summaryrefslogtreecommitdiff
path: root/patches/vba
diff options
context:
space:
mode:
Diffstat (limited to 'patches/vba')
-rw-r--r--patches/vba/Makefile.am1
-rw-r--r--patches/vba/ObjectModule.diff2061
-rw-r--r--patches/vba/api-application-caller.diff63
-rw-r--r--patches/vba/basic-allow-objectforerror-symbol.diff42
-rw-r--r--patches/vba/basic-caller-support.diff532
-rw-r--r--patches/vba/basic-ide-module-object-name-combile.diff98
-rw-r--r--patches/vba/basic-ide-objectmodule.diff41
-rw-r--r--patches/vba/basic-not-is-nothing.diff17
-rw-r--r--patches/vba/basic-public-dim-fix.diff115
-rw-r--r--patches/vba/basic-replace-function-fix.diff50
-rw-r--r--patches/vba/basic-speedup-fix.diff260
-rw-r--r--patches/vba/calc-vba-volatile-user-func.diff908
-rw-r--r--patches/vba/cws-vbasupportdev300.diff45014
-rw-r--r--patches/vba/cws-vbasupportdev300_m83-fix.diff168
-rw-r--r--patches/vba/cws-vbasupportdev300_m83.diff50376
-rw-r--r--patches/vba/enhanced-form-userform-controls.diff2031
-rw-r--r--patches/vba/eventhelper-closecrash-fix.diff135
-rw-r--r--patches/vba/fix-containercontrols-wizardresize.diff82
-rw-r--r--patches/vba/fix-doc-exit-basic-error-core.diff13
-rw-r--r--patches/vba/fix-name-range-separator.diff46
-rw-r--r--patches/vba/fix-read-disabled-toolbarimport.diff62
-rw-r--r--patches/vba/fix-sheet-control-valueset.diff72
-rw-r--r--patches/vba/fix-vba-NOT-trigger-update.diff87
-rw-r--r--patches/vba/fix-vba-late-docevent-crash.diff203
-rw-r--r--patches/vba/ibm-misc-fixes-1.diff1367
-rw-r--r--patches/vba/native-export/ObjectModule.diff2330
-rw-r--r--patches/vba/native-export/basic-ide-module-object-name-combile.diff110
-rw-r--r--patches/vba/native-export/vba-basic-macrochoose-dialog.diff913
-rw-r--r--patches/vba/native-export/vba-compatible-mode-uno.diff127
-rw-r--r--patches/vba/native-export/vba-ui-option.diff175
-rw-r--r--patches/vba/native-export/vba-userform-geometry-tweak.diff415
-rw-r--r--patches/vba/native-export/vbainfo-import-export-support-alternative-unkownstatus.diff2150
-rw-r--r--patches/vba/native-export/vbainfo-import-export-support.diff966
-rw-r--r--patches/vba/oovbaapi-disable-vba.diff90
-rw-r--r--patches/vba/oox-insert-module-bug.diff17
-rw-r--r--patches/vba/oox-projectname-oobuild-specifix.diff110
-rw-r--r--patches/vba/range-defaultmethod-i98476.diff13
-rw-r--r--patches/vba/range-listBox-compare.diff35
-rw-r--r--patches/vba/read-vba-dir-stream-fix.diff885
-rw-r--r--patches/vba/sc-hacky-handle-boolean.diff53
-rw-r--r--patches/vba/sc-source-ui-vba-makefile-mk.diff14
-rw-r--r--patches/vba/sc-vba-autofill-support.diff38
-rw-r--r--patches/vba/sc-vba-build-lst.diff11
-rw-r--r--patches/vba/sc-vbaimport-override-controlname.diff190
-rw-r--r--patches/vba/scp_vba_uno_service.diff23
-rw-r--r--patches/vba/spinbutton-import-valuechange.diff13
-rw-r--r--patches/vba/svx-source-form-fmscriptingenv-cxx.diff19
-rw-r--r--patches/vba/svx-source-form-fmundo-cxx.diff127
-rw-r--r--patches/vba/svx-source-form-makefile.diff18
-rw-r--r--patches/vba/svx-source-inc-fmundo-hxx.diff16
-rw-r--r--patches/vba/tool-menu-bar-improvements.diff1014
-rw-r--r--patches/vba/uno-xmenu-getpopupMenu-fix.diff48
-rw-r--r--patches/vba/userform-image-import-fix.diff48
-rw-r--r--patches/vba/vba-allow-arrays-in-usertypes.diff112
-rw-r--r--patches/vba/vba-allow-forms-resetvalue-binding.diff15
-rw-r--r--patches/vba/vba-allow-ranges-for-cell-functions.diff223
-rw-r--r--patches/vba/vba-always-set-defaultprop.diff15
-rw-r--r--patches/vba/vba-application-quit.diff183
-rw-r--r--patches/vba/vba-autofiltermode.diff275
-rwxr-xr-xpatches/vba/vba-automation-defaultmember.diff175
-rw-r--r--patches/vba/vba-automation-fix-named-paramaters.diff28
-rw-r--r--patches/vba/vba-automation-put-get-property-improvements.diff321
-rw-r--r--patches/vba/vba-automation-set-fix.diff85
-rw-r--r--patches/vba/vba-basic-if-compare-fix.diff11
-rw-r--r--patches/vba/vba-basic-macrochoose-dialog.diff831
-rw-r--r--patches/vba/vba-basic-not-fix.diff17
-rw-r--r--patches/vba/vba-basic-parallel-build.diff35
-rw-r--r--patches/vba/vba-buildin-toolbar-fix.diff81
-rw-r--r--patches/vba/vba-check-for-macro.diff311
-rw-r--r--patches/vba/vba-combobox-listindex-fix.diff68
-rw-r--r--patches/vba/vba-combobox-rowsource-fix.diff13
-rw-r--r--patches/vba/vba-commandbar-document-scope.diff252
-rw-r--r--patches/vba/vba-commandbar-enabled.diff52
-rw-r--r--patches/vba/vba-commandbar-fix.diff654
-rw-r--r--patches/vba/vba-commandbar-rework.diff2079
-rw-r--r--patches/vba/vba-commandbar-toolbar-fix.diff67
-rw-r--r--patches/vba/vba-commandbarcontrol-enabled.diff309
-rw-r--r--patches/vba/vba-compatible-mode-uno.diff277
-rw-r--r--patches/vba/vba-container-controls.diff7681
-rw-r--r--patches/vba/vba-ctb-fix-looponload.diff80
-rw-r--r--patches/vba/vba-currentcomponent-rework.diff1553
-rw-r--r--patches/vba/vba-cursor-pos-for-selected-maxrange.diff24
-rw-r--r--patches/vba/vba-datevalue-function-fix.diff22
-rw-r--r--patches/vba/vba-dim-as-contants-fix.diff193
-rw-r--r--patches/vba/vba-disable-toolbar+customizationimport.diff54
-rw-r--r--patches/vba/vba-documentcontext.diff101
-rw-r--r--patches/vba/vba-dont-load-for-odf.diff522
-rw-r--r--patches/vba/vba-empty-comparison-fix.diff11
-rw-r--r--patches/vba/vba-enable-fieldrelatedbits.diff27
-rw-r--r--patches/vba/vba-error-object.diff379
-rw-r--r--patches/vba/vba-excel-iserror-fix.diff168
-rw-r--r--patches/vba/vba-fallback-to-calling-doc-context.diff735
-rw-r--r--patches/vba/vba-financial-functions.diff813
-rw-r--r--patches/vba/vba-fireevents-from-apichange.diff472
-rw-r--r--patches/vba/vba-fix-IsEmpty-api-object.diff33
-rw-r--r--patches/vba/vba-fix-Range-Insert-CopyOrigin.diff33
-rw-r--r--patches/vba/vba-fix-basic-macro-organizer.diff40
-rw-r--r--patches/vba/vba-fix-checkbox-ole-access.diff13
-rw-r--r--patches/vba/vba-fix-control-shape-geom-fix.diff233
-rw-r--r--patches/vba/vba-fix-copysheet-toend.diff51
-rw-r--r--patches/vba/vba-fix-docmodule-import-crash.diff22
-rw-r--r--patches/vba/vba-fix-find-wraparound-onfail.diff18
-rw-r--r--patches/vba/vba-fix-ide-friendly-modulename.diff41
-rw-r--r--patches/vba/vba-fix-implicit-indexaccess.diff13
-rw-r--r--patches/vba/vba-fix-interesection.diff12
-rw-r--r--patches/vba/vba-fix-listboxhang-n560355.diff57
-rw-r--r--patches/vba/vba-fix-logical-precedence-order.diff161
-rw-r--r--patches/vba/vba-fix-macromode-api-docopen.diff27
-rw-r--r--patches/vba/vba-fix-missing-codename.diff424
-rw-r--r--patches/vba/vba-fix-named-any-para-pass.diff20
-rw-r--r--patches/vba/vba-fix-optionalparam-assigment.diff13
-rw-r--r--patches/vba/vba-fix-override-exportproblem.diff71
-rw-r--r--patches/vba/vba-fix-path-fullname.diff32
-rw-r--r--patches/vba/vba-fix-private-declare.diff60
-rw-r--r--patches/vba/vba-fix-range-delete-shift.diff42
-rw-r--r--patches/vba/vba-fix-scripting-parallelbuild.diff72
-rw-r--r--patches/vba/vba-fix-selection-dot-inproject.diff176
-rw-r--r--patches/vba/vba-fix-shapepic-hlinkmacro.diff41
-rw-r--r--patches/vba/vba-fix-userform-init.diff13
-rw-r--r--patches/vba/vba-fix-workbook-resize-core.diff234
-rw-r--r--patches/vba/vba-fix-worksheet-add-activate.diff15
-rw-r--r--patches/vba/vba-fix-worksheet-add-before-param-object.diff31
-rw-r--r--patches/vba/vba-fixerror-nonvba.diff25
-rw-r--r--patches/vba/vba-fixup-macrosearch.diff1581
-rw-r--r--patches/vba/vba-fixup-singlerange-sheetref.diff62
-rw-r--r--patches/vba/vba-fixup-vbasupportcws.diff123
-rw-r--r--patches/vba/vba-ide-choose-macro-to-run.diff32
-rw-r--r--patches/vba/vba-import-and-use-localrangenames.diff144
-rw-r--r--patches/vba/vba-import-globaltemplate-customizations.diff231
-rw-r--r--patches/vba/vba-import-xlsm.diff796
-rw-r--r--patches/vba/vba-improve-toolbarapi-macro-search.diff61
-rw-r--r--patches/vba/vba-interior-object-fix.diff52
-rw-r--r--patches/vba/vba-keyword-fix.diff116
-rw-r--r--patches/vba/vba-macro-properties.diff117
-rw-r--r--patches/vba/vba-menubar-objects.diff1732
-rw-r--r--patches/vba/vba-misc-tweakupstream-m2.diff36
-rw-r--r--patches/vba/vba-misc-tweakupstream.diff54
-rw-r--r--patches/vba/vba-msvbahelper-splitbuilt.diff1767
-rw-r--r--patches/vba/vba-multipage-fireapichange.diff29
-rw-r--r--patches/vba/vba-noregrex-for-match.diff34
-rw-r--r--patches/vba/vba-not-param-withoutbrackets.diff11
-rw-r--r--patches/vba/vba-null-not-treatment.diff87
-rw-r--r--patches/vba/vba-only-import-std-menutoolbar.diff14
-rw-r--r--patches/vba/vba-oovbaapi-parallel-build.diff23
-rw-r--r--patches/vba/vba-oox-autocodename.diff225
-rw-r--r--patches/vba/vba-oox-olenameoverride.diff446
-rw-r--r--patches/vba/vba-override-base-vbaevents.diff198
-rw-r--r--patches/vba/vba-parallel-build.diff79
-rw-r--r--patches/vba/vba-rangecell-colparam.diff75
-rw-r--r--patches/vba/vba-redim-array-fix.diff92
-rw-r--r--patches/vba/vba-reenable-cwssheetproctectbits.diff35
-rw-r--r--patches/vba/vba-reenable-rowsourcefixes.diff13
-rw-r--r--patches/vba/vba-reset-screenupdateing.diff69
-rw-r--r--patches/vba/vba-servicemacros-rework.diff251
-rw-r--r--patches/vba/vba-show-data-form-link-fix.diff13
-rw-r--r--patches/vba/vba-spinbutton-in-userform.diff344
-rw-r--r--patches/vba/vba-styles-add-fix.diff34
-rw-r--r--patches/vba/vba-support-export-palette.diff95
-rw-r--r--patches/vba/vba-support-properties-inmodules.diff145
-rw-r--r--patches/vba/vba-support-stoc-typeprovider-xexactname.diff372
-rw-r--r--patches/vba/vba-templateobject.diff579
-rw-r--r--patches/vba/vba-testclient-fix-project.diff23
-rw-r--r--patches/vba/vba-thiscomponent-fix.diff58
-rw-r--r--patches/vba/vba-toolbar-menu-support.diff1469
-rw-r--r--patches/vba/vba-toolbar-menufilter-core-fix.diff22
-rw-r--r--patches/vba/vba-transient-imported-autotext.diff543
-rw-r--r--patches/vba/vba-tweak-errorobj.diff472
-rw-r--r--patches/vba/vba-typename-fix.diff94
-rw-r--r--patches/vba/vba-use-ooxfilter-forcontrols.diff615
-rw-r--r--patches/vba/vba-userform-geometry-tweak.diff394
-rw-r--r--patches/vba/vba-userform.diff395
-rw-r--r--patches/vba/vba-variant-fix.diff13
-rw-r--r--patches/vba/vba-vpagebreak-object.diff445
-rw-r--r--patches/vba/vba-word-executable-option.diff351
-rw-r--r--patches/vba/vba-word-support-m4.diff15050
-rw-r--r--patches/vba/vba-word-support-part2.diff23674
-rw-r--r--patches/vba/vba-word-support.diff30509
-rw-r--r--patches/vba/vba-workbook-auto-open-event.diff67
-rw-r--r--patches/vba/vba-workbook-precisionasdisplayed.diff60
-rw-r--r--patches/vba/vba-workbook-worksheet-events.diff2227
-rw-r--r--patches/vba/vba-worksheet-calculate-event-fix.diff141
-rw-r--r--patches/vba/vba-worksheet-change-event-fix.diff148
-rw-r--r--patches/vba/vba-worksheet-copy-otherdoc-api-support.diff207
-rw-r--r--patches/vba/vba-worksheet-enableselection.diff116
-rw-r--r--patches/vba/vba-xls-formula-parser.diff48
-rw-r--r--patches/vba/vba-zoom-per-sheet.diff273
-rw-r--r--patches/vba/vbaevents-services-build.diff19
-rw-r--r--patches/vba/vbaevents-services-sources.diff2074
-rw-r--r--patches/vba/vbahelper-link-with-oox.diff10
-rw-r--r--patches/vba/vbahelper-no-oox.diff48
-rw-r--r--patches/vba/vbasupport-patch-roll-up.diff1005
191 files changed, 0 insertions, 225896 deletions
diff --git a/patches/vba/Makefile.am b/patches/vba/Makefile.am
deleted file mode 100644
index 0b280d2c7..000000000
--- a/patches/vba/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-EXTRA_DIST = $(wildcard *.diff)
diff --git a/patches/vba/ObjectModule.diff b/patches/vba/ObjectModule.diff
deleted file mode 100644
index 3f7b9b847..000000000
--- a/patches/vba/ObjectModule.diff
+++ /dev/null
@@ -1,2061 +0,0 @@
---- basctl/source/basicide/basides1.cxx.old 2009-04-02 10:56:36.000000000 +0000
-+++ basctl/source/basicide/basides1.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -1201,10 +1201,16 @@ IDEBaseWindow* BasicIDEShell::FindWindow
- // return any non-suspended window
- return pWin;
- }
-- else if ( pWin->IsDocument( rDocument ) && pWin->GetLibName() == rLibName && pWin->GetName() == rName &&
-+ else if ( pWin->IsDocument( rDocument ) )
-+ {
-+ OSL_TRACE("FindWindow pWin->GetLibName() %s rLibName %s",
-+ rtl::OUStringToOString( pWin->GetLibName(), RTL_TEXTENCODING_UTF8 ).getStr(),
-+ rtl::OUStringToOString( rLibName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ OSL_TRACE("pWin->pWin->IsA( TYPE( ModulWindow ) %d && nType %d = BASICIDE_TYPE_MODULE %d", pWin->IsA( TYPE( ModulWindow ) ), nType, BASICIDE_TYPE_MODULE );
-+ OSL_TRACE("pWin->pWin->IsA( TYPE( DialogWindow ) %d && nType %d = BASICIDE_TYPE_DIALOG %d", pWin->IsA( TYPE( DialogWindow ) ), nType, BASICIDE_TYPE_DIALOG );
-+ if ( pWin->GetLibName() == rLibName && pWin->GetName() == rName &&
- ( ( pWin->IsA( TYPE( ModulWindow ) ) && nType == BASICIDE_TYPE_MODULE ) ||
- ( pWin->IsA( TYPE( DialogWindow ) ) && nType == BASICIDE_TYPE_DIALOG ) ) )
-- {
- return pWin;
- }
- }
---- basctl/source/basicide/basides2.cxx.old 2009-04-02 10:56:36.000000000 +0000
-+++ basctl/source/basicide/basides2.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -251,9 +251,12 @@ ModulWindow* BasicIDEShell::CreateBasWin
-
- if ( bSuccess )
- {
-- // new module window
-- pWin = new ModulWindow( pModulLayout, rDocument, aLibName, aModName, aModule );
-- nKey = InsertWindowInTable( pWin );
-+ pWin = FindBasWin( rDocument, aLibName, aModName, FALSE, TRUE );
-+ if( !pWin )
-+ { // new module window
-+ pWin = new ModulWindow( pModulLayout, rDocument, aLibName, aModName, aModule );
-+ nKey = InsertWindowInTable( pWin );
-+ }
- }
- }
- else
-@@ -268,7 +271,8 @@ ModulWindow* BasicIDEShell::CreateBasWin
- }
- DBG_ASSERT( nKey, "CreateBasWin: Kein Key- Fenster nicht gefunden!" );
- }
-- pTabBar->InsertPage( (USHORT)nKey, aModName );
-+ if( nKey )
-+ pTabBar->InsertPage( (USHORT)nKey, aModName );
- pTabBar->Sort();
- pWin->GrabScrollBars( &aHScrollBar, &aVScrollBar );
- if ( !pCurWin )
---- basctl/source/basicide/basidesh.cxx.old 2009-04-02 10:56:36.000000000 +0000
-+++ basctl/source/basicide/basidesh.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -80,6 +80,9 @@
- #include <com/sun/star/script/XLibraryContainer.hpp>
- #include <com/sun/star/script/XLibraryContainerPassword.hpp>
- #include <com/sun/star/container/XNameContainer.hpp>
-+#include <com/sun/star/container/XContainer.hpp>
-+#include <com/sun/star/container/XContainerListener.hpp>
-+#include <com/sun/star/script/XLibraryContainer.hpp>
-
- #include <svx/xmlsecctrl.hxx>
-
-@@ -87,6 +90,71 @@ using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star;
- using ::rtl::OUString;
-
-+static const rtl::OUString sStandardLibName( rtl::OUString::createFromAscii("Standard") );
-+
-+typedef ::cppu::WeakImplHelper1< container::XContainerListener > ContainerListenerBASE;
-+
-+class ContainerListenerImpl : public ContainerListenerBASE
-+{
-+ BasicIDEShell* mpShell;
-+public:
-+
-+ ContainerListenerImpl( BasicIDEShell* pShell ) : mpShell( pShell ) {}
-+
-+ ~ContainerListenerImpl()
-+ {
-+ }
-+
-+ void addContainerListener( const ScriptDocument& rScriptDocument )
-+ {
-+ uno::Reference< container::XContainer > xContainer( rScriptDocument.getLibrary( E_SCRIPTS, sStandardLibName, FALSE ), uno::UNO_QUERY );
-+ if ( rScriptDocument.isDocument() && xContainer.is() )
-+ {
-+ uno::Reference< container::XContainerListener > xContainerListener( this );
-+ try
-+ {
-+ xContainer->addContainerListener( xContainerListener );
-+ }
-+ catch( uno::Exception& ) {}
-+ }
-+ }
-+ void removeContainerListener( const ScriptDocument& rScriptDocument )
-+ {
-+ uno::Reference< container::XContainer > xContainer( rScriptDocument.getLibrary( E_SCRIPTS, sStandardLibName, FALSE ), uno::UNO_QUERY );
-+ if ( rScriptDocument.isDocument(), xContainer.is() )
-+ {
-+ uno::Reference< container::XContainerListener > xContainerListener( this );
-+ try
-+ {
-+ xContainer->removeContainerListener( xContainerListener );
-+ }
-+ catch( uno::Exception& ) {}
-+ }
-+ }
-+
-+ // XEventListener
-+ virtual void SAL_CALL disposing( const lang::EventObject& ) throw( uno::RuntimeException ) {}
-+
-+ // XContainerListener
-+ virtual void SAL_CALL elementInserted( const container::ContainerEvent& Event ) throw( uno::RuntimeException )
-+ {
-+ rtl::OUString sModuleName;
-+ if( mpShell && ( Event.Accessor >>= sModuleName ) )
-+ mpShell->FindBasWin( mpShell->m_aCurDocument, sStandardLibName, sModuleName, TRUE, FALSE );
-+ }
-+ virtual void SAL_CALL elementReplaced( const container::ContainerEvent& ) throw( com::sun::star::uno::RuntimeException ) { }
-+ virtual void SAL_CALL elementRemoved( const container::ContainerEvent& Event ) throw( com::sun::star::uno::RuntimeException )
-+ {
-+ rtl::OUString sModuleName;
-+ if( mpShell && ( Event.Accessor >>= sModuleName ) )
-+ {
-+ IDEBaseWindow* pWin = mpShell->FindWindow( mpShell->m_aCurDocument, sStandardLibName, sModuleName, BASICIDE_TYPE_MODULE, TRUE );
-+ if( pWin )
-+ mpShell->RemoveWindow( pWin, FALSE, TRUE );
-+ }
-+ }
-+
-+};
-
- TYPEINIT1( BasicIDEShell, SfxViewShell );
-
-@@ -124,6 +192,7 @@ BasicIDEShell::BasicIDEShell( SfxViewFra
- m_bAppBasicModified( FALSE ),
- m_aNotifier( *this )
- {
-+ m_xLibListener = new ContainerListenerImpl( this );
- Init();
- GnBasicIDEShellCount++;
- }
-@@ -215,6 +284,12 @@ __EXPORT BasicIDEShell::~BasicIDEShell()
- delete pTabBar;
- delete pObjectCatalog;
- DestroyModulWindowLayout();
-+
-+ ContainerListenerImpl* pListener = dynamic_cast< ContainerListenerImpl* >( m_xLibListener.get() );
-+ // Destroy all ContainerListeners for Basic Container.
-+ if ( pListener )
-+ pListener->removeContainerListener( m_aCurDocument );
-+
- // MI: Das gab einen GPF im SDT beim Schliessen da dann der ViewFrame die
- // ObjSh loslaesst. Es wusste auch keiner mehr wozu das gut war.
- // GetViewFrame()->GetObjectShell()->Broadcast( SfxSimpleHint( SFX_HINT_DYING ) );
-@@ -921,7 +996,15 @@ void BasicIDEShell::SetCurLib( const Scr
- {
- if ( !bCheck || ( rDocument != m_aCurDocument || aLibName != m_aCurLibName ) )
- {
-+ ContainerListenerImpl* pListener = dynamic_cast< ContainerListenerImpl* >( m_xLibListener.get() );
-+ if ( pListener )
-+ pListener->removeContainerListener( m_aCurDocument );
-+
- m_aCurDocument = rDocument;
-+
-+ if ( pListener )
-+ pListener->addContainerListener( m_aCurDocument );
-+
- m_aCurLibName = aLibName;
- if ( bUpdateWindows )
- UpdateWindows();
---- basctl/source/basicide/scriptdocument.cxx.old 2009-04-06 16:41:59.000000000 +0000
-+++ basctl/source/basicide/scriptdocument.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -56,6 +56,7 @@
- #include <com/sun/star/frame/XModel2.hpp>
- #include <com/sun/star/awt/XWindow2.hpp>
- #include <com/sun/star/document/XEmbeddedScripts.hpp>
-+#include <com/sun/star/script/ModuleInfo.hpp>
- /** === end UNO includes === **/
-
- #include <sfx2/objsh.hxx>
-@@ -142,6 +143,7 @@ namespace basctl
- using ::com::sun::star::uno::RuntimeException;
- using ::com::sun::star::document::XEventBroadcaster;
- using ::com::sun::star::document::XEmbeddedScripts;
-+ using ::com::sun::star::script::ModuleInfo;
- /** === end UNO using === **/
- namespace MacroExecMode = ::com::sun::star::document::MacroExecMode;
- namespace FrameSearchFlag = ::com::sun::star::frame::FrameSearchFlag;
-@@ -674,6 +676,15 @@ namespace basctl
- }
-
- // insert element by new name in container
-+ if ( _eType == E_SCRIPTS )
-+ {
-+ ModuleInfo sModuleInfo;
-+ if ( aElement >>= sModuleInfo )
-+ {
-+ sModuleInfo.ModuleName = _rNewName;
-+ aElement <<= sModuleInfo;
-+ }
-+ }
- xLib->insertByName( _rNewName, aElement );
- return true;
- }
-@@ -738,8 +749,16 @@ namespace basctl
- Reference< XNameContainer > xLib( getOrCreateLibrary( E_SCRIPTS, _rLibName ), UNO_QUERY_THROW );
- if ( !xLib->hasByName( _rModName ) )
- return false;
--
-- xLib->replaceByName( _rModName, makeAny( _rModuleCode ) );
-+ ModuleInfo mInfo;
-+ Any aMod;
-+ if ( xLib->getByName( _rModName ) >>= mInfo )
-+ {
-+ mInfo.ModuleSource = _rModuleCode;
-+ aMod <<= mInfo;
-+ }
-+ else
-+ aMod <<= _rModuleCode;
-+ xLib->replaceByName( _rModName, aMod );
- return true;
- }
- catch( const Exception& )
-@@ -1392,7 +1411,15 @@ namespace basctl
- Any aCode;
- if ( !m_pImpl->getModuleOrDialog( E_SCRIPTS, _rLibName, _rModName, aCode ) )
- return false;
-- OSL_VERIFY( aCode >>= _out_rModuleSource );
-+ ModuleInfo sModuleInfo;
-+ if ( aCode >>= sModuleInfo )
-+ {
-+ _out_rModuleSource = sModuleInfo.ModuleSource;
-+ }
-+ else
-+ {
-+ OSL_VERIFY( aCode >>= _out_rModuleSource );
-+ }
- return true;
- }
-
---- basctl/source/inc/basidesh.hxx.old 2009-04-02 10:56:36.000000000 +0000
-+++ basctl/source/inc/basidesh.hxx 2009-04-06 16:41:59.000000000 +0000
-@@ -49,6 +49,7 @@
- #include <com/sun/star/io/XInputStreamProvider.hpp>
- #endif
-
-+#include <com/sun/star/container/XContainerListener.hpp>
-
- //----------------------------------------------------------------------------
-
-@@ -107,6 +108,8 @@ friend bool BasicIDE::RemoveDialog( cons
- BOOL m_bAppBasicModified;
- ::basctl::DocumentEventNotifier
- m_aNotifier;
-+friend class ContainerListenerImpl;
-+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener > m_xLibListener;
-
- #if _SOLAR__PRIVATE
- void Init();
---- basic/inc/basic/sbmod.hxx.old 2009-04-06 16:41:59.000000000 +0000
-+++ basic/inc/basic/sbmod.hxx 2009-04-06 16:41:59.000000000 +0000
-@@ -37,7 +37,7 @@
- #ifndef _RTL_USTRING_HXX
- #include <rtl/ustring.hxx>
- #endif
--
-+#include <com/sun/star/script/ModuleType.hpp>
- class SbMethod;
- class SbProperty;
- class SbiRuntime;
-@@ -67,6 +67,9 @@ protected:
- SbiBreakpoints* pBreaks; // Breakpoints
- SbClassData* pClassData;
- bool mbVBACompat;
-+ INT32 mnType;
-+ SbxObjectRef pDocObject; // an impl object ( used by Document Modules )
-+ bool bIsProxyModule;
-
- void StartDefinitions();
- SbMethod* GetMethod( const String&, SbxDataType );
-@@ -91,7 +94,7 @@ protected:
- public:
- SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_BASICMOD,2);
- TYPEINFO();
-- SbModule( const String& );
-+ SbModule( const String&, bool bCompat = false );
- virtual void SetParent( SbxObject* );
- virtual void Clear();
-
-@@ -127,8 +130,12 @@ public:
- BOOL LoadBinaryData( SvStream& );
- BOOL ExceedsLegacyModuleSize();
- void fixUpMethodStart( bool bCvtToLegacy, SbiImage* pImg = NULL ) const;
-- bool IsVBACompat() { return mbVBACompat; }
- bool HasExeCode();
-+ bool IsVBACompat();
-+ void SetVBACompat( bool bCompat );
-+ INT32 GetModuleType() { return mnType; }
-+ void SetModuleType( INT32 nType ) { mnType = nType; }
-+ bool GetIsProxyModule() { return bIsProxyModule; }
- };
-
- #ifndef __SB_SBMODULEREF_HXX
---- basic/inc/basic/sbobjmod.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ basic/inc/basic/sbobjmod.hxx 2009-04-06 16:41:59.000000000 +0000
-@@ -0,0 +1,66 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: sbobjmod.hxx,v $
-+ *
-+ * $Revision: 1.4 $
-+ *
-+ * last change: $Author: $ $Date: 2007/08/27 16:31:39 $
-+ *
-+ * 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 _SB_OBJMOD_HXX
-+#define _SB_OBJMOD_HXX
-+
-+#include <basic/sbmod.hxx>
-+#include <basic/sbstar.hxx>
-+#include <com/sun/star/script/ModuleInfo.hpp>
-+#include <com/sun/star/lang/XEventListener.hpp>
-+#include <com/sun/star/awt/XDialog.hpp>
-+
-+namespace css = ::com::sun::star;
-+
-+// Basic-Module for excel object.
-+
-+class SbObjModule : public SbModule
-+{
-+public:
-+ TYPEINFO();
-+ SbObjModule( const com::sun::star::script::ModuleInfo& mInfo, bool bIsVbaCompatible );
-+ virtual SbxVariable* Find( const XubString& rName, SbxClassType t );
-+ SbxVariable* GetObject();
-+ void SetUnoObject( const com::sun::star::uno::Any& aObj )throw ( com::sun::star::uno::RuntimeException ) ;
-+};
-+
-+#ifndef __SB_SBOBJMODULEREF_HXX
-+#define __SB_SBOBJMODULEREF_HXX
-+
-+SV_DECL_IMPL_REF(SbObjModule);
-+
-+#endif
-+#endif
-+
---- basic/inc/basic/sbstar.hxx
-+++ basic/inc/basic/sbstar.hxx
-@@ -40,6 +40,7 @@
-
- #include <basic/sbdef.hxx>
- #include <basic/sberrors.hxx>
-+#include <com/sun/star/script/ModuleInfo.hpp>
-
- class SbModule; // completed module
- class SbiInstance; // runtime instance
-@@ -71,6 +72,7 @@ class StarBASIC : public SbxObject
- BOOL bNoRtl; // if TRUE: do not search RTL
- BOOL bBreak; // if TRUE: Break, otherwise Step
- BOOL bDocBasic;
-+ BOOL bVBAEnabled;
- BasicLibInfo* pLibInfo; // Info block for basic manager
- SbLanguageMode eLanguageMode; // LanguageMode of the basic object
- protected:
-@@ -113,7 +115,8 @@ public:
-
- // Compiler-Interface
- SbModule* MakeModule( const String& rName, const String& rSrc );
-- SbModule* MakeModule32( const String& rName, const ::rtl::OUString& rSrc );
-+ SbModule* MakeModule32( const String& rName, const ::rtl::OUString& rSrc );
-+ SbModule* MakeModule32( const com::sun::star::script::ModuleInfo& mInfo );
- BOOL Compile( SbModule* );
- BOOL Disassemble( SbModule*, String& rText );
- static void Stop();
-@@ -185,6 +188,8 @@ public:
- ( const String& rName, USHORT& rStatus );
- static SbMethod* GetActiveMethod( USHORT nLevel = 0 );
- static SbModule* GetActiveModule();
-+ void SetVBAEnabled( BOOL bEnabled );
-+ BOOL isVBAEnabled();
-
- // #60175 TRUE: SFX-Resource is not displayed on basic errors
- static void StaticSuppressSfxResource( BOOL bSuppress );
---- basic/source/basmgr/basmgr.cxx.old 2009-04-06 16:41:59.000000000 +0000
-+++ basic/source/basmgr/basmgr.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -44,6 +44,7 @@
- #include <tools/debug.hxx>
- #include <tools/diagnose_ex.h>
- #include <basic/sbmod.hxx>
-+#include <basic/sbobjmod.hxx>
-
- #include <basic/sbuno.hxx>
- #include <basic/basmgr.hxx>
-@@ -67,6 +68,8 @@
- #include <com/sun/star/script/XStarBasicDialogInfo.hpp>
- #include <com/sun/star/script/XStarBasicLibraryInfo.hpp>
- #include <com/sun/star/script/XLibraryContainerPassword.hpp>
-+#include <com/sun/star/script/ModuleInfo.hpp>
-+#include <com/sun/star/script/ModuleType.hpp>
-
- #include <cppuhelper/implbase1.hxx>
-
-@@ -243,9 +246,18 @@ void BasMgrContainerListenerImpl::addLib
- {
- ::rtl::OUString aModuleName = pNames[ j ];
- Any aElement = xLibNameAccess->getByName( aModuleName );
-- ::rtl::OUString aMod;
-- aElement >>= aMod;
-- pLib->MakeModule32( aModuleName, aMod );
-+ ModuleInfo mInfo;
-+ if ( aElement >>= mInfo )
-+ {
-+ OSL_TRACE("#addLibraryModulesImpl - aMod");
-+ pLib->MakeModule32( mInfo );
-+ }
-+ else
-+ {
-+ ::rtl::OUString aMod;
-+ aElement >>= aMod;
-+ pLib->MakeModule32( aModuleName, aMod );
-+ }
- }
- }
-
-@@ -282,8 +294,6 @@ void SAL_CALL BasMgrContainerListenerImp
- }
- else
- {
-- ::rtl::OUString aMod;
-- Event.Element >>= aMod;
-
- StarBASIC* pLib = mpMgr->GetLib( maLibName );
- DBG_ASSERT( pLib, "BasMgrContainerListenerImpl::elementInserted: Unknown lib!");
-@@ -292,7 +302,17 @@ void SAL_CALL BasMgrContainerListenerImp
- SbModule* pMod = pLib->FindModule( aName );
- if( !pMod )
- {
-- pLib->MakeModule32( aName, aMod );
-+ ModuleInfo mInfo;
-+ if( Event.Element >>= mInfo )
-+ {
-+ pLib->MakeModule32( mInfo );
-+ }
-+ else
-+ {
-+ ::rtl::OUString aMod;
-+ Event.Element >>= aMod;
-+ pLib->MakeModule32( aName, aMod );
-+ }
- pLib->SetModified( FALSE );
- }
- }
-@@ -316,15 +336,35 @@ void SAL_CALL BasMgrContainerListenerImp
- DBG_ASSERT( !bLibContainer, "library container fired elementReplaced()");
-
- StarBASIC* pLib = mpMgr->GetLib( maLibName );
-+
- if( pLib )
- {
-- SbModule* pMod = pLib->FindModule( aName );
-+ SbModule* pMod = pLib->FindModule( aName );
- ::rtl::OUString aMod;
-- Event.Element >>= aMod;
-+ ModuleInfo mInfo;
-+ if( Event.Element >>= mInfo )
-+ aMod = mInfo.ModuleSource;
-+ else
-+ Event.Element >>= aMod;
- if( pMod )
-+ {
- pMod->SetSource32( aMod );
-- else
-- pLib->MakeModule32( aName, aMod );
-+ if ( mInfo.ModuleType == ModuleType::Document )
-+ {
-+ SbObjModule* pObjModule = dynamic_cast< SbObjModule* >( pMod );
-+ if ( pObjModule )
-+ pObjModule->SetUnoObject( makeAny( mInfo.ModuleObject ) );
-+ }
-+ }
-+ else
-+ // Probably we should have an assert for
-+ // unknow module type, e.g. either we are using
-+ // the ModuleInfo structure ( vba ) for *all* modules
-+ // or not ( normal )
-+ if ( mInfo.ModuleType == ModuleType::Unknown )
-+ pLib->MakeModule32( aName, aMod );
-+ else
-+ pLib->MakeModule32( mInfo );
-
- pLib->SetModified( FALSE );
- }
---- basic/source/classes/sb.cxx
-+++ basic/source/classes/sb.cxx
-@@ -52,12 +52,17 @@
- #include "disas.hxx"
- #include "runtime.hxx"
- #include <basic/sbuno.hxx>
-+#include <basic/sbobjmod.hxx>
- #include "stdobj.hxx"
- #include "filefmt.hxx"
- #include "sb.hrc"
- #include <basrid.hxx>
- #include <vos/mutex.hxx>
-
-+#include <com/sun/star/script/ModuleType.hpp>
-+#include <com/sun/star/script/ModuleInfo.hpp>
-+using namespace ::com::sun::star::script;
-+
- // #pragma SW_SEGMENT_CLASS( SBASIC, SBASIC_CODE )
-
- SV_IMPL_VARARR(SbTextPortions,SbTextPortion)
-@@ -249,6 +254,8 @@ SbxObject* SbiFactory::CreateObject( con
- else
- if( rClass.EqualsIgnoreCaseAscii( "Collection" ) )
- {
-+ // Only variables qualified by the Module Name e.g. Sheet1.foo
-+ // should work for Documant && Class type Modules
- String aCollectionName( RTL_CONSTASCII_USTRINGPARAM("Collection") );
- return new BasicCollection( aCollectionName );
- }
-@@ -447,6 +454,7 @@ SbClassModuleObject::SbClassModuleObject
- }
- }
- }
-+ SetModuleType( com::sun::star::script::ModuleType::Class );
- }
-
- SbClassModuleObject::~SbClassModuleObject()
-@@ -582,6 +590,7 @@ StarBASIC::StarBASIC( StarBASIC* p, BOOL
- SetParent( p );
- pLibInfo = NULL;
- bNoRtl = bBreak = FALSE;
-+ bVBAEnabled = FALSE;
- pModules = new SbxArray;
-
- if( !GetSbData()->nInst++ )
-@@ -684,12 +693,38 @@ SbModule* StarBASIC::MakeModule( const S
-
- SbModule* StarBASIC::MakeModule32( const String& rName, const ::rtl::OUString& rSrc )
- {
-- SbModule* p = new SbModule( rName );
-- p->SetSource32( rSrc );
-+ ModuleInfo mInfo;
-+ mInfo.ModuleSource = rSrc;
-+ mInfo.ModuleType = ModuleType::Normal;
-+ mInfo.ModuleName = rName;
-+ return MakeModule32( mInfo );
-+}
-+SbModule* StarBASIC::MakeModule32( const ModuleInfo& mInfo )
-+{
-+
-+ OSL_TRACE("create module %s type mInfo %d", rtl::OUStringToOString( mInfo.ModuleName, RTL_TEXTENCODING_UTF8 ).getStr(), mInfo.ModuleType );
-+ SbModule* p = NULL;
-+ switch ( mInfo.ModuleType )
-+ {
-+ case ModuleType::Document:
-+ // In theory we should be able to create Object modules
-+ // in ordinary basic ( in vba mode thought these are create
-+ // by the application/basic and not by the user )
-+ p = new SbObjModule( mInfo, isVBAEnabled() );
-+ break;
-+ case ModuleType::Class:
-+ p = new SbModule( mInfo.ModuleName, isVBAEnabled() );
-+ p->SetModuleType( com::sun::star::script::ModuleType::Class );
-+ break;
-+ default:
-+ p = new SbModule( mInfo.ModuleName, isVBAEnabled() );
-+
-+ }
-+ p->SetSource32( mInfo.ModuleSource );
- p->SetParent( this );
- pModules->Insert( p, pModules->Count() );
- SetModified( TRUE );
-- return p;
-+ return p;
- }
-
- void StarBASIC::Insert( SbxVariable* pVar )
-@@ -863,6 +898,12 @@ SbxVariable* StarBASIC::Find( const Stri
- }
- pNamed = p;
- }
-+ // Only variables qualified by the Module Name e.g. Sheet1.foo
-+ // should work for Documant && Class type Modules
-+ INT32 nType = p->GetModuleType();
-+ //if ( nType == com::sun::star::script::ModuleType::Class || nType == com::sun::star::script::ModuleType::Document )
-+ if ( nType == com::sun::star::script::ModuleType::Document )
-+ continue;
- // otherwise check if the element is available
- // unset GBLSEARCH-Flag (due to Rekursion)
- USHORT nGblFlag = p->GetFlags() & SBX_GBLSEARCH;
---- basic/source/classes/sbxmod.cxx.old 2009-04-06 16:41:59.000000000 +0000
-+++ basic/source/classes/sbxmod.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -55,6 +55,8 @@
-
- #include <basic/basrdll.hxx>
- #include <vos/mutex.hxx>
-+#include <basic/sbobjmod.hxx>
-+#include <com/sun/star/lang/XServiceInfo.hpp>
-
-
- // for the bsearch
-@@ -70,6 +72,17 @@
-
- #include <stdio.h>
-
-+#include <comphelper/processfactory.hxx>
-+#include <com/sun/star/script/XLibraryContainer.hpp>
-+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-+#include <com/sun/star/awt/XDialogProvider.hpp>
-+#include <com/sun/star/awt/XTopWindow.hpp>
-+#include <com/sun/star/awt/XControl.hpp>
-+#include <com/sun/star/frame/XModel.hpp>
-+#include <cppuhelper/implbase1.hxx>
-+#include <comphelper/anytostring.hxx>
-+
-+using namespace ::com::sun::star;
-
- TYPEINIT1(SbModule,SbxObject)
- TYPEINIT1(SbMethod,SbxMethod)
-@@ -77,6 +90,7 @@ TYPEINIT1(SbProperty,SbxProperty)
- TYPEINIT1(SbProcedureProperty,SbxProperty)
- TYPEINIT1(SbJScriptModule,SbModule)
- TYPEINIT1(SbJScriptMethod,SbMethod)
-+TYPEINIT1(SbObjModule,SbModule)
-
- SV_DECL_VARARR(SbiBreakpoints,USHORT,4,4)
- SV_IMPL_VARARR(SbiBreakpoints,USHORT)
-@@ -90,12 +104,13 @@ SV_IMPL_VARARR(HighlightPortions, Highli
- // Ein BASIC-Modul hat EXTSEARCH gesetzt, damit die im Modul enthaltenen
- // Elemente von anderen Modulen aus gefunden werden koennen.
-
--SbModule::SbModule( const String& rName )
-+SbModule::SbModule( const String& rName, bool bVBACompat )
- : SbxObject( String( RTL_CONSTASCII_USTRINGPARAM("StarBASICModule") ) ),
-- pImage( NULL ), pBreaks( NULL ), pClassData( NULL ), mbVBACompat( false )
-+ pImage( NULL ), pBreaks( NULL ), pClassData( NULL ), mbVBACompat( bVBACompat ), pDocObject( NULL ), bIsProxyModule( false )
- {
- SetName( rName );
- SetFlag( SBX_EXTSEARCH | SBX_GBLSEARCH );
-+ SetModuleType( com::sun::star::script::ModuleType::Normal );
- }
-
- SbModule::~SbModule()
-@@ -270,7 +285,10 @@ void SbModule::Clear()
-
- SbxVariable* SbModule::Find( const XubString& rName, SbxClassType t )
- {
-+ // make sure a search in an uninstatiated class module will fail
- SbxVariable* pRes = SbxObject::Find( rName, t );
-+ if ( bIsProxyModule )
-+ return NULL;
- if( !pRes && pImage )
- {
- SbiInstance* pInst = pINST;
-@@ -430,6 +448,7 @@ void SbModule::SetSource32( const ::rtl:
- aOUSource = r;
- StartDefinitions();
- SbiTokenizer aTok( r );
-+ aTok.SetCompatible( IsVBACompat() );
- while( !aTok.IsEof() )
- {
- SbiToken eEndTok = NIL;
-@@ -454,14 +473,6 @@ void SbModule::SetSource32( const ::rtl:
- {
- eEndTok = ENDPROPERTY; break;
- }
-- if( eCurTok == OPTION )
-- {
-- eCurTok = aTok.Next();
-- mbVBACompat = ( eCurTok == VBASUPPORT ) && ( aTok.Next() == NUMBER ) && ( aTok.GetDbl()== 1 );
-- if( eCurTok == COMPATIBLE
-- || mbVBACompat )
-- aTok.SetCompatible( true );
-- }
- }
- eLastTok = eCurTok;
- }
-@@ -600,10 +611,19 @@ void ClearUnoObjectsInRTL_Impl( StarBASI
- if( ((StarBASIC*)p) != pBasic )
- ClearUnoObjectsInRTL_Impl_Rek( (StarBASIC*)p );
- }
-+bool SbModule::IsVBACompat()
-+{
-+ return mbVBACompat;
-+}
-
-+void SbModule::SetVBACompat( bool bCompat )
-+{
-+ mbVBACompat = bCompat;
-+}
- // Ausfuehren eines BASIC-Unterprogramms
- USHORT SbModule::Run( SbMethod* pMeth )
- {
-+ OSL_TRACE("About to run %s, vba compatmode is %d", rtl::OUStringToOString( pMeth->GetName(), RTL_TEXTENCODING_UTF8 ).getStr(), mbVBACompat );
- static USHORT nMaxCallLevel = 0;
- static String aMSOMacroRuntimeLibName = String::CreateFromAscii( "Launcher" );
- static String aMSOMacroRuntimeAppSymbol = String::CreateFromAscii( "Application" );
-@@ -695,10 +715,10 @@ USHORT SbModule::Run( SbMethod* pMeth )
- if( pRt->pNext )
- pRt->pNext->block();
- pINST->pRun = pRt;
-- if ( SbiRuntime ::isVBAEnabled() )
-+ if ( mbVBACompat )
- {
- pINST->EnableCompatibility( TRUE );
-- pRt->SetVBAEnabled( true );
-+ //pRt->SetVBAEnabled( true ); // can we get rid of this
- }
- while( pRt->Step() ) {}
- if( pRt->pNext )
-@@ -1273,7 +1293,6 @@ BOOL SbModule::LoadBinaryData( SvStream&
- return bRet;
- }
-
--
- BOOL SbModule::LoadCompleted()
- {
- SbxArray* p = GetMethods();
-@@ -1513,6 +1532,53 @@ SbJScriptMethod::~SbJScriptMethod()
-
-
- /////////////////////////////////////////////////////////////////////////
-+SbObjModule::SbObjModule( const com::sun::star::script::ModuleInfo& mInfo, bool bIsVbaCompatible )
-+ : SbModule( mInfo.ModuleName, bIsVbaCompatible )
-+{
-+ SetModuleType( mInfo.ModuleType );
-+ if ( mInfo.ModuleType == script::ModuleType::Form )
-+ {
-+ SetClassName( rtl::OUString::createFromAscii( "Form" ) );
-+ }
-+ else if ( mInfo.ModuleObject.is() )
-+ SetUnoObject( uno::makeAny( mInfo.ModuleObject ) );
-+}
-+void
-+SbObjModule::SetUnoObject( const uno::Any& aObj ) throw ( uno::RuntimeException )
-+{
-+ SbUnoObject* pUnoObj = PTR_CAST(SbUnoObject,(SbxVariable*)pDocObject);
-+ if ( pUnoObj && pUnoObj->getUnoAny() == aObj ) // object is equal, nothing to do
-+ return;
-+ pDocObject = new SbUnoObject( GetName(), uno::makeAny( aObj ) );
-+
-+ com::sun::star::uno::Reference< com::sun::star::lang::XServiceInfo > xServiceInfo( aObj, com::sun::star::uno::UNO_QUERY_THROW );
-+ if( xServiceInfo->supportsService( rtl::OUString::createFromAscii( "ooo.vba.excel.Worksheet" ) ) )
-+ {
-+ SetClassName( rtl::OUString::createFromAscii( "Worksheet" ) );
-+ }
-+ else if( xServiceInfo->supportsService( rtl::OUString::createFromAscii( "ooo.vba.excel.Workbook" ) ) )
-+ {
-+ SetClassName( rtl::OUString::createFromAscii( "Workbook" ) );
-+ }
-+}
-+
-+SbxVariable*
-+SbObjModule::GetObject()
-+{
-+ return pDocObject;
-+}
-+SbxVariable*
-+SbObjModule::Find( const XubString& rName, SbxClassType t )
-+{
-+ //OSL_TRACE("SbObjectModule find for %s", rtl::OUStringToOString( rName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ SbxVariable* pVar = NULL;
-+ if ( !pVar && pDocObject)
-+ pVar = pDocObject->Find( rName, t );
-+ if ( !pVar )
-+ pVar = SbModule::Find( rName, t );
-+ return pVar;
-+}
-+/////////////////////////////////////////////////////////////////////////
-
- SbProperty::SbProperty( const String& r, SbxDataType t, SbModule* p )
- : SbxProperty( r, t ), pMod( p )
---- basic/source/comp/codegen.cxx.old 2009-04-02 10:49:17.000000000 +0000
-+++ basic/source/comp/codegen.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -130,12 +130,12 @@ void SbiCodeGen::Save()
- // OPTION EXPLICIT-Flag uebernehmen
- if( pParser->bExplicit )
- p->SetFlag( SBIMG_EXPLICIT );
-- if( pParser->IsVBASupportOn() )
-- p->SetFlag( SBIMG_VBASUPPORT );
-
- int nIfaceCount = 0;
-- if( pParser->bClassModule )
-+ if( rMod.mnType == com::sun::star::script::ModuleType::Class )
- {
-+ OSL_TRACE("COdeGen::save() classmodule processing");
-+ rMod.bIsProxyModule = true;
- p->SetFlag( SBIMG_CLASSMODULE );
- pCLASSFAC->AddClassModule( &rMod );
-
-@@ -158,6 +158,10 @@ void SbiCodeGen::Save()
- else
- {
- pCLASSFAC->RemoveClassModule( &rMod );
-+ // Only a ClassModule can revert to Normal
-+ if ( rMod.mnType == com::sun::star::script::ModuleType::Class )
-+ rMod.mnType = com::sun::star::script::ModuleType::Normal;
-+ rMod.bIsProxyModule = false;
- }
- if( pParser->bText )
- p->SetFlag( SBIMG_COMPARETEXT );
-@@ -240,6 +244,8 @@ void SbiCodeGen::Save()
- if( nPass == 1 )
- aPropName = aPropName.Copy( aIfaceName.Len() + 1 );
- SbProcedureProperty* pProcedureProperty = NULL;
-+ OSL_TRACE("*** getProcedureProperty for thing %s",
-+ rtl::OUStringToOString( aPropName,RTL_TEXTENCODING_UTF8 ).getStr() );
- pProcedureProperty = rMod.GetProcedureProperty( aPropName, ePropType );
- }
- if( nPass == 1 )
---- basic/source/comp/parser.cxx.old 2009-04-06 16:41:57.000000000 +0000
-+++ basic/source/comp/parser.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -144,7 +144,8 @@ SbiParser::SbiParser( StarBASIC* pb, SbM
- bNewGblDefs =
- bSingleLineIf =
- bExplicit = FALSE;
-- bClassModule = FALSE;
-+ bClassModule = ( pm->GetModuleType() == com::sun::star::script::ModuleType::Class );
-+ OSL_TRACE("Parser - %s, bClassModule %d", rtl::OUStringToOString( pm->GetName(), RTL_TEXTENCODING_UTF8 ).getStr(), bClassModule );
- pPool = &aPublics;
- for( short i = 0; i < 26; i++ )
- eDefTypes[ i ] = SbxVARIANT; // Kein expliziter Defaulttyp
-@@ -157,6 +158,10 @@ SbiParser::SbiParser( StarBASIC* pb, SbM
-
- rTypeArray = new SbxArray; // Array fuer Benutzerdefinierte Typen
- rEnumArray = new SbxArray; // Array for Enum types
-+ bVBASupportOn = pm->IsVBACompat();
-+ if ( bVBASupportOn )
-+ EnableCompatibility();
-+
- }
-
-
-@@ -755,8 +760,9 @@ void SbiParser::Option()
-
- case CLASSMODULE:
- bClassModule = TRUE;
-+ aGen.GetModule().SetModuleType( com::sun::star::script::ModuleType::Class );
- break;
-- case VBASUPPORT:
-+ case VBASUPPORT: // Option VBASupport used to override the module mode ( in fact this must reset the mode
- if( Next() == NUMBER )
- {
- if ( nVal == 1 || nVal == 0 )
-@@ -764,6 +770,10 @@ void SbiParser::Option()
- bVBASupportOn = ( nVal == 1 );
- if ( bVBASupportOn )
- EnableCompatibility();
-+ // if the module setting is different
-+ // reset it to what the Option tells us
-+ if ( bVBASupportOn != aGen.GetModule().IsVBACompat() )
-+ aGen.GetModule().SetVBACompat( bVBASupportOn );
- break;
- }
- }
---- basic/source/inc/codegen.hxx.old 2009-04-02 10:49:15.000000000 +0000
-+++ basic/source/inc/codegen.hxx 2009-04-06 16:41:59.000000000 +0000
-@@ -56,6 +56,7 @@ public:
- void GenStmnt(); // evtl. Statement-Opcode erzeugen
- UINT32 GetPC();
- UINT32 GetOffset() { return GetPC() + 1; }
-+ SbModule& GetModule() { return rMod; }
- void Save();
-
- // #29955 for-Schleifen-Ebene pflegen
---- basic/source/inc/image.hxx.old 2009-04-02 10:49:15.000000000 +0000
-+++ basic/source/inc/image.hxx 2009-04-06 16:41:59.000000000 +0000
-@@ -109,6 +109,5 @@ public:
- #define SBIMG_COMPARETEXT 0x0002 // OPTION COMPARE TEXT ist aktiv
- #define SBIMG_INITCODE 0x0004 // Init-Code vorhanden
- #define SBIMG_CLASSMODULE 0x0008 // OPTION ClassModule is active
--#define SBIMG_VBASUPPORT 0x0020 // OPTION VBASupport is 1
-
- #endif
---- basic/source/runtime/methods1.cxx.old 2009-04-02 10:49:15.000000000 +0000
-+++ basic/source/runtime/methods1.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -44,6 +44,7 @@
- #ifndef _SBX_HXX
- #include <basic/sbx.hxx>
- #endif
-+#include <basic/sbstar.hxx>
- #include <svtools/zforlist.hxx>
- #include <tools/fsys.hxx>
- #include <tools/urlobj.hxx>
-@@ -64,6 +65,7 @@
- #endif
-
- #include <vcl/jobset.hxx>
-+#include <basic/sbobjmod.hxx>
-
- #include "sbintern.hxx"
- #include "runtime.hxx"
-@@ -2594,14 +2596,14 @@ RTLFUNC(Me)
-
- SbModule* pActiveModule = pINST->GetActiveModule();
- SbClassModuleObject* pClassModuleObject = PTR_CAST(SbClassModuleObject,pActiveModule);
-+ SbxVariableRef refVar = rPar.Get(0);
- if( pClassModuleObject == NULL )
- {
-- StarBASIC::Error( SbERR_INVALID_USAGE_OBJECT );
-+ SbObjModule* pMod = PTR_CAST(SbObjModule,pActiveModule);
-+ if ( pMod )
-+ refVar->PutObject( pMod );
- }
- else
-- {
-- SbxVariableRef refVar = rPar.Get(0);
- refVar->PutObject( pClassModuleObject );
-- }
- }
-
---- basic/source/runtime/runtime.cxx.old 2009-04-06 16:41:58.000000000 +0000
-+++ basic/source/runtime/runtime.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -53,7 +53,8 @@ bool SbiRuntime::isVBAEnabled()
- bool result = false;
- SbiInstance* pInst = pINST;
- if ( pInst && pINST->pRun )
-- result = pInst->pRun->GetImageFlag( SBIMG_VBASUPPORT );
-+ //result = pInst->pRun->GetImageFlag( SBIMG_VBASUPPORT );
-+ result = pInst->pRun->bVBAEnabled;
- return result;
- }
-
-@@ -64,6 +65,24 @@ void StarBASIC::StaticEnableReschedule(
- {
- bStaticGlobalEnableReschedule = bReschedule;
- }
-+void StarBASIC::SetVBAEnabled( BOOL bEnabled )
-+{
-+ if ( bDocBasic )
-+ {
-+ bVBAEnabled = bEnabled;
-+ }
-+}
-+
-+BOOL StarBASIC::isVBAEnabled()
-+{
-+ if ( bDocBasic )
-+ {
-+ if( SbiRuntime::isVBAEnabled() )
-+ return TRUE;
-+ return bVBAEnabled;
-+ }
-+ return FALSE;
-+}
-
-
- struct SbiArgvStack { // Argv stack:
-@@ -520,6 +539,7 @@ SbiRuntime::SbiRuntime( SbModule* pm, Sb
- nForLvl = 0;
- nOps = 0;
- refExprStk = new SbxArray;
-+ SetVBAEnabled( pMod->IsVBACompat() );
- #if defined GCC
- SetParameters( pe ? pe->GetParameters() : (class SbxArray *)NULL );
- #else
-@@ -527,7 +547,6 @@ SbiRuntime::SbiRuntime( SbModule* pm, Sb
- #endif
- pRefSaveList = NULL;
- pItemStoreList = NULL;
-- bVBAEnabled = isVBAEnabled();
- }
-
- SbiRuntime::~SbiRuntime()
---- basic/source/uno/namecont.cxx.old 2009-04-02 10:49:15.000000000 +0000
-+++ basic/source/uno/namecont.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -76,6 +76,9 @@
- #include <cppuhelper/exc_hlp.hxx>
- #include <basic/sbmod.hxx>
-
-+#ifndef _COM_SUN_STAR_SCRIPT_MODULEINFO_HPP_
-+#include <com/sun/star/script/ModuleInfo.hpp>
-+#endif
-
- namespace basic
- {
-@@ -155,7 +158,7 @@ void NameContainer::replaceByName( const
- throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
- {
- Type aAnyType = aElement.getValueType();
-- if( mType != aAnyType )
-+ if( mType != aAnyType && aAnyType != getCppuType( static_cast< ModuleInfo* >( NULL ) ) )
- throw IllegalArgumentException();
-
- NameContainerNameMap::iterator aIt = mHashMap.find( aName );
-@@ -197,7 +200,7 @@ void NameContainer::insertByName( const
- throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
- {
- Type aAnyType = aElement.getValueType();
-- if( mType != aAnyType )
-+ if( mType != aAnyType && aAnyType != getCppuType( static_cast< ModuleInfo* >( NULL ) ) )
- throw IllegalArgumentException();
-
- NameContainerNameMap::iterator aIt = mHashMap.find( aName );
---- basic/source/uno/scriptcont.cxx.old 2009-04-06 16:41:59.000000000 +0000
-+++ basic/source/uno/scriptcont.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -214,7 +214,12 @@ void SAL_CALL SfxScriptLibraryContainer:
- xmlscript::ModuleDescriptor aMod;
- aMod.aName = aElementName;
- aMod.aLanguage = maScriptLanguage;
-- aElement >>= aMod.aCode;
-+ // make sure we export source
-+ ::com::sun::star::script::ModuleInfo mInfo;
-+ if ( aElement >>= mInfo )
-+ aMod.aCode = mInfo.ModuleSource;
-+ else
-+ aElement >>= aMod.aCode;
- xmlscript::exportScriptModule( xHandler, aMod );
- }
-
-@@ -1171,7 +1176,11 @@ void SfxScriptLibrary::storeResourcesToS
- bool SfxScriptLibrary::containsValidModule( const Any& aElement )
- {
- OUString sModuleText;
-- aElement >>= sModuleText;
-+ ::com::sun::star::script::ModuleInfo mInfo;
-+ if ( aElement >>= mInfo )
-+ sModuleText = mInfo.ModuleSource;
-+ else
-+ aElement >>= sModuleText;
- return ( sModuleText.getLength() > 0 );
- }
-
---- sc/inc/servuno.hxx.old 2009-04-02 10:45:43.000000000 +0000
-+++ sc/inc/servuno.hxx 2009-04-06 16:41:59.000000000 +0000
-@@ -93,8 +93,8 @@ class ScDocShell;
-
- #define SC_SERVICE_FORMULAPARS 38
- #define SC_SERVICE_OPCODEMAPPER 39
--
--#define SC_SERVICE_COUNT 40
-+#define SC_SERVICE_VBAOBJECTPROVIDER 40
-+#define SC_SERVICE_COUNT 41
- #define SC_SERVICE_INVALID USHRT_MAX
-
-
---- sc/source/filter/excel/excimp8.cxx.old 2009-04-06 16:41:59.000000000 +0000
-+++ sc/source/filter/excel/excimp8.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -102,6 +102,7 @@
-
- #include <com/sun/star/document/XDocumentProperties.hpp>
- #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
-+#include <com/sun/star/script/ModuleInfo.hpp>
-
-
- using namespace com::sun::star;
-@@ -109,8 +110,8 @@ using namespace com::sun::star;
-
- #define INVALID_POS 0xFFFFFFFF
-
--
--
-+// defined in docfunc.cxx ( really this needs a new name )
-+script::ModuleInfo lcl_InitModuleInfo( SfxObjectShell& rDocSh, String& sModule );
-
- ImportExcel8::ImportExcel8( XclImpRootData& rImpData, SvStream& rStrm ) :
- ImportExcel( rImpData, rStrm )
-@@ -260,6 +261,7 @@ bool lcl_hasVBAEnabled()
-
- void ImportExcel8::ReadBasic( void )
- {
-+ //bHasBasic = TRUE;
- bHasBasic = TRUE;
-
- SfxObjectShell* pShell = GetDocShell();
-@@ -289,6 +291,10 @@ void ImportExcel8::EndSheet( void )
-
- void ImportExcel8::PostDocLoad( void )
- {
-+ // delay reading basic until sheet object ( codenames etc. ) are read
-+
-+ if ( bHasBasic )
-+ ReadBasic();
- // #i11776# filtered ranges before outlines and hidden rows
- if( pExcRoot->pAutoFilterBuffer )
- pExcRoot->pAutoFilterBuffer->Apply();
---- sc/source/ui/docshell/docsh5.cxx.old 2009-04-06 16:41:49.000000000 +0000
-+++ sc/source/ui/docshell/docsh5.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -68,6 +68,10 @@
- #include "sc.hrc"
- #include "waitoff.hxx"
- #include "sizedev.hxx"
-+#include <basic/sbstar.hxx>
-+
-+// defined in docfunc.cxx
-+void lcl_InsertModule( ScDocShell& rDocSh, SCTAB nTab, String& sModuleName, String& sModuleSource );
-
- // ---------------------------------------------------------------------------
-
-@@ -838,6 +842,33 @@ BOOL ScDocShell::MoveTable( SCTAB nSrcTa
- GetUndoManager()->AddUndoAction(
- new ScUndoCopyTab( this, aSrcList, aDestList ) );
- }
-+
-+ StarBASIC* pStarBASIC = GetBasic();
-+ BOOL bVbaEnabled = pStarBASIC ? pStarBASIC->isVBAEnabled() : FALSE;
-+ if ( bVbaEnabled )
-+ {
-+ String sCodeName;
-+ String sSource;
-+ aDocument.GetCodeName( nDestTab, sCodeName );
-+ com::sun::star::uno::Reference< com::sun::star::script::XLibraryContainer > xLibContainer = GetBasicContainer();
-+ com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > xLib;
-+ if( xLibContainer.is() )
-+ {
-+ String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
-+ com::sun::star::uno::Any aLibAny = xLibContainer->getByName( aLibName );
-+ aLibAny >>= xLib;
-+ }
-+ if( xLib.is() )
-+ {
-+ String sSrcCodeName;
-+ aDocument.GetCodeName( nSrcTab, sSrcCodeName );
-+ rtl::OUString sModName = sSrcCodeName;
-+ com::sun::star::script::ModuleInfo sModuleInfo;
-+ xLib->getByName( sModName ) >>= sModuleInfo;
-+ sSource = sModuleInfo.ModuleSource;
-+ }
-+ lcl_InsertModule( *this, nDestTab, sCodeName, sSource );
-+ }
- }
-
- Broadcast( ScTablesHint( SC_TAB_COPIED, nSrcTab, nDestTab ) );
---- sc/source/filter/excel/read.cxx.old 2009-04-06 16:41:51.000000000 +0000
-+++ sc/source/filter/excel/read.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -949,7 +949,8 @@ FltError ImportExcel8::Read( void )
- case 0x22: Rec1904(); break; // 1904 [ 2345 ]
- case 0x56: Builtinfmtcnt(); break; // BUILTINFMTCNT[ 34 ]
- case 0x8D: Hideobj(); break; // HIDEOBJ [ 345 ]
-- case 0xD3: ReadBasic(); break;
-+ case 0xD3: /*ReadBasic()*/bHasBasic = true; break;
-+// case 0xD3: ReadBasic(); break;
- case 0xDE: Olesize(); break;
- case 0x01BA: Codename( TRUE ); break;
-
---- sc/source/ui/docshell/docfunc.cxx.old 2009-04-06 16:41:59.000000000 +0000
-+++ sc/source/ui/docshell/docfunc.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -51,6 +51,12 @@
- #include <svtools/zforlist.hxx>
- #include <svtools/PasswordHelper.hxx>
-
-+#include <basic/sbstar.hxx>
-+#include <com/sun/star/container/XNameContainer.hpp>
-+#include <com/sun/star/script/XLibraryContainer.hpp>
-+#include <com/sun/star/script/ModuleInfo.hpp>
-+#include <com/sun/star/script/ModuleType.hpp>
-+
- #include <list>
-
- #include "docfunc.hxx"
-@@ -99,6 +105,7 @@
- using namespace com::sun::star;
- using ::com::sun::star::uno::Sequence;
-
-+
- // STATIC DATA -----------------------------------------------------------
-
- //========================================================================
-@@ -2281,6 +2288,92 @@ BOOL ScDocFunc::MoveBlock( const ScRange
- }
-
- //------------------------------------------------------------------------
-+uno::Reference< uno::XInterface > GetDocModuleObject( SfxObjectShell& rDocSh, String& sCodeName )
-+{
-+ uno::Reference< lang::XMultiServiceFactory> xSF(rDocSh.GetModel(), uno::UNO_QUERY);
-+ uno::Reference< container::XNameAccess > xVBACodeNamedObjectAccess;
-+ uno::Reference< uno::XInterface > xDocModuleApiObject;
-+ if ( xSF.is() )
-+ {
-+ xVBACodeNamedObjectAccess.set( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAObjectModuleObjectProvider"))), uno::UNO_QUERY );
-+ xDocModuleApiObject.set( xVBACodeNamedObjectAccess->getByName( sCodeName ), uno::UNO_QUERY );
-+ }
-+ return xDocModuleApiObject;
-+
-+}
-+
-+script::ModuleInfo lcl_InitModuleInfo( SfxObjectShell& rDocSh, String& sModule, String& sSource )
-+{
-+ ::rtl::OUString aModName( sModule );
-+ ::rtl::OUString sVbaOption( RTL_CONSTASCII_USTRINGPARAM( "Rem Attribute VBA_ModuleType=VBADocumentModule\nOption VBASupport 1\n" ));
-+ script::ModuleInfo sModuleInfo;
-+ sModuleInfo.ModuleName = aModName;
-+ if ( sSource.Len() > 0 )
-+ sModuleInfo.ModuleSource = sSource;
-+ else
-+ sModuleInfo.ModuleSource = sVbaOption;
-+ sModuleInfo.ModuleType = script::ModuleType::Document;
-+ sModuleInfo.ModuleObject = GetDocModuleObject( rDocSh, sModule );
-+ return sModuleInfo;
-+}
-+
-+void lcl_InsertModule( ScDocShell& rDocSh, SCTAB nTab, String& sModuleName, String& sSource )
-+{
-+ SFX_APP()->EnterBasicCall();
-+ script::ModuleInfo sModuleInfo = lcl_InitModuleInfo( rDocSh, sModuleName, sSource );
-+ uno::Reference< script::XLibraryContainer > xLibContainer = rDocSh.GetBasicContainer();
-+ DBG_ASSERT( xLibContainer.is(), "No BasicContainer!" );
-+
-+ uno::Reference< container::XNameContainer > xLib;
-+ if( xLibContainer.is() )
-+ {
-+ String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
-+ uno::Any aLibAny = xLibContainer->getByName( aLibName );
-+ aLibAny >>= xLib;
-+ }
-+ if( xLib.is() )
-+ {
-+ // if the Module with codename exists then find a new name
-+ sal_Int32 nNum = 1;
-+ sModuleInfo.ModuleName = sModuleName;
-+ while( xLib->hasByName( sModuleInfo.ModuleName ) )
-+ {
-+ sModuleInfo.ModuleName = rtl::OUString::createFromAscii( "Sheet" ) + rtl::OUString::valueOf( nNum );
-+ nNum += 1;
-+ }
-+ uno::Any aSourceAny;
-+ aSourceAny <<= sModuleInfo;
-+ xLib->insertByName( sModuleInfo.ModuleName, aSourceAny );
-+ ScDocument* pDoc = rDocSh.GetDocument();
-+ String sCodeName( sModuleInfo.ModuleName );
-+ pDoc->SetCodeName( nTab, sCodeName );
-+ }
-+ SFX_APP()->LeaveBasicCall();
-+}
-+
-+void lcl_DeleteModule( ScDocShell& rDocSh, String& sModuleName )
-+{
-+ SFX_APP()->EnterBasicCall();
-+ uno::Reference< script::XLibraryContainer > xLibContainer = rDocSh.GetBasicContainer();
-+ DBG_ASSERT( xLibContainer.is(), "No BasicContainer!" );
-+
-+ uno::Reference< container::XNameContainer > xLib;
-+ if( xLibContainer.is() )
-+ {
-+ String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
-+ uno::Any aLibAny = xLibContainer->getByName( aLibName );
-+ aLibAny >>= xLib;
-+ }
-+ if( xLib.is() )
-+ {
-+ if( xLib->hasByName( sModuleName ) )
-+ {
-+ xLib->removeByName( sModuleName );
-+ }
-+ }
-+ SFX_APP()->LeaveBasicCall();
-+}
-+
-
- BOOL ScDocFunc::InsertTable( SCTAB nTab, const String& rName, BOOL bRecord, BOOL bApi )
- {
-@@ -2290,8 +2383,18 @@ BOOL ScDocFunc::InsertTable( SCTAB nTab,
- ScDocShellModificator aModificator( rDocShell );
-
- ScDocument* pDoc = rDocShell.GetDocument();
-- if (bRecord && !pDoc->IsUndoEnabled())
-+ // Strange loop, also basic is loaded too early ( InsertTable )
-+ // is called via the xml import for sheets in described in odf
-+ BOOL bInsertDocModule = false;
-+
-+ if( !rDocShell.GetDocument()->IsImportingXML() )
-+ {
-+ StarBASIC* pStarBASIC = rDocShell.GetBasic();
-+ bInsertDocModule = pStarBASIC ? pStarBASIC->isVBAEnabled() : false;
-+ }
-+ if ( bInsertDocModule || ( bRecord && !pDoc->IsUndoEnabled() ) )
- bRecord = FALSE;
-+
- if (bRecord)
- pDoc->BeginDrawUndo(); // InsertTab erzeugt ein SdrUndoNewPage
-
-@@ -2302,10 +2405,19 @@ BOOL ScDocFunc::InsertTable( SCTAB nTab,
-
- if (pDoc->InsertTab( nTab, rName ))
- {
-+ String sCodeName;
- if (bRecord)
- rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoInsertTab( &rDocShell, nTab, bAppend, rName));
- // Views updaten:
-+ // Only insert vba modules if vba mode ( and not currently importing XML )
-+ if( bInsertDocModule )
-+ {
-+ if ( sCodeName.Len() == 0 )
-+ sCodeName = rName;
-+ String sSource;
-+ lcl_InsertModule( rDocShell, nTab, sCodeName, sSource );
-+ }
- rDocShell.Broadcast( ScTablesHint( SC_TAB_INSERTED, nTab ) );
-
- rDocShell.PostPaintExtras();
-@@ -2327,8 +2439,12 @@ BOOL ScDocFunc::DeleteTable( SCTAB nTab,
-
- BOOL bSuccess = FALSE;
- ScDocument* pDoc = rDocShell.GetDocument();
-+ StarBASIC* pStarBASIC = rDocShell.GetBasic();
-+ BOOL bVbaEnabled = pStarBASIC->isVBAEnabled();
- if (bRecord && !pDoc->IsUndoEnabled())
- bRecord = FALSE;
-+ if ( bVbaEnabled )
-+ bRecord = FALSE;
- BOOL bWasLinked = pDoc->IsLinked(nTab);
- ScDocument* pUndoDoc = NULL;
- ScRefUndoData* pUndoData = NULL;
-@@ -2369,6 +2485,8 @@ BOOL ScDocFunc::DeleteTable( SCTAB nTab,
- pUndoData = new ScRefUndoData( pDoc );
- }
-
-+ String sCodeName;
-+ BOOL bHasCodeName = pDoc->GetCodeName( nTab, sCodeName );
- if (pDoc->DeleteTab( nTab, pUndoDoc ))
- {
- if (bRecord)
-@@ -2379,6 +2497,13 @@ BOOL ScDocFunc::DeleteTable( SCTAB nTab,
- new ScUndoDeleteTab( &rDocShell, theTabs, pUndoDoc, pUndoData ));
- }
- // Views updaten:
-+ if( bVbaEnabled )
-+ {
-+ if( bHasCodeName )
-+ {
-+ lcl_DeleteModule( rDocShell, sCodeName );
-+ }
-+ }
- rDocShell.Broadcast( ScTablesHint( SC_TAB_DELETED, nTab ) );
-
- if (bWasLinked)
---- sc/source/ui/unoobj/servuno.cxx.old 2009-04-02 10:45:26.000000000 +0000
-+++ sc/source/ui/unoobj/servuno.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -38,6 +38,7 @@
- #include <svx/unofill.hxx>
- #include <svx/unonrule.hxx>
- #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
-+#include <com/sun/star/container/XNameAccess.hpp>
-
- #include "servuno.hxx"
- #include "unonames.hxx"
-@@ -61,8 +62,103 @@
- #include <svx/xmleohlp.hxx>
- #include <svx/xmlgrhlp.hxx>
-
-+#include <comphelper/processfactory.hxx>
-+
- using namespace ::com::sun::star;
-
-+class ScVbaObjectForCodeNameProvider : public ::cppu::WeakImplHelper1< container::XNameAccess >
-+{
-+ uno::Any maWorkbook;
-+ uno::Any maCachedObject;
-+ uno::Reference<lang::XMultiServiceFactory> mxSF;
-+ ScDocShell* mpDocShell;
-+public:
-+ ScVbaObjectForCodeNameProvider( ScDocShell* pDocShell ) : mpDocShell( pDocShell )
-+ {
-+ mxSF.set(comphelper::getProcessServiceFactory());
-+ uno::Reference<beans::XPropertySet> xProps(mxSF, uno::UNO_QUERY);
-+ if( xProps.is() )
-+ {
-+ ScDocument* pDoc = mpDocShell->GetDocument();
-+ if ( !pDoc )
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("")), uno::Reference< uno::XInterface >() );
-+
-+ uno::Sequence< uno::Any > aArgs(2);
-+ aArgs[0] = uno::Any( uno::Reference< uno::XInterface >() );
-+ aArgs[1] = uno::Any( mpDocShell->GetModel() );
-+ maWorkbook <<= mxSF->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Workbook") ), aArgs );
-+ }
-+ }
-+
-+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException )
-+ {
-+ maCachedObject = uno::Any(); // clear cached object
-+ String sName = aName;
-+ ScDocument* pDoc = mpDocShell->GetDocument();
-+ if ( !pDoc )
-+ throw uno::RuntimeException();
-+ if ( sName == pDoc->GetCodeName() )
-+ maCachedObject = maWorkbook;
-+ else
-+ {
-+ String sCodeName;
-+ SCTAB nCount = pDoc->GetTableCount();
-+ for( SCTAB i = 0; i < nCount; i++ )
-+ {
-+ pDoc->GetCodeName( i, sCodeName );
-+ if( sCodeName == sName )
-+ {
-+ String sSheetName;
-+ if( pDoc->GetName( i, sSheetName ) )
-+ {
-+ uno::Reference< frame::XModel > xModel( mpDocShell->GetModel() );
-+ uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( xModel, uno::UNO_QUERY_THROW );
-+ uno::Reference<sheet::XSpreadsheets > xSheets( xSpreadDoc->getSheets(), uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xIndexAccess( xSheets, uno::UNO_QUERY_THROW );
-+ uno::Reference< sheet::XSpreadsheet > xSheet( xIndexAccess->getByIndex( i ), uno::UNO_QUERY_THROW );
-+ uno::Sequence< uno::Any > aArgs(3);
-+ aArgs[0] = maWorkbook;
-+ aArgs[1] = uno::Any( xModel );
-+ aArgs[2] = uno::Any( rtl::OUString( sSheetName ) );
-+ maCachedObject <<= mxSF->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Worksheet") ), aArgs );
-+ break;
-+ }
-+ }
-+ }
-+ }
-+ return maCachedObject.hasValue();
-+
-+ }
-+ ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
-+ {
-+ OSL_TRACE("ScVbaObjectForCodeNameProvider::getByName( %s )",
-+ rtl::OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ if ( !hasByName( aName ) )
-+ throw ::com::sun::star::container::NoSuchElementException();
-+ return maCachedObject;
-+ }
-+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (::com::sun::star::uno::RuntimeException)
-+ {
-+ ScDocument* pDoc = mpDocShell->GetDocument();
-+ if ( !pDoc )
-+ throw uno::RuntimeException();
-+ SCTAB nCount = pDoc->GetTableCount();
-+ uno::Sequence< rtl::OUString > aNames( nCount + 1 );
-+ SCTAB index = 0;
-+ String sCodeName;
-+ for( ; index < nCount; ++index )
-+ {
-+ pDoc->GetCodeName( index, sCodeName );
-+ aNames[ index ] = sCodeName;
-+ }
-+ aNames[ index ] = pDoc->GetCodeName();
-+ return aNames;
-+ }
-+ // XElemenAccess
-+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException){ return uno::Type(); }
-+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException ) { return sal_True; }
-+
-+};
-
- //------------------------------------------------------------------------
-
-@@ -112,7 +208,8 @@ static const sal_Char* __FAR_DATA aProvN
-
- SC_SERVICENAME_CHDATAPROV, // SC_SERVICE_CHDATAPROV
- SC_SERVICENAME_FORMULAPARS, // SC_SERVICE_FORMULAPARS
-- SC_SERVICENAME_OPCODEMAPPER // SC_SERVICE_OPCODEMAPPER
-+ SC_SERVICENAME_OPCODEMAPPER, // SC_SERVICE_OPCODEMAPPER
-+"ooo.vba.VBAObjectModuleObjectProvider",// SC_SERVICE_VBAOBJECTPROVIDER
- };
-
- //
-@@ -164,7 +261,8 @@ static const sal_Char* __FAR_DATA aOldNa
- "", // SC_SERVICE_SHEETDOCSET
- "", // SC_SERVICE_CHDATAPROV
- "", // SC_SERVICE_FORMULAPARS
-- "" // SC_SERVICE_OPCODEMAPPER
-+ "", // SC_SERVICE_OPCODEMAPPER
-+ "", // SC_SERVICE_VBAOBJECTPROVIDER
- };
-
-
-@@ -363,6 +461,9 @@ uno::Reference<uno::XInterface> ScServic
- xRet.set(static_cast<sheet::XFormulaOpCodeMapper*>(new ScFormulaOpCodeMapperObj(::std::auto_ptr<formula::FormulaCompiler> (pComp))));
- }
- break;
-+ case SC_SERVICE_VBAOBJECTPROVIDER:
-+ xRet.set(static_cast<container::XNameAccess*>(new ScVbaObjectForCodeNameProvider( pDocShell )));
-+ break;
- }
- return xRet;
- }
---- sc/source/ui/view/viewfun2.cxx.old 2009-04-06 16:41:49.000000000 +0000
-+++ sc/source/ui/view/viewfun2.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -57,6 +57,11 @@
- #include <vcl/sound.hxx>
- #include <vcl/waitobj.hxx>
-
-+#include <basic/sbstar.hxx>
-+#include <com/sun/star/container/XNameContainer.hpp>
-+#include <com/sun/star/script/XLibraryContainer.hpp>
-+using namespace com::sun::star;
-+
- #include "viewfunc.hxx"
-
- #include "sc.hrc"
-@@ -2139,15 +2144,42 @@ BOOL ScViewFunc::DeleteTable( SCTAB nTab
- return bSuccess;
- }
-
-+void lcl_DeleteModule( ScDocShell* rDocSh, String& sModuleName )
-+{
-+ SFX_APP()->EnterBasicCall();
-+ uno::Reference< script::XLibraryContainer > xLibContainer = rDocSh->GetBasicContainer();
-+ DBG_ASSERT( xLibContainer.is(), "No BasicContainer!" );
-+
-+ uno::Reference< container::XNameContainer > xLib;
-+ if( xLibContainer.is() )
-+ {
-+ String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
-+ uno::Any aLibAny = xLibContainer->getByName( aLibName );
-+ aLibAny >>= xLib;
-+ }
-+ if( xLib.is() )
-+ {
-+ if( xLib->hasByName( sModuleName ) )
-+ {
-+ xLib->removeByName( sModuleName );
-+ }
-+ }
-+ SFX_APP()->LeaveBasicCall();
-+}
-+
- BOOL ScViewFunc::DeleteTables(const SvShorts &TheTabs, BOOL bRecord )
- {
- ScDocShell* pDocSh = GetViewData()->GetDocShell();
- ScDocument* pDoc = pDocSh->GetDocument();
-+ StarBASIC* pStarBASIC = pDocSh->GetBasic();
-+ BOOL bVbaEnabled = pStarBASIC->isVBAEnabled();
- SCTAB nNewTab = TheTabs[0];
- int i;
- WaitObject aWait( GetFrameWin() );
- if (bRecord && !pDoc->IsUndoEnabled())
- bRecord = FALSE;
-+ if ( bVbaEnabled )
-+ bRecord = FALSE;
-
- while ( nNewTab > 0 && !pDoc->IsVisible( nNewTab ) )
- --nNewTab;
-@@ -2214,9 +2246,18 @@ BOOL ScViewFunc::DeleteTables(const SvSh
-
- for(i=TheTabs.Count()-1;i>=0;i--)
- {
-+ String sCodeName;
-+ BOOL bHasCodeName = pDoc->GetCodeName( TheTabs[sal::static_int_cast<USHORT>(i)], sCodeName );
- if (pDoc->DeleteTab( TheTabs[sal::static_int_cast<USHORT>(i)], pUndoDoc ))
- {
- bDelDone = TRUE;
-+ if( bVbaEnabled )
-+ {
-+ if( bHasCodeName )
-+ {
-+ lcl_DeleteModule( pDocSh, sCodeName );
-+ }
-+ }
- pDocSh->Broadcast( ScTablesHint( SC_TAB_DELETED, TheTabs[sal::static_int_cast<USHORT>(i)] ) );
- }
- }
-@@ -2244,6 +2285,7 @@ BOOL ScViewFunc::DeleteTables(const SvSh
- pDocSh->PostPaintExtras();
- pDocSh->SetDocumentModified();
-
-+
- SfxApplication* pSfxApp = SFX_APP(); // Navigator
- pSfxApp->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) );
- pSfxApp->Broadcast( SfxSimpleHint( SC_HINT_DBAREAS_CHANGED ) );
---- svx/source/msfilter/msvbasic.cxx.old 2009-04-02 11:03:03.000000000 +0000
-+++ svx/source/msfilter/msvbasic.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -41,6 +41,8 @@
- #include <rtl/tencinfo.h> //rtl_getTextEncodingFromWindowsCodePage
- #include "msvbasic.hxx"
-
-+using namespace ::com::sun::star::script;
-+
- /*
- A few urls which may in the future be of some use
- http://www.virusbtn.com/vb2000/Programme/papers/bontchev.pdf
-@@ -432,7 +434,7 @@ int VBA_Impl::ReadVBAProject(const SvSto
- *
- */
-
--ModuleType VBA_Impl::GetModuleType( const UniString& rModuleName )
-+ModType VBA_Impl::GetModuleType( const UniString& rModuleName )
- {
- ModuleTypeHash::iterator iter = mhModHash.find( rModuleName );
- ModuleTypeHash::iterator iterEnd = mhModHash.end();
-@@ -440,7 +442,7 @@ ModuleType VBA_Impl::GetModuleType( cons
- {
- return iter->second;
- }
-- return Unknown;
-+ return ModuleType::Unknown;
- }
-
- bool VBA_Impl::Open( const String &rToplevel, const String &rSublevel )
-@@ -483,7 +485,7 @@ bool VBA_Impl::Open( const String &rTopl
- static const String sClass( RTL_CONSTASCII_USTRINGPARAM( "Class" ) );
- static const String sBaseClass( RTL_CONSTASCII_USTRINGPARAM( "BaseClass" ) );
- static const String sDocument( RTL_CONSTASCII_USTRINGPARAM( "Document" ) );
-- mhModHash[ sThisDoc ] = Class;
-+ mhModHash[ sThisDoc ] = ModuleType::Class;
- while ( pStp->ReadByteStringLine( tmp, meCharSet ) )
- {
- xub_StrLen index = tmp.Search( '=' );
-@@ -493,14 +495,14 @@ bool VBA_Impl::Open( const String &rTopl
- String value = tmp.Copy( index + 1 );
- if ( key == sClass )
- {
-- mhModHash[ value ] = Class;
-+ mhModHash[ value ] = ModuleType::Class;
- OSL_TRACE("Module %s is of type Class",
- ::rtl::OUStringToOString( value ,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- }
- else if ( key == sBaseClass )
- {
-- mhModHash[ value ] = Form;
-+ mhModHash[ value ] = ModuleType::Form;
- OSL_TRACE("Module %s is of type Form",
- ::rtl::OUStringToOString( value ,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-@@ -513,14 +515,14 @@ bool VBA_Impl::Open( const String &rTopl
- // value is of form <name>/&H<identifier>, strip the identifier
- value.Erase( value.Search( '/' ) );
-
-- mhModHash[ value ] = Document;
-+ mhModHash[ value ] = ModuleType::Document;
- OSL_TRACE("Module %s is of type Document VBA",
- ::rtl::OUStringToOString( value ,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- }
- else if ( key == sModule )
- {
-- mhModHash[ value ] = Normal;
-+ mhModHash[ value ] = ModuleType::Normal;
- OSL_TRACE("Module %s is of type Normal VBA",
- ::rtl::OUStringToOString( value ,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
---- svx/source/msfilter/msvbasic.hxx.old 2009-04-02 11:03:03.000000000 +0000
-+++ svx/source/msfilter/msvbasic.hxx 2009-04-06 16:41:59.000000000 +0000
-@@ -45,6 +45,8 @@
- #include <vector>
- #endif
- #include<map>
-+#include <com/sun/star/script/ModuleType.hpp>
-+using namespace ::com::sun::star::script::ModuleType;
-
- /* class VBA:
- * The VBA class provides a set of methods to handle Visual Basic For
-@@ -68,13 +70,12 @@ DECLARE_DYNARRAY(StringArray,String *)
- // #117718# define internal types to distinguish between
- // module types, form, class & normal
- // #i37965# DR 2004-12-03: add "Document", used in Excel for macros attached to sheet
--enum ModuleType { Unknown = 0, Normal, Class, Form, Document };
-
- // #117718# define map to hold types of module
- //
--
-+typedef sal_Int32 ModType;
- typedef ::std::map< UniString,
-- ModuleType > ModuleTypeHash;
-+ ModType > ModuleTypeHash;
-
- class VBA_Impl
- {
-@@ -95,7 +96,7 @@ public:
- void Output(int len, const sal_uInt8 *data);
- //
- // #117718# member map of module names to types of module
-- ModuleType GetModuleType( const UniString& rModuleName );
-+ ModType GetModuleType( const UniString& rModuleName );
-
- std::vector<String> maReferences;
- private:
---- svx/source/msfilter/svxmsbas.cxx.old 2009-04-06 16:41:59.000000000 +0000
-+++ svx/source/msfilter/svxmsbas.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -53,6 +53,7 @@ using namespace com::sun::star::awt;
-
- #include <com/sun/star/container/XNameContainer.hpp>
- #include <com/sun/star/script/XLibraryContainer.hpp>
-+#include <com/sun/star/script/ModuleInfo.hpp>
- using namespace com::sun::star::container;
- using namespace com::sun::star::script;
- using namespace com::sun::star::uno;
-@@ -266,8 +267,22 @@ BOOL SvxImportMSVBasic::ImportCode_Impl(
- Any aLibAny = xLibContainer->getByName( aLibName );
- aLibAny >>= xLib;
- }
-- if( xLib.is() )
-+ if( xLib.is() )
- {
-+ Reference< container::XNameAccess > xVBAObjectForCodeName;
-+ if ( !bAsComment )
-+ {
-+ rDocSh.GetBasic()->SetVBAEnabled( true );
-+ Reference< XMultiServiceFactory> xSF(rDocSh.GetModel(), UNO_QUERY);
-+ if ( xSF.is() )
-+ {
-+ try
-+ {
-+ xVBAObjectForCodeName.set( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAObjectModuleObjectProvider"))), UNO_QUERY );
-+ }
-+ catch( Exception& ) { }
-+ }
-+ }
- for( UINT16 i=0; i<nStreamCount;i++)
- {
- StringArray aDecompressed = aVBA.Decompress(i);
-@@ -301,7 +316,7 @@ BOOL SvxImportMSVBasic::ImportCode_Impl(
- // is the same as the encoding for the names
- // that are keys in the map used by GetModuleType method
- const String &sOrigVBAModName = aVBA.GetStreamName( i );
-- ModuleType mType = aVBA.GetModuleType( sOrigVBAModName );
-+ ModType mType = aVBA.GetModuleType( sOrigVBAModName );
-
- rtl::OUString sClassRem( RTL_CONSTASCII_USTRINGPARAM( "Rem Attribute VBA_ModuleType=" ) );
-
-@@ -309,23 +324,23 @@ BOOL SvxImportMSVBasic::ImportCode_Impl(
-
- switch( mType )
- {
-- case Class:
-+ case ModuleType::Class:
- modeTypeComment = sClassRem +
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAClassModule\n" ) );
- break;
-- case Form:
-+ case ModuleType::Form:
- modeTypeComment = sClassRem +
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAFormModule\n" ) );
- break;
-- case Document:
-+ case ModuleType::Document:
- modeTypeComment = sClassRem +
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBADocumentModule\n" ) );
- break;
-- case Normal:
-+ case ModuleType::Normal:
- modeTypeComment = sClassRem +
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAModule\n" ) );
- break;
-- case Unknown:
-+ case ModuleType::Unknown:
- modeTypeComment = sClassRem +
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAUnknown\n" ) );
- break;
-@@ -335,10 +350,10 @@ BOOL SvxImportMSVBasic::ImportCode_Impl(
- }
- static ::rtl::OUString sVBAOption( RTL_CONSTASCII_USTRINGPARAM( "Option VBASupport 1\n" ) );
- static ::rtl::OUString sClassOption( RTL_CONSTASCII_USTRINGPARAM( "Option ClassModule\n" ) );
-- if ( !bAsComment )
-+ if ( !bAsComment /*&& !rDocSh.GetBasic()->isVBAEnabled() */)
- {
- modeTypeComment = modeTypeComment + sVBAOption;
-- if ( mType == Class )
-+ if ( mType == ModuleType::Class )
- modeTypeComment = modeTypeComment + sClassOption;
-
- }
-@@ -405,12 +420,41 @@ BOOL SvxImportMSVBasic::ImportCode_Impl(
- aSource += rtl::OUString::createFromAscii("\nEnd Sub");
- }
- ::rtl::OUString aModName( sModule );
-- if ( aSource.getLength() )
- {
- aSource = modeTypeComment + aSource;
-
- Any aSourceAny;
-- aSourceAny <<= aSource;
-+ OSL_TRACE("erm %d", mType );
-+ if ( !bAsComment )
-+ {
-+ OSL_TRACE("vba processing %d", mType );
-+ script::ModuleInfo sModuleInfo;
-+ sModuleInfo.ModuleName = aModName;
-+ sModuleInfo.ModuleSource = aSource;
-+ sModuleInfo.ModuleType = mType;
-+ if ( mType == ModuleType::Form )
-+ // hack, the module ( imo document basic should...
-+ // know the XModel... ) but it doesn't
-+ sModuleInfo.ModuleObject.set( rDocSh.GetModel(), UNO_QUERY );
-+ // document modules, we should be able to access
-+ // the api objects at this time
-+ else if ( mType == ModuleType::Document )
-+ {
-+ uno::Reference< lang::XMultiServiceFactory> xSF( rDocSh.GetModel(), uno::UNO_QUERY);
-+ uno::Reference< container::XNameAccess > xVBACodeNamedObjectAccess;
-+ if ( xSF.is() )
-+ xVBACodeNamedObjectAccess.set( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAObjectModuleObjectProvider"))), uno::UNO_QUERY );
-+ // get the api object for the codename
-+ if ( xVBACodeNamedObjectAccess.is() )
-+ {
-+ sModuleInfo.ModuleObject.set( xVBACodeNamedObjectAccess->getByName( sModuleInfo.ModuleName ), uno::UNO_QUERY );
-+ OSL_TRACE("** Straight up creation of Module");
-+ }
-+ }
-+ aSourceAny <<= sModuleInfo;
-+ }
-+ else
-+ aSourceAny <<= aSource;
- if( xLib->hasByName( aModName ) )
- xLib->replaceByName( aModName, aSourceAny );
- else
-@@ -420,6 +464,7 @@ BOOL SvxImportMSVBasic::ImportCode_Impl(
- bRet = true;
- }
- }
-+ if( bRet )
- SFX_APP()->LeaveBasicCall();
- }
- return bRet;
---- udkapi/com/sun/star/script/ModuleInfo.idl.old 1970-01-01 00:00:00.000000000 +0000
-+++ udkapi/com/sun/star/script/ModuleInfo.idl 2009-04-06 16:41:59.000000000 +0000
-@@ -0,0 +1,57 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: ModuleInfo.idl,v $
-+ *
-+ * $Revision: 1.2 $
-+ *
-+ * last change: $Author: rt $ $Date: 2006/05/05 10:14:46 $
-+ *
-+ * 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 __com_sun_star_script_ModuleInfo_idl__
-+#define __com_sun_star_script_ModuleInfo_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+//=============================================================================
-+module com { module sun { module star { module script {
-+struct ModuleInfo
-+{
-+ string ModuleName;
-+ string ModuleSource;
-+ com::sun::star::uno::XInterface ModuleObject;
-+ short ModuleType; // string?
-+};
-+
-+//=============================================================================
-+
-+}; }; }; };
-+
-+#endif
---- udkapi/com/sun/star/script/ModuleType.idl.old 1970-01-01 00:00:00.000000000 +0000
-+++ udkapi/com/sun/star/script/ModuleType.idl 2009-04-06 16:41:59.000000000 +0000
-@@ -0,0 +1,58 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: ModuleType.idl,v $
-+ *
-+ * $Revision: 1.2 $
-+ *
-+ * last change: $Author: rt $ $Date: 2006/05/05 10:14:46 $
-+ *
-+ * 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 __com_sun_star_script_ModuleType_idl__
-+#define __com_sun_star_script_ModuleType_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+//=============================================================================
-+module com { module sun { module star { module script {
-+published constants ModuleType
-+{
-+ const long Unknown = 0;
-+ const long Normal = 1;
-+ const long Class = 2;
-+ const long Form = 3;
-+ const long Document = 4;
-+};
-+
-+//=============================================================================
-+
-+}; }; }; };
-+
-+#endif
---- udkapi/com/sun/star/script/makefile.mk.old 2009-04-02 11:06:58.000000000 +0000
-+++ udkapi/com/sun/star/script/makefile.mk 2009-04-06 16:41:59.000000000 +0000
-@@ -85,6 +85,8 @@ IDLFILES=\
- XScriptEventsAttacher.idl\
- XDefaultMethod.idl\
- XDefaultProperty.idl\
-+ ModuleInfo.idl\
-+ ModuleType.idl\
-
- # ------------------------------------------------------------------
-
---- sc/source/filter/excel/xiescher.cxx.old 2009-04-06 16:41:59.000000000 +0000
-+++ sc/source/filter/excel/xiescher.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -495,7 +495,7 @@ void XclImpDrawObjBase::ProcessSdrObject
- {
- if( ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( &rSdrObj, TRUE ) )
- {
-- pInfo->SetMacro( XclControlHelper::GetScMacroName( maMacroName ) );
-+ pInfo->SetMacro( XclControlHelper::GetScMacroName( maMacroName, GetDocShell() ) );
- pInfo->SetHlink( maHyperlink );
- }
- }
-@@ -1876,7 +1876,7 @@ void XclImpTbxObjBase::SetDffProperties(
-
- bool XclImpTbxObjBase::FillMacroDescriptor( ScriptEventDescriptor& rDescriptor ) const
- {
-- return XclControlHelper::FillMacroDescriptor( rDescriptor, DoGetEventType(), GetMacroName() );
-+ return XclControlHelper::FillMacroDescriptor( rDescriptor, DoGetEventType(), GetMacroName(), GetDocShell() );
- }
-
- void XclImpTbxObjBase::ConvertFont( ScfPropertySet& rPropSet ) const
---- sc/source/filter/excel/xlescher.cxx.old 2009-04-06 16:41:59.000000000 +0000
-+++ sc/source/filter/excel/xlescher.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -40,6 +40,11 @@
- #include "xlescher.hxx"
- #include "globstr.hrc"
-
-+#include <sfx2/objsh.hxx>
-+#include <basic/sbstar.hxx>
-+#include <basic/sbmod.hxx>
-+#include <basic/sbmeth.hxx>
-+
- using ::rtl::OUString;
- using ::com::sun::star::uno::Reference;
- using ::com::sun::star::uno::UNO_QUERY;
-@@ -302,10 +307,26 @@ Reference< XControlModel > XclControlHel
- #define EXC_MACRONAME_PRE "vnd.sun.star.script:Standard."
- #define EXC_MACRONAME_SUF "?language=Basic&location=document"
-
--OUString XclControlHelper::GetScMacroName( const String& rXclMacroName )
-+OUString XclControlHelper::GetScMacroName( const String& rXclMacroName, SfxObjectShell* pDocShell )
- {
-+ String sTmp( rXclMacroName );
- if( rXclMacroName.Len() > 0 )
-- return CREATE_OUSTRING( EXC_MACRONAME_PRE ) + rXclMacroName + CREATE_OUSTRING( EXC_MACRONAME_SUF );
-+ {
-+ if ( ( sTmp.Search( '.' ) == STRING_NOTFOUND) && pDocShell )
-+ {
-+ if( StarBASIC* pBasic = pDocShell->GetBasic() )
-+ {
-+ if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pBasic->Find( sTmp, SbxCLASS_METHOD ) ) )
-+ {
-+ if( SbModule* pModule = pMethod->GetModule() )
-+ {
-+ sTmp.Insert( '.', 0 ).Insert( pModule->GetName(), 0 );
-+ }
-+ }
-+ }
-+ }
-+ return CREATE_OUSTRING( EXC_MACRONAME_PRE ) + sTmp + CREATE_OUSTRING( EXC_MACRONAME_SUF );
-+ }
- return OUString();
- }
-
-@@ -339,14 +360,14 @@ spTbxListenerData[] =
- #define EXC_MACROSCRIPT "Script"
-
- bool XclControlHelper::FillMacroDescriptor( ScriptEventDescriptor& rDescriptor,
-- XclTbxEventType eEventType, const String& rXclMacroName )
-+ XclTbxEventType eEventType, const String& rXclMacroName, SfxObjectShell* pShell )
- {
- if( rXclMacroName.Len() > 0 )
- {
- rDescriptor.ListenerType = OUString::createFromAscii( spTbxListenerData[ eEventType ].mpcListenerType );
- rDescriptor.EventMethod = OUString::createFromAscii( spTbxListenerData[ eEventType ].mpcEventMethod );
- rDescriptor.ScriptType = CREATE_OUSTRING( EXC_MACROSCRIPT );
-- rDescriptor.ScriptCode = GetScMacroName( rXclMacroName );
-+ rDescriptor.ScriptCode = GetScMacroName( rXclMacroName, pShell );
- return true;
- }
- return false;
---- sc/source/filter/inc/xlescher.hxx.old 2009-04-02 10:44:58.000000000 +0000
-+++ sc/source/filter/inc/xlescher.hxx 2009-04-06 16:41:59.000000000 +0000
-@@ -432,7 +432,8 @@ public:
- GetControlModel( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
-
- /** Returns the Calc macro name from an Excel macro name. */
-- static ::rtl::OUString GetScMacroName( const String& rXclMacroName );
-+ static ::rtl::OUString GetScMacroName( const String& rXclMacroName, SfxObjectShell* pShell = NULL );
-+
- /** Returns the Excel macro name from a Calc macro name. */
- static String GetXclMacroName( const ::rtl::OUString& rScMacroName );
-
-@@ -440,7 +441,7 @@ public:
- static bool FillMacroDescriptor(
- ::com::sun::star::script::ScriptEventDescriptor& rDescriptor,
- XclTbxEventType eEventType,
-- const String& rXclMacroName );
-+ const String& rXclMacroName, SfxObjectShell* pShell = NULL );
- /** Tries to extract an Excel macro name from the passed macro descriptor. */
- static String ExtractFromMacroDescriptor(
- const ::com::sun::star::script::ScriptEventDescriptor& rDescriptor,
diff --git a/patches/vba/api-application-caller.diff b/patches/vba/api-application-caller.diff
deleted file mode 100644
index 39262b119..000000000
--- a/patches/vba/api-application-caller.diff
+++ /dev/null
@@ -1,63 +0,0 @@
-diff --git oovbaapi/ooo/vba/excel/XApplication.idl oovbaapi/ooo/vba/excel/XApplication.idl
-index 8b0bde9..82533a5 100644
---- oovbaapi/ooo/vba/excel/XApplication.idl
-+++ oovbaapi/ooo/vba/excel/XApplication.idl
-@@ -110,6 +110,7 @@ interface XApplication
- raises(com::sun::star::script::BasicErrorException);
- void Volatile([in] any Volatile);
- void DoEvents();
-+ any Caller( [in] any aIndex );
- };
-
- }; }; };
-diff --git sc/source/ui/vba/vbaapplication.cxx sc/source/ui/vba/vbaapplication.cxx
-index 431090c..c554faa 100644
---- sc/source/ui/vba/vbaapplication.cxx
-+++ sc/source/ui/vba/vbaapplication.cxx
-@@ -110,6 +110,8 @@ using ::rtl::OUString;
-
- #define EXCELVERSION "11.0"
-
-+uno::Any sbxToUnoValue( SbxVariable* pVar );
-+
- class ActiveWorkbook : public ScVbaWorkbook
- {
- protected:
-@@ -1302,6 +1304,25 @@ 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;
-+}
-+
- rtl::OUString&
- ScVbaApplication::getServiceImplName()
- {
-diff --git sc/source/ui/vba/vbaapplication.hxx sc/source/ui/vba/vbaapplication.hxx
-index 1c2631e..754885e 100644
---- sc/source/ui/vba/vbaapplication.hxx
-+++ sc/source/ui/vba/vbaapplication.hxx
-@@ -103,6 +103,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<rtl::OUString> getServiceNames();
diff --git a/patches/vba/basic-allow-objectforerror-symbol.diff b/patches/vba/basic-allow-objectforerror-symbol.diff
deleted file mode 100644
index 5f6a4f3dc..000000000
--- a/patches/vba/basic-allow-objectforerror-symbol.diff
+++ /dev/null
@@ -1,42 +0,0 @@
-diff --git basic/source/comp/exprtree.cxx basic/source/comp/exprtree.cxx
-index 88b51d1..8e78aba 100644
---- basic/source/comp/exprtree.cxx
-+++ basic/source/comp/exprtree.cxx
-@@ -378,8 +378,12 @@ SbiExprNode* SbiExpression::Term( void )
- // Typ SbxOBJECT sein
- if( pDef->GetType() != SbxOBJECT && pDef->GetType() != SbxVARIANT )
- {
-- pParser->Error( SbERR_BAD_DECLARATION, aSym );
-- bError = TRUE;
-+ // defer error until runtime if in vba mode
-+ if ( !pParser->IsVBASupportOn() )
-+ {
-+ pParser->Error( SbERR_BAD_DECLARATION, aSym );
-+ bError = TRUE;
-+ }
- }
- if( !bError )
- pNd->aVar.pNext = ObjTerm( *pDef );
-diff --git basic/source/comp/parser.cxx basic/source/comp/parser.cxx
-index 1a4dc06..dea8d79 100644
---- basic/source/comp/parser.cxx
-+++ basic/source/comp/parser.cxx
-@@ -405,6 +405,18 @@ BOOL SbiParser::Parse()
- Next(); return TRUE;
- }
-
-+ // In vba it's possible to do Error.foobar ( even if it results in
-+ // a runtime error
-+ if ( eCurTok == _ERROR_ && IsVBASupportOn() ) // we probably need to define a subset of keywords where this madness applies e.g. if ( IsVBASupportOn() && SymbolCanBeRedined( eCurTok ) )
-+ {
-+ SbiTokenizer tokens( *(SbiTokenizer*)this );
-+ tokens.Next();
-+ if ( tokens.Peek() == DOT )
-+ {
-+ eCurTok = SYMBOL;
-+ ePush = eCurTok;
-+ }
-+ }
- // Kommt ein Symbol, ist es entweder eine Variable( LET )
- // oder eine SUB-Prozedur( CALL ohne Klammern )
- // DOT fuer Zuweisungen im WITH-Block: .A=5
diff --git a/patches/vba/basic-caller-support.diff b/patches/vba/basic-caller-support.diff
deleted file mode 100644
index f071f4ddb..000000000
--- a/patches/vba/basic-caller-support.diff
+++ /dev/null
@@ -1,532 +0,0 @@
-diff -up /data4/Latest/ooo-build/build/ooh680-m1/scripting/source/basprov/basscript.hxx scripting/source/basprov/basscript.hxx
---- /data4/Latest/ooo-build/build/ooh680-m1/scripting/source/basprov/basscript.hxx 2005-09-09 03:24:12.000000000 +0100
-+++ scripting/source/basprov/basscript.hxx 2007-12-19 17:19:58.000000000 +0000
-@@ -36,11 +36,13 @@
- #ifndef SCRIPTING_BASSCRIPT_HXX
- #define SCRIPTING_BASSCRIPT_HXX
-
-+#include "bcholder.hxx"
- #include <com/sun/star/script/provider/XScript.hpp>
- #include <com/sun/star/document/XScriptInvocationContext.hpp>
- #include <cppuhelper/implbase1.hxx>
-+#include <comphelper/proparrhlp.hxx>
-+#include <comphelper/propertycontainer.hxx>
- #include <basic/sbmeth.hxx>
--
-
- class BasicManager;
-
-@@ -66,7 +68,11 @@ namespace basprov
- ::com::sun::star::script::provider::XScript > BasicScriptImpl_BASE;
-
-
-- class BasicScriptImpl : public BasicScriptImpl_BASE
-+ class BasicScriptImpl : public BasicScriptImpl_BASE,
-+ public ::scripting_helper::OMutexHolder,
-+ public ::scripting_helper::OBroadcastHelperHolder,
-+ public ::comphelper::OPropertyContainer,
-+ public ::comphelper::OPropertyArrayUsageHelper< BasicScriptImpl >
- {
- private:
- SbMethodRef m_xMethod;
-@@ -74,6 +80,16 @@ namespace basprov
- BasicManager* m_documentBasicManager;
- ::com::sun::star::uno::Reference< ::com::sun::star::document::XScriptInvocationContext >
- m_xDocumentScriptContext;
-+ // hack, OPropertyContainer doesn't allow you to define a property of unknown
-+ // type ( I guess because an Any can't contain an Any... I've always wondered why?
-+ // as its not unusual to do that in corba )
-+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > m_caller;
-+ protected:
-+ // OPropertySetHelper
-+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper( );
-+
-+ // OPropertyArrayUsageHelper
-+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
-
- public:
- BasicScriptImpl(
-@@ -88,6 +104,12 @@ namespace basprov
- );
- virtual ~BasicScriptImpl();
-
-+ // XInterface
-+ DECLARE_XINTERFACE()
-+
-+ // XTypeProvider
-+ DECLARE_XTYPEPROVIDER()
-+
- // XScript
- virtual ::com::sun::star::uno::Any SAL_CALL invoke(
- const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aParams,
-@@ -97,6 +119,9 @@ namespace basprov
- ::com::sun::star::script::provider::ScriptFrameworkErrorException,
- ::com::sun::star::reflection::InvocationTargetException,
- ::com::sun::star::uno::RuntimeException );
-+ // XPropertySet
-+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( )
-+ throw (::com::sun::star::uno::RuntimeException);
- };
-
- //.........................................................................
---- /data4/Latest/ooo-build/build/ooh680-m1/basic/inc/basic/sbmeth.hxx 2008-01-08 09:36:28.000000000 +0000
-+++ basic/inc/basic/sbmeth.hxx 2007-12-20 09:38:21.000000000 +0000
-@@ -49,6 +49,7 @@
- friend class SbIfaceMapperMethod;
-
- SbMethodImpl* mpSbMethodImpl; // Impl data
-+ SbxVariable* mCaller; // caller
- SbModule* pMod;
- USHORT nDebugFlags;
- USHORT nLine1, nLine2;
-@@ -75,7 +76,7 @@
- void GetLineRange( USHORT&, USHORT& );
-
- // Schnittstelle zum Ausfuehren einer Methode aus den Applikationen
-- virtual ErrCode Call( SbxValue* pRet = NULL );
-+ virtual ErrCode Call( SbxValue* pRet = NULL, SbxVariable* pCaller = NULL );
- virtual void Broadcast( ULONG nHintId );
- };
-
---- /data4/Latest/ooo-build/build/ooh680-m1/basic/source/classes/sbxmod.cxx 2008-01-08 09:36:28.000000000 +0000
-+++ basic/source/classes/sbxmod.cxx 2007-12-20 11:22:38.000000000 +0000
-@@ -1936,6 +1936,7 @@ SbMethod::SbMethod( const String& r, Sbx
- nLine1 =
- nLine2 = 0;
- refStatics = new SbxArray;
-+ mCaller = 0;
- // AB: 2.7.1996: HACK wegen 'Referenz kann nicht gesichert werden'
- SetFlag( SBX_NO_MODIFY );
- }
-@@ -1950,6 +1951,7 @@ SbMethod::SbMethod( const SbMethod& r )
- nLine1 = r.nLine1;
- nLine2 = r.nLine2;
- refStatics = r.refStatics;
-+ mCaller = r.mCaller;
- SetFlag( SBX_NO_MODIFY );
- }
-
-@@ -2018,8 +2020,13 @@ SbxInfo* SbMethod::GetInfo()
- // Schnittstelle zum Ausfuehren einer Methode aus den Applikationen
- // #34191# Mit speziellem RefCounting, damit das Basic nicht durch CloseDocument()
- // abgeschossen werden kann. Rueckgabewert wird als String geliefert.
--ErrCode SbMethod::Call( SbxValue* pRet )
-+ErrCode SbMethod::Call( SbxValue* pRet, SbxVariable* pCaller )
- {
-+ if ( pCaller )
-+ {
-+ OSL_TRACE("SbMethod::Call Have been passed a caller 0x%x", pCaller );
-+ mCaller = pCaller;
-+ }
- // RefCount vom Modul hochzaehlen
- SbModule* pMod_ = (SbModule*)GetParent();
- pMod_->AddRef();
-@@ -2047,7 +2054,7 @@ ErrCode SbMethod::Call( SbxValue* pRet )
- // Objekte freigeben
- pMod_->ReleaseRef();
- pBasic->ReleaseRef();
--
-+ mCaller = 0;
- return nErr;
- }
-
---- /data4/Latest/ooo-build/build/ooh680-m1/basic/source/runtime/runtime.cxx 2008-01-08 09:36:28.000000000 +0000
-+++ basic/source/runtime/runtime.cxx 2007-12-20 11:23:14.000000000 +0000
-@@ -491,7 +491,7 @@ SbxArray* SbiInstance::GetLocals( SbMeth
-
- SbiRuntime::SbiRuntime( SbModule* pm, SbMethod* pe, UINT32 nStart )
- : rBasic( *(StarBASIC*)pm->pParent ), pInst( pINST ),
-- pMod( pm ), pMeth( pe ), pImg( pMod->pImage ), m_nLastTime(0)
-+ pMod( pm ), pMeth( pe ), pImg( pMod->pImage ), mpExtCaller(0), m_nLastTime(0)
- {
- nFlags = pe ? pe->GetDebugFlags() : 0;
- pIosys = pInst->pIosys;
-@@ -545,6 +545,18 @@ SbiRuntime::~SbiRuntime()
- }
- }
-
-+void SbiRuntime::SetVBAEnabled(bool bEnabled )
-+{
-+ bVBAEnabled = bEnabled;
-+ if ( bVBAEnabled )
-+ {
-+ if ( pMeth )
-+ mpExtCaller = pMeth->mCaller;
-+ }
-+ else
-+ mpExtCaller = 0;
-+}
-+
- // Aufbau der Parameterliste. Alle ByRef-Parameter werden direkt
- // uebernommen; von ByVal-Parametern werden Kopien angelegt. Falls
- // ein bestimmter Datentyp verlangt wird, wird konvertiert.
---- /data4/Latest/ooo-build/build/ooh680-m1/basic/source/inc/runtime.hxx 2008-01-08 09:36:28.000000000 +0000
-+++ basic/source/inc/runtime.hxx 2007-12-20 11:21:36.000000000 +0000
-@@ -338,6 +338,7 @@ class SbiRuntime
- SbxArrayRef refCaseStk; // CASE expression stack
- SbxArrayRef refRedimpArray; // Array saved to use for REDIM PRESERVE
- SbxVariableRef xDummyVar; // Ersatz fuer nicht gefundene Variablen
-+ SbxVariable* mpExtCaller; // Caller ( external - e.g. button name, shape, range object etc. - only in vba mode )
- SbiArgvStack* pArgvStk; // ARGV-Stack
- SbiGosubStack* pGosubStk; // GOSUB stack
- SbiForStack* pForStk; // FOR/NEXT-Stack
-@@ -479,7 +480,7 @@ class SbiRuntime
- void StepFIND_CM( UINT32, UINT32 );
- void StepFIND_STATIC( UINT32, UINT32 );
- public:
-- void SetVBAEnabled( bool bEnabled ) { bVBAEnabled = bEnabled; };
-+ void SetVBAEnabled( bool bEnabled );
- USHORT GetImageFlag( USHORT n ) const;
- USHORT GetBase();
- xub_StrLen nLine,nCol1,nCol2; // aktuelle Zeile, Spaltenbereich
-@@ -502,6 +503,7 @@ public:
- SbMethod* GetCaller();
- SbxArray* GetLocals();
- SbxArray* GetParams();
-+ SbxVariable* GetExternalCaller(){ return mpExtCaller; }
-
- SbxBase* FindElementExtern( const String& rName );
- static bool isVBAEnabled();
---- /data4/Latest/ooo-build/build/ooh680-m1/basic/source/runtime/methods.cxx 2008-01-08 09:36:28.000000000 +0000
-+++ basic/source/runtime/methods.cxx 2007-12-19 16:44:56.000000000 +0000
-@@ -948,6 +948,26 @@ RTLFUNC(Hex)
- }
- }
-
-+RTLFUNC(FuncCaller)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+ if ( SbiRuntime::isVBAEnabled() && pINST && pINST->pRun )
-+ {
-+ if ( pINST->pRun->GetExternalCaller() )
-+ *rPar.Get(0) = *pINST->pRun->GetExternalCaller();
-+ else
-+ {
-+ SbxVariableRef pVar = new SbxVariable(SbxVARIANT);
-+ *rPar.Get(0) = *pVar;
-+ }
-+ }
-+ else
-+ {
-+ StarBASIC::Error( SbERR_NOT_IMPLEMENTED );
-+ }
-+
-+}
- // InStr( [start],string,string,[compare] )
-
- RTLFUNC(InStr)
-
---- /data4/Latest/ooo-build/build/ooh680-m1/basic/source/runtime/stdobj.cxx 2008-01-08 09:36:28.000000000 +0000
-+++ basic/source/runtime/stdobj.cxx 2007-12-19 16:26:50.000000000 +0000
-@@ -608,6 +608,7 @@ static Methods aMethods[] = {
-
- { "Wait", SbxNULL, 1 | _FUNCTION, RTLNAME(Wait),0 },
- { "Milliseconds", SbxLONG, 0,NULL,0 },
-+{ "FuncCaller", SbxVARIANT, _FUNCTION, RTLNAME(FuncCaller),0 },
- //#i64882#
- { "WaitUntil", SbxNULL, 1 | _FUNCTION, RTLNAME(WaitUntil),0 },
- { "Date", SbxDOUBLE, 0,NULL,0 },
---- /data4/Latest/ooo-build/build/ooh680-m1/basic/source/runtime/rtlproto.hxx 2008-01-08 09:36:28.000000000 +0000
-+++ basic/source/runtime/rtlproto.hxx 2007-12-19 16:38:09.000000000 +0000
-@@ -303,6 +303,7 @@ extern RTLFUNC(Switch);
- extern RTLFUNC(Wait);
- //i#64882# add new WaitUntil
- extern RTLFUNC(WaitUntil);
-+extern RTLFUNC(FuncCaller);
-
- extern RTLFUNC(GetGUIVersion);
- extern RTLFUNC(Choose);
---- /data4/Latest/ooo-build/build/ooh680-m1/sfx2/inc/sfx2/objsh.hxx 2008-01-08 09:36:27.000000000 +0000
-+++ sfx2/inc/sfx2/objsh.hxx 2008-01-10 11:25:23.000000000 +0000
-@@ -449,7 +449,8 @@ public:
- ::com::sun::star::uno::Any& aRet,
- ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam,
-- bool bRaiseError = true
-+ bool bRaiseError = true,
-+ ::com::sun::star::uno::Any* aCaller = 0
- );
-
- static ErrCode CallXScript(
-@@ -459,7 +460,8 @@ public:
- ::com::sun::star::uno::Any& aRet,
- ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam,
-- bool bRaiseError = true
-+ bool bRaiseError = true,
-+ ::com::sun::star::uno::Any* aCaller = 0
- );
-
- /** adjusts the internal macro mode, according to the current security settings
---- /data4/Latest/ooo-build/build/ooh680-m1/sfx2/source/doc/objmisc.cxx 2008-01-08 09:36:27.000000000 +0000
-+++ sfx2/source/doc/objmisc.cxx 2008-01-10 15:12:14.000000000 +0000
-@@ -1515,7 +1515,7 @@ namespace
- }
-
- ErrCode SfxObjectShell::CallXScript( const Reference< XInterface >& _rxScriptContext, const ::rtl::OUString& _rScriptURL,
-- const Sequence< Any >& aParams, Any& aRet, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam, bool bRaiseError )
-+ const Sequence< Any >& aParams, Any& aRet, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam, bool bRaiseError, ::com::sun::star::uno::Any* pCaller )
- {
- OSL_TRACE( "in CallXScript" );
- ErrCode nErr = ERRCODE_NONE;
-@@ -1546,7 +1546,16 @@ ErrCode SfxObjectShell::CallXScript( con
-
- // obtain the script, and execute it
- Reference< provider::XScript > xScript( xScriptProvider->getScript( _rScriptURL ), UNO_QUERY_THROW );
--
-+ if ( pCaller && pCaller->hasValue() )
-+ {
-+ Reference< beans::XPropertySet > xProps( xScript, uno::UNO_QUERY );
-+ if ( xProps.is() )
-+ {
-+ Sequence< uno::Any > aArgs( 1 );
-+ aArgs[ 0 ] = *pCaller;
-+ xProps->setPropertyValue( rtl::OUString::createFromAscii("Caller"), uno::makeAny( aArgs ) );
-+ }
-+ }
- aRet = xScript->invoke( aParams, aOutParamIndex, aOutParam );
- }
- catch ( const uno::Exception& )
-@@ -1580,9 +1589,9 @@ ErrCode SfxObjectShell::CallXScript( con
- ::com::sun::star::uno::Any& aRet,
- ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >&
-- aOutParam, bool bRaiseError )
-+ aOutParam, bool bRaiseError, ::com::sun::star::uno::Any* pCaller )
- {
-- return CallXScript( GetModel(), rScriptURL, aParams, aRet, aOutParamIndex, aOutParam, bRaiseError );
-+ return CallXScript( GetModel(), rScriptURL, aParams, aRet, aOutParamIndex, aOutParam, bRaiseError, pCaller );
- }
-
- //-------------------------------------------------------------------------
---- /data4/Latest/ooo-build/build/ooh680-m1/sc/source/ui/drawfunc/fusel.cxx 2008-01-08 09:36:20.000000000 +0000
-+++ sc/source/ui/drawfunc/fusel.cxx 2008-01-10 15:25:12.000000000 +0000
-@@ -221,13 +221,23 @@ BOOL __EXPORT FuSelection::MouseButtonDo
- SfxObjectShell* pObjSh = SfxObjectShell::Current();
- if ( pObjSh && SfxApplication::IsXScriptURL( pInfo->GetMacro() ) )
- {
-+ uno::Reference< beans::XPropertySet > xProps( pObj->getUnoShape(), uno::UNO_QUERY );
-+ uno::Any aCaller;
-+ if ( xProps.is() )
-+ {
-+ try
-+ {
-+ aCaller = xProps->getPropertyValue( rtl::OUString::createFromAscii("Name") );
-+ }
-+ catch( uno::Exception& ) {}
-+ }
- uno::Any aRet;
- uno::Sequence< sal_Int16 > aOutArgsIndex;
- uno::Sequence< uno::Any > aOutArgs;
- uno::Sequence< uno::Any >* pInArgs =
- new uno::Sequence< uno::Any >(0);
- pObjSh->CallXScript( pInfo->GetMacro(),
-- *pInArgs, aRet, aOutArgsIndex, aOutArgs);
-+ *pInArgs, aRet, aOutArgsIndex, aOutArgs, true, &aCaller );
- pViewShell->FakeButtonUp( pViewShell->GetViewData()->GetActivePart() );
- return TRUE; // kein CaptureMouse etc.
- }
---- /data4/Latest/ooo-build/build/ooh680-m1/sc/source/ui/drawfunc/makefile.mk 2005-09-08 22:00:04.000000000 +0100
-+++ sc/source/ui/drawfunc/makefile.mk 2008-01-10 15:19:30.000000000 +0000
-@@ -90,6 +90,7 @@ SLOFILES = \
- $(SLO)$/mediash.obj
-
- EXCEPTIONSFILES= \
-+ $(SLO)$/fusel.obj \
- $(SLO)$/fuins2.obj
-
- NOOPTFILES=\
---- /data4/Latest/ooo-build/build/ooh680-m1/svx/source/form/fmscriptingenv.cxx 2008-01-08 09:36:27.000000000 +0000
-+++ svx/source/form/fmscriptingenv.cxx 2008-01-10 12:10:21.000000000 +0000
-@@ -59,6 +59,8 @@
- #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
- #include <com/sun/star/reflection/XInterfaceMethodTypeDescription.hpp>
- #include <com/sun/star/lang/DisposedException.hpp>
-+#include <com/sun/star/lang/EventObject.hpp>
-+#include <com/sun/star/awt/XControl.hpp>
- /** === end UNO includes === **/
- #include <tools/diagnose_ex.h>
- #include <cppuhelper/implbase1.hxx>
-@@ -111,6 +115,9 @@ namespace svxform
- using ::com::sun::star::uno::Exception;
- using ::com::sun::star::uno::Sequence;
- using ::com::sun::star::uno::XInterface;
-+ using ::com::sun::star::lang::EventObject;
-+ using ::com::sun::star::awt::XControl;
-+ using ::com::sun::star::beans::XPropertySet;
- /** === end UNO using === **/
-
- class FormScriptingEnvironment;
-@@ -453,8 +460,19 @@ namespace svxform
- {
- Sequence< sal_Int16 > aOutArgsIndex;
- Sequence< Any > aOutArgs;
--
-- m_rObjectShell.CallXScript( m_sScriptCode, _rArguments, _rSynchronousResult, aOutArgsIndex, aOutArgs );
-+ EventObject aEvent;
-+ Any aCaller;
-+ if ( ( _rArguments.getLength() > 0 ) && ( _rArguments[ 0 ] >>= aEvent ) )
-+ {
-+ try
-+ {
-+ Reference< XControl > xControl( aEvent.Source, UNO_QUERY_THROW );
-+ Reference< XPropertySet > xProps( xControl->getModel(), UNO_QUERY_THROW );
-+ aCaller = xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ) );
-+ }
-+ catch( Exception& ) {}
-+ }
-+ m_rObjectShell.CallXScript( m_sScriptCode, _rArguments, _rSynchronousResult, aOutArgsIndex, aOutArgs, true, aCaller.hasValue() ? &aCaller : 0 );
- }
-
- //................................................................
---- /data4/Latest/ooo-build/build/ooh680-m1/scripting/source/vbaevents/eventhelper.cxx 2008-01-08 09:36:27.000000000 +0000
-+++ scripting/source/vbaevents/eventhelper.cxx 2008-01-10 14:39:12.000000000 +0000
-@@ -808,7 +808,16 @@ EventListener::firing_Impl(const ScriptE
- {
- uno::Reference< script::provider::XScript > xScript = xScriptProvider->getScript( url );
- if ( xScript.is() )
-- xScript->invoke( aArguments, aOutArgsIndex, aOutArgs );
-+ {
-+ uno::Reference< beans::XPropertySet > xProps( xScript, uno::UNO_QUERY );
-+ if ( xProps.is() )
-+ {
-+ Sequence< Any > aCallerHack(1);
-+ aCallerHack[ 0 ] = uno::makeAny( rtl::OUString::createFromAscii("Error") );
-+ xProps->setPropertyValue( rtl::OUString::createFromAscii( "Caller" ), uno::makeAny( aCallerHack ) );
-+ }
-+ xScript->invoke( aArguments, aOutArgsIndex, aOutArgs );
-+ }
- }
- catch ( uno::Exception& e )
- {
---- scripting/source/basprov/basscript.cxx 2008-04-25 18:33:48.000000000 +0100
-+++ scripting/source/basprov/basscript.cxx 2008-04-25 18:23:29.000000000 +0100
-@@ -64,7 +64,10 @@
- #include <basic/sbmeth.hxx>
- #include <basic/basmgr.hxx>
- #include <com/sun/star/script/provider/ScriptFrameworkErrorType.hpp>
--
-+#include "bcholder.hxx"
-+#include <comphelper/proparrhlp.hxx>
-+#include <comphelper/propertycontainer.hxx>
-+#include <com/sun/star/beans/PropertyAttribute.hpp>
- #include <map>
-
-
-@@ -73,6 +76,7 @@ using namespace ::com::sun::star::lang;
- using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::script;
- using namespace ::com::sun::star::document;
-+using namespace ::com::sun::star::beans;
-
- extern ::com::sun::star::uno::Any sbxToUnoValue( SbxVariable* pVar );
- extern void unoToSbxValue( SbxVariable* pVar, const ::com::sun::star::uno::Any& aValue );
-@@ -82,6 +86,10 @@ extern void unoToSbxValue( SbxVariable*
- namespace basprov
- {
- //.........................................................................
-+#define BASSCRIPT_PROPERTY_ID_CALLER 1
-+#define BASSCRIPT_PROPERTY_CALLER ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Caller" ) )
-+
-+#define BASSCRIPT_DEFAULT_ATTRIBS() PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT
-
- typedef ::std::map< sal_Int16, Any, ::std::less< sal_Int16 > > OutParamMap;
-
-@@ -92,22 +100,28 @@ namespace basprov
- // -----------------------------------------------------------------------------
-
- BasicScriptImpl::BasicScriptImpl( const ::rtl::OUString& funcName, SbMethodRef xMethod )
-- :m_xMethod( xMethod )
-+ : ::scripting_helper::OBroadcastHelperHolder( m_aMutex )
-+ ,OPropertyContainer( GetBroadcastHelper() )
-+ ,m_xMethod( xMethod )
- ,m_funcName( funcName )
- ,m_documentBasicManager( NULL )
- ,m_xDocumentScriptContext()
- {
-+ registerProperty( BASSCRIPT_PROPERTY_CALLER, BASSCRIPT_PROPERTY_ID_CALLER, BASSCRIPT_DEFAULT_ATTRIBS(), &m_caller, ::getCppuType( &m_caller ) );
- }
-
- // -----------------------------------------------------------------------------
-
- BasicScriptImpl::BasicScriptImpl( const ::rtl::OUString& funcName, SbMethodRef xMethod,
-- BasicManager& documentBasicManager, const Reference< XScriptInvocationContext >& documentScriptContext )
-- :m_xMethod( xMethod )
-+ BasicManager& documentBasicManager, const Reference< XScriptInvocationContext >& documentScriptContext ) : ::scripting_helper::OBroadcastHelperHolder( m_aMutex )
-+ ,OPropertyContainer( GetBroadcastHelper() )
-+ ,m_xMethod( xMethod )
- ,m_funcName( funcName )
- ,m_documentBasicManager( &documentBasicManager )
- ,m_xDocumentScriptContext( documentScriptContext )
- {
-+ //
-+ registerProperty( BASSCRIPT_PROPERTY_CALLER, BASSCRIPT_PROPERTY_ID_CALLER, BASSCRIPT_DEFAULT_ATTRIBS(), &m_caller, ::getCppuType( &m_caller ) );
- }
-
- // -----------------------------------------------------------------------------
-@@ -116,6 +130,48 @@ namespace basprov
- }
-
- // -----------------------------------------------------------------------------
-+ // XInterface
-+ // -----------------------------------------------------------------------------
-+
-+ IMPLEMENT_FORWARD_XINTERFACE2( BasicScriptImpl, BasicScriptImpl_BASE, OPropertyContainer )
-+
-+ // -----------------------------------------------------------------------------
-+ // XTypeProvider
-+ // -----------------------------------------------------------------------------
-+
-+ IMPLEMENT_FORWARD_XTYPEPROVIDER2( BasicScriptImpl, BasicScriptImpl_BASE, OPropertyContainer )
-+
-+ // -----------------------------------------------------------------------------
-+ // OPropertySetHelper
-+ // -----------------------------------------------------------------------------
-+
-+ ::cppu::IPropertyArrayHelper& BasicScriptImpl::getInfoHelper( )
-+ {
-+ return *getArrayHelper();
-+ }
-+
-+ // -----------------------------------------------------------------------------
-+ // OPropertyArrayUsageHelper
-+ // -----------------------------------------------------------------------------
-+
-+ ::cppu::IPropertyArrayHelper* BasicScriptImpl::createArrayHelper( ) const
-+ {
-+ Sequence< Property > aProps;
-+ describeProperties( aProps );
-+ return new ::cppu::OPropertyArrayHelper( aProps );
-+ }
-+
-+ // -----------------------------------------------------------------------------
-+ // XPropertySet
-+ // -----------------------------------------------------------------------------
-+
-+ Reference< XPropertySetInfo > BasicScriptImpl::getPropertySetInfo( ) throw (RuntimeException)
-+ {
-+ Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
-+ return xInfo;
-+ }
-+
-+ // -----------------------------------------------------------------------------
- // XScript
- // -----------------------------------------------------------------------------
-
-@@ -194,8 +250,14 @@ namespace basprov
- if ( m_documentBasicManager && m_xDocumentScriptContext.is() )
- aOldThisComponent = m_documentBasicManager->SetGlobalUNOConstant( "ThisComponent", makeAny( m_xDocumentScriptContext ) );
-
-+ if ( m_caller.getLength() && m_caller[ 0 ].hasValue() )
-+ {
-+ SbxVariableRef xCallerVar = new SbxVariable( SbxVARIANT );
-+ unoToSbxValue( static_cast< SbxVariable* >( xCallerVar ), m_caller[ 0 ] );
-+ nErr = m_xMethod->Call( xReturn, xCallerVar );
-+ }
-+ else
- nErr = m_xMethod->Call( xReturn );
--
- if ( m_documentBasicManager && m_xDocumentScriptContext.is() )
- m_documentBasicManager->SetGlobalUNOConstant( "ThisComponent", aOldThisComponent );
- }
diff --git a/patches/vba/basic-ide-module-object-name-combile.diff b/patches/vba/basic-ide-module-object-name-combile.diff
deleted file mode 100644
index ecea8b877..000000000
--- a/patches/vba/basic-ide-module-object-name-combile.diff
+++ /dev/null
@@ -1,98 +0,0 @@
---- oovbaapi/ooo/vba/excel/XWorksheet.idl.old 2009-04-06 16:42:00.000000000 +0000
-+++ oovbaapi/ooo/vba/excel/XWorksheet.idl 2009-04-06 16:42:00.000000000 +0000
-@@ -42,6 +42,9 @@
- #include <com/sun/star/script/XInvocation.idl>
- #endif
-
-+#ifndef __com_sun_star_container_XNamed_idl__
-+#include <com/sun/star/container/XNamed.idl>
-+#endif
- //=============================================================================
-
- module ooo { module vba { module excel {
-@@ -57,8 +60,8 @@ interface XWorksheet
- {
- interface ::ooo::vba::XHelperInterface;
- interface ::com::sun::star::script::XInvocation;
-+ interface ::com::sun::star::container::XNamed;
-
-- [attribute] string Name;
- [attribute] boolean Visible;
- [attribute, readonly] long StandardHeight;
- [attribute, readonly] long StandardWidth;
---- sc/source/ui/vba/vbaworksheet.hxx.old 2009-04-06 16:42:00.000000000 +0000
-+++ sc/source/ui/vba/vbaworksheet.hxx 2009-04-06 16:42:00.000000000 +0000
-@@ -45,6 +45,7 @@
- #include <ooo/vba/excel/XPageSetup.hpp>
- #include <ooo/vba/excel/XHPageBreaks.hpp>
- #include <ooo/vba/excel/XChartObjects.hpp>
-+#include <com/sun/star/container/XNamed.hpp>
-
- #include "vbahelperinterface.hxx"
-
---- basctl/source/basicide/basides2.cxx.old 2009-04-06 16:41:59.000000000 +0000
-+++ basctl/source/basicide/basides2.cxx 2009-04-06 16:42:00.000000000 +0000
-@@ -55,11 +55,32 @@
- #include <tools/diagnose_ex.h>
- #include <sfx2/sfxdefs.hxx>
- #include <sfx2/signaturestate.hxx>
-+#include <com/sun/star/script/ModuleInfo.hpp>
-+#include <com/sun/star/container/XNameContainer.hpp>
-+#include <com/sun/star/container/XNamed.hpp>
-+#include <com/sun/star/lang/XServiceInfo.hpp>
-
- using namespace ::com::sun::star;
- using namespace ::com::sun::star::uno;
- namespace css = ::com::sun::star;
-
-+void lcl_getObjectName( const uno::Reference< container::XNameContainer >& rLib, const String& rModName, String& rObjName )
-+{
-+ uno::Any aElement( rLib->getByName( rModName ) );
-+ script::ModuleInfo aModuleInfo;
-+ if( aElement >>= aModuleInfo )
-+ {
-+ uno::Any aObject( aModuleInfo.ModuleObject );
-+ uno::Reference< lang::XServiceInfo > xServiceInfo( aObject, uno::UNO_QUERY );
-+ if( xServiceInfo.is() && xServiceInfo->supportsService( rtl::OUString::createFromAscii( "org.openoffice.excel.Worksheet" ) ) )
-+ {
-+ uno::Reference< container::XNamed > xNamed( aObject, uno::UNO_QUERY );
-+ if( xNamed.is() )
-+ rObjName = xNamed->getName();
-+ }
-+ }
-+}
-+
- IMPL_LINK_INLINE_START( BasicIDEShell, ObjectDialogCancelHdl, ObjectCatalog *, EMPTYARG )
- {
- ShowObjectDialog( FALSE, TRUE );
-@@ -232,7 +253,7 @@ ModulWindow* BasicIDEShell::CreateBasWin
- if ( !aLibName.Len() )
- aLibName = String::CreateFromAscii( "Standard" );
-
-- rDocument.getOrCreateLibrary( E_SCRIPTS, aLibName );
-+ uno::Reference< container::XNameContainer > xLib = rDocument.getOrCreateLibrary( E_SCRIPTS, aLibName );
-
- if ( !aModName.Len() )
- aModName = rDocument.createObjectName( E_SCRIPTS, aLibName );
-@@ -272,7 +293,20 @@ ModulWindow* BasicIDEShell::CreateBasWin
- DBG_ASSERT( nKey, "CreateBasWin: Kein Key- Fenster nicht gefunden!" );
- }
- if( nKey )
-- pTabBar->InsertPage( (USHORT)nKey, aModName );
-+ {
-+ if( xLib.is() )
-+ {
-+ // display a nice friendly name in the ObjectModule tab,
-+ // combining the objectname and module name, e.g. Sheet1 ( Financials )
-+ String sObjName;
-+ lcl_getObjectName( xLib, rModName, sObjName );
-+ if( sObjName.Len() )
-+ {
-+ aModName.AppendAscii(" (").Append(sObjName).AppendAscii(")");
-+ }
-+ }
-+ pTabBar->InsertPage( (USHORT)nKey, aModName );
-+ }
- pTabBar->Sort();
- pWin->GrabScrollBars( &aHScrollBar, &aVScrollBar );
- if ( !pCurWin )
diff --git a/patches/vba/basic-ide-objectmodule.diff b/patches/vba/basic-ide-objectmodule.diff
deleted file mode 100644
index 16ac701d0..000000000
--- a/patches/vba/basic-ide-objectmodule.diff
+++ /dev/null
@@ -1,41 +0,0 @@
---- basctl/source/basicide/bastypes.cxx.orig 2008-08-20 18:25:53.000000000 +0800
-+++ basctl/source/basicide/bastypes.cxx 2008-08-19 18:40:27.000000000 +0800
-@@ -60,6 +60,7 @@
- #include <com/sun/star/script/XLibraryContainer2.hpp>
- #endif
- #include <com/sun/star/script/XLibraryContainerPassword.hpp>
-+#include <com/sun/star/script/ModuleType.hpp>
-
- using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star;
-@@ -640,8 +641,30 @@ void __EXPORT BasicIDETabBar::Command( c
- aPopup.EnableItem( SID_BASICIDE_RENAMECURRENT, FALSE );
- aPopup.RemoveDisabledEntries();
- }
-+
-+ // disable to delete or remove object modules in IDE
-+ BasicManager* pBasMgr = aDocument.getBasicManager();
-+ if ( pBasMgr )
-+ {
-+ StarBASIC* pBasic = pBasMgr->GetLib( aOULibName );
-+ if( pBasic )
-+ {
-+ IDEWindowTable& aIDEWindowTable = pIDEShell->GetIDEWindowTable();
-+ IDEBaseWindow* pWin = aIDEWindowTable.Get( GetCurPageId() );
-+ if( pWin && pWin->ISA( ModulWindow ) )
-+ {
-+ SbModule* pActiveModule = (SbModule*)pBasic->FindModule( pWin->GetName() );
-+ if( pActiveModule && ( pActiveModule->GetModuleType() == script::ModuleType::Document ) )
-+ {
-+ aPopup.EnableItem( SID_BASICIDE_DELETECURRENT, FALSE );
-+ aPopup.EnableItem( SID_BASICIDE_RENAMECURRENT, FALSE );
-+ }
-+ }
-+ }
-+ }
- }
-
-+
- SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
- SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
- if ( pDispatcher )
diff --git a/patches/vba/basic-not-is-nothing.diff b/patches/vba/basic-not-is-nothing.diff
deleted file mode 100644
index 72fe8f2ab..000000000
--- a/patches/vba/basic-not-is-nothing.diff
+++ /dev/null
@@ -1,17 +0,0 @@
---- basic/source/comp/exprtree.cxx.orig 2008-07-16 13:59:41.000000000 +0800
-+++ basic/source/comp/exprtree.cxx 2008-07-21 09:30:56.000000000 +0800
-@@ -495,6 +495,14 @@ SbiExprNode* SbiExpression::Operand()
- switch( eTok = pParser->Peek() )
- {
- case SYMBOL:
-+ pRes = Term();
-+ // process something like "IF Not r Is Nothing Then .."
-+ if( pParser->IsVBASupportOn() && pParser->Peek() == IS )
-+ {
-+ eTok = pParser->Next();
-+ pRes = new SbiExprNode( pParser, pRes, eTok, Like() );
-+ }
-+ break;
- case DOT: // .with
- pRes = Term(); break;
- case NUMBER:
diff --git a/patches/vba/basic-public-dim-fix.diff b/patches/vba/basic-public-dim-fix.diff
deleted file mode 100644
index 194e04ba3..000000000
--- a/patches/vba/basic-public-dim-fix.diff
+++ /dev/null
@@ -1,115 +0,0 @@
-diff --git basic/inc/basic/sbmod.hxx basic/inc/basic/sbmod.hxx
-index ab496bc..d92bb84 100644
---- basic/inc/basic/sbmod.hxx
-+++ basic/inc/basic/sbmod.hxx
-@@ -38,6 +38,7 @@
- #include <rtl/ustring.hxx>
- #endif
- #include <com/sun/star/script/ModuleType.hpp>
-+#include <vector>
- class SbMethod;
- class SbProperty;
- class SbiRuntime;
-@@ -59,6 +60,7 @@ class SbModule : public SbxObject
- friend class SbClassModuleObject;
-
- SbModuleImpl* mpSbModuleImpl; // Impl data
-+ std::vector< String > mModuleVariableNames;
- SbModule();
- SbModule(const SbModule&);
-
-@@ -138,6 +140,8 @@ public:
- INT32 GetModuleType() { return mnType; }
- void SetModuleType( INT32 nType ) { mnType = nType; }
- bool GetIsProxyModule() { return bIsProxyModule; }
-+ void AddVarName( const String& aName );
-+ void RemoveVars();
- };
-
- #ifndef __SB_SBMODULEREF_HXX
-diff --git basic/source/classes/sbxmod.cxx basic/source/classes/sbxmod.cxx
-index cf5b5a5..36eb266 100644
---- basic/source/classes/sbxmod.cxx
-+++ basic/source/classes/sbxmod.cxx
-@@ -822,6 +822,33 @@ void SbModule::RunInit()
- }
-
- // Mit private/dim deklarierte Variablen loeschen
-+
-+void SbModule::AddVarName( const String& aName )
-+{
-+ // see if the name is added allready
-+ std::vector< String >::iterator it_end = mModuleVariableNames.end();
-+ for ( std::vector< String >::iterator it = mModuleVariableNames.begin(); it != it_end; ++it )
-+ {
-+ if ( aName == *it )
-+ return;
-+ }
-+ mModuleVariableNames.push_back( aName );
-+}
-+
-+void SbModule::RemoveVars()
-+{
-+ std::vector< String >::iterator it_end = mModuleVariableNames.end();
-+ for ( std::vector< String >::iterator it = mModuleVariableNames.begin(); it != it_end; ++it )
-+ {
-+ // We don't want a Find being called in a derived class ( e.g.
-+ // SbUserform because it could trigger say an initialise event
-+ // which would cause basic to be re-run in the middle of the init ( and remember RemoveVars is called from compile and we don't want code to run as part of the compile )
-+ SbxVariableRef p = SbModule::Find( *it, SbxCLASS_PROPERTY );
-+ if( p.Is() )
-+ Remove (p);
-+ }
-+}
-+
- void SbModule::ClearPrivateVars()
- {
- for( USHORT i = 0 ; i < pProps->Count() ; i++ )
-diff --git basic/source/comp/sbcomp.cxx basic/source/comp/sbcomp.cxx
-index 8af8285..047f30e 100644
---- basic/source/comp/sbcomp.cxx
-+++ basic/source/comp/sbcomp.cxx
-@@ -134,6 +134,7 @@ BOOL SbModule::Compile()
- if( bRet )
- {
- pBasic->ClearAllModuleVars();
-+ RemoveVars(); // remove 'this' Modules variables
- // clear all method statics
- for( USHORT i = 0; i < pMethods->Count(); i++ )
- {
-diff --git basic/source/runtime/step2.cxx basic/source/runtime/step2.cxx
-index 38e794d..644ecdb 100644
---- basic/source/runtime/step2.cxx
-+++ basic/source/runtime/step2.cxx
-@@ -1131,16 +1131,26 @@ void SbiRuntime::StepGLOBAL( UINT32 nOp1, UINT32 nOp2 )
- if( pImg->GetFlag( SBIMG_CLASSMODULE ) )
- StepPUBLIC_Impl( nOp1, nOp2, true );
-
-+ SbxObject* pStorage = &rBasic;
- String aName( pImg->GetString( static_cast<short>( nOp1 ) ) );
-+ // Store module scope variables at module scope
-+ // in non vba mode these are stored at the library level :/
-+ // not sure if this really should not be enabled for ALL basic
-+ if ( SbiRuntime::isVBAEnabled() )
-+ {
-+ pStorage = pMod;
-+ pMod->AddVarName( aName );
-+ }
-+
- SbxDataType t = (SbxDataType) nOp2;
-- BOOL bFlag = rBasic.IsSet( SBX_NO_MODIFY );
-+ BOOL bFlag = pStorage->IsSet( SBX_NO_MODIFY );
- rBasic.SetFlag( SBX_NO_MODIFY );
-- SbxVariableRef p = rBasic.Find( aName, SbxCLASS_PROPERTY );
-+ SbxVariableRef p = pStorage->Find( aName, SbxCLASS_PROPERTY );
- if( p.Is() )
-- rBasic.Remove (p);
-- p = rBasic.Make( aName, SbxCLASS_PROPERTY, t );
-+ pStorage->Remove (p);
-+ p = pStorage->Make( aName, SbxCLASS_PROPERTY, t );
- if( !bFlag )
-- rBasic.ResetFlag( SBX_NO_MODIFY );
-+ pStorage->ResetFlag( SBX_NO_MODIFY );
- if( p )
- {
- p->SetFlag( SBX_DONTSTORE );
diff --git a/patches/vba/basic-replace-function-fix.diff b/patches/vba/basic-replace-function-fix.diff
deleted file mode 100644
index e7cbe7aea..000000000
--- a/patches/vba/basic-replace-function-fix.diff
+++ /dev/null
@@ -1,50 +0,0 @@
---- basic/source/runtime/methods.cxx.orig 2008-07-22 22:11:52.000000000 +0800
-+++ basic/source/runtime/methods.cxx 2008-07-23 10:27:43.000000000 +0800
-@@ -1401,26 +1401,33 @@ RTLFUNC(Replace)
- if ( nArgCount == 6 )
- bTextMode = rPar.Get(6)->GetInteger();
-
-- USHORT nStrLen = aExpStr.Len();
-+ USHORT nExpStrLen = aExpStr.Len();
-+ USHORT nFindStrLen = aFindStr.Len();
-+ USHORT nReplaceStrLen = aReplaceStr.Len();
-
-- if( lStartPos <= nStrLen )
-+ if( lStartPos <= nExpStrLen )
- {
-- String aSrcStr( aExpStr );
-- if( bTextMode )
-+ USHORT nPos = static_cast<USHORT>( lStartPos - 1 );
-+ USHORT nCounts = 0;
-+ while( lCount == -1 || lCount > nCounts )
- {
-+ String aSrcStr( aExpStr );
-+ if( bTextMode )
-+ {
- aSrcStr.ToUpperAscii();
- aFindStr.ToUpperAscii();
-- }
--
-- USHORT nPos = aSrcStr.Search( aFindStr, static_cast<USHORT>( lStartPos - 1 ) );
-- USHORT nCounts = 0;
-- USHORT nReplaceLength = aReplaceStr.Len() ? aReplaceStr.Len():1;
-- while( nPos != STRING_NOTFOUND && (lCount == -1 || lCount > nCounts) )
-- {
-- aExpStr.Replace( nPos, aFindStr.Len(), aReplaceStr );
-- nPos = nPos + nReplaceLength;
-+ }
- nPos = aSrcStr.Search( aFindStr, nPos );
-- nCounts++;
-+ if( nPos != STRING_NOTFOUND )
-+ {
-+ aExpStr.Replace( nPos, nFindStrLen, aReplaceStr );
-+ nPos = nPos - nFindStrLen + nReplaceStrLen + 1;
-+ nCounts++;
-+ }
-+ else
-+ {
-+ break;
-+ }
- }
- }
- rPar.Get(0)->PutString( aExpStr.Copy( static_cast<USHORT>(lStartPos - 1) ) );
diff --git a/patches/vba/basic-speedup-fix.diff b/patches/vba/basic-speedup-fix.diff
deleted file mode 100644
index e6734fc14..000000000
--- a/patches/vba/basic-speedup-fix.diff
+++ /dev/null
@@ -1,260 +0,0 @@
-diff -rup basic/source/classes/sbxmod.cxx basic/source/classes/sbxmod.cxx
---- basic/source/classes/sbxmod.cxx 2007-01-02 17:08:45.000000000 +0000
-+++ basic/source/classes/sbxmod.cxx 2007-01-02 13:01:06.000000000 +0000
-@@ -769,7 +769,10 @@ USHORT SbModule::Run( SbMethod* pMeth )
- pRt->pNext->block();
- pINST->pRun = pRt;
- if ( SbiRuntime ::isVBAEnabled() )
-+ {
- pINST->EnableCompatibility( TRUE );
-+ pRt->SetVBAEnabled( true );
-+ }
- while( pRt->Step() ) {}
- if( pRt->pNext )
- pRt->pNext->unblock();
-diff -rup basic/source/inc/runtime.hxx basic/source/inc/runtime.hxx
---- basic/source/inc/runtime.hxx 2007-01-02 17:08:45.000000000 +0000
-+++ basic/source/inc/runtime.hxx 2007-01-02 16:29:59.000000000 +0000
-@@ -61,6 +61,7 @@
- #endif
-
- #include <vector>
-+#include <hash_map>
- #ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_
- #include <com/sun/star/lang/XComponent.hpp>
- #endif
-@@ -77,6 +78,8 @@ using namespace com::sun::star::lang;
- using namespace com::sun::star::container;
-
-
-+typedef std::hash_map< UINT32, UINT32 > LocalOpIndexHash;
-+
- // Define activates old file implementation
- // (only in non UCB case)
- // #define _OLD_FILE_IMPL
-@@ -352,6 +355,7 @@ class SbiRuntime
- String aLibName; // Lib-Name fuer Declare-Call
- SbxArrayRef refParams; // aktuelle Prozedur-Parameter
- SbxArrayRef refLocals; // lokale Variable
-+ LocalOpIndexHash localIndex;
- SbxArrayRef refArgv; // aktueller Argv
- // AB, 28.3.2000 #74254, Ein refSaveObj reicht nicht! Neu: pRefSaveList (s.u.)
- //SbxVariableRef refSaveObj; // #56368 Bei StepElem Referenz sichern
-@@ -360,6 +364,7 @@ class SbiRuntime
- BOOL bError; // TRUE: Fehler behandeln
- BOOL bInError; // TRUE: in einem Fehler-Handler
- BOOL bBlocked; // TRUE: blocked by next call level, #i48868
-+ BOOL bVBAEnabled;
- USHORT nFlags; // Debugging-Flags
- SbError nError; // letzter Fehler
- USHORT nOps; // Opcode-Zaehler
-@@ -474,6 +479,7 @@ class SbiRuntime
- void StepDCREATE_REDIMP(UINT32,UINT32), StepDCREATE_IMPL(UINT32,UINT32);
- void StepFIND_CM( UINT32, UINT32 );
- public:
-+ void SetVBAEnabled( bool bEnabled ) { bVBAEnabled = bEnabled; };
- USHORT GetImageFlag( USHORT n ) const;
- USHORT GetBase();
- xub_StrLen nLine,nCol1,nCol2; // aktuelle Zeile, Spaltenbereich
-diff -rup basic/source/runtime/runtime.cxx basic/source/runtime/runtime.cxx
---- basic/source/runtime/runtime.cxx 2007-01-02 17:08:45.000000000 +0000
-+++ basic/source/runtime/runtime.cxx 2007-01-02 13:01:06.000000000 +0000
-@@ -542,6 +542,7 @@ SbiRuntime::SbiRuntime( SbModule* pm, Sb
- #endif
- pRefSaveList = NULL;
- pItemStoreList = NULL;
-+ bVBAEnabled = isVBAEnabled();
- }
-
- SbiRuntime::~SbiRuntime()
-@@ -810,7 +811,7 @@ void SbiRuntime::Error( SbError n )
- if( n )
- {
- nError = n;
-- if ( isVBAEnabled() )
-+ if ( bVBAEnabled )
- {
- String aMsg = pInst->GetErrorMsg();
- // If a message is defined use that ( in preference to
-diff -rup basic/source/runtime/step0.cxx basic/source/runtime/step0.cxx
---- basic/source/runtime/step0.cxx 2007-01-02 17:08:45.000000000 +0000
-+++ basic/source/runtime/step0.cxx 2007-01-02 13:01:06.000000000 +0000
-@@ -72,7 +72,6 @@ void SbiRuntime::StepArith( SbxOperator
- TOSMakeTemp();
- SbxVariable* p2 = GetTOS();
-
-- bool bVBAInterop = SbiRuntime::isVBAEnabled();
-
- // This could & should be moved to the MakeTempTOS() method in runtime.cxx
- // In the code which this is cut'npaste from there is a check for a ref
-@@ -82,7 +81,7 @@ void SbiRuntime::StepArith( SbxOperator
- // here we alway seem to have a refcount of 1. Also it seems that
- // MakeTempTOS is called for other operation, so I hold off for now
- // until I have a better idea
-- if ( bVBAInterop
-+ if ( bVBAEnabled
- && ( p2->GetType() == SbxOBJECT || p2->GetType() == SbxVARIANT )
- )
- {
-@@ -252,14 +251,13 @@ void SbiRuntime::StepPUT()
- n = refVar->GetFlags();
- refVar->SetFlag( SBX_WRITE );
- }
-- bool bVBAInterop = SbiRuntime::isVBAEnabled();
-
- // if left side arg is an object or variant and right handside isn't
- // either an object or a variant then try and see if a default
- // property exists.
- // to use e.g. Range{"A1") = 34
- // could equate to Range("A1").Value = 34
-- if ( bVBAInterop )
-+ if ( bVBAEnabled )
- {
- if ( refVar->GetType() == SbxOBJECT )
- {
-@@ -277,7 +275,7 @@ void SbiRuntime::StepPUT()
-
- *refVar = *refVal;
- // lhs is a property who's value is currently null
-- if ( !bVBAInterop || ( bVBAInterop && refVar->GetType() != SbxEMPTY ) )
-+ if ( !bVBAEnabled || ( bVBAEnabled && refVar->GetType() != SbxEMPTY ) )
- // #67607 Uno-Structs kopieren
- checkUnoStructCopy( refVal, refVar );
- if( bFlagsChanged )
-@@ -410,7 +408,7 @@ void SbiRuntime::StepSET()
- {
- SbxVariableRef refVal = PopVar();
- SbxVariableRef refVar = PopVar();
-- StepSET_Impl( refVal, refVar, SbiRuntime::isVBAEnabled() ); // this is really assigment
-+ StepSET_Impl( refVal, refVar, bVBAEnabled ); // this is really assigment
- }
-
- void SbiRuntime::StepVBASET()
-diff -rup basic/source/runtime/step1.cxx basic/source/runtime/step1.cxx
---- basic/source/runtime/step1.cxx 2007-01-02 17:08:45.000000000 +0000
-+++ basic/source/runtime/step1.cxx 2007-01-02 13:01:06.000000000 +0000
-@@ -486,7 +486,7 @@ bool SbiRuntime::checkClass_Impl( const
- Error( SbERR_INVALID_USAGE_OBJECT );
- bOk = false;
- #else
-- if ( SbiRuntime::isVBAEnabled() && pObj->IsA( TYPE(SbUnoObject) ) )
-+ if ( bVBAEnabled && pObj->IsA( TYPE(SbUnoObject) ) )
- {
- SbUnoObject* pUnoObj = PTR_CAST(SbUnoObject,pObj);
- bOk = checkUnoObjectType( pUnoObj, aClass );
-@@ -508,7 +508,7 @@ bool SbiRuntime::checkClass_Impl( const
- }
- else
- {
-- if ( !SbiRuntime::isVBAEnabled() )
-+ if ( !bVBAEnabled )
- {
- if( bRaiseErrors )
- Error( SbERR_NEEDS_OBJECT );
---- basic.bak/source/runtime/step2.cxx 2007-01-05 14:19:27.000000000 +0000
-+++ basic/source/runtime/step2.cxx 2007-01-05 15:46:45.000000000 +0000
-@@ -111,8 +111,6 @@ SbxVariable* SbiRuntime::FindElement
- ( SbxObject* pObj, UINT32 nOp1, UINT32 nOp2, SbError nNotFound, BOOL bLocal )
- {
-
-- bool bIsVBAInterOp = SbiRuntime::isVBAEnabled();
--
- SbxVariable* pElem = NULL;
- if( !pObj )
- {
-@@ -123,29 +121,41 @@ SbxVariable* SbiRuntime::FindElement
- {
- BOOL bFatalError = FALSE;
- SbxDataType t = (SbxDataType) nOp2;
-- String aName( pImg->GetString( static_cast<short>( nOp1 & 0x7FFF ) ) );
--#ifdef ENABLE_VBA
-- bool bIsVBAInterOp = SbiRuntime::isVBAEnabled();
-- // Hacky capture of Evaluate [] syntax
-- // this should be tackled I feel at the pcode level
-- if ( bIsVBAInterOp && aName.Search('[') == 0 )
-- {
-- // emulate pcode here
-- StepARGC();
-- // psuedo StepLOADSC
-- String sArg = aName.Copy( 1, aName.Len() - 2 );
-- SbxVariable* p = new SbxVariable;
-- p->PutString( sArg );
-- PushVar( p );
-- //
-- StepARGV();
-- nOp1 = nOp1 | 0x8000; // indicate params are present
-- aName = String::CreateFromAscii("Evaluate");
-- }
--#endif //ENABLE_VBA
-+
-+ UINT32 nOp1Index = ( nOp1 & 0x7FFF );
-
- if( bLocal )
-- pElem = refLocals->Find( aName, SbxCLASS_DONTCARE );
-+ {
-+ LocalOpIndexHash::iterator it = localIndex.find( nOp1Index );
-+ if ( it != localIndex.end() )
-+ pElem = refLocals->Get( static_cast<USHORT>( it->second ) );
-+ }
-+
-+ String aName;
-+ if ( !pElem )
-+ {
-+ aName = pImg->GetString( static_cast<USHORT>( nOp1Index ) );
-+ // Hacky capture of Evaluate [] syntax
-+ // this should be tackled I feel at the pcode level
-+ if ( bVBAEnabled && aName.Search('[') == 0 )
-+ {
-+ // emulate pcode here
-+ StepARGC();
-+ // psuedo StepLOADSC
-+ String sArg = aName.Copy( 1, aName.Len() - 2 );
-+ SbxVariable* p = new SbxVariable;
-+ p->PutString( sArg );
-+ PushVar( p );
-+ //
-+ StepARGV();
-+ nOp1 = nOp1 | 0x8000; // indicate params are present
-+ aName = String::CreateFromAscii("Evaluate");
-+ }
-+ if ( bLocal )
-+ pElem = refLocals->Find( aName, SbxCLASS_DONTCARE );
-+ }
-+
-+
- if( !pElem )
- {
- // Die RTL brauchen wir nicht mehr zu durchsuchen!
-@@ -174,7 +184,7 @@ SbxVariable* SbiRuntime::FindElement
-
- // i#i68894# if VBAInterOp favour searching vba globals
- // over searching for uno classess
-- if ( bIsVBAInterOp )
-+ if ( bVBAEnabled )
- {
- // Try Find in VBA symbols space
- pElem = VBAFind( aName, SbxCLASS_DONTCARE, &rBasic );
-@@ -212,6 +222,7 @@ SbxVariable* SbiRuntime::FindElement
- if ( bSetName )
- pElem->SetName( aName );
- refLocals->Put( pElem, refLocals->Count() );
-+ localIndex[ nOp1Index ] = ( refLocals->Count() - 1 );
- }
- }
-
-@@ -254,6 +265,7 @@ SbxVariable* SbiRuntime::FindElement
- pElem->SetFlag( SBX_FIXED );
- pElem->SetName( aName );
- refLocals->Put( pElem, refLocals->Count() );
-+ localIndex[ nOp1Index ] = ( refLocals->Count() - 1 );
- }
- }
- }
-@@ -1111,6 +1123,7 @@ void SbiRuntime::StepLOCAL( UINT32 nOp1,
- SbxVariable* p = new SbxVariable( t );
- p->SetName( aName );
- refLocals->Put( p, refLocals->Count() );
-+ localIndex[ nOp1 ] = ( refLocals->Count() - 1 );
- }
- }
-
diff --git a/patches/vba/calc-vba-volatile-user-func.diff b/patches/vba/calc-vba-volatile-user-func.diff
deleted file mode 100644
index 5e3d38038..000000000
--- a/patches/vba/calc-vba-volatile-user-func.diff
+++ /dev/null
@@ -1,908 +0,0 @@
-diff --git formula/inc/formula/FormulaCompiler.hxx formula/inc/formula/FormulaCompiler.hxx
-index d5c3410..a388926 100644
---- formula/inc/formula/FormulaCompiler.hxx
-+++ formula/inc/formula/FormulaCompiler.hxx
-@@ -219,6 +219,8 @@ public:
- */
- OpCode GetEnglishOpCode( const String& rName ) const;
-
-+ static bool IsOpCodeVolatile( OpCode eOp );
-+
- static BOOL DeQuote( String& rStr );
-
- static const String& GetNativeSymbol( OpCode eOp );
-diff --git formula/source/core/api/FormulaCompiler.cxx formula/source/core/api/FormulaCompiler.cxx
-index a0a1c1a..72e6409 100644
---- formula/source/core/api/FormulaCompiler.cxx
-+++ formula/source/core/api/FormulaCompiler.cxx
-@@ -744,6 +744,30 @@ OpCode FormulaCompiler::GetEnglishOpCode( const String& rName ) const
- return bFound ? (*iLook).second : OpCode(ocNone);
- }
-
-+bool FormulaCompiler::IsOpCodeVolatile( OpCode eOp )
-+{
-+ switch (eOp)
-+ {
-+ // no parameters:
-+ case ocRandom:
-+ case ocGetActDate:
-+ case ocGetActTime:
-+ // one parameter:
-+ case ocFormula:
-+ case ocInfo:
-+ // more than one parameters:
-+ // ocIndirect/ocIndirectXL otherwise would have to do
-+ // StopListening and StartListening on a reference for every
-+ // interpreted value.
-+ case ocIndirect:
-+ case ocIndirectXL:
-+ // ocOffset results in indirect references.
-+ case ocOffset:
-+ return true;
-+ }
-+ return false;
-+}
-+
- // Remove quotes, escaped quotes are unescaped.
- BOOL FormulaCompiler::DeQuote( String& rStr )
- {
-@@ -960,44 +984,32 @@ void FormulaCompiler::Factor()
- {
- if( nNumFmt == NUMBERFORMAT_UNDEFINED )
- nNumFmt = lcl_GetRetFormat( eOp );
-- // Functions that have to be always recalculated
-- switch( eOp )
-+
-+ if ( IsOpCodeVolatile(eOp) )
-+ pArr->SetRecalcModeAlways();
-+ else
- {
-- // no parameters:
-- case ocRandom:
-- case ocGetActDate:
-- case ocGetActTime:
-- // one parameter:
-- case ocFormula:
-- case ocInfo:
-- // more than one parameters:
-- // ocIndirect/ocIndirectXL otherwise would have to do
-- // StopListening and StartListening on a reference for every
-- // interpreted value.
-- case ocIndirect:
-- case ocIndirectXL:
-- // ocOffset results in indirect references.
-- case ocOffset:
-- pArr->SetRecalcModeAlways();
-- break;
-- // Functions recalculated on every document load.
-- // Don't use SetRecalcModeOnLoad() which would override
-- // ModeAlways.
-- case ocConvert :
-- pArr->AddRecalcMode( RECALCMODE_ONLOAD );
-- break;
-- // If the referred cell is moved the value changes.
-- case ocColumn :
-- case ocRow :
-- // ocCell needs recalc on move for some possible type values.
-- case ocCell :
-- pArr->SetRecalcModeOnRefMove();
-- break;
-- case ocHyperLink :
-- pArr->SetHyperLink(TRUE);
-- break;
-- default:
-- ; // nothing
-+ switch( eOp )
-+ {
-+ // Functions recalculated on every document load.
-+ // Don't use SetRecalcModeOnLoad() which would override
-+ // ModeAlways.
-+ case ocConvert :
-+ pArr->AddRecalcMode( RECALCMODE_ONLOAD );
-+ break;
-+ // If the referred cell is moved the value changes.
-+ case ocColumn :
-+ case ocRow :
-+ // ocCell needs recalc on move for some possible type values.
-+ case ocCell :
-+ pArr->SetRecalcModeOnRefMove();
-+ break;
-+ case ocHyperLink :
-+ pArr->SetHyperLink(TRUE);
-+ break;
-+ default:
-+ ; // nothing
-+ }
- }
- if (SC_OPCODE_START_NO_PAR <= eOp && eOp < SC_OPCODE_STOP_NO_PAR)
- {
---- sc/inc/document.hxx
-+++ sc/inc/document.hxx
-@@ -96,6 +96,7 @@ class ScDrawLayer;
- class ScExtDocOptions;
- class ScExternalRefManager;
- class ScFormulaCell;
-+class ScMacroManager;
- class ScMarkData;
- class ScOutlineTable;
- class ScPatternAttr;
-@@ -294,6 +295,8 @@ private:
- ::std::auto_ptr<ScClipParam> mpClipParam;
-
- ::std::auto_ptr<ScExternalRefManager> pExternalRefMgr;
-+ ::std::auto_ptr<ScMacroManager> mpMacroMgr;
-+
-
- // mutable for lazy construction
- mutable ::std::auto_ptr< ScFormulaParserPool >
-@@ -1510,6 +1513,7 @@ public:
- SC_DLLPUBLIC ScLkUpdMode GetLinkMode() const { return eLinkMode ;}
- void SetLinkMode( ScLkUpdMode nSet ) { eLinkMode = nSet;}
-
-+ SC_DLLPUBLIC ScMacroManager* GetMacroManager();
-
- private:
- ScDocument(const ScDocument& r); // disabled with no definition
-diff --git sc/inc/macromgr.hxx sc/inc/macromgr.hxx
-new file mode 100644
-index 0000000..35a3b2d
---- /dev/null
-+++ sc/inc/macromgr.hxx
-@@ -0,0 +1,70 @@
-+/*************************************************************************
-+ *
-+ * 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: document.hxx,v $
-+ * $Revision: 1.115.36.9 $
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef SC_MACROMGR_HXX
-+#define SC_MACROMGR_HXX
-+
-+#include <com/sun/star/container/XContainerListener.hpp>
-+
-+#include "rtl/ustring.hxx"
-+#include "scdllapi.h"
-+
-+#include <hash_map>
-+#include <memory>
-+
-+class ScDocument;
-+class ScFormulaCell;
-+class ScUserMacroDepTracker;
-+
-+class ScMacroManager
-+{
-+public:
-+ explicit ScMacroManager(ScDocument* pDoc);
-+ ~ScMacroManager();
-+
-+ SC_DLLPUBLIC void InitUserFuncData();
-+ SC_DLLPUBLIC void SetUserFuncVolatile( const rtl::OUString& sName, bool isVolatile );
-+ SC_DLLPUBLIC bool GetUserFuncVolatile( const rtl::OUString& sName );
-+
-+ void AddDependentCell(const ::rtl::OUString& aModuleName, ScFormulaCell* pCell);
-+ void RemoveDependentCell(ScFormulaCell* pCell);
-+ void BroadcastModuleUpdate(const ::rtl::OUString& aModuleName);
-+
-+private:
-+ typedef std::hash_map< ::rtl::OUString, bool, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > NameBoolMap;
-+ NameBoolMap mhFuncToVolatile;
-+ com::sun::star::uno::Reference< com::sun::star::container::XContainerListener > mxContainerListener;
-+
-+ ::std::auto_ptr<ScUserMacroDepTracker> mpDepTracker;
-+ ScDocument* mpDoc;
-+};
-+
-+#endif
-+
---- sc/source/core/data/cell.cxx
-+++ sc/source/core/data/cell.cxx
-@@ -54,6 +54,7 @@
- #include "recursionhelper.hxx"
- #include "postit.hxx"
- #include "externalrefmgr.hxx"
-+#include "macromgr.hxx"
- #include <svx/editobj.hxx>
- #include <svtools/intitem.hxx>
- #include <svx/flditem.hxx>
-@@ -855,6 +856,9 @@ ScFormulaCell::ScFormulaCell( const ScFormulaCell& rCell, ScDocument& rDoc, cons
- ScFormulaCell::~ScFormulaCell()
- {
- pDocument->RemoveFromFormulaTree( this );
-+ if (pCode->HasOpCode(ocMacro))
-+ pDocument->GetMacroManager()->RemoveDependentCell(this);
-+
- delete pCode;
- #ifdef DBG_UTIL
- eCellType = CELLTYPE_DESTROYED;
-@@ -1721,6 +1725,36 @@ void ScFormulaCell::InterpretTail( ScInterpretTailParameter eTailParam )
- // Reschedule verlangsamt das ganze erheblich, nur bei Prozentaenderung ausfuehren
- ScProgress::GetInterpretProgress()->SetStateCountDownOnPercent(
- pDocument->GetFormulaCodeInTree()/MIN_NO_CODES_PER_PROGRESS_UPDATE );
-+
-+ switch (p->GetVolatileType())
-+ {
-+ case ScInterpreter::VOLATILE:
-+ // Volatile via built-in volatile functions. No actions needed.
-+ break;
-+ case ScInterpreter::VOLATILE_MACRO:
-+ // The formula contains a volatile macro.
-+ pCode->SetRecalcModeAlways();
-+ pDocument->PutInFormulaTree(this);
-+ StartListeningTo(pDocument);
-+ break;
-+ case ScInterpreter::NOT_VOLATILE:
-+ if (pCode->IsRecalcModeAlways())
-+ {
-+ // The formula was previously volatile, but no more.
-+ EndListeningTo(pDocument);
-+ pCode->SetRecalcModeNormal();
-+ }
-+ else
-+ {
-+ // non-volatile formula. End listening to the area in case
-+ // it's listening due to macro module change.
-+ pDocument->EndListeningArea(BCA_LISTEN_ALWAYS, this);
-+ }
-+ pDocument->RemoveFromFormulaTree(this);
-+ break;
-+ default:
-+ ;
-+ }
- }
- else
- {
---- sc/source/core/data/documen2.cxx
-+++ sc/source/core/data/documen2.cxx
-@@ -96,6 +96,7 @@
- #include "externalrefmgr.hxx"
- #include "tabprotection.hxx"
- #include "formulaparserpool.hxx"
- #include "clipparam.hxx"
-+#include "macromgr.hxx"
- #include <com/sun/star/document/XVbaEventsHelper.hpp>
-
-@@ -157,7 +158,8 @@ ScDocument::ScDocument( ScDocumentMode eMode,
- pCacheFieldEditEngine( NULL ),
- pDocProtection( NULL ),
- mpClipParam( NULL),
-+ mpMacroMgr( NULL ),
- pExternalRefMgr( NULL ),
- pViewOptions( NULL ),
- pDocOptions( NULL ),
- pExtDocOptions( NULL ),
-diff --git sc/source/core/data/documen8.cxx sc/source/core/data/documen8.cxx
-index 077b6fa..f1b608c 100644
---- sc/source/core/data/documen8.cxx
-+++ sc/source/core/data/documen8.cxx
-@@ -96,7 +96,8 @@
- #include "globstr.hrc"
- #include "sc.hrc"
- #include "charthelper.hxx"
- #include "dpobject.hxx"
-+#include "macromgr.hxx"
-
- #define GET_SCALEVALUE(set,id) ((const SfxUInt16Item&)(set.Get( id ))).GetValue()
-
-@@ -427,6 +428,13 @@ BYTE ScDocument::GetEditTextDirection(SCTAB nTab) const
- return sal::static_int_cast<BYTE>(eRet);
- }
-
-+ScMacroManager* ScDocument::GetMacroManager()
-+{
-+ if (!mpMacroMgr.get())
-+ mpMacroMgr.reset(new ScMacroManager(this));
-+ return mpMacroMgr.get();
-+}
-+
- //------------------------------------------------------------------------
-
- void ScDocument::InvalidateTextWidth( const ScAddress* pAdrFrom, const ScAddress* pAdrTo,
-diff --git sc/source/core/data/document.cxx sc/source/core/data/document.cxx
-index 11af993..676883e 100644
---- sc/source/core/data/document.cxx
-+++ sc/source/core/data/document.cxx
-@@ -95,10 +95,14 @@
- #include "externalrefmgr.hxx"
- #include "tabprotection.hxx"
- #include "clipparam.hxx"
-+#include <basic/basmgr.hxx>
-+#include <com/sun/star/container/XContainer.hpp>
-
- #include <map>
- #include <limits>
-
-+using namespace ::com::sun::star;
-+
- namespace WritingMode2 = ::com::sun::star::text::WritingMode2;
- using ::com::sun::star::uno::Sequence;
- using ::com::sun::star::sheet::TablePageBreakData;
-diff --git sc/source/core/inc/interpre.hxx sc/source/core/inc/interpre.hxx
-index a72775d..3a45be6 100644
---- sc/source/core/inc/interpre.hxx
-+++ sc/source/core/inc/interpre.hxx
-@@ -128,6 +128,15 @@ public:
- static inline double div( const double& fNumerator, const double& fDenominator );
-
- ScMatrixRef GetNewMat(SCSIZE nC, SCSIZE nR);
-+
-+ enum VolatileType {
-+ VOLATILE,
-+ VOLATILE_MACRO,
-+ NOT_VOLATILE
-+ };
-+
-+ VolatileType GetVolatileType() const;
-+
- private:
- static ScTokenStack* pGlobalStack;
- static BOOL bGlobalStackInUse;
-@@ -161,6 +170,8 @@ private:
- BOOL bCalcAsShown; // precision as shown
- BOOL bMatrixFormula; // formula cell is a matrix formula
-
-+ VolatileType meVolaileType;
-+
- //---------------------------------Funktionen in interpre.cxx---------
- // nMust <= nAct <= nMax ? ok : PushError
- inline BOOL MustHaveParamCount( short nAct, short nMust );
-diff --git sc/source/core/tool/interpr4.cxx sc/source/core/tool/interpr4.cxx
-index baa5152..7fccd66 100644
---- sc/source/core/tool/interpr4.cxx
-+++ sc/source/core/tool/interpr4.cxx
-@@ -41,6 +41,7 @@
- #include <basic/sbmod.hxx>
- #include <basic/sbstar.hxx>
- #include <basic/sbx.hxx>
-+#include <basic/sbxobj.hxx>
- #include <basic/sbuno.hxx>
- #include <svtools/zforlist.hxx>
- #include <tools/urlobj.hxx>
-@@ -71,7 +72,9 @@
- #include "jumpmatrix.hxx"
- #include "parclass.hxx"
- #include "externalrefmgr.hxx"
- #include "doubleref.hxx"
-+#include "formula/FormulaCompiler.hxx"
-+#include "macromgr.hxx"
-
- #include <math.h>
- #include <float.h>
-@@ -78,6 +81,7 @@
- #include <algorithm>
- #include <functional>
- #include <vbahelper/vbahelper.hxx>
-+#include <basic/basmgr.hxx>
-
- using namespace com::sun::star;
- using namespace formula;
-@@ -2751,7 +2755,9 @@ void ScInterpreter::ScMacro()
- return;
- }
-
-+ bool bVolatileMacro = false;
- SbMethod* pMethod = (SbMethod*)pVar;
-+
- SbModule* pModule = pMethod->GetModule();
- bool bUseVBAObjects = pModule->IsVBACompat();
- SbxObject* pObject = pModule->GetParent();
-@@ -2891,6 +2897,13 @@ void ScInterpreter::ScMacro()
- pDok->DecMacroInterpretLevel();
- pDok->UnlockTable( aPos.Tab() );
-
-+ ScMacroManager* pMacroMgr = pDok->GetMacroManager();
-+ if (pMacroMgr)
-+ {
-+ bVolatileMacro = pMacroMgr->GetUserFuncVolatile( pMethod->GetName() );
-+ pMacroMgr->AddDependentCell(pModule->GetName(), pMyFormulaCell);
-+ }
-+
- SbxDataType eResType = refRes->GetType();
- if( pVar->GetError() )
- SetError( errNoValue);
-@@ -2962,6 +2975,9 @@ void ScInterpreter::ScMacro()
- }
-
- pSfxApp->LeaveBasicCall();
-+
-+ if (bVolatileMacro && meVolaileType == NOT_VOLATILE)
-+ meVolaileType = VOLATILE_MACRO;
- }
-
-
-@@ -3619,7 +3635,8 @@ ScInterpreter::ScInterpreter( ScFormulaCell* pCell, ScDocument* pDoc,
- pTokenMatrixMap( NULL ),
- pMyFormulaCell( pCell ),
- pFormatter( pDoc->GetFormatTable() ),
-- bCalcAsShown( pDoc->GetDocOptions().IsCalcAsShown() )
-+ bCalcAsShown( pDoc->GetDocOptions().IsCalcAsShown() ),
-+ meVolaileType(NOT_VOLATILE)
- {
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScTTT" );
- // pStack = new ScToken*[ MAXSTACK ];
-@@ -4060,6 +4077,9 @@ StackVar ScInterpreter::Interpret()
- default : PushError( errUnknownOpCode); break;
- }
-
-+ if (FormulaCompiler::IsOpCodeVolatile(eOp))
-+ meVolaileType = VOLATILE;
-+
- // Remember result matrix in case it could be reused.
- if (pTokenMatrixMap && sp && GetStackType() == svMatrix)
- pTokenMatrixMap->insert( ScTokenMatrixMap::value_type( pCur,
-diff --git sc/source/core/tool/interpr5.cxx sc/source/core/tool/interpr5.cxx
-index c5b4770..854c25d 100644
---- sc/source/core/tool/interpr5.cxx
-+++ sc/source/core/tool/interpr5.cxx
-@@ -324,6 +324,11 @@ ScMatrixRef ScInterpreter::GetNewMat(SCSIZE nC, SCSIZE nR)
- return pMat;
- }
-
-+ScInterpreter::VolatileType ScInterpreter::GetVolatileType() const
-+{
-+ return meVolaileType;
-+}
-+
- ScMatrixRef ScInterpreter::CreateMatrixFromDoubleRef( const FormulaToken* pToken,
- SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
- SCCOL nCol2, SCROW nRow2, SCTAB nTab2 )
-diff --git sc/source/filter/excel/excimp8.cxx sc/source/filter/excel/excimp8.cxx
-index 60c2f6d..846682b 100644
---- sc/source/filter/excel/excimp8.cxx
-+++ sc/source/filter/excel/excimp8.cxx
-@@ -99,6 +99,7 @@
- #include "stlpool.hxx"
- #include "stlsheet.hxx"
- #include "detfunc.hxx"
-+#include "macromgr.hxx"
-
- #include <com/sun/star/document/XDocumentProperties.hpp>
- #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
-@@ -107,6 +108,7 @@
- #include <cppuhelper/component_context.hxx>
-
- #include <com/sun/star/container/XNameContainer.hpp>
-+#include <sfx2/app.hxx>
-
- using namespace com::sun::star;
-
-@@ -279,7 +281,24 @@ void ImportExcel8::ReadBasic( void )
- SvxImportMSVBasic aBasicImport( *pShell, *xRootStrg, bLoadCode, bLoadStrg );
- bool bAsComment = !bLoadExecutable || !aGlobs.hasValue();
- aBasicImport.Import( EXC_STORAGE_VBA_PROJECT, EXC_STORAGE_VBA, bAsComment );
-- GetObjectManager().SetOleNameOverrideInfo( aBasicImport.ControlNameForObjectId() );
-+ if ( !bAsComment )
-+ {
-+ GetObjectManager().SetOleNameOverrideInfo( aBasicImport.ControlNameForObjectId() );
-+ ScDocument& rDoc = GetDoc();
-+ rDoc.GetMacroManager()->InitUserFuncData();
-+ // 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
-+ BasicManager* pAppMgr = SFX_APP()->GetBasicManager();
-+ if ( pAppMgr )
-+ pAppMgr->SetGlobalUNOConstant( "ThisComponent", makeAny( pShell->GetModel() ) );
-+ }
- }
- }
- }
-diff --git sc/source/ui/docshell/macromgr.cxx sc/source/ui/docshell/macromgr.cxx
-new file mode 100644
-index 0000000..97623f3
---- /dev/null
-+++ sc/source/ui/docshell/macromgr.cxx
-@@ -0,0 +1,217 @@
-+/*************************************************************************
-+ *
-+ * 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: document.hxx,v $
-+ * $Revision: 1.115.36.9 $
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_sc.hxx"
-+
-+// INCLUDE ---------------------------------------------------------------
-+
-+#include "macromgr.hxx"
-+#include "document.hxx"
-+
-+#include "basic/basmgr.hxx"
-+#include "cppuhelper/implbase1.hxx"
-+#include "sfx2/objsh.hxx"
-+#include "cell.hxx"
-+#include <com/sun/star/container/XContainer.hpp>
-+
-+#include <list>
-+
-+using namespace ::com::sun::star;
-+using ::com::sun::star::uno::RuntimeException;
-+using ::com::sun::star::uno::Reference;
-+using ::rtl::OUString;
-+using ::rtl::OUStringHash;
-+using ::std::hash_map;
-+using ::std::list;
-+using ::std::for_each;
-+using ::std::pair;
-+
-+// ============================================================================
-+
-+/**
-+ * A simple container to keep track of cells that depend on basic modules
-+ * changes. We don't check for duplicates at insertion time; instead, we
-+ * remove duplicates at query time.
-+ */
-+class ScUserMacroDepTracker
-+{
-+public:
-+ void addCell(const OUString& rModuleName, ScFormulaCell* pCell)
-+ {
-+ ModuleCellMap::iterator itr = maCells.find(rModuleName);
-+ if (itr == maCells.end())
-+ {
-+ pair<ModuleCellMap::iterator, bool> r = maCells.insert(
-+ ModuleCellMap::value_type(rModuleName, list<ScFormulaCell*>()));
-+
-+ if (!r.second)
-+ // insertion failed.
-+ return;
-+
-+ itr = r.first;
-+ }
-+ itr->second.push_back(pCell);
-+ }
-+
-+ void removeCell(ScFormulaCell* pCell)
-+ {
-+ ModuleCellMap::iterator itr = maCells.begin(), itrEnd = maCells.end();
-+ for (; itr != itrEnd; ++itr)
-+ itr->second.remove(pCell);
-+ }
-+
-+ void getCellsByModule(const OUString& rModuleName, list<ScFormulaCell*>& rCells)
-+ {
-+ ModuleCellMap::iterator itr = maCells.find(rModuleName);
-+ if (itr == maCells.end())
-+ return;
-+
-+ list<ScFormulaCell*>& rCellList = itr->second;
-+
-+ // Remove duplicates.
-+ rCellList.sort();
-+ rCellList.unique();
-+ // exception safe copy
-+ list<ScFormulaCell*> temp(rCellList);
-+ rCells.swap(temp);
-+ }
-+
-+private:
-+ typedef hash_map<OUString, list<ScFormulaCell*>, OUStringHash> ModuleCellMap;
-+ ModuleCellMap maCells;
-+};
-+
-+
-+// ============================================================================
-+
-+ScMacroManager::ScMacroManager(ScDocument* pDoc) :
-+ mpDepTracker(new ScUserMacroDepTracker),
-+ mpDoc(pDoc)
-+{
-+}
-+
-+ScMacroManager::~ScMacroManager()
-+{
-+}
-+
-+typedef ::cppu::WeakImplHelper1< ::com::sun::star::container::XContainerListener > ContainerListenerHelper;
-+
-+class VBAProjectListener : public ContainerListenerHelper
-+{
-+ ScMacroManager* mpMacroMgr;
-+public:
-+ VBAProjectListener( ScMacroManager* pMacroMgr ) : mpMacroMgr( pMacroMgr ) {}
-+ // XEventListener
-+ virtual void SAL_CALL disposing( const lang::EventObject& /*Source*/ ) throw(RuntimeException) {}
-+
-+ // XContainerListener
-+ virtual void SAL_CALL elementInserted( const container::ContainerEvent& /*Event*/ ) throw(RuntimeException){}
-+ virtual void SAL_CALL elementReplaced( const container::ContainerEvent& Event ) throw(RuntimeException)
-+ {
-+ rtl::OUString sModuleName;
-+ Event.Accessor >>= sModuleName;
-+ OSL_TRACE("VBAProjectListener::elementReplaced(%s)", rtl::OUStringToOString( sModuleName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ mpMacroMgr->InitUserFuncData();
-+ mpMacroMgr->BroadcastModuleUpdate(sModuleName);
-+ }
-+ virtual void SAL_CALL elementRemoved( const container::ContainerEvent& /*Event*/ ) throw(RuntimeException){}
-+
-+};
-+
-+void ScMacroManager::InitUserFuncData()
-+{
-+ // Clear hash_map
-+ mhFuncToVolatile.clear();
-+ String sProjectName( RTL_CONSTASCII_USTRINGPARAM("Standard") );
-+
-+ Reference< container::XContainer > xModuleContainer;
-+ SfxObjectShell* pShell = mpDoc->GetDocumentShell();
-+ if ( pShell && pShell->GetBasicManager()->GetName().Len() > 0 )
-+ sProjectName = pShell->GetBasicManager()->GetName();
-+ try
-+ {
-+ Reference< script::XLibraryContainer > xLibraries( pShell->GetBasicContainer(), uno::UNO_QUERY_THROW );
-+ xModuleContainer.set( xLibraries->getByName( sProjectName ), uno::UNO_QUERY_THROW );
-+
-+ if ( xModuleContainer.is() )
-+ {
-+ // remove old listener ( if there was one )
-+ if ( mxContainerListener.is() )
-+ xModuleContainer->removeContainerListener( mxContainerListener );
-+ // Create listener
-+ mxContainerListener = new VBAProjectListener( this );
-+ xModuleContainer->addContainerListener( mxContainerListener );
-+ }
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+}
-+
-+void ScMacroManager::SetUserFuncVolatile( const OUString& sName, bool isVolatile )
-+{
-+ mhFuncToVolatile[ sName ] = isVolatile;
-+}
-+
-+bool ScMacroManager::GetUserFuncVolatile( const OUString& sName )
-+{
-+ NameBoolMap::iterator it = mhFuncToVolatile.find( sName );
-+ if ( it == mhFuncToVolatile.end() )
-+ return false;
-+ return it->second;
-+}
-+
-+void ScMacroManager::AddDependentCell(const OUString& aModuleName, ScFormulaCell* pCell)
-+{
-+ mpDepTracker->addCell(aModuleName, pCell);
-+}
-+
-+void ScMacroManager::RemoveDependentCell(ScFormulaCell* pCell)
-+{
-+ mpDepTracker->removeCell(pCell);
-+}
-+
-+void ScMacroManager::BroadcastModuleUpdate(const OUString& aModuleName)
-+{
-+ list<ScFormulaCell*> aCells;
-+ mpDepTracker->getCellsByModule(aModuleName, aCells);
-+ list<ScFormulaCell*>::iterator itr = aCells.begin(), itrEnd = aCells.end();
-+ for (; itr != itrEnd; ++itr)
-+ {
-+ ScFormulaCell* pCell = *itr;
-+ mpDoc->PutInFormulaTree(pCell); // for F9 recalc
-+
-+ // for recalc on cell value change. If the cell is not volatile, the
-+ // cell stops listening right away after it gets re-interpreted.
-+ mpDoc->StartListeningArea(BCA_LISTEN_ALWAYS, pCell);
-+ }
-+}
-+
-diff --git sc/source/ui/docshell/makefile.mk sc/source/ui/docshell/makefile.mk
-index b48627e..e96d750 100644
---- sc/source/ui/docshell/makefile.mk
-+++ sc/source/ui/docshell/makefile.mk
-@@ -95,7 +95,8 @@ SLOFILES = \
- $(SLO)$/hiranges.obj \
- $(SLO)$/pntlock.obj \
- $(SLO)$/sizedev.obj \
-- $(SLO)$/editable.obj
-+ $(SLO)$/editable.obj \
-+ $(SLO)$/macromgr.obj
-
-
- EXCEPTIONSFILES= \
-@@ -105,7 +106,8 @@ EXCEPTIONSFILES= \
- $(SLO)$/docsh8.obj \
- $(SLO)$/externalrefmgr.obj \
- $(SLO)$/dbdocimp.obj \
-- $(SLO)$/docfunc.obj
-+ $(SLO)$/docfunc.obj \
-+ $(SLO)$/macromgr.obj
-
- SRS1NAME=$(TARGET)
- SRC1FILES = tpstat.src
-@@ -135,7 +137,8 @@ LIB1OBJFILES = \
- $(SLO)$/hiranges.obj \
- $(SLO)$/pntlock.obj \
- $(SLO)$/sizedev.obj \
-- $(SLO)$/editable.obj
-+ $(SLO)$/editable.obj \
-+ $(SLO)$/macromgr.obj
-
- # --- Tagets -------------------------------------------------------
-
-diff --git sc/source/ui/vba/vbaapplication.cxx sc/source/ui/vba/vbaapplication.cxx
-index 69121a0..c26a61d 100644
---- sc/source/ui/vba/vbaapplication.cxx
-+++ sc/source/ui/vba/vbaapplication.cxx
-@@ -61,6 +61,7 @@
- #include "vbatextboxshape.hxx"
- #include "vbaassistant.hxx"
- #include "sc.hrc"
-+#include "macromgr.hxx"
-
- #include <osl/file.hxx>
-
-@@ -87,7 +88,12 @@
- #include "unonames.hxx"
- #include "docsh.hxx"
- #include <vbahelper/helperdecl.hxx>
--
-+#include <basic/sbmeth.hxx>
-+#include <basic/sbmod.hxx>
-+#include <basic/sbstar.hxx>
-+#include <basic/sbx.hxx>
-+#include <basic/sbxobj.hxx>
-+#include <basic/sbuno.hxx>
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
- using ::com::sun::star::uno::Reference;
-@@ -1111,6 +1117,16 @@ ScVbaApplication::Volatile( const uno::Any& aVolatile ) throw ( uno::RuntimeExc
- {
- sal_Bool bVolatile = sal_True;
- aVolatile >>= bVolatile;
-+ SbMethod* pMeth = StarBASIC::GetActiveMethod();
-+ if ( pMeth )
-+ {
-+ OSL_TRACE("ScVbaApplication::Volatile() In method ->%s<-", rtl::OUStringToOString( pMeth->GetName(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ uno::Reference< frame::XModel > xModel( getCurrentDocument() );
-+ ScDocument* pDoc = excel::getDocShell( xModel )->GetDocument();
-+ pDoc->GetMacroManager()->SetUserFuncVolatile( pMeth->GetName(), bVolatile);
-+ }
-+
-+// this is bound to break when loading the document
- return;
- /*
- if ( bVolatile )
-diff --git sc/source/ui/vba/vbadialog.cxx sc/source/ui/vba/vbadialog.cxx
-index 7383f5d..abfa6d3 100644
---- sc/source/ui/vba/vbadialog.cxx
-+++ sc/source/ui/vba/vbadialog.cxx
-@@ -47,6 +47,7 @@ void
- ScVbaDialog::Show() throw(uno::RuntimeException)
- {
- rtl::OUString aURL;
-+ // #FIXME - should this really use the current document?
- uno::Reference< frame::XModel > xModel = getCurrentDocument();
- if ( xModel.is() )
- {
-diff --git sc/source/ui/vba/vbarange.cxx sc/source/ui/vba/vbarange.cxx
-index 7a31267..5f62736 100644
---- sc/source/ui/vba/vbarange.cxx
-+++ sc/source/ui/vba/vbarange.cxx
-@@ -1976,6 +1976,7 @@ ScVbaRange::Select() throw (uno::RuntimeException)
- // ThisComponent.CurrentController.Frame.getContainerWindow.SetFocus
- try
- {
-+ // #FIXME don't use current document
- uno::Reference< frame::XController > xController( getCurrentDocument()->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 );
-@@ -2026,8 +2027,10 @@ ScVbaRange::Activate() throw (uno::RuntimeException)
- table::CellRangeAddress thisRangeAddress = xThisRangeAddress->getRangeAddress();
-
- // get current selection
-+ // #FIXME don't use getCurrentDocument
- uno::Reference< sheet::XCellRangeAddressable > xRange( getCurrentDocument()->getCurrentSelection(), ::uno::UNO_QUERY);
-
-+ // #FIXME don't use getCurrentDocument
- uno::Reference< sheet::XSheetCellRanges > xRanges( getCurrentDocument()->getCurrentSelection(), ::uno::UNO_QUERY);
-
- if ( xRanges.is() )
-@@ -2541,8 +2544,10 @@ 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 >() );
-+ // #FIXME doen't use current document
- uno::Reference< view::XSelectionSupplier > xSelection( getCurrentDocument()->getCurrentController(), uno::UNO_QUERY_THROW );
- // save old selection
-+ // #FIXME doen't use current document
- uno::Reference< uno::XInterface > xSel( getCurrentDocument()->getCurrentSelection() );
- // select this range
- xSelection->select( uno::makeAny( mxRange ) );
-@@ -3900,6 +3905,7 @@ ScVbaRange::ApplicationRange( const uno::Reference< uno::XComponentContext >& xC
- }
- }
- }
-+ // #FIXME don't use current document
- uno::Reference< sheet::XSpreadsheetView > xView( getCurrentDocument()->getCurrentController(), uno::UNO_QUERY );
- uno::Reference< table::XCellRange > xSheetRange( xView->getActiveSheet(), uno::UNO_QUERY_THROW );
- ScVbaRange* pRange = new ScVbaRange( uno::Reference< XHelperInterface >(), xContext, xSheetRange );
-diff --git sc/source/ui/vba/vbashape.cxx sc/source/ui/vba/vbashape.cxx
-index a8d9e82..a231cad 100644
---- sc/source/ui/vba/vbashape.cxx
-+++ sc/source/ui/vba/vbashape.cxx
-@@ -431,6 +431,7 @@ ScVbaShape::ScaleWidth( double Factor, sal_Bool /*RelativeToOriginalSize*/, sal_
- void SAL_CALL
- ScVbaShape::Select( const uno::Any& /*Replace*/ ) throw ( uno::RuntimeException )
- {
-+ // #FIXME don't use getCurrentDocument
- 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 ) );
-diff --git sc/source/ui/vba/vbashaperange.cxx sc/source/ui/vba/vbashaperange.cxx
-index 8aebaea..5890e43 100644
---- sc/source/ui/vba/vbashaperange.cxx
-+++ sc/source/ui/vba/vbashaperange.cxx
-@@ -66,6 +66,7 @@ ScVbaShapeRange::ScVbaShapeRange( const uno::Reference< XHelperInterface >& xPar
- void SAL_CALL
- ScVbaShapeRange::Select( ) throw (uno::RuntimeException)
- {
-+ // #FIXME don't use getCurrentDocument
- 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() ) );
-diff --git sc/source/ui/vba/vbashapes.cxx sc/source/ui/vba/vbashapes.cxx
-index 80c1e8f..c1013ba 100644
---- sc/source/ui/vba/vbashapes.cxx
-+++ sc/source/ui/vba/vbashapes.cxx
-@@ -219,6 +219,7 @@ ScVbaShapes::SelectAll() throw (uno::RuntimeException)
- uno::Reference< drawing::XShape >
- ScVbaShapes::createShape( rtl::OUString service ) throw (css::uno::RuntimeException)
- {
-+ // #FIXME don't use getCurrentDocument
- uno::Reference< lang::XMultiServiceFactory > xMSF( getCurrentDocument(), uno::UNO_QUERY_THROW );
- uno::Reference< drawing::XShape > xShape( xMSF->createInstance( service ), uno::UNO_QUERY_THROW );
- return xShape;
diff --git a/patches/vba/cws-vbasupportdev300.diff b/patches/vba/cws-vbasupportdev300.diff
deleted file mode 100644
index 732bf792e..000000000
--- a/patches/vba/cws-vbasupportdev300.diff
+++ /dev/null
@@ -1,45014 +0,0 @@
-diff --git basctl/source/basicide/baside3.cxx basctl/source/basicide/baside3.cxx
-index e307720..fbd83c8 100644
---- basctl/source/basicide/baside3.cxx
-+++ basctl/source/basicide/baside3.cxx
-@@ -82,6 +82,7 @@
- #include <com/sun/star/resource/XStringResourceResolver.hpp>
- #include <com/sun/star/resource/StringResourceWithLocation.hpp>
- #include <com/sun/star/task/XInteractionHandler.hpp>
-+#include <com/sun/star/script/vba/XVBACompatibility.hpp>
-
- using namespace comphelper;
- using namespace ::com::sun::star;
-@@ -112,8 +113,16 @@ DialogWindow::DialogWindow( Window* pParent, const ScriptDocument& rDocument, St
- {
- InitSettings( TRUE, TRUE, TRUE );
-
-- pEditor = new DlgEditor();
-+ pEditor = new DlgEditor( rDocument.isDocument() ? rDocument.getDocument() : Reference< frame::XModel >() );
- pEditor->SetWindow( this );
-+ // set vba mode on DialogModel ( allows it to work in 100thmm instead of MAP_APPFONT )
-+ if ( rDocument.isDocument() && rDocument.getDocument().is() )
-+ {
-+ uno::Reference< script::vba::XVBACompatibility > xDocVBAMode( rDocument.getLibraryContainer( E_SCRIPTS ), uno::UNO_QUERY );
-+ uno::Reference< script::vba::XVBACompatibility > xDialogModelVBAMode( xDialogModel, uno::UNO_QUERY );
-+ if ( xDocVBAMode.is() && xDialogModelVBAMode.is() )
-+ xDialogModelVBAMode->setVBACompatibilityMode( xDocVBAMode->getVBACompatibilityMode() );
-+ }
- pEditor->SetDialog( xDialogModel );
-
- // Undo einrichten
-@@ -728,7 +737,7 @@ BOOL DialogWindow::SaveDialog()
- Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
- OSL_ASSERT( xProps.is() );
- OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
-- Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext );
-+ Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, GetDocument().isDocument() ? GetDocument().getDocument() : Reference< frame::XModel >() );
- Reference< XInputStream > xInput( xISP->createInputStream() );
-
- Reference< XSimpleFileAccess > xSFI( xMSF->createInstance
-@@ -1010,7 +1019,7 @@ BOOL implImportDialog( Window* pWin, const String& rCurPath, const ScriptDocumen
- Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
- OSL_ASSERT( xProps.is() );
- OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
-- ::xmlscript::importDialogModel( xInput, xDialogModel, xContext );
-+ ::xmlscript::importDialogModel( xInput, xDialogModel, xContext, rDocument.isDocument() ? rDocument.getDocument() : Reference< frame::XModel >() );
-
- String aXmlDlgName;
- Reference< beans::XPropertySet > xDialogModelPropSet( xDialogModel, UNO_QUERY );
-@@ -1236,7 +1245,7 @@ BOOL implImportDialog( Window* pWin, const String& rCurPath, const ScriptDocumen
- }
- }
-
-- Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext );
-+ Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, rDocument.isDocument() ? rDocument.getDocument() : Reference< frame::XModel >() );
- bool bSuccess = rDocument.insertDialog( aLibName, aNewDlgName, xISP );
- if( bSuccess )
- {
-@@ -1346,7 +1355,7 @@ void DialogWindow::StoreData()
- Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
- OSL_ASSERT( xProps.is() );
- OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
-- Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext );
-+ Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, GetDocument().isDocument() ? GetDocument().getDocument() : Reference< frame::XModel >() );
- xLib->replaceByName( ::rtl::OUString( GetName() ), makeAny( xISP ) );
- }
- }
-diff --git basctl/source/basicide/basides3.cxx basctl/source/basicide/basides3.cxx
-index 1b71e43..6ec1dcd 100644
---- basctl/source/basicide/basides3.cxx
-+++ basctl/source/basicide/basides3.cxx
-@@ -96,7 +96,7 @@ DialogWindow* BasicIDEShell::CreateDlgWin( const ScriptDocument& rDocument, cons
- Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
- OSL_ASSERT( xProps.is() );
- OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
-- ::xmlscript::importDialogModel( xInput, xDialogModel, xContext );
-+ ::xmlscript::importDialogModel( xInput, xDialogModel, xContext, rDocument.isDocument() ? rDocument.getDocument() : Reference< frame::XModel >() );
- LocalizationMgr::setStringResourceAtDialog( rDocument, rLibName, aDlgName, xDialogModel );
-
- // new dialog window
-diff --git basctl/source/basicide/moduldlg.cxx basctl/source/basicide/moduldlg.cxx
-index e2a2377..b00acdd 100644
---- basctl/source/basicide/moduldlg.cxx
-+++ basctl/source/basicide/moduldlg.cxx
-@@ -312,7 +312,7 @@ void BasicIDEShell::CopyDialogResources( Reference< io::XInputStreamProvider >&
- Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
- OSL_ASSERT( xProps.is() );
- OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
-- ::xmlscript::importDialogModel( xInput, xDialogModel, xContext );
-+ ::xmlscript::importDialogModel( xInput, xDialogModel, xContext, rSourceDoc.isDocument() ? rSourceDoc.getDocument() : Reference< frame::XModel >() );
-
- if( xDialogModel.is() )
- {
-@@ -329,7 +329,7 @@ void BasicIDEShell::CopyDialogResources( Reference< io::XInputStreamProvider >&
- {
- LocalizationMgr::setResourceIDsForDialog( xDialogModel, xDestMgr );
- }
-- io_xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext );
-+ io_xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, rDestDoc.isDocument() ? rDestDoc.getDocument() : Reference< frame::XModel >() );
- }
- }
-
-diff --git basctl/source/basicide/scriptdocument.cxx basctl/source/basicide/scriptdocument.cxx
-index cfbd761..14d8dc8 100644
---- basctl/source/basicide/scriptdocument.cxx
-+++ basctl/source/basicide/scriptdocument.cxx
-@@ -453,14 +453,12 @@ namespace basctl
- bool ScriptDocument_Impl::isInVBAMode() const
- {
- bool bResult = false;
--#ifdef FUTURE_VBA_CWS
- if ( !isApplication() )
- {
- Reference< XVBACompatibility > xVBACompat( getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
- if ( xVBACompat.is() )
- bResult = xVBACompat->getVBACompatibilityMode();
- }
--#endif
- return bResult;
- }
-
-@@ -678,7 +676,7 @@ namespace basctl
- if ( !_rxExistingDialogModel.is() )
- {
- Reference< XInputStream > xInput( xISP->createInputStream(), UNO_QUERY_THROW );
-- ::xmlscript::importDialogModel( xInput, xDialogModel, aContext.getUNOContext() );
-+ ::xmlscript::importDialogModel( xInput, xDialogModel, aContext.getUNOContext(), isDocument() ? getDocument() : Reference< XModel >() );
- }
-
- // set new name as property
-@@ -686,12 +684,12 @@ namespace basctl
- xDlgPSet->setPropertyValue( DLGED_PROP_NAME, makeAny( _rNewName ) );
-
- // export dialog model
-- xISP = ::xmlscript::exportDialogModel( xDialogModel, aContext.getUNOContext() );
-+ xISP = ::xmlscript::exportDialogModel( xDialogModel, aContext.getUNOContext(), isDocument() ? getDocument() : Reference< XModel >() );
- aElement <<= xISP;
- }
-
- // insert element by new name in container
-- else if ( _eType == E_SCRIPTS )
-+ if ( _eType == E_SCRIPTS )
- {
- Reference< XVBAModuleInfo > xVBAModuleInfo( xLib, UNO_QUERY );
- if ( xVBAModuleInfo->hasModuleInfo( _rOldName ) )
-@@ -798,7 +796,7 @@ namespace basctl
- xDlgPSet->setPropertyValue( DLGED_PROP_NAME, makeAny( _rDialogName ) );
-
- // export dialog model
-- _out_rDialogProvider = ::xmlscript::exportDialogModel( xDialogModel, aContext.getUNOContext() );
-+ _out_rDialogProvider = ::xmlscript::exportDialogModel( xDialogModel, aContext.getUNOContext(), isDocument() ? getDocument() : Reference< XModel >() );
-
- // insert dialog into library
- xLib->insertByName( _rDialogName, makeAny( _out_rDialogProvider ) );
-diff --git basctl/source/dlged/dlged.cxx basctl/source/dlged/dlged.cxx
-index 04bc7e5..020f934 100644
---- basctl/source/dlged/dlged.cxx
-+++ basctl/source/dlged/dlged.cxx
-@@ -205,7 +205,7 @@ BOOL DlgEditor::RemarkDialog()
-
- //----------------------------------------------------------------------------
-
--DlgEditor::DlgEditor()
-+DlgEditor::DlgEditor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel )
- :pHScroll(NULL)
- ,pVScroll(NULL)
- ,pDlgEdModel(NULL)
-@@ -227,6 +227,7 @@ DlgEditor::DlgEditor()
- ,bCreateOK(TRUE)
- ,bDialogModelChanged(FALSE)
- ,mnPaintGuard(0)
-+ ,m_xDocument( xModel )
- {
- pDlgEdModel = new DlgEdModel();
- pDlgEdModel->GetItemPool().FreezeIdRanges();
-@@ -835,7 +836,7 @@ void DlgEditor::Copy()
- Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
- OSL_ASSERT( xProps.is() );
- OSL_VERIFY( xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
-- Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xClipDialogModel, xContext );
-+ Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xClipDialogModel, xContext, m_xDocument );
- Reference< XInputStream > xStream( xISP->createInputStream() );
- Sequence< sal_Int8 > DialogModelBytes;
- implCopyStreamToByteSequence( xStream, DialogModelBytes );
-@@ -868,7 +869,7 @@ void DlgEditor::Copy()
- uno::Reference< resource::XStringResourceManager >
- xStringResourceManager( xStringResourcePersistence, uno::UNO_QUERY );
- LocalizationMgr::resetResourceForDialog( xClipDialogModel, xStringResourceManager );
-- Reference< XInputStreamProvider > xISP2 = ::xmlscript::exportDialogModel( xClipDialogModel, xContext );
-+ Reference< XInputStreamProvider > xISP2 = ::xmlscript::exportDialogModel( xClipDialogModel, xContext, m_xDocument );
- Reference< XInputStream > xStream2( xISP2->createInputStream() );
- Sequence< sal_Int8 > NoResourceDialogModelBytes;
- implCopyStreamToByteSequence( xStream2, NoResourceDialogModelBytes );
-@@ -1014,7 +1015,7 @@ void DlgEditor::Paste()
- Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
- OSL_ASSERT( xProps.is() );
- OSL_VERIFY( xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
-- ::xmlscript::importDialogModel( ::xmlscript::createInputStream( *((::rtl::ByteSequence*)(&DialogModelBytes)) ) , xClipDialogModel, xContext );
-+ ::xmlscript::importDialogModel( ::xmlscript::createInputStream( *((::rtl::ByteSequence*)(&DialogModelBytes)) ) , xClipDialogModel, xContext, m_xDocument );
- }
-
- // get control models from clipboard dialog model
-diff --git basctl/source/dlged/dlgedobj.cxx basctl/source/dlged/dlgedobj.cxx
-index 50b54c6..a56985e 100644
---- basctl/source/dlged/dlgedobj.cxx
-+++ basctl/source/dlged/dlgedobj.cxx
-@@ -74,6 +74,22 @@ TYPEINIT1(DlgEdObj, SdrUnoObj);
- DBG_NAME(DlgEdObj);
-
- //----------------------------------------------------------------------------
-+MapMode lcl_getMapModeForForm( DlgEdForm* pForm )
-+{
-+ MapMode aMode( MAP_APPFONT ); //Default
-+ try
-+ {
-+ uno::Reference< beans::XPropertySet > xProps( pForm ? pForm->GetUnoControlModel() : NULL, uno::UNO_QUERY_THROW );
-+ sal_Bool bVBAForm = sal_False;
-+ xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VBAForm") ) ) >>= bVBAForm;
-+ if ( bVBAForm )
-+ aMode = MapMode( MAP_100TH_MM );
-+ }
-+ catch ( Exception& )
-+ {
-+ }
-+ return aMode;
-+}
-
- DlgEdObj::DlgEdObj()
- :SdrUnoObj(String(), sal_False)
-@@ -194,8 +210,9 @@ bool DlgEdObj::TransformSdrToControlCoordinates(
- }
-
- // convert pixel to logic units
-- aPos = pDevice->PixelToLogic( aPos, MapMode( MAP_APPFONT ) );
-- aSize = pDevice->PixelToLogic( aSize, MapMode( MAP_APPFONT ) );
-+ MapMode aConvMode = lcl_getMapModeForForm( pForm );
-+ aPos = pDevice->PixelToLogic( aPos, aConvMode );
-+ aSize = pDevice->PixelToLogic( aSize, aConvMode );
-
- // set out parameters
- nXOut = aPos.Width();
-@@ -242,10 +259,10 @@ bool DlgEdObj::TransformSdrToFormCoordinates(
- aSize.Width() -= aDeviceInfo.LeftInset + aDeviceInfo.RightInset;
- aSize.Height() -= aDeviceInfo.TopInset + aDeviceInfo.BottomInset;
- }
--
-+ MapMode aConvMode = lcl_getMapModeForForm( pForm );
- // convert pixel to logic units
-- aPos = pDevice->PixelToLogic( aPos, MapMode( MAP_APPFONT ) );
-- aSize = pDevice->PixelToLogic( aSize, MapMode( MAP_APPFONT ) );
-+ aPos = pDevice->PixelToLogic( aPos, aConvMode );
-+ aSize = pDevice->PixelToLogic( aSize, aConvMode );
-
- // set out parameters
- nXOut = aPos.Width();
-@@ -287,9 +304,10 @@ bool DlgEdObj::TransformControlToSdrCoordinates(
- DBG_ASSERT( pDevice, "DlgEdObj::TransformControlToSdrCoordinates: missing default device!" );
- if ( !pDevice )
- return false;
-- aPos = pDevice->LogicToPixel( aPos, MapMode( MAP_APPFONT ) );
-- aSize = pDevice->LogicToPixel( aSize, MapMode( MAP_APPFONT ) );
-- aFormPos = pDevice->LogicToPixel( aFormPos, MapMode( MAP_APPFONT ) );
-+ MapMode aConvMode = lcl_getMapModeForForm( pForm );
-+ aPos = pDevice->LogicToPixel( aPos, aConvMode );
-+ aSize = pDevice->LogicToPixel( aSize, aConvMode );
-+ aFormPos = pDevice->LogicToPixel( aFormPos, aConvMode );
-
- // add form position
- aPos.Width() += aFormPos.Width();
-@@ -333,14 +351,16 @@ bool DlgEdObj::TransformFormToSdrCoordinates(
- DBG_ASSERT( pDevice, "DlgEdObj::TransformFormToSdrCoordinates: missing default device!" );
- if ( !pDevice )
- return false;
-- aPos = pDevice->LogicToPixel( aPos, MapMode( MAP_APPFONT ) );
-- aSize = pDevice->LogicToPixel( aSize, MapMode( MAP_APPFONT ) );
-
- // take window borders into account
- DlgEdForm* pForm = NULL;
- if ( !lcl_getDlgEdForm( this, pForm ) )
- return false;
-
-+ MapMode aConvMode = lcl_getMapModeForForm( pForm );
-+ aPos = pDevice->LogicToPixel( aPos, aConvMode );
-+ aSize = pDevice->LogicToPixel( aSize, aConvMode );
-+
- // take window borders into account
- Reference< beans::XPropertySet > xPSetForm( pForm->GetUnoControlModel(), UNO_QUERY );
- DBG_ASSERT( xPSetForm.is(), "DlgEdObj::TransformFormToSdrCoordinates: no form property set!" );
-diff --git basctl/source/inc/dlged.hxx basctl/source/inc/dlged.hxx
-index a8adcda..a2ea57c 100644
---- basctl/source/inc/dlged.hxx
-+++ basctl/source/inc/dlged.hxx
-@@ -32,6 +32,7 @@
- #include <com/sun/star/awt/XControlContainer.hpp>
- #include <com/sun/star/datatransfer/DataFlavor.hpp>
- #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
-+#include <com/sun/star/frame/XModel.hpp>
- #include <tools/link.hxx>
- #include <tools/gen.hxx>
- #include <vcl/timer.hxx>
-@@ -128,9 +129,11 @@ protected:
- BOOL bDialogModelChanged;
- Timer aMarkTimer;
- long mnPaintGuard;
-+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xDocument;
-
-+ DlgEditor(); // not implemented
- public:
-- DlgEditor();
-+ DlgEditor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel );
- ~DlgEditor();
-
- void SetWindow( Window* pWindow );
-diff --git basic/inc/basic/basmgr.hxx basic/inc/basic/basmgr.hxx
-index 886aa7f..58cf623 100644
---- basic/inc/basic/basmgr.hxx
-+++ basic/inc/basic/basmgr.hxx
-@@ -236,7 +236,7 @@ public:
- takes the names of modules whose size exceeds the legacy limit
- */
- bool LegacyPsswdBinaryLimitExceeded( ::com::sun::star::uno::Sequence< rtl::OUString >& _out_rModuleNames );
--
-+ bool HasExeCode( const String& );
- private:
- BOOL IsReference( USHORT nLib );
-
-diff --git basic/inc/basic/sbmeth.hxx basic/inc/basic/sbmeth.hxx
-index 38319ac..89f88da 100644
---- basic/inc/basic/sbmeth.hxx
-+++ basic/inc/basic/sbmeth.hxx
-@@ -46,6 +46,7 @@ class SbMethod : public SbxMethod
- friend class SbIfaceMapperMethod;
-
- SbMethodImpl* mpSbMethodImpl; // Impl data
-+ SbxVariable* mCaller; // caller
- SbModule* pMod;
- USHORT nDebugFlags;
- USHORT nLine1, nLine2;
-@@ -72,7 +73,7 @@ public:
- void GetLineRange( USHORT&, USHORT& );
-
- // Interface to execute a method from the applications
-- virtual ErrCode Call( SbxValue* pRet = NULL );
-+ virtual ErrCode Call( SbxValue* pRet = NULL, SbxVariable* pCaller = NULL );
- virtual void Broadcast( ULONG nHintId );
- };
-
-diff --git basic/inc/basic/sbmod.hxx basic/inc/basic/sbmod.hxx
-index 15afc1f..f960b89 100644
---- basic/inc/basic/sbmod.hxx
-+++ basic/inc/basic/sbmod.hxx
-@@ -58,6 +58,8 @@ class SbModule : public SbxObject
-
- SbModuleImpl* mpSbModuleImpl; // Impl data
- std::vector< String > mModuleVariableNames;
-+ SbModule();
-+ SbModule(const SbModule&);
-
- protected:
- com::sun::star::uno::Reference< com::sun::star::script::XInvocation > mxWrapper;
-@@ -130,6 +132,7 @@ public:
- BOOL LoadBinaryData( SvStream& );
- BOOL ExceedsLegacyModuleSize();
- void fixUpMethodStart( bool bCvtToLegacy, SbiImage* pImg = NULL ) const;
-+ bool HasExeCode();
- BOOL IsVBACompat() const;
- void SetVBACompat( BOOL bCompat );
- INT32 GetModuleType() { return mnType; }
-diff --git basic/inc/basic/sbuno.hxx basic/inc/basic/sbuno.hxx
-index 27fe320..c5e0209 100644
---- basic/inc/basic/sbuno.hxx
-+++ basic/inc/basic/sbuno.hxx
-@@ -38,6 +38,7 @@ SbxObjectRef GetSbUnoObject( const String& aName, const com::sun::star::uno::Any
-
- // Force creation of all properties for debugging
- void createAllObjectProperties( SbxObject* pObj );
-+void SetSbUnoObjectDfltPropName( SbxObject* pObj );
-
- ::com::sun::star::uno::Any sbxToUnoValue( SbxVariable* pVar );
-
-diff --git basic/source/basmgr/basmgr.cxx basic/source/basmgr/basmgr.cxx
-index b2e0f58..ba0085f 100644
---- basic/source/basmgr/basmgr.cxx
-+++ basic/source/basmgr/basmgr.cxx
-@@ -1139,6 +1139,25 @@ void BasicManager::LegacyDeleteBasicManager( BasicManager*& _rpManager )
- _rpManager = NULL;
- }
-
-+
-+bool BasicManager::HasExeCode( const String& sLib )
-+{
-+ StarBASIC* pLib = GetLib(sLib);
-+ if ( pLib )
-+ {
-+ SbxArray* pMods = pLib->GetModules();
-+ USHORT nMods = pMods ? pMods->Count() : 0;
-+ for( USHORT i = 0; i < nMods; i++ )
-+ {
-+ SbModule* p = (SbModule*) pMods->Get( i );
-+ if ( p )
-+ if ( p->HasExeCode() )
-+ return true;
-+ }
-+ }
-+ return false;
-+}
-+
- void BasicManager::Init()
- {
- DBG_CHKTHIS( BasicManager, 0 );
-diff --git basic/source/classes/sb.cxx basic/source/classes/sb.cxx
-index df5bd58..605bd4e 100755
---- basic/source/classes/sb.cxx
-+++ basic/source/classes/sb.cxx
-@@ -577,93 +577,7 @@ SbClassModuleObject::~SbClassModuleObject()
- void SbClassModuleObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
- const SfxHint& rHint, const TypeId& rHintType )
- {
-- bool bDone = false;
--
-- const SbxHint* pHint = PTR_CAST(SbxHint,&rHint);
-- if( pHint )
-- {
-- SbxVariable* pVar = pHint->GetVar();
-- SbProcedureProperty* pProcProperty = PTR_CAST( SbProcedureProperty, pVar );
-- if( pProcProperty )
-- {
-- bDone = true;
--
-- if( pHint->GetId() == SBX_HINT_DATAWANTED )
-- {
-- String aProcName;
-- aProcName.AppendAscii( "Property Get " );
-- aProcName += pProcProperty->GetName();
--
-- SbxVariable* pMeth = Find( aProcName, SbxCLASS_METHOD );
-- if( pMeth )
-- {
-- SbxValues aVals;
-- aVals.eType = SbxVARIANT;
--
-- SbxArray* pArg = pVar->GetParameters();
-- USHORT nVarParCount = (pArg != NULL) ? pArg->Count() : 0;
-- if( nVarParCount > 1 )
-- {
-- SbxArrayRef xMethParameters = new SbxArray;
-- xMethParameters->Put( pMeth, 0 ); // Method as parameter 0
-- for( USHORT i = 1 ; i < nVarParCount ; ++i )
-- {
-- SbxVariable* pPar = pArg->Get( i );
-- xMethParameters->Put( pPar, i );
-- }
--
-- pMeth->SetParameters( xMethParameters );
-- pMeth->Get( aVals );
-- pMeth->SetParameters( NULL );
-- }
-- else
-- {
-- pMeth->Get( aVals );
-- }
--
-- pVar->Put( aVals );
-- }
-- }
-- else if( pHint->GetId() == SBX_HINT_DATACHANGED )
-- {
-- SbxVariable* pMeth = NULL;
--
-- bool bSet = pProcProperty->isSet();
-- if( bSet )
-- {
-- pProcProperty->setSet( false );
--
-- String aProcName;
-- aProcName.AppendAscii( "Property Set " );
-- aProcName += pProcProperty->GetName();
-- pMeth = Find( aProcName, SbxCLASS_METHOD );
-- }
-- if( !pMeth ) // Let
-- {
-- String aProcName;
-- aProcName.AppendAscii( "Property Let " );
-- aProcName += pProcProperty->GetName();
-- pMeth = Find( aProcName, SbxCLASS_METHOD );
-- }
--
-- if( pMeth )
-- {
-- // Setup parameters
-- SbxArrayRef xArray = new SbxArray;
-- xArray->Put( pMeth, 0 ); // Method as parameter 0
-- xArray->Put( pVar, 1 );
-- pMeth->SetParameters( xArray );
--
-- SbxValues aVals;
-- pMeth->Get( aVals );
-- pMeth->SetParameters( NULL );
-- }
-- }
-- }
-- }
--
-- if( !bDone )
-- SbModule::SFX_NOTIFY( rBC, rBCType, rHint, rHintType );
-+ SbModule::SFX_NOTIFY( rBC, rBCType, rHint, rHintType );
- }
-
- SbxVariable* SbClassModuleObject::Find( const XubString& rName, SbxClassType t )
-@@ -1093,7 +1007,6 @@ SbxVariable* StarBASIC::Find( const String& rName, SbxClassType t )
- INT32 nType = p->GetModuleType();
- if ( nType == ModuleType::DOCUMENT || nType == ModuleType::FORM )
- continue;
--
- // otherwise check if the element is available
- // unset GBLSEARCH-Flag (due to Rekursion)
- USHORT nGblFlag = p->GetFlags() & SBX_GBLSEARCH;
-diff --git basic/source/classes/sbunoobj.cxx basic/source/classes/sbunoobj.cxx
-index 1a9e046..dfc8dfd 100755
---- basic/source/classes/sbunoobj.cxx
-+++ basic/source/classes/sbunoobj.cxx
-@@ -61,6 +61,7 @@
- #include <com/sun/star/script/XInvocationAdapterFactory.hpp>
- #include <com/sun/star/script/XTypeConverter.hpp>
- #include <com/sun/star/script/XDefaultProperty.hpp>
-+#include <com/sun/star/script/XDefaultMethod.hpp>
- #include <com/sun/star/container/XNameAccess.hpp>
- #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
- #include <com/sun/star/reflection/XIdlArray.hpp>
-@@ -71,7 +72,7 @@
- #include <com/sun/star/bridge/oleautomation/Decimal.hpp>
- #include <com/sun/star/bridge/oleautomation/Currency.hpp>
- #include <com/sun/star/bridge/oleautomation/XAutomationObject.hpp>
--
-+#include <com/sun/star/script/XAutomationInvocation.hpp>
-
- using com::sun::star::uno::Reference;
- using namespace com::sun::star::uno;
-@@ -157,6 +158,21 @@ SbxVariable* getDefaultProp( SbxVariable* pRef )
- return pDefaultProp;
- }
-
-+void SetSbUnoObjectDfltPropName( SbxObject* pObj )
-+{
-+ SbUnoObject* pUnoObj = PTR_CAST(SbUnoObject,(SbxObject*) pObj);
-+ if ( pUnoObj )
-+ {
-+ String sDfltPropName;
-+
-+ if ( SbUnoObject::getDefaultPropName( pUnoObj, sDfltPropName ) )
-+ {
-+ OSL_TRACE("SetSbUnoObjectDfltPropName setting dflt prop for %s", rtl::OUStringToOString( pObj->GetName(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ pUnoObj->SetDfltProperty( sDfltPropName );
-+ }
-+ }
-+}
-+
- Reference< XComponentContext > getComponentContext_Impl( void )
- {
- static Reference< XComponentContext > xContext;
-@@ -453,6 +469,32 @@ void implHandleWrappedTargetException( const Any& _rWrappedTargetException )
- SbError nError( ERRCODE_BASIC_EXCEPTION );
- ::rtl::OUStringBuffer aMessageBuf;
-
-+ // Add for VBA, to get the correct error code and message.
-+ if ( SbiRuntime::isVBAEnabled() )
-+ {
-+ if ( aExamine >>= aBasicError )
-+ {
-+ if ( aBasicError.ErrorCode != 0 )
-+ {
-+ nError = StarBASIC::GetSfxFromVBError( (USHORT) aBasicError.ErrorCode );
-+ if ( nError == 0 )
-+ {
-+ nError = (SbError) aBasicError.ErrorCode;
-+ }
-+ aMessageBuf.append( aBasicError.ErrorMessageArgument );
-+ aExamine.clear();
-+ }
-+ }
-+
-+ IndexOutOfBoundsException aIdxOutBndsExp;
-+ if ( aExamine >>= aIdxOutBndsExp )
-+ {
-+ nError = SbERR_OUT_OF_RANGE;
-+ aExamine.clear();
-+ }
-+ }
-+ // End add
-+
- // strip any other WrappedTargetException instances, but this time preserve the error messages.
- WrappedTargetException aWrapped;
- sal_Int32 nLevel = 0;
-@@ -1502,6 +1544,103 @@ Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty
- return aRetVal;
- }
-
-+void processAutomationParams( SbxArray* pParams, Sequence< Any >& args, bool bOLEAutomation, UINT32 nParamCount )
-+{
-+ AutomationNamedArgsSbxArray* pArgNamesArray = NULL;
-+ if( bOLEAutomation )
-+ pArgNamesArray = PTR_CAST(AutomationNamedArgsSbxArray,pParams);
-+
-+ args.realloc( nParamCount );
-+ Any* pAnyArgs = args.getArray();
-+ bool bBlockConversionToSmallestType = pINST->IsCompatibility();
-+ UINT32 i = 0;
-+ if( pArgNamesArray )
-+ {
-+ Sequence< ::rtl::OUString >& rNameSeq = pArgNamesArray->getNames();
-+ ::rtl::OUString* pNames = rNameSeq.getArray();
-+ Any aValAny;
-+ for( i = 0 ; i < nParamCount ; i++ )
-+ {
-+ USHORT iSbx = (USHORT)(i+1);
-+
-+ // ACHTUNG: Bei den Sbx-Parametern den Offset nicht vergessen!
-+ aValAny = sbxToUnoValueImpl( pParams->Get( iSbx ),
-+ bBlockConversionToSmallestType );
-+
-+ ::rtl::OUString aParamName = pNames[iSbx];
-+ if( aParamName.getLength() )
-+ {
-+ oleautomation::NamedArgument aNamedArgument;
-+ aNamedArgument.Name = aParamName;
-+ aNamedArgument.Value = aValAny;
-+ pAnyArgs[i] <<= aNamedArgument;
-+ }
-+ else
-+ {
-+ pAnyArgs[i] = aValAny;
-+ }
-+ }
-+ }
-+ else
-+ {
-+ for( i = 0 ; i < nParamCount ; i++ )
-+ {
-+ // ACHTUNG: Bei den Sbx-Parametern den Offset nicht vergessen!
-+ pAnyArgs[i] = sbxToUnoValueImpl( pParams->Get( (USHORT)(i+1) ),
-+ bBlockConversionToSmallestType );
-+ }
-+ }
-+
-+}
-+enum INVOKETYPE
-+{
-+ GetProp = 0,
-+ SetProp,
-+ Func
-+};
-+Any invokeAutomationMethod( const String& Name, Sequence< Any >& args, SbxArray* pParams, UINT32 nParamCount, Reference< XInvocation >& rxInvocation, INVOKETYPE invokeType = Func )
-+{
-+ Sequence< INT16 > OutParamIndex;
-+ Sequence< Any > OutParam;
-+
-+ Any aRetAny;
-+ switch( invokeType )
-+ {
-+ case Func:
-+ aRetAny = rxInvocation->invoke( Name, args, OutParamIndex, OutParam );
-+ break;
-+ case GetProp:
-+ {
-+ Reference< XAutomationInvocation > xAutoInv( rxInvocation, UNO_QUERY );
-+ aRetAny = xAutoInv->invokeGetProperty( Name, args, OutParamIndex, OutParam );
-+ break;
-+ }
-+ case SetProp:
-+ {
-+ Reference< XAutomationInvocation > xAutoInv( rxInvocation, UNO_QUERY_THROW );
-+ aRetAny = xAutoInv->invokePutProperty( Name, args, OutParamIndex, OutParam );
-+ break;
-+ }
-+ default:
-+ break; // should introduce an error here
-+
-+ }
-+ const INT16* pIndices = OutParamIndex.getConstArray();
-+ UINT32 nLen = OutParamIndex.getLength();
-+ if( nLen )
-+ {
-+ const Any* pNewValues = OutParam.getConstArray();
-+ for( UINT32 j = 0 ; j < nLen ; j++ )
-+ {
-+ INT16 iTarget = pIndices[ j ];
-+ if( iTarget >= (INT16)nParamCount )
-+ break;
-+ unoToSbxValue( (SbxVariable*)pParams->Get( (USHORT)(j+1) ), pNewValues[ j ] );
-+ }
-+ }
-+ return aRetAny;
-+}
-+
- // Debugging help method to readout the imlemented interfaces of an object
- String Impl_GetInterfaceInfo( const Reference< XInterface >& x, const Reference< XIdlClass >& xClass, USHORT nRekLevel )
- {
-@@ -2008,11 +2147,26 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
- {
- try
- {
-- // get the value
-- Any aRetAny = mxInvocation->getValue( pProp->GetName() );
-+ UINT32 nParamCount = pParams ? ((UINT32)pParams->Count() - 1) : 0;
-+ sal_Bool bCanBeConsideredAMethod = mxInvocation->hasMethod( pProp->GetName() );
-+ Any aRetAny;
-+ if ( bCanBeConsideredAMethod && nParamCount )
-+ {
-+ // Automation properties have methods, so.. we need to invoke this through
-+ // XInvocation
-+ Sequence<Any> args;
-+ processAutomationParams( pParams, args, true, nParamCount );
-+ aRetAny = invokeAutomationMethod( pProp->GetName(), args, pParams, nParamCount, mxInvocation, GetProp );
-+ }
-+ else
-+ // Wert holen
-+ aRetAny = mxInvocation->getValue( pProp->GetName() );
-
- // take over the value from Uno to Sbx
- unoToSbxValue( pVar, aRetAny );
-+ if( pParams && bCanBeConsideredAMethod )
-+ pVar->SetParameters( NULL );
-+
- }
- catch( const Exception& )
- {
-@@ -2137,52 +2291,7 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
- else if( bInvocation && pParams && mxInvocation.is() )
- {
- bool bOLEAutomation = true;
-- // TODO: bOLEAutomation = xOLEAutomation.is()
--
-- AutomationNamedArgsSbxArray* pArgNamesArray = NULL;
-- if( bOLEAutomation )
-- pArgNamesArray = PTR_CAST(AutomationNamedArgsSbxArray,pParams);
--
-- args.realloc( nParamCount );
-- Any* pAnyArgs = args.getArray();
-- bool bBlockConversionToSmallestType = pINST->IsCompatibility();
-- if( pArgNamesArray )
-- {
-- Sequence< ::rtl::OUString >& rNameSeq = pArgNamesArray->getNames();
-- ::rtl::OUString* pNames = rNameSeq.getArray();
--
-- Any aValAny;
-- for( i = 0 ; i < nParamCount ; i++ )
-- {
-- USHORT iSbx = (USHORT)(i+1);
--
-- // ATTENTION: Don't forget for Sbx-Parameter the offset!
-- aValAny = sbxToUnoValueImpl( pParams->Get( iSbx ),
-- bBlockConversionToSmallestType );
--
-- ::rtl::OUString aParamName = pNames[iSbx];
-- if( aParamName.getLength() )
-- {
-- oleautomation::NamedArgument aNamedArgument;
-- aNamedArgument.Name = aParamName;
-- aNamedArgument.Value = aValAny;
-- pAnyArgs[i] <<= aNamedArgument;
-- }
-- else
-- {
-- pAnyArgs[i] = aValAny;
-- }
-- }
-- }
-- else
-- {
-- for( i = 0 ; i < nParamCount ; i++ )
-- {
-- // ATTENTION: Don't forget for Sbx-Parameter the offset!
-- pAnyArgs[i] = sbxToUnoValueImpl( pParams->Get( (USHORT)(i+1) ),
-- bBlockConversionToSmallestType );
-- }
-- }
-+ processAutomationParams( pParams, args, bOLEAutomation, nParamCount );
- }
-
- // call the method
-@@ -2217,26 +2326,8 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
- }
- else if( bInvocation && mxInvocation.is() )
- {
-- Sequence< INT16 > OutParamIndex;
-- Sequence< Any > OutParam;
-- Any aRetAny = mxInvocation->invoke( pMeth->GetName(), args, OutParamIndex, OutParam );
--
-- // take over the value from Uno to Sbx
-+ Any aRetAny = invokeAutomationMethod( pMeth->GetName(), args, pParams, nParamCount, mxInvocation );
- unoToSbxValue( pVar, aRetAny );
--
-- const INT16* pIndices = OutParamIndex.getConstArray();
-- UINT32 nLen = OutParamIndex.getLength();
-- if( nLen )
-- {
-- const Any* pNewValues = OutParam.getConstArray();
-- for( UINT32 j = 0 ; j < nLen ; j++ )
-- {
-- INT16 iTarget = pIndices[ j ];
-- if( iTarget >= (INT16)nParamCount )
-- break;
-- unoToSbxValue( (SbxVariable*)pParams->Get( (USHORT)(j+1) ), pNewValues[ j ] );
-- }
-- }
- }
-
- // remove parameter here, because this was not done anymore in unoToSbxValue()
-@@ -3165,11 +3256,16 @@ getTypeDescriptorEnumeration( const ::rtl::OUString& sSearchRoot,
-
- typedef std::hash_map< ::rtl::OUString, Any, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > VBAConstantsHash;
-
--SbxVariable* getVBAConstant( const String& rName )
-+VBAConstantHelper&
-+VBAConstantHelper::instance()
-+{
-+ static VBAConstantHelper aHelper;
-+ return aHelper;
-+}
-+
-+void
-+VBAConstantHelper::init()
- {
-- SbxVariable* pConst = NULL;
-- static VBAConstantsHash aConstCache;
-- static bool isInited = false;
- if ( !isInited )
- {
- Sequence< TypeClass > types(1);
-@@ -3177,39 +3273,77 @@ SbxVariable* getVBAConstant( const String& rName )
- Reference< XTypeDescriptionEnumeration > xEnum = getTypeDescriptorEnumeration( defaultNameSpace, types, TypeDescriptionSearchDepth_INFINITE );
-
- if ( !xEnum.is() )
-- return NULL;
-+ return; //NULL;
-
- while ( xEnum->hasMoreElements() )
- {
- Reference< XConstantsTypeDescription > xConstants( xEnum->nextElement(), UNO_QUERY );
- if ( xConstants.is() )
- {
-+ // store constant group name
-+ ::rtl::OUString sFullName = xConstants->getName();
-+ sal_Int32 indexLastDot = sFullName.lastIndexOf('.');
-+ ::rtl::OUString sLeafName( sFullName );
-+ if ( indexLastDot > -1 )
-+ sLeafName = sFullName.copy( indexLastDot + 1);
-+ aConstCache.push_back( sLeafName ); // assume constant group names are unique
- Sequence< Reference< XConstantTypeDescription > > aConsts = xConstants->getConstants();
- Reference< XConstantTypeDescription >* pSrc = aConsts.getArray();
- sal_Int32 nLen = aConsts.getLength();
- for ( sal_Int32 index =0; index<nLen; ++pSrc, ++index )
- {
-+ // store constant member name
- Reference< XConstantTypeDescription >& rXConst =
- *pSrc;
-- ::rtl::OUString sFullName = rXConst->getName();
-- sal_Int32 indexLastDot = sFullName.lastIndexOf('.');
-- ::rtl::OUString sLeafName;
-+ sFullName = rXConst->getName();
-+ indexLastDot = sFullName.lastIndexOf('.');
-+ sLeafName = sFullName;
- if ( indexLastDot > -1 )
- sLeafName = sFullName.copy( indexLastDot + 1);
-- aConstCache[ sLeafName.toAsciiLowerCase() ] = rXConst->getConstantValue();
-+ aConstHash[ sLeafName.toAsciiLowerCase() ] = rXConst->getConstantValue();
- }
- }
- }
- isInited = true;
- }
-+}
-+
-+bool
-+VBAConstantHelper::isVBAConstantType( const String& rName )
-+{
-+ init();
-+ bool bConstant = false;
-+ ::rtl::OUString sKey( rName );
-+ VBAConstantsVector::const_iterator it = aConstCache.begin();
-+
-+ for( ; it != aConstCache.end(); it++ )
-+ {
-+ if( sKey.equalsIgnoreAsciiCase( *it ) )
-+ {
-+ bConstant = true;
-+ break;
-+ }
-+ }
-+ return bConstant;
-+}
-+
-+SbxVariable*
-+VBAConstantHelper::getVBAConstant( const String& rName )
-+{
-+ SbxVariable* pConst = NULL;
-+ init();
-+
- ::rtl::OUString sKey( rName );
-- VBAConstantsHash::const_iterator it = aConstCache.find( sKey.toAsciiLowerCase() );
-- if ( it != aConstCache.end() )
-+
-+ VBAConstantsHash::const_iterator it = aConstHash.find( sKey.toAsciiLowerCase() );
-+
-+ if ( it != aConstHash.end() )
- {
- pConst = new SbxVariable( SbxVARIANT );
- pConst->SetName( rName );
- unoToSbxValue( pConst, it->second );
- }
-+
- return pConst;
- }
-
-diff --git basic/source/classes/sbxmod.cxx basic/source/classes/sbxmod.cxx
-index 834d731..0b9b351 100644
---- basic/source/classes/sbxmod.cxx
-+++ basic/source/classes/sbxmod.cxx
-@@ -58,6 +58,7 @@
- #include <com/sun/star/lang/XServiceInfo.hpp>
- #include <com/sun/star/script/ModuleType.hpp>
- #include <com/sun/star/script/vba/XVBACompatibility.hpp>
-+#include <com/sun/star/document/XVbaMethodParameter.hpp>
- #include <com/sun/star/beans/XPropertySet.hpp>
-
- using namespace com::sun::star;
-@@ -500,7 +500,6 @@ IMPL_LINK( AsyncQuitHandler, OnAsyncQuit, void*, /*pNull*/ )
- return 0L;
- }
-
--#if 0
- bool UnlockControllerHack( StarBASIC* pBasic )
- {
- bool bRes = false;
-@@ -526,7 +525,7 @@ bool UnlockControllerHack( StarBASIC* pBasic )
- }
- return bRes;
- }
--#endif
-+
- /////////////////////////////////////////////////////////////////////////////
-
- // A Basic module has set EXTSEARCH, so that the elements, that the modul contains,
-@@ -795,6 +794,82 @@ void SbModule::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
- SbxVariable* pVar = pHint->GetVar();
- SbProperty* pProp = PTR_CAST(SbProperty,pVar);
- SbMethod* pMeth = PTR_CAST(SbMethod,pVar);
-+ SbProcedureProperty* pProcProperty = PTR_CAST( SbProcedureProperty, pVar );
-+ if( pProcProperty )
-+ {
-+
-+ if( pHint->GetId() == SBX_HINT_DATAWANTED )
-+ {
-+ String aProcName;
-+ aProcName.AppendAscii( "Property Get " );
-+ aProcName += pProcProperty->GetName();
-+
-+ SbxVariable* pMethVar = Find( aProcName, SbxCLASS_METHOD );
-+ if( pMethVar )
-+ {
-+ SbxValues aVals;
-+ aVals.eType = SbxVARIANT;
-+
-+ SbxArray* pArg = pVar->GetParameters();
-+ USHORT nVarParCount = (pArg != NULL) ? pArg->Count() : 0;
-+ if( nVarParCount > 1 )
-+ {
-+ SbxArrayRef xMethParameters = new SbxArray;
-+ xMethParameters->Put( pMethVar, 0 ); // Method as parameter 0
-+ for( USHORT i = 1 ; i < nVarParCount ; ++i )
-+ {
-+ SbxVariable* pPar = pArg->Get( i );
-+ xMethParameters->Put( pPar, i );
-+ }
-+
-+ pMethVar->SetParameters( xMethParameters );
-+ pMethVar->Get( aVals );
-+ pMethVar->SetParameters( NULL );
-+ }
-+ else
-+ {
-+ pMethVar->Get( aVals );
-+ }
-+
-+ pVar->Put( aVals );
-+ }
-+ }
-+ else if( pHint->GetId() == SBX_HINT_DATACHANGED )
-+ {
-+ SbxVariable* pMethVar = NULL;
-+
-+ bool bSet = pProcProperty->isSet();
-+ if( bSet )
-+ {
-+ pProcProperty->setSet( false );
-+
-+ String aProcName;
-+ aProcName.AppendAscii( "Property Set " );
-+ aProcName += pProcProperty->GetName();
-+ pMethVar = Find( aProcName, SbxCLASS_METHOD );
-+ }
-+ if( !pMethVar ) // Let
-+ {
-+ String aProcName;
-+ aProcName.AppendAscii( "Property Let " );
-+ aProcName += pProcProperty->GetName();
-+ pMethVar = Find( aProcName, SbxCLASS_METHOD );
-+ }
-+
-+ if( pMethVar )
-+ {
-+ // Setup parameters
-+ SbxArrayRef xArray = new SbxArray;
-+ xArray->Put( pMethVar, 0 ); // Method as parameter 0
-+ xArray->Put( pVar, 1 );
-+ pMethVar->SetParameters( xArray );
-+
-+ SbxValues aVals;
-+ pMethVar->Get( aVals );
-+ pMethVar->SetParameters( NULL );
-+ }
-+ }
-+ }
- if( pProp )
- {
- if( pProp->GetModule() != this )
-@@ -849,6 +925,7 @@ void SbModule::SetSource32( const ::rtl::OUString& r )
- aOUSource = r;
- StartDefinitions();
- SbiTokenizer aTok( r );
-+ aTok.SetCompatible( IsVBACompat() );
- while( !aTok.IsEof() )
- {
- SbiToken eEndTok = NIL;
-@@ -1036,12 +1113,14 @@ void SbModule::SetVBACompat( BOOL bCompat )
- // Run a Basic-subprogram
- USHORT SbModule::Run( SbMethod* pMeth )
- {
-+ OSL_TRACE("About to run %s, vba compatmode is %d", rtl::OUStringToOString( pMeth->GetName(), RTL_TEXTENCODING_UTF8 ).getStr(), mbVBACompat );
- static USHORT nMaxCallLevel = 0;
- static String aMSOMacroRuntimeLibName = String::CreateFromAscii( "Launcher" );
- static String aMSOMacroRuntimeAppSymbol = String::CreateFromAscii( "Application" );
-
- USHORT nRes = 0;
- BOOL bDelInst = BOOL( pINST == NULL );
-+ bool bQuit = false;
- StarBASICRef xBasic;
- if( bDelInst )
- {
-@@ -1174,6 +1253,15 @@ USHORT SbModule::Run( SbMethod* pMeth )
-
- delete pRt;
- pMOD = pOldMod;
-+ if ( pINST->nCallLvl == 0 && IsVBACompat() )
-+ {
-+ // VBA always ensure screenupdating is enabled after completing
-+ StarBASIC* pBasic = PTR_CAST(StarBASIC,GetParent());
-+ if ( pBasic && pBasic->IsDocBasic() )
-+ {
-+ UnlockControllerHack( pBasic );
-+ }
-+ }
- if( bDelInst )
- {
- // #57841 Clear Uno-Objects, which were helt in RTL functions,
-@@ -1201,10 +1289,8 @@ USHORT SbModule::Run( SbMethod* pMeth )
-
- // VBA always ensure screenupdating is enabled after completing
- StarBASIC* pBasic = PTR_CAST(StarBASIC,GetParent());
--#if 0
- if ( pBasic && pBasic->IsDocBasic() && !pINST )
- UnlockControllerHack( pBasic );
--#endif
- if( bDelInst )
- {
- // #57841 Clear Uno-Objects, which were helt in RTL functions,
-@@ -1215,6 +1301,8 @@ USHORT SbModule::Run( SbMethod* pMeth )
- pINST = NULL;
- }
- if ( pBasic && pBasic->IsDocBasic() && pBasic->IsQuitApplication() && !pINST )
-+ bQuit = true;
-+ if ( bQuit )
- {
- Application::PostUserEvent( LINK( &AsyncQuitHandler::instance(), AsyncQuitHandler, OnAsyncQuit ), NULL );
- }
-@@ -1676,6 +1764,48 @@ BOOL SbModule::ExceedsLegacyModuleSize()
- return false;
- }
-
-+class ErrorHdlResetter
-+{
-+ Link mErrHandler;
-+ bool mbError;
-+ public:
-+ ErrorHdlResetter() : mbError( false )
-+ {
-+ // save error handler
-+ mErrHandler = StarBASIC::GetGlobalErrorHdl();
-+ // set new error handler
-+ StarBASIC::SetGlobalErrorHdl( LINK( this, ErrorHdlResetter, BasicErrorHdl ) );
-+ }
-+ ~ErrorHdlResetter()
-+ {
-+ // restore error handler
-+ StarBASIC::SetGlobalErrorHdl(mErrHandler);
-+ }
-+ DECL_LINK( BasicErrorHdl, StarBASIC * );
-+ bool HasError() { return mbError; }
-+};
-+IMPL_LINK( ErrorHdlResetter, BasicErrorHdl, StarBASIC *, /*pBasic*/)
-+{
-+ mbError = true;
-+ return 0;
-+}
-+
-+bool SbModule::HasExeCode()
-+{
-+
-+ ErrorHdlResetter aGblErrHdl;
-+ // And empty Image always has the Global Chain set up
-+ static const unsigned char pEmptyImage[] = { 0x45, 0x0 , 0x0, 0x0, 0x0 };
-+ // lets be stricter for the moment than VBA
-+
-+ bool bRes = false;
-+ if ( !IsCompiled() )
-+ Compile();
-+ if ( pImage && !( pImage->GetCodeSize() == 5 && ( memcmp( pImage->GetCode(), pEmptyImage, pImage->GetCodeSize() ) == 0 ) )
-+ || aGblErrHdl.HasError() )
-+ bRes = true;
-+ return bRes;
-+}
-
- // Store only image, no source
- BOOL SbModule::StoreBinaryData( SvStream& rStrm )
-@@ -1725,7 +1855,6 @@ BOOL SbModule::LoadBinaryData( SvStream& rStrm )
- return bRet;
- }
-
--
- BOOL SbModule::LoadCompleted()
- {
- SbxArray* p = GetMethods();
-@@ -1793,6 +1922,7 @@ SbMethod::SbMethod( const String& r, SbxDataType t, SbModule* p )
- nLine1 =
- nLine2 = 0;
- refStatics = new SbxArray;
-+ mCaller = 0;
- // From: 1996-07.02: HACK due to 'Referenz could not be saved'
- SetFlag( SBX_NO_MODIFY );
- }
-@@ -1807,6 +1937,7 @@ SbMethod::SbMethod( const SbMethod& r )
- nLine1 = r.nLine1;
- nLine2 = r.nLine2;
- refStatics = r.refStatics;
-+ mCaller = r.mCaller;
- SetFlag( SBX_NO_MODIFY );
- }
-
-@@ -1875,8 +2006,13 @@ SbxInfo* SbMethod::GetInfo()
- // Interface to execute a method of the applications
- // #34191# With special RefCounting, damit so that the Basic was not fired of by CloseDocument()
- // The return value will be delivered as string.
--ErrCode SbMethod::Call( SbxValue* pRet )
-+ErrCode SbMethod::Call( SbxValue* pRet, SbxVariable* pCaller )
- {
-+ if ( pCaller )
-+ {
-+ OSL_TRACE("SbMethod::Call Have been passed a caller 0x%x", pCaller );
-+ mCaller = pCaller;
-+ }
- // Increment the RefCount of the module
- SbModule* pMod_ = (SbModule*)GetParent();
- pMod_->AddRef();
-@@ -1904,7 +2040,7 @@ ErrCode SbMethod::Call( SbxValue* pRet )
- // Release objects
- pMod_->ReleaseRef();
- pBasic->ReleaseRef();
--
-+ mCaller = 0;
- return nErr;
- }
-
-@@ -2087,9 +2223,8 @@ public:
- }
-
- //liuchen 2009-7-21, support Excel VBA Form_QueryClose event
-- virtual void SAL_CALL windowClosing( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException)
-+ virtual void SAL_CALL windowClosing( const lang::EventObject& e ) throw (uno::RuntimeException)
- {
--#if IN_THE_FUTURE
- uno::Reference< awt::XDialog > xDialog( e.Source, uno::UNO_QUERY );
- if ( xDialog.is() )
- {
-@@ -2117,7 +2252,6 @@ public:
- }
-
- mpUserForm->triggerMethod( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Userform_QueryClose") ) );
--#endif
- }
- //liuchen 2009-7-21
-
-@@ -2214,14 +2348,13 @@ void SbUserFormModule::triggerMethod( const String& aMethodToRun )
- Sequence< Any > aArguments;
- triggerMethod( aMethodToRun, aArguments );
- }
--void SbUserFormModule::triggerMethod( const String& aMethodToRun, Sequence< Any >& /*aArguments*/)
-+void SbUserFormModule::triggerMethod( const String& aMethodToRun, Sequence< Any >& aArguments)
- {
- OSL_TRACE("*** trigger %s ***", rtl::OUStringToOString( aMethodToRun, RTL_TEXTENCODING_UTF8 ).getStr() );
- // Search method
- SbxVariable* pMeth = SbObjModule::Find( aMethodToRun, SbxCLASS_METHOD );
- if( pMeth )
- {
--#if IN_THE_FUTURE
- //liuchen 2009-7-21, support Excel VBA UserForm_QueryClose event with parameters
- if ( aArguments.getLength() > 0 ) // Setup parameters
- {
-@@ -2251,7 +2384,6 @@ void SbUserFormModule::triggerMethod( const String& aMethodToRun, Sequence< Any
- }
- else
- //liuchen 2009-7-21
--#endif
- {
- SbxValues aVals;
- pMeth->Get( aVals );
-@@ -2414,7 +2546,7 @@ void SbUserFormModule::InitObject()
- aArgs[ 0 ] = uno::Any();
- aArgs[ 1 ] <<= m_xDialog;
- aArgs[ 2 ] <<= m_xModel;
-- aArgs[ 3 ] <<= rtl::OUString( GetParent()->GetName() );
-+ aArgs[ 3 ] <<= sProjectName;
- pDocObject = new SbUnoObject( GetName(), uno::makeAny( xVBAFactory->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.UserForm")), aArgs ) ) );
- uno::Reference< lang::XComponent > xComponent( aArgs[ 1 ], uno::UNO_QUERY_THROW );
- // remove old listener if it exists
-diff --git basic/source/comp/codegen.cxx basic/source/comp/codegen.cxx
-index c7e8f11..be7c357 100644
---- basic/source/comp/codegen.cxx
-+++ basic/source/comp/codegen.cxx
-@@ -161,8 +161,6 @@ void SbiCodeGen::Save()
- rMod.bIsProxyModule = false;
- }
-
-- if( pParser->bText )
-- p->SetFlag( SBIMG_COMPARETEXT );
- // GlobalCode-Flag
- if( pParser->HasGlobalCode() )
- p->SetFlag( SBIMG_INITCODE );
-@@ -242,6 +240,8 @@ void SbiCodeGen::Save()
- if( nPass == 1 )
- aPropName = aPropName.Copy( aIfaceName.Len() + 1 );
- SbProcedureProperty* pProcedureProperty = NULL;
-+ OSL_TRACE("*** getProcedureProperty for thing %s",
-+ rtl::OUStringToOString( aPropName,RTL_TEXTENCODING_UTF8 ).getStr() );
- pProcedureProperty = rMod.GetProcedureProperty( aPropName, ePropType );
- }
- if( nPass == 1 )
-diff --git basic/source/comp/dim.cxx basic/source/comp/dim.cxx
-index b5131c9..19d9d38 100644
---- basic/source/comp/dim.cxx
-+++ basic/source/comp/dim.cxx
-@@ -29,6 +29,8 @@
- #include "precompiled_basic.hxx"
- #include <basic/sbx.hxx>
- #include "sbcomp.hxx"
-+#include "sbunoobj.hxx"
-+
-
- SbxObject* cloneTypeObjectImpl( const SbxObject& rTypeObj );
-
-@@ -153,7 +155,7 @@ void SbiParser::TypeDecl( SbiSymDef& rDef, BOOL bAsNewAlreadyParsed )
- }
- }
- }
-- else if( rEnumArray->Find( aCompleteName, SbxCLASS_OBJECT ) )
-+ else if( rEnumArray->Find( aCompleteName, SbxCLASS_OBJECT ) || ( IsVBASupportOn() && VBAConstantHelper::instance().isVBAConstantType( aCompleteName ) ) )
- {
- eType = SbxLONG;
- break;
-@@ -423,7 +425,10 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic )
- aExpr.Gen();
- SbiOpcode eOp_ = pDef->IsNew() ? _CREATE : _TCREATE;
- aGen.Gen( eOp_, pDef->GetId(), pDef->GetTypeId() );
-- aGen.Gen( _SET );
-+ if ( bVBASupportOn )
-+ aGen.Gen( _VBASET );
-+ else
-+ aGen.Gen( _SET );
- }
- }
- else
-@@ -975,6 +980,24 @@ void SbiParser::DefDeclare( BOOL bPrivate )
- }
- }
-
-+void SbiParser::Attribute()
-+{
-+ // TODO: Need to implement the method as an attributed object.
-+ while( Next() != EQ )
-+ {
-+ String aSym( GetSym() );
-+ if( Next() != DOT)
-+ break;
-+ }
-+
-+ if( eCurTok != EQ )
-+ Error( SbERR_SYNTAX );
-+ else
-+ SbiExpression aValue( this );
-+
-+ // Don't generate any code - just discard it.
-+}
-+
- // Aufruf einer SUB oder FUNCTION
-
- void SbiParser::Call()
-diff --git basic/source/comp/exprtree.cxx basic/source/comp/exprtree.cxx
-index 389b9e4..dd696d5 100644
---- basic/source/comp/exprtree.cxx
-+++ basic/source/comp/exprtree.cxx
-@@ -382,8 +382,12 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
- // Typ SbxOBJECT sein
- if( pDef->GetType() != SbxOBJECT && pDef->GetType() != SbxVARIANT )
- {
-- pParser->Error( SbERR_BAD_DECLARATION, aSym );
-- bError = TRUE;
-+ // defer error until runtime if in vba mode
-+ if ( !pParser->IsVBASupportOn() )
-+ {
-+ pParser->Error( SbERR_BAD_DECLARATION, aSym );
-+ bError = TRUE;
-+ }
- }
- if( !bError )
- pNd->aVar.pNext = ObjTerm( *pDef );
-@@ -589,7 +593,11 @@ SbiExprNode* SbiExpression::Unary()
- eTok = NEG;
- case NOT:
- pParser->Next();
-- pNd = new SbiExprNode( pParser, Unary(), eTok, NULL );
-+ // process something like "Do While Not "foo"="" "
-+ if( pParser->IsVBASupportOn() )
-+ pNd = new SbiExprNode( pParser, Like(), eTok, NULL );
-+ else
-+ pNd = new SbiExprNode( pParser, Unary(), eTok, NULL );
- break;
- case PLUS:
- pParser->Next();
-@@ -745,7 +753,7 @@ SbiExprNode* SbiExpression::Like()
- pNd = new SbiExprNode( pParser, pNd, eTok, Comp() ), nCount++;
- }
- // Mehrere Operatoren hintereinander gehen nicht
-- if( nCount > 1 )
-+ if( nCount > 1 && !pParser->IsVBASupportOn() )
- {
- pParser->Error( SbERR_SYNTAX );
- bError = TRUE;
-diff --git basic/source/comp/parser.cxx basic/source/comp/parser.cxx
-index 83e7bbd..81fd9d6 100644
---- basic/source/comp/parser.cxx
-+++ basic/source/comp/parser.cxx
-@@ -49,6 +49,7 @@ struct SbiStatement {
- #define N FALSE
-
- static SbiStatement StmntTable [] = {
-+{ ATTRIBUTE, &SbiParser::Attribute, Y, Y, }, // ATTRIBUTE
- { CALL, &SbiParser::Call, N, Y, }, // CALL
- { CLOSE, &SbiParser::Close, N, Y, }, // CLOSE
- { _CONST_, &SbiParser::Dim, Y, Y, }, // CONST
-@@ -387,6 +388,18 @@ BOOL SbiParser::Parse()
- Next(); return TRUE;
- }
-
-+ // In vba it's possible to do Error.foobar ( even if it results in
-+ // a runtime error
-+ if ( eCurTok == _ERROR_ && IsVBASupportOn() ) // we probably need to define a subset of keywords where this madness applies e.g. if ( IsVBASupportOn() && SymbolCanBeRedined( eCurTok ) )
-+ {
-+ SbiTokenizer tokens( *(SbiTokenizer*)this );
-+ tokens.Next();
-+ if ( tokens.Peek() == DOT )
-+ {
-+ eCurTok = SYMBOL;
-+ ePush = eCurTok;
-+ }
-+ }
- // Kommt ein Symbol, ist es entweder eine Variable( LET )
- // oder eine SUB-Prozedur( CALL ohne Klammern )
- // DOT fuer Zuweisungen im WITH-Block: .A=5
-@@ -795,7 +808,7 @@ void SbiParser::Option()
- bClassModule = TRUE;
- aGen.GetModule().SetModuleType( com::sun::star::script::ModuleType::CLASS );
- break;
-- case VBASUPPORT:
-+ case VBASUPPORT: // Option VBASupport used to override the module mode ( in fact this must reset the mode
- if( Next() == NUMBER )
- {
- if ( nVal == 1 || nVal == 0 )
-diff --git basic/source/comp/token.cxx basic/source/comp/token.cxx
-index 0069079..25dd885 100644
---- basic/source/comp/token.cxx
-+++ basic/source/comp/token.cxx
-@@ -58,6 +58,7 @@ static TokenTable aTokTable_Basic [] = { // Token-Tabelle:
- { ANY, "Any" },
- { APPEND, "Append" },
- { AS, "As" },
-+ { ATTRIBUTE,"Attribute" },
- { BASE, "Base" },
- { BINARY, "Binary" },
- { TBOOLEAN, "Boolean" },
-diff --git basic/source/inc/dlgcont.hxx basic/source/inc/dlgcont.hxx
-index 7d22f4d..fe70a45 100644
---- basic/source/inc/dlgcont.hxx
-+++ basic/source/inc/dlgcont.hxx
-@@ -96,7 +96,9 @@ public:
- throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
- throw (::com::sun::star::uno::RuntimeException);
--
-+ // XLibraryQueryExecutable
-+ virtual sal_Bool SAL_CALL HasExecutableCode(const rtl::OUString&)
-+ throw (::com::sun::star::uno::RuntimeException);
- // Service
- static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static();
- static ::rtl::OUString getImplementationName_static();
-diff --git basic/source/inc/namecont.hxx basic/source/inc/namecont.hxx
-index 72cdcee..29bc734 100644
---- basic/source/inc/namecont.hxx
-+++ basic/source/inc/namecont.hxx
-@@ -35,6 +35,7 @@
- #include <com/sun/star/script/XStorageBasedLibraryContainer.hpp>
- #include <com/sun/star/script/XLibraryContainerPassword.hpp>
- #include <com/sun/star/script/XLibraryContainerExport.hpp>
-+#include <com/sun/star/script/XLibraryQueryExecutable.hpp>
- #include <com/sun/star/script/XLibraryContainer3.hpp>
- #include <com/sun/star/container/XNameContainer.hpp>
- #include <com/sun/star/container/XContainer.hpp>
-@@ -59,6 +60,7 @@
-
- #include <cppuhelper/implbase2.hxx>
- #include <cppuhelper/compbase8.hxx>
-+#include <cppuhelper/compbase9.hxx>
- #include <cppuhelper/interfacecontainer.hxx>
- #include <com/sun/star/script/vba/XVBACompatibility.hpp>
-
-@@ -67,13 +69,14 @@ class BasicManager;
- namespace basic
- {
-
--typedef ::cppu::WeakComponentImplHelper8<
-+typedef ::cppu::WeakComponentImplHelper9<
- ::com::sun::star::lang::XInitialization,
- ::com::sun::star::script::XStorageBasedLibraryContainer,
- ::com::sun::star::script::XLibraryContainerPassword,
- ::com::sun::star::script::XLibraryContainerExport,
- ::com::sun::star::script::XLibraryContainer3,
- ::com::sun::star::container::XContainer,
-+ ::com::sun::star::script::XLibraryQueryExecutable,
- ::com::sun::star::script::vba::XVBACompatibility,
- ::com::sun::star::lang::XServiceInfo > LibraryContainerHelper;
-
-diff --git basic/source/inc/parser.hxx basic/source/inc/parser.hxx
-index 4fb7b18..f9a159d 100644
---- basic/source/inc/parser.hxx
-+++ basic/source/inc/parser.hxx
-@@ -106,6 +106,7 @@ public:
- void BadSyntax(); // Falsches SbiToken
- void NoIf(); // ELSE/ELSE IF ohne IF
- void Assign(); // LET
-+ void Attribute(); // Attribute
- void Call(); // CALL
- void Close(); // CLOSE
- void Declare(); // DECLARE
-diff --git basic/source/inc/runtime.hxx basic/source/inc/runtime.hxx
-index 96de7e5..b95b13c 100644
---- basic/source/inc/runtime.hxx
-+++ basic/source/inc/runtime.hxx
-@@ -203,7 +203,6 @@ class SbiInstance
- BOOL bCompatibility; // Flag: TRUE = VBA runtime compatibility mode
-
- ComponentVector_t ComponentVector;
--
- public:
- SbiRuntime* pRun; // Call-Stack
- SbiInstance* pNext; // Instanzen-Chain
-@@ -292,7 +291,9 @@ class SbiRuntime
- SbxArrayRef refExprStk; // expression stack
- SbxArrayRef refCaseStk; // CASE expression stack
- SbxArrayRef refRedimpArray; // Array saved to use for REDIM PRESERVE
-+ SbxVariableRef refRedim; // Array saved to use for REDIM
- SbxVariableRef xDummyVar; // Ersatz fuer nicht gefundene Variablen
-+ SbxVariable* mpExtCaller; // Caller ( external - e.g. button name, shape, range object etc. - only in vba mode )
- SbiArgvStack* pArgvStk; // ARGV-Stack
- SbiGosubStack* pGosubStk; // GOSUB stack
- SbiForStack* pForStk; // FOR/NEXT-Stack
-@@ -462,6 +463,7 @@ public:
- SbMethod* GetCaller();
- SbxArray* GetLocals();
- SbxArray* GetParams();
-+ SbxVariable* GetExternalCaller(){ return mpExtCaller; }
-
- SbxBase* FindElementExtern( const String& rName );
- static bool isVBAEnabled();
-diff --git basic/source/inc/sbunoobj.hxx basic/source/inc/sbunoobj.hxx
-index b8993c1..edbe260 100644
---- basic/source/inc/sbunoobj.hxx
-+++ basic/source/inc/sbunoobj.hxx
-@@ -43,6 +43,7 @@
- #include <com/sun/star/reflection/XServiceTypeDescription2.hpp>
- #include <com/sun/star/reflection/XSingletonTypeDescription.hpp>
- #include <rtl/ustring.hxx>
-+#include <hash_map>
-
- class SbUnoObject: public SbxObject
- {
-@@ -320,6 +321,26 @@ public:
- virtual void Clear();
- };
-
-+typedef std::hash_map< ::rtl::OUString, ::com::sun::star::uno::Any, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > VBAConstantsHash;
-+
-+typedef std::vector< rtl::OUString > VBAConstantsVector;
-+
-+class VBAConstantHelper
-+{
-+private:
-+
-+ VBAConstantsVector aConstCache;
-+ VBAConstantsHash aConstHash;
-+ bool isInited;
-+ VBAConstantHelper():isInited( false ) {}
-+ VBAConstantHelper(const VBAConstantHelper&);
-+ void init();
-+public:
-+ static VBAConstantHelper& instance();
-+ SbxVariable* getVBAConstant( const String& rName );
-+ bool isVBAConstantType( const String& rName );
-+};
-+
- #endif
-
-
-diff --git basic/source/inc/scriptcont.hxx basic/source/inc/scriptcont.hxx
-index 71ad535..3fb35ed 100644
---- basic/source/inc/scriptcont.hxx
-+++ basic/source/inc/scriptcont.hxx
-@@ -122,7 +122,9 @@ public:
- throw (::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::container::NoSuchElementException,
- ::com::sun::star::uno::RuntimeException);
--
-+ // XLibraryQueryExecutable
-+ virtual sal_Bool SAL_CALL HasExecutableCode(const rtl::OUString&)
-+ throw (::com::sun::star::uno::RuntimeException);
- // Methods XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName( )
- throw (::com::sun::star::uno::RuntimeException);
-diff --git basic/source/inc/token.hxx basic/source/inc/token.hxx
-index 7c3ff75..068a107 100644
---- basic/source/inc/token.hxx
-+++ basic/source/inc/token.hxx
-@@ -72,7 +72,7 @@ enum SbiToken {
- IF, _IN_, INPUT,
- LET, LINE, LINEINPUT, LOCAL, LOOP, LPRINT, LSET,
- NAME, NEW, NEXT,
-- ON, OPEN, OPTION, IMPLEMENTS,
-+ ON, OPEN, OPTION, ATTRIBUTE, IMPLEMENTS,
- PRINT, PRIVATE, PROPERTY, PUBLIC,
- REDIM, REM, RESUME, RETURN, RSET,
- SELECT, SET, SHARED, STATIC, STEP, STOP, SUB,
-diff --git basic/source/runtime/methods.cxx basic/source/runtime/methods.cxx
-index cafa0ee..a8e7d84 100644
---- basic/source/runtime/methods.cxx
-+++ basic/source/runtime/methods.cxx
-@@ -48,6 +48,7 @@
- #include <unotools/ucbstreamhelper.hxx>
- #include <tools/wldcrd.hxx>
- #include <i18npool/lang.h>
-+#include <rtl/string.hxx>
-
- #include "runtime.hxx"
- #include "sbunoobj.hxx"
-@@ -75,13 +76,16 @@
- #include <com/sun/star/io/XOutputStream.hpp>
- #include <com/sun/star/io/XStream.hpp>
- #include <com/sun/star/io/XSeekable.hpp>
--
-+#include <com/sun/star/script/XErrorQuery.hpp>
-+#include <ooo/vba/XHelperInterface.hpp>
-+#include <com/sun/star/bridge/oleautomation/XAutomationObject.hpp>
- using namespace comphelper;
- using namespace osl;
- using namespace com::sun::star::uno;
- using namespace com::sun::star::lang;
- using namespace com::sun::star::ucb;
- using namespace com::sun::star::io;
-+using namespace com::sun::star::script;
-
- #endif /* _USE_UNO */
-
-@@ -103,6 +107,8 @@ using namespace com::sun::star::io;
- #include <stdlib.h>
- #include <ctype.h>
-
-+SbxVariable* getDefaultProp( SbxVariable* pRef );
-+
- #if defined (WIN) || defined (WNT) || defined (OS2)
- #include <direct.h> // _getdcwd get current work directory, _chdrive
- #endif
-@@ -121,6 +127,9 @@ using namespace com::sun::star::io;
- #include <io.h>
- #endif
-
-+
-+#include <basic/sbobjmod.hxx>
-+
- #include <basic/sbobjmod.hxx>
-
- static void FilterWhiteSpace( String& rStr )
-@@ -706,6 +716,36 @@ RTLFUNC(MkDir) // JSM
- {
- try
- {
-+ if ( SbiRuntime::isVBAEnabled() )
-+ {
-+ // If aPath is the folder name, not a path, then create the folder under current directory.
-+ INetURLObject aTryPathURL( aPath );
-+ ::rtl::OUString sPathURL = aTryPathURL.GetMainURL( INetURLObject::NO_DECODE );
-+ if ( !sPathURL.getLength() )
-+ {
-+ File::getFileURLFromSystemPath( aPath, sPathURL );
-+ }
-+ INetURLObject aPathURL( sPathURL );
-+ if ( !aPathURL.GetPath().getLength() )
-+ {
-+ ::rtl::OUString sCurDirURL;
-+ SbxArrayRef pPar = new SbxArray;
-+ SbxVariableRef pVar = new SbxVariable();
-+ pPar->Put( pVar, 0 );
-+ SbRtl_CurDir( pBasic, *pPar, FALSE );
-+ String aCurPath = pPar->Get(0)->GetString();
-+
-+ File::getFileURLFromSystemPath( aCurPath, sCurDirURL );
-+ INetURLObject aDirURL( sCurDirURL );
-+ aDirURL.Append( aPath );
-+ ::rtl::OUString aTmpPath = aDirURL.GetMainURL( INetURLObject::NO_DECODE );
-+ if ( aTmpPath.getLength() > 0 )
-+ {
-+ aPath = aTmpPath;
-+ }
-+ }
-+ }
-+
- xSFI->createFolder( getFullPath( aPath ) );
- }
- catch( Exception & )
-@@ -940,6 +980,26 @@ RTLFUNC(Hex)
- }
- }
-
-+RTLFUNC(FuncCaller)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+ if ( SbiRuntime::isVBAEnabled() && pINST && pINST->pRun )
-+ {
-+ if ( pINST->pRun->GetExternalCaller() )
-+ *rPar.Get(0) = *pINST->pRun->GetExternalCaller();
-+ else
-+ {
-+ SbxVariableRef pVar = new SbxVariable(SbxVARIANT);
-+ *rPar.Get(0) = *pVar;
-+ }
-+ }
-+ else
-+ {
-+ StarBASIC::Error( SbERR_NOT_IMPLEMENTED );
-+ }
-+
-+}
- // InStr( [start],string,string,[compare] )
-
- RTLFUNC(InStr)
-@@ -2411,7 +2471,18 @@ RTLFUNC(IsEmpty)
- if ( rPar.Count() < 2 )
- StarBASIC::Error( SbERR_BAD_ARGUMENT );
- else
-- rPar.Get( 0 )->PutBool( rPar.Get(1)->IsEmpty() );
-+ {
-+ SbxVariable* pVar = NULL;
-+ if( SbiRuntime::isVBAEnabled() )
-+ pVar = getDefaultProp( rPar.Get(1) );
-+ if ( pVar )
-+ {
-+ pVar->Broadcast( SBX_HINT_DATAWANTED );
-+ rPar.Get( 0 )->PutBool( pVar->IsEmpty() );
-+ }
-+ else
-+ rPar.Get( 0 )->PutBool( rPar.Get(1)->IsEmpty() );
-+ }
- }
-
- RTLFUNC(IsError)
-@@ -2422,7 +2493,22 @@ RTLFUNC(IsError)
- if ( rPar.Count() < 2 )
- StarBASIC::Error( SbERR_BAD_ARGUMENT );
- else
-- rPar.Get( 0 )->PutBool( rPar.Get(1)->IsErr() );
-+ {
-+ SbxVariable* pVar =rPar.Get( 1 );
-+ SbUnoObject* pObj = PTR_CAST(SbUnoObject,pVar );
-+ if ( !pObj )
-+ {
-+ if ( SbxBase* pBaseObj = pVar->GetObject() )
-+ pObj = PTR_CAST(SbUnoObject, pBaseObj );
-+ }
-+ Reference< XErrorQuery > xError;
-+ if ( pObj )
-+ xError.set( pObj->getUnoAny(), UNO_QUERY );
-+ if ( xError.is() )
-+ rPar.Get( 0 )->PutBool( xError->hasError() );
-+ else
-+ rPar.Get( 0 )->PutBool( rPar.Get(1)->IsErr() );
-+ }
- }
-
- RTLFUNC(IsNull)
-@@ -3542,6 +3628,13 @@ RTLFUNC(Shell)
- NAMESPACE_VOS(OArgumentList) aArgList( pArgumentList, nParamCount );
- bSucc = pApp->execute( eOptions, aArgList ) == NAMESPACE_VOS(OProcess)::E_None;
- }
-+ long nResult = 0;
-+ NAMESPACE_VOS(OProcess)::TProcessInfo aInfo;
-+ // We should return the identifier of the executing process when is running VBA, because method Shell(...) returns it in Excel.
-+ if ( bSucc && SbiRuntime::isVBAEnabled() && pApp->getInfo( NAMESPACE_VOS(OProcess)::TData_Identifier, &aInfo ) == NAMESPACE_VOS(OProcess)::E_None )
-+ {
-+ nResult = aInfo.Ident;
-+ }
-
- /*
- if( nParamCount == 0 )
-@@ -3556,7 +3649,7 @@ RTLFUNC(Shell)
- if( !bSucc )
- StarBASIC::Error( SbERR_FILE_NOT_FOUND );
- else
-- rPar.Get(0)->PutLong( 0 );
-+ rPar.Get(0)->PutLong( nResult );
- }
- }
-
-@@ -3627,6 +3720,65 @@ String getBasicTypeName( SbxDataType eType )
- return aRetStr;
- }
-
-+String getObjectTypeName( SbxVariable* pVar )
-+{
-+ rtl::OUString sRet( RTL_CONSTASCII_USTRINGPARAM("Object") );
-+ if ( pVar )
-+ {
-+ SbxBase* pObj = pVar->GetObject();
-+ if( !pObj )
-+ sRet = String( RTL_CONSTASCII_USTRINGPARAM("Nothing") );
-+ else
-+ {
-+ SbUnoObject* pUnoObj = PTR_CAST(SbUnoObject,pVar );
-+ if ( !pUnoObj )
-+ {
-+ if ( SbxBase* pBaseObj = pVar->GetObject() )
-+ pUnoObj = PTR_CAST(SbUnoObject, pBaseObj );
-+ }
-+ if ( pUnoObj )
-+ {
-+ Any aObj = pUnoObj->getUnoAny();
-+ // For upstreaming unless we start to build oovbaapi by default
-+ // we need to get detect the vba-ness of the object in some
-+ // other way
-+ // note: Automation objects do not support XServiceInfo
-+ Reference< XServiceInfo > xServInfo( aObj, UNO_QUERY );
-+ if ( xServInfo.is() )
-+ {
-+ // is this a VBA object ?
-+ Reference< ooo::vba::XHelperInterface > xVBA( aObj, UNO_QUERY );
-+ Sequence< rtl::OUString > sServices = xServInfo->getSupportedServiceNames();
-+ if ( sServices.getLength() )
-+ sRet = sServices[ 0 ];
-+ }
-+ else
-+ {
-+ Reference< com::sun::star::bridge::oleautomation::XAutomationObject > xAutoMation( aObj, UNO_QUERY );
-+ if ( xAutoMation.is() )
-+ {
-+ Reference< XInvocation > xInv( aObj, UNO_QUERY );
-+ if ( xInv.is() )
-+ {
-+ try
-+ {
-+ xInv->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("$GetTypeName") ) ) >>= sRet;
-+ }
-+ catch( Exception& )
-+ {
-+ }
-+ }
-+ }
-+ }
-+ sal_Int32 nDot = sRet.lastIndexOf( '.' );
-+ if ( nDot != -1 && nDot < sRet.getLength() )
-+ sRet = sRet.copy( nDot + 1 );
-+ }
-+ }
-+ }
-+ return sRet;
-+}
-+
- RTLFUNC(TypeName)
- {
- (void)pBasic;
-@@ -3638,7 +3790,12 @@ RTLFUNC(TypeName)
- {
- SbxDataType eType = rPar.Get(1)->GetType();
- BOOL bIsArray = ( ( eType & SbxARRAY ) != 0 );
-- String aRetStr = getBasicTypeName( eType );
-+
-+ String aRetStr;
-+ if ( SbiRuntime::isVBAEnabled() && eType == SbxOBJECT )
-+ aRetStr = getObjectTypeName( rPar.Get(1) );
-+ else
-+ aRetStr = getBasicTypeName( eType );
- if( bIsArray )
- aRetStr.AppendAscii( "()" );
- rPar.Get(0)->PutString( aRetStr );
-diff --git basic/source/runtime/methods1.cxx basic/source/runtime/methods1.cxx
-index f22a52c..9d3b51a 100644
---- basic/source/runtime/methods1.cxx
-+++ basic/source/runtime/methods1.cxx
-@@ -78,11 +78,15 @@
- #include <com/sun/star/uno/Sequence.hxx>
- #include <com/sun/star/lang/XMultiServiceFactory.hpp>
- #include <com/sun/star/i18n/XCalendar.hpp>
-+#include <com/sun/star/sheet/XFunctionAccess.hpp>
-
- using namespace comphelper;
-+using namespace com::sun::star::sheet;
- using namespace com::sun::star::uno;
- using namespace com::sun::star::i18n;
-
-+void unoToSbxValue( SbxVariable* pVar, const Any& aValue );
-+Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, com::sun::star::beans::Property* pUnoProperty = NULL );
-
- static Reference< XCalendar > getLocaleCalendar( void )
- {
-@@ -2518,6 +2522,546 @@ RTLFUNC(Round)
- rPar.Get(0)->PutDouble( dRes );
- }
-
-+void CallFunctionAccessFunction( const Sequence< Any >& aArgs, const rtl::OUString& sFuncName, SbxVariable* pRet )
-+{
-+ static Reference< XFunctionAccess > xFunc;
-+ Any aRes;
-+ try
-+ {
-+ if ( !xFunc.is() )
-+ {
-+ Reference< XMultiServiceFactory > xFactory( getProcessServiceFactory() );
-+ if( xFactory.is() )
-+ {
-+ xFunc.set( xFactory->createInstance(::rtl::OUString::createFromAscii( "com.sun.star.sheet.FunctionAccess")), UNO_QUERY_THROW);
-+ }
-+ }
-+ Any aRet = xFunc->callFunction( sFuncName, aArgs );
-+
-+ unoToSbxValue( pRet, aRet );
-+
-+ }
-+ catch( Exception& )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ }
-+}
-+
-+RTLFUNC(SYD)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ ULONG nArgCount = rPar.Count()-1;
-+
-+ if ( nArgCount < 4 )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ return;
-+ }
-+
-+ // retrieve non-optional params
-+
-+ Sequence< Any > aParams( 4 );
-+ aParams[ 0 ] <<= makeAny( rPar.Get(1)->GetDouble() );
-+ aParams[ 1 ] <<= makeAny( rPar.Get(2)->GetDouble() );
-+ aParams[ 2 ] <<= makeAny( rPar.Get(3)->GetDouble() );
-+ aParams[ 3 ] <<= makeAny( rPar.Get(4)->GetDouble() );
-+
-+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SYD") ), rPar.Get( 0 ) );
-+}
-+
-+RTLFUNC(SLN)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ ULONG nArgCount = rPar.Count()-1;
-+
-+ if ( nArgCount < 3 )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ return;
-+ }
-+
-+ // retrieve non-optional params
-+
-+ Sequence< Any > aParams( 3 );
-+ aParams[ 0 ] <<= makeAny( rPar.Get(1)->GetDouble() );
-+ aParams[ 1 ] <<= makeAny( rPar.Get(2)->GetDouble() );
-+ aParams[ 2 ] <<= makeAny( rPar.Get(3)->GetDouble() );
-+
-+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SLN") ), rPar.Get( 0 ) );
-+}
-+
-+RTLFUNC(Pmt)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ ULONG nArgCount = rPar.Count()-1;
-+
-+ if ( nArgCount < 3 || nArgCount > 5 )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ return;
-+ }
-+ // retrieve non-optional params
-+
-+ double rate = rPar.Get(1)->GetDouble();
-+ double nper = rPar.Get(2)->GetDouble();
-+ double pmt = rPar.Get(3)->GetDouble();
-+
-+ // set default values for Optional args
-+ double fv = 0;
-+ double type = 0;
-+
-+ // fv
-+ if ( nArgCount >= 4 )
-+ {
-+ if( rPar.Get(4)->GetType() != SbxEMPTY )
-+ fv = rPar.Get(4)->GetDouble();
-+ }
-+ // type
-+ if ( nArgCount >= 5 )
-+ {
-+ if( rPar.Get(5)->GetType() != SbxEMPTY )
-+ type = rPar.Get(5)->GetDouble();
-+ }
-+
-+ Sequence< Any > aParams( 5 );
-+ aParams[ 0 ] <<= rate;
-+ aParams[ 1 ] <<= nper;
-+ aParams[ 2 ] <<= pmt;
-+ aParams[ 3 ] <<= fv;
-+ aParams[ 4 ] <<= type;
-+
-+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Pmt") ), rPar.Get( 0 ) );
-+}
-+
-+RTLFUNC(PPmt)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ ULONG nArgCount = rPar.Count()-1;
-+
-+ if ( nArgCount < 4 || nArgCount > 6 )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ return;
-+ }
-+ // retrieve non-optional params
-+
-+ double rate = rPar.Get(1)->GetDouble();
-+ double per = rPar.Get(2)->GetDouble();
-+ double nper = rPar.Get(3)->GetDouble();
-+ double pv = rPar.Get(4)->GetDouble();
-+
-+ // set default values for Optional args
-+ double fv = 0;
-+ double type = 0;
-+
-+ // fv
-+ if ( nArgCount >= 5 )
-+ {
-+ if( rPar.Get(5)->GetType() != SbxEMPTY )
-+ fv = rPar.Get(5)->GetDouble();
-+ }
-+ // type
-+ if ( nArgCount >= 6 )
-+ {
-+ if( rPar.Get(6)->GetType() != SbxEMPTY )
-+ type = rPar.Get(6)->GetDouble();
-+ }
-+
-+ Sequence< Any > aParams( 6 );
-+ aParams[ 0 ] <<= rate;
-+ aParams[ 1 ] <<= per;
-+ aParams[ 2 ] <<= nper;
-+ aParams[ 3 ] <<= pv;
-+ aParams[ 4 ] <<= fv;
-+ aParams[ 5 ] <<= type;
-+
-+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PPmt") ), rPar.Get( 0 ) );
-+}
-+
-+RTLFUNC(PV)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ ULONG nArgCount = rPar.Count()-1;
-+
-+ if ( nArgCount < 3 || nArgCount > 5 )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ return;
-+ }
-+ // retrieve non-optional params
-+
-+ double rate = rPar.Get(1)->GetDouble();
-+ double nper = rPar.Get(2)->GetDouble();
-+ double pmt = rPar.Get(3)->GetDouble();
-+
-+ // set default values for Optional args
-+ double fv = 0;
-+ double type = 0;
-+
-+ // fv
-+ if ( nArgCount >= 4 )
-+ {
-+ if( rPar.Get(4)->GetType() != SbxEMPTY )
-+ fv = rPar.Get(4)->GetDouble();
-+ }
-+ // type
-+ if ( nArgCount >= 5 )
-+ {
-+ if( rPar.Get(5)->GetType() != SbxEMPTY )
-+ type = rPar.Get(5)->GetDouble();
-+ }
-+
-+ Sequence< Any > aParams( 5 );
-+ aParams[ 0 ] <<= rate;
-+ aParams[ 1 ] <<= nper;
-+ aParams[ 2 ] <<= pmt;
-+ aParams[ 3 ] <<= fv;
-+ aParams[ 4 ] <<= type;
-+
-+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PV") ), rPar.Get( 0 ) );
-+}
-+
-+RTLFUNC(NPV)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ ULONG nArgCount = rPar.Count()-1;
-+
-+ if ( nArgCount < 1 || nArgCount > 2 )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ return;
-+ }
-+
-+ Sequence< Any > aParams( 2 );
-+ aParams[ 0 ] <<= makeAny( rPar.Get(1)->GetDouble() );
-+ Any aValues = sbxToUnoValue( rPar.Get(2),
-+ getCppuType( (Sequence<double>*)0 ) );
-+
-+ // convert for calc functions
-+ Sequence< Sequence< double > > sValues(1);
-+ aValues >>= sValues[ 0 ];
-+ aValues <<= sValues;
-+
-+ aParams[ 1 ] <<= aValues;
-+
-+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NPV") ), rPar.Get( 0 ) );
-+}
-+
-+RTLFUNC(NPer)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ ULONG nArgCount = rPar.Count()-1;
-+
-+ if ( nArgCount < 3 || nArgCount > 5 )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ return;
-+ }
-+ // retrieve non-optional params
-+
-+ double rate = rPar.Get(1)->GetDouble();
-+ double pmt = rPar.Get(2)->GetDouble();
-+ double pv = rPar.Get(3)->GetDouble();
-+
-+ // set default values for Optional args
-+ double fv = 0;
-+ double type = 0;
-+
-+ // fv
-+ if ( nArgCount >= 4 )
-+ {
-+ if( rPar.Get(4)->GetType() != SbxEMPTY )
-+ fv = rPar.Get(4)->GetDouble();
-+ }
-+ // type
-+ if ( nArgCount >= 5 )
-+ {
-+ if( rPar.Get(5)->GetType() != SbxEMPTY )
-+ type = rPar.Get(5)->GetDouble();
-+ }
-+
-+ Sequence< Any > aParams( 5 );
-+ aParams[ 0 ] <<= rate;
-+ aParams[ 1 ] <<= pmt;
-+ aParams[ 2 ] <<= pv;
-+ aParams[ 3 ] <<= fv;
-+ aParams[ 4 ] <<= type;
-+
-+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NPer") ), rPar.Get( 0 ) );
-+}
-+
-+RTLFUNC(MIRR)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ ULONG nArgCount = rPar.Count()-1;
-+
-+ if ( nArgCount < 3 )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ return;
-+ }
-+
-+ // retrieve non-optional params
-+
-+ Sequence< Any > aParams( 3 );
-+ Any aValues = sbxToUnoValue( rPar.Get(1),
-+ getCppuType( (Sequence<double>*)0 ) );
-+
-+ // convert for calc functions
-+ Sequence< Sequence< double > > sValues(1);
-+ aValues >>= sValues[ 0 ];
-+ aValues <<= sValues;
-+
-+ aParams[ 0 ] <<= aValues;
-+ aParams[ 1 ] <<= makeAny( rPar.Get(2)->GetDouble() );
-+ aParams[ 2 ] <<= makeAny( rPar.Get(3)->GetDouble() );
-+
-+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("MIRR") ), rPar.Get( 0 ) );
-+}
-+
-+RTLFUNC(IRR)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ ULONG nArgCount = rPar.Count()-1;
-+
-+ if ( nArgCount < 1 || nArgCount > 2 )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ return;
-+ }
-+ // retrieve non-optional params
-+ Any aValues = sbxToUnoValue( rPar.Get(1),
-+ getCppuType( (Sequence<double>*)0 ) );
-+
-+ // convert for calc functions
-+ Sequence< Sequence< double > > sValues(1);
-+ aValues >>= sValues[ 0 ];
-+ aValues <<= sValues;
-+
-+ // set default values for Optional args
-+ double guess = 0.1;
-+ // guess
-+ if ( nArgCount >= 2 )
-+ {
-+ if( rPar.Get(2)->GetType() != SbxEMPTY )
-+ guess = rPar.Get(2)->GetDouble();
-+ }
-+
-+ Sequence< Any > aParams( 2 );
-+ aParams[ 0 ] <<= aValues;
-+ aParams[ 1 ] <<= guess;
-+
-+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IRR") ), rPar.Get( 0 ) );
-+}
-+
-+RTLFUNC(IPmt)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ ULONG nArgCount = rPar.Count()-1;
-+
-+ if ( nArgCount < 4 || nArgCount > 6 )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ return;
-+ }
-+ // retrieve non-optional params
-+
-+ double rate = rPar.Get(1)->GetDouble();
-+ double per = rPar.Get(2)->GetInteger();
-+ double nper = rPar.Get(3)->GetDouble();
-+ double pv = rPar.Get(4)->GetDouble();
-+
-+ // set default values for Optional args
-+ double fv = 0;
-+ double type = 0;
-+
-+ // fv
-+ if ( nArgCount >= 5 )
-+ {
-+ if( rPar.Get(5)->GetType() != SbxEMPTY )
-+ fv = rPar.Get(5)->GetDouble();
-+ }
-+ // type
-+ if ( nArgCount >= 6 )
-+ {
-+ if( rPar.Get(6)->GetType() != SbxEMPTY )
-+ type = rPar.Get(6)->GetDouble();
-+ }
-+
-+ Sequence< Any > aParams( 6 );
-+ aParams[ 0 ] <<= rate;
-+ aParams[ 1 ] <<= per;
-+ aParams[ 2 ] <<= nper;
-+ aParams[ 3 ] <<= pv;
-+ aParams[ 4 ] <<= fv;
-+ aParams[ 5 ] <<= type;
-+
-+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IPmt") ), rPar.Get( 0 ) );
-+}
-+
-+RTLFUNC(FV)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ ULONG nArgCount = rPar.Count()-1;
-+
-+ if ( nArgCount < 3 || nArgCount > 5 )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ return;
-+ }
-+ // retrieve non-optional params
-+
-+ double rate = rPar.Get(1)->GetDouble();
-+ double nper = rPar.Get(2)->GetDouble();
-+ double pmt = rPar.Get(3)->GetDouble();
-+
-+ // set default values for Optional args
-+ double pv = 0;
-+ double type = 0;
-+
-+ // pv
-+ if ( nArgCount >= 4 )
-+ {
-+ if( rPar.Get(4)->GetType() != SbxEMPTY )
-+ pv = rPar.Get(4)->GetDouble();
-+ }
-+ // type
-+ if ( nArgCount >= 5 )
-+ {
-+ if( rPar.Get(5)->GetType() != SbxEMPTY )
-+ type = rPar.Get(5)->GetDouble();
-+ }
-+
-+ Sequence< Any > aParams( 5 );
-+ aParams[ 0 ] <<= rate;
-+ aParams[ 1 ] <<= nper;
-+ aParams[ 2 ] <<= pmt;
-+ aParams[ 3 ] <<= pv;
-+ aParams[ 4 ] <<= type;
-+
-+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FV") ), rPar.Get( 0 ) );
-+}
-+
-+RTLFUNC(DDB)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ ULONG nArgCount = rPar.Count()-1;
-+
-+ if ( nArgCount < 4 || nArgCount > 5 )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ return;
-+ }
-+ // retrieve non-optional params
-+
-+ double cost = rPar.Get(1)->GetDouble();
-+ double salvage = rPar.Get(2)->GetDouble();
-+ double life = rPar.Get(3)->GetDouble();
-+ double period = rPar.Get(4)->GetDouble();
-+
-+ // set default values for Optional args
-+ double factor = 2;
-+
-+ // factor
-+ if ( nArgCount >= 5 )
-+ {
-+ if( rPar.Get(5)->GetType() != SbxEMPTY )
-+ factor = rPar.Get(5)->GetDouble();
-+ }
-+
-+ Sequence< Any > aParams( 5 );
-+ aParams[ 0 ] <<= cost;
-+ aParams[ 1 ] <<= salvage;
-+ aParams[ 2 ] <<= life;
-+ aParams[ 3 ] <<= period;
-+ aParams[ 4 ] <<= factor;
-+
-+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DDB") ), rPar.Get( 0 ) );
-+}
-+
-+RTLFUNC(Rate)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ ULONG nArgCount = rPar.Count()-1;
-+
-+ if ( nArgCount < 3 || nArgCount > 6 )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ return;
-+ }
-+ // retrieve non-optional params
-+
-+ double nper = 0;
-+ double pmt = 0;
-+ double pv = 0;
-+
-+ nper = rPar.Get(1)->GetDouble();
-+ pmt = rPar.Get(2)->GetDouble();
-+ pv = rPar.Get(3)->GetDouble();
-+
-+ // set default values for Optional args
-+ double fv = 0;
-+ double type = 0;
-+ double guess = 0.1;
-+
-+ // fv
-+ if ( nArgCount >= 4 )
-+ {
-+ if( rPar.Get(4)->GetType() != SbxEMPTY )
-+ fv = rPar.Get(4)->GetDouble();
-+ }
-+
-+ // type
-+ if ( nArgCount >= 5 )
-+ {
-+ if( rPar.Get(5)->GetType() != SbxEMPTY )
-+ type = rPar.Get(5)->GetDouble();
-+ }
-+
-+ // guess
-+ if ( nArgCount >= 6 )
-+ {
-+ if( rPar.Get(6)->GetType() != SbxEMPTY )
-+ type = rPar.Get(6)->GetDouble();
-+ }
-+
-+ Sequence< Any > aParams( 6 );
-+ aParams[ 0 ] <<= nper;
-+ aParams[ 1 ] <<= pmt;
-+ aParams[ 2 ] <<= pv;
-+ aParams[ 3 ] <<= fv;
-+ aParams[ 4 ] <<= type;
-+ aParams[ 5 ] <<= guess;
-+
-+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Rate") ), rPar.Get( 0 ) );
-+}
-+
- RTLFUNC(StrReverse)
- {
- (void)pBasic;
-diff --git basic/source/runtime/rtlproto.hxx basic/source/runtime/rtlproto.hxx
-index e3b2a05..b1145c8 100644
---- basic/source/runtime/rtlproto.hxx
-+++ basic/source/runtime/rtlproto.hxx
-@@ -165,29 +165,41 @@ extern RTLFUNC(Kill); // JSM
- extern RTLFUNC(MkDir); // JSM
- extern RTLFUNC(RmDir); // JSM
- extern RTLFUNC(SendKeys); // JSM
-+extern RTLFUNC(DDB);
- extern RTLFUNC(DimArray);
- extern RTLFUNC(Dir);
- extern RTLFUNC(DoEvents);
- extern RTLFUNC(Exp);
- extern RTLFUNC(FileLen);
- extern RTLFUNC(Fix);
-+extern RTLFUNC(FV);
- extern RTLFUNC(Hex);
- extern RTLFUNC(Input);
- extern RTLFUNC(InStr);
- extern RTLFUNC(InStrRev);
- extern RTLFUNC(Int);
-+extern RTLFUNC(IPmt);
-+extern RTLFUNC(IRR);
- extern RTLFUNC(Join);
- extern RTLFUNC(LCase);
- extern RTLFUNC(Left);
- extern RTLFUNC(Log);
- extern RTLFUNC(LTrim);
- extern RTLFUNC(Mid);
-+extern RTLFUNC(MIRR);
-+extern RTLFUNC(NPer);
-+extern RTLFUNC(NPV);
- extern RTLFUNC(Oct);
-+extern RTLFUNC(Pmt);
-+extern RTLFUNC(PPmt);
-+extern RTLFUNC(PV);
-+extern RTLFUNC(Rate);
- extern RTLFUNC(Replace);
- extern RTLFUNC(Right);
- extern RTLFUNC(RTrim);
- extern RTLFUNC(RTL);
- extern RTLFUNC(Sgn);
-+extern RTLFUNC(SLN);
- extern RTLFUNC(Space);
- extern RTLFUNC(Split);
- extern RTLFUNC(Sqr);
-@@ -195,6 +207,7 @@ extern RTLFUNC(Str);
- extern RTLFUNC(StrComp);
- extern RTLFUNC(String);
- extern RTLFUNC(StrReverse);
-+extern RTLFUNC(SYD);
- extern RTLFUNC(Tan);
- extern RTLFUNC(UCase);
- extern RTLFUNC(Val);
-@@ -297,6 +310,7 @@ extern RTLFUNC(Switch);
- extern RTLFUNC(Wait);
- //i#64882# add new WaitUntil
- extern RTLFUNC(WaitUntil);
-+extern RTLFUNC(FuncCaller);
-
- extern RTLFUNC(GetGUIVersion);
- extern RTLFUNC(Choose);
-diff --git basic/source/runtime/runtime.cxx basic/source/runtime/runtime.cxx
-index a8eff4d..e08ebeb 100755
---- basic/source/runtime/runtime.cxx
-+++ basic/source/runtime/runtime.cxx
-@@ -46,6 +46,8 @@
- #include "errobject.hxx"
- #include "sbtrace.hxx"
-
-+SbxVariable* getDefaultProp( SbxVariable* pRef );
-+
- using namespace ::com::sun::star;
-
- bool SbiRuntime::isVBAEnabled()
-@@ -544,7 +546,7 @@ SbxArray* SbiInstance::GetLocals( SbMethod* pMeth )
-
- SbiRuntime::SbiRuntime( SbModule* pm, SbMethod* pe, UINT32 nStart )
- : rBasic( *(StarBASIC*)pm->pParent ), pInst( pINST ),
-- pMod( pm ), pMeth( pe ), pImg( pMod->pImage ), m_nLastTime(0)
-+ pMod( pm ), pMeth( pe ), pImg( pMod->pImage ), mpExtCaller(0), m_nLastTime(0)
- {
- nFlags = pe ? pe->GetDebugFlags() : 0;
- pIosys = pInst->pIosys;
-@@ -601,6 +603,13 @@ SbiRuntime::~SbiRuntime()
- void SbiRuntime::SetVBAEnabled(bool bEnabled )
- {
- bVBAEnabled = bEnabled;
-+ if ( bVBAEnabled )
-+ {
-+ if ( pMeth )
-+ mpExtCaller = pMeth->mCaller;
-+ }
-+ else
-+ mpExtCaller = 0;
- }
-
- // Aufbau der Parameterliste. Alle ByRef-Parameter werden direkt
-@@ -1029,7 +1038,25 @@ SbxVariable* SbiRuntime::GetTOS( short n )
- void SbiRuntime::TOSMakeTemp()
- {
- SbxVariable* p = refExprStk->Get( nExprLvl - 1 );
-- if( p->GetRefCount() != 1 )
-+ if ( p->GetType() == SbxEMPTY )
-+ p->Broadcast( SBX_HINT_DATAWANTED );
-+
-+ SbxVariable* pDflt = NULL;
-+ if ( bVBAEnabled && ( p->GetType() == SbxOBJECT || p->GetType() == SbxVARIANT ) && ( pDflt = getDefaultProp( p ) ) )
-+ {
-+ pDflt->Broadcast( SBX_HINT_DATAWANTED );
-+ // replacing new p on stack causes object pointed by
-+ // pDft->pParent to be deleted, when p2->Compute() is
-+ // called below pParent is accessed ( but its deleted )
-+ // so set it to NULL now
-+ pDflt->SetParent( NULL );
-+ p = new SbxVariable( *pDflt );
-+ p->SetFlag( SBX_READWRITE );
-+ refExprStk->Put( p, nExprLvl - 1 );
-+// return;
-+ }
-+
-+ else if( p->GetRefCount() != 1 )
- {
- SbxVariable* pNew = new SbxVariable( *p );
- pNew->SetFlag( SBX_READWRITE );
-@@ -1038,7 +1065,6 @@ void SbiRuntime::TOSMakeTemp()
- }
-
- // Der GOSUB-Stack nimmt Returnadressen fuer GOSUBs auf
--
- void SbiRuntime::PushGosub( const BYTE* pc )
- {
- if( ++nGosubLvl > MAXRECURSION )
-diff --git basic/source/runtime/stdobj.cxx basic/source/runtime/stdobj.cxx
-index d621a12..9605df5 100644
---- basic/source/runtime/stdobj.cxx
-+++ basic/source/runtime/stdobj.cxx
-@@ -33,7 +33,7 @@
- #include <basic/sbstdobj.hxx>
- #include "rtlproto.hxx"
- #include "sbintern.hxx"
--
-+#include <hash_map>
- // Das nArgs-Feld eines Tabelleneintrags ist wie folgt verschluesselt:
- // Zur Zeit wird davon ausgegangen, dass Properties keine Parameter
- // benoetigen!
-@@ -69,6 +69,45 @@ struct Methods {
- USHORT nHash; // Hashcode
- };
-
-+struct StringHashCode
-+{
-+ size_t operator()( const String& rStr ) const
-+ {
-+ return rtl_ustr_hashCode_WithLength( rStr.GetBuffer(), rStr.Len() );
-+ }
-+};
-+
-+class VBABlacklist
-+{
-+friend class VBABlackListQuery;
-+ std::hash_map< String, bool, StringHashCode > mBlackList;
-+ VBABlacklist()
-+ {
-+ const char* list[] = { "Red" };
-+ sal_Int32 nSize = sizeof( list ) / sizeof( list[ 0 ] );
-+ for ( sal_Int32 index = 0; index < nSize; ++index )
-+ {
-+ mBlackList[ String::CreateFromAscii( list[ index ] ).ToLowerAscii() ] = true;
-+ }
-+ }
-+public:
-+ bool isBlackListed( const String& sName )
-+ {
-+ String sNameLower( sName );
-+ sNameLower.ToLowerAscii();
-+ return ( mBlackList.find( sNameLower ) != mBlackList.end() );
-+ }
-+};
-+
-+class VBABlackListQuery
-+{
-+public:
-+ static bool isBlackListed( const String& sName )
-+ {
-+ static VBABlacklist blackList;
-+ return blackList.isBlackListed( sName );
-+ }
-+};
- static Methods aMethods[] = {
-
- { "AboutStarBasic", SbxNULL, 1 | _FUNCTION, RTLNAME(AboutStarBasic),0 },
-@@ -171,7 +210,12 @@ static Methods aMethods[] = {
- { "expression", SbxVARIANT, 0,NULL,0 },
- { "CVErr", SbxVARIANT, 1 | _FUNCTION, RTLNAME(CVErr),0 },
- { "expression", SbxVARIANT, 0,NULL,0 },
--
-+{ "DDB", SbxDOUBLE, 5 | _FUNCTION | _COMPTMASK, RTLNAME(DDB),0 },
-+ { "Cost", SbxDOUBLE, 0, NULL,0 },
-+ { "Salvage", SbxDOUBLE, 0, NULL,0 },
-+ { "Life", SbxDOUBLE, 0, NULL,0 },
-+ { "Period", SbxDOUBLE, 0, NULL,0 },
-+ { "Factor", SbxVARIANT, _OPT, NULL,0 },
- { "Date", SbxDATE, _LFUNCTION,RTLNAME(Date),0 },
- { "DateAdd", SbxDATE, 3 | _FUNCTION, RTLNAME(DateAdd),0 },
- { "Interval", SbxSTRING, 0,NULL,0 },
-@@ -271,6 +315,12 @@ static Methods aMethods[] = {
- { "FreeLibrary", SbxNULL, 1 | _FUNCTION, RTLNAME(FreeLibrary),0 },
- { "Modulename", SbxSTRING, 0,NULL,0 },
-
-+{ "FV", SbxDOUBLE, 5 | _FUNCTION | _COMPTMASK, RTLNAME(FV),0 },
-+ { "Rate", SbxDOUBLE, 0, NULL,0 },
-+ { "NPer", SbxDOUBLE, 0, NULL,0 },
-+ { "Pmt", SbxDOUBLE, 0, NULL,0 },
-+ { "PV", SbxVARIANT, _OPT, NULL,0 },
-+ { "Due", SbxVARIANT, _OPT, NULL,0 },
- { "Get", SbxNULL, 3 | _FUNCTION, RTLNAME(Get),0 },
- { "filenumber", SbxINTEGER, 0,NULL,0 },
- { "recordnumber", SbxLONG, 0,NULL,0 },
-@@ -331,6 +381,16 @@ static Methods aMethods[] = {
- { "Compare", SbxINTEGER, _OPT, NULL,0 },
- { "Int", SbxDOUBLE, 1 | _FUNCTION, RTLNAME(Int),0 },
- { "number", SbxDOUBLE, 0,NULL,0 },
-+{ "IPmt", SbxDOUBLE, 6 | _FUNCTION | _COMPTMASK, RTLNAME(IPmt),0 },
-+ { "Rate", SbxDOUBLE, 0, NULL,0 },
-+ { "Per", SbxDOUBLE, 0, NULL,0 },
-+ { "NPer", SbxDOUBLE, 0, NULL,0 },
-+ { "PV", SbxDOUBLE, 0, NULL,0 },
-+ { "FV", SbxVARIANT, _OPT, NULL,0 },
-+ { "Due", SbxVARIANT, _OPT, NULL,0 },
-+{ "IRR", SbxDOUBLE, 2 | _FUNCTION | _COMPTMASK, RTLNAME(IRR),0 },
-+ { "ValueArray", SbxARRAY, 0, NULL,0 },
-+ { "Guess", SbxVARIANT, _OPT, NULL,0 },
- { "IsArray", SbxBOOL, 1 | _FUNCTION, RTLNAME(IsArray),0 },
- { "Variant", SbxVARIANT, 0,NULL,0 },
- { "IsDate", SbxBOOL, 1 | _FUNCTION, RTLNAME(IsDate),0 },
-@@ -401,6 +461,10 @@ static Methods aMethods[] = {
- { "Length", SbxLONG, _OPT, NULL,0 },
- { "Minute", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Minute),0 },
- { "Date", SbxDATE, 0,NULL,0 },
-+{ "MIRR", SbxDOUBLE, 2 | _FUNCTION | _COMPTMASK, RTLNAME(MIRR),0 },
-+ { "ValueArray", SbxARRAY, 0, NULL,0 },
-+ { "FinanceRate", SbxDOUBLE, 0, NULL,0 },
-+ { "ReinvestRate", SbxDOUBLE, 0, NULL,0 },
- { "MkDir", SbxNULL, 1 | _FUNCTION, RTLNAME(MkDir),0 },
- { "pathname", SbxSTRING, 0,NULL,0 },
- { "Month", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Month),0 },
-@@ -417,6 +481,15 @@ static Methods aMethods[] = {
-
- { "Nothing", SbxOBJECT, _CPROP, RTLNAME(Nothing),0 },
- { "Now", SbxDATE, _FUNCTION, RTLNAME(Now),0 },
-+{ "NPer", SbxDOUBLE, 5 | _FUNCTION | _COMPTMASK, RTLNAME(NPer),0 },
-+ { "Rate", SbxDOUBLE, 0, NULL,0 },
-+ { "Pmt", SbxDOUBLE, 0, NULL,0 },
-+ { "PV", SbxDOUBLE, 0, NULL,0 },
-+ { "FV", SbxVARIANT, _OPT, NULL,0 },
-+ { "Due", SbxVARIANT, _OPT, NULL,0 },
-+{ "NPV", SbxDOUBLE, 2 | _FUNCTION | _COMPTMASK, RTLNAME(NPV),0 },
-+ { "Rate", SbxDOUBLE, 0, NULL,0 },
-+ { "ValueArray", SbxARRAY, 0, NULL,0 },
- { "Null", SbxNULL, _CPROP, RTLNAME(Null),0 },
-
- { "Oct", SbxSTRING, 1 | _FUNCTION, RTLNAME(Oct),0 },
-@@ -428,16 +501,46 @@ static Methods aMethods[] = {
- { "stop", SbxLONG, 0,NULL,0 },
- { "interval", SbxLONG, 0,NULL,0 },
- { "Pi", SbxDOUBLE, _CPROP, RTLNAME(PI),0 },
-+
-+{ "Pmt", SbxDOUBLE, 5 | _FUNCTION | _COMPTMASK, RTLNAME(Pmt),0 },
-+ { "Rate", SbxDOUBLE, 0, NULL,0 },
-+ { "NPer", SbxDOUBLE, 0, NULL,0 },
-+ { "PV", SbxDOUBLE, 0, NULL,0 },
-+ { "FV", SbxVARIANT, _OPT, NULL,0 },
-+ { "Due", SbxVARIANT, _OPT, NULL,0 },
-+
-+{ "PPmt", SbxDOUBLE, 6 | _FUNCTION | _COMPTMASK, RTLNAME(PPmt),0 },
-+ { "Rate", SbxDOUBLE, 0, NULL,0 },
-+ { "Per", SbxDOUBLE, 0, NULL,0 },
-+ { "NPer", SbxDOUBLE, 0, NULL,0 },
-+ { "PV", SbxDOUBLE, 0, NULL,0 },
-+ { "FV", SbxVARIANT, _OPT, NULL,0 },
-+ { "Due", SbxVARIANT, _OPT, NULL,0 },
-+
- { "Put", SbxNULL, 3 | _FUNCTION, RTLNAME(Put),0 },
- { "filenumber", SbxINTEGER, 0,NULL,0 },
- { "recordnumber", SbxLONG, 0,NULL,0 },
- { "variablename", SbxVARIANT, 0,NULL,0 },
-
-+{ "PV", SbxDOUBLE, 5 | _FUNCTION | _COMPTMASK, RTLNAME(PV),0 },
-+ { "Rate", SbxDOUBLE, 0, NULL,0 },
-+ { "NPer", SbxDOUBLE, 0, NULL,0 },
-+ { "Pmt", SbxDOUBLE, 0, NULL,0 },
-+ { "FV", SbxVARIANT, _OPT, NULL,0 },
-+ { "Due", SbxVARIANT, _OPT, NULL,0 },
-+
- { "QBColor", SbxLONG, 1 | _FUNCTION, RTLNAME(QBColor),0 },
- { "number", SbxINTEGER, 0,NULL,0 },
-
- { "Randomize", SbxNULL, 1 | _FUNCTION, RTLNAME(Randomize),0 },
- { "Number", SbxDOUBLE, _OPT, NULL,0 },
-+{ "Rate", SbxDOUBLE, 6 | _FUNCTION | _COMPTMASK, RTLNAME(Rate),0 },
-+ { "NPer", SbxDOUBLE, 0, NULL,0 },
-+ { "Pmt", SbxDOUBLE, 0, NULL,0 },
-+ { "PV", SbxDOUBLE, 0, NULL,0 },
-+ { "FV", SbxVARIANT, _OPT, NULL,0 },
-+ { "Due", SbxVARIANT, _OPT, NULL,0 },
-+ { "Guess", SbxVARIANT, _OPT, NULL,0 },
- { "Red", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Red),0 },
- { "RGB-Value", SbxLONG, 0,NULL,0 },
- { "Reset", SbxNULL, 0 | _FUNCTION, RTLNAME(Reset),0 },
-@@ -491,6 +594,15 @@ static Methods aMethods[] = {
- { "WindowStyle", SbxINTEGER, _OPT, NULL,0 },
- { "Sin", SbxDOUBLE, 1 | _FUNCTION, RTLNAME(Sin),0 },
- { "number", SbxDOUBLE, 0,NULL,0 },
-+{ "SLN", SbxDOUBLE, 2 | _FUNCTION | _COMPTMASK, RTLNAME(SLN),0 },
-+ { "Cost", SbxDOUBLE, 0,NULL,0 },
-+ { "Double", SbxDOUBLE, 0,NULL,0 },
-+ { "Life", SbxDOUBLE, 0,NULL,0 },
-+{ "SYD", SbxDOUBLE, 2 | _FUNCTION | _COMPTMASK, RTLNAME(SYD),0 },
-+ { "Cost", SbxDOUBLE, 0,NULL,0 },
-+ { "Salvage", SbxDOUBLE, 0,NULL,0 },
-+ { "Life", SbxDOUBLE, 0,NULL,0 },
-+ { "Period", SbxDOUBLE, 0,NULL,0 },
- { "Space", SbxSTRING, 1 | _FUNCTION, RTLNAME(Space),0 },
- { "string", SbxLONG, 0,NULL,0 },
- { "Spc", SbxSTRING, 1 | _FUNCTION, RTLNAME(Spc),0 },
-@@ -605,6 +717,7 @@ static Methods aMethods[] = {
-
- { "Wait", SbxNULL, 1 | _FUNCTION, RTLNAME(Wait),0 },
- { "Milliseconds", SbxLONG, 0,NULL,0 },
-+{ "FuncCaller", SbxVARIANT, _FUNCTION, RTLNAME(FuncCaller),0 },
- //#i64882#
- { "WaitUntil", SbxNULL, 1 | _FUNCTION, RTLNAME(WaitUntil),0 },
- { "Date", SbxDOUBLE, 0,NULL,0 },
-@@ -683,13 +796,15 @@ SbxVariable* SbiStdObject::Find( const String& rName, SbxClassType t )
- && ( p->nHash == nHash_ )
- && ( rName.EqualsIgnoreCaseAscii( p->pName ) ) )
- {
-+ SbiInstance* pInst = pINST;
- bFound = TRUE;
- if( p->nArgs & _COMPTMASK )
- {
-- SbiInstance* pInst = pINST;
- if( !pInst || !pInst->IsCompatibility() )
- bFound = FALSE;
- }
-+ if ( pInst && pInst->IsCompatibility() && VBABlackListQuery::isBlackListed( rName ) )
-+ bFound = FALSE;
- break;
- }
- nIndex += ( p->nArgs & _ARGSMASK ) + 1;
-diff --git basic/source/runtime/step0.cxx basic/source/runtime/step0.cxx
-index 112c88b..979013d 100644
---- basic/source/runtime/step0.cxx
-+++ basic/source/runtime/step0.cxx
-@@ -48,6 +48,11 @@ Reference< XInterface > createComListener( const Any& aControlAny, const ::rtl::
-
- #include <algorithm>
-
-+// for a patch forward declaring these methods below makes sense
-+// but, #FIXME lets really just move the methods to the top
-+void lcl_clearImpl( SbxVariableRef& refVar, SbxDataType& eType );
-+void lcl_eraseImpl( SbxVariableRef& refVar, bool bVBAEnabled );
-+
- SbxVariable* getDefaultProp( SbxVariable* pRef );
-
- void SbiRuntime::StepNOP()
-@@ -59,34 +64,6 @@ void SbiRuntime::StepArith( SbxOperator eOp )
- TOSMakeTemp();
- SbxVariable* p2 = GetTOS();
-
--
-- // This could & should be moved to the MakeTempTOS() method in runtime.cxx
-- // In the code which this is cut'npaste from there is a check for a ref
-- // count != 1 based on which the copy of the SbxVariable is done.
-- // see orig code in MakeTempTOS ( and I'm not sure what the significance,
-- // of that is )
-- // here we alway seem to have a refcount of 1. Also it seems that
-- // MakeTempTOS is called for other operation, so I hold off for now
-- // until I have a better idea
-- if ( bVBAEnabled
-- && ( p2->GetType() == SbxOBJECT || p2->GetType() == SbxVARIANT )
-- )
-- {
-- SbxVariable* pDflt = getDefaultProp( p2 );
-- if ( pDflt )
-- {
-- pDflt->Broadcast( SBX_HINT_DATAWANTED );
-- // replacing new p2 on stack causes object pointed by
-- // pDft->pParent to be deleted, when p2->Compute() is
-- // called below pParent is accessed ( but its deleted )
-- // so set it to NULL now
-- pDflt->SetParent( NULL );
-- p2 = new SbxVariable( *pDflt );
-- p2->SetFlag( SBX_READWRITE );
-- refExprStk->Put( p2, nExprLvl - 1 );
-- }
-- }
--
- p2->ResetFlag( SBX_FIXED );
- p2->Compute( eOp, *p1 );
-
-@@ -109,19 +86,24 @@ void SbiRuntime::StepCompare( SbxOperator eOp )
- // values ( and type ) set as appropriate
- SbxDataType p1Type = p1->GetType();
- SbxDataType p2Type = p2->GetType();
-+ if ( p1Type == SbxEMPTY )
-+ {
-+ p1->Broadcast( SBX_HINT_DATAWANTED );
-+ p1Type = p1->GetType();
-+ }
-+ if ( p2Type == SbxEMPTY )
-+ {
-+ p2->Broadcast( SBX_HINT_DATAWANTED );
-+ p2Type = p2->GetType();
-+ }
- if ( p1Type == p2Type )
- {
-- if ( p1Type == SbxEMPTY )
-- {
-- p1->Broadcast( SBX_HINT_DATAWANTED );
-- p2->Broadcast( SBX_HINT_DATAWANTED );
-- }
- // if both sides are an object and have default props
- // then we need to use the default props
- // we don't need to worry if only one side ( lhs, rhs ) is an
- // object ( object side will get coerced to correct type in
- // Compare )
-- else if ( p1Type == SbxOBJECT )
-+ if ( p1Type == SbxOBJECT )
- {
- SbxVariable* pDflt = getDefaultProp( p1 );
- if ( pDflt )
-@@ -141,8 +123,21 @@ void SbiRuntime::StepCompare( SbxOperator eOp )
- #ifndef WIN
- static SbxVariable* pTRUE = NULL;
- static SbxVariable* pFALSE = NULL;
--
-- if( p2->Compare( eOp, *p1 ) )
-+ static SbxVariable* pNULL = NULL;
-+ // why do this on non-windows ?
-+ // why do this at all ?
-+ // I dumbly follow the pattern :-/
-+ if ( bVBAEnabled && ( p1->IsNull() || p2->IsNull() ) )
-+ {
-+ if( !pNULL )
-+ {
-+ pNULL = new SbxVariable;
-+ pNULL->PutNull();
-+ pNULL->AddRef();
-+ }
-+ PushVar( pNULL );
-+ }
-+ else if( p2->Compare( eOp, *p1 ) )
- {
- if( !pTRUE )
- {
-@@ -163,9 +158,14 @@ void SbiRuntime::StepCompare( SbxOperator eOp )
- PushVar( pFALSE );
- }
- #else
-- BOOL bRes = p2->Compare( eOp, *p1 );
- SbxVariable* pRes = new SbxVariable;
-- pRes->PutBool( bRes );
-+ if ( bVBAEnabled && ( p1->IsNull() || p2->IsNull() ) )
-+ pRes->PutNull();
-+ else
-+ {
-+ BOOL bRes = p2->Compare( eOp, *p1 );
-+ pRes->PutBool( bRes );
-+ }
- PushVar( pRes );
- #endif
- }
-@@ -680,6 +680,17 @@ void SbiRuntime::StepDIM()
- // #56204 DIM-Funktionalitaet in Hilfsmethode auslagern (step0.cxx)
- void SbiRuntime::DimImpl( SbxVariableRef refVar )
- {
-+ // If refDim then this DIM statement is terminating a ReDIM and
-+ // previous StepERASE_CLEAR for an array, the following actions have
-+ // been delayed from ( StepERASE_CLEAR ) 'till here
-+ if ( refRedim )
-+ {
-+ if ( !refRedimpArray ) // only erase the array not ReDim Preserve
-+ lcl_eraseImpl( refVar, bVBAEnabled );
-+ SbxDataType eType = refVar->GetType();
-+ lcl_clearImpl( refVar, eType );
-+ refRedim = NULL;
-+ }
- SbxArray* pDims = refVar->GetParameters();
- // Muss eine gerade Anzahl Argumente haben
- // Man denke daran, dass Arg[0] nicht zaehlt!
-@@ -845,6 +856,7 @@ void SbiRuntime::StepREDIMP()
- void SbiRuntime::StepREDIMP_ERASE()
- {
- SbxVariableRef refVar = PopVar();
-+ refRedim = refVar;
- SbxDataType eType = refVar->GetType();
- if( eType & SbxARRAY )
- {
-@@ -855,12 +867,6 @@ void SbiRuntime::StepREDIMP_ERASE()
- refRedimpArray = pDimArray;
- }
-
-- // As in ERASE
-- USHORT nSavFlags = refVar->GetFlags();
-- refVar->ResetFlag( SBX_FIXED );
-- refVar->SetType( SbxDataType(eType & 0x0FFF) );
-- refVar->SetFlags( nSavFlags );
-- refVar->Clear();
- }
- else
- if( refVar->IsFixed() )
-@@ -933,10 +939,7 @@ void SbiRuntime::StepERASE()
-
- void SbiRuntime::StepERASE_CLEAR()
- {
-- SbxVariableRef refVar = PopVar();
-- lcl_eraseImpl( refVar, bVBAEnabled );
-- SbxDataType eType = refVar->GetType();
-- lcl_clearImpl( refVar, eType );
-+ refRedim = PopVar();
- }
-
- void SbiRuntime::StepARRAYACCESS()
-diff --git basic/source/runtime/step1.cxx basic/source/runtime/step1.cxx
-index f448f79..0e564f0 100644
---- basic/source/runtime/step1.cxx
-+++ basic/source/runtime/step1.cxx
-@@ -93,6 +93,15 @@ void SbiRuntime::StepARGN( UINT32 nOp1 )
- {
- String aAlias( pImg->GetString( static_cast<short>( nOp1 ) ) );
- SbxVariableRef pVal = PopVar();
-+ if( bVBAEnabled && ( pVal->ISA(SbxMethod) || pVal->ISA(SbUnoProperty) || pVal->ISA(SbProcedureProperty) ) )
-+ {
-+ // named variables ( that are Any especially properties ) can be empty at this point and need a broadcast
-+ if ( pVal->GetType() == SbxEMPTY )
-+ pVal->Broadcast( SBX_HINT_DATAWANTED );
-+ // Methoden und Properties evaluieren!
-+ SbxVariable* pRes = new SbxVariable( *pVal );
-+ pVal = pRes;
-+ }
- refArgv->Put( pVal, nArgc );
- refArgv->PutAlias( aAlias, nArgc++ );
- }
-@@ -182,7 +191,9 @@ void SbiRuntime::StepJUMPT( UINT32 nOp1 )
- void SbiRuntime::StepJUMPF( UINT32 nOp1 )
- {
- SbxVariableRef p = PopVar();
-- if( !p->GetBool() )
-+ // In a test e.g. If Null then
-+ // will evaluate Null will act as if False
-+ if( ( bVBAEnabled && p->IsNull() ) || !p->GetBool() )
- StepJUMP( nOp1 );
- }
-
-diff --git basic/source/runtime/step2.cxx basic/source/runtime/step2.cxx
-index 995c425..68bef06 100755
---- basic/source/runtime/step2.cxx
-+++ basic/source/runtime/step2.cxx
-@@ -141,7 +141,7 @@ SbxVariable* SbiRuntime::FindElement
- if ( pElem )
- bSetName = false; // don't overwrite uno name
- else
-- pElem = getVBAConstant( aName );
-+ pElem = VBAConstantHelper::instance().getVBAConstant( aName );
- }
- // #72382 VORSICHT! Liefert jetzt wegen unbekannten
- // Modulen IMMER ein Ergebnis!
-@@ -457,7 +457,7 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
- {
- // Falls wir ein Array haben, wollen wir bitte das Array-Element!
- SbxArray* pPar;
-- if( pElem->GetType() & SbxARRAY )
-+ if( ( pElem->GetType() & SbxARRAY ) && (SbxVariable*)refRedim != pElem )
- {
- SbxBase* pElemObj = pElem->GetObject();
- SbxDimArray* pDimArray = PTR_CAST(SbxDimArray,pElemObj);
-@@ -489,7 +489,7 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
- pPar->Put( NULL, 0 );
- }
- // Index-Access bei UnoObjekten beruecksichtigen
-- else if( pElem->GetType() == SbxOBJECT && !pElem->ISA(SbxMethod) )
-+ else if( pElem->GetType() == SbxOBJECT && !pElem->ISA(SbxMethod) && !pElem->ISA(SbxProperty) )
- {
- pPar = pElem->GetParameters();
- if ( pPar )
-@@ -733,6 +733,8 @@ void SbiRuntime::StepPARAM( UINT32 nOp1, UINT32 nOp2 )
- SaveRef( q );
- *q = *p;
- p = q;
-+ if ( i )
-+ refParams->Put( p, i );
- }
- SetupArgs( p, nOp1 );
- PushVar( CheckArray( p ) );
-diff --git basic/source/sbx/sbxvalue.cxx basic/source/sbx/sbxvalue.cxx
-index 34ca872..f535925 100644
---- basic/source/sbx/sbxvalue.cxx
-+++ basic/source/sbx/sbxvalue.cxx
-@@ -1144,8 +1144,8 @@ BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
- {
- SbxValues aL, aR;
- bool bDecimal = false;
-- if( bVBAInterop && ( ( eThisType == SbxSTRING && eOpType != SbxSTRING ) ||
-- ( eThisType != SbxSTRING && eOpType == SbxSTRING ) ) &&
-+ if( bVBAInterop && ( ( eThisType == SbxSTRING && eOpType != SbxSTRING && eOpType != SbxEMPTY ) ||
-+ ( eThisType != SbxSTRING && eThisType != SbxEMPTY && eOpType == SbxSTRING ) ) &&
- ( eOp == SbxMUL || eOp == SbxDIV || eOp == SbxPLUS || eOp == SbxMINUS ) )
- {
- goto Lbl_OpIsDouble;
-@@ -1192,6 +1192,8 @@ BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
- aL.eType = aR.eType = GetType();
- // else if( GetType() == SbxDouble || GetType() == SbxSingle )
- // aL.eType = aR.eType = SbxLONG64;
-+ else if ( bVBAInterop && eOpType == SbxBOOL )
-+ aL.eType = aR.eType = SbxBOOL;
- else
- aL.eType = aR.eType = SbxLONG;
- }
-@@ -1278,7 +1280,12 @@ BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
- break;
- case SbxNOT:
- if( aL.eType != SbxLONG && aL.eType != SbxULONG )
-- aL.nLong64 = ~aL.nLong64;
-+ {
-+ if ( aL.eType != SbxBOOL )
-+ aL.nLong64 = ~aL.nLong64;
-+ else
-+ aL.nLong = ~aL.nLong;
-+ }
- else
- aL.nLong = ~aL.nLong;
- break;
-diff --git basic/source/uno/dlgcont.cxx basic/source/uno/dlgcont.cxx
-index aee3d18..e0611ab 100644
---- basic/source/uno/dlgcont.cxx
-+++ basic/source/uno/dlgcont.cxx
-@@ -321,8 +321,8 @@ Any SAL_CALL SfxDialogLibraryContainer::importLibraryElement
- source.sSystemId = aFile;
-
- try {
-- // start parsing
-- xParser->setDocumentHandler( ::xmlscript::importDialogModel( xDialogModel, xContext ) );
-+ // start parsing
-+ xParser->setDocumentHandler( ::xmlscript::importDialogModel( xDialogModel, xContext, mxOwnerDocument ) );
- xParser->parseStream( source );
- }
- catch( Exception& )
-@@ -336,7 +336,7 @@ Any SAL_CALL SfxDialogLibraryContainer::importLibraryElement
-
- // Create InputStream, TODO: Implement own InputStreamProvider
- // to avoid creating the DialogModel here!
-- Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext );
-+ Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, mxOwnerDocument );
- aRetAny <<= xISP;
- return aRetAny;
- }
-@@ -484,7 +484,11 @@ void SfxDialogLibraryContainer::onNewRootStorage()
- }
- }
-
--
-+sal_Bool SAL_CALL
-+SfxDialogLibraryContainer:: HasExecutableCode( const ::rtl::OUString& Library ) throw (uno::RuntimeException)
-+{
-+ return sal_False; // dialog library has no executable code
-+}
- //============================================================================
- // Service
-
-diff --git basic/source/uno/scriptcont.cxx basic/source/uno/scriptcont.cxx
-index e10d111..38eefcf 100644
---- basic/source/uno/scriptcont.cxx
-+++ basic/source/uno/scriptcont.cxx
-@@ -66,7 +66,8 @@
- #include <xmlscript/xmlmod_imexp.hxx>
- #include <cppuhelper/factory.hxx>
- #include <com/sun/star/util/VetoException.hpp>
--
-+#include <com/sun/star/script/XLibraryQueryExecutable.hpp>
-+#include <cppuhelper/implbase1.hxx>
- namespace basic
- {
-
-@@ -137,7 +138,6 @@ sal_Bool SfxScriptLibraryContainer::hasLibraryPassword( const String& rLibraryNa
- return pImplLib->mbPasswordProtected;
- }
-
--
- // Ctor for service
- SfxScriptLibraryContainer::SfxScriptLibraryContainer( void )
- :maScriptLanguage( RTL_CONSTASCII_USTRINGPARAM( "StarBasic" ) )
-@@ -1165,6 +1165,17 @@ void SfxScriptLibraryContainer::onNewRootStorage()
- {
- }
-
-+sal_Bool SAL_CALL
-+SfxScriptLibraryContainer:: HasExecutableCode( const ::rtl::OUString& Library ) throw (uno::RuntimeException)
-+{
-+ BasicManager* pBasicMgr = getBasicManager();
-+ OSL_ENSURE( pBasicMgr, "we need a basicmanager, really we do" );
-+ if ( pBasicMgr )
-+ return pBasicMgr->HasExeCode( Library ); // need to change this to take name
-+ // default to it has code if we can't decide
-+ return sal_True;
-+}
-+
- //============================================================================
- // Service
- void createRegistryInfo_SfxScriptLibraryContainer()
-diff --git cui/source/customize/cfg.cxx cui/source/customize/cfg.cxx
-index 211deef..b4a8c88 100644
---- cui/source/customize/cfg.cxx
-+++ cui/source/customize/cfg.cxx
-@@ -5718,7 +5718,7 @@ bool SvxIconSelectorDialog::ReplaceGraphicItem(
- if ( bOK && ((aSize.Width != m_nExpectedSize) || (aSize.Height != m_nExpectedSize)) )
- {
- BitmapEx aBitmap = aImage.GetBitmapEx();
-- BitmapEx aBitmapex = AutoScaleBitmap(aBitmap, m_nExpectedSize);
-+ BitmapEx aBitmapex = BitmapEx::AutoScaleBitmap(aBitmap, m_nExpectedSize);
- aImage = Image( aBitmapex);
- }
- aTbSymbol.InsertItem( nId,aImage, aURL, 0, 0 ); //modify
-@@ -5882,7 +5882,7 @@ bool SvxIconSelectorDialog::ImportGraphic( const OUString& aURL )
- if ( bOK && ((aSize.Width != m_nExpectedSize) || (aSize.Height != m_nExpectedSize)) )
- {
- BitmapEx aBitmap = aImage.GetBitmapEx();
-- BitmapEx aBitmapex = AutoScaleBitmap(aBitmap, m_nExpectedSize);
-+ BitmapEx aBitmapex = BitmapEx::AutoScaleBitmap(aBitmap, m_nExpectedSize);
- aImage = Image( aBitmapex);
- }
- if ( bOK && !!aImage )
-diff --git cui/source/options/optfltr.cxx cui/source/options/optfltr.cxx
-index 51034c9..229ee76 100644
---- cui/source/options/optfltr.cxx
-+++ cui/source/options/optfltr.cxx
-@@ -54,6 +54,7 @@ OfaMSFilterTabPage::OfaMSFilterTabPage(Window* pParent, const SfxItemSet& rSet)
- : SfxTabPage( pParent, CUI_RES( RID_OFAPAGE_MSFILTEROPT ), rSet ),
- aMSWordGB ( this, CUI_RES( GB_WORD ) ),
- aWBasicCodeCB ( this, CUI_RES( CB_WBAS_CODE ) ),
-+ aWBasicWbctblCB ( this, CUI_RES( CB_WBAS_WBCTBL ) ),
- aWBasicStgCB ( this, CUI_RES( CB_WBAS_STG ) ),
- aMSExcelGB ( this, CUI_RES( GB_EXCEL ) ),
- aEBasicCodeCB ( this, CUI_RES( CB_EBAS_CODE ) ),
-@@ -65,6 +66,7 @@ OfaMSFilterTabPage::OfaMSFilterTabPage(Window* pParent, const SfxItemSet& rSet)
- {
- FreeResource();
-
-+ aWBasicCodeCB.SetClickHdl( LINK( this, OfaMSFilterTabPage, LoadWordBasicCheckHdl_Impl ) );
- aEBasicCodeCB.SetClickHdl( LINK( this, OfaMSFilterTabPage, LoadExcelBasicCheckHdl_Impl ) );
- }
-
-@@ -72,6 +74,12 @@ OfaMSFilterTabPage::~OfaMSFilterTabPage()
- {
- }
-
-+IMPL_LINK( OfaMSFilterTabPage, LoadWordBasicCheckHdl_Impl, CheckBox*, EMPTYARG )
-+{
-+ aWBasicWbctblCB.Enable( aWBasicCodeCB.IsChecked() );
-+ return 0;
-+}
-+
- IMPL_LINK( OfaMSFilterTabPage, LoadExcelBasicCheckHdl_Impl, CheckBox*, EMPTYARG )
- {
- aEBasicExectblCB.Enable( aEBasicCodeCB.IsChecked() );
-@@ -91,6 +99,8 @@ BOOL OfaMSFilterTabPage::FillItemSet( SfxItemSet& )
- BOOL bFlag;
- if( aWBasicCodeCB.GetSavedValue() != (bFlag = aWBasicCodeCB.IsChecked()))
- pOpt->SetLoadWordBasicCode( bFlag );
-+ if( aWBasicWbctblCB.GetSavedValue() != (bFlag = aWBasicWbctblCB.IsChecked()))
-+ pOpt->SetLoadWordBasicExecutable( bFlag );
- if( aWBasicStgCB.GetSavedValue() != (bFlag = aWBasicStgCB.IsChecked()))
- pOpt->SetLoadWordBasicStorage( bFlag );
-
-@@ -119,8 +129,11 @@ void OfaMSFilterTabPage::Reset( const SfxItemSet& )
-
- aWBasicCodeCB.Check( pOpt->IsLoadWordBasicCode() );
- aWBasicCodeCB.SaveValue();
-+ aWBasicWbctblCB.Check( pOpt->IsLoadWordBasicExecutable() );
-+ aWBasicWbctblCB.SaveValue();
- aWBasicStgCB.Check( pOpt->IsLoadWordBasicStorage() );
- aWBasicStgCB.SaveValue();
-+ LoadWordBasicCheckHdl_Impl( &aWBasicCodeCB );
-
- aEBasicCodeCB.Check( pOpt->IsLoadExcelBasicCode() );
- aEBasicCodeCB.SaveValue();
-diff --git cui/source/options/optfltr.hrc cui/source/options/optfltr.hrc
-index 5938604..40204b7 100644
---- cui/source/options/optfltr.hrc
-+++ cui/source/options/optfltr.hrc
-@@ -40,6 +40,7 @@
- #define CB_EBAS_STG 5
- #define CB_PBAS_CODE 6
- #define CB_PBAS_STG 7
-+#define CB_WBAS_WBCTBL 8
-
- #define CLB_SETTINGS 1
- #define ST_CHG_MATH 1
-diff --git cui/source/options/optfltr.hxx cui/source/options/optfltr.hxx
-index 8014281..0fb4aee 100644
---- cui/source/options/optfltr.hxx
-+++ cui/source/options/optfltr.hxx
-@@ -43,6 +43,7 @@ class OfaMSFilterTabPage : public SfxTabPage
- {
- FixedLine aMSWordGB;
- CheckBox aWBasicCodeCB;
-+ CheckBox aWBasicWbctblCB;
- CheckBox aWBasicStgCB;
- FixedLine aMSExcelGB;
- CheckBox aEBasicCodeCB;
-@@ -55,6 +56,7 @@ class OfaMSFilterTabPage : public SfxTabPage
- OfaMSFilterTabPage( Window* pParent, const SfxItemSet& rSet );
- virtual ~OfaMSFilterTabPage();
-
-+ DECL_LINK( LoadWordBasicCheckHdl_Impl, CheckBox* );
- DECL_LINK( LoadExcelBasicCheckHdl_Impl, CheckBox* );
- public:
-
-diff --git cui/source/options/optfltr.src cui/source/options/optfltr.src
-index e24da54..d9ff1c8 100644
---- cui/source/options/optfltr.src
-+++ cui/source/options/optfltr.src
-@@ -51,9 +51,16 @@ TabPage RID_OFAPAGE_MSFILTEROPT
- TabStop = TRUE ;
- Text [ en-US ] = "Load Basic ~code";
- };
-+ CheckBox CB_WBAS_WBCTBL
-+ {
-+ Pos = MAP_APPFONT ( 22 , 28 ) ;
-+ Size = MAP_APPFONT ( 236 , 10 ) ;
-+ TabStop = TRUE ;
-+ Text [ en-US ] = "E~xecutable code";
-+ };
- CheckBox CB_WBAS_STG
- {
-- Pos = MAP_APPFONT ( 12 , 28 ) ;
-+ Pos = MAP_APPFONT ( 12 , 42 ) ;
- Size = MAP_APPFONT ( 236 , 10 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "Save ~original Basic code";
-@@ -61,27 +68,27 @@ TabPage RID_OFAPAGE_MSFILTEROPT
-
- FixedLine GB_EXCEL
- {
-- Pos = MAP_APPFONT ( 6 , 44 ) ;
-+ Pos = MAP_APPFONT ( 6 , 58 ) ;
- Size = MAP_APPFONT ( 248 , 8 ) ;
- Text [ en-US ] = "Microsoft Excel 97/2000/XP";
- };
- CheckBox CB_EBAS_CODE
- {
-- Pos = MAP_APPFONT ( 12 , 55 ) ;
-+ Pos = MAP_APPFONT ( 12 , 69 ) ;
- Size = MAP_APPFONT ( 236 , 10 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "Lo~ad Basic code";
- };
- CheckBox CB_EBAS_EXECTBL
- {
-- Pos = MAP_APPFONT ( 22 , 69 ) ;
-+ Pos = MAP_APPFONT ( 22 , 83 ) ;
- Size = MAP_APPFONT ( 236 , 10 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "E~xecutable code";
- };
- CheckBox CB_EBAS_STG
- {
-- Pos = MAP_APPFONT ( 12 , 83 ) ;
-+ Pos = MAP_APPFONT ( 12 , 97 ) ;
- Size = MAP_APPFONT ( 236 , 10 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "Sa~ve original Basic code";
-diff --git dbaccess/source/ext/macromigration/migrationengine.cxx dbaccess/source/ext/macromigration/migrationengine.cxx
-index 9e6781d..b54c3be 100644
---- dbaccess/source/ext/macromigration/migrationengine.cxx
-+++ dbaccess/source/ext/macromigration/migrationengine.cxx
-@@ -1835,7 +1835,7 @@ namespace dbmm
- Reference< XInputStream > xInput( xISP->createInputStream(), UNO_QUERY_THROW );
-
- Reference< XNameContainer > xDialogModel( m_aContext.createComponent( "com.sun.star.awt.UnoControlDialogModel" ), UNO_QUERY_THROW );
-- ::xmlscript::importDialogModel( xInput, xDialogModel, m_aContext.getUNOContext() );
-+ ::xmlscript::importDialogModel( xInput, xDialogModel, m_aContext.getUNOContext(), m_xDocumentModel );
-
- // adjust the events of the dialog
- impl_adjustDialogElementEvents_throw( xDialogModel );
-@@ -1850,7 +1850,7 @@ namespace dbmm
- }
-
- // export dialog model
-- xISP = ::xmlscript::exportDialogModel( xDialogModel, m_aContext.getUNOContext() );
-+ xISP = ::xmlscript::exportDialogModel( xDialogModel, m_aContext.getUNOContext(), m_xDocumentModel );
- _inout_rDialogLibraryElement <<= xISP;
- }
- catch( const Exception& )
-diff --git extensions/inc/propctrlr.hrc extensions/inc/propctrlr.hrc
-index a559b30..ab11bf4 100644
---- extensions/inc/propctrlr.hrc
-+++ extensions/inc/propctrlr.hrc
-@@ -326,9 +326,10 @@
- #define HID_FM_PROPDLG_TAB_GENERAL ( HID_PROPC_START + 294)
- #define HID_FM_PROPDLG_TAB_DATA ( HID_PROPC_START + 295)
- #define HID_FM_PROPDLG_TAB_EVT ( HID_PROPC_START + 296)
-+#define HID_PROP_GROUP_NAME ( HID_PROPC_START + 297)
- // please adjust HID_LAST_PROPC_ID if you add new ids here!
-
--#define HID_LAST_PROPC_ID HID_FM_PROPDLG_TAB_EVT
-+#define HID_LAST_PROPC_ID HID_PROP_GROUP_NAME
-
- #if HID_LAST_PROPC_ID > HID_PROPC_END
- #error help id overflow (PROPC)
-diff --git extensions/source/ole/oleobjw.cxx extensions/source/ole/oleobjw.cxx
-index 7a73ed7..aca6e53 100755
---- extensions/source/ole/oleobjw.cxx
-+++ extensions/source/ole/oleobjw.cxx
-@@ -49,6 +49,7 @@
- #include <com/sun/star/script/XEngine.hpp>
- #include <com/sun/star/script/InterruptEngineEvent.hpp>
- #include <com/sun/star/script/XLibraryAccess.hpp>
-+#include <com/sun/star/script/BasicErrorException.hpp>
- #include <com/sun/star/bridge/ModelDependent.hpp>
-
- #include "com/sun/star/bridge/oleautomation/NamedArgument.hpp"
-@@ -152,10 +153,10 @@ Any IUnknownWrapper_Impl::queryInterface(const Type& t)
- return Any();
- if (t == getCppuType(static_cast<Reference<XDefaultProperty>*>( 0)) && !m_bHasDfltProperty )
- return Any();
-- if (t == getCppuType(static_cast<Reference<XInvocation>*>( 0)) && !m_spDispatch)
-+ if ( ( t == getCppuType(static_cast<Reference<XInvocation>*>( 0)) || t == getCppuType(static_cast<Reference<XAutomationInvocation>*>( 0)) ) && !m_spDispatch)
- return Any();
-
-- return WeakImplHelper6<XInvocation, XBridgeSupplier2,
-+ return WeakImplHelper6<XAutomationInvocation, XBridgeSupplier2,
- XInitialization, XAutomationObject, XDefaultProperty, XDefaultMethod>::queryInterface(t);
- }
-
-@@ -167,6 +168,61 @@ Reference<XIntrospectionAccess> SAL_CALL IUnknownWrapper_Impl::getIntrospection(
- return ret;
- }
-
-+Any SAL_CALL IUnknownWrapper_Impl::invokeGetProperty( const OUString& aPropertyName, const Sequence< Any >& aParams, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam )
-+{
-+ Any aResult;
-+ try
-+ {
-+ o2u_attachCurrentThread();
-+ ITypeInfo * pInfo = getTypeInfo();
-+ FuncDesc aDescGet(pInfo);
-+ FuncDesc aDescPut(pInfo);
-+ VarDesc aVarDesc(pInfo);
-+ getPropDesc(aPropertyName, & aDescGet, & aDescPut, & aVarDesc);
-+ if ( !aDescGet )
-+ {
-+ OUString msg(OUSTR("[automation bridge]Property \"") + aPropertyName +
-+ OUSTR("\" is not supported"));
-+ throw UnknownPropertyException(msg, Reference<XInterface>());
-+ }
-+ aResult = invokeWithDispIdComTlb( aDescGet, aPropertyName, aParams, aOutParamIndex, aOutParam );
-+ }
-+ catch ( Exception& e )
-+ {
-+ throw RuntimeException(OUSTR("[automation bridge] unexpected exception in "
-+ "IUnknownWrapper_Impl::invokeGetProperty ! Message : \n") +
-+ e.Message, Reference<XInterface>());
-+ }
-+ return aResult;
-+}
-+
-+Any SAL_CALL IUnknownWrapper_Impl::invokePutProperty( const OUString& aPropertyName, const Sequence< Any >& aParams, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam )
-+{
-+ Any aResult;
-+ try
-+ {
-+ o2u_attachCurrentThread();
-+ ITypeInfo * pInfo = getTypeInfo();
-+ FuncDesc aDescGet(pInfo);
-+ FuncDesc aDescPut(pInfo);
-+ VarDesc aVarDesc(pInfo);
-+ getPropDesc(aPropertyName, & aDescGet, & aDescPut, & aVarDesc);
-+ if ( !aDescPut )
-+ {
-+ OUString msg(OUSTR("[automation bridge]Property \"") + aPropertyName +
-+ OUSTR("\" is not supported"));
-+ throw UnknownPropertyException(msg, Reference<XInterface>());
-+ }
-+ aResult = invokeWithDispIdComTlb( aDescPut, aPropertyName, aParams, aOutParamIndex, aOutParam );
-+ }
-+ catch ( Exception& e )
-+ {
-+ throw RuntimeException(OUSTR("[automation bridge] unexpected exception in "
-+ "IUnknownWrapper_Impl::invokePutProperty ! Message : \n") +
-+ e.Message, Reference<XInterface>());
-+ }
-+ return aResult;
-+}
-
-
- Any SAL_CALL IUnknownWrapper_Impl::invoke( const OUString& aFunctionName,
-@@ -210,6 +266,10 @@ Any SAL_CALL IUnknownWrapper_Impl::invoke( const OUString& aFunctionName,
- throw;
- }
- catch (CannotConvertException &)
-+ {
-+ throw;
-+ }
-+ catch (InvocationTargetException &)
- {
- throw;
- }
-@@ -658,12 +718,16 @@ sal_Bool SAL_CALL IUnknownWrapper_Impl::hasProperty( const OUString& aName )
- FuncDesc aDescPut(pInfo);
- VarDesc aVarDesc(pInfo);
- getPropDesc(aName, & aDescGet, & aDescPut, & aVarDesc);
-- // Automation properties can have parameters. If so, we access them through
-- // XInvocation::invoke. Thas is, hasProperty must return false for such a
-- // property
-+
-+ // we should probably just check the funckind
-+ // basic has been modified to handle properties ( 'get' ) props at
-+ // least with paramaters
-+ // additionally you can call invoke(Get|Set)Property on the bridge
-+ // you can determine if a property has parameter is hasMethod
-+ // returns true for the name
- if (aVarDesc
-- || aDescPut && aDescPut->cParams == 0
-- || aDescGet && aDescGet->cParams == 0)
-+ || aDescPut
-+ || aDescGet )
- {
- ret = sal_True;
- }
-@@ -1392,6 +1456,19 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(const OUString& sFuncName,
- Sequence< sal_Int16 >& OutParamIndex,
- Sequence< Any >& OutParam)
- {
-+ // Get type info for the call. It can be a method call or property put or
-+ // property get operation.
-+ FuncDesc aFuncDesc(getTypeInfo());
-+ getFuncDescForInvoke(sFuncName, Params, & aFuncDesc);
-+ return invokeWithDispIdComTlb( aFuncDesc, sFuncName, Params, OutParamIndex, OutParam );
-+}
-+
-+Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc,
-+ const OUString& sFuncName,
-+ const Sequence< Any >& Params,
-+ Sequence< sal_Int16 >& OutParamIndex,
-+ Sequence< Any >& OutParam)
-+{
- Any ret;
- HRESULT result;
-
-@@ -1410,10 +1487,6 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(const OUString& sFuncName,
- sal_Int32 revIndex = 0;
- bool bVarargParam = false;
-
-- // Get type info for the call. It can be a method call or property put or
-- // property get operation.
-- FuncDesc aFuncDesc(getTypeInfo());
-- getFuncDescForInvoke(sFuncName, Params, & aFuncDesc);
-
- //Set the array of DISPIDs for named args if it is a property put operation.
- //If there are other named arguments another array is set later on.
-@@ -1832,11 +1905,24 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(const OUString& sFuncName,
- "DISP_E_BADVARTYPE."), 0);
- break;
- case DISP_E_EXCEPTION:
-+ {
- message = OUSTR("[automation bridge]: ");
- message += OUString(reinterpret_cast<const sal_Unicode*>(excepinfo.bstrDescription),
- ::SysStringLen(excepinfo.bstrDescription));
-- throw InvocationTargetException(message, Reference<XInterface>(), Any());
-+
-+ // Add for VBA, to throw an exception with the correct error code and message.
-+ sal_Int32 nErrorCode = excepinfo.wCode;
-+ if ( nErrorCode == 0 )
-+ {
-+ // The low 16-bit of scode describing the error or warning.
-+ nErrorCode = ( excepinfo.scode & 0xFFFF );
-+ }
-+ BasicErrorException aBasicErrExp(message, Reference<XInterface>(), nErrorCode, message);
-+ throw InvocationTargetException(message, Reference<XInterface>(), makeAny(aBasicErrExp));
-+ // End add
-+
- break;
-+ }
- case DISP_E_MEMBERNOTFOUND:
- message = OUSTR("[automation bridge]: A function with the name \"")
- + sFuncName + OUSTR("\" is not supported. Object returned "
-@@ -1969,11 +2055,17 @@ void IUnknownWrapper_Impl::getFuncDesc(const OUString & sFuncName, FUNCDESC ** p
- //get the associated index and add an entry to the map
- //with the name sFuncName which differs in the casing of the letters to
- //the actual name as obtained from ITypeInfo
-- cit itOrg = m_mapComFunc.find(OUString(reinterpret_cast<const sal_Unicode*>(LPCOLESTR(memberName))));
-+ OUString sRealName(reinterpret_cast<const sal_Unicode*>(LPCOLESTR(memberName)));
-+ cit itOrg = m_mapComFunc.find(sRealName);
- OSL_ASSERT(itOrg != m_mapComFunc.end());
-+ // maybe this is a property, if so we need
-+ // to store either both id's ( put/get ) or
-+ // just the get. Storing both is more consistent
-+ pair<cit, cit> pItems = m_mapComFunc.equal_range( sRealName );
-+ for ( ;pItems.first != pItems.second; ++pItems.first )
-+ m_mapComFunc.insert( TLBFuncIndexMap::value_type ( make_pair(sFuncName, pItems.first->second ) ));
- itIndex =
-- m_mapComFunc.insert( TLBFuncIndexMap::value_type
-- ( make_pair(sFuncName, itOrg->second ) ));
-+ m_mapComFunc.find( sFuncName );
- }
- }
- }
-@@ -2080,56 +2172,69 @@ void IUnknownWrapper_Impl::getPropDesc(const OUString & sFuncName, FUNCDESC ** p
- //else no entry for sFuncName, pFuncDesc will not be filled in
- }
-
--VARTYPE IUnknownWrapper_Impl::getElementTypeDesc(const TYPEDESC *desc)
-+VARTYPE IUnknownWrapper_Impl::getUserDefinedElementType( ITypeInfo* pTypeInfo, const DWORD nHrefType )
- {
- VARTYPE _type( VT_NULL );
--
-- if (desc->vt == VT_PTR)
-+ if ( pTypeInfo )
- {
-- _type = getElementTypeDesc(desc->lptdesc);
-- _type |= VT_BYREF;
-- }
-- else if (desc->vt == VT_SAFEARRAY)
-- {
-- _type = getElementTypeDesc(desc->lptdesc);
-- _type |= VT_ARRAY;
-- }
-- else if (desc->vt == VT_USERDEFINED)
-- {
-- ITypeInfo* thisInfo = getTypeInfo(); //kept by this instance
-- CComPtr<ITypeInfo> spRefInfo;
-- thisInfo->GetRefTypeInfo(desc->hreftype, & spRefInfo.p);
-- if (spRefInfo)
-+ CComPtr<ITypeInfo> spRefInfo;
-+ pTypeInfo->GetRefTypeInfo( nHrefType, &spRefInfo.p );
-+ if ( spRefInfo )
- {
-- TypeAttr attr(spRefInfo);
-- spRefInfo->GetTypeAttr( & attr);
-- if (attr->typekind == TKIND_ENUM)
-+ TypeAttr attr( spRefInfo );
-+ spRefInfo->GetTypeAttr( &attr );
-+ if ( attr->typekind == TKIND_ENUM )
- {
-- //We use the type of the first enum value.
-- if (attr->cVars == 0)
-+ // We use the type of the first enum value.
-+ if ( attr->cVars == 0 )
- {
-- throw BridgeRuntimeError(OUSTR("[automation bridge] Could "
-- "not obtain type description"));
-+ throw BridgeRuntimeError(OUSTR("[automation bridge] Could not obtain type description"));
- }
-- VarDesc var(spRefInfo);
-- spRefInfo->GetVarDesc(0, & var);
-- _type = var->lpvarValue->vt;
-+ VarDesc var( spRefInfo );
-+ spRefInfo->GetVarDesc( 0, &var );
-+ _type = var->lpvarValue->vt;
- }
-- else if (attr->typekind == TKIND_INTERFACE)
-+ else if ( attr->typekind == TKIND_INTERFACE )
- {
- _type = VT_UNKNOWN;
- }
-- else if (attr->typekind == TKIND_DISPATCH)
-+ else if ( attr->typekind == TKIND_DISPATCH )
- {
- _type = VT_DISPATCH;
- }
-- else
-+ else if ( attr->typekind == TKIND_ALIAS )
- {
-- throw BridgeRuntimeError(OUSTR("[automation bridge] "
-- "Unhandled user defined type."));
-+ // TKIND_ALIAS is a type that is an alias for another type. So get that alias type.
-+ _type = getUserDefinedElementType( pTypeInfo, attr->tdescAlias.hreftype );
-+ }
-+ else
-+ {
-+ throw BridgeRuntimeError( OUSTR("[automation bridge] Unhandled user defined type.") );
- }
- }
- }
-+ return _type;
-+}
-+
-+VARTYPE IUnknownWrapper_Impl::getElementTypeDesc(const TYPEDESC *desc)
-+{
-+ VARTYPE _type( VT_NULL );
-+
-+ if (desc->vt == VT_PTR)
-+ {
-+ _type = getElementTypeDesc(desc->lptdesc);
-+ _type |= VT_BYREF;
-+ }
-+ else if (desc->vt == VT_SAFEARRAY)
-+ {
-+ _type = getElementTypeDesc(desc->lptdesc);
-+ _type |= VT_ARRAY;
-+ }
-+ else if (desc->vt == VT_USERDEFINED)
-+ {
-+ ITypeInfo* thisInfo = getTypeInfo(); //kept by this instance
-+ _type = getUserDefinedElementType( thisInfo, desc->hreftype );
-+ }
- else
- {
- _type = desc->vt;
-diff --git extensions/source/ole/oleobjw.hxx extensions/source/ole/oleobjw.hxx
-index 334fb18..ae879f2 100644
---- extensions/source/ole/oleobjw.hxx
-+++ extensions/source/ole/oleobjw.hxx
-@@ -54,6 +54,7 @@
-
- #include <com/sun/star/lang/XInitialization.hpp>
- #include <com/sun/star/bridge/oleautomation/XAutomationObject.hpp>
-+#include <com/sun/star/script//XAutomationInvocation.hpp>
- #include <rtl/ustring.hxx>
-
- #include <com/sun/star/script/XDefaultProperty.hpp>
-@@ -81,7 +82,7 @@ typedef hash_multimap<OUString, unsigned int, hashOUString_Impl, equalOUString_I
- // This class wraps an IDispatch and maps XInvocation calls to IDispatch calls on the wrapped object.
- // If m_TypeDescription is set then this class represents an UNO interface implemented in a COM component.
- // The interface is not a real interface in terms of an abstract class but is realized through IDispatch.
--class IUnknownWrapper_Impl : public WeakImplHelper6<XInvocation, XBridgeSupplier2, XInitialization, XAutomationObject, XDefaultProperty, XDefaultMethod>,
-+class IUnknownWrapper_Impl : public WeakImplHelper6<XAutomationInvocation, XBridgeSupplier2, XInitialization, XAutomationObject, XDefaultProperty, XDefaultMethod>,
-
- public UnoConversionUtilities<IUnknownWrapper_Impl>
-
-@@ -134,6 +135,9 @@ public:
- protected:
- virtual ::rtl::OUString SAL_CALL getDefaultMethodName( ) throw (::com::sun::star::uno::RuntimeException) { return m_sDefaultMember; }
-
-+ virtual ::com::sun::star::uno::Any SAL_CALL invokeGetProperty( const ::rtl::OUString& aFunctionName, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aParams, ::com::sun::star::uno::Sequence< ::sal_Int16 >& aOutParamIndex, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::script::CannotConvertException, ::com::sun::star::reflection::InvocationTargetException, ::com::sun::star::uno::RuntimeException);
-+ virtual ::com::sun::star::uno::Any SAL_CALL invokePutProperty( const ::rtl::OUString& aFunctionName, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aParams, ::com::sun::star::uno::Sequence< ::sal_Int16 >& aOutParamIndex, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::script::CannotConvertException, ::com::sun::star::reflection::InvocationTargetException, ::com::sun::star::uno::RuntimeException);
-+
- // ----------------------------------------------------------------------------
- virtual Any invokeWithDispIdUnoTlb(const OUString& sFunctionName,
- const Sequence< Any >& Params,
-@@ -149,6 +149,12 @@
- Sequence< sal_Int16 >& OutParamIndex,
- Sequence< Any >& OutParam);
-
-+ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc,
-+ const OUString& sFuncName,
-+ const Sequence< Any >& Params,
-+ Sequence< sal_Int16 >& OutParamIndex,
-+ Sequence< Any >& OutParam);
-+
- // virtual void setValueWithDispId(DISPID dispID, const Any& Value);
-
- // virtual Any getValueWithDispId(const OUString& sName, DISPID dispID);
-@@ -188,7 +192,10 @@ protected:
- /** Returns the DISPID for a function or property name. If true is returned then
- id contains a valid DISPID.
- */
-+
- bool getDispid(const OUString& sFuncName, DISPID * id);
-+
-+ VARTYPE getUserDefinedElementType( ITypeInfo* pTypeInfo, const DWORD nHrefType );
-
- /** Gets the element type in a VARIANT like style. E.g. if desc->lptdesc contains
- a VT_PTR than it is replaced by VT_BYREF and VT_SAFEARRAY is replaced by VT_ARRAY
-diff --git extensions/source/propctrlr/defaultforminspection.cxx extensions/source/propctrlr/defaultforminspection.cxx
-index 2fab077..ac57f9e 100644
---- extensions/source/propctrlr/defaultforminspection.cxx
-+++ extensions/source/propctrlr/defaultforminspection.cxx
-@@ -149,7 +149,7 @@ namespace pcr
- { "com.sun.star.form.inspection.EventHandler", false },
-
- // a handler which introduces virtual properties for binding controls to spreadsheet cells
-- { "com.sun.star.form.inspection.CellBindingPropertyHandler", true },
-+ { "com.sun.star.form.inspection.CellBindingPropertyHandler", false },
-
- // properties related to binding to an XForms DOM node
- { "com.sun.star.form.inspection.XMLFormsPropertyHandler", true },
-diff --git extensions/source/propctrlr/formmetadata.cxx extensions/source/propctrlr/formmetadata.cxx
-index f6ab37e..58df4cd 100644
---- extensions/source/propctrlr/formmetadata.cxx
-+++ extensions/source/propctrlr/formmetadata.cxx
-@@ -138,6 +138,7 @@ namespace pcr
- DEF_INFO_3( LABEL, LABEL, LABEL, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
- DEF_INFO_2( CONTROLLABEL, LABELCONTROL, CONTROLLABEL, FORM_VISIBLE, COMPOSEABLE ),
- DEF_INFO_3( WRITING_MODE, WRITING_MODE, WRITING_MODE, FORM_VISIBLE, ENUM, COMPOSEABLE ),
-+ DEF_INFO_3( GROUP_NAME, GROUP_NAME, GROUP_NAME, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
- DEF_INFO_2( TEXT, TEXT, TEXT, DIALOG_VISIBLE, COMPOSEABLE ),
- DEF_INFO_3( MAXTEXTLEN, MAXTEXTLEN, MAXTEXTLEN, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
- DEF_INFO_3( EDITMASK, EDITMASK, EDITMASK, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
-diff --git extensions/source/propctrlr/formmetadata.hxx extensions/source/propctrlr/formmetadata.hxx
-index e5413f2..c11797a 100644
---- extensions/source/propctrlr/formmetadata.hxx
-+++ extensions/source/propctrlr/formmetadata.hxx
-@@ -163,6 +163,7 @@ namespace pcr
- #define PROPERTY_ID_ALLOWADDITIONS 20
- #define PROPERTY_ID_ALLOWEDITS 21
- #define PROPERTY_ID_ALLOWDELETIONS 22
-+ #define PROPERTY_ID_GROUP_NAME 23
- #define PROPERTY_ID_NAVIGATION 24
- #define PROPERTY_ID_CYCLE 25
- #define PROPERTY_ID_HIDDEN_VALUE 26
-diff --git extensions/source/propctrlr/formres.src extensions/source/propctrlr/formres.src
-index c853723..11c08c0 100644
---- extensions/source/propctrlr/formres.src
-+++ extensions/source/propctrlr/formres.src
-@@ -231,6 +231,10 @@ String RID_STR_NAME
- {
- Text [ en-US ] = "Name" ;
- };
-+String RID_STR_GROUP_NAME
-+{
-+ Text [ en-US ] = "Group name" ;
-+};
- String RID_STR_TABINDEX
- {
- Text [ en-US ] = "Tab order" ;
-diff --git extensions/source/propctrlr/formresid.hrc extensions/source/propctrlr/formresid.hrc
-index 613db7d..e05a6bb 100644
---- extensions/source/propctrlr/formresid.hrc
-+++ extensions/source/propctrlr/formresid.hrc
-@@ -149,6 +149,7 @@
- #define RID_STR_CURSOR_TYPE ( RID_FORMBROWSER_START + 121 )
- #define RID_STR_ENABLE_VISIBLE ( RID_FORMBROWSER_START + 122 )
- #define RID_STR_WHEEL_BEHAVIOR ( RID_FORMBROWSER_START + 123 )
-+#define RID_STR_GROUP_NAME ( RID_FORMBROWSER_START + 124 )
- // FREE
- // FREE
- // FREE
-diff --git extensions/source/propctrlr/formstrings.hxx extensions/source/propctrlr/formstrings.hxx
-index b338653..95a57b1 100644
---- extensions/source/propctrlr/formstrings.hxx
-+++ extensions/source/propctrlr/formstrings.hxx
-@@ -48,6 +48,7 @@ namespace pcr
- PCR_CONSTASCII_STRING( PROPERTY_WHEEL_BEHAVIOR, "MouseWheelBehavior");
- PCR_CONSTASCII_STRING( PROPERTY_TAG, "Tag");
- PCR_CONSTASCII_STRING( PROPERTY_NAME, "Name");
-+ PCR_CONSTASCII_STRING( PROPERTY_GROUP_NAME, "GroupName");
- PCR_CONSTASCII_STRING( PROPERTY_VALUE, "Value");
- PCR_CONSTASCII_STRING( PROPERTY_TEXT, "Text");
- PCR_CONSTASCII_STRING( PROPERTY_NAVIGATION, "NavigationBarMode");
-diff --git extensions/util/hidother.src extensions/util/hidother.src
-index 2aa0413..48f2e8e 100644
---- extensions/util/hidother.src
-+++ extensions/util/hidother.src
-@@ -207,6 +207,7 @@ hidspecial HID_PROP_FOCUSONCLICK { HelpId = HID_PROP_FOCUSONCLICK
- hidspecial HID_PROP_FONT { HelpId = HID_PROP_FONT; }
- hidspecial HID_PROP_FORMATKEY { HelpId = HID_PROP_FORMATKEY; }
- hidspecial HID_PROP_GROUPBOX { HelpId = HID_PROP_GROUPBOX; }
-+hidspecial HID_PROP_GROUP_NAME { HelpId = HID_PROP_GROUP_NAME; }
- hidspecial HID_PROP_HEIGHT { HelpId = HID_PROP_HEIGHT; }
- hidspecial HID_PROP_HELPTEXT { HelpId = HID_PROP_HELPTEXT; }
- hidspecial HID_PROP_HELPURL { HelpId = HID_PROP_HELPURL; }
-diff --git filter/inc/filter/msfilter/escherex.hxx filter/inc/filter/msfilter/escherex.hxx
-index 53f6f9b..0ee4916 100644
---- filter/inc/filter/msfilter/escherex.hxx
-+++ filter/inc/filter/msfilter/escherex.hxx
-@@ -45,6 +45,7 @@
- #include <com/sun/star/drawing/BitmapMode.hpp>
- #include <com/sun/star/drawing/Hatch.hpp>
- #include <svx/msdffdef.hxx>
-+#include <memory>
- #include "filter/msfilter/msfilterdllapi.h"
-
- /*Record Name FBT-Value Instance Contents Wrd Exl PPt Ver*/
-@@ -1305,6 +1306,19 @@ public:
- const Rectangle& rRect ) = 0;
- };
-
-+class InteractionInfo
-+{
-+ bool mbHasInteraction;
-+ std::auto_ptr<SvMemoryStream> mpHyperlinkRecord;
-+ InteractionInfo();
-+public:
-+ InteractionInfo( SvMemoryStream* pStream, bool bInteraction ) : mbHasInteraction( bInteraction )
-+ {
-+ mpHyperlinkRecord.reset( pStream );
-+ }
-+ bool hasInteraction() { return mbHasInteraction; }
-+ const std::auto_ptr< SvMemoryStream >& getHyperlinkRecord() { return mpHyperlinkRecord; }
-+};
-
- class EscherExHostAppData
- {
-@@ -1312,14 +1326,17 @@ private:
- EscherExClientAnchor_Base* pClientAnchor;
- EscherExClientRecord_Base* pClientData;
- EscherExClientRecord_Base* pClientTextbox;
-+ InteractionInfo* pInteractionInfo;
- // ignore single shape if entire pages are written
- BOOL bDontWriteShape;
-
- public:
- EscherExHostAppData() : pClientAnchor(0), pClientData(0),
-- pClientTextbox(0), bDontWriteShape(FALSE)
-+ pClientTextbox(0), pInteractionInfo(0), bDontWriteShape(FALSE)
- {}
-
-+ void SetInteractionInfo( InteractionInfo* p )
-+ { pInteractionInfo = p; }
- void SetClientAnchor( EscherExClientAnchor_Base* p )
- { pClientAnchor = p; }
- void SetClientData( EscherExClientRecord_Base* p )
-@@ -1328,6 +1345,8 @@ public:
- { pClientTextbox = p; }
- void SetDontWriteShape( BOOL b )
- { bDontWriteShape = b; }
-+ InteractionInfo* GetInteractionInfo() const
-+ { return pInteractionInfo; }
- EscherExClientAnchor_Base* GetClientAnchor() const
- { return pClientAnchor; }
- EscherExClientRecord_Base* GetClientData() const
-diff --git filter/inc/filter/msfilter/msocximex.hxx filter/inc/filter/msfilter/msocximex.hxx
-index b8733b1..7caf854 100644
---- filter/inc/filter/msfilter/msocximex.hxx
-+++ filter/inc/filter/msfilter/msocximex.hxx
-@@ -29,6 +29,7 @@
-
- #include <sot/storage.hxx>
- #include <tools/debug.hxx>
-+#include <com/sun/star/graphic/XGraphicObject.hpp>
-
- //!! no such defines in global namespaces - it will break other existing code that uses the same define!!
- //#ifndef C2U
-@@ -287,7 +288,10 @@ public:
- bool mbVisible;
- UniString sName;
- UniString msToolTip;
-+ UniString msParentName;
- OCX_FontData aFontData;
-+ rtl::OUString msCtrlSource;
-+ rtl::OUString msRowSource;
- SfxObjectShell *pDocSh;
- protected:
-
-@@ -324,14 +328,13 @@ public:
- nMultiState(0), nValueLen(0), nCaptionLen(0), nVertPos(1), nHorzPos(7),
- nSpecialEffect(2), nIcon(0), nPicture(0), nAccelerator(0), nGroupNameLen(0),
- pValue(0), pCaption(0), pGroupName(0), nIconLen(0), pIcon(0),
-- nPictureLen(0), pPicture(0) {}
-+ nPictureLen(0) {}
-
- ~OCX_ModernControl() {
- if (pValue) delete[] pValue;
- if (pCaption) delete[] pCaption;
- if (pGroupName) delete[] pGroupName;
- if (pIcon) delete[] pIcon;
-- if (pPicture) delete[] pPicture;
- }
- sal_Bool Read(SotStorageStream *pS);
-
-@@ -412,7 +415,8 @@ public:
-
- sal_uInt8 pPictureHeader[20];
- sal_uInt32 nPictureLen;
-- sal_uInt8 *pPicture;
-+ ::rtl::OUString sImageUrl;
-+ com::sun::star::uno::Reference< com::sun::star::graphic::XGraphicObject> mxGrfObj;
-
- };
-
-@@ -461,6 +465,7 @@ public:
-
- bool bAutoSize;
- ::rtl::OUString sImageUrl;
-+ com::sun::star::uno::Reference< com::sun::star::graphic::XGraphicObject> mxGrfObj;
- sal_Bool Read(SotStorageStream *pS);
-
- using OCX_Control::Import; // to not hide the other two import methods
-@@ -485,6 +490,8 @@ struct ContainerRecord
-
- ::rtl::OUString cName;
- ::rtl::OUString controlTip;
-+ ::rtl::OUString sCtrlSource;
-+ ::rtl::OUString sRowSource;
-
- sal_uInt32 nTop;
- sal_uInt32 nLeft;
-@@ -499,54 +506,8 @@ typedef std::vector<OCX_Control*>::iterator CtrlIterator;
- typedef std::vector<OCX_Control*>::const_iterator CtrlIteratorConst;
- typedef std::vector<OCX_Control*> CtrlList;
-
--
--
--class RBGroup
--{
-- public:
-- RBGroup():mRBGroupPos(0){}
-- RBGroup(sal_uInt16& groupPos ):mRBGroupPos(groupPos){}
-- sal_Int16 tabPos() const { return mRBGroupPos; }
-- std::vector<OCX_Control*>::size_type numControls()
-- { return mpControls.size(); }
-- std::vector<OCX_Control*>& controls() { return mpControls; }
--
-- void add(OCX_Control* pRB);
-- private:
-- sal_uInt16 mRBGroupPos;
-- std::vector<OCX_Control*> mpControls;
--};
--
--typedef ::std::hash_map < ::rtl::OUString, RBGroup*, ::rtl::OUStringHash,
-- ::std::equal_to< ::rtl::OUString > > RBGroupHash;
--typedef std::vector<RBGroup*>::iterator GroupIterator;
--
- class OCX_OptionButton;
-
--class RBGroupManager
--{
--public:
-- RBGroupManager( String& defaultName );
-- ~RBGroupManager();
--
-- CtrlList insertGroupsIntoControlList( const CtrlList& sourceList );
-- void addRadioButton( OCX_OptionButton* pRButton );
--private:
--
-- void addSeperator( std::vector< OCX_Control* >& dest );
-- void copyList( std::vector< OCX_Control* >& src,
-- std::vector< OCX_Control* >& dest,
-- bool addGroupSeperator );
--
-- RBGroupHash rbGroups;
-- String mSDefaultName;
-- std::vector< RBGroup* > groupList;
-- sal_uInt16 numRadioButtons;
--};
--
--
--
--
- class OCX_ContainerControl : public OCX_Control
- {
- public:
-@@ -572,8 +533,9 @@ public:
- SotStorageStreamRef getContainerStream() { return mContainerStream; }
-
- virtual void ProcessControl( OCX_Control* pControl, SvStorageStream* pS, ContainerRecord& rec );
-- bool createFromContainerRecord( const ContainerRecord& record,
-+ bool createFromContainerRecord( ContainerRecord& record,
- OCX_Control*& );
-+ SotStorageStreamRef getContainedControlsStream(){ return mContainedControlsStream; }
- protected:
- // This class not meant to be instantiated
- // needs to be subclassed
-@@ -585,10 +547,10 @@ protected:
- OCX_Control* pParent = NULL );
- rtl::OUString createSubStreamName( const sal_uInt32& subStorageID );
-
-- RBGroupManager rbGroupMgr;
- com::sun::star::uno::Reference<
- com::sun::star::container::XNameContainer > mxParent;
- std::vector<OCX_Control*> mpControls;
-+ std::hash_map<sal_uInt16, sal_uInt16> mActiveXIDMap;
- SotStorageRef mContainerStorage;
- SotStorageStreamRef mContainerStream;
- SotStorageStreamRef mContainedControlsStream;
-@@ -856,7 +818,6 @@ public:
- {
- delete[] pCaption;
- delete[] pIcon;
-- delete[] pPicture;
- }
-
- virtual sal_Bool Read(SvStorageStream *pS);
-@@ -920,7 +881,8 @@ public:
-
- sal_uInt8 pPictureHeader[20];
- sal_uInt32 nPictureLen;
-- sal_uInt8 *pPicture;
-+ ::rtl::OUString sImageUrl;
-+ com::sun::star::uno::Reference< com::sun::star::graphic::XGraphicObject> mxGrfObj;
- private:
- com::sun::star::uno::Reference<
- com::sun::star::uno::XComponentContext> mxCtx;
-@@ -959,7 +921,8 @@ public:
- OCX_OptionButton() : OCX_ModernControl(rtl::OUString::createFromAscii("OptionButton"))
- {
- msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.RadioButton");
-- msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlRadioButtonModel");
-+ //msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlRadioButtonModel");
-+ msDialogType = rtl::OUString::createFromAscii("com.sun.star.form.component.RadioButton");
- mnBackColor = 0x80000005L;
- mnForeColor = 0x80000008L;
- aFontData.SetHasAlign(TRUE);
-@@ -1060,7 +1023,7 @@ class OCX_ComboBox : public OCX_ModernControl
- public:
- OCX_ComboBox() : OCX_ModernControl(rtl::OUString::createFromAscii("ComboBox")){
- msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.ComboBox");
-- msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlComboBoxModel");
-+ msDialogType = rtl::OUString::createFromAscii("com.sun.star.form.component.ComboBox");
- mnBackColor = 0x80000005;
- mnForeColor = 0x80000008;
- nBorderColor = 0x80000006;
-@@ -1085,7 +1048,8 @@ class OCX_ListBox : public OCX_ModernControl
- public:
- OCX_ListBox() : OCX_ModernControl(rtl::OUString::createFromAscii("ListBox")){
- msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.ListBox");
-- msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlListBoxModel");
-+ //msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlListBoxModel");
-+ msDialogType = rtl::OUString::createFromAscii("com.sun.star.form.component.ListBox");
- mnBackColor = 0x80000005;
- mnForeColor = 0x80000008;
- nBorderColor = 0x80000006;
-@@ -1113,7 +1077,7 @@ public:
- fEnabled(1), fLocked(0), fBackStyle(1), fWordWrap(0), fAutoSize(0),
- nCaptionLen(0), nVertPos(1), nHorzPos(7), nMousePointer(0), nPicture(0),
- nAccelerator(0), nIcon(0), pCaption(0), nIconLen(0), pIcon(0), nPictureLen(0),
-- pPicture(0), mbTakeFocus( true )
-+ mbTakeFocus( true )
- {
- msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.CommandButton");
- msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlButtonModel");
-@@ -1124,7 +1088,6 @@ public:
- ~OCX_CommandButton() {
- if (pCaption) delete[] pCaption;
- if (pIcon) delete[] pIcon;
-- if (pPicture) delete[] pPicture;
- }
- sal_Bool Read(SotStorageStream *pS);
-
-@@ -1167,7 +1130,8 @@ public:
-
- sal_uInt8 pPictureHeader[20];
- sal_uInt32 nPictureLen;
-- sal_uInt8 *pPicture;
-+ ::rtl::OUString sImageUrl;
-+ com::sun::star::uno::Reference< com::sun::star::graphic::XGraphicObject> mxGrfObj;
-
- bool mbTakeFocus;
-
-@@ -1285,7 +1249,7 @@ public:
-
- sal_uInt8 pPictureHeader[20];
- sal_uInt32 nPictureLen;
-- sal_uInt8 *pPicture;
-+ sal_uInt8 *pPicture;
-
- static OCX_Control *Create() { return new OCX_Label;}
-
-diff --git filter/inc/filter/msfilter/mstoolbar.hxx filter/inc/filter/msfilter/mstoolbar.hxx
-new file mode 100644
-index 0000000..c117645
---- /dev/null
-+++ filter/inc/filter/msfilter/mstoolbar.hxx
-@@ -0,0 +1,334 @@
-+#ifndef _MSTOOLBAR_HXX
-+#define _MSTOOLBAR_HXX
-+#include "filter/msfilter/msfilterdllapi.h"
-+#include <tools/string.hxx>
-+#include <sot/storage.hxx>
-+#include <ostream>
-+#include <memory>
-+#include <vector>
-+#include <boost/shared_ptr.hpp>
-+#include <com/sun/star/frame/XModel.hpp>
-+#include <com/sun/star/container/XIndexContainer.hpp>
-+#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
-+#include <com/sun/star/ui/ImageType.hpp>
-+#include <com/sun/star/graphic/XGraphic.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <vcl/bitmap.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+
-+namespace css = ::com::sun::star;
-+
-+class TBCHeader;
-+
-+
-+class MSOCommandConvertor
-+{
-+public:
-+ virtual ~MSOCommandConvertor() {}
-+ virtual rtl::OUString MSOCommandToOOCommand( sal_Int16 msoCmd ) = 0;
-+ virtual rtl::OUString MSOTCIDToOOCommand( sal_Int16 msoTCID ) = 0;
-+};
-+
-+class SfxObjectShell;
-+
-+class MSFILTER_DLLPUBLIC CustomToolBarImportHelper
-+{
-+ struct iconcontrolitem
-+ {
-+ rtl::OUString sCommand;
-+ css::uno::Reference< css::graphic::XGraphic > image;
-+ };
-+ std::vector< iconcontrolitem > iconcommands;
-+ std::auto_ptr< MSOCommandConvertor > pMSOCmdConvertor;
-+ css::uno::Reference< css::ui::XUIConfigurationManagerSupplier > m_xCfgSupp;
-+ css::uno::Reference< css::ui::XUIConfigurationManager > m_xAppCfgMgr;
-+ SfxObjectShell& mrDocSh;
-+ void ScaleImage( css::uno::Reference< css::graphic::XGraphic >& xGraphic, long nNewSize );
-+public:
-+ CustomToolBarImportHelper( SfxObjectShell& rDocSh, const css::uno::Reference< css::ui::XUIConfigurationManager >& rxAppCfgMgr );
-+
-+ void setMSOCommandMap( MSOCommandConvertor* pCnvtr ) { pMSOCmdConvertor.reset( pCnvtr ); }
-+ css::uno::Reference< css::ui::XUIConfigurationManager > getCfgManager();
-+ css::uno::Reference< css::ui::XUIConfigurationManager > getAppCfgManager();
-+
-+
-+ css::uno::Any createCommandFromMacro( const rtl::OUString& sCmd );
-+
-+ void addIcon( const css::uno::Reference< css::graphic::XGraphic >& xImage, const rtl::OUString& sString );
-+ void applyIcons();
-+ rtl::OUString MSOCommandToOOCommand( sal_Int16 msoCmd );
-+ rtl::OUString MSOTCIDToOOCommand( sal_Int16 msoTCID );
-+ SfxObjectShell& GetDocShell() { return mrDocSh; }
-+ void showToolbar( const rtl::OUString& rName );
-+ bool createMenu( const rtl::OUString& rName, const css::uno::Reference< css::container::XIndexAccess >& xMenuDesc, bool bPersist );
-+};
-+
-+class MSFILTER_DLLPUBLIC TBBase
-+{
-+friend class Indent;
-+ static int nIndent; // num spaces to indent before printing
-+protected:
-+ void indent_printf(FILE* fp, const char* format, ... );
-+ sal_uInt32 nOffSet; // usually for debug we can store the offset in the stream to this record
-+public:
-+ TBBase() : nOffSet( 0 ) {}
-+ virtual ~TBBase(){}
-+ rtl::OUString readUnicodeString( SvStream* pS, sal_Int32 nChars );
-+
-+ virtual bool Read(SvStream *pS) = 0;
-+ virtual void Print( FILE* ) {} // #FIXME remove this an implement the debug routines in all the classes below to enable some sort of readable output
-+ sal_uInt32 GetOffset() { return nOffSet; }
-+};
-+
-+class Indent
-+{
-+public:
-+ Indent( bool binit = false )
-+ {
-+ if ( binit )
-+ init();
-+ else
-+ TBBase::nIndent = TBBase::nIndent + 2;
-+ }
-+ ~Indent() { TBBase::nIndent = TBBase::nIndent - 2; }
-+ void init() { TBBase::nIndent = 0; }
-+};
-+
-+
-+class MSFILTER_DLLPUBLIC WString : public TBBase
-+{
-+ rtl::OUString sString;
-+
-+public:
-+ WString(){};
-+ ~WString(){};
-+ bool Read(SvStream *pS);
-+ rtl::OUString getString(){ return sString; }
-+};
-+
-+class MSFILTER_DLLPUBLIC TBCExtraInfo : public TBBase
-+{
-+ WString wstrHelpFile;
-+ sal_Int32 idHelpContext;
-+ WString wstrTag;
-+ WString wstrOnAction;
-+ WString wstrParam;
-+ sal_Int8 tbcu;
-+ sal_Int8 tbmg;
-+
-+ TBCExtraInfo(const TBCExtraInfo&);
-+ TBCExtraInfo& operator = ( const TBCExtraInfo&);
-+public:
-+ TBCExtraInfo();
-+ ~TBCExtraInfo(){}
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+ rtl::OUString getOnAction();
-+};
-+
-+class MSFILTER_DLLPUBLIC TBCGeneralInfo : public TBBase
-+{
-+ sal_uInt8 bFlags;
-+ WString customText;
-+ WString descriptionText;
-+ WString tooltip;
-+ TBCExtraInfo extraInfo;
-+
-+public:
-+ TBCGeneralInfo();
-+ ~TBCGeneralInfo() {}
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+ bool ImportToolBarControlData( CustomToolBarImportHelper&, std::vector< css::beans::PropertyValue >& );
-+ rtl::OUString CustomText() { return customText.getString(); }
-+ rtl::OUString DescriptionText() { return descriptionText.getString(); }
-+ rtl::OUString Tooltip() { return tooltip.getString(); }
-+};
-+
-+class MSFILTER_DLLPUBLIC TBCBitMap : public TBBase
-+{
-+friend class TBCBSpecific; // #FIXME hacky access, need to fix
-+ sal_Int32 cbDIB;
-+ Bitmap mBitMap;
-+ int size;
-+public:
-+ TBCBitMap();
-+ ~TBCBitMap();
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+ Bitmap& getBitMap();
-+};
-+
-+class MSFILTER_DLLPUBLIC TBCMenuSpecific : public TBBase
-+{
-+ sal_Int32 tbid;
-+ boost::shared_ptr< WString > name; //exist only if tbid equals 0x00000001
-+public:
-+ TBCMenuSpecific();
-+ ~TBCMenuSpecific(){}
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+ rtl::OUString Name();
-+};
-+
-+class MSFILTER_DLLPUBLIC TBCCDData : public TBBase
-+{
-+ sal_Int16 cwstrItems; //Signed integer that specifies the number of items in wstrList. MUST be positive.
-+ std::vector< WString > wstrList; // Zero-based index array of WString structures. Number of elements MUST be equal to cwstrItems.
-+ sal_Int16 cwstrMRU; // Signed integer that specifies the number of most recently used string
-+ sal_Int16 iSel ; // Signed integer that specifies the zero-based index of the selected item in the wstrList field. MUST be equal to 0xFFFF (-1) or greater than or equal to 0x0000.
-+ sal_Int16 cLines; // Signed integer that specifies the suggested number of lines that the toolbar control will display at any time when displaying the elements of wstrList of available items.
-+ sal_Int16 dxWidth; // Signed integer that specifies the width in pixels that the interior of the dropdown has. This excludes the width of the toolbar control border and scroll bar.
-+ WString wstrEdit; //Structure of type WString. Editable text for editable area of the ComboBox toolbar control.
-+
-+public:
-+ TBCCDData();
-+ ~TBCCDData();
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+};
-+
-+class TBCComboDropdownSpecific : public TBBase
-+{
-+ boost::shared_ptr< TBCCDData > data;
-+public:
-+ TBCComboDropdownSpecific( const TBCHeader& header );
-+ TBCComboDropdownSpecific(){}
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+};
-+
-+class TBCBSpecific : public TBBase
-+{
-+ sal_uInt8 bFlags;
-+ boost::shared_ptr< TBCBitMap > icon; // optional
-+ boost::shared_ptr< TBCBitMap > iconMask; // optional
-+ boost::shared_ptr< sal_uInt16 > iBtnFace; // optional
-+ boost::shared_ptr< WString > wstrAcc; // optional
-+
-+public:
-+ TBCBSpecific();
-+ ~TBCBSpecific(){}
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+ // #TODO just add a getGraphic member here
-+ TBCBitMap* getIcon();
-+ TBCBitMap* getIconMask();
-+ sal_uInt16* getBtnFace() { return iBtnFace.get(); }
-+};
-+
-+/* TBCHeader.tct controlSpecificInfo type
-+
-+0x01 (Button control) TBCBSpecific
-+0x10 (ExpandingGrid control) TBCBSpecific
-+0x0A (Popup control) TBCMenuSpecific
-+0x0C (ButtonPopup control) TBCMenuSpecific
-+0x0D (SplitButtonPopup control) TBCMenuSpecific
-+0x0E (SplitButtonMRUPopup control) TBCMenuSpecific
-+0x02 (Edit control) TBCComboDropdow nSpecific
-+0x04 (ComboBox control) TBCComboDropdow nSpecific
-+0x14 (GraphicCombo control) TBCComboDropdow nSpecific
-+0x03 (DropDown control) TBCComboDropdow nSpecific
-+0x06 (SplitDropDown control) TBCComboDropdow nSpecific
-+0x09 (GraphicDropDown control) TBCComboDropdow nSpecific
-+0x07 (OCXDropDown control) controlSpecificInfo MUST NOT exist
-+0x0F (Label control) controlSpecificInfo MUST NOT exist
-+0x12 (Grid control) controlSpecificInfo MUST NOT exist
-+0x13 (Gauge control) controlSpecificInfo MUST NOT exist
-+0x16 (ActiveX control) controlSpecificInfo MUST NOT exist
-+
-+*/
-+class MSFILTER_DLLPUBLIC TBCHeader : public TBBase
-+{
-+ sal_Int8 bSignature;
-+ sal_Int8 bVersion;
-+ sal_uInt8 bFlagsTCR;
-+ sal_uInt8 tct;
-+ sal_uInt16 tcid;
-+ sal_uInt32 tbct;
-+ sal_uInt8 bPriority;
-+ boost::shared_ptr< sal_uInt16 > width; //optional
-+ boost::shared_ptr< sal_uInt16 > height; //optional
-+
-+public:
-+ TBCHeader();
-+ ~TBCHeader();
-+ sal_uInt8 getTct() const { return tct; }
-+ sal_uInt16 getTcID() const { return tcid; }
-+ bool isVisible() { return !( bFlagsTCR & 0x1 ); }
-+ bool isBeginGroup() { return ( bFlagsTCR & 0x2 ); }
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+ sal_uInt32 getTbct() { return tbct; };
-+};
-+
-+class MSFILTER_DLLPUBLIC TBCData : public TBBase
-+{
-+ TBCHeader rHeader;
-+ TBCGeneralInfo controlGeneralInfo;
-+ boost::shared_ptr< TBBase > controlSpecificInfo; // can be one of TBCBSpecific, TBCMenuSpecific or TBCComboDropdow nSpecific depending on the control type specified by TBCHeader.tct
-+ TBCData(const TBCData&);
-+ TBCData& operator = ( const TBCData&);
-+public:
-+ TBCData( const TBCHeader& Header );
-+ ~TBCData(){}
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+ bool ImportToolBarControl( CustomToolBarImportHelper&, std::vector< css::beans::PropertyValue >&, bool& bBeginGroup, bool bIsMenuBar );
-+ TBCGeneralInfo& getGeneralInfo() { return controlGeneralInfo; }
-+ TBCMenuSpecific* getMenuSpecific();
-+};
-+
-+class MSFILTER_DLLPUBLIC TB : public TBBase
-+{
-+ sal_uInt8 bSignature;// Signed integer that specifies the toolbar signature number. MUST be 0x02.
-+ sal_uInt8 bVersion; // Signed integer that specifies the toolbar version number. MUST be 0x01.
-+ sal_Int16 cCL; // Signed integer that SHOULD specify the number of toolbar controls contained in this toolbar.
-+ sal_Int32 ltbid;// Signed integer that specifies the toolbar ID. MUST be 0x0001 (custom toolbar ID).
-+ sal_uInt32 ltbtr;// Unsigned integer of type TBTRFlags that specifies the toolbar type and toolbar restrictions.
-+ sal_uInt16 cRowsDefault;// Unsigned integer that specifies the number of preferred rows for the toolbar when the toolbar is not docked. MUST be less than or equal to 255.
-+ sal_uInt16 bFlags; //Unsigned integer of type TBFlags.
-+ WString name; //Structure of type WString that specifies the toolbar name
-+public:
-+ TB();
-+ ~TB(){}
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+ sal_Int16 getcCL(){ return cCL; }
-+ WString& getName(){ return name; }
-+ bool IsEnabled();
-+ bool IsMenuToolbar(){ return ( ( ltbtr & 0x2000000 ) == 0x2000000 ); }
-+ bool NeedsPositioning();
-+};
-+
-+class MSFILTER_DLLPUBLIC SRECT : public TBBase
-+{
-+public:
-+ SRECT() : left(0), top(0), right(0), bottom(0) {}
-+ sal_Int16 left;
-+ sal_Int16 top;
-+ sal_Int16 right;
-+ sal_Int16 bottom;
-+ bool Read( SvStream* pS ) { *pS >> left >> top >> right >> bottom; return true; }
-+ void Print( FILE* fo );
-+};
-+
-+typedef cppu::WeakImplHelper1< css::container::XIndexContainer > PropertyValueIndexContainer_BASE;
-+
-+class MSFILTER_DLLPUBLIC TBVisualData : public TBBase
-+{
-+ sal_Int8 tbds;
-+ sal_Int8 tbv;
-+ sal_Int8 tbdsDock;
-+ sal_Int8 iRow;
-+
-+ SRECT rcDock;
-+ SRECT rcFloat;
-+
-+public:
-+ TBVisualData();
-+ ~TBVisualData(){}
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+};
-+#endif
-diff --git filter/inc/filter/msfilter/svxmsbas.hxx filter/inc/filter/msfilter/svxmsbas.hxx
-index 3a945fe..a619c99 100644
---- filter/inc/filter/msfilter/svxmsbas.hxx
-+++ filter/inc/filter/msfilter/svxmsbas.hxx
-@@ -32,6 +32,8 @@
- #include "filter/msfilter/msfilterdllapi.h"
-
- #include <sot/storage.hxx>
-+#include <map>
-+#include <hash_map>
-
- class SfxObjectShell;
-
-@@ -50,6 +52,12 @@ class SfxObjectShell;
- * probably what the user expects to see when viewing the code
- */
-
-+typedef std::hash_map< sal_Int32, String > ObjIdToName;
-+
-+typedef std::map< String, ObjIdToName > ControlAttributeInfo;
-+
-+class VBA_Impl;
-+
- class MSFILTER_DLLPUBLIC SvxImportMSVBasic
- {
- public:
-@@ -76,23 +84,31 @@ public:
-
- // check if the MS-VBA-Storage exist in the RootStorage of the DocShell.
- // If it exist, then return the WarningId for loosing the information.
-+
-+ const ControlAttributeInfo& ControlNameForObjectId(){ return m_ModuleNameToObjIdHash; }
- static ULONG GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocS );
-
- static String GetMSBasicStorageName();
-+ rtl::OUString GetVBAProjectName() { return msProjectName; }
- private:
- SotStorageRef xRoot;
- SfxObjectShell &rDocSh;
- BOOL bImport;
- BOOL bCopy;
-+ ControlAttributeInfo m_ModuleNameToObjIdHash;
-+ MSFILTER_DLLPRIVATE void extractAttribute( const String& rAttribute, const String& rModName );
-
- MSFILTER_DLLPRIVATE BOOL ImportCode_Impl( const String& rStorageName,
- const String &rSubStorageName,
- const std::vector< String >& codeNames,
- BOOL bAsComment, BOOL bStripped);
- MSFILTER_DLLPRIVATE bool ImportForms_Impl(const String& rStorageName,
-- const String &rSubStorageName);
-+ const String &rSubStorageName, BOOL bVBAMode);
- MSFILTER_DLLPRIVATE BOOL CopyStorage_Impl( const String& rStorageName,
- const String &rSubStorageName);
-+ rtl::OUString msProjectName;
-+ MSFILTER_DLLPRIVATE BOOL ImportCode_Impl( VBA_Impl&, const std::vector< String >&, BOOL, BOOL );
-+ MSFILTER_DLLPRIVATE bool ImportForms_Impl( VBA_Impl&, const String&, const String&, BOOL);
- };
-
- #endif
-diff --git filter/source/msfilter/eschesdo.cxx filter/source/msfilter/eschesdo.cxx
-index ed82269..e8fe184 100644
---- filter/source/msfilter/eschesdo.cxx
-+++ filter/source/msfilter/eschesdo.cxx
-@@ -244,6 +244,19 @@ UINT32 ImplEESdrWriter::ImplWriteShape( ImplEESdrObject& rObj,
- // #i51348# shape name
- if( aShapeName.Len() > 0 )
- aPropOpt.AddOpt( ESCHER_Prop_wzName, aShapeName );
-+ if ( InteractionInfo* pInteraction = mpHostAppData->GetInteractionInfo() )
-+ {
-+ const std::auto_ptr< SvMemoryStream >& pMemStrm = pInteraction->getHyperlinkRecord();
-+ if ( pMemStrm.get() )
-+ {
-+ pMemStrm->ObjectOwnsMemory( FALSE );
-+ sal_uInt8* pBuf = (sal_uInt8*) pMemStrm->GetData();
-+ sal_uInt32 nSize = pMemStrm->Seek( STREAM_SEEK_TO_END );
-+ aPropOpt.AddOpt( ESCHER_Prop_pihlShape, sal_False, nSize, pBuf, nSize );;
-+ }
-+ if ( pInteraction->hasInteraction() )
-+ aPropOpt.AddOpt( ESCHER_Prop_fPrint, 0x00080008 );
-+ }
-
- if ( rObj.GetType().EqualsAscii( "drawing.Custom" ) )
- {
-diff --git filter/source/msfilter/makefile.mk filter/source/msfilter/makefile.mk
-index 7780529..c59a126 100644
---- filter/source/msfilter/makefile.mk
-+++ filter/source/msfilter/makefile.mk
-@@ -53,6 +53,7 @@ SLOFILES= \
- $(SLO)$/svdfppt.obj \
- $(SLO)$/svxmsbas2.obj \
- $(SLO)$/msvbahelper.obj \
-+ $(SLO)$/mstoolbar.obj\
-
- SHL1TARGET= msfilter$(DLLPOSTFIX)
- SHL1IMPLIB= i$(TARGET)
-@@ -61,6 +62,7 @@ SHL1USE_EXPORTS=name
- SHL1STDLIBS= \
- $(EDITENGLIB) \
- $(SVXCORELIB) \
-+ $(SVTOOLLIB) \
- $(SFX2LIB) \
- $(XMLOFFLIB) \
- $(BASEGFXLIB) \
-diff --git filter/source/msfilter/msocximex.cxx filter/source/msfilter/msocximex.cxx
-index 0391c5c..3405ad4 100644
---- filter/source/msfilter/msocximex.cxx
-+++ filter/source/msfilter/msocximex.cxx
-@@ -46,6 +46,10 @@
- #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
- #include <com/sun/star/form/XFormsSupplier.hpp>
- #include <com/sun/star/form/XForm.hpp>
-+#include <com/sun/star/form/binding/XBindableValue.hpp>
-+#include <com/sun/star/form/binding/XValueBinding.hpp>
-+#include <com/sun/star/form/binding/XListEntrySink.hpp>
-+#include <com/sun/star/form/binding/XListEntrySource.hpp>
- #include <com/sun/star/form/FormComponentType.hpp>
- #include <com/sun/star/awt/FontWeight.hpp>
- #include <com/sun/star/awt/FontSlant.hpp>
-@@ -70,7 +74,22 @@
- #include <com/sun/star/ucb/XSimpleFileAccess.hpp>
- #include <algorithm>
- #include <memory>
--
-+#include <com/sun/star/graphic/GraphicObject.hpp>
-+#include <com/sun/star/graphic/XGraphicProvider.hpp>
-+#include <com/sun/star/graphic/XGraphic.hpp>
-+#include <com/sun/star/io/XInputStream.hpp>
-+#include <comphelper/componentcontext.hxx>
-+#include <unotools/streamwrap.hxx>
-+
-+#include <com/sun/star/beans/NamedValue.hpp>
-+#include <com/sun/star/table/XCellRange.hpp>
-+#include <com/sun/star/table/CellRangeAddress.hpp>
-+#include <com/sun/star/table/CellAddress.hpp>
-+#include <com/sun/star/sheet/XSpreadsheetView.hpp>
-+#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
-+#include <com/sun/star/sheet/XCellRangeReferrer.hpp>
-+#include <svtools/filterutils.hxx>
-+
- #ifndef C2S
- #define C2S(cChar) String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(cChar))
- #endif
-@@ -84,6 +103,7 @@ using namespace cppu;
-
-
- #define WW8_ASCII2STR(s) String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(s))
-+#define GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:"
-
-
- static char sWW8_form[] = "WW-Standard";
-@@ -112,126 +132,48 @@ long ReadAlign(SvStorageStream *pS, long nPos, int nAmount)
- return 0;
- }
-
--
- // NP - Images in controls in OO2.0/SO8 exist as links, e.g. they are not part of the document so are
- // referenced externally. On import from ms document try to save images for controls here.
- // Images are stored in directory called temp in the user installation directory. Next version of OO/SO
- // hopefully will address this issue and allow a choice e.g. images for controls to be stored as links
- // or embeded in the document.
--
--// [out]location path to the stream to where the image is to be stored,
--// if same name exists in folder then this function calcuates a new name
--// [in] data raw bytes of image to be stored.
--// [in] dataLen no. byte to be stored
--//
--// returns, true if successful
--
--bool storePictureInFileSystem( OUString& location, sal_uInt8* data, sal_uInt32 dataLen )
--{
-- bool result = true;
-- OUString origPath = location;
-- try
-- {
-- uno::Reference<lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(),
-- uno::UNO_QUERY_THROW );
-- uno::Reference< com::sun::star::ucb::XSimpleFileAccess> xSFA( xMSF->createInstance(
-- S2U("com.sun.star.ucb.SimpleFileAccess" ) ),
-- uno::UNO_QUERY_THROW );
-- OUString ext;
-- sal_Int32 index = 0;
-- while ( xSFA->exists( location ) )
-- {
-- ext = OUString::valueOf( ++index );
-- location = origPath + ext;
-- }
--
-- SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( location, STREAM_WRITE | STREAM_TRUNC );
-- if ( pStream )
-- {
-- pStream->Write(data, dataLen);
-- delete pStream;
-- }
-- else
-- {
-- result = false;
-- }
-- }
-- catch( uno::Exception& )
-- {
-- result = false;
-- }
-- return result;
-+uno::Reference< graphic::XGraphicObject> lcl_readGraphicObject( SotStorageStream *pS )
-+{
-+ uno::Reference< graphic::XGraphicObject > xGrfObj;
-+ uno::Reference< lang::XMultiServiceFactory > xServiceManager = ::comphelper::getProcessServiceFactory();
-+ if( xServiceManager.is() )
-+ {
-+ try
-+ {
-+ // use the GraphicProvider service to get the XGraphic
-+ uno::Reference< graphic::XGraphicProvider > xGraphProvider(
-+ xServiceManager->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.graphic.GraphicProvider" ) ), uno::UNO_QUERY );
-+ if( xGraphProvider.is() )
-+ {
-+ uno::Reference< io::XInputStream > xStream( new utl::OInputStreamWrapper( *pS ) );
-+ if( xStream.is() )
-+ {
-+ uno::Sequence< beans::PropertyValue > aMediaProps( 1 );
-+ aMediaProps[0].Name = ::rtl::OUString::createFromAscii( "InputStream" );
-+ aMediaProps[0].Value <<= xStream;
-+ uno::Reference< graphic::XGraphic > xGraphic = xGraphProvider->queryGraphic( aMediaProps );
-+ if( xGraphic.is() )
-+ {
-+ // create an XGraphicObject
-+ ::comphelper::ComponentContext aContext( xServiceManager );
-+ xGrfObj = graphic::GraphicObject::create( aContext.getUNOContext() );
-+ xGrfObj->setGraphic(xGraphic);
-+ }
-+ }
-+ }
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+ }
-+ return xGrfObj;
- }
-
--// NP - Images in controls in OO2.0/SO8 exist as links, e.g. they are not part of the document so are
--// referenced externally. On import from ms document try to save images from controls here so this
--// at least a macro programmer has a chance to accessed them manually later. Next version of OO/SO
--// hopefully will address this issue.
--// Images will be stored in a top level folder in the document package, folder is named "MigratedImages"
--
--// [in] pDocSh* the document shell.
--// [in] name name of stream image to stored in.
--// [in] data raw bytes of image to be stored.
--// [in] dataLen no. byte to be stored
--
--bool storePictureInDoc( SfxObjectShell* pDocSh, OUString& name, sal_uInt8* data, sal_uInt32 dataLen )
--{
-- uno::Reference < embed::XStorage > xStor;
-- if (pDocSh)
-- {
-- xStor = pDocSh->GetStorage();
-- if( xStor.is() )
-- {
-- try
-- {
-- uno::Reference< embed::XStorage > xPictures = xStor->openStorageElement(
-- OUString( RTL_CONSTASCII_USTRINGPARAM( "MigratedImages" ) ),
-- embed::ElementModes::READWRITE );
-- uno::Reference< beans::XPropertySet > xPropSet( xPictures, uno::UNO_QUERY );
--
-- // Set media type of folder MigratedImages to something ( that is unknown ) so that
-- // it will get copied to exported OO/SO format after SaveAs
-- if ( xPropSet.is() )
-- {
-- OUString aMediaType = C2U("MigrationImages");
-- uno::Any a;
-- a <<= aMediaType;
-- xPropSet->setPropertyValue( C2U("MediaType"), a );
-- }
--
-- uno::Reference< io::XStream > xObjReplStr = xPictures->openStreamElement(
-- name,
-- embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE );
-- uno::Reference< io::XOutputStream > xOutStream( xObjReplStr->getOutputStream(), uno::UNO_QUERY_THROW );
-- uno::Sequence< sal_Int8 > imageBytes( (sal_Int8*)data, dataLen );
-- xOutStream->writeBytes( imageBytes );
-- xOutStream->closeOutput();
--
-- uno::Reference< embed::XTransactedObject > xTransact( xPictures, uno::UNO_QUERY );
-- if ( xTransact.is() )
-- {
-- xTransact->commit();
-- }
-- }
-- catch( uno::Exception& )
-- {
-- return false;
-- }
--
-- }
-- else
-- {
-- // no storage something wrong
-- return false;
-- }
-- }
-- else
-- {
-- //No doc shell
-- return false;
-- }
-- return true;
--}
-
- long WriteAlign(SvStorageStream *pS, int nAmount)
- {
-@@ -395,35 +337,11 @@ void lclReadCharArray( SvStorageStream& rStrm, char*& rpcCharArr, sal_uInt32 nLe
- */
- OUString lclCreateOUString( const char* pcCharArr, sal_uInt32 nLenFld )
- {
-- OUStringBuffer aBuffer;
- sal_uInt32 nBufSize = lclGetBufferSize( nLenFld );
- if( lclIsCompressed( nLenFld ) )
-- {
-- // buffer contains compressed Unicode, not encoded bytestring
-- sal_Int32 nStrLen = static_cast< sal_Int32 >( nBufSize );
-- aBuffer.setLength( nStrLen );
-- const char* pcCurrChar = pcCharArr;
-- for( sal_Int32 nChar = 0; nChar < nStrLen; ++nChar, ++pcCurrChar )
-- /* *pcCurrChar may contain negative values and therefore MUST be
-- casted to unsigned char, before assigned to a sal_Unicode. */
-- aBuffer.setCharAt( nChar, static_cast< unsigned char >( *pcCurrChar ) );
-- }
-- else
-- {
-- // buffer contains Little-Endian Unicode
-- sal_Int32 nStrLen = static_cast< sal_Int32 >( nBufSize ) / 2;
-- aBuffer.setLength( nStrLen );
-- const char* pcCurrChar = pcCharArr;
-- for( sal_Int32 nChar = 0; nChar < nStrLen; ++nChar )
-- {
-- /* *pcCurrChar may contain negative values and therefore MUST be
-- casted to unsigned char, before assigned to a sal_Unicode. */
-- sal_Unicode cChar = static_cast< unsigned char >( *pcCurrChar++ );
-- cChar |= (static_cast< unsigned char >( *pcCurrChar++ ) << 8);
-- aBuffer.setCharAt( nChar, cChar );
-- }
-- }
-- return aBuffer.makeStringAndClear();
-+ return svt::BinFilterUtils::CreateOUStringFromStringArray( pcCharArr, nBufSize );
-+
-+ return svt::BinFilterUtils::CreateOUStringFromUniStringArray( pcCharArr, nBufSize );
- }
-
- // export ---------------------------------------------------------------------
-@@ -543,8 +461,129 @@ const sal_uInt16 TOGGLEBUTTON = (sal_uInt16)0x1C;
- const sal_uInt16 SCROLLBAR = (sal_uInt16)0x2F;
-
- const sal_uInt16 MULTIPAGE = (sal_uInt16)0x39;
-+// The IDs with bit 0x8000 set appear to be generated.
-+// It looks like these ID's are used with the non-toolbox [1]
-+// ActiveX controls that can be present in a Userform
-+// ( note: RefEdit seems to be an exception )
-+// In UserForm::Read just before the Container record starts
-+// you will notice there can be sometimes trailing records,
-+// it seems that these records have a 1:1 relationship with the non-toolbox
-+// controls present in the Userform. An id in the trailing record
-+// seems to identify the specific ActiveX control and an artificial nTypeIdent
-+// e.g. 0x8000, 0x8001 etc. is created so as to be able to associate
-+// the ActiveX control when referenced later
-+// [1] Such ActiveX controls are added via Tools/AddionalControls
-+// menu
-+
-+// create a fixed set of those special id(s)
-+// ahem, we can only read one Progress bars at the moment so....
- const sal_uInt16 PROGRESSBAR = (sal_uInt16)0x8000;
-
-+// A set of IDs from the trailing records mentioned above that seem to
-+// identify the following ActiveX controls
-+// Currently we only can process ( in a limited way ) the ProgressBar
-+// the other ID's are for reference ( & future )
-+
-+// RefEdit control {00024512-0000-0000-c000-000000000046}
-+const sal_uInt8 aRefEditID[] =
-+{
-+0x12, 0x45, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46,
-+};
-+
-+// Microsoft ProgressBar Control, version 6.0 {35053A22-8589-11D1-B16A-00C0F0283628}
-+const sal_uInt8 aProgressID[] =
-+{
-+0x22, 0x3a, 0x05, 0x35, 0x89, 0x85, 0xd1, 0x11, 0xb1, 0x6a, 0x00, 0xc0, 0xf0, 0x28, 0x36, 0x28,
-+};
-+
-+// Calendar Control 10.0
-+const sal_uInt8 aCalendarID[] =
-+{
-+0x2b, 0xc9, 0x27, 0x8e, 0x64, 0x12, 0x1c, 0x10, 0x8a, 0x2f, 0x04, 0x02, 0x24, 0x00, 0x9c, 0x02,
-+};
-+
-+
-+// Microsoft ImageComboxBox Control, version 6.0 {DD9DA666-8594-11D1-B16A-00C0F0283628}
-+const sal_uInt8 aImageComboID[] =
-+{
-+0x66, 0xa6, 0x9d, 0xdd, 0x94, 0x85, 0xd1, 0x11, 0xb1, 0x6a, 0x00, 0xc0, 0xf0, 0x28, 0x36, 0x28,
-+};
-+
-+// Microsoft ImageList Control, version 6.0 {2C247F23-8591-11D1-B16A-00C0F0283628}
-+const sal_uInt8 aImageListID[] =
-+{
-+0x23, 0x7f, 0x24, 0x2c, 0x91, 0x85, 0xd1, 0x11, 0xb1, 0x6a, 0x00, 0xc0, 0xf0, 0x28, 0x36, 0x28,
-+};
-+
-+// Microsoft Slider Control, version 6.0 {F08DF954-8592-11D1-B16A-00C0F0283628}
-+const sal_uInt8 aSliderID[] =
-+{
-+0x54, 0xf9, 0x8d, 0xf0, 0x92, 0x85, 0xd1, 0x11, 0xb1, 0x6a, 0x00, 0xc0, 0xf0, 0x28, 0x36, 0x28,
-+};
-+
-+// Microsoft StatusBar Control, version 6.0 {8E3867A3-8586-11D1-B16A-00C0F0283628}
-+const sal_uInt8 aStatusBarID[] =
-+{
-+0xa3, 0x67, 0x38, 0x8e, 0x86, 0x85, 0xd1, 0x11, 0xb1, 0x6a, 0x00, 0xc0, 0xf0, 0x28, 0x36, 0x28,
-+};
-+
-+// Microsoft Office Chart 10.0
-+const sal_uInt8 aChartSpaceID[] =
-+{
-+0x46, 0xe5, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46,
-+};
-+
-+const sal_Int16 ActiveXIDLen = 0x10; // CLSID len
-+const sal_Int16 ActiveXIDBlockLen = 0x30; // the block len that contains the CLSID
-+
-+bool lcl_handleActiveXControl( SvStorageStream *pS, sal_uInt16& nTypeID )
-+{
-+ nTypeID = 0; // Illegal ActiveX ID
-+ bool bRes = false;
-+ sal_uInt16 nIdentifier, nFixedAreaLen;
-+ *pS >> nIdentifier;
-+ *pS >> nFixedAreaLen;
-+ pS->SeekRel( ( nFixedAreaLen - ActiveXIDBlockLen ) );
-+ sal_uInt8 aID[ ActiveXIDLen ];
-+ if ( !pS->IsEof() )
-+ {
-+ pS->Read( aID, ActiveXIDLen );
-+ pS->SeekRel( ActiveXIDBlockLen - ActiveXIDLen ); // read remainer of record
-+ if ( memcmp( aID, aProgressID, ActiveXIDLen ) == 0 )
-+ {
-+ nTypeID = PROGRESSBAR;
-+ OSL_TRACE("Found supported ***PROGRESSBAR*** ActiveX control");
-+ bRes = true;
-+ }
-+#if (OSL_DEBUG_LEVEL > 0)
-+ // If we really want to process these more controls we should put them in
-+ // a list or array and have a single loop testing each id. For the moment
-+ // as we only can process PROGRESSBAR, not much point doing that until
-+ // we add support for at least another activex control
-+
-+ else if ( memcmp( aID, aCalendarID, ActiveXIDLen ) == 0 )
-+ OSL_TRACE("Found unsupported ***CALENDAR*** ActiveX control");
-+ else if ( memcmp( aID, aRefEditID, ActiveXIDLen ) == 0 )
-+ OSL_TRACE("Found unsupported ***REFEDIT*** ActiveX control");
-+ else if ( memcmp( aID, aImageComboID, ActiveXIDLen ) == 0 )
-+ OSL_TRACE("Found unsupported ***IMAGECOMBO*** ActiveX control");
-+ else if ( memcmp( aID, aImageListID, ActiveXIDLen ) == 0 )
-+ OSL_TRACE("Found unsupported ***IMAGELIST*** ActiveX control");
-+ else if ( memcmp( aID, aChartSpaceID, ActiveXIDLen ) == 0 )
-+ OSL_TRACE("Found unsupported ***CHARTSPACE*** ActiveX control");
-+ else if ( memcmp( aID, aSliderID, ActiveXIDLen ) == 0 )
-+ OSL_TRACE("Found unsupported ***SLIDER*** ActiveX control");
-+ else if ( memcmp( aID, aStatusBarID, ActiveXIDLen ) == 0 )
-+ OSL_TRACE("Found unsupported ***STATUSBAR*** ActiveX control");
-+#endif
-+ else
-+ {
-+ OSL_TRACE("Unknown activeX ID !");
-+ }
-+ }
-+ return bRes;
-+}
-+
- typedef std::vector< ContainerRecord > ContainerRecordList;
-
- class ContainerRecReader
-@@ -619,6 +658,8 @@ class ContainerRecReader
- // control type
- if( nContentFlags & 0x00000080 )
- *pS >> rec.nTypeIdent;
-+ if( nContentFlags & 0x00000200 )
-+ pS->SeekRel( 4 ); // Grouping?
- // length of infotip
- sal_uInt32 nTipLen = 0;
- if( nContentFlags & 0x00000800 )
-@@ -693,14 +734,22 @@ class ContainerRecReader
- if( nCtrlSrcBufSize > 0 )
- {
- ReadAlign( pS, pS->Tell() - nStartPos, 4 );
-- pS->SeekRel( nCtrlSrcBufSize );
-+ std::auto_ptr< sal_Char > pCtrlSrcName;
-+ pCtrlSrcName.reset( new sal_Char[ nCtrlSrcBufSize ] );
-+ pS->Read( pCtrlSrcName.get(), nCtrlSrcBufSize );
-+ rec.sCtrlSource = lclCreateOUString( pCtrlSrcName.get(), nCtrlSrcLen );
-+ OSL_TRACE("*** *** *** ControlSourceName -> %s ", rtl::OUStringToOString( rec.sCtrlSource, RTL_TEXTENCODING_UTF8 ).getStr() );
- }
- // row source name
- sal_uInt32 nRowSrcBufSize = lclGetBufferSize( nRowSrcLen );
- if( nRowSrcBufSize > 0 )
- {
- ReadAlign( pS, pS->Tell() - nStartPos, 4 );
-- pS->SeekRel( nRowSrcBufSize );
-+ std::auto_ptr< sal_Char > pRowSrcName;
-+ pRowSrcName.reset( new sal_Char[ nRowSrcBufSize ] );
-+ pS->Read( pRowSrcName.get(), nRowSrcBufSize );
-+ rec.sRowSource = lclCreateOUString( pRowSrcName.get(), nRowSrcLen );
-+ OSL_TRACE("*** *** *** RowSourceName -> %s ", rtl::OUStringToOString( rec.sRowSource, RTL_TEXTENCODING_UTF8 ).getStr() );
- }
-
- // seek to end of data
-@@ -717,6 +766,13 @@ class ContainerRecReader
- pControl->pDocSh = pContainerControl->pDocSh;
- pContainerControl->ProcessControl( pControl, pS, rec );
- }
-+ else if ( rec.nTypeIdent & 0x8000 )
-+ {
-+ // Skip ActiveX Controls we can't import
-+ SotStorageStreamRef oStream = pContainerControl->getContainedControlsStream();
-+ ULONG nStrmPos = oStream->Tell();
-+ oStream->Seek( nStrmPos + rec.nSubStreamLen );
-+ }
- else
- {
- DBG_ERROR("Terminating import, unexpected error");
-@@ -737,6 +793,11 @@ class ContainerRecReader
- {
- sal_uInt8 aUnknown11[4];
- pS->Read(aUnknown11, sizeof(aUnknown11));
-+ // discovered a dialog with value of 0xFF for aUnknown11
-+ // needed an extra 4 bytes to offset correctly into the control
-+ // records. Valid test or coincidence ?
-+ if ( aUnknown11[1] == 0xFF )
-+ pS->Read( aUnknown11, sizeof(aUnknown11));
- return true;
- }
-
-@@ -811,176 +872,6 @@ class ContainerRecordReaderFac
-
- // ============================================================================
-
--void RBGroup::add(OCX_Control* pRB)
--{
-- // The tab index for the group is calculated as
-- // the lowest tab index found in the list of RadioButtons
-- if ( pRB->mnTabPos < mRBGroupPos )
-- {
-- mRBGroupPos = pRB->mnTabPos;
-- CtrlIterator aEnd = mpControls.end();
-- for (CtrlIterator aIter = mpControls.begin(); aIter != aEnd; ++ aIter )
-- {
-- (*aIter)->mnTabPos = mRBGroupPos;
-- }
-- }
-- mpControls.push_back( pRB );
--}
--
--struct SortGroupByTabPos
--{
-- bool operator()( const RBGroup* a, const RBGroup* b )
-- {
-- return a->tabPos() < b->tabPos();
-- }
--};
--
--RBGroupManager::RBGroupManager( String& defaultName ):mSDefaultName( defaultName ),
-- numRadioButtons(0)
--{
-- groupList.reserve( 8 ); // reserve far more than we expect
--}
--
--RBGroupManager::~RBGroupManager()
--{
-- for ( GroupIterator gIter=groupList.begin(); gIter!=groupList.end(); ++gIter )
-- {
-- delete( *gIter );
-- }
--}
--
--// Loose description of the method below ( I sure there is a better way to do
--// this )
--// In order to "fake" MS grouping behavior for OptionButtons the OptionButtons
--// in the same group need to have consecutive tab indices ( regardless of the
--// imported tab indices of the RadioButtons ). Additionally if two
--// groups of OptionButtons end up having all consecutive indices they
--// will be treated as a single group by OpenOffice. In this case
--// a dummy seperator control needs to be inserted between the groups.
--//
--// This method returns a new list "destinationList" containing the controls
--// passed in "sourceList" and the OptionButtons contained in the various
--// Groups maintained by this class.
--// Controls are ordered in the destination list by tab index.
--// Each RadioButtonGroup has a tab index associated with it.
--// ( Tab index of a RadioGroup is determined as the tab index of the
--// OptionButton control with the lowest tab index in the group )
--
--
--void RBGroupManager::addRadioButton( OCX_OptionButton* pRButton )
--{
-- if ( pRButton )
-- {
-- OUString groupName = mSDefaultName;
-- if ( pRButton->nGroupNameLen )
-- {
-- groupName =
-- lclCreateOUString(pRButton->pGroupName,
-- pRButton->nGroupNameLen);
-- }
-- ++numRadioButtons;
-- RBGroupHash::iterator iter = rbGroups.find( groupName );
-- if ( iter != rbGroups.end() )
-- {
-- iter->second->controls().push_back( pRButton );
-- }
-- else
-- {
-- RBGroup* newGroup = new RBGroup(pRButton->mnTabPos);
-- newGroup->controls().push_back( pRButton );
-- rbGroups[ groupName ] = newGroup;
-- groupList.push_back( newGroup );
-- }
--
-- }
--}
--
--CtrlList RBGroupManager::insertGroupsIntoControlList( const CtrlList& sourceList )
--{
-- ::std::sort( groupList.begin(), groupList.end(), SortGroupByTabPos() );
-- std::vector<OCX_Control*> destinationList;
-- if ( groupList.size() )
-- {
-- destinationList.reserve( sourceList.size() + numRadioButtons );
--
-- GroupIterator groupEnd = groupList.end();
-- CtrlIteratorConst sourceEnd = sourceList.end();
--
-- size_t prevGroupListSize = 0;
--
-- CtrlIteratorConst containees = sourceList.begin();
-- GroupIterator groupIter=groupList.begin();
-- while ( containees != sourceEnd ||
-- groupIter != groupEnd )
-- {
-- bool addGroupSeperator = false;
-- if ( containees != sourceEnd )
-- {
-- if ( groupIter != groupEnd )
-- {
-- sal_Int16 groupTabPos = (*groupIter)->tabPos();
-- if ( (*containees)->mnTabPos >= groupTabPos )
-- {
-- if ( !(destinationList.size() >= prevGroupListSize ))
-- {
-- addGroupSeperator = true;
-- }
-- copyList( (*groupIter)->controls(), destinationList, addGroupSeperator );
-- ++groupIter;
--
-- prevGroupListSize = destinationList.size();
-- }
-- }
-- destinationList.push_back(*containees);
-- ++containees;
-- }
-- else
-- {
-- if ( groupIter != groupEnd )
-- {
-- if ( !(destinationList.size() > prevGroupListSize ))
-- {
-- addGroupSeperator = true;
-- }
-- copyList( (*groupIter)->controls(), destinationList, addGroupSeperator );
-- ++groupIter;
-- prevGroupListSize = destinationList.size();
-- }
-- }
-- }
-- }
-- else
-- {
-- destinationList = sourceList;
-- }
-- return destinationList;
--
--}
--
--
--void RBGroupManager::addSeperator( std::vector< OCX_Control* >& dest )
--{
-- OCX_Control* seperator = new OCX_CommandButton;
-- seperator->SetInDialog(true);
-- seperator->sName = C2S("GroupSeperator");
-- dest.push_back( seperator );
--}
--
--void RBGroupManager::copyList( std::vector< OCX_Control* >& src,
-- std::vector< OCX_Control* >& dest,
-- bool addGroupSeperator )
--{
-- if ( addGroupSeperator )
-- {
-- addSeperator( dest );
-- }
--
-- for ( CtrlIterator rbIter = src.begin(); rbIter != src.end(); ++rbIter )
-- {
-- dest.push_back( *rbIter );
-- }
--}
--
- class OCX_UserFormLabel : public OCX_Label
- {
- public:
-@@ -1147,6 +1038,9 @@ sal_Bool OCX_Control::Import(
- sal_Bool OCX_Control::Import(uno::Reference<container::XNameContainer> &rDialog
- )
- {
-+ uno::Reference<beans::XPropertySet > xDlgProps( rDialog, uno::UNO_QUERY);
-+
-+
- uno::Reference<lang::XMultiServiceFactory>
- xFactory(rDialog, uno::UNO_QUERY);
-
-@@ -1159,11 +1053,15 @@ sal_Bool OCX_Control::Import(uno::Reference<container::XNameContainer> &rDialog
- if (!xModel.is())
- return sal_False;
-
-+ sal_Bool bVBA = sal_False;
- /* #147900# sometimes insertion of a control fails due to existing name,
- do not break entire form import then... */
- try
- {
- rDialog->insertByName(sName, uno::makeAny(xModel));
-+ if ( xDlgProps.is() )
-+ xDlgProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("VBAForm") ) ) >>= bVBA;
-+
- }
- catch( uno::Exception& )
- {
-@@ -1179,16 +1077,31 @@ sal_Bool OCX_Control::Import(uno::Reference<container::XNameContainer> &rDialog
-
- if (!Import(xPropSet))
- return sal_False;
--
-+
- uno::Any aTmp;
-- aTmp <<= sal_Int32((mnLeft * 2) / 100);
-- xPropSet->setPropertyValue(WW8_ASCII2STR("PositionX"), aTmp);
-- aTmp <<= sal_Int32((mnTop * 2) / 100);
-- xPropSet->setPropertyValue(WW8_ASCII2STR("PositionY"), aTmp);
-- aTmp <<= sal_Int32((nWidth * 2) / 100);
-- xPropSet->setPropertyValue(WW8_ASCII2STR("Width"), aTmp);
-- aTmp <<= sal_Int32((nHeight * 2) / 100);
-- xPropSet->setPropertyValue(WW8_ASCII2STR("Height"), aTmp);
-+
-+ if ( !bVBA )
-+ {
-+ aTmp <<= sal_Int32((mnLeft * 2) / 100);
-+ xPropSet->setPropertyValue(WW8_ASCII2STR("PositionX"), aTmp);
-+ aTmp <<= sal_Int32((mnTop * 2) / 100);
-+ xPropSet->setPropertyValue(WW8_ASCII2STR("PositionY"), aTmp);
-+ aTmp <<= sal_Int32((nWidth * 2) / 100);
-+ xPropSet->setPropertyValue(WW8_ASCII2STR("Width"), aTmp);
-+ aTmp <<= sal_Int32((nHeight * 2) / 100);
-+ xPropSet->setPropertyValue(WW8_ASCII2STR("Height"), aTmp);
-+ }
-+ else
-+ {
-+ aTmp <<= sal_Int32(mnLeft); // 100thmm
-+ xPropSet->setPropertyValue(WW8_ASCII2STR("PositionX"), aTmp);
-+ aTmp <<= sal_Int32(mnTop); //100th mm
-+ xPropSet->setPropertyValue(WW8_ASCII2STR("PositionY"), aTmp);
-+ aTmp <<= sal_Int32(nWidth); // 100thmm
-+ xPropSet->setPropertyValue(WW8_ASCII2STR("Width"), aTmp);
-+ aTmp <<= sal_Int32(nHeight); //100th mm
-+ xPropSet->setPropertyValue(WW8_ASCII2STR("Height"), aTmp);
-+ }
- if ( msToolTip.Len() > 0 )
- xPropSet->setPropertyValue(WW8_ASCII2STR("HelpText"), uno::Any(OUString(msToolTip)));
-
-@@ -1403,6 +1316,12 @@ sal_Bool OCX_CommandButton::Import( com::sun::star::uno::Reference<
- rPropSet->setPropertyValue( WW8_ASCII2STR( "FocusOnClick" ), aTmp );
-
- aFontData.Import(rPropSet);
-+
-+ if ( sImageUrl.getLength() )
-+ {
-+ aTmp <<= sImageUrl;
-+ rPropSet->setPropertyValue( WW8_ASCII2STR("ImageURL"), aTmp);
-+ }
- return sal_True;
- }
-
-@@ -1650,6 +1569,99 @@ sal_Bool OCX_ImageButton::Export(SvStorageRef &rObj,
- return WriteContents(xContents,rPropSet,rSize);
- }
-
-+bool lcl_isNamedRange( const rtl::OUString& sAddress, uno::Reference< frame::XModel >& xModel, table::CellRangeAddress& aAddress )
-+{
-+ bool bRes = false;
-+ const static rtl::OUString sNamedRanges( RTL_CONSTASCII_USTRINGPARAM("NamedRanges"));
-+ uno::Reference< sheet::XCellRangeReferrer > xReferrer;
-+ try
-+ {
-+ uno::Reference< beans::XPropertySet > xPropSet( xModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XNameAccess > xNamed( xPropSet->getPropertyValue( sNamedRanges ), uno::UNO_QUERY_THROW );
-+ xReferrer.set ( xNamed->getByName( sAddress ), uno::UNO_QUERY );
-+ }
-+ catch( uno::Exception& /*e*/ )
-+ {
-+ // do nothing
-+ }
-+ if ( xReferrer.is() )
-+ {
-+ uno::Reference< sheet::XCellRangeAddressable > xRangeAddressable( xReferrer->getReferredCells(), uno::UNO_QUERY );
-+ if ( xRangeAddressable.is() )
-+ {
-+ aAddress = xRangeAddressable->getRangeAddress();
-+ bRes = true;
-+ }
-+ }
-+ return bRes;
-+}
-+
-+void lcl_ApplyListSourceAndBindableStuff( uno::Reference< frame::XModel >& xModel, const uno::Reference< beans::XPropertySet >& rPropSet, const rtl::OUString& rsCtrlSource, const rtl::OUString& rsRowSource )
-+{
-+// XBindable etc.
-+ uno::Reference< lang::XMultiServiceFactory > xFac;
-+ if ( xModel.is() )
-+ xFac.set( xModel, uno::UNO_QUERY );
-+ uno::Reference< form::binding::XBindableValue > xBindable( rPropSet, uno::UNO_QUERY );
-+ if ( xFac.is() && rsCtrlSource.getLength() && xBindable.is() )
-+ {
-+
-+ // OOo address structures
-+ // RefCell - convert from XL
-+ // pretend we converted the imported string address into the
-+ // appropriate address structure
-+ uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( C2U( "com.sun.star.table.CellAddressConversion" )), uno::UNO_QUERY );
-+ table::CellAddress aAddress;
-+ if ( xConvertor.is() )
-+ {
-+ // we need this service to properly convert XL notation also
-+ // Should be easy to extend
-+ xConvertor->setPropertyValue( C2U( "XL_A1_Representation" ), uno::makeAny( rsCtrlSource ) );
-+ xConvertor->getPropertyValue( C2U( "Address" ) ) >>= aAddress;
-+ }
-+
-+ beans::NamedValue aArg1;
-+ aArg1.Name = C2U("BoundCell");
-+ aArg1.Value <<= aAddress;
-+
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[ 0 ] <<= aArg1;
-+
-+ uno::Reference< form::binding::XValueBinding > xBinding( xFac->createInstanceWithArguments( C2U("com.sun.star.table.CellValueBinding" ), aArgs ), uno::UNO_QUERY );
-+ xBindable->setValueBinding( xBinding );
-+ }
-+ uno::Reference< form::binding::XListEntrySink > xListEntrySink( rPropSet, uno::UNO_QUERY );
-+ if ( xFac.is() && rsRowSource.getLength() && xListEntrySink.is() )
-+ {
-+
-+ // OOo address structures
-+ // RefCell - convert from XL
-+ // pretend we converted the imported string address into the
-+ // appropriate address structure
-+ uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( C2U( "com.sun.star.table.CellRangeAddressConversion" )), uno::UNO_QUERY );
-+ table::CellRangeAddress aAddress;
-+ if ( xConvertor.is() )
-+ {
-+ if ( !lcl_isNamedRange( rsRowSource, xModel, aAddress ) )
-+ {
-+ // we need this service to properly convert XL notation also
-+ // Should be easy to extend
-+ xConvertor->setPropertyValue( C2U( "XL_A1_Representation" ), uno::makeAny( rsRowSource ) );
-+ xConvertor->getPropertyValue( C2U( "Address" ) ) >>= aAddress;
-+ }
-+ }
-+
-+ beans::NamedValue aArg1;
-+ aArg1.Name = C2U("CellRange");
-+ aArg1.Value <<= aAddress;
-+
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[ 0 ] <<= aArg1;
-+
-+ uno::Reference< form::binding::XListEntrySource > xSource( xFac->createInstanceWithArguments( C2U("com.sun.star.table.CellRangeListSource" ), aArgs ), uno::UNO_QUERY );
-+ xListEntrySink->setListEntrySource( xSource );
-+ }
-+}
-
- sal_Bool OCX_OptionButton::Import(com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet> &rPropSet)
-@@ -1682,12 +1694,51 @@ sal_Bool OCX_OptionButton::Import(com::sun::star::uno::Reference<
- aTmp <<= ImportSpecEffect( nSpecialEffect );
- rPropSet->setPropertyValue( WW8_ASCII2STR("VisualEffect"), aTmp);
-
-- if (pValue && !bSetInDialog)
-+ if (pValue)
- {
- INT16 nTmp = pValue[0]-0x30;
- aTmp <<= nTmp;
-- rPropSet->setPropertyValue( WW8_ASCII2STR("DefaultState"), aTmp);
-- }
-+ if (!bSetInDialog)
-+ rPropSet->setPropertyValue( WW8_ASCII2STR("DefaultState"), aTmp);
-+ else
-+ {
-+ // dialog ( but we might be using the form model )
-+ if ( rPropSet->getPropertySetInfo()->hasPropertyByName( WW8_ASCII2STR("DefaultState") ) )
-+ rPropSet->setPropertyValue( WW8_ASCII2STR("DefaultState"), aTmp);
-+ else
-+ rPropSet->setPropertyValue( WW8_ASCII2STR("State"), aTmp);
-+ }
-+ }
-+ // If this is a dialog control then we need to set a groupname *always*
-+ rtl::OUString sGroupName = lclCreateOUString( pGroupName, nGroupNameLen );
-+ if ( GetInDialog() ) // Userform/Dialog
-+ {
-+ // By default groupnames are not set in Excel, it's not unusual to have
-+ // a number of groups of radiobuttons located inside frame ( or other container
-+ // controls ) where there is *no* specific groupname set for the radiobuttons.
-+ // But... there is implicit grouping for radio buttons in seperate containers
-+ // e.g. radio buttons in a frame are by default in the same group.
-+ // Unfortunately in openoffice there are no containers below the dialog itself :-(
-+ // To ensure correct grouping for imported radiobuttons either with no groupname
-+ // or identical groupnames that are in separate containers we *must* ensure
-+ // that a suitable groupname is applied.
-+ // Because controlNames are unique even across different containers we can use the
-+ // controls container (e.g. parent) name as a prefix for a group name
-+ rtl::OUString sParentName = msParentName;
-+ sGroupName = sParentName.concat( C2U( ":" ) ).concat( sGroupName );
-+ }
-+ if ( sGroupName.getLength() == 0 )
-+ sGroupName = rtl::OUString::createFromAscii("DefaultGroup");
-+ OSL_TRACE("RadioButton %s has groupname %s",
-+ rtl::OUStringToOString( sName, RTL_TEXTENCODING_UTF8 ).getStr(), rtl::OUStringToOString( sGroupName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ try
-+ {
-+ aTmp <<= sGroupName;
-+ rPropSet->setPropertyValue( WW8_ASCII2STR("GroupName"), aTmp);
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-
- if (pCaption)
- {
-@@ -1699,6 +1750,14 @@ sal_Bool OCX_OptionButton::Import(com::sun::star::uno::Reference<
- aTmp <<= ::com::sun::star::style::VerticalAlignment_MIDDLE;
- rPropSet->setPropertyValue( WW8_ASCII2STR("VerticalAlign"), aTmp );
-
-+ uno::Reference< frame::XModel > xModel ( pDocSh ? pDocSh->GetModel() : NULL );
-+ lcl_ApplyListSourceAndBindableStuff( xModel, rPropSet, msCtrlSource, msRowSource );
-+ if ( sImageUrl.getLength() )
-+ {
-+ aTmp <<= sImageUrl;
-+ rPropSet->setPropertyValue( WW8_ASCII2STR("ImageURL"), aTmp);
-+ }
-+
- aFontData.Import(rPropSet);
- return sal_True;
- }
-@@ -2323,8 +2382,9 @@ sal_Bool OCX_ToggleButton::Import(com::sun::star::uno::Reference<
- if (pValue)
- {
- INT16 nTmp=pValue[0]-0x30;
-- aTmp <<= nTmp == 1;
-- rPropSet->setPropertyValue( WW8_ASCII2STR("DefaultState"), aTmp);
-+ //aTmp <<= nTmp == 1;
-+ aTmp <<= nTmp;
-+ rPropSet->setPropertyValue( WW8_ASCII2STR("State"), aTmp);
- }
-
- if (pCaption)
-@@ -2334,6 +2394,12 @@ sal_Bool OCX_ToggleButton::Import(com::sun::star::uno::Reference<
- }
-
- aFontData.Import(rPropSet);
-+
-+ if ( sImageUrl.getLength() )
-+ {
-+ aTmp <<= sImageUrl;
-+ rPropSet->setPropertyValue( WW8_ASCII2STR("ImageURL"), aTmp);
-+ }
- return sal_True;
- }
-
-@@ -2589,6 +2655,8 @@ sal_Bool OCX_ComboBox::Import(com::sun::star::uno::Reference<
- rPropSet->setPropertyValue( WW8_ASCII2STR("MaxTextLen"), aTmp);
-
- aFontData.Import(rPropSet);
-+ uno::Reference< frame::XModel > xModel ( pDocSh ? pDocSh->GetModel() : NULL );
-+ lcl_ApplyListSourceAndBindableStuff( xModel, rPropSet, msCtrlSource, msRowSource );
- return sal_True;
- }
-
-@@ -2808,7 +2876,8 @@ sal_Bool OCX_ListBox::Import(com::sun::star::uno::Reference<
-
- aTmp <<= ImportColor( nBorderColor );
- rPropSet->setPropertyValue( WW8_ASCII2STR("BorderColor"), aTmp);
--
-+ uno::Reference< frame::XModel > xModel ( pDocSh ? pDocSh->GetModel() : NULL );
-+ lcl_ApplyListSourceAndBindableStuff( xModel, rPropSet, msCtrlSource, msRowSource );
- aFontData.Import(rPropSet);
- return sal_True;
- }
-@@ -3186,8 +3255,15 @@ sal_Bool OCX_ModernControl::Read(SvStorageStream *pS)
- {
- pS->Read(pPictureHeader,20);
- *pS >> nPictureLen;
-- pPicture = new sal_uInt8[nPictureLen];
-- pS->Read(pPicture,nPictureLen);
-+ long imagePos = pS->Tell();
-+ mxGrfObj = lcl_readGraphicObject( pS );
-+ if( mxGrfObj.is() )
-+ {
-+ sImageUrl = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( GRAPHOBJ_URLPREFIX ) );
-+ sImageUrl = sImageUrl + mxGrfObj->getUniqueID();
-+ }
-+ // make sure the stream position should be pointing after the image
-+ pS->Seek( imagePos + nPictureLen );
- }
-
- return sal_True;
-@@ -3277,8 +3353,15 @@ sal_Bool OCX_CommandButton::Read(SvStorageStream *pS)
- {
- pS->Read(pPictureHeader,20);
- *pS >> nPictureLen;
-- pPicture = new sal_uInt8[nPictureLen];
-- pS->Read(pPicture,nPictureLen);
-+ long imagePos = pS->Tell();
-+ mxGrfObj = lcl_readGraphicObject( pS );
-+ if( mxGrfObj.is() )
-+ {
-+ sImageUrl = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( GRAPHOBJ_URLPREFIX ) );
-+ sImageUrl = sImageUrl + mxGrfObj->getUniqueID();
-+ }
-+ // make sure the stream position should be pointing after the image
-+ pS->Seek( imagePos + nPictureLen );
- }
-
- return sal_True;
-@@ -3399,7 +3482,7 @@ OCX_ContainerControl::OCX_ContainerControl( SotStorageRef& parent,
- const ::rtl::OUString& sN,
- const uno::Reference< container::XNameContainer > &rParent,
- OCX_Control* pParent ) :
-- OCX_Control(sN, pParent), rbGroupMgr( sName ), mxParent(rParent), nNoRecords(0), nTotalLen(0), containerType( STDCONTAINER )
-+ OCX_Control(sN, pParent), mxParent(rParent), nNoRecords(0), nTotalLen(0), containerType( STDCONTAINER )
- {
-
- mContainerStorage = parent->OpenSotStorage(storageName,
-@@ -3462,9 +3545,18 @@ OUString OCX_ContainerControl::createSubStreamName( const sal_uInt32& subStorage
- return buf.makeStringAndClear();
- }
-
--bool OCX_ContainerControl::createFromContainerRecord( const ContainerRecord& record, OCX_Control*& pControl )
-+
-+bool OCX_ContainerControl::createFromContainerRecord( ContainerRecord& record, OCX_Control*& pControl )
- {
- pControl = NULL;
-+ if ( record.nTypeIdent & 0x8000 )
-+ {
-+ std::hash_map<sal_uInt16, sal_uInt16>::iterator it = mActiveXIDMap.find( record.nTypeIdent );
-+ if ( it == mActiveXIDMap.end() )
-+ return false;
-+ // replace the generated id with our hardcoded one
-+ record.nTypeIdent = it->second;
-+ }
- switch ( record.nTypeIdent)
- {
- case CMDBUTTON:
-@@ -3572,8 +3664,7 @@ void OCX_ContainerControl::ProcessControl(OCX_Control* pControl,SvStorageStream*
- SotStorageStreamRef oStream = mContainedControlsStream;
-
- // can insert into OO Dialog (e.g is this a supported dialog control)??
-- if ( rec.nTypeIdent == SPINBUTTON ||
-- rec.nTypeIdent == TABSTRIP)
-+ if ( rec.nTypeIdent == TABSTRIP )
- {
- // skip the record in the stream, discard the control
- oStream->SeekRel( rec.nSubStreamLen );
-@@ -3583,15 +3674,27 @@ void OCX_ContainerControl::ProcessControl(OCX_Control* pControl,SvStorageStream*
- {
- // A container control needs to read the f stream in
- // the folder ( substorage ) associated with this control
-- if ( rec.nTypeIdent == FRAME ||
-- rec.nTypeIdent == MULTIPAGE||
-- rec.nTypeIdent == PAGE )
-+ switch ( rec.nTypeIdent )
- {
-- OCX_ContainerControl* pContainer =
-- static_cast< OCX_ContainerControl* >( pControl );
-- oStream = pContainer->getContainerStream();
-+ case FRAME:
-+ case MULTIPAGE:
-+ case PAGE:
-+ {
-+ OCX_ContainerControl* pContainer =
-+ static_cast< OCX_ContainerControl* >( pControl );
-+ oStream = pContainer->getContainerStream();
-+ break;
-+ }
-+ case LISTBOX:
-+ case OPTIONBUTTON:
-+ case COMBOBOX:
-+ case SPINBUTTON:
-+ case SCROLLBAR:
-+ {
-+ pControl->msCtrlSource = rec.sCtrlSource;
-+ pControl->msRowSource = rec.sRowSource;
-+ }
- }
--
- pControl->sName = rec.cName;
- pControl->msToolTip = rec.controlTip;
- // Position of controls is relative to the container
-@@ -3611,6 +3714,7 @@ void OCX_ContainerControl::ProcessControl(OCX_Control* pControl,SvStorageStream*
- // applied to all containees
- pControl->mnStep = mnStep;
- }
-+ pControl->msParentName = sName;
-
- // #117490# DR: container records provide size of substream, use it here...
-
-@@ -3621,17 +3725,7 @@ void OCX_ContainerControl::ProcessControl(OCX_Control* pControl,SvStorageStream*
- // set stream to position behind substream of this control
- oStream->Seek( nStrmPos + rec.nSubStreamLen );
-
-- //need to fake grouping behaviour for radio ( option ) buttons
-- if ( rec.nTypeIdent == OPTIONBUTTON )
-- {
-- OCX_OptionButton* pRButton =
-- static_cast< OCX_OptionButton*>(pControl);
-- rbGroupMgr.addRadioButton( pRButton );
-- }
-- else
-- {
-- mpControls.push_back( pControl );
-- }
-+ mpControls.push_back( pControl );
- }
- }
-
-@@ -3654,7 +3748,6 @@ sal_Bool OCX_ContainerControl::Read(SvStorageStream *pS)
- // this ensures that the default tab index created by Star/Open office
- // reflects the "flattened" ms tab order.
- ::std::sort( mpControls.begin(), mpControls.end(), SortOrderByTabPos() );
-- mpControls = rbGroupMgr.insertGroupsIntoControlList( mpControls );
- return true;
- }
-
-@@ -3672,7 +3765,8 @@ OCX_MultiPage::OCX_MultiPage( SotStorageRef& parent,
- nScrollWidth(0), nScrollHeight(0), nIconLen(0), pIcon(0), nPictureLen(0),
- pPicture(0)
- {
-- msDialogType = C2U("NotSupported");
-+ //msDialogType = C2U("NotSupported");
-+ msDialogType = C2U("com.sun.star.awt.UnoMultiPageModel");
- mnForeColor = 0x80000012L,
- mnBackColor = 0x8000000FL;
- bSetInDialog = true;// UserForm control only
-@@ -3736,7 +3830,6 @@ sal_Bool OCX_MultiPage::Read(SvStorageStream *pS)
- sal_Bool OCX_MultiPage::Import(com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet> &rPropSet)
- {
-- // Calls import on contained controls
- OCX_ContainerControl::Import( rPropSet );
- return sal_True;
- }
-@@ -3757,6 +3850,43 @@ sal_Bool OCX_MultiPage::Import(com::sun::star::uno::Reference<
-
- if ( xPropSet.is() )
- {
-+ uno::Reference<lang::XMultiServiceFactory>
-+ xFactory(rDialog, uno::UNO_QUERY);
-+ OSL_TRACE("** MultiPage creating control %s", rtl::OUStringToOString( msDialogType, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ uno::Reference<uno::XInterface> xCreate = xFactory->createInstance(msDialogType);
-+ if (!xCreate.is())
-+ return sal_False;
-+
-+ uno::Reference<awt::XControlModel> xModel(xCreate, uno::UNO_QUERY);
-+ if (!xModel.is())
-+ return sal_False;
-+
-+ try
-+ {
-+ // we should just call MultiPage::Import( XPropertySet )
-+ OSL_TRACE("********* MULTIPAGE cName %s", rtl::OUStringToOString( sName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ uno::Any aTmp(&sName,getCppuType((OUString *)0));
-+ uno::Reference<beans::XPropertySet> xPrps(xModel, uno::UNO_QUERY);
-+ xPrps->setPropertyValue( WW8_ASCII2STR("Name"), aTmp );
-+ aTmp = uno::makeAny( mnCurrentPageStep );
-+ xPrps->setPropertyValue( WW8_ASCII2STR("ProgressValueMax"), aTmp );
-+ // default current page to 0 ( #FIXME, we need to read this value )
-+ aTmp = uno::makeAny( sal_Int32(0) );
-+ xPrps->setPropertyValue( WW8_ASCII2STR("ProgressValue"), aTmp );
-+ OSL_TRACE("********* MULTIPAGE vomitted out properties");
-+
-+ // Calls import on contained controls
-+ rDialog->insertByName(sName, uno::makeAny(xModel));
-+ OSL_TRACE("*** inserted ***");
-+ }
-+ catch( uno::Exception& )
-+ {
-+ DBG_ERRORFILE(
-+ ByteString( "OCX_Control::Import - cannot insert control \"" ).
-+ Append( ByteString( sName, RTL_TEXTENCODING_UTF8 ) ).
-+ Append( '"' ).GetBuffer() );
-+ }
-+
- // Calls import on contained pages
- return OCX_ContainerControl::Import( xPropSet );
- }
-@@ -4043,8 +4173,7 @@ OCX_UserForm::OCX_UserForm( SotStorageRef& parent,
- nKeepScrollBarsVisible(3), nCycle(0), nBorderStyle(0), nSpecialEffect(0),
- nPicture(0), nPictureAlignment(2), nPictureSizeMode(0),
- bPictureTiling(FALSE), nAccelerator(0), nIcon(0), pCaption(0),
-- nScrollWidth(0), nScrollHeight(0), nScrollLeft(0), nScrollTop(0), nIconLen(0), pIcon(0), nPictureLen(0),
-- pPicture(0)
-+ nScrollWidth(0), nScrollHeight(0), nScrollLeft(0), nScrollTop(0), nIconLen(0), pIcon(0), nPictureLen(0)
- {
- mnForeColor = 0x80000012;
- mnBackColor = 0x8000000F;
-@@ -4174,24 +4303,30 @@ sal_Bool OCX_UserForm::Read(SvStorageStream *pS)
- pS->Read(pIcon,nIconLen);
- }
-
-+ ReadAlign( pS, pS->Tell() - nStart, 4);
-+ if (pBlockFlags[2] & 0x10)
-+ {
-+ //Font Stuff..
-+ pS->SeekRel(0x1a);
-+ sal_uInt8 nFontLen;
-+ *pS >> nFontLen;
-+ pS->SeekRel(nFontLen);
-+ }
- if (nPicture)
- {
- pS->Read(pPictureHeader,20);
- *pS >> nPictureLen;
-- pPicture = new sal_uInt8[nPictureLen];
-- pS->Read(pPicture,nPictureLen);
-- }
--
-- ReadAlign( pS, pS->Tell() - nStart, 4);
--
-- if (pBlockFlags[2] & 0x10)
-- {
-- //Font Stuff..
-- pS->SeekRel(0x1a);
-- sal_uInt8 nFontLen;
-- *pS >> nFontLen;
-- pS->SeekRel(nFontLen);
-- }
-+ long imagePos = pS->Tell();
-+ // great embedded object
-+ mxGrfObj = lcl_readGraphicObject( pS );
-+ if( mxGrfObj.is() )
-+ {
-+ sImageUrl = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( GRAPHOBJ_URLPREFIX ) );
-+ sImageUrl = sImageUrl + mxGrfObj->getUniqueID();
-+ }
-+ // make sure the stream position should be pointing after the image.
-+ pS->Seek( imagePos + nPictureLen );
-+ }
-
- sal_Int16 numTrailingRecs = 0;
- *pS >> numTrailingRecs;
-@@ -4200,10 +4335,14 @@ sal_Bool OCX_UserForm::Read(SvStorageStream *pS)
- // ( unknown what these trailing records are for)
- if ( numTrailingRecs )
- {
-- for ( ; numTrailingRecs ; --numTrailingRecs )
-+ for ( sal_Int16 i = 0 ; numTrailingRecs ; --numTrailingRecs, ++i )
- {
-- OCX_Control skip(C2S("dummy")) ;
-- skip.Read( pS );
-+ sal_uInt16 nTypeID = 0;
-+ if ( lcl_handleActiveXControl( pS, nTypeID ) )
-+ {
-+ if ( nTypeID & 0x8000 ) // valid ActiveXID
-+ mActiveXIDMap[ ( i | 0x8000 ) ] = nTypeID;
-+ }
- }
- }
- return OCX_ContainerControl::Read( pS );
-@@ -4214,6 +4353,8 @@ sal_Bool OCX_UserForm::Import(
- {
- uno::Reference<beans::XPropertySet>
- xDialogPropSet(mxParent, uno::UNO_QUERY);
-+ if ( !xDialogPropSet.is() )
-+ return sal_False;
- uno::Any aTmp(&sName,getCppuType((OUString *)0));
- xDialogPropSet->setPropertyValue(
- OUString(RTL_CONSTASCII_USTRINGPARAM("Name")), aTmp);
-@@ -4221,22 +4362,55 @@ sal_Bool OCX_UserForm::Import(
- OUString(RTL_CONSTASCII_USTRINGPARAM("Title")), aTmp);
- aTmp <<= ImportColor(mnBackColor);
- xDialogPropSet->setPropertyValue( WW8_ASCII2STR("BackgroundColor"), aTmp);
-+ sal_Bool bVBA = sal_False;
-+ // Ok we are importing xls but maybe we aren't in VBA mode
-+ // if we are not in VBA mode then we should import sizes etc. ( as before )
-+ try
-+ {
-+ xDialogPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("VBAForm") ) ) >>= bVBA;
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ }
-+ if ( !bVBA )
-+ {
-+ aTmp <<= sal_Int32((nWidth * 2) / 100);
-+ xDialogPropSet->setPropertyValue(WW8_ASCII2STR("Width"), aTmp);
-+ aTmp <<= sal_Int32((nHeight * 2) / 100);
-+ xDialogPropSet->setPropertyValue(WW8_ASCII2STR("Height"), aTmp);
-+ }
-+ else
-+ {
-+ aTmp <<= sal_Int32( nWidth + 160 ); // 100thmm
-+ xDialogPropSet->setPropertyValue(WW8_ASCII2STR("Width"), aTmp);
-+ aTmp <<= sal_Int32(nHeight + 662 - 714); //100th mm
-+ xDialogPropSet->setPropertyValue(WW8_ASCII2STR("Height"), aTmp);
-+ }
-
-- aTmp <<= sal_Int32((nWidth * 2) / 100);
-- xDialogPropSet->setPropertyValue(WW8_ASCII2STR("Width"), aTmp);
-- aTmp <<= sal_Int32((nHeight * 2) / 100);
-- xDialogPropSet->setPropertyValue(WW8_ASCII2STR("Height"), aTmp);
-
- uno::Reference<beans::XPropertySet> xPropSet( mxParent, uno::UNO_QUERY );
- OCX_ContainerControl::Import( xPropSet );
-
- uno::Reference<io::XInputStreamProvider> xSource =
-- xmlscript::exportDialogModel(mxParent, mxCtx);
-+ xmlscript::exportDialogModel(mxParent, mxCtx, pDocSh->GetModel() );
- uno::Any aSourceAny(uno::makeAny(xSource));
- if (rLib->hasByName(sName))
- rLib->replaceByName(sName, aSourceAny);
- else
- rLib->insertByName(sName, aSourceAny);
-+
-+ if ( sImageUrl.getLength() )
-+ {
-+ aTmp <<= sImageUrl;
-+ try
-+ {
-+ xDialogPropSet->setPropertyValue( WW8_ASCII2STR("ImageURL"), aTmp);
-+ }
-+ catch( uno::Exception& )
-+ {
-+ OSL_TRACE("OCX_UserForm::Import, Image fails to import");
-+ }
-+ }
- return sal_True;
- }
-
-@@ -4761,11 +4935,14 @@ sal_Bool OCX_CheckBox::Import(com::sun::star::uno::Reference<
- aTmp <<= ImportSpecEffect( nSpecialEffect );
- rPropSet->setPropertyValue( WW8_ASCII2STR("VisualEffect"), aTmp);
-
-- if (pValue && !bSetInDialog)
-+ if (pValue)
- {
- INT16 nTmp=pValue[0]-0x30;
- aTmp <<= nTmp;
-- rPropSet->setPropertyValue( WW8_ASCII2STR("DefaultState"), aTmp);
-+ if ( !bSetInDialog )
-+ rPropSet->setPropertyValue( WW8_ASCII2STR("DefaultState"), aTmp);
-+ else
-+ rPropSet->setPropertyValue( WW8_ASCII2STR("State"), aTmp);
- }
-
- if (pCaption)
-@@ -5175,12 +5352,6 @@ sal_Bool OCX_TabStrip::ReadFontData(SotStorageStream *pS)
-
- sal_Bool OCX_Image::Read(SotStorageStream *pS)
- {
-- if ( !bSetInDialog )
-- {
-- // preserve the present behavior at the moment.
-- // only import image control for UserForms
-- return sal_False;
-- }
- ULONG nStart = pS->Tell();
- *pS >> nIdentifier;
- DBG_ASSERT(nStandardId==nIdentifier,
-@@ -5271,16 +5442,14 @@ sal_Bool OCX_Image::Read(SotStorageStream *pS)
-
- long imagePos = pS->Tell();
-
-- pS->Seek( imagePos );
--
-- sImageUrl = C2U("vnd.sun.star.expand:${$BRAND_BASE_DIR/program/") + C2U( SAL_CONFIGFILE( "bootstrap" ) ) + C2U("::UserInstallation}/user/temp/") + sName;
--
-- sal_uInt8* pImage = new sal_uInt8[ nImageLen ];
-- pS->Read(pImage, nImageLen);
-- bool result = storePictureInFileSystem( sImageUrl, pImage, nImageLen );
-- OUString pictName = sImageUrl.copy( sImageUrl.lastIndexOf('/') + 1 );
-- result = storePictureInDoc( pDocSh, pictName, pImage, nImageLen );
-- delete [] pImage;
-+ mxGrfObj = lcl_readGraphicObject( pS );
-+ if( mxGrfObj.is() )
-+ {
-+ sImageUrl = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( GRAPHOBJ_URLPREFIX ) );
-+ sImageUrl = sImageUrl + mxGrfObj->getUniqueID();
-+ }
-+ // make sure the stream position should be pointing after the image
-+ pS->Seek( imagePos + nImageLen );
- }
- return sal_True;
- }
-@@ -5448,7 +5617,7 @@ OCX_SpinButton::OCX_SpinButton() :
- mbPropThumb( true )
- {
- msFormType = C2U("com.sun.star.form.component.SpinButton");
-- msDialogType = C2U("com.sun.star.awt.UnoControlSpinButtonModel");
-+ msDialogType = C2U("com.sun.star.form.component.SpinButton");
- mnBackColor = 0x8000000F;
- mnForeColor = 0x80000012;
- }
-@@ -5485,8 +5654,8 @@ sal_Bool OCX_SpinButton::Read( SvStorageStream *pS )
- if( mnBlockFlags & 0x00000080 ) rStrm >> mnValue;
- if( mnBlockFlags & 0x00000100 ) rStrm.SeekRel( 4 ); // unknown
- if( mnBlockFlags & 0x00000200 ) rStrm.SeekRel( 4 ); // unknown
-- if( mnBlockFlags & 0x00000400 ) rStrm.SeekRel( 4 ); // unknown
-- if( mnBlockFlags & 0x00000800 ) rStrm >> mnSmallStep;
-+ if( mnBlockFlags & 0x00000400 ) rStrm >> mnSmallStep;
-+ if( mnBlockFlags & 0x00000800 ) rStrm.SeekRel( 4 ); // unknown
- if( mnBlockFlags & 0x00001000 ) rStrm >> mnPageStep;
- if( mnBlockFlags & 0x00002000 ) rStrm >> mnOrient;
- if( mnBlockFlags & 0x00004000 )
-@@ -5571,6 +5740,9 @@ sal_Bool OCX_SpinButton::Import(com::sun::star::uno::Reference<
- aTmp <<= sal_Int16( 0 );
- rPropSet->setPropertyValue( WW8_ASCII2STR("Border"), aTmp);
-
-+ uno::Reference< frame::XModel > xModel ( pDocSh ? pDocSh->GetModel() : NULL );
-+ lcl_ApplyListSourceAndBindableStuff( xModel, rPropSet, msCtrlSource, msRowSource );
-+
- return sal_True;
- }
-
-@@ -5738,7 +5910,7 @@ OCX_ScrollBar::OCX_ScrollBar()
- sName = OUString( RTL_CONSTASCII_USTRINGPARAM( "ScrollBar" ) );
- mnMax = 32767;
- msFormType = C2U("com.sun.star.form.component.ScrollBar");
-- msDialogType = C2U("com.sun.star.awt.UnoControlScrollBarModel");
-+ msDialogType = C2U("com.sun.star.form.component.ScrollBar");
-
- }
-
-@@ -5804,6 +5976,9 @@ sal_Bool OCX_ScrollBar::Import(com::sun::star::uno::Reference<
- aTmp <<= sal_Int16( 0 );
- rPropSet->setPropertyValue( WW8_ASCII2STR("Border"), aTmp);
-
-+ uno::Reference< frame::XModel > xModel ( pDocSh ? pDocSh->GetModel() : NULL );
-+ lcl_ApplyListSourceAndBindableStuff( xModel, rPropSet, msCtrlSource, msRowSource );
-+
- return sal_True;
- }
-
-diff --git filter/source/msfilter/msoleexp.cxx filter/source/msfilter/msoleexp.cxx
-index e782c5f..76220ee 100644
---- filter/source/msfilter/msoleexp.cxx
-+++ filter/source/msfilter/msoleexp.cxx
-@@ -219,7 +219,12 @@ void SvxMSExportOLEObjects::ExportOLEObject( svt::EmbeddedObjectRef& rObj, SvSto
- aSeq[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterName" ) );
- aSeq[1].Value <<= ::rtl::OUString( pExpFilter->GetName() );
- uno::Reference < frame::XStorable > xStor( rObj->getComponent(), uno::UNO_QUERY );
-+ try
-+ {
- xStor->storeToURL( ::rtl::OUString::createFromAscii( "private:stream" ), aSeq );
-+ }
-+ catch( uno::Exception& ) {} // #TODO really handle exceptions - interactionalhandler etc. ?
-+
- SotStorageRef xOLEStor = new SotStorage( pStream, TRUE );
- xOLEStor->CopyTo( &rDestStg );
- rDestStg.Commit();
-diff --git filter/source/msfilter/mstoolbar.cxx filter/source/msfilter/mstoolbar.cxx
-new file mode 100644
-index 0000000..eead43c
---- /dev/null
-+++ filter/source/msfilter/mstoolbar.cxx
-@@ -0,0 +1,817 @@
-+#include <filter/msfilter/mstoolbar.hxx>
-+#include <rtl/ustrbuf.hxx>
-+#include <stdarg.h>
-+#include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
-+#include <com/sun/star/ui/XImageManager.hpp>
-+#include <com/sun/star/ui/ItemType.hpp>
-+#include <com/sun/star/ui/ItemStyle.hpp>
-+#include <com/sun/star/frame/XLayoutManager.hpp>
-+#include <fstream>
-+#include <vcl/graph.hxx>
-+#include <vcl/bitmapex.hxx>
-+#include <vcl/image.hxx>
-+#include <map>
-+#include <sfx2/objsh.hxx>
-+#include <basic/basmgr.hxx>
-+#include <svtools/filterutils.hxx>
-+#include <boost/scoped_array.hpp>
-+#include <filter/msfilter/msvbahelper.hxx>
-+#include <svtools/miscopt.hxx>
-+#include <vcl/svapp.hxx>
-+#include <vcl/window.hxx>
-+
-+using namespace com::sun::star;
-+
-+int TBBase::nIndent = 0;
-+
-+void CustomToolBarImportHelper::showToolbar( const rtl::OUString& rName )
-+{
-+ try
-+ {
-+ uno::Reference< frame::XController > xCntrller( mrDocSh.GetModel()->getCurrentController(), uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xProps( xCntrller->getFrame(), uno::UNO_QUERY_THROW );
-+ uno::Reference< frame::XLayoutManager > xLayoutMgr( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LayoutManager") ) ), uno::UNO_QUERY_THROW );
-+ xLayoutMgr->showElement( rName );
-+ }
-+ catch( uno::Exception& ) {}
-+}
-+
-+void CustomToolBarImportHelper::ScaleImage( uno::Reference< graphic::XGraphic >& xGraphic, long nNewSize )
-+{
-+ Graphic aGraphic( xGraphic );
-+ Size aSize = aGraphic.GetSizePixel();
-+ if ( aSize.Height() && ( aSize.Height() == aSize.Width() ) )
-+ {
-+ Image aImage( xGraphic );
-+ if ( aSize.Height() != nNewSize )
-+ {
-+ BitmapEx aBitmap = aImage.GetBitmapEx();
-+ BitmapEx aBitmapex = BitmapEx::AutoScaleBitmap(aBitmap, nNewSize );
-+ aImage = Image( aBitmapex);
-+ xGraphic = aImage.GetXGraphic();
-+ }
-+ }
-+}
-+
-+void CustomToolBarImportHelper::applyIcons()
-+{
-+ for ( std::vector< iconcontrolitem >::iterator it = iconcommands.begin(); it != iconcommands.end(); ++it )
-+ {
-+ uno::Sequence< rtl::OUString > commands(1);
-+ commands[ 0 ] = it->sCommand;
-+ uno::Sequence< uno::Reference< graphic::XGraphic > > images(1);
-+ images[ 0 ] = it->image;
-+
-+ OSL_TRACE("About to applyIcons for command %s, have image ? %s", rtl::OUStringToOString( commands[ 0 ], RTL_TEXTENCODING_UTF8 ).getStr(), images[ 0 ].is() ? "yes" : "no" );
-+ uno::Reference< ui::XImageManager > xImageManager( getCfgManager()->getImageManager(), uno::UNO_QUERY_THROW );
-+ sal_uInt16 nColor = ui::ImageType::COLOR_NORMAL;
-+
-+ Window* topwin = Application::GetActiveTopWindow();
-+ if ( topwin != NULL && topwin->GetDisplayBackground().GetColor().IsDark() )
-+ nColor = css::ui::ImageType::COLOR_HIGHCONTRAST;
-+
-+ ScaleImage( images[ 0 ], 16 );
-+ xImageManager->replaceImages( ui::ImageType::SIZE_DEFAULT | nColor, commands, images );
-+ ScaleImage( images[ 0 ], 26 );
-+ xImageManager->replaceImages( ui::ImageType::SIZE_LARGE | nColor, commands, images );
-+ }
-+}
-+
-+void CustomToolBarImportHelper::addIcon( const uno::Reference< graphic::XGraphic >& xImage, const rtl::OUString& sString )
-+{
-+ iconcontrolitem item;
-+ item.sCommand = sString;
-+ item.image = xImage;
-+ iconcommands.push_back( item );
-+}
-+
-+CustomToolBarImportHelper::CustomToolBarImportHelper( SfxObjectShell& rDocShell, const css::uno::Reference< css::ui::XUIConfigurationManager>& rxAppCfgMgr ) : mrDocSh( rDocShell )
-+{
-+ m_xCfgSupp.set( mrDocSh.GetModel(), uno::UNO_QUERY_THROW );
-+ m_xAppCfgMgr.set( rxAppCfgMgr, uno::UNO_QUERY_THROW );
-+}
-+
-+uno::Reference< ui::XUIConfigurationManager >
-+CustomToolBarImportHelper::getCfgManager()
-+{
-+ return m_xCfgSupp->getUIConfigurationManager();
-+}
-+
-+uno::Reference< ui::XUIConfigurationManager >
-+CustomToolBarImportHelper::getAppCfgManager()
-+{
-+ return m_xAppCfgMgr;
-+}
-+
-+uno::Any
-+CustomToolBarImportHelper::createCommandFromMacro( const rtl::OUString& sCmd )
-+{
-+//"vnd.sun.star.script:Standard.Module1.Main?language=Basic&location=document"
-+ static rtl::OUString scheme = rtl::OUString::createFromAscii( "vnd.sun.star.script:");
-+ static rtl::OUString part2 = rtl::OUString::createFromAscii("?language=Basic&location=document");
-+ // create script url
-+ rtl::OUString scriptURL = scheme + sCmd + part2;
-+ return uno::makeAny( scriptURL );
-+}
-+
-+rtl::OUString CustomToolBarImportHelper::MSOCommandToOOCommand( sal_Int16 msoCmd )
-+{
-+ rtl::OUString result;
-+ if ( pMSOCmdConvertor.get() )
-+ result = pMSOCmdConvertor->MSOCommandToOOCommand( msoCmd );
-+ return result;
-+}
-+
-+rtl::OUString CustomToolBarImportHelper::MSOTCIDToOOCommand( sal_Int16 msoTCID )
-+{
-+ rtl::OUString result;
-+ if ( pMSOCmdConvertor.get() )
-+ result = pMSOCmdConvertor->MSOTCIDToOOCommand( msoTCID );
-+ return result;
-+}
-+
-+bool
-+CustomToolBarImportHelper::createMenu( const rtl::OUString& rName, const uno::Reference< container::XIndexAccess >& xMenuDesc, bool bPersist )
-+{
-+ bool bRes = true;
-+ try
-+ {
-+ uno::Reference< ui::XUIConfigurationManager > xCfgManager( getCfgManager() );
-+ rtl::OUString sMenuBar( RTL_CONSTASCII_USTRINGPARAM("private:resource/menubar/") );
-+ sMenuBar += rName;
-+ uno::Reference< container::XIndexContainer > xPopup( xCfgManager->createSettings(), uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xProps( xPopup, uno::UNO_QUERY_THROW );
-+ // set name for menubar
-+ xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UIName") ), uno::makeAny( rName ) );
-+ if ( xPopup.is() )
-+ {
-+ uno::Sequence< beans::PropertyValue > aPopupMenu( 4 );
-+ aPopupMenu[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CommandURL") );
-+ aPopupMenu[0].Value = uno::makeAny( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("vnd.openoffice.org:") ) + rName );
-+ aPopupMenu[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Label") );
-+ aPopupMenu[1].Value <<= rName;
-+ aPopupMenu[2].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ItemDescriptorContainer") );
-+ aPopupMenu[2].Value = uno::makeAny( xMenuDesc );
-+ aPopupMenu[3].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Type" ) );
-+ aPopupMenu[3].Value <<= sal_Int32( 0 );
-+
-+ xPopup->insertByIndex( xPopup->getCount(), uno::makeAny( aPopupMenu ) );
-+ if ( bPersist )
-+ {
-+ xCfgManager->insertSettings( sMenuBar, uno::Reference< container::XIndexAccess >( xPopup, uno::UNO_QUERY ) );
-+ uno::Reference< ui::XUIConfigurationPersistence > xPersistence( xCfgManager, uno::UNO_QUERY_THROW );
-+ xPersistence->store();
-+ }
-+ }
-+ }
-+ catch( uno::Exception& )
-+ {
-+ bRes = false;
-+ }
-+ return bRes;
-+}
-+
-+void
-+TBBase::indent_printf( FILE* fp, const char* format, ... )
-+{
-+ va_list ap;
-+ va_start ( ap, format );
-+
-+ // indent nIndent spaces
-+ for ( int i=0; i<nIndent; ++i)
-+ fprintf(fp," ");
-+ // append the rest of the message
-+ vfprintf( fp, format, ap );
-+ va_end( ap );
-+}
-+
-+rtl::OUString TBBase::readUnicodeString( SvStream* pS, sal_Int32 nChars )
-+{
-+ sal_Int32 nBufSize = nChars * 2;
-+ boost::scoped_array< sal_uInt8 > pArray( new sal_uInt8[ nBufSize ] );
-+ pS->Read( pArray.get(), nBufSize );
-+ return svt::BinFilterUtils::CreateOUStringFromUniStringArray( reinterpret_cast< const char* >( pArray.get() ), nBufSize );
-+}
-+
-+TBCHeader::TBCHeader() : bSignature( 0x3 )
-+,bVersion( 0x01 )
-+,bFlagsTCR( 0 )
-+,tct(0x1) // default to Button
-+,tcid(0)
-+,tbct(0)
-+{
-+}
-+
-+
-+TBCHeader::~TBCHeader()
-+{
-+}
-+
-+bool TBCHeader::Read( SvStream* pS )
-+{
-+ OSL_TRACE("TBCHeader::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> bSignature >> bVersion >> bFlagsTCR >> tct >> tcid >> tbct >> bPriority;
-+ // bit 4 ( from lsb )
-+ if ( bFlagsTCR & 0x10 )
-+ {
-+ width.reset( new sal_uInt16 );
-+ height.reset( new sal_uInt16 );
-+ *pS >> *width >> *height;
-+ }
-+ return true;
-+}
-+
-+void TBCHeader::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf(fp,"[ 0x%x ] TBCHeader -- dump\n", nOffSet );
-+ indent_printf(fp," bSignature 0x%x\n", bSignature );
-+ indent_printf(fp," bVersion 0x%x\n", bVersion );
-+ indent_printf(fp," bFlagsTCR 0x%x\n", bFlagsTCR );
-+ indent_printf(fp," tct 0x%x\n", tct );
-+ indent_printf(fp," tcid 0x%x\n", tcid );
-+ indent_printf(fp," tbct 0x%x\n", static_cast< unsigned int >( tbct ));
-+ indent_printf(fp," bPriority 0x%x\n", bPriority );
-+ if ( width.get() )
-+ indent_printf(fp," width 0x%d(0x%x)\n", *width, *width);
-+ if ( height.get() )
-+ indent_printf(fp," height 0x%d(0x%x)\n", *height, *height);
-+}
-+
-+TBCData::TBCData( const TBCHeader& Header ) : rHeader( Header )
-+{
-+}
-+
-+bool TBCData::Read(SvStream *pS)
-+{
-+ OSL_TRACE("TBCData::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ if ( !controlGeneralInfo.Read(pS) /*|| !controlSpecificInfo.Read(pS)*/ )
-+ return false;
-+ switch ( rHeader.getTct() )
-+ {
-+ case 0x01: // (Button control)
-+ case 0x10: // (ExpandingGrid control)
-+ controlSpecificInfo.reset( new TBCBSpecific() );
-+ break;
-+ case 0x0A: // (Popup control)
-+ case 0x0C: // (ButtonPopup control)
-+ case 0x0D: // (SplitButtonPopup control)
-+ case 0x0E: // (SplitButtonMRUPopup control)
-+ controlSpecificInfo.reset( new TBCMenuSpecific() );
-+ break;
-+ case 0x02: // (Edit control)
-+ case 0x04: // (ComboBox control)
-+ case 0x14: // (GraphicCombo control)
-+ case 0x03: // (DropDown control)
-+ case 0x06: // (SplitDropDown control)
-+ case 0x09: // (GraphicDropDown control)
-+ controlSpecificInfo.reset( new TBCComboDropdownSpecific( rHeader ) );
-+ break;
-+ default:
-+ break;
-+ }
-+ if ( controlSpecificInfo.get() )
-+ return controlSpecificInfo->Read( pS );
-+ //#FIXME I need to be able to handle different controlSpecificInfo types.
-+ return true;
-+}
-+
-+TBCMenuSpecific* TBCData::getMenuSpecific()
-+{
-+ TBCMenuSpecific* pMenu = dynamic_cast< TBCMenuSpecific* >( controlSpecificInfo.get() );
-+ return pMenu;
-+}
-+bool TBCData::ImportToolBarControl( CustomToolBarImportHelper& helper, std::vector< css::beans::PropertyValue >& props, bool& bBeginGroup, bool bIsMenuBar )
-+{
-+ sal_uInt16 nStyle = 0;
-+ bBeginGroup = rHeader.isBeginGroup();
-+ controlGeneralInfo.ImportToolBarControlData( helper, props );
-+ beans::PropertyValue aProp;
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Visible") ) ;
-+ aProp.Value = uno::makeAny( rHeader.isVisible() ); // where is the visible attribute stored
-+ props.push_back( aProp );
-+ if ( rHeader.getTct() == 0x01
-+ || rHeader.getTct() == 0x10 )
-+ {
-+ TBCBSpecific* pSpecificInfo = dynamic_cast< TBCBSpecific* >( controlSpecificInfo.get() );
-+ if ( pSpecificInfo )
-+ {
-+ // if we have a icon then lets set it for the command
-+ rtl::OUString sCommand;
-+ for ( std::vector< css::beans::PropertyValue >::iterator it = props.begin(); it != props.end(); ++it )
-+ {
-+ if ( it->Name.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CommandURL") ) ) )
-+ it->Value >>= sCommand;
-+ }
-+ if ( TBCBitMap* pIcon = pSpecificInfo->getIcon() )
-+ {
-+ // Without a command openoffice won't display the icon
-+ if ( sCommand.getLength() )
-+ {
-+ BitmapEx aBitEx( pIcon->getBitMap() );
-+ if ( pSpecificInfo->getIconMask() )
-+ // according to the spec:
-+ // "the iconMask is white in all the areas in which the icon is
-+ // displayed as transparent and is black in all other areas."
-+ aBitEx = BitmapEx( aBitEx.GetBitmap(), pSpecificInfo->getIconMask()->getBitMap().CreateMask( Color( COL_WHITE ) ) );
-+
-+ Graphic aGraphic( aBitEx );
-+ helper.addIcon( aGraphic.GetXGraphic(), sCommand );
-+ }
-+ }
-+ else if ( pSpecificInfo->getBtnFace() )
-+ {
-+
-+ rtl::OUString sBuiltInCmd = helper.MSOTCIDToOOCommand( *pSpecificInfo->getBtnFace() );
-+ if ( sBuiltInCmd.getLength() )
-+ {
-+ uno::Sequence< rtl::OUString> sCmds(1);
-+ sCmds[ 0 ] = sBuiltInCmd;
-+ uno::Reference< ui::XImageManager > xImageManager( helper.getAppCfgManager()->getImageManager(), uno::UNO_QUERY_THROW );
-+ // 0 = default image size
-+ uno::Sequence< uno::Reference< graphic::XGraphic > > sImages = xImageManager->getImages( 0, sCmds );
-+ if ( sImages.getLength() && sImages[0].is() )
-+ helper.addIcon( sImages[0], sCommand );
-+ }
-+ }
-+ }
-+ }
-+ else if ( rHeader.getTct() == 0x0a )
-+ {
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CommandURL") ) ;
-+ rtl::OUString sMenuBar( RTL_CONSTASCII_USTRINGPARAM("private:resource/menubar/") );
-+
-+ TBCMenuSpecific* pMenu = getMenuSpecific();
-+ if ( pMenu )
-+ aProp.Value = uno::makeAny( sMenuBar += pMenu->Name() ); // name of popup
-+ nStyle |= ui::ItemStyle::DROP_DOWN;
-+ props.push_back( aProp );
-+ }
-+
-+ short icontext = ( rHeader.getTbct() & 0x03 );
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Style") ) ;
-+ if ( bIsMenuBar )
-+ {
-+ nStyle |= ui::ItemStyle::TEXT;
-+ if ( !icontext || icontext == 0x3 )
-+ // Text And image
-+ nStyle |= ui::ItemStyle::ICON;
-+ }
-+ else
-+ {
-+ if ( ( icontext & 0x02 ) == 0x02 )
-+ nStyle |= ui::ItemStyle::TEXT;
-+ if ( !icontext || ( icontext & 0x03 ) == 0x03 )
-+ nStyle |= ui::ItemStyle::ICON;
-+ }
-+ aProp.Value <<= nStyle;
-+ props.push_back( aProp );
-+ return true; // just ignore
-+}
-+
-+void TBCData::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf(fp,"[ 0x%x ] TBCData -- dump\n", nOffSet );
-+ indent_printf(fp," dumping controlGeneralInfo( TBCGeneralInfo )\n");
-+ controlGeneralInfo.Print( fp );
-+ //if ( rHeader.getTct() == 1 )
-+ if ( controlSpecificInfo.get() )
-+ {
-+ indent_printf(fp," dumping controlSpecificInfo( TBCBSpecificInfo )\n");
-+ controlSpecificInfo->Print( fp );
-+ }
-+}
-+
-+bool
-+WString::Read( SvStream *pS )
-+{
-+ OSL_TRACE("WString::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ sal_Int8 nChars = 0;
-+ *pS >> nChars;
-+ sString = readUnicodeString( pS, static_cast< sal_Int32 >( nChars ) );
-+ return true;
-+}
-+
-+TBCExtraInfo::TBCExtraInfo() : idHelpContext( 0 )
-+{
-+}
-+
-+bool
-+TBCExtraInfo::Read( SvStream *pS )
-+{
-+ OSL_TRACE("TBCExtraInfo::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ if( !wstrHelpFile.Read( pS ) )
-+ return false;
-+
-+ *pS >> idHelpContext;
-+
-+ if ( !wstrTag.Read( pS ) || !wstrOnAction.Read( pS ) || !wstrParam.Read( pS ) )
-+ return false;
-+
-+ *pS >> tbcu >> tbmg;
-+ return true;
-+}
-+
-+void
-+TBCExtraInfo::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf( fp, "[ 0x%x ] TBCExtraInfo -- dump\n", nOffSet );
-+ indent_printf( fp, " wstrHelpFile %s\n",
-+ rtl::OUStringToOString( wstrHelpFile.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ indent_printf( fp, " idHelpContext 0x%x\n", static_cast< unsigned int >( idHelpContext ) );
-+ indent_printf( fp, " wstrTag %s\n",
-+ rtl::OUStringToOString( wstrTag.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ indent_printf( fp, " wstrOnAction %s\n",
-+ rtl::OUStringToOString( wstrOnAction.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ indent_printf( fp, " wstrParam %s\n",
-+ rtl::OUStringToOString( wstrParam.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ indent_printf( fp, " tbcu 0x%x\n", tbcu );
-+ indent_printf( fp, " tbmg 0x%x\n", tbmg );
-+
-+}
-+
-+rtl::OUString
-+TBCExtraInfo::getOnAction()
-+{
-+ return wstrOnAction.getString();
-+}
-+
-+TBCGeneralInfo::TBCGeneralInfo() : bFlags( 0 )
-+{
-+}
-+
-+bool TBCGeneralInfo::Read( SvStream *pS )
-+{
-+ OSL_TRACE("TBCGeneralInfo::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> bFlags;
-+
-+ if ( ( bFlags & 0x1 ) && !customText.Read( pS ) )
-+ return false;
-+ if ( ( bFlags & 0x2 ) && ( !descriptionText.Read( pS ) || !tooltip.Read( pS ) ) )
-+ return false;
-+ if ( ( bFlags & 0x4 ) && !extraInfo.Read( pS ) )
-+ return false;
-+ return true;
-+}
-+
-+void
-+TBCGeneralInfo::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf( fp, "[ 0x%x ] TBCGeneralInfo -- dump\n", nOffSet );
-+ indent_printf( fp, " bFlags 0x%x\n", bFlags );
-+ indent_printf( fp, " customText %s\n",
-+ rtl::OUStringToOString( customText.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ indent_printf( fp, " description %s\n",
-+ rtl::OUStringToOString( descriptionText.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ indent_printf( fp, " tooltip %s\n",
-+ rtl::OUStringToOString( tooltip.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ if ( bFlags & 0x4 )
-+ extraInfo.Print( fp );
-+}
-+
-+bool
-+TBCGeneralInfo::ImportToolBarControlData( CustomToolBarImportHelper& helper, std::vector< beans::PropertyValue >& sControlData )
-+{
-+ if ( ( bFlags & 0x5 ) )
-+ {
-+ beans::PropertyValue aProp;
-+ // probably access to the header would be a better test than seeing if there is an action, e.g.
-+ // if ( rHeader.getTct() == 0x01 && rHeader.getTcID() == 0x01 ) // not defined, probably this is a command
-+ if ( extraInfo.getOnAction().getLength() )
-+ {
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CommandURL") );
-+ ooo::vba::VBAMacroResolvedInfo aMacroInf = ooo::vba::resolveVBAMacro( &helper.GetDocShell(), extraInfo.getOnAction(), true );
-+ if ( aMacroInf.IsResolved() )
-+ aProp.Value = helper.createCommandFromMacro( aMacroInf.ResolvedMacro() );
-+ else
-+ aProp.Value <<= rtl::OUString::createFromAscii("UnResolvedMacro[").concat( extraInfo.getOnAction() ).concat( rtl::OUString::createFromAscii("]") );
-+ sControlData.push_back( aProp );
-+ }
-+
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Label") );
-+ aProp.Value = uno::makeAny( customText.getString().replace('&','~') );
-+ sControlData.push_back( aProp );
-+
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Type") );
-+ aProp.Value = uno::makeAny( ui::ItemType::DEFAULT );
-+ sControlData.push_back( aProp );
-+
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Tooltip") );
-+ aProp.Value = uno::makeAny( tooltip.getString() );
-+ sControlData.push_back( aProp );
-+/*
-+aToolbarItem(0).Name = "CommandURL" wstrOnAction
-+aToolbarItem(0).Value = Command
-+aToolbarItem(1).Name = "Label" customText
-+aToolbarItem(1).Value = Label
-+aToolbarItem(2).Name = "Type"
-+aToolbarItem(2).Value = 0
-+aToolbarItem(3).Name = "Visible"
-+aToolbarItem(3).Value = true
-+*/
-+ }
-+ return true;
-+}
-+
-+TBCMenuSpecific::TBCMenuSpecific() : tbid( 0 )
-+{
-+}
-+
-+bool
-+TBCMenuSpecific::Read( SvStream *pS)
-+{
-+ OSL_TRACE("TBCMenuSpecific::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> tbid;
-+ if ( tbid == 1 )
-+ {
-+ name.reset( new WString() );
-+ return name->Read( pS );
-+ }
-+ return true;
-+}
-+
-+void
-+TBCMenuSpecific::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf( fp, "[ 0x%x ] TBCMenuSpecific -- dump\n", nOffSet );
-+ indent_printf( fp, " tbid 0x%x\n", static_cast< unsigned int >( tbid ) );
-+ if ( tbid == 1 )
-+ indent_printf( fp, " name %s\n", rtl::OUStringToOString( name->getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+
-+}
-+
-+rtl::OUString TBCMenuSpecific::Name()
-+{
-+ rtl::OUString aName;
-+ if ( name.get() )
-+ aName = name->getString();
-+ return aName;
-+}
-+TBCBSpecific::TBCBSpecific() : bFlags( 0 )
-+{
-+}
-+
-+bool TBCBSpecific::Read( SvStream *pS)
-+{
-+ OSL_TRACE("TBCBSpecific::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> bFlags;
-+
-+ // bFlags determines what we read next
-+
-+ // bFlags.fCustomBitmap = 1 ( 0x8 ) set
-+ if ( bFlags & 0x8 )
-+ {
-+ icon.reset( new TBCBitMap() );
-+ iconMask.reset( new TBCBitMap() );
-+ if ( !icon->Read( pS ) || !iconMask->Read( pS ) )
-+ return false;
-+ }
-+ // if bFlags.fCustomBtnFace = 1 ( 0x10 )
-+ if ( bFlags & 0x10 )
-+ {
-+ iBtnFace.reset( new sal_uInt16 );
-+ *pS >> *iBtnFace.get();
-+ }
-+ // if bFlags.fAccelerator equals 1 ( 0x04 )
-+ if ( bFlags & 0x04 )
-+ {
-+ wstrAcc.reset( new WString() );
-+ return wstrAcc->Read( pS );
-+ }
-+ return true;
-+}
-+
-+
-+void TBCBSpecific::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf( fp, "[ 0x%x ] TBCBSpecific -- dump\n", nOffSet );
-+ indent_printf( fp, " bFlags 0x%x\n", bFlags );
-+ bool bResult = ( icon.get() != NULL );
-+ indent_printf( fp, " icon present? %s\n", bResult ? "true" : "false" );
-+ if ( bResult )
-+ {
-+ Indent b;
-+ indent_printf( fp, " icon: \n");
-+ icon->Print( fp ); // will dump size
-+ }
-+ bResult = ( iconMask.get() != NULL );
-+ indent_printf( fp, " icon mask present? %s\n", bResult ? "true" : "false" );
-+ if ( bResult )
-+ {
-+ Indent c;
-+ indent_printf( fp, " icon mask: \n");
-+ iconMask->Print( fp ); // will dump size
-+ }
-+ if ( iBtnFace.get() )
-+ {
-+ indent_printf( fp, " iBtnFace 0x%x\n", *(iBtnFace.get()) );
-+ }
-+ bResult = ( wstrAcc.get() != NULL );
-+ indent_printf( fp, " option string present? %s ->%s<-\n", bResult ? "true" : "false", bResult ? rtl::OUStringToOString( wstrAcc->getString(), RTL_TEXTENCODING_UTF8 ).getStr() : "N/A" );
-+}
-+
-+TBCBitMap*
-+TBCBSpecific::getIcon()
-+{
-+ return icon.get();
-+}
-+
-+TBCBitMap*
-+TBCBSpecific::getIconMask()
-+{
-+ return iconMask.get();
-+}
-+
-+TBCComboDropdownSpecific::TBCComboDropdownSpecific(const TBCHeader& header )
-+{
-+ if ( header.getTcID() == 0x01 )
-+ data.reset( new TBCCDData() );
-+}
-+
-+bool TBCComboDropdownSpecific::Read( SvStream *pS)
-+{
-+ nOffSet = pS->Tell();
-+ if ( data.get() )
-+ return data->Read( pS );
-+ return true;
-+}
-+
-+void TBCComboDropdownSpecific::Print( FILE* fp)
-+{
-+ Indent a;
-+ indent_printf(fp,"[ 0x%x ] TBCComboDropdownSpecific -- dump\n", nOffSet );
-+ if ( data.get() )
-+ data->Print( fp );
-+ else
-+ indent_printf(fp," no data " );
-+}
-+
-+TBCCDData::TBCCDData() : cwstrItems( 0 )
-+,iSel( 0 )
-+,cLines( 0 )
-+,dxWidth( 0 )
-+{
-+}
-+
-+TBCCDData::~TBCCDData()
-+{
-+}
-+
-+bool TBCCDData::Read( SvStream *pS)
-+{
-+ nOffSet = pS->Tell();
-+ *pS >> cwstrItems;
-+ if ( cwstrItems )
-+ {
-+ for( sal_Int32 index=0; index < cwstrItems; ++index )
-+ {
-+ WString aString;
-+ if ( !aString.Read( pS ) )
-+ return false;
-+ wstrList.push_back( aString );
-+ }
-+ }
-+ *pS >> cwstrMRU >> iSel >> cLines >> dxWidth;
-+
-+ return wstrEdit.Read( pS );
-+}
-+
-+void TBCCDData::Print( FILE* fp)
-+{
-+ Indent a;
-+ indent_printf(fp,"[ 0x%x ] TBCCDData -- dump\n", nOffSet );
-+ indent_printf(fp," cwstrItems items in wstrList 0x%d\n", cwstrItems);
-+ for ( sal_Int32 index=0; index < cwstrItems; ++index )
-+ {
-+ Indent b;
-+ indent_printf(fp, " wstrList[%d] %s", static_cast< int >( index ), rtl::OUStringToOString( wstrList[index].getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ }
-+ indent_printf(fp," cwstrMRU num most recently used string 0x%d item\n", cwstrMRU);
-+ indent_printf(fp," iSel index of selected item 0x%d item\n", iSel);
-+ indent_printf(fp," cLines num of suggested lines to display 0x%d", cLines);
-+ indent_printf(fp," dxWidth width in pixels 0x%d", dxWidth);
-+ indent_printf(fp," wstrEdit %s", rtl::OUStringToOString( wstrEdit.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+}
-+
-+TBCBitMap::TBCBitMap() : cbDIB( 0 ), size( 0 )
-+{
-+}
-+
-+TBCBitMap::~TBCBitMap()
-+{
-+}
-+
-+// #FIXME Const-ness
-+Bitmap&
-+TBCBitMap::getBitMap()
-+{
-+ return mBitMap;
-+}
-+
-+bool TBCBitMap::Read( SvStream* pS)
-+{
-+ OSL_TRACE("TBCBitMap::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> cbDIB;
-+ // cbDIB = sizeOf(biHeader) + sizeOf(colors) + sizeOf(bitmapData) + 10
-+ return mBitMap.Read( *pS, FALSE, TRUE );
-+}
-+
-+void TBCBitMap::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf(fp, "[ 0x%x ] TBCBitMap -- dump\n", nOffSet );
-+ indent_printf(fp, " TBCBitMap size of bitmap data 0x%x\n", static_cast< unsigned int > ( cbDIB ) );
-+}
-+
-+TB::TB() : bSignature(0x2),
-+bVersion(0x1),
-+cCL(0),
-+ltbid( 0x1 ),
-+ltbtr(0),
-+cRowsDefault( 0 ),
-+bFlags( 0 )
-+{
-+}
-+
-+bool TB::Read(SvStream *pS)
-+{
-+ OSL_TRACE("TB::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> bSignature >> bVersion >> cCL >> ltbid >> ltbtr >> cRowsDefault >> bFlags;
-+ name.Read( pS );
-+ return true;
-+
-+}
-+
-+bool TB::IsEnabled()
-+{
-+ return ( bFlags & 0x01 ) != 0x01;
-+}
-+
-+bool TB::NeedsPositioning()
-+{
-+ return ( bFlags & 0x10 ) == 0x10;
-+}
-+
-+void TB::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf(fp,"[ 0x%x ] TB -- dump\n", nOffSet );
-+ indent_printf(fp," bSignature 0x%x\n", bSignature );
-+ indent_printf(fp," bVersion 0x%x\n", bVersion );
-+ indent_printf(fp," cCL 0x%x\n", cCL );
-+ indent_printf(fp," ltbid 0x%x\n", ltbid );
-+ indent_printf(fp," ltbtr 0x%x\n", ltbtr );
-+ indent_printf(fp," cRowsDefault 0x%x\n", cRowsDefault );
-+ indent_printf(fp," bFlags 0x%x\n", bFlags );
-+ indent_printf(fp, " name %s\n", rtl::OUStringToOString( name.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+}
-+
-+TBVisualData::TBVisualData() : tbds(0), tbv(0), tbdsDock(0), iRow(0)
-+{
-+}
-+
-+bool TBVisualData::Read( SvStream* pS )
-+{
-+ OSL_TRACE("TBVisualData::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> tbds >> tbv >> tbdsDock >> iRow;
-+ rcDock.Read( pS );
-+ rcFloat.Read( pS );
-+ return true;
-+}
-+
-+void SRECT::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf( fp, " left 0x%x\n", left);
-+ indent_printf( fp, " top 0x%x\n", top);
-+ indent_printf( fp, " right 0x%x\n", right);
-+ indent_printf( fp, " bottom 0x%x\n", bottom);
-+}
-+
-+void TBVisualData::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf( fp, "[ 0x%x ] TBVisualData -- dump\n", nOffSet );
-+ indent_printf( fp, " tbds 0x%x\n", tbds);
-+ indent_printf( fp, " tbv 0x%x\n", tbv);
-+ indent_printf( fp, " tbdsDoc 0x%x\n", tbdsDock);
-+ indent_printf( fp, " iRow 0x%x\n", iRow);
-+ rcDock.Print( fp );
-+ rcFloat.Print( fp );
-+}
-+
-diff --git filter/source/msfilter/msvbasic.cxx filter/source/msfilter/msvbasic.cxx
-index 33a76ac..bcd021a 100644
---- filter/source/msfilter/msvbasic.cxx
-+++ filter/source/msfilter/msvbasic.cxx
-@@ -37,11 +37,804 @@
- #include <osl/endian.h>
- #include <rtl/tencinfo.h> //rtl_getTextEncodingFromWindowsCodePage
- #include "msvbasic.hxx"
-+#include <memory>
-+#include <rtl/ustrbuf.hxx>
-+#include <boost/shared_ptr.hpp>
-+#include <boost/scoped_array.hpp>
-+#include <boost/shared_array.hpp>
-+#include <svtools/filterutils.hxx>
-
- #include <com/sun/star/script/ModuleType.hpp>
-+#include <fstream>
-
- using namespace ::com::sun::star::script;
-
-+namespace MSLZSS {
-+
-+static unsigned int getShift( sal_uInt32 nPos )
-+{
-+ if (nPos <= 0x80) {
-+ if (nPos <= 0x20)
-+ return (nPos <= 0x10) ? 12 : 11;
-+ else
-+ return (nPos <= 0x40) ? 10 : 9;
-+ } else {
-+ if (nPos <= 0x200)
-+ return (nPos <= 0x100) ? 8 : 7;
-+ else if (nPos <= 0x800)
-+ return (nPos <= 0x400) ? 6 : 5;
-+ else
-+ return 4;
-+ }
-+}
-+
-+SvMemoryStream *decompressAsStream( SvStream *pStream, sal_uInt32 nOffset, sal_uInt32 *pCompressedLength = NULL, sal_uInt32 *pLength = NULL )
-+{
-+ SvMemoryStream *pResult;
-+ const sal_Int32 nWINDOWLEN = 4096;
-+ pResult = new SvMemoryStream();
-+
-+ sal_uInt8 nLeadbyte;
-+ unsigned int nPos = 0;
-+ int nLen, nDistance, nShift, nClean=1;
-+ sal_uInt8 aHistory[ nWINDOWLEN ];
-+
-+ pStream->Seek( nOffset + 3 );
-+
-+ while( pStream->Read( &nLeadbyte, 1 ) )
-+ {
-+ for(int nMask=0x01; nMask < 0x100; nMask = nMask<<1)
-+ {
-+ // we see if the leadbyte has flagged this location as a dataunit
-+ // which is actually a token which must be looked up in the history
-+ if( nLeadbyte & nMask )
-+ {
-+ sal_uInt16 nToken;
-+
-+ *pStream >> nToken;
-+
-+ if (nClean == 0)
-+ nClean=1;
-+
-+ //For some reason the division of the token into the length
-+ //field of the data to be inserted, and the distance back into
-+ //the history differs depending on how full the history is
-+ nShift = getShift( nPos % nWINDOWLEN );
-+
-+ nLen = (nToken & ((1<<nShift) - 1)) + 3;
-+ nDistance = nToken >> nShift;
-+
-+ //read the len of data from the history, wrapping around the
-+ //nWINDOWLEN boundary if necessary data read from the history
-+ //is also copied into the recent part of the history as well.
-+ for (int i = 0; i < nLen; i++)
-+ {
-+ unsigned char c;
-+ c = aHistory[(nPos-nDistance-1) % nWINDOWLEN];
-+ aHistory[nPos % nWINDOWLEN] = c;
-+ nPos++;
-+ }
-+ }
-+ else
-+ {
-+ // special boundary case code, not guarantueed to be correct
-+ // seems to work though, there is something wrong with the
-+ // compression scheme (or maybe a feature) where when the data
-+ // ends on a nWINDOWLEN boundary and the excess bytes in the 8
-+ // dataunit list are discarded, and not interpreted as tokens
-+ // or normal data.
-+ if ((nPos != 0) && ((nPos % nWINDOWLEN) == 0) && (nClean))
-+ {
-+ pStream->SeekRel(2);
-+ nClean=0;
-+ pResult->Write( aHistory, nWINDOWLEN );
-+ break;
-+ }
-+ //This is the normal case for when the data unit is not a
-+ //token to be looked up, but instead some normal data which
-+ //can be output, and placed in the history.
-+ if (pStream->Read(&aHistory[nPos % nWINDOWLEN],1))
-+ nPos++;
-+
-+ if (nClean == 0)
-+ nClean=1;
-+ }
-+ }
-+ }
-+ if (nPos % nWINDOWLEN)
-+ pResult->Write( aHistory, nPos % nWINDOWLEN );
-+ pResult->Flush();
-+
-+ if( pCompressedLength )
-+ *pCompressedLength = nPos;
-+
-+ if( pLength )
-+ *pLength = pResult->Tell();
-+
-+ pResult->Seek( 0 );
-+
-+ return pResult;
-+}
-+
-+} //MSZSS
-+
-+// also _VBA_PROJECT_VDPI can be used to create a usable
-+// ( and much smaller ) "_VBA_PROJECT" stream
-+
-+// _VBA_PROJECT Stream Version Dependant Project Information
-+// _VBA_PROJECT Stream Version Dependant Project Information
-+
-+class _VBA_PROJECT_VDPI
-+{
-+public:
-+sal_Int16 Reserved1;
-+sal_Int16 Version;
-+sal_Int8 Reserved2;
-+sal_Int16 Reserved3;
-+boost::scoped_array< sal_uInt8 > PerformanceCache;
-+sal_Int32 PerformanceCacheSize;
-+_VBA_PROJECT_VDPI(): Reserved1( 0x61CC), Version( 0xFFFF ), Reserved2(0x0), Reserved3(0x0), PerformanceCacheSize(0) {}
-+~_VBA_PROJECT_VDPI()
-+{
-+ PerformanceCacheSize = 0;
-+}
-+void read(){}
-+void write( SvStream* pStream )
-+{
-+ *pStream << Reserved1 << Version << Reserved2 << Reserved3;
-+ if ( PerformanceCacheSize )
-+ {
-+ PerformanceCache.reset( new sal_uInt8[ PerformanceCacheSize ] );
-+ pStream->Read( PerformanceCache.get(), PerformanceCacheSize );
-+ }
-+}
-+};
-+
-+class ProjectSysKindRecord
-+{
-+public:
-+sal_Int16 Id;
-+sal_Int32 Size;
-+sal_Int32 SysKind;
-+ProjectSysKindRecord(): Id(0x1), Size(0x4), SysKind( 0x1 ) {}
-+void read( SvStream* pStream )
-+{
-+ *pStream >> Id >> Size >> SysKind;
-+}
-+};
-+
-+class ProjectLcidRecord
-+{
-+public:
-+sal_Int16 Id;
-+sal_Int32 Size;
-+sal_Int32 Lcid;
-+
-+ProjectLcidRecord() : Id( 0x2 ), Size( 0x4 ), Lcid( 0x409 ) {}
-+void read( SvStream* pStream )
-+{
-+ OSL_TRACE("ProjectLcidRecord [0x%x]", pStream->Tell() );
-+ *pStream >> Id >> Size >> Lcid;
-+}
-+};
-+
-+class ProjectLcidInvokeRecord
-+{
-+sal_Int16 Id;
-+sal_Int32 Size;
-+sal_Int32 LcidInvoke;
-+public:
-+ProjectLcidInvokeRecord() : Id( 0x14 ), Size( 0x4 ), LcidInvoke( 0x409 ) {}
-+void read( SvStream* pStream )
-+{
-+ OSL_TRACE("ProjectLcidInvokeRecord [0x%x]", pStream->Tell() );
-+ *pStream >> Id >> Size >> LcidInvoke;
-+}
-+};
-+
-+class ProjectCodePageRecord
-+{
-+sal_Int16 Id;
-+sal_Int32 Size;
-+sal_Int16 CodePage;
-+public:
-+// #FIXME get a better default for the CodePage
-+ProjectCodePageRecord() : Id( 0x03 ), Size( 0x2 ), CodePage( 0x0 ) {}
-+void read( SvStream* pStream )
-+{
-+ OSL_TRACE("ProjectCodePageRecord [0x%x]", pStream->Tell() );
-+ *pStream >> Id >> Size >> CodePage;
-+}
-+};
-+class ProjectNameRecord
-+{
-+public:
-+sal_Int16 Id;
-+sal_Int32 SizeOfProjectName;
-+rtl::OUString ProjectName;
-+ProjectNameRecord() : Id( 0x04 ), SizeOfProjectName( 0x0 ){}
-+~ProjectNameRecord()
-+{
-+}
-+void read( SvStream* pStream )
-+{
-+ OSL_TRACE("ProjectNameRecord [0x%x]", pStream->Tell() );
-+ *pStream >> Id >> SizeOfProjectName;
-+
-+ if ( SizeOfProjectName )
-+ {
-+ boost::scoped_array< sal_uInt8 > pProjectName( new sal_uInt8[ SizeOfProjectName ] );
-+ OSL_TRACE("ProjectNameRecord about to read name from [0x%x], size %d", pStream->Tell(), SizeOfProjectName );
-+ pStream->Read( pProjectName.get(), SizeOfProjectName );
-+ ProjectName = svt::BinFilterUtils::CreateOUStringFromStringArray( reinterpret_cast< const char* >( pProjectName.get() ), SizeOfProjectName );
-+ }
-+}
-+};
-+
-+class ProjectDocStringRecord
-+{
-+public:
-+sal_Int16 Id;
-+sal_Int32 SizeOfDocString;
-+sal_Int16 Reserved;
-+sal_Int32 SizeOfDocStringUnicode;
-+rtl::OUString DocString;
-+rtl::OUString DocStringUnicode;
-+
-+ProjectDocStringRecord() : Id( 0x5 ), SizeOfDocString( 0x0 ), Reserved( 0x0 ), SizeOfDocStringUnicode( 0 ){}
-+
-+~ProjectDocStringRecord()
-+{
-+}
-+void read( SvStream* pStream )
-+{
-+ OSL_TRACE("ProjectDocStringRecord [0x%x]", pStream->Tell() );
-+ *pStream >> Id >> SizeOfDocString;
-+
-+
-+ boost::scoped_array< sal_uInt8 > pDocString( new sal_uInt8[ SizeOfDocString ] );
-+ pStream->Read( pDocString.get(), SizeOfDocString );
-+
-+ DocString = svt::BinFilterUtils::CreateOUStringFromStringArray( reinterpret_cast< const char* >( pDocString.get() ), SizeOfDocString );
-+
-+ *pStream >> Reserved >> SizeOfDocStringUnicode;
-+
-+ boost::scoped_array< sal_uInt8 > pDocStringUnicode( new sal_uInt8[ SizeOfDocStringUnicode ] );
-+
-+ pStream->Read( pDocStringUnicode.get(), SizeOfDocStringUnicode );
-+ DocStringUnicode = svt::BinFilterUtils::CreateOUStringFromUniStringArray( reinterpret_cast< const char* >( pDocStringUnicode.get() ), SizeOfDocString );
-+
-+}
-+
-+};
-+
-+class ProjectHelpFilePath
-+{
-+public:
-+sal_Int16 Id;
-+sal_Int32 SizeOfHelpFile1;
-+boost::scoped_array< sal_uInt8 > HelpFile1;
-+sal_Int16 Reserved;
-+sal_Int32 SizeOfHelpFile2;
-+boost::scoped_array< sal_uInt8 > HelpFile2;
-+
-+ProjectHelpFilePath() : Id( 0x06 ), SizeOfHelpFile1(0), Reserved(0x0), SizeOfHelpFile2(0) {}
-+~ProjectHelpFilePath()
-+{
-+}
-+
-+void read( SvStream* pStream )
-+{
-+ OSL_TRACE("ProjectHelpFilePath [0x%x]", pStream->Tell() );
-+ *pStream >> Id >> SizeOfHelpFile1;
-+
-+ HelpFile1.reset( new sal_uInt8[ SizeOfHelpFile1 ] );
-+ pStream->Read( HelpFile1.get(), SizeOfHelpFile1 );
-+
-+ *pStream >> Reserved >> SizeOfHelpFile2;
-+
-+ HelpFile2.reset( new sal_uInt8[ SizeOfHelpFile2 ] );
-+ pStream->Read( HelpFile2.get(), SizeOfHelpFile2 );
-+
-+}
-+};
-+
-+class ProjectHelpContextRecord
-+{
-+public:
-+sal_Int16 Id;
-+sal_Int32 Size;
-+sal_Int32 HelpContext;
-+
-+ProjectHelpContextRecord() : Id( 0x7 ), Size( 0x4 ), HelpContext( 0 ) {}
-+void read( SvStream* pStream )
-+{
-+
-+ OSL_TRACE("ProjectHelpContextRecord [0x%x]", pStream->Tell() );
-+ *pStream >> Id >> Size >> HelpContext;
-+}
-+
-+};
-+
-+class ProjectLibFlagsRecord
-+{
-+sal_Int16 Id;
-+sal_Int32 Size;
-+sal_Int32 ProjectLibFlags;
-+
-+public:
-+ProjectLibFlagsRecord() : Id( 0x8 ), Size( 0x4 ), ProjectLibFlags( 0x0 ) {}
-+void read( SvStream* pStream )
-+{
-+ OSL_TRACE("ProjectLibFlagsRecord [0x%x]", pStream->Tell() );
-+ *pStream >> Id >> Size >> ProjectLibFlags;
-+}
-+};
-+
-+class ProjectVersionRecord
-+{
-+public:
-+sal_Int16 Id;
-+sal_Int32 Reserved;
-+sal_Int32 VersionMajor;
-+sal_Int16 VersionMinor;
-+ProjectVersionRecord() : Id( 0x9 ), Reserved( 0x4 ), VersionMajor( 0x1 ), VersionMinor( 0 ) {}
-+void read( SvStream* pStream )
-+{
-+ OSL_TRACE("ProjectVersionRecord [0x%x]", pStream->Tell() );
-+ *pStream >> Id >> Reserved >> VersionMajor >> VersionMinor;
-+}
-+};
-+
-+class ProjectConstantsRecord
-+{
-+sal_Int16 Id;
-+sal_Int32 SizeOfConstants;
-+boost::scoped_array< sal_uInt8 > Constants;
-+sal_Int16 Reserved;
-+sal_Int32 SizeOfConstantsUnicode;
-+boost::scoped_array< sal_uInt8 > ConstantsUnicode;
-+public:
-+ProjectConstantsRecord() : Id( 0xC ), SizeOfConstants( 0 ), Constants( 0 ), Reserved( 0x3C ), SizeOfConstantsUnicode( 0 ), ConstantsUnicode(0) {}
-+
-+~ProjectConstantsRecord()
-+{
-+}
-+
-+void read( SvStream* pStream )
-+{
-+ OSL_TRACE("ProjectConstantsRecord [0x%x]", pStream->Tell() );
-+ *pStream >> Id >> SizeOfConstants;
-+ Constants.reset( new sal_uInt8[ SizeOfConstants ] );
-+
-+ pStream->Read( Constants.get(), SizeOfConstants );
-+
-+ *pStream >> Reserved;
-+
-+ *pStream >> SizeOfConstantsUnicode;
-+
-+ ConstantsUnicode.reset( new sal_uInt8[ SizeOfConstantsUnicode ] );
-+ pStream->Read( ConstantsUnicode.get(), SizeOfConstantsUnicode );
-+}
-+
-+};
-+
-+class ReferenceNameRecord
-+{
-+public:
-+sal_Int16 Id;
-+sal_Int32 SizeOfName;
-+rtl::OUString Name;
-+sal_Int16 Reserved;
-+sal_Int32 SizeOfNameUnicode;
-+rtl::OUString NameUnicode;
-+
-+ReferenceNameRecord() : Id( 0x16 ), SizeOfName( 0 ), Reserved( 0x3E ), SizeOfNameUnicode( 0 ){}
-+~ReferenceNameRecord()
-+{
-+}
-+
-+void read( SvStream* pStream )
-+{
-+ OSL_TRACE("NameRecord [0x%x]", pStream->Tell() );
-+ *pStream >> Id >> SizeOfName;
-+
-+ boost::scoped_array< sal_uInt8 > pName( new sal_uInt8[ SizeOfName ] );
-+
-+ pStream->Read( pName.get(), SizeOfName );
-+ Name = svt::BinFilterUtils::CreateOUStringFromStringArray( reinterpret_cast< const char* >( pName.get() ), SizeOfName );
-+
-+ *pStream >> Reserved >> SizeOfNameUnicode;
-+
-+ boost::scoped_array< sal_uInt8 > pNameUnicode( new sal_uInt8[ SizeOfNameUnicode ] );
-+ pStream->Read( pNameUnicode.get(), SizeOfNameUnicode );
-+ NameUnicode = svt::BinFilterUtils::CreateOUStringFromUniStringArray( reinterpret_cast< const char* >( pNameUnicode.get() ), SizeOfName );
-+}
-+
-+};
-+
-+// Baseclass for ReferenceControlRecord, ReferenceRegisteredRecord, ReferenceProjectRecord
-+class DirDumper;
-+
-+class BaseReferenceRecord
-+{
-+public:
-+virtual ~BaseReferenceRecord(){}
-+virtual bool read( SvStream* pStream ) = 0;
-+virtual void import( VBA_Impl& ){}
-+};
-+
-+
-+class ReferenceProjectRecord : public BaseReferenceRecord
-+{
-+public:
-+ sal_uInt16 Id;
-+ sal_uInt32 Size;
-+ sal_uInt32 SizeOfLibidAbsolute;
-+ sal_uInt32 SizeOfLibidRelative;
-+ sal_uInt32 MajorVersion;
-+ sal_uInt16 MinorVersion;
-+ rtl::OUString AbsoluteLibid;
-+ rtl::OUString RelativeLibid;
-+
-+ virtual bool read( SvStream* pStream );
-+ virtual void import( VBA_Impl& rDir );
-+ ReferenceProjectRecord();
-+ ~ReferenceProjectRecord();
-+};
-+
-+ReferenceProjectRecord::ReferenceProjectRecord() : Id( 0x000E ), Size( 0 ), SizeOfLibidAbsolute( 0 ), SizeOfLibidRelative( 0 ), MajorVersion( 0 ), MinorVersion( 0 )
-+{
-+}
-+
-+ReferenceProjectRecord::~ReferenceProjectRecord()
-+{
-+}
-+
-+bool ReferenceProjectRecord::read( SvStream* pStream )
-+{
-+ OSL_TRACE("ReferenceProjectRecord [0x%x]", pStream->Tell() );
-+ *pStream >> Id >> Size >> SizeOfLibidAbsolute;
-+
-+ boost::scoped_array< sal_uInt8 > pLibidAbsolute( new sal_uInt8[ SizeOfLibidAbsolute ] );
-+ OSL_TRACE("ReferenceProjectRecord about to read LibidAbsolute at [0x%x]", pStream->Tell() );
-+ pStream->Read( pLibidAbsolute.get(), SizeOfLibidAbsolute );
-+
-+ *pStream >> SizeOfLibidRelative;
-+
-+ boost::scoped_array< sal_uInt8 > pLibidRelative( new sal_uInt8[ SizeOfLibidRelative ] );
-+ OSL_TRACE("ReferenceProjectRecord about to read LibidRelative at [0x%x]", pStream->Tell() );
-+ pStream->Read( pLibidRelative.get(), SizeOfLibidRelative );
-+
-+ *pStream >> MajorVersion >> MinorVersion;
-+
-+ // array size is ORed with SVX_MSOCX_COMPRESSED to force processing of ascii bytes ( and not
-+ // 16 bit unicode )
-+ // the offset of 3 is needed to skip the ProjectReference "*\" and project kind ( 0x4[1-4] ) info.
-+
-+ AbsoluteLibid = svt::BinFilterUtils::CreateOUStringFromStringArray( reinterpret_cast< const char* >( pLibidAbsolute.get() + 3 ), (SizeOfLibidAbsolute - 3 ) );
-+ RelativeLibid = svt::BinFilterUtils::CreateOUStringFromStringArray( reinterpret_cast< const char* >( pLibidRelative.get() + 3 ), ( SizeOfLibidRelative -3 ) );
-+
-+ OSL_TRACE("ReferenceProjectRecord - absolute path %s", rtl::OUStringToOString( AbsoluteLibid, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ OSL_TRACE("ReferenceProjectRecord - relative path %s", rtl::OUStringToOString( RelativeLibid, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ return true;
-+}
-+
-+void ReferenceProjectRecord::import( VBA_Impl& rDir )
-+{
-+ rDir.AddProjectReference( AbsoluteLibid );
-+}
-+
-+class ReferenceRegisteredRecord : public BaseReferenceRecord
-+{
-+public:
-+ sal_uInt16 Id;
-+ sal_uInt32 Size;
-+ sal_uInt32 SizeOfLibid;
-+ boost::scoped_array< sal_uInt8> pLibid;
-+ sal_Int32 Reserved1;
-+ sal_Int16 Reserved2;
-+
-+ ReferenceRegisteredRecord();
-+ ~ReferenceRegisteredRecord();
-+ bool read( SvStream* pStream );
-+};
-+
-+ReferenceRegisteredRecord::ReferenceRegisteredRecord() : Id( 0x000D ), Size( 0 ), SizeOfLibid( 0 ), Reserved1( 0 ), Reserved2( 0 )
-+{
-+}
-+
-+ReferenceRegisteredRecord::~ReferenceRegisteredRecord()
-+{
-+}
-+
-+bool
-+ReferenceRegisteredRecord::read( SvStream* pStream )
-+{
-+ OSL_TRACE("ReferenceRegisteredRecord [0x%x]", pStream->Tell() );
-+ *pStream >> Id >> Size >> SizeOfLibid;
-+ if ( SizeOfLibid )
-+ {
-+ pLibid.reset( new sal_uInt8[ SizeOfLibid] );
-+ pStream->Read( pLibid.get(), SizeOfLibid );
-+ }
-+ *pStream >> Reserved1 >> Reserved2;
-+ return true;
-+}
-+
-+class ReferenceOriginalRecord
-+{
-+public:
-+ sal_uInt16 Id;
-+ sal_uInt32 SizeOfLibOriginal;
-+ boost::scoped_array< sal_uInt8 > pLibidOriginal;
-+
-+
-+ReferenceOriginalRecord() : Id( 0x033 ), SizeOfLibOriginal( 0 )
-+{
-+}
-+
-+~ReferenceOriginalRecord()
-+{
-+}
-+
-+void read( SvStream* pStream )
-+{
-+ *pStream >> Id >> SizeOfLibOriginal;
-+ if ( SizeOfLibOriginal )
-+ {
-+ pLibidOriginal.reset( new sal_uInt8[ SizeOfLibOriginal ] );
-+ pStream->Read( pLibidOriginal.get(), SizeOfLibOriginal );
-+ }
-+}
-+
-+};
-+
-+class ReferenceControlRecord : public BaseReferenceRecord
-+{
-+public:
-+std::auto_ptr< ReferenceOriginalRecord > OriginalRecord;
-+sal_Int16 Id;
-+sal_uInt32 SizeTwiddled;
-+sal_uInt32 SizeOfLibidTwiddled;
-+boost::shared_array< sal_uInt8 > LibidTwiddled;
-+sal_uInt32 Reserved1;
-+sal_uInt16 Reserved2;
-+std::auto_ptr< ReferenceNameRecord > NameRecordExtended;// Optional
-+sal_uInt16 Reserved3;
-+sal_uInt32 SizeExtended;
-+sal_uInt32 SizeOfLibidExtended;
-+boost::shared_array< sal_uInt8 > LibidExtended;
-+sal_uInt32 Reserved4;
-+sal_uInt16 Reserved5;
-+sal_uInt8 OriginalTypeLib[ 16 ];
-+sal_uInt32 Cookie;
-+
-+ReferenceControlRecord() : Id( 0x2F ), SizeTwiddled( 0 ), SizeOfLibidTwiddled( 0 ), Reserved1( 0 ), Reserved2( 0 ), Reserved3( 0x30 ), SizeExtended( 0 ), SizeOfLibidExtended( 0 ), Reserved4( 0 ), Reserved5( 0 ), Cookie( 0 )
-+{
-+ for( int i = 0; i < 16; ++i )
-+ OriginalTypeLib[ i ] = 0;
-+}
-+
-+~ReferenceControlRecord()
-+{
-+}
-+
-+bool read( SvStream* pStream )
-+{
-+ OSL_TRACE("ReferenceControlRecord [0x%x]", pStream->Tell() );
-+ long nPos = pStream->Tell();
-+
-+ *pStream >> Id;
-+ pStream->Seek( nPos ); // point before the peeked Id
-+ if ( Id == 0x33 ) // we have an OriginalRecord
-+ {
-+ OriginalRecord.reset( new ReferenceOriginalRecord() );
-+ OriginalRecord->read( pStream );
-+ }
-+ *pStream >> Id >> SizeTwiddled >> SizeOfLibidTwiddled;
-+
-+ if ( SizeOfLibidTwiddled )
-+ {
-+ LibidTwiddled.reset( new sal_uInt8[ SizeOfLibidTwiddled ] );
-+ pStream->Read( LibidTwiddled.get(), SizeOfLibidTwiddled );
-+ }
-+
-+ *pStream >> Reserved1 >> Reserved2;
-+
-+ nPos = pStream->Tell();
-+ // peek at the id for optional NameRecord
-+ sal_Int16 nTmpId;
-+ *pStream >> nTmpId;
-+ if ( nTmpId == 0x30 )
-+ {
-+ Reserved3 = 0x30;
-+ }
-+ else
-+ {
-+ pStream->Seek( nPos );
-+ NameRecordExtended.reset( new ReferenceNameRecord() );
-+ NameRecordExtended->read( pStream );
-+ *pStream >> Reserved3;
-+ }
-+ *pStream >> SizeExtended >> SizeOfLibidExtended;
-+
-+ if ( SizeExtended )
-+ {
-+ LibidExtended.reset( new sal_uInt8[ SizeOfLibidExtended ] );
-+ pStream->Read( LibidExtended.get(), SizeOfLibidExtended );
-+ }
-+
-+ *pStream >> Reserved4;
-+ *pStream >> Reserved5;
-+
-+ pStream->Read( OriginalTypeLib, sizeof( OriginalTypeLib ) );
-+ *pStream >> Cookie;
-+ return true;
-+}
-+
-+};
-+
-+class ReferenceRecord : public BaseReferenceRecord
-+{
-+public:
-+// NameRecord is Optional
-+std::auto_ptr< ReferenceNameRecord > NameRecord;
-+std::auto_ptr< BaseReferenceRecord > aReferenceRecord;
-+
-+ReferenceRecord(){}
-+~ReferenceRecord()
-+{
-+}
-+
-+// false return would mean failed to read Record e.g. end of array encountered
-+// Note: this read routine will make sure the stream is pointing to where it was the
-+// method was called )
-+
-+bool read( SvStream* pStream )
-+{
-+ OSL_TRACE("ReferenceRecord [0x%x]", pStream->Tell() );
-+ bool bRead = true;
-+ long nStart = pStream->Tell();
-+ long nPos = nStart;
-+ // Peek at the ID
-+ sal_Int16 Id;
-+ *pStream >> Id;
-+ pStream->Seek( nPos ); // place back before Id
-+ if ( Id == 0x16 ) // Optional NameRecord
-+ {
-+ NameRecord.reset( new ReferenceNameRecord() );
-+ NameRecord->read( pStream );
-+ }
-+ else if ( Id == 0x0f )
-+ {
-+ pStream->Seek( nStart );
-+ bRead = false;
-+ return bRead; // start of module, terminate read
-+ }
-+
-+ nPos = pStream->Tell(); // mark position, peek at next Id
-+ *pStream >> Id;
-+ pStream->Seek( nPos ); // place back before Id
-+
-+ switch( Id )
-+ {
-+ case 0x0D:
-+ aReferenceRecord.reset( new ReferenceRegisteredRecord() );
-+ break;
-+ case 0x0E:
-+ aReferenceRecord.reset( new ReferenceProjectRecord() );
-+ break;
-+ case 0x2F:
-+ case 0x33:
-+ aReferenceRecord.reset( new ReferenceControlRecord() );
-+ break;
-+ default:
-+ bRead = false;
-+ OSL_TRACE("Big fat error, unknown ID 0x%x", Id);
-+ break;
-+ }
-+ if ( bRead )
-+ aReferenceRecord->read( pStream );
-+ return bRead;
-+}
-+
-+void import( VBA_Impl& rVBA )
-+{
-+ if ( aReferenceRecord.get() )
-+ aReferenceRecord->import( rVBA );
-+}
-+
-+};
-+
-+class DirDumper
-+{
-+public:
-+ProjectSysKindRecord mSysKindRec;
-+ProjectLcidRecord mLcidRec;
-+ProjectLcidInvokeRecord mLcidInvokeRec;
-+ProjectCodePageRecord mCodePageRec;
-+ProjectNameRecord mProjectNameRec;
-+ProjectDocStringRecord mDocStringRec;
-+ProjectHelpFilePath mHelpFileRec;
-+ProjectHelpContextRecord mHelpContextRec;
-+ProjectLibFlagsRecord mLibFlagsRec;
-+ProjectVersionRecord mVersionRec;
-+ProjectConstantsRecord mConstantsRecord;
-+std::vector< ReferenceRecord* > ReferenceArray;
-+
-+DirDumper() {}
-+~DirDumper()
-+{
-+ for ( std::vector< ReferenceRecord* >::iterator it = ReferenceArray.begin(); it != ReferenceArray.end(); ++it )
-+ delete *it;
-+
-+}
-+
-+void read( SvStream* pStream )
-+{
-+ sal_Int32 nPos = pStream->Tell();
-+#ifdef DEBUG
-+ std::ofstream aDump("dir.dump");
-+ while ( !pStream->IsEof() )
-+ {
-+ sal_Int8 aByte;
-+ *pStream >> aByte;
-+ aDump << aByte;
-+ }
-+ aDump.flush();
-+#endif
-+ pStream->Seek( nPos );
-+ readProjectInformation( pStream );
-+ readProjectReferenceInformation( pStream );
-+}
-+
-+void readProjectReferenceInformation( SvStream* pStream )
-+{
-+ bool bKeepReading = true;
-+ while( bKeepReading )
-+ {
-+ ReferenceRecord* pRef = new ReferenceRecord();
-+ bKeepReading = pRef->read( pStream );
-+ if ( bKeepReading )
-+ ReferenceArray.push_back( pRef );
-+ }
-+}
-+
-+void readProjectInformation( SvStream* pStream )
-+{
-+ mSysKindRec.read( pStream );
-+ mLcidRec.read( pStream );
-+ mLcidInvokeRec.read( pStream );
-+ mCodePageRec.read( pStream );
-+ mProjectNameRec.read( pStream );
-+ mDocStringRec.read( pStream );
-+ mHelpFileRec.read( pStream );
-+ mHelpContextRec.read( pStream );
-+ mLibFlagsRec.read( pStream );
-+ mVersionRec.read( pStream );
-+ sal_Int32 nPos = pStream->Tell();
-+ sal_uInt16 nTmp;
-+ *pStream >> nTmp;
-+ if ( nTmp == 0x0C )
-+ {
-+ pStream->Seek( nPos );
-+ mConstantsRecord.read( pStream );
-+ }
-+ OSL_TRACE("After Information pos is 0x%x", pStream->Tell() );
-+}
-+
-+void import( VBA_Impl& rVBA )
-+{
-+ // get project references
-+ for ( std::vector< ReferenceRecord* >::iterator it = ReferenceArray.begin(); it != ReferenceArray.end(); ++it )
-+ (*it)->import( rVBA );
-+ rVBA.SetProjectName( mProjectNameRec.ProjectName );
-+
-+}
-+};
-+
-+
- /*
- A few urls which may in the future be of some use
- http://www.virusbtn.com/vb2000/Programme/papers/bontchev.pdf
-@@ -154,7 +947,21 @@ int VBA_Impl::ReadVBAProject(const SvStorageRef &rxVBAStorage)
- xVBAProject = rxVBAStorage->OpenSotStream(
- String( RTL_CONSTASCII_USTRINGPARAM( "_VBA_PROJECT" ) ),
- STREAM_STD_READ | STREAM_NOCREATE );
--
-+ // read Dir stream
-+ SvStorageStreamRef xDir = rxVBAStorage->OpenSotStream(
-+ String( RTL_CONSTASCII_USTRINGPARAM( "dir" ) ),
-+ STREAM_STD_READ | STREAM_NOCREATE );
-+// disable read and import of Dir stream bits, e.g. project references and
-+// project name for 3.1 ( a bit unstable yet )
-+#if 1
-+ // decompress the stream
-+ std::auto_ptr< SvMemoryStream > xCmpDir;
-+ xCmpDir.reset( MSLZSS::decompressAsStream( xDir, 0 ) );
-+ // try to parse the dir stream
-+ DirDumper dDump;
-+ dDump.read( xCmpDir.get() );
-+ dDump.import( *this );
-+#endif
- if( !xVBAProject.Is() || SVSTREAM_OK != xVBAProject->GetError() )
- {
- DBG_WARNING("Not able to find vba project, cannot find macros");
-@@ -415,6 +1222,7 @@ bool VBA_Impl::Open( const String &rToplevel, const String &rSublevel )
- if( !xMacros.Is() || SVSTREAM_OK != xMacros->GetError() )
- {
- DBG_WARNING("No Macros Storage");
-+ OSL_TRACE("No Macros Storage");
- }
- else
- {
-@@ -424,6 +1232,7 @@ bool VBA_Impl::Open( const String &rToplevel, const String &rSublevel )
- if( !xVBA.Is() || SVSTREAM_OK != xVBA->GetError() )
- {
- DBG_WARNING("No Visual Basic in Storage");
-+ OSL_TRACE("No Visual Basic in Storage");
- }
- else
- {
-@@ -438,6 +1247,7 @@ bool VBA_Impl::Open( const String &rToplevel, const String &rSublevel )
- * ( value ) is either a Class Module, Form Module or a plain VB Module. */
- SvStorageStreamRef xProject = xMacros->OpenSotStream(
- String( RTL_CONSTASCII_USTRINGPARAM( "PROJECT" ) ) );
-+
- SvStorageStream* pStp = xProject;
- UniString tmp;
- static const String sThisDoc( RTL_CONSTASCII_USTRINGPARAM( "ThisDocument" ) );
-diff --git filter/source/msfilter/msvbasic.hxx filter/source/msfilter/msvbasic.hxx
-index b163662..f35e3c8 100644
---- filter/source/msfilter/msvbasic.hxx
-+++ filter/source/msfilter/msvbasic.hxx
-@@ -36,6 +36,8 @@
- #include <tools/dynary.hxx>
- #include <vector>
- #include <map>
-+#include <com/sun/star/script/ModuleType.hpp>
-+using namespace ::com::sun::star::script::ModuleType;
-
- /* class VBA:
- * The VBA class provides a set of methods to handle Visual Basic For
-@@ -86,8 +88,14 @@ public:
- //
- // #117718# member map of module names to types of module
- ModType GetModuleType( const UniString& rModuleName );
-- std::vector<String> maReferences;
-+ rtl::OUString& ProjectName() { return msProjectName; }
-+ void SetProjectName( const rtl::OUString& rPName ) { msProjectName = rPName; }
-+ const std::vector<rtl::OUString>& ProjectReferences() { return maPrjReferences; }
-+ void AddProjectReference( const rtl::OUString& rProject ) { maPrjReferences.push_back( rProject); }
-+ SvStorage* GetStorage() { return xStor; }
- private:
-+ std::vector<rtl::OUString> maReferences;
-+ std::vector<rtl::OUString> maPrjReferences;
- struct VBAOffset_Impl
- {
- String sName;
-@@ -113,6 +121,7 @@ private:
- int ReadVBAProject(const SvStorageRef &rxVBAStorage);
- int DecompressVBA(int index, SvStorageStreamRef &rxVBAStream);
- sal_uInt8 ReadPString(SvStorageStreamRef &xVBAProject, bool bIsUnicode);
-+ rtl::OUString msProjectName;
- };
-
- #endif
-diff --git filter/source/msfilter/svxmsbas.cxx filter/source/msfilter/svxmsbas.cxx
-index fc1afa4..a123ada 100644
---- filter/source/msfilter/svxmsbas.cxx
-+++ filter/source/msfilter/svxmsbas.cxx
-@@ -65,26 +65,47 @@ using rtl::OUString;
-
- static ::rtl::OUString sVBAOption( RTL_CONSTASCII_USTRINGPARAM( "Option VBASupport 1\n" ) );
-
-+void SvxImportMSVBasic::extractAttribute( const String& rAttribute, const String& rModName )
-+{
-+ // format of the attribute we are interested in is
-+ // Attribute VB_Control = "ControlName", intString, MSForms, ControlTypeAsString
-+ // e.g.
-+ // Attribute VB_Control = "CommandButton1, 201, 19, MSForms, CommandButton"
-+ String sControlAttribute( RTL_CONSTASCII_USTRINGPARAM("Attribute VB_Control = \"") );
-+ if ( rAttribute.Search( sControlAttribute ) != STRING_NOTFOUND )
-+ {
-+ String sRest = rAttribute.Copy( sControlAttribute.Len() );
-+ xub_StrLen nPos = 0;
-+ String sCntrlName = sRest.GetToken( 0, ',', nPos );
-+
-+ sal_Int32 nCntrlId = sRest.GetToken( 0, ',', nPos).ToInt32();
-+ OSL_TRACE("In module %s, assiging %d controlname %s",
-+ rtl::OUStringToOString( rModName, RTL_TEXTENCODING_UTF8 ).getStr(), nCntrlId,
-+ rtl::OUStringToOString( sCntrlName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ m_ModuleNameToObjIdHash[ rModName ][ nCntrlId ] = sCntrlName;
-+ }
-+}
-+
- int SvxImportMSVBasic::Import( const String& rStorageName,
-- const String &rSubStorageName,
-- BOOL bAsComment, BOOL bStripped )
-+ const String &rSubStorageName,
-+ BOOL bAsComment, BOOL bStripped )
- {
- std::vector< String > codeNames;
- return Import( rStorageName, rSubStorageName, codeNames, bAsComment, bStripped );
- }
--
- int SvxImportMSVBasic::Import( const String& rStorageName,
- const String &rSubStorageName,
- const std::vector< String >& codeNames,
- BOOL bAsComment, BOOL bStripped )
- {
-+ msProjectName = rtl::OUString();
- int nRet = 0;
-- if( bImport && ImportCode_Impl( rStorageName, rSubStorageName, codeNames,
-+ if( bImport && ImportCode_Impl( rStorageName, rSubStorageName, codeNames,
- bAsComment, bStripped ))
- nRet |= 1;
-
- if (bImport)
-- ImportForms_Impl(rStorageName, rSubStorageName);
-+ ImportForms_Impl(rStorageName, rSubStorageName, !bAsComment);
-
- if( bCopy && CopyStorage_Impl( rStorageName, rSubStorageName ))
- nRet |= 2;
-@@ -93,9 +114,44 @@ int SvxImportMSVBasic::Import( const String& rStorageName,
- }
-
- bool SvxImportMSVBasic::ImportForms_Impl(const String& rStorageName,
-- const String& rSubStorageName)
-+ const String& rSubStorageName, BOOL bVBAMode )
- {
-- SvStorageRef xVBAStg(xRoot->OpenSotStorage(rStorageName,
-+ BOOL bRet = FALSE;
-+ // #FIXME VBA_Impl ( or some other new class ) should handle both userforms
-+ // and code
-+ VBA_Impl aVBA( *xRoot, TRUE );
-+ // This call is a waste we read the source ( again ) only to get the refereneces
-+ // *AGAIN*, we really need to rewrite all of this
-+ aVBA.Open( rStorageName, rSubStorageName );
-+
-+ bRet = ImportForms_Impl( aVBA, rStorageName, rSubStorageName, bVBAMode );
-+ std::vector<rtl::OUString> sProjectRefs = aVBA.ProjectReferences();
-+
-+ for ( std::vector<rtl::OUString>::iterator it = sProjectRefs.begin(); it != sProjectRefs.end(); ++it )
-+ {
-+ rtl::OUString sFileName = *it;
-+#ifndef WIN
-+#ifdef DEBUG
-+ // hacky test code to read referenced projects on linux
-+ sal_Int32 nPos = (*it).lastIndexOf('\\');
-+ sFileName = (*it).copy( nPos + 1 );
-+ sFileName = rtl::OUString::createFromAscii("~/Documents/") + sFileName;
-+#endif
-+#endif
-+ SotStorageRef rRoot = new SotStorage( sFileName, STREAM_STD_READWRITE, STORAGE_TRANSACTED );
-+ VBA_Impl refVBA( *rRoot, TRUE );
-+ refVBA.Open( rStorageName, rSubStorageName );
-+ // The return from ImportForms doesn't indicate and error ( it could )
-+ // but also it just means no userforms were imported
-+ if ( ImportForms_Impl( refVBA, rStorageName, rSubStorageName, bVBAMode ) )
-+ bRet = true; // mark that at least on userform was imported
-+ }
-+ return bRet;
-+}
-+
-+bool SvxImportMSVBasic::ImportForms_Impl( VBA_Impl& rVBA, const String& rStorageName, const String& rSubStorageName, BOOL bVBAMode )
-+{
-+ SvStorageRef xVBAStg(rVBA.GetStorage()->OpenSotStorage(rStorageName,
- STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYALL));
- if (!xVBAStg.Is() || xVBAStg->GetError())
- return false;
-@@ -128,6 +184,10 @@ bool SvxImportMSVBasic::ImportForms_Impl(const String& rStorageName,
- DBG_ASSERT( xLibContainer.is(), "No BasicContainer!" );
-
- String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
-+
-+ if (rVBA.ProjectName().getLength() )
-+ aLibName = rVBA.ProjectName();
-+ OSL_TRACE( "userformage lib name %s", rtl::OUStringToOString( aLibName, RTL_TEXTENCODING_UTF8 ).getStr() );
- Reference<XNameContainer> xLib;
- if (xLibContainer.is())
- {
-@@ -177,7 +237,17 @@ bool SvxImportMSVBasic::ImportForms_Impl(const String& rStorageName,
- xSF->createInstance(
- OUString(RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.awt.UnoControlDialogModel"))), uno::UNO_QUERY);
--
-+ // #FIXME HACK - mark the Model with the VBA mode
-+ // In vba mode the imported userform uses 100th mm as units
-+ // or geometry
-+ // In non vba mode MAP_APPFONT is used ( same as normal basic
-+ // dialogs
-+ if ( bVBAMode )
-+ {
-+ Reference<XPropertySet> xDlgProps(xDialog, UNO_QUERY);
-+ if ( xDlgProps.is() )
-+ xDlgProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VBAForm") ), uno::makeAny( sal_True ) );
-+ }
- OCX_UserForm aForm(xVBAStg, *aIter, *aIter, xDialog, xSF );
- aForm.pDocSh = &rDocSh;
- sal_Bool bOk = aForm.Read(xTypes);
-@@ -246,8 +316,34 @@ BOOL SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName,
- {
- BOOL bRet = FALSE;
- VBA_Impl aVBA( *xRoot, bAsComment );
-+
- if( aVBA.Open(rStorageName,rSubStorageName) )
- {
-+ msProjectName = aVBA.ProjectName();
-+
-+ if ( msProjectName.getLength() )
-+ rDocSh.GetBasicManager()->SetName( msProjectName ); // set name of Project
-+
-+ bRet = ImportCode_Impl( aVBA, codeNames, bAsComment, bStripped );
-+ std::vector<rtl::OUString> sProjectRefs = aVBA.ProjectReferences();
-+
-+ for ( std::vector<rtl::OUString>::iterator it = sProjectRefs.begin(); it != sProjectRefs.end(); ++it )
-+ {
-+ rtl::OUString sFileName = *it;
-+ OSL_TRACE("referenced project %s ", rtl::OUStringToOString( sFileName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ SotStorageRef rRoot = new SotStorage( sFileName, STREAM_STD_READWRITE, STORAGE_TRANSACTED );
-+ VBA_Impl refVBA( *rRoot, bAsComment );
-+ std::vector< String > codeNamesNone;
-+ if( refVBA.Open(rStorageName,rSubStorageName) && ImportCode_Impl( refVBA, codeNamesNone, bAsComment, bStripped ) )
-+ bRet = TRUE; // mark that some code was imported
-+ }
-+ }
-+ return bRet;
-+}
-+
-+BOOL SvxImportMSVBasic::ImportCode_Impl( VBA_Impl& aVBA, const std::vector< String >& codeNames, BOOL bAsComment, BOOL bStripped )
-+{
-+ BOOL bRet = FALSE;
- SFX_APP()->EnterBasicCall();
- Reference<XLibraryContainer> xLibContainer = rDocSh.GetBasicContainer();
- DBG_ASSERT( xLibContainer.is(), "No BasicContainer!" );
-@@ -268,6 +364,8 @@ BOOL SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName,
- UINT16 nStreamCount = aVBA.GetNoStreams();
- Reference<XNameContainer> xLib;
- String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
-+ if ( aVBA.ProjectName().getLength() )
-+ aLibName = aVBA.ProjectName();
- if( xLibContainer.is() && nStreamCount )
- {
- if( !xLibContainer->hasByName( aLibName ) )
-@@ -416,7 +514,11 @@ BOOL SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName,
- if( nEnd == STRING_NOTFOUND )
- pStr->Erase();
- else
-+ {
-+ String sAttr= pStr->Copy( nBegin, (nEnd-nBegin)+1);
-+ extractAttribute( sAttr, sModule );
- pStr->Erase(nBegin, (nEnd-nBegin)+1);
-+ }
- }
- }
- if( aDecompressed.Get(j)->Len() )
-@@ -495,7 +597,6 @@ BOOL SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName,
- bRet = true;
- }
- SFX_APP()->LeaveBasicCall();
-- }
- return bRet;
- }
-
-diff --git forms/source/component/FormComponent.cxx forms/source/component/FormComponent.cxx
-index 2513636..55d19fb 100644
---- forms/source/component/FormComponent.cxx
-+++ forms/source/component/FormComponent.cxx
-@@ -2751,8 +2751,8 @@ void SAL_CALL OBoundControlModel::setValueBinding( const Reference< XValueBindin
- OSL_PRECOND( m_bSupportsExternalBinding, "OBoundControlModel::setValueBinding: How did you reach this method?" );
- // the interface for this method should not have been exposed if we do not
- // support binding to external data
--
-- if ( !impl_approveValueBinding_nolock( _rxBinding ) )
-+ // allow reset
-+ if ( _rxBinding.is() && !impl_approveValueBinding_nolock( _rxBinding ) )
- {
- throw IncompatibleTypesException(
- FRM_RES_STRING( RID_STR_INCOMPATIBLE_TYPES ),
-diff --git forms/source/component/GroupManager.cxx forms/source/component/GroupManager.cxx
-index dfc679d..c4c8224 100644
---- forms/source/component/GroupManager.cxx
-+++ forms/source/component/GroupManager.cxx
-@@ -124,14 +124,13 @@ OGroupComp::OGroupComp(const Reference<XPropertySet>& rxSet, sal_Int32 nInsertPo
- ,m_xControlModel(rxSet,UNO_QUERY)
- ,m_nPos( nInsertPos )
- ,m_nTabIndex(0)
-+ ,m_aName( OGroupManager::GetGroupName( rxSet ) )
- {
- if (m_xComponent.is())
- {
- if (hasProperty( PROPERTY_TABINDEX, m_xComponent ) )
- // Indices kleiner 0 werden wie 0 behandelt
- m_nTabIndex = Max(getINT16(m_xComponent->getPropertyValue( PROPERTY_TABINDEX )) , sal_Int16(0));
--
-- m_xComponent->getPropertyValue( PROPERTY_NAME ) >>= m_aName;
- }
- }
-
-@@ -318,7 +317,8 @@ void OGroupManager::removeFromGroupMap(const ::rtl::OUString& _sGroupName,const
- aFind->second.RemoveComponent( _xSet );
-
- // Wenn Anzahl der Gruppenelemente == 1 ist, Gruppe deaktivieren
-- if ( aFind->second.Count() == 1 )
-+ sal_Int32 nCount = aFind->second.Count();
-+ if ( nCount == 1 || nCount == 0 )
- {
- OActiveGroups::iterator aActiveFind = ::std::find(
- m_aActiveGroupMap.begin(),
-@@ -329,7 +329,7 @@ void OGroupManager::removeFromGroupMap(const ::rtl::OUString& _sGroupName,const
- {
- // the group is active. Deactivate it if the remaining component
- // is *no* radio button
-- if ( !isRadioButton( aFind->second.GetObject( 0 ) ) )
-+ if ( nCount == 0 || !isRadioButton( aFind->second.GetObject( 0 ) ) )
- m_aActiveGroupMap.erase( aActiveFind );
- }
- }
-@@ -338,6 +338,8 @@ void OGroupManager::removeFromGroupMap(const ::rtl::OUString& _sGroupName,const
-
- // Bei Component als PropertyChangeListener abmelden
- _xSet->removePropertyChangeListener( PROPERTY_NAME, this );
-+ if (hasProperty(PROPERTY_GROUP_NAME, _xSet))
-+ _xSet->removePropertyChangeListener( PROPERTY_GROUP_NAME, this );
- if (hasProperty(PROPERTY_TABINDEX, _xSet))
- _xSet->removePropertyChangeListener( PROPERTY_TABINDEX, this );
- }
-@@ -348,10 +350,23 @@ void SAL_CALL OGroupManager::propertyChange(const PropertyChangeEvent& evt) thro
-
- // Component aus Gruppe entfernen
- ::rtl::OUString sGroupName;
-- if (evt.PropertyName == PROPERTY_NAME)
-+ if (hasProperty( PROPERTY_GROUP_NAME, xSet ))
-+ xSet->getPropertyValue( PROPERTY_GROUP_NAME ) >>= sGroupName;
-+ if (evt.PropertyName == PROPERTY_NAME) {
-+ if (sGroupName.getLength() > 0)
-+ return; // group hasn't changed; ignore this name change.
-+ // no GroupName; use Name as GroupNme
- evt.OldValue >>= sGroupName;
-+ }
-+ else if (evt.PropertyName == PROPERTY_GROUP_NAME) {
-+ evt.OldValue >>= sGroupName;
-+ if (sGroupName.getLength() == 0) {
-+ // No prior GroupName; fallback to Nme
-+ xSet->getPropertyValue( PROPERTY_NAME ) >>= sGroupName;
-+ }
-+ }
- else
-- xSet->getPropertyValue( PROPERTY_NAME ) >>= sGroupName;
-+ sGroupName = GetGroupName( xSet );
-
- removeFromGroupMap(sGroupName,xSet);
-
-@@ -434,8 +449,7 @@ void OGroupManager::InsertElement( const Reference<XPropertySet>& xSet )
- m_pCompGroup->InsertComponent( xSet );
-
- // Component in Gruppe aufnehmen
-- ::rtl::OUString sGroupName;
-- xSet->getPropertyValue( PROPERTY_NAME ) >>= sGroupName;
-+ ::rtl::OUString sGroupName( GetGroupName( xSet ) );
-
- OGroupArr::iterator aFind = m_aGroupArr.find(sGroupName);
-
-@@ -473,6 +487,8 @@ void OGroupManager::InsertElement( const Reference<XPropertySet>& xSet )
-
- // Bei Component als PropertyChangeListener anmelden
- xSet->addPropertyChangeListener( PROPERTY_NAME, this );
-+ if (hasProperty(PROPERTY_GROUP_NAME, xSet))
-+ xSet->addPropertyChangeListener( PROPERTY_GROUP_NAME, this );
-
- // Tabindex muss nicht jeder unterstuetzen
- if (hasProperty(PROPERTY_TABINDEX, xSet))
-@@ -489,12 +505,26 @@ void OGroupManager::RemoveElement( const Reference<XPropertySet>& xSet )
- return;
-
- // Component aus Gruppe entfernen
-- ::rtl::OUString sGroupName;
-- xSet->getPropertyValue( PROPERTY_NAME ) >>= sGroupName;
-+ ::rtl::OUString sGroupName( GetGroupName( xSet ) );
-
- removeFromGroupMap(sGroupName,xSet);
- }
-
-+::rtl::OUString OGroupManager::GetGroupName( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xComponent )
-+{
-+ if (!xComponent.is())
-+ return ::rtl::OUString();
-+ ::rtl::OUString sGroupName;
-+ if (hasProperty( PROPERTY_GROUP_NAME, xComponent )) {
-+ xComponent->getPropertyValue( PROPERTY_GROUP_NAME ) >>= sGroupName;
-+ if (sGroupName.getLength() == 0)
-+ xComponent->getPropertyValue( PROPERTY_NAME ) >>= sGroupName;
-+ }
-+ else
-+ xComponent->getPropertyValue( PROPERTY_NAME ) >>= sGroupName;
-+ return sGroupName;
-+}
-+
- //.........................................................................
- } // namespace frm
- //.........................................................................
-diff --git forms/source/component/GroupManager.hxx forms/source/component/GroupManager.hxx
-index f514771..2143c76 100644
---- forms/source/component/GroupManager.hxx
-+++ forms/source/component/GroupManager.hxx
-@@ -217,6 +217,8 @@ public:
- void getGroup(sal_Int32 nGroup, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel> >& _rGroup, ::rtl::OUString& Name);
- void getGroupByName(const ::rtl::OUString& Name, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel> >& _rGroup);
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel> > getControlModels();
-+
-+ static ::rtl::OUString GetGroupName( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xComponent );
- };
-
-
-diff --git forms/source/component/ListBox.cxx forms/source/component/ListBox.cxx
-index fe24fc2..51661d1 100644
---- forms/source/component/ListBox.cxx
-+++ forms/source/component/ListBox.cxx
-@@ -1555,6 +1555,8 @@ namespace frm
- void SAL_CALL OListBoxControl::itemStateChanged(const ItemEvent& _rEvent) throw(RuntimeException)
- {
- // forward this to our listeners
-+ Reference< XChild > xChild( getModel(), UNO_QUERY );
-+ if ( xChild.is() && xChild->getParent().is() )
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_aItemListeners.getLength() )
-@@ -1567,6 +1569,8 @@ namespace frm
- m_pItemBroadcaster->addEvent( new ItemEventDescription( _rEvent ), this );
- }
- }
-+ else
-+ m_aItemListeners.notifyEach( &XItemListener::itemStateChanged, _rEvent );
-
- // and do the handling for the ChangeListeners
- ::osl::ClearableMutexGuard aGuard(m_aMutex);
-diff --git forms/source/component/RadioButton.cxx forms/source/component/RadioButton.cxx
-index 27ae8cd..05e9bb6 100644
---- forms/source/component/RadioButton.cxx
-+++ forms/source/component/RadioButton.cxx
-@@ -28,6 +28,7 @@
- // MARKER(update_precomp.py): autogen include statement, do not remove
- #include "precompiled_forms.hxx"
- #include "RadioButton.hxx"
-+#include "GroupManager.hxx"
- #include "property.hxx"
- #include "property.hrc"
- #include "services.hxx"
-@@ -119,6 +120,7 @@ ORadioButtonModel::ORadioButtonModel(const Reference<XMultiServiceFactory>& _rxF
- m_nClassId = FormComponentType::RADIOBUTTON;
- m_aLabelServiceName = FRM_SUN_COMPONENT_GROUPBOX;
- initValueProperty( PROPERTY_STATE, PROPERTY_ID_STATE );
-+ startAggregatePropertyListening( PROPERTY_GROUP_NAME );
- }
-
- //------------------------------------------------------------------
-@@ -166,7 +168,11 @@ StringSequence SAL_CALL ORadioButtonModel::getSupportedServiceNames() throw(Runt
- void ORadioButtonModel::SetSiblingPropsTo(const ::rtl::OUString& rPropName, const Any& rValue)
- {
- // my name
-- ::rtl::OUString sMyName(m_aName);
-+ ::rtl::OUString sMyGroup;
-+ if (hasProperty(PROPERTY_GROUP_NAME, this))
-+ this->getPropertyValue(PROPERTY_GROUP_NAME) >>= sMyGroup;
-+ if (sMyGroup.getLength() == 0)
-+ sMyGroup = m_aName;
-
- // meine Siblings durchiterieren
- Reference<XIndexAccess> xIndexAccess(getParent(), UNO_QUERY);
-@@ -174,8 +180,9 @@ void ORadioButtonModel::SetSiblingPropsTo(const ::rtl::OUString& rPropName, cons
- {
- Reference<XPropertySet> xMyProps;
- query_interface(static_cast<XWeak*>(this), xMyProps);
-- ::rtl::OUString sCurrentName;
-- for (sal_Int32 i=0; i<xIndexAccess->getCount(); ++i)
-+ ::rtl::OUString sCurrentGroup;
-+ sal_Int32 nNumSiblings = xIndexAccess->getCount();
-+ for (sal_Int32 i=0; i<nNumSiblings; ++i)
- {
- Reference<XPropertySet> xSiblingProperties(*(InterfaceRef*)xIndexAccess->getByIndex(i).getValue(), UNO_QUERY);
- if (!xSiblingProperties.is())
-@@ -192,8 +199,8 @@ void ORadioButtonModel::SetSiblingPropsTo(const ::rtl::OUString& rPropName, cons
- continue;
-
- // das 'zur selben Gruppe gehoeren' wird am Namen festgemacht
-- xSiblingProperties->getPropertyValue(PROPERTY_NAME) >>= sCurrentName;
-- if (sCurrentName == sMyName)
-+ sCurrentGroup = OGroupManager::GetGroupName( xSiblingProperties );
-+ if (sCurrentGroup == sMyGroup)
- xSiblingProperties->setPropertyValue(rPropName, rValue);
- }
- }
-@@ -220,40 +227,7 @@ void ORadioButtonModel::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, cons
- // die andere Richtung : wenn sich mein Name aendert ...
- if (nHandle == PROPERTY_ID_NAME)
- {
-- // ... muss ich testen, ob ich Siblings mit dem selben Namen habe, damit ich deren ControlSource uebernehmen kann
-- Reference<XIndexAccess> xIndexAccess(getParent(), UNO_QUERY);
-- if (xIndexAccess.is())
-- {
-- ::rtl::OUString sName;
-- ::rtl::OUString sControlSource;
--
-- Reference<XPropertySet> xMyProps;
-- query_interface(static_cast<XWeak*>(this), xMyProps);
-- for (sal_Int32 i=0; i<xIndexAccess->getCount(); ++i)
-- {
-- Reference<XPropertySet> xSiblingProperties(*(InterfaceRef*)xIndexAccess->getByIndex(i).getValue(), UNO_QUERY);
-- if (!xSiblingProperties.is())
-- continue;
--
-- if (xMyProps == xSiblingProperties)
-- // nur wenn ich nicht mich selber gefunden habe
-- continue;
--
-- sal_Int16 nType = 0;
-- xSiblingProperties->getPropertyValue(PROPERTY_CLASSID) >>= nType;
-- if (nType != FormComponentType::RADIOBUTTON)
-- // nur Radio-Buttons
-- continue;
--
-- xSiblingProperties->getPropertyValue(PROPERTY_NAME) >>= sName;
-- // Control, das zur gleichen Gruppe gehoert ?
-- if (rValue == sName)
-- {
-- setPropertyValue(PROPERTY_CONTROLSOURCE, xSiblingProperties->getPropertyValue(PROPERTY_CONTROLSOURCE));
-- break;
-- }
-- }
-- }
-+ setControlSource();
- }
-
- if (nHandle == PROPERTY_ID_DEFAULT_STATE)
-@@ -271,6 +245,52 @@ void ORadioButtonModel::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, cons
- }
- }
-
-+void ORadioButtonModel::setControlSource()
-+{
-+ Reference<XIndexAccess> xIndexAccess(getParent(), UNO_QUERY);
-+ if (xIndexAccess.is())
-+ {
-+ ::rtl::OUString sName, sGroupName;
-+
-+ if (hasProperty(PROPERTY_GROUP_NAME, this))
-+ this->getPropertyValue(PROPERTY_GROUP_NAME) >>= sGroupName;
-+ this->getPropertyValue(PROPERTY_NAME) >>= sName;
-+
-+ Reference<XPropertySet> xMyProps;
-+ query_interface(static_cast<XWeak*>(this), xMyProps);
-+ for (sal_Int32 i=0; i<xIndexAccess->getCount(); ++i)
-+ {
-+ Reference<XPropertySet> xSiblingProperties(*(InterfaceRef*)xIndexAccess->getByIndex(i).getValue(), UNO_QUERY);
-+ if (!xSiblingProperties.is())
-+ continue;
-+
-+ if (xMyProps == xSiblingProperties)
-+ // nur wenn ich nicht mich selber gefunden habe
-+ continue;
-+
-+ sal_Int16 nType = 0;
-+ xSiblingProperties->getPropertyValue(PROPERTY_CLASSID) >>= nType;
-+ if (nType != FormComponentType::RADIOBUTTON)
-+ // nur Radio-Buttons
-+ continue;
-+
-+ ::rtl::OUString sSiblingName, sSiblingGroupName;
-+ if (hasProperty(PROPERTY_GROUP_NAME, xSiblingProperties))
-+ xSiblingProperties->getPropertyValue(PROPERTY_GROUP_NAME) >>= sSiblingGroupName;
-+ xSiblingProperties->getPropertyValue(PROPERTY_NAME) >>= sSiblingName;
-+
-+ if ((sGroupName.getLength() == 0 && sSiblingGroupName.getLength() == 0 && // (no group name
-+ sName == sSiblingName) || // names match) or
-+ (sGroupName.getLength() != 0 && sSiblingGroupName.getLength() != 0 && // (have group name
-+ sGroupName == sSiblingGroupName)) // they match)
-+ {
-+ setPropertyValue(PROPERTY_CONTROLSOURCE, xSiblingProperties->getPropertyValue(PROPERTY_CONTROLSOURCE));
-+ break;
-+ }
-+ }
-+ }
-+}
-+
- //------------------------------------------------------------------------------
- void ORadioButtonModel::describeFixedProperties( Sequence< Property >& _rProps ) const
- {
-@@ -360,6 +380,13 @@ void ORadioButtonModel::_propertyChanged(const PropertyChangeEvent& _rEvent) thr
- SetSiblingPropsTo( PROPERTY_STATE, aZero );
- }
- }
-+ else if ( _rEvent.PropertyName.equals( PROPERTY_GROUP_NAME ) )
-+ {
-+ setControlSource();
-+ // Can't call OReferenceValueComponent::_propertyChanged(), as it
-+ // doesn't know what to do with the GroupName property.
-+ return;
-+ }
-
- OReferenceValueComponent::_propertyChanged( _rEvent );
- }
-diff --git forms/source/component/RadioButton.hxx forms/source/component/RadioButton.hxx
-index 0b1ab0e..0d10b05 100644
---- forms/source/component/RadioButton.hxx
-+++ forms/source/component/RadioButton.hxx
-@@ -84,6 +84,8 @@ private:
- our mutex is aquired exactly once
- */
- void setNewAggregateState( const ::com::sun::star::uno::Any& _rValue );
-+
-+ void setControlSource();
- };
-
- //==================================================================
-diff --git forms/source/inc/frm_strings.hxx forms/source/inc/frm_strings.hxx
-index 1f57f42..ae411ac 100644
---- forms/source/inc/frm_strings.hxx
-+++ forms/source/inc/frm_strings.hxx
-@@ -97,6 +97,7 @@ namespace frm
- FORMS_CONSTASCII_STRING( PROPERTY_TABINDEX, "TabIndex" );
- FORMS_CONSTASCII_STRING( PROPERTY_TAG, "Tag" );
- FORMS_CONSTASCII_STRING( PROPERTY_NAME, "Name" );
-+ FORMS_CONSTASCII_STRING( PROPERTY_GROUP_NAME, "GroupName" );
- FORMS_CONSTASCII_STRING( PROPERTY_CLASSID, "ClassId" );
- FORMS_CONSTASCII_STRING( PROPERTY_FETCHSIZE, "FetchSize" );
- FORMS_CONSTASCII_STRING( PROPERTY_VALUE, "Value" );
-diff --git forms/source/inc/property.hrc forms/source/inc/property.hrc
-index e70dff4..5c44b93 100644
---- forms/source/inc/property.hrc
-+++ forms/source/inc/property.hrc
-@@ -60,8 +60,8 @@ namespace frm
- #define PROPERTY_ID_WRITING_MODE (PROPERTY_ID_START + 20)
- #define PROPERTY_ID_CONTEXT_WRITING_MODE (PROPERTY_ID_START + 21)
- #define PROPERTY_ID_VERTICAL_ALIGN (PROPERTY_ID_START + 22)
--#define PROPERTY_ID_GRAPHIC (PROPERTY_ID_START + 23)
-+#define PROPERTY_ID_GROUP_NAME (PROPERTY_ID_START + 23)
-+#define PROPERTY_ID_GRAPHIC (PROPERTY_ID_START + 24)
-- // free
- // free
- // free
- // free
-diff --git formula/inc/formula/FormulaCompiler.hxx formula/inc/formula/FormulaCompiler.hxx
-index 47fefb3..1f40d74 100644
---- formula/inc/formula/FormulaCompiler.hxx
-+++ formula/inc/formula/FormulaCompiler.hxx
-@@ -219,6 +219,8 @@ public:
- void SetCompileForFAP( BOOL bVal )
- { bCompileForFAP = bVal; bIgnoreErrors = bVal; }
-
-+ static bool IsOpCodeVolatile( OpCode eOp );
-+
- static BOOL DeQuote( String& rStr );
-
- static const String& GetNativeSymbol( OpCode eOp );
-diff --git formula/source/core/api/FormulaCompiler.cxx formula/source/core/api/FormulaCompiler.cxx
-index fed0aab..fca0dc4 100644
---- formula/source/core/api/FormulaCompiler.cxx
-+++ formula/source/core/api/FormulaCompiler.cxx
-@@ -741,6 +741,30 @@ OpCode FormulaCompiler::GetEnglishOpCode( const String& rName ) const
- return bFound ? (*iLook).second : OpCode(ocNone);
- }
-
-+bool FormulaCompiler::IsOpCodeVolatile( OpCode eOp )
-+{
-+ switch (eOp)
-+ {
-+ // no parameters:
-+ case ocRandom:
-+ case ocGetActDate:
-+ case ocGetActTime:
-+ // one parameter:
-+ case ocFormula:
-+ case ocInfo:
-+ // more than one parameters:
-+ // ocIndirect/ocIndirectXL otherwise would have to do
-+ // StopListening and StartListening on a reference for every
-+ // interpreted value.
-+ case ocIndirect:
-+ case ocIndirectXL:
-+ // ocOffset results in indirect references.
-+ case ocOffset:
-+ return true;
-+ }
-+ return false;
-+}
-+
- // Remove quotes, escaped quotes are unescaped.
- BOOL FormulaCompiler::DeQuote( String& rStr )
- {
-@@ -957,44 +981,32 @@ void FormulaCompiler::Factor()
- {
- if( nNumFmt == NUMBERFORMAT_UNDEFINED )
- nNumFmt = lcl_GetRetFormat( eOp );
-- // Functions that have to be always recalculated
-- switch( eOp )
-+
-+ if ( IsOpCodeVolatile(eOp) )
-+ pArr->SetRecalcModeAlways();
-+ else
- {
-- // no parameters:
-- case ocRandom:
-- case ocGetActDate:
-- case ocGetActTime:
-- // one parameter:
-- case ocFormula:
-- case ocInfo:
-- // more than one parameters:
-- // ocIndirect/ocIndirectXL otherwise would have to do
-- // StopListening and StartListening on a reference for every
-- // interpreted value.
-- case ocIndirect:
-- case ocIndirectXL:
-- // ocOffset results in indirect references.
-- case ocOffset:
-- pArr->SetRecalcModeAlways();
-- break;
-- // Functions recalculated on every document load.
-- // Don't use SetRecalcModeOnLoad() which would override
-- // ModeAlways.
-- case ocConvert :
-- pArr->AddRecalcMode( RECALCMODE_ONLOAD );
-- break;
-- // If the referred cell is moved the value changes.
-- case ocColumn :
-- case ocRow :
-- // ocCell needs recalc on move for some possible type values.
-- case ocCell :
-- pArr->SetRecalcModeOnRefMove();
-- break;
-- case ocHyperLink :
-- pArr->SetHyperLink(TRUE);
-- break;
-- default:
-- ; // nothing
-+ switch( eOp )
-+ {
-+ // Functions recalculated on every document load.
-+ // Don't use SetRecalcModeOnLoad() which would override
-+ // ModeAlways.
-+ case ocConvert :
-+ pArr->AddRecalcMode( RECALCMODE_ONLOAD );
-+ break;
-+ // If the referred cell is moved the value changes.
-+ case ocColumn :
-+ case ocRow :
-+ // ocCell needs recalc on move for some possible type values.
-+ case ocCell :
-+ pArr->SetRecalcModeOnRefMove();
-+ break;
-+ case ocHyperLink :
-+ pArr->SetHyperLink(TRUE);
-+ break;
-+ default:
-+ ; // nothing
-+ }
- }
- if (SC_OPCODE_START_NO_PAR <= eOp && eOp < SC_OPCODE_STOP_NO_PAR)
- {
-diff --git offapi/com/sun/star/document/XCompatWriterDocProperties.idl offapi/com/sun/star/document/XCompatWriterDocProperties.idl
-new file mode 100644
-index 0000000..435ffb3
---- /dev/null
-+++ offapi/com/sun/star/document/XCompatWriterDocProperties.idl
-@@ -0,0 +1,49 @@
-+/*************************************************************************
-+ *
-+ * 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: XDocumentProperties.idl,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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __com_sun_star_document_XCompatWriterDocProperties_idl__
-+#define __com_sun_star_document_XCompatWriterDocProperties_idl__
-+
-+#ifndef __com_sun_star_document_XDocumentProperties_idl__
-+#include <com/sun/star/document/XDocumentProperties.idl>
-+#endif
-+//=============================================================================
-+
-+module com { module sun { module star { module document {
-+interface XCompatWriterDocProperties
-+{
-+// interface ::com::sun::star::document::XDocumentProperties;
-+ [attribute] string Manager;
-+ [attribute] string Category;
-+ [attribute] string Company;
-+
-+
-+}; }; }; };
-+};
-+#endif
-diff --git offapi/com/sun/star/document/XVbaMethodParameter.idl offapi/com/sun/star/document/XVbaMethodParameter.idl
-new file mode 100644
-index 0000000..7ef5296
---- /dev/null
-+++ offapi/com/sun/star/document/XVbaMethodParameter.idl
-@@ -0,0 +1,68 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009
-+ * Copyright 2009 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: XVbaMethodParameter,v $
-+ * $Revision: 1.13 $
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef __org_openoffice_vba_XVbaMethodParameter_idl__
-+#define __org_openoffice_vba_XVbaMethodParameter_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+//=============================================================================
-+
-+module com { module sun { module star { module document {
-+
-+//=============================================================================
-+//gives access to vba method input/output parameters
-+//
-+//some OO objects need to implement this interface to support the passing of input/output parameters
-+//for certain VBA events
-+
-+interface XVbaMethodParameter : com::sun::star::uno::XInterface
-+{
-+ //-------------------------------------------------------------------------
-+
-+ /** sets the value of the parameter with the specified name.
-+ */
-+ void setVbaMethodParameter( [in] string PropertyName,
-+ [in] any Value );
-+
-+ //-------------------------------------------------------------------------
-+
-+ /** returns the value of the parameter with the specified name.
-+ */
-+ any getVbaMethodParameter( [in] string PropertyName );
-+};
-+
-+//=============================================================================
-+
-+}; }; }; };
-+#endif
-diff --git offapi/com/sun/star/document/makefile.mk offapi/com/sun/star/document/makefile.mk
-index 48394a6..6796fcf 100644
---- offapi/com/sun/star/document/makefile.mk
-+++ offapi/com/sun/star/document/makefile.mk
-@@ -114,7 +114,9 @@ IDLFILES=\
- XDocumentRevisionListPersistence.idl\
- DocumentRevisionListPersistence.idl \
- XDocumentLanguages.idl \
-- XCodeNameQuery.idl
-+ XCodeNameQuery.idl \
-+ XCompatWriterDocProperties.idl \
-+ XVbaMethodParameter.idl \
-
-
- # ------------------------------------------------------------------
-diff --git offapi/com/sun/star/drawing/Shape.idl offapi/com/sun/star/drawing/Shape.idl
-index 360352a..92fbdff 100644
---- offapi/com/sun/star/drawing/Shape.idl
-+++ offapi/com/sun/star/drawing/Shape.idl
-@@ -200,6 +200,10 @@ published service Shape
- the z-order.
- */
- [optional, property] long NavigationOrder;
-+
-+ /** this property lets you get and set a hyperlink for this shape.
-+ */
-+ [optional, property] string Hyperlink;
- };
-
- //=============================================================================
-diff --git offapi/com/sun/star/script/XLibraryQueryExecutable.idl offapi/com/sun/star/script/XLibraryQueryExecutable.idl
-new file mode 100644
-index 0000000..48dbfaa
---- /dev/null
-+++ offapi/com/sun/star/script/XLibraryQueryExecutable.idl
-@@ -0,0 +1,51 @@
-+/*************************************************************************
-+ *
-+ * 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: XLibraryContainer.idl,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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __com_sun_star_script_XLibraryQueryExecutable_idl__
-+#define __com_sun_star_script_XLibraryQueryExecutable_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+//=============================================================================
-+
-+module com { module sun { module star { module script {
-+
-+interface XLibraryQueryExecutable: com::sun::star::uno::XInterface
-+{
-+ boolean HasExecutableCode( [in] string name );
-+};
-+
-+//=============================================================================
-+
-+
-+}; }; }; };
-+
-+#endif
-diff --git offapi/com/sun/star/script/makefile.mk offapi/com/sun/star/script/makefile.mk
-index da8e911..8c46453 100644
---- offapi/com/sun/star/script/makefile.mk
-+++ offapi/com/sun/star/script/makefile.mk
-@@ -48,6 +48,7 @@ IDLFILES=\
- XLibraryContainerExport.idl\
- XPersistentLibraryContainer.idl\
- XStorageBasedLibraryContainer.idl\
-+ XLibraryQueryExecutable.idl \
- ModuleSizeExceededRequest.idl\
- ModuleInfo.idl\
- ModuleType.idl
-diff --git officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
-index 5629a4f..f9c9970 100644
---- officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
-+++ officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
-@@ -1205,6 +1205,12 @@
- <value xml:lang="en-US">~Remove Filter</value>
- </prop>
- </node>
-+ <node oor:name=".uno:DataForm" oor:op="replace">
-+ <prop oor:name="Label" oor:type="xs:string">
-+ <value xml:lang="de">D~atenForm...</value>
-+ <value xml:lang="en-US">D~ataForm...</value>
-+ </prop>
-+ </node>
- <node oor:name=".uno:DataSubTotals" oor:op="replace">
- <prop oor:name="Label" oor:type="xs:string">
- <value xml:lang="en-US">Sub~totals...</value>
-diff --git officecfg/registry/schema/org/openoffice/Office/Calc.xcs officecfg/registry/schema/org/openoffice/Office/Calc.xcs
-index 2db99d2..97a3cd2 100644
---- officecfg/registry/schema/org/openoffice/Office/Calc.xcs
-+++ officecfg/registry/schema/org/openoffice/Office/Calc.xcs
-@@ -1394,7 +1394,7 @@
- <desc>Indicates whether VBA macros are imported without comments to be executable.</desc>
- <label>Executable code</label>
- </info>
-- <value>false</value>
-+ <value>true</value>
- </prop>
- <prop oor:name="Save" oor:type="xs:boolean">
- <!-- OldPath: Filter/MS_Office/Basic/Excel -->
-diff --git officecfg/registry/schema/org/openoffice/Office/Writer.xcs officecfg/registry/schema/org/openoffice/Office/Writer.xcs
-index 9abada4..de76f80 100644
---- officecfg/registry/schema/org/openoffice/Office/Writer.xcs
-+++ officecfg/registry/schema/org/openoffice/Office/Writer.xcs
-@@ -746,6 +746,17 @@
- </group>
- </templates>
- <component>
-+ <group oor:name="GlobalTemplateList">
-+ <info>
-+ <desc>Contains the most recently opened documents.</desc>
-+ </info>
-+ <prop oor:name="Paths" oor:type="oor:string-list">
-+ <info>
-+ <desc>Lists the file global templates loaded when importing writer documents.</desc>
-+ </info>
-+ <value oor:separator=";"></value>
-+ </prop>
-+ </group>
- <group oor:name="MailMergeWizard">
- <info>
- <desc>Settings of the mail merge wizard.</desc>
-@@ -6021,6 +6032,14 @@
- </info>
- <value>true</value>
- </prop>
-+ <prop oor:name="Executable" oor:type="xs:boolean">
-+ <info>
-+ <author>pflin</author>
-+ <desc>Indicates whether VBA macros are imported without comments to be executable.</desc>
-+ <label>Executable code</label>
-+ </info>
-+ <value>true</value>
-+ </prop>
- <prop oor:name="Save" oor:type="xs:boolean">
- <!-- OldPath: Filter/MS_Office/Basic/Word -->
- <!-- OldLocation: soffice.cfg -->
-diff --git oovbaapi/genconstidl/api-to-idl.pl oovbaapi/genconstidl/api-to-idl.pl
-index 33e28e2..972e8b3 100644
---- oovbaapi/genconstidl/api-to-idl.pl
-+++ oovbaapi/genconstidl/api-to-idl.pl
-@@ -125,6 +125,9 @@ sub generate_idls($) {
- foreach $module ( keys %result ) {
- foreach $type ( keys %{$result{$module}} ) {
- my $fname = $path . "/" . $type . ".idl";
-+ if ( uc($module) eq "ADODB" || uc($module) eq "DAO" ) {
-+ $fname = $path . "/" . uc($module) . "_" . $type . ".idl";
-+ }
- open( IDL, ">$fname" ) || die "Cannot write $fname.";
-
- if( $module eq "vba" ) {
-diff --git oovbaapi/ooo/vba/XApplicationBase.idl oovbaapi/ooo/vba/XApplicationBase.idl
-index 2a98305..c1490fc 100644
---- oovbaapi/ooo/vba/XApplicationBase.idl
-+++ oovbaapi/ooo/vba/XApplicationBase.idl
-@@ -50,7 +50,7 @@ interface XApplicationBase
- void Quit();
-
- any CommandBars( [in] any aIndex );
-- void Run([in] string MacroName, [in] /*Optional*/ any varg1, [in] /*Optional*/ any varg2, [in] /*Optional*/ any varg3, [in] /*Optional*/ any varg4, [in] /*Optional*/ any varg5, [in] /*Optional*/ any varg6, [in] /*Optional*/ any varg7, [in] /*Optional*/ any varg8, [in] /*Optional*/ any varg9, [in] /*Optional*/ any varg10, [in] /*Optional*/ any varg11, [in] /*Optional*/ any varg12, [in] /*Optional*/ any varg13, [in] /*Optional*/ any varg14, [in] /*Optional*/ any varg15, [in] /*Optional*/ any varg16, [in] /*Optional*/ any varg17, [in] /*Optional*/ any varg18, [in] /*Optional*/ any varg19, [in] /*Optional*/ any varg20, [in] /*Optional*/ any varg21, [in] /*Optional*/ any varg22, [in] /*Optional*/ any varg23, [in] /*Optional*/ any varg24, [in] /*Optional*/ any varg25, [in] /*Optional*/ any varg26, [in] /*Optional*/ any varg27, [in] /*Optional*/ any varg28, [in] /*Optional*/ any varg29, [in] /*Optional*/ any varg30);
-+ any Run([in] string MacroName, [in] /*Optional*/ any varg1, [in] /*Optional*/ any varg2, [in] /*Optional*/ any varg3, [in] /*Optional*/ any varg4, [in] /*Optional*/ any varg5, [in] /*Optional*/ any varg6, [in] /*Optional*/ any varg7, [in] /*Optional*/ any varg8, [in] /*Optional*/ any varg9, [in] /*Optional*/ any varg10, [in] /*Optional*/ any varg11, [in] /*Optional*/ any varg12, [in] /*Optional*/ any varg13, [in] /*Optional*/ any varg14, [in] /*Optional*/ any varg15, [in] /*Optional*/ any varg16, [in] /*Optional*/ any varg17, [in] /*Optional*/ any varg18, [in] /*Optional*/ any varg19, [in] /*Optional*/ any varg20, [in] /*Optional*/ any varg21, [in] /*Optional*/ any varg22, [in] /*Optional*/ any varg23, [in] /*Optional*/ any varg24, [in] /*Optional*/ any varg25, [in] /*Optional*/ any varg26, [in] /*Optional*/ any varg27, [in] /*Optional*/ any varg28, [in] /*Optional*/ any varg29, [in] /*Optional*/ any varg30);
- void OnTime( [in] any aEarliestTime, [in] string aFunction, [in] any aLatestTime, [in] any aSchedule );
- float CentimetersToPoints([in] float Centimeters );
- void Undo();
-diff --git oovbaapi/ooo/vba/XDialogBase.idl oovbaapi/ooo/vba/XDialogBase.idl
-index ee5c833..48fa3d8 100644
---- oovbaapi/ooo/vba/XDialogBase.idl
-+++ oovbaapi/ooo/vba/XDialogBase.idl
-@@ -46,7 +46,7 @@ interface XDialogBase
- {
- interface ::ooo::vba::XHelperInterface;
-
-- void Show();
-+ boolean Show();
- };
-
- }; };
-diff --git oovbaapi/ooo/vba/XDocumentBase.idl oovbaapi/ooo/vba/XDocumentBase.idl
-index bb45caf..04181bb 100644
---- oovbaapi/ooo/vba/XDocumentBase.idl
-+++ oovbaapi/ooo/vba/XDocumentBase.idl
-@@ -53,7 +53,6 @@ interface XDocumentBase
- void Close([in] any SaveChanges, [in] any FileName, [in] any RouteWorkBook);
- void Save();
- void Activate();
-- void Protect( [in] any Password );
- void Unprotect( [in] any Password );
- };
-
-diff --git oovbaapi/ooo/vba/XFileDialog.idl oovbaapi/ooo/vba/XFileDialog.idl
-new file mode 100644
-index 0000000..846e16f
---- /dev/null
-+++ oovbaapi/ooo/vba/XFileDialog.idl
-@@ -0,0 +1,54 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009, 2010.
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef __ooo_vba_excel_XFileDialog_idl__
-+#define __ooo_vba_excel_XFileDialog_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#include <ooo/vba/XFileDialogSelectedItems.idl>
-+
-+//=============================================================================
-+
-+module ooo { module vba {
-+
-+//=============================================================================
-+
-+interface XFileDialog : com::sun::star::uno::XInterface
-+{
-+ [attribute, readonly] ooo::vba::XFileDialogSelectedItems SelectedItems;
-+
-+ long Show();
-+};
-+
-+}; };
-+
-+#endif
-+
-diff --git oovbaapi/ooo/vba/XFileDialogSelectedItems.idl oovbaapi/ooo/vba/XFileDialogSelectedItems.idl
-new file mode 100644
-index 0000000..b844667
---- /dev/null
-+++ oovbaapi/ooo/vba/XFileDialogSelectedItems.idl
-@@ -0,0 +1,54 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009, 2010.
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+
-+#ifndef __ooo_vba_excel_XFileDialogSelectedItems_idl__
-+#define __ooo_vba_excel_XFileDialogSelectedItems_idl__
-+
-+// #ifndef __com_sun_star_uno_XInterface_idl__
-+// #include <com/sun/star/uno/XInterface.idl>
-+// #endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+//=============================================================================
-+
-+module ooo { module vba {
-+
-+//=============================================================================
-+
-+interface XFileDialogSelectedItems
-+{
-+ interface ooo::vba::XCollection;
-+};
-+
-+}; };
-+
-+#endif
-+
-diff --git oovbaapi/ooo/vba/XFileSearch.idl oovbaapi/ooo/vba/XFileSearch.idl
-new file mode 100644
-index 0000000..b88f87c
---- /dev/null
-+++ oovbaapi/ooo/vba/XFileSearch.idl
-@@ -0,0 +1,61 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009, 2010.
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef __ooo_vba_XFileSearch_idl__
-+#define __ooo_vba_XFileSearch_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XFoundFiles_idl__
-+#include <ooo/vba/XFoundFiles.idl>
-+#endif
-+
-+//=============================================================================
-+
-+module ooo { module vba {
-+//=============================================================================
-+
-+interface XFileSearch
-+{
-+ interface ::com::sun::star::uno::XInterface;
-+
-+ [attribute] string FileName;
-+ [attribute] string LookIn;
-+ [attribute] boolean SearchSubFolders;
-+ [attribute] boolean MatchTextExactly;
-+ [attribute, readonly] XFoundFiles FoundFiles;
-+
-+ long Execute();
-+ void NewSearch();
-+};
-+
-+}; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/XFoundFiles.idl oovbaapi/ooo/vba/XFoundFiles.idl
-new file mode 100644
-index 0000000..ce6dba1
---- /dev/null
-+++ oovbaapi/ooo/vba/XFoundFiles.idl
-@@ -0,0 +1,52 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009, 2010.
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef __ooo_vba_XFoundFiles_idl__
-+#define __ooo_vba_XFoundFiles_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+//=============================================================================
-+
-+module ooo { module vba {
-+//=============================================================================
-+
-+interface XFoundFiles
-+{
-+ interface ooo::vba::XCollection;
-+};
-+
-+}; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/excel/XApplication.idl oovbaapi/ooo/vba/excel/XApplication.idl
-index ac1f4c4..a09caea 100644
---- oovbaapi/ooo/vba/excel/XApplication.idl
-+++ oovbaapi/ooo/vba/excel/XApplication.idl
-@@ -32,6 +32,14 @@
- #include <ooo/vba/XHelperInterface.idl>
- #include <ooo/vba/XAssistant.idl>
-
-+#ifndef __ooo_vba_excel_XFileDialog_idl__
-+#include <ooo/vba/XFileDialog.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XFileSearch_idl__
-+#include <ooo/vba/XFileSearch.idl>
-+#endif
-+
- module ooo { module vba { module excel {
-
- interface XRange;
-@@ -41,6 +49,8 @@ interface XWorksheets;
- interface XWorksheetFunction;
- interface XWindow;
- interface XWorksheet;
-+interface XFileDialog;
-+interface XFileSearch;
-
- interface XApplication
- {
-@@ -56,8 +66,10 @@ interface XApplication
- [attribute, readonly] XWindow ActiveWindow;
- [attribute, readonly] XWorksheet ActiveSheet;
- [attribute, readonly] ooo::vba::XAssistant Assistant;
-+ [attribute, readonly] ooo::vba::XFileSearch FileSearch; //liuchen 2009-8-18, add the support of VBA Application.FileSearch
- [attribute] long Calculation;
- [attribute, readonly] XWorkbook ThisWorkbook;
-+ [attribute, readonly] ooo::vba::XFileDialog FileDialog;
- [attribute, readonly] string Name;
- [attribute] boolean DisplayAlerts;
- [attribute] boolean DisplayFormulaBar;
-@@ -65,11 +77,16 @@ interface XApplication
- [attribute] any StatusBar;
- [attribute] long Cursor;
- [attribute] boolean EnableEvents;
-+ [attribute] boolean Visible;
-+ [attribute] boolean Iteration; //liuchen 2009-11-25
-+ [attribute] long EnableCancelKey; //liuchen 2009-11-26
-
- void setDefaultFilePath([in] string DefaultFilePath) raises(com::sun::star::script::BasicErrorException);
-
- string getDefaultFilePath() raises(com::sun::star::script::BasicErrorException);
-
-+ any GetOpenFilename([in] /*Optional*/ any FileFilter, [in] /*Optional*/ any FilterIndex, [in] /*Optional*/ any Title, [in] /*Optional*/ any ButtonText, [in] /*Optional*/ any MultiSelect); //minz, 2009-07-08
-+
- string LibraryPath() raises(com::sun::star::script::BasicErrorException);
- string TemplatesPath() raises(com::sun::star::script::BasicErrorException);
- string PathSeparator() raises(com::sun::star::script::BasicErrorException);
-@@ -91,8 +108,14 @@ interface XApplication
- XRange Union([in] XRange Arg1, [in] XRange Arg2, [in] /*Optional*/ any Arg3, [in] /*Optional*/ any Arg4, [in] /*Optional*/ any Arg5, [in] /*Optional*/ any Arg6, [in] /*Optional*/ any Arg7, [in] /*Optional*/ any Arg8, [in] /*Optional*/ any Arg9, [in] /*Optional*/ any Arg10, [in] /*Optional*/ any Arg11, [in] /*Optional*/ any Arg12, [in] /*Optional*/ any Arg13, [in] /*Optional*/ any Arg14, [in] /*Optional*/ any Arg15, [in] /*Optional*/ any Arg16, [in] /*Optional*/ any Arg17, [in] /*Optional*/ any Arg18, [in] /*Optional*/ any Arg19, [in] /*Optional*/ any Arg20, [in] /*Optional*/ any Arg21, [in] /*Optional*/ any Arg22, [in] /*Optional*/ any Arg23, [in] /*Optional*/ any Arg24, [in] /*Optional*/ any Arg25, [in] /*Optional*/ any Arg26, [in] /*Optional*/ any Arg27, [in] /*Optional*/ any Arg28, [in] /*Optional*/ any Arg29, [in] /*Optional*/ any Arg30)
- raises(com::sun::star::script::BasicErrorException);
- void Volatile([in] any Volatile);
-- void DoEvents();
- any Caller( [in] any aIndex );
-+ any MenuBars( [in] any aIndex );
-+ any International([in] long Index); //liuchen 2009-11-26
-+ any GetSaveAsFilename( [in] any InitialFilename, [in] any FileFilter, [in] any FilterIndex, [in] any Title,[in] any ButtonText);
-+ void Undo(); //2009-10-11 limingl
-+ double InchesToPoints([in] double Inches);
-+ void setSheetsInNewWorkbook( [in] long SheetsInNewWorkbook ) raises(com::sun::star::script::BasicErrorException);
-+ long getSheetsInNewWorkbook();
- };
-
- }; }; };
-diff --git oovbaapi/ooo/vba/excel/XGlobals.idl oovbaapi/ooo/vba/excel/XGlobals.idl
-index c54740a..1ffcfdc 100644
---- oovbaapi/ooo/vba/excel/XGlobals.idl
-+++ oovbaapi/ooo/vba/excel/XGlobals.idl
-@@ -73,6 +73,7 @@ XRange Intersect([in] XRange Arg1, [in] XRange Arg2, [in] /*Optional*/ any Arg3,
- any Names( [in] any Index );
- XRange Union([in] XRange Arg1, [in] XRange Arg2, [in] /*Optional*/ any Arg3, [in] /*Optional*/ any Arg4, [in] /*Optional*/ any Arg5, [in] /*Optional*/ any Arg6, [in] /*Optional*/ any Arg7, [in] /*Optional*/ any Arg8, [in] /*Optional*/ any Arg9, [in] /*Optional*/ any Arg10, [in] /*Optional*/ any Arg11, [in] /*Optional*/ any Arg12, [in] /*Optional*/ any Arg13, [in] /*Optional*/ any Arg14, [in] /*Optional*/ any Arg15, [in] /*Optional*/ any Arg16, [in] /*Optional*/ any Arg17, [in] /*Optional*/ any Arg18, [in] /*Optional*/ any Arg19, [in] /*Optional*/ any Arg20, [in] /*Optional*/ any Arg21, [in] /*Optional*/ any Arg22, [in] /*Optional*/ any Arg23, [in] /*Optional*/ any Arg24, [in] /*Optional*/ any Arg25, [in] /*Optional*/ any Arg26, [in] /*Optional*/ any Arg27, [in] /*Optional*/ any Arg28, [in] /*Optional*/ any Arg29, [in] /*Optional*/ any Arg30)
- raises(com::sun::star::script::BasicErrorException);
-+ any MenuBars( [in] any aIndex );
-
- };
-
-diff --git oovbaapi/ooo/vba/excel/XMenu.idl oovbaapi/ooo/vba/excel/XMenu.idl
-new file mode 100644
-index 0000000..cb3698b
---- /dev/null
-+++ oovbaapi/ooo/vba/excel/XMenu.idl
-@@ -0,0 +1,62 @@
-+/*************************************************************************
-+ *
-+ * 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 __ooo_vba_excel_XMenu_idl__
-+#define __ooo_vba_excel_XMenu_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+//=============================================================================
-+
-+module ooo { module vba { module excel {
-+//=============================================================================
-+
-+interface XMenu
-+{
-+ interface XHelperInterface;
-+
-+ [attribute] string Caption;
-+
-+ void Delete() raises ( com::sun::star::script::BasicErrorException );
-+ any MenuItems( [in] any Index ) raises ( com::sun::star::script::BasicErrorException );
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/excel/XMenuBar.idl oovbaapi/ooo/vba/excel/XMenuBar.idl
-new file mode 100644
-index 0000000..3ead272
---- /dev/null
-+++ oovbaapi/ooo/vba/excel/XMenuBar.idl
-@@ -0,0 +1,59 @@
-+/*************************************************************************
-+ *
-+ * 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 __ooo_vba_excel_XMenuBar_idl__
-+#define __ooo_vba_excel_XMenuBar_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+//=============================================================================
-+
-+module ooo { module vba { module excel {
-+//=============================================================================
-+
-+interface XMenuBar
-+{
-+ interface XHelperInterface;
-+
-+ any Menus( [in] any Index ) raises ( com::sun::star::script::BasicErrorException );
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/excel/XMenuBars.idl oovbaapi/ooo/vba/excel/XMenuBars.idl
-new file mode 100644
-index 0000000..3a46c3b
---- /dev/null
-+++ oovbaapi/ooo/vba/excel/XMenuBars.idl
-@@ -0,0 +1,66 @@
-+/*************************************************************************
-+ *
-+ * 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: XMenuBars.idl,v $
-+ * $Revision: 1.0 $
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_excel_XMenuBars_idl__
-+#define __ooo_vba_excel_XMenuBars_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+#ifndef __com_sun_star_helper_script_BasicErrorException_idl__
-+#include <com/sun/star/script/BasicErrorException.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+//=============================================================================
-+
-+module ooo { module vba { module excel {
-+
-+//=============================================================================
-+
-+interface XMenuBars
-+{
-+ interface ooo::vba::XCollection;
-+};
-+
-+//=============================================================================
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/excel/XMenuItem.idl oovbaapi/ooo/vba/excel/XMenuItem.idl
-new file mode 100644
-index 0000000..2dcfb2f
---- /dev/null
-+++ oovbaapi/ooo/vba/excel/XMenuItem.idl
-@@ -0,0 +1,62 @@
-+/*************************************************************************
-+ *
-+ * 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 __ooo_vba_excel_XMenuItem_idl__
-+#define __ooo_vba_excel_XMenuItem_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+//=============================================================================
-+
-+module ooo { module vba { module excel {
-+//=============================================================================
-+
-+interface XMenuItem
-+{
-+ interface XHelperInterface;
-+
-+ [attribute] string Caption;
-+ [attribute] string OnAction;
-+
-+ void Delete() raises ( com::sun::star::script::BasicErrorException );
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/excel/XMenuItems.idl oovbaapi/ooo/vba/excel/XMenuItems.idl
-new file mode 100644
-index 0000000..9ba7b38
---- /dev/null
-+++ oovbaapi/ooo/vba/excel/XMenuItems.idl
-@@ -0,0 +1,70 @@
-+/*************************************************************************
-+ *
-+ * 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: XMenuItems.idl,v $
-+ * $Revision: 1.0 $
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_excel_XMenuItems_idl__
-+#define __ooo_vba_excel_XMenuItems_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+#ifndef __com_sun_star_helper_script_BasicErrorException_idl__
-+#include <com/sun/star/script/BasicErrorException.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+//=============================================================================
-+
-+module ooo { module vba { module excel {
-+
-+//=============================================================================
-+
-+interface XMenuItem;
-+
-+interface XMenuItems
-+{
-+ interface ooo::vba::XCollection;
-+
-+ XMenuItem Add( [in] string Caption, [in] any OnAction, [in] any ShortcutKey, [in] any Before, [in] any Restore, [in] any StatusBar, [in] any HelpFile, [in] any HelpContextID ) raises ( com::sun::star::script::BasicErrorException );
-+};
-+
-+//=============================================================================
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/excel/XMenus.idl oovbaapi/ooo/vba/excel/XMenus.idl
-new file mode 100644
-index 0000000..c8e4ea2
---- /dev/null
-+++ oovbaapi/ooo/vba/excel/XMenus.idl
-@@ -0,0 +1,70 @@
-+/*************************************************************************
-+ *
-+ * 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: XMenus.idl,v $
-+ * $Revision: 1.0 $
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_excel_XMenus_idl__
-+#define __ooo_vba_excel_XMenus_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+#ifndef __com_sun_star_helper_script_BasicErrorException_idl__
-+#include <com/sun/star/script/BasicErrorException.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+//=============================================================================
-+
-+module ooo { module vba { module excel {
-+
-+//=============================================================================
-+
-+interface XMenu;
-+
-+interface XMenus
-+{
-+ interface ooo::vba::XCollection;
-+
-+ XMenu Add( [in] string Caption, [in] any Before, [in] any Restore ) raises ( com::sun::star::script::BasicErrorException );
-+};
-+
-+//=============================================================================
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/excel/XPageSetup.idl oovbaapi/ooo/vba/excel/XPageSetup.idl
-index 70a1ae8..31ad1a5 100644
---- oovbaapi/ooo/vba/excel/XPageSetup.idl
-+++ oovbaapi/ooo/vba/excel/XPageSetup.idl
-@@ -65,6 +65,7 @@ interface XPageSetup : com::sun::star::uno::XInterface
- [attribute] boolean CenterVertically;
- [attribute] boolean CenterHorizontally;
- [attribute] boolean PrintHeadings;
-+ [attribute] long PaperSize; //liuchen 2009-12-11
-
- };
-
-diff --git oovbaapi/ooo/vba/excel/XPivotCache.idl oovbaapi/ooo/vba/excel/XPivotCache.idl
-index 65fd014..09bbd63 100644
---- oovbaapi/ooo/vba/excel/XPivotCache.idl
-+++ oovbaapi/ooo/vba/excel/XPivotCache.idl
-@@ -45,6 +45,7 @@ interface XPivotCache
- {
- interface ::ooo::vba::XHelperInterface;
-
-+ [attribute] long MissingItemsLimit;
- void Refresh();
- };
-
-diff --git oovbaapi/ooo/vba/excel/XQueryTable.idl oovbaapi/ooo/vba/excel/XQueryTable.idl
-new file mode 100644
-index 0000000..c1a2442
---- /dev/null
-+++ oovbaapi/ooo/vba/excel/XQueryTable.idl
-@@ -0,0 +1,58 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009, 2010.
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef __ooo_vba_excel_XQueryTable_idl__
-+#define __ooo_vba_excel_XQueryTable_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba__XHelperInterface_idl__
-+#define __ooo_vba__XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module excel {
-+
-+//=============================================================================
-+
-+interface XQueryTable
-+{
-+ interface com::sun::star::uno::XInterface;
-+ //interface ooo::vba::XHelperInterface;
-+ boolean Refresh([in] any aBackgroundQuery);
-+};
-+
-+}; }; };
-+
-+#endif
-+
-diff --git oovbaapi/ooo/vba/excel/XRange.idl oovbaapi/ooo/vba/excel/XRange.idl
-index 5d59a3b..4ed6fc4 100644
---- oovbaapi/ooo/vba/excel/XRange.idl
-+++ oovbaapi/ooo/vba/excel/XRange.idl
-@@ -42,6 +42,9 @@
- #ifndef __com_sun_star_script_XDefaultMethod_idl__
- #include <com/sun/star/script/XDefaultMethod.idl>
- #endif
-+#ifndef __com_sun_star_script_XErrorQuery_idl__
-+#include <com/sun/star/script/XErrorQuery.idl>
-+#endif
- #ifndef __ooo_vba_XCollection_idl__
- #include <ooo/vba/XCollection.idl>
- #endif
-@@ -69,11 +72,14 @@ interface XBorders;
- interface XValidation;
- interface XWorksheet;
-
-+interface XPivotTable;
-+interface XQueryTable;
- interface XRange
- {
- interface com::sun::star::container::XEnumerationAccess;
- interface com::sun::star::script::XDefaultMethod;
- interface com::sun::star::script::XDefaultProperty;
-+ interface com::sun::star::script::XErrorQuery;
- interface ::ooo::vba::excel::XFormat;
- //interface ::ooo::vba::XHelperInterface;
-
-@@ -102,6 +108,7 @@ interface XRange
- [attribute] any Style;
- [attribute] any AddIndent;
- [attribute] any ShowDetail;
-+ [attribute, readonly] XQueryTable QueryTable;
-
- XComment AddComment( [in] any Text );
- void Clear();
-@@ -166,6 +173,11 @@ interface XRange
- void Subtotal( [in] long GroupBy, [in] long Function, [in] /*Optional*/ sequence<long> TotalList, [in] /*Optional*/ any Replace, [in] /*Optional*/ any PageBreaks, [in] any SummaryBelowData ) raises ( com::sun::star::script::BasicErrorException );
- XRange MergeArea( ) raises ( com::sun::star::script::BasicErrorException );
- any Hyperlinks( [in] any aIndex );
-+ long CopyFromRecordset([in] any Data, [in] any MaxRows , [in] any MaxColumns) raises ( com::sun::star::script::BasicErrorException );
-+ XPivotTable PivotTable();
-+ void TextToColumns([in] any Destination, [in] any DataType, [in] any TextQualifier, [in] any ConsecutiveDelimiter, [in] any Tab, [in] any Semicolon, [in] any Comma,
-+ [in] any Space, [in] any Other, [in] any OtherChar, [in] any FieldInfo, [in] any DecimalSeparator, [in] any ThousandsSeparator, [in] any TrailingMinusNumbers );
-+ any AdvancedFilter([in] long Action, [in] any CriteriaRange, [in] any CopyToRange, [in] any Unique) raises ( com::sun::star::script::BasicErrorException );
- };
-
- //=============================================================================
-diff --git oovbaapi/ooo/vba/excel/XWorkbook.idl oovbaapi/ooo/vba/excel/XWorkbook.idl
-index e35b661..1a9807c 100644
---- oovbaapi/ooo/vba/excel/XWorkbook.idl
-+++ oovbaapi/ooo/vba/excel/XWorkbook.idl
-@@ -50,6 +50,7 @@ interface XWorkbook : com::sun::star::uno::XInterface
- [attribute, readonly] boolean ProtectStructure;
- [attribute, readonly] XWorksheet ActiveSheet;
- [attribute, readonly] string CodeName;
-+ [attribute, readonly] long FileFormat;
- [attribute] boolean PrecisionAsDisplayed;
-
- any Worksheets([in] any sheet);
-@@ -60,8 +61,9 @@ interface XWorkbook : com::sun::star::uno::XInterface
- void Activate();
- any Names( [in] any Index );
- any Colors([in] any Index) raises (com::sun::star::script::BasicErrorException);
-- long FileFormat() raises (com::sun::star::script::BasicErrorException);
- void SaveCopyAs( [in] string Filename );
-+ void Protect( [in] any Password );
-+ void SaveAs([in] string FileName, [in]any FileFormat, [in]any CreateBackup);
- };
-
- }; }; };
-diff --git oovbaapi/ooo/vba/excel/XWorksheet.idl oovbaapi/ooo/vba/excel/XWorksheet.idl
-index 07e9f23..c476bf4 100644
---- oovbaapi/ooo/vba/excel/XWorksheet.idl
-+++ oovbaapi/ooo/vba/excel/XWorksheet.idl
-@@ -38,6 +38,7 @@
- #ifndef __com_sun_star_script_XInvocation_idl__
- #include <com/sun/star/script/XInvocation.idl>
- #endif
-+
-
- #ifndef __com_sun_star_container_XNamed_idl__
- #include <com/sun/star/container/XNamed.idl>
-@@ -60,7 +61,7 @@ interface XWorksheet
- interface ::com::sun::star::script::XInvocation;
- interface ::com::sun::star::container::XNamed;
-
-- [attribute] boolean Visible;
-+ [attribute] long Visible;
- [attribute, readonly] long StandardHeight;
- [attribute, readonly] long StandardWidth;
- [attribute, readonly] boolean ProtectionMode;
-@@ -75,7 +77,7 @@ interface XWorksheet
-
- void Activate();
- void Calculate( );
-- void Select();
-+ void Select([in] any Replace); //liuchen 2009-9-2, add the input parameter to support expand selection
- void Move([in] any Before,[in] any After );
- void Copy([in] any Before,[in] any After );
- void Paste([in] any Destination,[in] any Link);
-diff --git oovbaapi/ooo/vba/excel/makefile.mk oovbaapi/ooo/vba/excel/makefile.mk
-index 2515880..1143311 100644
---- oovbaapi/ooo/vba/excel/makefile.mk
-+++ oovbaapi/ooo/vba/excel/makefile.mk
-@@ -102,7 +102,13 @@ IDLFILES= XGlobals.idl\
- XVPageBreak.idl \
- XVPageBreaks.idl \
- TextFrame.idl \
--
-+ XMenuBar.idl \
-+ XMenuBars.idl \
-+ XMenu.idl \
-+ XMenus.idl \
-+ XMenuItem.idl \
-+ XMenuItems.idl \
-+ XQueryTable.idl
-
- # ------------------------------------------------------------------
-
-diff --git oovbaapi/ooo/vba/makefile.mk oovbaapi/ooo/vba/makefile.mk
-index 4f6d378..ef77f77 100644
---- oovbaapi/ooo/vba/makefile.mk
-+++ oovbaapi/ooo/vba/makefile.mk
-@@ -61,7 +61,11 @@ IDLFILES=\
- XFontBase.idl\
- XDialogsBase.idl\
- XDialogBase.idl\
-- XPageSetupBase.idl
-+ XPageSetupBase.idl \
-+ XFileSearch.idl\
-+ XFoundFiles.idl\
-+ XFileDialog.idl \
-+ XFileDialogSelectedItems.idl
-
- # ------------------------------------------------------------------
- .ENDIF
-diff --git oovbaapi/ooo/vba/msforms/MSFormReturnTypes.idl oovbaapi/ooo/vba/msforms/MSFormReturnTypes.idl
-index e7532e3..8fa44f9 100644
---- oovbaapi/ooo/vba/msforms/MSFormReturnTypes.idl
-+++ oovbaapi/ooo/vba/msforms/MSFormReturnTypes.idl
-@@ -25,27 +25,15 @@
- *
- ************************************************************************/
- module msforms
--{
-- struct ReturnBoolean
-- {
-- boolean Value;
-- };
--
-+{
- struct ReturnEffect
- {
- //fmDropEffect Value;
- short Value;
- };
-
-- struct ReturnInteger
-- {
-- long Value;
-- };
--
- struct ReturnSingle
- {
- float Value;
- };
--
--
- };
-diff --git oovbaapi/ooo/vba/msforms/XCheckBox.idl oovbaapi/ooo/vba/msforms/XCheckBox.idl
-new file mode 100644
-index 0000000..30bdee0
---- /dev/null
-+++ oovbaapi/ooo/vba/msforms/XCheckBox.idl
-@@ -0,0 +1,53 @@
-+/*************************************************************************
-+ *
-+ * 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: XCheckBox.idl,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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_msforms_XCheckBox_idl__
-+#define __ooo_vba_msforms_XCheckBox_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+//=============================================================================
-+
-+module ooo { module vba { module msforms {
-+
-+//=============================================================================
-+interface XCheckBox: com::sun::star::uno::XInterface
-+{
-+ [attribute] string Caption;
-+ [attribute] any Value;
-+};
-+
-+//=============================================================================
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/msforms/XComboBox.idl oovbaapi/ooo/vba/msforms/XComboBox.idl
-index 8581392..49e4320 100644
---- oovbaapi/ooo/vba/msforms/XComboBox.idl
-+++ oovbaapi/ooo/vba/msforms/XComboBox.idl
-@@ -47,6 +47,7 @@ interface XComboBox: ::com::sun::star::uno::XInterface
- void AddItem( [in] any pvargItem, [in] any pvargIndex );
- void removeItem( [in] any index );
- void Clear();
-+ any List( [in] any pvargIndex, [in] any pvarColumn );
- };
-
- //=============================================================================
-diff --git oovbaapi/ooo/vba/msforms/XControl.idl oovbaapi/ooo/vba/msforms/XControl.idl
-index 50d15db..48f178e 100644
---- oovbaapi/ooo/vba/msforms/XControl.idl
-+++ oovbaapi/ooo/vba/msforms/XControl.idl
-@@ -63,6 +63,7 @@ interface XControl
- [attribute] string Name;
- [attribute] string ControlTipText;
- [attribute] string Tag;
-+ [attribute] long ForeColor;
- };
-
- //=============================================================================
-diff --git oovbaapi/ooo/vba/msforms/XLabel.idl oovbaapi/ooo/vba/msforms/XLabel.idl
-index 60427f6..ea4d944 100644
---- oovbaapi/ooo/vba/msforms/XLabel.idl
-+++ oovbaapi/ooo/vba/msforms/XLabel.idl
-@@ -39,6 +39,7 @@ interface XLabel: com::sun::star::uno::XInterface
- {
- [attribute] string Caption;
- [attribute] any Value;
-+ [attribute] string Accelerator;
- };
-
- //=============================================================================
-diff --git oovbaapi/ooo/vba/msforms/XListBox.idl oovbaapi/ooo/vba/msforms/XListBox.idl
-index 627c541..2400602 100644
---- oovbaapi/ooo/vba/msforms/XListBox.idl
-+++ oovbaapi/ooo/vba/msforms/XListBox.idl
-@@ -40,7 +40,7 @@ interface XListBox: com::sun::star::uno::XInterface
- {
- [attribute] any Value;
- [attribute] string Text;
-- [attribute] boolean MultiSelect;
-+ [attribute] long MultiSelect; //liuchen 2009-7-31 MultiSelect property in Excel VBA is type long
- [attribute] any ListIndex;
- [attribute, readonly ] long ListCount;
- void AddItem( [in] any pvargItem, [in] any pvargIndex );
-diff --git oovbaapi/ooo/vba/msforms/XReturnBoolean.idl oovbaapi/ooo/vba/msforms/XReturnBoolean.idl
-new file mode 100644
-index 0000000..52eb69d
---- /dev/null
-+++ oovbaapi/ooo/vba/msforms/XReturnBoolean.idl
-@@ -0,0 +1,51 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009, 2010.
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef __ooo_vba_msforms_XReturnInteger_idl__
-+#define __ooo_vba_msforms_XReturnInteger_idl__
-+
-+#ifndef __com_sun_star_script_XDefaultProperty_idl__
-+#include <com/sun/star/script/XDefaultProperty.idl>
-+#endif
-+//=============================================================================
-+
-+module msforms
-+{
-+
-+//=============================================================================
-+interface XReturnBoolean: com::sun::star::script::XDefaultProperty
-+{
-+ [attribute] boolean Value;
-+};
-+//=============================================================================
-+
-+};
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/msforms/XReturnInteger.idl oovbaapi/ooo/vba/msforms/XReturnInteger.idl
-new file mode 100644
-index 0000000..8ca5c6a
---- /dev/null
-+++ oovbaapi/ooo/vba/msforms/XReturnInteger.idl
-@@ -0,0 +1,51 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009, 2010.
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef __ooo_vba_msforms_XReturnInteger_idl__
-+#define __ooo_vba_msforms_XReturnInteger_idl__
-+
-+#ifndef __com_sun_star_script_XDefaultProperty_idl__
-+#include <com/sun/star/script/XDefaultProperty.idl>
-+#endif
-+//=============================================================================
-+
-+module msforms
-+{
-+
-+//=============================================================================
-+interface XReturnInteger: com::sun::star::script::XDefaultProperty
-+{
-+ [attribute] long Value;
-+};
-+//=============================================================================
-+
-+};
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/msforms/XShape.idl oovbaapi/ooo/vba/msforms/XShape.idl
-index e8682a6..eec1a7f 100644
---- oovbaapi/ooo/vba/msforms/XShape.idl
-+++ oovbaapi/ooo/vba/msforms/XShape.idl
-@@ -75,6 +75,7 @@ interface XShape : ooo::vba::XHelperInterface
- void ScaleHeight( [in] double Factor, [in] boolean RelativeToOriginalSize, [in] long Scale );
- void ScaleWidth( [in] double Factor, [in] boolean RelativeToOriginalSize, [in] long Scale );
- any ShapeRange( [in] any index ); // only here for convience
-+ void Copy();
- };
- }; }; };
-
-diff --git oovbaapi/ooo/vba/msforms/XShapeRange.idl oovbaapi/ooo/vba/msforms/XShapeRange.idl
-index d5b0df2..2d936e0 100644
---- oovbaapi/ooo/vba/msforms/XShapeRange.idl
-+++ oovbaapi/ooo/vba/msforms/XShapeRange.idl
-@@ -47,6 +47,7 @@ interface XShapeRange
- {
- interface ooo::vba::XCollection;
-
-+ [attribute] string Name;
- [attribute] double Height;
- [attribute] double Width;
- [attribute] double Left;
-@@ -65,6 +66,7 @@ interface XShapeRange
- void IncrementRotation( [in] double Increment );
- void IncrementLeft( [in] double Increment );
- void IncrementTop( [in] double Increment );
-+ void ZOrder( [in] long ZOrderCmd );
- };
- }; }; };
-
-diff --git oovbaapi/ooo/vba/msforms/makefile.mk oovbaapi/ooo/vba/msforms/makefile.mk
-index 56ac4ca..79313a9 100644
---- oovbaapi/ooo/vba/msforms/makefile.mk
-+++ oovbaapi/ooo/vba/msforms/makefile.mk
-@@ -44,6 +44,7 @@ IDLFILES=\
- XLabel.idl \
- XTextBox.idl \
- XRadioButton.idl \
-+ XCheckBox.idl \
- XShape.idl \
- XShapes.idl \
- XLineFormat.idl \
-@@ -62,6 +63,8 @@ IDLFILES=\
- XSpinButton.idl \
- XImage.idl \
- XControls.idl \
-+ XReturnBoolean.idl \
-+ XReturnInteger.idl \
- XTextFrame.idl \
-
- # ------------------------------------------------------------------
-diff --git oovbaapi/ooo/vba/word/XApplication.idl oovbaapi/ooo/vba/word/XApplication.idl
-index e6cde02..311f981 100644
---- oovbaapi/ooo/vba/word/XApplication.idl
-+++ oovbaapi/ooo/vba/word/XApplication.idl
-@@ -57,6 +57,7 @@ interface XApplication : com::sun::star::uno::XInterface
- any Documents( [in] any aIndex );
- any Addins( [in] any aIndex );
- any Dialogs( [in] any aIndex );
-+ any ListGalleries( [in] any aIndex );
- float CentimetersToPoints([in] float Centimeters );
- };
-
-diff --git oovbaapi/ooo/vba/word/XCell.idl oovbaapi/ooo/vba/word/XCell.idl
-new file mode 100644
-index 0000000..700b9dc
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XCell.idl
-@@ -0,0 +1,59 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XCell_idl__
-+#define __ooo_vba_word_XCell_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XCell
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ [attribute] long Width;
-+ [attribute] any Height;
-+ [attribute] long HeightRule;
-+
-+ void SetWidth( [in] float ColumnWidth, [in] long RulerStyle );
-+ void SetHeight( [in] float RowHeight, [in] long HeightRule );
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XCells.idl oovbaapi/ooo/vba/word/XCells.idl
-new file mode 100644
-index 0000000..9a18c55
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XCells.idl
-@@ -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:
-+ * $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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XCells_idl__
-+#define __ooo_vba_word_XCells_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XCells
-+{
-+ interface ::ooo::vba::XCollection;
-+
-+ [attribute] long Width;
-+ [attribute] any Height;
-+ [attribute] long HeightRule;
-+
-+ void SetWidth( [in] float ColumnWidth, [in] long RulerStyle );
-+ void SetHeight( [in] float RowHeight, [in] long HeightRule );
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XCheckBox.idl oovbaapi/ooo/vba/word/XCheckBox.idl
-new file mode 100644
-index 0000000..1baafe5
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XCheckBox.idl
-@@ -0,0 +1,54 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XCheckBox_idl__
-+#define __ooo_vba_word_XCheckBox_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XCheckBox
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ [attribute] boolean Value;
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XColumn.idl oovbaapi/ooo/vba/word/XColumn.idl
-new file mode 100644
-index 0000000..78266fc
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XColumn.idl
-@@ -0,0 +1,56 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XColumn_idl__
-+#define __ooo_vba_word_XColumn_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XColumn
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ [attribute] long Width;
-+
-+ void Select();
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XColumns.idl oovbaapi/ooo/vba/word/XColumns.idl
-new file mode 100644
-index 0000000..84ed9cb
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XColumns.idl
-@@ -0,0 +1,59 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XColumns_idl__
-+#define __ooo_vba_word_XColumns_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XColumns
-+{
-+ interface ::ooo::vba::XCollection;
-+
-+ [attribute] long Width;
-+
-+ void Select();
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XDocument.idl oovbaapi/ooo/vba/word/XDocument.idl
-index 4b55552..2fc26bf 100644
---- oovbaapi/ooo/vba/word/XDocument.idl
-+++ oovbaapi/ooo/vba/word/XDocument.idl
-@@ -49,6 +49,11 @@ interface XDocument : com::sun::star::script::XInvocation
- {
- [attribute, readonly] XRange Content;
- [attribute] any AttachedTemplate;
-+ [attribute] long ProtectionType;
-+ [attribute] boolean UpdateStylesOnOpen;
-+ [attribute] boolean AutoHyphenation;
-+ [attribute] long HyphenationZone;
-+ [attribute] long ConsecutiveHyphensLimit;
-
- XRange Range( [in] any Start, [in] any End );
- any BuiltInDocumentProperties( [in] any index );
-@@ -63,6 +68,14 @@ interface XDocument : com::sun::star::script::XInvocation
- any Sections([in] any Index);
- void Activate();
- any PageSetup();
-+ any TablesOfContents([in] any Index);
-+ any FormFields([in] any Index);
-+ void Protect( [in] long Type, [in] any NOReset, [in] any Password, [in] any UseIRM, [in] any EnforceStyleLock );
-+ void PrintOut([in] any Background, [in] any Append, [in] any Range, [in] any OutputFileName, [in] any From, [in] any To, [in] any Item, [in] any Copies, [in] any Pages, [in] any PageType, [in] any PrintToFile, [in] any Collate, [in] any FileName, [in] any ActivePrinterMacGX, [in] any ManualDuplexPrint, [in] any PrintZoomColumn, [in] any PrintZoomRow, [in] any PrintZoomPaperWidth, [in] any PrintZoomPaperHeight);
-+ void PrintPreview();
-+ void ClosePrintPreview();
-+ any Revisions( [in] any index );
-+ any Frames( [in] any index );
- };
-
- }; }; };
-diff --git oovbaapi/ooo/vba/word/XField.idl oovbaapi/ooo/vba/word/XField.idl
-index d610da6..29d30aa 100644
---- oovbaapi/ooo/vba/word/XField.idl
-+++ oovbaapi/ooo/vba/word/XField.idl
-@@ -36,6 +36,8 @@ module ooo { module vba { module word {
- interface XField
- {
- interface ::ooo::vba::XHelperInterface;
-+
-+ boolean Update();
- };
-
- }; }; };
-diff --git oovbaapi/ooo/vba/word/XFormField.idl oovbaapi/ooo/vba/word/XFormField.idl
-new file mode 100644
-index 0000000..23d2a83
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XFormField.idl
-@@ -0,0 +1,58 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XFormField_idl__
-+#define __ooo_vba_word_XFormField_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XFormField
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ [attribute] string Result;
-+ [attribute] boolean Enabled;
-+
-+ any CheckBox();
-+
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XFormFields.idl oovbaapi/ooo/vba/word/XFormFields.idl
-new file mode 100644
-index 0000000..7a19d3b
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XFormFields.idl
-@@ -0,0 +1,55 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XFormFields_idl__
-+#define __ooo_vba_word_XFormFields_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XFormFields
-+{
-+ interface ::ooo::vba::XCollection;
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XFrame.idl oovbaapi/ooo/vba/word/XFrame.idl
-new file mode 100644
-index 0000000..5007405
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XFrame.idl
-@@ -0,0 +1,58 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XFrame_idl__
-+#define __ooo_vba_word_XFrame_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+#ifndef __com_sun_star_container_XNamed_idl__
-+#include <com/sun/star/container/XNamed.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XFrame
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ void Select();
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XFrames.idl oovbaapi/ooo/vba/word/XFrames.idl
-new file mode 100644
-index 0000000..4c81545
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XFrames.idl
-@@ -0,0 +1,55 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XFrames_idl__
-+#define __ooo_vba_word_XFrames_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XFrames
-+{
-+ interface ::ooo::vba::XCollection;
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XGlobals.idl oovbaapi/ooo/vba/word/XGlobals.idl
-index 45b52fc..c3cfd6d 100644
---- oovbaapi/ooo/vba/word/XGlobals.idl
-+++ oovbaapi/ooo/vba/word/XGlobals.idl
-@@ -49,6 +49,7 @@ interface XGlobals : com::sun::star::uno::XInterface
- any Documents( [in] any aIndex );
- any Addins( [in] any aIndex );
- any Dialogs( [in] any aIndex );
-+ any ListGalleries( [in] any aIndex );
- float CentimetersToPoints([in] float Centimeters );
- };
-
-diff --git oovbaapi/ooo/vba/word/XHeadersFooters.idl oovbaapi/ooo/vba/word/XHeadersFooters.idl
-new file mode 100644
-index 0000000..22066e8
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XHeadersFooters.idl
-@@ -0,0 +1,55 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XHeadersFooters_idl__
-+#define __ooo_vba_word_XHeadersFooters_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XHeadersFooters
-+{
-+ interface ::ooo::vba::XCollection;
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XListFormat.idl oovbaapi/ooo/vba/word/XListFormat.idl
-new file mode 100644
-index 0000000..d9aa65a
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XListFormat.idl
-@@ -0,0 +1,60 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XListFormat_idl__
-+#define __ooo_vba_word_XListFormat_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XListTemplate;
-+interface XListFormat
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ void ApplyListTemplate([in] XListTemplate ListTemplate,
-+ [in] any /* optional */ ContinuePreviousList,
-+ [in] any /* optional */ ApplyTo,
-+ [in] any /* optional */ DefaultListBehavior);
-+
-+ void ConvertNumbersToText();
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XListGalleries.idl oovbaapi/ooo/vba/word/XListGalleries.idl
-new file mode 100644
-index 0000000..9268afc
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XListGalleries.idl
-@@ -0,0 +1,55 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XListGalleries_idl__
-+#define __ooo_vba_word_XListGalleries_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XListGalleries
-+{
-+ interface ::ooo::vba::XCollection;
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XListGallery.idl oovbaapi/ooo/vba/word/XListGallery.idl
-new file mode 100644
-index 0000000..4bd83b9
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XListGallery.idl
-@@ -0,0 +1,54 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XListGallery_idl__
-+#define __ooo_vba_word_XListGallery_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XListGallery
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ any ListTemplates( [in] any aIndex );
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XListLevel.idl oovbaapi/ooo/vba/word/XListLevel.idl
-new file mode 100644
-index 0000000..0ea1be7
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XListLevel.idl
-@@ -0,0 +1,66 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XListLevel_idl__
-+#define __ooo_vba_word_XListLevel_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XFont;
-+interface XListLevel
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ [attribute] long Alignment;
-+ [attribute] XFont Font;
-+ [attribute, readonly] long Index;
-+ [attribute] string LinkedStyle;
-+ [attribute] string NumberFormat;
-+ [attribute] float NumberPosition;
-+ [attribute] long NumberStyle;
-+ [attribute] long ResetOnHigher;
-+ [attribute] long StartAt;
-+ [attribute] float TabPosition;
-+ [attribute] float TextPosition;
-+ [attribute] long TrailingCharacter;
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XListLevels.idl oovbaapi/ooo/vba/word/XListLevels.idl
-new file mode 100644
-index 0000000..522d474
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XListLevels.idl
-@@ -0,0 +1,55 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XListLevels_idl__
-+#define __ooo_vba_word_XListLevels_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XListLevels
-+{
-+ interface ::ooo::vba::XCollection;
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XListTemplate.idl oovbaapi/ooo/vba/word/XListTemplate.idl
-new file mode 100644
-index 0000000..403bfa9
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XListTemplate.idl
-@@ -0,0 +1,54 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XListTemplate_idl__
-+#define __ooo_vba_word_XListTemplate_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XListTemplate
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ any ListLevels( [in] any aIndex );
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XListTemplates.idl oovbaapi/ooo/vba/word/XListTemplates.idl
-new file mode 100644
-index 0000000..d6ec96d
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XListTemplates.idl
-@@ -0,0 +1,55 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XListTemplates_idl__
-+#define __ooo_vba_word_XListTemplates_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XListTemplates
-+{
-+ interface ::ooo::vba::XCollection;
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XParagraph.idl oovbaapi/ooo/vba/word/XParagraph.idl
-index 057875d..a585e32 100644
---- oovbaapi/ooo/vba/word/XParagraph.idl
-+++ oovbaapi/ooo/vba/word/XParagraph.idl
-@@ -43,6 +43,7 @@ interface XParagraph
- interface ooo::vba::XHelperInterface;
-
- [attribute, readonly] XRange Range;
-+ [attribute] any Style;
- };
-
- }; }; };
-diff --git oovbaapi/ooo/vba/word/XRange.idl oovbaapi/ooo/vba/word/XRange.idl
-index 868613c..4bed0c0 100644
---- oovbaapi/ooo/vba/word/XRange.idl
-+++ oovbaapi/ooo/vba/word/XRange.idl
-@@ -45,13 +45,14 @@ module ooo { module vba { module word {
- interface XParagraphFormat;
- interface XStyle;
- interface XFont;
-+interface XListFormat;
- interface XRange
- {
- interface ooo::vba::XHelperInterface;
-
- [attribute] string Text;
- [attribute] XParagraphFormat ParagraphFormat;
-- [attribute] XStyle Style;
-+ [attribute] any Style;
- [attribute,readonly] ::com::sun::star::text::XTextRange XTextRange;
- // Of course Font is NOT readonly, #FIXME #TODO
- // readonly though will force an error attempting to write
-@@ -59,6 +60,7 @@ interface XRange
- [attribute] long LanguageID;
- [attribute] long Start;
- [attribute] long End;
-+ [attribute, readonly] XListFormat ListFormat;
-
- void InsertBreak( [in] any Type );
- void Select();
-@@ -66,6 +68,10 @@ interface XRange
- void InsertParagraphBefore();
- void InsertParagraphAfter();
- any PageSetup();
-+ boolean InRange( [in] XRange Range );
-+ any Revisions( [in] any index );
-+ any Sections( [in] any index );
-+ any Fields( [in] any index );
- };
-
- }; }; };
-diff --git oovbaapi/ooo/vba/word/XReplacement.idl oovbaapi/ooo/vba/word/XReplacement.idl
-index 2d6dcd2..778f9e1 100644
---- oovbaapi/ooo/vba/word/XReplacement.idl
-+++ oovbaapi/ooo/vba/word/XReplacement.idl
-@@ -42,6 +42,8 @@ interface XReplacement
- interface ooo::vba::XHelperInterface;
-
- [attribute] string Text;
-+
-+ void ClearFormatting();
- };
-
- }; }; };
-diff --git oovbaapi/ooo/vba/word/XRevision.idl oovbaapi/ooo/vba/word/XRevision.idl
-new file mode 100644
-index 0000000..bb3e570
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XRevision.idl
-@@ -0,0 +1,56 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XRevision_idl__
-+#define __ooo_vba_word_XRevision_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XRange;
-+interface XRevision
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ void Accept();
-+ void Reject();
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XRevisions.idl oovbaapi/ooo/vba/word/XRevisions.idl
-new file mode 100644
-index 0000000..358face
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XRevisions.idl
-@@ -0,0 +1,58 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XRevisions_idl__
-+#define __ooo_vba_word_XRevisions_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XRevisions
-+{
-+ interface ::ooo::vba::XCollection;
-+
-+ void AcceptAll();
-+ void RejectAll();
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XRow.idl oovbaapi/ooo/vba/word/XRow.idl
-new file mode 100644
-index 0000000..2c54828
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XRow.idl
-@@ -0,0 +1,58 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XRow_idl__
-+#define __ooo_vba_word_XRow_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XRow
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ [attribute] any Height;
-+ [attribute] long HeightRule;
-+
-+ void Select();
-+ void SetHeight( [in] float RowHeight, [in] long HeightRule );
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XRows.idl oovbaapi/ooo/vba/word/XRows.idl
-new file mode 100644
-index 0000000..8d0ae61
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XRows.idl
-@@ -0,0 +1,63 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XRows_idl__
-+#define __ooo_vba_word_XRows_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XRows
-+{
-+ interface ::ooo::vba::XCollection;
-+
-+ [attribute] long Alignment;
-+ [attribute] any AllowBreakAcrossPages;
-+ [attribute] float SpaceBetweenColumns;
-+
-+ void Delete();
-+ void SetLeftIndent( [in] float LeftIndent, [in] long RulerStyle );
-+ void Select();
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XSection.idl oovbaapi/ooo/vba/word/XSection.idl
-index 325ddf5..ec4569b 100644
---- oovbaapi/ooo/vba/word/XSection.idl
-+++ oovbaapi/ooo/vba/word/XSection.idl
-@@ -43,8 +43,8 @@ interface XSection
-
- [attribute] boolean ProtectedForForms;
-
-- any Headers();
-- any Footers();
-+ any Headers( [in] any aIndex );
-+ any Footers( [in] any aIndex );
- any PageSetup();
- };
-
-diff --git oovbaapi/ooo/vba/word/XSelection.idl oovbaapi/ooo/vba/word/XSelection.idl
-index 053cbc6..3cbcfaa 100644
---- oovbaapi/ooo/vba/word/XSelection.idl
-+++ oovbaapi/ooo/vba/word/XSelection.idl
-@@ -52,7 +52,7 @@ interface XSelection
- [attribute, readonly] XRange Range;
- [attribute] XParagraphFormat ParagraphFormat;
- [attribute, readonly] XFind Find;
-- [attribute] XStyle Style;
-+ [attribute] any Style;
- [attribute, readonly] XFont Font;
- [attribute, readonly] XHeaderFooter HeaderFooter;
- [attribute] long LanguageID;
-@@ -68,6 +68,7 @@ interface XSelection
- void MoveRight( [in] any Unit, [in] any Count, [in] any Extend );
- void MoveLeft( [in] any Unit, [in] any Count, [in] any Extend );
- void MoveDown( [in] any Unit, [in] any Count, [in] any Extend );
-+ void MoveUp( [in] any Unit, [in] any Count, [in] any Extend );
- void TypeParagraph();
- void InsertParagraph();
- void InsertParagraphBefore();
-@@ -77,6 +78,19 @@ interface XSelection
- any Information( [in] long Type );
- void InsertBreak( [in] any Type );
- any ShapeRange();
-+ void SelectColumn();
-+ void SelectRow();
-+ any Rows( [in] any aIndex );
-+ any Columns( [in] any aIndex );
-+ any Cells( [in] any aIndex );
-+ void Copy();
-+ void CopyAsPicture();
-+ void Paste();
-+ void Collapse([in] any Direction);
-+ void WholeStory();
-+ boolean InRange( [in] XRange Range );
-+ void SplitTable();
-+ any Paragraphs( [in] any aIndex );
- };
-
- }; }; };
-diff --git oovbaapi/ooo/vba/word/XStyle.idl oovbaapi/ooo/vba/word/XStyle.idl
-index b89798d..1c0f305 100644
---- oovbaapi/ooo/vba/word/XStyle.idl
-+++ oovbaapi/ooo/vba/word/XStyle.idl
-@@ -35,17 +35,32 @@
- #include <ooo/vba/XHelperInterface.idl>
- #endif
-
-+#ifndef __com_sun_star_script_XDefaultProperty_idl__
-+#include <com/sun/star/script/XDefaultProperty.idl>
-+#endif
-+
- module ooo { module vba { module word {
-
- interface XFont;
-+interface XListTemplate;
-+interface XParagraphFormat;
- interface XStyle
- {
- interface ooo::vba::XHelperInterface;
-+ interface com::sun::star::script::XDefaultProperty;
-
- [attribute] string Name;
- [attribute] long LanguageID;
- [attribute, readonly] long Type;
- [attribute, readonly] XFont Font;
-+ [attribute] string NameLocal;
-+ [attribute, readonly] XParagraphFormat ParagraphFormat;
-+ [attribute] boolean AutomaticallyUpdate;
-+ [attribute] any BaseStyle;
-+ [attribute] any NextParagraphStyle;
-+ [attribute, readonly] long ListLevelNumber;
-+
-+ void LinkToListTemplate( [in] XListTemplate ListTemplate, [in] any ListLevelNumber );
- };
-
- }; }; };
-diff --git oovbaapi/ooo/vba/word/XTabStop.idl oovbaapi/ooo/vba/word/XTabStop.idl
-new file mode 100644
-index 0000000..b9cf94d
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XTabStop.idl
-@@ -0,0 +1,52 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XTabStop_idl__
-+#define __ooo_vba_word_XTabStop_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XTabStop
-+{
-+ interface ooo::vba::XHelperInterface;
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XTabStops.idl oovbaapi/ooo/vba/word/XTabStops.idl
-new file mode 100644
-index 0000000..318d492
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XTabStops.idl
-@@ -0,0 +1,59 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XTabStops_idl__
-+#define __ooo_vba_word_XTabStops_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XTabStop;
-+interface XTabStops
-+{
-+ interface ::ooo::vba::XCollection;
-+
-+ XTabStop Add([in] float Position, [in] any Alignment, [in] any Leader );
-+ void ClearAll();
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XTable.idl oovbaapi/ooo/vba/word/XTable.idl
-index 235067c..edd5b39 100644
---- oovbaapi/ooo/vba/word/XTable.idl
-+++ oovbaapi/ooo/vba/word/XTable.idl
-@@ -69,7 +69,9 @@ interface XTable
- raises(com::sun::star::script::BasicErrorException);
- */
- any Borders( [in] any aIndex );
--
-+
-+ any Rows([in] any aIndex );
-+ any Columns([in] any aIndex );
- };
-
- }; }; };
-diff --git oovbaapi/ooo/vba/word/XTableOfContents.idl oovbaapi/ooo/vba/word/XTableOfContents.idl
-new file mode 100644
-index 0000000..dcb7e8a
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XTableOfContents.idl
-@@ -0,0 +1,60 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XTableOfContents_idl__
-+#define __ooo_vba_word_XTableOfContents_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XTableOfContents
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ [attribute] long LowerHeadingLevel;
-+ [attribute] long TabLeader;
-+ [attribute] boolean UseFields;
-+ [attribute] boolean UseOutlineLevels;
-+
-+ void Delete();
-+ void Update();
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XTablesOfContents.idl oovbaapi/ooo/vba/word/XTablesOfContents.idl
-new file mode 100644
-index 0000000..53c557b
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XTablesOfContents.idl
-@@ -0,0 +1,59 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XTablesOfContents_idl__
-+#define __ooo_vba_word_XTablesOfContents_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XTableOfContents;
-+interface XRange;
-+interface XTablesOfContents
-+{
-+ interface ::ooo::vba::XCollection;
-+
-+ XTableOfContents Add([in] XRange Range, [in] any UseHeadingStyles, [in] any UpperHeadingLevel, [in] any LowerHeadingLevel, [in] any UseFields, [in] any TableID, [in] any RightAlignPageNumbers, [in] any IncludePageNumbers, [in] any AddedStyles, [in] any UseHyperlinks, [in] any HidePageNumbersInWeb, [in] any UseOutlineLevels );
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XTemplate.idl oovbaapi/ooo/vba/word/XTemplate.idl
-index 0a5f0ed..04e7063 100644
---- oovbaapi/ooo/vba/word/XTemplate.idl
-+++ oovbaapi/ooo/vba/word/XTemplate.idl
-@@ -42,6 +42,7 @@ interface XTemplate
- interface ooo::vba::XHelperInterface;
-
- [attribute, readonly] string Name;
-+ [attribute, readonly] string Path;
-
- any AutoTextEntries( [in] any aIndex );
- };
-diff --git oovbaapi/ooo/vba/word/XWindow.idl oovbaapi/ooo/vba/word/XWindow.idl
-index 225a923..4ef56da 100644
---- oovbaapi/ooo/vba/word/XWindow.idl
-+++ oovbaapi/ooo/vba/word/XWindow.idl
-@@ -44,6 +44,7 @@ module ooo { module vba { module word {
- interface XWindow : com::sun::star::uno::XInterface
- {
- [attribute] any View;
-+ [attribute] any WindowState;
- void Activate();
- void Close([in] any SaveChanges, [in] any RouteDocument);
- any Panes( [in] any aIndex ); // this is a fake api for it seems not support in Write
-diff --git oovbaapi/ooo/vba/word/makefile.mk oovbaapi/ooo/vba/word/makefile.mk
-index 543e99f..04b36d1 100644
---- oovbaapi/ooo/vba/word/makefile.mk
-+++ oovbaapi/ooo/vba/word/makefile.mk
-@@ -79,6 +79,31 @@ IDLFILES= XGlobals.idl\
- XPageSetup.idl \
- XSection.idl \
- XSections.idl \
-+ XRow.idl \
-+ XRows.idl \
-+ XColumn.idl \
-+ XColumns.idl \
-+ XCell.idl \
-+ XCells.idl \
-+ XTabStop.idl \
-+ XTabStops.idl \
-+ XTableOfContents.idl \
-+ XTablesOfContents.idl \
-+ XListFormat.idl \
-+ XListGalleries.idl \
-+ XListGallery.idl \
-+ XListTemplate.idl \
-+ XListTemplates.idl \
-+ XListLevel.idl \
-+ XListLevels.idl \
-+ XFormField.idl \
-+ XFormFields.idl \
-+ XRevision.idl \
-+ XRevisions.idl \
-+ XFrame.idl \
-+ XFrames.idl \
-+ XCheckBox.idl \
-+ XHeadersFooters.idl \
-
- # ------------------------------------------------------------------
-
-diff --git oox/inc/oox/ole/vbacontrol.hxx oox/inc/oox/ole/vbacontrol.hxx
-index 71f3a70..730d46d 100755
---- oox/inc/oox/ole/vbacontrol.hxx
-+++ oox/inc/oox/ole/vbacontrol.hxx
-@@ -29,6 +29,7 @@
- #define OOX_OLE_VBACONTROL_HXX
-
- #include "oox/ole/axcontrol.hxx"
-+#include <com/sun/star/frame/XModel.hpp>
-
- namespace com { namespace sun { namespace star {
- namespace container { class XNameContainer; }
-@@ -192,6 +193,7 @@ public:
- /** Imports the form and its embedded controls, and inserts the form with
- all its controls into the passed dialog library. */
- void importForm(
-+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxDocModel,
- const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxDialogLib,
- StorageBase& rVbaFormStrg,
- const ::rtl::OUString& rModuleName,
-diff --git oox/source/ole/vbacontrol.cxx oox/source/ole/vbacontrol.cxx
-index 8b37c13..8a3a5c6 100755
---- oox/source/ole/vbacontrol.cxx
-+++ oox/source/ole/vbacontrol.cxx
-@@ -57,6 +57,7 @@ using ::com::sun::star::uno::Reference;
- using ::com::sun::star::uno::UNO_QUERY_THROW;
- using ::com::sun::star::uno::UNO_SET_THROW;
- using ::com::sun::star::uno::XComponentContext;
-+using ::com::sun::star::frame::XModel;
-
- namespace oox {
- namespace ole {
-@@ -758,7 +759,7 @@ VbaUserForm::VbaUserForm( const Reference< XMultiServiceFactory >& rxGlobalFacto
- OSL_ENSURE( mxGlobalFactory.is(), "VbaUserForm::VbaUserForm - missing service factory" );
- }
-
--void VbaUserForm::importForm( const Reference< XNameContainer >& rxDialogLib,
-+void VbaUserForm::importForm( const Reference< XModel >& rxDocModel, const Reference< XNameContainer >& rxDialogLib,
- StorageBase& rVbaFormStrg, const OUString& rModuleName, rtl_TextEncoding eTextEnc )
- {
- OSL_ENSURE( rxDialogLib.is(), "VbaUserForm::importForm - missing dialog library" );
-@@ -829,7 +830,7 @@ void VbaUserForm::importForm( const Reference< XNameContainer >& rxDialogLib,
- // export the dialog to XML and insert it into the dialog library
- PropertySet aFactoryProps( mxGlobalFactory );
- Reference< XComponentContext > xCompContext( aFactoryProps.getAnyProperty( PROP_DefaultContext ), UNO_QUERY_THROW );
-- Reference< XInputStreamProvider > xDialogSource( ::xmlscript::exportDialogModel( xDialogNC, xCompContext ), UNO_SET_THROW );
-+ Reference< XInputStreamProvider > xDialogSource( ::xmlscript::exportDialogModel( xDialogNC, xCompContext, rxDocModel ), UNO_SET_THROW );
- OSL_ENSURE( !rxDialogLib->hasByName( aFormName ), "VbaUserForm::importForm - multiple dialogs with equal name" );
- ContainerHelper::insertByName( rxDialogLib, aFormName, Any( xDialogSource ) );
- }
-diff --git oox/source/ole/vbaproject.cxx oox/source/ole/vbaproject.cxx
-index d93877d..877f16e 100755
---- oox/source/ole/vbaproject.cxx
-+++ oox/source/ole/vbaproject.cxx
-@@ -418,7 +418,7 @@ void VbaProject::importVba( StorageBase& rVbaPrjStrg, const GraphicHelper& rGrap
- // create and import the form
- Reference< XNameContainer > xDialogLib( createDialogLibrary(), UNO_SET_THROW );
- VbaUserForm aForm( mxGlobalFactory, rGraphicHelper, bDefaultColorBgr );
-- aForm.importForm( xDialogLib, *xSubStrg, aModuleName, eTextEnc );
-+ aForm.importForm( mxDocModel, xDialogLib, *xSubStrg, aModuleName, eTextEnc );
- }
- catch( Exception& )
- {
-diff --git sc/inc/address.hxx sc/inc/address.hxx
-index 6a8d4d7..3619fd6 100644
---- sc/inc/address.hxx
-+++ sc/inc/address.hxx
-@@ -232,6 +232,9 @@ inline SCTAB SanitizeTab( SCTAB nTab, SCTAB nMaxTab )
- #define SCA_VALID_ROW 0x0100
- #define SCA_VALID_COL 0x0200
- #define SCA_VALID_TAB 0x0400
-+// SCA_BITS is a convience for
-+// (SCA_VALID_TAB | SCA_VALID_COL | SCA_VALID_ROW | SCA_TAB_3D | SCA_TAB_ABSOLUTE | SCA_ROW_ABSOLUTE | SCA_COL_ABSOLUTE)
-+#define SCA_BITS 0x070F
- // somewhat cheesy kludge to force the display of the document name even for
- // local references. Requires TAB_3D to be valid
- #define SCA_FORCE_DOC 0x0800
-diff --git sc/inc/addruno.hxx sc/inc/addruno.hxx
-index 2cf8eca..3e17398 100644
---- sc/inc/addruno.hxx
-+++ sc/inc/addruno.hxx
-@@ -47,7 +47,7 @@ private:
- sal_Int32 nRefSheet;
- sal_Bool bIsRange;
-
-- sal_Bool ParseUIString( const String& rUIString );
-+ sal_Bool ParseUIString( const String& rUIString, ::formula::FormulaGrammar::AddressConvention eConv = ::formula::FormulaGrammar::CONV_OOO );
-
- public:
-
-diff --git sc/inc/appoptio.hxx sc/inc/appoptio.hxx
-index 4056b3c..12b41ff 100644
---- sc/inc/appoptio.hxx
-+++ sc/inc/appoptio.hxx
-@@ -44,6 +44,10 @@ public:
-
- void SetDefaults();
-
-+ // Set or get the initial tab count for new spreadsheet, it is used by VBA API currently.
-+ void SetTabCountInNewSpreadsheet( sal_Int16 nCount ) { nTabCountInNewSpreadsheet = nCount; }
-+ sal_Int16 GetTabCountInNewSpreadsheet() const { return nTabCountInNewSpreadsheet; }
-+
- void SetAppMetric( FieldUnit eUnit ) { eMetric = eUnit; }
- FieldUnit GetAppMetric() const { return eMetric; }
- void SetZoom( USHORT nNew ) { nZoom = nNew; }
-@@ -87,6 +91,7 @@ public:
- const ScAppOptions& operator= ( const ScAppOptions& rOpt );
-
- private:
-+ sal_Int16 nTabCountInNewSpreadsheet;
- FieldUnit eMetric;
- USHORT nLRUFuncCount;
- USHORT* pLRUList;
-diff --git sc/inc/cell.hxx sc/inc/cell.hxx
-index 93818ec..3c1605e 100644
---- sc/inc/cell.hxx
-+++ sc/inc/cell.hxx
-@@ -406,7 +406,7 @@ public:
- const formula::FormulaGrammar::Grammar = formula::FormulaGrammar::GRAM_DEFAULT ) const;
-
- void SetDirty();
-- inline void SetDirtyVar() { bDirty = TRUE; }
-+ void SetDirtyVar();
- // If setting entire document dirty after load, no broadcasts but still append to FormulaTree.
- void SetDirtyAfterLoad();
- inline void ResetTableOpDirtyVar() { bTableOpDirty = FALSE; }
-diff --git sc/inc/document.hxx sc/inc/document.hxx
-index 9112c6d..59d774f 100644
---- sc/inc/document.hxx
-+++ sc/inc/document.hxx
-@@ -103,6 +103,7 @@ class ScDrawLayer;
- class ScExtDocOptions;
- class ScExternalRefManager;
- class ScFormulaCell;
-+class ScMacroManager;
- class ScMarkData;
- class ScOutlineTable;
- class ScPatternAttr;
-@@ -305,6 +309,8 @@ private:
- ::std::auto_ptr<ScClipParam> mpClipParam;
-
- ::std::auto_ptr<ScExternalRefManager> pExternalRefMgr;
-+ ::std::auto_ptr<ScMacroManager> mpMacroMgr;
-+
-
- // mutable for lazy construction
- mutable ::std::auto_ptr< ScFormulaParserPool >
-@@ -460,6 +471,8 @@ public:
- void SetName( const String& r ) { aDocName = r; }
- const String& GetCodeName() const { return aDocCodeName; }
- void SetCodeName( const String& r ) { aDocCodeName = r; }
-+
-+ SC_DLLPUBLIC NameToNameMap* GetLocalNameMap( SCTAB& rTab );
-
- void GetDocStat( ScDocStat& rDocStat );
-
-@@ -956,7 +973,7 @@ public:
- SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab,
- ScDirection eDir );
-
-- void FindAreaPos( SCCOL& rCol, SCROW& rRow, SCTAB nTab, SCsCOL nMovX, SCsROW nMovY );
-+ SC_DLLPUBLIC void FindAreaPos( SCCOL& rCol, SCROW& rRow, SCTAB nTab, SCsCOL nMovX, SCsROW nMovY );
- SC_DLLPUBLIC void GetNextPos( SCCOL& rCol, SCROW& rRow, SCTAB nTab, SCsCOL nMovX, SCsROW nMovY,
- BOOL bMarked, BOOL bUnprotected, const ScMarkData& rMark );
-
-@@ -977,7 +994,7 @@ public:
- SCROW nStartRow, SCSIZE nSize,
- ScDocument* pRefUndoDoc = NULL, BOOL* pUndoOutline = NULL,
- const ScMarkData* pTabMark = NULL );
-- void DeleteRow( const ScRange& rRange,
-+ SC_DLLPUBLIC void DeleteRow( const ScRange& rRange,
- ScDocument* pRefUndoDoc = NULL, BOOL* pUndoOutline = NULL );
- BOOL InsertCol( SCROW nStartRow, SCTAB nStartTab,
- SCROW nEndRow, SCTAB nEndTab,
-@@ -1015,7 +1032,7 @@ public:
- SC_DLLPUBLIC void ResetClip( ScDocument* pSourceDoc, const ScMarkData* pMarks );
- SC_DLLPUBLIC void ResetClip( ScDocument* pSourceDoc, SCTAB nTab );
- void SetCutMode( BOOL bCut );
-- BOOL IsCutMode();
-+ SC_DLLPUBLIC BOOL IsCutMode();
- void SetClipArea( const ScRange& rArea, BOOL bCut = FALSE );
-
- SC_DLLPUBLIC BOOL IsDocVisible() const { return bIsVisible; }
-@@ -1590,6 +1607,7 @@ public:
- SC_DLLPUBLIC ScLkUpdMode GetLinkMode() const { return eLinkMode ;}
- void SetLinkMode( ScLkUpdMode nSet ) { eLinkMode = nSet;}
-
-+ SC_DLLPUBLIC ScMacroManager* GetMacroManager();
-
- private:
- ScDocument(const ScDocument& r); // disabled with no definition
-diff --git sc/inc/global.hxx sc/inc/global.hxx
-index e456fed..cde71d8 100644
---- sc/inc/global.hxx
-+++ sc/inc/global.hxx
-@@ -225,6 +225,7 @@ const USHORT IDF_HARDATTR = 0x0020; /// Hard cell attributes.
- const USHORT IDF_STYLES = 0x0040; /// Cell styles.
- const USHORT IDF_OBJECTS = 0x0080; /// Drawing objects.
- const USHORT IDF_EDITATTR = 0x0100; /// Rich-text attributes.
-+const USHORT IDF_SPECIAL_BOOLEAN = 0x1000;
- const USHORT IDF_ATTRIB = IDF_HARDATTR | IDF_STYLES;
- const USHORT IDF_CONTENTS = IDF_VALUE | IDF_DATETIME | IDF_STRING | IDF_NOTE | IDF_FORMULA;
- const USHORT IDF_ALL = IDF_CONTENTS | IDF_ATTRIB | IDF_OBJECTS;
-diff --git sc/inc/globstr.hrc sc/inc/globstr.hrc
-index a783120..7503ce2 100644
---- sc/inc/globstr.hrc
-+++ sc/inc/globstr.hrc
-@@ -577,7 +577,22 @@
-
- #define STR_OPTIONS_WARN_SEPARATORS 442
-
--#define STR_COUNT 443
-+#define STR_SHAPE_AUTOSHAPE 443
-+#define STR_SHAPE_RECTANGLE 444
-+#define STR_SHAPE_LINE 445
-+#define STR_SHAPE_OVAL 446
-+#define STR_SHAPE_TEXTBOX 447
-+
-+#define STR_FORM_BUTTON 448
-+#define STR_FORM_CHECKBOX 449
-+#define STR_FORM_OPTIONBUTTON 450
-+#define STR_FORM_LABEL 451
-+#define STR_FORM_LISTBOX 452
-+#define STR_FORM_GROUPBOX 453
-+#define STR_FORM_DROPDOWN 454
-+#define STR_FORM_SPINNER 455
-+#define STR_FORM_SCROLLBAR 456
-+
-+#define STR_COUNT 457
-
- #endif
--
-diff --git sc/inc/macromgr.hxx sc/inc/macromgr.hxx
-new file mode 100644
-index 0000000..35a3b2d
---- /dev/null
-+++ sc/inc/macromgr.hxx
-@@ -0,0 +1,70 @@
-+/*************************************************************************
-+ *
-+ * 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: document.hxx,v $
-+ * $Revision: 1.115.36.9 $
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef SC_MACROMGR_HXX
-+#define SC_MACROMGR_HXX
-+
-+#include <com/sun/star/container/XContainerListener.hpp>
-+
-+#include "rtl/ustring.hxx"
-+#include "scdllapi.h"
-+
-+#include <hash_map>
-+#include <memory>
-+
-+class ScDocument;
-+class ScFormulaCell;
-+class ScUserMacroDepTracker;
-+
-+class ScMacroManager
-+{
-+public:
-+ explicit ScMacroManager(ScDocument* pDoc);
-+ ~ScMacroManager();
-+
-+ SC_DLLPUBLIC void InitUserFuncData();
-+ SC_DLLPUBLIC void SetUserFuncVolatile( const rtl::OUString& sName, bool isVolatile );
-+ SC_DLLPUBLIC bool GetUserFuncVolatile( const rtl::OUString& sName );
-+
-+ void AddDependentCell(const ::rtl::OUString& aModuleName, ScFormulaCell* pCell);
-+ void RemoveDependentCell(ScFormulaCell* pCell);
-+ void BroadcastModuleUpdate(const ::rtl::OUString& aModuleName);
-+
-+private:
-+ typedef std::hash_map< ::rtl::OUString, bool, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > NameBoolMap;
-+ NameBoolMap mhFuncToVolatile;
-+ com::sun::star::uno::Reference< com::sun::star::container::XContainerListener > mxContainerListener;
-+
-+ ::std::auto_ptr<ScUserMacroDepTracker> mpDepTracker;
-+ ScDocument* mpDoc;
-+};
-+
-+#endif
-+
-diff --git sc/inc/rangenam.hxx sc/inc/rangenam.hxx
-index 7f3e123..651be23 100644
---- sc/inc/rangenam.hxx
-+++ sc/inc/rangenam.hxx
-@@ -142,7 +142,7 @@ public:
-
- SC_DLLPUBLIC BOOL IsReference( ScRange& rRef ) const;
- BOOL IsReference( ScRange& rRef, const ScAddress& rPos ) const;
-- BOOL IsValidReference( ScRange& rRef ) const;
-+ SC_DLLPUBLIC BOOL IsValidReference( ScRange& rRef ) const;
- BOOL IsRangeAtBlock( const ScRange& ) const;
-
- void UpdateTabRef(SCTAB nOldTable, USHORT nFlag, SCTAB nNewTable);
-diff --git sc/inc/sc.hrc sc/inc/sc.hrc
-index 87f02b5..d1ac237 100644
---- sc/inc/sc.hrc
-+++ sc/inc/sc.hrc
-@@ -592,11 +592,9 @@
- // #i59082# assign macro to shape
- #define SID_ASSIGNMACRO (SC_VIEW_START + 95)
-
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
- // #i66550# hyperlinks in shapes
- #define SID_DRAW_HLINK_EDIT (SC_VIEW_START + 96)
- #define SID_DRAW_HLINK_DELETE (SC_VIEW_START + 97)
--#endif
-
- // "Zoom / Synchronize sheets" in options dialog
- #define SID_SC_OPT_SYNCZOOM (SC_VIEW_START + 98)
-@@ -1669,6 +1669,9 @@
- #define SID_INSERT_CURRENT_DATE (SC_OOO_BUILD_START + 4)
- #define SID_INSERT_CURRENT_TIME (SC_OOO_BUILD_START + 5)
-
-+// Data Form
-+#define SID_DATAFORM_NEW (SC_OOO_BUILD_START + 7) // message
-+#define SID_DATA_FORM (SC_OOO_BUILD_START + 8) // menu (in Data menu)
-+#define RID_SCDLG_DATAFORM (SC_OOO_BUILD_START + 9) // dialog
-+
- #endif
--
--
-diff --git sc/inc/scabstdlg.hxx sc/inc/scabstdlg.hxx
-index 05ca719..e50f8cd 100644
---- sc/inc/scabstdlg.hxx
-+++ sc/inc/scabstdlg.hxx
-@@ -40,6 +40,8 @@
- #include "pivot.hxx"
- #include "i18npool/lang.h"
-
-+#include <tabvwsh.hxx>
-+
- class ScAsciiOptions;
- class ScAutoFormat;
- class ScAutoFormatData;
-@@ -113,6 +115,12 @@ public:
- virtual DelCellCmd GetDelCellCmd() const = 0;
- };
-
-+//for dataform
-+class AbstractScDataFormDlg : public VclAbstractDialog //add for ScDeleteCellDlg
-+{
-+
-+};
-+
- class AbstractScDeleteContentsDlg: public VclAbstractDialog //add for ScDeleteContentsDlg
- {
- public:
-@@ -309,7 +317,7 @@ public:
- class ScAbstractDialogFactory
- {
- public:
-- static ScAbstractDialogFactory* Create();
-+ SC_DLLPUBLIC static ScAbstractDialogFactory* Create();
-
- virtual AbstractScImportAsciiDlg * CreateScImportAsciiDlg( Window* pParent, String aDatName, //add for ScImportAsciiDlg
- SvStream* pInStream, int nId,
-@@ -343,6 +351,9 @@ public:
-
- virtual AbstractScDeleteCellDlg * CreateScDeleteCellDlg( Window* pParent, int nId, BOOL bDisallowCellMove = FALSE ) = 0 ; //add for ScDeleteCellDlg
-
-+ //for dataform
-+ virtual AbstractScDataFormDlg * CreateScDataFormDlg( Window* pParent, int nId, ScTabViewShell* pTabViewShell ) = 0 ; //add for ScDataFormDlg
-+
- virtual AbstractScDeleteContentsDlg * CreateScDeleteContentsDlg(Window* pParent,int nId, //add for ScDeleteContentsDlg
- USHORT nCheckDefaults = 0 ) = 0;
- virtual AbstractScFillSeriesDlg * CreateScFillSeriesDlg( Window* pParent, //add for ScFillSeriesDlg
-diff --git sc/inc/scmod.hxx sc/inc/scmod.hxx
-index 6bbcff0..e0b0aa8 100644
---- sc/inc/scmod.hxx
-+++ sc/inc/scmod.hxx
-@@ -201,12 +201,12 @@ public:
-
- // Options:
- const ScViewOptions& GetViewOptions ();
-- const ScDocOptions& GetDocOptions ();
-+SC_DLLPUBLIC const ScDocOptions& GetDocOptions ();
- SC_DLLPUBLIC const ScAppOptions& GetAppOptions ();
- const ScInputOptions& GetInputOptions ();
- SC_DLLPUBLIC const ScPrintOptions& GetPrintOptions ();
- void SetViewOptions ( const ScViewOptions& rOpt );
-- void SetDocOptions ( const ScDocOptions& rOpt );
-+SC_DLLPUBLIC void SetDocOptions ( const ScDocOptions& rOpt );
- SC_DLLPUBLIC void SetAppOptions ( const ScAppOptions& rOpt );
- void SetInputOptions ( const ScInputOptions& rOpt );
- void SetPrintOptions ( const ScPrintOptions& rOpt );
-diff --git sc/inc/shapeuno.hxx sc/inc/shapeuno.hxx
-index a80ad3c..1f8f1a5 100644
---- sc/inc/shapeuno.hxx
-+++ sc/inc/shapeuno.hxx
-@@ -52,6 +52,7 @@ namespace com { namespace sun { namespace star {
- class SdrObject;
- struct SvEventDescription;
- class ShapeUnoEventAccessImpl;
-+class ScMacroInfo;
-
- //------------------------------------------------------------------------
-
-@@ -70,6 +71,7 @@ class ScShapeObj :public ScShapeObj_Base
- ,public ScShapeObj_TextBase
- {
- private:
-+friend ScMacroInfo* lcl_getShapeHyperMacroInfo( ScShapeObj* pShape, BOOL bCreate );
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > mxShapeAgg;
- // cached pointers to avoid repeated queryAggregation calls:
- ::com::sun::star::beans::XPropertySet* pShapePropertySet;
-diff --git sc/inc/table.hxx sc/inc/table.hxx
-index 0fcda21..770a5cc 100644
---- sc/inc/table.hxx
-+++ sc/inc/table.hxx
-@@ -87,6 +87,8 @@ class ScFlatBoolRowSegments;
- struct ScColWidthParam;
- struct ScColWidthParam;
-
-+typedef std::hash_map< ::rtl::OUString, rtl::OUString, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > NameToNameMap;
-+
- class ScTable
- {
- private:
-@@ -181,6 +183,7 @@ private:
- Color aTabBgColor;
- USHORT nScenarioFlags;
- BOOL bActiveScenario;
-+ NameToNameMap localNameToGlobalName;
- bool mbPageBreaksValid;
-
- friend class ScDocument; // fuer FillInfo
-diff --git sc/inc/unonames.hxx sc/inc/unonames.hxx
-index fabd595..2ca67a1 100644
---- sc/inc/unonames.hxx
-+++ sc/inc/unonames.hxx
-@@ -184,6 +184,8 @@
- #define SC_UNONAME_ANCHOR "Anchor"
- #define SC_UNONAME_HORIPOS "HoriOrientPosition"
- #define SC_UNONAME_VERTPOS "VertOrientPosition"
-+// #i66550 HLINK_FOR_SHAPES
-+#define SC_UNONAME_HYPERLINK "Hyperlink"
-
- // other cell properties
- #define SC_UNONAME_CHCOLHDR "ChartColumnAsLabel"
-@@ -529,6 +531,7 @@
- #define SC_UNO_ZOOMTYPE "ZoomType"
- #define SC_UNO_ZOOMVALUE "ZoomValue"
- #define SC_UNO_UPDTEMPL "UpdateFromTemplate"
-+#define SC_UNO_FILTERED_RANGE_SELECTION "FilteredRangeSelection"
-
- /*Stampit enable/disable print cancel */
- #define SC_UNO_ALLOWPRINTJOBCANCEL "AllowPrintJobCancel"
-@@ -610,6 +613,7 @@
- #define SC_UNONAME_ADDRESS "Address"
- #define SC_UNONAME_UIREPR "UserInterfaceRepresentation"
- #define SC_UNONAME_PERSREPR "PersistentRepresentation"
-+#define SC_UNONAME_XL_A1_REPR "XL_A1_Representation"
- #define SC_UNONAME_REFSHEET "ReferenceSheet"
-
- // --> PB 2004-08-23 #i33095# Security Options
-diff --git sc/inc/userdat.hxx sc/inc/userdat.hxx
-index 35020f8..a4fc379 100644
---- sc/inc/userdat.hxx
-+++ sc/inc/userdat.hxx
-@@ -99,16 +99,12 @@ public:
- void SetMacro( const rtl::OUString& rMacro ) { maMacro = rMacro; }
- const rtl::OUString& GetMacro() const { return maMacro; }
-
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
- void SetHlink( const rtl::OUString& rHlink ) { maHlink = rHlink; }
- const rtl::OUString& GetHlink() const { return maHlink; }
--#endif
-
- private:
- rtl::OUString maMacro;
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
- rtl::OUString maHlink;
--#endif
- };
-
- //-------------------------------------------------------------------------
-diff --git sc/inc/viewuno.hxx sc/inc/viewuno.hxx
-index 9d3d822..f34a962 100644
---- sc/inc/viewuno.hxx
-+++ sc/inc/viewuno.hxx
-@@ -199,6 +199,7 @@ private:
- XActivationEventListenerArr_Impl aActivationListeners;
- SCTAB nPreviousTab;
- sal_Bool bDrawSelModeSet;
-+ sal_Bool bFilteredRangeSelection;
-
- ScViewPaneObj* GetObjectByIndex_Impl(USHORT nIndex) const;
- INT16 GetZoom(void) const;
-@@ -313,6 +314,13 @@ public:
- ::com::sun::star::sheet::XSpreadsheet >& xActiveSheet )
- throw(::com::sun::star::uno::RuntimeException);
-
-+ //liuchen 2009-9-2 support expand (but not replace) the active sheet
-+ virtual void SAL_CALL selectSheet( const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::sheet::XSpreadsheet >& xActiveSheet,
-+ sal_Bool bExpand)
-+ throw(::com::sun::star::uno::RuntimeException);
-+ //liuchen 2009-9-2
-+
- //XEnhancedMouseClickBroadcaster
-
- virtual void SAL_CALL addEnhancedMouseClickHandler( const ::com::sun::star::uno::Reference<
-diff --git sc/sdi/cellsh.sdi sc/sdi/cellsh.sdi
-index 957c3d1..84b23d5 100644
---- sc/sdi/cellsh.sdi
-+++ sc/sdi/cellsh.sdi
-@@ -60,6 +60,7 @@ interface CellSelection
- SID_SBA_BRW_INSERT [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ]
- SID_SELECT_DB [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ]
- SID_SORT [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ]
-+ SID_DATA_FORM [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ]
- FID_FILTER_OK [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ]
- SID_AUTO_FILTER [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ]
- SID_AUTOFILTER_HIDE [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ]
-diff --git sc/sdi/drawsh.sdi sc/sdi/drawsh.sdi
-index e73f447..f330474 100644
---- sc/sdi/drawsh.sdi
-+++ sc/sdi/drawsh.sdi
-@@ -226,9 +226,9 @@ interface TableDraw
- SID_FONTWORK_CHARACTER_SPACING_DIALOG [ ExecMethod = ExecDrawFunc ; StateMethod = GetDrawFuncState ; ]
-
- // ISSUE66550_HLINK_FOR_SHAPES
--// SID_DRAW_HLINK_EDIT [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawFuncState; Export = FALSE; ]
--// SID_DRAW_HLINK_DELETE [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawFuncState; Export = FALSE; ]
--// SID_OPEN_HYPERLINK [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawFuncState; Export = FALSE; ]
-+ SID_DRAW_HLINK_EDIT [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawFuncState; Export = FALSE; ]
-+ SID_DRAW_HLINK_DELETE [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawFuncState; Export = FALSE; ]
-+ SID_OPEN_HYPERLINK [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawFuncState; Export = FALSE; ]
- }
-
-
-diff --git sc/sdi/scalc.sdi sc/sdi/scalc.sdi
-index 3685677..efa641a 100644
---- sc/sdi/scalc.sdi
-+++ sc/sdi/scalc.sdi
-@@ -1598,6 +1598,31 @@ SfxVoidItem DataSort SID_SORT
- ]
-
- //--------------------------------------------------------------------------
-+SfxVoidItem DataForm SID_DATA_FORM
-+()
-+[
-+ /* flags: */
-+ AutoUpdate = FALSE,
-+ Cachable = Cachable,
-+ FastCall = FALSE,
-+ HasCoreId = FALSE,
-+ HasDialog = TRUE,
-+ ReadOnlyDoc = TRUE,
-+ Toggle = FALSE,
-+ Container = FALSE,
-+ RecordAbsolute = FALSE,
-+ RecordPerSet;
-+ Synchron;
-+
-+ /* config: */
-+ AccelConfig = TRUE,
-+ MenuConfig = TRUE,
-+ StatusBarConfig = FALSE,
-+ ToolBoxConfig = FALSE,
-+ GroupId = GID_DATA;
-+]
-+
-+//--------------------------------------------------------------------------
- SfxVoidItem DataSubTotals SID_SUBTOTALS
- ()
- [
-@@ -6295,55 +6320,55 @@ SfxVoidItem StandardFonts SID_STANDARD_FONTS
-
- //--------------------------------------------------------------------------
- // ISSUE66550_HLINK_FOR_SHAPES
--//SfxVoidItem EditShapeHyperlink SID_DRAW_HLINK_EDIT
--//()
--//[
--// /* flags: */
--// AutoUpdate = FALSE,
--// Cachable = Cachable,
--// FastCall = TRUE,
--// HasCoreId = FALSE,
--// HasDialog = TRUE,
--// ReadOnlyDoc = TRUE,
--// Toggle = FALSE,
--// Container = FALSE,
--// RecordAbsolute = FALSE,
--// RecordPerSet;
--// Synchron;
--//
-+SfxVoidItem EditShapeHyperlink SID_DRAW_HLINK_EDIT
-+()
-+[
-+ /* flags: */
-+ AutoUpdate = FALSE,
-+ Cachable = Cachable,
-+ FastCall = TRUE,
-+ HasCoreId = FALSE,
-+ HasDialog = TRUE,
-+ ReadOnlyDoc = TRUE,
-+ Toggle = FALSE,
-+ Container = FALSE,
-+ RecordAbsolute = FALSE,
-+ RecordPerSet;
-+ Synchron;
-+
- // /* config: */
--// AccelConfig = TRUE,
--// MenuConfig = FALSE,
--// StatusBarConfig = FALSE,
--// ToolBoxConfig = FALSE,
--// GroupId = GID_DRAWING;
--//]
-+ AccelConfig = TRUE,
-+ MenuConfig = FALSE,
-+ StatusBarConfig = FALSE,
-+ ToolBoxConfig = FALSE,
-+ GroupId = GID_DRAWING;
-+]
-
- //--------------------------------------------------------------------------
- // ISSUE66550_HLINK_FOR_SHAPES
--//SfxVoidItem DeleteShapeHyperlink SID_DRAW_HLINK_DELETE
--//()
--//[
--// /* flags: */
--// AutoUpdate = TRUE,
--// Cachable = Cachable,
--// FastCall = TRUE,
--// HasCoreId = FALSE,
--// HasDialog = FALSE,
--// ReadOnlyDoc = TRUE,
--// Toggle = FALSE,
--// Container = FALSE,
--// RecordAbsolute = FALSE,
--// RecordPerSet;
--// Synchron;
--//
--// /* config: */
--// AccelConfig = TRUE,
--// MenuConfig = FALSE,
--// StatusBarConfig = FALSE,
--// ToolBoxConfig = FALSE,
--// GroupId = GID_DRAWING;
--//]
-+SfxVoidItem DeleteShapeHyperlink SID_DRAW_HLINK_DELETE
-+()
-+[
-+ /* flags: */
-+ AutoUpdate = TRUE,
-+ Cachable = Cachable,
-+ FastCall = TRUE,
-+ HasCoreId = FALSE,
-+ HasDialog = FALSE,
-+ ReadOnlyDoc = TRUE,
-+ Toggle = FALSE,
-+ Container = FALSE,
-+ RecordAbsolute = FALSE,
-+ RecordPerSet;
-+ Synchron;
-+
-+ /* config: */
-+ AccelConfig = TRUE,
-+ MenuConfig = FALSE,
-+ StatusBarConfig = FALSE,
-+ ToolBoxConfig = FALSE,
-+ GroupId = GID_DRAWING;
-+]
-
- //--------------------------------------------------------------------------
- SfxVoidItem StandardTextAttributes SID_TEXT_STANDARD
-diff --git sc/source/core/data/cell.cxx sc/source/core/data/cell.cxx
-index 74d7126..ce3a9b0 100644
---- sc/source/core/data/cell.cxx
-+++ sc/source/core/data/cell.cxx
-@@ -51,6 +51,7 @@
- #include "recursionhelper.hxx"
- #include "postit.hxx"
- #include "externalrefmgr.hxx"
-+#include "macromgr.hxx"
- #include <editeng/editobj.hxx>
- #include <svl/intitem.hxx>
- #include <editeng/flditem.hxx>
-@@ -819,6 +820,8 @@ ScFormulaCell::ScFormulaCell( const ScFormulaCell& rCell, ScDocument& rDoc, cons
- {
- pDocument->RemoveFromFormulaTree( this );
- pDocument->RemoveSubTotalCell(this);
-+ if (pCode->HasOpCode(ocMacro))
-+ pDocument->GetMacroManager()->RemoveDependentCell(this);
-
- if (pDocument->HasExternalRefManager())
- pDocument->GetExternalRefManager()->removeRefCell(this);
-@@ -1742,6 +1748,36 @@ void ScFormulaCell::InterpretTail( ScInterpretTailParameter eTailParam )
- // Reschedule verlangsamt das ganze erheblich, nur bei Prozentaenderung ausfuehren
- ScProgress::GetInterpretProgress()->SetStateCountDownOnPercent(
- pDocument->GetFormulaCodeInTree()/MIN_NO_CODES_PER_PROGRESS_UPDATE );
-+
-+ switch (p->GetVolatileType())
-+ {
-+ case ScInterpreter::VOLATILE:
-+ // Volatile via built-in volatile functions. No actions needed.
-+ break;
-+ case ScInterpreter::VOLATILE_MACRO:
-+ // The formula contains a volatile macro.
-+ pCode->SetRecalcModeAlways();
-+ pDocument->PutInFormulaTree(this);
-+ StartListeningTo(pDocument);
-+ break;
-+ case ScInterpreter::NOT_VOLATILE:
-+ if (pCode->IsRecalcModeAlways())
-+ {
-+ // The formula was previously volatile, but no more.
-+ EndListeningTo(pDocument);
-+ pCode->SetRecalcModeNormal();
-+ }
-+ else
-+ {
-+ // non-volatile formula. End listening to the area in case
-+ // it's listening due to macro module change.
-+ pDocument->EndListeningArea(BCA_LISTEN_ALWAYS, this);
-+ }
-+ pDocument->RemoveFromFormulaTree(this);
-+ break;
-+ default:
-+ ;
-+ }
- }
- else
- {
-@@ -1809,7 +1845,7 @@ void __EXPORT ScFormulaCell::Notify( SvtBroadcaster&, const SfxHint& rHint)
- else
- {
- bForceTrack = !bDirty;
-- bDirty = TRUE;
-+ SetDirtyVar();
- }
- // #35962# Don't remove from FormulaTree to put in FormulaTrack to
- // put in FormulaTree again and again, only if necessary.
-@@ -1832,7 +1868,7 @@ void ScFormulaCell::SetDirty()
- if ( !IsInChangeTrack() )
- {
- if ( pDocument->GetHardRecalcState() )
-- bDirty = TRUE;
-+ SetDirtyVar();
- else
- {
- // Mehrfach-FormulaTracking in Load und in CompileAll
-@@ -1841,7 +1877,7 @@ void ScFormulaCell::SetDirty()
- // setzen, z.B. in CompileTokenArray
- if ( !bDirty || !pDocument->IsInFormulaTree( this ) )
- {
-- bDirty = TRUE;
-+ SetDirtyVar();
- pDocument->AppendToFormulaTrack( this );
- pDocument->TrackFormulas();
- }
-@@ -1852,6 +1888,13 @@ void ScFormulaCell::SetDirty()
- }
- }
-
-+void ScFormulaCell::SetDirtyVar()
-+{
-+ bDirty = TRUE;
-+ // mark the sheet of this cell to be calculated
-+ //#FIXME do we need to revert this remnant of old fake vba events? pDocument->AddCalculateTable( aPos.Tab() );
-+}
-+
- void ScFormulaCell::SetDirtyAfterLoad()
- {
- bDirty = TRUE;
-diff --git sc/source/core/data/column3.cxx sc/source/core/data/column3.cxx
-index b6ffc03..6caa91b 100644
---- sc/source/core/data/column3.cxx
-+++ sc/source/core/data/column3.cxx
-@@ -829,8 +829,10 @@ ScBaseCell* ScColumn::CloneCell(SCSIZE nIndex, USHORT nFlags, ScDocument& rDestD
- bool bCloneValue = (nFlags & IDF_VALUE) != 0;
- bool bCloneDateTime = (nFlags & IDF_DATETIME) != 0;
- bool bCloneString = (nFlags & IDF_STRING) != 0;
-+ bool bCloneSpecialBoolean = (nFlags & IDF_SPECIAL_BOOLEAN) != 0;
- bool bCloneFormula = (nFlags & IDF_FORMULA) != 0;
- bool bCloneNote = (nFlags & IDF_NOTE) != 0;
-+ bool bForceFormula = false;
-
- ScBaseCell* pNew = 0;
- ScBaseCell& rSource = *pItems[nIndex].pCell;
-@@ -854,7 +856,18 @@ ScBaseCell* ScColumn::CloneCell(SCSIZE nIndex, USHORT nFlags, ScDocument& rDestD
- break;
-
- case CELLTYPE_FORMULA:
-- if (bCloneFormula)
-+ if ( bCloneSpecialBoolean )
-+ {
-+ ScFormulaCell& rForm = (ScFormulaCell&)rSource;
-+ rtl::OUStringBuffer aBuf;
-+ // #TODO #FIXME do we have a localisation issue here?
-+ rForm.GetFormula( aBuf );
-+ rtl::OUString aVal( aBuf.makeStringAndClear() );
-+ if ( aVal.equalsAscii( "=TRUE()" )
-+ || aVal.equalsAscii( "=FALSE()" ) )
-+ bForceFormula = true;
-+ }
-+ if (bForceFormula || bCloneFormula)
- {
- // note will be cloned below
- pNew = rSource.CloneWithoutNote( rDestDoc, rDestPos );
-diff --git sc/source/core/data/documen2.cxx sc/source/core/data/documen2.cxx
-index 1c1cf39..2153170 100644
---- sc/source/core/data/documen2.cxx
-+++ sc/source/core/data/documen2.cxx
-@@ -94,6 +94,7 @@
- #include "tabprotection.hxx"
- #include "formulaparserpool.hxx"
- #include "clipparam.hxx"
-+#include "macromgr.hxx"
-
- using namespace com::sun::star;
-
-@@ -156,6 +159,7 @@ ScDocument::ScDocument( ScDocumentMode eMode,
- pCacheFieldEditEngine( NULL ),
- pDocProtection( NULL ),
- mpClipParam( NULL),
-+ mpMacroMgr( NULL ),
- pExternalRefMgr( NULL ),
- pViewOptions( NULL ),
- pDocOptions( NULL ),
-diff --git sc/source/core/data/documen8.cxx sc/source/core/data/documen8.cxx
-index bc2bf8c..1daa520 100644
---- sc/source/core/data/documen8.cxx
-+++ sc/source/core/data/documen8.cxx
-@@ -93,6 +93,7 @@
- #include "globstr.hrc"
- #include "sc.hrc"
- #include "charthelper.hxx"
-+#include "macromgr.hxx"
- #include "dpobject.hxx"
-
- #define GET_SCALEVALUE(set,id) ((const SfxUInt16Item&)(set.Get( id ))).GetValue()
-@@ -412,6 +413,13 @@ BYTE ScDocument::GetEditTextDirection(SCTAB nTab) const
- return sal::static_int_cast<BYTE>(eRet);
- }
-
-+ScMacroManager* ScDocument::GetMacroManager()
-+{
-+ if (!mpMacroMgr.get())
-+ mpMacroMgr.reset(new ScMacroManager(this));
-+ return mpMacroMgr.get();
-+}
-+
- //------------------------------------------------------------------------
-
- void ScDocument::InvalidateTextWidth( const ScAddress* pAdrFrom, const ScAddress* pAdrTo,
-diff --git sc/source/core/data/document.cxx sc/source/core/data/document.cxx
-index 26719e5..df271f0 100644
---- sc/source/core/data/document.cxx
-+++ sc/source/core/data/document.cxx
-@@ -97,6 +97,8 @@
- #include <map>
- #include <limits>
-
-+using namespace ::com::sun::star;
-+
- namespace WritingMode2 = ::com::sun::star::text::WritingMode2;
- using ::com::sun::star::uno::Sequence;
- using ::com::sun::star::sheet::TablePageBreakData;
-@@ -184,6 +186,13 @@ BOOL ScDocument::GetCodeName( SCTAB nTab, String& rName ) const
- return FALSE;
- }
-
-+NameToNameMap*
-+ScDocument::GetLocalNameMap( SCTAB& rTab )
-+{
-+ if ( !HasTable( rTab ) )
-+ return NULL;
-+ return &pTab[rTab]->localNameToGlobalName;
-+}
-
- BOOL ScDocument::GetTable( const String& rName, SCTAB& rTab ) const
- {
-@@ -448,6 +457,7 @@ BOOL ScDocument::DeleteTab( SCTAB nTab, ScDocument* pRefUndoDoc )
- delete pTab[nTab];
- for (i=nTab + 1; i < nTabCount; i++)
- pTab[i - 1] = pTab[i];
-+
- pTab[nTabCount - 1] = NULL;
- --nMaxTableNumber;
- // UpdateBroadcastAreas must be called between UpdateDeleteTab,
-diff --git sc/source/core/inc/interpre.hxx sc/source/core/inc/interpre.hxx
-index d80573a..b28bfc1 100644
---- sc/source/core/inc/interpre.hxx
-+++ sc/source/core/inc/interpre.hxx
-@@ -134,6 +134,15 @@ public:
- static inline double div( const double& fNumerator, const double& fDenominator );
-
- ScMatrixRef GetNewMat(SCSIZE nC, SCSIZE nR);
-+
-+ enum VolatileType {
-+ VOLATILE,
-+ VOLATILE_MACRO,
-+ NOT_VOLATILE
-+ };
-+
-+ VolatileType GetVolatileType() const;
-+
- private:
- static ScTokenStack* pGlobalStack;
- static BOOL bGlobalStackInUse;
-@@ -168,6 +177,8 @@ private:
- BOOL bCalcAsShown; // precision as shown
- BOOL bMatrixFormula; // formula cell is a matrix formula
-
-+ VolatileType meVolaileType;
-+
- //---------------------------------Funktionen in interpre.cxx---------
- // nMust <= nAct <= nMax ? ok : PushError
- inline BOOL MustHaveParamCount( short nAct, short nMust );
-diff --git sc/source/core/tool/address.cxx sc/source/core/tool/address.cxx
-index a4a77c9..78d2c31 100644
---- sc/source/core/tool/address.cxx
-+++ sc/source/core/tool/address.cxx
-@@ -1374,7 +1374,7 @@ lcl_ScRange_Parse_OOo( ScRange &aRange, const String& r, ScDocument* pDoc, ScAdd
- }
- nRes1 = ( ( nRes1 | nRes2 ) & SCA_VALID )
- | nRes1
-- | ( ( nRes2 & 0x070F ) << 4 );
-+ | ( ( nRes2 & SCA_BITS ) << 4 );
- return nRes1;
- }
-
-diff --git sc/source/core/tool/appoptio.cxx sc/source/core/tool/appoptio.cxx
-index e14b16c..8f27807 100644
---- sc/source/core/tool/appoptio.cxx
-+++ sc/source/core/tool/appoptio.cxx
-@@ -82,6 +82,9 @@ ScAppOptions::~ScAppOptions()
-
- void ScAppOptions::SetDefaults()
- {
-+ // Set default tab count for new spreadsheet.
-+ nTabCountInNewSpreadsheet = 3;
-+
- if ( ScOptionsUtil::IsMetricSystem() )
- eMetric = FUNIT_CM; // default for countries with metric system
- else
-@@ -119,6 +122,7 @@ void ScAppOptions::SetDefaults()
-
- const ScAppOptions& ScAppOptions::operator=( const ScAppOptions& rCpy )
- {
-+ nTabCountInNewSpreadsheet = rCpy.nTabCountInNewSpreadsheet;
- eMetric = rCpy.eMetric;
- eZoomType = rCpy.eZoomType;
- bSynchronizeZoom = rCpy.bSynchronizeZoom;
-diff --git sc/source/core/tool/interpr1.cxx sc/source/core/tool/interpr1.cxx
-index 516b96e..0d2613b 100644
---- sc/source/core/tool/interpr1.cxx
-+++ sc/source/core/tool/interpr1.cxx
-@@ -71,6 +71,7 @@
- #include "rangenam.hxx"
- #include "compiler.hxx"
- #include "externalrefmgr.hxx"
-+#include <basic/sbstar.hxx>
- #include "doubleref.hxx"
- #include "queryparam.hxx"
-
-@@ -4186,7 +4187,17 @@ void ScInterpreter::ScMatch()
- }
- }
- if ( rEntry.bQueryByString )
-- rParam.bRegExp = MayBeRegExp( *rEntry.pStr, pDok );
-+ {
-+ BOOL bIsVBAMode = FALSE;
-+ if ( pDok )
-+ bIsVBAMode = pDok->IsInVBAMode();
-+
-+ // #TODO handle MSO wildcards
-+ if ( bIsVBAMode )
-+ rParam.bRegExp = FALSE;
-+ else
-+ rParam.bRegExp = MayBeRegExp( *rEntry.pStr, pDok );
-+ }
-
- if (pMatSrc) // The source data is matrix array.
- {
-diff --git sc/source/core/tool/interpr4.cxx sc/source/core/tool/interpr4.cxx
-index 901bcc4..023741b 100644
---- sc/source/core/tool/interpr4.cxx
-+++ sc/source/core/tool/interpr4.cxx
-@@ -33,10 +33,14 @@
- #include <sfx2/app.hxx>
- #include <sfx2/docfile.hxx>
- #include <sfx2/objsh.hxx>
-+#include <sfx2/docfilt.hxx>
- #include <basic/sbmeth.hxx>
- #include <basic/sbmod.hxx>
- #include <basic/sbstar.hxx>
- #include <basic/sbx.hxx>
-+#include <basic/sbxobj.hxx>
-+#include <basic/sbuno.hxx>
-+#include <svl/zforlist.hxx>
- #include <svl/zforlist.hxx>
- #include <tools/urlobj.hxx>
- #include <rtl/logfile.hxx>
-@@ -45,6 +49,8 @@
- #include <signal.h>
-
- #include <com/sun/star/table/XCellRange.hpp>
-+#include <com/sun/star/sheet/XSheetCellRange.hpp>
-+#include <comphelper/processfactory.hxx>
-
- #include "interpre.hxx"
- #include "global.hxx"
-@@ -65,6 +71,8 @@
- #include "jumpmatrix.hxx"
- #include "parclass.hxx"
- #include "externalrefmgr.hxx"
-+#include "formula/FormulaCompiler.hxx"
-+#include "macromgr.hxx"
- #include "doubleref.hxx"
-
- #include <math.h>
-@@ -72,6 +80,8 @@
- #include <map>
- #include <algorithm>
- #include <functional>
-+#include <basic/basmgr.hxx>
-+#include <vbahelper/vbaaccesshelper.hxx>
- #include <memory>
-
- using namespace com::sun::star;
-@@ -2694,6 +2704,61 @@ void ScInterpreter::ScMissing()
- PushTempToken( new FormulaMissingToken );
- }
-
-+uno::Any lcl_getSheetModule( const uno::Reference<table::XCellRange>& xCellRange, ScDocument* pDok )
-+{
-+ uno::Reference< sheet::XSheetCellRange > xSheetRange( xCellRange, uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xProps( xSheetRange->getSpreadsheet(), uno::UNO_QUERY_THROW );
-+ rtl::OUString sCodeName;
-+ xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CodeName") ) ) >>= sCodeName;
-+ // #TODO #FIXME ideally we should 'throw' here if we don't get a valid parent, but... it is possible
-+ // to create a module ( and use 'Option VBASupport 1' ) for a calc document, in this scenario there
-+ // are *NO* special document module objects ( of course being able to switch between vba/non vba mode at
-+ // the document in the future could fix this, especially IF the switching of the vba mode takes care to
-+ // create the special document module objects if they don't exist.
-+ BasicManager* pBasMgr = pDok->GetDocumentShell()->GetBasicManager();
-+
-+ uno::Reference< uno::XInterface > xIf;
-+ if ( pBasMgr && pBasMgr->GetName().Len() )
-+ {
-+ String sProj = String( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
-+ if ( pDok->GetDocumentShell()->GetBasicManager()->GetName().Len() )
-+ sProj = pDok->GetDocumentShell()->GetBasicManager()->GetName();
-+ StarBASIC* pBasic = pDok->GetDocumentShell()->GetBasicManager()->GetLib( sProj );
-+ if ( pBasic )
-+ {
-+ SbModule* pMod = pBasic->FindModule( sCodeName );
-+ if ( pMod )
-+ xIf = pMod->GetUnoModule();
-+ }
-+ }
-+ return uno::makeAny( xIf );
-+}
-+
-+bool
-+lcl_setVBARange( ScRange& aRange, ScDocument* pDok, SbxVariable* pPar )
-+{
-+ bool bOk = false;
-+ try
-+ {
-+ uno::Reference< uno::XInterface > xVBARange;
-+ uno::Reference<table::XCellRange> xCellRange = ScCellRangeObj::CreateRangeFromDoc( pDok, aRange );
-+ uno::Sequence< uno::Any > aArgs(2);
-+ aArgs[0] = lcl_getSheetModule( xCellRange, pDok );
-+ aArgs[1] = uno::Any( xCellRange );
-+ xVBARange = ooo::vba::createVBAUnoAPIServiceWithArgs( pDok->GetDocumentShell(), "ooo.vba.excel.Range", aArgs );
-+ if ( xVBARange.is() )
-+ {
-+ String sDummy(RTL_CONSTASCII_USTRINGPARAM("A-Range") );
-+ SbxObjectRef aObj = GetSbUnoObject( sDummy, uno::Any( xVBARange ) );
-+ SetSbUnoObjectDfltPropName( aObj );
-+ bOk = pPar->PutObject( aObj );
-+ }
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+ return bOk;
-+}
-
- void ScInterpreter::ScMacro()
- {
-@@ -2731,8 +2796,11 @@ void ScInterpreter::ScMacro()
- return;
- }
-
-+ bool bVolatileMacro = false;
- SbMethod* pMethod = (SbMethod*)pVar;
-+
- SbModule* pModule = pMethod->GetModule();
-+ bool bUseVBAObjects = pModule->IsVBACompat();
- SbxObject* pObject = pModule->GetParent();
- DBG_ASSERT(pObject->IsA(TYPE(StarBASIC)), "Kein Basic gefunden!");
- String aMacroStr = pObject->GetName();
-@@ -2742,7 +2810,13 @@ void ScInterpreter::ScMacro()
- aMacroStr += pMethod->GetName();
- String aBasicStr;
- if (pObject->GetParent())
-+ {
- aBasicStr = pObject->GetParent()->GetName(); // Dokumentenbasic
-+ const SfxFilter* pFilter = NULL;
-+ SfxMedium* pMedium = pDok->GetDocumentShell()->GetMedium();
-+ if ( pMedium )
-+ pFilter = pMedium->GetFilter();
-+ }
- else
- aBasicStr = SFX_APP()->GetName(); // Applikationsbasic
-
-@@ -2766,7 +2840,13 @@ void ScInterpreter::ScMacro()
- {
- ScAddress aAdr;
- PopSingleRef( aAdr );
-- bOk = SetSbxVariable( pPar, aAdr );
-+ if ( bUseVBAObjects )
-+ {
-+ ScRange aRange( aAdr );
-+ bOk = lcl_setVBARange( aRange, pDok, pPar );
-+ }
-+ else
-+ bOk = SetSbxVariable( pPar, aAdr );
- }
- break;
- case svDoubleRef:
-@@ -2785,24 +2865,32 @@ void ScInterpreter::ScMacro()
- }
- else
- {
-- SbxDimArrayRef refArray = new SbxDimArray;
-- refArray->AddDim32( 1, nRow2 - nRow1 + 1 );
-- refArray->AddDim32( 1, nCol2 - nCol1 + 1 );
-- ScAddress aAdr( nCol1, nRow1, nTab1 );
-- for( SCROW nRow = nRow1; bOk && nRow <= nRow2; nRow++ )
-+ if ( bUseVBAObjects )
- {
-- aAdr.SetRow( nRow );
-- INT32 nIdx[ 2 ];
-- nIdx[ 0 ] = nRow-nRow1+1;
-- for( SCCOL nCol = nCol1; bOk && nCol <= nCol2; nCol++ )
-- {
-- aAdr.SetCol( nCol );
-- nIdx[ 1 ] = nCol-nCol1+1;
-- SbxVariable* p = refArray->Get32( nIdx );
-- bOk = SetSbxVariable( p, aAdr );
-+ ScRange aRange( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
-+ bOk = lcl_setVBARange( aRange, pDok, pPar );
-+ }
-+ else
-+ {
-+ SbxDimArrayRef refArray = new SbxDimArray;
-+ refArray->AddDim32( 1, nRow2 - nRow1 + 1 );
-+ refArray->AddDim32( 1, nCol2 - nCol1 + 1 );
-+ ScAddress aAdr( nCol1, nRow1, nTab1 );
-+ for( SCROW nRow = nRow1; bOk && nRow <= nRow2; nRow++ )
-+ {
-+ aAdr.SetRow( nRow );
-+ INT32 nIdx[ 2 ];
-+ nIdx[ 0 ] = nRow-nRow1+1;
-+ for( SCCOL nCol = nCol1; bOk && nCol <= nCol2; nCol++ )
-+ {
-+ aAdr.SetCol( nCol );
-+ nIdx[ 1 ] = nCol-nCol1+1;
-+ SbxVariable* p = refArray->Get32( nIdx );
-+ bOk = SetSbxVariable( p, aAdr );
-+ }
- }
-+ pPar->PutObject( refArray );
- }
-- pPar->PutObject( refArray );
- }
- }
- break;
-@@ -2850,6 +2938,13 @@ void ScInterpreter::ScMacro()
- pDok->DecMacroInterpretLevel();
- pDok->UnlockTable( aPos.Tab() );
-
-+ ScMacroManager* pMacroMgr = pDok->GetMacroManager();
-+ if (pMacroMgr)
-+ {
-+ bVolatileMacro = pMacroMgr->GetUserFuncVolatile( pMethod->GetName() );
-+ pMacroMgr->AddDependentCell(pModule->GetName(), pMyFormulaCell);
-+ }
-+
- SbxDataType eResType = refRes->GetType();
- if( pVar->GetError() )
- SetError( errNoValue);
-@@ -2921,6 +3016,9 @@ void ScInterpreter::ScMacro()
- }
-
- pSfxApp->LeaveBasicCall();
-+
-+ if (bVolatileMacro && meVolaileType == NOT_VOLATILE)
-+ meVolaileType = VOLATILE_MACRO;
- }
-
-
-@@ -3293,7 +3391,8 @@ ScInterpreter::ScInterpreter( ScFormulaCell* pCell, ScDocument* pDoc,
- pMyFormulaCell( pCell ),
- pFormatter( pDoc->GetFormatTable() ),
- mnStringNoValueError( errNoValue),
-- bCalcAsShown( pDoc->GetDocOptions().IsCalcAsShown() )
-+ bCalcAsShown( pDoc->GetDocOptions().IsCalcAsShown() ),
-+ meVolaileType(NOT_VOLATILE)
- {
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScTTT" );
- // pStack = new ScToken*[ MAXSTACK ];
-@@ -3740,6 +3839,9 @@ StackVar ScInterpreter::Interpret()
- continue; // while( ( pCur = aCode.Next() ) != NULL ...
- }
-
-+ if (FormulaCompiler::IsOpCodeVolatile(eOp))
-+ meVolaileType = VOLATILE;
-+
- // Remember result matrix in case it could be reused.
- if (pTokenMatrixMap && sp && GetStackType() == svMatrix)
- pTokenMatrixMap->insert( ScTokenMatrixMap::value_type( pCur,
-diff --git sc/source/core/tool/interpr5.cxx sc/source/core/tool/interpr5.cxx
-index 3bf95dc..af98bd1 100644
---- sc/source/core/tool/interpr5.cxx
-+++ sc/source/core/tool/interpr5.cxx
-@@ -321,6 +321,11 @@ ScMatrixRef ScInterpreter::GetNewMat(SCSIZE nC, SCSIZE nR)
- return pMat;
- }
-
-+ScInterpreter::VolatileType ScInterpreter::GetVolatileType() const
-+{
-+ return meVolaileType;
-+}
-+
- ScMatrixRef ScInterpreter::CreateMatrixFromDoubleRef( const FormulaToken* pToken,
- SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
- SCCOL nCol2, SCROW nRow2, SCTAB nTab2 )
-diff --git sc/source/core/tool/rangelst.cxx sc/source/core/tool/rangelst.cxx
-index 6bd25c5..b4d5866 100644
---- sc/source/core/tool/rangelst.cxx
-+++ sc/source/core/tool/rangelst.cxx
-@@ -83,15 +83,18 @@ USHORT ScRangeList::Parse( const String& rStr, ScDocument* pDoc, USHORT nMask,
- for ( USHORT i=0; i<nTCount; i++ )
- {
- aOne = rStr.GetToken( i, cDelimiter );
-- // FIXME : broken for Lotus
-- if ( aOne.Search( ':' ) == STRING_NOTFOUND )
-- { // Range muss es sein
-- String aStrTmp( aOne );
-- aOne += ':';
-- aOne += aStrTmp;
-- }
- aRange.aStart.SetTab( nTab ); // Default Tab wenn nicht angegeben
-- USHORT nRes = aRange.Parse( aOne, pDoc, eConv );
-+ USHORT nRes = aRange.ParseAny( aOne, pDoc, eConv );
-+ USHORT nEndRangeBits = SCA_VALID_COL2 | SCA_VALID_ROW2 |
-+SCA_VALID_TAB2;
-+ USHORT nTmp1 = ( nRes & SCA_BITS );
-+ USHORT nTmp2 = ( nRes & nEndRangeBits );
-+ // If we have a valid single range with
-+ // any of the address bits we are interested in
-+ // set - set the equiv end range bits
-+ if ( (nRes & SCA_VALID ) && nTmp1 && ( nTmp2 != nEndRangeBits ) )
-+ nRes |= ( nTmp1 << 4 );
-+
- if ( (nRes & nMask) == nMask )
- Append( aRange );
- nResult &= nRes; // alle gemeinsamen Bits bleiben erhalten
-diff --git sc/source/filter/excel/excimp8.cxx sc/source/filter/excel/excimp8.cxx
-index a601d76..6083116 100644
---- sc/source/filter/excel/excimp8.cxx
-+++ sc/source/filter/excel/excimp8.cxx
-@@ -99,15 +99,20 @@
- #include "stlpool.hxx"
- #include "stlsheet.hxx"
- #include "detfunc.hxx"
-+#include "macromgr.hxx"
-
- #include <com/sun/star/document/XDocumentProperties.hpp>
- #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
-+#include <com/sun/star/script/ModuleInfo.hpp>
- #include <cppuhelper/component_context.hxx>
- #include <sfx2/app.hxx>
-+#include "xltoolbar.hxx"
-
- using namespace com::sun::star;
- using ::rtl::OUString;
-
-+// defined in docfunc.cxx ( really this needs a new name )
-+script::ModuleInfo lcl_InitModuleInfo( SfxObjectShell& rDocSh, String& sModule );
-
- ImportExcel8::ImportExcel8( XclImpRootData& rImpData, SvStream& rStrm ) :
- ImportExcel( rImpData, rStrm )
-@@ -242,7 +247,30 @@ void ImportExcel8::ReadBasic( void )
- {
- SvxImportMSVBasic aBasicImport( *pShell, *xRootStrg, bLoadCode, bLoadStrg );
- bool bAsComment = !bLoadExecutable;
-+
-+ if ( !bAsComment )
-+ {
-+ ScDocument& rDoc = GetDoc();
-+#if 1
-+ // see if we have the XCB stream
-+ SvStorageStreamRef xXCB = xRootStrg->OpenSotStream( String( RTL_CONSTASCII_USTRINGPARAM( "XCB" ) ), STREAM_STD_READ | STREAM_NOCREATE );
-+ if ( xXCB.Is()|| SVSTREAM_OK == xXCB->GetError() )
-+ {
-+ CTBWrapper wrapper;
-+ if ( wrapper.Read( xXCB ) )
-+ {
-+#if DEBUG
-+ wrapper.Print( stderr );
-+#endif
-+ wrapper.ImportCustomToolBar( *pShell );
-+ }
-+ }
-+#endif
-+
-+ }
- aBasicImport.Import( EXC_STORAGE_VBA_PROJECT, EXC_STORAGE_VBA, bAsComment );
-+ if ( !bAsComment )
-+ GetObjectManager().SetOleNameOverrideInfo( aBasicImport.ControlNameForObjectId() );
- }
- }
- }
-diff --git sc/source/filter/excel/makefile.mk sc/source/filter/excel/makefile.mk
-index 04ba76d..a84f4aa 100644
---- sc/source/filter/excel/makefile.mk
-+++ sc/source/filter/excel/makefile.mk
-@@ -102,7 +102,8 @@ SLOFILES = \
- $(SLO)$/xlstyle.obj \
- $(SLO)$/xltools.obj \
- $(SLO)$/xltracer.obj \
-- $(SLO)$/xlview.obj
-+ $(SLO)$/xlview.obj \
-+ $(SLO)$/xltoolbar.obj \
-
- .IF "$(OS)$(COM)$(CPUNAME)"=="LINUXGCCSPARC"
- NOOPTFILES = \
-@@ -151,6 +152,7 @@ EXCEPTIONSFILES = \
- $(SLO)$/xlpivot.obj \
- $(SLO)$/xlroot.obj \
- $(SLO)$/xlstyle.obj \
-+ $(SLO)$/xltoolbar.obj \
- $(SLO)$/xltools.obj \
- $(SLO)$/xlview.obj
-
-diff --git sc/source/filter/excel/read.cxx sc/source/filter/excel/read.cxx
-index 5b67513..b43b581 100644
---- sc/source/filter/excel/read.cxx
-+++ sc/source/filter/excel/read.cxx
-@@ -831,6 +831,12 @@ FltError ImportExcel8::Read( void )
- sal_Size nProgressBasePos = 0;
- sal_Size nProgressBaseSize = 0;
-
-+ bool bSheetHasCodeName = false;
-+
-+ std::vector< String > CodeNames;
-+
-+ std::vector < SCTAB > nTabsWithNoCodeName;
-+
- while( eAkt != EXC_STATE_END )
- {
- if( eAkt == EXC_STATE_BEFORE_SHEET )
-@@ -912,6 +918,7 @@ FltError ImportExcel8::Read( void )
- // #i62752# possible to have BIFF8 sheet without globals
- NeueTabelle();
- eAkt = EXC_STATE_SHEET_PRE; // Shrfmla Prefetch, Row-Prefetch
-+ bSheetHasCodeName = false; // reset
- aIn.StoreGlobalPosition();
- }
- }
-@@ -1082,12 +1089,32 @@ FltError ImportExcel8::Read( void )
- case EXC_ID2_DIMENSIONS:
- case EXC_ID3_DIMENSIONS: ReadDimensions(); break;
-
-- case EXC_ID_CODENAME: ReadCodeName( aIn, false ); break;
-+ case EXC_ID_CODENAME: ReadCodeName( aIn, false ); bSheetHasCodeName = true; break;
-
- case 0x0A: // EOF [ 2345 ]
-+ {
- eAkt = EXC_STATE_SHEET;
-+ String sName;
-+ GetDoc().GetName( GetCurrScTab(), sName );
-+ if ( !bSheetHasCodeName )
-+ {
-+ nTabsWithNoCodeName.push_back( GetCurrScTab() );
-+ OSL_TRACE("No Codename for %d", GetCurrScTab() );
-+ }
-+ else
-+ {
-+ String sCodeName;
-+ GetDoc().GetCodeName( GetCurrScTab(), sCodeName );
-+ OSL_TRACE("Have CodeName %s for SheetName %s",
-+ rtl::OUStringToOString( sCodeName, RTL_TEXTENCODING_UTF8 ).getStr(), rtl::OUStringToOString( sName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ CodeNames.push_back( sCodeName );
-+ }
-+
-+ bSheetHasCodeName = false; // reset
-+
- aIn.SeekGlobalPosition(); // und zurueck an alte Position
- break;
-+ }
- case 0x12: SheetProtect(); break;
- case 0x13: SheetPassword(); break;
- case 0x42: Codepage(); break; // CODEPAGE [ 2345 ]
-@@ -1206,6 +1233,42 @@ FltError ImportExcel8::Read( void )
-
- if( eLastErr == eERR_OK )
- {
-+ // In some strange circumstances a the codename might be missing
-+ // # Create any missing Sheet CodeNames
-+ std::vector < SCTAB >::iterator it_end = nTabsWithNoCodeName.end();
-+ for ( std::vector < SCTAB >::iterator it = nTabsWithNoCodeName.begin(); it != it_end; ++it )
-+ {
-+ bool bGotCodeName = false;
-+ SCTAB nTab = 1;
-+ OSL_TRACE("Trying to find suitable codename for %d", *it );
-+ while ( true )
-+ {
-+ String sTmpName( RTL_CONSTASCII_USTRINGPARAM("Sheet" ) );
-+ sTmpName += String::CreateFromInt32( sal_Int32(nTab++) );
-+ std::vector< String >::iterator codeName_It = CodeNames.begin();
-+ std::vector< String >::iterator codeName_It_end = CodeNames.end();
-+ // search for codename
-+ for ( ; codeName_It != codeName_It_end; ++codeName_It )
-+ {
-+ if ( *codeName_It == sTmpName )
-+ break;
-+ }
-+
-+ if ( codeName_It == codeName_It_end ) // generated codename not found
-+ {
-+ OSL_TRACE("Using generated codename %s", rtl::OUStringToOString( sTmpName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ // Set new codename
-+ GetDoc().SetCodeName( *it, sTmpName );
-+ // Record newly used codename
-+ CodeNames.push_back( sTmpName );
-+ // Record those we have created so they can be created in
-+ // basic
-+ AutoGeneratedCodeNames.push_back( sTmpName );
-+ break;
-+ }
-+ }
-+
-+ }
- // #i45843# Convert pivot tables before calculation, so they are available
- // for the GETPIVOTDATA function.
- if( GetBiff() == EXC_BIFF8 )
-diff --git sc/source/filter/excel/xecontent.cxx sc/source/filter/excel/xecontent.cxx
-index c5c2620..f71c8be 100644
---- sc/source/filter/excel/xecontent.cxx
-+++ sc/source/filter/excel/xecontent.cxx
-@@ -524,12 +524,17 @@ void XclExpHyperlink::WriteBody( XclExpStream& rStrm )
- {
- sal_uInt16 nXclCol = static_cast< sal_uInt16 >( maScPos.Col() );
- sal_uInt16 nXclRow = static_cast< sal_uInt16 >( maScPos.Row() );
-- mxVarData->Seek( STREAM_SEEK_TO_BEGIN );
-+ rStrm << nXclRow << nXclRow << nXclCol << nXclCol;
-+ WriteEmbeddedData( rStrm );
-+}
-
-- rStrm << nXclRow << nXclRow << nXclCol << nXclCol
-- << XclTools::maGuidStdLink
-+void XclExpHyperlink::WriteEmbeddedData( XclExpStream& rStrm )
-+{
-+ rStrm << XclTools::maGuidStdLink
- << sal_uInt32( 2 )
- << mnFlags;
-+
-+ mxVarData->Seek( STREAM_SEEK_TO_BEGIN );
- rStrm.CopyFromStream( *mxVarData );
- }
-
-diff --git sc/source/filter/excel/xeescher.cxx sc/source/filter/excel/xeescher.cxx
-index 27461d2..7b4fc27 100644
---- sc/source/filter/excel/xeescher.cxx
-+++ sc/source/filter/excel/xeescher.cxx
-@@ -63,6 +63,9 @@
- #include "xelink.hxx"
- #include "xename.hxx"
- #include "xestyle.hxx"
-+#include "userdat.hxx"
-+#include "drwlayer.hxx"
-+#include "svx/unoapi.hxx"
-
- #include <oox/core/tokens.hxx>
-
-@@ -484,9 +487,9 @@ void XclExpOcxControlObj::WriteSubRecs( XclExpStream& rStrm )
-
- #else
-
--XclExpTbxControlObj::XclExpTbxControlObj( XclExpObjectManager& rObjMgr, Reference< XShape > xShape, const Rectangle* pChildAnchor ) :
-- XclObj( rObjMgr, EXC_OBJTYPE_UNKNOWN, true ),
-- XclExpControlHelper( rObjMgr.GetRoot() ),
-+XclExpTbxControlObj::XclExpTbxControlObj( XclExpObjectManager& rRoot, Reference< XShape > xShape , const Rectangle* pChildAnchor ) :
-+ XclObj( rRoot, EXC_OBJTYPE_UNKNOWN, true ),
-+ XclMacroHelper( rRoot ),
- mnHeight( 0 ),
- mnState( 0 ),
- mnLineCount( 0 ),
-@@ -735,6 +738,8 @@ XclExpTbxControlObj::XclExpTbxControlObj( XclExpObjectManager& rObjMgr, Referenc
-
- bool XclExpTbxControlObj::SetMacroLink( const ScriptEventDescriptor& rEvent )
- {
-+ return XclMacroHelper::SetMacroLink( rEvent, meEventType );
-+/*
- String aMacroName = XclControlHelper::ExtractFromMacroDescriptor( rEvent, meEventType );
- if( aMacroName.Len() )
- {
-@@ -744,6 +749,7 @@ bool XclExpTbxControlObj::SetMacroLink( const ScriptEventDescriptor& rEvent )
- return true;
- }
- return false;
-+*/
- }
-
- void XclExpTbxControlObj::WriteSubRecs( XclExpStream& rStrm )
-@@ -884,12 +890,6 @@ void XclExpTbxControlObj::WriteSubRecs( XclExpStream& rStrm )
- }
- }
-
--void XclExpTbxControlObj::WriteMacroSubRec( XclExpStream& rStrm )
--{
-- if( mxMacroLink.is() )
-- WriteFormulaSubRec( rStrm, EXC_ID_OBJMACRO, *mxMacroLink );
--}
--
- void XclExpTbxControlObj::WriteCellLinkSubRec( XclExpStream& rStrm, sal_uInt16 nSubRecId )
- {
- if( const XclTokenArray* pCellLink = GetCellLinkTokArr() )
-@@ -918,6 +918,7 @@ void XclExpTbxControlObj::WriteSbs( XclExpStream& rStrm )
-
- #endif
-
-+
- // ----------------------------------------------------------------------------
-
- XclExpChartObj::XclExpChartObj( XclExpObjectManager& rObjMgr, Reference< XShape > xShape, const Rectangle* pChildAnchor ) :
-@@ -1061,6 +1062,7 @@ void XclExpNote::Save( XclExpStream& rStrm )
- }
- }
-
-+
- void XclExpNote::WriteBody( XclExpStream& rStrm )
- {
- // BIFF5/BIFF7 is written separately
-@@ -1097,6 +1099,72 @@ void XclExpNote::WriteXml( sal_Int32 nAuthorId, XclExpXmlStream& rStrm )
-
- // ============================================================================
-
-+XclMacroHelper::XclMacroHelper( const XclExpRoot& rRoot ) :
-+ XclExpControlHelper( rRoot )
-+{
-+}
-+
-+XclMacroHelper::~XclMacroHelper()
-+{
-+}
-+
-+void XclMacroHelper::WriteMacroSubRec( XclExpStream& rStrm )
-+{
-+ if( mxMacroLink.is() )
-+ WriteFormulaSubRec( rStrm, EXC_ID_OBJMACRO, *mxMacroLink );
-+}
-+
-+bool
-+XclMacroHelper::SetMacroLink( const ScriptEventDescriptor& rEvent, const XclTbxEventType& nEventType )
-+{
-+ String aMacroName = XclControlHelper::ExtractFromMacroDescriptor( rEvent, nEventType, GetDocShell() );
-+ if( aMacroName.Len() )
-+ {
-+ return SetMacroLink( aMacroName );
-+ }
-+ return false;
-+}
-+
-+bool
-+XclMacroHelper::SetMacroLink( const String& rMacroName )
-+{
-+ OSL_TRACE("SetMacroLink( macroname:=%s )", rtl::OUStringToOString( rMacroName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ if( rMacroName.Len() )
-+ {
-+ sal_uInt16 nExtSheet = GetLocalLinkManager().FindExtSheet( EXC_EXTSH_OWNDOC );
-+ sal_uInt16 nNameIdx = GetNameManager().InsertMacroCall( rMacroName, true, false );
-+ mxMacroLink = GetFormulaCompiler().CreateNameXFormula( nExtSheet, nNameIdx );
-+ return true;
-+ }
-+ return false;
-+}
-+
-+XclExpShapeObj::XclExpShapeObj( XclExpObjectManager& rRoot, ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape ) :
-+ XclObjAny( rRoot ),
-+ XclMacroHelper( rRoot )
-+{
-+ if( SdrObject* pSdrObj = ::GetSdrObjectFromXShape( xShape ) )
-+ {
-+ ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( pSdrObj );
-+ if ( pInfo && pInfo->GetMacro().getLength() )
-+// FIXME ooo330-m2: XclControlHelper::GetXclMacroName was removed in upstream sources; they started to call XclTools::GetXclMacroName instead; is this enough? it has only one parameter
-+// SetMacroLink( XclControlHelper::GetXclMacroName( pInfo->GetMacro(), rRoot.GetDocShell() ) );
-+ SetMacroLink( XclTools::GetXclMacroName( pInfo->GetMacro() ) );
-+ }
-+}
-+
-+XclExpShapeObj::~XclExpShapeObj()
-+{
-+}
-+
-+void XclExpShapeObj::WriteSubRecs( XclExpStream& rStrm )
-+{
-+ XclObjAny::WriteSubRecs( rStrm );
-+ WriteMacroSubRec( rStrm );
-+}
-+
-+// ============================================================================
-+
- XclExpComments::XclExpComments( SCTAB nTab, XclExpRecordList< XclExpNote >& rNotes )
- : mnTab( nTab ), mrNotes( rNotes )
- {
-diff --git sc/source/filter/excel/xiescher.cxx sc/source/filter/excel/xiescher.cxx
-index 2106ac1..5ba8fe4 100644
---- sc/source/filter/excel/xiescher.cxx
-+++ sc/source/filter/excel/xiescher.cxx
-@@ -109,6 +109,8 @@
- #include "xipage.hxx"
- #include "xichart.hxx"
- #include "xicontent.hxx"
-+#include "scextopt.hxx"
-+
- #include "namebuff.hxx"
-
- using ::rtl::OUString;
-@@ -236,6 +238,7 @@ XclImpDrawObjBase::~XclImpDrawObjBase()
- }
- }
-
-+ xDrawObj->mnTab = rRoot.GetCurrScTab();
- xDrawObj->ImplReadObj3( rStrm );
- return xDrawObj;
- }
-@@ -268,6 +271,7 @@ XclImpDrawObjBase::~XclImpDrawObjBase()
- }
- }
-
-+ xDrawObj->mnTab = rRoot.GetCurrScTab();
- xDrawObj->ImplReadObj4( rStrm );
- return xDrawObj;
- }
-@@ -310,6 +314,7 @@ XclImpDrawObjBase::~XclImpDrawObjBase()
- }
- }
-
-+ xDrawObj->mnTab = rRoot.GetCurrScTab();
- xDrawObj->ImplReadObj5( rStrm );
- return xDrawObj;
- }
-@@ -368,6 +373,7 @@ XclImpDrawObjBase::~XclImpDrawObjBase()
- }
- }
-
-+ xDrawObj->mnTab = rRoot.GetCurrScTab();
- xDrawObj->ImplReadObj8( rStrm );
- return xDrawObj;
- }
-@@ -468,8 +474,8 @@ void XclImpDrawObjBase::PreProcessSdrObject( XclImpDffConverter& rDffConv, SdrOb
- }
-
- // macro and hyperlink
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
-- if( mbSimpleMacro && ((maMacroName.Len() > 0) || (maHyperlink.getLength() > 0)) )
-+ if( mbSimpleMacro && ((maMacroName.Len() > 0) ||
-+ (maHyperlink.Len() > 0)) )
- {
- if( ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( &rSdrObj, TRUE ) )
- {
-@@ -477,11 +483,6 @@ void XclImpDrawObjBase::PreProcessSdrObject( XclImpDffConverter& rDffConv, SdrOb
- pInfo->SetHlink( maHyperlink );
- }
- }
--#else
-- if( mbSimpleMacro && (maMacroName.Len() > 0) )
-- if( ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( &rSdrObj, TRUE ) )
-- pInfo->SetMacro( XclTools::GetSbMacroUrl( maMacroName, GetDocShell() ) );
--#endif
-
- // call virtual function for object type specific processing
- DoPreProcessSdrObj( rDffConv, rSdrObj );
-@@ -1761,22 +1762,15 @@ SdrObject* XclImpControlHelper::CreateSdrObjectFromShape(
- return xSdrObj.release();
- }
-
--void XclImpControlHelper::ProcessControl( const XclImpDrawObjBase& rDrawObj ) const
-+void XclImpControlHelper::ApplySheetLinkProps() const
- {
-+
- Reference< XControlModel > xCtrlModel = XclControlHelper::GetControlModel( mxShape );
- if( !xCtrlModel.is() )
- return;
--
- ScfPropertySet aPropSet( xCtrlModel );
-
-- // #118053# #i51348# set object name at control model
-- aPropSet.SetStringProperty( CREATE_OUSTRING( "Name" ), rDrawObj.GetObjName() );
--
-- // control visible and printable?
-- aPropSet.SetBoolProperty( CREATE_OUSTRING( "EnableVisible" ), rDrawObj.IsVisible() );
-- aPropSet.SetBoolProperty( CREATE_OUSTRING( "Printable" ), rDrawObj.IsPrintable() );
--
-- // sheet links
-+ // sheet links
- if( SfxObjectShell* pDocShell = mrRoot.GetDocShell() )
- {
- Reference< XMultiServiceFactory > xFactory( pDocShell->GetModel(), UNO_QUERY );
-@@ -1839,7 +1833,26 @@ void XclImpControlHelper::ProcessControl( const XclImpDrawObjBase& rDrawObj ) co
- }
- }
- }
-+}
-+
-+void XclImpControlHelper::ProcessControl( const XclImpDrawObjBase& rDrawObj ) const
-+{
-+ Reference< XControlModel > xCtrlModel = XclControlHelper::GetControlModel( mxShape );
-+ if( !xCtrlModel.is() )
-+ return;
-+
-+ ApplySheetLinkProps();
-+
-+ ScfPropertySet aPropSet( xCtrlModel );
-+
-+ // #118053# #i51348# set object name at control model
-+ aPropSet.SetStringProperty( CREATE_OUSTRING( "Name" ), rDrawObj.GetObjName() );
-+
-+ // control visible and printable?
-+ aPropSet.SetBoolProperty( CREATE_OUSTRING( "EnableVisible" ), rDrawObj.IsVisible() );
-+ aPropSet.SetBoolProperty( CREATE_OUSTRING( "Printable" ), rDrawObj.IsPrintable() );
-
-+
- // virtual call for type specific processing
- DoProcessControl( aPropSet );
- }
-@@ -2170,6 +2183,45 @@ void XclImpOptionButtonObj::DoProcessControl( ScfPropertySet& rPropSet ) const
- {
- XclImpCheckBoxObj::DoProcessControl( rPropSet );
- // TODO: grouping
-+ XclImpOptionButtonObj* pTbxObj = dynamic_cast< XclImpOptionButtonObj* >( GetObjectManager().GetSheetDrawing( GetTab() ).FindDrawObj( mnNextInGroup ).get() );
-+ if ( ( pTbxObj && pTbxObj->mnFirstInGroup ) )
-+ {
-+ // Group has terminated
-+ // traverse each RadioButton in group and
-+ // a) apply the groupname
-+ // b) propagate the linked cell from the lead radiobutton
-+ // c) apply the correct Ref value
-+ XclImpOptionButtonObj* pLeader = pTbxObj;
-+ ;
-+ sal_Int32 nRefVal = 1;
-+ OSL_TRACE( "0x%x start group ", pLeader->GetObjId()/*.mnObjId */);
-+ do
-+ {
-+
-+ Reference< XControlModel > xCtrlModel = XclControlHelper::GetControlModel( pTbxObj->mxShape );
-+ if ( xCtrlModel.is() )
-+ {
-+ ScfPropertySet aProps( xCtrlModel );
-+ rtl::OUString sGroupName = rtl::OUString::valueOf( static_cast< sal_Int32 >( pLeader->GetDffShapeId() ) );
-+
-+ aProps.SetStringProperty( CREATE_OUSTRING( "GroupName" ), sGroupName );
-+ aProps.SetStringProperty( CREATE_OUSTRING( "RefValue" ), rtl::OUString::valueOf( nRefVal++ ) );
-+ if ( pLeader->HasCellLink() && !pTbxObj->HasCellLink() )
-+ {
-+ // propagate cell link info
-+ pTbxObj->mxCellLink.reset( new ScAddress( *pLeader->mxCellLink.get() ) );
-+ pTbxObj->ApplySheetLinkProps();
-+ }
-+ pTbxObj = dynamic_cast< XclImpOptionButtonObj* >( GetObjectManager().GetSheetDrawing( GetTab() ).FindDrawObj( pTbxObj->mnNextInGroup ).get() );
-+ }
-+ else
-+ pTbxObj = NULL;
-+ } while ( pTbxObj && !( pTbxObj->mnFirstInGroup == 1 ) );
-+ }
-+ else
-+ {
-+ // not the leader? try and find it
-+ }
- }
-
- OUString XclImpOptionButtonObj::DoGetServiceName() const
-@@ -2806,6 +2858,17 @@ SdrObject* XclImpPictureObj::DoCreateSdrObj( XclImpDffConverter& rDffConv, const
- return xSdrObj.release();
- }
-
-+String XclImpPictureObj::GetObjName() const
-+{
-+ if( IsOcxControl() )
-+ {
-+ String sName( GetObjectManager().GetOleNameOverride( GetTab(), GetObjId() ) );
-+ if ( sName.Len() > 0 )
-+ return sName;
-+ }
-+ return XclImpDrawObjBase::GetObjName();
-+}
-+
- void XclImpPictureObj::DoPreProcessSdrObj( XclImpDffConverter& rDffConv, SdrObject& rSdrObj ) const
- {
- if( IsOcxControl() )
-@@ -3120,6 +3183,27 @@ XclImpDffConverter::~XclImpDffConverter()
- {
- }
-
-+String XclImpObjectManager::GetOleNameOverride( SCTAB nTab, sal_uInt16 nObjId )
-+{
-+ String sOleName;
-+ String sCodeName = GetExtDocOptions().GetCodeName( nTab );
-+
-+ CodeNameToCntrlObjIdInfo::iterator it = maOleCtrlNameOverride.find( sCodeName );
-+ if ( it != maOleCtrlNameOverride.end() )
-+ {
-+ CntrlObjIdToName::iterator it_id = it->second.find( nObjId );
-+ if ( it_id != it->second.end() )
-+ {
-+ sOleName = it_id->second;
-+ }
-+ }
-+ OSL_TRACE("XclImpObjectManager::GetOleNameOverride tab %d, ( module %s ) object id ( %d ) is %s", nTab,
-+ rtl::OUStringToOString( sCodeName, RTL_TEXTENCODING_UTF8 ).getStr(), nObjId,
-+ rtl::OUStringToOString( sOleName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+
-+ return sOleName;
-+}
-+
- void XclImpDffConverter::StartProgressBar( sal_Size nProgressSize )
- {
- mxProgress.reset( new ScfProgressBar( GetDocShell(), STR_PROGRESS_CALCULATING ) );
-@@ -3990,27 +4074,27 @@ XclImpObjectManager::XclImpObjectManager( const XclImpRoot& rRoot ) :
- XclImpRoot( rRoot )
- {
- maDefObjNames[ EXC_OBJTYPE_GROUP ] = CREATE_STRING( "Group" );
-- maDefObjNames[ EXC_OBJTYPE_LINE ] = CREATE_STRING( "Line" );
-- maDefObjNames[ EXC_OBJTYPE_RECTANGLE ] = CREATE_STRING( "Rectangle" );
-- maDefObjNames[ EXC_OBJTYPE_OVAL ] = CREATE_STRING( "Oval" );
-+ maDefObjNames[ EXC_OBJTYPE_LINE ] = ScGlobal::GetRscString( STR_SHAPE_LINE );
-+ maDefObjNames[ EXC_OBJTYPE_RECTANGLE ] = ScGlobal::GetRscString( STR_SHAPE_RECTANGLE );
-+ maDefObjNames[ EXC_OBJTYPE_OVAL ] = ScGlobal::GetRscString( STR_SHAPE_OVAL );
- maDefObjNames[ EXC_OBJTYPE_ARC ] = CREATE_STRING( "Arc" );
- maDefObjNames[ EXC_OBJTYPE_CHART ] = CREATE_STRING( "Chart" );
- maDefObjNames[ EXC_OBJTYPE_TEXT ] = CREATE_STRING( "Text" );
-- maDefObjNames[ EXC_OBJTYPE_BUTTON ] = CREATE_STRING( "Button" );
-+ maDefObjNames[ EXC_OBJTYPE_BUTTON ] = ScGlobal::GetRscString( STR_FORM_BUTTON );
- maDefObjNames[ EXC_OBJTYPE_PICTURE ] = CREATE_STRING( "Picture" );
- maDefObjNames[ EXC_OBJTYPE_POLYGON ] = CREATE_STRING( "Freeform" );
-- maDefObjNames[ EXC_OBJTYPE_CHECKBOX ] = CREATE_STRING( "Check Box" );
-- maDefObjNames[ EXC_OBJTYPE_OPTIONBUTTON ] = CREATE_STRING( "Option Button" );
-+ maDefObjNames[ EXC_OBJTYPE_CHECKBOX ] = ScGlobal::GetRscString( STR_FORM_CHECKBOX );
-+ maDefObjNames[ EXC_OBJTYPE_OPTIONBUTTON ] = ScGlobal::GetRscString( STR_FORM_OPTIONBUTTON );
- maDefObjNames[ EXC_OBJTYPE_EDIT ] = CREATE_STRING( "Edit Box" );
-- maDefObjNames[ EXC_OBJTYPE_LABEL ] = CREATE_STRING( "Label" );
-+ maDefObjNames[ EXC_OBJTYPE_LABEL ] = ScGlobal::GetRscString( STR_FORM_LABEL );
- maDefObjNames[ EXC_OBJTYPE_DIALOG ] = CREATE_STRING( "Dialog Frame" );
-- maDefObjNames[ EXC_OBJTYPE_SPIN ] = CREATE_STRING( "Spinner" );
-- maDefObjNames[ EXC_OBJTYPE_SCROLLBAR ] = CREATE_STRING( "Scroll Bar" );
-- maDefObjNames[ EXC_OBJTYPE_LISTBOX ] = CREATE_STRING( "List Box" );
-- maDefObjNames[ EXC_OBJTYPE_GROUPBOX ] = CREATE_STRING( "Group Box" );
-- maDefObjNames[ EXC_OBJTYPE_DROPDOWN ] = CREATE_STRING( "Drop Down" );
-+ maDefObjNames[ EXC_OBJTYPE_SPIN ] = ScGlobal::GetRscString( STR_FORM_SPINNER );
-+ maDefObjNames[ EXC_OBJTYPE_SCROLLBAR ] = ScGlobal::GetRscString( STR_FORM_SCROLLBAR );
-+ maDefObjNames[ EXC_OBJTYPE_LISTBOX ] = ScGlobal::GetRscString( STR_FORM_LISTBOX );
-+ maDefObjNames[ EXC_OBJTYPE_GROUPBOX ] = ScGlobal::GetRscString( STR_FORM_GROUPBOX );
-+ maDefObjNames[ EXC_OBJTYPE_DROPDOWN ] = ScGlobal::GetRscString( STR_FORM_DROPDOWN );
- maDefObjNames[ EXC_OBJTYPE_NOTE ] = CREATE_STRING( "Comment" );
-- maDefObjNames[ EXC_OBJTYPE_DRAWING ] = CREATE_STRING( "AutoShape" );
-+ maDefObjNames[ EXC_OBJTYPE_DRAWING ] = ScGlobal::GetRscString( STR_SHAPE_AUTOSHAPE );
- }
-
- XclImpObjectManager::~XclImpObjectManager()
-diff --git sc/source/filter/excel/xiname.cxx sc/source/filter/excel/xiname.cxx
-index 38e08b0..94e0b77 100644
---- sc/source/filter/excel/xiname.cxx
-+++ sc/source/filter/excel/xiname.cxx
-@@ -35,7 +35,8 @@
- #include "excform.hxx"
- // for filter manager
- #include "excimp8.hxx"
--
-+#include "scextopt.hxx"
-+#include "document.hxx"
- // ============================================================================
- // *** Implementation ***
- // ============================================================================
-@@ -127,6 +128,7 @@ XclImpName::XclImpName( XclImpStream& rStrm, sal_uInt16 nXclNameIdx ) :
- maScName = maXclName;
- ScfTools::ConvertToScDefinedName( maScName );
- }
-+ rtl::OUString aRealOrigName = maScName;
-
- // add index for local names
- if( nXclTab != EXC_NAME_GLOBAL )
-@@ -219,6 +221,25 @@ XclImpName::XclImpName( XclImpStream& rStrm, sal_uInt16 nXclNameIdx ) :
- pData->GuessPosition(); // calculate base position for relative refs
- pData->SetIndex( nXclNameIdx ); // used as unique identifier in formulas
- rRangeNames.Insert( pData ); // takes ownership of pData
-+ if( nXclTab != EXC_NAME_GLOBAL )
-+ {
-+ if (GetBiff() == EXC_BIFF8)
-+ {
-+ ScRange aRange;
-+ // discard deleted ranges ( for the moment at least )
-+ if ( pData->IsValidReference( aRange ) )
-+ {
-+ ScExtTabSettings& rTabSett = GetExtDocOptions().GetOrCreateTabSettings( nXclTab );
-+ // create a mapping between the unmodified localname to
-+ // the name in the global name container for named ranges
-+ OSL_TRACE(" mapping local name to global name for tab %d which exists? %s", nXclTab, GetDoc().HasTable( mnScTab ) ? "true" : "false" );
-+ SCTAB nTab( static_cast< SCTAB >( mnScTab ) );
-+ NameToNameMap* pMap = GetDoc().GetLocalNameMap( nTab );
-+ if ( pMap )
-+ (*pMap)[ aRealOrigName ] = maScName;
-+ }
-+ }
-+ }
- mpScData = pData; // cache for later use
- }
- }
-diff --git sc/source/filter/excel/xistyle.cxx sc/source/filter/excel/xistyle.cxx
-index b1ce3a0..fdd537a 100644
---- sc/source/filter/excel/xistyle.cxx
-+++ sc/source/filter/excel/xistyle.cxx
-@@ -69,12 +69,73 @@
-
- #include <list>
-
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/container/XIndexAccess.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+
- using ::std::list;
-+using namespace ::com::sun::star;
-+
-+typedef ::cppu::WeakImplHelper1< container::XIndexAccess > XIndexAccess_BASE;
-+typedef ::std::vector< ColorData > ColorDataVec;
-+
-+class PaletteIndex : public XIndexAccess_BASE
-+{
-+public:
-+ PaletteIndex( const ColorDataVec& rColorDataTable ) : maColorData( rColorDataTable ) {}
-+
-+ // Methods XIndexAccess
-+ virtual ::sal_Int32 SAL_CALL getCount() throw (uno::RuntimeException)
-+ {
-+ return maColorData.size();
-+ }
-+
-+ virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ //--Index; // apparently the palette is already 1 based
-+ return uno::makeAny( sal_Int32( maColorData[ Index ] ) );
-+ }
-+
-+ // Methods XElementAcess
-+ virtual uno::Type SAL_CALL getElementType() throw (uno::RuntimeException)
-+ {
-+ return ::getCppuType( (sal_Int32*)0 );
-+ }
-+ virtual ::sal_Bool SAL_CALL hasElements() throw (uno::RuntimeException)
-+ {
-+ return (maColorData.size() > 0);
-+ }
-+
-+private:
-+ ColorDataVec maColorData;
-+};
-+
-+void
-+XclImpPalette::ExportPalette()
-+{
-+ if( SfxObjectShell* pDocShell = mrRoot.GetDocShell() )
-+ {
-+ // copy values in color palette
-+ sal_Int16 nColors = maColorTable.size();
-+ ColorDataVec aColors;
-+ aColors.resize( nColors );
-+ for( sal_uInt16 nIndex = 0; nIndex < nColors; ++nIndex )
-+ aColors[ nIndex ] = GetColorData( nIndex );
-+
-+ uno::Reference< beans::XPropertySet > xProps( pDocShell->GetModel(), uno::UNO_QUERY );
-+ if ( xProps.is() )
-+ {
-+ uno::Reference< container::XIndexAccess > xIndex( new PaletteIndex( aColors ) );
-+ xProps->setPropertyValue( CREATE_OUSTRING("ColorPalette"), uno::makeAny( xIndex ) );
-+ }
-+ }
-+
-+}
-
- // PALETTE record - color information =========================================
-
- XclImpPalette::XclImpPalette( const XclImpRoot& rRoot ) :
-- XclDefaultPalette( rRoot )
-+ XclDefaultPalette( rRoot ), mrRoot( rRoot )
- {
- }
-
-@@ -102,6 +162,7 @@ void XclImpPalette::ReadPalette( XclImpStream& rStrm )
- rStrm >> aColor;
- maColorTable[ nIndex ] = aColor.GetColor();
- }
-+ ExportPalette();
- }
-
- // FONT record - font information =============================================
-diff --git sc/source/filter/excel/xlescher.cxx sc/source/filter/excel/xlescher.cxx
-index ec4828d..3360b02 100644
---- sc/source/filter/excel/xlescher.cxx
-+++ sc/source/filter/excel/xlescher.cxx
-@@ -366,7 +366,7 @@ bool XclControlHelper::FillMacroDescriptor( ScriptEventDescriptor& rDescriptor,
- }
-
- String XclControlHelper::ExtractFromMacroDescriptor(
-- const ScriptEventDescriptor& rDescriptor, XclTbxEventType eEventType )
-+ const ScriptEventDescriptor& rDescriptor, XclTbxEventType eEventType, SfxObjectShell* pShell )
- {
- if( (rDescriptor.ScriptCode.getLength() > 0) &&
- rDescriptor.ScriptType.equalsIgnoreAsciiCaseAscii( "Script" ) &&
-diff --git sc/source/filter/excel/xltoolbar.cxx sc/source/filter/excel/xltoolbar.cxx
-new file mode 100644
-index 0000000..019a146
---- /dev/null
-+++ sc/source/filter/excel/xltoolbar.cxx
-@@ -0,0 +1,433 @@
-+#include "xltoolbar.hxx"
-+#include <rtl/ustrbuf.hxx>
-+#include <stdarg.h>
-+#include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
-+#include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
-+#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
-+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-+#include <com/sun/star/lang/XSingleComponentFactory.hpp>
-+#include <com/sun/star/lang/XMultiComponentFactory.hpp>
-+#include <com/sun/star/ui/XImageManager.hpp>
-+#include <com/sun/star/ui/ItemType.hpp>
-+#include <fstream>
-+#include <comphelper/processfactory.hxx>
-+#include <vcl/graph.hxx>
-+#include <map>
-+using namespace com::sun::star;
-+
-+typedef std::map< sal_Int16, rtl::OUString > IdToString;
-+
-+class MSOExcelCommandConvertor : public MSOCommandConvertor
-+{
-+ IdToString msoToOOcmd;
-+ IdToString tcidToOOcmd;
-+public:
-+ MSOExcelCommandConvertor();
-+ virtual rtl::OUString MSOCommandToOOCommand( sal_Int16 msoCmd );
-+ virtual rtl::OUString MSOTCIDToOOCommand( sal_Int16 key );
-+};
-+
-+MSOExcelCommandConvertor::MSOExcelCommandConvertor()
-+{
-+/*
-+ // mso command id to ooo command string
-+ // #FIXME and *HUNDREDS* of id's to added here
-+ msoToOOcmd[ 0x20b ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".uno:CloseDoc") );
-+ msoToOOcmd[ 0x50 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".uno:Open") );
-+
-+ // mso tcid to ooo command string
-+ // #FIXME and *HUNDREDS* of id's to added here
-+ tcidToOOcmd[ 0x9d9 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".uno:Print") );
-+*/
-+}
-+
-+rtl::OUString MSOExcelCommandConvertor::MSOCommandToOOCommand( sal_Int16 key )
-+{
-+ rtl::OUString sResult;
-+ IdToString::iterator it = msoToOOcmd.find( key );
-+ if ( it != msoToOOcmd.end() )
-+ sResult = it->second;
-+ return sResult;
-+}
-+
-+rtl::OUString MSOExcelCommandConvertor::MSOTCIDToOOCommand( sal_Int16 key )
-+{
-+ rtl::OUString sResult;
-+ IdToString::iterator it = tcidToOOcmd.find( key );
-+ if ( it != tcidToOOcmd.end() )
-+ sResult = it->second;
-+ return sResult;
-+}
-+
-+
-+
-+CTBS::CTBS() : bSignature(0), bVersion(0), reserved1(0), reserved2(0), reserved3(0), ctb(0), ctbViews(0), ictbView(0)
-+{
-+}
-+
-+CTB::CTB() : nViews( 0 ), ectbid(0)
-+{
-+}
-+
-+CTB::CTB(sal_uInt16 nNum ) : nViews( nNum ), ectbid(0)
-+{
-+}
-+
-+bool CTB::Read( SvStream *pS )
-+{
-+ OSL_TRACE("CTB::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ tb.Read( pS );
-+ for ( sal_uInt16 index = 0; index < nViews; ++index )
-+ {
-+ TBVisualData aVisData;
-+ aVisData.Read( pS );
-+ rVisualData.push_back( aVisData );
-+ }
-+ *pS >> ectbid;
-+
-+ for ( sal_Int16 index = 0; index < tb.getcCL(); ++index )
-+ {
-+ TBC aTBC;
-+ aTBC.Read( pS );
-+ rTBC.push_back( aTBC );
-+ }
-+ return true;
-+}
-+
-+void CTB::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf( fp, "[ 0x%x ] CTB -- dump\n", nOffSet );
-+ indent_printf( fp, " nViews 0x%x\n", nViews);
-+ tb.Print( fp );
-+
-+ std::vector<TBVisualData>::iterator visData_end = rVisualData.end();
-+ sal_Int32 counter = 0;
-+ for ( std::vector<TBVisualData>::iterator it = rVisualData.begin(); it != visData_end; ++it )
-+ {
-+
-+ indent_printf( fp, " TBVisualData [%d]\n", counter++ );
-+ Indent b;
-+ it->Print( fp );
-+ }
-+ indent_printf( fp, " ectbid 0x%x\n", ectbid);
-+ std::vector<TBC>::iterator it_end = rTBC.end();
-+ counter = 0;
-+ for ( std::vector<TBC>::iterator it = rTBC.begin(); it != it_end; ++it )
-+ {
-+ indent_printf( fp, " TBC [%d]\n", counter++);
-+ Indent c;
-+ it->Print( fp );
-+ }
-+}
-+
-+bool CTB::IsMenuToolbar()
-+{
-+ return tb.IsMenuToolbar();
-+}
-+
-+bool CTB::ImportMenuTB( CTBWrapper& rWrapper, const css::uno::Reference< css::container::XIndexContainer >& xMenuDesc, CustomToolBarImportHelper& helper )
-+{
-+ sal_Int32 index = 0;
-+ for ( std::vector< TBC >::iterator it = rTBC.begin(); it != rTBC.end(); ++it, ++index )
-+ {
-+ if ( !it->ImportToolBarControl( rWrapper, xMenuDesc, helper, IsMenuToolbar() ) )
-+ return false;
-+ }
-+ return true;
-+}
-+
-+bool CTB::ImportCustomToolBar( CTBWrapper& rWrapper, CustomToolBarImportHelper& helper )
-+{
-+
-+ static rtl::OUString sToolbarPrefix( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/custom_" ) );
-+ bool bRes = false;
-+ try
-+ {
-+ if ( !tb.IsEnabled() )
-+ return true; // didn't fail, just ignoring
-+
-+ // Create default setting
-+ uno::Reference< container::XIndexContainer > xIndexContainer( helper.getCfgManager()->createSettings(), uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xIndexAccess( xIndexContainer, uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xProps( xIndexContainer, uno::UNO_QUERY_THROW );
-+ WString& name = tb.getName();
-+ // set UI name for toolbar
-+ xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UIName") ), uno::makeAny( name.getString() ) );
-+
-+ rtl::OUString sToolBarName = sToolbarPrefix.concat( name.getString() );
-+ for ( std::vector< TBC >::iterator it = rTBC.begin(); it != rTBC.end(); ++it )
-+ {
-+ if ( !it->ImportToolBarControl( rWrapper, xIndexContainer, helper, IsMenuToolbar() ) )
-+ return false;
-+ }
-+
-+ OSL_TRACE("Name of toolbar :-/ %s", rtl::OUStringToOString( sToolBarName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+
-+ helper.getCfgManager()->insertSettings( sToolBarName, xIndexAccess );
-+ helper.applyIcons();
-+#if 1
-+ uno::Reference< ui::XUIConfigurationPersistence > xPersistence( helper.getCfgManager()->getImageManager(), uno::UNO_QUERY_THROW );
-+ xPersistence->store();
-+
-+ xPersistence.set( helper.getCfgManager(), uno::UNO_QUERY_THROW );
-+ xPersistence->store();
-+#endif
-+
-+ bRes = true;
-+ }
-+ catch( uno::Exception& )
-+ {
-+ bRes = false;
-+ }
-+ return bRes;
-+}
-+bool CTBS::Read( SvStream *pS )
-+{
-+ OSL_TRACE("CTBS::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> bSignature >> bVersion >> reserved1 >> reserved2 >> reserved3 >> ctb >> ctbViews >> ictbView;
-+ return true;
-+}
-+
-+void CTBS::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf( fp, "[ 0x%x ] CTBS -- dump\n", nOffSet );
-+
-+ indent_printf( fp, " bSignature 0x%x\n", bSignature);
-+ indent_printf( fp, " bVersion 0x%x\n", bVersion);
-+
-+ indent_printf( fp, " reserved1 0x%x\n", reserved1 );
-+ indent_printf( fp, " reserved2 0x%x\n", reserved2 );
-+ indent_printf( fp, " reserved3 0x%x\n", reserved3 );
-+
-+ indent_printf( fp, " ctb 0x%x\n", ctb );
-+ indent_printf( fp, " ctbViews 0x%x\n", ctbViews );
-+ indent_printf( fp, " ictbView 0x%x\n", ictbView );
-+}
-+
-+TBC::TBC()
-+{
-+}
-+
-+bool
-+TBC::Read(SvStream *pS)
-+{
-+ OSL_TRACE("TBC::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ if ( !tbch.Read( pS ) )
-+ return false;
-+ sal_uInt16 tcid = tbch.getTcID();
-+ sal_uInt8 tct = tbch.getTct();
-+ if ( ( tcid != 0x0001 && tcid != 0x06CC && tcid != 0x03D8 && tcid != 0x03EC && tcid != 0x1051 ) && ( ( tct > 0 && tct < 0x0B ) || ( ( tct > 0x0B && tct < 0x10 ) || tct == 0x15 ) ) )
-+ {
-+ tbcCmd.reset( new TBCCmd );
-+ if ( ! tbcCmd->Read( pS ) )
-+ return false;
-+ }
-+ if ( tct != 0x16 )
-+ {
-+ tbcd.reset( new TBCData( tbch ) );
-+ if ( !tbcd->Read( pS ) )
-+ return false;
-+ }
-+ return true;
-+}
-+
-+
-+void
-+TBC::Print(FILE* fp)
-+{
-+ Indent a;
-+ indent_printf( fp, "[ 0x%x ] TBC -- dump\n", nOffSet );
-+ tbch.Print( fp );
-+ if ( tbcCmd.get() )
-+ tbcCmd->Print( fp );
-+ if ( tbcd.get() )
-+ tbcd->Print( fp );
-+}
-+
-+bool TBC::ImportToolBarControl( CTBWrapper& rWrapper, const css::uno::Reference< css::container::XIndexContainer >& toolbarcontainer, CustomToolBarImportHelper& helper, bool bIsMenuToolbar )
-+{
-+ // how to identify built-in-command ?
-+// bool bBuiltin = false;
-+ if ( tbcd.get() )
-+ {
-+ std::vector< css::beans::PropertyValue > props;
-+/*
-+ if ( bBuiltin )
-+ {
-+ rtl::OUString sCommand = helper.MSOCommandToOOCommand( cmdId );
-+ if ( sCommand.getLength() > 0 )
-+ {
-+ beans::PropertyValue aProp;
-+
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CommandURL") );
-+ aProp.Value <<= sCommand;
-+ props.push_back( aProp );
-+ }
-+
-+ }
-+*/
-+ bool bBeginGroup = false;
-+ if ( ! tbcd->ImportToolBarControl( helper, props, bBeginGroup, bIsMenuToolbar ) )
-+ return false;
-+ TBCMenuSpecific* pMenu = tbcd->getMenuSpecific();
-+ if ( pMenu )
-+ {
-+ // search for CTB with the appropriate name ( it contains the
-+ // menu items, although we cannot import ( or create ) a menu on
-+ // a custom toolbar we can import the menu items in a separate
-+ // toolbar ( better than nothing )
-+ CTB* pCustTB = rWrapper.GetCustomizationData( pMenu->Name() );
-+ if ( pCustTB )
-+ {
-+ uno::Reference< container::XIndexContainer > xMenuDesc;
-+ uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+ xMenuDesc.set( xMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.IndexedPropertyValues" ) ) ), uno::UNO_QUERY_THROW );
-+ if ( !pCustTB->ImportMenuTB( rWrapper, xMenuDesc, helper ) )
-+ return false;
-+ if ( !bIsMenuToolbar )
-+ {
-+ if ( !helper.createMenu( pMenu->Name(), uno::Reference< container::XIndexAccess >( xMenuDesc, uno::UNO_QUERY ), true ) )
-+ return false;
-+ }
-+ else
-+ {
-+ beans::PropertyValue aProp;
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ItemDescriptorContainer") );
-+ aProp.Value <<= xMenuDesc;
-+ props.push_back( aProp );
-+ }
-+ }
-+ }
-+
-+ if ( bBeginGroup )
-+ {
-+ // insert spacer
-+ uno::Sequence< beans::PropertyValue > sProps( 1 );
-+ sProps[ 0 ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Type") );
-+ sProps[ 0 ].Value = uno::makeAny( ui::ItemType::SEPARATOR_LINE );
-+ toolbarcontainer->insertByIndex( toolbarcontainer->getCount(), uno::makeAny( sProps ) );
-+ }
-+ uno::Sequence< beans::PropertyValue > sProps( props.size() );
-+ beans::PropertyValue* pProp = sProps.getArray();
-+
-+ for ( std::vector< css::beans::PropertyValue >::iterator it = props.begin(); it != props.end(); ++it, ++pProp )
-+ *pProp = *it;
-+
-+ toolbarcontainer->insertByIndex( toolbarcontainer->getCount(), uno::makeAny( sProps ) );
-+ }
-+ return true;
-+}
-+
-+void
-+TBCCmd::Print(FILE* fp)
-+{
-+ Indent a;
-+ indent_printf( fp, " TBCCmd -- dump\n" );
-+ indent_printf( fp, " cmdID 0x%x\n", cmdID );
-+ indent_printf( fp, " A ( fHideDrawing ) %s\n", A ? "true" : "false" );
-+ indent_printf( fp, " B ( reserved - ignored ) %s\n", A ? "true" : "false" );
-+ indent_printf( fp, " cmdType 0x%x\n", cmdType );
-+ indent_printf( fp, " C ( reserved - ignored ) %s\n", A ? "true" : "false" );
-+ indent_printf( fp, " reserved3 0x%x\n", reserved3 );
-+}
-+
-+bool TBCCmd::Read( SvStream *pS )
-+{
-+ OSL_TRACE("TBCCmd::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> cmdID;
-+ sal_uInt16 temp;
-+ *pS >> temp;
-+ OSL_TRACE("TBCmd temp = 0x%x", temp );
-+ A = (temp & 0x8000 ) == 0x8000;
-+ B = (temp & 0x4000) == 0x4000;
-+ cmdType = ( temp & 0x3E00 ) >> 9;
-+ C = ( temp & 0x100 ) == 0x100;
-+ reserved3 = ( temp & 0xFF );
-+ return true;
-+}
-+
-+CTBWrapper::CTBWrapper()
-+{
-+}
-+
-+CTBWrapper::~CTBWrapper()
-+{
-+}
-+
-+bool
-+CTBWrapper::Read( SvStream *pS)
-+{
-+ OSL_TRACE("CTBWrapper::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ if ( !ctbSet.Read( pS ) )
-+ return false;
-+ for ( sal_uInt16 index = 0; index < ctbSet.ctb; ++index )
-+ {
-+ CTB aCTB( ctbSet.ctbViews );
-+ if ( !aCTB.Read( pS ) )
-+ return false;
-+ rCTB.push_back( aCTB );
-+ }
-+ return true;
-+}
-+
-+void
-+CTBWrapper::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf( fp, "[ 0x%x ] CTBWrapper -- dump\n", nOffSet );
-+ ctbSet.Print( fp );
-+ std::vector<CTB>::iterator it_end = rCTB.end();
-+ for ( std::vector<CTB>::iterator it = rCTB.begin(); it != it_end; ++it )
-+ {
-+ Indent b;
-+ it->Print( fp );
-+ }
-+}
-+
-+CTB* CTBWrapper::GetCustomizationData( const rtl::OUString& sTBName )
-+{
-+ CTB* pCTB = NULL;
-+ for ( std::vector< CTB >::iterator it = rCTB.begin(); it != rCTB.end(); ++it )
-+ {
-+ if ( it->GetName().equals( sTBName ) )
-+ {
-+ pCTB = &(*it);
-+ break;
-+ }
-+ }
-+ return pCTB;
-+}
-+
-+bool CTBWrapper::ImportCustomToolBar( SfxObjectShell& rDocSh )
-+{
-+ std::vector<CTB>::iterator it_end = rCTB.end();
-+ for ( std::vector<CTB>::iterator it = rCTB.begin(); it != it_end; ++it )
-+ {
-+ // for each customtoolbar
-+ uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+ uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xAppCfgSupp( xMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.ModuleUIConfigurationManagerSupplier" ) ) ), uno::UNO_QUERY_THROW );
-+ CustomToolBarImportHelper helper( rDocSh, xAppCfgSupp->getUIConfigurationManager( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.SpreadsheetDocument" ) ) ) );
-+ helper.setMSOCommandMap( new MSOExcelCommandConvertor() );
-+ // Ignore menu toolbars, excel doesn't ( afaics ) store
-+ // menu customizations ( but you can have menus in a customtoolbar
-+ // such menus will be dealt with when they are encountered
-+ // as part of importing the appropriate MenuSpecific toolbar control )
-+
-+
-+ if ( !(*it).IsMenuToolbar() )
-+ {
-+ if ( !(*it).ImportCustomToolBar( *this, helper ) )
-+ return false;
-+ }
-+ }
-+ return true;
-+}
-+
-+
-diff --git sc/source/filter/excel/xltoolbar.hxx sc/source/filter/excel/xltoolbar.hxx
-new file mode 100644
-index 0000000..5bfbe2c
---- /dev/null
-+++ sc/source/filter/excel/xltoolbar.hxx
-@@ -0,0 +1,95 @@
-+#ifndef _XLTOOLBAR_HXX
-+#define _XLTOOLBAR_HXX
-+
-+#include <filter/msfilter/mstoolbar.hxx>
-+
-+namespace css = ::com::sun::star;
-+
-+class CTBWrapper;
-+// hmm I don't normally use these packed structures
-+// but.. hey always good to do something different
-+class TBCCmd : public TBBase
-+{
-+public:
-+ TBCCmd() : cmdID(0), A(0), B(0), cmdType(0), C(0), reserved3(0) {}
-+ sal_uInt16 cmdID;
-+ sal_uInt16 A:1;
-+ sal_uInt16 B:1;
-+ sal_uInt16 cmdType:5;
-+ sal_uInt16 C:1;
-+ sal_uInt16 reserved3:8;
-+ bool Read( SvStream* pS );
-+ void Print(FILE* fp);
-+};
-+
-+class TBC : public TBBase
-+{
-+ TBCHeader tbch;
-+ boost::shared_ptr<TBCCmd> tbcCmd; // optional
-+ boost::shared_ptr<TBCData> tbcd;
-+public:
-+ TBC();
-+ ~TBC(){}
-+ void Print( FILE* );
-+ bool Read(SvStream *pS);
-+ bool ImportToolBarControl( CTBWrapper&, const com::sun::star::uno::Reference< com::sun::star::container::XIndexContainer >& toolbarcontainer, CustomToolBarImportHelper& helper, bool bIsMenuBar );
-+};
-+
-+class CTB : public TBBase
-+{
-+ sal_uInt16 nViews;
-+ TB tb;
-+ std::vector<TBVisualData> rVisualData;
-+ sal_uInt32 ectbid;
-+ std::vector< TBC > rTBC;
-+ bool ImportCustomToolBar_Impl( CTBWrapper&, CustomToolBarImportHelper& );
-+public:
-+ CTB();
-+ CTB(sal_uInt16);
-+ ~CTB(){}
-+ void Print( FILE* );
-+ bool Read(SvStream *pS);
-+ bool IsMenuToolbar();
-+ bool ImportCustomToolBar( CTBWrapper&, CustomToolBarImportHelper& );
-+ bool ImportMenuTB( CTBWrapper&, const css::uno::Reference< css::container::XIndexContainer >&, CustomToolBarImportHelper& );
-+ rtl::OUString GetName() { return tb.getName().getString(); }
-+
-+
-+};
-+
-+class CTBS : public TBBase
-+{
-+public:
-+ sal_uInt8 bSignature;
-+ sal_uInt8 bVersion;
-+ sal_uInt16 reserved1;
-+ sal_uInt16 reserved2;
-+ sal_uInt16 reserved3;
-+ sal_uInt16 ctb;
-+ sal_uInt16 ctbViews;
-+ sal_uInt16 ictbView;
-+ CTBS(const CTBS&);
-+ CTBS& operator = ( const CTBS&);
-+ CTBS();
-+ ~CTBS(){}
-+ void Print( FILE* );
-+ bool Read(SvStream *pS);
-+};
-+
-+class CTBWrapper : public TBBase
-+{
-+ CTBS ctbSet;
-+
-+ std::vector< CTB > rCTB;
-+
-+public:
-+ CTBWrapper();
-+ ~CTBWrapper();
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+ bool ImportCustomToolBar( SfxObjectShell& rDocSh );
-+ CTB* GetCustomizationData( const rtl::OUString& name );
-+};
-+
-+
-+#endif //_XLTOOLBAR_HXX
-diff --git sc/source/filter/inc/excimp8.hxx sc/source/filter/inc/excimp8.hxx
-index d3cca16..cdcf128 100644
---- sc/source/filter/inc/excimp8.hxx
-+++ sc/source/filter/inc/excimp8.hxx
-@@ -57,6 +57,9 @@ public:
- virtual FltError Read( void );
-
- protected:
-+ // represents codename ( and associated modules )
-+ // not speficied directly in the binary format
-+ std::vector< String > AutoGeneratedCodeNames;
- ExcScenarioList aScenList;
-
- void Calccount( void ); // 0x0C
-diff --git sc/source/filter/inc/xcl97esc.hxx sc/source/filter/inc/xcl97esc.hxx
-index e40e3f1..2c52717 100644
---- sc/source/filter/inc/xcl97esc.hxx
-+++ sc/source/filter/inc/xcl97esc.hxx
-@@ -70,6 +70,15 @@ class XclExpOcxControlObj;
- #else
- class XclExpTbxControlObj;
- #endif
-+class XclExpShapeObj;
-+class EscherExHostAppData;
-+class ShapeInteractionHelper
-+{
-+public:
-+ static XclExpShapeObj* CreateShapeObj( XclExpObjectManager& rObjMgr, const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::drawing::XShape >& xShape );
-+ static void PopulateShapeInteractionInfo( XclExpObjectManager& rObjMgr, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape, EscherExHostAppData& rHostAppData );
-+};
-
- class XclEscherEx : public EscherEx, protected XclExpRoot
- {
-diff --git sc/source/filter/inc/xcl97rec.hxx sc/source/filter/inc/xcl97rec.hxx
-index 82db773..3274d88 100644
---- sc/source/filter/inc/xcl97rec.hxx
-+++ sc/source/filter/inc/xcl97rec.hxx
-@@ -220,7 +220,7 @@ public:
-
- class XclObjAny : public XclObj
- {
--private:
-+protected:
- virtual void WriteSubRecs( XclExpStream& rStrm );
-
- public:
-diff --git sc/source/filter/inc/xecontent.hxx sc/source/filter/inc/xecontent.hxx
-index 4783814..ddb6162 100644
---- sc/source/filter/inc/xecontent.hxx
-+++ sc/source/filter/inc/xecontent.hxx
-@@ -113,6 +113,8 @@ public:
- inline const String* GetRepr() const { return mxRepr.get(); }
-
- virtual void SaveXml( XclExpXmlStream& rStrm );
-+
-+ virtual void WriteEmbeddedData( XclExpStream& rStrm );
- private:
- /** Builds file name from the passed file URL. Tries to convert to relative file name.
- @param rnLevel (out-param) The parent directory level.
-diff --git sc/source/filter/inc/xeescher.hxx sc/source/filter/inc/xeescher.hxx
-index 259ab97..c57993c 100644
---- sc/source/filter/inc/xeescher.hxx
-+++ sc/source/filter/inc/xeescher.hxx
-@@ -207,6 +207,34 @@ private:
- sal_uInt16 mnEntryCount; /// Number of entries in source range.
- };
-
-+class XclMacroHelper : public XclExpControlHelper
-+{
-+protected:
-+ XclTokenArrayRef mxMacroLink; /// Token array containing a link to an attached macro.
-+
-+public:
-+ explicit XclMacroHelper( const XclExpRoot& rRoot );
-+ virtual ~XclMacroHelper();
-+ /** Writes an ftMacro subrecord containing a macro link, or nothing, if no macro present. */
-+ void WriteMacroSubRec( XclExpStream& rStrm );
-+ /** Sets the name of a macro for object of passed type
-+ @return true = The passed event descriptor was valid, macro name has been found. */
-+ bool SetMacroLink( const ::com::sun::star::script::ScriptEventDescriptor& rEvent, const XclTbxEventType& nEventType );
-+
-+ /** Sets the name of a macro
-+ @return true = The passed macro name has been found. */
-+ bool SetMacroLink( const String& rMacro );
-+};
-+
-+class XclExpShapeObj : public XclObjAny, public XclMacroHelper
-+{
-+public:
-+ explicit XclExpShapeObj( XclExpObjectManager& rRoot, ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
-+ virtual ~XclExpShapeObj();
-+private:
-+ virtual void WriteSubRecs( XclExpStream& rStrm );
-+};
-+
- // ----------------------------------------------------------------------------
-
- #if EXC_EXP_OCX_CTRL
-@@ -234,7 +262,7 @@ private:
- #else
-
- /** Represents an OBJ record for an TBX form control. */
--class XclExpTbxControlObj : public XclObj, public XclExpControlHelper
-+class XclExpTbxControlObj : public XclObj, public XclMacroHelper
- {
- public:
- explicit XclExpTbxControlObj(
-@@ -249,8 +277,6 @@ public:
- private:
- virtual void WriteSubRecs( XclExpStream& rStrm );
-
-- /** Writes an ftMacro subrecord containing a macro link, or nothing, if no macro present. */
-- void WriteMacroSubRec( XclExpStream& rStrm );
- /** Writes a subrecord containing a cell link, or nothing, if no link present. */
- void WriteCellLinkSubRec( XclExpStream& rStrm, sal_uInt16 nSubRecId );
- /** Writes the ftSbs sub structure containing scrollbar data. */
-@@ -258,7 +284,6 @@ private:
-
- private:
- ScfInt16Vec maMultiSel; /// Indexes of all selected entries in a multi selection.
-- XclTokenArrayRef mxMacroLink; /// Token array containing a link to an attached macro.
- XclTbxEventType meEventType; /// Type of supported macro event.
- sal_Int32 mnHeight; /// Height of the control.
- sal_uInt16 mnState; /// Checked/unchecked state.
-diff --git sc/source/filter/inc/xiescher.hxx sc/source/filter/inc/xiescher.hxx
-index b845207..a5998ed 100644
---- sc/source/filter/inc/xiescher.hxx
-+++ sc/source/filter/inc/xiescher.hxx
-@@ -30,6 +30,7 @@
-
- #include <vector>
- #include <map>
-+#include <hash_map>
- #include <filter/msfilter/msdffimp.hxx>
- #include <filter/msfilter/msocximex.hxx>
- #include <vcl/graph.hxx>
-@@ -92,7 +93,7 @@ public:
- /** Returns the Excel object type from OBJ record. */
- inline sal_uInt16 GetObjType() const { return mnObjType; }
- /** Returns the name of this object, may generate a default name. */
-- String GetObjName() const;
-+ virtual String GetObjName() const;
- /** Returns associated macro name, if set, otherwise zero length string. */
- inline const String& GetMacroName() const { return maMacroName; }
-
-@@ -172,7 +173,7 @@ protected:
- virtual void DoPreProcessSdrObj( XclImpDffConverter& rDffConv, SdrObject& rSdrObj ) const;
- /** Derived classes may perform additional processing for the passed SdrObject after insertion. */
- virtual void DoPostProcessSdrObj( XclImpDffConverter& rDffConv, SdrObject& rSdrObj ) const;
--
-+ SCTAB GetTab() const { return mnTab; }
- private:
- /** Reads the contents of a BIFF3 OBJ record. */
- void ImplReadObj3( XclImpStream& rStrm );
-@@ -186,6 +187,7 @@ private:
- private:
- XclObjAnchor maAnchor; /// The position of the object in its parent.
- sal_uInt16 mnObjId; /// The object identifier (unique per drawing).
-+ SCTAB mnTab; /// Location of object
- sal_uInt16 mnObjType; /// The Excel object type from OBJ record.
- sal_uInt32 mnDffShapeId; /// Shape ID from DFF stream.
- sal_uInt32 mnDffFlags; /// Shape flags from DFF stream.
-@@ -502,6 +504,10 @@ protected:
- /** Derived classes will set additional properties for the current form control. */
- virtual void DoProcessControl( ScfPropertySet& rPropSet ) const;
-
-+ void ApplySheetLinkProps() const;
-+ mutable ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
-+ mxShape; /// The UNO wrapper of the control shape.
-+ ScfRef< ScAddress > mxCellLink; /// Linked cell in the Calc document.
- private:
- /** Reads a list of cell ranges from a formula at the current stream position. */
- void ReadRangeList( ScRangeList& rScRanges, XclImpStream& rStrm );
-@@ -510,9 +516,6 @@ private:
-
- private:
- const XclImpRoot& mrRoot; /// Not derived from XclImpRoot to allow multiple inheritance.
-- mutable ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
-- mxShape; /// The UNO wrapper of the control shape.
-- ScfRef< ScAddress > mxCellLink; /// Linked cell in the Calc document.
- ScfRef< ScRange > mxSrcRange; /// Source data range in the Calc document.
- XclCtrlBindMode meBindMode; /// Value binding mode.
- };
-@@ -614,6 +617,7 @@ protected:
- virtual XclTbxEventType DoGetEventType() const;
-
- protected:
-+ void ApplyGrouping( XclImpOptionButtonObj& rLeader, sal_Int32 nRefVal );
- sal_uInt16 mnNextInGroup; /// Next option button in a group.
- sal_uInt16 mnFirstInGroup; /// 1 = Button is the first in a group.
- };
-@@ -862,7 +866,8 @@ class XclImpPictureObj : public XclImpRectObj, public XclImpControlHelper
- {
- public:
- explicit XclImpPictureObj( const XclImpRoot& rRoot );
--
-+ /** Returns the ObjectName - can use non-obvious lookup for override in the associated vba document module stream**/
-+ virtual String GetObjName() const;
- /** Returns the graphic imported from the IMGDATA record. */
- inline const Graphic& GetGraphic() const { return maGraphic; }
- /** Returns the visible area of the imported graphic. */
-@@ -1209,6 +1214,8 @@ private:
- /** Stores all drawing and OLE objects and additional data related to these objects. */
- class XclImpObjectManager : protected XclImpRoot
- {
-+typedef std::hash_map< sal_Int32, String > CntrlObjIdToName;
-+typedef std::map< String, CntrlObjIdToName > CodeNameToCntrlObjIdInfo;
- public:
- explicit XclImpObjectManager( const XclImpRoot& rRoot );
- virtual ~XclImpObjectManager();
-@@ -1225,9 +1232,41 @@ public:
- String GetDefaultObjName( const XclImpDrawObjBase& rDrawObj ) const;
- /** Returns the used area in the sheet with the passed index. */
- ScRange GetUsedArea( SCTAB nScTab ) const;
-+ void SetOleNameOverrideInfo( const CodeNameToCntrlObjIdInfo& rOverrideInfo ) { maOleCtrlNameOverride = rOverrideInfo; }
-+ String GetOleNameOverride( SCTAB nTab, sal_uInt16 nObjId );
-+ // ------------------------------------------------------------------------
-+private:
-+
-+ CodeNameToCntrlObjIdInfo maOleCtrlNameOverride;
-+
-+ /** Reads and returns a bitmap from WMF/PICT format. */
-+ static void ReadWmf( Graphic& rGraphic, XclImpStream& rStrm );
-+ /** Reads and returns a bitmap from BMP format. */
-+ static void ReadBmp( Graphic& rGraphic, XclImpStream& rStrm );
-+
-+ /** Reads contents of an DFF record and append data to internal DFF stream. */
-+ void ReadDffRecord( XclImpStream& rStrm );
-+ /** Reads a BIFF8 OBJ record following an MSODRAWING record. */
-+ void ReadObj8( XclImpStream& rStrm );
-+ /** Reads the TXO record and following CONTINUE records containing string and formatting. */
-+ void ReadTxo( XclImpStream& rStrm );
-+
-+ /** Reads a BIFF3-BIFF5 NOTE record. */
-+ void ReadNote3( XclImpStream& rStrm );
-+ /** Reads a BIFF8 NOTE record. */
-+ void ReadNote8( XclImpStream& rStrm );
-+
-+ /** Returns the size of the progress bar shown while processing all objects. */
-+ sal_Size GetProgressSize() const;
-
- // ------------------------------------------------------------------------
- private:
-+ typedef ::std::map< sal_Size, XclImpDrawObjRef > XclImpObjMap;
-+ typedef ::std::map< XclObjId, XclImpDrawObjRef > XclImpObjMapById;
-+ typedef ScfRef< XclImpObjTextData > XclImpObjTextRef;
-+ typedef ::std::map< sal_Size, XclImpObjTextRef > XclImpObjTextMap;
-+ typedef ::std::vector< XclObjId > XclObjIdVec;
-+
- typedef ::std::map< sal_uInt16, String > DefObjNameMap;
- typedef ScfRef< XclImpSheetDrawing > XclImpSheetDrawingRef;
- typedef ::std::map< SCTAB, XclImpSheetDrawingRef > XclImpSheetDrawingMap;
-diff --git sc/source/filter/inc/xistyle.hxx sc/source/filter/inc/xistyle.hxx
-index 1d3047e..ba3448f 100644
---- sc/source/filter/inc/xistyle.hxx
-+++ sc/source/filter/inc/xistyle.hxx
-@@ -69,8 +69,10 @@ public:
- void ReadPalette( XclImpStream& rStrm );
-
- private:
-+ void ExportPalette();
- typedef ::std::vector< ColorData > ColorDataVec;
- ColorDataVec maColorTable; /// Colors read from file.
-+ const XclImpRoot& mrRoot;
- };
-
- // FONT record - font information =============================================
-diff --git sc/source/filter/inc/xlescher.hxx sc/source/filter/inc/xlescher.hxx
-index ecc8ab9..22bb12e 100644
---- sc/source/filter/inc/xlescher.hxx
-+++ sc/source/filter/inc/xlescher.hxx
-@@ -441,7 +441,7 @@ public:
- /** Tries to extract an Excel macro name from the passed macro descriptor. */
- static String ExtractFromMacroDescriptor(
- const ::com::sun::star::script::ScriptEventDescriptor& rDescriptor,
-- XclTbxEventType eEventType );
-+ XclTbxEventType eEventType, SfxObjectShell* pShell = NULL );
- };
-
- // ============================================================================
-diff --git sc/source/filter/xcl97/xcl97esc.cxx sc/source/filter/xcl97/xcl97esc.cxx
-index b7e5de8..58ef6ad 100644
---- sc/source/filter/xcl97/xcl97esc.cxx
-+++ sc/source/filter/xcl97/xcl97esc.cxx
-@@ -54,6 +54,9 @@
- #include "global.hxx"
- #include "document.hxx"
- #include "drwlayer.hxx"
-+#include "xecontent.hxx"
-+#include <editeng/flditem.hxx>
-+#include "userdat.hxx"
- #include "xcl97rec.hxx"
- #include "xehelper.hxx"
- #include "xechart.hxx"
-@@ -256,7 +259,8 @@ EscherExHostAppData* XclEscherEx::StartShape( const Reference< XShape >& rxShape
- {
- // #107540# ignore permanent note shapes
- // #i12190# do not ignore callouts (do not filter by object type ID)
-- pCurrXclObj = new XclObjAny( mrObjMgr ); // just a metafile
-+ pCurrXclObj = ShapeInteractionHelper::CreateShapeObj( mrObjMgr, rxShape );
-+ ShapeInteractionHelper::PopulateShapeInteractionInfo( mrObjMgr, rxShape, *pCurrAppData );
- }
- }
- if ( pCurrXclObj )
-@@ -359,7 +363,6 @@ EscherExHostAppData* XclEscherEx::EnterAdditionalTextGroup()
- return pCurrAppData;
- }
-
--
- void XclEscherEx::EndDocument()
- {
- if( mbIsRootDff )
-@@ -478,6 +481,7 @@ void XclEscherEx::DeleteCurrAppData()
- delete pCurrAppData->GetClientAnchor();
- // delete pCurrAppData->GetClientData();
- delete pCurrAppData->GetClientTextbox();
-+ delete pCurrAppData->GetInteractionInfo();
- delete pCurrAppData;
- }
- }
-@@ -509,4 +513,40 @@ void XclEscherClientTextbox::WriteData( EscherEx& /*rEx*/ ) const
- pXclObj->SetText( GetRoot(), rTextObj );
- }
-
-+XclExpShapeObj*
-+ShapeInteractionHelper::CreateShapeObj( XclExpObjectManager& rObjMgr, const Reference< XShape >& xShape )
-+{
-+ return new XclExpShapeObj( rObjMgr, xShape );
-+}
-+
-+void
-+ShapeInteractionHelper::PopulateShapeInteractionInfo( XclExpObjectManager& rObjMgr, const Reference< XShape >& xShape, EscherExHostAppData& rHostAppData )
-+{
-+ try
-+ {
-+ SvMemoryStream* pMemStrm = NULL;
-+ rtl::OUString sHyperLink;
-+ rtl::OUString sMacro;
-+ if ( ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( ::GetSdrObjectFromXShape( xShape ) ) )
-+ {
-+ sHyperLink = pInfo->GetHlink();
-+ sMacro = pInfo->GetMacro();
-+ }
-+ if ( sHyperLink.getLength() > 0 )
-+ {
-+ pMemStrm = new SvMemoryStream();
-+ XclExpStream tmpStream( *pMemStrm, rObjMgr.GetRoot() );
-+ ScAddress dummyAddress;
-+ SvxURLField aUrlField;
-+ aUrlField.SetURL( sHyperLink );
-+ XclExpHyperlink hExpHlink( rObjMgr.GetRoot(), aUrlField, dummyAddress );
-+ hExpHlink.WriteEmbeddedData( tmpStream );
-+ }
-+ if ( ( sHyperLink.getLength() > 0 ) || ( sMacro.getLength() > 0 ) )
-+ rHostAppData.SetInteractionInfo( new InteractionInfo( pMemStrm, true ) );
-+ }
-+ catch( Exception& )
-+ {
-+ }
-+}
-
-diff --git sc/source/filter/xml/xmlexprt.cxx sc/source/filter/xml/xmlexprt.cxx
-index d46080d..e7e7bd3 100644
---- sc/source/filter/xml/xmlexprt.cxx
-+++ sc/source/filter/xml/xmlexprt.cxx
-@@ -3268,7 +3268,34 @@ void ScXMLExport::ExportShape(const uno::Reference < drawing::XShape >& xShape,
- }
- }
- if (!bIsChart)
-+ {
-+ // #i66550 HLINK_FOR_SHAPES
-+ rtl::OUString sHlink;
-+ uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY );
-+ if ( xProps.is() )
-+ xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_HYPERLINK ) ) ) >>= sHlink;
-+
-+ std::auto_ptr< SvXMLElementExport > pDrawA;
-+ // enlose shapes with <draw:a> element only if sHlink contains something
-+ if ( sHlink.getLength() > 0 )
-+ {
-+ // need to get delete the attributes that are pre-loaded
-+ // for the shape export ( otherwise they will become
-+ // attributes of the draw:a element ) This *shouldn't*
-+ // affect performance adversely as there are only a
-+ // couple of attributes involved
-+ uno::Reference< xml::sax::XAttributeList > xSaveAttribs( new SvXMLAttributeList( GetAttrList() ) );
-+ ClearAttrList();
-+ // Add Hlink
-+ AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
-+ AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, sHlink);
-+ pDrawA.reset( new SvXMLElementExport( *this, XML_NAMESPACE_DRAW, XML_A, sal_False, sal_False ) );
-+ // Attribute list has been cleared by previous operation
-+ // re-add pre-loaded attributes
-+ AddAttributeList( xSaveAttribs );
-+ }
- GetShapeExport()->exportShape(xShape, SEF_DEFAULT, pPoint);
-+ }
- IncrementProgressBar(sal_False);
- }
-
-diff --git sc/source/ui/attrdlg/scdlgfact.cxx sc/source/ui/attrdlg/scdlgfact.cxx
-index 3d261aa..901f317 100644
---- sc/source/ui/attrdlg/scdlgfact.cxx
-+++ sc/source/ui/attrdlg/scdlgfact.cxx
-@@ -80,6 +80,8 @@
- #include "tpusrlst.hxx" //add for ScTpUserLists
- #include "tpview.hxx" //add for ScTpContentOptions
- #include "tpformula.hxx"
-+//for dataform
-+#include "datafdlg.hxx" //add for ScDataFormDlg
-
- // ause
- #include "editutil.hxx"
-@@ -93,6 +95,8 @@ IMPL_ABSTDLG_BASE(AbstractScDataPilotDatabaseDlg_Impl); //add for ScDataPilotDat
- IMPL_ABSTDLG_BASE(AbstractScDataPilotSourceTypeDlg_Impl); //add for ScDataPilotSourceTypeDlg
- IMPL_ABSTDLG_BASE(AbstractScDataPilotServiceDlg_Impl); //add for ScDataPilotServiceDlg
- IMPL_ABSTDLG_BASE(AbstractScDeleteCellDlg_Impl); //add for ScDeleteCellDlg
-+//for dataform
-+IMPL_ABSTDLG_BASE(AbstractScDataFormDlg_Impl); //add for ScDataFormDlg
- IMPL_ABSTDLG_BASE(AbstractScDeleteContentsDlg_Impl); //add for ScDeleteContentsDlg
- IMPL_ABSTDLG_BASE(AbstractScFillSeriesDlg_Impl); //add for ScFillSeriesDlg
- IMPL_ABSTDLG_BASE(AbstractScGroupDlg_Impl); //add for ScGroupDlg
-@@ -864,6 +868,26 @@ AbstractScDeleteCellDlg* ScAbstractDialogFactory_Impl::CreateScDeleteCellDlg( Wi
-
- //add for ScDeleteCellDlg end
-
-+//add for ScDataFormDlg begin
-+AbstractScDataFormDlg* ScAbstractDialogFactory_Impl::CreateScDataFormDlg( Window* pParent, int nId, ScTabViewShell* pTabViewShell )
-+{
-+ ScDataFormDlg * pDlg=NULL;
-+ switch ( nId )
-+ {
-+ case RID_SCDLG_DATAFORM :
-+ pDlg = new ScDataFormDlg( pParent, pTabViewShell);
-+ break;
-+ default:
-+ break;
-+ }
-+
-+ if ( pDlg )
-+ return new AbstractScDataFormDlg_Impl( pDlg );
-+ return 0;
-+}
-+
-+//add for ScDataFormDlg end
-+
- //add for ScDeleteContentsDlg begin
- AbstractScDeleteContentsDlg* ScAbstractDialogFactory_Impl::CreateScDeleteContentsDlg(Window* pParent,int nId, //add for ScDeleteContentsDlg
- USHORT nCheckDefaults )
-diff --git sc/source/ui/attrdlg/scdlgfact.hxx sc/source/ui/attrdlg/scdlgfact.hxx
-index d8ae113..1174723 100644
---- sc/source/ui/attrdlg/scdlgfact.hxx
-+++ sc/source/ui/attrdlg/scdlgfact.hxx
-@@ -37,6 +37,7 @@ class ScDataPilotDatabaseDlg;
- class ScDataPilotSourceTypeDlg;
- class ScDataPilotServiceDlg;
- class ScDeleteCellDlg;
-+class ScDataFormDlg;
- class ScDeleteContentsDlg;
- class ScFillSeriesDlg;
- class ScGroupDlg;
-@@ -164,6 +165,12 @@ class AbstractScDeleteCellDlg_Impl : public AbstractScDeleteCellDlg //add for S
- virtual DelCellCmd GetDelCellCmd() const;
- };
-
-+//for dataform
-+class AbstractScDataFormDlg_Impl : public AbstractScDataFormDlg //add for ScDataFormDlg
-+{
-+ DECL_ABSTDLG_BASE(AbstractScDataFormDlg_Impl,ScDataFormDlg);
-+};
-+
- class AbstractScDeleteContentsDlg_Impl : public AbstractScDeleteContentsDlg //add for ScDeleteContentsDlg
- {
- DECL_ABSTDLG_BASE( AbstractScDeleteContentsDlg_Impl,ScDeleteContentsDlg)
-@@ -427,6 +434,9 @@ public:
- virtual AbstractScDeleteCellDlg * CreateScDeleteCellDlg( Window* pParent, int nId,
- BOOL bDisallowCellMove = FALSE ); //add for ScDeleteCellDlg
-
-+ //for dataform
-+ virtual AbstractScDataFormDlg * CreateScDataFormDlg( Window* pParent, int nId, ScTabViewShell* pTabViewShell); //add for ScDeleteCellDlg
-+
- virtual AbstractScDeleteContentsDlg * CreateScDeleteContentsDlg(Window* pParent,int nId, //add for ScDeleteContentsDlg
- USHORT nCheckDefaults = 0 );
-
-diff --git sc/source/ui/docshell/docfunc.cxx sc/source/ui/docshell/docfunc.cxx
-index bec1b90..634456f 100644
---- sc/source/ui/docshell/docfunc.cxx
-+++ sc/source/ui/docshell/docfunc.cxx
-@@ -110,6 +110,7 @@ using namespace com::sun::star;
- using ::com::sun::star::uno::Sequence;
- using ::std::vector;
-
-+
- // STATIC DATA -----------------------------------------------------------
-
- //========================================================================
-@@ -4226,6 +4227,13 @@ BOOL ScDocFunc::FillSeries( const ScRange& rRange, const ScMarkData* pTabMark,
- BOOL ScDocFunc::FillAuto( ScRange& rRange, const ScMarkData* pTabMark,
- FillDir eDir, ULONG nCount, BOOL bRecord, BOOL bApi )
- {
-+ double fStep = 1.0;
-+ double fMax = MAXDOUBLE;
-+ return FillAuto( rRange, pTabMark, eDir, FILL_AUTO, FILL_DAY, nCount, fStep, fMax, bRecord, bApi );
-+}
-+
-+BOOL ScDocFunc::FillAuto( ScRange& rRange, const ScMarkData* pTabMark, FillDir eDir, FillCmd eCmd, FillDateCmd eDateCmd, ULONG nCount, double fStep, double fMax, BOOL bRecord, BOOL bApi )
-+{
- ScDocShellModificator aModificator( rDocShell );
-
- ScDocument* pDoc = rDocShell.GetDocument();
-@@ -4251,10 +4259,6 @@ BOOL ScDocFunc::FillAuto( ScRange& rRange, const ScMarkData* pTabMark,
- ScRange aSourceArea = rRange;
- ScRange aDestArea = rRange;
-
-- FillCmd eCmd = FILL_AUTO;
-- FillDateCmd eDateCmd = FILL_DAY;
-- double fStep = 1.0;
-- double fMax = MAXDOUBLE;
-
- switch (eDir)
- {
-diff --git sc/source/ui/docshell/docsh5.cxx sc/source/ui/docshell/docsh5.cxx
-index aa3ca3e..82e797e 100644
---- sc/source/ui/docshell/docsh5.cxx
-+++ sc/source/ui/docshell/docsh5.cxx
-@@ -857,6 +857,47 @@ SCTAB ScDocShell::MakeScenario( SCTAB nTab, const String& rName, const String& r
- return nTab;
- }
-
-+ULONG ScDocShell::TransferTab( ScDocShell& rSrcDocShell, SCTAB nSrcPos,
-+ SCTAB nDestPos, BOOL bInsertNew,
-+ BOOL bNotifyAndPaint )
-+{
-+ ScDocument* pSrcDoc = rSrcDocShell.GetDocument();
-+
-+ ULONG nErrVal = aDocument.TransferTab( pSrcDoc, nSrcPos, nDestPos,
-+ bInsertNew ); // no insert
-+
-+ // TransferTab doesn't copy drawing objects with bInsertNew=FALSE
-+ if ( nErrVal > 0 && !bInsertNew)
-+ aDocument.TransferDrawPage( pSrcDoc, nSrcPos, nDestPos );
-+
-+ if(nErrVal>0 && pSrcDoc->IsScenario( nSrcPos ))
-+ {
-+ String aComment;
-+ Color aColor;
-+ USHORT nFlags;
-+
-+ pSrcDoc->GetScenarioData( nSrcPos, aComment,aColor, nFlags);
-+ aDocument.SetScenario(nDestPos,TRUE);
-+ aDocument.SetScenarioData(nDestPos,aComment,aColor,nFlags);
-+ BOOL bActive = pSrcDoc->IsActiveScenario(nSrcPos);
-+ aDocument.SetActiveScenario(nDestPos, bActive );
-+
-+ BOOL bVisible=pSrcDoc->IsVisible(nSrcPos);
-+ aDocument.SetVisible(nDestPos,bVisible );
-+
-+ }
-+
-+ if ( nErrVal > 0 && pSrcDoc->IsTabProtected( nSrcPos ) )
-+ aDocument.SetTabProtection(nDestPos, pSrcDoc->GetTabProtection(nSrcPos));
-+ if ( bNotifyAndPaint )
-+ {
-+ Broadcast( ScTablesHint( SC_TAB_INSERTED, nDestPos ) );
-+ PostPaintExtras();
-+ PostPaintGridAll();
-+ }
-+ return nErrVal;
-+}
-+
- BOOL ScDocShell::MoveTable( SCTAB nSrcTab, SCTAB nDestTab, BOOL bCopy, BOOL bRecord )
- {
- ScDocShellModificator aModificator( *this );
-diff --git sc/source/ui/docshell/macromgr.cxx sc/source/ui/docshell/macromgr.cxx
-new file mode 100644
-index 0000000..97623f3
---- /dev/null
-+++ sc/source/ui/docshell/macromgr.cxx
-@@ -0,0 +1,217 @@
-+/*************************************************************************
-+ *
-+ * 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: document.hxx,v $
-+ * $Revision: 1.115.36.9 $
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_sc.hxx"
-+
-+// INCLUDE ---------------------------------------------------------------
-+
-+#include "macromgr.hxx"
-+#include "document.hxx"
-+
-+#include "basic/basmgr.hxx"
-+#include "cppuhelper/implbase1.hxx"
-+#include "sfx2/objsh.hxx"
-+#include "cell.hxx"
-+#include <com/sun/star/container/XContainer.hpp>
-+
-+#include <list>
-+
-+using namespace ::com::sun::star;
-+using ::com::sun::star::uno::RuntimeException;
-+using ::com::sun::star::uno::Reference;
-+using ::rtl::OUString;
-+using ::rtl::OUStringHash;
-+using ::std::hash_map;
-+using ::std::list;
-+using ::std::for_each;
-+using ::std::pair;
-+
-+// ============================================================================
-+
-+/**
-+ * A simple container to keep track of cells that depend on basic modules
-+ * changes. We don't check for duplicates at insertion time; instead, we
-+ * remove duplicates at query time.
-+ */
-+class ScUserMacroDepTracker
-+{
-+public:
-+ void addCell(const OUString& rModuleName, ScFormulaCell* pCell)
-+ {
-+ ModuleCellMap::iterator itr = maCells.find(rModuleName);
-+ if (itr == maCells.end())
-+ {
-+ pair<ModuleCellMap::iterator, bool> r = maCells.insert(
-+ ModuleCellMap::value_type(rModuleName, list<ScFormulaCell*>()));
-+
-+ if (!r.second)
-+ // insertion failed.
-+ return;
-+
-+ itr = r.first;
-+ }
-+ itr->second.push_back(pCell);
-+ }
-+
-+ void removeCell(ScFormulaCell* pCell)
-+ {
-+ ModuleCellMap::iterator itr = maCells.begin(), itrEnd = maCells.end();
-+ for (; itr != itrEnd; ++itr)
-+ itr->second.remove(pCell);
-+ }
-+
-+ void getCellsByModule(const OUString& rModuleName, list<ScFormulaCell*>& rCells)
-+ {
-+ ModuleCellMap::iterator itr = maCells.find(rModuleName);
-+ if (itr == maCells.end())
-+ return;
-+
-+ list<ScFormulaCell*>& rCellList = itr->second;
-+
-+ // Remove duplicates.
-+ rCellList.sort();
-+ rCellList.unique();
-+ // exception safe copy
-+ list<ScFormulaCell*> temp(rCellList);
-+ rCells.swap(temp);
-+ }
-+
-+private:
-+ typedef hash_map<OUString, list<ScFormulaCell*>, OUStringHash> ModuleCellMap;
-+ ModuleCellMap maCells;
-+};
-+
-+
-+// ============================================================================
-+
-+ScMacroManager::ScMacroManager(ScDocument* pDoc) :
-+ mpDepTracker(new ScUserMacroDepTracker),
-+ mpDoc(pDoc)
-+{
-+}
-+
-+ScMacroManager::~ScMacroManager()
-+{
-+}
-+
-+typedef ::cppu::WeakImplHelper1< ::com::sun::star::container::XContainerListener > ContainerListenerHelper;
-+
-+class VBAProjectListener : public ContainerListenerHelper
-+{
-+ ScMacroManager* mpMacroMgr;
-+public:
-+ VBAProjectListener( ScMacroManager* pMacroMgr ) : mpMacroMgr( pMacroMgr ) {}
-+ // XEventListener
-+ virtual void SAL_CALL disposing( const lang::EventObject& /*Source*/ ) throw(RuntimeException) {}
-+
-+ // XContainerListener
-+ virtual void SAL_CALL elementInserted( const container::ContainerEvent& /*Event*/ ) throw(RuntimeException){}
-+ virtual void SAL_CALL elementReplaced( const container::ContainerEvent& Event ) throw(RuntimeException)
-+ {
-+ rtl::OUString sModuleName;
-+ Event.Accessor >>= sModuleName;
-+ OSL_TRACE("VBAProjectListener::elementReplaced(%s)", rtl::OUStringToOString( sModuleName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ mpMacroMgr->InitUserFuncData();
-+ mpMacroMgr->BroadcastModuleUpdate(sModuleName);
-+ }
-+ virtual void SAL_CALL elementRemoved( const container::ContainerEvent& /*Event*/ ) throw(RuntimeException){}
-+
-+};
-+
-+void ScMacroManager::InitUserFuncData()
-+{
-+ // Clear hash_map
-+ mhFuncToVolatile.clear();
-+ String sProjectName( RTL_CONSTASCII_USTRINGPARAM("Standard") );
-+
-+ Reference< container::XContainer > xModuleContainer;
-+ SfxObjectShell* pShell = mpDoc->GetDocumentShell();
-+ if ( pShell && pShell->GetBasicManager()->GetName().Len() > 0 )
-+ sProjectName = pShell->GetBasicManager()->GetName();
-+ try
-+ {
-+ Reference< script::XLibraryContainer > xLibraries( pShell->GetBasicContainer(), uno::UNO_QUERY_THROW );
-+ xModuleContainer.set( xLibraries->getByName( sProjectName ), uno::UNO_QUERY_THROW );
-+
-+ if ( xModuleContainer.is() )
-+ {
-+ // remove old listener ( if there was one )
-+ if ( mxContainerListener.is() )
-+ xModuleContainer->removeContainerListener( mxContainerListener );
-+ // Create listener
-+ mxContainerListener = new VBAProjectListener( this );
-+ xModuleContainer->addContainerListener( mxContainerListener );
-+ }
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+}
-+
-+void ScMacroManager::SetUserFuncVolatile( const OUString& sName, bool isVolatile )
-+{
-+ mhFuncToVolatile[ sName ] = isVolatile;
-+}
-+
-+bool ScMacroManager::GetUserFuncVolatile( const OUString& sName )
-+{
-+ NameBoolMap::iterator it = mhFuncToVolatile.find( sName );
-+ if ( it == mhFuncToVolatile.end() )
-+ return false;
-+ return it->second;
-+}
-+
-+void ScMacroManager::AddDependentCell(const OUString& aModuleName, ScFormulaCell* pCell)
-+{
-+ mpDepTracker->addCell(aModuleName, pCell);
-+}
-+
-+void ScMacroManager::RemoveDependentCell(ScFormulaCell* pCell)
-+{
-+ mpDepTracker->removeCell(pCell);
-+}
-+
-+void ScMacroManager::BroadcastModuleUpdate(const OUString& aModuleName)
-+{
-+ list<ScFormulaCell*> aCells;
-+ mpDepTracker->getCellsByModule(aModuleName, aCells);
-+ list<ScFormulaCell*>::iterator itr = aCells.begin(), itrEnd = aCells.end();
-+ for (; itr != itrEnd; ++itr)
-+ {
-+ ScFormulaCell* pCell = *itr;
-+ mpDoc->PutInFormulaTree(pCell); // for F9 recalc
-+
-+ // for recalc on cell value change. If the cell is not volatile, the
-+ // cell stops listening right away after it gets re-interpreted.
-+ mpDoc->StartListeningArea(BCA_LISTEN_ALWAYS, pCell);
-+ }
-+}
-+
-diff --git sc/source/ui/docshell/makefile.mk sc/source/ui/docshell/makefile.mk
-index 99a7495..6851f78 100644
---- sc/source/ui/docshell/makefile.mk
-+++ sc/source/ui/docshell/makefile.mk
-@@ -91,7 +91,8 @@ SLOFILES = \
- $(SLO)$/hiranges.obj \
- $(SLO)$/pntlock.obj \
- $(SLO)$/sizedev.obj \
-- $(SLO)$/editable.obj
-+ $(SLO)$/editable.obj \
-+ $(SLO)$/macromgr.obj
-
-
- EXCEPTIONSFILES= \
-@@ -101,7 +102,8 @@ EXCEPTIONSFILES= \
- $(SLO)$/docsh8.obj \
- $(SLO)$/externalrefmgr.obj \
- $(SLO)$/dbdocimp.obj \
-- $(SLO)$/docfunc.obj
-+ $(SLO)$/docfunc.obj \
-+ $(SLO)$/macromgr.obj
-
- SRS1NAME=$(TARGET)
- SRC1FILES = tpstat.src
-@@ -131,7 +133,8 @@ LIB1OBJFILES = \
- $(SLO)$/hiranges.obj \
- $(SLO)$/pntlock.obj \
- $(SLO)$/sizedev.obj \
-- $(SLO)$/editable.obj
-+ $(SLO)$/editable.obj \
-+ $(SLO)$/macromgr.obj
-
- # --- Tagets -------------------------------------------------------
-
-diff --git sc/source/ui/drawfunc/drawsh.cxx sc/source/ui/drawfunc/drawsh.cxx
-index d1ab807..04248ae 100644
---- sc/source/ui/drawfunc/drawsh.cxx
-+++ sc/source/ui/drawfunc/drawsh.cxx
-@@ -208,7 +208,6 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq )
- ExecuteTextAttrDlg( rReq );
- break;
-
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
- case SID_DRAW_HLINK_EDIT:
- if ( pSingleSelectedObj )
- pViewData->GetDispatcher().Execute( SID_HYPERLINK_DIALOG );
-@@ -236,7 +235,6 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq )
- ScGlobal::OpenURL( pInfo->GetHlink(), String::EmptyString() );
- }
- break;
--#endif
-
- case SID_ATTR_TRANSFORM:
- {
-@@ -489,7 +487,6 @@ void ScDrawShell::ExecuteTextAttrDlg( SfxRequest& rReq, USHORT /* nTabPage */ )
- delete( pDlg );
- }
-
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
- void ScDrawShell::SetHlinkForObject( SdrObject* pObj, const rtl::OUString& rHlnk )
- {
- if ( pObj )
-@@ -499,5 +496,4 @@ void ScDrawShell::SetHlinkForObject( SdrObject* pObj, const rtl::OUString& rHlnk
- lcl_setModified( GetObjectShell() );
- }
- }
--#endif
-
-diff --git sc/source/ui/drawfunc/drawsh2.cxx sc/source/ui/drawfunc/drawsh2.cxx
-index 7d1392b..05a7930 100644
---- sc/source/ui/drawfunc/drawsh2.cxx
-+++ sc/source/ui/drawfunc/drawsh2.cxx
-@@ -197,24 +197,20 @@ void ScDrawShell::GetDrawFuncState( SfxItemSet& rSet ) // Funktionen disablen
- BOOL bCanRename = FALSE;
- if ( nMarkCount > 1 )
- {
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
- // no hypelink options for a selected group
- rSet.DisableItem( SID_DRAW_HLINK_EDIT );
- rSet.DisableItem( SID_DRAW_HLINK_DELETE );
- rSet.DisableItem( SID_OPEN_HYPERLINK );
--#endif
- }
- else if ( nMarkCount == 1 )
- {
- SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
- ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( pObj );
- if ( !pInfo || (pInfo->GetHlink().getLength() == 0) )
- {
- rSet.DisableItem( SID_DRAW_HLINK_DELETE );
- rSet.DisableItem( SID_OPEN_HYPERLINK );
- }
--#endif
- SdrLayerID nLayerID = pObj->GetLayer();
- if ( nLayerID != SC_LAYER_INTERN )
- bCanRename = TRUE; // #i51351# anything except internal objects can be renamed
-diff --git sc/source/ui/drawfunc/drawsh5.cxx sc/source/ui/drawfunc/drawsh5.cxx
-index 2908af8..cb2e019 100644
---- sc/source/ui/drawfunc/drawsh5.cxx
-+++ sc/source/ui/drawfunc/drawsh5.cxx
-@@ -92,14 +92,12 @@ void ScDrawShell::GetHLinkState( SfxItemSet& rSet ) // Hyperlink
- if ( nMarkCount == 1 ) // URL-Button markiert ?
- {
- SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
- ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( pObj );
- if ( pInfo && (pInfo->GetHlink().getLength() > 0) )
- {
- aHLinkItem.SetURL( pInfo->GetHlink() );
- aHLinkItem.SetInsertMode(HLINK_FIELD);
- }
--#endif
- SdrUnoObj* pUnoCtrl = PTR_CAST(SdrUnoObj, pObj);
- if (pUnoCtrl && FmFormInventor == pUnoCtrl->GetObjInventor())
- {
-@@ -242,13 +240,11 @@ void ScDrawShell::ExecuteHLink( SfxRequest& rReq )
- bDone = TRUE;
- }
- }
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
- else
- {
- SetHlinkForObject( pObj, rURL );
- bDone = TRUE;
- }
--#endif
- }
- }
-
-diff --git sc/source/ui/drawfunc/fudraw.cxx sc/source/ui/drawfunc/fudraw.cxx
-index 4cbd08d..ee901e2 100644
---- sc/source/ui/drawfunc/fudraw.cxx
-+++ sc/source/ui/drawfunc/fudraw.cxx
-@@ -828,11 +828,7 @@ void FuDraw::ForcePointer(const MouseEvent* pMEvt)
- SdrObjMacroHitRec aHitRec; //! muss da noch irgendwas gesetzt werden ????
- pViewShell->SetActivePointer( pObj->GetMacroPointer(aHitRec) );
- }
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
- else if ( !bAlt && pInfo && ((pInfo->GetMacro().getLength() > 0) || (pInfo->GetHlink().getLength() > 0)) )
--#else
-- else if ( !bAlt && pInfo && (pInfo->GetMacro().getLength() > 0) )
--#endif
- pWindow->SetPointer( Pointer( POINTER_REFHAND ) );
- else if ( IsDetectiveHit( aPnt ) )
- pViewShell->SetActivePointer( Pointer( POINTER_DETECTIVE ) );
-diff --git sc/source/ui/drawfunc/fusel.cxx sc/source/ui/drawfunc/fusel.cxx
-index 2c284d3..538cf1f 100644
---- sc/source/ui/drawfunc/fusel.cxx
-+++ sc/source/ui/drawfunc/fusel.cxx
-@@ -202,7 +202,6 @@ BOOL __EXPORT FuSelection::MouseButtonDown(const MouseEvent& rMEvt)
- }
-
- ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( pObj, TRUE );
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
- // For interoperability favour links over macros if both are defined
- if ( pInfo->GetHlink().getLength() > 0 )
- {
-@@ -210,20 +209,27 @@ BOOL __EXPORT FuSelection::MouseButtonDown(const MouseEvent& rMEvt)
- sURL = pInfo->GetHlink();
- }
- else if ( pInfo->GetMacro().getLength() > 0 )
--#else
-- if ( pInfo->GetMacro().getLength() > 0 )
--#endif
- {
- SfxObjectShell* pObjSh = SfxObjectShell::Current();
- if ( pObjSh && SfxApplication::IsXScriptURL( pInfo->GetMacro() ) )
- {
-+ uno::Reference< beans::XPropertySet > xProps( pObj->getUnoShape(), uno::UNO_QUERY );
-+ uno::Any aCaller;
-+ if ( xProps.is() )
-+ {
-+ try
-+ {
-+ aCaller = xProps->getPropertyValue( rtl::OUString::createFromAscii("Name") );
-+ }
-+ catch( uno::Exception& ) {}
-+ }
- uno::Any aRet;
- uno::Sequence< sal_Int16 > aOutArgsIndex;
- uno::Sequence< uno::Any > aOutArgs;
- uno::Sequence< uno::Any >* pInArgs =
- new uno::Sequence< uno::Any >(0);
- pObjSh->CallXScript( pInfo->GetMacro(),
-- *pInArgs, aRet, aOutArgsIndex, aOutArgs);
-+ *pInArgs, aRet, aOutArgsIndex, aOutArgs, true, &aCaller );
- pViewShell->FakeButtonUp( pViewShell->GetViewData()->GetActivePart() );
- return TRUE; // kein CaptureMouse etc.
- }
-diff --git sc/source/ui/drawfunc/makefile.mk sc/source/ui/drawfunc/makefile.mk
-index a50c450..f82008e 100644
---- sc/source/ui/drawfunc/makefile.mk
-+++ sc/source/ui/drawfunc/makefile.mk
-@@ -75,6 +75,7 @@ SLOFILES = \
- $(SLO)$/mediash.obj
-
- EXCEPTIONSFILES= \
-+ $(SLO)$/fusel.obj \
- $(SLO)$/fuins2.obj \
- $(SLO)$/graphsh.obj \
- $(SLO)$/mediash.obj
-diff --git sc/source/ui/drawfunc/objdraw.src sc/source/ui/drawfunc/objdraw.src
-index 81d1e2c..9fb1b96 100644
---- sc/source/ui/drawfunc/objdraw.src
-+++ sc/source/ui/drawfunc/objdraw.src
-@@ -186,7 +186,6 @@
- ITEM_FORMAT_PARA_DLG\
- };
-
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
- #define MN_EDITLNK \
- MenuItem\
- {\
-@@ -202,7 +201,6 @@
- HelpID = SID_DRAW_HLINK_DELETE ; \
- Text [ en-US ] = "~Remove Hyperlink" ; \
- };
--#endif
-
- #define MN_DRWTXTATTR \
- MenuItem\
-@@ -1297,14 +1295,12 @@ Menu RID_POPUP_DRAW
- MenuItem { Separator = TRUE ; };
- //------------------------------
- ITEM_GROUP_MENU
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
- //------------------------------
- MenuItem { Separator = TRUE ; };
- //------------------------------
- MN_EDITLNK
- MN_DELLNK
- MenuItem { ITEM_OPEN_HYPERLINK };
--#endif
- };
- };
-
-@@ -1374,14 +1370,12 @@ Menu RID_POPUP_GRAPHIC
- MenuItem { Separator = TRUE ; };
- //------------------------------
- ITEM_GROUP_MENU
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
- //------------------------------
- MenuItem { Separator = TRUE ; };
- //------------------------------
- MN_EDITLNK
- MN_DELLNK
- MenuItem { ITEM_OPEN_HYPERLINK };
--#endif
- };
- };
-
-diff --git sc/source/ui/inc/asciiopt.hxx sc/source/ui/inc/asciiopt.hxx
-index 0c6df4b..783650c 100644
---- sc/source/ui/inc/asciiopt.hxx
-+++ sc/source/ui/inc/asciiopt.hxx
-@@ -56,7 +56,7 @@
-
- // ============================================================================
-
--class ScAsciiOptions
-+class SC_DLLPUBLIC ScAsciiOptions
- {
- private:
- BOOL bFixedLen;
-diff --git sc/source/ui/inc/datafdlg.hrc sc/source/ui/inc/datafdlg.hrc
-new file mode 100644
-index 0000000..8fa8999
---- /dev/null
-+++ sc/source/ui/inc/datafdlg.hrc
-@@ -0,0 +1,49 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: datafdlg.hrc,v $
-+ *
-+ * $Revision: 1.00 $
-+ *
-+ * last change: $Author: rt $ $Date: 2005/09/08 21:37:12 $
-+ *
-+ * 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 "sc.hrc" // -> RID_SCDLG_DATAFORM
-+
-+//dataform
-+#define BTN_DATAFORM_NEW 1001
-+#define BTN_DATAFORM_DELETE 1002
-+#define BTN_DATAFORM_RESTORE 1003
-+#define BTN_DATAFORM_LAST 1004
-+#define BTN_DATAFORM_NEXT 1005
-+#define BTN_DATAFORM_CLOSE 1007
-+#define WND_DATAFORM_SCROLLBAR 1008
-+#define LAB_DATAFORM_RECORDNO 1009
-+
-+#define FT_DATAFORM_FIXEDTEXT1 2001
-+#define ED_DATAFORM_EDIT1 2002
-\ No newline at end of file
-diff --git sc/source/ui/inc/datafdlg.hxx sc/source/ui/inc/datafdlg.hxx
-new file mode 100644
-index 0000000..3e6d8e3
---- /dev/null
-+++ sc/source/ui/inc/datafdlg.hxx
-@@ -0,0 +1,121 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: datafdlg.hxx,v $
-+ *
-+ * $Revision: 1.00 $
-+ *
-+ * last change: $Author: rt $ $Date: 2005/09/08 21:20:35 $
-+ *
-+ * 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_DATAFDLG_HXX
-+#define SC_DATAFDLG_HXX
-+
-+
-+#ifndef _SV_DIALOG_HXX //autogen
-+#include <vcl/dialog.hxx>
-+#endif
-+
-+#ifndef _SV_BUTTON_HXX //autogen
-+#include <vcl/imagebtn.hxx>
-+#endif
-+
-+#ifndef _SV_FIXED_HXX //autogen
-+#include <vcl/fixed.hxx>
-+#endif
-+
-+
-+#include "global.hxx"
-+
-+#include <tabvwsh.hxx>
-+#include <sfx2/bindings.hxx>
-+#include <sfx2/dispatch.hxx>
-+
-+#define MAX_DATAFORM_COLS 256
-+#define MAX_DATAFORM_ROWS 32000
-+#define CTRL_HEIGHT 22
-+#define FIXED_WIDTH 60
-+#define EDIT_WIDTH 140
-+#define FIXED_LEFT 12
-+#define EDIT_LEFT 78
-+#define LINE_HEIGHT 30
-+
-+//zhangyun
-+class ScDataFormDlg : public ModalDialog
-+{
-+private:
-+
-+ PushButton aBtnNew;
-+ PushButton aBtnDelete;
-+ PushButton aBtnRestore;
-+ PushButton aBtnLast;
-+ PushButton aBtnNext;
-+ PushButton aBtnClose;
-+ ScrollBar aSlider;
-+ FixedText aFixedText;
-+ //FixedText aFixedText1;
-+ //Edit aEdit1;
-+
-+ ScTabViewShell* pTabViewShell;
-+ ScDocument* pDoc;
-+ sal_uInt16 aColLength;
-+ SCROW aCurrentRow;
-+ SCCOL nStartCol;
-+ SCCOL nEndCol;
-+ SCROW nStartRow;
-+ SCROW nEndRow;
-+ SCTAB nTab;
-+ BOOL bNoSelection;
-+
-+ FixedText** pFixedTexts;
-+ Edit** pEdits;
-+
-+public:
-+ ScDataFormDlg( Window* pParent, ScTabViewShell* pTabViewShell);
-+ ~ScDataFormDlg();
-+
-+ void FillCtrls(SCROW nCurrentRow);
-+private:
-+
-+ void SetButtonState();
-+
-+ // Handler:
-+ DECL_LINK( Impl_NewHdl, PushButton* );
-+ DECL_LINK( Impl_LastHdl, PushButton* );
-+ DECL_LINK( Impl_NextHdl, PushButton* );
-+
-+ DECL_LINK( Impl_RestoreHdl, PushButton* );
-+ DECL_LINK( Impl_DeleteHdl, PushButton* );
-+ DECL_LINK( Impl_CloseHdl, PushButton* );
-+
-+ DECL_LINK( Impl_ScrollHdl, ScrollBar* );
-+ DECL_LINK( Impl_DataModifyHdl, Edit* );
-+};
-+#endif // SC_DATAFDLG_HXX
-+
-+
-diff --git sc/source/ui/inc/docfunc.hxx sc/source/ui/inc/docfunc.hxx
-index a39bda5..9a6ee54 100644
---- sc/source/ui/inc/docfunc.hxx
-+++ sc/source/ui/inc/docfunc.hxx
-@@ -167,7 +167,9 @@ public:
- double fStart, double fStep, double fMax,
- BOOL bRecord, BOOL bApi );
- // FillAuto: rRange wird von Source-Range auf Dest-Range angepasst
-- BOOL FillAuto( ScRange& rRange, const ScMarkData* pTabMark,
-+ SC_DLLPUBLIC BOOL FillAuto( ScRange& rRange, const ScMarkData* pTabMark, FillDir eDir, FillCmd eCmd, FillDateCmd eDateCmd, ULONG nCount, double fStep, double fMax, BOOL bRecord, BOOL bApi );
-+
-+ BOOL FillAuto( ScRange& rRange, const ScMarkData* pTabMark,
- FillDir eDir, ULONG nCount, BOOL bRecord, BOOL bApi );
-
- BOOL ResizeMatrix( const ScRange& rOldRange, const ScAddress& rNewEnd, BOOL bApi );
-diff --git sc/source/ui/inc/docsh.hxx sc/source/ui/inc/docsh.hxx
-index b1b1b0b..53abd68 100644
---- sc/source/ui/inc/docsh.hxx
-+++ sc/source/ui/inc/docsh.hxx
-@@ -42,6 +42,7 @@
- #include "refreshtimer.hxx"
-
- #include <hash_map>
-+#include <cppuhelper/implbase1.hxx>
-
- class ScEditEngineDefaulter;
- class FontList;
-@@ -298,6 +299,10 @@ public:
- ScMarkData& rMark, BOOL bRecord = TRUE );
- void ModifyScenario( SCTAB nTab, const String& rName, const String& rComment,
- const Color& rColor, USHORT nFlags );
-+ ULONG TransferTab( ScDocShell& rSrcDocShell, SCTAB nSrcPos,
-+ SCTAB nDestPos, BOOL bInsertNew,
-+ BOOL bNotifyAndPaint );
-+
- BOOL MoveTable( SCTAB nSrcTab, SCTAB nDestTab, BOOL bCopy, BOOL bRecord );
-
- void DoRecalc( BOOL bApi );
-diff --git sc/source/ui/inc/drawsh.hxx sc/source/ui/inc/drawsh.hxx
-index 47ea4ce..5e6e568 100644
---- sc/source/ui/inc/drawsh.hxx
-+++ sc/source/ui/inc/drawsh.hxx
-@@ -44,9 +44,7 @@ class ScDrawShell : public SfxShell
-
- DECL_LINK( NameObjectHdl, AbstractSvxNameDialog* );
-
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
- void SetHlinkForObject( SdrObject* pObj, const rtl::OUString& rHlnk );
--#endif
-
- protected:
- ScViewData* GetViewData() { return pViewData; }
-diff --git sc/source/ui/inc/impex.hxx sc/source/ui/inc/impex.hxx
-index e28b34e..491d933 100644
---- sc/source/ui/inc/impex.hxx
-+++ sc/source/ui/inc/impex.hxx
-@@ -50,7 +50,7 @@ struct ScExportTextOptions
- bool mbAddQuotes;
- };
-
--class ScImportExport
-+class SC_DLLPUBLIC ScImportExport
- {
- ScDocShell* pDocSh;
- ScDocument* pDoc;
-diff --git sc/source/ui/inc/tabvwsh.hxx sc/source/ui/inc/tabvwsh.hxx
-index 91add9d..aba6f9d 100644
---- sc/source/ui/inc/tabvwsh.hxx
-+++ sc/source/ui/inc/tabvwsh.hxx
-@@ -252,7 +252,7 @@ public:
-
- virtual ~ScTabViewShell();
-
-- Window* GetDialogParent();
-+ SC_DLLPUBLIC Window* GetDialogParent();
-
- bool IsRefInputMode() const;
- void ExecuteInputDirect();
-@@ -298,7 +298,7 @@ public:
- void GetSaveState( SfxItemSet& rSet );
- void ExecSearch( SfxRequest& rReq );
-
-- void ExecuteUndo(SfxRequest& rReq);
-+ SC_DLLPUBLIC void ExecuteUndo(SfxRequest& rReq);
- void GetUndoState(SfxItemSet &rSet);
-
- void ExecuteSbx( SfxRequest& rReq );
-diff --git sc/source/ui/inc/undodat.hxx sc/source/ui/inc/undodat.hxx
-index 81da22e..cba77ef 100644
---- sc/source/ui/inc/undodat.hxx
-+++ sc/source/ui/inc/undodat.hxx
-@@ -528,7 +528,43 @@ private:
- void Init();
- };
-
-+// amelia
-+class ScUndoDataForm: public ScBlockUndo
-+{
-+public:
-+ TYPEINFO();
-+ ScUndoDataForm( ScDocShell* pNewDocShell,
-+ SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
-+ SCCOL nEndX, SCROW nEndY, SCTAB nEndZ,
-+ const ScMarkData& rMark,
-+ ScDocument* pNewUndoDoc, ScDocument* pNewRedoDoc,
-+ USHORT nNewFlags,
-+ ScRefUndoData* pRefData, void* pFill1, void* pFill2, void* pFill3,
-+ BOOL bRedoIsFilled = TRUE
-+ );
-+ virtual ~ScUndoDataForm();
-+
-+ virtual void Undo();
-+ virtual void Redo();
-+ virtual void Repeat(SfxRepeatTarget& rTarget);
-+ virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
-+
-+ virtual String GetComment() const;
-
-+private:
-+ ScMarkData aMarkData;
-+ ScDocument* pUndoDoc;
-+ ScDocument* pRedoDoc;
-+ USHORT nFlags;
-+ ScRefUndoData* pRefUndoData;
-+ ScRefUndoData* pRefRedoData;
-+ ULONG nStartChangeAction;
-+ ULONG nEndChangeAction;
-+ BOOL bRedoFilled;
-+
-+ void DoChange( const BOOL bUndo );
-+ void SetChangeTrack();
-+};
-
-
- #endif
-diff --git sc/source/ui/inc/viewfunc.hxx sc/source/ui/inc/viewfunc.hxx
-index 8a5aeee..6e9ec02 100644
---- sc/source/ui/inc/viewfunc.hxx
-+++ sc/source/ui/inc/viewfunc.hxx
-@@ -338,6 +338,13 @@ public:
- void ForgetFormatArea() { bFormatValid = FALSE; }
- BOOL SelectionEditable( BOOL* pOnlyNotBecauseOfMatrix = NULL );
-
-+ // Amelia Wang
-+ SC_DLLPUBLIC void DataFormPutData( SCROW nCurrentRow ,
-+ SCROW nStartRow , SCCOL nStartCol ,
-+ SCROW nEndRow , SCCOL nEndCol ,
-+ Edit** pEdits ,
-+ sal_uInt16 aColLength );
-+
- // interne Hilfsfunktionen
- protected:
- void UpdateLineAttrs( SvxBorderLine& rLine,
-diff --git sc/source/ui/miscdlgs/datafdlg.cxx sc/source/ui/miscdlgs/datafdlg.cxx
-new file mode 100644
-index 0000000..619355c
---- /dev/null
-+++ sc/source/ui/miscdlgs/datafdlg.cxx
-@@ -0,0 +1,422 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: datafdlg.cxx,v $
-+ *
-+ * $Revision: 1.00 $
-+ *
-+ * last change: $Author: kz $ $Date: 2006/07/21 14:04:33 $
-+ *
-+ * 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
-+ *
-+ ************************************************************************/
-+
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_sc.hxx"
-+
-+#undef SC_DLLIMPLEMENTATION
-+
-+//------------------------------------------------------------------
-+
-+#include "datafdlg.hxx"
-+#include "scresid.hxx"
-+#include "datafdlg.hrc"
-+#include "viewdata.hxx"
-+//#include "document.hxx"
-+#include "docsh.hxx"
-+#include "refundo.hxx"
-+#include "undodat.hxx"
-+
-+#define HDL(hdl) LINK( this, ScDataFormDlg, hdl )
-+
-+//zhangyun
-+ScDataFormDlg::ScDataFormDlg( Window* pParent, ScTabViewShell* pTabViewShellOri) :
-+ ModalDialog ( pParent, ScResId( RID_SCDLG_DATAFORM ) ),
-+ //
-+ aBtnNew ( this, ScResId( BTN_DATAFORM_NEW ) ),
-+ aBtnDelete ( this, ScResId( BTN_DATAFORM_DELETE ) ),
-+ aBtnRestore ( this, ScResId( BTN_DATAFORM_RESTORE ) ),
-+ aBtnLast ( this, ScResId( BTN_DATAFORM_LAST ) ),
-+ aBtnNext ( this, ScResId( BTN_DATAFORM_NEXT ) ),
-+ aBtnClose ( this, ScResId( BTN_DATAFORM_CLOSE ) ),
-+ aSlider ( this, ScResId( WND_DATAFORM_SCROLLBAR ) ),
-+ aFixedText ( this, ScResId( LAB_DATAFORM_RECORDNO ) )
-+{
-+ pTabViewShell = pTabViewShellOri;
-+ FreeResource();
-+ //read header form current document, and add new controls
-+ DBG_ASSERT( pTabViewShell, "pTabViewShell is NULL! :-/" );
-+ ScViewData* pViewData = pTabViewShell->GetViewData();
-+
-+ pDoc = pViewData->GetDocument();
-+ if (pDoc)
-+ {
-+ ScRange aRange;
-+ pViewData->GetSimpleArea( aRange );
-+ ScAddress aStart = aRange.aStart;
-+ ScAddress aEnd = aRange.aEnd;
-+
-+ nStartCol = aStart.Col();
-+ nEndCol = aEnd.Col();
-+ nStartRow = aStart.Row();
-+ nEndRow = aEnd.Row();
-+
-+ nTab = pViewData->GetTabNo();
-+ //if there is no selection
-+ if ((nStartCol == nEndCol) && (nStartRow == nEndRow))
-+ bNoSelection = TRUE;
-+
-+ if (bNoSelection)
-+ {
-+ //find last not blank cell in row
-+ for (int i=1;i<=MAX_DATAFORM_COLS;i++)
-+ {
-+ String aColName;
-+ nEndCol++;
-+ pDoc->GetString( nEndCol, nStartRow, nTab, aColName );
-+ int nColWidth = pDoc->GetColWidth( nEndCol, nTab );
-+ if ( aColName.Len() == 0 && nColWidth)
-+ {
-+ nEndCol--;
-+ break;
-+ }
-+ }
-+
-+ //find first not blank cell in row
-+ for (int i=1;i<=MAX_DATAFORM_COLS;i++)
-+ {
-+ String aColName;
-+ if (nStartCol <= 0)
-+ break;
-+ nStartCol--;
-+
-+ pDoc->GetString( nStartCol, nStartRow, nTab, aColName );
-+ int nColWidth = pDoc->GetColWidth( nEndCol, nTab );
-+ if ( aColName.Len() == 0 && nColWidth)
-+ {
-+ nStartCol++;
-+ break;
-+ }
-+ }
-+
-+ //skip leading hide column
-+ for (int i=1;i<=MAX_DATAFORM_COLS;i++)
-+ {
-+ String aColName;
-+ int nColWidth = pDoc->GetColWidth( nStartCol, nTab );
-+ if (nColWidth)
-+ break;
-+ nStartCol++;
-+ }
-+
-+ if (nEndCol < nStartCol)
-+ nEndCol = nStartCol;
-+
-+ //find last not blank cell in row
-+ for (int i=1;i<=MAX_DATAFORM_ROWS;i++)
-+ {
-+ String aColName;
-+ nEndRow++;
-+ pDoc->GetString( nStartCol, nEndRow, nTab, aColName );
-+ if ( aColName.Len() == 0 )
-+ {
-+ nEndRow--;
-+ break;
-+ }
-+ }
-+
-+ //find first not blank cell in row
-+ for (int i=1;i<=MAX_DATAFORM_ROWS;i++)
-+ {
-+ String aColName;
-+ if (nStartRow <= 0)
-+ break;
-+ nStartRow--;
-+
-+ pDoc->GetString( nStartCol, nStartRow, nTab, aColName );
-+ if ( aColName.Len() == 0 )
-+ {
-+ nStartRow++;
-+ break;
-+ }
-+ }
-+
-+ if (nEndRow < nStartRow)
-+ nEndRow = nStartRow;
-+ }
-+
-+ aCurrentRow = nStartRow + 1;
-+
-+ String aFieldName;
-+
-+ int nTop = 12;
-+
-+ Size nFixedSize(FIXED_WIDTH, CTRL_HEIGHT );
-+ Size nEditSize(EDIT_WIDTH, CTRL_HEIGHT );
-+
-+ //pFtArray = new FixedText(this);
-+ aColLength = nEndCol - nStartCol + 1;
-+
-+ //new the controls
-+ pFixedTexts = new FixedText*[aColLength];
-+ pEdits = new Edit*[aColLength];
-+
-+ for(sal_uInt16 nIndex = 0; nIndex < aColLength; nIndex++)
-+ {
-+ pDoc->GetString( nIndex + nStartCol, nStartRow, nTab, aFieldName );
-+ int nColWidth = pDoc->GetColWidth( nIndex + nStartCol, nTab );
-+ if (nColWidth)
-+ {
-+ pFixedTexts[nIndex] = new FixedText(this);
-+ pEdits[nIndex] = new Edit(this, WB_BORDER);
-+
-+ pFixedTexts[nIndex]->SetSizePixel(nFixedSize);
-+ pEdits[nIndex]->SetSizePixel(nEditSize);
-+ pFixedTexts[nIndex]->SetPosPixel(Point(FIXED_LEFT, nTop));
-+ pEdits[nIndex]->SetPosPixel(Point(EDIT_LEFT, nTop));
-+ //pFixedTexts[nIndex]->SetText(String::CreateFromAscii("W4W-Filter Nr. "));
-+ pFixedTexts[nIndex]->SetText(aFieldName);
-+ pFixedTexts[nIndex]->Show();
-+ pEdits[nIndex]->Show();
-+
-+ nTop += LINE_HEIGHT;
-+ }
-+ else
-+ {
-+ pFixedTexts[nIndex] = NULL;
-+ pEdits[nIndex] = NULL;
-+ }
-+ pEdits[nIndex]->SetModifyHdl( HDL(Impl_DataModifyHdl) );
-+ }
-+
-+ Size nDialogSize = this->GetSizePixel();
-+ if (nTop > nDialogSize.Height())
-+ {
-+ nDialogSize.setHeight(nTop);
-+ this->SetSizePixel(nDialogSize);
-+ }
-+ Size nScrollSize = aSlider.GetSizePixel();
-+ nScrollSize.setHeight(nDialogSize.Height()-20);
-+ aSlider.SetSizePixel(nScrollSize);
-+ }
-+
-+ FillCtrls(aCurrentRow);
-+
-+ aSlider.SetPageSize( 10 );
-+ aSlider.SetVisibleSize( 1 );
-+ aSlider.SetLineSize( 1 );
-+ aSlider.SetRange( Range( 0, nEndRow - nStartRow + 1) );
-+ aSlider.Show();
-+
-+ aBtnNew.SetClickHdl ( HDL(Impl_NewHdl) );
-+ aBtnLast.SetClickHdl ( HDL(Impl_LastHdl) );
-+ aBtnNext.SetClickHdl ( HDL(Impl_NextHdl) );
-+
-+ aBtnRestore.SetClickHdl ( HDL(Impl_RestoreHdl) );
-+ aBtnDelete.SetClickHdl ( HDL(Impl_DeleteHdl) );
-+ aBtnClose.SetClickHdl ( HDL(Impl_CloseHdl) );
-+
-+ aSlider.SetEndScrollHdl( HDL( Impl_ScrollHdl ) );
-+
-+ SetButtonState();
-+
-+ //end
-+ //FreeResource();
-+}
-+
-+ScDataFormDlg::~ScDataFormDlg()
-+{
-+ for(sal_uInt16 i = 0; i < aColLength; i++)
-+ {
-+ if (pEdits[i])
-+ delete pEdits[i];
-+ if (pFixedTexts[i])
-+ delete pFixedTexts[i];
-+ }
-+ if (pEdits)
-+ delete pEdits;
-+ if (pFixedTexts)
-+ delete pFixedTexts;
-+}
-+
-+void ScDataFormDlg::FillCtrls(SCROW /*nCurrentRow*/)
-+{
-+ //ScViewData* pViewData = pTabViewShell->GetViewData();
-+
-+ //pDoc = pViewData->GetDocument();
-+ String aFieldName;
-+ int nRecordNum = nEndRow - nStartRow;
-+ for(sal_uInt16 i = 0; i < aColLength; i++)
-+ {
-+ if (pEdits[i])
-+ {
-+ if (aCurrentRow<=nEndRow)
-+ {
-+ pDoc->GetString( i + nStartCol, aCurrentRow, nTab, aFieldName );
-+ pEdits[i]->SetText(aFieldName);
-+ }
-+ else
-+ pEdits[i]->SetText(String());
-+ }
-+ }
-+ char sRecordStr[256];
-+ if (aCurrentRow<=nEndRow)
-+ aFixedText.SetText(String::CreateFromAscii(sRecordStr));
-+ else
-+ aFixedText.SetText(String::CreateFromAscii("New Record"));
-+
-+ aSlider.SetThumbPos(aCurrentRow-nStartRow-1);
-+}
-+
-+IMPL_LINK( ScDataFormDlg, Impl_DataModifyHdl, Edit*, pEdit)
-+{
-+ if ( pEdit->IsModified() )
-+ aBtnRestore.Enable( TRUE );
-+ return 0;
-+}
-+
-+IMPL_LINK( ScDataFormDlg, Impl_NewHdl, PushButton*, EMPTYARG )
-+{
-+ ScViewData* pViewData = pTabViewShell->GetViewData();
-+ ScDocShell* pDocSh = pViewData->GetDocShell();
-+ if ( pDoc )
-+ {
-+ sal_Bool bHasData = sal_False;
-+ for(sal_uInt16 i = 0; i < aColLength; i++)
-+ if (pEdits[i])
-+ if ( pEdits[i]->GetText().Len() != 0 )
-+ {
-+ bHasData = sal_True;
-+ break;
-+ }
-+
-+ if ( bHasData )
-+ {
-+ pTabViewShell->DataFormPutData( aCurrentRow , nStartRow , nStartCol , nEndRow , nEndCol , pEdits , aColLength );
-+ aCurrentRow++;
-+ if (aCurrentRow >= nEndRow + 2)
-+ {
-+ nEndRow ++ ;
-+ aSlider.SetRange( Range( 0, nEndRow - nStartRow + 1) );
-+ }
-+ SetButtonState();
-+ FillCtrls(aCurrentRow);
-+ pDocSh->SetDocumentModified();
-+ pDocSh->PostPaintGridAll();
-+ }
-+ }
-+ return 0;
-+}
-+
-+IMPL_LINK( ScDataFormDlg, Impl_LastHdl, PushButton*, EMPTYARG )
-+{
-+ if (pDoc)
-+ {
-+ if ( aCurrentRow > nStartRow +1 )
-+ aCurrentRow--;
-+
-+ SetButtonState();
-+ FillCtrls(aCurrentRow);
-+ }
-+ return 0;
-+}
-+
-+IMPL_LINK( ScDataFormDlg, Impl_NextHdl, PushButton*, EMPTYARG )
-+{
-+ if (pDoc)
-+ {
-+ if ( aCurrentRow <= nEndRow)
-+ aCurrentRow++;
-+
-+ SetButtonState();
-+ FillCtrls(aCurrentRow);
-+ }
-+ return 0;
-+}
-+
-+IMPL_LINK( ScDataFormDlg, Impl_RestoreHdl, PushButton*, EMPTYARG )
-+{
-+ if (pDoc)
-+ {
-+ FillCtrls(aCurrentRow);
-+ }
-+ return 0;
-+}
-+
-+IMPL_LINK( ScDataFormDlg, Impl_DeleteHdl, PushButton*, EMPTYARG )
-+{
-+ ScViewData* pViewData = pTabViewShell->GetViewData();
-+ ScDocShell* pDocSh = pViewData->GetDocShell();
-+ if (pDoc)
-+ {
-+ ScRange aRange(nStartCol, aCurrentRow, nTab, nEndCol, aCurrentRow, nTab);
-+ pDoc->DeleteRow(aRange);
-+ nEndRow--;
-+
-+ SetButtonState();
-+ pDocSh->GetUndoManager()->Clear();
-+
-+ FillCtrls(aCurrentRow);
-+ pDocSh->SetDocumentModified();
-+ pDocSh->PostPaintGridAll();
-+ }
-+ return 0;
-+}
-+
-+IMPL_LINK( ScDataFormDlg, Impl_CloseHdl, PushButton*, EMPTYARG )
-+{
-+ EndDialog( );
-+ return 0;
-+}
-+
-+IMPL_LINK( ScDataFormDlg, Impl_ScrollHdl, ScrollBar*, EMPTYARG )
-+{
-+ long nOffset = aSlider.GetThumbPos();
-+ aCurrentRow = nStartRow + nOffset + 1;
-+ SetButtonState();
-+ FillCtrls(aCurrentRow);
-+ return 0;
-+}
-+
-+void ScDataFormDlg::SetButtonState()
-+{
-+ if ( aCurrentRow > nEndRow )
-+ {
-+ aBtnDelete.Enable( FALSE );
-+ aBtnLast.Enable( TRUE );
-+ aBtnNext.Enable( FALSE );
-+ }
-+ else
-+ {
-+ aBtnDelete.Enable( TRUE );
-+ aBtnNext.Enable( TRUE );
-+ }
-+ if ( 1 == aCurrentRow )
-+ aBtnLast.Enable( FALSE );
-+
-+ aBtnRestore.Enable( FALSE );
-+ if ( pEdits )
-+ pEdits[0]->GrabFocus();
-+}
-diff --git sc/source/ui/miscdlgs/makefile.mk sc/source/ui/miscdlgs/makefile.mk
-index 8c56101..07e70a1 100644
---- sc/source/ui/miscdlgs/makefile.mk
-+++ sc/source/ui/miscdlgs/makefile.mk
-@@ -41,6 +41,7 @@ LIBTARGET=no
- # --- Files --------------------------------------------------------
-
- SLOFILES = \
-+ $(SLO)$/datafdlg.obj \
- $(SLO)$/delcldlg.obj \
- $(SLO)$/inscldlg.obj \
- $(SLO)$/delcodlg.obj \
-diff --git sc/source/ui/src/datafdlg.src sc/source/ui/src/datafdlg.src
-new file mode 100644
-index 0000000..535ec66
---- /dev/null
-+++ sc/source/ui/src/datafdlg.src
-@@ -0,0 +1,108 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: datafdlg.src,v $
-+ *
-+ * $Revision: 1.00 $
-+ *
-+ * last change: $Author: hr $ $Date: 2005/09/23 15:07:30 $
-+ *
-+ * 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 "datafdlg.hrc"
-+
-+//zhangyun, dataform
-+ModalDialog RID_SCDLG_DATAFORM
-+{
-+ OutputSize = TRUE ;
-+ SVLook = TRUE ;
-+ Size = MAP_APPFONT ( 191 , 180 ) ;
-+ Text [ en-US ] = "Data Form" ;
-+ Moveable = TRUE ;
-+ Closeable = TRUE ;
-+ FixedText LAB_DATAFORM_RECORDNO
-+ {
-+ Pos = MAP_APPFONT ( 136 , 6 ) ;
-+ Size = MAP_APPFONT ( 50 , 12 ) ;
-+ Text [ en-US ] = "/" ;
-+ };
-+ PushButton BTN_DATAFORM_NEW
-+ {
-+ Pos = MAP_APPFONT ( 135 , 23 ) ;
-+ Size = MAP_APPFONT ( 50 , 14 ) ;
-+ TabStop = TRUE ;
-+ DefButton = TRUE ;
-+ Text [ en-US ] = "New" ;
-+ };
-+ PushButton BTN_DATAFORM_DELETE
-+ {
-+ Pos = MAP_APPFONT ( 135 , 40 ) ;
-+ Size = MAP_APPFONT ( 50 , 14 ) ;
-+ TabStop = TRUE ;
-+ Text [ en-US ] = "Delete" ;
-+ };
-+ PushButton BTN_DATAFORM_RESTORE
-+ {
-+ Pos = MAP_APPFONT ( 135 , 57 ) ;
-+ Size = MAP_APPFONT ( 50 , 14 ) ;
-+ TabStop = TRUE ;
-+ Text [ en-US ] = "Restore" ;
-+ };
-+ PushButton BTN_DATAFORM_LAST
-+ {
-+ Pos = MAP_APPFONT ( 135 , 82 ) ;
-+ Size = MAP_APPFONT ( 50 , 14 ) ;
-+ TabStop = TRUE ;
-+ Text [ en-US ] = "Last Record" ;
-+ };
-+ PushButton BTN_DATAFORM_NEXT
-+ {
-+ Pos = MAP_APPFONT ( 135 , 99 ) ;
-+ Size = MAP_APPFONT ( 50 , 14 ) ;
-+ TabStop = TRUE ;
-+ Text [ en-US ] = "Next Record" ;
-+ };
-+ PushButton BTN_DATAFORM_CLOSE
-+ {
-+ Pos = MAP_APPFONT ( 135 , 116 ) ;
-+ Size = MAP_APPFONT ( 50 , 14 ) ;
-+ TabStop = TRUE ;
-+ Text [ en-US ] = "Close" ;
-+ };
-+ ScrollBar WND_DATAFORM_SCROLLBAR
-+ {
-+ Pos = MAP_APPFONT ( 124 , 6 ) ;
-+ Size = MAP_APPFONT ( 8 , 135 ) ;
-+ HScroll = FALSE ;
-+ TabStop = FALSE ;
-+ };
-+};
-+//end
-+
-+
-+
-+
-diff --git sc/source/ui/src/globstr.src sc/source/ui/src/globstr.src
-index 37f0d31..eceefa6 100644
---- sc/source/ui/src/globstr.src
-+++ sc/source/ui/src/globstr.src
-@@ -1718,6 +1718,77 @@ Resource RID_GLOBSTR
- {
- Text [ en-US ] = "Unknown User";
- };
-+
-+ String STR_SHAPE_AUTOSHAPE
-+ {
-+ Text [ en-US ] = "AutoShape";
-+ };
-+
-+ String STR_SHAPE_RECTANGLE
-+ {
-+ Text [ en-US ] = "Rectangle";
-+ };
-+
-+ String STR_SHAPE_LINE
-+ {
-+ Text [ en-US ] = "Line";
-+ };
-+
-+ String STR_SHAPE_OVAL
-+ {
-+ Text [ en-US ] = "Oval";
-+ };
-+
-+ String STR_SHAPE_TEXTBOX
-+ {
-+ Text [ en-US ] = "Text Box";
-+ };
-+
-+ String STR_FORM_BUTTON
-+ {
-+ Text [ en-US ] = "Button";
-+ };
-+
-+ String STR_FORM_CHECKBOX
-+ {
-+ Text [ en-US ] = "Check Box";
-+ };
-+
-+ String STR_FORM_OPTIONBUTTON
-+ {
-+ Text [ en-US ] = "Option Button";
-+ };
-+
-+ String STR_FORM_LABEL
-+ {
-+ Text [ en-US ] = "Label";
-+ };
-+
-+ String STR_FORM_LISTBOX
-+ {
-+ Text [ en-US ] = "List Box";
-+ };
-+
-+ String STR_FORM_GROUPBOX
-+ {
-+ Text [ en-US ] = "Group Box";
-+ };
-+
-+ String STR_FORM_DROPDOWN
-+ {
-+ Text [ en-US ] = "Drop Down";
-+ };
-+
-+ String STR_FORM_SPINNER
-+ {
-+ Text [ en-US ] = "Spinner";
-+ };
-+
-+ String STR_FORM_SCROLLBAR
-+ {
-+ Text [ en-US ] = "Scroll Bar";
-+ };
-+
- String STR_STYLE_FAMILY_CELL
- {
- Text [ en-US ] = "Cell Styles";
-diff --git sc/source/ui/src/makefile.mk sc/source/ui/src/makefile.mk
-index 96bb78e..c935a08 100644
---- sc/source/ui/src/makefile.mk
-+++ sc/source/ui/src/makefile.mk
-@@ -53,6 +53,7 @@ SRC1FILES = \
- dbnamdlg.src \
- subtdlg.src \
- miscdlgs.src \
-+ datafdlg.src \
- autofmt.src \
- solvrdlg.src \
- optsolver.src \
-diff --git sc/source/ui/undo/undodat.cxx sc/source/ui/undo/undodat.cxx
-index d42dc64..a175ea6 100644
---- sc/source/ui/undo/undodat.cxx
-+++ sc/source/ui/undo/undodat.cxx
-@@ -52,6 +52,8 @@
- #include "attrib.hxx"
- #include "hints.hxx"
- #include "sc.hrc"
-+#include "chgtrack.hxx" // Amelia Wang
-+#include "refundo.hxx" // Amelia Wang
-
- // -----------------------------------------------------------------------
-
-@@ -72,6 +74,7 @@ TYPEINIT1(ScUndoRepeatDB, ScSimpleUndo);
- TYPEINIT1(ScUndoDataPilot, ScSimpleUndo);
- TYPEINIT1(ScUndoConsolidate, ScSimpleUndo);
- TYPEINIT1(ScUndoChartData, ScSimpleUndo);
-+TYPEINIT1(ScUndoDataForm, SfxUndoAction); // amelia
-
- // -----------------------------------------------------------------------
-
-@@ -2186,8 +2189,210 @@ BOOL __EXPORT ScUndoChartData::CanRepeat(SfxRepeatTarget& /* rTarget */) const
- return FALSE;
- }
-
-+// Amelia Wang
-+ScUndoDataForm::ScUndoDataForm( ScDocShell* pNewDocShell,
-+ SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
-+ SCCOL nEndX, SCROW nEndY, SCTAB nEndZ,
-+ const ScMarkData& rMark,
-+ ScDocument* pNewUndoDoc, ScDocument* pNewRedoDoc,
-+ USHORT nNewFlags,
-+ ScRefUndoData* pRefData,
-+ void* /*pFill1*/, void* /*pFill2*/, void* /*pFill3*/,
-+ BOOL bRedoIsFilled ) :
-+ ScBlockUndo( pNewDocShell, ScRange( nStartX, nStartY, nStartZ, nEndX, nEndY, nEndZ ), SC_UNDO_SIMPLE ),
-+ aMarkData( rMark ),
-+ pUndoDoc( pNewUndoDoc ),
-+ pRedoDoc( pNewRedoDoc ),
-+ nFlags( nNewFlags ),
-+ pRefUndoData( pRefData ),
-+ pRefRedoData( NULL ),
-+ bRedoFilled( bRedoIsFilled )
-+{
-+ // pFill1,pFill2,pFill3 are there so the ctor calls for simple paste (without cutting)
-+ // don't have to be changed and branched for 641.
-+ // They can be removed later.
-+
-+ if ( !aMarkData.IsMarked() ) // no cell marked:
-+ aMarkData.SetMarkArea( aBlockRange ); // mark paste block
-+
-+ if ( pRefUndoData )
-+ pRefUndoData->DeleteUnchanged( pDocShell->GetDocument() );
-+
-+ SetChangeTrack();
-+}
-+
-+ScUndoDataForm::~ScUndoDataForm()
-+{
-+ delete pUndoDoc;
-+ delete pRedoDoc;
-+ delete pRefUndoData;
-+ delete pRefRedoData;
-+}
-+
-+String ScUndoDataForm::GetComment() const
-+{
-+ return ScGlobal::GetRscString( STR_UNDO_PASTE );
-+}
-+
-+void ScUndoDataForm::SetChangeTrack()
-+{
-+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
-+ if ( pChangeTrack && (nFlags & IDF_CONTENTS) )
-+ pChangeTrack->AppendContentRange( aBlockRange, pUndoDoc,
-+ nStartChangeAction, nEndChangeAction, SC_CACM_PASTE );
-+ else
-+ nStartChangeAction = nEndChangeAction = 0;
-+}
-+
-+
-+void ScUndoDataForm::Undo()
-+{
-+ BeginUndo();
-+ DoChange( TRUE );
-+ ShowTable( aBlockRange );
-+ EndUndo();
-+ SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) );
-+}
-+
-+void ScUndoDataForm::Redo()
-+{
-+ BeginRedo();
-+ ScDocument* pDoc = pDocShell->GetDocument();
-+ EnableDrawAdjust( pDoc, FALSE ); //! include in ScBlockUndo?
-+ DoChange( FALSE );
-+ EnableDrawAdjust( pDoc, TRUE ); //! include in ScBlockUndo?
-+ EndRedo();
-+ SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) );
-+}
-+
-+void ScUndoDataForm::Repeat(SfxRepeatTarget& /*rTarget*/)
-+{
-+}
-+
-+BOOL ScUndoDataForm::CanRepeat(SfxRepeatTarget& rTarget) const
-+{
-+ return (rTarget.ISA(ScTabViewTarget));
-+}
-
-+void ScUndoDataForm::DoChange( const BOOL bUndo )
-+{
-+ ScDocument* pDoc = pDocShell->GetDocument();
-
-+ // RefUndoData for redo is created before first undo
-+ // (with DeleteUnchanged after the DoUndo call)
-+ BOOL bCreateRedoData = ( bUndo && pRefUndoData && !pRefRedoData );
-+ if ( bCreateRedoData )
-+ pRefRedoData = new ScRefUndoData( pDoc );
-
-+ ScRefUndoData* pWorkRefData = bUndo ? pRefUndoData : pRefRedoData;
-+
-+ // fuer Undo immer alle oder keine Inhalte sichern
-+ USHORT nUndoFlags = IDF_NONE;
-+ if (nFlags & IDF_CONTENTS)
-+ nUndoFlags |= IDF_CONTENTS;
-+ if (nFlags & IDF_ATTRIB)
-+ nUndoFlags |= IDF_ATTRIB;
-+
-+ BOOL bPaintAll = FALSE;
-+
-+ ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
-
-+ // marking is in ScBlockUndo...
-+ //ScUndoUtil::MarkSimpleBlock( pDocShell, aBlockRange );
-
-+ SCTAB nTabCount = pDoc->GetTableCount();
-+ if ( bUndo && !bRedoFilled )
-+ {
-+ if (!pRedoDoc)
-+ {
-+ BOOL bColInfo = ( aBlockRange.aStart.Row()==0 && aBlockRange.aEnd.Row()==MAXROW );
-+ BOOL bRowInfo = ( aBlockRange.aStart.Col()==0 && aBlockRange.aEnd.Col()==MAXCOL );
-+
-+ pRedoDoc = new ScDocument( SCDOCMODE_UNDO );
-+ pRedoDoc->InitUndoSelected( pDoc, aMarkData, bColInfo, bRowInfo );
-+ }
-+ // read "redo" data from the document in the first undo
-+ // all sheets - CopyToDocument skips those that don't exist in pRedoDoc
-+ ScRange aCopyRange = aBlockRange;
-+ aCopyRange.aStart.SetTab(0);
-+ aCopyRange.aEnd.SetTab(nTabCount-1);
-+ pDoc->CopyToDocument( aCopyRange, 1, FALSE, pRedoDoc );
-+ bRedoFilled = TRUE;
-+ }
-+
-+ USHORT nExtFlags = 0;
-+ pDocShell->UpdatePaintExt( nExtFlags, aBlockRange );
-+
-+ for ( sal_uInt16 i=0; i <= ( aBlockRange.aEnd.Col() - aBlockRange.aStart.Col() ); i++ )
-+ {
-+ String aOldString;
-+ pUndoDoc->GetString( aBlockRange.aStart.Col()+i , aBlockRange.aStart.Row() , aBlockRange.aStart.Tab() , aOldString );
-+ pDoc->SetString( aBlockRange.aStart.Col()+i , aBlockRange.aStart.Row() , aBlockRange.aStart.Tab() , aOldString );
-+ }
-+
-+ //ScRange aTabSelectRange = aBlockRange;
-+
-+ if (pWorkRefData)
-+ {
-+ pWorkRefData->DoUndo( pDoc, TRUE ); // TRUE = bSetChartRangeLists for SetChartListenerCollection
-+ if ( pDoc->RefreshAutoFilter( 0,0, MAXCOL,MAXROW, aBlockRange.aStart.Tab() ) )
-+ bPaintAll = TRUE;
-+ }
-+
-+ if ( bCreateRedoData && pRefRedoData )
-+ pRefRedoData->DeleteUnchanged( pDoc );
-+
-+ if ( bUndo )
-+ {
-+ ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
-+ if ( pChangeTrack )
-+ pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
-+ }
-+ else
-+ SetChangeTrack();
-+
-+ ScRange aDrawRange( aBlockRange );
-+ pDoc->ExtendMerge( aDrawRange, TRUE ); // only needed for single sheet (text/rtf etc.)
-+ USHORT nPaint = PAINT_GRID;
-+ if (bPaintAll)
-+ {
-+ aDrawRange.aStart.SetCol(0);
-+ aDrawRange.aStart.SetRow(0);
-+ aDrawRange.aEnd.SetCol(MAXCOL);
-+ aDrawRange.aEnd.SetRow(MAXROW);
-+ nPaint |= PAINT_TOP | PAINT_LEFT;
-+/*A*/ if (pViewShell)
-+ pViewShell->AdjustBlockHeight(FALSE);
-+ }
-+ else
-+ {
-+ if ( aBlockRange.aStart.Row() == 0 && aBlockRange.aEnd.Row() == MAXROW ) // ganze Spalte
-+ {
-+ nPaint |= PAINT_TOP;
-+ aDrawRange.aEnd.SetCol(MAXCOL);
-+ }
-+ if ( aBlockRange.aStart.Col() == 0 && aBlockRange.aEnd.Col() == MAXCOL ) // ganze Zeile
-+ {
-+ nPaint |= PAINT_LEFT;
-+ aDrawRange.aEnd.SetRow(MAXROW);
-+ }
-+/*A*/ if ((pViewShell) && pViewShell->AdjustBlockHeight(FALSE))
-+ {
-+ aDrawRange.aStart.SetCol(0);
-+ aDrawRange.aStart.SetRow(0);
-+ aDrawRange.aEnd.SetCol(MAXCOL);
-+ aDrawRange.aEnd.SetRow(MAXROW);
-+ nPaint |= PAINT_LEFT;
-+ }
-+ pDocShell->UpdatePaintExt( nExtFlags, aDrawRange );
-+ }
-+
-+ if ( !bUndo ) // draw redo after updating row heights
-+ RedoSdrUndoAction( pDrawUndo ); //! include in ScBlockUndo?
-+
-+ pDocShell->PostPaint( aDrawRange, nPaint, nExtFlags );
-+
-+ pDocShell->PostDataChanged();
-+ if (pViewShell)
-+ pViewShell->CellContentChanged();
-+}
-diff --git sc/source/ui/unoobj/addruno.cxx sc/source/ui/unoobj/addruno.cxx
-index 4bea38e..fa1d4ee 100644
---- sc/source/ui/unoobj/addruno.cxx
-+++ sc/source/ui/unoobj/addruno.cxx
-@@ -69,7 +69,7 @@ void ScAddressConversionObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
- }
- }
-
--sal_Bool ScAddressConversionObj::ParseUIString( const String& rUIString )
-+sal_Bool ScAddressConversionObj::ParseUIString( const String& rUIString, ::formula::FormulaGrammar::AddressConvention eConv )
- {
- if (!pDocShell)
- return sal_False;
-@@ -78,7 +78,7 @@ sal_Bool ScAddressConversionObj::ParseUIString( const String& rUIString )
- sal_Bool bSuccess = sal_False;
- if ( bIsRange )
- {
-- USHORT nResult = aRange.ParseAny( rUIString, pDoc );
-+ USHORT nResult = aRange.ParseAny( rUIString, pDoc, eConv );
- if ( nResult & SCA_VALID )
- {
- if ( ( nResult & SCA_TAB_3D ) == 0 )
-@@ -92,7 +92,7 @@ sal_Bool ScAddressConversionObj::ParseUIString( const String& rUIString )
- }
- else
- {
-- USHORT nResult = aRange.aStart.Parse( rUIString, pDoc );
-+ USHORT nResult = aRange.aStart.Parse( rUIString, pDoc, eConv );
- if ( nResult & SCA_VALID )
- {
- if ( ( nResult & SCA_TAB_3D ) == 0 )
-@@ -116,6 +116,7 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScAddressConversionObj::getProp
- {
- {MAP_CHAR_LEN(SC_UNONAME_ADDRESS), 0, &getCppuType((table::CellRangeAddress*)0), 0, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_PERSREPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
-+ {MAP_CHAR_LEN(SC_UNONAME_XL_A1_REPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_REFSHEET), 0, &getCppuType((sal_Int32*)0), 0, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_UIREPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
- {0,0,0,0,0,0}
-@@ -129,6 +130,7 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScAddressConversionObj::getProp
- {
- {MAP_CHAR_LEN(SC_UNONAME_ADDRESS), 0, &getCppuType((table::CellAddress*)0), 0, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_PERSREPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
-+ {MAP_CHAR_LEN(SC_UNONAME_XL_A1_REPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_REFSHEET), 0, &getCppuType((sal_Int32*)0), 0, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_UIREPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
- {0,0,0,0,0,0}
-@@ -190,8 +192,11 @@ void SAL_CALL ScAddressConversionObj::setPropertyValue( const rtl::OUString& aPr
- bSuccess = ParseUIString( aUIString );
- }
- }
-- else if ( aNameStr.EqualsAscii( SC_UNONAME_PERSREPR ) )
-+ else if ( aNameStr.EqualsAscii( SC_UNONAME_PERSREPR ) || aNameStr.EqualsAscii( SC_UNONAME_XL_A1_REPR ) )
- {
-+ ::formula::FormulaGrammar::AddressConvention aConv = ::formula::FormulaGrammar::CONV_OOO;
-+ if ( aNameStr.EqualsAscii( SC_UNONAME_XL_A1_REPR ) )
-+ aConv = ::formula::FormulaGrammar::CONV_XL_A1;
- // parse the file format string
- rtl::OUString sRepresentation;
- if (aValue >>= sRepresentation)
-@@ -212,7 +217,7 @@ void SAL_CALL ScAddressConversionObj::setPropertyValue( const rtl::OUString& aPr
- }
-
- // parse the rest like a UI string
-- bSuccess = ParseUIString( aUIString );
-+ bSuccess = ParseUIString( aUIString, aConv );
- }
- }
- else
-@@ -265,17 +270,24 @@ uno::Any SAL_CALL ScAddressConversionObj::getPropertyValue( const rtl::OUString&
- aRange.aStart.Format( aFormatStr, nFlags, pDoc );
- aRet <<= rtl::OUString( aFormatStr );
- }
-- else if ( aNameStr.EqualsAscii( SC_UNONAME_PERSREPR ) )
-+ else if ( aNameStr.EqualsAscii( SC_UNONAME_PERSREPR ) || aNameStr.EqualsAscii( SC_UNONAME_XL_A1_REPR ) )
- {
-+ ::formula::FormulaGrammar::AddressConvention aConv = ::formula::FormulaGrammar::CONV_OOO;
-+ if ( aNameStr.EqualsAscii( SC_UNONAME_XL_A1_REPR ) )
-+ aConv = ::formula::FormulaGrammar::CONV_XL_A1;
-+
- // generate file format string - always include sheet
- String aFormatStr;
-- aRange.aStart.Format( aFormatStr, SCA_VALID | SCA_TAB_3D, pDoc );
-+ aRange.aStart.Format( aFormatStr, SCA_VALID | SCA_TAB_3D, pDoc, aConv );
- if ( bIsRange )
- {
- // manually concatenate range so both parts always have the sheet name
- aFormatStr.Append( (sal_Unicode) ':' );
- String aSecond;
-- aRange.aEnd.Format( aSecond, SCA_VALID | SCA_TAB_3D, pDoc );
-+ USHORT nFlags = SCA_VALID;
-+ if( aConv != ::formula::FormulaGrammar::CONV_XL_A1 )
-+ nFlags |= SCA_TAB_3D;
-+ aRange.aEnd.Format( aSecond, SCA_VALID | SCA_TAB_3D, pDoc, aConv );
- aFormatStr.Append( aSecond );
- }
- aRet <<= rtl::OUString( aFormatStr );
-diff --git sc/source/ui/unoobj/docuno.cxx sc/source/ui/unoobj/docuno.cxx
-index ccf3ddf..39caf07 100644
---- sc/source/ui/unoobj/docuno.cxx
-+++ sc/source/ui/unoobj/docuno.cxx
-@@ -101,6 +101,7 @@
- #include "scresid.hxx"
-
- using namespace com::sun::star;
-+#define SC_UNO_VBADOCOBJ "ThisVBADocObj" // perhaps we want to actually make this ThisWorkbook ?
-
- //------------------------------------------------------------------------
-
-@@ -117,6 +122,7 @@ const SfxItemPropertyMapEntry* lcl_GetDocOptPropertyMap()
- {MAP_CHAR_LEN(SC_UNO_AUTOCONTFOC), 0, &getBooleanCppuType(), 0, 0},
- {MAP_CHAR_LEN(SC_UNO_BASICLIBRARIES), 0, &getCppuType((uno::Reference< script::XLibraryContainer >*)0), beans::PropertyAttribute::READONLY, 0},
- {MAP_CHAR_LEN(SC_UNO_DIALOGLIBRARIES), 0, &getCppuType((uno::Reference< script::XLibraryContainer >*)0), beans::PropertyAttribute::READONLY, 0},
-+ {MAP_CHAR_LEN(SC_UNO_VBADOCOBJ), 0, &getCppuType((beans::PropertyValue*)0), beans::PropertyAttribute::READONLY, 0},
- {MAP_CHAR_LEN(SC_UNO_CALCASSHOWN), PROP_UNO_CALCASSHOWN, &getBooleanCppuType(), 0, 0},
- {MAP_CHAR_LEN(SC_UNONAME_CLOCAL), 0, &getCppuType((lang::Locale*)0), 0, 0},
- {MAP_CHAR_LEN(SC_UNO_CJK_CLOCAL), 0, &getCppuType((lang::Locale*)0), 0, 0},
-@@ -1873,6 +1880,18 @@ uno::Any SAL_CALL ScModelObj::getPropertyValue( const rtl::OUString& aPropertyNa
- {
- aRet <<= pDocShell->GetDialogContainer();
- }
-+ else if ( aString.EqualsAscii( SC_UNO_VBADOCOBJ ) )
-+ {
-+ // PropertyValue seems extreme because we store
-+ // the model ( as the value member ) of the PropertyValue that is
-+ // itself a property of the model ( the intention however is to
-+ // store something like a Workbook object... but we don't do that )
-+ // yet
-+ beans::PropertyValue aProp;
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ThisExcelDoc") );
-+ aProp.Value <<= pDocShell->GetModel();
-+ aRet <<= aProp;
-+ }
- else if ( aString.EqualsAscii( SC_UNO_RUNTIMEUID ) )
- {
- aRet <<= getRuntimeUID();
-diff --git sc/source/ui/unoobj/servuno.cxx sc/source/ui/unoobj/servuno.cxx
-index a9a83b7..32106fa 100644
---- sc/source/ui/unoobj/servuno.cxx
-+++ sc/source/ui/unoobj/servuno.cxx
-@@ -35,6 +35,7 @@
- #include <svx/unofill.hxx>
- #include <editeng/unonrule.hxx>
- #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
-+#include <com/sun/star/container/XNameAccess.hpp>
-
- #include "servuno.hxx"
- #include "unoguard.hxx"
-@@ -71,8 +72,27 @@
- #include <basic/basmgr.hxx>
- #include <sfx2/app.hxx>
-
-+#include <comphelper/processfactory.hxx>
-+#include <com/sun/star/document/XCodeNameQuery.hpp>
-+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
-+#include <com/sun/star/form/XFormsSupplier.hpp>
-+#include <com/sun/star/script/ScriptEventDescriptor.hpp>
-+#include <comphelper/componentcontext.hxx>
-+#include <cppuhelper/component_context.hxx>
-+#include <vbahelper/vbaaccesshelper.hxx>
-+#include <com/sun/star/script/vba/XVBACompatibility.hpp>
-+
- using namespace ::com::sun::star;
-
-+bool isInVBAMode( ScDocShell& rDocSh )
-+{
-+ uno::Reference<script::XLibraryContainer> xLibContainer = rDocSh.GetBasicContainer();
-+ uno::Reference<script::vba::XVBACompatibility> xVBACompat( xLibContainer, uno::UNO_QUERY );
-+ if ( xVBACompat.is() )
-+ return xVBACompat->getVBACompatibilityMode();
-+ return false;
-+}
-+
- class ScVbaObjectForCodeNameProvider : public ::cppu::WeakImplHelper1< container::XNameAccess >
- {
- uno::Any maWorkbook;
-@@ -285,7 +305,8 @@ static const ProvNamesId_Type __FAR_DATA aProvNamesId[] =
- { "com.sun.star.text.textfield.Time", SC_SERVICE_TIMEFIELD },
- { "com.sun.star.text.textfield.DocumentTitle", SC_SERVICE_TITLEFIELD },
- { "com.sun.star.text.textfield.FileName", SC_SERVICE_FILEFIELD },
-- { "com.sun.star.text.textfield.SheetName", SC_SERVICE_SHEETFIELD }
-+ { "com.sun.star.text.textfield.SheetName", SC_SERVICE_SHEETFIELD },
-+ { "ooo.vba.VBAGlobals", SC_SERVICE_VBAGLOBALS },
- };
-
- //
-@@ -554,7 +575,7 @@ uno::Reference<uno::XInterface> ScServiceProvider::MakeInstance(
- }
- break;
- case SC_SERVICE_VBACODENAMEPROVIDER:
-- if (pDocShell && pDocShell->GetDocument()->IsInVBAMode())
-+ if ( pDocShell && ooo::vba::isAlienExcelDoc( *pDocShell ) && isInVBAMode( *pDocShell ) )
- {
- OSL_TRACE("**** creating VBA Object provider");
- xRet.set(static_cast<document::XCodeNameQuery*>(new ScVbaCodeNameProvider( pDocShell )));
-diff --git sc/source/ui/unoobj/shapeuno.cxx sc/source/ui/unoobj/shapeuno.cxx
-index 2533354..dcea134 100644
---- sc/source/ui/unoobj/shapeuno.cxx
-+++ sc/source/ui/unoobj/shapeuno.cxx
-@@ -70,6 +70,8 @@ const SfxItemPropertyMapEntry* lcl_GetShapeMap()
- {MAP_CHAR_LEN(SC_UNONAME_HORIPOS), 0, &getCppuType((sal_Int32*)0), 0, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_IMAGEMAP), 0, &getCppuType((uno::Reference<container::XIndexContainer>*)0), 0, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_VERTPOS), 0, &getCppuType((sal_Int32*)0), 0, 0 },
-+ // #i66550 HLINK_FOR_SHAPES
-+ {MAP_CHAR_LEN(SC_UNONAME_HYPERLINK), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
- {0,0,0,0,0,0}
- };
- return aShapeMap_Impl;
-@@ -84,6 +86,14 @@ const SvEventDescription* ScShapeObj::GetSupportedMacroItems()
- };
- return aMacroDescriptionsImpl;
- }
-+// #i66550 HLINK_FOR_SHAPES
-+ScMacroInfo* lcl_getShapeHyperMacroInfo( ScShapeObj* pShape, BOOL bCreate = FALSE )
-+{
-+ if( pShape )
-+ if( SdrObject* pObj = pShape->GetSdrObject() )
-+ return ScDrawLayer::GetMacroInfo( pObj, bCreate );
-+ return 0;
-+}
-
- //------------------------------------------------------------------------
-
-@@ -635,6 +645,13 @@ void SAL_CALL ScShapeObj::setPropertyValue(
- }
- }
- }
-+ else if ( aNameString.EqualsAscii( SC_UNONAME_HYPERLINK ) )
-+ {
-+ rtl::OUString sHlink;
-+ ScMacroInfo* pInfo = lcl_getShapeHyperMacroInfo(this, TRUE);
-+ if ( ( aValue >>= sHlink ) && pInfo )
-+ pInfo->SetHlink( sHlink );
-+ }
- else
- {
- GetShapePropertySet();
-@@ -816,6 +833,13 @@ uno::Any SAL_CALL ScShapeObj::getPropertyValue( const rtl::OUString& aPropertyNa
- }
- }
- }
-+ else if ( aNameString.EqualsAscii( SC_UNONAME_HYPERLINK ) )
-+ {
-+ rtl::OUString sHlink;
-+ if ( ScMacroInfo* pInfo = lcl_getShapeHyperMacroInfo(this) )
-+ sHlink = pInfo->GetHlink();
-+ aAny <<= sHlink;
-+ }
- else
- {
- GetShapePropertySet();
-@@ -1339,11 +1363,6 @@ SdrObject* ScShapeObj::GetSdrObject() const throw()
- }
-
- #define SC_EVENTACC_ONCLICK ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnClick" ) )
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
--#define SC_EVENTACC_ONACTION ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnAction" ) )
--#define SC_EVENTACC_URL ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) )
--#define SC_EVENTACC_ACTION ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Action" ) )
--#endif
- #define SC_EVENTACC_SCRIPT ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Script" ) )
- #define SC_EVENTACC_EVENTTYPE ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EventType" ) )
-
-@@ -1355,10 +1374,7 @@ private:
-
- ScMacroInfo* getInfo( BOOL bCreate = FALSE )
- {
-- if( mpShape )
-- if( SdrObject* pObj = mpShape->GetSdrObject() )
-- return ScDrawLayer::GetMacroInfo( pObj, bCreate );
-- return 0;
-+ return lcl_getShapeHyperMacroInfo( mpShape, bCreate );
- }
-
- public:
-@@ -1384,11 +1400,7 @@ public:
- isEventType = true;
- continue;
- }
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
-- if ( isEventType && ((pProperties->Name == SC_EVENTACC_SCRIPT) || (pProperties->Name == SC_EVENTACC_URL)) )
--#else
- if ( isEventType && (pProperties->Name == SC_EVENTACC_SCRIPT) )
--#endif
- {
- rtl::OUString sValue;
- if ( pProperties->Value >>= sValue )
-@@ -1399,10 +1411,8 @@ public:
- break;
- if ( pProperties->Name == SC_EVENTACC_SCRIPT )
- pInfo->SetMacro( sValue );
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
- else
- pInfo->SetHlink( sValue );
--#endif
- }
- }
- }
-@@ -1425,19 +1435,6 @@ public:
- aProperties[ 1 ].Value <<= pInfo->GetMacro();
- }
- }
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
-- else if( aName == SC_EVENTACC_ONACTION )
-- {
-- if ( pInfo && (pInfo->GetHlink().getLength() > 0) )
-- {
-- aProperties.realloc( 2 );
-- aProperties[ 0 ].Name = SC_EVENTACC_EVENTTYPE;
-- aProperties[ 0 ].Value <<= SC_EVENTACC_ACTION;
-- aProperties[ 1 ].Name = SC_EVENTACC_URL;
-- aProperties[ 1 ].Value <<= pInfo->GetHlink();
-- }
-- }
--#endif
- else
- {
- throw container::NoSuchElementException();
-@@ -1448,25 +1445,14 @@ public:
-
- virtual uno::Sequence< rtl::OUString > SAL_CALL getElementNames() throw(uno::RuntimeException)
- {
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
-- uno::Sequence< rtl::OUString > aSeq( 2 );
--#else
- uno::Sequence< rtl::OUString > aSeq( 1 );
--#endif
- aSeq[ 0 ] = SC_EVENTACC_ONCLICK;
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
-- aSeq[ 1 ] = SC_EVENTACC_ONACTION;
--#endif
- return aSeq;
- }
-
- virtual sal_Bool SAL_CALL hasByName( const rtl::OUString& aName ) throw(uno::RuntimeException)
- {
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
-- return (aName == SC_EVENTACC_ONCLICK) || (aName == SC_EVENTACC_ONACTION);
--#else
- return aName == SC_EVENTACC_ONCLICK;
--#endif
- }
-
- // XElementAccess
-diff --git sc/source/ui/unoobj/viewuno.cxx sc/source/ui/unoobj/viewuno.cxx
-index 0a3fe3f..200e592 100644
---- sc/source/ui/unoobj/viewuno.cxx
-+++ sc/source/ui/unoobj/viewuno.cxx
-@@ -1173,11 +1296,21 @@ uno::Reference<sheet::XSpreadsheet> SAL_CALL ScTabViewObj::getActiveSheet()
- return NULL;
- }
-
-+//liuchen 2009-9-2 support expand (but not replace) the active sheet
- void SAL_CALL ScTabViewObj::setActiveSheet( const uno::Reference<sheet::XSpreadsheet>& xActiveSheet )
- throw(uno::RuntimeException)
- {
-- ScUnoGuard aGuard;
-+ selectSheet(xActiveSheet, false);
-+}
-
-+void SAL_CALL
-+ScTabViewObj::selectSheet( const uno::Reference<sheet::XSpreadsheet>& xActiveSheet,
-+ sal_Bool bExpand)
-+ throw(uno::RuntimeException)
-+{
-+ ScUnoGuard aGuard;
-+ sal_Bool bNew = bExpand;
-+
- ScTabViewShell* pViewSh = GetViewShell();
- if ( pViewSh && xActiveSheet.is() )
- {
-@@ -1191,7 +1324,7 @@ void SAL_CALL ScTabViewObj::setActiveSheet( const uno::Reference<sheet::XSpreads
- {
- SCTAB nNewTab = rRanges.GetObject(0)->aStart.Tab();
- if ( pViewSh->GetViewData()->GetDocument()->HasTable(nNewTab) )
-- pViewSh->SetTabNo( nNewTab );
-+ pViewSh->SetTabNo( nNewTab, bNew, bExpand );
- }
- }
- }
-@@ -1885,6 +2018,12 @@ void SAL_CALL ScTabViewObj::setPropertyValue(
- ScUnoGuard aGuard;
- String aString(aPropertyName);
-
-+ if ( aString.EqualsAscii(SC_UNO_FILTERED_RANGE_SELECTION) )
-+ {
-+ bFilteredRangeSelection = ScUnoHelpFunctions::GetBoolFromAny(aValue);
-+ return;
-+ }
-+
- ScTabViewShell* pViewSh = GetViewShell();
- if (pViewSh)
- {
-@@ -2005,6 +2144,12 @@ uno::Any SAL_CALL ScTabViewObj::getPropertyValue( const rtl::OUString& aProperty
- String aString(aPropertyName);
- uno::Any aRet;
-
-+ if ( aString.EqualsAscii(SC_UNO_FILTERED_RANGE_SELECTION) )
-+ {
-+ ScUnoHelpFunctions::SetBoolInAny(aRet, bFilteredRangeSelection);
-+ return aRet;
-+ }
-+
- ScTabViewShell* pViewSh = GetViewShell();
- if (pViewSh)
- {
-diff --git sc/source/ui/vba/excelvbahelper.cxx sc/source/ui/vba/excelvbahelper.cxx
-index 5fc1b3c..705941b 100644
---- sc/source/ui/vba/excelvbahelper.cxx
-+++ sc/source/ui/vba/excelvbahelper.cxx
-@@ -43,6 +43,52 @@ namespace vba
- namespace excel
- {
-
-+uno::Reference< sheet::XDatabaseRanges >
-+GetDataBaseRanges( ScDocShell* pShell ) throw ( uno::RuntimeException )
-+{
-+ uno::Reference< frame::XModel > xModel;
-+ if ( pShell )
-+ xModel.set( pShell->GetModel(), uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xModelProps( xModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< sheet::XDatabaseRanges > xDBRanges( xModelProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DatabaseRanges") ) ), uno::UNO_QUERY_THROW );
-+ return xDBRanges;
-+}
-+
-+// returns the XDatabaseRange for the autofilter on sheet (nSheet)
-+// also populates sName with the name of range
-+uno::Reference< sheet::XDatabaseRange >
-+GetAutoFiltRange( ScDocShell* pShell, sal_Int16 nSheet, rtl::OUString& sName ) throw ( uno::RuntimeException )
-+{
-+ uno::Reference< container::XIndexAccess > xIndexAccess( GetDataBaseRanges( pShell ), uno::UNO_QUERY_THROW );
-+ uno::Reference< sheet::XDatabaseRange > xDataBaseRange;
-+ table::CellRangeAddress dbAddress;
-+ for ( sal_Int32 index=0; index < xIndexAccess->getCount(); ++index )
-+ {
-+ uno::Reference< sheet::XDatabaseRange > xDBRange( xIndexAccess->getByIndex( index ), uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XNamed > xNamed( xDBRange, uno::UNO_QUERY_THROW );
-+ // autofilters work weirdly with openoffice, unnamed is the default
-+ // named range which is used to create an autofilter, but
-+ // its also possible that another name could be used
-+ // this also causes problems when an autofilter is created on
-+ // another sheet
-+ // ( but.. you can use any named range )
-+ dbAddress = xDBRange->getDataArea();
-+ if ( dbAddress.Sheet == nSheet )
-+ {
-+ sal_Bool bHasAuto = sal_False;
-+ uno::Reference< beans::XPropertySet > xProps( xDBRange, uno::UNO_QUERY_THROW );
-+ xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AutoFilter") ) ) >>= bHasAuto;
-+ if ( bHasAuto )
-+ {
-+ sName = xNamed->getName();
-+ xDataBaseRange=xDBRange;
-+ break;
-+ }
-+ }
-+ }
-+ return xDataBaseRange;
-+}
-+
- ScDocShell* GetDocShellFromRange( const uno::Reference< uno::XInterface >& xRange ) throw ( uno::RuntimeException )
- {
- ScCellRangesBase* pScCellRangesBase = ScCellRangesBase::getImplementation( xRange );
-@@ -53,6 +99,13 @@ ScDocShell* GetDocShellFromRange( const uno::Reference< uno::XInterface >& xRang
- return pScCellRangesBase->GetDocShell();
- }
-
-+ScDocShell* GetDocShellFromRanges( const uno::Reference< sheet::XSheetCellRangeContainer >& xRanges ) throw ( uno::RuntimeException )
-+{
-+ // need the ScCellRangesBase to get docshell
-+ uno::Reference< uno::XInterface > xIf( xRanges, uno::UNO_QUERY_THROW );
-+ return GetDocShellFromRange( xIf );
-+}
-+
- ScDocument* GetDocumentFromRange( const uno::Reference< uno::XInterface >& xRange ) throw ( uno::RuntimeException )
- {
- ScDocShell* pDocShell = GetDocShellFromRange( xRange );
-@@ -63,6 +116,16 @@ ScDocument* GetDocumentFromRange( const uno::Reference< uno::XInterface >& xRang
- return pDocShell->GetDocument();
- }
-
-+uno::Reference< frame::XModel > GetModelFromRange( const uno::Reference< uno::XInterface >& xRange ) throw ( uno::RuntimeException )
-+{
-+ ScDocShell* pDocShell = GetDocShellFromRange( xRange );
-+ if ( !pDocShell )
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Failed to access underlying model uno range object" ) ), uno::Reference< uno::XInterface >() );
-+ }
-+ return pDocShell->GetModel();
-+}
-+
- void implSetZoom( const uno::Reference< frame::XModel >& xModel, sal_Int16 nZoom, std::vector< SCTAB >& nTabs )
- {
- ScTabViewShell* pViewSh = excel::getBestViewShell( xModel );
-@@ -229,6 +292,19 @@ getViewFrame( const uno::Reference< frame::XModel >& xModel )
- return NULL;
- }
-
-+sal_Bool IsR1C1ReferFormat( ScDocument* pDoc, const rtl::OUString& sRangeStr )
-+{
-+ ScRangeList aCellRanges;
-+ String sAddress( sRangeStr );
-+ USHORT nMask = SCA_VALID;
-+ USHORT rResFlags = aCellRanges.Parse( sAddress, pDoc, nMask, formula::FormulaGrammar::CONV_XL_R1C1 );
-+ if ( rResFlags & SCA_VALID )
-+ {
-+ return sal_True;
-+ }
-+ return sal_False;
-+}
-+
- uno::Reference< XHelperInterface >
- getUnoSheetModuleObj( const uno::Reference< table::XCellRange >& xRange ) throw ( uno::RuntimeException )
- {
-diff --git sc/source/ui/vba/excelvbahelper.hxx sc/source/ui/vba/excelvbahelper.hxx
-index 528457a..ab0474e 100644
---- sc/source/ui/vba/excelvbahelper.hxx
-+++ sc/source/ui/vba/excelvbahelper.hxx
-@@ -29,6 +29,8 @@
-
- #include<vbahelper/vbahelper.hxx>
- #include <docsh.hxx>
-+#include <com/sun/star/sheet/XDatabaseRanges.hpp>
-+#include <com/sun/star/sheet/XDatabaseRange.hpp>
- #include <com/sun/star/table/XCellRange.hpp>
- #include <com/sun/star/sheet/XSheetCellRangeContainer.hpp>
- #include <ooo/vba/XHelperInterface.hpp>
-@@ -39,29 +41,35 @@ namespace ooo
- {
- namespace vba
- {
-- namespace excel
-+ 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 );
-+ // 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 );
-+ sal_Bool IsR1C1ReferFormat( ScDocument* pDoc, const ::rtl::OUString& sRangeStr );
-+ css::uno::Reference< css::sheet::XDatabaseRanges > GetDataBaseRanges( ScDocShell* pShell ) throw ( css::uno::RuntimeException );
-+
-+ css::uno::Reference< css::sheet::XDatabaseRange > GetAutoFiltRange( ScDocShell* pShell, sal_Int16 nSheet, rtl::OUString& sName ) throw ( css::uno::RuntimeException );
- css::uno::Reference< ooo::vba::XHelperInterface > getUnoSheetModuleObj( const css::uno::Reference< css::sheet::XSheetCellRangeContainer >& xRanges ) throw ( css::uno::RuntimeException );
- css::uno::Reference< ooo::vba::XHelperInterface > getUnoSheetModuleObj( const css::uno::Reference< css::table::XCellRange >& xRange ) throw ( css::uno::RuntimeException );
- ScDocShell* GetDocShellFromRange( const css::uno::Reference< css::uno::XInterface >& xRange ) throw ( css::uno::RuntimeException );
-+ ScDocShell* GetDocShellFromRanges( const css::uno::Reference< css::sheet::XSheetCellRangeContainer >& xRanges ) throw ( css::uno::RuntimeException );
- ScDocument* GetDocumentFromRange( const css::uno::Reference< css::uno::XInterface >& xRange ) throw ( css::uno::RuntimeException );
- css::uno::Reference< css::frame::XModel > GetModelFromRange( const css::uno::Reference< css::uno::XInterface >& xRange ) throw ( css::uno::RuntimeException );
-+
- class ScVbaCellRangeAccess
- {
- public:
- static SfxItemSet* GetDataSet( ScCellRangesBase* pRangeObj );
- };
--}
--}
-+ }
-+ }
- }
- #endif
-diff --git sc/source/ui/vba/makefile.mk sc/source/ui/vba/makefile.mk
-index 4cb7e3e..9974665 100644
---- sc/source/ui/vba/makefile.mk
-+++ sc/source/ui/vba/makefile.mk
-@@ -31,7 +31,7 @@ PRJNAME=sc
- TARGET=vbaobj
- ENABLE_EXCEPTIONS=TRUE
- VISIBILITY_HIDDEN=TRUE
--
-+CDEFS+=-DVBA_OOBUILD_HACK
- # --- Settings -----------------------------------------------------
-
- .INCLUDE : settings.mk
-@@ -63,18 +63,29 @@ SLOFILES= \
- $(SLO)$/vbacharttitle.obj \
- $(SLO)$/vbacomment.obj \
- $(SLO)$/vbacomments.obj \
-+ $(SLO)$/vbacommentshape.obj \
- $(SLO)$/vbacondition.obj \
- $(SLO)$/vbadialog.obj \
- $(SLO)$/vbadialogs.obj \
- $(SLO)$/vbaeventshelper.obj \
-+ $(SLO)$/vbafiledialog.obj \
-+ $(SLO)$/vbafiledialogselecteditems.obj \
-+ $(SLO)$/vbafilesearch.obj \
- $(SLO)$/vbafont.obj \
- $(SLO)$/vbaformat.obj \
- $(SLO)$/vbaformatcondition.obj \
- $(SLO)$/vbaformatconditions.obj \
-+ $(SLO)$/vbafoundfiles.obj \
- $(SLO)$/vbaglobals.obj \
- $(SLO)$/vbahyperlink.obj \
- $(SLO)$/vbahyperlinks.obj \
- $(SLO)$/vbainterior.obj \
-+ $(SLO)$/vbamenubar.obj \
-+ $(SLO)$/vbamenubars.obj \
-+ $(SLO)$/vbamenu.obj \
-+ $(SLO)$/vbamenus.obj \
-+ $(SLO)$/vbamenuitem.obj \
-+ $(SLO)$/vbamenuitems.obj \
- $(SLO)$/vbaname.obj \
- $(SLO)$/vbanames.obj \
- $(SLO)$/vbaoleobject.obj \
-@@ -88,6 +90,7 @@ SLOFILES= \
- $(SLO)$/vbapivotcache.obj \
- $(SLO)$/vbapivottable.obj \
- $(SLO)$/vbapivottables.obj \
-+ $(SLO)$/vbaquerytable.obj \
- $(SLO)$/vbarange.obj \
- $(SLO)$/vbaseriescollection.obj \
- $(SLO)$/vbasheetobject.obj \
-diff --git sc/source/ui/vba/testvba/testvba.cxx sc/source/ui/vba/testvba/testvba.cxx
-index 990a37a..058c874 100644
---- sc/source/ui/vba/testvba/testvba.cxx
-+++ sc/source/ui/vba/testvba/testvba.cxx
-@@ -159,15 +159,15 @@ mxCompLoader( _xCompLoader ), msOutDirPath( convertToURL( _outDirPath ) )
- Reference< script::provider::XScript > xScript;
- try
- {
-- xScript = xProv->getScript( rtl::OUString::createFromAscii( "vnd.sun.star.script:Standard.TestMacros.Main?language=Basic&location=document" ));
-+ xScript = xProv->getScript( rtl::OUString::createFromAscii( "vnd.sun.star.script:VBAProject.TestMacros.Main?language=Basic&location=document" ));
- } catch ( uno::Exception& e )
- {
- try
- {
-- xScript = xProv->getScript( rtl::OUString::createFromAscii( "vnd.sun.star.script:Standard.testMacro.Main?language=Basic&location=document" ));
-+ xScript = xProv->getScript( rtl::OUString::createFromAscii( "vnd.sun.star.script:VBAProject.testMacro.Main?language=Basic&location=document" ));
- } catch ( uno::Exception& e2 )
- {
-- xScript = xProv->getScript( rtl::OUString::createFromAscii( "vnd.sun.star.script:Standard.testMain.Main?language=Basic&location=document" ));
-+ xScript = xProv->getScript( rtl::OUString::createFromAscii( "vnd.sun.star.script:VBAProject.testMain.Main?language=Basic&location=document" ));
- }
- }
- OSL_TRACE("Got script for doc %s", rtl::OUStringToOString( sUrl, RTL_TEXTENCODING_UTF8 ).getStr() );
-diff --git sc/source/ui/vba/vbaapplication.cxx sc/source/ui/vba/vbaapplication.cxx
-index 63db284..d4a6ed5 100644
---- sc/source/ui/vba/vbaapplication.cxx
-+++ sc/source/ui/vba/vbaapplication.cxx
-@@ -27,11 +27,14 @@
-
- #include <stdio.h>
-
-+#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
-+#include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp>
- #include <com/sun/star/sheet/XSpreadsheetView.hpp>
- #include <com/sun/star/sheet/XSpreadsheets.hpp>
- #include <com/sun/star/view/XSelectionSupplier.hpp>
- #include <com/sun/star/lang/XServiceInfo.hpp>
- #include <ooo/vba/excel/XlCalculation.hpp>
-+#include <ooo/vba/excel/XlCutCopyMode.hpp>
- #include <com/sun/star/sheet/XCellRangeReferrer.hpp>
- #include <com/sun/star/sheet/XCalculatable.hpp>
- #include <com/sun/star/frame/XLayoutManager.hpp>
-@@ -40,6 +43,19 @@
- #include <ooo/vba/excel/XlMousePointer.hpp>
- #include <com/sun/star/sheet/XNamedRanges.hpp>
- #include <com/sun/star/sheet/XCellRangeAddressable.hpp>
-+#include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp>
-+#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
-+#include <com/sun/star/ui/dialogs/XFilePicker2.hpp>
-+#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
-+#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
-+//2009-11-06 add by limingl
-+#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
-+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
-+//end
-+#include<ooo/vba/XCommandBars.hpp>
-+#include <ooo/vba/excel/XlEnableCancelKey.hpp> //liuchen 2009-11-26
-+#include <ooo/vba/excel/XlApplicationInternational.hpp> //liuchen 2009-11-26
-+#include <unotools/localedatawrapper.hxx> //liuchen 2009-11-26
-
- #include "vbaapplication.hxx"
- #include "vbaworkbooks.hxx"
-@@ -51,25 +67,37 @@
- #include "vbawindow.hxx"
- #include "vbawindows.hxx"
- #include "vbaglobals.hxx"
-+#include "vbamenubars.hxx"
- #include "tabvwsh.hxx"
- #include "gridwin.hxx"
- #include "vbanames.hxx"
- #include <vbahelper/vbashape.hxx>
- #include "vbatextboxshape.hxx"
- #include "vbaassistant.hxx"
-+#include "vbafilesearch.hxx" //liuchen 2009-8-18, add the support of VBA Application.FileSearch
- #include "sc.hrc"
-+#include "macromgr.hxx"
-+#include "global.hxx" //liuchen 2009-11-26
-+#include "scmod.hxx" //liuchen 2009-11-26
-+#include "docoptio.hxx" //liuchen 2009-11-26
-+#include "appoptio.hxx"
-
- #include <osl/file.hxx>
-
-+#include <map>
-+
- #include <sfx2/request.hxx>
- #include <sfx2/objsh.hxx>
- #include <sfx2/viewfrm.hxx>
- #include <sfx2/app.hxx>
-
-+#include <comphelper/processfactory.hxx>
-+
- #include <toolkit/awt/vclxwindow.hxx>
- #include <toolkit/helper/vclunohelper.hxx>
-
- #include <tools/diagnose_ex.h>
-+#include <tools/urlobj.hxx>
-
- #include <docuno.hxx>
-
-@@ -78,15 +106,29 @@
- #include <basic/sbuno.hxx>
- #include <basic/sbmeth.hxx>
-
-+#include "transobj.hxx"
- #include "convuno.hxx"
- #include "cellsuno.hxx"
-+#include "miscuno.hxx"
-+#include "unonames.hxx"
- #include "docsh.hxx"
- #include <vbahelper/helperdecl.hxx>
- #include "excelvbahelper.hxx"
-
--
-+#include <basic/sbmeth.hxx>
-+#include <basic/sbmod.hxx>
-+#include <basic/sbstar.hxx>
-+#include <basic/sbx.hxx>
-+#include <basic/sbxobj.hxx>
-+#include <basic/sbuno.hxx>
-+//limingl 2009-07-20
-+#include "vbafiledialog.hxx"
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-+using ::com::sun::star::uno::Reference;
-+using ::com::sun::star::uno::UNO_QUERY_THROW;
-+using ::com::sun::star::uno::UNO_QUERY;
-+using ::rtl::OUString;
-
- // #TODO is this defined somewhere else?
- #if ( defined UNX ) || ( defined OS2 ) //unix
-@@ -243,16 +285,49 @@ ScVbaApplication::getAssistant() throw (uno::RuntimeException)
- return uno::Reference< XAssistant >( new ScVbaAssistant( this, mxContext ) );
- }
-
-+//liuchen 2009-8-18, add support of VBA Application.FileSearch
-+uno::Reference< XFileSearch > SAL_CALL
-+ScVbaApplication::getFileSearch() throw (uno::RuntimeException)
-+{
-+ if (! m_xFileSearch.get() )
-+ {
-+ m_xFileSearch = uno::Reference< XFileSearch >( new ScVbaFileSearch( this, uno::Reference< XHelperInterface >( this ), mxContext ) );
-+ }
-+
-+ return m_xFileSearch;
-+}
-+//liuchen
-+
- uno::Any SAL_CALL
- ScVbaApplication::getSelection() throw (uno::RuntimeException)
- {
- OSL_TRACE("** ScVbaApplication::getSelection() ** ");
- 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") )
-+
-+ Reference< view::XSelectionSupplier > xSelSupp( xModel->getCurrentController(), UNO_QUERY_THROW );
-+ Reference< beans::XPropertySet > xPropSet( xSelSupp, UNO_QUERY_THROW );
-+ OUString aPropName = OUString::createFromAscii( SC_UNO_FILTERED_RANGE_SELECTION );
-+ uno::Any aOldVal = xPropSet->getPropertyValue( aPropName );
-+ uno::Any any;
-+ any <<= sal_False;
-+ xPropSet->setPropertyValue( aPropName, any );
-+ uno::Reference< uno::XInterface > aSelection = ScUnoHelpFunctions::AnyToInterface(
-+ xSelSupp->getSelection() );
-+ xPropSet->setPropertyValue( aPropName, aOldVal );
-+
-+ if (!aSelection.is())
- {
-- uno::Reference< drawing::XShapes > xShapes( xModel->getCurrentSelection(), uno::UNO_QUERY_THROW );
-+ throw uno::RuntimeException(
-+ rtl::OUString::createFromAscii("failed to obtain current selection"),
-+ uno::Reference< uno::XInterface >() );
-+ }
-+
-+ uno::Reference< lang::XServiceInfo > xServiceInfo( aSelection, uno::UNO_QUERY_THROW );
-+ rtl::OUString sImplementationName = xServiceInfo->getImplementationName();
-+
-+ if( sImplementationName.equalsIgnoreAsciiCaseAscii("com.sun.star.drawing.SvxShapeCollection") )
-+ {
-+ uno::Reference< drawing::XShapes > xShapes( aSelection, 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
-@@ -271,10 +346,10 @@ ScVbaApplication::getSelection() throw (uno::RuntimeException)
- else if( xServiceInfo->supportsService( rtl::OUString::createFromAscii("com.sun.star.sheet.SheetCellRange")) ||
- xServiceInfo->supportsService( rtl::OUString::createFromAscii("com.sun.star.sheet.SheetCellRanges")))
- {
-- uno::Reference< table::XCellRange > xRange( getCurrentDocument()->getCurrentSelection(), ::uno::UNO_QUERY);
-+ uno::Reference< table::XCellRange > xRange( aSelection, ::uno::UNO_QUERY);
- if ( !xRange.is() )
- {
-- uno::Reference< sheet::XSheetCellRangeContainer > xRanges( getCurrentDocument()->getCurrentSelection(), ::uno::UNO_QUERY);
-+ uno::Reference< sheet::XSheetCellRangeContainer > xRanges( aSelection, ::uno::UNO_QUERY);
- if ( xRanges.is() )
- return uno::makeAny( uno::Reference< excel::XRange >( new ScVbaRange( excel::getUnoSheetModuleObj( xRanges ), mxContext, xRanges ) ) );
-
-@@ -283,7 +358,7 @@ ScVbaApplication::getSelection() throw (uno::RuntimeException)
- }
- else
- {
-- throw uno::RuntimeException( sImpementaionName + rtl::OUString::createFromAscii(" not suported"), uno::Reference< uno::XInterface >() );
-+ throw uno::RuntimeException( sImplementationName + rtl::OUString::createFromAscii(" not supported"), uno::Reference< uno::XInterface >() );
- }
- }
-
-@@ -372,16 +447,67 @@ ScVbaApplication::getActiveWindow() throw (uno::RuntimeException)
- uno::Any SAL_CALL
- ScVbaApplication::getCutCopyMode() throw (uno::RuntimeException)
- {
-- //# FIXME TODO, implementation
- uno::Any result;
-- result <<= sal_False;
-+ ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( NULL );
-+ ScDocument* pDoc = pOwnClip ? pOwnClip->GetDocument() : NULL;
-+ if ( pDoc )
-+ {
-+ if ( pDoc->IsCutMode() )
-+ {
-+ result <<= excel::XlCutCopyMode::xlCut;
-+ }
-+ else
-+ {
-+ result <<= excel::XlCutCopyMode::xlCopy;
-+ }
-+ }
-+ else
-+ {
-+ result <<= sal_False;
-+ }
- return result;
- }
-
- void SAL_CALL
--ScVbaApplication::setCutCopyMode( const uno::Any& /*_cutcopymode*/ ) throw (uno::RuntimeException)
--{
-- //# FIXME TODO, implementation
-+ScVbaApplication::setCutCopyMode( const uno::Any& _cutcopymode ) throw (uno::RuntimeException)
-+{
-+ // According to Excel's behavior, no matter what is the value of _cutcopymode, always releases the clip object.
-+ sal_Bool bCutCopyMode = sal_False;
-+ if ( ( _cutcopymode >>= bCutCopyMode ) )
-+ {
-+ ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( NULL );
-+ if ( pOwnClip )
-+ {
-+ pOwnClip->ObjectReleased();
-+ ScTabViewShell* pTabViewShell = excel::getBestViewShell( getCurrentDocument() );
-+ if ( pTabViewShell )
-+ {
-+ ScViewData* pView = pTabViewShell->GetViewData();
-+ Window* pWindow = pView ? pView->GetActiveWin() : NULL;
-+ if ( pWindow )
-+ {
-+ Reference< datatransfer::clipboard::XClipboard > xClipboard = pWindow->GetClipboard();
-+ Reference< datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( xClipboard, uno::UNO_QUERY );
-+ if ( xClipboard.is() )
-+ {
-+ xClipboard->setContents( NULL, NULL );
-+ if ( xFlushableClipboard.is() )
-+ {
-+ const sal_uInt32 nRef = Application::ReleaseSolarMutex();
-+ try
-+ {
-+ xFlushableClipboard->flushClipboard();
-+ }
-+ catch( const uno::Exception& )
-+ {
-+ }
-+ Application::AcquireSolarMutex( nRef );
-+ }
-+ }
-+ }
-+ }
-+ }
-+ }
- }
-
- uno::Any SAL_CALL
-@@ -730,6 +856,91 @@ ScVbaApplication::getEnableEvents() throw (uno::RuntimeException)
- return m_bEnableEvents;
- }
-
-+sal_Bool SAL_CALL
-+ScVbaApplication::getVisible() throw (uno::RuntimeException)
-+{
-+ sal_Bool bVisible = sal_True;
-+ return bVisible;
-+}
-+
-+void SAL_CALL
-+ScVbaApplication::setVisible(sal_Bool /*bVisible*/) throw (uno::RuntimeException)
-+{
-+}
-+
-+//liuchen 2009-11-25 add the support of Excel VBA Application.Iteration
-+//The Excel Iteration option is global and unique, but in Symphony there is an Iteration property in ScModule and one in every ScDocument,
-+//so the set method will set all the Iteration properties
-+sal_Bool SAL_CALL
-+ScVbaApplication::getIteration() throw (uno::RuntimeException)
-+{
-+ ScModule* pScMod = SC_MOD();
-+ ScDocOptions aDocOpt = pScMod->GetDocOptions();
-+
-+ return aDocOpt.IsIter();
-+}
-+
-+void SAL_CALL
-+ScVbaApplication::setIteration(sal_Bool bIteration) throw (uno::RuntimeException)
-+{
-+ ScModule* pScMod = SC_MOD();
-+ ScDocOptions& aDocOpt = const_cast< ScDocOptions& > (pScMod->GetDocOptions());
-+ aDocOpt.SetIter( bIteration );
-+
-+ uno::Any aIteration;
-+ aIteration <<= bIteration;
-+
-+ OUString aPropName = OUString::createFromAscii( "IsIterationEnabled" );
-+
-+ uno::Reference< XCollection > xWorkbooks( new ScVbaWorkbooks( this, mxContext ) );
-+ sal_Int32 nCount = xWorkbooks->getCount();
-+
-+ for (sal_Int32 i = 1; i <= nCount; i++)
-+ {
-+ uno::Reference< ooo::vba::excel::XWorkbook > xWorkbook;
-+ uno::Any aWorkbook = xWorkbooks->Item(uno::makeAny(i), uno::Any());
-+ aWorkbook >>= xWorkbook;
-+ ScVbaWorkbook* pWorkbook = static_cast< ScVbaWorkbook* > ( xWorkbook.get() );
-+
-+ uno::Reference< frame::XModel > xModel( pWorkbook->getDocModel(), uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xPropertySet( xModel, uno::UNO_QUERY_THROW );
-+ xPropertySet->setPropertyValue( aPropName, aIteration );
-+ }
-+}
-+//liuchen 2009-11-25 end
-+
-+//liuchen 2009-11-26 add the support of Excel VBA Application.EnableCancelKey
-+sal_Int32 SAL_CALL
-+ScVbaApplication::getEnableCancelKey() throw (uno::RuntimeException)
-+{
-+ return ooo::vba::excel::XlEnableCancelKey::xlDisabled;
-+}
-+
-+void SAL_CALL
-+ScVbaApplication::setEnableCancelKey(sal_Int32 /*lEnableCancelKey*/) throw (uno::RuntimeException)
-+{
-+}
-+//liuchen 2009-11-26 end
-+
-+sal_Int32 SAL_CALL ScVbaApplication::getSheetsInNewWorkbook() throw (uno::RuntimeException)
-+{
-+ const ScAppOptions& rAppOpt = SC_MOD()->GetAppOptions();
-+ return rAppOpt.GetTabCountInNewSpreadsheet();
-+}
-+
-+void SAL_CALL ScVbaApplication::setSheetsInNewWorkbook( sal_Int32 SheetsInNewWorkbook ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ if ( SheetsInNewWorkbook < 1 || SheetsInNewWorkbook > MAXTAB )
-+ {
-+ DebugHelper::exception( OUString::createFromAscii("The number must be between 1 and 255"), uno::Exception(), SbERR_METHOD_FAILED, OUString() );
-+ }
-+ else
-+ {
-+ ScAppOptions& rAppOpt = const_cast< ScAppOptions& >(SC_MOD()->GetAppOptions());
-+ rAppOpt.SetTabCountInNewSpreadsheet( SheetsInNewWorkbook );
-+ }
-+}
-+
- void SAL_CALL
- ScVbaApplication::Calculate() throw( script::BasicErrorException , uno::RuntimeException )
- {
-@@ -1218,13 +1429,19 @@ ScVbaApplication::Volatile( const uno::Any& aVolatile ) throw ( uno::RuntimeExc
- {
- sal_Bool bVolatile = sal_True;
- aVolatile >>= bVolatile;
-+ SbMethod* pMeth = StarBASIC::GetActiveMethod();
-+ if ( pMeth )
-+ {
-+ OSL_TRACE("ScVbaApplication::Volatile() In method ->%s<-", rtl::OUStringToOString( pMeth->GetName(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ uno::Reference< frame::XModel > xModel( getCurrentDocument() );
-+ ScDocument* pDoc = excel::getDocShell( xModel )->GetDocument();
-+ pDoc->GetMacroManager()->SetUserFuncVolatile( pMeth->GetName(), bVolatile);
-+ }
-+
-+// this is bound to break when loading the document
- return;
- }
-
--void SAL_CALL
--ScVbaApplication::DoEvents() throw ( uno::RuntimeException )
--{
--}
- ::sal_Bool SAL_CALL
- ScVbaApplication::getDisplayFormulaBar() throw ( css::uno::RuntimeException )
- {
-@@ -1276,12 +1493,421 @@ ScVbaApplication::Caller( const uno::Any& /*aIndex*/ ) throw ( uno::RuntimeExcep
- return aRet;
- }
-
-+//Add by minz@cn.ibm.com. 2009-07-08.
-+uno::Any SAL_CALL
-+ScVbaApplication::GetOpenFilename(const uno::Any& FileFilter, const uno::Any& FilterIndex, const uno::Any& Title, const uno::Any& ButtonText, const uno::Any& MultiSelect) throw (uno::RuntimeException)
-+{
-+ uno::Any aRet = uno::makeAny( sal_False );
-+ try
-+ {
-+ const ::rtl::OUString sServiceName = ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.FilePicker" );
-+ uno::Reference< lang::XMultiServiceFactory > xMSF( comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
-+ // Set the type of File Picker Dialog: TemplateDescription::FILEOPEN_SIMPLE.
-+ uno::Sequence< uno::Any > aDialogType( 1 );
-+ aDialogType[0] <<= ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE;
-+ uno::Reference< ui::dialogs::XFilePicker > xFilePicker( xMSF->createInstanceWithArguments( sServiceName, aDialogType ), UNO_QUERY );
-+ uno::Reference< ui::dialogs::XFilePicker2 > xFilePicker2( xFilePicker, UNO_QUERY );
-+ uno::Reference< ui::dialogs::XFilterManager > xFilterManager( xFilePicker, UNO_QUERY );
-+ uno::Reference< ui::dialogs::XExecutableDialog > xExecutableDialog( xFilePicker, UNO_QUERY );
-+ uno::Reference< ui::dialogs::XFilePickerControlAccess > xPickerControlAccess( xFilePicker, UNO_QUERY );
-+
-+ if ( xFilterManager.is() && FileFilter.hasValue() )
-+ {
-+ sal_Int32 nFilterIndex = 1;
-+ if ( FilterIndex.hasValue() )
-+ {
-+ FilterIndex >>= nFilterIndex;
-+ }
-+ ::rtl::OUString strFilter;
-+ FileFilter >>= strFilter;
-+ sal_Int32 nCommaID = 0;
-+ sal_Int32 nIndex = 1;
-+ do
-+ {
-+ ::rtl::OUString aFilterTitleToken = strFilter.getToken( 0, ',' , nCommaID );
-+ ::rtl::OUString aFilterToken;
-+ if ( nCommaID >= 0 )
-+ {
-+ aFilterToken = strFilter.getToken( 0, ',' , nCommaID );
-+ }
-+ else if ( nCommaID < 0 && nIndex == 1 )
-+ {
-+ throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid FileFilter format!" ), uno::Reference< uno::XInterface >() );
-+ }
-+ xFilterManager->appendFilter( aFilterTitleToken, aFilterToken );
-+ if ( nFilterIndex == nIndex )
-+ {
-+ xFilterManager->setCurrentFilter( aFilterTitleToken );
-+ }
-+ nIndex++;
-+ } while ( nCommaID >= 0 );
-+ }
-+ if ( xExecutableDialog.is() && Title.hasValue() )
-+ {
-+ ::rtl::OUString sTitle;
-+ Title >>= sTitle;
-+ xExecutableDialog->setTitle( sTitle );
-+ }
-+ if ( xPickerControlAccess.is() && ButtonText.hasValue() )
-+ {
-+ ::rtl::OUString sButtonText;
-+ ButtonText >>= sButtonText;
-+ xPickerControlAccess->setLabel( ui::dialogs::CommonFilePickerElementIds::PUSHBUTTON_OK, sButtonText );
-+ }
-+ sal_Bool bMultiSelect = sal_False;
-+ if ( xFilePicker.is() && MultiSelect.hasValue() )
-+ {
-+ MultiSelect >>= bMultiSelect;
-+ xFilePicker->setMultiSelectionMode( bMultiSelect );
-+ }
-+
-+ if ( xFilePicker.is() && xFilePicker->execute() )
-+ {
-+ sal_Bool bUseXFilePicker2 = sal_False;
-+ uno::Reference< lang::XServiceInfo > xServiceInfo( xFilePicker, UNO_QUERY );
-+ if ( xServiceInfo.is() )
-+ {
-+ rtl::OUString sImplName = xServiceInfo->getImplementationName();
-+ if ( sImplName.equalsAscii("com.sun.star.comp.fpicker.VistaFileDialog") || sImplName.equalsAscii("com.sun.star.ui.dialogs.SalGtkFilePicker") )
-+ {
-+ bUseXFilePicker2 = sal_True;
-+ }
-+ }
-+ uno::Sequence< rtl::OUString > aSelectedFiles;
-+ if ( bUseXFilePicker2 && xFilePicker2.is() )
-+ {
-+ // On Linux, XFilePicker->getFiles() always return one selected file although we select more than one file, also on Vista
-+ // XFilePicker->getFiles() does not work well too, so we call XFilePicker2->getSelectedFiles() to get selected files.
-+ aSelectedFiles = xFilePicker2->getSelectedFiles();
-+ }
-+ else
-+ {
-+ // If only one file is selected, the first entry of the sequence contains the complete path/filename in URL format. If multiple files are selected,
-+ // the first entry of the sequence contains the path in URL format, and the other entries contains the names of the selected files without path information.
-+ uno::Sequence< rtl::OUString > aTmpFiles = xFilePicker->getFiles();
-+ aSelectedFiles = aTmpFiles;
-+ sal_Int32 iFileCount = aTmpFiles.getLength();
-+ if ( iFileCount > 1 )
-+ {
-+ aSelectedFiles.realloc( iFileCount - 1 );
-+ INetURLObject aPath( aTmpFiles[0] );
-+ aPath.setFinalSlash();
-+ for ( sal_Int32 i = 1; i < iFileCount; i++ )
-+ {
-+ if ( aTmpFiles[i].indexOf ('/') > 0 || aTmpFiles[i].indexOf ('\\') > 0 )
-+ {
-+ aSelectedFiles[i - 1] = aTmpFiles[i];
-+ }
-+ else
-+ {
-+ if ( i == 1 )
-+ aPath.Append( aTmpFiles[i] );
-+ else
-+ aPath.setName( aTmpFiles[i] );
-+ aSelectedFiles[i - 1] = aPath.GetMainURL( INetURLObject::NO_DECODE );
-+ }
-+ }
-+ }
-+ }
-+
-+ sal_Int32 iFileCount = aSelectedFiles.getLength();
-+ for ( sal_Int32 i = 0; i < iFileCount; i++ )
-+ {
-+ INetURLObject aObj( aSelectedFiles[i] );
-+ if ( aObj.GetProtocol() == INET_PROT_FILE )
-+ {
-+ rtl::OUString aTemp = aObj.PathToFileName();
-+ aSelectedFiles[i] = aTemp.getLength() > 0 ? aTemp : aSelectedFiles[i];
-+ }
-+ }
-+ if ( bMultiSelect )
-+ {
-+ aRet = uno::makeAny( aSelectedFiles );
-+ }
-+ else if ( aSelectedFiles.getLength() > 0 && !bMultiSelect )
-+ {
-+ aRet = uno::makeAny( aSelectedFiles[0] );
-+ }
-+ }
-+ }
-+ catch( const uno::Exception& )
-+ {
-+ DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
-+ }
-+
-+ return aRet;
-+}
-+
-+//liming 2009-7-17
-+::com::sun::star::uno::Reference< ::ooo::vba::XFileDialog > SAL_CALL
-+ScVbaApplication::getFileDialog() throw (::com::sun::star::uno::RuntimeException)
-+{
-+ uno::Reference< XFileDialog > xFileDialogs( new ScVbaFileDialog( uno::Reference< XHelperInterface >( this ), mxContext, getCurrentDocument() ) );
-+ return xFileDialogs;
-+}
-+
-+typedef std::map< ::rtl::OUString, ::rtl::OUString > FileFilterMap;
-+
-+//2009-11-06 add by limingl
-+uno::Any SAL_CALL
-+ScVbaApplication::GetSaveAsFilename( const ::com::sun::star::uno::Any& InitialFilename, const ::com::sun::star::uno::Any& FileFilter, const ::com::sun::star::uno::Any& FilterIndex, const ::com::sun::star::uno::Any& Title, const ::com::sun::star::uno::Any& ButtonText ) throw (::com::sun::star::uno::RuntimeException)
-+{
-+ uno::Any strRet;
-+ try
-+ {
-+ const ::rtl::OUString sServiceName = ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.FilePicker" );
-+ uno::Reference< lang::XMultiServiceFactory > xMSF( comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
-+
-+ uno::Sequence< uno::Any > aDialogType( 1 );
-+ aDialogType[0] <<= ui::dialogs::TemplateDescription::FILESAVE_SIMPLE;
-+ uno::Reference< ui::dialogs::XFilePicker > xFilePicker( xMSF->createInstanceWithArguments( sServiceName, aDialogType ), UNO_QUERY );
-+
-+ if (InitialFilename.hasValue())
-+ {
-+ ::rtl::OUString strInitFileName;
-+ InitialFilename >>= strInitFileName;
-+ xFilePicker->setDefaultName(strInitFileName);
-+ }
-+
-+ // Begin from 1.
-+ sal_Int32 nFilterIndex = 1;
-+ if (FilterIndex.hasValue())
-+ {
-+ FilterIndex >>= nFilterIndex;
-+ }
-+
-+ uno::Reference< ui::dialogs::XFilterManager > xFilter( xFilePicker, UNO_QUERY );
-+ FileFilterMap mFilterNameMap;
-+ if (FileFilter.hasValue())
-+ {
-+ ::rtl::OUString strFilter;
-+ sal_Int32 nCommaID = 0;
-+ FileFilter >>= strFilter;
-+
-+ sal_Int32 nIndex = 1;
-+ do
-+ {
-+ ::rtl::OUString aFilterTitleToken = strFilter.getToken( 0, ',' , nCommaID );
-+ ::rtl::OUString aFilterToken;
-+ if ( nCommaID >= 0 )
-+ {
-+ aFilterToken = strFilter.getToken( 0, ',' , nCommaID );
-+ }
-+ else if ( nCommaID < 0 && nIndex == 1 )
-+ {
-+ throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid FileFilter format!" ), uno::Reference< uno::XInterface >() );
-+ }
-+
-+ FileFilterMap::const_iterator aIt = mFilterNameMap.find( aFilterTitleToken );
-+ if ( aIt == mFilterNameMap.end() )
-+ {
-+ xFilter->appendFilter( aFilterTitleToken, aFilterToken );
-+ if ( nFilterIndex == nIndex )
-+ {
-+ xFilter->setCurrentFilter( aFilterTitleToken );
-+ }
-+ nIndex++;
-+ mFilterNameMap[aFilterTitleToken] = aFilterToken;
-+ }
-+ } while ( nCommaID >= 0 );
-+ }
-+
-+ if (Title.hasValue())
-+ {
-+ ::rtl::OUString strTitle;
-+ Title >>= strTitle;
-+ uno::Reference< ::com::sun::star::ui::dialogs::XExecutableDialog> xExcTblDlg(xFilePicker, UNO_QUERY );
-+ xExcTblDlg->setTitle(strTitle);
-+ }
-+
-+ if (ButtonText.hasValue())
-+ {
-+ ::rtl::OUString strBttTxt;
-+ ButtonText >>= strBttTxt;
-+ }
-+
-+
-+ if ( xFilePicker.is() )
-+ {
-+ sal_Int16 nRet = xFilePicker->execute();
-+ if (nRet == 0)
-+ {
-+ strRet <<= sal_False;
-+ }
-+ else
-+ {
-+ uno::Sequence < rtl::OUString > aPathSeq = xFilePicker->getFiles();
-+
-+ if ( aPathSeq.getLength() )
-+ {
-+ ::rtl::OUString sSelectedFilters;
-+ if ( xFilter.is() )
-+ {
-+ ::rtl::OUString sSelectedFilterName = xFilter->getCurrentFilter();
-+ FileFilterMap::const_iterator aIt = mFilterNameMap.find( sSelectedFilterName );
-+ if ( aIt != mFilterNameMap.end() )
-+ {
-+ sSelectedFilters = aIt->second;
-+ }
-+ }
-+ INetURLObject aURLObj( aPathSeq[0] );
-+ ::rtl::OUString aPathStr = aURLObj.PathToFileName();
-+ if ( aURLObj.GetProtocol() == INET_PROT_FILE )
-+ {
-+ sal_Int32 nSemicolonID = 0;
-+ ::rtl::OUString sFirstFilter = sSelectedFilters.getToken( 0, ';' , nSemicolonID );
-+ ::rtl::OUString sFileExtension = aURLObj.GetExtension();
-+ if ( sFileExtension.equalsAscii("") )
-+ {
-+ sFileExtension = sFirstFilter.equalsAscii("*.*") ? sFileExtension : sFirstFilter.copy( sFirstFilter.indexOfAsciiL("*.", 2) + 2 );
-+ aPathStr = sFileExtension.equalsAscii("") ? aPathStr : aPathStr + ::rtl::OUString::createFromAscii(".") + sFileExtension;
-+ }
-+ else
-+ {
-+ sal_Bool bValidFilter = sal_False;
-+ FileFilterMap::const_iterator aIt = mFilterNameMap.begin();
-+ while ( aIt != mFilterNameMap.end() )
-+ {
-+ sSelectedFilters = aIt->second;
-+ nSemicolonID = 0;
-+ do
-+ {
-+ ::rtl::OUString aFilterToken = sSelectedFilters.getToken( 0, ';' , nSemicolonID );
-+ if ( aFilterToken.trim().equalsIgnoreAsciiCase(::rtl::OUString::createFromAscii("*.") + sFileExtension) )
-+ {
-+ bValidFilter = sal_True;
-+ break;
-+ }
-+ } while ( nSemicolonID >= 0 );
-+ if ( bValidFilter )
-+ {
-+ break;
-+ }
-+ aIt++;
-+ }
-+ if ( !bValidFilter )
-+ {
-+ sFileExtension = sFirstFilter.equalsAscii("*.*") ? ::rtl::OUString::createFromAscii("") : sFirstFilter.copy( sFirstFilter.indexOfAsciiL("*.", 2) + 2 );
-+ aPathStr = sFileExtension.equalsAscii("") ? aPathStr : aPathStr + ::rtl::OUString::createFromAscii(".") + sFileExtension;
-+ }
-+ }
-+ }
-+ strRet <<= aPathStr;
-+ }
-+ }
-+ }
-+ }
-+ catch( const uno::Exception& )
-+ {
-+ DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
-+ }
-+ return strRet;
-+}
-+
-+//end add
-+
- uno::Reference< frame::XModel >
- ScVbaApplication::getCurrentDocument() throw (css::uno::RuntimeException)
- {
- return getCurrentExcelDoc(mxContext);
- }
-
-+uno::Any SAL_CALL
-+ScVbaApplication::MenuBars( const uno::Any& aIndex ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< XCommandBars > xCommandBars( CommandBars( uno::Any() ), uno::UNO_QUERY_THROW );
-+ uno::Reference< XCollection > xMenuBars( new ScVbaMenuBars( this, mxContext, xCommandBars ) );
-+ if ( aIndex.hasValue() )
-+ {
-+ return uno::Any ( xMenuBars->Item( aIndex, uno::Any() ) );
-+ }
-+
-+ return uno::Any( xMenuBars );
-+}
-+
-+//liuchen 2009-11-26 add the support of Application.International
-+sal_Int32 SAL_CALL
-+ConvertCountryCode(const OUString& language)
-+{
-+ sal_Int32 nCode = 0;
-+
-+ if( language == OUString::createFromAscii("ar") ) nCode = 966; // Arabic
-+ else if ( language == OUString::createFromAscii("cs") ) nCode = 42; // Czech
-+ else if ( language == OUString::createFromAscii("da") ) nCode = 45; // Danish
-+ else if ( language == OUString::createFromAscii("de") ) nCode = 49; // German
-+ else if ( language == OUString::createFromAscii("en") ) nCode = 1; // English
-+ else if ( language == OUString::createFromAscii("es") ) nCode = 34; // Spanish
-+ else if ( language == OUString::createFromAscii("el") ) nCode = 30; // Greek
-+ else if ( language == OUString::createFromAscii("fa") ) nCode = 98; // Persian = Farsi
-+ else if ( language == OUString::createFromAscii("fi") ) nCode = 358; // Finnish
-+ else if ( language == OUString::createFromAscii("fr") ) nCode = 33; // French
-+ else if ( language == OUString::createFromAscii("he") ) nCode = 972; // Hebrew
-+ else if ( language == OUString::createFromAscii("hi") ) nCode = 91; // Indian = Hindi
-+ else if ( language == OUString::createFromAscii("hu") ) nCode = 36; // Hungarian
-+ else if ( language == OUString::createFromAscii("it") ) nCode = 39; // Italian
-+ else if ( language == OUString::createFromAscii("ja") ) nCode = 81; // Japanese
-+ else if ( language == OUString::createFromAscii("ko") ) nCode = 82; // Korean
-+ else if ( language == OUString::createFromAscii("nl") ) nCode = 31; // Dutch
-+ else if ( language == OUString::createFromAscii("no") ) nCode = 47; // Norwegian
-+ else if ( language == OUString::createFromAscii("pl") ) nCode = 48; // Polish
-+ else if ( language == OUString::createFromAscii("pt") ) nCode = 351; // Portuguese
-+ else if ( language == OUString::createFromAscii("ru") ) nCode = 7; // Russian
-+ else if ( language == OUString::createFromAscii("sv") ) nCode = 46; // Swedish
-+ else if ( language == OUString::createFromAscii("th") ) nCode = 66; // Thai
-+ else if ( language == OUString::createFromAscii("tk") ) nCode = 90; // Turkish
-+ else if ( language == OUString::createFromAscii("ur") ) nCode = 92; // Urdu
-+ else if ( language == OUString::createFromAscii("vi") ) nCode = 84; // Vietnamese
-+ else if ( language == OUString::createFromAscii("zh") ) nCode = 86; // Simplified Chinese
-+
-+ return nCode;
-+}
-+
-+uno::Any SAL_CALL
-+ScVbaApplication::International( sal_Int32 Index ) throw (uno::RuntimeException)
-+{
-+ uno::Any aRet;
-+ OUString str;
-+ const LocaleDataWrapper* pLocaleData = ScGlobal::GetpLocaleData();
-+ switch ( Index )
-+ {
-+ case excel::XlApplicationInternational::xlCountryCode:
-+ aRet <<= ConvertCountryCode( pLocaleData->getLanguageCountryInfo().Language );
-+ break;
-+ case excel::XlApplicationInternational::xlDecimalSeparator:
-+ str = pLocaleData->getNumDecimalSep();
-+ aRet <<= str;
-+ break;
-+ case excel::XlApplicationInternational::xlDateSeparator:
-+ str = pLocaleData->getDateSep();
-+ aRet <<= str;
-+ break;
-+ default:
-+ break;
-+ }
-+ return aRet;
-+}
-+//liuchen 2009-11-26 end
-+
-+//2009-12-11 add by limingl
-+void SAL_CALL ScVbaApplication::Undo( ) throw (::com::sun::star::uno::RuntimeException)
-+{
-+ SfxAllItemSet reqList( SFX_APP()->GetPool() );
-+ SfxRequest rReq(SID_UNDO, 0, reqList);
-+ ScTabViewShell* pViewShell = excel::getCurrentBestViewShell( mxContext );
-+
-+ if (pViewShell != NULL)
-+ {
-+ pViewShell->ExecuteUndo(rReq);
-+ }
-+}
-+//end
-+
-+double SAL_CALL ScVbaApplication::InchesToPoints( double Inches ) throw (uno::RuntimeException)
-+{
-+ // Convert a measurement from Inch to Point (1 inch = 72 points).
-+ return MetricField::ConvertDoubleValue( Inches, 0, 0, FUNIT_INCH, FUNIT_POINT );
-+}
-+
- rtl::OUString&
- ScVbaApplication::getServiceImplName()
- {
-diff --git sc/source/ui/vba/vbaapplication.hxx sc/source/ui/vba/vbaapplication.hxx
-index e6ebe28..a25455d 100644
---- sc/source/ui/vba/vbaapplication.hxx
-+++ sc/source/ui/vba/vbaapplication.hxx
-@@ -47,6 +47,7 @@ private:
- sal_Bool m_bEnableEvents;
-
- rtl::OUString getOfficePath( const rtl::OUString& sPath ) throw ( css::uno::RuntimeException );
-+ css::uno::Reference< ov::XFileSearch > m_xFileSearch; //
-
- protected:
- virtual css::uno::Reference< css::frame::XModel > getCurrentDocument() throw (css::uno::RuntimeException);
-@@ -89,6 +90,7 @@ public:
- 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::Reference< ov::XFileSearch > SAL_CALL getFileSearch() throw (css::uno::RuntimeException); //liuchen 2009-8-18 add the support of Application.FileSearch
- 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);
-@@ -101,6 +103,17 @@ public:
- virtual void SAL_CALL setStatusBar( const css::uno::Any& _statusbar ) throw (css::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getCursor() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setCursor( ::sal_Int32 _cursor ) throw (css::uno::RuntimeException);
-+
-+ virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setVisible( sal_Bool bVisible ) throw (css::uno::RuntimeException);
-+
-+ virtual sal_Bool SAL_CALL getIteration() throw (css::uno::RuntimeException); //liuchen 2009-11-25 add the support of Iteration
-+ virtual void SAL_CALL setIteration( sal_Bool bIteration ) throw (css::uno::RuntimeException); //liuchen 2009-11-25 add the support of Iteration
-+ virtual sal_Int32 SAL_CALL getEnableCancelKey() throw (css::uno::RuntimeException); //liuchen 2009-11-26 add the support of EnableCancelKey
-+ virtual void SAL_CALL setEnableCancelKey( sal_Int32 lEnableCancelKey ) throw (css::uno::RuntimeException); //liuchen 2009-11-26 add the support of EnableCancelKey
-+
-+ virtual sal_Int32 SAL_CALL getSheetsInNewWorkbook() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setSheetsInNewWorkbook( sal_Int32 SheetsInNewWorkbook ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-
- virtual sal_Bool SAL_CALL getEnableEvents() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setEnableEvents( sal_Bool bEnable ) throw (css::uno::RuntimeException);
-@@ -114,8 +130,16 @@ public:
- 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);
- 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);
-+ virtual css::uno::Any SAL_CALL MenuBars( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL GetOpenFilename( const css::uno::Any& FileFilter, const css::uno::Any& FilterIndex, const css::uno::Any& Title, const css::uno::Any& ButtonText, const css::uno::Any& MultiSelect ) throw (css::uno::RuntimeException);
-+ virtual ::com::sun::star::uno::Reference< ::ooo::vba::XFileDialog > SAL_CALL getFileDialog() throw (::com::sun::star::uno::RuntimeException); //liminl 2009-08-12 add
-+ virtual css::uno::Any SAL_CALL International( sal_Int32 Index ) throw (css::uno::RuntimeException); //liuchen 2009-11-26
-+ //2009-12-04 add by limingl
-+ virtual css::uno::Any SAL_CALL GetSaveAsFilename( const ::com::sun::star::uno::Any& InitialFilename, const ::com::sun::star::uno::Any& FileFilter, const ::com::sun::star::uno::Any& FilterIndex, const ::com::sun::star::uno::Any& Title, const ::com::sun::star::uno::Any& ButtonText ) throw (::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL Undo( ) throw (::com::sun::star::uno::RuntimeException);
-+ virtual double SAL_CALL InchesToPoints( double Inches ) throw (css::uno::RuntimeException);
-+
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-diff --git sc/source/ui/vba/vbacomment.cxx sc/source/ui/vba/vbacomment.cxx
-index 797b080..3d2c791 100644
---- sc/source/ui/vba/vbacomment.cxx
-+++ sc/source/ui/vba/vbacomment.cxx
-@@ -33,14 +33,23 @@
- #include <com/sun/star/sheet/XSheetAnnotationsSupplier.hpp>
- #include <com/sun/star/sheet/XSheetAnnotationShapeSupplier.hpp>
- #include <com/sun/star/sheet/XSheetCellRange.hpp>
-+#include <com/sun/star/sheet/XCellAddressable.hpp>
- #include <com/sun/star/table/CellAddress.hpp>
- #include <com/sun/star/table/XCell.hpp>
- #include <com/sun/star/text/XText.hpp>
-
-+#include <cellsuno.hxx>
-+#include <postit.hxx>
-+#include <svx/svdobj.hxx>
-+#include <svx/svdocapt.hxx>
-+#include <ooo/vba/msforms/XShape.hpp>
-+#include <com/sun/star/drawing/XShape.hpp>
-+#include <com/sun/star/frame/XModel.hpp>
-+
- #include <vbahelper/vbashape.hxx>
- #include "vbaglobals.hxx"
- #include "vbacomments.hxx"
--
-+#include "vbacommentshape.hxx"
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-@@ -178,8 +187,7 @@ ScVbaComment::Text( const uno::Any& aText, const uno::Any& aStart, const uno::An
- aText >>= sText;
-
- uno::Reference< text::XSimpleText > xAnnoText( getAnnotation(), uno::UNO_QUERY_THROW );
-- rtl::OUString sAnnoText = xAnnoText->getString();
--
-+
- if ( aStart.hasValue() )
- {
- sal_Int16 nStart = 0;
-@@ -212,10 +220,12 @@ ScVbaComment::Text( const uno::Any& aText, const uno::Any& aStart, const uno::An
- }
- else if ( aText.hasValue() )
- {
-- xAnnoText->setString( sText );
-- return sText;
-+ uno::Reference< sheet::XCellAddressable > xCellAddr(mxRange->getCellByPosition(0, 0), uno::UNO_QUERY_THROW );
-+ table::CellAddress aAddress = xCellAddr->getCellAddress();
-+ getAnnotations()->insertNew( aAddress, sText );
- }
-
-+ rtl::OUString sAnnoText = xAnnoText->getString();
- return sAnnoText;
- }
-
-diff --git sc/source/ui/vba/vbacommentshape.cxx sc/source/ui/vba/vbacommentshape.cxx
-new file mode 100644
-index 0000000..ab97ac4
---- /dev/null
-+++ sc/source/ui/vba/vbacommentshape.cxx
-@@ -0,0 +1,46 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009, 2010.
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#include "vbacommentshape.hxx"
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+
-+ScVbaCommentShape::ScVbaCommentShape( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape >& xShape, const uno::Reference< excel::XComment >& xComment,
-+ const uno::Reference< drawing::XShapes >& xShapes, const uno::Reference< frame::XModel >& xModel, sal_Int32 nType ) : ScVbaShape( xParent, xContext, xShape, xShapes, xModel, nType )
-+{
-+ m_xComment.set( xComment, uno::UNO_QUERY );
-+}
-+
-+void SAL_CALL ScVbaCommentShape::Delete() throw (uno::RuntimeException)
-+{
-+ if ( m_xComment.is() )
-+ {
-+ m_xComment->Delete();
-+ }
-+}
-diff --git sc/source/ui/vba/vbacommentshape.hxx sc/source/ui/vba/vbacommentshape.hxx
-new file mode 100644
-index 0000000..ce1c9ed
---- /dev/null
-+++ sc/source/ui/vba/vbacommentshape.hxx
-@@ -0,0 +1,46 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009, 2010.
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef SC_VBA_COMMENTSHAPE_HXX
-+#define SC_VBA_COMMENTSHAPE_HXX
-+
-+#include <ooo/vba/excel/XComment.hpp>
-+#include <vbahelper/vbashape.hxx>
-+
-+class ScVbaCommentShape : public ScVbaShape
-+{
-+ css::uno::Reference< ooo::vba::excel::XComment > m_xComment;
-+
-+public:
-+ ScVbaCommentShape( 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< ooo::vba::excel::XComment >& xComment, const css::uno::Reference< css::drawing::XShapes >& xShapes, const css::uno::Reference< css::frame::XModel >& xModel, sal_Int32 nType );
-+
-+ // Methods
-+ virtual void SAL_CALL Delete() throw (css::uno::RuntimeException);
-+};
-+#endif //SC_VBA_COMMENTSHAPE_HXX
-diff --git sc/source/ui/vba/vbadialog.cxx sc/source/ui/vba/vbadialog.cxx
-index 891ac75..db56765 100644
---- sc/source/ui/vba/vbadialog.cxx
-+++ sc/source/ui/vba/vbadialog.cxx
-@@ -29,42 +29,58 @@
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-
--static const rtl::OUString aStringList[]=
-+//liuchen 2009-7-27
-+//solve the problem that "Application.Dialogs.Item(***).Show" and "Application.Dialogs.Count" cannot get the correct result
-+struct DialogMatch
- {
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Open" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormatCellDialog" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertCell" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Print" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:PasteSpecial" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ToolProtectionDocument" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ColumnWidth" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DefineName" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ConfigureDialog" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:HyperlinkDialog" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertGraphic" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertObject" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:PageFormatDialog" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DataSort" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:RowHeight" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:AutoCorrectDlg" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ConditionalFormatDialog" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DataConsolidate" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CreateNames" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillSeries" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Validation") ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DefineLabelRange" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DataFilterAutoFilter" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DataFilterSpecialFilter" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:AutoFormat" ) )
-+ sal_Int32 nVbaDlgIndex;
-+ rtl::OUString aOODlgName;
- };
-
--const sal_Int32 nDialogSize = SAL_N_ELEMENTS( aStringList ) ;
-+static const DialogMatch aDialogMatchList[] =
-+{
-+ { 1, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Open" ) ) }, // xlDialogOpen -> .uno:Open
-+ { -1, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormatCellDialog" ) ) }, // ??? -> .uno:FormatCellDialog
-+ { 55, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertCell" ) ) }, // xlDialogInsert -> .uno:InsertCell
-+ { 8, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Print" ) ) }, // xlDialogPrint -> .uno:Print
-+ { 9, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:PrinterSetup" ) ) }, // xlDialogPrinterSetup -> .uno:PrinterSetup
-+ { 53, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:PasteSpecial" ) ) }, // xlDialogPasteSpecial -> .uno:PasteSpecial
-+ { 28, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ToolProtectionDocument" ) ) }, // xlDialogProtectDocument -> uno:ToolProtectionDocument
-+ { 47, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ColumnWidth" ) ) }, // xlDialogColumnWidth -> .uno:ColumnWidth
-+ { 61, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DefineName" ) ) }, // xlDialogDefineName -> .uno:DefineName
-+ { -1, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ConfigureDialog" ) ) }, // ??? -> .uno:ConfigureDialog
-+ { 596, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:HyperlinkDialog" ) ) }, // xlDialogInsertHyperlink -> .uno:HyperlinkDialog
-+ { 342, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertGraphic" ) ) }, // xlDialogInsertPicture -> .uno:InsertGraphic
-+ { 259, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertObject" ) ) }, // xlDialogInsertObject -> .uno:InsertObject
-+ { 7, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:PageFormatDialog" ) ) }, // xlDialogPageSetup -> .uno:PageFormatDialog
-+ { 39, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DataSort" ) ) }, // xlDialogSort -> .uno:DataSort
-+ { 127, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:RowHeight" ) ) }, // xlDialogRowHeight -> .uno:RowHeight
-+ { 485, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:AutoCorrectDlg" ) ) }, // xlDialogAutoCorrect -> .uno:AutoCorrectDlg
-+ { 583, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ConditionalFormatDialog" ) ) }, // xlDialogCondiationalFormatting -> .uno:ConditionalFormatDialog
-+ { 191, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DataConsolidate" ) ) }, // xlDialogConsolidate -> .uno:DataConsolidate
-+ { 62, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CreateNames" ) ) }, // xlDialogCreateNames -> .uno:CreateNames
-+ { -1, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillSeries" ) ) }, // ??? -> .uno:FillSeries
-+ { -1, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Validation" ) ) }, // ??? -> .uno:Validation"
-+ { -1, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DefineLabelRange" ) ) }, // ??? -> .uno:DefineLabelRange
-+ { -1, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DataFilterAutoFilter" ) ) }, // ??? -> .uno:DataFilterAutoFilter
-+ { -1, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DataFilterSpecialFilter" ) ) }, // ??? -> .uno:DataFilterSpecialFilter
-+ { 269, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:AutoFormat" ) ) } // xlDialogFormatAuto -> .uno:AutoFormat
-+};
-+
-+const sal_Int32 nDialogSize = SAL_N_ELEMENTS( aDialogMatchList ) ;;
-
-+//liuchen modified 2009-2-27
- rtl::OUString
- ScVbaDialog::mapIndexToName( sal_Int32 nIndex )
- {
-- if( nIndex < nDialogSize )
-- return aStringList[ nIndex ];
-+ for (int i = 0; i < nDialogSize; i++)
-+ {
-+ if ( aDialogMatchList[i].nVbaDlgIndex == nIndex )
-+ {
-+ return aDialogMatchList[i].aOODlgName;
-+ }
-+ }
-+
- return rtl::OUString();
- }
-
-@@ -86,3 +102,9 @@ ScVbaDialog::getServiceNames()
- }
- return aServiceNames;
- }
-+
-+//liuchen add 2009-7-27
-+sal_Int32 ScVbaDialog::GetSupportedDialogCount()
-+{
-+ return nDialogSize;
-+}
-\ No newline at end of file
-diff --git sc/source/ui/vba/vbadialog.hxx sc/source/ui/vba/vbadialog.hxx
-index a886fe3..ffbfb84 100644
---- sc/source/ui/vba/vbadialog.hxx
-+++ sc/source/ui/vba/vbadialog.hxx
-@@ -45,6 +45,9 @@ public:
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+
-+ //liuchen 2009-7-27
-+ static sal_Int32 GetSupportedDialogCount();
- };
-
- #endif /* SC_VBA_DIALOG_HXX */
-diff --git sc/source/ui/vba/vbadialogs.cxx sc/source/ui/vba/vbadialogs.cxx
-index 16d3dcb..0ff0bb6 100644
---- sc/source/ui/vba/vbadialogs.cxx
-+++ sc/source/ui/vba/vbadialogs.cxx
-@@ -64,5 +64,13 @@ ScVbaDialogs::getServiceNames()
- return aServiceNames;
- }
-
-+//liuchen 2009-7-27
-+::sal_Int32
-+ScVbaDialogs::getCount() throw (uno::RuntimeException)
-+{
-+ return ScVbaDialog::GetSupportedDialogCount();
-+}
-+
-+
-
-
-diff --git sc/source/ui/vba/vbadialogs.hxx sc/source/ui/vba/vbadialogs.hxx
-index 20fae2d..980dbf9 100644
---- sc/source/ui/vba/vbadialogs.hxx
-+++ sc/source/ui/vba/vbadialogs.hxx
-@@ -44,6 +44,7 @@ public:
-
- // XCollection
- virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException); //liuchen 2009-7-27
-
- // XDialogs
- virtual void SAL_CALL Dummy() throw (css::uno::RuntimeException);
-diff --git sc/source/ui/vba/vbafiledialog.cxx sc/source/ui/vba/vbafiledialog.cxx
-new file mode 100644
-index 0000000..b7fa59f
---- /dev/null
-+++ sc/source/ui/vba/vbafiledialog.cxx
-@@ -0,0 +1,186 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009, 2010.
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#include "vbafiledialog.hxx"
-+#include "comphelper/processfactory.hxx"
-+#include <com/sun/star/lang/XServiceInfo.hpp>
-+#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
-+#include <com/sun/star/ui/dialogs/XFilePicker2.hpp>
-+#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
-+#include "tools/urlobj.hxx"
-+
-+
-+using namespace ::com::sun::star;
-+using namespace ::com::sun::star::uno;
-+
-+
-+ScVbaFileDialog::ScVbaFileDialog( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext, const css::uno::Reference< css::frame::XModel >& xModel )
-+: ScVbaFileDialog_BASE( xParent, xContext, xModel )
-+{
-+ m_pFileDialogSelectedItems = new VbaFileDialogSelectedItems(xParent, xContext, (com::sun::star::container::XIndexAccess *)&m_FileDialogSelectedObj);
-+}
-+
-+ScVbaFileDialog::~ScVbaFileDialog()
-+{
-+ if (m_pFileDialogSelectedItems != NULL)
-+ {
-+ delete m_pFileDialogSelectedItems;
-+ }
-+}
-+
-+rtl::OUString&
-+ScVbaFileDialog::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaFileDialog") );
-+ return sImplName;
-+}
-+
-+css::uno::Sequence<rtl::OUString>
-+ScVbaFileDialog::getServiceNames()
-+{
-+ static Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.FileDialog" ) );
-+ }
-+ return aServiceNames;
-+
-+}
-+
-+css::uno::Reference< ov::XFileDialogSelectedItems > SAL_CALL
-+ScVbaFileDialog::getSelectedItems() throw (css::uno::RuntimeException)
-+{
-+ css::uno::Reference< ov::XFileDialogSelectedItems > xFileDlgSlc = (ov::XFileDialogSelectedItems *)m_pFileDialogSelectedItems;
-+ return xFileDlgSlc;
-+}
-+
-+::sal_Int32 SAL_CALL
-+ScVbaFileDialog::Show( ) throw (::com::sun::star::uno::RuntimeException)
-+{
-+ // Returns an Integer indicating if user pressed "Open" button(-1) or "Cancel" button(0).
-+ sal_Int32 nResult = -1;
-+ try
-+ {
-+ m_sSelectedItems.realloc(0);
-+
-+ const ::rtl::OUString sServiceName = ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.FilePicker" );
-+
-+ Reference< lang::XMultiServiceFactory > xMSF( comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
-+ // Set the type of File Picker Dialog: TemplateDescription::FILEOPEN_SIMPLE.
-+ Sequence< uno::Any > aDialogType( 1 );
-+ aDialogType[0] <<= ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE;
-+ Reference < ui::dialogs::XFilePicker > xFilePicker( xMSF->createInstanceWithArguments( sServiceName, aDialogType ), UNO_QUERY );
-+ Reference < ui::dialogs::XFilePicker2 > xFilePicker2( xFilePicker, UNO_QUERY );
-+ if ( xFilePicker.is() )
-+ {
-+ xFilePicker->setMultiSelectionMode(sal_True);
-+ if ( xFilePicker->execute() )
-+ {
-+ sal_Bool bUseXFilePicker2 = sal_False;
-+ Reference< lang::XServiceInfo > xServiceInfo( xFilePicker, UNO_QUERY );
-+ if (xServiceInfo.is())
-+ {
-+ rtl::OUString sImplName = xServiceInfo->getImplementationName();
-+ if (sImplName.equalsAscii("com.sun.star.comp.fpicker.VistaFileDialog") ||
-+ sImplName.equalsAscii("com.sun.star.ui.dialogs.SalGtkFilePicker"))
-+ {
-+ bUseXFilePicker2 = sal_True;
-+ }
-+ }
-+ if ( bUseXFilePicker2 && xFilePicker2.is() )
-+ {
-+ // On Linux, XFilePicker->getFiles() always return one selected file although we select
-+ // more than one file, also on Vista XFilePicker->getFiles() does not work well too,
-+ // so we call XFilePicker2->getSelectedFiles() to get selected files.
-+ m_sSelectedItems = xFilePicker2->getSelectedFiles();
-+ }
-+ else
-+ {
-+ // If only one file is selected, the first entry of the sequence contains the complete path/filename in
-+ // URL format. If multiple files are selected, the first entry of the sequence contains the path in URL
-+ // format, and the other entries contains the names of the selected files without path information.
-+ Sequence< rtl::OUString > aSelectedFiles = xFilePicker->getFiles();
-+ sal_Int32 iFileCount = aSelectedFiles.getLength();
-+ if ( iFileCount > 1 )
-+ {
-+ m_sSelectedItems.realloc( iFileCount - 1 );
-+ INetURLObject aPath( aSelectedFiles[0] );
-+ aPath.setFinalSlash();
-+ for ( sal_Int32 i = 1; i < iFileCount; i++ )
-+ {
-+ if ( aSelectedFiles[i].indexOf ('/') > 0 || aSelectedFiles[i].indexOf ('\\') > 0 )
-+ {
-+ m_sSelectedItems[i - 1] = aSelectedFiles[i];
-+ }
-+ else
-+ {
-+ if ( i == 1 )
-+ aPath.Append( aSelectedFiles[i] );
-+ else
-+ aPath.setName( aSelectedFiles[i] );
-+ m_sSelectedItems[i - 1] = aPath.GetMainURL(INetURLObject::NO_DECODE);
-+ }
-+ }
-+ }
-+ else if ( iFileCount == 1 )
-+ {
-+ m_sSelectedItems = aSelectedFiles;
-+ }
-+ }
-+
-+ sal_Int32 iFileCount = m_sSelectedItems.getLength();
-+ rtl::OUString aTemp;
-+ for ( sal_Int32 i = 0; i < iFileCount; i++ )
-+ {
-+ INetURLObject aObj( m_sSelectedItems[i] );
-+ if ( aObj.GetProtocol() == INET_PROT_FILE )
-+ {
-+ aTemp = aObj.PathToFileName();
-+ m_sSelectedItems[i] = aTemp.getLength() > 0 ? aTemp : m_sSelectedItems[i];
-+ }
-+ }
-+ }
-+ else
-+ {
-+ nResult = 0;
-+ }
-+ }
-+
-+ m_FileDialogSelectedObj.SetSelectedFile(m_sSelectedItems);
-+ }
-+ catch( const uno::Exception& )
-+ {
-+ return 0;
-+ }
-+
-+ return nResult;
-+}
-+
-+
-+
-diff --git sc/source/ui/vba/vbafiledialog.hxx sc/source/ui/vba/vbafiledialog.hxx
-new file mode 100644
-index 0000000..2273e4b
---- /dev/null
-+++ sc/source/ui/vba/vbafiledialog.hxx
-@@ -0,0 +1,60 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009, 2010.
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef _vbafiledialog_hxx_
-+#define _vbafiledialog_hxx_
-+
-+#include <cppuhelper/implbase1.hxx>
-+#include <vbahelper/vbadialogsbase.hxx>
-+#include <ooo/vba/XFileDialog.hpp>
-+#include "vbafiledialogselecteditems.hxx"
-+
-+
-+typedef cppu::ImplInheritanceHelper1< VbaDialogsBase, ov::XFileDialog > ScVbaFileDialog_BASE;
-+
-+class ScVbaFileDialog : public ScVbaFileDialog_BASE
-+{
-+public:
-+
-+ ScVbaFileDialog( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext, const css::uno::Reference< css::frame::XModel >& xModel ) ;
-+ virtual ~ScVbaFileDialog() ;
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+ //XFileDialog
-+ virtual css::uno::Reference< ov::XFileDialogSelectedItems > SAL_CALL getSelectedItems() throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL Show( ) throw (::com::sun::star::uno::RuntimeException) ;
-+
-+private:
-+ css::uno::Sequence < rtl::OUString > m_sSelectedItems;
-+ VbaFileDialogSelectedItems *m_pFileDialogSelectedItems;
-+ VbaFileDialogSelectedObj m_FileDialogSelectedObj;
-+};
-+
-+#endif
-\ No newline at end of file
-diff --git sc/source/ui/vba/vbafiledialogselecteditems.cxx sc/source/ui/vba/vbafiledialogselecteditems.cxx
-new file mode 100644
-index 0000000..fbf0e14
---- /dev/null
-+++ sc/source/ui/vba/vbafiledialogselecteditems.cxx
-@@ -0,0 +1,157 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009, 2010.
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#include "vbafiledialogselecteditems.hxx"
-+
-+using namespace ::com::sun::star;
-+
-+VbaFileDialogSelectedItems::VbaFileDialogSelectedItems( const css::uno::Reference< ov::XHelperInterface >& xParent,
-+ const css::uno::Reference< css::uno::XComponentContext >& xContext,
-+ const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess
-+ )
-+ : FileDialogSelectedItems_BASE( xParent, xContext, xIndexAccess )
-+{
-+}
-+
-+
-+rtl::OUString& VbaFileDialogSelectedItems::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("VbaFileDialogSelectedItems") );
-+ return sImplName;
-+
-+}
-+css::uno::Sequence<rtl::OUString> VbaFileDialogSelectedItems::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.FileDialogSelectedItems" ) );
-+ }
-+ return aServiceNames;
-+
-+}
-+
-+css::uno::Any VbaFileDialogSelectedItems::createCollectionObject( const css::uno::Any& aSource )
-+{
-+ css::uno::Any aRet;
-+ aRet = aSource;
-+ return aRet;
-+}
-+
-+
-+css::uno::Type SAL_CALL
-+VbaFileDialogSelectedItems::getElementType() throw (css::uno::RuntimeException)
-+{
-+ return ooo::vba::XFileDialogSelectedItems::static_type(0);
-+}
-+
-+css::uno::Reference< css::container::XEnumeration > SAL_CALL
-+VbaFileDialogSelectedItems::createEnumeration() throw (css::uno::RuntimeException)
-+{
-+ css::uno::Reference< css::container::XEnumeration > xEnumRet(m_xIndexAccess, css::uno::UNO_QUERY);
-+ return xEnumRet;
-+}
-+
-+
-+//VbaFileDialogSelectedObj
-+//////////////////////////////////////////////////////////////////////////
-+
-+VbaFileDialogSelectedObj::VbaFileDialogSelectedObj()
-+{
-+ m_nIndex = 0;
-+}
-+
-+
-+sal_Bool
-+VbaFileDialogSelectedObj::SetSelectedFile(css::uno::Sequence<rtl::OUString> &sFList)
-+{
-+ m_sFileList = sFList;
-+ return sal_True;
-+}
-+
-+sal_Int32 SAL_CALL
-+VbaFileDialogSelectedObj::getCount() throw(::com::sun::star::uno::RuntimeException)
-+{
-+ sal_Int32 nListCnt = m_sFileList.getLength();
-+ return nListCnt;
-+}
-+
-+::com::sun::star::uno::Any SAL_CALL VbaFileDialogSelectedObj::getByIndex( sal_Int32 nIndex )
-+throw(::com::sun::star::lang::IndexOutOfBoundsException,
-+ ::com::sun::star::lang::WrappedTargetException,
-+ ::com::sun::star::uno::RuntimeException)
-+{
-+ css::uno::Any aRet;
-+
-+ if ( nIndex >= getCount() )
-+ {
-+ throw css::lang::IndexOutOfBoundsException();
-+ }
-+
-+ return uno::makeAny(m_sFileList[nIndex]);
-+}
-+
-+::com::sun::star::uno::Type SAL_CALL
-+VbaFileDialogSelectedObj::getElementType()
-+throw(::com::sun::star::uno::RuntimeException)
-+{
-+ return getCppuType((uno::Reference<com::sun::star::container::XIndexAccess>*)0);
-+}
-+
-+sal_Bool SAL_CALL VbaFileDialogSelectedObj::hasElements()
-+throw(::com::sun::star::uno::RuntimeException)
-+{
-+ return ( getCount() != 0 );
-+}
-+
-+::sal_Bool SAL_CALL
-+VbaFileDialogSelectedObj::hasMoreElements( )
-+throw (uno::RuntimeException)
-+{
-+ if (getCount() > m_nIndex)
-+ {
-+ return sal_True;
-+ }
-+ return sal_False;
-+}
-+
-+uno::Any SAL_CALL
-+VbaFileDialogSelectedObj::nextElement( )
-+throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+{
-+ if (!hasMoreElements())
-+ {
-+ throw container::NoSuchElementException();
-+ }
-+
-+ return uno::makeAny(m_sFileList[m_nIndex++]);
-+}
-+
-+
-+
-diff --git sc/source/ui/vba/vbafiledialogselecteditems.hxx sc/source/ui/vba/vbafiledialogselecteditems.hxx
-new file mode 100644
-index 0000000..44a32cf
---- /dev/null
-+++ sc/source/ui/vba/vbafiledialogselecteditems.hxx
-@@ -0,0 +1,87 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009, 2010.
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef _vbafiledialogselecteditems_hxx_
-+#define _vbafiledialogselecteditems_hxx_
-+
-+#include <ooo/vba/XFileDialogSelectedItems.hpp>
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/container/XIndexAccess.hpp>
-+
-+typedef CollTestImplHelper< ov::XFileDialogSelectedItems > FileDialogSelectedItems_BASE;
-+
-+
-+class VbaFileDialogSelectedItems : public FileDialogSelectedItems_BASE
-+{
-+public:
-+ VbaFileDialogSelectedItems( const css::uno::Reference< ov::XHelperInterface >& xParent,
-+ const css::uno::Reference< css::uno::XComponentContext >& xContext,
-+ const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess );
-+
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ 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);
-+
-+protected:
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+private:
-+};
-+
-+
-+class VbaFileDialogSelectedObj : public cppu::WeakImplHelper2<css::container::XIndexAccess, css::container::XEnumeration>
-+{
-+public:
-+ VbaFileDialogSelectedObj();
-+ sal_Bool SetSelectedFile(css::uno::Sequence<rtl::OUString> &sFList);
-+ //XIndexAccess
-+ virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException);
-+
-+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 nIndex )
-+ throw(::com::sun::star::lang::IndexOutOfBoundsException,
-+ ::com::sun::star::lang::WrappedTargetException,
-+ ::com::sun::star::uno::RuntimeException);
-+
-+ // XElementAccess
-+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
-+ throw(::com::sun::star::uno::RuntimeException);
-+
-+ virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
-+
-+ //XEnumeration
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL nextElement( ) throw (css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException);
-+
-+protected:
-+private:
-+ css::uno::Sequence<rtl::OUString> m_sFileList;
-+ sal_Int32 m_nIndex;
-+};
-+
-+#endif
-diff --git sc/source/ui/vba/vbafilesearch.cxx sc/source/ui/vba/vbafilesearch.cxx
-new file mode 100644
-index 0000000..7369ae5
---- /dev/null
-+++ sc/source/ui/vba/vbafilesearch.cxx
-@@ -0,0 +1,242 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009, 2010.
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#include "vbafilesearch.hxx"
-+#include "vbaapplication.hxx"
-+#include "vbafoundfiles.hxx"
-+#include <comphelper/processfactory.hxx>
-+#include <tools/urlobj.hxx>
-+#include <tools/wldcrd.hxx>
-+#include <com/sun/star/ucb/XSimpleFileAccess3.hpp>
-+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-+#include <com/sun/star/uno/Sequence.hxx>
-+#include <vector>
-+#include "unotools/viewoptions.hxx"
-+#include <osl/file.hxx>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+using namespace ::com::sun::star::uno;
-+using namespace ::com::sun::star::ucb;
-+using namespace ::com::sun::star::lang;
-+using namespace comphelper;
-+
-+static Reference< XSimpleFileAccess3 > getFileAccess( void )
-+{
-+ static Reference< XSimpleFileAccess3 > xSFI;
-+ if( !xSFI.is() )
-+ {
-+ Reference< XMultiServiceFactory > xSMgr = getProcessServiceFactory();
-+ if( xSMgr.is() )
-+ {
-+ xSFI = Reference< XSimpleFileAccess3 >( xSMgr->createInstance
-+ ( ::rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY );
-+ }
-+ }
-+ return xSFI;
-+}
-+
-+ScVbaFileSearch::ScVbaFileSearch( ScVbaApplication* pApp, const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext )
-+ : ScVbaFileSearchImpl_BASE( xParent, xContext ), m_pApplication( pApp )
-+{
-+ NewSearch();
-+}
-+
-+ScVbaFileSearch::~ScVbaFileSearch()
-+{
-+}
-+
-+::rtl::OUString SAL_CALL ScVbaFileSearch::getFileName() throw (css::uno::RuntimeException)
-+{
-+ return m_sFileName;
-+}
-+
-+void SAL_CALL ScVbaFileSearch::setFileName(const ::rtl::OUString& _fileName ) throw (css::uno::RuntimeException)
-+{
-+ m_sFileName = _fileName;
-+}
-+
-+::rtl::OUString SAL_CALL ScVbaFileSearch::getLookIn() throw (css::uno::RuntimeException)
-+{
-+ return m_sLookIn;
-+}
-+
-+void SAL_CALL ScVbaFileSearch::setLookIn( const ::rtl::OUString& _lookIn ) throw (css::uno::RuntimeException)
-+{
-+ m_sLookIn = _lookIn;
-+}
-+
-+sal_Bool SAL_CALL ScVbaFileSearch::getSearchSubFolders() throw (css::uno::RuntimeException)
-+{
-+ return m_bSearchSubFolders;
-+}
-+
-+void SAL_CALL ScVbaFileSearch::setSearchSubFolders( sal_Bool _searchSubFolders ) throw (css::uno::RuntimeException)
-+{
-+ m_bSearchSubFolders = _searchSubFolders;
-+}
-+
-+sal_Bool SAL_CALL ScVbaFileSearch::getMatchTextExactly() throw (css::uno::RuntimeException)
-+{
-+ return m_bMatchTextExactly;
-+}
-+
-+void SAL_CALL ScVbaFileSearch::setMatchTextExactly( sal_Bool _matchTextExactly ) throw (css::uno::RuntimeException)
-+{
-+ m_bMatchTextExactly = _matchTextExactly;
-+}
-+
-+static bool IsWildCard( const ::rtl::OUString& fileName )
-+{
-+ static sal_Char cWild1 = '*';
-+ static sal_Char cWild2 = '?';
-+
-+ return ( ( fileName.indexOf( cWild1 ) >= 0 )
-+ || ( fileName.indexOf( cWild2 ) >= 0 ) );
-+}
-+
-+static void SearchWildCard(const WildCard& wildCard, const ::rtl::OUString& aDir, bool bSearchSubFolders, css::uno::Sequence< rtl::OUString >& aSearchedFiles)
-+{
-+ Reference< XSimpleFileAccess3 > xSFI = getFileAccess();
-+ Sequence< rtl::OUString > aDirSeq;
-+ try
-+ {
-+ if ( xSFI.is() )
-+ {
-+ aDirSeq = xSFI->getFolderContents( aDir, bSearchSubFolders );
-+ }
-+ }
-+ catch( css::uno::Exception& )
-+ {
-+ }
-+ sal_Int32 nLength = aDirSeq.getLength();
-+ for ( sal_Int32 i = 0; i < nLength; i++ )
-+ {
-+ rtl::OUString aURLStr = aDirSeq[i];
-+ if ( xSFI->isFolder( aURLStr ) )
-+ {
-+ if ( bSearchSubFolders )
-+ {
-+ SearchWildCard( wildCard, aURLStr, true, aSearchedFiles );
-+ }
-+ }
-+ else
-+ {
-+ INetURLObject aFileURL( aURLStr );
-+ rtl::OUString aFileName = aFileURL.GetLastName( INetURLObject::DECODE_UNAMBIGUOUS );
-+ if ( wildCard.Matches( aFileName.toAsciiLowerCase() ) )
-+ {
-+ sal_Int32 nFilesLength = aSearchedFiles.getLength();
-+ aSearchedFiles.realloc( nFilesLength + 1 );
-+ rtl::OUString sSystemPath;
-+ ::osl::File::getSystemPathFromFileURL( aURLStr, sSystemPath );
-+ aSearchedFiles[nFilesLength] = sSystemPath;
-+ }
-+ }
-+ }
-+}
-+
-+sal_Int32 SAL_CALL ScVbaFileSearch::Execute( ) throw (css::uno::RuntimeException)
-+{
-+ m_aSearchedFiles.realloc(0);
-+ Reference< XSimpleFileAccess3 > xSFI = getFileAccess();
-+ if ( !xSFI.is() || !xSFI->isFolder( m_sLookIn ) )
-+ {
-+ return 0;
-+ }
-+
-+ if ( m_sFileName == ::rtl::OUString::createFromAscii( "" ) )
-+ {
-+ return 1;
-+ }
-+
-+ ::rtl::OUString aTempFileName = m_sFileName.toAsciiLowerCase();
-+ if ( IsWildCard( aTempFileName ) )
-+ {
-+ bool bEndWithAsterisk = aTempFileName.endsWithAsciiL("*", 1);
-+ bool bStartWithAsterisk = (aTempFileName.indexOf(::rtl::OUString::createFromAscii("*")) == 0);
-+ if ( !bEndWithAsterisk && !bStartWithAsterisk )
-+ {
-+ aTempFileName = ::rtl::OUString::createFromAscii("*") + aTempFileName + ::rtl::OUString::createFromAscii("*");
-+ }
-+ }
-+ else
-+ {
-+ aTempFileName = ::rtl::OUString::createFromAscii("*") + aTempFileName + ::rtl::OUString::createFromAscii("*");
-+ }
-+ WildCard wildCard( aTempFileName );
-+ SearchWildCard( wildCard, m_sLookIn, m_bSearchSubFolders, m_aSearchedFiles );
-+
-+ return m_aSearchedFiles.getLength();
-+}
-+
-+//liuchen 2009-11-5 set ScVbaApplication::getDefaultFilePath( ) as the InitPath for FileSearch
-+ ::rtl::OUString ScVbaFileSearch::getInitPath() throw (css::uno::RuntimeException)
-+{
-+ String aPath;
-+
-+ if (m_pApplication != NULL)
-+ {
-+ aPath = m_pApplication->getDefaultFilePath();
-+ }
-+
-+ return aPath;
-+}
-+
-+void SAL_CALL ScVbaFileSearch::NewSearch( ) throw (css::uno::RuntimeException)
-+{
-+ m_sFileName = ::rtl::OUString::createFromAscii( "" );
-+ m_sLookIn = getInitPath();
-+ m_bSearchSubFolders = false;
-+ m_bMatchTextExactly = false;
-+ m_aSearchedFiles.realloc(0);
-+}
-+
-+Reference< XFoundFiles > SAL_CALL ScVbaFileSearch::getFoundFiles() throw (css::uno::RuntimeException)
-+{
-+ css::uno::Reference< ov::XFoundFiles > xFoundFiles = new VbaFoundFiles(
-+ mxParent, mxContext, (css::container::XIndexAccess *) new VbaFoundFilesEnum(m_aSearchedFiles) );
-+ return xFoundFiles;
-+}
-+
-+rtl::OUString& ScVbaFileSearch::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("VbaFileSearch") );
-+ return sImplName;
-+}
-+
-+css::uno::Sequence< rtl::OUString > ScVbaFileSearch::getServiceNames()
-+{
-+ static css::uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.FileSearch") );
-+ }
-+ return aServiceNames;
-+}
-diff --git sc/source/ui/vba/vbafilesearch.hxx sc/source/ui/vba/vbafilesearch.hxx
-new file mode 100644
-index 0000000..2857ac5
---- /dev/null
-+++ sc/source/ui/vba/vbafilesearch.hxx
-@@ -0,0 +1,77 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009, 2010.
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef SC_VBA_FILESEARCH_HXX
-+#define SC_VBA_FILESEARCH_HXX
-+
-+#include <ooo/vba/XFileSearch.hpp>
-+#include <cppuhelper/implbase1.hxx>
-+#include <vbahelper/vbahelperinterface.hxx>
-+
-+namespace css = ::com::sun::star;
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::XFileSearch > ScVbaFileSearchImpl_BASE;
-+
-+class ScVbaApplication;
-+
-+class ScVbaFileSearch : public ScVbaFileSearchImpl_BASE
-+{
-+private:
-+ rtl::OUString m_sFileName;
-+ rtl::OUString m_sLookIn;
-+ sal_Bool m_bSearchSubFolders;
-+ sal_Bool m_bMatchTextExactly;
-+ ScVbaApplication* m_pApplication;
-+ css::uno::Sequence< rtl::OUString > m_aSearchedFiles;
-+
-+ ::rtl::OUString getInitPath() throw (css::uno::RuntimeException);
-+
-+public:
-+ ScVbaFileSearch( ScVbaApplication* pApp, const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext );
-+ virtual ~ScVbaFileSearch();
-+
-+ // Attributes
-+ virtual ::rtl::OUString SAL_CALL getFileName() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setFileName(const ::rtl::OUString& _fileName ) throw (css::uno::RuntimeException);
-+ virtual ::rtl::OUString SAL_CALL getLookIn() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setLookIn(const ::rtl::OUString& _lookIn ) throw (css::uno::RuntimeException);
-+ virtual sal_Bool SAL_CALL getSearchSubFolders() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setSearchSubFolders( sal_Bool _searchSubFolders ) throw (css::uno::RuntimeException);
-+ virtual sal_Bool SAL_CALL getMatchTextExactly() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setMatchTextExactly( sal_Bool _matchTextExactly ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Reference< ::ooo::vba::XFoundFiles > SAL_CALL getFoundFiles() throw (css::uno::RuntimeException);
-+
-+ virtual sal_Int32 SAL_CALL Execute( ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL NewSearch( ) throw (css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence< rtl::OUString > getServiceNames();
-+};
-+
-+#endif /* SC_VBA_FILESEARCH_HXX */
-diff --git sc/source/ui/vba/vbafoundfiles.cxx sc/source/ui/vba/vbafoundfiles.cxx
-new file mode 100644
-index 0000000..464b533
---- /dev/null
-+++ sc/source/ui/vba/vbafoundfiles.cxx
-@@ -0,0 +1,143 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009, 2010.
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#include "vbafoundfiles.hxx"
-+
-+////////////////////////////////VbaFoundFilesEnum//////////////////////////////////////////
-+VbaFoundFilesEnum::VbaFoundFilesEnum() : m_nIndex(0)
-+{
-+
-+}
-+
-+VbaFoundFilesEnum::VbaFoundFilesEnum( css::uno::Sequence<rtl::OUString>& sFileList ) : m_nIndex(0), m_sFileList(sFileList)
-+{
-+
-+}
-+
-+VbaFoundFilesEnum::~VbaFoundFilesEnum()
-+{
-+
-+}
-+
-+void VbaFoundFilesEnum::SetFileList( css::uno::Sequence<rtl::OUString>& sFileList )
-+{
-+ m_nIndex = 0;
-+ m_sFileList = sFileList;
-+}
-+
-+sal_Int32 SAL_CALL VbaFoundFilesEnum::getCount() throw (css::uno::RuntimeException)
-+{
-+ return m_sFileList.getLength();
-+}
-+
-+css::uno::Any SAL_CALL VbaFoundFilesEnum::getByIndex( sal_Int32 nIndex )
-+ throw (css::lang::IndexOutOfBoundsException, css::lang::WrappedTargetException, css::uno::RuntimeException)
-+{
-+ if ( nIndex >= getCount() )
-+ {
-+ throw css::lang::IndexOutOfBoundsException();
-+ }
-+
-+ return css::uno::makeAny( m_sFileList[nIndex] );
-+}
-+
-+css::uno::Type SAL_CALL VbaFoundFilesEnum::getElementType() throw (css::uno::RuntimeException)
-+{
-+ return getCppuType((css::uno::Reference< css::container::XIndexAccess >*)0);
-+}
-+
-+sal_Bool SAL_CALL VbaFoundFilesEnum::hasElements() throw (css::uno::RuntimeException)
-+{
-+ return ( getCount() != 0 );
-+}
-+
-+sal_Bool SAL_CALL VbaFoundFilesEnum::hasMoreElements() throw (css::uno::RuntimeException)
-+{
-+ if ( getCount() > m_nIndex )
-+ {
-+ return sal_True;
-+ }
-+ return sal_False;
-+}
-+
-+css::uno::Any SAL_CALL VbaFoundFilesEnum::nextElement() throw (css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException)
-+{
-+ if ( !hasMoreElements() )
-+ {
-+ throw css::container::NoSuchElementException();
-+ }
-+
-+ return css::uno::makeAny( m_sFileList[m_nIndex++] );
-+}
-+
-+////////////////////////////////VbaFoundFiles//////////////////////////////////////////
-+VbaFoundFiles::VbaFoundFiles( const css::uno::Reference< ov::XHelperInterface >& xParent,
-+ const css::uno::Reference< css::uno::XComponentContext >& xContext,
-+ const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess
-+ ) : VbaFoundFilesImpl_BASE( xParent, xContext, xIndexAccess )
-+{
-+
-+}
-+
-+VbaFoundFiles::~VbaFoundFiles()
-+{
-+
-+}
-+
-+css::uno::Reference< css::container::XEnumeration > VbaFoundFiles::createEnumeration() throw (css::uno::RuntimeException)
-+{
-+ css::uno::Reference< css::container::XEnumeration > xEnumRet( m_xIndexAccess, css::uno::UNO_QUERY );
-+ return xEnumRet;
-+}
-+
-+css::uno::Any VbaFoundFiles::createCollectionObject( const css::uno::Any& aSource )
-+{
-+ return aSource;
-+}
-+
-+css::uno::Type VbaFoundFiles::getElementType() throw (css::uno::RuntimeException)
-+{
-+ return ov::XFoundFiles::static_type(0);
-+}
-+
-+rtl::OUString& VbaFoundFiles::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("VbaFoundFiles") );
-+ return sImplName;
-+}
-+
-+css::uno::Sequence< rtl::OUString > VbaFoundFiles::getServiceNames()
-+{
-+ static css::uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.FoundFiles") );
-+ }
-+ return aServiceNames;
-+}
-diff --git sc/source/ui/vba/vbafoundfiles.hxx sc/source/ui/vba/vbafoundfiles.hxx
-new file mode 100644
-index 0000000..4a3a1db
---- /dev/null
-+++ sc/source/ui/vba/vbafoundfiles.hxx
-@@ -0,0 +1,88 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009, 2010.
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef SC_VBA_FOUNDFILES_HXX
-+#define SC_VBA_FOUNDFILES_HXX
-+
-+#include <cppuhelper/implbase2.hxx>
-+#include <com/sun/star/container/XIndexAccess.hpp>
-+#include <ooo/vba/XFoundFiles.hpp>
-+#include <vbahelper/vbacollectionimpl.hxx>
-+
-+namespace css = ::com::sun::star;
-+
-+typedef CollTestImplHelper< ooo::vba::XFoundFiles > VbaFoundFilesImpl_BASE;
-+
-+class VbaFoundFilesEnum : public cppu::WeakImplHelper2< css::container::XIndexAccess, css::container::XEnumeration >
-+{
-+private:
-+ sal_Int32 m_nIndex;
-+ css::uno::Sequence< rtl::OUString > m_sFileList;
-+
-+public:
-+ VbaFoundFilesEnum();
-+ VbaFoundFilesEnum( css::uno::Sequence< rtl::OUString >& sFileList );
-+ ~VbaFoundFilesEnum();
-+
-+ void SetFileList( css::uno::Sequence< rtl::OUString >& sFileList );
-+
-+ // XIndexAccess
-+ virtual sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 nIndex ) throw (css::lang::IndexOutOfBoundsException, css::lang::WrappedTargetException, css::uno::RuntimeException);
-+
-+ // XElementAccess
-+ virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
-+ virtual sal_Bool SAL_CALL hasElements() throw (css::uno::RuntimeException);
-+
-+ // XEnumeration
-+ virtual sal_Bool SAL_CALL hasMoreElements() throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL nextElement() throw (css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException);
-+};
-+
-+class VbaFoundFiles : public VbaFoundFilesImpl_BASE
-+{
-+private:
-+
-+public:
-+ VbaFoundFiles( const css::uno::Reference< ov::XHelperInterface >& xParent,
-+ const css::uno::Reference< css::uno::XComponentContext >& xContext,
-+ const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess );
-+ virtual ~VbaFoundFiles();
-+
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+
-+ // 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);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence< rtl::OUString > getServiceNames();
-+};
-+
-+#endif /* SC_VBA_FOUNDFILES_HXX */
-diff --git sc/source/ui/vba/vbaglobals.cxx sc/source/ui/vba/vbaglobals.cxx
-index d937784..2cd8b79 100644
---- sc/source/ui/vba/vbaglobals.cxx
-+++ sc/source/ui/vba/vbaglobals.cxx
-@@ -219,6 +219,12 @@ ScVbaGlobals::Rows( const uno::Any& aIndex ) throw (uno::RuntimeException)
- return uno::Any();
- }
-
-+uno::Any SAL_CALL
-+ScVbaGlobals::MenuBars( const uno::Any& aIndex ) throw (uno::RuntimeException)
-+{
-+ return uno::Any( getApplication()->MenuBars(aIndex) );
-+}
-+
- uno::Sequence< ::rtl::OUString > SAL_CALL
- ScVbaGlobals::getAvailableServiceNames( ) throw (uno::RuntimeException)
- {
-diff --git sc/source/ui/vba/vbaglobals.hxx sc/source/ui/vba/vbaglobals.hxx
-index 38a51f2..f06acb4 100644
---- sc/source/ui/vba/vbaglobals.hxx
-+++ sc/source/ui/vba/vbaglobals.hxx
-@@ -83,6 +83,7 @@ typedef ::cppu::ImplInheritanceHelper1< VbaGlobalsBase, ov::excel::XGlobals > Sc
- 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 css::uno::Reference< ov::excel::XApplication > SAL_CALL getExcel() throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getDebug() throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL MenuBars( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-
-
- // XMultiServiceFactory
-diff --git sc/source/ui/vba/vbahelper.cxx sc/source/ui/vba/vbahelper.cxx
-deleted file mode 100644
-index 1248b4c..0000000
---- sc/source/ui/vba/vbahelper.cxx
-+++ /dev/null
-@@ -1,758 +0,0 @@
--/*************************************************************************
-- *
-- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-- *
-- * Copyright 2000, 2010 Oracle and/or its affiliates.
-- *
-- * OpenOffice.org - a multi-platform office productivity suite
-- *
-- * 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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--#include <cppuhelper/bootstrap.hxx>
--#include <com/sun/star/util/XURLTransformer.hpp>
--#include <com/sun/star/frame/XDispatchProvider.hpp>
--#include <com/sun/star/frame/XModel.hpp>
--#include <com/sun/star/frame/XFrame.hpp>
--#include <com/sun/star/frame/XDesktop.hpp>
--#include <com/sun/star/frame/XController.hpp>
--#include <com/sun/star/uno/XComponentContext.hpp>
--#include <com/sun/star/lang/XMultiComponentFactory.hpp>
--#include <com/sun/star/beans/XPropertySet.hpp>
--#include <com/sun/star/beans/XIntrospection.hpp>
--
--#include <comphelper/processfactory.hxx>
--
--#include <sfx2/objsh.hxx>
--#include <sfx2/viewfrm.hxx>
--#include <sfx2/dispatch.hxx>
--#include <sfx2/app.hxx>
--#include <svl/stritem.hxx>
--
--#include <docuno.hxx>
--
--#include <basic/sbx.hxx>
--#include <basic/sbstar.hxx>
--#include <rtl/math.hxx>
--
--#include <math.h>
--#include "vbahelper.hxx"
--#include "tabvwsh.hxx"
--#include "transobj.hxx"
--#include "scmod.hxx"
--#include "vbashape.hxx"
--#include "unonames.hxx"
--#include "cellsuno.hxx"
--using namespace ::com::sun::star;
--using namespace ::ooo::vba;
--
--#define POINTTO100THMILLIMETERFACTOR 35.27778
--void unoToSbxValue( SbxVariable* pVar, const uno::Any& aValue );
--
--uno::Any sbxToUnoValue( SbxVariable* pVar );
--
--
--namespace ooo
--{
--namespace vba
--{
--
--const double Millimeter::factor = 35.27778;
--
--uno::Reference< beans::XIntrospectionAccess >
--getIntrospectionAccess( const uno::Any& aObject ) throw (uno::RuntimeException)
--{
-- static uno::Reference< beans::XIntrospection > xIntrospection;
-- if( !xIntrospection.is() )
-- {
-- uno::Reference< lang::XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-- xIntrospection.set( xFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.beans.Introspection") ), uno::UNO_QUERY_THROW );
-- }
-- return xIntrospection->inspect( aObject );
--}
--
--uno::Reference< script::XTypeConverter >
--getTypeConverter( const uno::Reference< uno::XComponentContext >& xContext ) throw (uno::RuntimeException)
--{
-- static uno::Reference< script::XTypeConverter > xTypeConv( xContext->getServiceManager()->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter") ), xContext ), uno::UNO_QUERY_THROW );
-- return xTypeConv;
--}
--// helper method to determine if the view ( calc ) is in print-preview mode
--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"));
--const uno::Any&
--aNULL()
--{
-- static uno::Any aNULLL = uno::makeAny( uno::Reference< uno::XInterface >() );
-- return aNULLL;
--}
--
--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<uno::XComponentContext > xContext( xTmpProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
-- static uno::Reference<lang::XMultiComponentFactory > 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 dispatchExecute(css::uno::Reference< css::frame::XModel>& xModel, USHORT nSlot, SfxCallMode nCall)
--{
-- ScTabViewShell* pViewShell = getBestViewShell( xModel );
-- SfxViewFrame* pViewFrame = NULL;
-- if ( pViewShell )
-- pViewFrame = pViewShell->GetViewFrame();
-- if ( pViewFrame )
-- {
-- SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
-- if( pDispatcher )
-- {
-- pDispatcher->Execute( nSlot , nCall );
-- }
-- }
--}
--
--void
--implnPaste()
--{
-- PasteCellsWarningReseter resetWarningBox;
-- ScTabViewShell* pViewShell = getCurrentBestViewShell();
-- if ( pViewShell )
-- {
-- pViewShell->PasteFromSystem();
-- pViewShell->CellContentChanged();
-- }
--}
--
--
--void
--implnCopy()
--{
-- ScTabViewShell* pViewShell = getCurrentBestViewShell();
-- if ( pViewShell )
-- pViewShell->CopyToClip(NULL,false,false,true);
--}
--
--void
--implnCut()
--{
-- ScTabViewShell* pViewShell = getCurrentBestViewShell();
-- if ( pViewShell )
-- pViewShell->CutToClip( NULL, TRUE );
--}
--
--void implnPasteSpecial(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 = ScTabViewShell::GetActiveViewShell();
-- if ( !pTabViewShell )
-- // none active, try next best
-- pTabViewShell = getCurrentBestViewShell();
-- 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();
-- }
-- }
-- }
--
--}
--
-- uno::Reference< frame::XModel >
--getCurrentDocument() throw (uno::RuntimeException)
--{
-- uno::Reference< frame::XModel > xModel;
-- SbxObject* pBasic = dynamic_cast< SbxObject* > ( SFX_APP()->GetBasic() );
-- SbxObject* basicChosen = pBasic ;
-- if ( basicChosen == NULL)
-- {
-- OSL_TRACE("getModelFromBasic() StarBASIC* is NULL" );
-- return xModel;
-- }
-- SbxObject* p = pBasic;
-- SbxObject* pParent = p->GetParent();
-- SbxObject* pParentParent = pParent ? pParent->GetParent() : NULL;
--
-- if( pParentParent )
-- {
-- basicChosen = pParentParent;
-- }
-- else if( pParent )
-- {
-- basicChosen = pParent;
-- }
--
--
-- uno::Any aModel;
-- SbxVariable *pCompVar = basicChosen->Find( UniString(RTL_CONSTASCII_USTRINGPARAM("ThisComponent")), SbxCLASS_OBJECT );
--
-- if ( pCompVar )
-- {
-- aModel = sbxToUnoValue( pCompVar );
-- if ( sal_False == ( aModel >>= xModel ) ||
-- !xModel.is() )
-- {
-- // trying last gasp try the current component
-- uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-- // test if vba service is present
-- uno::Reference< uno::XComponentContext > xCtx( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
-- uno::Reference<lang::XMultiComponentFactory > xSMgr( xCtx->getServiceManager(), uno::UNO_QUERY_THROW );
-- uno::Reference< frame::XDesktop > xDesktop (xSMgr->createInstanceWithContext(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"), xCtx), uno::UNO_QUERY_THROW );
-- xModel.set( xDesktop->getCurrentComponent(), uno::UNO_QUERY );
-- if ( !xModel.is() )
-- {
-- throw uno::RuntimeException(
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can't extract model from basic ( its obviously not set yet ) therefore don't know the currently selected document") ), uno::Reference< uno::XInterface >() );
-- }
-- return xModel;
-- }
-- else
-- {
-- OSL_TRACE("Have model ThisComponent points to url %s",
-- ::rtl::OUStringToOString( xModel->getURL(),
-- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-- }
-- }
-- else
-- {
-- OSL_TRACE("Failed to get ThisComponent");
-- throw uno::RuntimeException(
-- rtl::OUString(
-- RTL_CONSTASCII_USTRINGPARAM(
-- "Can't determine the currently selected document") ),
-- uno::Reference< uno::XInterface >() );
-- }
-- return xModel;
--}
--
--ScDocShell*
--getDocShell( 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( css::uno::Reference< css::frame::XModel>& xModel )
--{
-- ScDocShell* pDocShell = getDocShell( xModel );
-- if ( pDocShell )
-- return pDocShell->GetBestViewShell();
-- return NULL;
--}
--
--ScTabViewShell*
--getCurrentBestViewShell()
--{
-- uno::Reference< frame::XModel > xModel = getCurrentDocument();
-- return getBestViewShell( xModel );
--}
--
--SfxViewFrame*
--getCurrentViewFrame()
--{
-- ScTabViewShell* pViewShell = getCurrentBestViewShell();
-- if ( pViewShell )
-- return pViewShell->GetViewFrame();
-- return NULL;
--}
--
--sal_Int32
--OORGBToXLRGB( sal_Int32 nCol )
--{
-- sal_Int32 nRed = nCol;
-- nRed &= 0x00FF0000;
-- nRed >>= 16;
-- sal_Int32 nGreen = nCol;
-- nGreen &= 0x0000FF00;
-- nGreen >>= 8;
-- sal_Int32 nBlue = nCol;
-- nBlue &= 0x000000FF;
-- sal_Int32 nRGB = ( (nBlue << 16) | (nGreen << 8) | nRed );
-- return nRGB;
--}
--sal_Int32
--XLRGBToOORGB( sal_Int32 nCol )
--{
-- sal_Int32 nBlue = nCol;
-- nBlue &= 0x00FF0000;
-- nBlue >>= 16;
-- sal_Int32 nGreen = nCol;
-- nGreen &= 0x0000FF00;
-- nGreen >>= 8;
-- sal_Int32 nRed = nCol;
-- nRed &= 0x000000FF;
-- sal_Int32 nRGB = ( (nRed << 16) | (nGreen << 8) | nBlue );
-- return nRGB;
--}
--uno::Any
--OORGBToXLRGB( const uno::Any& aCol )
--{
-- sal_Int32 nCol=0;
-- aCol >>= nCol;
-- nCol = OORGBToXLRGB( nCol );
-- return uno::makeAny( nCol );
--}
--uno::Any
--XLRGBToOORGB( const uno::Any& aCol )
--{
-- sal_Int32 nCol=0;
-- aCol >>= nCol;
-- nCol = XLRGBToOORGB( nCol );
-- return uno::makeAny( nCol );
--}
--
--void PrintOutHelper( const uno::Any& From, const uno::Any& To, const uno::Any& Copies, const uno::Any& Preview, const uno::Any& /*ActivePrinter*/, const uno::Any& /*PrintToFile*/, const uno::Any& Collate, const uno::Any& PrToFileName, css::uno::Reference< frame::XModel >& xModel, sal_Bool bUseSelection )
--{
-- sal_Int32 nTo = 0;
-- sal_Int32 nFrom = 0;
-- sal_Int16 nCopies = 1;
-- sal_Bool bPreview = sal_False;
-- sal_Bool bCollate = sal_False;
-- sal_Bool bSelection = bUseSelection;
-- From >>= nFrom;
-- To >>= nTo;
-- Copies >>= nCopies;
-- Preview >>= bPreview;
-- if ( nCopies > 1 ) // Collate only useful when more that 1 copy
-- Collate >>= bCollate;
--
-- rtl::OUString sRange( RTL_CONSTASCII_USTRINGPARAM( "-" ) );
-- rtl::OUString sFileName;
--
-- if (( nFrom || nTo ) )
-- {
-- if ( nFrom )
-- sRange = ( ::rtl::OUString::valueOf( nFrom ) + sRange );
-- if ( nTo )
-- sRange += ::rtl::OUString::valueOf( nTo );
-- }
--
-- if ( PrToFileName.getValue() )
-- {
-- PrToFileName >>= sFileName;
-- }
-- ScTabViewShell* pViewShell = getBestViewShell( xModel );
-- SfxViewFrame* pViewFrame = NULL;
-- if ( pViewShell )
-- pViewFrame = pViewShell->GetViewFrame();
-- if ( pViewFrame )
-- {
-- SfxAllItemSet aArgs( SFX_APP()->GetPool() );
--
-- SfxBoolItem sfxCollate( SID_PRINT_COLLATE, bCollate );
-- aArgs.Put( sfxCollate, sfxCollate.Which() );
-- SfxInt16Item sfxCopies( SID_PRINT_COPIES, nCopies );
-- aArgs.Put( sfxCopies, sfxCopies.Which() );
-- if ( sFileName.getLength() )
-- {
-- SfxStringItem sfxFileName( SID_FILE_NAME, sFileName);
-- aArgs.Put( sfxFileName, sfxFileName.Which() );
--
-- }
-- if ( sRange.getLength() )
-- {
-- SfxStringItem sfxRange( SID_PRINT_PAGES, sRange );
-- aArgs.Put( sfxRange, sfxRange.Which() );
-- }
-- SfxBoolItem sfxSelection( SID_SELECTION, bSelection );
-- aArgs.Put( sfxSelection, sfxSelection.Which() );
-- SfxBoolItem sfxAsync( SID_ASYNCHRON, sal_False );
-- aArgs.Put( sfxAsync, sfxAsync.Which() );
-- SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
--
-- if ( pDispatcher )
-- {
-- if ( bPreview )
-- {
-- if ( !pViewFrame->GetFrame().IsInPlace() )
-- {
-- SC_MOD()->InputEnterHandler();
-- pViewFrame->GetDispatcher()->Execute( SID_VIEWSHELL1, SFX_CALLMODE_SYNCHRON );
-- while ( isInPrintPreview( pViewFrame ) )
-- Application::Yield();
-- }
-- }
-- else
-- pDispatcher->Execute( (USHORT)SID_PRINTDOC, (SfxCallMode)SFX_CALLMODE_SYNCHRON, aArgs );
-- }
--
-- }
--
-- // #FIXME #TODO
-- // 1 ActivePrinter ( how/can we switch a printer via API? )
-- // 2 PrintToFile ( ms behaviour if this option is specified but no
-- // filename supplied 'PrToFileName' then the user will be prompted )
-- // 3 Need to check behaviour of Selected sheets with range ( e.g. From & To
-- // values ) in oOO these options are mutually exclusive
-- // 4 There is a pop up to do with transparent objects in the print source
-- // should be able to disable that via configuration for the duration
-- // of this method
--}
--
-- void PrintPreviewHelper( const css::uno::Any& /*EnableChanges*/, css::uno::Reference< css::frame::XModel >& xModel )
--{
-- dispatchExecute( xModel, SID_VIEWSHELL1 );
--}
--
--rtl::OUString getAnyAsString( const uno::Any& pvargItem ) throw ( uno::RuntimeException )
--{
-- uno::Type aType = pvargItem.getValueType();
-- uno::TypeClass eTypeClass = aType.getTypeClass();
-- rtl::OUString sString;
-- switch ( eTypeClass )
-- {
-- case uno::TypeClass_BOOLEAN:
-- {
-- sal_Bool bBool = sal_False;
-- pvargItem >>= bBool;
-- sString = rtl::OUString::valueOf( bBool );
-- break;
-- }
-- case uno::TypeClass_STRING:
-- pvargItem >>= sString;
-- break;
-- case uno::TypeClass_FLOAT:
-- {
-- float aFloat = 0;
-- pvargItem >>= aFloat;
-- sString = rtl::OUString::valueOf( aFloat );
-- break;
-- }
-- case uno::TypeClass_DOUBLE:
-- {
-- double aDouble = 0;
-- pvargItem >>= aDouble;
-- sString = rtl::OUString::valueOf( aDouble );
-- break;
-- }
-- case uno::TypeClass_SHORT:
-- case uno::TypeClass_LONG:
-- case uno::TypeClass_BYTE:
-- {
-- sal_Int32 aNum = 0;
-- pvargItem >>= aNum;
-- sString = rtl::OUString::valueOf( aNum );
-- break;
-- }
--
-- case uno::TypeClass_HYPER:
-- {
-- sal_Int64 aHyper = 0;
-- pvargItem >>= aHyper;
-- sString = rtl::OUString::valueOf( aHyper );
-- break;
-- }
-- default:
-- throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid type, can't convert" ), uno::Reference< uno::XInterface >() );
-- }
-- return sString;
--}
--
--
--rtl::OUString
--ContainerUtilities::getUniqueName( const uno::Sequence< ::rtl::OUString >& _slist, const rtl::OUString& _sElementName, const ::rtl::OUString& _sSuffixSeparator)
--{
-- return getUniqueName(_slist, _sElementName, _sSuffixSeparator, sal_Int32(2));
--}
--
--rtl::OUString
--ContainerUtilities::getUniqueName( const uno::Sequence< rtl::OUString >& _slist, const rtl::OUString _sElementName, const rtl::OUString& _sSuffixSeparator, sal_Int32 _nStartSuffix)
--{
-- sal_Int32 a = _nStartSuffix;
-- rtl::OUString scompname = _sElementName;
-- bool bElementexists = true;
-- sal_Int32 nLen = _slist.getLength();
-- if ( nLen == 0 )
-- return _sElementName;
--
-- while (bElementexists == true)
-- {
-- for (sal_Int32 i = 0; i < nLen; i++)
-- {
-- if (FieldInList(_slist, scompname) == -1)
-- {
-- return scompname;
-- }
-- }
-- scompname = _sElementName + _sSuffixSeparator + rtl::OUString::valueOf( a++ );
-- }
-- return rtl::OUString();
--}
--
--sal_Int32
--ContainerUtilities::FieldInList( const uno::Sequence< rtl::OUString >& SearchList, const rtl::OUString& SearchString )
--{
-- sal_Int32 FieldLen = SearchList.getLength();
-- sal_Int32 retvalue = -1;
-- for (sal_Int32 i = 0; i < FieldLen; i++)
-- {
-- // I wonder why comparing lexicographically is done
-- // when its a match is whats interesting?
-- //if (SearchList[i].compareTo(SearchString) == 0)
-- if ( SearchList[i].equals( SearchString ) )
-- {
-- retvalue = i;
-- break;
-- }
-- }
-- return retvalue;
--
--}
--bool NeedEsc(sal_Unicode cCode)
--{
-- String sEsc(RTL_CONSTASCII_USTRINGPARAM(".^$+\\|{}()"));
-- return (STRING_NOTFOUND != sEsc.Search(cCode));
--}
--
--rtl::OUString VBAToRegexp(const rtl::OUString &rIn, bool bForLike )
--{
-- rtl::OUStringBuffer sResult;
-- const sal_Unicode *start = rIn.getStr();
-- const sal_Unicode *end = start + rIn.getLength();
--
-- int seenright = 0;
-- if ( bForLike )
-- sResult.append(static_cast<sal_Unicode>('^'));
--
-- while (start < end)
-- {
-- switch (*start)
-- {
-- case '?':
-- sResult.append(static_cast<sal_Unicode>('.'));
-- start++;
-- break;
-- case '*':
-- sResult.append(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".*")));
-- start++;
-- break;
-- case '#':
-- sResult.append(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("[0-9]")));
-- start++;
-- break;
-- case '~':
-- sResult.append(static_cast<sal_Unicode>('\\'));
-- sResult.append(*(++start));
-- start++;
-- break;
-- // dump the ~ and escape the next characture
-- case ']':
-- sResult.append(static_cast<sal_Unicode>('\\'));
-- sResult.append(*start++);
-- break;
-- case '[':
-- sResult.append(*start++);
-- seenright = 0;
-- while (start < end && !seenright)
-- {
-- switch (*start)
-- {
-- case '[':
-- case '?':
-- case '*':
-- sResult.append(static_cast<sal_Unicode>('\\'));
-- sResult.append(*start);
-- break;
-- case ']':
-- sResult.append(*start);
-- seenright = 1;
-- break;
-- case '!':
-- sResult.append(static_cast<sal_Unicode>('^'));
-- break;
-- default:
-- if (NeedEsc(*start))
-- sResult.append(static_cast<sal_Unicode>('\\'));
-- sResult.append(*start);
-- break;
-- }
-- start++;
-- }
-- break;
-- default:
-- if (NeedEsc(*start))
-- sResult.append(static_cast<sal_Unicode>('\\'));
-- sResult.append(*start++);
-- }
-- }
--
-- if ( bForLike )
-- sResult.append(static_cast<sal_Unicode>('$'));
--
-- return sResult.makeStringAndClear( );
--}
--
--double getPixelTo100thMillimeterConversionFactor( css::uno::Reference< css::awt::XDevice >& xDevice, sal_Bool bVertical)
--{
-- double fConvertFactor = 1.0;
-- if( bVertical )
-- {
-- fConvertFactor = xDevice->getInfo().PixelPerMeterY/100000;
-- }
-- else
-- {
-- fConvertFactor = xDevice->getInfo().PixelPerMeterX/100000;
-- }
-- return fConvertFactor;
--}
--
--double PointsToPixels( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical)
--{
-- double fConvertFactor = getPixelTo100thMillimeterConversionFactor( xDevice, bVertical );
-- return fPoints * POINTTO100THMILLIMETERFACTOR * fConvertFactor;
--}
--double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double fPixels, sal_Bool bVertical)
--{
-- double fConvertFactor = getPixelTo100thMillimeterConversionFactor( xDevice, bVertical );
-- return (fPixels/fConvertFactor)/POINTTO100THMILLIMETERFACTOR;
--}
--
--ConcreteXShapeGeometryAttributes::ConcreteXShapeGeometryAttributes( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape )
--{
-- m_xShape = new ScVbaShape( xContext, xShape );
--}
--
--#define VBA_LEFT "PositionX"
--#define VBA_TOP "PositionY"
--UserFormGeometryHelper::UserFormGeometryHelper( const uno::Reference< uno::XComponentContext >& /*xContext*/, const uno::Reference< awt::XControl >& xControl )
--{
-- mxModel.set( xControl->getModel(), uno::UNO_QUERY_THROW );
--}
-- double UserFormGeometryHelper::getLeft()
-- {
-- sal_Int32 nLeft = 0;
-- mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_LEFT ) ) ) >>= nLeft;
-- return Millimeter::getInPoints( nLeft );
-- }
-- void UserFormGeometryHelper::setLeft( double nLeft )
-- {
-- mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_LEFT ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nLeft ) ) );
-- }
-- double UserFormGeometryHelper::getTop()
-- {
-- sal_Int32 nTop = 0;
-- mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_TOP ) ) ) >>= nTop;
-- return Millimeter::getInPoints( nTop );
-- }
-- void UserFormGeometryHelper::setTop( double nTop )
-- {
-- mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_TOP ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nTop ) ) );
-- }
-- double UserFormGeometryHelper::getHeight()
-- {
-- sal_Int32 nHeight = 0;
-- mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CELLHGT ) ) ) >>= nHeight;
-- return Millimeter::getInPoints( nHeight );
-- }
-- void UserFormGeometryHelper::setHeight( double nHeight )
-- {
-- mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CELLHGT ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nHeight ) ) );
-- }
-- double UserFormGeometryHelper::getWidth()
-- {
-- sal_Int32 nWidth = 0;
-- mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CELLWID ) ) ) >>= nWidth;
-- return Millimeter::getInPoints( nWidth );
-- }
-- void UserFormGeometryHelper::setWidth( double nWidth)
-- {
-- mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CELLWID ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nWidth ) ) );
-- }
--
--SfxItemSet*
--ScVbaCellRangeAccess::GetDataSet( ScCellRangeObj* pRangeObj )
--{
-- SfxItemSet* pDataSet = pRangeObj ? pRangeObj->GetCurrentDataSet( true ) : NULL ;
-- return pDataSet;
--
--}
--
--} // vba
--} // ooo
-diff --git sc/source/ui/vba/vbamenu.cxx sc/source/ui/vba/vbamenu.cxx
-new file mode 100644
-index 0000000..58972b0
---- /dev/null
-+++ sc/source/ui/vba/vbamenu.cxx
-@@ -0,0 +1,91 @@
-+/*************************************************************************
-+ *
-+ * 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 "vbamenu.hxx"
-+#include "vbamenuitems.hxx"
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+
-+ScVbaMenu::ScVbaMenu( const uno::Reference< ov::XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< XCommandBarControl >& xCommandBarControl ) throw( uno::RuntimeException ) : Menu_BASE( xParent, xContext ), m_xCommandBarControl( xCommandBarControl )
-+{
-+}
-+
-+::rtl::OUString SAL_CALL
-+ScVbaMenu::getCaption() throw ( uno::RuntimeException )
-+{
-+ return m_xCommandBarControl->getCaption();
-+}
-+
-+void SAL_CALL
-+ScVbaMenu::setCaption( const ::rtl::OUString& _caption ) throw (uno::RuntimeException)
-+{
-+ m_xCommandBarControl->setCaption( _caption );
-+}
-+
-+void SAL_CALL
-+ScVbaMenu::Delete( ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ m_xCommandBarControl->Delete();
-+}
-+
-+uno::Any SAL_CALL
-+ScVbaMenu::MenuItems( const uno::Any& aIndex ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ uno::Reference< XCommandBarControls > xCommandBarControls( m_xCommandBarControl->Controls( uno::Any() ), uno::UNO_QUERY_THROW );
-+ uno::Reference< excel::XMenuItems > xMenuItems( new ScVbaMenuItems( this, mxContext, xCommandBarControls ) );
-+ if( aIndex.hasValue() )
-+ {
-+ return xMenuItems->Item( aIndex, uno::Any() );
-+ }
-+ return uno::makeAny( xMenuItems );
-+}
-+
-+rtl::OUString&
-+ScVbaMenu::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaMenu") );
-+ return sImplName;
-+}
-+uno::Sequence<rtl::OUString>
-+ScVbaMenu::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Menu" ) );
-+ }
-+ return aServiceNames;
-+}
-diff --git sc/source/ui/vba/vbamenu.hxx sc/source/ui/vba/vbamenu.hxx
-new file mode 100644
-index 0000000..cd96857
---- /dev/null
-+++ sc/source/ui/vba/vbamenu.hxx
-@@ -0,0 +1,62 @@
-+/*************************************************************************
-+ *
-+ * 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_MENU_HXX
-+#define SC_VBA_MENU_HXX
-+
-+#include <ooo/vba/excel/XMenu.hpp>
-+#include <ooo/vba/XCommandBarControl.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+
-+typedef InheritedHelperInterfaceImpl1< ov::excel::XMenu > Menu_BASE;
-+
-+class ScVbaMenu : public Menu_BASE
-+{
-+private:
-+ css::uno::Reference< ov::XCommandBarControl > m_xCommandBarControl;
-+
-+public:
-+ ScVbaMenu( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, const css::uno::Reference< ov::XCommandBarControl >& xCommandBarControl ) 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);
-+
-+ virtual void SAL_CALL Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL MenuItems( const css::uno::Any& aIndex ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif//SC_VBA_MENU_HXX
-diff --git sc/source/ui/vba/vbamenubar.cxx sc/source/ui/vba/vbamenubar.cxx
-new file mode 100644
-index 0000000..9386028
---- /dev/null
-+++ sc/source/ui/vba/vbamenubar.cxx
-@@ -0,0 +1,74 @@
-+/*************************************************************************
-+ *
-+ * 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 "vbamenubar.hxx"
-+#include "vbamenus.hxx"
-+#include <ooo/vba/XCommandBarControls.hpp>
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+
-+ScVbaMenuBar::ScVbaMenuBar( const uno::Reference< ov::XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< XCommandBar >& xCommandBar ) throw( uno::RuntimeException ) : MenuBar_BASE( xParent, xContext ), m_xCommandBar( xCommandBar )
-+{
-+}
-+
-+uno::Any SAL_CALL
-+ScVbaMenuBar::Menus( const uno::Any& aIndex ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ uno::Reference< XCommandBarControls > xCommandBarControls( m_xCommandBar->Controls( uno::Any() ), uno::UNO_QUERY_THROW );
-+ uno::Reference< excel::XMenus > xMenus( new ScVbaMenus( this, mxContext, xCommandBarControls ) );
-+ if( aIndex.hasValue() )
-+ {
-+ return xMenus->Item( aIndex, uno::Any() );
-+ }
-+ return uno::makeAny( xMenus );
-+}
-+
-+rtl::OUString&
-+ScVbaMenuBar::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaMenuBar") );
-+ return sImplName;
-+}
-+uno::Sequence<rtl::OUString>
-+ScVbaMenuBar::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.MenuBar" ) );
-+ }
-+ return aServiceNames;
-+}
-diff --git sc/source/ui/vba/vbamenubar.hxx sc/source/ui/vba/vbamenubar.hxx
-new file mode 100644
-index 0000000..fa39054
---- /dev/null
-+++ sc/source/ui/vba/vbamenubar.hxx
-@@ -0,0 +1,58 @@
-+/*************************************************************************
-+ *
-+ * 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_MENUBAR_HXX
-+#define SC_VBA_MENUBAR_HXX
-+
-+#include <ooo/vba/excel/XMenuBar.hpp>
-+#include <ooo/vba/XCommandBar.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+
-+typedef InheritedHelperInterfaceImpl1< ov::excel::XMenuBar > MenuBar_BASE;
-+
-+class ScVbaMenuBar : public MenuBar_BASE
-+{
-+private:
-+ css::uno::Reference< ov::XCommandBar > m_xCommandBar;
-+
-+public:
-+ ScVbaMenuBar( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, const css::uno::Reference< ov::XCommandBar >& xCommandBar ) throw( css::uno::RuntimeException );
-+
-+ virtual css::uno::Any SAL_CALL Menus( const css::uno::Any& aIndex ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif//SC_VBA_MENUBAR_HXX
-diff --git sc/source/ui/vba/vbamenubars.cxx sc/source/ui/vba/vbamenubars.cxx
-new file mode 100644
-index 0000000..a5f9e9b
---- /dev/null
-+++ sc/source/ui/vba/vbamenubars.cxx
-@@ -0,0 +1,146 @@
-+/*************************************************************************
-+ *
-+ * 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 "vbamenubars.hxx"
-+#include "vbamenubar.hxx"
-+#include <ooo/vba/excel/XlSheetType.hpp>
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+
-+
-+typedef ::cppu::WeakImplHelper1< container::XEnumeration > MenuBarEnumeration_BASE;
-+
-+class MenuBarEnumeration : public MenuBarEnumeration_BASE
-+{
-+ uno::Reference< XHelperInterface > m_xParent;
-+ uno::Reference< uno::XComponentContext > m_xContext;
-+ uno::Reference< container::XEnumeration > m_xEnumeration;
-+public:
-+ MenuBarEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration) throw ( uno::RuntimeException ) : m_xParent( xParent ), m_xContext( xContext ), m_xEnumeration( xEnumeration )
-+ {
-+ }
-+ virtual sal_Bool SAL_CALL hasMoreElements() throw ( uno::RuntimeException )
-+ {
-+ return m_xEnumeration->hasMoreElements();
-+ }
-+ virtual uno::Any SAL_CALL nextElement() throw ( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
-+ {
-+ // FIXME: should be add menubar
-+ if( hasMoreElements() )
-+ {
-+ uno::Reference< XCommandBar > xCommandBar( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
-+ uno::Reference< excel::XMenuBar > xMenuBar( new ScVbaMenuBar( m_xParent, m_xContext, xCommandBar ) );
-+ return uno::makeAny( xMenuBar );
-+ }
-+ else
-+ throw container::NoSuchElementException();
-+ return uno::Any();
-+ }
-+};
-+
-+ScVbaMenuBars::ScVbaMenuBars( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< XCommandBars >& xCommandBars ) throw ( uno::RuntimeException ) : MenuBars_BASE( xParent, xContext, uno::Reference< container::XIndexAccess>() ), m_xCommandBars( xCommandBars )
-+{
-+}
-+
-+ScVbaMenuBars::~ScVbaMenuBars()
-+{
-+}
-+
-+// XEnumerationAccess
-+uno::Type SAL_CALL
-+ScVbaMenuBars::getElementType() throw ( uno::RuntimeException )
-+{
-+ return excel::XMenuBar::static_type( 0 );
-+}
-+
-+uno::Reference< container::XEnumeration >
-+ScVbaMenuBars::createEnumeration() throw ( uno::RuntimeException )
-+{
-+ uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xCommandBars, uno::UNO_QUERY_THROW );
-+ return uno::Reference< container::XEnumeration >( new MenuBarEnumeration( this, mxContext, xEnumAccess->createEnumeration() ) );
-+}
-+
-+uno::Any
-+ScVbaMenuBars::createCollectionObject( const uno::Any& aSource )
-+{
-+ // make no sense
-+ return aSource;
-+}
-+
-+sal_Int32 SAL_CALL
-+ScVbaMenuBars::getCount() throw(css::uno::RuntimeException)
-+{
-+ return m_xCommandBars->getCount();
-+}
-+
-+// ScVbaCollectionBaseImpl
-+uno::Any SAL_CALL
-+ScVbaMenuBars::Item( const uno::Any& aIndex, const uno::Any& /*aIndex2*/ ) throw( uno::RuntimeException )
-+{
-+ sal_Int16 nIndex = 0;
-+ aIndex >>= nIndex;
-+ if( nIndex == excel::XlSheetType::xlWorksheet )
-+ {
-+ uno::Any aSource;
-+ aSource <<= rtl::OUString::createFromAscii( "Worksheet Menu Bar" );
-+ uno::Reference< XCommandBar > xCommandBar( m_xCommandBars->Item( aSource, uno::Any() ), uno::UNO_QUERY_THROW );
-+ uno::Reference< excel::XMenuBar > xMenuBar( new ScVbaMenuBar( this, mxContext, xCommandBar ) );
-+ return uno::makeAny( xMenuBar );
-+ }
-+
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+
-+ return uno::Any();
-+}
-+
-+// XHelperInterface
-+rtl::OUString&
-+ScVbaMenuBars::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaMenuBars") );
-+ return sImplName;
-+}
-+uno::Sequence<rtl::OUString>
-+ScVbaMenuBars::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.MenuBars" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sc/source/ui/vba/vbamenubars.hxx sc/source/ui/vba/vbamenubars.hxx
-new file mode 100644
-index 0000000..0d8ea58
---- /dev/null
-+++ sc/source/ui/vba/vbamenubars.hxx
-@@ -0,0 +1,69 @@
-+/*************************************************************************
-+ *
-+ * 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_MENUBARS_HXX
-+#define SC_VBA_MENUBARS_HXX
-+
-+#include <ooo/vba/excel/XMenuBars.hpp>
-+#include <ooo/vba/excel/XMenuBar.hpp>
-+#include <ooo/vba/XCommandBars.hpp>
-+#include <com/sun/star/container/XNameAccess.hpp>
-+#include <cppuhelper/implbase1.hxx>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <vbahelper/vbacollectionimpl.hxx>
-+
-+typedef CollTestImplHelper< ov::excel::XMenuBars > MenuBars_BASE;
-+
-+class ScVbaMenuBars : public MenuBars_BASE
-+{
-+private:
-+ css::uno::Reference< ov::XCommandBars > m_xCommandBars;
-+
-+public:
-+ ScVbaMenuBars( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< ov::XCommandBars >& xCommandBars ) throw (css::uno::RuntimeException);
-+ virtual ~ScVbaMenuBars();
-+
-+ // 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<rtl::OUString> getServiceNames();
-+};
-+
-+#endif//SC_VBA_MENUBARS_HXX
-diff --git sc/source/ui/vba/vbamenuitem.cxx sc/source/ui/vba/vbamenuitem.cxx
-new file mode 100644
-index 0000000..48254cc
---- /dev/null
-+++ sc/source/ui/vba/vbamenuitem.cxx
-@@ -0,0 +1,90 @@
-+/*************************************************************************
-+ *
-+ * 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 "vbamenuitem.hxx"
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+
-+ScVbaMenuItem::ScVbaMenuItem( const uno::Reference< ov::XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< XCommandBarControl >& xCommandBarControl ) throw( uno::RuntimeException ) : MenuItem_BASE( xParent, xContext ), m_xCommandBarControl( xCommandBarControl )
-+{
-+}
-+
-+::rtl::OUString SAL_CALL
-+ScVbaMenuItem::getCaption() throw ( uno::RuntimeException )
-+{
-+ return m_xCommandBarControl->getCaption();
-+}
-+
-+void SAL_CALL
-+ScVbaMenuItem::setCaption( const ::rtl::OUString& _caption ) throw (uno::RuntimeException)
-+{
-+ m_xCommandBarControl->setCaption( _caption );
-+}
-+
-+::rtl::OUString SAL_CALL
-+ScVbaMenuItem::getOnAction() throw ( uno::RuntimeException )
-+{
-+ return m_xCommandBarControl->getOnAction();
-+}
-+
-+void SAL_CALL
-+ScVbaMenuItem::setOnAction( const ::rtl::OUString& _onaction ) throw (uno::RuntimeException)
-+{
-+ m_xCommandBarControl->setOnAction( _onaction );
-+}
-+
-+void SAL_CALL
-+ScVbaMenuItem::Delete( ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ m_xCommandBarControl->Delete();
-+}
-+
-+rtl::OUString&
-+ScVbaMenuItem::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaMenuItem") );
-+ return sImplName;
-+}
-+uno::Sequence<rtl::OUString>
-+ScVbaMenuItem::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.MenuItem" ) );
-+ }
-+ return aServiceNames;
-+}
-diff --git sc/source/ui/vba/vbamenuitem.hxx sc/source/ui/vba/vbamenuitem.hxx
-new file mode 100644
-index 0000000..bf4c087
---- /dev/null
-+++ sc/source/ui/vba/vbamenuitem.hxx
-@@ -0,0 +1,63 @@
-+/*************************************************************************
-+ *
-+ * 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_MENUITEM_HXX
-+#define SC_VBA_MENUITEM_HXX
-+
-+#include <ooo/vba/excel/XMenuItem.hpp>
-+#include <ooo/vba/XCommandBarControl.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+
-+typedef InheritedHelperInterfaceImpl1< ov::excel::XMenuItem > MenuItem_BASE;
-+
-+class ScVbaMenuItem : public MenuItem_BASE
-+{
-+private:
-+ css::uno::Reference< ov::XCommandBarControl > m_xCommandBarControl;
-+
-+public:
-+ ScVbaMenuItem( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, const css::uno::Reference< ov::XCommandBarControl >& xCommandBarControl ) 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);
-+ virtual ::rtl::OUString SAL_CALL getOnAction() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setOnAction( const ::rtl::OUString& _onaction ) throw (css::uno::RuntimeException);
-+
-+ virtual void SAL_CALL Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif//SC_VBA_MENUITEM_HXX
-diff --git sc/source/ui/vba/vbamenuitems.cxx sc/source/ui/vba/vbamenuitems.cxx
-new file mode 100644
-index 0000000..3a5cd79
---- /dev/null
-+++ sc/source/ui/vba/vbamenuitems.cxx
-@@ -0,0 +1,159 @@
-+/*************************************************************************
-+ *
-+ * 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 "vbamenuitems.hxx"
-+#include "vbamenuitem.hxx"
-+#include "vbamenu.hxx"
-+#include <ooo/vba/office/MsoControlType.hpp>
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+
-+
-+typedef ::cppu::WeakImplHelper1< container::XEnumeration > MenuEnumeration_BASE;
-+
-+class MenuEnumeration : public MenuEnumeration_BASE
-+{
-+ uno::Reference< XHelperInterface > m_xParent;
-+ uno::Reference< uno::XComponentContext > m_xContext;
-+ uno::Reference< container::XEnumeration > m_xEnumeration;
-+public:
-+ MenuEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration) throw ( uno::RuntimeException ) : m_xParent( xParent ), m_xContext( xContext ), m_xEnumeration( xEnumeration )
-+ {
-+ }
-+ virtual sal_Bool SAL_CALL hasMoreElements() throw ( uno::RuntimeException )
-+ {
-+ return m_xEnumeration->hasMoreElements();
-+ }
-+ virtual uno::Any SAL_CALL nextElement() throw ( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
-+ {
-+ // FIXME: should be add menu
-+ if( hasMoreElements() )
-+ {
-+ uno::Reference< XCommandBarControl > xCommandBarControl( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
-+ if( xCommandBarControl->getType() == office::MsoControlType::msoControlPopup )
-+ {
-+ uno::Reference< excel::XMenu > xMenu( new ScVbaMenu( m_xParent, m_xContext, xCommandBarControl ) );
-+ return uno::makeAny( xMenu );
-+ }
-+ else if( xCommandBarControl->getType() == office::MsoControlType::msoControlButton )
-+ {
-+ uno::Reference< excel::XMenuItem > xMenuItem( new ScVbaMenuItem( m_xParent, m_xContext, xCommandBarControl ) );
-+ return uno::makeAny( xMenuItem );
-+ }
-+ nextElement();
-+ }
-+ else
-+ throw container::NoSuchElementException();
-+ return uno::Any();
-+ }
-+};
-+
-+ScVbaMenuItems::ScVbaMenuItems( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< XCommandBarControls >& xCommandBarControls ) throw ( uno::RuntimeException ) : MenuItems_BASE( xParent, xContext, uno::Reference< container::XIndexAccess>() ), m_xCommandBarControls( xCommandBarControls )
-+{
-+}
-+
-+// XEnumerationAccess
-+uno::Type SAL_CALL
-+ScVbaMenuItems::getElementType() throw ( uno::RuntimeException )
-+{
-+ return excel::XMenuItem::static_type( 0 );
-+}
-+
-+uno::Reference< container::XEnumeration >
-+ScVbaMenuItems::createEnumeration() throw ( uno::RuntimeException )
-+{
-+ uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xCommandBarControls, uno::UNO_QUERY_THROW );
-+ return uno::Reference< container::XEnumeration >( new MenuEnumeration( this, mxContext, xEnumAccess->createEnumeration() ) );
-+}
-+
-+uno::Any
-+ScVbaMenuItems::createCollectionObject( const uno::Any& aSource )
-+{
-+ // make no sense
-+ return aSource;
-+}
-+
-+sal_Int32 SAL_CALL
-+ScVbaMenuItems::getCount() throw(css::uno::RuntimeException)
-+{
-+ // FIXME: should check if it is a popup menu
-+ return m_xCommandBarControls->getCount();
-+}
-+
-+// ScVbaCollectionBaseImpl
-+uno::Any SAL_CALL
-+ScVbaMenuItems::Item( const uno::Any& aIndex, const uno::Any& /*aIndex2*/ ) throw( uno::RuntimeException )
-+{
-+ uno::Reference< XCommandBarControl > xCommandBarControl( m_xCommandBarControls->Item( aIndex, uno::Any() ), uno::UNO_QUERY_THROW );
-+ if( xCommandBarControl->getType() == office::MsoControlType::msoControlPopup )
-+ return uno::makeAny( uno::Reference< excel::XMenu > ( new ScVbaMenu( this, mxContext, xCommandBarControl ) ) );
-+ else if( xCommandBarControl->getType() == office::MsoControlType::msoControlButton )
-+ return uno::makeAny( uno::Reference< excel::XMenuItem > ( new ScVbaMenuItem( this, mxContext, xCommandBarControl ) ) );
-+ throw uno::RuntimeException();
-+}
-+
-+uno::Reference< excel::XMenuItem > SAL_CALL ScVbaMenuItems::Add( const rtl::OUString& Caption, const css::uno::Any& OnAction, const css::uno::Any& /*ShortcutKey*/, const css::uno::Any& Before, const css::uno::Any& Restore, const css::uno::Any& /*StatusBar*/, const css::uno::Any& /*HelpFile*/, const css::uno::Any& /*HelpContextID*/ ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
-+{
-+ sal_Int32 nType = office::MsoControlType::msoControlButton;
-+ uno::Reference< XCommandBarControl > xCommandBarControl = m_xCommandBarControls->Add( uno::makeAny( nType ), uno::Any(), uno::Any(), Before, Restore );
-+ xCommandBarControl->setCaption( Caption );
-+ if( OnAction.hasValue() )
-+ {
-+ rtl::OUString sAction;
-+ OnAction >>= sAction;
-+ xCommandBarControl->setOnAction( sAction );
-+ }
-+ return uno::Reference< excel::XMenuItem >( new ScVbaMenuItem( this, mxContext, xCommandBarControl ) );
-+}
-+
-+// XHelperInterface
-+rtl::OUString&
-+ScVbaMenuItems::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaMenuItems") );
-+ return sImplName;
-+}
-+uno::Sequence<rtl::OUString>
-+ScVbaMenuItems::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.MenuItems" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sc/source/ui/vba/vbamenuitems.hxx sc/source/ui/vba/vbamenuitems.hxx
-new file mode 100644
-index 0000000..8aeb931
---- /dev/null
-+++ sc/source/ui/vba/vbamenuitems.hxx
-@@ -0,0 +1,68 @@
-+/*************************************************************************
-+ *
-+ * 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_MENUITEMS_HXX
-+#define SC_VBA_MENUITEMS_HXX
-+
-+#include <ooo/vba/excel/XMenuItems.hpp>
-+#include <ooo/vba/excel/XMenuItem.hpp>
-+#include <ooo/vba/XCommandBarControls.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <vbahelper/vbacollectionimpl.hxx>
-+
-+typedef CollTestImplHelper< ov::excel::XMenuItems > MenuItems_BASE;
-+
-+class ScVbaMenuItems : public MenuItems_BASE
-+{
-+private:
-+ css::uno::Reference< ov::XCommandBarControls > m_xCommandBarControls;
-+
-+public:
-+ ScVbaMenuItems( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< ov::XCommandBarControls >& xCommandBarControls ) 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 sal_Int32 SAL_CALL getCount() throw(css::uno::RuntimeException);
-+ 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::excel::XMenuItem > SAL_CALL Add( const rtl::OUString& Caption, const css::uno::Any& OnAction, const css::uno::Any& ShortcutKey, const css::uno::Any& Before, const css::uno::Any& Restore, const css::uno::Any& StatusBar, const css::uno::Any& HelpFile, const css::uno::Any& HelpContextID ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif//SC_VBA_MENUITEMS_HXX
-diff --git sc/source/ui/vba/vbamenus.cxx sc/source/ui/vba/vbamenus.cxx
-new file mode 100644
-index 0000000..7d5a21b
---- /dev/null
-+++ sc/source/ui/vba/vbamenus.cxx
-@@ -0,0 +1,145 @@
-+/*************************************************************************
-+ *
-+ * 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 "vbamenus.hxx"
-+#include "vbamenu.hxx"
-+#include <ooo/vba/office/MsoControlType.hpp>
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+
-+
-+typedef ::cppu::WeakImplHelper1< container::XEnumeration > MenuEnumeration_BASE;
-+
-+class MenuEnumeration : public MenuEnumeration_BASE
-+{
-+ uno::Reference< XHelperInterface > m_xParent;
-+ uno::Reference< uno::XComponentContext > m_xContext;
-+ uno::Reference< container::XEnumeration > m_xEnumeration;
-+public:
-+ MenuEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration) throw ( uno::RuntimeException ) : m_xParent( xParent ), m_xContext( xContext ), m_xEnumeration( xEnumeration )
-+ {
-+ }
-+ virtual sal_Bool SAL_CALL hasMoreElements() throw ( uno::RuntimeException )
-+ {
-+ return m_xEnumeration->hasMoreElements();
-+ }
-+ virtual uno::Any SAL_CALL nextElement() throw ( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
-+ {
-+ // FIXME: should be add menu
-+ if( hasMoreElements() )
-+ {
-+ uno::Reference< XCommandBarControl > xCommandBarControl( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
-+ if( xCommandBarControl->getType() == office::MsoControlType::msoControlPopup )
-+ {
-+ uno::Reference< excel::XMenu > xMenu( new ScVbaMenu( m_xParent, m_xContext, xCommandBarControl ) );
-+ return uno::makeAny( xMenu );
-+ }
-+ nextElement();
-+ }
-+ else
-+ throw container::NoSuchElementException();
-+ return uno::Any();
-+ }
-+};
-+
-+ScVbaMenus::ScVbaMenus( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< XCommandBarControls >& xCommandBarControls ) throw ( uno::RuntimeException ) : Menus_BASE( xParent, xContext, uno::Reference< container::XIndexAccess>() ), m_xCommandBarControls( xCommandBarControls )
-+{
-+}
-+
-+// XEnumerationAccess
-+uno::Type SAL_CALL
-+ScVbaMenus::getElementType() throw ( uno::RuntimeException )
-+{
-+ return excel::XMenu::static_type( 0 );
-+}
-+
-+uno::Reference< container::XEnumeration >
-+ScVbaMenus::createEnumeration() throw ( uno::RuntimeException )
-+{
-+ uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xCommandBarControls, uno::UNO_QUERY_THROW );
-+ return uno::Reference< container::XEnumeration >( new MenuEnumeration( this, mxContext, xEnumAccess->createEnumeration() ) );
-+}
-+
-+uno::Any
-+ScVbaMenus::createCollectionObject( const uno::Any& aSource )
-+{
-+ // make no sense
-+ return aSource;
-+}
-+
-+sal_Int32 SAL_CALL
-+ScVbaMenus::getCount() throw(css::uno::RuntimeException)
-+{
-+ // FIXME: should check if it is a popup menu
-+ return m_xCommandBarControls->getCount();
-+}
-+
-+// ScVbaCollectionBaseImpl
-+uno::Any SAL_CALL
-+ScVbaMenus::Item( const uno::Any& aIndex, const uno::Any& /*aIndex2*/ ) throw( uno::RuntimeException )
-+{
-+ uno::Reference< XCommandBarControl > xCommandBarControl( m_xCommandBarControls->Item( aIndex, uno::Any() ), uno::UNO_QUERY_THROW );
-+ if( xCommandBarControl->getType() != office::MsoControlType::msoControlPopup )
-+ throw uno::RuntimeException();
-+ return uno::makeAny( uno::Reference< excel::XMenu > ( new ScVbaMenu( this, mxContext, xCommandBarControl ) ) );
-+}
-+
-+uno::Reference< excel::XMenu > SAL_CALL ScVbaMenus::Add( const rtl::OUString& Caption, const css::uno::Any& Before, const css::uno::Any& Restore ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
-+{
-+ sal_Int32 nType = office::MsoControlType::msoControlPopup;
-+ uno::Reference< XCommandBarControl > xCommandBarControl = m_xCommandBarControls->Add( uno::makeAny( nType ), uno::Any(), uno::Any(), Before, Restore );
-+ xCommandBarControl->setCaption( Caption );
-+ return uno::Reference< excel::XMenu >( new ScVbaMenu( this, mxContext, xCommandBarControl ) );
-+}
-+
-+// XHelperInterface
-+rtl::OUString&
-+ScVbaMenus::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaMenus") );
-+ return sImplName;
-+}
-+uno::Sequence<rtl::OUString>
-+ScVbaMenus::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Menus" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sc/source/ui/vba/vbamenus.hxx sc/source/ui/vba/vbamenus.hxx
-new file mode 100644
-index 0000000..596127e
---- /dev/null
-+++ sc/source/ui/vba/vbamenus.hxx
-@@ -0,0 +1,68 @@
-+/*************************************************************************
-+ *
-+ * 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_MENUS_HXX
-+#define SC_VBA_MENUS_HXX
-+
-+#include <ooo/vba/excel/XMenus.hpp>
-+#include <ooo/vba/excel/XMenu.hpp>
-+#include <ooo/vba/XCommandBarControls.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <vbahelper/vbacollectionimpl.hxx>
-+
-+typedef CollTestImplHelper< ov::excel::XMenus > Menus_BASE;
-+
-+class ScVbaMenus : public Menus_BASE
-+{
-+private:
-+ css::uno::Reference< ov::XCommandBarControls > m_xCommandBarControls;
-+
-+public:
-+ ScVbaMenus( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< ov::XCommandBarControls >& xCommandBarControls ) 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 sal_Int32 SAL_CALL getCount() throw(css::uno::RuntimeException);
-+ 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::excel::XMenu > SAL_CALL Add( const rtl::OUString& Caption, const css::uno::Any& Before, const css::uno::Any& Restore ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif//SC_VBA_MENUS_HXX
-diff --git sc/source/ui/vba/vbaname.cxx sc/source/ui/vba/vbaname.cxx
-index 66381c1..b5238cf 100644
---- sc/source/ui/vba/vbaname.cxx
-+++ sc/source/ui/vba/vbaname.cxx
-@@ -69,8 +69,8 @@ ScVbaName::getWorkSheet() throw (css::uno::RuntimeException)
- ScVbaName::getName() throw (css::uno::RuntimeException)
- {
- String sName;
-- sName += UniString( getWorkSheet()->getName());
-- sName += String::CreateFromAscii("!");
-+ //sName += UniString( getWorkSheet()->getName()); //liuchen 2009-9-9 resolve the defect that the name get by macro code are not the same with that in UI (for example, if a name of "AA" is found in the UI "Define Names" dialog box, the result of get that name through macro code will be "Sheet1!AA")
-+ //sName += String::CreateFromAscii("!");
- sName += UniString ( mxNamedRange->getName() );
- return ::rtl::OUString( sName );
- }
-diff --git sc/source/ui/vba/vbapagebreaks.cxx sc/source/ui/vba/vbapagebreaks.cxx
-index ebb5a0d..6103296 100644
---- sc/source/ui/vba/vbapagebreaks.cxx
-+++ sc/source/ui/vba/vbapagebreaks.cxx
-@@ -115,10 +115,13 @@ sal_Int32 SAL_CALL RangePageBreaks::getCount( ) throw (uno::RuntimeException)
- for( sal_Int32 i=0; i<nLength; i++ )
- {
- sal_Int32 nPos = aTablePageBreakData[i].Position;
-- if( nPos > nUsedEnd )
-- return nCount;
-- if( nPos >= nUsedStart )
-- nCount++;
-+
-+ // VBA. minz@cn.ibm.com. All page breaks before the used range should be counted.
-+ // And the page break at the end of the used range also should be counted.
-+ if( nPos <= nUsedEnd + 1 )
-+ nCount++;
-+ else
-+ return nCount;
- }
-
- return nCount;
-@@ -144,26 +147,15 @@ uno::Any SAL_CALL RangePageBreaks::getByIndex( sal_Int32 Index ) throw (lang::In
-
- sheet::TablePageBreakData RangePageBreaks::getTablePageBreakData( sal_Int32 nAPIItemIndex ) throw ( script::BasicErrorException, uno::RuntimeException)
- {
-- sal_Int32 index = -1;
- sheet::TablePageBreakData aTablePageBreakData;
- uno::Reference< excel::XWorksheet > xWorksheet( mxParent, uno::UNO_QUERY_THROW );
- uno::Reference< excel::XRange > xRange = xWorksheet->getUsedRange();
-- sal_Int32 nUsedStart = getAPIStartofRange( xRange );
-- sal_Int32 nUsedEnd = getAPIEndIndexofRange( xRange, nUsedStart );
- uno::Sequence<sheet::TablePageBreakData> aTablePageBreakDataList = getAllPageBreaks();
-
- sal_Int32 nLength = aTablePageBreakDataList.getLength();
-- for( sal_Int32 i=0; i<nLength; i++ )
-- {
-- aTablePageBreakData = aTablePageBreakDataList[i];
-- sal_Int32 nPos = aTablePageBreakData.Position;
-- if( nPos >= nUsedStart )
-- index++;
-- if( nPos > nUsedEnd )
-- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
-- if( index == nAPIItemIndex )
-- return aTablePageBreakData;
-- }
-+ //VBA. minz@cn.ibm.com. No need to filter the page break. All page breaks before the used range are counted.
-+ if ( nAPIItemIndex < nLength && nAPIItemIndex>=0 )
-+ aTablePageBreakData = aTablePageBreakDataList[nAPIItemIndex];
-
- return aTablePageBreakData;
- }
-diff --git sc/source/ui/vba/vbapagesetup.cxx sc/source/ui/vba/vbapagesetup.cxx
-index eeba5be..246aa5c 100644
---- sc/source/ui/vba/vbapagesetup.cxx
-+++ sc/source/ui/vba/vbapagesetup.cxx
-@@ -37,6 +37,9 @@
- #include <ooo/vba/excel/XlPageOrientation.hpp>
- #include <ooo/vba/excel/XlOrder.hpp>
- #include <ooo/vba/excel/Constants.hpp>
-+#include <i18npool/paper.hxx>
-+#include <editeng/paperinf.hxx>
-+#include <ooo/vba/excel/XlPaperSize.hpp>
-
- using namespace ::com::sun::star;
- using namespace ::ooo::vba;
-@@ -624,3 +627,105 @@ ScVbaPageSetup::getServiceNames()
- }
- return aServiceNames;
- }
-+
-+//liuchen 2009-12-11
-+
-+struct PaperSizeMap
-+{
-+ Paper ePaper;
-+ sal_Int32 xlPaper;
-+};
-+
-+static PaperSizeMap paperSizeMappings[] =
-+{
-+ { PAPER_A3, ooo::vba::excel::XlPaperSize::xlPaperA3 },
-+ { PAPER_A4, ooo::vba::excel::XlPaperSize::xlPaperA4 },
-+ { PAPER_A5, ooo::vba::excel::XlPaperSize::xlPaperA5 },
-+ { PAPER_B4_ISO, ooo::vba::excel::XlPaperSize::xlPaperB4 },
-+ { PAPER_B5_ISO, ooo::vba::excel::XlPaperSize::xlPaperB5 },
-+ { PAPER_LETTER, ooo::vba::excel::XlPaperSize::xlPaperLetter },
-+ { PAPER_LEGAL, ooo::vba::excel::XlPaperSize::xlPaperLegal },
-+ { PAPER_TABLOID, ooo::vba::excel::XlPaperSize::xlPaperTabloid },
-+ { PAPER_USER, ooo::vba::excel::XlPaperSize::xlPaperUser },
-+ { PAPER_B6_ISO, ooo::vba::excel::XlPaperSize::xlPaperEnvelopeB6 },
-+ { PAPER_ENV_C4, ooo::vba::excel::XlPaperSize::xlPaperEnvelopeC4 },
-+ { PAPER_ENV_C5, ooo::vba::excel::XlPaperSize::xlPaperEnvelopeC5 },
-+ { PAPER_ENV_C6, ooo::vba::excel::XlPaperSize::xlPaperEnvelopeC6 },
-+ { PAPER_ENV_C65, ooo::vba::excel::XlPaperSize::xlPaperEnvelopeC65 },
-+ { PAPER_ENV_DL, ooo::vba::excel::XlPaperSize::xlPaperEnvelopeDL },
-+ { PAPER_C, ooo::vba::excel::XlPaperSize::xlPaperCsheet },
-+ { PAPER_D, ooo::vba::excel::XlPaperSize::xlPaperDsheet },
-+ { PAPER_E, ooo::vba::excel::XlPaperSize::xlPaperEsheet },
-+ { PAPER_ENV_MONARCH, ooo::vba::excel::XlPaperSize::xlPaperEnvelopeMonarch },
-+ { PAPER_ENV_PERSONAL, ooo::vba::excel::XlPaperSize::xlPaperEnvelopePersonal },
-+ { PAPER_ENV_9, ooo::vba::excel::XlPaperSize::xlPaperEnvelope9 },
-+ { PAPER_ENV_10, ooo::vba::excel::XlPaperSize::xlPaperEnvelope10 },
-+ { PAPER_ENV_11, ooo::vba::excel::XlPaperSize::xlPaperEnvelope11 },
-+ { PAPER_ENV_12, ooo::vba::excel::XlPaperSize::xlPaperEnvelope12 }
-+};
-+
-+static const int nMapSize = sizeof(paperSizeMappings) / sizeof(paperSizeMappings[0]);
-+
-+sal_Int32 PaperSizeOOoToExcel(Paper ePaper)
-+{
-+ sal_Int32 nPaperSize = ooo::vba::excel::XlPaperSize::xlPaperUser;
-+
-+ for (int i = 0; i < nMapSize; i++)
-+ {
-+ if (ePaper == paperSizeMappings[i].ePaper)
-+ {
-+ nPaperSize = paperSizeMappings[i].xlPaper;
-+ break;
-+ }
-+ }
-+
-+ return nPaperSize;
-+}
-+
-+sal_Int32 SAL_CALL ScVbaPageSetup::getPaperSize() throw (css::uno::RuntimeException)
-+{
-+ com::sun::star::awt::Size size;
-+ Paper ePaper = PAPER_USER;
-+
-+ try
-+ {
-+ uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Size")));
-+ aValue >>= size;
-+ ePaper = SvxPaperInfo::GetSvxPaper( Size(size.Width, size.Height), MAP_100TH_MM, TRUE);
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+
-+ return PaperSizeOOoToExcel(ePaper);
-+}
-+
-+Paper PaperSizeExcelToOOo( sal_Int32 xlPaper)
-+{
-+ Paper ePaper = PAPER_USER;
-+
-+ for (int i = 0; i < nMapSize; i++)
-+ {
-+ if (xlPaper == paperSizeMappings[i].xlPaper)
-+ {
-+ ePaper = paperSizeMappings[i].ePaper;
-+ break;
-+ }
-+ }
-+
-+ return ePaper;
-+}
-+void SAL_CALL ScVbaPageSetup::setPaperSize( sal_Int32 paperSize) throw (css::uno::RuntimeException)
-+{
-+ Paper ePaper = PaperSizeExcelToOOo( paperSize );
-+
-+ try
-+ {
-+ Size size1 = SvxPaperInfo::GetPaperSize( ePaper, MAP_100TH_MM );
-+ com::sun::star::awt::Size size(size1.Width(), size1.Height());
-+ mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Size")), uno::makeAny( size ));
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+}
-diff --git sc/source/ui/vba/vbapagesetup.hxx sc/source/ui/vba/vbapagesetup.hxx
-index 09a996c..0afb600 100644
---- sc/source/ui/vba/vbapagesetup.hxx
-+++ sc/source/ui/vba/vbapagesetup.hxx
-@@ -82,6 +82,8 @@ public:
- virtual void SAL_CALL setCenterHorizontally( sal_Bool centerHorizontally ) throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getPrintHeadings() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setPrintHeadings( sal_Bool printHeadings ) throw (css::uno::RuntimeException);
-+ virtual sal_Int32 SAL_CALL getPaperSize() throw (css::uno::RuntimeException); //liuchen 2009-12-11
-+ virtual void SAL_CALL setPaperSize( sal_Int32 paperSize ) throw (css::uno::RuntimeException); //liuchen 2009-12-11
-
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
-diff --git sc/source/ui/vba/vbapivotcache.cxx sc/source/ui/vba/vbapivotcache.cxx
-index 1ca3ca3..8d128e0 100644
---- sc/source/ui/vba/vbapivotcache.cxx
-+++ sc/source/ui/vba/vbapivotcache.cxx
-@@ -34,6 +34,17 @@ ScVbaPivotCache::ScVbaPivotCache( const uno::Reference< XHelperInterface >& xPar
- {
- }
-
-+sal_Int32
-+ScVbaPivotCache::getMissingItemsLimit() throw (css::uno::RuntimeException)
-+{
-+ return -1;
-+}
-+
-+void
-+ScVbaPivotCache::setMissingItemsLimit( sal_Int32 /*aValue*/ ) throw ( css::uno::RuntimeException)
-+{
-+}
-+
- void SAL_CALL
- ScVbaPivotCache::Refresh() throw (css::uno::RuntimeException)
- {
-diff --git sc/source/ui/vba/vbapivotcache.hxx sc/source/ui/vba/vbapivotcache.hxx
-index 682c640..e32619b 100644
---- sc/source/ui/vba/vbapivotcache.hxx
-+++ sc/source/ui/vba/vbapivotcache.hxx
-@@ -40,6 +40,10 @@ class ScVbaPivotCache : public PivotCacheImpl_BASE
- css::uno::Reference< css::sheet::XDataPilotTable > m_xTable;
- public:
- ScVbaPivotCache( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::sheet::XDataPilotTable >& xTable );
-+
-+ virtual ::sal_Int32 SAL_CALL getMissingItemsLimit() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setMissingItemsLimit( ::sal_Int32 aValue ) throw ( css::uno::RuntimeException);
-+
- virtual void SAL_CALL Refresh() throw (css::uno::RuntimeException);
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
-diff --git sc/source/ui/vba/vbaquerytable.cxx sc/source/ui/vba/vbaquerytable.cxx
-new file mode 100644
-index 0000000..5ef6eec
---- /dev/null
-+++ sc/source/ui/vba/vbaquerytable.cxx
-@@ -0,0 +1,89 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009, 2010.
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#include "vbaquerytable.hxx"
-+#include "document.hxx"
-+#include "docsh.hxx"
-+#include "sfx2/lnkbase.hxx"
-+#include "sfx2/linkmgr.hxx"
-+#include "arealink.hxx"
-+#include "vbarange.hxx"
-+
-+using namespace com::sun::star;
-+
-+
-+ScVbaQueryTable::ScVbaQueryTable(const css::uno::Reference< ov::XHelperInterface >& xParent,
-+ const css::uno::Reference< css::uno::XComponentContext > & xContext,
-+ ScDocument *pDocument ,
-+ ScVbaRange *pParent
-+ )
-+//:QueryTable_Base(xParent, xContext)
-+{
-+ m_pDocument = pDocument;
-+ m_pParent = pParent;
-+}
-+
-+ScVbaQueryTable::~ScVbaQueryTable()
-+{
-+
-+}
-+
-+::sal_Bool SAL_CALL
-+ScVbaQueryTable::Refresh( const ::com::sun::star::uno::Any& aBackgroundQuery ) throw (::com::sun::star::uno::RuntimeException)
-+{
-+
-+ //Get parent Info
-+ sal_Int32 nRow = m_pParent->getRow();
-+ sal_Int32 nClm = m_pParent->getColumn();
-+ sal_Int16 nTab = m_pParent->getWorksheet()->getIndex() - 1; //The vba index begin from 1.
-+ ScAddress crrRngAddr(nClm, nRow, nTab);
-+
-+ //Get link info
-+ sfx2::LinkManager *pLinkMng = m_pDocument->GetLinkManager();
-+ const ::sfx2::SvBaseLinks &rLinks = pLinkMng->GetLinks();
-+ USHORT nCount = rLinks.Count();
-+
-+ for (USHORT i=0; i<nCount; i++)
-+ {
-+ ::sfx2::SvBaseLink* pBase = *rLinks[i];
-+ if (pBase->ISA(ScAreaLink))
-+ {
-+
-+ ScAreaLink *pAreaLink = (ScAreaLink *)pBase;
-+ const ScRange &destRange = pAreaLink->GetDestArea();
-+ if (destRange.In(crrRngAddr))
-+ {
-+ pBase->Update();
-+ }
-+ }
-+ }
-+
-+ return sal_True;
-+}
-+
-+
-diff --git sc/source/ui/vba/vbaquerytable.hxx sc/source/ui/vba/vbaquerytable.hxx
-new file mode 100644
-index 0000000..9c05e9a
---- /dev/null
-+++ sc/source/ui/vba/vbaquerytable.hxx
-@@ -0,0 +1,59 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009, 2010.
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef SC_VBA_QUERYTABLE_HXX
-+#define SC_VBA_QUERYTABLE_HXX
-+
-+
-+#include <ooo/vba/excel/XQueryTable.hpp>
-+#include "vbahelper/vbahelperinterface.hxx"
-+
-+using namespace ::ooo::vba;
-+typedef ::cppu::WeakImplHelper1<excel::XQueryTable> QueryTable_Base;
-+
-+class ScDocument;
-+class ScVbaRange;
-+
-+class ScVbaQueryTable : public QueryTable_Base
-+{
-+private:
-+ ScDocument *m_pDocument;
-+ ScVbaRange *m_pParent;
-+public:
-+ ScVbaQueryTable(const css::uno::Reference< ov::XHelperInterface >& xParent,
-+ const css::uno::Reference< css::uno::XComponentContext > & xContext,
-+ ScDocument *pDocument = NULL,
-+ ScVbaRange *pParent = NULL
-+ );
-+ ~ScVbaQueryTable();
-+ virtual ::sal_Bool SAL_CALL Refresh( const ::com::sun::star::uno::Any& aBackgroundQuery )
-+ throw (::com::sun::star::uno::RuntimeException);
-+
-+};
-+
-+#endif
-diff --git sc/source/ui/vba/vbarange.cxx sc/source/ui/vba/vbarange.cxx
-index 8fcfcd5..dd93063 100755
---- sc/source/ui/vba/vbarange.cxx
-+++ sc/source/ui/vba/vbarange.cxx
-@@ -43,7 +43,6 @@
- #include <com/sun/star/text/XTextRange.hpp>
- #include <com/sun/star/sheet/XCellRangeAddressable.hpp>
- #include <com/sun/star/table/CellRangeAddress.hpp>
--#include <com/sun/star/table/CellAddress.hpp>
- #include <com/sun/star/sheet/XSpreadsheetView.hpp>
- #include <com/sun/star/sheet/XCellRangeReferrer.hpp>
- #include <com/sun/star/sheet/XSheetCellRange.hpp>
-@@ -92,6 +91,15 @@
- #include <com/sun/star/sheet/XSubTotalDescriptor.hpp>
- #include <com/sun/star/sheet/GeneralFunction.hdl>
-
-+#include <com/sun/star/sheet/XSheetAnnotationsSupplier.hpp>
-+#include <com/sun/star/sheet/XSheetAnnotations.hpp>
-+
-+#include <com/sun/star/sheet/XDataPilotTable.hpp>
-+#include <com/sun/star/sheet/XDataPilotTable2.hpp>
-+#include <com/sun/star/sheet/XDataPilotTablesSupplier.hpp>
-+#include <com/sun/star/sheet/DataPilotTablePositionData.hpp>
-+#include <com/sun/star/sheet/DataPilotTablePositionType.hpp>
-+
- #include <ooo/vba/excel/XlPasteSpecialOperation.hpp>
- #include <ooo/vba/excel/XlPasteType.hpp>
- #include <ooo/vba/excel/Constants.hpp>
-@@ -117,12 +125,15 @@
- #include <ooo/vba/excel/XlSpecialCellsValue.hpp>
- #include <ooo/vba/excel/XlConsolidationFunction.hpp>
- #include <ooo/vba/excel/XlSearchDirection.hpp>
-+#include <ooo/vba/excel/XlColumnDataType.hpp>
-+#include <ooo/vba/excel/XlFilterAction.hpp>
-
- #include <scitems.hxx>
- #include <svl/srchitem.hxx>
- #include <cellsuno.hxx>
- #include <dbcolect.hxx>
- #include "docfunc.hxx"
-+#include <docuno.hxx>
-
- #include <sfx2/dispatch.hxx>
- #include <sfx2/app.hxx>
-@@ -133,6 +144,7 @@
- #include <sc.hrc>
- #include <globstr.hrc>
- #include <unonames.hxx>
-+#include <tools/stream.hxx>
-
- #include "vbarange.hxx"
- #include "vbafont.hxx"
-@@ -144,8 +156,13 @@
- #include "vbavalidation.hxx"
- #include "vbahyperlinks.hxx"
-
-+#include "vbapivottable.hxx"
-+
-+#include "asciiopt.hxx"
-+#include "impex.hxx"
- #include "tabvwsh.hxx"
- #include "rangelst.hxx"
-+#include "rangenam.hxx"
- #include "convuno.hxx"
- #include "compiler.hxx"
- #include "attrib.hxx"
-@@ -363,55 +380,6 @@ ScVbaRangeAreas::createCollectionObject( const uno::Any& aSource )
- return lcl_makeRange( mxParent, mxContext, aSource, mbIsRows, mbIsColumns );
- }
-
--// assume that xIf is infact a ScCellRangesBase
--ScDocShell*
--getDocShellFromIf( const uno::Reference< uno::XInterface >& xIf ) throw ( uno::RuntimeException )
--{
-- ScCellRangesBase* pUno = ScCellRangesBase::getImplementation( xIf );
-- if ( !pUno )
-- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Failed to access underlying uno range object" ) ), uno::Reference< uno::XInterface >() );
-- return pUno->GetDocShell();
--}
--
--ScDocShell*
--getDocShellFromRange( const uno::Reference< table::XCellRange >& xRange ) throw ( uno::RuntimeException )
--{
-- // need the ScCellRangesBase to get docshell
-- uno::Reference< uno::XInterface > xIf( xRange, uno::UNO_QUERY_THROW );
-- return getDocShellFromIf(xIf );
--}
--
--ScDocShell*
--getDocShellFromRanges( const uno::Reference< sheet::XSheetCellRangeContainer >& xRanges ) throw ( uno::RuntimeException )
--{
-- // need the ScCellRangesBase to get docshell
-- uno::Reference< uno::XInterface > xIf( xRanges, uno::UNO_QUERY_THROW );
-- return getDocShellFromIf(xIf );
--}
--
--uno::Reference< frame::XModel > getModelFromXIf( const uno::Reference< uno::XInterface >& xIf ) throw ( uno::RuntimeException )
--{
-- ScDocShell* pDocShell = getDocShellFromIf(xIf );
-- return pDocShell->GetModel();
--}
--
--uno::Reference< frame::XModel > getModelFromRange( const uno::Reference< table::XCellRange >& xRange ) throw ( uno::RuntimeException )
--{
-- uno::Reference< uno::XInterface > xIf( xRange, uno::UNO_QUERY_THROW );
-- return getModelFromXIf( xIf );
--}
--
--ScDocument*
--getDocumentFromRange( const uno::Reference< table::XCellRange >& xRange )
--{
-- ScDocShell* pDocShell = getDocShellFromRange( xRange );
-- if ( !pDocShell )
-- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Failed to access underlying docshell from uno range object" ) ), uno::Reference< uno::XInterface >() );
-- ScDocument* pDoc = pDocShell->GetDocument();
-- return pDoc;
--}
--
--
- ScDocument*
- ScVbaRange::getScDocument() throw (uno::RuntimeException)
- {
-@@ -419,9 +387,9 @@ ScVbaRange::getScDocument() throw (uno::RuntimeException)
- {
- uno::Reference< container::XIndexAccess > xIndex( mxRanges, uno::UNO_QUERY_THROW );
- uno::Reference< table::XCellRange > xRange( xIndex->getByIndex( 0 ), uno::UNO_QUERY_THROW );
-- return getDocumentFromRange( xRange );
-- }
-- return getDocumentFromRange( mxRange );
-+ return excel::GetDocumentFromRange( xRange );
-+ }
-+ return excel::GetDocumentFromRange( mxRange );
- }
-
- ScDocShell*
-@@ -431,9 +399,9 @@ ScVbaRange::getScDocShell() throw (uno::RuntimeException)
- {
- uno::Reference< container::XIndexAccess > xIndex( mxRanges, uno::UNO_QUERY_THROW );
- uno::Reference< table::XCellRange > xRange( xIndex->getByIndex( 0 ), uno::UNO_QUERY_THROW );
-- return getDocShellFromRange( xRange );
-- }
-- return getDocShellFromRange( mxRange );
-+ return excel::GetDocShellFromRange( xRange );
-+ }
-+ return excel::GetDocShellFromRange( mxRange );
- }
-
- /*static*/ ScVbaRange* ScVbaRange::getImplementation( const uno::Reference< excel::XRange >& rxRange )
-@@ -479,7 +447,7 @@ class NumFormatHelper
- public:
- NumFormatHelper( const uno::Reference< table::XCellRange >& xRange )
- {
-- mxSupplier.set( getModelFromRange( xRange ), uno::UNO_QUERY_THROW );
-+ mxSupplier.set( excel::GetModelFromRange( xRange ), uno::UNO_QUERY_THROW );
- mxRangeProps.set( xRange, uno::UNO_QUERY_THROW);
- mxFormats = mxSupplier->getNumberFormats();
- }
-@@ -744,7 +712,15 @@ CellValueSetter::processValue( const uno::Any& aValue, const uno::Reference< tab
- {
- double nDouble = 0.0;
- if ( aValue >>= nDouble )
-+ {
- xCell->setValue( nDouble );
-+ uno::Reference< table::XCellRange > xRange( xCell, uno::UNO_QUERY_THROW );
-+ NumFormatHelper cellNumFormat( xRange );
-+ if ( cellNumFormat.isBooleanType() )
-+ {
-+ cellNumFormat.setNumberFormat( util::NumberFormat::NUMBER );
-+ }
-+ }
- else
- isExtracted = false;
- break;
-@@ -838,9 +814,10 @@ protected:
- double aDblValue = 0.0;
- if ( aValue >>= sFormula )
- {
-- // convert to CONV_OOO style formula string because XCell::setFormula
-- // always compile it in CONV_OOO style. Perhaps css.sheet.FormulaParser
-- // should be used in future to directly pass formula tokens.
-+ // convert to GRAM_PODF_A1 style grammar because XCell::setFormula
-+ // always compile it in that grammar. Perhaps
-+ // css.sheet.FormulaParser should be used in future to directly
-+ // pass formula tokens when that API stabilizes.
- if ( m_eGrammar != formula::FormulaGrammar::GRAM_PODF_A1 && ( sFormula.trim().indexOf('=') == 0 ) )
- {
- uno::Reference< uno::XInterface > xIf( xCell, uno::UNO_QUERY_THROW );
-@@ -1146,6 +1123,24 @@ bool getScRangeListForAddress( const rtl::OUString& sName, ScDocShell* pDocSh, S
- formula::FormulaGrammar::AddressConvention eConv = aConv;
- // spaces are illegal ( but the user of course can enter them )
- rtl::OUString sAddress = (*it).trim();
-+ // if a local name ( on the active sheet ) exists this will
-+ // take precedence over a global with the same name
-+ if ( !xNameAccess->hasByName( sAddress ) && pDocSh )
-+ {
-+ // try a local name
-+ ScDocument* pDoc = pDocSh->GetDocument();
-+ SCTAB nCurTab = pDocSh->GetCurTab();
-+ if ( pDoc )
-+ {
-+ NameToNameMap* pMap = pDoc->GetLocalNameMap( nCurTab );
-+ if ( pMap )
-+ {
-+ NameToNameMap::iterator itTmp = pMap->find( sAddress );
-+ if ( itTmp != pMap->end() ) // found a mapping
-+ sAddress = itTmp->second;
-+ }
-+ }
-+ }
- if ( xNameAccess->hasByName( sAddress ) )
- {
- uno::Reference< sheet::XNamedRange > xNamed( xNameAccess->getByName( sAddress ), uno::UNO_QUERY_THROW );
-@@ -1242,7 +1237,7 @@ uno::Reference< sheet::XSheetCellRangeContainer > lclExpandToMerged( const uno::
- ScUnoConversion::FillScRange( aScRange, aRangeAddr );
- aScRanges.Append( aScRange );
- }
-- return new ScCellRangesObj( getDocShellFromRanges( rxCellRanges ), aScRanges );
-+ return new ScCellRangesObj( excel::GetDocShellFromRanges( rxCellRanges ), aScRanges );
- }
-
- void lclExpandAndMerge( const uno::Reference< table::XCellRange >& rxCellRange, bool bMerge ) throw (uno::RuntimeException)
-@@ -1276,7 +1271,7 @@ util::TriState lclGetMergedState( const uno::Reference< table::XCellRange >& rxC
- of a merged range is part of this range are not covered. */
- ScRange aScRange;
- ScUnoConversion::FillScRange( aScRange, aRangeAddr );
-- bool bHasMerged = getDocumentFromRange( rxCellRange )->HasAttrib( aScRange, HASATTR_MERGED | HASATTR_OVERLAPPED );
-+ bool bHasMerged = excel::GetDocumentFromRange( rxCellRange )->HasAttrib( aScRange, HASATTR_MERGED | HASATTR_OVERLAPPED );
- return bHasMerged ? util::TriState_INDETERMINATE : util::TriState_NO;
- }
-
-@@ -1293,6 +1288,28 @@ ScVbaRange::getRangeObjectForName(
- return getRangeForName( xContext, sRangeName, pDocSh, refAddr, eConv );
- }
-
-+table::CellAddress ScVbaRange::getLeftUpperCellAddress()
-+{
-+ table::CellAddress aCellAddress;
-+ uno::Reference< table::XCellRange > xCellRange = mxRange;
-+ if ( mxRanges.is() && m_Areas.is() && m_Areas->getCount() > 1 )
-+ {
-+ uno::Reference< container::XIndexAccess > xIndex( mxRanges, uno::UNO_QUERY );
-+ if ( xIndex.is() && xIndex->getCount() > 0 )
-+ {
-+ xCellRange.set( xIndex->getByIndex( 0 ), uno::UNO_QUERY );
-+ }
-+ }
-+ if ( xCellRange.is() )
-+ {
-+ uno::Reference< sheet::XCellAddressable > xCellAddr( xCellRange->getCellByPosition( 0, 0 ), uno::UNO_QUERY );
-+ if ( xCellAddr.is() )
-+ {
-+ aCellAddress = xCellAddr->getCellAddress();
-+ }
-+ }
-+ return aCellAddress;
-+}
-
- table::CellRangeAddress getCellRangeAddressForVBARange( const uno::Any& aParam, ScDocShell* pDocSh, formula::FormulaGrammar::AddressConvention aConv = formula::FormulaGrammar::CONV_XL_A1) throw ( uno::RuntimeException )
- {
-@@ -1320,7 +1337,14 @@ table::CellRangeAddress getCellRangeAddressForVBARange( const uno::Any& aParam,
- uno::Reference< excel::XRange > xRange;
- aParam >>= xRange;
- if ( xRange.is() )
-+ {
-+ ScVbaRange* pRange = dynamic_cast< ScVbaRange* >( xRange.get() );
-+ if ( pRange && pDocSh && pRange->getScDocument() != pDocSh->GetDocument() )
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Invalid range" ) ), uno::Reference< uno::XInterface >() );
-+ }
- xRange->getCellRange() >>= xRangeParam;
-+ }
- break;
- }
- default:
-@@ -1333,7 +1357,7 @@ uno::Reference< XCollection >
- lcl_setupBorders( const uno::Reference< excel::XRange >& xParentRange, const uno::Reference<uno::XComponentContext>& xContext, const uno::Reference< table::XCellRange >& xRange ) throw( uno::RuntimeException )
- {
- uno::Reference< XHelperInterface > xParent( xParentRange, uno::UNO_QUERY_THROW );
-- ScDocument* pDoc = getDocumentFromRange(xRange);
-+ ScDocument* pDoc = excel::GetDocumentFromRange(xRange);
- if ( !pDoc )
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Failed to access document from shell" ) ), uno::Reference< uno::XInterface >() );
- ScVbaPalette aPalette( pDoc->GetDocumentShell() );
-@@ -1341,8 +1365,21 @@ lcl_setupBorders( const uno::Reference< excel::XRange >& xParentRange, const uno
- return borders;
- }
-
-+void lcl_NotifyRangeChanges( const uno::Reference< frame::XModel >& xModel, ScCellRangesBase* pUnoRangesBase )
-+{
-+ if ( xModel.is() && pUnoRangesBase )
-+ {
-+ ScModelObj* pModelObj = ScModelObj::getImplementation( xModel );
-+ const ScRangeList& aCellRanges = pUnoRangesBase->GetRangeList();
-+ if ( pModelObj && pModelObj->HasChangesListeners() )
-+ {
-+ pModelObj->NotifyChanges( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "cell-change" ) ), aCellRanges );
-+ }
-+ }
-+}
-+
- ScVbaRange::ScVbaRange( uno::Sequence< uno::Any> const & args,
-- uno::Reference< uno::XComponentContext> const & xContext ) throw ( lang::IllegalArgumentException ) : ScVbaRange_BASE( getXSomethingFromArgs< XHelperInterface >( args, 0 ), xContext, getXSomethingFromArgs< beans::XPropertySet >( args, 1, false ), getModelFromXIf( getXSomethingFromArgs< uno::XInterface >( args, 1 ) ), true ), mbIsRows( sal_False ), mbIsColumns( sal_False )
-+ uno::Reference< uno::XComponentContext> const & xContext ) throw ( lang::IllegalArgumentException ) : ScVbaRange_BASE( getXSomethingFromArgs< XHelperInterface >( args, 0 ), xContext, getXSomethingFromArgs< beans::XPropertySet >( args, 1, false ), excel::GetModelFromRange( getXSomethingFromArgs< uno::XInterface >( args, 1 ) ), true ), mbIsRows( sal_False ), mbIsColumns( sal_False )
- {
- mxRange.set( mxPropertySet, uno::UNO_QUERY );
- mxRanges.set( mxPropertySet, uno::UNO_QUERY );
-@@ -1359,7 +1396,7 @@ ScVbaRange::ScVbaRange( uno::Sequence< uno::Any> const & args,
- }
-
- ScVbaRange::ScVbaRange( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< table::XCellRange >& xRange, sal_Bool bIsRows, sal_Bool bIsColumns ) throw( lang::IllegalArgumentException )
--: ScVbaRange_BASE( xParent, xContext, uno::Reference< beans::XPropertySet >( xRange, uno::UNO_QUERY_THROW ), getModelFromRange( xRange), true ), mxRange( xRange ),
-+: ScVbaRange_BASE( xParent, xContext, uno::Reference< beans::XPropertySet >( xRange, uno::UNO_QUERY_THROW ), excel::GetModelFromRange( xRange), true ), mxRange( xRange ),
- mbIsRows( bIsRows ),
- mbIsColumns( bIsColumns )
- {
-@@ -1374,7 +1411,7 @@ ScVbaRange::ScVbaRange( const uno::Reference< XHelperInterface >& xParent, const
- }
-
- ScVbaRange::ScVbaRange( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< sheet::XSheetCellRangeContainer >& xRanges, sal_Bool bIsRows, sal_Bool bIsColumns ) throw ( lang::IllegalArgumentException )
--: ScVbaRange_BASE( xParent, xContext, uno::Reference< beans::XPropertySet >( xRanges, uno::UNO_QUERY_THROW ), getModelFromXIf( uno::Reference< uno::XInterface >( xRanges, uno::UNO_QUERY_THROW ) ), true ), mxRanges( xRanges ),mbIsRows( bIsRows ), mbIsColumns( bIsColumns )
-+: ScVbaRange_BASE( xParent, xContext, uno::Reference< beans::XPropertySet >( xRanges, uno::UNO_QUERY_THROW ), excel::GetModelFromRange( uno::Reference< uno::XInterface >( xRanges, uno::UNO_QUERY_THROW ) ), true ), mxRanges( xRanges ),mbIsRows( bIsRows ), mbIsColumns( bIsColumns )
-
- {
- uno::Reference< container::XIndexAccess > xIndex( mxRanges, uno::UNO_QUERY_THROW );
-@@ -1503,6 +1540,9 @@ ScVbaRange::setValue( const uno::Any &aValue ) throw (uno::RuntimeException)
- }
- CellValueSetter valueSetter( aValue );
- setValue( aValue, valueSetter );
-+
-+ // Fires the range change event.
-+ lcl_NotifyRangeChanges( getScDocShell()->GetModel(), getCellRangesBase() );
- }
-
- void
-@@ -1510,6 +1550,9 @@ ScVbaRange::Clear() throw (uno::RuntimeException)
- using namespace ::com::sun::star::sheet::CellFlags;
- sal_Int32 nFlags = VALUE | DATETIME | STRING | FORMULA | HARDATTR | EDITATTR | FORMATTED;
- ClearContents( nFlags );
-+
-+ // Fires the range change event.
-+ lcl_NotifyRangeChanges( getScDocShell()->GetModel(), getCellRangesBase() );
- }
-
- //helper ClearContent
-@@ -1550,6 +1593,9 @@ ScVbaRange::ClearContents() throw (uno::RuntimeException)
- sheet::CellFlags::STRING | sheet::CellFlags::DATETIME |
- sheet::CellFlags::FORMULA );
- ClearContents( nClearFlags );
-+
-+ // Fires the range change event.
-+ lcl_NotifyRangeChanges( getScDocShell()->GetModel(), getCellRangesBase() );
- }
-
- void
-@@ -1558,6 +1604,9 @@ ScVbaRange::ClearFormats() throw (uno::RuntimeException)
- //FIXME: need to check if we need to combine sheet::CellFlags::FORMATTED
- sal_Int32 nClearFlags = sheet::CellFlags::HARDATTR | sheet::CellFlags::FORMATTED | sheet::CellFlags::EDITATTR;
- ClearContents( nClearFlags );
-+
-+ // Fires the range change event.
-+ lcl_NotifyRangeChanges( getScDocShell()->GetModel(), getCellRangesBase() );
- }
-
- void
-@@ -1573,6 +1622,9 @@ ScVbaRange::setFormulaValue( const uno::Any& rFormula, formula::FormulaGrammar::
- }
- CellFormulaValueSetter formulaValueSetter( rFormula, getScDocument(), eGram );
- setValue( rFormula, formulaValueSetter );
-+
-+ // Fires the range change event.
-+ lcl_NotifyRangeChanges( getScDocShell()->GetModel(), getCellRangesBase() );
- }
-
- uno::Any
-@@ -1732,6 +1784,9 @@ ScVbaRange::fillSeries( sheet::FillDirection nFillDirection, sheet::FillMode nFi
-
- uno::Reference< sheet::XCellSeries > xCellSeries(mxRange, uno::UNO_QUERY_THROW );
- xCellSeries->fillSeries( nFillDirection, nFillMode, nFillDateMode, fStep, fEndValue );
-+
-+ // Fires the range change event.
-+ lcl_NotifyRangeChanges( getScDocShell()->GetModel(), getCellRangesBase() );
- }
-
- void
-@@ -1871,7 +1926,16 @@ ScVbaRange::getFormulaArray() throw (uno::RuntimeException)
- uno::Reference< sheet::XCellRangeFormula> xCellRangeFormula( mxRange, uno::UNO_QUERY_THROW );
- uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( mxContext );
- uno::Any aMatrix;
-- aMatrix = xConverter->convertTo( uno::makeAny( xCellRangeFormula->getFormulaArray() ) , getCppuType((uno::Sequence< uno::Sequence< uno::Any > >*)0) ) ;
-+
-+ //VBA, minz@cn.ibm.com
-+ uno::Sequence< uno::Sequence<rtl::OUString> > aFmArray = xCellRangeFormula->getFormulaArray();
-+ if( aFmArray.getLength() )
-+ {
-+ if( aFmArray.getLength() == 1 && aFmArray[0].getLength() == 1 )
-+ aMatrix <<= aFmArray[0][0];
-+ else
-+ aMatrix = xConverter->convertTo( uno::makeAny( xCellRangeFormula->getFormulaArray() ) , getCppuType((uno::Sequence< uno::Sequence< uno::Any > >*)0) ) ;
-+ }
- return aMatrix;
- }
-
-@@ -2226,7 +2290,7 @@ ScVbaRange::Rows(const uno::Any& aIndex ) throw (uno::RuntimeException)
- {
- ScAddress::Details dDetails( formula::FormulaGrammar::CONV_XL_A1, 0, 0 );
- ScRange tmpRange;
-- tmpRange.ParseRows( sAddress, getDocumentFromRange( mxRange ), dDetails );
-+ tmpRange.ParseRows( sAddress, excel::GetDocumentFromRange( mxRange ), dDetails );
- nStartRow = tmpRange.aStart.Row();
- nEndRow = tmpRange.aEnd.Row();
-
-@@ -2273,7 +2337,7 @@ ScVbaRange::Columns(const uno::Any& aIndex ) throw (uno::RuntimeException)
- {
- ScAddress::Details dDetails( formula::FormulaGrammar::CONV_XL_A1, 0, 0 );
- ScRange tmpRange;
-- tmpRange.ParseCols( sAddress, getDocumentFromRange( mxRange ), dDetails );
-+ tmpRange.ParseCols( sAddress, excel::GetDocumentFromRange( mxRange ), dDetails );
- nStartCol = tmpRange.aStart.Col();
- nEndCol = tmpRange.aEnd.Col();
-
-@@ -2377,7 +2441,7 @@ ScVbaRange::Copy(const ::uno::Any& Destination) throw (uno::RuntimeException)
- }
- else
- {
-- uno::Reference< frame::XModel > xModel = getModelFromRange( mxRange );
-+ uno::Reference< frame::XModel > xModel = excel::GetModelFromRange( mxRange );
- Select();
- excel::implnCopy( xModel );
- }
-@@ -2401,8 +2465,9 @@ ScVbaRange::Cut(const ::uno::Any& Destination) throw (uno::RuntimeException)
- uno::Reference< sheet::XCellRangeAddressable > xSource( mxRange, uno::UNO_QUERY);
- xMover->moveRange( xDestination->getCellAddress(), xSource->getRangeAddress() );
- }
-- {
-- uno::Reference< frame::XModel > xModel = getModelFromRange( mxRange );
-+ //VBA, minz@cn.ibm.com.
-+ else {
-+ uno::Reference< frame::XModel > xModel = excel::GetModelFromRange( mxRange );
- Select();
- excel::implnCut( xModel );
- }
-@@ -2721,8 +2786,6 @@ ScVbaRange::PasteSpecial( const uno::Any& Paste, const uno::Any& Operation, cons
-
- 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( xModel->getCurrentSelection() );
- // select this range
- xSelection->select( uno::makeAny( mxRange ) );
- // set up defaults
-@@ -2743,8 +2806,6 @@ ScVbaRange::PasteSpecial( const uno::Any& Paste, const uno::Any& Operation, cons
- USHORT nFlags = getPasteFlags(nPaste);
- USHORT nFormulaBits = getPasteFormulaBits(nOperation);
- excel::implnPasteSpecial(pShell->GetModel(), nFlags,nFormulaBits,bSkipBlanks,bTranspose);
-- // restore selection
-- xSelection->select( uno::makeAny( xSel ) );
- }
-
- uno::Reference< excel::XRange >
-@@ -2967,7 +3028,16 @@ ScVbaRange::Replace( const ::rtl::OUString& What, const ::rtl::OUString& Replace
- // OOo.org afaik
-
- uno::Reference< util::XSearchDescriptor > xSearch( xDescriptor, uno::UNO_QUERY );
-+ // Find all cells that being replaced, used to fire the range changed event.
-+ uno::Reference< container::XIndexAccess > xIndexAccess = xReplace->findAll( xSearch );
- xReplace->replaceAll( xSearch );
-+
-+ if ( xIndexAccess.is() && xIndexAccess->getCount() > 0 )
-+ {
-+ // Fires the range change event.
-+ ScCellRangesBase* pScCellRangesBase = ScCellRangesBase::getImplementation( xIndexAccess ); //liuchen 2010-01-05
-+ lcl_NotifyRangeChanges( getScDocShell()->GetModel(), pScCellRangesBase ); //liuchen 2010-01-05 the original convert method will fail in SUSE
-+ }
- }
- return sal_True; // always
- }
-@@ -3118,6 +3188,13 @@ ScVbaRange::Find( const uno::Any& What, const uno::Any& After, const uno::Any& L
-
- uno::Reference< uno::XInterface > xInterface = xStartCell.is() ? xSearch->findNext( xStartCell, xDescriptor) : xSearch->findFirst( xDescriptor );
- uno::Reference< table::XCellRange > xCellRange( xInterface, uno::UNO_QUERY );
-+ // if we are searching from a starting cell and failed to find a match
-+ // then try from the begining
-+ if ( !xCellRange.is() && xStartCell.is() )
-+ {
-+ xInterface = xSearch->findFirst( xDescriptor );
-+ xCellRange.set( xInterface, uno::UNO_QUERY );
-+ }
- if ( xCellRange.is() )
- {
- uno::Reference< excel::XRange > xResultRange = new ScVbaRange( mxParent, mxContext, xCellRange );
-@@ -3411,76 +3488,45 @@ ScVbaRange::End( ::sal_Int32 Direction ) throw (uno::RuntimeException)
- return xRange->End( Direction );
- }
-
--
-- // #FIXME #TODO
-- // euch! found my orig implementation sucked, so
-- // trying this even suckier one ( really need to use/expose code in
-- // around ScTabView::MoveCursorArea(), thats the bit that calcutes
-- // where the cursor should go )
-- // Main problem with this method is the ultra hacky attempt to preserve
-- // the ActiveCell, there should be no need to go to these extreems
--
-- // Save ActiveCell pos ( to restore later )
-- uno::Any 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();
--
-- uno::Reference< frame::XModel > xModel = getModelFromRange( mxRange );
--
-- SfxViewFrame* pViewFrame = excel::getViewFrame( xModel );
-- if ( pViewFrame )
-- {
-- SfxAllItemSet aArgs( SFX_APP()->GetPool() );
-- // Hoping this will make sure this slot is called
-- // synchronously
-- SfxBoolItem sfxAsync( SID_ASYNCHRON, sal_False );
-- aArgs.Put( sfxAsync, sfxAsync.Which() );
-- SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
--
-- USHORT nSID = 0;
--
-- switch( Direction )
-- {
-- case excel::XlDirection::xlDown:
-- nSID = SID_CURSORBLKDOWN;
-- break;
-- case excel::XlDirection::xlUp:
-- nSID = SID_CURSORBLKUP;
-- break;
-- case excel::XlDirection::xlToLeft:
-- nSID = SID_CURSORBLKLEFT;
-- break;
-- case excel::XlDirection::xlToRight:
-- nSID = SID_CURSORBLKRIGHT;
-- break;
-- default:
-- throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ": Invalid ColumnIndex" ) ), uno::Reference< uno::XInterface >() );
-- }
-- if ( pDispatcher )
-- {
-- pDispatcher->Execute( nSID, (SfxCallMode)SFX_CALLMODE_SYNCHRON, aArgs );
-- }
-- }
--
-- // result is the ActiveCell
-- rtl::OUString sMoved = xApplication->getActiveCell()->Address(aDft, aDft, aDft, aDft, aDft );
--
-- // restore old ActiveCell
-- uno::Any aVoid;
--
-- 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( xApplication->getActiveSheet()->Range( uno::makeAny( sMoved ), aVoid ), uno::UNO_QUERY_THROW );
--
-- // return result
--
-- return resultCell;
-+ table::CellAddress aAddress = getLeftUpperCellAddress();
-+ SCTAB nTab = aAddress.Sheet;
-+ SCCOL nCurX = aAddress.Column;
-+ SCROW nCurY = aAddress.Row;
-+ SCCOL nNewX = nCurX;
-+ SCROW nNewY = nCurY;
-+
-+ ScDocShell* pDocShell = getScDocShell();
-+ ScDocument* pDoc = pDocShell->GetDocument();
-+
-+ SCsCOL nMoveX = 0;
-+ SCsROW nMoveY = 0;
-+ switch ( Direction )
-+ {
-+ case excel::XlDirection::xlDown:
-+ nMoveY = 1;
-+ break;
-+ case excel::XlDirection::xlUp:
-+ nMoveY = -1;
-+ break;
-+ case excel::XlDirection::xlToLeft:
-+ nMoveX = -1;
-+ break;
-+ case excel::XlDirection::xlToRight:
-+ nMoveX = 1;
-+ break;
-+ default:
-+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Invalid Direction" ) ), uno::Reference< uno::XInterface >() );
-+ }
-+
-+ if ( pDoc )
-+ {
-+ pDoc->FindAreaPos( nNewX, nNewY, nTab, nMoveX, nMoveY );
-+ }
-+
-+ ScRange aNewRange( (SCCOL)nNewX, (SCROW)nNewY, nTab, (SCCOL)nNewX, (SCROW)nNewY, nTab );
-+ uno::Reference< table::XCellRange > xCellRange( new ScCellRangeObj( getScDocShell(), aNewRange ) );
-+ uno::Reference< excel::XRange > xResultRange = new ScVbaRange( mxParent, mxContext, xCellRange );
-+ return xResultRange;
- }
-
- bool
-@@ -3498,7 +3544,7 @@ ScVbaRange::characters( const uno::Any& Start, const uno::Any& Length ) throw (u
- if ( !isSingleCellRange() )
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Can't create Characters property for multicell range ") ), uno::Reference< uno::XInterface >() );
- uno::Reference< text::XSimpleText > xSimple(mxRange->getCellByPosition(0,0) , uno::UNO_QUERY_THROW );
-- ScDocument* pDoc = getDocumentFromRange(mxRange);
-+ ScDocument* pDoc = excel::GetDocumentFromRange(mxRange);
- if ( !pDoc )
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Failed to access document from shell" ) ), uno::Reference< uno::XInterface >() );
-
-@@ -3615,7 +3661,7 @@ ScVbaRange::getCalcColWidth( const table::CellRangeAddress& rAddress) throw (uno
- double
- ScVbaRange::getCalcRowHeight( const table::CellRangeAddress& rAddress ) throw (uno::RuntimeException)
- {
-- ScDocument* pDoc = getDocumentFromRange( mxRange );
-+ ScDocument* pDoc = excel::GetDocumentFromRange( mxRange );
- USHORT nWidth = pDoc->GetOriginalHeight( rAddress.StartRow, rAddress.Sheet );
- double nPoints = lcl_TwipsToPoints( nWidth );
- nPoints = lcl_Round2DecPlaces( nPoints );
-@@ -3877,7 +3923,7 @@ ScVbaRange::setRowHeight( const uno::Any& _rowheight) throw (uno::RuntimeExcepti
- table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
- USHORT nTwips = lcl_pointsToTwips( nHeight );
-
-- ScDocShell* pDocShell = getDocShellFromRange( mxRange );
-+ ScDocShell* pDocShell = excel::GetDocShellFromRange( mxRange );
- ScDocFunc aFunc(*pDocShell);
- SCCOLROW nRowArr[2];
- nRowArr[0] = thisAddress.StartRow;
-@@ -3890,7 +3936,7 @@ uno::Any SAL_CALL
- ScVbaRange::getPageBreak() throw (uno::RuntimeException)
- {
- sal_Int32 nPageBreak = excel::XlPageBreak::xlPageBreakNone;
-- ScDocShell* pShell = getDocShellFromRange( mxRange );
-+ ScDocShell* pShell = excel::GetDocShellFromRange( mxRange );
- if ( pShell )
- {
- RangeHelper thisRange( mxRange );
-@@ -3903,7 +3949,7 @@ ScVbaRange::getPageBreak() throw (uno::RuntimeException)
- uno::Reference< frame::XModel > xModel = pShell->GetModel();
- if ( xModel.is() )
- {
-- ScDocument* pDoc = getDocumentFromRange( mxRange );
-+ ScDocument* pDoc = excel::GetDocumentFromRange( mxRange );
-
- ScBreakType nBreak = BREAK_NONE;
- if ( !bColumn )
-@@ -3928,7 +3974,7 @@ ScVbaRange::setPageBreak( const uno::Any& _pagebreak) throw (uno::RuntimeExcepti
- sal_Int32 nPageBreak = 0;
- _pagebreak >>= nPageBreak;
-
-- ScDocShell* pShell = getDocShellFromRange( mxRange );
-+ ScDocShell* pShell = excel::GetDocShellFromRange( mxRange );
- if ( pShell )
- {
- RangeHelper thisRange( mxRange );
-@@ -4022,7 +4068,7 @@ ScVbaRange::getWorksheet() throw (uno::RuntimeException)
- uno::Reference< container::XIndexAccess > xIndex( mxRanges, uno::UNO_QUERY_THROW );
- xRange.set( xIndex->getByIndex( 0 ), uno::UNO_QUERY_THROW );
- }
-- ScDocShell* pDocShell = getDocShellFromRange(xRange);
-+ ScDocShell* pDocShell = excel::GetDocShellFromRange(xRange);
- RangeHelper rHelper(xRange);
- // parent should be Thisworkbook
- xSheet.set( new ScVbaWorksheet( uno::Reference< XHelperInterface >(), mxContext,rHelper.getSpreadSheet(),pDocShell->GetModel()) );
-@@ -4077,63 +4123,44 @@ ScVbaRange::ApplicationRange( const uno::Reference< uno::XComponentContext >& xC
- }
- }
- }
-- 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( excel::getUnoSheetModuleObj( xSheetRange ), xContext, xSheetRange );
-+
-+ // Add these codes for supporting shortcut: Application.Range(Range1, Range2), Range1 or Range2 is not the range of current active sheet.
-+ // If Range1 and Range2 are not in current active sheet, we should not use the active sheet, but use the sheet of Range1 and Range2.
-+ // If Range1 and Range2 are not in the same sheet, we throw an exception.
-+ uno::Reference< sheet::XSpreadsheet > xSpreadsheet;
-+ uno::Reference< excel::XRange > xRange1( Cell1, uno::UNO_QUERY ), xRange2( Cell2, uno::UNO_QUERY );
-+ if ( xRange1.is() )
-+ {
-+ RangeHelper thisRange( xRange1->getCellRange() );
-+ xSpreadsheet = thisRange.getSpreadSheet();
-+ }
-+ else if ( xRange2.is() )
-+ {
-+ RangeHelper thisRange( xRange2->getCellRange() );
-+ xSpreadsheet = thisRange.getSpreadSheet();
-+ }
-+ if ( !xSpreadsheet.is() )
-+ {
-+ uno::Reference< frame::XModel > xModel = getCurrentExcelDoc( xContext );
-+ if ( xModel.is() )
-+ {
-+ uno::Reference< sheet::XSpreadsheetView > xView( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
-+ xSpreadsheet = xView->getActiveSheet();
-+ }
-+ }
-+
-+ uno::Reference< table::XCellRange > xSheetRange( xSpreadsheet, uno::UNO_QUERY_THROW );
-+ ScVbaRange* pRange = new ScVbaRange( excel::getUnoSheetModuleObj( xSheetRange ), xContext, xSheetRange );
-+
- uno::Reference< excel::XRange > xVbSheetRange( pRange );
- return pRange->Range( Cell1, Cell2, true );
- }
-
--uno::Reference< sheet::XDatabaseRanges >
--lcl_GetDataBaseRanges( ScDocShell* pShell ) throw ( uno::RuntimeException )
--{
-- uno::Reference< frame::XModel > xModel;
-- if ( pShell )
-- xModel.set( pShell->GetModel(), uno::UNO_QUERY_THROW );
-- uno::Reference< beans::XPropertySet > xModelProps( xModel, uno::UNO_QUERY_THROW );
-- uno::Reference< sheet::XDatabaseRanges > xDBRanges( xModelProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DatabaseRanges") ) ), uno::UNO_QUERY_THROW );
-- return xDBRanges;
--}
--// returns the XDatabaseRange for the autofilter on sheet (nSheet)
--// also populates sName with the name of range
--uno::Reference< sheet::XDatabaseRange >
--lcl_GetAutoFiltRange( ScDocShell* pShell, sal_Int16 nSheet, rtl::OUString& sName )
--{
-- uno::Reference< container::XIndexAccess > xIndexAccess( lcl_GetDataBaseRanges( pShell ), uno::UNO_QUERY_THROW );
-- uno::Reference< sheet::XDatabaseRange > xDataBaseRange;
-- table::CellRangeAddress dbAddress;
-- for ( sal_Int32 index=0; index < xIndexAccess->getCount(); ++index )
-- {
-- uno::Reference< sheet::XDatabaseRange > xDBRange( xIndexAccess->getByIndex( index ), uno::UNO_QUERY_THROW );
-- uno::Reference< container::XNamed > xNamed( xDBRange, uno::UNO_QUERY_THROW );
-- // autofilters work weirdly with openoffice, unnamed is the default
-- // named range which is used to create an autofilter, but
-- // its also possible that another name could be used
-- // this also causes problems when an autofilter is created on
-- // another sheet
-- // ( but.. you can use any named range )
-- dbAddress = xDBRange->getDataArea();
-- if ( dbAddress.Sheet == nSheet )
-- {
-- sal_Bool bHasAuto = sal_False;
-- uno::Reference< beans::XPropertySet > xProps( xDBRange, uno::UNO_QUERY_THROW );
-- xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AutoFilter") ) ) >>= bHasAuto;
-- if ( bHasAuto )
-- {
-- sName = xNamed->getName();
-- xDataBaseRange=xDBRange;
-- break;
-- }
-- }
-- }
-- return xDataBaseRange;
--}
--
- // Helper functions for AutoFilter
- ScDBData* lcl_GetDBData_Impl( ScDocShell* pDocShell, sal_Int16 nSheet )
- {
- rtl::OUString sName;
-- lcl_GetAutoFiltRange( pDocShell, nSheet, sName );
-+ excel::GetAutoFiltRange( pDocShell, nSheet, sName );
- OSL_TRACE("lcl_GetDBData_Impl got autofilter range %s for sheet %d",
- rtl::OUStringToOString( sName, RTL_TEXTENCODING_UTF8 ).getStr() , nSheet );
- ScDBData* pRet = NULL;
-@@ -4300,7 +4327,7 @@ ScVbaRange::AutoFilter( const uno::Any& Field, const uno::Any& Criteria1, const
- ScDocShell* pShell = getScDocShell();
- sal_Bool bHasAuto = sal_False;
- rtl::OUString sAutofiltRangeName;
-- uno::Reference< sheet::XDatabaseRange > xDataBaseRange = lcl_GetAutoFiltRange( pShell, nSheet, sAutofiltRangeName );
-+ uno::Reference< sheet::XDatabaseRange > xDataBaseRange = excel::GetAutoFiltRange( pShell, nSheet, sAutofiltRangeName );
- if ( xDataBaseRange.is() )
- bHasAuto = true;
-
-@@ -4333,7 +4360,7 @@ ScVbaRange::AutoFilter( const uno::Any& Field, const uno::Any& Criteria1, const
- autoFiltAddress = multiCellRange.getCellRangeAddressable()->getRangeAddress();
- }
-
-- uno::Reference< sheet::XDatabaseRanges > xDBRanges = lcl_GetDataBaseRanges( pShell );
-+ uno::Reference< sheet::XDatabaseRanges > xDBRanges = excel::GetDataBaseRanges( pShell );
- if ( xDBRanges.is() )
- {
- rtl::OUString sGenName( RTL_CONSTASCII_USTRINGPARAM("VBA_Autofilter_") );
-@@ -4386,8 +4413,21 @@ ScVbaRange::AutoFilter( const uno::Any& Field, const uno::Any& Criteria1, const
- // Use the normal uno api, sometimes e.g. when you want to use ALL as the filter
- // we can't use refresh as the uno interface doesn't have a concept of ALL
- // in this case we just call the core calc functionality -
-- bool bAll = false;;
-- if ( ( Field >>= nField ) )
-+ bool bAll = false;
-+ uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( mxContext );
-+ bool bIsValidFieldValue = ( Field >>= nField );
-+ if ( !bIsValidFieldValue && xConverter.is() )
-+ {
-+ try
-+ {
-+ uno::Any aConverted = xConverter->convertTo( Field, getCppuType( (sal_Int32*)0 ) );
-+ bIsValidFieldValue = ( aConverted >>= nField );
-+ }
-+ catch( const uno::Exception& ex )
-+ {
-+ }
-+ }
-+ if ( bIsValidFieldValue )
- {
- uno::Reference< sheet::XSheetFilterDescriptor2 > xDesc(
- xDataBaseRange->getFilterDescriptor(), uno::UNO_QUERY );
-@@ -4418,7 +4458,19 @@ ScVbaRange::AutoFilter( const uno::Any& Field, const uno::Any& Criteria1, const
- bAll = true;
- // not sure what the relationship between Criteria1 and Operator is,
- // e.g. can you have a Operator without a Criteria ? in openoffice it
-- if ( Operator.hasValue() && ( Operator >>= nOperator ) )
-+ bool bIsValidOpValue = ( Operator.hasValue() && ( Operator >>= nOperator ) );
-+ if ( Operator.hasValue() && !bIsValidOpValue && xConverter.is() )
-+ {
-+ try
-+ {
-+ uno::Any aConverted = xConverter->convertTo( Operator, getCppuType( (sal_Int32*)0 ) );
-+ bIsValidOpValue = ( aConverted >>= nOperator );
-+ }
-+ catch( const uno::Exception& ex )
-+ {
-+ }
-+ }
-+ if ( bIsValidOpValue )
- {
- // if its a bottom/top Ten(Percent/Value) and there
- // is no value specified for critera1 set it to 10
-@@ -4566,8 +4618,8 @@ ScVbaRange::Insert( const uno::Any& Shift, const uno::Any& CopyOrigin ) throw (u
- {
- // 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( mxParent, mxContext, xRange, mbIsRows, mbIsColumns ) );
-+ uno::Reference< table::XCellRange > xRange( new ScCellRangeObj( excel::GetDocShellFromRange( mxRange ) , aRange ) );
-+ uno::Reference< excel::XRange > xVbaRange( new ScVbaRange( mxParent, mxContext, xRange, mbIsRows, mbIsColumns ) );
- xVbaRange->PasteSpecial( uno::Any(), uno::Any(), uno::Any(), uno::Any() );
- }
- }
-@@ -4590,7 +4642,7 @@ ScVbaRange::Autofit() throw (uno::RuntimeException)
-
- if ( !( mbIsColumns || mbIsRows ) )
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
-- ScDocShell* pDocShell = getDocShellFromRange( mxRange );
-+ ScDocShell* pDocShell = excel::GetDocShellFromRange( mxRange );
- if ( pDocShell )
- {
- RangeHelper thisRange( mxRange );
-@@ -4622,8 +4674,8 @@ ScVbaRange::Autofit() throw (uno::RuntimeException)
- ***************************************************************************************/
- void SAL_CALL
- ScVbaRange::TextToColumns( const css::uno::Any& Destination, const css::uno::Any& DataType, const css::uno::Any& TextQualifier,
-- const css::uno::Any& ConsecutinveDelimiter, const css::uno::Any& Tab, const css::uno::Any& Semicolon, const css::uno::Any& Comma,
-- const css::uno::Any& Space, const css::uno::Any& Other, const css::uno::Any& OtherChar, const css::uno::Any& /*FieldInfo*/,
-+ const css::uno::Any& ConsecutiveDelimiter, const css::uno::Any& Tab, const css::uno::Any& Semicolon, const css::uno::Any& Comma,
-+ const css::uno::Any& Space, const css::uno::Any& Other, const css::uno::Any& OtherChar, const css::uno::Any& FieldInfo,
- const css::uno::Any& DecimalSeparator, const css::uno::Any& ThousandsSeparator, const css::uno::Any& /*TrailingMinusNumbers*/ ) throw (css::uno::RuntimeException)
- {
- uno::Reference< excel::XRange > xRange;
-@@ -4660,13 +4712,13 @@ ScVbaRange::TextToColumns( const css::uno::Any& Destination, const css::uno::Any
- OSL_TRACE("set TextQualifier\n");
- }
-
-- sal_Bool bConsecutinveDelimiter = sal_False;
-- if( ConsecutinveDelimiter.hasValue() )
-+ sal_Bool bConsecutiveDelimiter = sal_False;
-+ if( ConsecutiveDelimiter.hasValue() )
- {
-- if( !( ConsecutinveDelimiter >>= bConsecutinveDelimiter ) )
-- throw uno::RuntimeException( rtl::OUString::createFromAscii( "ConsecutinveDelimiter parameter should be a boolean" ),
-+ if( !( ConsecutiveDelimiter >>= bConsecutiveDelimiter ) )
-+ throw uno::RuntimeException( rtl::OUString::createFromAscii( "ConsecutiveDelimiter parameter should be a boolean" ),
- uno::Reference< uno::XInterface >() );
-- OSL_TRACE("set ConsecutinveDelimiter\n");
-+ OSL_TRACE("set ConsecutiveDelimiter\n");
- }
-
- sal_Bool bTab = sal_False;
-@@ -4718,7 +4770,13 @@ ScVbaRange::TextToColumns( const css::uno::Any& Destination, const css::uno::Any
- throw uno::RuntimeException( rtl::OUString::createFromAscii( "Other parameter should be a True" ),
- uno::Reference< uno::XInterface >() );
- }
-- //TODO* FieldInfo Optional Variant. An array containing parse information for the individual columns of data. The interpretation depends on the value of DataType. When the data is delimited, this argument is an array of two-element arrays, with each two-element array specifying the conversion options for a particular column. The first element is the column number (1-based), and the second element is one of the xlColumnDataType constants specifying how the column is parsed.
-+ // FieldInfo, Optional Variant. An array containing parse information for the individual columns of data.
-+ // The interpretation depends on the value of DataType. When the data is delimited, this argument is an array
-+ // of two-element arrays, with each two-element array specifying the conversion options for a particular column.
-+ // The first element is the column number (1-based), and the second element is one of the xlColumnDataType
-+ // constants specifying how the column is parsed.
-+ uno::Sequence< uno::Sequence< uno::Any > > sFieldInfo;
-+ FieldInfo >>= sFieldInfo;
-
- rtl::OUString sDecimalSeparator;
- if( DecimalSeparator.hasValue() )
-@@ -4736,7 +4794,106 @@ ScVbaRange::TextToColumns( const css::uno::Any& Destination, const css::uno::Any
- uno::Reference< uno::XInterface >() );
- OSL_TRACE("set ThousandsSpeparator\n" );
- }
-- //TODO* TrailingMinusNumbers Optional Variant. Numbers that begin with a minus character.
-+ //TODO* TrailingMinusNumbers Optional Variant. Numbers that begin with a minus character.
-+
-+ // Get the destination range's left-upper cell address.
-+ ScVbaRange* pDestVbaRange = dynamic_cast< ScVbaRange* >( xRange.get() );
-+ ScAddress aScDestAddress;
-+ if ( pDestVbaRange )
-+ {
-+ ScUnoConversion::FillScAddress( aScDestAddress, pDestVbaRange->getLeftUpperCellAddress() );
-+ }
-+
-+ // Parse the value of parameter FieldInfo.
-+ USHORT nCount = 0, nRealCount = 0;
-+ xub_StrLen* pColumns = NULL;
-+ BYTE* pFormats = NULL;
-+ if ( sFieldInfo.getLength() > 0 )
-+ {
-+ nCount = sFieldInfo.getLength();
-+ pColumns = new xub_StrLen[nCount];
-+ pFormats = new BYTE[nCount];
-+ USHORT nFormat = 1;
-+ uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( mxContext );
-+ for ( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
-+ {
-+ if ( sFieldInfo[nIndex].getLength() >= 2 )
-+ {
-+ nFormat = 1;
-+ try
-+ {
-+ uno::Any aConverted = xConverter->convertTo( sFieldInfo[nIndex][0], getCppuType((xub_StrLen*)0) );
-+ aConverted >>= pColumns[nRealCount];
-+ aConverted = xConverter->convertTo( sFieldInfo[nIndex][1], getCppuType((USHORT*)0) );
-+ aConverted >>= nFormat;
-+ }
-+ catch( const uno::Exception& )
-+ {
-+ }
-+ pFormats[nRealCount++] = nFormat;
-+ }
-+ }
-+ }
-+
-+ sal_Unicode cTextQualifier = '"';
-+ cTextQualifier = xlTextQualifier == excel::XlTextQualifier::xlTextQualifierNone ? '\0' : cTextQualifier;
-+ cTextQualifier = xlTextQualifier == excel::XlTextQualifier::xlTextQualifierSingleQuote ? '\'' : cTextQualifier;
-+
-+ // Get field delimiters.
-+ String rFieldDelimiters;
-+ if ( bTab ) rFieldDelimiters += '\t';
-+ if ( bSemicolon ) rFieldDelimiters += ';';
-+ if ( bComma ) rFieldDelimiters += ',';
-+ if ( bSpace ) rFieldDelimiters += ' ';
-+ if ( bOther ) rFieldDelimiters += *sOtherChar.getStr();
-+
-+ // Get the text in current range to SvMemoryStream.
-+ ScRange aSrcScRange;
-+ ScCellRangesBase* pSrcCellRangesBase = getCellRangesBase();
-+ if ( pSrcCellRangesBase )
-+ {
-+ ScRangeList aRangeList = pSrcCellRangesBase->GetRangeList();
-+ if ( aRangeList.First() )
-+ {
-+ aSrcScRange = *aRangeList.First();
-+ }
-+ }
-+ ScImportExport aExport( getScDocument(), aSrcScRange );
-+ aExport.SetDelimiter( static_cast< sal_Unicode >( 0 ) );
-+ SvMemoryStream aStream;
-+ aStream.SetStreamCharSet( RTL_TEXTENCODING_UNICODE );
-+ ScImportExport::SetNoEndianSwap( aStream );
-+ aExport.ExportStream( aStream, String(), FORMAT_STRING );
-+ aStream.Seek( 0 );
-+
-+ // Set ScAsciiOptions according to the input parameters.
-+ ScAsciiOptions aOptions;
-+ aOptions.SetFixedLen( !bDilimited );
-+ aOptions.SetStartRow( 0 );
-+ aOptions.SetColInfo( nRealCount, pColumns, pFormats );
-+ if ( bDilimited )
-+ {
-+ aOptions.SetFieldSeps( rFieldDelimiters );
-+ aOptions.SetMergeSeps( bConsecutiveDelimiter );
-+ aOptions.SetTextSep( cTextQualifier );
-+ }
-+
-+ // Split the String in to columns.
-+ if ( pDestVbaRange && pDestVbaRange->getScDocument() )
-+ {
-+ ScImportExport aImport( pDestVbaRange->getScDocument(), aScDestAddress );
-+ aImport.SetExtOptions( aOptions );
-+ aImport.SetApi( false );
-+ aImport.ImportStream( aStream, String(), FORMAT_STRING );
-+ }
-+ if ( pColumns )
-+ {
-+ DELETEZ( pColumns );
-+ }
-+ if ( pFormats )
-+ {
-+ DELETEZ( pFormats );
-+ }
- }
-
- uno::Any SAL_CALL
-@@ -4881,7 +5038,7 @@ uno::Any ScVbaRange::getShowDetail() throw ( css::uno::RuntimeException)
- (thisAddress.StartColumn == thisAddress.EndColumn && thisAddress.EndColumn == aOutlineAddress.EndColumn ))
- {
- sal_Bool bColumn =thisAddress.StartRow == thisAddress.EndRow ? sal_False:sal_True;
-- ScDocument* pDoc = getDocumentFromRange( mxRange );
-+ ScDocument* pDoc = excel::GetDocumentFromRange( mxRange );
- ScOutlineTable* pOutlineTable = pDoc->GetOutlineTable(static_cast<SCTAB>(thisAddress.Sheet), sal_True);
- const ScOutlineArray* pOutlineArray = bColumn ? pOutlineTable->GetColArray(): pOutlineTable->GetRowArray();
- if( pOutlineArray )
-@@ -4938,6 +5095,24 @@ void ScVbaRange::setShowDetail(const uno::Any& aShowDetail) throw ( css::uno::Ru
- }
- }
-
-+//09-09-16 add by limingl
-+::com::sun::star::uno::Reference< ::ooo::vba::excel::XQueryTable > SAL_CALL
-+ScVbaRange::getQueryTable() throw (::com::sun::star::uno::RuntimeException)
-+{
-+ /*
-+ if (m_pQueryTable == NULL)
-+ {
-+ m_pQueryTable = new ScVbaQueryTable(mxParent ,mxContext, getScDocument(), this); //add by limingl
-+ }
-+ //*/
-+ if (!m_xQueryTable.is())
-+ {
-+ m_xQueryTable = new ScVbaQueryTable(mxParent ,mxContext, getScDocument(), this); //add by limingl
-+ }
-+
-+ return m_xQueryTable;
-+}
-+//end add
- uno::Reference< excel::XRange > SAL_CALL
- ScVbaRange::MergeArea() throw (script::BasicErrorException, uno::RuntimeException)
- {
-@@ -4967,6 +5142,118 @@ ScVbaRange::MergeArea() throw (script::BasicErrorException, uno::RuntimeExceptio
- return new ScVbaRange( mxParent, mxContext, mxRange );
- }
-
-+//2008-08-25 add by limingl
-+//The recordset's member: Recordset.Fields.Item will get a Field obj.
-+//Field.value is the column value.
-+::sal_Int32 SAL_CALL
-+ScVbaRange::CopyFromRecordset( const ::com::sun::star::uno::Any& Data, const ::com::sun::star::uno::Any& MaxRows, const ::com::sun::star::uno::Any& MaxColumns )
-+throw (::com::sun::star::script::BasicErrorException, ::com::sun::star::uno::RuntimeException)
-+{
-+ uno::Sequence< uno::Any > aParams;
-+ uno::Sequence< uno::Any > aFieldsParams(1);
-+ uno::Sequence< sal_Int16 > aOutParamIndex;
-+ uno::Sequence< uno::Any > aOutParam;
-+ uno::Reference< uno::XInterface > xIntRes;
-+ uno::Reference< uno::XInterface > xIntFields;
-+ uno::Reference< uno::XInterface > xIntFld;
-+ uno::Any aRet;
-+ uno::Any aPar;
-+ uno::Any aCrrCol;
-+ uno::Any aCrrRow;
-+ sal_Int16 nCrrCol = 0;
-+ sal_Int32 nCrrRow = 0;
-+ sal_Int32 nCol;
-+ sal_Int32 nMaxRows = 0;
-+ sal_Int32 nMaxColumns = 0;
-+ sal_Bool bEof;
-+// sal_Bool bColName = sal_True;
-+ long lColCnt = 0;
-+ if (MaxColumns.hasValue())
-+ {
-+ MaxColumns >>= nMaxColumns;
-+ }
-+
-+ long lMaxCol = nMaxColumns;
-+
-+ if (MaxRows.hasValue())
-+ {
-+ MaxRows >>= nMaxRows;
-+ }
-+
-+
-+ Data >>= xIntRes;
-+ uno::Reference< script::XInvocation > xInvRes(xIntRes, uno::UNO_QUERY_THROW);
-+ rtl::OUString oMoveNext = rtl::OUString::createFromAscii("MoveNext") ;
-+ rtl::OUString oEof = rtl::OUString::createFromAscii("EOF") ;
-+ rtl::OUString oFields = rtl::OUString::createFromAscii("Fields") ;
-+
-+ if( !xInvRes->hasMethod(oMoveNext))
-+ {
-+ return -1;
-+ }
-+
-+ //Get columns count
-+ aRet = xInvRes->getValue(oFields);
-+ aRet >>= xIntFields;
-+ uno::Reference< script::XInvocation > xInvFields(xIntFields, uno::UNO_QUERY_THROW);
-+ aRet = xInvFields->getValue( rtl::OUString::createFromAscii("Count")) ;
-+ aRet >>= lColCnt;
-+
-+ //Set the assign column number
-+ if (lMaxCol != 0)
-+ {
-+ if (lColCnt > lMaxCol)
-+ {
-+ lColCnt = lMaxCol;
-+ }
-+ }
-+
-+ aCrrRow <<= nCrrRow;
-+ aCrrCol <<= nCrrCol;
-+
-+
-+ //Get start position
-+ uno::Reference< excel::XRange > xRngStartRow = Rows(uno::Any(sal_Int32(1)) );
-+ uno::Reference< excel::XRange > xRngPos = xRngStartRow->Columns( uno::Any(sal_Int32(1)) );
-+
-+ while(1)
-+ {//travel recordset
-+ //get every column
-+ for (long l = 0; l < lColCnt ; l++)
-+ {
-+ nCol = l;
-+ aPar <<= nCol;
-+ //get every field
-+ aRet = xInvFields->invoke( rtl::OUString::createFromAscii("Item"), uno::Sequence< uno::Any >(&aPar,1) , aOutParamIndex,aOutParam);
-+ aRet >>= xIntFld;
-+ uno::Reference< script::XInvocation > xInvFld(xIntFld, uno::UNO_QUERY_THROW); //Get the Field obj
-+
-+ //set the field value
-+ aRet = xInvFld->getValue( rtl::OUString::createFromAscii("Value") );
-+ uno::Reference< excel::XRange > xRngToFill = xRngPos->Offset(aCrrRow,aCrrCol );
-+
-+ xRngToFill->setValue(aRet);
-+ nCrrCol++;
-+ aCrrCol <<= nCrrCol;
-+ }
-+
-+ aRet = xInvRes->invoke(oMoveNext, aParams,aOutParamIndex,aOutParam );
-+ aRet = xInvRes->getValue(oEof);
-+ aRet >>= bEof;
-+ if (bEof || ( nCrrRow >= nMaxRows && nMaxRows != 0) )
-+ {//Arrive the end of recordset
-+ break;
-+ }
-+
-+ nCrrRow++;
-+ aCrrRow <<= nCrrRow;
-+ nCrrCol = 0;
-+ aCrrCol <<= nCrrCol;
-+ }
-+
-+ return 0;
-+}
-+//end add
- void SAL_CALL
- ScVbaRange::PrintOut( const uno::Any& From, const uno::Any& To, const uno::Any& Copies, const uno::Any& Preview, const uno::Any& ActivePrinter, const uno::Any& PrintToFile, const uno::Any& Collate, const uno::Any& PrToFileName ) throw (uno::RuntimeException)
- {
-@@ -4985,7 +5272,7 @@ ScVbaRange::PrintOut( const uno::Any& From, const uno::Any& To, const uno::Any&
- {
- ScVbaRange* pRange = getImplementation( xRange );
- // initialise the doc shell and the printareas
-- pShell = getDocShellFromRange( pRange->mxRange );
-+ pShell = excel::GetDocShellFromRange( pRange->mxRange );
- xPrintAreas.set( thisRange.getSpreadSheet(), uno::UNO_QUERY_THROW );
- }
- printAreas[ index - 1 ] = rangeAddress;
-@@ -5071,7 +5358,7 @@ ScVbaRange::AutoFill( const uno::Reference< excel::XRange >& Destination, const
- }
- }
- }
-- ScDocShell* pDocSh= getDocShellFromRange( mxRange );
-+ ScDocShell* pDocSh= excel::GetDocShellFromRange( mxRange );
-
- FillCmd eCmd = FILL_AUTO;
- FillDateCmd eDateCmd = FILL_DAY;
-@@ -5194,13 +5481,8 @@ ScVbaRange::AutoOutline( ) throw (script::BasicErrorException, uno::RuntimeExce
- RangeHelper thisRange( mxRange );
- table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
-
-- if ( isSingleCellRange() || mbIsRows )
-- {
-- uno::Reference< sheet::XSheetOutline > xSheetOutline( thisRange.getSpreadSheet(), uno::UNO_QUERY_THROW );
-- xSheetOutline->autoOutline( thisAddress );
-- }
-- else
-- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
-+ uno::Reference< sheet::XSheetOutline > xSheetOutline( thisRange.getSpreadSheet(), uno::UNO_QUERY_THROW );
-+ xSheetOutline->autoOutline( thisAddress );
- }
-
- void SAL_CALL
-@@ -5227,9 +5509,9 @@ ScVbaRange::groupUnGroup( bool bUnGroup ) throw ( script::BasicErrorException, u
- {
- if ( m_Areas->getCount() > 1 )
- DebugHelper::exception(SbERR_METHOD_FAILED, STR_ERRORMESSAGE_APPLIESTOSINGLERANGEONLY);
-- table::TableOrientation nOrient = table::TableOrientation_ROWS;
-- if ( mbIsColumns )
-- nOrient = table::TableOrientation_COLUMNS;
-+ table::TableOrientation nOrient = table::TableOrientation_COLUMNS;
-+ if ( mbIsRows )
-+ nOrient = table::TableOrientation_ROWS;
- RangeHelper thisRange( mxRange );
- table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
- uno::Reference< sheet::XSheetOutline > xSheetOutline( thisRange.getSpreadSheet(), uno::UNO_QUERY_THROW );
-@@ -5388,6 +5670,7 @@ ScVbaRange::SpecialCells( const uno::Any& _oType, const uno::Any& _oValue) throw
- bool bIsSingleCell = isSingleCellRange();
- bool bIsMultiArea = ( m_Areas->getCount() > 1 );
- ScVbaRange* pRangeToUse = this;
-+ uno::Reference< excel::XRange > xUsedRange( getWorksheet()->getUsedRange() );
- sal_Int32 nType = 0;
- if ( !( _oType >>= nType ) )
- DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() );
-@@ -5533,7 +5533,6 @@ ScVbaRange::SpecialCells( const uno::Any& _oType, const uno::Any& _oValue) throw
- }
- else if ( bIsSingleCell )
- {
-- uno::Reference< excel::XRange > xUsedRange = getWorksheet()->getUsedRange();
- pRangeToUse = static_cast< ScVbaRange* >( xUsedRange.get() );
- }
-
-@@ -5623,6 +5906,183 @@ ScVbaRange::Subtotal( ::sal_Int32 _nGroupBy, ::sal_Int32 _nFunction, const uno::
- }
- }
-
-+uno::Any SAL_CALL ScVbaRange::AdvancedFilter( sal_Int32 Action, const uno::Any& CriteriaRange,
-+ const uno::Any& CopyToRange, const uno::Any& Unique ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ uno::Any aRet;
-+ aRet <<= sal_True;
-+
-+ uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( mxContext );
-+ ScDocument* pDoc = getScDocument();
-+ if ( !pDoc )
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Failed to access document from range" ) ), uno::Reference< uno::XInterface >() );
-+ }
-+
-+ // Action
-+ if ( Action != excel::XlFilterAction::xlFilterInPlace && Action != excel::XlFilterAction::xlFilterCopy )
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Invalid input parameter" ) ), uno::Reference< uno::XInterface >() );
-+ }
-+ if ( m_Areas->getCount() > 1 )
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Invalid range" ) ), uno::Reference< uno::XInterface >() );
-+ }
-+
-+ sal_Bool bCopyOut = ( Action != excel::XlFilterAction::xlFilterInPlace );
-+ uno::Reference< sheet::XSheetFilterDescriptor > xFilterDesc;
-+ uno::Reference< sheet::XSheetFilterable > xSheetFilter( mxRange, uno::UNO_QUERY_THROW );
-+
-+ // CriteriaRange
-+ String aBuiltInCriteria; // Excel Built-In Filter Criteria.
-+ ScRangeData* pData = NULL;
-+ table::CellRangeAddress refParentAddr;
-+ uno::Any aCriteriaRange = CriteriaRange;
-+ formula::FormulaGrammar::AddressConvention aConv = formula::FormulaGrammar::CONV_XL_A1;
-+ if ( aCriteriaRange.hasValue() && aCriteriaRange.getValueTypeClass() == uno::TypeClass_STRING )
-+ {
-+ rtl::OUString rRangeString;
-+ aCriteriaRange >>= rRangeString;
-+ aConv = excel::IsR1C1ReferFormat( pDoc, rRangeString ) ? formula::FormulaGrammar::CONV_XL_R1C1 : aConv;
-+ }
-+ else
-+ {
-+ // Get Excel BuiltIn Filter Criteria.
-+ ScRangeName* pRangeNames = pDoc->GetRangeName();
-+ const USHORT nCount = pRangeNames ? pRangeNames->GetCount() : 0;
-+ for ( USHORT index = 0; index < nCount; index++ )
-+ {
-+ pData = ( ScRangeData* )( pRangeNames->At( index ) );
-+ if ( pData && pData->HasType( RT_CRITERIA ) )
-+ {
-+ pData->GetSymbol( aBuiltInCriteria, formula::FormulaGrammar::GRAM_NATIVE_XL_A1 );
-+ break;
-+ }
-+ }
-+ aCriteriaRange = aBuiltInCriteria.Len() > 0 ? uno::makeAny( rtl::OUString( aBuiltInCriteria ) ) : aCriteriaRange;
-+ }
-+ if ( aCriteriaRange.hasValue() )
-+ {
-+ table::CellRangeAddress criteriaRangeAddress = getCellRangeAddressForVBARange( aCriteriaRange, getScDocShell(), aConv );
-+ ScRange refRange;
-+ ScUnoConversion::FillScRange( refRange, criteriaRangeAddress );
-+ uno::Reference< table::XCellRange > xRange( new ScCellRangeObj( getScDocShell(), refRange ) );
-+ uno::Reference< sheet::XSheetFilterableEx > xCriteria( xRange, uno::UNO_QUERY );
-+ if ( xCriteria.is() )
-+ {
-+ xFilterDesc = xCriteria->createFilterDescriptorByObject( xSheetFilter );
-+ }
-+ }
-+ else if ( mxRange.is() )
-+ {
-+ uno::Reference< sheet::XSheetFilterableEx > xCriteria( mxRange, uno::UNO_QUERY );
-+ if ( xCriteria.is() )
-+ {
-+ xFilterDesc = xCriteria->createFilterDescriptorByObject( xSheetFilter );
-+ }
-+ }
-+
-+ uno::Reference< beans::XPropertySet > xPropertySet( xFilterDesc, uno::UNO_QUERY );
-+ if ( xPropertySet.is() )
-+ {
-+ xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_COPYOUT ) ), uno::makeAny( bCopyOut ) );
-+ }
-+
-+ // CopyToRange
-+ if ( bCopyOut && CopyToRange.hasValue() && xPropertySet.is() )
-+ {
-+ formula::FormulaGrammar::AddressConvention aTmpConv = formula::FormulaGrammar::CONV_XL_A1;
-+ if ( CopyToRange.getValueTypeClass() == uno::TypeClass_STRING )
-+ {
-+ rtl::OUString rRangeString;
-+ CopyToRange >>= rRangeString;
-+ aTmpConv = excel::IsR1C1ReferFormat( pDoc, rRangeString ) ? formula::FormulaGrammar::CONV_XL_R1C1 : aConv;
-+ }
-+ ScRange refRange;
-+ ScUnoConversion::FillScRange( refRange, getCellRangeAddressForVBARange( CopyToRange, getScDocShell(), aTmpConv ) );
-+ uno::Reference< table::XCellRange > xRange( new ScCellRangeObj( getScDocShell(), refRange ) );
-+ uno::Reference< sheet::XCellAddressable > xCellAddr( xRange->getCellByPosition( 0, 0 ), uno::UNO_QUERY_THROW );
-+ xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_OUTPOS ) ), uno::makeAny( xCellAddr->getCellAddress() ) );
-+ }
-+
-+ // Unique
-+ if ( xPropertySet.is() )
-+ {
-+ sal_Bool bUnique = sal_False;
-+ uno::Any aUnique;
-+ try
-+ {
-+ aUnique <<= bUnique;
-+ aUnique = ( xConverter.is() && Unique.hasValue() ) ? xConverter->convertTo( Unique, getCppuType( ( sal_Bool* ) 0 ) ) : aUnique;
-+ }
-+ catch( const uno::Exception& )
-+ {
-+ }
-+ xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_SKIPDUP ) ), aUnique );
-+ }
-+
-+ // Do filter.
-+ if ( xFilterDesc.is() )
-+ {
-+ xSheetFilter->filter( xFilterDesc );
-+ }
-+
-+ return aRet;
-+}
-+
-+//Add by minz@cn.ibm.com. Range.PivotTable.
-+//Returns a PivotTable object that represents the PivotTable report containing the upper-left corner of the specified range.
-+uno::Reference< excel::XPivotTable >
-+ScVbaRange::PivotTable() throw (uno::RuntimeException)
-+{
-+ uno::Reference< excel::XPivotTable > xDestPVTable;
-+
-+ uno::Reference< sheet::XSpreadsheet > xSheet;
-+ if ( mxRange.is() )
-+ {
-+ RangeHelper thisRange( mxRange );
-+ xSheet = thisRange.getSpreadSheet();
-+ }
-+ else if ( mxRanges.is() )
-+ {
-+ uno::Reference< container::XIndexAccess > xIndex( mxRanges, uno::UNO_QUERY_THROW );
-+ uno::Reference< table::XCellRange > xRange( xIndex->getByIndex( 0 ), uno::UNO_QUERY_THROW );
-+ RangeHelper thisRange( xRange );
-+ xSheet = thisRange.getSpreadSheet();
-+ }
-+
-+// RangeHelper thisRange( mxRange );
-+// uno::Reference< sheet::XSpreadsheet > xSheet = thisRange.getSpreadSheet();
-+ uno::Reference< sheet::XDataPilotTablesSupplier > xTables(xSheet, uno::UNO_QUERY_THROW ) ;
-+ uno::Reference< container::XIndexAccess > xIndexAccess( xTables->getDataPilotTables(), uno::UNO_QUERY_THROW );
-+ if ( xIndexAccess.is() )
-+ {
-+ //get the upper-left cell address
-+ table::CellAddress aAddress = getLeftUpperCellAddress();
-+
-+ sal_Int32 nCount = xIndexAccess->getCount();
-+ for (sal_Int32 i=0; i < nCount; i++)
-+ {
-+ uno::Reference< sheet::XDataPilotTable > xDPTable(xIndexAccess->getByIndex(i), uno::UNO_QUERY);
-+ uno::Reference< sheet::XDataPilotTable2 > xDPTable2(xDPTable, uno::UNO_QUERY);
-+
-+ //check if the cell is in the pivot table
-+ sheet::DataPilotTablePositionData posData = xDPTable2->getPositionData(aAddress);
-+ table::CellRangeAddress aCellRangeAddress = xDPTable->getOutputRange();
-+ ScRange aScRange( aCellRangeAddress.StartColumn, aCellRangeAddress.StartRow, aCellRangeAddress.Sheet,
-+ aCellRangeAddress.EndColumn, aCellRangeAddress.EndRow, aCellRangeAddress.Sheet );
-+ ScAddress aPos( aAddress.Column, aAddress.Row, aAddress.Sheet );
-+ if( !(posData.PositionType == sheet::DataPilotTablePositionType::NOT_IN_TABLE) || aScRange.In( aPos ) )
-+ {
-+ xDestPVTable = new ScVbaPivotTable( mxContext, xDPTable );
-+ break;
-+ }
-+ }
-+ }
-+ return xDestPVTable;
-+}
-+
-+
- rtl::OUString&
- ScVbaRange::getServiceImplName()
- {
-@@ -5642,6 +6102,25 @@ ScVbaRange::getServiceNames()
- return aServiceNames;
- }
-
-+sal_Bool SAL_CALL
-+ScVbaRange::hasError() throw (uno::RuntimeException)
-+{
-+ double dResult = sal_False;
-+ uno::Reference< excel::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW );
-+ uno::Reference< script::XInvocation > xInvoc( xApplication->WorksheetFunction(), uno::UNO_QUERY_THROW );
-+
-+ static rtl::OUString FunctionName( RTL_CONSTASCII_USTRINGPARAM("IsError" ) );
-+ uno::Sequence< uno::Any > Params(1);
-+ uno::Reference< excel::XRange > aRange( this );
-+ Params[0] = uno::makeAny( aRange );
-+ uno::Sequence< sal_Int16 > OutParamIndex;
-+ uno::Sequence< uno::Any > OutParam;
-+ xInvoc->invoke( FunctionName, Params, OutParamIndex, OutParam ) >>= dResult;
-+ if ( dResult > 0.0 )
-+ return sal_True;
-+ return sal_False;
-+}
-+
- namespace range
- {
- namespace sdecl = comphelper::service_decl;
-diff --git sc/source/ui/vba/vbarange.hxx sc/source/ui/vba/vbarange.hxx
-index 14f0bde..50b18ba 100644
---- sc/source/ui/vba/vbarange.hxx
-+++ sc/source/ui/vba/vbarange.hxx
-@@ -35,6 +35,7 @@
- #include <ooo/vba/excel/XFont.hpp>
- #include <ooo/vba/excel/XComment.hpp>
- #include <ooo/vba/XCollection.hpp>
-+#include <ooo/vba/excel/XPivotTable.hpp>
- #include <ooo/vba/excel/XlPasteType.hdl>
- #include <ooo/vba/excel/XlPasteSpecialOperation.hdl>
-
-@@ -49,6 +50,8 @@
- #include <com/sun/star/sheet/FillDirection.hpp>
- #include <com/sun/star/sheet/XSpreadsheet.hpp>
- #include <com/sun/star/sheet/XSheetCellRangeContainer.hpp>
-+#include <com/sun/star/table/CellAddress.hpp>
-+#include "vbaquerytable.hxx" //09-09-18 add by limingl
-
- #include "vbaformat.hxx"
- #include <formula/grammar.hxx>
-@@ -99,6 +102,7 @@ class ScVbaRange : public ScVbaRange_BASE
- sal_Bool mbIsRows;
- sal_Bool mbIsColumns;
- css::uno::Reference< ov::excel::XValidation > m_xValidation;
-+ css::uno::Reference<excel::XQueryTable> m_xQueryTable; //09-09-16 add by limingl
- double getCalcColWidth( const css::table::CellRangeAddress& ) throw (css::uno::RuntimeException);
- double getCalcRowHeight( const css::table::CellRangeAddress& ) throw (css::uno::RuntimeException);
- void visitArray( ArrayVisitor& vistor );
-@@ -148,6 +152,7 @@ public:
- const css::uno::Reference< css::uno::XComponentContext >& xContext,
- const rtl::OUString& sRangeName, ScDocShell* pDocSh,
- formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_XL_A1 ) throw ( css::uno::RuntimeException );
-+ css::table::CellAddress getLeftUpperCellAddress();
-
- // Attributes
- virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
-@@ -190,6 +195,7 @@ public:
- virtual css::uno::Any SAL_CALL getPrefixCharacter() throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getShowDetail() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setShowDetail(const css::uno::Any& aShowDetail) throw (css::uno::RuntimeException);
-+ virtual ::com::sun::star::uno::Reference< ::ooo::vba::excel::XQueryTable > SAL_CALL getQueryTable() throw (::com::sun::star::uno::RuntimeException); //09-09-16 add by limingl
- // Methods
- sal_Bool IsRows() { return mbIsRows; }
- sal_Bool IsColumns() { return mbIsColumns; }
-@@ -239,8 +245,8 @@ public:
- virtual css::uno::Any SAL_CALL Borders( const css::uno::Any& ) throw ( css::script::BasicErrorException, css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL BorderAround( const css::uno::Any& LineStyle,
- const css::uno::Any& Weight, const css::uno::Any& ColorIndex, const css::uno::Any& Color ) throw (css::uno::RuntimeException);
-- virtual void SAL_CALL TextToColumns( const css::uno::Any& Destination, const css::uno::Any& DataType, const css::uno::Any& TextQualifier,
-- const css::uno::Any& ConsecutinveDelimiter, const css::uno::Any& Tab, const css::uno::Any& Semicolon, const css::uno::Any& Comma,
-+ virtual void SAL_CALL TextToColumns( const css::uno::Any& Destination, const css::uno::Any& DataType, const css::uno::Any& TextQualifier,
-+ const css::uno::Any& ConsecutiveDelimiter, const css::uno::Any& Tab, const css::uno::Any& Semicolon, const css::uno::Any& Comma,
- const css::uno::Any& Space, const css::uno::Any& Other, const css::uno::Any& OtherChar, const css::uno::Any& FieldInfo,
- const css::uno::Any& DecimalSeparator, const css::uno::Any& ThousandsSeparator, const css::uno::Any& TrailingMinusNumbers ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Hyperlinks( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-@@ -265,6 +271,11 @@ public:
- virtual void SAL_CALL RemoveSubtotal( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual css::uno::Reference< ov::excel::XRange > SAL_CALL MergeArea() throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL Subtotal( ::sal_Int32 GroupBy, ::sal_Int32 Function, const css::uno::Sequence< ::sal_Int32 >& TotalList, const css::uno::Any& Replace, const css::uno::Any& PageBreaks, const css::uno::Any& SummaryBelowData ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL AdvancedFilter( ::sal_Int32 Action, const css::uno::Any& CriteriaRange, const css::uno::Any& CopyToRange, const css::uno::Any& Unique ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-+
-+ virtual css::uno::Reference< ov::excel::XPivotTable > SAL_CALL PivotTable( ) throw (css::uno::RuntimeException);
-+
-+ virtual ::sal_Int32 SAL_CALL CopyFromRecordset( const ::com::sun::star::uno::Any& Data, const ::com::sun::star::uno::Any& MaxRows, const ::com::sun::star::uno::Any& MaxColumns ) throw (::com::sun::star::script::BasicErrorException, ::com::sun::star::uno::RuntimeException); //2008-08-25 add by limingl
- // XEnumerationAccess
- virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
- // XElementAccess
-@@ -290,6 +301,8 @@ public:
- static css::uno::Reference< ov::excel::XRange > ApplicationRange( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Any &Cell1, const css::uno::Any &Cell2 ) throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL GoalSeek( const css::uno::Any& Goal, const css::uno::Reference< ov::excel::XRange >& ChangingCell ) throw (css::uno::RuntimeException);
- virtual css::uno::Reference< ov::excel::XRange > SAL_CALL SpecialCells( const css::uno::Any& _oType, const css::uno::Any& _oValue) throw ( css::script::BasicErrorException );
-+ // XErrorQuery
-+ virtual ::sal_Bool SAL_CALL hasError( ) throw (css::uno::RuntimeException);
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-diff --git sc/source/ui/vba/vbavalidation.cxx sc/source/ui/vba/vbavalidation.cxx
-index f76794e..e585343 100644
---- sc/source/ui/vba/vbavalidation.cxx
-+++ sc/source/ui/vba/vbavalidation.cxx
-@@ -25,6 +25,7 @@
- *
- ************************************************************************/
- #include "vbavalidation.hxx"
-+#include "vbaformatcondition.hxx"
- #include <com/sun/star/sheet/XSheetCondition.hpp>
- #include <com/sun/star/sheet/ValidationType.hpp>
- #include <com/sun/star/sheet/ValidationAlertStyle.hpp>
-@@ -225,8 +226,10 @@ ScVbaValidation::Delete( ) throw (uno::RuntimeException)
-
- lcl_setValidationProps( m_xRange, xProps );
- }
-+
-+// Fix the defect that validatation cannot work when the input should be limited between a lower bound and an upper bound
- void SAL_CALL
--ScVbaValidation::Add( const uno::Any& Type, const uno::Any& AlertStyle, const uno::Any& /*Operator*/, const uno::Any& Formula1, const uno::Any& Formula2 ) throw (uno::RuntimeException)
-+ScVbaValidation::Add( const uno::Any& Type, const uno::Any& AlertStyle, const uno::Any& Operator, const uno::Any& Formula1, const uno::Any& Formula2 ) throw (uno::RuntimeException)
- {
- uno::Reference< beans::XPropertySet > xProps( lcl_getValidationProps( m_xRange ) );
- uno::Reference< sheet::XSheetCondition > xCond( xProps, uno::UNO_QUERY_THROW );
-@@ -291,6 +294,13 @@ ScVbaValidation::Add( const uno::Any& Type, const uno::Any& AlertStyle, const un
-
- xProps->setPropertyValue( ALERTSTYLE, uno::makeAny( eStyle ) );
-
-+ //2009-11-11 fix the defect that validatation cannot work when the input should be limited between a lower bound and an upper bound
-+ if ( Operator.hasValue() )
-+ {
-+ css::sheet::ConditionOperator conOperator = ScVbaFormatCondition::retrieveAPIOperator( Operator );
-+ xCond->setOperator( conOperator );
-+ }
-+ //2009-11-11
- if ( sFormula1.getLength() )
- xCond->setFormula1( sFormula1 );
- if ( sFormula2.getLength() )
-diff --git sc/source/ui/vba/vbaworkbook.cxx sc/source/ui/vba/vbaworkbook.cxx
-index 5fa25a4..4d4ad9c 100644
---- sc/source/ui/vba/vbaworkbook.cxx
-+++ sc/source/ui/vba/vbaworkbook.cxx
-@@ -36,6 +36,7 @@
- #include <com/sun/star/frame/XFrame.hpp>
- #include <com/sun/star/beans/XPropertySet.hpp>
- #include <ooo/vba/excel/XlFileFormat.hpp>
-+#include <ooo/vba/excel/XApplication.hpp> //liuchen 2009-12-16
-
- #include "scextopt.hxx"
- #include "vbaworksheet.hxx"
-@@ -124,7 +125,7 @@ ScVbaWorkbook::Colors( const ::uno::Any& Index ) throw (::script::BasicErrorExce
- }
-
- ::sal_Int32 SAL_CALL
--ScVbaWorkbook::FileFormat( ) throw (::script::BasicErrorException, ::uno::RuntimeException)
-+ScVbaWorkbook::getFileFormat( ) throw (::uno::RuntimeException)
- {
- sal_Int32 aFileFormat = 0;
- rtl::OUString aFilterName;
-@@ -184,6 +185,24 @@ ScVbaWorkbook::FileFormat( ) throw (::script::BasicErrorException, ::uno::Runti
- return aFileFormat;
- }
-
-+//VBA by minz@cn.ibm.com. Convert Excel fileformat to OO file filter
-+::rtl::OUString ScVbaWorkbook::convertFileFormat(sal_Int32 aFileFormat)
-+{
-+ rtl::OUString aFilterName;
-+
-+ switch(aFileFormat)
-+ {
-+ case excel::XlFileFormat::xlCSV:
-+ aFilterName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Text - txt - csv (StarCalc)" ) );
-+ break;
-+ case excel::XlFileFormat::xlExcel9795:
-+ aFilterName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MS Excel 97" ) );
-+ break;
-+ }
-+
-+ return aFilterName;
-+}
-+
- void
- ScVbaWorkbook::init()
- {
-@@ -261,6 +280,12 @@ ScVbaWorkbook::Activate() throw (uno::RuntimeException)
- VbaDocumentBase::Activate();
- }
-
-+void
-+ScVbaWorkbook::Protect( const uno::Any &aPassword ) throw (uno::RuntimeException)
-+{
-+ VbaDocumentBase::Protect( aPassword );
-+}
-+
- ::sal_Bool
- ScVbaWorkbook::getProtectStructure() throw (uno::RuntimeException)
- {
-@@ -296,6 +321,50 @@ ScVbaWorkbook::SaveCopyAs( const rtl::OUString& sFileName ) throw ( uno::Runtime
- xStor->storeToURL( aURL, storeProps );
- }
-
-+//VBA by minz@cn.ibm.com. Add Workbook.SaveAs.
-+void
-+ScVbaWorkbook::SaveAs( const rtl::OUString& FileName, const uno::Any& FileFormat, const uno::Any& /*CreateBackup*/ ) throw ( uno::RuntimeException)
-+{
-+ rtl::OUString aURL;
-+ osl::FileBase::getFileURLFromSystemPath( FileName, aURL );
-+ //liuchen 2009-12-16 if the input parameter "FileName" takes the form as "MyFile", we need to get the current directory and combine the current directory and the file name
-+ INetURLObject aFileNameURL( aURL );
-+ aURL = aFileNameURL.GetMainURL( INetURLObject::NO_DECODE );
-+ if ( aURL.getLength() == 0 )
-+ {
-+ uno::Reference< excel::XApplication > xApplication ( Application(),uno::UNO_QUERY_THROW );
-+ rtl::OUString aPathStr = xApplication->getDefaultFilePath();
-+ rtl::OUString aPathURLStr;
-+ osl::FileBase::getFileURLFromSystemPath( aPathStr, aPathURLStr );
-+ INetURLObject aPathURL( aPathURLStr );
-+ aPathURL.Append( FileName );
-+ aURL = aPathURL.GetMainURL( INetURLObject::NO_DECODE );
-+ }
-+ //liuchen 2009-12-16
-+ uno::Reference< frame::XStorable > xStor( getModel(), uno::UNO_QUERY_THROW );
-+
-+ sal_Int32 aFileFormat = excel::XlFileFormat::xlExcel9795;
-+ FileFormat >>= aFileFormat;
-+
-+ if ( FileName.indexOf('.') == -1 )
-+ {
-+ if ( aFileFormat == excel::XlFileFormat::xlExcel9795 )
-+ {
-+ aURL = aURL + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".xls" ) );
-+ }
-+ else if ( aFileFormat == excel::XlFileFormat::xlCSV )
-+ {
-+ aURL = aURL + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".csv" ) );
-+ }
-+ }
-+
-+ uno::Sequence< beans::PropertyValue > storeProps(1);
-+ storeProps[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterName" ) );
-+ storeProps[0].Value <<= convertFileFormat(aFileFormat);
-+
-+ xStor->storeAsURL( aURL, storeProps );
-+}
-+
- css::uno::Any SAL_CALL
- ScVbaWorkbook::Styles( const::uno::Any& Item ) throw (uno::RuntimeException)
- {
-diff --git sc/source/ui/vba/vbaworkbook.hxx sc/source/ui/vba/vbaworkbook.hxx
-index 36ce6ed..eac6df1 100644
---- sc/source/ui/vba/vbaworkbook.hxx
-+++ sc/source/ui/vba/vbaworkbook.hxx
-@@ -41,6 +41,8 @@ class ScVbaWorkbook : public ScVbaWorkbook_BASE
- static css::uno::Sequence< sal_Int32 > ColorData;
- void initColorData( const css::uno::Sequence< sal_Int32 >& sColors );
- void init();
-+
-+ ::rtl::OUString convertFileFormat(sal_Int32 aFileFormat);
- protected:
-
- ScVbaWorkbook( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext);
-@@ -61,20 +63,25 @@ public:
- 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 Activate() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL Protect( const css::uno::Any & aPassword ) throw (css::uno::RuntimeException);
- // Amelia Wang
- virtual css::uno::Any SAL_CALL Names( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-
- virtual css::uno::Any SAL_CALL Styles( const css::uno::Any& Item ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL ResetColors( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Colors( const css::uno::Any& Index ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-- virtual ::sal_Int32 SAL_CALL FileFormat( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getFileFormat( ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL SaveCopyAs( const rtl::OUString& Filename ) throw ( css::uno::RuntimeException);
-+ virtual void SAL_CALL SaveAs( const rtl::OUString& FileName, const css::uno::Any& FileFormat, const css::uno::Any& CreateBackup ) throw (css::uno::RuntimeException);
-+
- // code name
- virtual ::rtl::OUString SAL_CALL getCodeName() throw ( css::uno::RuntimeException);
-
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+
-+ virtual css::uno::Reference< css::frame::XModel > getDocModel() { return mxModel; }
- };
-
- #endif /* SC_VBA_WORKBOOK_HXX */
-diff --git sc/source/ui/vba/vbaworksheet.cxx sc/source/ui/vba/vbaworksheet.cxx
-index c09e229..60b7bf6 100644
---- sc/source/ui/vba/vbaworksheet.cxx
-+++ sc/source/ui/vba/vbaworksheet.cxx
-@@ -62,6 +62,7 @@
- #include <ooo/vba/excel/XlEnableSelection.hpp>
- #include <ooo/vba/excel/XWorkbook.hpp>
- #include <ooo/vba/XControlProvider.hpp>
-+#include <ooo/vba/excel/XlSheetVisibility.hpp>
-
- #include <comphelper/processfactory.hxx>
- #include <vbahelper/vbashapes.hxx>
-@@ -79,7 +80,7 @@
-
- #include "cellsuno.hxx"
- #include "drwlayer.hxx"
--
-+#include "tabprotection.hxx"
- #include "scextopt.hxx"
- #include "vbaoutline.hxx"
- #include "vbarange.hxx"
-@@ -93,6 +94,7 @@
- #include "vbaworksheets.hxx"
- #include "vbahyperlinks.hxx"
- #include "vbasheetobjects.hxx"
-+#include "viewuno.hxx" //liuchen 2009-9-2
-
- #define STANDARDWIDTH 2267
- #define STANDARDHEIGHT 427
-@@ -220,7 +222,7 @@ ScVbaWorksheet::setName(const ::rtl::OUString &rName ) throw (uno::RuntimeExcept
- xNamed->setName( rName );
- }
-
--sal_Bool
-+::sal_Int32
- ScVbaWorksheet::getVisible() throw (uno::RuntimeException)
- {
- uno::Reference< beans::XPropertySet > xProps( getSheet(), uno::UNO_QUERY_THROW );
-@@ -228,13 +230,33 @@ ScVbaWorksheet::getVisible() throw (uno::RuntimeException)
- (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsVisible" ) ) );
- sal_Bool bRet = false;
- aValue >>= bRet;
-- return bRet;
-+ if ( bRet )
-+ {
-+ return excel::XlSheetVisibility::xlSheetVisible;
-+ }
-+ else
-+ {
-+ return excel::XlSheetVisibility::xlSheetHidden;
-+ }
- }
-
- void
--ScVbaWorksheet::setVisible( sal_Bool bVisible ) throw (uno::RuntimeException)
-+ScVbaWorksheet::setVisible( ::sal_Int32 _Visible ) throw (uno::RuntimeException)
- {
- uno::Reference< beans::XPropertySet > xProps( getSheet(), uno::UNO_QUERY_THROW );
-+
-+ //VBA by minz@cn.ibm.com.
-+ sal_Bool bVisible = true;
-+ switch( _Visible )
-+ {
-+ case excel::XlSheetVisibility::xlSheetHidden:
-+ case excel::XlSheetVisibility::xlSheetVeryHidden:
-+ bVisible = false;
-+ break;
-+ case excel::XlSheetVisibility::xlSheetVisible:
-+ bVisible = true;
-+ break;
-+ }
- uno::Any aValue( bVisible );
- xProps->setPropertyValue
- (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsVisible" ) ), aValue);
-@@ -392,6 +414,18 @@ ScVbaWorksheet::getProtectContents()throw (uno::RuntimeException)
- sal_Bool
- ScVbaWorksheet::getProtectDrawingObjects() throw (uno::RuntimeException)
- {
-+ SCTAB nTab = 0;
-+ rtl::OUString aSheetName = getName();
-+ uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( getModel(), uno::UNO_QUERY_THROW );
-+ bool bSheetExists = ScVbaWorksheets::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);
-+ if ( pProtect )
-+ return pProtect->isOptionEnabled( ScTableProtection::OBJECTS );
-+ }
- return sal_False;
- }
-
-@@ -403,10 +437,30 @@ ScVbaWorksheet::Activate() throw (uno::RuntimeException)
- xSpreadsheet->setActiveSheet(getSheet());
- }
-
-+//liuchen 2009-9-2, support expand (but not replace) the active sheet
- void
--ScVbaWorksheet::Select() throw (uno::RuntimeException)
--{
-- Activate();
-+ScVbaWorksheet::Select(const css::uno::Any& aReplace) throw (uno::RuntimeException)
-+{
-+ sal_Bool bReplace = true;
-+ if (aReplace.hasValue() && aReplace.getValueTypeClass() == uno::TypeClass_BOOLEAN)
-+ {
-+ aReplace >>= bReplace;
-+ }
-+
-+ uno::Reference< sheet::XSpreadsheetView > xSpreadsheet(
-+ getModel()->getCurrentController(), uno::UNO_QUERY_THROW );
-+ ScTabViewObj* pTabView = static_cast< ScTabViewObj* >( xSpreadsheet.get() );
-+
-+ if (bReplace)
-+ {
-+ pTabView->selectSheet(getSheet(), false);
-+ }
-+ else
-+ {
-+ uno::Reference< sheet::XSpreadsheet > xOldActiveSheet = pTabView->getActiveSheet();
-+ pTabView->selectSheet(getSheet(), true);
-+ pTabView->selectSheet(xOldActiveSheet, true);
-+ }
- }
-
- void
-@@ -468,18 +522,42 @@ ScVbaWorksheet::Copy( const uno::Any& Before, const uno::Any& After ) throw (uno
- return;
- }
-
-- uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( getModel(), uno::UNO_QUERY );
-+ ScVbaWorksheet* pDestSheet = static_cast< ScVbaWorksheet* >(xSheet.get());
-+ uno::Reference <sheet::XSpreadsheetDocument> xDestDoc( pDestSheet->getModel(), uno::UNO_QUERY );
-+ uno::Reference <sheet::XSpreadsheetDocument> xSrcDoc( getModel(), uno::UNO_QUERY );
-+
- SCTAB nDest = 0;
-+ SCTAB nSrc = 0;
- rtl::OUString aSheetName = xSheet->getName();
-- if ( ScVbaWorksheets::nameExists (xSpreadDoc, aSheetName, nDest ) )
-+ bool bSameDoc = ( pDestSheet->getModel() == getModel() );
-+ bool bDestSheetExists = ScVbaWorksheets::nameExists (xDestDoc, aSheetName, nDest );
-+ bool bSheetExists = ScVbaWorksheets::nameExists (xSrcDoc, aCurrSheetName, nSrc );
-+
-+ // set sheet name to be newSheet name
-+ aSheetName = aCurrSheetName;
-+ SCTAB nDummy=0;
-+ if ( bSheetExists && bDestSheetExists )
- {
- sal_Bool bAfter = After.hasValue();
- if(bAfter)
- nDest++;
-- uno::Reference<sheet::XSpreadsheets> xSheets = xSpreadDoc->getSheets();
-- getNewSpreadsheetName(aSheetName,aCurrSheetName,xSpreadDoc);
-- xSheets->copyByName(aCurrSheetName,aSheetName,nDest);
-+ uno::Reference<sheet::XSpreadsheets> xSheets = xDestDoc->getSheets();
-+ if ( bSameDoc || ScVbaWorksheets::nameExists( xDestDoc, aCurrSheetName, nDummy ) )
-+ getNewSpreadsheetName(aSheetName,aCurrSheetName,xDestDoc);
-+ if ( bSameDoc )
-+ xSheets->copyByName(aCurrSheetName,aSheetName,nDest);
-+ else
-+ {
-+ ScDocShell* pDestDocShell = excel::getDocShell( pDestSheet->getModel() );
-+ ScDocShell* pSrcDocShell = excel::getDocShell( getModel() );
-+ if ( pDestDocShell && pSrcDocShell )
-+ pDestDocShell->TransferTab( *pSrcDocShell, static_cast<SCTAB>(nSrc), static_cast<SCTAB>(nDest), TRUE, TRUE );
-+ }
- }
-+ // active the new sheet
-+ uno::Reference< excel::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW );
-+ uno::Reference< excel::XWorksheet > xNewSheet( xApplication->Worksheets( uno::makeAny( aSheetName ) ), uno::UNO_QUERY_THROW );
-+ xNewSheet->Activate();
- }
-
-
-@@ -531,13 +609,25 @@ ScVbaWorksheet::getSheetAtOffset(SCTAB offset) throw (uno::RuntimeException)
- uno::Reference< excel::XWorksheet >
- ScVbaWorksheet::getNext() throw (uno::RuntimeException)
- {
-- return getSheetAtOffset(static_cast<SCTAB>(1));
-+ //VBA, minz@cn.ibm.com. catch the exception for index out of bound
-+ try{
-+ return getSheetAtOffset(static_cast<SCTAB>(1));
-+ }catch( lang::IndexOutOfBoundsException& /*e*/ )
-+ {
-+ return NULL;
-+ }
- }
-
- uno::Reference< excel::XWorksheet >
- ScVbaWorksheet::getPrevious() throw (uno::RuntimeException)
- {
-- return getSheetAtOffset(-1);
-+ //VBA, minz@cn.ibm.com. catch the exception for index out of bound
-+ try{
-+ return getSheetAtOffset(-1);
-+ }catch( lang::IndexOutOfBoundsException& /*e*/ )
-+ {
-+ return NULL;
-+ }
- }
-
-
-@@ -621,7 +711,7 @@ ScVbaWorksheet::ChartObjects( const uno::Any& Index ) throw (uno::RuntimeExcepti
- uno::Reference< table::XTableChartsSupplier > xChartSupplier( getSheet(), uno::UNO_QUERY_THROW );
- uno::Reference< table::XTableCharts > xTableCharts = xChartSupplier->getCharts();
-
-- uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxSheet, uno::UNO_QUERY_THROW );
-+ uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( getSheet(), uno::UNO_QUERY_THROW ); //VBA, minz@cn.ibm.com.
- mxCharts = new ScVbaChartObjects( this, mxContext, xTableCharts, xDrawPageSupplier );
- }
- if ( Index.hasValue() )
-@@ -940,7 +1030,7 @@ ScVbaWorksheet::getCodeName() throw (css::uno::RuntimeException)
- sal_Int16
- ScVbaWorksheet::getSheetID() throw (uno::RuntimeException)
- {
-- uno::Reference< sheet::XCellRangeAddressable > xAddressable( mxSheet, uno::UNO_QUERY_THROW );
-+ uno::Reference< sheet::XCellRangeAddressable > xAddressable( getSheet(), uno::UNO_QUERY_THROW ); //VBA. minz@cn.ibm.com. if ActiveSheet, mxSheet is null.
- return xAddressable->getRangeAddress().Sheet;
- }
-
-diff --git sc/source/ui/vba/vbaworksheet.hxx sc/source/ui/vba/vbaworksheet.hxx
-index 4c730ab..cfa88cd 100644
---- sc/source/ui/vba/vbaworksheet.hxx
-+++ sc/source/ui/vba/vbaworksheet.hxx
-@@ -42,6 +42,7 @@
- #include <ooo/vba/excel/XPageSetup.hpp>
- #include <ooo/vba/excel/XHPageBreaks.hpp>
- #include <ooo/vba/excel/XVPageBreaks.hpp>
-+#include <com/sun/star/container/XNamed.hpp>
-
- #include <vbahelper/vbahelperinterface.hxx>
- #include "address.hxx"
-@@ -85,8 +86,8 @@ public:
- // Attributes
- virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setName( const ::rtl::OUString &rName ) throw (css::uno::RuntimeException);
-- virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException);
-- virtual void SAL_CALL setVisible( sal_Bool bVisible ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getVisible() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setVisible( ::sal_Int32 _Visible ) throw (css::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getStandardWidth() throw (css::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getStandardHeight() throw (css::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL getProtectionMode() throw (css::uno::RuntimeException);
-@@ -109,7 +113,7 @@ public:
-
- // Methods
- virtual void SAL_CALL Activate() throw (css::uno::RuntimeException);
-- virtual void SAL_CALL Select() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL Select(const css::uno::Any& aReplace) throw (css::uno::RuntimeException); //liuchen 2009-9-2, add the input parameter to support expand selection
- virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Range( const css::uno::Any& Cell1, const css::uno::Any& Cell2 ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Move( const css::uno::Any& Before, const css::uno::Any& After ) throw (css::uno::RuntimeException) ;
- virtual void SAL_CALL Copy( const css::uno::Any& Before, const css::uno::Any& After ) throw (css::uno::RuntimeException);
-diff --git sc/source/ui/vba/vbawsfunction.cxx sc/source/ui/vba/vbawsfunction.cxx
-index 008b969..f65ef51 100644
---- sc/source/ui/vba/vbawsfunction.cxx
-+++ sc/source/ui/vba/vbawsfunction.cxx
-@@ -60,6 +60,18 @@ void lclConvertDoubleToBoolean( uno::Any& rAny )
- }
- }
-
-+void lclConvertBooleanToDouble( uno::Any& rAny )
-+{
-+ sal_Bool bValue( sal_False );
-+ if ( rAny >>= bValue )
-+ {
-+ if ( bValue )
-+ rAny <<= double( 1.0 );
-+ else
-+ rAny <<= double( 0.0 );
-+ }
-+}
-+
- } // namespace
-
- ScVbaWSFunction::ScVbaWSFunction( const uno::Reference< XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) :
-@@ -84,9 +96,57 @@ ScVbaWSFunction::invoke(const rtl::OUString& FunctionName, const uno::Sequence<
- uno::Any* pArrayEnd = pArray + aParamTemp.getLength();
- for( ; pArray < pArrayEnd; ++pArray )
- {
-- uno::Reference< excel::XRange > myRange( *pArray, uno::UNO_QUERY );
-- if( myRange.is() )
-- *pArray = myRange->getCellRange();
-+ switch( pArray->getValueType().getTypeClass() )
-+ {
-+ case uno::TypeClass_BOOLEAN:
-+ lclConvertBooleanToDouble( *pArray );
-+ break;
-+ case uno::TypeClass_INTERFACE:
-+ {
-+ uno::Reference< excel::XRange > myRange( *pArray, uno::UNO_QUERY );
-+ if( myRange.is() )
-+ *pArray = myRange->getCellRange();
-+ }
-+ break;
-+ case uno::TypeClass_SEQUENCE:
-+ {
-+ // the sheet.FunctionAccess service doesn't deal with Sequences, only Sequences of Sequence
-+ uno::Type aType = pArray->getValueType();
-+ if ( aType.equals( getCppuType( (uno::Sequence<sal_Int16>*)0 ) ) )
-+ {
-+ uno::Sequence< uno::Sequence< sal_Int16 > > aTmp(1);
-+ (*pArray) >>= aTmp[ 0 ];
-+ (*pArray) <<= aTmp;
-+ }
-+ else if ( aType.equals( getCppuType( (uno::Sequence<sal_Int32>*)0 ) ) )
-+ {
-+ uno::Sequence< uno::Sequence< sal_Int32 > > aTmp(1);
-+ (*pArray) >>= aTmp[ 0 ];
-+ (*pArray) <<= aTmp;
-+ }
-+ else if ( aType.equals( getCppuType( (uno::Sequence<double>*)0 ) ) )
-+ {
-+ uno::Sequence< uno::Sequence< double > > aTmp(1);
-+ (*pArray) >>= aTmp[ 0 ];
-+ (*pArray) <<= aTmp;
-+ }
-+ else if ( aType.equals( getCppuType( (uno::Sequence<rtl::OUString>*)0 ) ) )
-+ {
-+ uno::Sequence< uno::Sequence< rtl::OUString > > aTmp(1);
-+ (*pArray) >>= aTmp[ 0 ];
-+ (*pArray) <<= aTmp;
-+ }
-+ else if ( aType.equals( getCppuType( (uno::Sequence<uno::Any>*)0 ) ) )
-+ {
-+ uno::Sequence< uno::Sequence<uno::Any > > aTmp(1);
-+ (*pArray) >>= aTmp[ 0 ];
-+ (*pArray) <<= aTmp;
-+ }
-+ }
-+ break;
-+ default:
-+ break;
-+ }
- OSL_TRACE("Param[%d] is %s", (int)(pArray - aParamTemp.getConstArray()), rtl::OUStringToOString( comphelper::anyToString( *pArray ), RTL_TEXTENCODING_UTF8 ).getStr() );
- }
- }
-diff --git sc/source/ui/view/cellsh2.cxx sc/source/ui/view/cellsh2.cxx
-index 3908596..f4ba3d5 100644
---- sc/source/ui/view/cellsh2.cxx
-+++ sc/source/ui/view/cellsh2.cxx
-@@ -345,6 +345,20 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
- }
- break;
-
-+ case SID_DATA_FORM:
-+ {
-+ ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
-+ DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
-+
-+ AbstractScDataFormDlg* pDlg = pFact->CreateScDataFormDlg( pTabViewShell->GetDialogParent(),RID_SCDLG_DATAFORM, pTabViewShell);
-+ DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001
-+
-+ pDlg->Execute();
-+
-+ rReq.Done();
-+ }
-+ break;
-+
- case SID_SUBTOTALS:
- {
- const SfxItemSet* pArgs = rReq.GetArgs();
-diff --git sc/source/ui/view/gridwin5.cxx sc/source/ui/view/gridwin5.cxx
-index 821d5da..d9e10ef 100644
---- sc/source/ui/view/gridwin5.cxx
-+++ sc/source/ui/view/gridwin5.cxx
-@@ -343,14 +343,12 @@ void ScGridWindow::RequestHelp(const HelpEvent& rHEvt)
- if ( pDrView->PickObj(aMDPos, pDrView->getHitTolLog(), pHit, pPV, SDRSEARCH_DEEP ) )
- pObj = pHit;
- }
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
- ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( pObj );
- if ( pInfo && (pInfo->GetHlink().getLength() > 0) )
- {
- aPixRect = LogicToPixel(aVEvt.pObj->GetLogicRect());
- aHelpText = pInfo->GetHlink();
- }
--#endif
- }
- }
- }
-diff --git sc/source/ui/view/tabview3.cxx sc/source/ui/view/tabview3.cxx
-index 961f526..355f741 100644
---- sc/source/ui/view/tabview3.cxx
-+++ sc/source/ui/view/tabview3.cxx
-@@ -1419,10 +1419,12 @@ void ScTabView::MarkRange( const ScRange& rRange, BOOL bSetCursor, BOOL bContinu
- {
- SCCOL nAlignX = rRange.aStart.Col();
- SCROW nAlignY = rRange.aStart.Row();
-- if ( rRange.aStart.Col() == 0 && rRange.aEnd.Col() == MAXCOL )
-- nAlignX = aViewData.GetPosX(WhichH(aViewData.GetActivePart()));
-- if ( rRange.aStart.Row() == 0 && rRange.aEnd.Row() == MAXROW )
-- nAlignY = aViewData.GetPosY(WhichV(aViewData.GetActivePart()));
-+ bool bCol = ( rRange.aStart.Col() == 0 && rRange.aEnd.Col() == MAXCOL ) && !aViewData.GetDocument()->IsInVBAMode();
-+ bool bRow = ( rRange.aStart.Row() == 0 && rRange.aEnd.Row() == MAXROW );
-+ if ( bCol )
-+ nAlignX = aViewData.GetPosX(WhichH(aViewData.GetActivePart()));
-+ if ( bRow )
-+ nAlignY = aViewData.GetPosY(WhichV(aViewData.GetActivePart()));
- AlignToCursor( nAlignX, nAlignY, SC_FOLLOW_JUMP );
- }
- InitBlockMode( rRange.aStart.Col(), rRange.aStart.Row(), nTab );
-@@ -1535,6 +1537,7 @@ void ScTabView::SetTabNo( SCTAB nTab, BOOL bNew, BOOL bExtendSelection )
- // nicht InputEnterHandler wegen Referenzeingabe !
-
- ScDocument* pDoc = aViewData.GetDocument();
-+
- pDoc->MakeTable( nTab );
-
- // Update pending row heights before switching the sheet, so Reschedule from the progress bar
-diff --git sc/source/ui/view/tabvwsh4.cxx sc/source/ui/view/tabvwsh4.cxx
-index 095a6f3..43dd17a 100644
---- sc/source/ui/view/tabvwsh4.cxx
-+++ sc/source/ui/view/tabvwsh4.cxx
-@@ -1799,6 +1799,13 @@ void ScTabViewShell::Construct( BYTE nForceDesignMode )
- if ( pDocSh->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED )
- {
- SCTAB nInitTabCount = 3; //! konfigurierbar !!!
-+ // Get the customized initial tab count, we only can set the count by VBA API currently.
-+ const ScAppOptions& rAppOpt = SC_MOD()->GetAppOptions();
-+ SCTAB nNewTabCount = rAppOpt.GetTabCountInNewSpreadsheet();
-+ if ( nNewTabCount >= 1 && nNewTabCount <= MAXTAB )
-+ {
-+ nInitTabCount = nNewTabCount;
-+ }
- for (SCTAB i=1; i<nInitTabCount; i++)
- pDoc->MakeTable(i,false);
- }
-diff --git sc/source/ui/view/viewfun2.cxx sc/source/ui/view/viewfun2.cxx
-index c341e8e..145ad8e 100644
---- sc/source/ui/view/viewfun2.cxx
-+++ sc/source/ui/view/viewfun2.cxx
-@@ -52,6 +52,11 @@
- #include <vcl/sound.hxx>
- #include <vcl/waitobj.hxx>
-
-+#include <basic/sbstar.hxx>
-+#include <com/sun/star/container/XNameContainer.hpp>
-+#include <com/sun/star/script/XLibraryContainer.hpp>
-+using namespace com::sun::star;
-+
- #include "viewfunc.hxx"
-
- #include "sc.hrc"
-@@ -2223,6 +2228,8 @@ BOOL ScViewFunc::DeleteTables(const SvShorts &TheTabs, BOOL bRecord )
- WaitObject aWait( GetFrameWin() );
- if (bRecord && !pDoc->IsUndoEnabled())
- bRecord = FALSE;
-+ if ( bVbaEnabled )
-+ bRecord = FALSE;
-
- while ( nNewTab > 0 && !pDoc->IsVisible( nNewTab ) )
- --nNewTab;
-@@ -2330,6 +2337,7 @@ BOOL ScViewFunc::DeleteTables(const SvShorts &TheTabs, BOOL bRecord )
- pDocSh->PostPaintExtras();
- pDocSh->SetDocumentModified();
-
-+
- SfxApplication* pSfxApp = SFX_APP(); // Navigator
- pSfxApp->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) );
- pSfxApp->Broadcast( SfxSimpleHint( SC_HINT_DBAREAS_CHANGED ) );
-@@ -2474,8 +2482,8 @@ void ScViewFunc::ImportTables( ScDocShell* pSrcShell,
- {
- SCTAB nSrcTab = pSrcTabs[i];
- SCTAB nDestTab1=nTab+i;
-- ULONG nErrVal = pDoc->TransferTab( pSrcDoc, nSrcTab, nDestTab1,
-- FALSE ); // no insert
-+ ULONG nErrVal = pDocSh->TransferTab( *pSrcShell, nSrcTab, nDestTab1,
-+ FALSE, FALSE ); // no insert
-
- switch (nErrVal)
- {
-@@ -2493,25 +2501,6 @@ void ScViewFunc::ImportTables( ScDocShell* pSrcShell,
- break;
- }
-
-- // TransferTab doesn't copy drawing objects with bInsertNew=FALSE
-- if ( !bError )
-- pDoc->TransferDrawPage( pSrcDoc, nSrcTab, nDestTab1 );
--
-- if(!bError &&pSrcDoc->IsScenario(nSrcTab))
-- {
-- String aComment;
-- Color aColor;
-- USHORT nFlags;
--
-- pSrcDoc->GetScenarioData(nSrcTab, aComment,aColor, nFlags);
-- pDoc->SetScenario( nDestTab1,TRUE);
-- pDoc->SetScenarioData( nTab+i,aComment,aColor,nFlags);
-- BOOL bActive = pSrcDoc->IsActiveScenario(nSrcTab );
-- pDoc->SetActiveScenario( nDestTab1, bActive );
-- BOOL bVisible=pSrcDoc->IsVisible(nSrcTab);
-- pDoc->SetVisible(nDestTab1,bVisible );
--
-- }
- }
-
- if (bLink)
-@@ -2695,33 +2684,7 @@ void ScViewFunc::MoveTable( USHORT nDestDocNo, SCTAB nDestTab, BOOL bCopy )
- nDestTab1 = nDestTab;
- for(USHORT i=0;i<TheTabs.Count();i++)
- {
-- nErrVal = pDestDoc->TransferTab( pDoc, TheTabs[i], nDestTab1,
-- FALSE ); // no insert
--
-- // TransferTab doesn't copy drawing objects with bInsertNew=FALSE
-- if ( nErrVal > 0 )
-- pDestDoc->TransferDrawPage( pDoc, TheTabs[i], nDestTab1 );
--
-- if(nErrVal>0 && pDoc->IsScenario(TheTabs[i]))
-- {
-- String aComment;
-- Color aColor;
-- USHORT nFlags;
--
-- pDoc->GetScenarioData(TheTabs[i], aComment,aColor, nFlags);
-- pDestDoc->SetScenario(nDestTab1,TRUE);
-- pDestDoc->SetScenarioData(nDestTab1,aComment,aColor,nFlags);
-- BOOL bActive = pDoc->IsActiveScenario(TheTabs[i]);
-- pDestDoc->SetActiveScenario(nDestTab1, bActive );
--
-- BOOL bVisible=pDoc->IsVisible(TheTabs[i]);
-- pDestDoc->SetVisible(nDestTab1,bVisible );
--
-- }
--
-- if ( nErrVal > 0 && pDoc->IsTabProtected( TheTabs[i] ) )
-- pDestDoc->SetTabProtection(nDestTab1, pDoc->GetTabProtection(TheTabs[i]));
--
-+ nErrVal = pDestShell->TransferTab( *pDocShell, static_cast<SCTAB>(TheTabs[i]), static_cast<SCTAB>(nDestTab1), FALSE, FALSE );
- nDestTab1++;
- }
- }
-diff --git sc/source/ui/view/viewfun3.cxx sc/source/ui/view/viewfun3.cxx
-index 8fc5acd..4c353f0 100644
---- sc/source/ui/view/viewfun3.cxx
-+++ sc/source/ui/view/viewfun3.cxx
-@@ -210,6 +210,7 @@
- #include "drwtrans.hxx"
- #include "docuno.hxx"
- #include "clipparam.hxx"
-+#include "undodat.hxx" // Amelia Wang
-
- using namespace com::sun::star;
-
-@@ -1784,6 +1785,85 @@ BOOL ScViewFunc::LinkBlock( const ScRange& rSource, const ScAddress& rDestPos, B
- return TRUE;
- }
-
-+void ScViewFunc::DataFormPutData( SCROW nCurrentRow ,
-+ SCROW nStartRow , SCCOL nStartCol ,
-+ SCROW nEndRow , SCCOL nEndCol ,
-+ Edit** pEdits ,
-+ sal_uInt16 aColLength )
-+{
-+ ScDocument* pDoc = GetViewData()->GetDocument();
-+ ScDocShell* pDocSh = GetViewData()->GetDocShell();
-+ ScMarkData& rMark = GetViewData()->GetMarkData();
-+ ScDocShellModificator aModificator( *pDocSh );
-+ SfxUndoManager* pUndoMgr = pDocSh->GetUndoManager();
-+ if ( pDoc )
-+ {
-+ const BOOL bRecord( pDoc->IsUndoEnabled());
-+ ScDocument* pUndoDoc = NULL;
-+ ScDocument* pRedoDoc = NULL;
-+ ScDocument* pRefUndoDoc = NULL;
-+ ScRefUndoData* pUndoData = NULL;
-+ SCTAB nTab = GetViewData()->GetTabNo();
-+ SCTAB nStartTab = nTab;
-+ SCTAB nEndTab = nTab;
-+
-+ {
-+ ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
-+ if ( pChangeTrack )
-+ pChangeTrack->ResetLastCut(); // kein CutMode mehr
-+ }
-+ ScRange aUserRange( nStartCol, nCurrentRow, nStartTab, nEndCol, nCurrentRow, nEndTab );
-+ BOOL bColInfo = ( nStartRow==0 && nEndRow==MAXROW );
-+ BOOL bRowInfo = ( nStartCol==0 && nEndCol==MAXCOL );
-+ SCCOL nUndoEndCol = nStartCol+aColLength-1;
-+ SCROW nUndoEndRow = nCurrentRow;
-+ USHORT nUndoFlags = IDF_NONE;
-+
-+ if ( bRecord )
-+ {
-+ pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
-+ pUndoDoc->InitUndoSelected( pDoc , rMark , bColInfo , bRowInfo );
-+ pDoc->CopyToDocument( aUserRange , 1 , FALSE , pUndoDoc );
-+ }
-+ USHORT nExtFlags = 0;
-+ pDocSh->UpdatePaintExt( nExtFlags, nStartCol, nStartRow, nStartTab , nEndCol, nEndRow, nEndTab ); // content before the change
-+ //rMark.SetMarkArea( aUserRange );
-+ pDoc->BeginDrawUndo();
-+
-+ for(sal_uInt16 i = 0; i < aColLength; i++)
-+ {
-+ if (pEdits[i])
-+ {
-+ String aFieldName=pEdits[i]->GetText();
-+ pDoc->SetString( nStartCol + i, nCurrentRow, nTab, aFieldName );
-+ }
-+ }
-+ //pDoc->ExtendMergeSel( nStartCol, nStartRow, nEndCol, nEndRow, rMark, TRUE ); // Refresh
-+ pDocSh->UpdatePaintExt( nExtFlags, nStartCol, nCurrentRow, nStartTab, nEndCol, nCurrentRow, nEndTab ); // content after the change
-+ SfxUndoAction* pUndo = new ScUndoDataForm( pDocSh,
-+ nStartCol, nCurrentRow, nStartTab,
-+ nUndoEndCol, nUndoEndRow, nEndTab, rMark,
-+ pUndoDoc, pRedoDoc, nUndoFlags,
-+ pUndoData, NULL, NULL, NULL,
-+ FALSE ); // FALSE = Redo data not yet copied
-+ pUndoMgr->AddUndoAction( new ScUndoWrapper( pUndo ), TRUE );
-+
-+ USHORT nPaint = PAINT_GRID;
-+ if (bColInfo)
-+ {
-+ nPaint |= PAINT_TOP;
-+ nUndoEndCol = MAXCOL; // nur zum Zeichnen !
-+ }
-+ if (bRowInfo)
-+ {
-+ nPaint |= PAINT_LEFT;
-+ nUndoEndRow = MAXROW; // nur zum Zeichnen !
-+ }
-
-+ pDocSh->PostPaint( nStartCol, nCurrentRow, nStartTab,
-+ nUndoEndCol, nUndoEndRow, nEndTab, nPaint, nExtFlags );
-+ pDocSh->UpdateOle(GetViewData());
-+ }
-+}
-
-
-diff --git sc/uiconfig/scalc/menubar/menubar.xml sc/uiconfig/scalc/menubar/menubar.xml
-index 959e538..3624c29 100644
---- sc/uiconfig/scalc/menubar/menubar.xml
-+++ sc/uiconfig/scalc/menubar/menubar.xml
-@@ -404,6 +404,7 @@
- <menu:menuitem menu:id=".uno:DataFilterHideAutoFilter"/>
- </menu:menupopup>
- </menu:menu>
-+ <menu:menuitem menu:id=".uno:DataForm"/>
- <menu:menuitem menu:id=".uno:DataSubTotals"/>
- <menu:menuitem menu:id=".uno:Validation"/>
- <menu:menuseparator/>
-diff --git sc/util/makefile.mk sc/util/makefile.mk
-index 980d271..8c0f1e0 100644
---- sc/util/makefile.mk
-+++ sc/util/makefile.mk
-@@ -273,6 +273,7 @@ LIB8OBJFILES = \
- $(SLO)$/filldlg.obj \
- $(SLO)$/delcodlg.obj \
- $(SLO)$/delcldlg.obj \
-+ $(SLO)$/datafdlg.obj \
- $(SLO)$/dapitype.obj \
- $(SLO)$/dapidata.obj \
- $(SLO)$/crdlg.obj \
-@@ -316,7 +317,8 @@ SHL9STDLIBS= \
- $(VCLLIB) \
- $(TKLIB) \
- $(MSFILTERLIB) \
-- $(FORLIB)
-+ $(FORLIB) \
-+ $(UNOTOOLSLIB)
-
- SHL9DEPN=$(SHL1TARGETN) $(SHL8TARGETN)
- SHL9LIBS=$(SLB)$/$(TARGET_VBA).lib
-diff --git scripting/source/basprov/basprov.cxx scripting/source/basprov/basprov.cxx
-index c616371..1fd2f21 100644
---- scripting/source/basprov/basprov.cxx
-+++ scripting/source/basprov/basprov.cxx
-@@ -371,7 +371,33 @@ namespace basprov
- ::rtl::OUString::createFromAscii( "location" ) );
-
- sal_Int32 nIndex = 0;
-- ::rtl::OUString aLibrary = aDescription.getToken( 0, (sal_Unicode)'.', nIndex );
-+ // In some strange circumstances the Library name can have an
-+ // apparantly illegal '.' in it ( in imported VBA )
-+
-+ BasicManager* pBasicMgr = NULL;
-+ if ( aLocation.equals( ::rtl::OUString::createFromAscii("document") ) )
-+ {
-+ pBasicMgr = m_pDocBasicManager;
-+ }
-+ else if ( aLocation.equals( ::rtl::OUString::createFromAscii("application") ) )
-+ {
-+ pBasicMgr = m_pAppBasicManager;
-+ }
-+ rtl::OUString sProjectName;
-+ if ( pBasicMgr )
-+ sProjectName = pBasicMgr->GetName();
-+
-+ ::rtl::OUString aLibrary;
-+ if ( sProjectName.getLength() && aDescription.match( sProjectName ) )
-+ {
-+ OSL_TRACE("LibraryName %s is part of the url %s",
-+ rtl::OUStringToOString( sProjectName, RTL_TEXTENCODING_UTF8 ).getStr(),
-+ rtl::OUStringToOString( aDescription, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ aLibrary = sProjectName;
-+ nIndex = sProjectName.getLength() + 1;
-+ }
-+ else
-+ aLibrary = aDescription.getToken( 0, (sal_Unicode)'.', nIndex );
- ::rtl::OUString aModule;
- if ( nIndex != -1 )
- aModule = aDescription.getToken( 0, (sal_Unicode)'.', nIndex );
-@@ -381,15 +407,6 @@ namespace basprov
-
- if ( aLibrary.getLength() != 0 && aModule.getLength() != 0 && aMethod.getLength() != 0 && aLocation.getLength() != 0 )
- {
-- BasicManager* pBasicMgr = NULL;
-- if ( aLocation.equals( ::rtl::OUString::createFromAscii("document") ) )
-- {
-- pBasicMgr = m_pDocBasicManager;
-- }
-- else if ( aLocation.equals( ::rtl::OUString::createFromAscii("application") ) )
-- {
-- pBasicMgr = m_pAppBasicManager;
-- }
-
- if ( pBasicMgr )
- {
-diff --git scripting/source/basprov/basscript.cxx scripting/source/basprov/basscript.cxx
-index 620e249..e99a346 100644
---- scripting/source/basprov/basscript.cxx
-+++ scripting/source/basprov/basscript.cxx
-@@ -36,7 +36,10 @@
- #include <basic/sbmeth.hxx>
- #include <basic/basmgr.hxx>
- #include <com/sun/star/script/provider/ScriptFrameworkErrorType.hpp>
--
-+#include "bcholder.hxx"
-+#include <comphelper/proparrhlp.hxx>
-+#include <comphelper/propertycontainer.hxx>
-+#include <com/sun/star/beans/PropertyAttribute.hpp>
- #include <map>
-
-
-@@ -45,6 +48,7 @@ using namespace ::com::sun::star::lang;
- using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::script;
- using namespace ::com::sun::star::document;
-+using namespace ::com::sun::star::beans;
-
- extern ::com::sun::star::uno::Any sbxToUnoValue( SbxVariable* pVar );
- extern void unoToSbxValue( SbxVariable* pVar, const ::com::sun::star::uno::Any& aValue );
-@@ -54,6 +58,10 @@ extern void unoToSbxValue( SbxVariable* pVar, const ::com::sun::star::uno::Any&
- namespace basprov
- {
- //.........................................................................
-+#define BASSCRIPT_PROPERTY_ID_CALLER 1
-+#define BASSCRIPT_PROPERTY_CALLER ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Caller" ) )
-+
-+#define BASSCRIPT_DEFAULT_ATTRIBS() PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT
-
- typedef ::std::map< sal_Int16, Any, ::std::less< sal_Int16 > > OutParamMap;
-
-@@ -64,22 +72,28 @@ namespace basprov
- // -----------------------------------------------------------------------------
-
- BasicScriptImpl::BasicScriptImpl( const ::rtl::OUString& funcName, SbMethodRef xMethod )
-- :m_xMethod( xMethod )
-+ : ::scripting_helper::OBroadcastHelperHolder( m_aMutex )
-+ ,OPropertyContainer( GetBroadcastHelper() )
-+ ,m_xMethod( xMethod )
- ,m_funcName( funcName )
- ,m_documentBasicManager( NULL )
- ,m_xDocumentScriptContext()
- {
-+ registerProperty( BASSCRIPT_PROPERTY_CALLER, BASSCRIPT_PROPERTY_ID_CALLER, BASSCRIPT_DEFAULT_ATTRIBS(), &m_caller, ::getCppuType( &m_caller ) );
- }
-
- // -----------------------------------------------------------------------------
-
- BasicScriptImpl::BasicScriptImpl( const ::rtl::OUString& funcName, SbMethodRef xMethod,
-- BasicManager& documentBasicManager, const Reference< XScriptInvocationContext >& documentScriptContext )
-- :m_xMethod( xMethod )
-+ BasicManager& documentBasicManager, const Reference< XScriptInvocationContext >& documentScriptContext ) : ::scripting_helper::OBroadcastHelperHolder( m_aMutex )
-+ ,OPropertyContainer( GetBroadcastHelper() )
-+ ,m_xMethod( xMethod )
- ,m_funcName( funcName )
- ,m_documentBasicManager( &documentBasicManager )
- ,m_xDocumentScriptContext( documentScriptContext )
- {
-+ //
-+ registerProperty( BASSCRIPT_PROPERTY_CALLER, BASSCRIPT_PROPERTY_ID_CALLER, BASSCRIPT_DEFAULT_ATTRIBS(), &m_caller, ::getCppuType( &m_caller ) );
- }
-
- // -----------------------------------------------------------------------------
-@@ -88,6 +102,48 @@ namespace basprov
- }
-
- // -----------------------------------------------------------------------------
-+ // XInterface
-+ // -----------------------------------------------------------------------------
-+
-+ IMPLEMENT_FORWARD_XINTERFACE2( BasicScriptImpl, BasicScriptImpl_BASE, OPropertyContainer )
-+
-+ // -----------------------------------------------------------------------------
-+ // XTypeProvider
-+ // -----------------------------------------------------------------------------
-+
-+ IMPLEMENT_FORWARD_XTYPEPROVIDER2( BasicScriptImpl, BasicScriptImpl_BASE, OPropertyContainer )
-+
-+ // -----------------------------------------------------------------------------
-+ // OPropertySetHelper
-+ // -----------------------------------------------------------------------------
-+
-+ ::cppu::IPropertyArrayHelper& BasicScriptImpl::getInfoHelper( )
-+ {
-+ return *getArrayHelper();
-+ }
-+
-+ // -----------------------------------------------------------------------------
-+ // OPropertyArrayUsageHelper
-+ // -----------------------------------------------------------------------------
-+
-+ ::cppu::IPropertyArrayHelper* BasicScriptImpl::createArrayHelper( ) const
-+ {
-+ Sequence< Property > aProps;
-+ describeProperties( aProps );
-+ return new ::cppu::OPropertyArrayHelper( aProps );
-+ }
-+
-+ // -----------------------------------------------------------------------------
-+ // XPropertySet
-+ // -----------------------------------------------------------------------------
-+
-+ Reference< XPropertySetInfo > BasicScriptImpl::getPropertySetInfo( ) throw (RuntimeException)
-+ {
-+ Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
-+ return xInfo;
-+ }
-+
-+ // -----------------------------------------------------------------------------
- // XScript
- // -----------------------------------------------------------------------------
-
-@@ -166,8 +222,14 @@ namespace basprov
- if ( m_documentBasicManager && m_xDocumentScriptContext.is() )
- aOldThisComponent = m_documentBasicManager->SetGlobalUNOConstant( "ThisComponent", makeAny( m_xDocumentScriptContext ) );
-
-+ if ( m_caller.getLength() && m_caller[ 0 ].hasValue() )
-+ {
-+ SbxVariableRef xCallerVar = new SbxVariable( SbxVARIANT );
-+ unoToSbxValue( static_cast< SbxVariable* >( xCallerVar ), m_caller[ 0 ] );
-+ nErr = m_xMethod->Call( xReturn, xCallerVar );
-+ }
-+ else
- nErr = m_xMethod->Call( xReturn );
--
- if ( m_documentBasicManager && m_xDocumentScriptContext.is() )
- m_documentBasicManager->SetGlobalUNOConstant( "ThisComponent", aOldThisComponent );
- }
-diff --git scripting/source/basprov/basscript.hxx scripting/source/basprov/basscript.hxx
-index a524c18..12ac0a0 100644
---- scripting/source/basprov/basscript.hxx
-+++ scripting/source/basprov/basscript.hxx
-@@ -28,12 +28,14 @@
- #ifndef SCRIPTING_BASSCRIPT_HXX
- #define SCRIPTING_BASSCRIPT_HXX
-
-+#include "bcholder.hxx"
- #include <com/sun/star/script/provider/XScript.hpp>
- #include <com/sun/star/document/XScriptInvocationContext.hpp>
- #include <cppuhelper/implbase1.hxx>
-+#include <comphelper/proparrhlp.hxx>
-+#include <comphelper/propertycontainer.hxx>
- #include <basic/sbmeth.hxx>
-
--
- class BasicManager;
-
- //.........................................................................
-@@ -49,7 +51,11 @@ namespace basprov
- ::com::sun::star::script::provider::XScript > BasicScriptImpl_BASE;
-
-
-- class BasicScriptImpl : public BasicScriptImpl_BASE
-+ class BasicScriptImpl : public BasicScriptImpl_BASE,
-+ public ::scripting_helper::OMutexHolder,
-+ public ::scripting_helper::OBroadcastHelperHolder,
-+ public ::comphelper::OPropertyContainer,
-+ public ::comphelper::OPropertyArrayUsageHelper< BasicScriptImpl >
- {
- private:
- SbMethodRef m_xMethod;
-@@ -57,6 +63,16 @@ namespace basprov
- BasicManager* m_documentBasicManager;
- ::com::sun::star::uno::Reference< ::com::sun::star::document::XScriptInvocationContext >
- m_xDocumentScriptContext;
-+ // hack, OPropertyContainer doesn't allow you to define a property of unknown
-+ // type ( I guess because an Any can't contain an Any... I've always wondered why?
-+ // as its not unusual to do that in corba )
-+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > m_caller;
-+ protected:
-+ // OPropertySetHelper
-+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper( );
-+
-+ // OPropertyArrayUsageHelper
-+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
-
- public:
- BasicScriptImpl(
-@@ -71,6 +87,12 @@ namespace basprov
- );
- virtual ~BasicScriptImpl();
-
-+ // XInterface
-+ DECLARE_XINTERFACE()
-+
-+ // XTypeProvider
-+ DECLARE_XTYPEPROVIDER()
-+
- // XScript
- virtual ::com::sun::star::uno::Any SAL_CALL invoke(
- const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aParams,
-@@ -80,6 +102,9 @@ namespace basprov
- ::com::sun::star::script::provider::ScriptFrameworkErrorException,
- ::com::sun::star::reflection::InvocationTargetException,
- ::com::sun::star::uno::RuntimeException );
-+ // XPropertySet
-+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( )
-+ throw (::com::sun::star::uno::RuntimeException);
- };
-
- //.........................................................................
-diff --git scripting/source/dlgprov/dlgevtatt.cxx scripting/source/dlgprov/dlgevtatt.cxx
-index 11a1014..2d8c853 100644
---- scripting/source/dlgprov/dlgevtatt.cxx
-+++ scripting/source/dlgprov/dlgevtatt.cxx
-@@ -108,13 +108,14 @@ namespace dlgprov
- {
- protected:
- rtl::OUString msDialogCodeName;
-+ rtl::OUString msDialogLibName;
- Reference< script::XScriptListener > mxListener;
- virtual void firing_impl( const script::ScriptEvent& aScriptEvent, uno::Any* pRet );
- public:
-- DialogVBAScriptListenerImpl( const Reference< XComponentContext >& rxContext, const Reference< awt::XControl >& rxControl, const Reference< frame::XModel >& xModel );
-+ DialogVBAScriptListenerImpl( const Reference< XComponentContext >& rxContext, const Reference< awt::XControl >& rxControl, const Reference< frame::XModel >& xModel, const rtl::OUString& sDialogLibName );
- };
-
-- DialogVBAScriptListenerImpl::DialogVBAScriptListenerImpl( const Reference< XComponentContext >& rxContext, const Reference< awt::XControl >& rxControl, const Reference< frame::XModel >& xModel ) : DialogScriptListenerImpl( rxContext )
-+ DialogVBAScriptListenerImpl::DialogVBAScriptListenerImpl( const Reference< XComponentContext >& rxContext, const Reference< awt::XControl >& rxControl, const Reference< frame::XModel >& xModel, const rtl::OUString& sDialogLibName ) : DialogScriptListenerImpl( rxContext ), msDialogLibName( sDialogLibName )
- {
- Reference< XMultiComponentFactory > xSMgr( m_xContext->getServiceManager() );
- Sequence< Any > args(1);
-@@ -145,7 +146,7 @@ namespace dlgprov
- if ( aScriptEvent.ScriptType.equals( rtl::OUString::createFromAscii("VBAInterop") ) && mxListener.is() )
- {
- ScriptEvent aScriptEventCopy( aScriptEvent );
-- aScriptEventCopy.ScriptCode = msDialogCodeName;
-+ aScriptEventCopy.ScriptCode = msDialogLibName.concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "." ) ) ).concat( msDialogCodeName );
- try
- {
- mxListener->firing( aScriptEventCopy );
-@@ -163,7 +164,7 @@ namespace dlgprov
- // DialogEventsAttacherImpl
- // =============================================================================
-
-- DialogEventsAttacherImpl::DialogEventsAttacherImpl( const Reference< XComponentContext >& rxContext, const Reference< frame::XModel >& rxModel, const Reference< awt::XControl >& rxControl, const Reference< XInterface >& rxHandler, const Reference< beans::XIntrospectionAccess >& rxIntrospect, bool bProviderMode, const Reference< script::XScriptListener >& rxRTLListener )
-+ DialogEventsAttacherImpl::DialogEventsAttacherImpl( const Reference< XComponentContext >& rxContext, const Reference< frame::XModel >& rxModel, const Reference< awt::XControl >& rxControl, const Reference< XInterface >& rxHandler, const Reference< beans::XIntrospectionAccess >& rxIntrospect, bool bProviderMode, const Reference< script::XScriptListener >& rxRTLListener, const rtl::OUString& sDialogLibName )
- :mbUseFakeVBAEvents( false ), m_xContext( rxContext )
- {
- // key listeners by protocol when ScriptType = 'Script'
-@@ -186,11 +187,11 @@ namespace dlgprov
- {
- pFoundShell = reinterpret_cast<SfxObjectShell*>( xObjShellTunnel->getSomething(SfxObjectShell::getUnoTunnelId()));
- if ( pFoundShell )
-- mbUseFakeVBAEvents = ooo::vba::isAlienExcelDoc( *pFoundShell );
-+ mbUseFakeVBAEvents = ooo::vba::isAlienExcelDoc( *pFoundShell ) || ooo::vba::isAlienWordDoc( *pFoundShell ) ;
- }
- }
- if ( mbUseFakeVBAEvents )
-- listernersForTypes[ rtl::OUString::createFromAscii("VBAInterop") ] = new DialogVBAScriptListenerImpl( rxContext, rxControl, rxModel );
-+ listernersForTypes[ rtl::OUString::createFromAscii("VBAInterop") ] = new DialogVBAScriptListenerImpl( rxContext, rxControl, rxModel, sDialogLibName );
- }
-
- // -----------------------------------------------------------------------------
-@@ -217,6 +218,7 @@ namespace dlgprov
- Reference< ooo::vba::XVBAToOOEventDescGen > xVBAToOOEvtDesc( xSMgr->createInstanceWithContext( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAToOOEventDesc" ) ), m_xContext ), UNO_QUERY );
- if ( xVBAToOOEvtDesc.is() )
- xEventsSupplier.set( xVBAToOOEvtDesc->getEventSupplier( xControl, sControlName ), UNO_QUERY );
-+
- }
- return xEventsSupplier;
- }
-@@ -409,7 +411,7 @@ namespace dlgprov
-
- void DialogAllListenerImpl::firing( const AllEventObject& Event ) throw ( RuntimeException )
- {
-- ::osl::MutexGuard aGuard( getMutex() );
-+ //::osl::MutexGuard aGuard( getMutex() );
-
- firing_impl( Event, NULL );
- }
-@@ -419,7 +421,7 @@ namespace dlgprov
- Any DialogAllListenerImpl::approveFiring( const AllEventObject& Event )
- throw ( reflection::InvocationTargetException, RuntimeException )
- {
-- ::osl::MutexGuard aGuard( getMutex() );
-+ //::osl::MutexGuard aGuard( getMutex() );
-
- Any aReturn;
- firing_impl( Event, &aReturn );
-@@ -655,7 +657,7 @@ namespace dlgprov
-
- void DialogScriptListenerImpl::firing( const ScriptEvent& aScriptEvent ) throw ( RuntimeException )
- {
-- ::osl::MutexGuard aGuard( getMutex() );
-+ //::osl::MutexGuard aGuard( getMutex() );
-
- firing_impl( aScriptEvent, NULL );
- }
-@@ -665,7 +667,7 @@ namespace dlgprov
- Any DialogScriptListenerImpl::approveFiring( const ScriptEvent& aScriptEvent )
- throw ( reflection::InvocationTargetException, RuntimeException )
- {
-- ::osl::MutexGuard aGuard( getMutex() );
-+ //::osl::MutexGuard aGuard( getMutex() );
-
- Any aReturn;
- firing_impl( aScriptEvent, &aReturn );
-diff --git scripting/source/dlgprov/dlgevtatt.hxx scripting/source/dlgprov/dlgevtatt.hxx
-index c76ee09..0df79b2 100644
---- scripting/source/dlgprov/dlgevtatt.hxx
-+++ scripting/source/dlgprov/dlgevtatt.hxx
-@@ -78,7 +78,7 @@ namespace dlgprov
- const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xHandler,
- const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XIntrospectionAccess >& xIntrospect,
- bool bProviderMode,
-- const ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptListener >& xRTLListener );
-+ const ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptListener >& xRTLListener ,const rtl::OUString& sDialogLibName );
- virtual ~DialogEventsAttacherImpl();
-
- // XScriptEventsAttacher
-diff --git scripting/source/dlgprov/dlgprov.cxx scripting/source/dlgprov/dlgprov.cxx
-index e9e1299..49b0b5f 100644
---- scripting/source/dlgprov/dlgprov.cxx
-+++ scripting/source/dlgprov/dlgprov.cxx
-@@ -189,7 +189,15 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
- Reference< beans::XPropertySet > xDlgPropSet( xDialogModel, UNO_QUERY );
- xDlgPropSet->setPropertyValue( aDlgSrcUrlPropName, aDialogSourceURL );
-
-- ::xmlscript::importDialogModel( xInput, xDialogModel, m_xContext );
-+ // #TODO we really need to detect the source of the Dialog, is it
-+ // located in the document or not. m_xModel need not be the location of
-+ // the dialog. E.g. if the dialog was created from basic ( then we just
-+ // can't tell where its from )
-+ // If we are happy to always substitute the form model for the awt
-+ // one then maybe the presence of a document model is enough to trigger
-+ // swapping out the models ( or perhaps we only want to do this
-+ // for vba mode ) there are a number of feasible and valid possibilities
-+ ::xmlscript::importDialogModel( xInput, xDialogModel, m_xContext, m_xModel );
- // Set resource property
- if( xStringResourceManager.is() )
- {
-@@ -403,6 +411,7 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
-
- if ( xISP.is() )
- xInput = xISP->createInputStream();
-+ msDialogLibName = sLibName;
- }
-
- // import dialog model
-@@ -520,7 +529,7 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
- const Reference< XControl >& rxControl,
- const Reference< XInterface >& rxHandler,
- const Reference< XIntrospectionAccess >& rxIntrospectionAccess,
-- bool bDialogProviderMode )
-+ bool bDialogProviderMode, const rtl::OUString& sDialogLibName )
- {
- if ( rxControl.is() )
- {
-@@ -544,7 +553,7 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
-
- Reference< XScriptEventsAttacher > xScriptEventsAttacher = new DialogEventsAttacherImpl
- ( m_xContext, m_xModel, rxControl, rxHandler, rxIntrospectionAccess,
-- bDialogProviderMode, ( m_BasicInfo.get() ? m_BasicInfo->mxBasicRTLListener : NULL ) );
-+ bDialogProviderMode, ( m_BasicInfo.get() ? m_BasicInfo->mxBasicRTLListener : NULL ), msDialogLibName );
-
- Any aHelper;
- xScriptEventsAttacher->attachEvents( aObjects, Reference< XScriptListener >(), aHelper );
-@@ -649,7 +658,10 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
- aArguments[0] >>= m_xModel;
- m_BasicInfo.reset( new BasicRTLParams() );
- m_BasicInfo->mxInput.set( aArguments[ 1 ], UNO_QUERY_THROW );
-- m_BasicInfo->mxDlgLib.set( aArguments[ 2 ], UNO_QUERY_THROW );
-+ // allow null mxDlgLib, a document dialog instantiated from
-+ // from application basic is unable to provide ( or find ) it's
-+ // Library
-+ aArguments[ 2 ] >>= m_BasicInfo->mxDlgLib;
- // leave the possibility to optionally allow the old dialog creation
- // to use the new XScriptListener ( which converts the old style macro
- // to a SF url )
-@@ -733,7 +745,7 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
- {
- //xDialog = Reference< XDialog >( xCtrl, UNO_QUERY );
- Reference< XIntrospectionAccess > xIntrospectionAccess = inspectHandler( xHandler );
-- attachControlEvents( xCtrl, xHandler, xIntrospectionAccess, bDialogProviderMode );
-+ attachControlEvents( xCtrl, xHandler, xIntrospectionAccess, bDialogProviderMode, msDialogLibName );
- }
- }
-
-diff --git scripting/source/dlgprov/dlgprov.hxx scripting/source/dlgprov/dlgprov.hxx
-index 82faef2..e2aba36 100644
---- scripting/source/dlgprov/dlgprov.hxx
-+++ scripting/source/dlgprov/dlgprov.hxx
-@@ -81,9 +81,9 @@ namespace dlgprov
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xModel;
-
--
-+ rtl::OUString msDialogLibName;
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > createDialogModel( const ::rtl::OUString& sURL );
--
-+
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > createDialogControl(
- const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxDialogModel,
- const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& xParent );
-@@ -91,7 +91,7 @@ namespace dlgprov
- void attachControlEvents( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& rxControlContainer,
- const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxHandler,
- const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XIntrospectionAccess >& rxIntrospectionAccess,
-- bool bDialogProviderMode );
-+ bool bDialogProviderMode, const rtl::OUString& );
- ::com::sun::star::uno::Reference< ::com::sun::star::beans::XIntrospectionAccess > inspectHandler(
- const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxHandler );
- // helper methods
-diff --git scripting/source/vbaevents/eventhelper.cxx scripting/source/vbaevents/eventhelper.cxx
-index 6975fba..703357d 100644
---- scripting/source/vbaevents/eventhelper.cxx
-+++ scripting/source/vbaevents/eventhelper.cxx
-@@ -46,12 +46,17 @@
- #include <com/sun/star/lang/XServiceInfo.hpp>
- #include <com/sun/star/lang/XInitialization.hpp>
-
-+#include <com/sun/star/util/XCloseListener.hpp>
-+#include <com/sun/star/util/XCloseBroadcaster.hpp>
-+
- #include <com/sun/star/frame/XModel.hpp>
-
- #include <com/sun/star/script/XLibraryContainer.hpp>
- #include <com/sun/star/script/ScriptEventDescriptor.hpp>
- #include <com/sun/star/script/provider/XScriptProviderSupplier.hpp>
-
-+#include <com/sun/star/container/XNamed.hpp>
-+
- #include <com/sun/star/drawing/XControlShape.hpp>
-
- #include <com/sun/star/awt/XControl.hpp>
-@@ -62,8 +67,9 @@
- #include <com/sun/star/awt/XTextComponent.hpp> //liuchen 2009-6-5
- #include <com/sun/star/awt/XComboBox.hpp> //liuchen 2009-6-18
- #include <com/sun/star/awt/XRadioButton.hpp> //liuchen 2009-7-30
-+#include <com/sun/star/awt/XListBox.hpp>
-
--#include <msforms/ReturnInteger.hpp>
-+#include "vbamsformreturntypes.hxx"
-
- #include <sfx2/objsh.hxx>
- #include <basic/sbstar.hxx>
-@@ -71,6 +77,7 @@
- #include <basic/sbmeth.hxx>
- #include <basic/sbmod.hxx>
- #include <basic/sbx.hxx>
-+#include <filter/msfilter/msvbahelper.hxx>
-
-
-
-@@ -82,12 +89,21 @@
- #include <com/sun/star/lang/XMultiComponentFactory.hpp>
- #include <com/sun/star/script/XScriptListener.hpp>
- #include <cppuhelper/implbase1.hxx>
-+#include <cppuhelper/implbase3.hxx>
- #include <cppuhelper/implbase2.hxx>
- #include <comphelper/evtmethodhelper.hxx>
-
- #include <set>
- #include <list>
- #include <hash_map>
-+#define ASYNC 0
-+
-+// primitive support for asynchronous handling of
-+// events from controls ( all event will be processed asynchronously
-+// in the application thread )
-+#if ASYNC
-+#include <vcl/svapp.hxx>
-+#endif
-
- using namespace ::com::sun::star;
- using namespace ::com::sun::star::script;
-@@ -189,6 +205,14 @@ bool isMouseEventOk( awt::MouseEvent& evt, const Sequence< Any >& params )
- return true;
- }
-
-+bool isFocusEventOk( awt::FocusEvent& evt, const Sequence< Any >& params )
-+{
-+ if ( !( params.getLength() > 0 ) ||
-+ !( params[ 0 ] >>= evt ) )
-+ return false;
-+ return true;
-+}
-+
- Sequence< Any > ooMouseEvtToVBADblClick( const Sequence< Any >& params )
- {
- Sequence< Any > translatedParams;
-@@ -232,9 +256,14 @@ Sequence< Any > ooKeyPressedToVBAKeyPressed( const Sequence< Any >& params )
-
- translatedParams.realloc(1);
-
-- msforms::ReturnInteger keyCode;
-- keyCode.Value = evt.KeyCode;
-- translatedParams[0] <<= keyCode;
-+ //The VBA events such as ComboBox_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) may cause an error because
-+ //the original input parameter data structure -- msforms::ReturnInteger -- is a struct, it cannot support default value.
-+ //So the newly defined VbaReturnIntege class is used here to support default value.
-+ VbaReturnInteger* pKeyCode = new VbaReturnInteger();
-+ pKeyCode->Value = evt.KeyChar;
-+ ::uno::Reference< msforms::XReturnInteger > xInteger =
-+ static_cast< ::uno::Reference< msforms::XReturnInteger > > (pKeyCode);
-+ translatedParams[0] <<= xInteger;
- return translatedParams;
- }
-
-@@ -248,16 +277,38 @@ Sequence< Any > ooKeyPressedToVBAKeyUpDown( const Sequence< Any >& params )
-
- translatedParams.realloc(2);
-
-- msforms::ReturnInteger keyCode;
-- sal_Int8 shift = sal::static_int_cast<sal_Int8>( evt.Modifiers );
--
-- // #TODO check whether values from OOO conform to values generated from vba
-- keyCode.Value = evt.KeyCode;
-- translatedParams[0] <<= keyCode;
-+ //The VBA events such as ComboBox_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) may cause an error because
-+ //the original input parameter data structure -- msforms::ReturnInteger -- is a struct, it cannot support default value.
-+ //So the newly defined VbaReturnIntege class is used here to support default value.
-+ VbaReturnInteger* pKeyCode = new VbaReturnInteger();
-+ sal_Int8 shift = evt.Modifiers;
-+
-+ pKeyCode->Value = evt.KeyChar;
-+ ::uno::Reference< msforms::XReturnInteger > xInteger = static_cast< ::uno::Reference< msforms::XReturnInteger > > (pKeyCode);
-+ translatedParams[0] <<= xInteger;
- translatedParams[1] <<= shift;
- return translatedParams;
- }
-
-+Sequence< Any > ooFocusLostToVBAExit( const Sequence< Any >& params )
-+{
-+ Sequence< Any > translatedParams;
-+ awt::FocusEvent evt;
-+
-+ if ( !isFocusEventOk( evt, params ) )
-+ return Sequence< Any >();
-+
-+ translatedParams.realloc(1);
-+
-+ VbaReturnBoolean* pCancel = new VbaReturnBoolean();
-+
-+ ::uno::Reference< msforms::XReturnBoolean > xBoolean=
-+ static_cast< ::uno::Reference< msforms::XReturnBoolean > > (pCancel);
-+ translatedParams[0] <<= xBoolean;
-+ return translatedParams;
-+}
-+
-+
- typedef Sequence< Any > (*Translator)(const Sequence< Any >&);
-
- //liuchen 2009-6-23
-@@ -287,6 +338,7 @@ bool ApproveAll(const ScriptEvent& evt, void* pPara); //allow all types of contr
- bool ApproveType(const ScriptEvent& evt, void* pPara); //certain types of controls should execute the event, those types are given by pPara
- bool DenyType(const ScriptEvent& evt, void* pPara); //certain types of controls should not execute the event, those types are given by pPara
- bool DenyMouseDrag(const ScriptEvent& evt, void* pPara); //used for VBA MouseMove event when "Shift" key is pressed
-+bool DenyKeys(const ScriptEvent& evt, void* pPara); //For some keys, press them will cause Symphony keyPressed event, but will not cause any events in Excel, so deny these key events
-
- struct TypeList
- {
-@@ -294,28 +346,30 @@ struct TypeList
- int nListLength;
- };
-
--Type typeXFixedText = GET_TYPE(awt::XFixedText)
--Type typeXTextComponent = GET_TYPE(awt::XTextComponent)
--Type typeXComboBox = GET_TYPE(awt::XComboBox)
--Type typeXRadioButton = GET_TYPE(awt::XRadioButton)
-+Type typeXFixedText = GET_TYPE(awt::XFixedText);
-+Type typeXTextComponent = GET_TYPE(awt::XTextComponent);
-+Type typeXComboBox = GET_TYPE(awt::XComboBox);
-+Type typeXRadioButton = GET_TYPE(awt::XRadioButton);
-+Type typeXListBox = GET_TYPE(awt::XListBox);
-
-
- TypeList fixedTextList = {&typeXFixedText, 1};
- TypeList textCompList = {&typeXTextComponent, 1};
- TypeList radioButtonList = {&typeXRadioButton, 1};
- TypeList comboBoxList = {&typeXComboBox, 1};
-+TypeList listBoxList = {&typeXListBox, 1};
-
- //this array stores the OO event to VBA event translation info
- static TranslatePropMap aTranslatePropMap_Impl[] =
- {
-+ { MAP_CHAR_LEN("actionPerformed"), { MAP_CHAR_LEN("_Change"), NULL, DenyType, (void*)(&radioButtonList) } }, //liuchen 2009-7-30, OptionalButton_Change event is not the same as OptionalButton_Click event
- // actionPerformed ooo event
- { MAP_CHAR_LEN("actionPerformed"), { MAP_CHAR_LEN("_Click"), NULL, ApproveAll, NULL } },
-- { MAP_CHAR_LEN("actionPerformed"), { MAP_CHAR_LEN("_Change"), NULL, DenyType, (void*)(&radioButtonList) } }, //liuchen 2009-7-30, OptionalButton_Change event is not the same as OptionalButton_Click event
--
-+ { MAP_CHAR_LEN("itemStateChanged"), { MAP_CHAR_LEN("_Change"), NULL, ApproveType, (void*)(&radioButtonList) } }, //liuchen 2009-7-30, OptionalButton_Change event should be triggered when the button state is changed
- // itemStateChanged ooo event
- { MAP_CHAR_LEN("itemStateChanged"), { MAP_CHAR_LEN("_Click"), NULL, ApproveType, (void*)(&comboBoxList) } }, //liuchen, add to support VBA ComboBox_Click event
-- { MAP_CHAR_LEN("itemStateChanged"), { MAP_CHAR_LEN("_Change"), NULL, ApproveType, (void*)(&radioButtonList) } }, //liuchen 2009-7-30, OptionalButton_Change event should be triggered when the button state is changed
-
-+ { MAP_CHAR_LEN("itemStateChanged"), { MAP_CHAR_LEN("_Click"), NULL, ApproveType, (void*)(&listBoxList) } },
- // changed ooo event
- { MAP_CHAR_LEN("changed"), { MAP_CHAR_LEN("_Change"), NULL, ApproveAll, NULL } },
-
-@@ -324,7 +378,7 @@ static TranslatePropMap aTranslatePropMap_Impl[] =
-
- // focusLost ooo event
- { MAP_CHAR_LEN("focusLost"), { MAP_CHAR_LEN("_LostFocus"), NULL, ApproveAll, NULL } },
-- { MAP_CHAR_LEN("focusLost"), { MAP_CHAR_LEN("_Exit"), NULL, ApproveType, (void*)(&textCompList) } }, //liuchen, add to support VBA TextBox_Exit event
-+ { MAP_CHAR_LEN("focusLost"), { MAP_CHAR_LEN("_Exit"), ooFocusLostToVBAExit, ApproveType, (void*)(&textCompList) } }, //liuchen, add to support VBA TextBox_Exit event
-
- // adjustmentValueChanged ooo event
- { MAP_CHAR_LEN("adjustmentValueChanged"), { MAP_CHAR_LEN("_Scroll"), NULL, ApproveAll, NULL } },
-@@ -349,8 +403,8 @@ static TranslatePropMap aTranslatePropMap_Impl[] =
- { MAP_CHAR_LEN("mouseDragged"), { MAP_CHAR_LEN("_MouseMove"), ooMouseEvtToVBAMouseEvt, DenyMouseDrag, NULL } }, //liuchen, add to support VBA MouseMove event when the "Shift" key is pressed
-
- // keyPressed ooo event
-- { MAP_CHAR_LEN("keyPressed"), { MAP_CHAR_LEN("_KeyDown"), ooKeyPressedToVBAKeyPressed, ApproveAll, NULL } },
-- { MAP_CHAR_LEN("keyPressed"), { MAP_CHAR_LEN("_KeyPress"), ooKeyPressedToVBAKeyPressed, ApproveAll, NULL } }
-+ { MAP_CHAR_LEN("keyPressed"), { MAP_CHAR_LEN("_KeyDown"), ooKeyPressedToVBAKeyUpDown, ApproveAll, NULL } },
-+ { MAP_CHAR_LEN("keyPressed"), { MAP_CHAR_LEN("_KeyPress"), ooKeyPressedToVBAKeyUpDown, DenyKeys, NULL } }
- };
-
- EventInfoHash& getEventTransInfo()
-@@ -632,7 +686,7 @@ private:
- Reference< container::XNameContainer > m_xNameContainer;
- };
-
--typedef ::cppu::WeakImplHelper2< XScriptListener, lang::XInitialization > EventListener_BASE;
-+typedef ::cppu::WeakImplHelper3< XScriptListener, util::XCloseListener, lang::XInitialization > EventListener_BASE;
-
- #define EVENTLSTNR_PROPERTY_ID_MODEL 1
- #define EVENTLSTNR_PROPERTY_MODEL ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Model" ) )
-@@ -653,6 +707,9 @@ public:
- // XScriptListener
- virtual void SAL_CALL firing(const ScriptEvent& evt) throw(RuntimeException);
- virtual Any SAL_CALL approveFiring(const ScriptEvent& evt) throw(reflection::InvocationTargetException, RuntimeException);
-+ // XCloseListener
-+ virtual void SAL_CALL queryClosing( const lang::EventObject& Source, ::sal_Bool GetsOwnership ) throw (util::CloseVetoException, uno::RuntimeException);
-+ virtual void SAL_CALL notifyClosing( const lang::EventObject& Source ) throw (uno::RuntimeException);
- // XPropertySet
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException);
- // XInitialization
-@@ -664,6 +721,25 @@ public:
- DECLARE_XTYPEPROVIDER()
- virtual void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
- {
-+ if ( nHandle == EVENTLSTNR_PROPERTY_ID_MODEL )
-+ {
-+ uno::Reference< frame::XModel > xModel( rValue, uno::UNO_QUERY );
-+ if( xModel != m_xModel)
-+ {
-+ // Remove the listener from the old XCloseBroadcaster.
-+ uno::Reference< util::XCloseBroadcaster > xCloseBroadcaster( m_xModel, uno::UNO_QUERY );
-+ if (xCloseBroadcaster.is())
-+ {
-+ xCloseBroadcaster->removeCloseListener( this );
-+ }
-+ // Add the listener into the new XCloseBroadcaster.
-+ xCloseBroadcaster = uno::Reference< util::XCloseBroadcaster >( xModel, uno::UNO_QUERY );
-+ if (xCloseBroadcaster.is())
-+ {
-+ xCloseBroadcaster->addCloseListener( this );
-+ }
-+ }
-+ }
- OPropertyContainer::setFastPropertyValue( nHandle, rValue );
- if ( nHandle == EVENTLSTNR_PROPERTY_ID_MODEL )
- setShellFromModel();
-@@ -677,17 +753,21 @@ protected:
- virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
-
- private:
-+#if ASYNC
-+ DECL_LINK( OnAsyncScriptEvent, ScriptEvent* );
-+#endif
- void setShellFromModel();
- void firing_Impl( const ScriptEvent& evt, Any *pSyncRet=NULL ) throw( RuntimeException );
-
- Reference< XComponentContext > m_xContext;
- Reference< frame::XModel > m_xModel;
- SfxObjectShell* mpShell;
-+ sal_Bool m_bDocClosed;
-
- };
-
- EventListener::EventListener( const Reference< XComponentContext >& rxContext ) :
--OPropertyContainer(GetBroadcastHelper()), m_xContext( rxContext ), mpShell( 0 )
-+OPropertyContainer(GetBroadcastHelper()), m_xContext( rxContext ), m_bDocClosed(sal_False), mpShell( 0 )
- {
- registerProperty( EVENTLSTNR_PROPERTY_MODEL, EVENTLSTNR_PROPERTY_ID_MODEL,
- beans::PropertyAttribute::TRANSIENT, &m_xModel, ::getCppuType( &m_xModel ) );
-@@ -722,9 +802,39 @@ EventListener::disposing(const lang::EventObject&) throw( RuntimeException )
- void SAL_CALL
- EventListener::firing(const ScriptEvent& evt) throw(RuntimeException)
- {
-+#if ASYNC
-+ // needs some logic to check if the event handler is oneway or not
-+ // if not oneway then firing_Impl otherwise... as below
-+ acquire();
-+ Application::PostUserEvent( LINK( this, EventListener, OnAsyncScriptEvent ), new ScriptEvent( evt ) );
-+#else
- firing_Impl( evt );
-+#endif
- }
-
-+#if ASYNC
-+IMPL_LINK( EventListener, OnAsyncScriptEvent, ScriptEvent*, _pEvent )
-+{
-+ if ( !_pEvent )
-+ return 1L;
-+
-+ {
-+ // #FIXME if we enable ASYNC we probably need something like
-+ // below
-+ //::osl::ClearableMutexGuard aGuard( m_aMutex );
-+
-+ //if ( !impl_isDisposed_nothrow() )
-+ // impl_doFireScriptEvent_nothrow( aGuard, *_pEvent, NULL );
-+ firing_Impl( *_pEvent, NULL );
-+ }
-+
-+ delete _pEvent;
-+ // we acquired ourself immediately before posting the event
-+ release();
-+ return 0L;
-+ }
-+#endif
-+
- Any SAL_CALL
- EventListener::approveFiring(const ScriptEvent& evt) throw(reflection::InvocationTargetException, RuntimeException)
- {
-@@ -733,6 +843,24 @@ EventListener::approveFiring(const ScriptEvent& evt) throw(reflection::Invocatio
- return ret;
- }
-
-+// XCloseListener
-+void SAL_CALL
-+EventListener::queryClosing( const lang::EventObject& Source, ::sal_Bool GetsOwnership ) throw (util::CloseVetoException, uno::RuntimeException)
-+{
-+ //Nothing to do
-+}
-+
-+void SAL_CALL
-+EventListener::notifyClosing( const lang::EventObject& Source ) throw (uno::RuntimeException)
-+{
-+ m_bDocClosed = sal_True;
-+ uno::Reference< util::XCloseBroadcaster > xCloseBroadcaster( m_xModel, uno::UNO_QUERY );
-+ if (xCloseBroadcaster.is())
-+ {
-+ xCloseBroadcaster->removeCloseListener( this );
-+ }
-+}
-+
- // XInitialization
- void SAL_CALL
- EventListener::initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException)
-@@ -835,13 +963,28 @@ bool DenyMouseDrag(const ScriptEvent& evt, void* )
- }
- }
-
-+//For some keys, press them will cause Symphony keyPressed event, but will not cause any events in Excel, so deny these key events
-+bool DenyKeys(const ScriptEvent& evt, void* /*pPara*/)
-+{
-+ awt::KeyEvent aEvent;
-+ evt.Arguments[ 0 ] >>= aEvent;
-+ if (aEvent.KeyChar == 0 || aEvent.KeyChar == 8)
-+ {
-+ return false;
-+ }
-+ else
-+ {
-+ return true;
-+ }
-+}
-+
-
-
- //liuchen 2009-6-23
- // EventListener
-
- void
--EventListener::firing_Impl(const ScriptEvent& evt, Any* /*pRet*/ ) throw(RuntimeException)
-+EventListener::firing_Impl(const ScriptEvent& evt, Any* pRet ) throw(RuntimeException)
- {
- OSL_TRACE("EventListener::firing_Impl( FAKE VBA_EVENTS )");
- static const ::rtl::OUString vbaInterOp =
-@@ -852,18 +995,46 @@ EventListener::firing_Impl(const ScriptEvent& evt, Any* /*pRet*/ ) throw(Runtime
- return;
- lang::EventObject aEvent;
- evt.Arguments[ 0 ] >>= aEvent;
-+ OSL_TRACE("evt.MethodName is %s", rtl::OUStringToOString( evt.MethodName, RTL_TEXTENCODING_UTF8 ).getStr() );
- OSL_TRACE("Argument[0] is %s", rtl::OUStringToOString( comphelper::anyToString( evt.Arguments[0] ), RTL_TEXTENCODING_UTF8 ).getStr() );
- OSL_TRACE("Getting Control");
-- uno::Reference< awt::XControl > xControl( aEvent.Source, uno::UNO_QUERY_THROW );
-- OSL_TRACE("Getting properties");
-- uno::Reference< beans::XPropertySet > xProps( xControl->getModel(), uno::UNO_QUERY_THROW );
--
- rtl::OUString sName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UserForm") );
- OSL_TRACE("Getting Name");
-
- uno::Reference< awt::XDialog > xDlg( aEvent.Source, uno::UNO_QUERY );
- if ( !xDlg.is() )
-- xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ) ) >>= sName;
-+ {
-+ OSL_TRACE("Getting Control");
-+ // evt.Source is
-+ // a) Dialog
-+ // b) xShapeControl ( from api (sheet control) )
-+ // c) eventmanager ( I guess )
-+ // d) vba control ( from api also )
-+ uno::Reference< drawing::XControlShape > xCntrlShape( evt.Source, uno::UNO_QUERY );
-+ uno::Reference< awt::XControl > xControl( aEvent.Source, uno::UNO_QUERY );
-+ if ( xCntrlShape.is() )
-+ {
-+ // for sheet controls ( that fire from the api ) we don't
-+ // have the real control ( thats only available from the view )
-+ // api code creates just a control instance that is transferred
-+ // via aEvent.Arguments[ 0 ] that control though has no
-+ // info like name etc.
-+ uno::Reference< drawing::XControlShape > xCntrlShape( evt.Source, UNO_QUERY_THROW );
-+ OSL_TRACE("Got control shape");
-+ uno::Reference< container::XNamed > xName( xCntrlShape->getControl(), uno::UNO_QUERY_THROW );
-+ OSL_TRACE("Got xnamed ");
-+ sName = xName->getName();
-+ }
-+ else
-+ {
-+ // Userform control ( fired from the api or from event manager )
-+ uno::Reference< beans::XPropertySet > xProps;
-+ OSL_TRACE("Getting properties");
-+ xProps.set( xControl->getModel(), uno::UNO_QUERY_THROW );
-+ xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ) ) >>= sName;
-+ }
-+
-+ }
- //dumpEvent( evt );
- EventInfoHash& infos = getEventTransInfo();
- EventInfoHash::const_iterator eventInfo_it = infos.find( evt.MethodName );
-@@ -885,20 +1056,49 @@ EventListener::firing_Impl(const ScriptEvent& evt, Any* /*pRet*/ ) throw(Runtime
- std::list< TranslateInfo >::const_iterator txInfo =
- eventInfo_it->second.begin();
- std::list< TranslateInfo >::const_iterator txInfo_end = eventInfo_it->second.end();
-- rtl::OUString sMacroLoc = rtl::OUString::createFromAscii("Standard.").concat( evt.ScriptCode ).concat( rtl::OUString::createFromAscii(".") );
-
- StarBASIC* pBasic = mpShell->GetBasic();
-- SbModule* pModule = pBasic->FindModule( evt.ScriptCode );
-- for ( ; pModule && txInfo != txInfo_end; ++txInfo )
-+ BasicManager* pBasicManager = mpShell->GetBasicManager();
-+ rtl::OUString sProject;
-+ rtl::OUString sScriptCode( evt.ScriptCode );
-+ // dialogs pass their own library, presence of Dot determines that
-+ if ( sScriptCode.indexOf( '.' ) == -1 )
-+ {
-+ //'Project' is a better default but I want to force failures
-+ //rtl::OUString sMacroLoc = rtl::OUString::createFromAscii("Project");
-+ sProject = rtl::OUString::createFromAscii("Standard");
-+
-+ if ( pBasicManager->GetName().Len() > 0 )
-+ sProject = pBasicManager->GetName();
-+ }
-+ else
-+ {
-+ sal_Int32 nIndex = sScriptCode.indexOf( '.' );
-+ sProject = sScriptCode.copy( 0, nIndex );
-+ sScriptCode = sScriptCode.copy( nIndex + 1 );
-+ }
-+ rtl::OUString sMacroLoc = sProject;
-+ sMacroLoc = sMacroLoc.concat( rtl::OUString::createFromAscii(".") );
-+ sMacroLoc = sMacroLoc.concat( sScriptCode ).concat( rtl::OUString::createFromAscii(".") );
-+
-+ OSL_TRACE("sMacroLoc is %s", rtl::OUStringToOString( sMacroLoc, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ for ( ; txInfo != txInfo_end; ++txInfo )
- {
-+ // If the document is closed, we should not execute macro.
-+ if (m_bDocClosed)
-+ {
-+ break;
-+ }
-+
-+ rtl::OUString sTemp = sName.concat( (*txInfo).sVBAName );
- // see if we have a match for the handlerextension
- // where ScriptCode is methodname_handlerextension
-- rtl::OUString sTemp = sName.concat( (*txInfo).sVBAName );
-+ rtl::OUString sToResolve = sMacroLoc.concat( sTemp );
-
- OSL_TRACE("*** trying to invoke %s ",
-- rtl::OUStringToOString( sTemp, RTL_TEXTENCODING_UTF8 ).getStr() );
-- SbMethod* pMeth = static_cast< SbMethod* >( pModule->Find( sTemp, SbxCLASS_METHOD ) );
-- if ( pMeth )
-+ rtl::OUStringToOString( sToResolve, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ ooo::vba::VBAMacroResolvedInfo aMacroResolvedInfo = ooo::vba::resolveVBAMacro( mpShell, sToResolve );
-+ if ( aMacroResolvedInfo.IsResolved() )
- {
- //liuchen 2009-6-8
- if (! txInfo->ApproveRule(evt, txInfo->pPara) )
-@@ -916,24 +1116,21 @@ EventListener::firing_Impl(const ScriptEvent& evt, Any* /*pRet*/ ) throw(Runtime
- {
- // call basic event handlers for event
-
-- static rtl::OUString part1 = rtl::OUString::createFromAscii( "vnd.sun.star.script:");
-- static rtl::OUString part2 = rtl::OUString::createFromAscii("?language=Basic&location=document");
--
- // create script url
-- rtl::OUString url = part1 + sMacroLoc + sTemp + part2;
-+ rtl::OUString url = aMacroResolvedInfo.ResolvedMacro();
-
-- OSL_TRACE("script url = %s",
-+ OSL_TRACE("resolved script = %s",
- rtl::OUStringToOString( url,
- RTL_TEXTENCODING_UTF8 ).getStr() );
-- Sequence< sal_Int16 > aOutArgsIndex;
-- Sequence< Any > aOutArgs;
- try
- {
-- if ( mpShell )
-+ uno::Any aDummyCaller = uno::makeAny( rtl::OUString::createFromAscii("Error") );
-+ if ( pRet )
-+ ooo::vba::executeMacro( mpShell, url, aArguments, *pRet, aDummyCaller );
-+ else
- {
- uno::Any aRet;
-- mpShell->CallXScript( url,
-- aArguments, aRet, aOutArgsIndex, aOutArgs, false );
-+ ooo::vba::executeMacro( mpShell, url, aArguments, aRet, aDummyCaller );
- }
- }
- catch ( uno::Exception& e )
-diff --git scripting/source/vbaevents/makefile.mk scripting/source/vbaevents/makefile.mk
-index 1946c61..a367898 100644
---- scripting/source/vbaevents/makefile.mk
-+++ scripting/source/vbaevents/makefile.mk
-@@ -69,6 +69,7 @@ SHL1STDLIBS= \
- $(BASICLIB) \
- $(COMPHELPERLIB) \
- $(SFXLIB) \
-+ $(MSFILTERLIB) \
- $(CPPULIB) \
- $(TOOLSLIB) \
- $(SALLIB)
-diff --git scripting/source/vbaevents/vbaevents.map scripting/source/vbaevents/vbaevents.map
-new file mode 100644
-index 0000000..832e82c
---- /dev/null
-+++ scripting/source/vbaevents/vbaevents.map
-@@ -0,0 +1,9 @@
-+OOO_1.1 {
-+ global:
-+ component_getImplementationEnvironment;
-+ component_getFactory;
-+ component_writeInfo;
-+
-+ local:
-+ *;
-+};
-diff --git scripting/source/vbaevents/vbamsformreturntypes.hxx scripting/source/vbaevents/vbamsformreturntypes.hxx
-new file mode 100644
-index 0000000..e632eeb
---- /dev/null
-+++ scripting/source/vbaevents/vbamsformreturntypes.hxx
-@@ -0,0 +1,73 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009, 2010.
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef VBA_MSFORM_RETURNTYPES_HXX
-+#define VBA_MSFORM_RETURNTYPES_HXX
-+
-+#include <cppuhelper/implbase1.hxx>
-+#include <msforms/XReturnBoolean.hpp>
-+#include <msforms/XReturnInteger.hpp>
-+
-+
-+typedef ::cppu::WeakImplHelper1<msforms::XReturnBoolean> ReturnBoolean_BASE;
-+
-+class SAL_DLLPUBLIC_EXPORT VbaReturnBoolean : public ReturnBoolean_BASE
-+{
-+public:
-+ sal_Bool Value;
-+
-+public:
-+ VbaReturnBoolean() : Value(false) {} ;
-+
-+ // XReturnBoolean
-+ virtual ::sal_Bool SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException) { return Value; }
-+ virtual void SAL_CALL setValue( ::sal_Bool _value ) throw (::com::sun::star::uno::RuntimeException) { Value = _value; }
-+
-+ // XDefaultProperty
-+ ::rtl::OUString SAL_CALL getDefaultPropertyName() throw (com::sun::star::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
-+};
-+
-+
-+typedef ::cppu::WeakImplHelper1<msforms::XReturnInteger> ReturnInteger_BASE;
-+
-+class SAL_DLLPUBLIC_EXPORT VbaReturnInteger : public ReturnInteger_BASE
-+{
-+public:
-+ sal_Int32 Value;
-+
-+public:
-+ VbaReturnInteger() : Value(0) {} ;
-+
-+ // XReturnInteger
-+ virtual ::sal_Int32 SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException) { return Value; }
-+ virtual void SAL_CALL setValue( ::sal_Int32 _value ) throw (::com::sun::star::uno::RuntimeException) { Value = _value; }
-+
-+ // XDefaultProperty
-+ ::rtl::OUString SAL_CALL getDefaultPropertyName() throw (com::sun::star::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
-+};
-+#endif
-diff --git sfx2/inc/sfx2/objsh.hxx sfx2/inc/sfx2/objsh.hxx
-index 8e4dde2..9fd0a60 100644
---- sfx2/inc/sfx2/objsh.hxx
-+++ sfx2/inc/sfx2/objsh.hxx
-@@ -404,8 +405,8 @@ public:
- ::com::sun::star::uno::Any& aRet,
- ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam,
-- bool bRaiseError = true
-- );
-+ bool bRaiseError = true,
-+ const ::com::sun::star::uno::Any* aCaller = 0 );
-
- static ErrCode CallXScript(
- const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxScriptContext,
-@@ -414,7 +415,8 @@ public:
- ::com::sun::star::uno::Any& aRet,
- ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam,
-- bool bRaiseError = true
-+ bool bRaiseError = true,
-+ const ::com::sun::star::uno::Any* aCaller = 0
- );
-
- /** adjusts the internal macro mode, according to the current security settings
-diff --git sfx2/inc/sfx2/sfx.hrc sfx2/inc/sfx2/sfx.hrc
-index 87cc2b6..8c58159 100755
---- sfx2/inc/sfx2/sfx.hrc
-+++ sfx2/inc/sfx2/sfx.hrc
-@@ -399,8 +399,10 @@
- #define MID_DOCINFO_ENCRYPTED 0x2c
- #define MID_DOCINFO_STATISTIC 0x33
- #define MID_DOCINFO_CHARLOCALE 0x34
--
--#define MID_LAST_USED_PROPID MID_DOCINFO_CHARLOCALE
-+#define MID_CATEGORY 0x35
-+#define MID_COMPANY 0x36
-+#define MID_MANAGER 0x37
-+#define MID_LAST_USED_PROPID MID_MANAGER
-
- // Config-Ids -----------------------------------------------------------
-
-diff --git sfx2/inc/sfx2/sfxbasemodel.hxx sfx2/inc/sfx2/sfxbasemodel.hxx
-index 52fe2c1..8fe1468 100644
---- sfx2/inc/sfx2/sfxbasemodel.hxx
-+++ sfx2/inc/sfx2/sfxbasemodel.hxx
-@@ -1505,6 +1505,7 @@ protected:
- /* returns true if the document signatures are valid, otherwise false */
- sal_Bool hasValidSignatures() const;
-
-+ void setDocumentProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentProperties >& );
- //________________________________________________________________________________________________________
- // private methods
- //________________________________________________________________________________________________________
-diff --git sfx2/inc/sfx2/sfxsids.hrc sfx2/inc/sfx2/sfxsids.hrc
-index cbd45cf..bf1cebb 100644
---- sfx2/inc/sfx2/sfxsids.hrc
-+++ sfx2/inc/sfx2/sfxsids.hrc
-@@ -75,6 +75,7 @@
-
- #define SID_VERSION_VISIBLE (SID_SFX_START + 313)
- #define SID_PASTE_UNFORMATTED (SID_SFX_START + 314)
-+#define SID_DIALOG_RETURN (SID_SFX_START + 318)
- #define SID_PRINTER_NOTFOUND_WARN (SID_SFX_START + 320)
- #define SID_PRINTER_USETHREAD (SID_SFX_START + 321)
- #define SID_PRINTER_NAME (SID_SFX_START + 322)
-diff --git sfx2/source/appl/app.cxx sfx2/source/appl/app.cxx
-index ca8062b..5c8c768 100644
---- sfx2/source/appl/app.cxx
-+++ sfx2/source/appl/app.cxx
-@@ -749,7 +749,7 @@ IMPL_LINK( SfxApplication, GlobalBasicErrorHdl_Impl, StarBASIC*, pStarBasic )
- basicide_handle_basic_error pSymbol = (basicide_handle_basic_error) osl_getFunctionSymbol( handleMod, aSymbol.pData );
-
- // call basicide_handle_basic_error in basctl
-- long nRet = pSymbol( pStarBasic );
-+ long nRet = pSymbol ? pSymbol( pStarBasic ) : 0;
-
- return nRet;
- }
-diff --git sfx2/source/appl/appuno.cxx sfx2/source/appl/appuno.cxx
-index 2a7bb3f..091ffb8 100755
---- sfx2/source/appl/appuno.cxx
-+++ sfx2/source/appl/appuno.cxx
-@@ -2281,6 +2281,16 @@ SFX2_DLLPUBLIC sal_Bool SAL_CALL component_writeInfo(
- xNewKey = xKey->createKey( aTempStr );
- xNewKey->createKey( ::rtl::OUString::createFromAscii("com.sun.star.document.DocumentProperties") );
-
-+
-+ // writer compatable document properties
-+ aImpl = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/"));
-+ aImpl += comp_CompatWriterDocProps::_getImplementationName();
-+
-+ aTempStr = aImpl;
-+ aTempStr += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES"));
-+ xNewKey = xKey->createKey( aTempStr );
-+ xNewKey->createKey( ::rtl::OUString::createFromAscii("com.sun.star.writer.DocumentProperties") );
-+
- return sal_True;
- }
-
-@@ -2340,6 +2350,16 @@ SFX2_DLLPUBLIC void* SAL_CALL component_getFactory(
- ::comp_SfxDocumentMetaData::_getImplementationName(),
- ::comp_SfxDocumentMetaData::_getSupportedServiceNames());
- }
-+ if ( ::comp_CompatWriterDocProps::_getImplementationName().equals(
-+ ::rtl::OUString::createFromAscii( pImplementationName ) ) )
-+ {
-+ xFactory = ::cppu::createSingleComponentFactory(
-+ ::comp_CompatWriterDocProps::_create,
-+ ::comp_CompatWriterDocProps::_getImplementationName(),
-+ ::comp_CompatWriterDocProps::_getSupportedServiceNames());
-+ }
-+
-+ // Factory is valid - service was found.
-
- // Factory is valid - service was found.
- if ( xFactory.is() )
-diff --git sfx2/source/control/unoctitm.cxx sfx2/source/control/unoctitm.cxx
-index 14b3fe0..0a51e21 100644
---- sfx2/source/control/unoctitm.cxx
-+++ sfx2/source/control/unoctitm.cxx
-@@ -702,6 +702,7 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util
- // Filter arguments which shouldn't be part of the sequence property value
- sal_Bool bTemp = sal_Bool();
- sal_uInt16 nModifier(0);
-+ sal_Bool bVBARequest = sal_False;
- std::vector< ::com::sun::star::beans::PropertyValue > aAddArgs;
- for( sal_Int32 n=0; n<nCount; n++ )
- {
-@@ -718,6 +719,10 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util
- }
- else if( rProp.Name.equalsAsciiL("KeyModifier",11))
- rProp.Value >>= nModifier;
-+ else if( rProp.Name.equalsAsciiL("VBADialogResultRequest",22) )
-+ {
-+ rProp.Value >>= bVBARequest;
-+ }
- else
- aAddArgs.push_back( aArgs[n] );
- }
-@@ -801,6 +806,14 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util
- pItem = aReq.GetReturnValue();
- bSuccess = aReq.IsDone() || pItem != NULL;
- bFailure = aReq.IsCancelled();
-+ if ( bVBARequest )
-+ {
-+ SFX_REQUEST_ARG( aReq, pItem, SfxBoolItem, SID_DIALOG_RETURN, FALSE );
-+ if ( pItem )
-+ {
-+ bSuccess = pItem->GetValue();
-+ }
-+ }
- }
- }
- #ifdef DBG_UTIL
-diff --git sfx2/source/doc/SfxDocumentMetaData.cxx sfx2/source/doc/SfxDocumentMetaData.cxx
-index 95fe000..9975858 100644
---- sfx2/source/doc/SfxDocumentMetaData.cxx
-+++ sfx2/source/doc/SfxDocumentMetaData.cxx
-@@ -87,6 +87,10 @@
- #include <cstring>
- #include <limits>
-
-+
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/document/XCompatWriterDocProperties.hpp>
-+
- /**
- * This file contains the implementation of the service
- * com.sun.star.document.DocumentProperties.
-@@ -292,12 +296,12 @@ public:
- const css::uno::Sequence< css::beans::StringPair >& i_rNamespaces)
- throw (css::uno::RuntimeException, css::xml::sax::SAXException);
-
--private:
-+protected:
- SfxDocumentMetaData(SfxDocumentMetaData &); // not defined
- SfxDocumentMetaData& operator =(SfxDocumentMetaData &); // not defined
-
- virtual ~SfxDocumentMetaData() {}
--
-+ virtual SfxDocumentMetaData* createMe( css::uno::Reference< css::uno::XComponentContext > const & context ) { return new SfxDocumentMetaData( context ); };
- const css::uno::Reference< css::uno::XComponentContext > m_xContext;
-
- /// for notification
-@@ -372,6 +376,54 @@ private:
- void createUserDefined();
- };
-
-+typedef ::cppu::ImplInheritanceHelper1< SfxDocumentMetaData, css::document::XCompatWriterDocProperties > CompatWriterDocPropsImpl_BASE;
-+
-+class CompatWriterDocPropsImpl : public CompatWriterDocPropsImpl_BASE
-+{
-+ rtl::OUString msManager;
-+ rtl::OUString msCategory;
-+ rtl::OUString msCompany;
-+protected:
-+ virtual SfxDocumentMetaData* createMe( css::uno::Reference< css::uno::XComponentContext > const & context ) { return new CompatWriterDocPropsImpl( context ); };
-+public:
-+ CompatWriterDocPropsImpl( css::uno::Reference< css::uno::XComponentContext > const & context) : CompatWriterDocPropsImpl_BASE( context ) {}
-+// XCompatWriterDocPropsImpl
-+ virtual ::rtl::OUString SAL_CALL getManager() throw (::com::sun::star::uno::RuntimeException) { return msManager; }
-+ virtual void SAL_CALL setManager( const ::rtl::OUString& _manager ) throw (::com::sun::star::uno::RuntimeException) { msManager = _manager; }
-+ virtual ::rtl::OUString SAL_CALL getCategory() throw (::com::sun::star::uno::RuntimeException){ return msCategory; }
-+ virtual void SAL_CALL setCategory( const ::rtl::OUString& _category ) throw (::com::sun::star::uno::RuntimeException){ msCategory = _category; }
-+ virtual ::rtl::OUString SAL_CALL getCompany() throw (::com::sun::star::uno::RuntimeException){ return msCompany; }
-+ virtual void SAL_CALL setCompany( const ::rtl::OUString& _company ) throw (::com::sun::star::uno::RuntimeException){ msCompany = _company; }
-+
-+// XServiceInfo
-+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException)
-+ {
-+ return comp_CompatWriterDocProps::_getImplementationName();
-+ }
-+
-+ virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException)
-+ {
-+ css::uno::Sequence< rtl::OUString > sServiceNames= getSupportedServiceNames();
-+ sal_Int32 nLen = sServiceNames.getLength();
-+ rtl::OUString* pIt = sServiceNames.getArray();
-+ rtl::OUString* pEnd = ( pIt + nLen );
-+ sal_Bool bRes = sal_False;
-+ for ( ; pIt != pEnd; ++pIt )
-+ {
-+ if ( pIt->equals( ServiceName ) )
-+ {
-+ bRes = sal_True;
-+ break;
-+ }
-+ }
-+ return bRes;
-+ }
-+
-+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException)
-+ {
-+ return comp_CompatWriterDocProps::_getSupportedServiceNames();
-+ }
-+};
- ////////////////////////////////////////////////////////////////////////////
-
- bool operator== (const css::util::DateTime &i_rLeft,
-@@ -2156,7 +2208,7 @@ SfxDocumentMetaData::createClone()
- ::osl::MutexGuard g(m_aMutex);
- checkInit();
-
-- SfxDocumentMetaData *pNew = new SfxDocumentMetaData(m_xContext);
-+ SfxDocumentMetaData *pNew = createMe(m_xContext);
-
- // NB: do not copy the modification listeners, only DOM
- css::uno::Reference<css::xml::dom::XDocument> xDoc = createDOM();
-@@ -2334,6 +2386,32 @@ void SfxDocumentMetaData::createUserDefined()
-
-
- // component helper namespace
-+namespace comp_CompatWriterDocProps {
-+
-+ ::rtl::OUString SAL_CALL _getImplementationName() {
-+ return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
-+ "CompatWriterDocPropsImpl"));
-+}
-+
-+ css::uno::Sequence< ::rtl::OUString > SAL_CALL _getSupportedServiceNames()
-+ {
-+ static css::uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.writer.DocumentProperties" ) );
-+ }
-+ return aServiceNames;
-+ }
-+ css::uno::Reference< css::uno::XInterface > SAL_CALL _create(
-+ const css::uno::Reference< css::uno::XComponentContext > & context)
-+ SAL_THROW((css::uno::Exception))
-+ {
-+ return static_cast< ::cppu::OWeakObject * >
-+ (new CompatWriterDocPropsImpl(context));
-+ }
-+
-+}
- namespace comp_SfxDocumentMetaData {
-
- ::rtl::OUString SAL_CALL _getImplementationName() {
-diff --git sfx2/source/doc/docinf.cxx sfx2/source/doc/docinf.cxx
-index 15f2317..94e92ee 100644
---- sfx2/source/doc/docinf.cxx
-+++ sfx2/source/doc/docinf.cxx
-@@ -34,6 +34,7 @@
- #include <com/sun/star/beans/XPropertySet.hpp>
- #include <com/sun/star/beans/XPropertyContainer.hpp>
- #include <com/sun/star/document/XDocumentProperties.hpp>
-+#include <com/sun/star/document/XCompatWriterDocProperties.hpp>
- #include <com/sun/star/uno/Exception.hpp>
-
- #include <rtl/ustring.hxx>
-@@ -43,7 +44,6 @@
- #include <vcl/gdimtf.hxx>
-
- #include "oleprops.hxx"
--
- // ============================================================================
-
- // stream names
-@@ -172,6 +172,28 @@ sal_uInt32 SFX2_DLLPUBLIC LoadOlePropertySet(
- }
- }
-
-+ uno::Reference< document::XCompatWriterDocProperties > xWriterProps( i_xDocProps, uno::UNO_QUERY );
-+ if ( xWriterProps.is() )
-+ {
-+ SfxOleSectionRef xBuiltin = aDocSet.GetSection( SECTION_BUILTIN );
-+ if ( xBuiltin.get() )
-+ {
-+ try
-+ {
-+ String aStrValue;
-+ if ( xBuiltin->GetStringValue( aStrValue, PROPID_MANAGER ) )
-+ xWriterProps->setManager( aStrValue );
-+ if ( xBuiltin->GetStringValue( aStrValue, PROPID_CATEGORY ) )
-+ xWriterProps->setCategory( aStrValue );
-+ if ( xBuiltin->GetStringValue( aStrValue, PROPID_COMPANY ) )
-+ xWriterProps->setCompany( aStrValue );
-+ }
-+ catch ( uno::Exception& )
-+ {
-+ }
-+ }
-+ }
-+
- // return code
- return (nGlobError != ERRCODE_NONE) ? nGlobError : nDocError;
- }
-diff --git sfx2/source/doc/docmacromode.cxx sfx2/source/doc/docmacromode.cxx
-index 613d90c..a8695d3 100644
---- sfx2/source/doc/docmacromode.cxx
-+++ sfx2/source/doc/docmacromode.cxx
-@@ -38,6 +38,8 @@
- #include <com/sun/star/task/DocumentMacroConfirmationRequest.hpp>
- #include <com/sun/star/task/InteractionClassification.hpp>
- #include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
-+#include <com/sun/star/script/XLibraryQueryExecutable.hpp>
-+#include <com/sun/star/script/vba/XVBACompatibility.hpp>
- /** === end UNO includes === **/
-
- #include <comphelper/componentcontext.hxx>
-@@ -73,8 +75,11 @@ namespace sfx2
- using ::com::sun::star::document::XEmbeddedScripts;
- using ::com::sun::star::uno::UNO_SET_THROW;
- using ::com::sun::star::script::XLibraryContainer;
-+ using ::com::sun::star::script::XLibraryQueryExecutable;
-+ using ::com::sun::star::script::vba::XVBACompatibility;
- using ::com::sun::star::container::XNameAccess;
- using ::com::sun::star::uno::UNO_QUERY_THROW;
-+ using ::com::sun::star::uno::UNO_QUERY;
- /** === end UNO using === **/
- namespace MacroExecMode = ::com::sun::star::document::MacroExecMode;
-
-@@ -336,6 +341,8 @@ namespace sfx2
- if ( xScripts.is() )
- xContainer.set( xScripts->getBasicLibraries(), UNO_QUERY_THROW );
-
-+ Reference< XVBACompatibility > xDocVBAMode( xContainer, UNO_QUERY );
-+ sal_Bool bIsVBAMode = ( xDocVBAMode.is() && xDocVBAMode->getVBACompatibilityMode() );
- if ( xContainer.is() )
- {
- // a library container exists; check if it's empty
-@@ -350,23 +357,46 @@ namespace sfx2
- Sequence< ::rtl::OUString > aElements = xContainer->getElementNames();
- if ( aElements.getLength() )
- {
-- if ( aElements.getLength() > 1 || !aElements[0].equals( aStdLibName ) )
-+ // old check, if more than 1 library or the first library isn't the expected 'Standard'
-+ // trigger the security 'nag' dialog
-+ if ( !bIsVBAMode && ( aElements.getLength() > 1 || !aElements[0].equals( aStdLibName ) ) )
- bHasMacroLib = sal_True;
-- else
-+ else
- {
-- // usually a "Standard" library is always present (design)
-- // for this reason we must check if it's empty
-- //
-- // Note: Since #i73229#, this is not true anymore. There's no default
-- // "Standard" lib anymore. Wouldn't it be time to get completely
-- // rid of the "Standard" thingie - this shouldn't be necessary
-- // anymore, should it?
-- // 2007-01-25 / frank.schoenheit@sun.com
-- Reference < XNameAccess > xLib;
-- Any aAny = xContainer->getByName( aStdLibName );
-- aAny >>= xLib;
-+ // other wise just check all libraries for executeable code
-+ Reference< XLibraryQueryExecutable > xLib( xContainer, UNO_QUERY );
- if ( xLib.is() )
-- bHasMacroLib = xLib->hasElements();
-+ {
-+ Sequence< ::rtl::OUString > aElements = xContainer->getElementNames();
-+ sal_Int32 nElementCount = aElements.getLength();
-+ const ::rtl::OUString* pElementName = aElements.getConstArray();
-+ for ( sal_Int32 index = 0; index < nElementCount; index++ )
-+ {
-+ bHasMacroLib = xLib->HasExecutableCode( pElementName[index] );
-+ if ( bHasMacroLib )
-+ break;
-+ }
-+ }
-+ }
-+ }
-+ }
-+ }
-+ if ( bIsVBAMode && !bHasMacroLib && xScripts.is() )
-+ {
-+ Reference< XLibraryContainer > xDlgContainer( xScripts->getDialogLibraries(), UNO_QUERY );
-+ if ( xDlgContainer.is() && xDlgContainer->hasElements() )
-+ {
-+ Sequence< ::rtl::OUString > aElements = xDlgContainer->getElementNames();
-+ sal_Int32 nElementCount = aElements.getLength();
-+ const ::rtl::OUString* pElementName = aElements.getConstArray();
-+ for ( sal_Int32 index = 0; index < nElementCount; index++ )
-+ {
-+ Reference< XNameAccess > xNameAccess;
-+ xDlgContainer->getByName( pElementName[index] ) >>= xNameAccess;
-+ if ( xNameAccess.is() && xNameAccess->hasElements() )
-+ {
-+ bHasMacroLib = sal_True;
-+ break;
- }
- }
- }
-diff --git sfx2/source/doc/objmisc.cxx sfx2/source/doc/objmisc.cxx
-index 5b91b31..a82e565 100755
---- sfx2/source/doc/objmisc.cxx
-+++ sfx2/source/doc/objmisc.cxx
-@@ -1710,7 +1710,7 @@ namespace
- }
-
- ErrCode SfxObjectShell::CallXScript( const Reference< XInterface >& _rxScriptContext, const ::rtl::OUString& _rScriptURL,
-- const Sequence< Any >& aParams, Any& aRet, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam, bool bRaiseError )
-+ const Sequence< Any >& aParams, Any& aRet, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam, bool bRaiseError, const ::com::sun::star::uno::Any* pCaller )
- {
- OSL_TRACE( "in CallXScript" );
- ErrCode nErr = ERRCODE_NONE;
-@@ -1741,7 +1741,16 @@ ErrCode SfxObjectShell::CallXScript( const Reference< XInterface >& _rxScriptCon
-
- // obtain the script, and execute it
- Reference< provider::XScript > xScript( xScriptProvider->getScript( _rScriptURL ), UNO_QUERY_THROW );
--
-+ if ( pCaller && pCaller->hasValue() )
-+ {
-+ Reference< beans::XPropertySet > xProps( xScript, uno::UNO_QUERY );
-+ if ( xProps.is() )
-+ {
-+ Sequence< uno::Any > aArgs( 1 );
-+ aArgs[ 0 ] = *pCaller;
-+ xProps->setPropertyValue( rtl::OUString::createFromAscii("Caller"), uno::makeAny( aArgs ) );
-+ }
-+ }
- aRet = xScript->invoke( aParams, aOutParamIndex, aOutParam );
- }
- catch ( const uno::Exception& )
-@@ -1774,10 +1783,10 @@ ErrCode SfxObjectShell::CallXScript( const String& rScriptURL,
- aParams,
- ::com::sun::star::uno::Any& aRet,
- ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
-- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam
-- , bool bRaiseError )
-+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >&
-+ aOutParam, bool bRaiseError, const ::com::sun::star::uno::Any* pCaller )
- {
-- return CallXScript( GetModel(), rScriptURL, aParams, aRet, aOutParamIndex, aOutParam, bRaiseError );
-+ return CallXScript( GetModel(), rScriptURL, aParams, aRet, aOutParamIndex, aOutParam, bRaiseError, pCaller );
- }
-
- //-------------------------------------------------------------------------
-diff --git sfx2/source/doc/objuno.cxx sfx2/source/doc/objuno.cxx
-index ac45ef5..ef49f5d 100644
---- sfx2/source/doc/objuno.cxx
-+++ sfx2/source/doc/objuno.cxx
-@@ -45,6 +45,7 @@
- #include <com/sun/star/lang/Locale.hpp>
- #include <com/sun/star/util/XModifiable.hpp>
- #include <com/sun/star/document/XDocumentProperties.hpp>
-+#include <com/sun/star/document/XCompatWriterDocProperties.hpp>
-
- #include <unotools/configmgr.hxx>
- #include <tools/inetdef.hxx>
-@@ -104,6 +105,9 @@ const SfxItemPropertyMapEntry* lcl_GetDocInfoPropertyMap()
- { "AutoloadEnabled" , 15, MID_DOCINFO_AUTOLOADENABLED, &::getBooleanCppuType(), PROPERTY_UNBOUND, 0 },
- { "AutoloadSecs" , 12, MID_DOCINFO_AUTOLOADSECS, &::getCppuType((const sal_Int32*)0), PROPERTY_UNBOUND, 0 },
- { "AutoloadURL" , 11, MID_DOCINFO_AUTOLOADURL, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
-+ { "Category" , 8 , MID_CATEGORY, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
-+ { "Company" , 7 , MID_COMPANY, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
-+ { "Manager" , 7 , MID_MANAGER, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
- { "CreationDate" , 12, WID_DATE_CREATED, &::getCppuType((const ::com::sun::star::util::DateTime*)0),PROPERTY_MAYBEVOID, 0 },
- { "DefaultTarget" , 13, MID_DOCINFO_DEFAULTTARGET, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
- { "Description" , 11, MID_DOCINFO_DESCRIPTION, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
-@@ -807,6 +811,22 @@ void SAL_CALL SfxDocumentInfoObject::setFastPropertyValue(sal_Int32 nHandle, co
- _pImp->m_xDocProps->setDefaultTarget(sTemp);
- break;
- // case WID_CONTENT_TYPE : // this is readonly!
-+ case MID_CATEGORY:
-+ case MID_MANAGER:
-+ case MID_COMPANY:
-+ {
-+ uno::Reference< document::XCompatWriterDocProperties > xWriterProps( _pImp->m_xDocProps, uno::UNO_QUERY );
-+ if ( xWriterProps.is() )
-+ {
-+ if ( nHandle == MID_CATEGORY )
-+ xWriterProps->setCategory( sTemp );
-+ else if ( nHandle == MID_MANAGER )
-+ xWriterProps->setManager( sTemp );
-+ else
-+ xWriterProps->setCompany( sTemp );
-+ break;
-+ }
-+ }
- default:
- break;
- }
-@@ -1024,6 +1044,23 @@ void SAL_CALL SfxDocumentInfoObject::setFastPropertyValue(sal_Int32 nHandle, co
- case MID_DOCINFO_CHARLOCALE:
- aValue <<= _pImp->m_xDocProps->getLanguage();
- break;
-+ case MID_CATEGORY:
-+ case MID_MANAGER:
-+ case MID_COMPANY:
-+ {
-+ uno::Reference< document::XCompatWriterDocProperties > xWriterProps( _pImp->m_xDocProps, uno::UNO_QUERY );
-+ if ( xWriterProps.is() )
-+ {
-+ if ( nHandle == MID_CATEGORY )
-+ aValue <<= xWriterProps->getCategory();
-+ else if ( nHandle == MID_MANAGER )
-+ aValue <<= xWriterProps->getManager();
-+ else
-+ aValue <<= xWriterProps->getCompany();
-+ break;
-+ }
-+ }
-+
- default:
- aValue <<= ::rtl::OUString();
- break;
-diff --git sfx2/source/doc/objxtor.cxx sfx2/source/doc/objxtor.cxx
-index a9a7583..c535d40 100644
---- sfx2/source/doc/objxtor.cxx
-+++ sfx2/source/doc/objxtor.cxx
-@@ -134,6 +134,40 @@ DBG_NAME(SfxObjectShell)
-
- static WeakReference< XInterface > s_xCurrentComponent;
-
-+void lcl_UpdateAppBasicDocVars( const Reference< XInterface >& _rxComponent, bool bClear = false )
-+{
-+ BasicManager* pAppMgr = SFX_APP()->GetBasicManager();
-+ if ( pAppMgr )
-+ {
-+ uno::Reference< beans::XPropertySet > xProps( _rxComponent, uno::UNO_QUERY );
-+ if ( xProps.is() )
-+ {
-+ try
-+ {
-+ // ThisVBADocObj contains a PropertyValue
-+ // Name is ( the name of the VBA global to insert )
-+ // Value is the Object to insert.
-+ // ( note: at the moment the Value is actually the model so
-+ // it strictly is not necessary, however we do intend to store
-+ // not the model in basic but a custom object, so we keep this
-+ // level of indirection for future proofing )
-+ beans::PropertyValue aProp;
-+ xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ThisVBADocObj") ) ) >>= aProp;
-+ rtl::OString sTmp( rtl::OUStringToOString( aProp.Name, RTL_TEXTENCODING_UTF8 ) );
-+ const char* pAscii = sTmp.getStr();
-+ if ( bClear )
-+ pAppMgr->SetGlobalUNOConstant( pAscii, uno::makeAny( uno::Reference< uno::XInterface >() ) );
-+ else
-+ pAppMgr->SetGlobalUNOConstant( pAscii, aProp.Value );
-+
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ }
-+ }
-+ }
-+}
-+
- //=========================================================================
-
-
-@@ -168,6 +202,7 @@ void SAL_CALL SfxModelListener_Impl::disposing( const com::sun::star::lang::Even
- ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
- if ( SfxObjectShell::GetCurrentComponent() == _rEvent.Source )
- {
-+ lcl_UpdateAppBasicDocVars( SfxObjectShell::GetCurrentComponent(), true );
- // remove ThisComponent reference from AppBasic
- SfxObjectShell::SetCurrentComponent( Reference< XInterface >() );
- }
-@@ -919,7 +961,10 @@ void SfxObjectShell::SetCurrentComponent( const Reference< XInterface >& _rxComp
- BasicManager* pAppMgr = SFX_APP()->GetBasicManager();
- s_xCurrentComponent = _rxComponent;
- if ( pAppMgr )
-+ {
-+ lcl_UpdateAppBasicDocVars( _rxComponent );
- pAppMgr->SetGlobalUNOConstant( "ThisComponent", makeAny( _rxComponent ) );
-+ }
-
- #if OSL_DEBUG_LEVEL > 0
- const char* pComponentImplName = _rxComponent.get() ? typeid( *_rxComponent.get() ).name() : "void";
-diff --git sfx2/source/doc/oleprops.hxx sfx2/source/doc/oleprops.hxx
-index 0fddd50..c277ec5 100755
---- sfx2/source/doc/oleprops.hxx
-+++ sfx2/source/doc/oleprops.hxx
-@@ -80,6 +80,10 @@ const sal_Int32 PROPID_CREATED = 12;
- const sal_Int32 PROPID_LASTSAVED = 13;
- const sal_Int32 PROPID_THUMBNAIL = 17;
-
-+// some Builtin properties
-+const sal_Int32 PROPID_CATEGORY = 0x2;
-+const sal_Int32 PROPID_COMPANY = 0xf;
-+const sal_Int32 PROPID_MANAGER = 0xe;
- // predefined codepages
- const sal_uInt16 CODEPAGE_UNKNOWN = 0;
- const sal_uInt16 CODEPAGE_UNICODE = 1200;
-diff --git sfx2/source/doc/sfxbasemodel.cxx sfx2/source/doc/sfxbasemodel.cxx
-index 8122e61..7e2e934 100644
---- sfx2/source/doc/sfxbasemodel.cxx
-+++ sfx2/source/doc/sfxbasemodel.cxx
-@@ -882,7 +882,15 @@ uno::Reference< document::XDocumentInfo > SAL_CALL SfxBaseModel::getDocumentInfo
-
- return m_pData->m_xDocumentInfo;
- }
--
-+void
-+SfxBaseModel::setDocumentProperties( const uno::Reference< document::XDocumentProperties >& rxNewDocProps )
-+{
-+ // object already disposed?
-+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
-+ if ( impl_isDisposed() )
-+ throw lang::DisposedException();
-+ m_pData->m_xDocumentProperties.set(rxNewDocProps, uno::UNO_QUERY_THROW);
-+}
- // document::XDocumentPropertiesSupplier:
- uno::Reference< document::XDocumentProperties > SAL_CALL
- SfxBaseModel::getDocumentProperties()
-@@ -3551,15 +3559,23 @@ void SAL_CALL SfxBaseModel::switchToStorage( const uno::Reference< XSTORAGE >& x
- throw IOEXCEPTION(); // TODO:
-
- // the persistence should be switched only if the storage is different
-- if ( xStorage != m_pData->m_pObjectShell->GetStorage()
-- && !m_pData->m_pObjectShell->SwitchPersistance( xStorage ) )
-- {
-- sal_uInt32 nError = m_pData->m_pObjectShell->GetErrorCode();
-- throw task::ErrorCodeIOException( ::rtl::OUString(),
-- uno::Reference< uno::XInterface >(),
-- nError ? nError : ERRCODE_IO_GENERAL );
-- }
--
-+ if ( xStorage != m_pData->m_pObjectShell->GetStorage() )
-+ {
-+ if ( !m_pData->m_pObjectShell->SwitchPersistance( xStorage ) )
-+ {
-+ sal_uInt32 nError = m_pData->m_pObjectShell->GetErrorCode();
-+ throw task::ErrorCodeIOException( ::rtl::OUString(),
-+ uno::Reference< uno::XInterface >(),
-+ nError ? nError : ERRCODE_IO_GENERAL );
-+ }
-+ else
-+ {
-+ // UICfgMgr has a reference to the old storage, update it
-+ uno::Reference< ui::XUIConfigurationStorage > xUICfgMgrStorage( getUIConfigurationManager(), uno::UNO_QUERY );
-+ if ( xUICfgMgrStorage.is() )
-+ xUICfgMgrStorage->setStorage( xStorage );
-+ }
-+ }
- m_pData->m_pObjectShell->Get_Impl()->bOwnsStorage = FALSE;
- }
-
-diff --git sfx2/source/inc/SfxDocumentMetaData.hxx sfx2/source/inc/SfxDocumentMetaData.hxx
-index 871ed19..6114339 100644
---- sfx2/source/inc/SfxDocumentMetaData.hxx
-+++ sfx2/source/inc/SfxDocumentMetaData.hxx
-@@ -45,5 +45,16 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL _create(
-
- } // closing component helper namespace
-
-+namespace comp_CompatWriterDocProps {
-+
-+namespace css = ::com::sun::star;
-+
-+// component and service helper functions:
-+::rtl::OUString SAL_CALL _getImplementationName();
-+css::uno::Sequence< ::rtl::OUString > SAL_CALL _getSupportedServiceNames();
-+css::uno::Reference< css::uno::XInterface > SAL_CALL _create(
-+ css::uno::Reference< css::uno::XComponentContext > const & context );
-+
-+}
- #endif
-
-diff --git sfx2/source/view/viewprn.cxx sfx2/source/view/viewprn.cxx
-index 43c9c8b..5cc2ce8 100644
---- sfx2/source/view/viewprn.cxx
-+++ sfx2/source/view/viewprn.cxx
-@@ -874,6 +888,10 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
- aReq.AppendItem( SfxStringItem( SID_PRINTER_NAME, pDlgPrinter->GetName() ) );
- aReq.Done();
- }
-+ if ( nId == SID_SETUPPRINTER )
-+ {
-+ rReq.AppendItem( SfxBoolItem( SID_DIALOG_RETURN, TRUE ) );
-+ }
-
- // take the changes made in the dialog
- pPrinter = SetPrinter_Impl( pDlgPrinter );
-@@ -894,6 +912,10 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
- rReq.Ignore();
- if ( SID_PRINTDOC == nId )
- rReq.SetReturnValue(SfxBoolItem(0,FALSE));
-+ if ( nId == SID_SETUPPRINTER )
-+ {
-+ rReq.AppendItem( SfxBoolItem( SID_DIALOG_RETURN, FALSE ) );
-+ }
- }
- }
- }
-diff --git svtools/inc/bindablecontrolhelper.hxx svtools/inc/bindablecontrolhelper.hxx
-new file mode 100644
-index 0000000..e9cd3e6
---- /dev/null
-+++ svtools/inc/bindablecontrolhelper.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: imageresourceaccess.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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef SVTOOLS_INC_BINDABLECONTROL_HXX
-+#define SVTOOLS_INC_BINDABLECONTROL_HXX
-+
-+#include "svtools/svtdllapi.h"
-+
-+#include <com/sun/star/frame/XModel.hpp>
-+//........................................................................
-+namespace svt
-+{
-+//........................................................................
-+
-+ //====================================================================
-+ //= GraphicAccess
-+ //====================================================================
-+ /** helper class for obtaining streams (which also can be used with the ImageProducer)
-+ from a resource
-+ */
-+ class BindableControlHelper
-+ {
-+ private:
-+ BindableControlHelper(); // never implemented
-+
-+ public:
-+ SVT_DLLPUBLIC static void ApplyListSourceAndBindableData( const com::sun::star::uno::Reference< com::sun::star::frame::XModel >& xModel, const com::sun::star::uno::Reference< com::sun::star::uno::XInterface >& rObj, const rtl::OUString& rsCtrlSource, const rtl::OUString& rsRowSource );
-+ };
-+
-+//........................................................................
-+} // namespace svt
-+//........................................................................
-+
-+#endif // DBA14_SVTOOLS_INC_IMAGERESOURCEACCESS_HXX
-+
-diff --git svtools/inc/filterutils.hxx svtools/inc/filterutils.hxx
-new file mode 100644
-index 0000000..a05025f
---- /dev/null
-+++ svtools/inc/filterutils.hxx
-@@ -0,0 +1,22 @@
-+#ifndef SVTOOLS_INC_FILTERUTILS_HXX
-+#define SVTOOLS_INC_FILTERUTILS_HXX
-+
-+#include "svtools/svtdllapi.h"
-+#include <com/sun/star/uno/RuntimeException.hpp>
-+namespace svt
-+{
-+ class BinFilterUtils
-+ {
-+ private:
-+ BinFilterUtils(); // never implemented
-+
-+ public:
-+ SVT_DLLPUBLIC static rtl::OUString CreateOUStringFromUniStringArray( const char* pcCharArr, sal_uInt32 nBufSize );
-+ SVT_DLLPUBLIC static rtl::OUString CreateOUStringFromStringArray( const char* pcCharArr, sal_uInt32 nBufSize );
-+ };
-+
-+//........................................................................
-+} // namespace svt
-+//........................................................................
-+
-+#endif
-diff --git svtools/source/misc/bindablecontrolhelper.cxx svtools/source/misc/bindablecontrolhelper.cxx
-new file mode 100644
-index 0000000..ba842f0
---- /dev/null
-+++ svtools/source/misc/bindablecontrolhelper.cxx
-@@ -0,0 +1,162 @@
-+/*************************************************************************
-+ *
-+ * 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: imageresourceaccess.cxx,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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_svtools.hxx"
-+#include "bindablecontrolhelper.hxx"
-+#include <com/sun/star/form/binding/XBindableValue.hpp>
-+#include <com/sun/star/form/binding/XValueBinding.hpp>
-+#include <com/sun/star/form/binding/XListEntrySink.hpp>
-+#include <com/sun/star/form/binding/XListEntrySource.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <com/sun/star/container/XNameAccess.hpp>
-+#include <com/sun/star/table/CellRangeAddress.hpp>
-+#include <com/sun/star/sheet/XCellRangeReferrer.hpp>
-+#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
-+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-+#include <com/sun/star/table/CellAddress.hpp>
-+#include <com/sun/star/beans/NamedValue.hpp>
-+
-+//........................................................................
-+namespace svt
-+{
-+//........................................................................
-+
-+#ifndef C2U
-+#define C2U(cChar) rtl::OUString::createFromAscii(cChar)
-+#endif
-+
-+ using namespace ::com::sun::star;
-+
-+bool lcl_isNamedRange( const rtl::OUString& sAddress, const uno::Reference< frame::XModel >& xModel, table::CellRangeAddress& aAddress )
-+{
-+ bool bRes = false;
-+ const static rtl::OUString sNamedRanges( RTL_CONSTASCII_USTRINGPARAM("NamedRanges"));
-+ uno::Reference< sheet::XCellRangeReferrer > xReferrer;
-+ try
-+ {
-+ uno::Reference< beans::XPropertySet > xPropSet( xModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XNameAccess > xNamed( xPropSet->getPropertyValue( sNamedRanges ), uno::UNO_QUERY_THROW );
-+ xReferrer.set ( xNamed->getByName( sAddress ), uno::UNO_QUERY );
-+ }
-+ catch( uno::Exception& /*e*/ )
-+ {
-+ // do nothing
-+ }
-+ if ( xReferrer.is() )
-+ {
-+ uno::Reference< sheet::XCellRangeAddressable > xRangeAddressable( xReferrer->getReferredCells(), uno::UNO_QUERY );
-+ if ( xRangeAddressable.is() )
-+ {
-+ aAddress = xRangeAddressable->getRangeAddress();
-+ bRes = true;
-+ }
-+ }
-+ return bRes;
-+}
-+
-+
-+void
-+BindableControlHelper::ApplyListSourceAndBindableData( const com::sun::star::uno::Reference< com::sun::star::frame::XModel >& xModel, const com::sun::star::uno::Reference< com::sun::star::uno::XInterface >& rObj, const rtl::OUString& rsCtrlSource, const rtl::OUString& rsRowSource )
-+{
-+// XBindable etc.
-+ uno::Reference< lang::XMultiServiceFactory > xFac;
-+ if ( xModel.is() )
-+ xFac.set( xModel, uno::UNO_QUERY );
-+ uno::Reference< form::binding::XBindableValue > xBindable( rObj, uno::UNO_QUERY );
-+ if ( xFac.is() && rsCtrlSource.getLength() && xBindable.is() )
-+ {
-+
-+ // OOo address structures
-+ // RefCell - convert from XL
-+ // pretend we converted the imported string address into the
-+ // appropriate address structure
-+ uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( C2U( "com.sun.star.table.CellAddressConversion" )), uno::UNO_QUERY );
-+ table::CellAddress aAddress;
-+ if ( xConvertor.is() )
-+ {
-+ // we need this service to properly convert XL notation also
-+ // Should be easy to extend
-+ xConvertor->setPropertyValue( C2U( "XL_A1_Representation" ), uno::makeAny( rsCtrlSource ) );
-+ xConvertor->getPropertyValue( C2U( "Address" ) ) >>= aAddress;
-+ }
-+
-+ beans::NamedValue aArg1;
-+ aArg1.Name = C2U("BoundCell");
-+ aArg1.Value <<= aAddress;
-+
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[ 0 ] <<= aArg1;
-+
-+ uno::Reference< form::binding::XValueBinding > xBinding( xFac->createInstanceWithArguments( C2U("com.sun.star.table.CellValueBinding" ), aArgs ), uno::UNO_QUERY );
-+ xBindable->setValueBinding( xBinding );
-+ }
-+ else if ( xBindable.is() ) // reset it
-+ xBindable->setValueBinding( uno::Reference< form::binding::XValueBinding >() );
-+ uno::Reference< form::binding::XListEntrySink > xListEntrySink( rObj, uno::UNO_QUERY );
-+ if ( xFac.is() && rsRowSource.getLength() && xListEntrySink.is() )
-+ {
-+
-+ // OOo address structures
-+ // RefCell - convert from XL
-+ // pretend we converted the imported string address into the
-+ // appropriate address structure
-+ uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( C2U( "com.sun.star.table.CellRangeAddressConversion" )), uno::UNO_QUERY );
-+ table::CellRangeAddress aAddress;
-+ if ( xConvertor.is() )
-+ {
-+ if ( !lcl_isNamedRange( rsRowSource, xModel, aAddress ) )
-+ {
-+ // we need this service to properly convert XL notation also
-+ // Should be easy to extend
-+ xConvertor->setPropertyValue( C2U( "XL_A1_Representation" ), uno::makeAny( rsRowSource ) );
-+ xConvertor->getPropertyValue( C2U( "Address" ) ) >>= aAddress;
-+ }
-+ }
-+
-+ beans::NamedValue aArg1;
-+ aArg1.Name = C2U("CellRange");
-+ aArg1.Value <<= aAddress;
-+
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[ 0 ] <<= aArg1;
-+
-+ uno::Reference< form::binding::XListEntrySource > xSource( xFac->createInstanceWithArguments( C2U("com.sun.star.table.CellRangeListSource" ), aArgs ), uno::UNO_QUERY );
-+ xListEntrySink->setListEntrySource( xSource );
-+ }
-+ else if ( xListEntrySink.is() ) // reset
-+ xListEntrySink->setListEntrySource( uno::Reference< form::binding::XListEntrySource >() );
-+
-+}
-+
-+//........................................................................
-+} // namespace svt
-+//........................................................................
-+
-diff --git svtools/source/misc/filterutils.cxx svtools/source/misc/filterutils.cxx
-new file mode 100644
-index 0000000..91a6ca4
---- /dev/null
-+++ svtools/source/misc/filterutils.cxx
-@@ -0,0 +1,56 @@
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_svtools.hxx"
-+#include "filterutils.hxx"
-+#include <rtl/ustrbuf.hxx>
-+
-+namespace svt
-+{
-+//........................................................................
-+
-+ using namespace ::com::sun::star;
-+
-+ rtl::OUString lcl_createStringFromArray( const char* pcCharArr, sal_uInt32 nBufSize, bool bIsCompressed )
-+ {
-+ rtl::OUStringBuffer aBuffer;
-+ if( bIsCompressed )
-+ {
-+ // buffer contains compressed Unicode, not encoded bytestring
-+ sal_Int32 nStrLen = static_cast< sal_Int32 >( nBufSize );
-+ aBuffer.setLength( nStrLen );
-+ const char* pcCurrChar = pcCharArr;
-+ for( sal_Int32 nChar = 0; nChar < nStrLen; ++nChar, ++pcCurrChar )
-+ /* *pcCurrChar may contain negative values and therefore MUST be
-+ casted to unsigned char, before assigned to a sal_Unicode. */
-+ aBuffer.setCharAt( nChar, static_cast< unsigned char >( *pcCurrChar ) );
-+ }
-+ else
-+ {
-+ // buffer contains Little-Endian Unicode
-+ sal_Int32 nStrLen = static_cast< sal_Int32 >( nBufSize ) / 2;
-+ aBuffer.setLength( nStrLen );
-+ const char* pcCurrChar = pcCharArr;
-+ for( sal_Int32 nChar = 0; nChar < nStrLen; ++nChar )
-+ {
-+ /* *pcCurrChar may contain negative values and therefore MUST be
-+ casted to unsigned char, before assigned to a sal_Unicode. */
-+ sal_Unicode cChar = static_cast< unsigned char >( *pcCurrChar++ );
-+ cChar |= (static_cast< unsigned char >( *pcCurrChar++ ) << 8);
-+ aBuffer.setCharAt( nChar, cChar );
-+ }
-+ }
-+ return aBuffer.makeStringAndClear();
-+ }
-+
-+ rtl::OUString BinFilterUtils::CreateOUStringFromUniStringArray( const char* pcCharArr, sal_uInt32 nBufSize )
-+ {
-+ return lcl_createStringFromArray( pcCharArr, nBufSize, false );
-+ }
-+
-+ rtl::OUString BinFilterUtils::CreateOUStringFromStringArray( const char* pcCharArr, sal_uInt32 nBufSize )
-+ {
-+ return lcl_createStringFromArray( pcCharArr, nBufSize, true );
-+ }
-+//........................................................................
-+} // namespace svt
-+//........................................................................
-+
-diff --git svtools/source/misc/makefile.mk svtools/source/misc/makefile.mk
-index 32781db..cd14b3b 100755
---- svtools/source/misc/makefile.mk
-+++ svtools/source/misc/makefile.mk
-@@ -75,6 +75,8 @@ SLOFILES=\
- $(SLO)$/transfer.obj \
- $(SLO)$/transfer2.obj \
- $(SLO)$/unitconv.obj \
-+ $(SLO)$/bindablecontrolhelper.obj \
-+ $(SLO)$/filterutils.obj \
- $(SLO)$/wallitem.obj \
- $(SLO)$/xwindowitem.obj
-
-diff --git svx/source/form/fmscriptingenv.cxx svx/source/form/fmscriptingenv.cxx
-index 74d9585..c14d2f1 100644
---- svx/source/form/fmscriptingenv.cxx
-+++ svx/source/form/fmscriptingenv.cxx
-@@ -36,6 +36,8 @@
- #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
- #include <com/sun/star/reflection/XInterfaceMethodTypeDescription.hpp>
- #include <com/sun/star/lang/DisposedException.hpp>
-+#include <com/sun/star/lang/EventObject.hpp>
-+#include <com/sun/star/awt/XControl.hpp>
- /** === end UNO includes === **/
- #include <tools/diagnose_ex.h>
- #include <cppuhelper/implbase1.hxx>
-@@ -71,6 +73,9 @@ namespace svxform
- using ::com::sun::star::uno::Exception;
- using ::com::sun::star::uno::Sequence;
- using ::com::sun::star::uno::XInterface;
-+ using ::com::sun::star::lang::EventObject;
-+ using ::com::sun::star::awt::XControl;
-+ using ::com::sun::star::beans::XPropertySet;
- /** === end UNO using === **/
-
- class FormScriptingEnvironment;
-@@ -413,8 +418,19 @@ namespace svxform
- {
- Sequence< sal_Int16 > aOutArgsIndex;
- Sequence< Any > aOutArgs;
--
-- m_rObjectShell.CallXScript( m_sScriptCode, _rArguments, _rSynchronousResult, aOutArgsIndex, aOutArgs );
-+ EventObject aEvent;
-+ Any aCaller;
-+ if ( ( _rArguments.getLength() > 0 ) && ( _rArguments[ 0 ] >>= aEvent ) )
-+ {
-+ try
-+ {
-+ Reference< XControl > xControl( aEvent.Source, UNO_QUERY_THROW );
-+ Reference< XPropertySet > xProps( xControl->getModel(), UNO_QUERY_THROW );
-+ aCaller = xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ) );
-+ }
-+ catch( Exception& ) {}
-+ }
-+ m_rObjectShell.CallXScript( m_sScriptCode, _rArguments, _rSynchronousResult, aOutArgsIndex, aOutArgs, true, aCaller.hasValue() ? &aCaller : 0 );
- }
-
- //................................................................
-diff --git svx/source/form/makefile.mk svx/source/form/makefile.mk
-index d6dc1bd..276df21 100644
---- svx/source/form/makefile.mk
-+++ svx/source/form/makefile.mk
-@@ -41,6 +41,10 @@ ENABLE_EXCEPTIONS=TRUE
- # --- Files --------------------------------------------------------
-
- .IF "$(ENABLE_VBA)"=="YES"
-+ CDEFS+=-DENABLE_VBA
-+.ENDIF
-+
-+.IF "$(ENABLE_VBA)"=="YES"
- CDEFS+=-DENABLE_VBA
- .ENDIF
-
---- sw/inc/doc.hxx 2010-08-21 18:03:57.000000000 +0100
-+++ sw/inc/doc.hxx 2010-08-21 18:13:06.000000000 +0100
-@@ -79,9 +79,7 @@ class SwList;
- #include "comphelper/implementationreference.hxx"
- #include <com/sun/star/chart2/data/XDataProvider.hpp>
- #include <com/sun/star/linguistic2/XProofreadingIterator.hpp>
--#ifdef FUTURE_VBA
- #include <com/sun/star/script/vba/XVBAEventProcessor.hpp>
--#endif
-
- #include <hash_map>
- #include <stringhash.hxx>
-@@ -408,9 +406,8 @@ class SW_DLLPUBLIC SwDoc :
-
- // table of forbidden characters of this document
- vos::ORef<SvxForbiddenCharactersTable> xForbiddenCharsTable;
--#ifdef FUTURE_VBA
- com::sun::star::uno::Reference< com::sun::star::script::vba::XVBAEventProcessor > mxVbaEvents;
--#endif
-+ com::sun::star::uno::Reference<com::sun::star::container::XNameContainer> m_xTemplateToProjectCache;
- // --> OD 2007-10-26 #i83479#
- public:
- struct lessThanNodeNum
-@@ -2146,9 +2142,9 @@ public:
- {
- return n32DummyCompatabilityOptions2;
- }
--#ifdef FUTURE_VBA
- com::sun::star::uno::Reference< com::sun::star::script::vba::XVBAEventProcessor > GetVbaEventProcessor();
--#endif
-+ void SetVBATemplateToProjectCache( com::sun::star::uno::Reference< com::sun::star::container::XNameContainer >& xCache ) { m_xTemplateToProjectCache = xCache; };
-+ com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > GetVBATemplateToProjectCache() { return m_xTemplateToProjectCache; };
- ::sfx2::IXmlIdRegistry& GetXmlIdRegistry();
- ::sw::MetaFieldManager & GetMetaFieldManager();
- SfxObjectShell* CreateCopy(bool bCallInitNew) const;
-diff --git sw/inc/docsh.hxx sw/inc/docsh.hxx
-index 3840d59..6c2fd87 100644
---- sw/inc/docsh.hxx
-+++ sw/inc/docsh.hxx
-@@ -83,6 +83,7 @@ class SW_DLLPUBLIC SwDocShell: public SfxObjectShell, public SfxListener
- comphelper::EmbeddedObjectContainer* pOLEChildList;
- sal_Int16 nUpdateDocMode; // contains the com::sun::star::document::UpdateDocMode
- bool bInUpdateFontList; //prevent nested calls of UpdateFontList
-+ bool bIsATemplate; //prevent nested calls of UpdateFontList
- // Methoden fuer den Zugriff aufs Doc
- SW_DLLPRIVATE void AddLink();
- SW_DLLPRIVATE void RemoveLink();
-@@ -301,6 +302,8 @@ public:
- GetController();
-
- SfxInPlaceClient* GetIPClient( const ::svt::EmbeddedObjectRef& xObjRef );
-+ SW_DLLPRIVATE sal_Bool IsTemplate() { return bIsATemplate; }
-+ SW_DLLPRIVATE void SetIsTemplate( bool bValue ) { bIsATemplate = bValue; }
-
- virtual const ::sfx2::IXmlIdRegistry* GetXmlIdRegistry() const;
-
-diff --git sw/inc/unocoll.hxx sw/inc/unocoll.hxx
-index bf6ba28..805b68c 100644
---- sw/inc/unocoll.hxx
-+++ sw/inc/unocoll.hxx
-@@ -195,8 +195,12 @@ class SwUnoCollection
- #define SW_SERVICE_TYPE_FIELDMARK 107
- #define SW_SERVICE_TYPE_FORMFIELDMARK 108
- #define SW_SERVICE_TYPE_META 109
-+#define SW_SERVICE_VBAOBJECTPROVIDER 110
-+#define SW_SERVICE_VBACODENAMEPROVIDER 111
-+#define SW_SERVICE_VBAPROJECTNAMEPROVIDER 112
-+#define SW_SERVICE_VBAGLOBALS 113
-
--#define SW_SERVICE_LAST SW_SERVICE_TYPE_META
-+#define SW_SERVICE_LAST SW_SERVICE_VBAGLOBALS
-
- #define SW_SERVICE_INVALID USHRT_MAX
-
-diff --git sw/inc/unoprnms.hxx sw/inc/unoprnms.hxx
-index 374753b..2dfc961 100644
---- sw/inc/unoprnms.hxx
-+++ sw/inc/unoprnms.hxx
-@@ -805,8 +805,10 @@ enum SwPropNameIds
- /* 0737 */ UNO_NAME_DESCRIPTION,
- // <--
- /* 0738 */ UNO_NAME_META, // #i91565#
--/* 0739 */ UNO_NAME_NESTED_TEXT_CONTENT, // #i109601#
--/* 0740 */ SW_PROPNAME_END
-+/* 0739 */ UNO_NAME_IS_TEMPLATE,
-+/* 0740 */ UNO_NAME_VBA_DOCOBJ,
-+/* 0741 */ UNO_NAME_NESTED_TEXT_CONTENT, // #i109601#
-+/* 0742 */ SW_PROPNAME_END
- };
-
-
-diff --git sw/inc/unotbl.hxx sw/inc/unotbl.hxx
-index ab6f6c6..7aa83d8 100644
---- sw/inc/unotbl.hxx
-+++ sw/inc/unotbl.hxx
-@@ -337,7 +337,7 @@ public:
- SwXTextTable(SwFrmFmt& rFrmFmt);
-
-
-- static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
-+ SW_DLLPUBLIC static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
-
- //XUnoTunnel
- virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
-diff --git sw/source/core/doc/doc.cxx sw/source/core/doc/doc.cxx
-index a414c8f..acb6532 100644
---- sw/source/core/doc/doc.cxx
-+++ sw/source/core/doc/doc.cxx
-@@ -119,9 +119,7 @@
-
- #include <osl/diagnose.h>
- #include <osl/interlck.h>
--#ifdef FUTURE_VBA
- #include <vbahelper/vbaaccesshelper.hxx>
--#endif
-
- /* @@@MAINTAINABILITY-HORROR@@@
- Probably unwanted dependency on SwDocShell
-@@ -2724,7 +2722,6 @@ void SwDoc::ChkCondColls()
- }
- }
-
--#ifdef FUTURE_VBA
- uno::Reference< script::vba::XVBAEventProcessor >
- SwDoc::GetVbaEventProcessor()
- {
-@@ -2743,7 +2740,6 @@ SwDoc::GetVbaEventProcessor()
- }
- return mxVbaEvents;
- }
--#endif
-
- void SwDoc::setExternalData(::sw::tExternalDataType eType,
- ::sw::tExternalDataPointer pPayload)
-diff --git sw/source/core/unocore/unocoll.cxx sw/source/core/unocore/unocoll.cxx
-index 03df3e1..9e71620 100644
---- sw/source/core/unocore/unocoll.cxx
-+++ sw/source/core/unocore/unocoll.cxx
-@@ -79,7 +79,16 @@
- #include <unorefmark.hxx>
- #include <unometa.hxx>
- #include "docsh.hxx"
--
-+#include <com/sun/star/document/XCodeNameQuery.hpp>
-+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
-+#include <com/sun/star/form/XFormsSupplier.hpp>
-+#include <com/sun/star/script/ModuleInfo.hpp>
-+#include <com/sun/star/script/ModuleType.hpp>
-+#include <com/sun/star/script/ScriptEventDescriptor.hpp>
-+#include <com/sun/star/script/vba/XVBAModuleInfo.hpp>
-+#include <vbahelper/vbaaccesshelper.hxx>
-+#include <basic/basmgr.hxx>
-+#include <comphelper/processfactory.hxx>
-
- using ::rtl::OUString;
- using namespace ::com::sun::star;
-@@ -89,6 +98,184 @@ using namespace ::com::sun::star::text;
- using namespace ::com::sun::star::container;
- using namespace ::com::sun::star::lang;
-
-+class SwVbaCodeNameProvider : public ::cppu::WeakImplHelper1< document::XCodeNameQuery >
-+{
-+ SwDocShell* mpDocShell;
-+ rtl::OUString msThisDocumentCodeName;
-+public:
-+ SwVbaCodeNameProvider( SwDocShell* pDocShell ) : mpDocShell( pDocShell ) {}
-+ // XCodeNameQuery
-+ rtl::OUString SAL_CALL getCodeNameForObject( const uno::Reference< uno::XInterface >& xIf ) throw( uno::RuntimeException )
-+ {
-+ // Initialise the code name
-+ if ( msThisDocumentCodeName.getLength() == 0 )
-+ {
-+ try
-+ {
-+ uno::Reference< beans::XPropertySet > xProps( mpDocShell->GetModel(), uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XNameAccess > xLibContainer( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BasicLibraries") ) ), uno::UNO_QUERY_THROW );
-+ rtl::OUString sProjectName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Standard") ) );
-+ if ( mpDocShell->GetBasicManager()->GetName().Len() )
-+ sProjectName = mpDocShell->GetBasicManager()->GetName();
-+
-+ uno::Reference< container::XNameAccess > xLib( xLibContainer->getByName( sProjectName ), uno::UNO_QUERY_THROW );
-+ uno::Sequence< rtl::OUString > sModuleNames = xLib->getElementNames();
-+ uno::Reference< script::vba::XVBAModuleInfo > xVBAModuleInfo( xLib, uno::UNO_QUERY );
-+
-+ for ( sal_Int32 i=0; i < sModuleNames.getLength(); ++i )
-+ {
-+ script::ModuleInfo mInfo;
-+
-+ if ( xVBAModuleInfo->hasModuleInfo( sModuleNames[ i ] ) && xVBAModuleInfo->getModuleInfo( sModuleNames[ i ] ).ModuleType == script::ModuleType::DOCUMENT )
-+ {
-+ msThisDocumentCodeName = sModuleNames[ i ];
-+ break;
-+ }
-+ }
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+ }
-+ rtl::OUString sCodeName;
-+ if ( mpDocShell )
-+ {
-+ OSL_TRACE( "*** In ScVbaCodeNameProvider::getCodeNameForObject");
-+ // need to find the page ( and index ) for this control
-+ uno::Reference< drawing::XDrawPageSupplier > xSupplier( mpDocShell->GetModel(), uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xIndex( xSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
-+ sal_Int32 nLen = xIndex->getCount();
-+ bool bMatched = false;
-+ uno::Sequence< script::ScriptEventDescriptor > aFakeEvents;
-+ try
-+ {
-+ uno::Reference< form::XFormsSupplier > xFormSupplier( xIndex, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xFormIndex( xFormSupplier->getForms(), uno::UNO_QUERY_THROW );
-+ // get the www-standard container
-+ uno::Reference< container::XIndexAccess > xFormControls( xFormIndex->getByIndex(0), uno::UNO_QUERY_THROW );
-+ sal_Int32 nCntrls = xFormControls->getCount();
-+ for( sal_Int32 cIndex = 0; cIndex < nCntrls; ++cIndex )
-+ {
-+ uno::Reference< uno::XInterface > xControl( xFormControls->getByIndex( cIndex ), uno::UNO_QUERY_THROW );
-+ bMatched = ( xControl == xIf );
-+ if ( bMatched )
-+ {
-+ sCodeName = msThisDocumentCodeName;
-+ break;
-+ }
-+ }
-+ }
-+ catch( uno::Exception& ) {}
-+ }
-+ // Probably should throw here ( if !bMatched )
-+ return sCodeName;
-+ }
-+};
-+
-+typedef std::hash_map< rtl::OUString, rtl::OUString, rtl::OUStringHash > StringHashMap;
-+class SwVbaProjectNameProvider : public ::cppu::WeakImplHelper1< container::XNameContainer >
-+{
-+ SwDocShell* mpDocShell;
-+ StringHashMap mTemplateToProject;
-+public:
-+ SwVbaProjectNameProvider( SwDocShell* pDocShell ) : mpDocShell( pDocShell )
-+ {
-+ }
-+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException )
-+ {
-+ return ( mTemplateToProject.find( aName ) != mTemplateToProject.end() );
-+ }
-+ virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
-+ {
-+ if ( !hasByName( aName ) )
-+ throw container::NoSuchElementException();
-+ return uno::makeAny( mTemplateToProject.find( aName )->second );
-+ }
-+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (::com::sun::star::uno::RuntimeException)
-+ {
-+ uno::Sequence< rtl::OUString > aElements( mTemplateToProject.size() );
-+ StringHashMap::iterator it_end = mTemplateToProject.end();
-+ sal_Int32 index = 0;
-+ for ( StringHashMap::iterator it = mTemplateToProject.begin(); it != it_end; ++it, ++index )
-+ aElements[ index ] = it->first;
-+ return aElements;
-+ }
-+
-+ virtual void SAL_CALL insertByName( const rtl::OUString& aName, const uno::Any& aElement ) throw ( com::sun::star::lang::IllegalArgumentException, com::sun::star::container::ElementExistException, com::sun::star::lang::WrappedTargetException )
-+ {
-+
-+ rtl::OUString sProjectName;
-+ aElement >>= sProjectName;
-+ OSL_TRACE("** Template cache inserting template name %s with project %s"
-+ , rtl::OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr()
-+ , rtl::OUStringToOString( sProjectName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ mTemplateToProject[ aName ] = sProjectName;
-+ }
-+
-+ virtual void SAL_CALL removeByName( const rtl::OUString& Name ) throw ( com::sun::star::container::NoSuchElementException, com::sun::star::lang::WrappedTargetException )
-+ {
-+ if ( !hasByName( Name ) )
-+ throw container::NoSuchElementException();
-+ mTemplateToProject.erase( Name );
-+ }
-+ virtual void SAL_CALL replaceByName( const rtl::OUString& aName, const uno::Any& aElement ) throw ( com::sun::star::lang::IllegalArgumentException, com::sun::star::container::NoSuchElementException, com::sun::star::lang::WrappedTargetException )
-+ {
-+ if ( !hasByName( aName ) )
-+ throw container::NoSuchElementException();
-+ insertByName( aName, aElement ); // insert will overwrite
-+ }
-+ // XElemenAccess
-+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException)
-+ {
-+ return ::getCppuType((const rtl::OUString*)0);
-+ }
-+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException )
-+ {
-+
-+ return ( mTemplateToProject.size() > 0 );
-+ }
-+
-+};
-+
-+class SwVbaObjectForCodeNameProvider : public ::cppu::WeakImplHelper1< container::XNameAccess >
-+{
-+ SwDocShell* mpDocShell;
-+public:
-+ SwVbaObjectForCodeNameProvider( SwDocShell* pDocShell ) : mpDocShell( pDocShell )
-+ {
-+ // #FIXME #TODO is the code name for ThisDocument read anywhere?
-+ }
-+
-+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException )
-+ {
-+ // #FIXME #TODO we really need to be checking against the codename for
-+ // ThisDocument
-+ if ( aName.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ThisDocument" ) ) ) )
-+ return sal_True;
-+ return sal_False;
-+ }
-+ ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
-+ {
-+ if ( !hasByName( aName ) )
-+ throw container::NoSuchElementException();
-+ uno::Sequence< uno::Any > aArgs( 2 );
-+ aArgs[0] = uno::Any( uno::Reference< uno::XInterface >() );
-+ aArgs[1] = uno::Any( mpDocShell->GetModel() );
-+ uno::Reference< uno::XInterface > xDocObj = ooo::vba::createVBAUnoAPIServiceWithArgs( mpDocShell, "ooo.vba.word.Document" , aArgs );
-+ OSL_TRACE("Creating Object ( ooo.vba.word.Document ) 0x%x", xDocObj.get() );
-+ return uno::makeAny( xDocObj );
-+ }
-+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (::com::sun::star::uno::RuntimeException)
-+ {
-+ uno::Sequence< rtl::OUString > aNames;
-+ return aNames;
-+ }
-+ // XElemenAccess
-+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException){ return uno::Type(); }
-+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException ) { return sal_True; }
-+
-+};
-+
- /******************************************************************************
- *
- ******************************************************************************/
-@@ -211,6 +398,10 @@ const ProvNamesId_Type __FAR_DATA aProvNamesId[] =
- { "com.sun.star.text.Fieldmark", SW_SERVICE_TYPE_FIELDMARK },
- { "com.sun.star.text.FormFieldmark", SW_SERVICE_TYPE_FORMFIELDMARK },
- { "com.sun.star.text.InContentMetadata", SW_SERVICE_TYPE_META },
-+ { "ooo.vba.VBAObjectModuleObjectProvider", SW_SERVICE_VBAOBJECTPROVIDER },
-+ { "ooo.vba.VBACodeNameProvider", SW_SERVICE_VBACODENAMEPROVIDER },
-+ { "ooo.vba.VBAProjectNameProvider", SW_SERVICE_VBAPROJECTNAMEPROVIDER },
-+ { "ooo.vba.VBAGlobals", SW_SERVICE_VBAGLOBALS },
-
- // case-correct versions of the service names (see #i67811)
- { CSS_TEXT_TEXTFIELD_DATE_TIME, SW_SERVICE_FIELDTYPE_DATETIME },
-@@ -391,6 +582,50 @@ uno::Reference< uno::XInterface > SwXServiceProvider::MakeInstance(sal_uInt16
- xRet = (cppu::OWeakObject*)pFieldmark;
- }
- break;
-+ case SW_SERVICE_VBAOBJECTPROVIDER :
-+ {
-+ SwVbaObjectForCodeNameProvider* pObjProv = new SwVbaObjectForCodeNameProvider( pDoc->GetDocShell() );
-+ xRet = (cppu::OWeakObject*)pObjProv;
-+ }
-+ break;
-+ case SW_SERVICE_VBACODENAMEPROVIDER :
-+ {
-+ if ( pDoc->GetDocShell() && ooo::vba::isAlienWordDoc( *pDoc->GetDocShell() ) )
-+ {
-+ SwVbaCodeNameProvider* pObjProv = new SwVbaCodeNameProvider( pDoc->GetDocShell() );
-+ xRet = (cppu::OWeakObject*)pObjProv;
-+ }
-+ }
-+ break;
-+ case SW_SERVICE_VBAPROJECTNAMEPROVIDER :
-+ {
-+ uno::Reference< container::XNameContainer > xProjProv = pDoc->GetVBATemplateToProjectCache();
-+ if ( !xProjProv.is() && pDoc->GetDocShell() && ooo::vba::isAlienWordDoc( *pDoc->GetDocShell() ) )
-+ {
-+ xProjProv = new SwVbaProjectNameProvider( pDoc->GetDocShell() );
-+ pDoc->SetVBATemplateToProjectCache( xProjProv );
-+ }
-+ //xRet = (cppu::OWeakObject*)xProjProv;
-+ xRet = xProjProv;
-+ }
-+ break;
-+ case SW_SERVICE_VBAGLOBALS :
-+ {
-+ if ( pDoc )
-+ {
-+ uno::Any aGlobs;
-+ if ( !pDoc->GetDocShell()->GetBasicManager()->GetGlobalUNOConstant( "VBAGlobals", aGlobs ) )
-+ {
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[ 0 ] <<= pDoc->GetDocShell()->GetModel();
-+ aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( ::rtl::OUString::createFromAscii( "ooo.vba.word.Globals"), aArgs );
-+ pDoc->GetDocShell()->GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
-+ }
-+ aGlobs >>= xRet;
-+ }
-+ }
-+ break;
-+
- case SW_SERVICE_TYPE_FOOTNOTE :
- xRet = (cppu::OWeakObject*)new SwXFootnote(sal_False);
- break;
-diff --git sw/source/core/unocore/unomap.cxx sw/source/core/unocore/unomap.cxx
-index f5aee26..f4df212 100644
---- sw/source/core/unocore/unomap.cxx
-+++ sw/source/core/unocore/unomap.cxx
-@@ -1580,11 +1580,13 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
- { SW_PROP_NMID(UNO_NAME_CHAR_LOCALE), RES_CHRATR_LANGUAGE , CPPU_E2T(CPPUTYPE_LOCALE), PropertyAttribute::MAYBEVOID, MID_LANG_LOCALE },
- { SW_PROP_NMID(UNO_NAME_CHARACTER_COUNT), WID_DOC_CHAR_COUNT, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::READONLY, 0},
- { SW_PROP_NMID(UNO_NAME_DIALOG_LIBRARIES), WID_DOC_DIALOG_LIBRARIES, CPPU_E2T(CPPUTYPE_REFLIBCONTAINER), PropertyAttribute::READONLY, 0},
-+ { SW_PROP_NMID(UNO_NAME_VBA_DOCOBJ), WID_DOC_VBA_DOCOBJ, CPPU_E2T(CPPUTYPE_PROPERTYVALUE), PropertyAttribute::READONLY, 0},
- { SW_PROP_NMID(UNO_NAME_INDEX_AUTO_MARK_FILE_U_R_L), WID_DOC_AUTO_MARK_URL, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
- { SW_PROP_NMID(UNO_NAME_PARAGRAPH_COUNT), WID_DOC_PARA_COUNT, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::READONLY, 0},
- { SW_PROP_NMID(UNO_NAME_RECORD_CHANGES), WID_DOC_CHANGES_RECORD, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
- { SW_PROP_NMID(UNO_NAME_SHOW_CHANGES), WID_DOC_CHANGES_SHOW, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
- { SW_PROP_NMID(UNO_NAME_WORD_COUNT), WID_DOC_WORD_COUNT, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::READONLY, 0},
-+ { SW_PROP_NMID(UNO_NAME_IS_TEMPLATE), WID_DOC_ISTEMPLATEID, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::READONLY, 0},
- { SW_PROP_NMID(UNO_NAME_WORD_SEPARATOR), WID_DOC_WORD_SEPARATOR, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
- { SW_PROP_NMID(UNO_NAME_HIDE_FIELD_TIPS), WID_DOC_HIDE_TIPS, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
- { SW_PROP_NMID(UNO_NAME_REDLINE_DISPLAY_TYPE), WID_DOC_REDLINE_DISPLAY, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
-diff --git sw/source/core/unocore/unoprnms.cxx sw/source/core/unocore/unoprnms.cxx
-index 228b489..6a98b97 100644
---- sw/source/core/unocore/unoprnms.cxx
-+++ sw/source/core/unocore/unoprnms.cxx
-@@ -778,7 +778,10 @@ const SwPropNameTab aPropNameTab = {
- /* 0736 UNO_NAME_OUTLINE_LEVEL */ {MAP_CHAR_LEN("OutlineLevel")},//#outline level,add<-zhaojianwei Outlinelevel
- /* 0737 UNO_NAME_DESCRIPTION */ {MAP_CHAR_LEN("Description")},
- /* 0738 UNO_NAME_META */ {MAP_CHAR_LEN("InContentMetadata")},
--/* 0739 UNO_NAME_NESTED_TEXT_CONTENT */ {MAP_CHAR_LEN("NestedTextContent")},
-+/* 0739 UNO_NAME_IS_TEMPLATE */ {MAP_CHAR_LEN("IsTemplate")},
-+/* 0740 UNO_NAME_VBA_DOCOBJ */ {MAP_CHAR_LEN("ThisVBADocObj")},
-+
-+/* 0741 UNO_NAME_NESTED_TEXT_CONTENT */ {MAP_CHAR_LEN("NestedTextContent")},
- };
-
- const SwPropNameLen& SwGetPropName( USHORT nId )
-diff --git sw/source/filter/ww8/makefile.mk sw/source/filter/ww8/makefile.mk
-index a1d1242..80f8278 100644
---- sw/source/filter/ww8/makefile.mk
-+++ sw/source/filter/ww8/makefile.mk
-@@ -67,6 +67,7 @@ EXCEPTIONSFILES = \
- $(SLO)$/WW8TableInfo.obj \
- $(SLO)$/WW8FFData.obj \
- $(SLO)$/WW8Sttbf.obj \
-+ $(SLO)$/ww8toolbar.obj \
- $(SLO)$/WW8FibData.obj \
- $(SLO)$/rtfexportfilter.obj \
- $(SLO)$/rtfimportfilter.obj \
-@@ -101,6 +102,7 @@ SLOFILES = \
- $(SLO)$/WW8TableInfo.obj \
- $(SLO)$/WW8FFData.obj \
- $(SLO)$/WW8Sttbf.obj \
-+ $(SLO)$/ww8toolbar.obj \
- $(SLO)$/WW8FibData.obj \
- $(SLO)$/rtfexportfilter.obj \
- $(SLO)$/rtfimportfilter.obj \
-diff --git sw/source/filter/ww8/ww8par.cxx sw/source/filter/ww8/ww8par.cxx
-index 04341ab..c71f885 100644
---- sw/source/filter/ww8/ww8par.cxx
-+++ sw/source/filter/ww8/ww8par.cxx
-@@ -128,11 +128,19 @@
- #include <svl/itemiter.hxx> //SfxItemIter
-
- #include <stdio.h>
-+#include <comphelper/processfactory.hxx>
-+#include <basic/basmgr.hxx>
-+
-+#include "ww8toolbar.hxx"
-+#include <osl/file.hxx>
-+#include <com/sun/star/document/XDocumentInfoSupplier.hpp>
-
- #ifdef DEBUG
- #include <iostream>
- #include <dbgoutsw.hxx>
- #endif
-+#include <unotools/localfilehelper.hxx>
-+#include <comphelper/configurationhelper.hxx>
-
- #include "WW8Sttbf.hxx"
- #include "WW8FibData.hxx"
-@@ -144,6 +152,87 @@ using namespace sw::util;
- using namespace sw::types;
- using namespace nsHdFtFlags;
-
-+#include <com/sun/star/document/XEventsSupplier.hpp>
-+#include <com/sun/star/container/XNameReplace.hpp>
-+#include <com/sun/star/frame/XModel.hpp>
-+#include <filter/msfilter/msvbahelper.hxx>
-+#include <unotools/pathoptions.hxx>
-+#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
-+
-+class Sttb : TBBase
-+{
-+struct SBBItem
-+{
-+ sal_uInt16 cchData;
-+ rtl::OUString data;
-+ SBBItem() : cchData(0){}
-+};
-+ sal_uInt16 fExtend;
-+ sal_uInt16 cData;
-+ sal_uInt16 cbExtra;
-+
-+ std::vector< SBBItem > dataItems;
-+
-+ Sttb(const Sttb&);
-+ Sttb& operator = ( const Sttb&);
-+public:
-+ Sttb();
-+ ~Sttb();
-+ bool Read(SvStream *pS);
-+ void Print( FILE* fp );
-+ rtl::OUString getStringAtIndex( sal_uInt32 );
-+};
-+
-+Sttb::Sttb() : fExtend( 0 )
-+,cData( 0 )
-+,cbExtra( 0 )
-+{
-+}
-+
-+Sttb::~Sttb()
-+{
-+}
-+
-+bool Sttb::Read( SvStream* pS )
-+{
-+ OSL_TRACE("Sttb::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> fExtend >> cData >> cbExtra;
-+ if ( cData )
-+ {
-+ for ( sal_Int32 index = 0; index < cData; ++index )
-+ {
-+ SBBItem aItem;
-+ *pS >> aItem.cchData;
-+ aItem.data = readUnicodeString( pS, aItem.cchData );
-+ dataItems.push_back( aItem );
-+ }
-+ }
-+ return true;
-+}
-+
-+void Sttb::Print( FILE* fp )
-+{
-+ fprintf( fp, "[ 0x%x ] Sttb - dump\n", nOffSet);
-+ fprintf( fp, " fExtend 0x%x [expected 0xFFFF ]\n", fExtend );
-+ fprintf( fp, " cData no. or string data items %d (0x%x)\n", cData, cData );
-+
-+ if ( cData )
-+ {
-+ for ( sal_Int32 index = 0; index < cData; ++index )
-+ fprintf(fp," string dataItem[ %d(0x%x) ] has name %s\n", static_cast< int >( index ), static_cast< unsigned int >( index ), rtl::OUStringToOString( dataItems[ index ].data, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ }
-+
-+}
-+
-+rtl::OUString
-+Sttb::getStringAtIndex( sal_uInt32 index )
-+{
-+ rtl::OUString aRet;
-+ if ( index < dataItems.size() )
-+ aRet = dataItems[ index ].data;
-+ return aRet;
-+}
-
- SwMSDffManager::SwMSDffManager( SwWW8ImplReader& rRdr )
- : SvxMSDffManager(*rRdr.pTableStream, rRdr.GetBaseURL(), rRdr.pWwFib->fcDggInfo,
-@@ -3783,11 +3872,168 @@ void SwWW8ImplReader::ReadDocInfo()
- DBG_ASSERT(xDocProps.is(), "DocumentProperties is null");
-
- if (xDocProps.is()) {
-+ if ( pWwFib->fDot )
-+ {
-+ rtl::OUString sTemplateURL;
-+ SfxMedium* pMedium = mpDocShell->GetMedium();
-+ if ( pMedium )
-+ {
-+ rtl::OUString aName = pMedium->GetName();
-+ INetURLObject aURL( aName );
-+ sTemplateURL = aURL.GetMainURL(INetURLObject::DECODE_TO_IURI);
-+ if ( sTemplateURL.getLength() > 0 )
-+ xDocProps->setTemplateURL( sTemplateURL );
-+ }
-+ }
-+ else // not a template
-+ {
-+ long nCur = pTableStream->Tell();
-+ Sttb aSttb;
-+ pTableStream->Seek( pWwFib->fcSttbfAssoc ); // point at tgc record
-+ if (!aSttb.Read( pTableStream ) )
-+ OSL_TRACE("** Read of SttbAssoc data failed!!!! ");
-+ pTableStream->Seek( nCur ); // return to previous position, is that necessary?
-+#if DEBUG
-+ aSttb.Print( stderr );
-+#endif
-+ String sPath = aSttb.getStringAtIndex( 0x1 );
-+ String aURL;
-+ // attempt to convert to url ( won't work for obvious reasons on linux
-+ if ( sPath.Len() )
-+ ::utl::LocalFileHelper::ConvertPhysicalNameToURL( sPath, aURL );
-+ if ( aURL.Len() )
-+ xDocProps->setTemplateURL( aURL );
-+ else
-+ xDocProps->setTemplateURL( sPath );
-+
-+ }
- sfx2::LoadOlePropertySet(xDocProps, pStg);
- }
- }
- }
-
-+void lcl_createTemplateToProjectEntry( const uno::Reference< container::XNameContainer >& xPrjNameCache, const rtl::OUString& sTemplatePathOrURL, const rtl::OUString& sVBAProjName )
-+{
-+ if ( xPrjNameCache.is() )
-+ {
-+ INetURLObject aObj;
-+ aObj.SetURL( sTemplatePathOrURL );
-+ bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
-+ rtl::OUString aURL;
-+ if ( bIsURL )
-+ aURL = sTemplatePathOrURL;
-+ else
-+ {
-+ osl::FileBase::getFileURLFromSystemPath( sTemplatePathOrURL, aURL );
-+ aObj.SetURL( aURL );
-+ }
-+ try
-+ {
-+ rtl::OUString templateNameWithExt = aObj.GetLastName();
-+ rtl::OUString templateName;
-+ sal_Int32 nIndex = templateNameWithExt.lastIndexOf( '.' );
-+ //xPrjNameCache->insertByName( templateNameWithExt, uno::makeAny( sVBAProjName ) );
-+ if ( nIndex != -1 )
-+ {
-+ templateName = templateNameWithExt.copy( 0, nIndex );
-+ xPrjNameCache->insertByName( templateName, uno::makeAny( sVBAProjName ) );
-+ }
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+ }
-+}
-+
-+class WW8Customizations
-+{
-+ SvStream* mpTableStream;
-+ WW8Fib mWw8Fib;
-+public:
-+ WW8Customizations( SvStream*, WW8Fib& );
-+ bool Import( SwDocShell* pShell );
-+};
-+
-+WW8Customizations::WW8Customizations( SvStream* pTableStream, WW8Fib& rFib ) : mpTableStream(pTableStream), mWw8Fib( rFib )
-+{
-+}
-+
-+bool WW8Customizations::Import( SwDocShell* pShell )
-+{
-+ if ( mWw8Fib.lcbCmds == 0 )
-+ return false;
-+ Tcg aTCG;
-+ long nCur = mpTableStream->Tell();
-+ mpTableStream->Seek( mWw8Fib.fcCmds ); // point at tgc record
-+ bool bReadResult = aTCG.Read( mpTableStream );
-+ mpTableStream->Seek( nCur ); // return to previous position, is that necessary?
-+ if ( !bReadResult )
-+ {
-+ OSL_TRACE("** Read of Customization data failed!!!! ");
-+ return false;
-+ }
-+#if DEBUG
-+ aTCG.Print( stderr );
-+#endif
-+ return aTCG.ImportCustomToolBar( *pShell );
-+}
-+
-+bool SwWW8ImplReader::ReadGlobalTemplateSettings( const rtl::OUString& sCreatedFrom, const uno::Reference< container::XNameContainer >& xPrjNameCache )
-+{
-+ SvtPathOptions aPathOpt;
-+ String aAddinPath = aPathOpt.GetAddinPath();
-+ uno::Sequence< rtl::OUString > sGlobalTemplates;
-+
-+ // first get the autoload addins in the directory STARTUP
-+ uno::Reference< ucb::XSimpleFileAccess > xSFA( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ), uno::UNO_QUERY_THROW );
-+
-+ if( xSFA->isFolder( aAddinPath ) )
-+ sGlobalTemplates = xSFA->getFolderContents( aAddinPath, sal_False );
-+
-+ sal_Int32 nEntries = sGlobalTemplates.getLength();
-+ bool bRes = true;
-+ const SvtFilterOptions* pVBAFlags = SvtFilterOptions::Get();
-+ for ( sal_Int32 i=0; i<nEntries; ++i )
-+ {
-+ INetURLObject aObj;
-+ aObj.SetURL( sGlobalTemplates[ i ] );
-+ bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
-+ rtl::OUString aURL;
-+ if ( bIsURL )
-+ aURL = sGlobalTemplates[ i ];
-+ else
-+ osl::FileBase::getFileURLFromSystemPath( sGlobalTemplates[ i ], aURL );
-+ if ( !aURL.endsWithIgnoreAsciiCaseAsciiL( ".dot", 4 ) || ( sCreatedFrom.getLength() && sCreatedFrom.equals( aURL ) ) )
-+ continue; // don't try and read the same document as ourselves
-+
-+ SotStorageRef rRoot = new SotStorage( aURL, STREAM_STD_READWRITE, STORAGE_TRANSACTED );
-+
-+ // Read Macro Projects
-+ SvxImportMSVBasic aVBasic(*mpDocShell, *rRoot,
-+ pVBAFlags->IsLoadWordBasicCode(),
-+ pVBAFlags->IsLoadWordBasicStorage() );
-+
-+
-+ String s1(CREATE_CONST_ASC("Macros"));
-+ String s2(CREATE_CONST_ASC("VBA"));
-+ aVBasic.Import( s1, s2, !pVBAFlags->IsLoadWordBasicExecutable() );
-+ lcl_createTemplateToProjectEntry( xPrjNameCache, aURL, aVBasic.GetVBAProjectName() );
-+ // Read toolbars & menus
-+ SvStorageStreamRef refMainStream = rRoot->OpenSotStream( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WordDocument") ) );
-+ refMainStream->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN);
-+ WW8Fib aWwFib( *refMainStream, 8 );
-+ SvStorageStreamRef xTableStream = rRoot->OpenSotStream(String::CreateFromAscii( aWwFib.fWhichTblStm ? SL::a1Table : SL::a0Table), STREAM_STD_READ);
-+
-+ if (xTableStream.Is() && SVSTREAM_OK == xTableStream->GetError())
-+ {
-+ xTableStream->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN);
-+ WW8Customizations aGblCustomisations( xTableStream, aWwFib );
-+ aGblCustomisations.Import( mpDocShell );
-+ }
-+ }
-+ return bRes;
-+}
-+
- ULONG SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
- {
- ULONG nErrRet = 0;
-@@ -4071,7 +4317,59 @@ ULONG SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
- }
- else //ordinary case
- {
-+ if (mbNewDoc && pStg && !pGloss) /*meaningless for a glossary, cmc*/
-+ {
-+ mpDocShell->SetIsTemplate( pWwFib->fDot ); // point at tgc record
-+ const SvtFilterOptions* pVBAFlags = SvtFilterOptions::Get();
-+ maTracer.EnterEnvironment(sw::log::eMacros);
-+// dissable below for 3.1 at the moment, 'cause it's kinda immature
-+// similarly the project reference in svx/source/msvba
-+#if 1
-+ uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( mpDocShell->GetModel(), uno::UNO_QUERY_THROW );
-+ uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW );
-+ uno::Reference< document::XDocumentProperties > xDocProps( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW );
-+
-+ rtl::OUString sCreatedFrom = xDocProps->getTemplateURL();
-+ uno::Reference< container::XNameContainer > xPrjNameCache;
-+ uno::Reference< lang::XMultiServiceFactory> xSF(mpDocShell->GetModel(), uno::UNO_QUERY);
-+ if ( xSF.is() )
-+ xPrjNameCache.set( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAProjectNameProvider" ) ) ), uno::UNO_QUERY );
-+
-+ // Read Global templates
-+ ReadGlobalTemplateSettings( sCreatedFrom, xPrjNameCache );
-+#endif
-+ // Create and insert Word vba Globals
-+ uno::Any aGlobs;
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[ 0 ] <<= mpDocShell->GetModel();
-+ aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( ::rtl::OUString::createFromAscii( "ooo.vba.word.Globals"), aArgs );
-+ mpDocShell->GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
-+
-+ SvxImportMSVBasic aVBasic(*mpDocShell, *pStg,
-+ pVBAFlags->IsLoadWordBasicCode(),
-+ pVBAFlags->IsLoadWordBasicStorage() );
-+ String s1(CREATE_CONST_ASC("Macros"));
-+ String s2(CREATE_CONST_ASC("VBA"));
-+ int nRet = aVBasic.Import( s1, s2, !pVBAFlags->IsLoadWordBasicExecutable() );
-+// dissable below for 3.1 at the moment, 'cause it's kinda immature
-+// similarly the project reference in svx/source/msvba
-+#if 1
-+ lcl_createTemplateToProjectEntry( xPrjNameCache, sCreatedFrom, aVBasic.GetVBAProjectName() );
-+ WW8Customizations aCustomisations( pTableStream, *pWwFib );
-+ aCustomisations.Import( mpDocShell );
-+#endif
-+ if( 2 & nRet )
-+ {
-+ maTracer.Log(sw::log::eContainsVisualBasic);
-+ rDoc.SetContainsMSVBasic(true);
-+ }
-+
-+ StoreMacroCmds();
-+
-+ maTracer.LeaveEnvironment(sw::log::eMacros);
-+ }
- ReadText(0, pWwFib->ccpText, MAN_MAINTEXT);
-+
- }
-
- ::SetProgressState(nProgress, mpDocShell); // Update
-@@ -4145,26 +4443,6 @@ ULONG SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
- eMode |= nsRedlineMode_t::REDLINE_ON;
- if( pWDop->fRMView )
- eMode |= nsRedlineMode_t::REDLINE_SHOW_DELETE;
-- if (pStg && !pGloss) /*meaningless for a glossary, cmc*/
-- {
-- const SvtFilterOptions* pVBAFlags = SvtFilterOptions::Get();
-- maTracer.EnterEnvironment(sw::log::eMacros);
-- SvxImportMSVBasic aVBasic(*mpDocShell, *pStg,
-- pVBAFlags->IsLoadWordBasicCode(),
-- pVBAFlags->IsLoadWordBasicStorage() );
-- String s1(CREATE_CONST_ASC("Macros"));
-- String s2(CREATE_CONST_ASC("VBA"));
-- int nRet = aVBasic.Import( s1, s2 );
-- if( 2 & nRet )
-- {
-- maTracer.Log(sw::log::eContainsVisualBasic);
-- rDoc.SetContainsMSVBasic(true);
-- }
--
-- StoreMacroCmds();
--
-- maTracer.LeaveEnvironment(sw::log::eMacros);
-- }
- }
-
- maInsertedTables.DelAndMakeTblFrms();
-diff --git sw/source/filter/ww8/ww8par.hxx sw/source/filter/ww8/ww8par.hxx
-index a2b92ee..95a072f 100644
---- sw/source/filter/ww8/ww8par.hxx
-+++ sw/source/filter/ww8/ww8par.hxx
-@@ -1417,7 +1417,7 @@ private:
- // determine object attribute "Layout in Table Cell"
- bool IsObjectLayoutInTableCell( const UINT32 nLayoutInTableCell ) const;
- // <--
--
-+ bool ReadGlobalTemplateSettings( const rtl::OUString& sCreatedFrom, const com::sun::star::uno::Reference< com::sun::star::container::XNameContainer >& xPrjNameMap );
- //No copying
- SwWW8ImplReader(const SwWW8ImplReader &);
- SwWW8ImplReader& operator=(const SwWW8ImplReader&);
-diff --git sw/source/filter/ww8/ww8toolbar.cxx sw/source/filter/ww8/ww8toolbar.cxx
-new file mode 100644
-index 0000000..e9fb6a3
---- /dev/null
-+++ sw/source/filter/ww8/ww8toolbar.cxx
-@@ -0,0 +1,1302 @@
-+#include "ww8toolbar.hxx"
-+#include <rtl/ustrbuf.hxx>
-+#include <stdarg.h>
-+#include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
-+#include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
-+#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
-+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-+#include <com/sun/star/lang/XSingleComponentFactory.hpp>
-+#include <com/sun/star/lang/XMultiComponentFactory.hpp>
-+#include <com/sun/star/ui/XImageManager.hpp>
-+#include <com/sun/star/ui/ItemType.hpp>
-+#include <fstream>
-+#include <comphelper/processfactory.hxx>
-+#include <vcl/graph.hxx>
-+#include <map>
-+using namespace com::sun::star;
-+
-+// no. of visual data elements in a CTB ( fixed )
-+const short nVisualData = 5;
-+
-+typedef std::map< sal_Int16, rtl::OUString > IdToString;
-+
-+class MSOWordCommandConvertor : public MSOCommandConvertor
-+{
-+ IdToString msoToOOcmd;
-+ IdToString tcidToOOcmd;
-+public:
-+ MSOWordCommandConvertor();
-+ virtual rtl::OUString MSOCommandToOOCommand( sal_Int16 msoCmd );
-+ virtual rtl::OUString MSOTCIDToOOCommand( sal_Int16 key );
-+};
-+
-+MSOWordCommandConvertor::MSOWordCommandConvertor()
-+{
-+ // mso command id to ooo command string
-+ // #FIXME and *HUNDREDS* of id's to added here
-+ msoToOOcmd[ 0x20b ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".uno:CloseDoc") );
-+ msoToOOcmd[ 0x50 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".uno:Open") );
-+
-+ // mso tcid to ooo command string
-+ // #FIXME and *HUNDREDS* of id's to added here
-+ tcidToOOcmd[ 0x9d9 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".uno:Print") );
-+}
-+
-+rtl::OUString MSOWordCommandConvertor::MSOCommandToOOCommand( sal_Int16 key )
-+{
-+ rtl::OUString sResult;
-+ IdToString::iterator it = msoToOOcmd.find( key );
-+ if ( it != msoToOOcmd.end() )
-+ sResult = it->second;
-+ return sResult;
-+}
-+
-+rtl::OUString MSOWordCommandConvertor::MSOTCIDToOOCommand( sal_Int16 key )
-+{
-+ rtl::OUString sResult;
-+ IdToString::iterator it = tcidToOOcmd.find( key );
-+ if ( it != tcidToOOcmd.end() )
-+ sResult = it->second;
-+ return sResult;
-+}
-+
-+
-+CTBWrapper::CTBWrapper( bool bReadId ) : Tcg255SubStruct( bReadId )
-+,reserved2(0)
-+,reserved3(0)
-+,reserved4(0)
-+,reserved5(0)
-+,cbTBD(0)
-+,cCust(0)
-+,cbDTBC(0)
-+,rtbdc(0)
-+{
-+}
-+
-+CTBWrapper::~CTBWrapper()
-+{
-+}
-+
-+Customization* CTBWrapper::GetCustomizaton( sal_Int16 index )
-+{
-+ if ( index < 0 || index >= static_cast<sal_Int16>( rCustomizations.size() ) )
-+ return NULL;
-+ return &rCustomizations[ index ];
-+}
-+
-+CTB* CTBWrapper::GetCustomizationData( const rtl::OUString& sTBName )
-+{
-+ CTB* pCTB = NULL;
-+ for ( std::vector< Customization >::iterator it = rCustomizations.begin(); it != rCustomizations.end(); ++it )
-+ {
-+ if ( it->GetCustomizationData() && it->GetCustomizationData()->GetName().equals( sTBName ) )
-+ {
-+ pCTB = it->GetCustomizationData();
-+ break;
-+ }
-+ }
-+ return pCTB;
-+}
-+
-+bool CTBWrapper::Read( SvStream* pS )
-+{
-+ OSL_TRACE("CTBWrapper::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ Tcg255SubStruct::Read( pS );
-+ *pS >> reserved2 >> reserved3 >> reserved4 >> reserved5;
-+ *pS >> cbTBD >> cCust >> cbDTBC;
-+ long nExpectedPos = pS->Tell() + cbDTBC;
-+ if ( cbDTBC )
-+ {
-+ // cbDTBC is the size in bytes of the TBC array
-+ // but the size of a TBC element is dynamic ( and this relates to TBDelta's
-+ int nStart = pS->Tell();
-+
-+ int bytesRead = 0;
-+ int bytesToRead = cbDTBC - bytesRead;
-+ // cbDTBC specifies the size ( in bytes ) taken by an array ( of unspecified size )
-+ // of TBC records ( TBC records have dynamic length, so we need to check our position
-+ // after each read )
-+ do
-+ {
-+ TBC aTBC;
-+ if ( !aTBC.Read( pS ) )
-+ return false;
-+ rtbdc.push_back( aTBC );
-+ bytesToRead = cbDTBC - ( pS->Tell() - nStart );
-+ } while ( bytesToRead > 0 );
-+ }
-+ if ( static_cast< long >( pS->Tell() ) != nExpectedPos )
-+ {
-+ // Strange error condition, shouldn't happen ( but does in at least
-+ // one test document ) In the case where it happens the TBC &
-+ // TBCHeader records seem blank??? ( and incorrect )
-+ OSL_ENSURE( pS->Tell() == nExpectedPos, "### Error: Expected pos not equal to actual pos after reading rtbdc");
-+ OSL_TRACE("\tPos now is 0x%x should be 0x%x", pS->Tell(), nExpectedPos );
-+ // seek to correct position after rtbdc
-+ pS->Seek( nExpectedPos );
-+ }
-+ if ( cCust )
-+ {
-+ for ( sal_Int32 index = 0; index < cCust; ++index )
-+ {
-+ Customization aCust( this );
-+ if ( !aCust.Read( pS ) )
-+ return false;
-+ rCustomizations.push_back( aCust );
-+ }
-+ }
-+ std::vector< sal_Int16 >::iterator it_end = dropDownMenuIndices.end();
-+ for ( std::vector< sal_Int16 >::iterator it = dropDownMenuIndices.begin(); it != it_end; ++it )
-+ {
-+ rCustomizations[ *it ].bIsDroppedMenuTB = true;
-+ }
-+ return true;
-+}
-+
-+TBC* CTBWrapper::GetTBCAtOffset( sal_uInt32 nStreamOffset )
-+{
-+ for ( std::vector< TBC >::iterator it = rtbdc.begin(); it != rtbdc.end(); ++it )
-+ {
-+ if ( (*it).GetOffset() == nStreamOffset )
-+ return &(*it);
-+ }
-+ return NULL;
-+}
-+
-+void CTBWrapper::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf(fp,"[ 0x%x ] CTBWrapper - dump\n", nOffSet );
-+ bool bRes = ( ch == 0x12 && reserved2 == 0x0 && reserved3 == 0x7 && reserved4 == 0x6 && reserved5 == 0xC );
-+ if ( bRes )
-+ indent_printf(fp," sanity check ( first 8 bytes conform )\n");
-+ else
-+ {
-+ indent_printf(fp," reserved1(0x%x)\n",ch);
-+ indent_printf(fp," reserved2(0x%x)\n",reserved2);
-+ indent_printf(fp," reserved3(0x%x)\n",reserved3);
-+ indent_printf(fp," reserved4(0x%x)\n",reserved4);
-+ indent_printf(fp," reserved5(0x%x)\n",reserved5);
-+ indent_printf(fp,"Quiting dump");
-+ return;
-+ }
-+ indent_printf(fp," size of TBDelta structures 0x%x\n", cbTBD );
-+ indent_printf(fp," cCust: no. of cCust structures 0x%x\n",cCust);
-+ indent_printf(fp," cbDTBC: no. of bytes in rtbdc array 0x%x\n", static_cast< unsigned int >( cbDTBC ));
-+
-+ sal_Int32 index = 0;
-+
-+ for ( std::vector< TBC >::iterator it = rtbdc.begin(); it != rtbdc.end(); ++it, ++index )
-+ {
-+ indent_printf(fp," Dumping rtbdc[%d]\n", static_cast< int >( index ));
-+ Indent b;
-+ it->Print( fp );
-+ }
-+
-+ index = 0;
-+
-+ for ( std::vector< Customization >::iterator it = rCustomizations.begin(); it != rCustomizations.end(); ++it, ++index )
-+ {
-+ indent_printf(fp," Dumping custimization [%d]\n", static_cast< int >( index ));
-+ Indent c;
-+ it->Print(fp);
-+ }
-+}
-+
-+bool CTBWrapper::ImportCustomToolBar( SfxObjectShell& rDocSh )
-+{
-+ for ( std::vector< Customization >::iterator it = rCustomizations.begin(); it != rCustomizations.end(); ++it )
-+ {
-+ uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+ uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xAppCfgSupp( xMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.ModuleUIConfigurationManagerSupplier" ) ) ), uno::UNO_QUERY_THROW );
-+ CustomToolBarImportHelper helper( rDocSh, xAppCfgSupp->getUIConfigurationManager( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument" ) ) ) );
-+ helper.setMSOCommandMap( new MSOWordCommandConvertor() );
-+
-+ if ( !(*it).ImportCustomToolBar( *this, helper ) )
-+ return false;
-+ }
-+ return false;
-+}
-+
-+Customization::Customization( CTBWrapper* wrapper ) : tbidForTBD( 0 )
-+,reserved1( 0 )
-+, ctbds( 0 )
-+, pWrapper( wrapper )
-+, bIsDroppedMenuTB( false )
-+{
-+}
-+
-+Customization::~Customization()
-+{
-+}
-+
-+bool Customization::Read( SvStream *pS)
-+{
-+ OSL_TRACE("Custimization::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> tbidForTBD >> reserved1 >> ctbds;
-+ if ( tbidForTBD )
-+ {
-+ for ( sal_Int32 index = 0; index < ctbds; ++index )
-+ {
-+ TBDelta aTBDelta;
-+ if (!aTBDelta.Read( pS ) )
-+ return false;
-+ customizationDataTBDelta.push_back( aTBDelta );
-+ // Only set the drop down for menu's associated with standard toolbar
-+ if ( aTBDelta.ControlDropsToolBar() && tbidForTBD == 0x25 )
-+ pWrapper->InsertDropIndex( aTBDelta.CustomizationIndex() );
-+ }
-+ }
-+ else
-+ {
-+ customizationDataCTB.reset( new CTB() );
-+ if ( !customizationDataCTB->Read( pS ) )
-+ return false;
-+ }
-+ return true;
-+}
-+
-+void Customization::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf( fp,"[ 0x%x ] Customization -- dump \n", nOffSet );
-+ indent_printf( fp," tbidForTBD 0x%x ( should be 0 for CTBs )\n", static_cast< unsigned int >( tbidForTBD ));
-+ indent_printf( fp," reserved1 0x%x \n", reserved1);
-+ indent_printf( fp," ctbds - number of customisations %d(0x%x) \n", ctbds, ctbds );
-+ if ( !tbidForTBD && !ctbds )
-+ customizationDataCTB->Print( fp );
-+ else
-+ {
-+ const char* pToolBar = NULL;
-+ switch ( tbidForTBD )
-+ {
-+ case 0x9:
-+ pToolBar = "Standard";
-+ break;
-+ case 0x25:
-+ pToolBar = "Builtin-Menu";
-+ break;
-+ default:
-+ pToolBar = "Unknown toolbar";
-+ break;
-+ }
-+
-+ indent_printf( fp," TBDelta(s) are associated with %s toolbar.\n", pToolBar);
-+ std::vector< TBDelta >::iterator it = customizationDataTBDelta.begin();
-+ for ( sal_Int32 index = 0; index < ctbds; ++it,++index )
-+ it->Print( fp );
-+ }
-+
-+}
-+
-+bool Customization::ImportMenu( CTBWrapper& rWrapper, CustomToolBarImportHelper& helper )
-+{
-+ if ( tbidForTBD == 0x25 ) // we can handle in a limited way additions the built-in menu bar
-+ {
-+ for ( std::vector< TBDelta >::iterator it = customizationDataTBDelta.begin(); it != customizationDataTBDelta.end(); ++it )
-+ {
-+ // for each new menu ( control that drops a toolbar )
-+ // import a toolbar
-+ if ( it->ControlIsInserted() && it->ControlDropsToolBar() )
-+ {
-+ Customization* pCust = pWrapper->GetCustomizaton( it->CustomizationIndex() );
-+ if ( pCust )
-+ {
-+ // currently only support built-in menu
-+ rtl::OUString sMenuBar( RTL_CONSTASCII_USTRINGPARAM("private:resource/menubar/") );
-+
-+ sMenuBar = sMenuBar.concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("menubar") ) );
-+ // Get menu name
-+ TBC* pTBC = pWrapper->GetTBCAtOffset( it->TBCStreamOffset() );
-+ if ( !pTBC )
-+ return false;
-+ rtl::OUString sMenuName = pTBC->GetCustomText();
-+ sMenuName = sMenuName.replace('&','~');
-+
-+ // see if the document has already setting for the menubar
-+
-+ uno::Reference< container::XIndexContainer > xIndexContainer;
-+ bool bHasSettings = false;
-+ if ( helper.getCfgManager()->hasSettings( sMenuBar ) )
-+ {
-+ xIndexContainer.set( helper.getCfgManager()->getSettings( sMenuBar, sal_True ), uno::UNO_QUERY_THROW );
-+ bHasSettings = true;
-+ }
-+ else
-+ {
-+ if ( helper.getAppCfgManager()->hasSettings( sMenuBar ) )
-+ xIndexContainer.set( helper.getAppCfgManager()->getSettings( sMenuBar, sal_True ), uno::UNO_QUERY_THROW );
-+ else
-+ xIndexContainer.set( helper.getAppCfgManager()->createSettings(), uno::UNO_QUERY_THROW );
-+ }
-+
-+ uno::Reference< lang::XSingleComponentFactory > xSCF( xIndexContainer, uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+ uno::Reference< uno::XComponentContext > xContext( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
-+ // create the popup menu
-+ uno::Sequence< beans::PropertyValue > aPopupMenu( 4 );
-+ aPopupMenu[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CommandURL") );
-+ aPopupMenu[0].Value = uno::makeAny( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("vnd.openoffice.org:") ) + sMenuName );
-+ aPopupMenu[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Label") );
-+ aPopupMenu[1].Value <<= sMenuName;
-+ aPopupMenu[2].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Type" ) );
-+ aPopupMenu[2].Value <<= sal_Int32( 0 );
-+ aPopupMenu[3].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ItemDescriptorContainer") );
-+ uno::Reference< container::XIndexContainer > xMenuContainer( xSCF->createInstanceWithContext( xContext ), uno::UNO_QUERY_THROW );
-+ aPopupMenu[3].Value <<= xMenuContainer;
-+ if ( pCust->customizationDataCTB.get() && !pCust->customizationDataCTB->ImportMenuTB( rWrapper, xMenuContainer, helper ) )
-+ return false;
-+ OSL_TRACE("** there are %d menu items on the bar, inserting after that", xIndexContainer->getCount() );
-+ xIndexContainer->insertByIndex( xIndexContainer->getCount(), uno::makeAny( aPopupMenu ) );
-+
-+ if ( bHasSettings )
-+ helper.getCfgManager()->replaceSettings( sMenuBar, uno::Reference< container::XIndexAccess >( xIndexContainer, uno::UNO_QUERY_THROW ) );
-+ else
-+ helper.getCfgManager()->insertSettings( sMenuBar, uno::Reference< container::XIndexAccess >( xIndexContainer, uno::UNO_QUERY_THROW ) );
-+ uno::Reference< ui::XUIConfigurationPersistence > xPersistence( helper.getCfgManager(), uno::UNO_QUERY_THROW );
-+ xPersistence->store();
-+ }
-+ }
-+ }
-+ return true;
-+ }
-+ return true;
-+}
-+
-+bool Customization::ImportCustomToolBar( CTBWrapper& rWrapper, CustomToolBarImportHelper& helper )
-+{
-+ if ( GetTBIDForTB() == 0x25 )
-+ return ImportMenu( rWrapper, helper );
-+ if ( !customizationDataCTB.get() )
-+ return false;
-+ if ( !customizationDataCTB->IsMenuToolbar() )
-+ {
-+ if ( !customizationDataCTB->ImportCustomToolBar( rWrapper, helper ) )
-+ return false;
-+ }
-+ return true;
-+}
-+
-+TBDelta::TBDelta() : doprfatendFlags(0)
-+,ibts(0)
-+,cidNext(0)
-+,cid(0)
-+,fc(0)
-+,cbTBC(0)
-+{
-+}
-+
-+bool TBDelta::ControlIsModified()
-+{
-+ return ( ( doprfatendFlags & 0x3 ) == 0x2 );
-+}
-+
-+bool TBDelta::ControlIsInserted()
-+{
-+ return ( ( doprfatendFlags & 0x3 ) == 0x1 );
-+}
-+
-+bool TBDelta::ControlIsChanged()
-+{
-+ return ( ( doprfatendFlags & 0x3 ) == 0x1 );
-+}
-+
-+bool TBDelta::ControlDropsToolBar()
-+{
-+ return !( CiTBDE & 0x8000 );
-+}
-+
-+sal_Int32 TBDelta::TBCStreamOffset()
-+{
-+ return fc;
-+}
-+
-+sal_Int16 TBDelta::CustomizationIndex()
-+{
-+ sal_Int16 nIndex = CiTBDE;
-+ nIndex = nIndex >> 1;
-+ nIndex &= 0x1ff; // only 13 bits are relevant
-+ return nIndex;
-+}
-+
-+bool TBDelta::Read(SvStream *pS)
-+{
-+ OSL_TRACE("TBDelta::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> doprfatendFlags >> ibts >> cidNext >> cid >> fc ;
-+ *pS >> CiTBDE >> cbTBC;
-+ return true;
-+}
-+
-+void TBDelta::Print( FILE* fp )
-+{
-+ // Like most of the debug output, it's raw and little ( no )
-+ // interpretation of the data is output ( e.g. flag values etc. )
-+ indent_printf( fp, "[ 0x%x ] TBDelta -- dump\n", nOffSet );
-+ indent_printf( fp, " doprfatendFlags 0x%x\n",doprfatendFlags );
-+
-+ indent_printf( fp, " ibts 0x%x\n",ibts );
-+ indent_printf( fp, " cidNext 0x%x\n", static_cast< unsigned int >( cidNext ) );
-+ indent_printf( fp, " cid 0x%x\n", static_cast< unsigned int >( cid ) );
-+ indent_printf( fp, " fc 0x%x\n", static_cast< unsigned int >( fc ) );
-+ indent_printf( fp, " CiTBDE 0x%x\n",CiTBDE );
-+ indent_printf( fp, " cbTBC 0x%x\n", cbTBC );
-+ if ( ControlDropsToolBar() )
-+ {
-+ indent_printf( fp, " this delta is associated with a control that drops a menu toolbar\n", cbTBC );
-+ indent_printf( fp, " the menu toolbar drops the toolbar defined at index[%d] in the rCustomizations array of the CTBWRAPPER that contains this TBDelta\n", CustomizationIndex() );
-+ }
-+}
-+
-+CTB::CTB() : cbTBData( 0 )
-+,iWCTBl( 0 )
-+,reserved( 0 )
-+,unused( 0 )
-+,cCtls( 0 )
-+{
-+}
-+
-+CTB::~CTB()
-+{
-+}
-+
-+bool CTB::IsMenuToolbar()
-+{
-+ return tb.IsMenuToolbar();
-+}
-+
-+
-+bool CTB::Read( SvStream *pS)
-+{
-+ OSL_TRACE("CTB::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ if ( !name.Read( pS ) )
-+ return false;
-+ *pS >> cbTBData;
-+ if ( !tb.Read( pS ) )
-+ return false;
-+ for ( short index = 0; index < nVisualData; ++index )
-+ {
-+ TBVisualData aVisData;
-+ aVisData.Read( pS );
-+ rVisualData.push_back( aVisData );
-+ }
-+
-+ *pS >> iWCTBl >> reserved >> unused >> cCtls;
-+
-+ if ( cCtls )
-+ {
-+ for ( sal_Int32 index = 0; index < cCtls; ++index )
-+ {
-+ TBC aTBC;
-+ if ( !aTBC.Read( pS ) )
-+ return false;
-+ rTBC.push_back( aTBC );
-+ }
-+ }
-+ return true;
-+}
-+
-+void
-+CTB::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf(fp, "[ 0x%x ] CTB - dump\n", nOffSet );
-+ indent_printf(fp, " name %s\n", rtl::OUStringToOString( name.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ indent_printf(fp, " cbTBData size, in bytes, of this structure excluding the name, cCtls, and rTBC fields. %x\n", static_cast< unsigned int >( cbTBData ) );
-+
-+ tb.Print(fp);
-+ for ( short counter = 0; counter < nVisualData; ++counter )
-+ {
-+ indent_printf( fp, " TBVisualData [%d]\n", counter);
-+ Indent b;
-+ rVisualData[ counter ].Print( fp );
-+ }
-+ indent_printf(fp, " iWCTBl 0x%x reserved 0x%x unused 0x%x cCtls( toolbar controls ) 0x%x \n", static_cast< unsigned int >( iWCTBl ), reserved, unused, static_cast< unsigned int >( cCtls ) );
-+ if ( cCtls )
-+ {
-+ for ( sal_Int32 index = 0; index < cCtls; ++index )
-+ {
-+
-+ indent_printf(fp, " dumping toolbar control 0x%x\n", static_cast< unsigned int >( index ) );
-+ rTBC[ index ].Print( fp );
-+ }
-+ }
-+}
-+
-+bool CTB::ImportCustomToolBar( CTBWrapper& rWrapper, CustomToolBarImportHelper& helper )
-+{
-+ static rtl::OUString sToolbarPrefix( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/custom_" ) );
-+ bool bRes = false;
-+ try
-+ {
-+ if ( !tb.IsEnabled() )
-+ return true; // didn't fail, just ignoring
-+ // Create default setting
-+ uno::Reference< container::XIndexContainer > xIndexContainer( helper.getCfgManager()->createSettings(), uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xIndexAccess( xIndexContainer, uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xProps( xIndexContainer, uno::UNO_QUERY_THROW );
-+
-+ // set UI name for toolbar
-+ xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UIName") ), uno::makeAny( name.getString() ) );
-+
-+ rtl::OUString sToolBarName = sToolbarPrefix.concat( name.getString() );
-+ for ( std::vector< TBC >::iterator it = rTBC.begin(); it != rTBC.end(); ++it )
-+ {
-+ // createToolBar item for control
-+ if ( !it->ImportToolBarControl( rWrapper, xIndexContainer, helper, IsMenuToolbar() ) )
-+ return false;
-+ }
-+
-+ OSL_TRACE("Name of toolbar :-/ %s", rtl::OUStringToOString( sToolBarName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+
-+ helper.getCfgManager()->insertSettings( sToolBarName, xIndexAccess );
-+ helper.applyIcons();
-+#if 1 // don't think this is necessary
-+ uno::Reference< ui::XUIConfigurationPersistence > xPersistence( helper.getCfgManager()->getImageManager(), uno::UNO_QUERY_THROW );
-+ xPersistence->store();
-+
-+ xPersistence.set( helper.getCfgManager(), uno::UNO_QUERY_THROW );
-+ xPersistence->store();
-+#endif
-+ bRes = true;
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ OSL_TRACE("***** For some reason we have an exception %s", rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ bRes = false;
-+ }
-+ return bRes;
-+}
-+
-+bool CTB::ImportMenuTB( CTBWrapper& rWrapper, const css::uno::Reference< css::container::XIndexContainer >& xIndexContainer, CustomToolBarImportHelper& rHelper )
-+{
-+ for ( std::vector< TBC >::iterator it = rTBC.begin(); it != rTBC.end(); ++it )
-+ {
-+ // createToolBar item for control
-+ if ( !it->ImportToolBarControl( rWrapper, xIndexContainer, rHelper, true ) )
-+ return false;
-+ }
-+ return true;
-+}
-+
-+TBC::TBC()
-+{
-+}
-+
-+TBC::~TBC()
-+{
-+}
-+
-+bool TBC::Read( SvStream *pS )
-+{
-+ OSL_TRACE("TBC::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ if ( !tbch.Read( pS ) )
-+ return false;
-+ if ( tbch.getTcID() != 0x1 && tbch.getTcID() != 0x1051 )
-+ {
-+ cid.reset( new sal_uInt32 );
-+ *pS >> *cid;
-+ }
-+ // MUST exist if tbch.tct is not equal to 0x16
-+ if ( tbch.getTct() != 0x16 )
-+ {
-+ tbcd.reset( new TBCData( tbch ) );
-+ if ( !tbcd->Read( pS ) )
-+ return false;
-+ }
-+ return true;
-+}
-+
-+void TBC::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf(fp,"[ 0x%x ] TBC -- dump\n", nOffSet );
-+ indent_printf(fp," dumping header ( TBCHeader )\n");
-+ tbch.Print( fp );
-+ if ( cid.get() )
-+ indent_printf(fp," cid = 0x%x\n", static_cast< unsigned int >( *cid ) );
-+ if ( tbcd.get() )
-+ {
-+ indent_printf(fp," dumping toolbar data TBCData \n");
-+ tbcd->Print(fp);
-+ }
-+}
-+
-+bool
-+TBC::ImportToolBarControl( CTBWrapper& rWrapper, const css::uno::Reference< css::container::XIndexContainer >& toolbarcontainer, CustomToolBarImportHelper& helper, bool bIsMenuBar )
-+{
-+ // cmtFci 0x1 Command based on a built-in command. See CidFci.
-+ // cmtMacro 0x2 Macro command. See CidMacro.
-+ // cmtAllocated 0x3 Allocated command. See CidAllocated.
-+ // cmtNil 0x7 No command. See Cid.
-+ bool bBuiltin = false;
-+ sal_uInt16 cmdId = 0;
-+ if ( cid.get() )
-+ {
-+ sal_uInt16 arg2 = ( *( cid.get() ) & 0xFFFF );
-+
-+ sal_uInt8 cmt = ( arg2 & 0x7 );
-+ arg2 = ( arg2 >> 3 );
-+
-+ switch ( cmt )
-+ {
-+ case 1:
-+ OSL_TRACE("cmt is cmtFci builtin command 0x%x", arg2);
-+ bBuiltin = true;
-+ cmdId = arg2;
-+ break;
-+ case 2:
-+ OSL_TRACE("cmt is cmtMacro macro 0x%x", arg2);
-+ break;
-+ case 3:
-+ OSL_TRACE("cmt is cmtAllocated [???] 0x%x", arg2);
-+ break;
-+ case 7:
-+ OSL_TRACE("cmt is cmNill no-phing 0x%x", arg2);
-+ break;
-+ default:
-+ OSL_TRACE("illegal 0x%x", cmt);
-+ break;
-+ }
-+ }
-+
-+ if ( tbcd.get() )
-+ {
-+ std::vector< css::beans::PropertyValue > props;
-+ if ( bBuiltin )
-+ {
-+ rtl::OUString sCommand = helper.MSOCommandToOOCommand( cmdId );
-+ if ( sCommand.getLength() > 0 )
-+ {
-+ beans::PropertyValue aProp;
-+
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CommandURL") );
-+ aProp.Value <<= sCommand;
-+ props.push_back( aProp );
-+ }
-+ }
-+ bool bBeginGroup = false;
-+ if ( ! tbcd->ImportToolBarControl( helper, props, bBeginGroup, bIsMenuBar ) )
-+ return false;
-+
-+ TBCMenuSpecific* pMenu = tbcd->getMenuSpecific();
-+ if ( pMenu )
-+ {
-+ OSL_TRACE("** control has a menu, name of toolbar with menu items is %s", rtl::OUStringToOString( pMenu->Name(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ // search for CTB with the appropriate name ( it contains the
-+ // menu items, although we cannot import ( or create ) a menu on
-+ // a custom toolbar we can import the menu items in a separate
-+ // toolbar ( better than nothing )
-+ CTB* pCustTB = rWrapper.GetCustomizationData( pMenu->Name() );
-+ if ( pCustTB )
-+ {
-+ uno::Reference< container::XIndexContainer > xMenuDesc;
-+ uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+ xMenuDesc.set( xMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.IndexedPropertyValues" ) ) ), uno::UNO_QUERY_THROW );
-+ if ( !pCustTB->ImportMenuTB( rWrapper,xMenuDesc, helper ) )
-+ return false;
-+ if ( !bIsMenuBar )
-+ {
-+ if ( !helper.createMenu( pMenu->Name(), uno::Reference< container::XIndexAccess >( xMenuDesc, uno::UNO_QUERY ), true ) )
-+ return false;
-+ }
-+ else
-+ {
-+ beans::PropertyValue aProp;
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ItemDescriptorContainer") );
-+ aProp.Value <<= xMenuDesc;
-+ props.push_back( aProp );
-+ }
-+ }
-+ }
-+
-+ if ( bBeginGroup )
-+ {
-+ // insert spacer
-+ uno::Sequence< beans::PropertyValue > sProps( 1 );
-+ sProps[ 0 ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Type") );
-+ sProps[ 0 ].Value = uno::makeAny( ui::ItemType::SEPARATOR_LINE );
-+ toolbarcontainer->insertByIndex( toolbarcontainer->getCount(), uno::makeAny( sProps ) );
-+ }
-+
-+ uno::Sequence< beans::PropertyValue > sProps( props.size() );
-+ beans::PropertyValue* pProp = sProps.getArray();
-+
-+ for ( std::vector< css::beans::PropertyValue >::iterator it = props.begin(); it != props.end(); ++it, ++pProp )
-+ *pProp = *it;
-+
-+ toolbarcontainer->insertByIndex( toolbarcontainer->getCount(), uno::makeAny( sProps ) );
-+ }
-+ return true;
-+}
-+
-+rtl::OUString
-+TBC::GetCustomText()
-+{
-+ rtl::OUString sCustomText;
-+ if ( tbcd.get() )
-+ sCustomText = tbcd->getGeneralInfo().CustomText();
-+ return sCustomText;
-+
-+
-+}
-+
-+bool
-+Xst::Read( SvStream* pS )
-+{
-+ OSL_TRACE("Xst::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ sal_Int16 nChars = 0;
-+ *pS >> nChars;
-+ sString = readUnicodeString( pS, static_cast< sal_Int32 >( nChars ) );
-+ return true;
-+}
-+
-+void
-+Xst::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf( fp, "[ 0x%x ] Xst -- dump\n", nOffSet );
-+ indent_printf( fp, " %s", rtl::OUStringToOString( sString, RTL_TEXTENCODING_UTF8 ).getStr() );
-+}
-+
-+Tcg::Tcg() : nTcgVer( 255 )
-+{
-+}
-+
-+bool Tcg::Read(SvStream *pS)
-+{
-+ OSL_TRACE("Tcg::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> nTcgVer;
-+ if ( nTcgVer != (sal_Int8)255 )
-+ return false;
-+ tcg.reset( new Tcg255() );
-+ return tcg->Read( pS );
-+}
-+
-+void Tcg::Print( FILE* fp )
-+{
-+ Indent a(true);
-+ indent_printf(fp, "[ 0x%x ] Tcg - dump %d\n", nOffSet, nTcgVer);
-+ indent_printf(fp," nTcgVer %d\n", nTcgVer);
-+ if ( tcg.get() )
-+ tcg->Print( fp );
-+}
-+
-+bool Tcg::ImportCustomToolBar( SfxObjectShell& rDocSh )
-+{
-+ if ( tcg.get() )
-+ return tcg->ImportCustomToolBar( rDocSh );
-+ return false;
-+}
-+
-+Tcg255::Tcg255()
-+{
-+}
-+
-+Tcg255::~Tcg255()
-+{
-+ std::vector< Tcg255SubStruct* >::iterator it = rgtcgData.begin();
-+ for ( ; it != rgtcgData.end(); ++it )
-+ delete *it;
-+}
-+
-+bool Tcg255::processSubStruct( sal_uInt8 nId, SvStream *pS )
-+{
-+ Tcg255SubStruct* pSubStruct = NULL;
-+ switch ( nId )
-+ {
-+ case 0x1:
-+ {
-+ pSubStruct = new PlfMcd( false ); // don't read the id
-+ break;
-+ }
-+ case 0x2:
-+ {
-+ pSubStruct = new PlfAcd( false );
-+ break;
-+ }
-+ case 0x3:
-+ case 0x4:
-+ {
-+ pSubStruct = new PlfKme( false );
-+ break;
-+ }
-+ case 0x10:
-+ {
-+ pSubStruct = new TcgSttbf( false );
-+ break;
-+ }
-+ case 0x11:
-+ {
-+ pSubStruct = new MacroNames( false );
-+ break;
-+ }
-+ case 0x12:
-+ {
-+ pSubStruct = new CTBWrapper( false );
-+ break;
-+ }
-+ default:
-+ OSL_TRACE("Unknown id 0x%x",nId);
-+ return false;
-+ }
-+ pSubStruct->ch = nId;
-+ if ( !pSubStruct->Read( pS ) )
-+ return false;
-+ rgtcgData.push_back( pSubStruct );
-+ return true;
-+}
-+
-+bool Tcg255::ImportCustomToolBar( SfxObjectShell& rDocSh )
-+{
-+ // Find the CTBWrapper
-+ for ( std::vector< Tcg255SubStruct* >::const_iterator it = rgtcgData.begin(); it != rgtcgData.end(); ++it )
-+ {
-+ if ( (*it)->id() == 0x12 )
-+ {
-+ // not so great, shouldn't really have to do a horror casting
-+ CTBWrapper* pCTBWrapper = dynamic_cast< CTBWrapper* > ( *it );
-+ if ( pCTBWrapper )
-+ {
-+ if ( !pCTBWrapper->ImportCustomToolBar( rDocSh ) )
-+ return false;
-+ }
-+ }
-+ }
-+ return true;
-+}
-+
-+
-+bool Tcg255::Read(SvStream *pS)
-+{
-+ OSL_TRACE("Tcg255::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ sal_uInt8 nId = 0; //
-+ *pS >> nId;
-+ while ( nId != 0x40 )
-+ {
-+ if ( !processSubStruct( nId, pS ) )
-+ return false;
-+ *pS >> nId;
-+ }
-+ return true;
-+ // Peek at
-+}
-+
-+void Tcg255::Print( FILE* fp)
-+{
-+ Indent a;
-+ indent_printf(fp, "[ 0x%x ] Tcg255 - dump\n", nOffSet );
-+ indent_printf(fp, " contains %d sub records\n", rgtcgData.size() );
-+ std::vector< Tcg255SubStruct* >::iterator it = rgtcgData.begin();
-+ std::vector< Tcg255SubStruct* >::iterator it_end = rgtcgData.end();
-+
-+ for( sal_Int32 count = 1; it != it_end ; ++it, ++count )
-+ {
-+ Indent b;
-+ indent_printf(fp, " [%d] Tcg255SubStruct \n", static_cast< unsigned int >( count ) );
-+ (*it)->Print(fp);
-+ }
-+}
-+
-+
-+Tcg255SubStruct::Tcg255SubStruct( bool bReadId ) : mbReadId( bReadId ), ch(0)
-+{
-+}
-+
-+bool Tcg255SubStruct::Read(SvStream *pS)
-+{
-+ OSL_TRACE("Tcg255SubStruct::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ if ( mbReadId )
-+ *pS >> ch;
-+ return true;
-+}
-+
-+PlfMcd::PlfMcd( bool bReadId ): Tcg255SubStruct( bReadId ), rgmcd( NULL )
-+{
-+}
-+PlfMcd::~PlfMcd()
-+{
-+ if ( rgmcd )
-+ delete[] rgmcd;
-+}
-+
-+bool PlfMcd::Read(SvStream *pS)
-+{
-+ OSL_TRACE("PffMcd::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ Tcg255SubStruct::Read( pS );
-+ *pS >> iMac;
-+ if ( iMac )
-+ {
-+ rgmcd = new MCD[ iMac ];
-+ for ( sal_Int32 index = 0; index < iMac; ++index )
-+ {
-+ if ( !rgmcd[ index ].Read( pS ) )
-+ return false;
-+ }
-+ }
-+ return true;
-+}
-+
-+void PlfMcd::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf(fp, "[ 0x%x ] PlfMcd ( Tcg255SubStruct ) - dump\n", nOffSet );
-+ indent_printf(fp, " contains %d MCD records\n", static_cast<int>( iMac ) );
-+ for ( sal_Int32 count=0; count < iMac; ++count )
-+ {
-+ Indent b;
-+ indent_printf(fp, "[%d] MCD\n", static_cast< int >( count ) );
-+ rgmcd[ count ].Print( fp );
-+ }
-+
-+}
-+
-+PlfAcd::PlfAcd( bool bReadId ) : Tcg255SubStruct( bReadId )
-+,iMac(0)
-+,rgacd(NULL)
-+{
-+}
-+
-+
-+PlfAcd::~PlfAcd()
-+{
-+ if ( rgacd )
-+ delete[] rgacd;
-+}
-+
-+bool PlfAcd::Read( SvStream *pS)
-+{
-+ OSL_TRACE("PffAcd::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ Tcg255SubStruct::Read( pS );
-+ *pS >> iMac;
-+ if ( iMac )
-+ {
-+ rgacd = new Acd[ iMac ];
-+ for ( sal_Int32 index = 0; index < iMac; ++index )
-+ {
-+ if ( !rgacd[ index ].Read( pS ) )
-+ return false;
-+ }
-+ }
-+ return true;
-+}
-+void PlfAcd::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf(fp, "[ 0x%x ] PlfAcd ( Tcg255SubStruct ) - dump\n", nOffSet );
-+ indent_printf(fp, " contains %d ACD records\n", static_cast< int >( iMac ) );
-+ for ( sal_Int32 count=0; count < iMac; ++count )
-+ {
-+ Indent b;
-+ indent_printf(fp, "[%d] ACD\n", static_cast< int >( count ) );
-+ rgacd[ count ].Print( fp );
-+ }
-+
-+}
-+
-+PlfKme::PlfKme( bool bReadId ) : Tcg255SubStruct( bReadId )
-+,iMac( 0 )
-+,rgkme( NULL )
-+{
-+}
-+
-+PlfKme::~PlfKme()
-+{
-+ if ( rgkme )
-+ delete[] rgkme;
-+}
-+
-+bool PlfKme::Read(SvStream *pS)
-+{
-+ OSL_TRACE("PlfKme::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ Tcg255SubStruct::Read( pS );
-+ *pS >> iMac;
-+ if ( iMac )
-+ {
-+ rgkme = new Kme[ iMac ];
-+ for( sal_Int32 index=0; index<iMac; ++index )
-+ {
-+ if ( !rgkme[ index ].Read( pS ) )
-+ return false;
-+ }
-+ }
-+ return true;
-+}
-+
-+void PlfKme::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf(fp, "[ 0x%x ] PlfKme ( Tcg255SubStruct ) - dump\n", nOffSet );
-+ indent_printf(fp, " contains %d Kme records\n", static_cast< int >( iMac ) );
-+ for ( sal_Int32 count=0; count < iMac; ++count )
-+ {
-+ Indent b;
-+ indent_printf(fp, "[%d] Kme\n", static_cast< int >( count ) );
-+ rgkme[ count ].Print( fp );
-+ }
-+
-+}
-+
-+TcgSttbf::TcgSttbf( bool bReadId ) : Tcg255SubStruct( bReadId )
-+{
-+}
-+
-+bool TcgSttbf::Read( SvStream *pS)
-+{
-+ OSL_TRACE("TcgSttbf::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ Tcg255SubStruct::Read( pS );
-+ return sttbf.Read( pS );
-+}
-+
-+void TcgSttbf::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf(fp,"[ 0x%x ] TcgSttbf - dump\n", nOffSet );
-+ sttbf.Print( fp );
-+}
-+
-+TcgSttbfCore::TcgSttbfCore() : fExtend( 0 )
-+,cData( 0 )
-+,cbExtra( 0 )
-+,dataItems( NULL )
-+{
-+}
-+
-+TcgSttbfCore::~TcgSttbfCore()
-+{
-+ if ( dataItems )
-+ delete[] dataItems;
-+}
-+
-+bool TcgSttbfCore::Read( SvStream* pS )
-+{
-+ OSL_TRACE("TcgSttbfCore::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> fExtend >> cData >> cbExtra;
-+ if ( cData )
-+ {
-+ dataItems = new SBBItem[ cData ];
-+ for ( sal_Int32 index = 0; index < cData; ++index )
-+ {
-+ *pS >> dataItems[ index ].cchData;
-+ dataItems[ index ].data = readUnicodeString( pS, dataItems[ index ].cchData );
-+ *pS >> dataItems[ index ].extraData;
-+ }
-+ }
-+ return true;
-+}
-+
-+void TcgSttbfCore::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf( fp, "[ 0x%x ] TcgSttbfCore - dump\n");
-+ indent_printf( fp, " fExtend 0x%x [expected 0xFFFF ]\n", fExtend );
-+ indent_printf( fp, " cbExtra 0x%x [expected 0x02 ]\n", cbExtra );
-+ indent_printf( fp, " cData no. or string data items %d (0x%x)\n", cData, cData );
-+
-+ if ( cData )
-+ {
-+ for ( sal_Int32 index = 0; index < cData; ++index )
-+ indent_printf(fp," string dataItem[ %d(0x%x) ] has name %s and if referenced %d times.\n", static_cast< int >( index ), static_cast< unsigned int >( index ), rtl::OUStringToOString( dataItems[ index ].data, RTL_TEXTENCODING_UTF8 ).getStr(), dataItems[ index ].extraData );
-+ }
-+
-+}
-+MacroNames::MacroNames( bool bReadId ) : Tcg255SubStruct( bReadId )
-+,iMac( 0 )
-+,rgNames( NULL )
-+{
-+}
-+
-+MacroNames::~MacroNames()
-+{
-+ if ( rgNames )
-+ delete[] rgNames;
-+}
-+
-+bool MacroNames::Read( SvStream *pS)
-+{
-+ OSL_TRACE("MacroNames::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ Tcg255SubStruct::Read( pS );
-+ *pS >> iMac;
-+ if ( iMac )
-+ {
-+ rgNames = new MacroName[ iMac ];
-+ for ( sal_Int32 index = 0; index < iMac; ++index )
-+ {
-+ if ( !rgNames[ index ].Read( pS ) )
-+ return false;
-+ }
-+ }
-+ return true;
-+}
-+
-+void MacroNames::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf(fp, "[ 0x%x ] MacroNames ( Tcg255SubStruct ) - dump\n");
-+ indent_printf(fp, " contains %d MacroName records\n", iMac );
-+ for ( sal_Int32 count=0; count < iMac; ++count )
-+ {
-+ Indent b;
-+ indent_printf(fp, "[%d] MacroName\n", static_cast<int>( count ) );
-+ rgNames[ count ].Print( fp );
-+ }
-+
-+}
-+
-+MacroName::MacroName():ibst(0)
-+{
-+}
-+
-+
-+bool MacroName::Read(SvStream *pS)
-+{
-+ OSL_TRACE("MacroName::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> ibst;
-+ return xstz.Read( pS );
-+}
-+
-+void MacroName::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf( fp, "[ 0x%x ] MacroName - dump");
-+ indent_printf( fp," index - 0x%x has associated following record\n", ibst );
-+ xstz.Print( fp );
-+}
-+
-+
-+
-+Xstz::Xstz():chTerm(0)
-+{
-+}
-+
-+bool
-+Xstz::Read(SvStream *pS)
-+{
-+ OSL_TRACE("Xstz::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ if ( !xst.Read( pS ) )
-+ return false;
-+ *pS >> chTerm;
-+ if ( chTerm != 0 ) // should be an assert
-+ return false;
-+ return true;
-+}
-+
-+void Xstz::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf(fp,"[ 0x%x ] Xstz -- dump\n", nOffSet );
-+ indent_printf(fp," Xst\n");
-+ xst.Print( fp );
-+ indent_printf(fp," chterm 0x%x ( should be zero )\n", chTerm);
-+}
-+
-+Kme::Kme() : reserved1(0)
-+,reserved2(0)
-+,kcm1(0)
-+,kcm2(0)
-+,kt(0)
-+,param(0)
-+{
-+}
-+
-+Kme::~Kme()
-+{
-+}
-+
-+bool
-+Kme::Read(SvStream *pS)
-+{
-+ OSL_TRACE("Kme::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> reserved1 >> reserved2 >> kcm1 >> kcm2 >> kt >> param;
-+ return true;
-+}
-+
-+void Kme::Print( FILE* fp )
-+{
-+ Indent a;
-+
-+ indent_printf( fp, "[ 0x%x ] Kme - dump\n", nOffSet );
-+ indent_printf( fp, " reserved1 0x%x [expected 0x0 ]\n", reserved1 );
-+ indent_printf( fp, " reserved2 0x%x [expected 0x0 ]\n", reserved2 );
-+ indent_printf( fp, " kcm1 0x%x [shortcut key]\n", kcm1 );
-+ indent_printf( fp, " kcm2 0x%x [shortcut key]\n", kcm2 );
-+ indent_printf( fp, " kt 0x%x \n", kt );
-+ indent_printf( fp, " param 0x%x \n", static_cast< unsigned int >( param ) );
-+}
-+
-+Acd::Acd() : ibst( 0 )
-+, fciBasedOnABC( 0 )
-+{
-+}
-+
-+bool Acd::Read(SvStream *pS)
-+{
-+ OSL_TRACE("Acd::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> ibst >> fciBasedOnABC;
-+ return true;
-+}
-+
-+void Acd::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf( fp,"[ 0x%x ] ACD - dump\n", nOffSet );
-+ // #TODO flesh out interpretation of these values
-+ indent_printf( fp," ibst 0x%x\n", ibst);
-+ indent_printf( fp," fciBaseObABC 0x%x\n", fciBasedOnABC);
-+}
-+
-+MCD::MCD() : reserved1(0x56)
-+,reserved2( 0 )
-+,ibst( 0 )
-+,ibstName( 0 )
-+,reserved3( 0xFFFF )
-+,reserved4( 0 )
-+,reserved5( 0 )
-+,reserved6( 0 )
-+,reserved7( 0 )
-+{
-+}
-+
-+bool MCD::Read(SvStream *pS)
-+{
-+ OSL_TRACE("MCD::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> reserved1 >> reserved2 >> ibst >> ibstName >> reserved3;
-+ *pS >> reserved4 >> reserved5 >> reserved6 >> reserved7;
-+ return true;
-+}
-+
-+void MCD::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf( fp, "[ 0x%x ] MCD - dump\n", nOffSet );
-+ indent_printf( fp, " reserved1 0x%x [expected 0x56 ]\n", reserved1 );
-+ indent_printf( fp, " reserved2 0x%x [expected 0x0 ]\n", reserved2 );
-+ indent_printf( fp, " ibst 0x%x specifies macro with MacroName.xstz = 0x%x\n", ibst, ibst );
-+ indent_printf( fp, " ibstName 0x%x index into command string table ( TcgSttbf.sttbf )\n", ibstName );
-+
-+ indent_printf( fp, " reserved3 0x%x [expected 0xFFFF ]\n", reserved3 );
-+ indent_printf( fp, " reserved4 0x%x\n", static_cast< unsigned int >( reserved4 ) );
-+ indent_printf( fp, " reserved5 0x%x [expected 0x0 ]\n", static_cast< unsigned int >( reserved5 ) );
-+ indent_printf( fp, " reserved6 0x%x\n", static_cast< unsigned int >( reserved6 ) );
-+ indent_printf( fp, " reserved7 0x%x\n", static_cast< unsigned int >( reserved7 ) );
-+}
-+
-diff --git sw/source/filter/ww8/ww8toolbar.hxx sw/source/filter/ww8/ww8toolbar.hxx
-new file mode 100644
-index 0000000..a8b3342
---- /dev/null
-+++ sw/source/filter/ww8/ww8toolbar.hxx
-@@ -0,0 +1,347 @@
-+#ifndef _WW8TOOLBAR_HXX
-+#define _WW8TOOLBAR_HXX
-+
-+#include <filter/msfilter/mstoolbar.hxx>
-+
-+namespace css = ::com::sun::star;
-+
-+class Xst : public TBBase
-+{
-+ rtl::OUString sString;
-+public:
-+ Xst(){}
-+ bool Read(SvStream *pS);
-+ rtl::OUString getString() { return sString; }
-+ void Print( FILE* fp );
-+};
-+
-+class CTBWrapper;
-+class TBC : public TBBase
-+{
-+ TBCHeader tbch;
-+ boost::shared_ptr< sal_uInt32 > cid; // optional
-+ boost::shared_ptr<TBCData> tbcd;
-+public:
-+ TBC();
-+ ~TBC();
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+ bool ImportToolBarControl( CTBWrapper&, const css::uno::Reference< css::container::XIndexContainer >&, CustomToolBarImportHelper&, bool );
-+ rtl::OUString GetCustomText();
-+};
-+
-+class CTB : public TBBase
-+{
-+ Xst name;
-+ sal_Int32 cbTBData;
-+ TB tb;
-+ std::vector<TBVisualData> rVisualData;
-+ sal_Int32 iWCTBl;
-+ sal_uInt16 reserved;
-+ sal_uInt16 unused;
-+ sal_Int32 cCtls;
-+ std::vector< TBC > rTBC;
-+
-+ CTB(const CTB&);
-+ CTB& operator = ( const CTB&);
-+public:
-+ CTB();
-+ ~CTB();
-+ bool Read(SvStream *pS);
-+ void Print( FILE* fp );
-+ bool IsMenuToolbar();
-+ bool ImportCustomToolBar( CTBWrapper&, CustomToolBarImportHelper& );
-+ bool ImportMenuTB( CTBWrapper&, const css::uno::Reference< css::container::XIndexContainer >&, CustomToolBarImportHelper& );
-+ rtl::OUString GetName() { return tb.getName().getString(); }
-+};
-+
-+class TBDelta : public TBBase
-+{
-+ sal_uInt8 doprfatendFlags;
-+
-+ sal_uInt8 ibts;
-+ sal_Int32 cidNext;
-+ sal_Int32 cid;
-+ sal_Int32 fc;
-+ sal_uInt16 CiTBDE; // careful of this ( endian matters etc. )
-+ sal_uInt16 cbTBC;
-+public:
-+ TBDelta();
-+ ~TBDelta(){}
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+ bool ControlIsModified();
-+ bool ControlIsInserted();
-+ bool ControlIsChanged();
-+ bool ControlDropsToolBar();
-+ sal_Int32 TBCStreamOffset();
-+ sal_Int16 CustomizationIndex();
-+
-+};
-+
-+class Tcg255SubStruct : public TBBase
-+{
-+friend class Tcg255;
-+ bool mbReadId;
-+ Tcg255SubStruct(const Tcg255SubStruct&);
-+ Tcg255SubStruct& operator = ( const Tcg255SubStruct&);
-+protected:
-+ sal_uInt8 ch;
-+public:
-+ Tcg255SubStruct( bool bReadId );
-+ ~Tcg255SubStruct(){}
-+ virtual sal_uInt8 id() const { return ch; }
-+ bool Read(SvStream *pS);
-+};
-+
-+class CTBWrapper;
-+class Customization : public TBBase
-+{
-+friend class CTBWrapper;
-+ sal_Int32 tbidForTBD;
-+ sal_uInt16 reserved1;
-+ sal_Int16 ctbds;
-+ CTBWrapper* pWrapper;
-+ boost::shared_ptr< CTB > customizationDataCTB;
-+ std::vector< TBDelta > customizationDataTBDelta;
-+ bool bIsDroppedMenuTB;
-+ bool ImportMenu( CTBWrapper&, const css::uno::Reference< css::container::XIndexContainer >&, CustomToolBarImportHelper& );
-+public:
-+ Customization( CTBWrapper* rapper );
-+ ~Customization();
-+ bool Read(SvStream *pS);
-+ bool ImportCustomToolBar( CTBWrapper&, CustomToolBarImportHelper& );
-+ bool ImportMenu( CTBWrapper&, CustomToolBarImportHelper& );
-+ void Print( FILE* );
-+ sal_Int32 GetTBIDForTB(){ return tbidForTBD; }
-+ CTB* GetCustomizationData() { return customizationDataCTB.get(); };
-+};
-+
-+class SfxObjectShell;
-+
-+class CTBWrapper : public Tcg255SubStruct
-+{
-+ // reserved1 is the ch field of Tcg255SubStruct
-+ sal_uInt16 reserved2;
-+ sal_uInt8 reserved3;
-+ sal_uInt16 reserved4;
-+ sal_uInt16 reserved5;
-+
-+ sal_Int16 cbTBD;
-+ sal_Int16 cCust;
-+
-+ sal_Int32 cbDTBC;
-+
-+ std::vector< TBC > rtbdc; //
-+ std::vector< Customization > rCustomizations; // array of Customizations
-+ std::vector< sal_Int16 > dropDownMenuIndices; // array of indexes of Customization toolbars that are dropped by a menu
-+ CTBWrapper(const CTBWrapper&);
-+ CTBWrapper& operator = ( const CTBWrapper&);
-+public:
-+ CTBWrapper( bool bReadId = true );
-+ ~CTBWrapper();
-+ void InsertDropIndex( sal_Int32 aIndex ) { dropDownMenuIndices.push_back( aIndex ); }
-+ TBC* GetTBCAtOffset( sal_uInt32 nStreamOffset );
-+ bool Read(SvStream *pS);
-+ bool ImportCustomToolBar( SfxObjectShell& rDocSh );
-+
-+ Customization* GetCustomizaton( sal_Int16 index );
-+ CTB* GetCustomizationData( const rtl::OUString& name );
-+ void Print( FILE* );
-+};
-+
-+class MCD : public TBBase
-+{
-+ sal_Int8 reserved1; // A signed integer that MUST be 0x56.
-+ sal_uInt8 reserved2; // MUST be 0.
-+ sal_uInt16 ibst; // Unsigned integer that specifies the name of the macro. Macro name is specified by MacroName.xstz of the MacroName entry in the MacroNames such that MacroName.ibst equals ibst. MacroNames MUST contain such an entry.
-+ sal_uInt16 ibstName; // An unsigned integer that specifies the index into the Command String Table (TcgSttbf.sttbf) where the macro‘s name and arguments are specified.
-+ sal_uInt16 reserved3; // An unsigned integer that MUST be 0xFFFF.
-+ sal_uInt32 reserved4; //MUST be ignored.
-+ sal_uInt32 reserved5; //MUST be 0.
-+ sal_uInt32 reserved6; //MUST be ignored.
-+ sal_uInt32 reserved7; //MUST be ignored
-+
-+ MCD(const MCD&);
-+ MCD& operator = ( const MCD&);
-+public:
-+ MCD();
-+ ~MCD(){}
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+};
-+
-+class PlfMcd : public Tcg255SubStruct
-+{
-+ sal_Int32 iMac;
-+ MCD* rgmcd; // array of MCD's
-+ PlfMcd(const PlfMcd&);
-+ PlfMcd& operator = ( const PlfMcd&);
-+public:
-+ PlfMcd( bool bReadId = true );
-+ ~PlfMcd();
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+};
-+
-+class Acd : public TBBase
-+{
-+ sal_Int16 ibst;
-+ sal_uInt16 fciBasedOnABC; // fciBasedOn(13 bits) A(1bit)B(1bit)C(1Bit)
-+ Acd(const Acd&);
-+ Acd& operator = ( const Acd&);
-+public:
-+ Acd();
-+ ~Acd(){}
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+};
-+
-+class PlfAcd: public Tcg255SubStruct
-+{
-+ sal_Int32 iMac;
-+ Acd* rgacd;
-+ PlfAcd(const PlfAcd&);
-+ PlfAcd& operator = ( const PlfAcd&);
-+public:
-+ PlfAcd( bool bReadId = true );
-+ ~PlfAcd();
-+ bool Read(SvStream *pS);
-+ void Print(FILE*);
-+};
-+
-+class Kme : public TBBase
-+{
-+ sal_Int16 reserved1; //MUST be zero.
-+ sal_Int16 reserved2; //MUST be zero.
-+ sal_uInt16 kcm1; //A Kcm that specifies the primary shortcut key.
-+ sal_uInt16 kcm2; //A Kcm that specifies the secondary shortcut key, or 0x00FF if there is no secondary shortcut key.
-+ sal_uInt16 kt; //A Kt that specifies the type of action to be taken when the key combination is pressed.
-+ sal_uInt32 param; //The meaning of this field depends on the value of kt
-+
-+ Kme(const Kme&);
-+ Kme& operator = ( const Kme&);
-+public:
-+ Kme();
-+ ~Kme();
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+};
-+
-+class PlfKme : public Tcg255SubStruct
-+{
-+ sal_Int32 iMac;
-+ Kme* rgkme;
-+ PlfKme(const PlfKme&);
-+ PlfKme& operator = ( const PlfKme&);
-+public:
-+ PlfKme( bool bReadId = true );
-+ ~PlfKme();
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+};
-+
-+class TcgSttbfCore : public TBBase
-+{
-+struct SBBItem
-+{
-+ sal_uInt16 cchData;
-+ rtl::OUString data;
-+ sal_uInt16 extraData;
-+ SBBItem() : cchData(0), extraData(0){}
-+};
-+ sal_uInt16 fExtend;
-+ sal_uInt16 cData;
-+ sal_uInt16 cbExtra;
-+ SBBItem* dataItems;
-+ TcgSttbfCore(const TcgSttbfCore&);
-+ TcgSttbfCore& operator = ( const TcgSttbfCore&);
-+public:
-+ TcgSttbfCore();
-+ ~TcgSttbfCore();
-+ bool Read(SvStream *pS);
-+ void Print( FILE* fp );
-+};
-+
-+class TcgSttbf : public Tcg255SubStruct
-+{
-+ TcgSttbfCore sttbf;
-+ TcgSttbf(const TcgSttbf&);
-+ TcgSttbf& operator = ( const TcgSttbf&);
-+public:
-+ TcgSttbf( bool bReadId = true );
-+ ~TcgSttbf(){}
-+ bool Read(SvStream *pS);
-+ void Print( FILE* fp );
-+};
-+
-+class Xstz : public TBBase
-+{
-+ Xst xst; //An Xst specifying the string with its pre-pended length.
-+ sal_uInt16 chTerm;
-+
-+ Xstz(const Xstz&);
-+ Xstz& operator = ( const Xstz&);
-+public:
-+ Xstz();
-+ ~Xstz(){}
-+ bool Read(SvStream *pS);
-+ void Print( FILE* fp );
-+};
-+
-+class MacroName : public TBBase
-+{
-+ sal_uInt16 ibst; //An unsigned integer that specifies the index of the current entry in the macro name table. MUST NOT be the same as the index of any other entry.
-+ Xstz xstz;
-+ MacroName(const MacroName&);
-+ MacroName& operator = ( const MacroName&);
-+public:
-+ MacroName();
-+ ~MacroName(){}
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+};
-+
-+class MacroNames : public Tcg255SubStruct
-+{
-+ sal_uInt16 iMac; //An unsigned integer that specifies the number of MacroName structures in rgNames.
-+ MacroName* rgNames;
-+
-+ MacroNames(const MacroNames&);
-+ MacroNames& operator = ( const MacroNames&);
-+public:
-+ MacroNames( bool bReadId = true );
-+ ~MacroNames();
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+};
-+
-+class Tcg255 : public TBBase
-+{
-+ std::vector< Tcg255SubStruct* > rgtcgData; // array of sub structures
-+ Tcg255(const Tcg255&);
-+ Tcg255& operator = ( const Tcg255&);
-+ bool processSubStruct( sal_uInt8 nId, SvStream* );
-+public:
-+ Tcg255();
-+ ~Tcg255();
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+ bool ImportCustomToolBar( SfxObjectShell& rDocSh );
-+};
-+
-+class Tcg: public TBBase
-+{
-+ sal_Int8 nTcgVer;
-+ std::auto_ptr< Tcg255 > tcg;
-+ Tcg(const Tcg&);
-+ Tcg& operator = ( const Tcg&);
-+public:
-+ Tcg();
-+ ~Tcg(){}
-+ bool Read(SvStream *pS);
-+ bool ImportCustomToolBar( SfxObjectShell& rDocSh );
-+ void Print( FILE* );
-+};
-+
-+#endif
-diff --git sw/source/ui/app/docsh.cxx sw/source/ui/app/docsh.cxx
-index 5a1b860..190c301 100755
---- sw/source/ui/app/docsh.cxx
-+++ sw/source/ui/app/docsh.cxx
-@@ -491,13 +491,6 @@ sal_Bool SwDocShell::SaveAs( SfxMedium& rMedium )
- xDocSh->DoClose();
- }
-
-- if( pDoc->ContainsMSVBasic() )
-- {
-- if( SvtFilterOptions::Get()->IsLoadWordBasicStorage() )
-- nVBWarning = GetSaveWarningOfMSVBAStorage( (SfxObjectShell&) *this );
-- pDoc->SetContainsMSVBasic( FALSE );
-- }
--
- // TabellenBox Edit beenden!
- if( pWrtShell )
- pWrtShell->EndAllTblBoxEdit();
-diff --git sw/source/ui/app/docsh2.cxx sw/source/ui/app/docsh2.cxx
-index b0ae693..fa9765e 100644
---- sw/source/ui/app/docsh2.cxx
-+++ sw/source/ui/app/docsh2.cxx
-@@ -119,10 +119,8 @@
- #include <com/sun/star/ui/dialogs/ListboxControlActions.hpp>
- #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp>
- #include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
--#ifdef FUTURE_VBA
- #include <com/sun/star/script/vba/XVBAEventProcessor.hpp>
- #include <com/sun/star/script/vba/VBAEventId.hpp>
--#endif
- #include <editeng/acorrcfg.hxx>
- #include <SwStyleNameMapper.hxx>
-
-@@ -190,7 +188,6 @@ void SwDocShell::DoFlushDocInfo()
- }
- }
-
--#ifdef FUTURE_VBA
- void lcl_processCompatibleSfxHint( const uno::Reference< script::vba::XVBAEventProcessor >& xVbaEvents, const SfxHint& rHint )
- {
- using namespace com::sun::star::script::vba::VBAEventId;
-@@ -209,7 +206,6 @@ void lcl_processCompatibleSfxHint( const uno::Reference< script::vba::XVBAEventP
- }
- }
- }
--#endif
-
- /*--------------------------------------------------------------------
- Beschreibung: Benachrichtigung bei geaenderter DocInfo
-@@ -224,11 +220,9 @@ void SwDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
- return ;
- }
-
--#ifdef FUTURE_VBA
- uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents = pDoc->GetVbaEventProcessor();
- if( xVbaEvents.is() )
- lcl_processCompatibleSfxHint( xVbaEvents, rHint );
--#endif
-
- USHORT nAction = 0;
- if( rHint.ISA(SfxSimpleHint) )
-@@ -311,7 +305,6 @@ USHORT SwDocShell::PrepareClose( BOOL bUI, BOOL bForBrowsing )
- if( TRUE == nRet ) //Unbedingt auf TRUE abfragen! (RET_NEWTASK)
- EndListening( *this );
-
--#ifdef FUTURE_VBA
- if( pDoc && IsInPrepareClose() )
- {
- uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents = pDoc->GetVbaEventProcessor();
-@@ -322,7 +315,6 @@ USHORT SwDocShell::PrepareClose( BOOL bUI, BOOL bForBrowsing )
- xVbaEvents->processVbaEvent( DOCUMENT_CLOSE, aArgs );
- }
- }
--#endif
- return nRet;
- }
-
-@@ -1531,6 +1523,34 @@ void SwDocShell::Execute(SfxRequest& rReq)
- }
- }
-
-+ // #FIXME - align with NEW event stuff ( if possible )
-+#if 0
-+void lcl_processCompatibleSfxHint( const uno::Reference< document::XVbaEventsHelper >& xVbaEventsHelper, const SfxHint& rHint )
-+{
-+ if ( rHint.ISA( SfxEventHint ) )
-+ {
-+ uno::Sequence< uno::Any > aArgs;
-+ ULONG nEventId = ((SfxEventHint&)rHint).GetEventId();
-+ switch( nEventId )
-+ {
-+ case SFX_EVENT_CREATEDOC:
-+ {
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_DOCUMENT_NEW, aArgs );
-+ break;
-+ }
-+ case SFX_EVENT_OPENDOC:
-+ {
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_DOCUMENT_OPEN, aArgs );
-+ break;
-+ }
-+ default:
-+ {
-+ //do nothing
-+ }
-+ }
-+ }
-+}
-+#endif
-
- /*--------------------------------------------------------------------
- Beschreibung:
-@@ -1587,6 +1604,12 @@ void SwDocShell::FillClass( SvGlobalName * pClassName,
- *pClipFormat = bTemplate ? SOT_FORMATSTR_ID_STARWRITER_8_TEMPLATE : SOT_FORMATSTR_ID_STARWRITER_8;
- *pLongUserName = SW_RESSTR(STR_WRITER_DOCUMENT_FULLTYPE);
- }
-+// #FIXME check with new Event handling
-+#if 0
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper = pDoc->GetVbaEventsHelper();
-+ if( xVbaEventsHelper.is() )
-+ lcl_processCompatibleSfxHint( xVbaEventsHelper, rHint );
-+#endif
-
- *pUserName = SW_RESSTR(STR_HUMAN_SWDOC_NAME);
- }
-diff --git sw/source/ui/uno/unotxdoc.cxx sw/source/ui/uno/unotxdoc.cxx
-index e3f1322..94a850b 100644
---- sw/source/ui/uno/unotxdoc.cxx
-+++ sw/source/ui/uno/unotxdoc.cxx
-@@ -178,6 +178,8 @@ using ::osl::FileBase;
- #define SW_CREATE_MARKER_TABLE 0x06
- #define SW_CREATE_DRAW_DEFAULTS 0x07
-
-+#include <comphelper/processfactory.hxx>
-+
- extern bool lcl_GetPostIts( IDocumentFieldsAccess* pIDFA, _SetGetExpFlds * pSrtLst );
-
- SwPrintUIOptions * lcl_GetPrintUIOptions(
-@@ -256,6 +257,12 @@ sal_Int64 SAL_CALL SwXTextDocument::getSomething( const Sequence< sal_Int8 >& rI
- {
- return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this ));
- }
-+ if( rId.getLength() == 16
-+ && 0 == rtl_compareMemory( SfxObjectShell::getUnoTunnelId().getConstArray(),
-+ rId.getConstArray(), 16 ) )
-+ {
-+ return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(pDocShell ));
-+ }
-
- sal_Int64 nRet = SfxBaseModel::getSomething( rId );
- if ( nRet )
-@@ -404,6 +411,9 @@ SwXTextDocument::SwXTextDocument(SwDocShell* pShell) :
- m_pPrintUIOptions( NULL ),
- m_pRenderData( NULL )
- {
-+ uno::Reference< document::XDocumentProperties > xWriterProps( ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.writer.DocumentProperties") ), uno::UNO_QUERY_THROW);
-+
-+ SfxBaseModel::setDocumentProperties( xWriterProps );
- }
-
- SwXTextDocument::~SwXTextDocument()
-@@ -2173,6 +2183,9 @@ Any SwXTextDocument::getPropertyValue(const OUString& rPropertyName)
- Any aAny;
- switch(pEntry->nWID)
- {
-+ case WID_DOC_ISTEMPLATEID :
-+ aAny <<= pDocShell->IsTemplate();
-+ break;
- case WID_DOC_CHAR_COUNT :
- case WID_DOC_PARA_COUNT :
- case WID_DOC_WORD_COUNT :
-@@ -2281,6 +2294,14 @@ Any SwXTextDocument::getPropertyValue(const OUString& rPropertyName)
- case WID_DOC_DIALOG_LIBRARIES:
- aAny <<= pDocShell->GetDialogContainer();
- break;
-+ case WID_DOC_VBA_DOCOBJ:
-+ {
-+ beans::PropertyValue aProp;
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ThisWordDoc") );
-+ aProp.Value <<= pDocShell->GetModel();
-+ aAny <<= aProp;
-+ }
-+ break;
- case WID_DOC_RUNTIME_UID:
- aAny <<= getRuntimeUID();
- break;
-@@ -3189,6 +3210,7 @@ uno::Sequence< lang::Locale > SAL_CALL SwXTextDocument::getDocumentLanguages(
- {
- ::vos::OGuard aGuard(Application::GetSolarMutex());
-
-+
- // possible canonical values for nScriptTypes
- // any bit wise combination is allowed
- const sal_Int16 nLatin = 0x001;
-diff --git sw/source/ui/vba/makefile.mk sw/source/ui/vba/makefile.mk
-index b6d0d79..b0fb0f4 100644
---- sw/source/ui/vba/makefile.mk
-+++ sw/source/ui/vba/makefile.mk
-@@ -82,6 +82,7 @@ SLOFILES= \
- $(SLO)$/vbaborders.obj \
- $(SLO)$/vbadocuments.obj \
- $(SLO)$/vbaheaderfooter.obj \
-+ $(SLO)$/vbaheadersfooters.obj \
- $(SLO)$/vbaheaderfooterhelper.obj \
- $(SLO)$/vbaaddin.obj \
- $(SLO)$/vbaaddins.obj \
-@@ -91,6 +92,29 @@ SLOFILES= \
- $(SLO)$/vbapagesetup.obj \
- $(SLO)$/vbasection.obj \
- $(SLO)$/vbasections.obj \
-+ $(SLO)$/vbarow.obj \
-+ $(SLO)$/vbarows.obj \
-+ $(SLO)$/vbacolumn.obj \
-+ $(SLO)$/vbacolumns.obj \
-+ $(SLO)$/vbatablehelper.obj \
-+ $(SLO)$/vbacell.obj \
-+ $(SLO)$/vbacells.obj \
-+ $(SLO)$/vbatabstop.obj \
-+ $(SLO)$/vbatabstops.obj \
-+ $(SLO)$/vbatableofcontents.obj \
-+ $(SLO)$/vbatablesofcontents.obj \
-+ $(SLO)$/vbalistgallery.obj \
-+ $(SLO)$/vbalistgalleries.obj \
-+ $(SLO)$/vbalisthelper.obj \
-+ $(SLO)$/vbalisttemplate.obj \
-+ $(SLO)$/vbalisttemplates.obj \
-+ $(SLO)$/vbalistlevel.obj \
-+ $(SLO)$/vbalistlevels.obj \
-+ $(SLO)$/vbalistformat.obj \
-+ $(SLO)$/vbarevision.obj \
-+ $(SLO)$/vbarevisions.obj \
-+ $(SLO)$/vbaframe.obj \
-+ $(SLO)$/vbaframes.obj \
- $(SLO)$/vbaeventshelper.obj \
-
- # --- Targets ------------------------------------------------------
-diff --git sw/source/ui/vba/service.cxx sw/source/ui/vba/service.cxx
-index 8200e32..a80a69a 100644
---- sw/source/ui/vba/service.cxx
-+++ sw/source/ui/vba/service.cxx
-@@ -57,6 +57,11 @@ namespace vbaeventshelper
- extern sdecl::ServiceDecl const serviceDecl;
- }
-
-+namespace vbaeventshelper
-+{
-+extern sdecl::ServiceDecl const serviceDecl;
-+}
-+
- extern "C"
- {
- void SAL_CALL component_getImplementationEnvironment(
-diff --git sw/source/ui/vba/vbaapplication.cxx sw/source/ui/vba/vbaapplication.cxx
-index fd815b2..4ce05bc 100644
---- sw/source/ui/vba/vbaapplication.cxx
-+++ sw/source/ui/vba/vbaapplication.cxx
-@@ -40,6 +40,7 @@
- #include <editeng/acorrcfg.hxx>
- #include "wordvbahelper.hxx"
- #include <docsh.hxx>
-+#include "vbalistgalleries.hxx"
-
- using namespace ::ooo;
- using namespace ::ooo::vba;
-@@ -151,6 +152,16 @@ SwVbaApplication::Dialogs( const uno::Any& index ) throw (uno::RuntimeException)
- return uno::makeAny( xCol );
- }
-
-+uno::Any SAL_CALL
-+SwVbaApplication::ListGalleries( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< text::XTextDocument > xTextDoc( getCurrentDocument(), uno::UNO_QUERY_THROW );
-+ uno::Reference< XCollection > xCol( new SwVbaListGalleries( this, mxContext, xTextDoc ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
- sal_Bool SAL_CALL SwVbaApplication::getDisplayAutoCompleteTips() throw (css::uno::RuntimeException)
- {
- return SvxAutoCorrCfg::Get()->IsAutoTextTip();
-diff --git sw/source/ui/vba/vbaapplication.hxx sw/source/ui/vba/vbaapplication.hxx
-index 66f9bca..2f4d912 100644
---- sw/source/ui/vba/vbaapplication.hxx
-+++ sw/source/ui/vba/vbaapplication.hxx
-@@ -60,6 +60,7 @@ public:
- virtual css::uno::Any SAL_CALL Documents( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Addins( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Dialogs( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL ListGalleries( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getDisplayAutoCompleteTips() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setDisplayAutoCompleteTips( sal_Bool _displayAutoCompleteTips ) throw (css::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getEnableCancelKey() throw (css::uno::RuntimeException);
-diff --git sw/source/ui/vba/vbaautotextentry.cxx sw/source/ui/vba/vbaautotextentry.cxx
-index 5d098a2..8c92627 100644
---- sw/source/ui/vba/vbaautotextentry.cxx
-+++ sw/source/ui/vba/vbaautotextentry.cxx
-@@ -26,7 +26,9 @@
- ************************************************************************/
- #include "vbaautotextentry.hxx"
- #include <vbahelper/vbahelper.hxx>
-+#include <com/sun/star/text/XParagraphCursor.hpp>
- #include <tools/diagnose_ex.h>
-+#include "wordvbahelper.hxx"
- #include "vbarange.hxx"
-
- using namespace ::ooo::vba;
-@@ -41,7 +43,7 @@ SwVbaAutoTextEntry::~SwVbaAutoTextEntry()
- {
- }
-
--uno::Reference< word::XRange > SAL_CALL SwVbaAutoTextEntry::Insert( const uno::Reference< word::XRange >& _where, const uno::Any& /*_richtext*/ ) throw ( uno::RuntimeException )
-+uno::Reference< word::XRange > SAL_CALL SwVbaAutoTextEntry::Insert( const uno::Reference< word::XRange >& _where, const uno::Any& _richtext ) throw ( uno::RuntimeException )
- {
- SwVbaRange* pWhere = dynamic_cast<SwVbaRange*>( _where.get() );
- if( pWhere )
-@@ -55,8 +57,28 @@ uno::Reference< word::XRange > SAL_CALL SwVbaAutoTextEntry::Insert( const uno::R
- uno::Reference< text::XTextCursor > xTC = xText->createTextCursorByRange( xTextRange->getStart() );
- xTC->goRight( 1, sal_True );
- xTC->setString( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("") ) ); // remove marker
-+ // remove the blank paragraph if it is a rich text
-+ sal_Bool bRich = sal_False;
-+ _richtext >>= bRich;
-+ if( bRich )
-+ {
-+ // check if it is a blank paragraph
-+ uno::Reference< text::XParagraphCursor > xParaCursor( xTC, uno::UNO_QUERY_THROW );
-+ if( xParaCursor->isStartOfParagraph() && xParaCursor->isEndOfParagraph() )
-+ {
-+ //remove the blank paragraph
-+ uno::Reference< frame::XModel > xModel( getCurrentWordDoc( mxContext ), uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextViewCursor > xTVCursor = word::getXTextViewCursor( xModel );
-+ uno::Reference< text::XTextRange > xCurrentRange( xTC->getEnd(), uno::UNO_QUERY_THROW );
-+ xTVCursor->gotoRange( xCurrentRange, sal_False );
-+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Delete"));
-+ dispatchRequests( xModel,url );
-+ xTVCursor->gotoRange( xEndMarker->getEnd(), sal_False );
-+ }
-+ }
- xEndMarker->setString( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("") ) ); // remove marker
-- xTC->gotoRange( xEndMarker, sal_True );
-+ //xTC->gotoRange( xEndMarker, sal_True );
-+ xTC = xText->createTextCursorByRange( xEndMarker->getEnd() );
- pWhere->setXTextCursor( xTC );
- }
- return uno::Reference< word::XRange >( pWhere );
-@@ -95,8 +117,9 @@ SwVbaAutoTextEntries::getElementType() throw (uno::RuntimeException)
- uno::Reference< container::XEnumeration >
- SwVbaAutoTextEntries::createEnumeration() throw (uno::RuntimeException)
- {
-- uno::Reference< container::XEnumerationAccess > xEnumerationAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
-- return xEnumerationAccess->createEnumeration();
-+ //uno::Reference< container::XEnumerationAccess > xEnumerationAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
-+ //return xEnumerationAccess->createEnumeration();
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
- }
-
- uno::Any
-diff --git sw/source/ui/vba/vbabookmark.cxx sw/source/ui/vba/vbabookmark.cxx
-index bb67fac..f5ff0fe 100644
---- sw/source/ui/vba/vbabookmark.cxx
-+++ sw/source/ui/vba/vbabookmark.cxx
-@@ -29,9 +29,12 @@
- #include <tools/diagnose_ex.h>
- #include <com/sun/star/text/XTextDocument.hpp>
- #include <com/sun/star/text/XTextContent.hpp>
-+#include <com/sun/star/text/XTextRange.hpp>
- #include <com/sun/star/text/XTextViewCursor.hpp>
- #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
-+#include <com/sun/star/view/XSelectionSupplier.hpp>
- #include "vbarange.hxx"
-+#include "wordvbahelper.hxx"
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-@@ -65,8 +68,8 @@ void SAL_CALL SwVbaBookmark::Delete() throw ( uno::RuntimeException )
- void SAL_CALL SwVbaBookmark::Select() throw ( uno::RuntimeException )
- {
- checkVality();
-- uno::Reference< text::XTextViewCursorSupplier > xViewCursorSupplier( mxModel->getCurrentController(), uno::UNO_QUERY_THROW );
-- xViewCursorSupplier->getViewCursor()->gotoRange( mxBookmark->getAnchor(),sal_False );
-+ uno::Reference< view::XSelectionSupplier > xSelectSupp( mxModel->getCurrentController(), uno::UNO_QUERY_THROW );
-+ xSelectSupp->select( uno::makeAny( mxBookmark ) );
- }
-
- rtl::OUString SAL_CALL SwVbaBookmark::getName() throw ( uno::RuntimeException )
-diff --git sw/source/ui/vba/vbabookmarks.cxx sw/source/ui/vba/vbabookmarks.cxx
-index bccfeef..841b7e7 100644
---- sw/source/ui/vba/vbabookmarks.cxx
-+++ sw/source/ui/vba/vbabookmarks.cxx
-@@ -118,8 +118,7 @@ SwVbaBookmarks::SwVbaBookmarks( const uno::Reference< XHelperInterface >& xParen
- mxBookmarksSupplier.set( mxModel, uno::UNO_QUERY_THROW );
- uno::Reference< text::XTextDocument > xDocument( mxModel, uno::UNO_QUERY_THROW );
- // use view cursor to insert bookmark, or it will fail if insert bookmark in table
-- // mxText = xDocument->getText();
-- mxText = word::getXTextViewCursor( mxModel )->getText();
-+ //mxText = word::getXTextViewCursor( mxModel )->getText();
- }
- // XEnumerationAccess
- uno::Type
-@@ -145,16 +144,16 @@ SwVbaBookmarks::createCollectionObject( const css::uno::Any& aSource )
- void SwVbaBookmarks::removeBookmarkByName( const rtl::OUString& rName ) throw (uno::RuntimeException)
- {
- uno::Reference< text::XTextContent > xBookmark( m_xNameAccess->getByName( rName ), uno::UNO_QUERY_THROW );
-- mxText->removeTextContent( xBookmark );
-+ word::getXTextViewCursor( mxModel )->getText()->removeTextContent( xBookmark );
- }
-
--void SwVbaBookmarks::addBookmarkByName( const rtl::OUString& rName, const uno::Reference< text::XTextRange >& rTextRange ) throw (uno::RuntimeException)
-+void SwVbaBookmarks::addBookmarkByName( const uno::Reference< frame::XModel >& xModel, const rtl::OUString& rName, const uno::Reference< text::XTextRange >& rTextRange ) throw (uno::RuntimeException)
- {
-- uno::Reference< lang::XMultiServiceFactory > xDocMSF( mxModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< lang::XMultiServiceFactory > xDocMSF( xModel, uno::UNO_QUERY_THROW );
- uno::Reference< text::XTextContent > xBookmark( xDocMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.Bookmark")) ), uno::UNO_QUERY_THROW );
- uno::Reference< container::XNamed > xNamed( xBookmark, uno::UNO_QUERY_THROW );
- xNamed->setName( rName );
-- mxText->insertTextContent( rTextRange, xBookmark, sal_False );
-+ rTextRange->getText()->insertTextContent( rTextRange, xBookmark, sal_False );
- }
-
- uno::Any SAL_CALL
-@@ -180,7 +179,7 @@ SwVbaBookmarks::Add( const rtl::OUString& rName, const uno::Any& rRange ) throw
- if( m_xNameAccess->hasByName( aName ) )
- removeBookmarkByName( aName );
-
-- addBookmarkByName( aName, xTextRange );
-+ addBookmarkByName( mxModel, aName, xTextRange );
-
- return uno::makeAny( uno::Reference< word::XBookmark >( new SwVbaBookmark( getParent(), mxContext, mxModel, aName ) ) );
- }
-diff --git sw/source/ui/vba/vbabookmarks.hxx sw/source/ui/vba/vbabookmarks.hxx
-index 5efef7a..29e26b9 100644
---- sw/source/ui/vba/vbabookmarks.hxx
-+++ sw/source/ui/vba/vbabookmarks.hxx
-@@ -47,12 +47,12 @@ private:
-
- private:
- void removeBookmarkByName( const rtl::OUString& rName ) throw (css::uno::RuntimeException);
-- void addBookmarkByName( const rtl::OUString& rName, const css::uno::Reference< css::text::XTextRange >& rTextRange ) throw (css::uno::RuntimeException);
-
- public:
- SwVbaBookmarks( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::container::XIndexAccess >& xBookmarks, const css::uno::Reference< css::frame::XModel >& xModel );
- virtual ~SwVbaBookmarks() {}
-
-+ static void addBookmarkByName( const css::uno::Reference< css::frame::XModel >& xModel, const rtl::OUString& rName, const css::uno::Reference< css::text::XTextRange >& rTextRange ) 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);
-diff --git sw/source/ui/vba/vbaborders.cxx sw/source/ui/vba/vbaborders.cxx
-index 634ab63..1cd2b0d 100644
---- sw/source/ui/vba/vbaborders.cxx
-+++ sw/source/ui/vba/vbaborders.cxx
-@@ -348,14 +348,19 @@ SwVbaBorders::getItemByIntIndex( const sal_Int32 nIndex ) throw (uno::RuntimeEx
-
- sal_Bool SAL_CALL SwVbaBorders::getShadow() throw (uno::RuntimeException)
- {
-+ /*
- table::ShadowFormat aShadowFormat;
- m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ShadowFormat") ) ) >>= aShadowFormat;
- return ( aShadowFormat.Location != table::ShadowLocation_NONE );
-+ */
-+ // always return False for table border in MS Word
-+ return sal_False;
- }
-
- void SAL_CALL SwVbaBorders::setShadow( sal_Bool /*_shadow*/ ) throw (uno::RuntimeException)
- {
-- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ // not support in Table border in Word
-+ // TODO:
- }
-
- rtl::OUString&
-diff --git sw/source/ui/vba/vbacell.cxx sw/source/ui/vba/vbacell.cxx
-new file mode 100644
-index 0000000..8b05bf7
---- /dev/null
-+++ sw/source/ui/vba/vbacell.cxx
-@@ -0,0 +1,120 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbacell.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include "vbatable.hxx"
-+#include <com/sun/star/table/XCellRange.hpp>
-+#include <com/sun/star/view/XSelectionSupplier.hpp>
-+#include <rtl/ustrbuf.hxx>
-+#include "wordvbahelper.hxx"
-+#include "vbatablehelper.hxx"
-+#include "vbarow.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaCell::SwVbaCell( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextTable >& xTextTable, sal_Int32 nColumn, sal_Int32 nRow ) throw ( uno::RuntimeException ) :
-+ SwVbaCell_BASE( rParent, rContext ), mxTextTable( xTextTable ), mnColumn( nColumn ), mnRow( nRow )
-+{
-+}
-+
-+SwVbaCell::~SwVbaCell()
-+{
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaCell::getWidth() throw (css::uno::RuntimeException)
-+{
-+ SwVbaTableHelper aTableHelper( mxTextTable );
-+ return aTableHelper.GetColWidth( mnColumn, mnRow, sal_True );
-+}
-+
-+void SAL_CALL SwVbaCell::setWidth( ::sal_Int32 _width ) throw (css::uno::RuntimeException)
-+{
-+ SwVbaTableHelper aTableHelper( mxTextTable );
-+ aTableHelper.SetColWidth( _width, mnColumn, mnRow, sal_True );
-+}
-+
-+uno::Any SAL_CALL SwVbaCell::getHeight() throw (css::uno::RuntimeException)
-+{
-+ uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnRow ) );
-+ return xRow->getHeight();
-+}
-+
-+void SAL_CALL SwVbaCell::setHeight( const uno::Any& _height ) throw (css::uno::RuntimeException)
-+{
-+ uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnRow ) );
-+ xRow->setHeight( _height );
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaCell::getHeightRule() throw (css::uno::RuntimeException)
-+{
-+ uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnRow ) );
-+ return xRow->getHeightRule();
-+}
-+
-+void SAL_CALL SwVbaCell::setHeightRule( ::sal_Int32 _heightrule ) throw (css::uno::RuntimeException)
-+{
-+ uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnRow ) );
-+ xRow->setHeightRule( _heightrule );
-+}
-+
-+void SAL_CALL SwVbaCell::SetWidth( float width, sal_Int32 /*rulestyle*/ ) throw (css::uno::RuntimeException)
-+{
-+ // FIXME: handle the argument: rulestyle
-+ setWidth( width );
-+}
-+
-+void SAL_CALL SwVbaCell::SetHeight( float height, sal_Int32 heightrule ) throw (css::uno::RuntimeException)
-+{
-+ // FIXME: handle the argument: heightrule
-+ setHeightRule( heightrule );
-+ setHeight( uno::makeAny( height ) );
-+}
-+
-+rtl::OUString&
-+SwVbaCell::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaCell") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaCell::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Cell" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbacell.hxx sw/source/ui/vba/vbacell.hxx
-new file mode 100644
-index 0000000..1350288
---- /dev/null
-+++ sw/source/ui/vba/vbacell.hxx
-@@ -0,0 +1,67 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_CELL_HXX
-+#define SW_VBA_CELL_HXX
-+
-+#include <ooo/vba/word/XCell.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/text/XTextTable.hpp>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XCell > SwVbaCell_BASE;
-+
-+class SwVbaCell : public SwVbaCell_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XTextTable > mxTextTable;
-+ sal_Int32 mnColumn;
-+ sal_Int32 mnRow;
-+
-+public:
-+ SwVbaCell( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextTable >& xTextTable, sal_Int32 nColumn, sal_Int32 nRow ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaCell();
-+
-+ // Attributes
-+ 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 getHeight() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setHeight( const css::uno::Any& _height ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getHeightRule() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setHeightRule( ::sal_Int32 _heightrule ) throw (css::uno::RuntimeException);
-+
-+ // Methods
-+ virtual void SAL_CALL SetWidth( float width, sal_Int32 rulestyle ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL SetHeight( float height, sal_Int32 heightrule ) throw (css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_CELL_HXX */
-diff --git sw/source/ui/vba/vbacells.cxx sw/source/ui/vba/vbacells.cxx
-new file mode 100644
-index 0000000..919306b
---- /dev/null
-+++ sw/source/ui/vba/vbacells.cxx
-@@ -0,0 +1,223 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbacells.hxx"
-+#include "vbacell.hxx"
-+#include "wordvbahelper.hxx"
-+#include "vbatablehelper.hxx"
-+#include "vbarow.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+typedef ::cppu::WeakImplHelper2< container::XIndexAccess, container::XEnumerationAccess > CellCollectionHelper_Base;
-+
-+class CellsEnumWrapper : public EnumerationHelper_BASE
-+{
-+ uno::Reference< container::XIndexAccess > mxIndexAccess;
-+ sal_Int32 nIndex;
-+
-+public:
-+ CellsEnumWrapper( const uno::Reference< container::XIndexAccess >& xIndexAccess ) : mxIndexAccess( xIndexAccess ), nIndex( 0 )
-+ {
-+ }
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( nIndex < mxIndexAccess->getCount() );
-+ }
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if( nIndex < mxIndexAccess->getCount() )
-+ {
-+ return mxIndexAccess->getByIndex( nIndex++ );
-+ }
-+ throw container::NoSuchElementException();
-+ }
-+};
-+
-+class CellCollectionHelper : public CellCollectionHelper_Base
-+{
-+private:
-+ uno::Reference< XHelperInterface > mxParent;
-+ uno::Reference< uno::XComponentContext > mxContext;
-+ uno::Reference< css::text::XTextTable > mxTextTable;
-+ sal_Int32 mnLeft;
-+ sal_Int32 mnTop;
-+ sal_Int32 mnRight;
-+ sal_Int32 mnBottom;
-+
-+public:
-+ CellCollectionHelper( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::text::XTextTable >& xTextTable, sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom ) throw ( css::uno::RuntimeException ): mxParent( xParent ), mxContext( xContext ), mxTextTable( xTextTable ), mnLeft( nLeft ), mnTop( nTop ), mnRight( nRight ), mnBottom( nBottom )
-+ {
-+ }
-+ virtual ~CellCollectionHelper() {}
-+
-+ virtual sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
-+ {
-+ return ( mnRight - mnLeft + 1 ) * ( mnBottom - mnTop + 1 );
-+ }
-+ virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( Index < 0 || Index >= getCount() )
-+ throw css::lang::IndexOutOfBoundsException();
-+
-+ for( sal_Int32 row = mnTop; row <= mnBottom; row++ )
-+ {
-+ for( sal_Int32 col = mnLeft; col <= mnRight; col++ )
-+ {
-+ if( Index == ( ( row - mnTop ) * ( mnRight - mnLeft + 1 ) + ( col - mnLeft ) ) )
-+ return uno::makeAny( uno::Reference< word::XCell >( new SwVbaCell( mxParent, mxContext, mxTextTable, col, row ) ) );
-+ }
-+ }
-+ throw css::lang::IndexOutOfBoundsException();
-+
-+ }
-+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
-+ {
-+ return word::XCell::static_type(0);
-+ }
-+ virtual sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
-+ {
-+ return sal_True;
-+ }
-+ // XEnumerationAccess
-+ virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
-+ {
-+ return new CellsEnumWrapper( this );
-+ }
-+};
-+
-+SwVbaCells::SwVbaCells( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextTable >& xTextTable, sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom ) throw (uno::RuntimeException) : SwVbaCells_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new CellCollectionHelper( xParent, xContext, xTextTable, nLeft, nTop, nRight, nBottom ) ) ), mxTextTable( xTextTable ), mnLeft( nLeft ), mnTop( nTop ), mnRight( nRight ), mnBottom( nBottom )
-+{
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaCells::getWidth() throw (css::uno::RuntimeException)
-+{
-+ uno::Reference< word::XCell > xCell( m_xIndexAccess->getByIndex( 0 ), uno::UNO_QUERY_THROW );
-+ return xCell->getWidth();
-+}
-+
-+void SAL_CALL SwVbaCells::setWidth( ::sal_Int32 _width ) throw (css::uno::RuntimeException)
-+{
-+ sal_Int32 nIndex = 0;
-+ while( nIndex < m_xIndexAccess->getCount() )
-+ {
-+ uno::Reference< word::XCell > xCell( m_xIndexAccess->getByIndex( nIndex++ ), uno::UNO_QUERY_THROW );
-+ xCell->setWidth( _width );
-+ }
-+}
-+
-+uno::Any SAL_CALL SwVbaCells::getHeight() throw (css::uno::RuntimeException)
-+{
-+ uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnTop ) );
-+ return xRow->getHeight();
-+}
-+
-+void SAL_CALL SwVbaCells::setHeight( const uno::Any& _height ) throw (css::uno::RuntimeException)
-+{
-+ for( sal_Int32 row = mnTop; row <= mnBottom; row++ )
-+ {
-+ uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, row ) );
-+ xRow->setHeight( _height );
-+ }
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaCells::getHeightRule() throw (css::uno::RuntimeException)
-+{
-+ uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnTop ) );
-+ return xRow->getHeightRule();
-+}
-+
-+void SAL_CALL SwVbaCells::setHeightRule( ::sal_Int32 _heightrule ) throw (css::uno::RuntimeException)
-+{
-+ for( sal_Int32 row = mnTop; row <= mnBottom; row++ )
-+ {
-+ uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, row ) );
-+ xRow->setHeightRule( _heightrule );
-+ }
-+}
-+
-+void SAL_CALL SwVbaCells::SetWidth( float width, sal_Int32 rulestyle ) throw (css::uno::RuntimeException)
-+{
-+ sal_Int32 nIndex = 0;
-+ while( nIndex < m_xIndexAccess->getCount() )
-+ {
-+ uno::Reference< word::XCell > xCell( m_xIndexAccess->getByIndex( nIndex++ ), uno::UNO_QUERY_THROW );
-+ xCell->SetWidth( width, rulestyle );
-+ }
-+}
-+
-+void SAL_CALL SwVbaCells::SetHeight( float height, sal_Int32 heightrule ) throw (css::uno::RuntimeException)
-+{
-+ for( sal_Int32 row = mnTop; row <= mnBottom; row++ )
-+ {
-+ uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, row ) );
-+ xRow->SetHeight( height, heightrule );
-+ }
-+}
-+
-+// XEnumerationAccess
-+uno::Type
-+SwVbaCells::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XCell::static_type(0);
-+}
-+
-+uno::Reference< container::XEnumeration >
-+SwVbaCells::createEnumeration() throw (uno::RuntimeException)
-+{
-+ uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
-+ return xEnumAccess->createEnumeration();
-+}
-+
-+uno::Any
-+SwVbaCells::createCollectionObject( const uno::Any& aSource )
-+{
-+ return aSource;
-+}
-+
-+rtl::OUString&
-+SwVbaCells::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaCells") );
-+ return sImplName;
-+}
-+
-+uno::Sequence<rtl::OUString>
-+SwVbaCells::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Cells") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbacells.hxx sw/source/ui/vba/vbacells.hxx
-new file mode 100644
-index 0000000..3468b29
---- /dev/null
-+++ sw/source/ui/vba/vbacells.hxx
-@@ -0,0 +1,75 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_CELLS_HXX
-+#define SW_VBA_CELLS_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XCells.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/text/XTextTable.hpp>
-+
-+typedef CollTestImplHelper< ooo::vba::word::XCells > SwVbaCells_BASE;
-+
-+class SwVbaCells : public SwVbaCells_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XTextTable > mxTextTable;
-+ sal_Int32 mnLeft;
-+ sal_Int32 mnTop;
-+ sal_Int32 mnRight;
-+ sal_Int32 mnBottom;
-+
-+public:
-+ SwVbaCells( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::text::XTextTable >& xTextTable, sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaCells() {}
-+
-+ // Attributes
-+ 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 getHeight() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setHeight( const css::uno::Any& _height ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getHeightRule() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setHeightRule( ::sal_Int32 _heightrule ) throw (css::uno::RuntimeException);
-+
-+ // Methods
-+ virtual void SAL_CALL SetWidth( float width, sal_Int32 rulestyle ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL SetHeight( float height, sal_Int32 heightrule ) 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);
-+
-+ // SwVbaCells_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* SW_VBA_CELLS_HXX */
-diff --git sw/source/ui/vba/vbacheckbox.cxx sw/source/ui/vba/vbacheckbox.cxx
-new file mode 100644
-index 0000000..307f7a2
---- /dev/null
-+++ sw/source/ui/vba/vbacheckbox.cxx
-@@ -0,0 +1,98 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbacheckbox.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include <com/sun/star/text/XTextContent.hpp>
-+#include <com/sun/star/text/XTextViewCursor.hpp>
-+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
-+#include <ecmaflds.hxx>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaCheckBox::SwVbaCheckBox( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< frame::XModel >& rModel, const uno::Reference< text::XFormField >& xFormField ) throw ( uno::RuntimeException ) : SwVbaCheckBox_BASE( rParent, rContext ), mxModel( rModel ), mxFormField( xFormField )
-+{
-+ rtl::OUString sType = mxFormField->getFieldType();
-+ if( !sType.equalsIgnoreAsciiCaseAscii( ECMA_FORMCHECKBOX ) )
-+ {
-+ throw uno::RuntimeException( rtl::OUString(
-+ RTL_CONSTASCII_USTRINGPARAM("It is not a CheckBox")), uno::Reference< uno::XInterface >() );
-+ }
-+}
-+
-+SwVbaCheckBox::~SwVbaCheckBox()
-+{
-+}
-+
-+sal_Bool SAL_CALL SwVbaCheckBox::getValue() throw ( uno::RuntimeException )
-+{
-+ sal_Bool bValue = sal_False;
-+ sal_Int32 nCount = mxFormField->getParamCount();
-+ for( sal_Int32 i = 0; i < nCount; i++ )
-+ {
-+ if( mxFormField->getParamName(i).equalsIgnoreAsciiCaseAscii( ECMA_FORMCHECKBOX_CHECKED ) )
-+ {
-+ if( mxFormField->getParamValue(i).equalsIgnoreAsciiCaseAscii("on") )
-+ bValue = sal_True;
-+ else
-+ bValue = sal_False;
-+ break;
-+ }
-+ }
-+ return bValue;
-+}
-+
-+void SAL_CALL SwVbaCheckBox::setValue( sal_Bool value ) throw ( uno::RuntimeException )
-+{
-+ rtl::OUString sValue = rtl::OUString::createFromAscii( value ? "on" : "off" );
-+ mxFormField->addParam( rtl::OUString::createFromAscii( ECMA_FORMCHECKBOX_CHECKED ), sValue, sal_True );
-+}
-+
-+rtl::OUString&
-+SwVbaCheckBox::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaCheckBox") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaCheckBox::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.CheckBox" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbacheckbox.hxx sw/source/ui/vba/vbacheckbox.hxx
-new file mode 100644
-index 0000000..7b12ed5
---- /dev/null
-+++ sw/source/ui/vba/vbacheckbox.hxx
-@@ -0,0 +1,58 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_CHECKBOX_HXX
-+#define SW_VBA_CHECKBOX_HXX
-+
-+#include <ooo/vba/word/XCheckBox.hpp>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/text/XFormField.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XCheckBox > SwVbaCheckBox_BASE;
-+
-+class SwVbaCheckBox : public SwVbaCheckBox_BASE
-+{
-+private:
-+ css::uno::Reference< css::frame::XModel > mxModel;
-+ css::uno::Reference< css::text::XFormField > mxFormField;
-+
-+public:
-+ SwVbaCheckBox( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& rModel, const css::uno::Reference< css::text::XFormField >& xFormField ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaCheckBox();
-+
-+ // Methods
-+ sal_Bool SAL_CALL getValue() throw ( css::uno::RuntimeException );
-+ void SAL_CALL setValue( sal_Bool value ) throw ( css::uno::RuntimeException );
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_CHECKBOX_HXX */
-diff --git sw/source/ui/vba/vbacolumn.cxx sw/source/ui/vba/vbacolumn.cxx
-new file mode 100644
-index 0000000..3dd4eb1
---- /dev/null
-+++ sw/source/ui/vba/vbacolumn.cxx
-@@ -0,0 +1,201 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbacolumn.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include "vbatable.hxx"
-+#include <com/sun/star/table/XCellRange.hpp>
-+#include <com/sun/star/view/XSelectionSupplier.hpp>
-+#include <rtl/ustrbuf.hxx>
-+#include "wordvbahelper.hxx"
-+#include "vbatablehelper.hxx"
-+
-+#define RELATIVE_TABLE_WIDTH 10000
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaColumn::SwVbaColumn( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextTable >& xTextTable, sal_Int32 nIndex ) throw ( uno::RuntimeException ) :
-+ SwVbaColumn_BASE( rParent, rContext ), mxTextTable( xTextTable ), mnIndex( nIndex )
-+{
-+ mxTableColumns = mxTextTable->getColumns();
-+}
-+
-+SwVbaColumn::~SwVbaColumn()
-+{
-+}
-+
-+void SwVbaColumn::calculateAbsoluteColumnWidth( sal_Int32 nTableWidth, const css::uno::Sequence< css::text::TableColumnSeparator >& aSeparators, double* pAbsWidth )
-+{
-+ const text::TableColumnSeparator* pArray = aSeparators.getConstArray();
-+ sal_Int32 nSepCount = aSeparators.getLength();
-+ for( sal_Int32 i = 0; i <= nSepCount; i++ )
-+ {
-+ sal_Int32 nRelColWidth = 0;
-+ if( i == 0 )
-+ {
-+ if( nSepCount != 0 )
-+ {
-+ nRelColWidth = pArray[0].Position;
-+ }
-+ else
-+ {
-+ nRelColWidth = RELATIVE_TABLE_WIDTH;
-+ }
-+ }
-+ else
-+ {
-+ if( i == nSepCount )
-+ {
-+ nRelColWidth = RELATIVE_TABLE_WIDTH - pArray[i-1].Position;
-+ }
-+ else
-+ {
-+ nRelColWidth = pArray[i].Position - pArray[i-1].Position;
-+ }
-+ }
-+ pAbsWidth[i] = ( (double)nRelColWidth / RELATIVE_TABLE_WIDTH ) * (double) nTableWidth;
-+ }
-+}
-+
-+void SwVbaColumn::calculateRelativeColumnWidth( const double* pAbsWidth, double* pRelWidth, sal_Int32 nCount )
-+{
-+ double tableWidth = 0.0;
-+ for( sal_Int32 i = 0; i < nCount; i++ )
-+ {
-+ tableWidth += pAbsWidth[i];
-+ }
-+
-+ pRelWidth[ nCount - 1 ] = tableWidth;
-+ for( sal_Int32 i = 0; i < nCount - 1; i++ )
-+ {
-+ if( i == 0 )
-+ {
-+ pRelWidth[i] = ( pAbsWidth[i] * RELATIVE_TABLE_WIDTH ) / tableWidth;
-+ }
-+ else
-+ {
-+ pRelWidth[i] = pRelWidth[i-1] + ( pAbsWidth[i] * RELATIVE_TABLE_WIDTH ) / tableWidth;
-+ }
-+ }
-+}
-+
-+sal_Int32 SAL_CALL
-+SwVbaColumn::getWidth( ) throw ( css::uno::RuntimeException )
-+{
-+ /* uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, uno::UNO_QUERY_THROW );
-+ uno::Sequence< text::TableColumnSeparator > aSeparators;
-+ xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TableColumnSeparators") ) ) >>= aSeparators;
-+ sal_Int32 nTableWidth = SwVbaTable::getTableWidth( xTableProps );
-+ sal_Int32 nColCont = aSeparators.getLength() + 1;
-+ double dAbsColWidth[ nColCont ];
-+ calculateAbsoluteColumnWidth( nTableWidth, aSeparators, dAbsColWidth );
-+ return Millimeter::getInPoints( (sal_Int32)( dAbsColWidth[ mnIndex ] ) );
-+ */
-+ SwVbaTableHelper aTableHelper( mxTextTable );
-+ return aTableHelper.GetColWidth( mnIndex );
-+}
-+
-+void SAL_CALL
-+SwVbaColumn::setWidth( sal_Int32 _width ) throw ( css::uno::RuntimeException )
-+{
-+/* uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, uno::UNO_QUERY_THROW );
-+ uno::Sequence< text::TableColumnSeparator > aSeparators;
-+ xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TableColumnSeparators") ) ) >>= aSeparators;
-+ sal_Int32 nTableWidth = SwVbaTable::getTableWidth( xTableProps );
-+ sal_Int32 nColCont = aSeparators.getLength() + 1;
-+ double dAbsColWidth[ nColCont ];
-+ calculateAbsoluteColumnWidth( nTableWidth, aSeparators, dAbsColWidth );
-+ dAbsColWidth[ mnIndex ] = Millimeter::getInHundredthsOfOneMillimeter( _width );
-+ double tableWidth = 0.0;
-+ for( sal_Int32 i = 0; i < nColCont; i++ )
-+ {
-+ tableWidth += dAbsColWidth[i];
-+ }
-+
-+ double dRelColWidth[ nColCont ];
-+ calculateRelativeColumnWidth( dAbsColWidth, dRelColWidth, nColCont);
-+
-+ text::TableColumnSeparator* pArray = aSeparators.getArray();
-+ for( sal_Int32 i = 0; i < nColCont - 1; i++ )
-+ {
-+ pArray[i].Position = (sal_Int16)(dRelColWidth[i]);
-+ }
-+
-+ xTableProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TableColumnSeparators") ), uno::makeAny( aSeparators ) );
-+ SwVbaTable::setTableWidth( xTableProps, (sal_Int32)( tableWidth ) );
-+ */
-+
-+ SwVbaTableHelper aTableHelper( mxTextTable );
-+ aTableHelper.SetColWidth( _width, mnIndex );
-+}
-+
-+void SAL_CALL
-+SwVbaColumn::Select( ) throw ( uno::RuntimeException )
-+{
-+ SelectColumn( getCurrentWordDoc(mxContext), mxTextTable, mnIndex, mnIndex );
-+}
-+
-+void SwVbaColumn::SelectColumn( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XTextTable >& xTextTable, sal_Int32 nStartColumn, sal_Int32 nEndColumn ) throw ( uno::RuntimeException )
-+{
-+ rtl::OUStringBuffer aRangeName;
-+ rtl::OUString sStartCol = SwVbaTableHelper::getColumnStr( nStartColumn );
-+ aRangeName.append(sStartCol).append(sal_Int32( 1 ) );
-+ rtl::OUString sEndCol = SwVbaTableHelper::getColumnStr( nEndColumn );
-+ sal_Int32 nRowCount = xTextTable->getRows()->getCount();
-+ aRangeName.appendAscii(":").append( sEndCol ).append( sal_Int32( nRowCount ) );
-+
-+ uno::Reference< table::XCellRange > xCellRange( xTextTable, uno::UNO_QUERY_THROW );
-+ rtl::OUString sSelRange = aRangeName.makeStringAndClear();
-+ uno::Reference< table::XCellRange > xSelRange = xCellRange->getCellRangeByName( sSelRange );
-+
-+ uno::Reference< view::XSelectionSupplier > xSelection( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
-+ xSelection->select( uno::makeAny( xSelRange ) );
-+}
-+
-+rtl::OUString&
-+SwVbaColumn::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaColumn") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaColumn::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Column" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbacolumn.hxx sw/source/ui/vba/vbacolumn.hxx
-new file mode 100644
-index 0000000..6d67bdd
---- /dev/null
-+++ sw/source/ui/vba/vbacolumn.hxx
-@@ -0,0 +1,68 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_COLUMN_HXX
-+#define SW_VBA_COLUMN_HXX
-+
-+#include <ooo/vba/word/XColumn.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/table/XTableColumns.hpp>
-+#include <com/sun/star/text/XTextTable.hpp>
-+#include <com/sun/star/text/TableColumnSeparator.hpp>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XColumn > SwVbaColumn_BASE;
-+
-+class SwVbaColumn : public SwVbaColumn_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XTextTable > mxTextTable;
-+ css::uno::Reference< css::table::XTableColumns > mxTableColumns;
-+ sal_Int32 mnIndex;
-+
-+private:
-+ void calculateAbsoluteColumnWidth( sal_Int32 nTableWidth, const css::uno::Sequence< css::text::TableColumnSeparator >& aSeparators, double* pAbsWidth );
-+ void calculateRelativeColumnWidth( const double* pAbsWidth, double* pRelWidth, sal_Int32 nCount );
-+
-+public:
-+ SwVbaColumn( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextTable >& xTextTable, sal_Int32 nIndex ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaColumn();
-+
-+ // Methods
-+ virtual sal_Int32 SAL_CALL getWidth() throw ( css::uno::RuntimeException );
-+ virtual void SAL_CALL setWidth( sal_Int32 _width ) throw ( css::uno::RuntimeException );
-+ virtual void SAL_CALL Select( ) throw (css::uno::RuntimeException);
-+
-+ static void SelectColumn( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XTextTable >& xTextTable, sal_Int32 nStartColumn, sal_Int32 nEndColumn ) throw (css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_COLUMN_HXX */
-diff --git sw/source/ui/vba/vbacolumns.cxx sw/source/ui/vba/vbacolumns.cxx
-new file mode 100644
-index 0000000..90cd7fb
---- /dev/null
-+++ sw/source/ui/vba/vbacolumns.cxx
-@@ -0,0 +1,160 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbacolumns.hxx"
-+#include "vbacolumn.hxx"
-+#include <com/sun/star/text/HoriOrientation.hpp>
-+#include <com/sun/star/table/XCellRange.hpp>
-+#include <ooo/vba/word/WdConstants.hpp>
-+#include <ooo/vba/word/WdRulerStyle.hpp>
-+#include "wordvbahelper.hxx"
-+#include "vbatablehelper.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+class ColumnsEnumWrapper : public EnumerationHelper_BASE
-+{
-+ uno::WeakReference< XHelperInterface > mxParent;
-+ uno::Reference< uno::XComponentContext > mxContext;
-+ uno::Reference< text::XTextTable > mxTextTable;
-+ uno::Reference< container::XIndexAccess > mxIndexAccess;
-+ sal_Int32 nIndex;
-+
-+public:
-+ ColumnsEnumWrapper( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< text::XTextTable >& xTextTable ) : mxParent( xParent ), mxContext( xContext ), mxTextTable( xTextTable ), nIndex( 0 )
-+ {
-+ mxIndexAccess.set( mxTextTable->getColumns(), uno::UNO_QUERY );
-+ }
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( nIndex < mxIndexAccess->getCount() );
-+ }
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if( nIndex < mxIndexAccess->getCount() )
-+ {
-+ return uno::makeAny( uno::Reference< word::XColumn > ( new SwVbaColumn( mxParent, mxContext, mxTextTable, nIndex++ ) ) );
-+ }
-+ throw container::NoSuchElementException();
-+ }
-+};
-+
-+SwVbaColumns::SwVbaColumns( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextTable >& xTextTable, const uno::Reference< table::XTableColumns >& xTableColumns ) throw (uno::RuntimeException) : SwVbaColumns_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( xTableColumns, uno::UNO_QUERY_THROW ) ), mxTextTable( xTextTable ), mxTableColumns( xTableColumns )
-+{
-+ mnStartColumnIndex = 0;
-+ SwVbaTableHelper aTableHelper( mxTextTable );
-+ mnEndColumnIndex = aTableHelper.getTabColumnsMaxCount( ) - 1;
-+}
-+
-+SwVbaColumns::SwVbaColumns( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextTable >& xTextTable, const uno::Reference< table::XTableColumns >& xTableColumns, sal_Int32 nStartCol, sal_Int32 nEndCol ) throw (uno::RuntimeException) : SwVbaColumns_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( xTableColumns, uno::UNO_QUERY_THROW ) ), mxTextTable( xTextTable ), mxTableColumns( xTableColumns ), mnStartColumnIndex( nStartCol ), mnEndColumnIndex( nEndCol )
-+{
-+ if( mnEndColumnIndex < mnStartColumnIndex )
-+ throw uno::RuntimeException();
-+}
-+
-+uno::Reference< word::XColumn > SwVbaColumns::getColumnAtIndex( sal_Int32 index ) throw (uno::RuntimeException)
-+{
-+ return uno::Reference< word::XColumn >( new SwVbaColumn( this, mxContext, mxTextTable, index ) );
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaColumns::getWidth() throw (uno::RuntimeException)
-+{
-+ return getColumnAtIndex( mnStartColumnIndex )->getWidth();
-+}
-+
-+void SAL_CALL SwVbaColumns::setWidth( ::sal_Int32 _width ) throw (uno::RuntimeException)
-+{
-+ for( sal_Int32 index = mnStartColumnIndex; index <= mnEndColumnIndex; index++ )
-+ {
-+ getColumnAtIndex( index )->setWidth( _width );
-+ }
-+}
-+
-+void SAL_CALL SwVbaColumns::Select( ) throw (uno::RuntimeException)
-+{
-+ SwVbaColumn::SelectColumn( getCurrentWordDoc(mxContext), mxTextTable, mnStartColumnIndex, mnEndColumnIndex );
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaColumns::getCount() throw (uno::RuntimeException)
-+{
-+ return ( mnEndColumnIndex - mnStartColumnIndex + 1 );
-+}
-+
-+uno::Any SAL_CALL SwVbaColumns::Item( const uno::Any& Index1, const uno::Any& /*not processed in this base class*/ ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nIndex = 0;
-+ if( ( Index1 >>= nIndex ) == sal_True )
-+ {
-+ if( nIndex <= 0 || nIndex > getCount() )
-+ {
-+ throw lang::IndexOutOfBoundsException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Index out of bounds") ), uno::Reference< uno::XInterface >() );
-+ }
-+ return uno::makeAny( uno::Reference< word::XColumn >( new SwVbaColumn( this, mxContext, mxTextTable, nIndex - 1 ) ) );
-+ }
-+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Index out of bounds") ), uno::Reference< uno::XInterface >() );
-+}
-+
-+// XEnumerationAccess
-+uno::Type
-+SwVbaColumns::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XColumn::static_type(0);
-+}
-+uno::Reference< container::XEnumeration >
-+SwVbaColumns::createEnumeration() throw (uno::RuntimeException)
-+{
-+ return new ColumnsEnumWrapper( this, mxContext, mxTextTable );
-+}
-+
-+uno::Any
-+SwVbaColumns::createCollectionObject( const uno::Any& aSource )
-+{
-+ return aSource;
-+}
-+
-+rtl::OUString&
-+SwVbaColumns::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaColumns") );
-+ return sImplName;
-+}
-+
-+uno::Sequence<rtl::OUString>
-+SwVbaColumns::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Columns") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbacolumns.hxx sw/source/ui/vba/vbacolumns.hxx
-new file mode 100644
-index 0000000..3fd2b4a
---- /dev/null
-+++ sw/source/ui/vba/vbacolumns.hxx
-@@ -0,0 +1,75 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_COLUMNS_HXX
-+#define SW_VBA_COLUMNS_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XColumns.hpp>
-+#include <ooo/vba/word/XColumn.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/table/XTableColumns.hpp>
-+#include <com/sun/star/text/XTextTable.hpp>
-+
-+typedef CollTestImplHelper< ooo::vba::word::XColumns > SwVbaColumns_BASE;
-+
-+class SwVbaColumns : public SwVbaColumns_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XTextTable > mxTextTable;
-+ css::uno::Reference< css::table::XTableColumns > mxTableColumns;
-+ sal_Int32 mnStartColumnIndex;
-+ sal_Int32 mnEndColumnIndex;
-+
-+private:
-+ css::uno::Reference< ooo::vba::word::XColumn > getColumnAtIndex( sal_Int32 index ) throw (css::uno::RuntimeException);
-+
-+public:
-+ SwVbaColumns( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::text::XTextTable >& xTextTable, const css::uno::Reference< css::table::XTableColumns >& xTableColumns ) throw ( css::uno::RuntimeException );
-+ SwVbaColumns( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::text::XTextTable >& xTextTable, const css::uno::Reference< css::table::XTableColumns >& xTableColumns, sal_Int32 nStartCol, sal_Int32 nEndCol ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaColumns() {}
-+
-+ virtual sal_Int32 SAL_CALL getWidth( ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setWidth( sal_Int32 _width ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL Select( ) throw (css::uno::RuntimeException);
-+
-+ //XCollection
-+ virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException);
-+ 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 );
-+ // 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);
-+
-+ // SwVbaColumns_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* SW_VBA_COLUMNS_HXX */
-diff --git sw/source/ui/vba/vbadocument.cxx sw/source/ui/vba/vbadocument.cxx
-index 98692d5..71641e1 100644
---- sw/source/ui/vba/vbadocument.cxx
-+++ sw/source/ui/vba/vbadocument.cxx
-@@ -38,7 +38,9 @@
- #include <com/sun/star/drawing/XControlShape.hpp>
- #include <com/sun/star/drawing/XControlShape.hpp>
- #include <com/sun/star/form/XFormsSupplier.hpp>
-+#include <com/sun/star/document/XRedlinesSupplier.hpp>
- #include <ooo/vba/XControlProvider.hpp>
-+#include <ooo/vba/word/WdProtectionType.hpp>
-
- #include <vbahelper/helperdecl.hxx>
- #include <wordvbahelper.hxx>
-@@ -50,7 +52,14 @@
- #include "vbafield.hxx"
- #include "vbapagesetup.hxx"
- #include "vbasections.hxx"
-+#include "vbatablesofcontents.hxx"
- #include <vbahelper/vbashapes.hxx>
-+#include <vbahelper/vbahelper.hxx>
-+#include "vbarevisions.hxx"
-+#include "vbaframes.hxx"
-+#include "vbaformfields.hxx"
-+#include <osl/file.hxx>
-+#include <tools/urlobj.hxx>
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-@@ -220,6 +229,31 @@ SwVbaDocument::Sections( const uno::Any& index ) throw (uno::RuntimeException)
- }
-
- uno::Any SAL_CALL
-+SwVbaDocument::TablesOfContents( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< XCollection > xCol( new SwVbaTablesOfContents( this, mxContext, mxTextDocument ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+#ifdef FIELDPATCH
-+uno::Any SAL_CALL
-+SwVbaDocument::FormFields( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< XCollection > xCol( new SwVbaFormFields( this, mxContext, getModel() ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+#else
-+uno::Any SAL_CALL
-+SwVbaDocument::FormFields( const uno::Any& /*index*/ ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< XCollection > xCol;
-+#endif
-+ return uno::makeAny( xCol );
-+}
-+
-+uno::Any SAL_CALL
- SwVbaDocument::PageSetup( ) throw (uno::RuntimeException)
- {
- uno::Reference< beans::XPropertySet > xPageProps( word::getCurrentPageStyle( mxModel ), uno::UNO_QUERY_THROW );
-@@ -239,16 +273,34 @@ SwVbaDocument::getAttachedTemplate() throw (uno::RuntimeException)
- uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( getModel(), uno::UNO_QUERY_THROW );
- uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW );
- uno::Reference< document::XDocumentProperties > xDocProps( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW );
-- rtl::OUString sTemplateName = xDocProps->getTemplateName();
-+ rtl::OUString sTemplateUrl = xDocProps->getTemplateURL();
-
-- xTemplate = new SwVbaTemplate( this, mxContext, getModel(), sTemplateName );
-+ xTemplate = new SwVbaTemplate( this, mxContext, getModel(), sTemplateUrl );
- return uno::makeAny( xTemplate );
- }
-
- void SAL_CALL
--SwVbaDocument::setAttachedTemplate( const css::uno::Any& /*_attachedtemplate*/ ) throw (uno::RuntimeException)
-+SwVbaDocument::setAttachedTemplate( const css::uno::Any& _attachedtemplate ) throw (uno::RuntimeException)
- {
-- throw uno::RuntimeException();
-+ rtl::OUString sTemplate;
-+ if( !( _attachedtemplate >>= sTemplate ) )
-+ {
-+ throw uno::RuntimeException();
-+ }
-+ rtl::OUString aURL;
-+ INetURLObject aObj;
-+ aObj.SetURL( sTemplate );
-+ bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
-+ if ( bIsURL )
-+ aURL = sTemplate;
-+ else
-+ osl::FileBase::getFileURLFromSystemPath( sTemplate, aURL );
-+
-+ uno::Reference< word::XTemplate > xTemplate;
-+ uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( getModel(), uno::UNO_QUERY_THROW );
-+ uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW );
-+ uno::Reference< document::XDocumentProperties > xDocProps( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW );
-+ xDocProps->setTemplateURL( aURL );
- }
-
- uno::Any SAL_CALL
-@@ -267,6 +319,116 @@ void SAL_CALL SwVbaDocument::Activate() throw (uno::RuntimeException)
- VbaDocumentBase::Activate();
- }
-
-+::sal_Int32 SAL_CALL SwVbaDocument::getProtectionType() throw (css::uno::RuntimeException)
-+{
-+ //TODO
-+ return word::WdProtectionType::wdNoProtection;
-+}
-+
-+void SAL_CALL SwVbaDocument::setProtectionType( ::sal_Int32 /*_protectiontype*/ ) throw (css::uno::RuntimeException)
-+{
-+ //TODO
-+}
-+
-+::sal_Bool SAL_CALL SwVbaDocument::getUpdateStylesOnOpen() throw (css::uno::RuntimeException)
-+{
-+ //TODO
-+ return sal_False;
-+}
-+
-+void SAL_CALL SwVbaDocument::setUpdateStylesOnOpen( ::sal_Bool /*_updatestylesonopen*/ ) throw (uno::RuntimeException)
-+{
-+ //TODO
-+}
-+
-+::sal_Bool SAL_CALL SwVbaDocument::getAutoHyphenation() throw (uno::RuntimeException)
-+{
-+ // check this property only in default paragraph style
-+ sal_Bool IsAutoHyphenation = sal_False;
-+ uno::Reference< beans::XPropertySet > xParaProps( word::getDefaultParagraphStyle( getModel() ), uno::UNO_QUERY_THROW );
-+ xParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaIsHyphenation")) ) >>= IsAutoHyphenation;
-+ return IsAutoHyphenation;
-+}
-+
-+void SAL_CALL SwVbaDocument::setAutoHyphenation( ::sal_Bool _autohyphenation ) throw (uno::RuntimeException)
-+{
-+ //TODO
-+ uno::Reference< beans::XPropertySet > xParaProps( word::getDefaultParagraphStyle( getModel() ), uno::UNO_QUERY_THROW );
-+ xParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaIsHyphenation")), uno::makeAny( _autohyphenation ) );
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaDocument::getHyphenationZone() throw (uno::RuntimeException)
-+{
-+ //TODO
-+ return 0;
-+}
-+
-+void SAL_CALL SwVbaDocument::setHyphenationZone( ::sal_Int32 /*_hyphenationzone*/ ) throw (uno::RuntimeException)
-+{
-+ //TODO
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaDocument::getConsecutiveHyphensLimit() throw (uno::RuntimeException)
-+{
-+ //TODO
-+ sal_Int16 nHyphensLimit = 0;
-+ uno::Reference< beans::XPropertySet > xParaProps( word::getDefaultParagraphStyle( getModel() ), uno::UNO_QUERY_THROW );
-+ xParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaHyphenationMaxHyphens")) ) >>= nHyphensLimit;
-+ return nHyphensLimit;
-+}
-+
-+void SAL_CALL SwVbaDocument::setConsecutiveHyphensLimit( ::sal_Int32 _consecutivehyphenslimit ) throw (uno::RuntimeException)
-+{
-+ sal_Int16 nHyphensLimit = static_cast< sal_Int16 >( _consecutivehyphenslimit );
-+ uno::Reference< beans::XPropertySet > xParaProps( word::getDefaultParagraphStyle( getModel() ), uno::UNO_QUERY_THROW );
-+ xParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaHyphenationMaxHyphens")), uno::makeAny( nHyphensLimit ) );
-+}
-+
-+void SAL_CALL SwVbaDocument::Protect( ::sal_Int32 /*Type*/, const uno::Any& /*NOReset*/, const uno::Any& /*Password*/, const uno::Any& /*UseIRM*/, const uno::Any& /*EnforceStyleLock*/ ) throw (uno::RuntimeException)
-+{
-+ // Seems not support in Writer
-+ // VbaDocumentBase::Protect( Password );
-+}
-+
-+void SAL_CALL SwVbaDocument::PrintOut( const uno::Any& /*Background*/, const uno::Any& /*Append*/, const uno::Any& /*Range*/, const uno::Any& /*OutputFileName*/, const uno::Any& /*From*/, const uno::Any& /*To*/, const uno::Any& /*Item*/, const uno::Any& /*Copies*/, const uno::Any& /*Pages*/, const uno::Any& /*PageType*/, const uno::Any& /*PrintToFile*/, const uno::Any& /*Collate*/, const uno::Any& /*FileName*/, const uno::Any& /*ActivePrinterMacGX*/, const uno::Any& /*ManualDuplexPrint*/, const uno::Any& /*PrintZoomColumn*/, const uno::Any& /*PrintZoomRow*/, const uno::Any& /*PrintZoomPaperWidth*/, const uno::Any& /*PrintZoomPaperHeight*/ ) throw (uno::RuntimeException)
-+{
-+ //TODO
-+}
-+
-+void SAL_CALL SwVbaDocument::PrintPreview( ) throw (uno::RuntimeException)
-+{
-+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:PrintPreview"));
-+ dispatchRequests( mxModel,url );
-+}
-+
-+void SAL_CALL SwVbaDocument::ClosePrintPreview( ) throw (uno::RuntimeException)
-+{
-+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ClosePreview"));
-+ dispatchRequests( mxModel,url );
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaDocument::Revisions( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< document::XRedlinesSupplier > xRedlinesSupp( mxTextDocument, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xRedlines( xRedlinesSupp->getRedlines(), uno::UNO_QUERY_THROW );
-+ uno::Reference< XCollection > xCol( new SwVbaRevisions( this, mxContext, getModel(), xRedlines ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaDocument::Frames( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< text::XTextFramesSupplier > xTextFramesSupp( mxTextDocument, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xFrames( xTextFramesSupp->getTextFrames(), uno::UNO_QUERY_THROW );
-+ uno::Reference< XCollection > xCol( new SwVbaFrames( this, mxContext, xFrames, getModel() ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
- uno::Any
- SwVbaDocument::getControlShape( const ::rtl::OUString& sName )
- {
-diff --git sw/source/ui/vba/vbadocument.hxx sw/source/ui/vba/vbadocument.hxx
-index 4602e9a..4ca6801 100644
---- sw/source/ui/vba/vbadocument.hxx
-+++ sw/source/ui/vba/vbadocument.hxx
-@@ -65,6 +65,25 @@ public:
- virtual css::uno::Any SAL_CALL Sections( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Activate() throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL PageSetup() throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL TablesOfContents( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL FormFields( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getProtectionType() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setProtectionType( ::sal_Int32 _protectiontype ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getUpdateStylesOnOpen() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setUpdateStylesOnOpen( ::sal_Bool _updatestylesonopen ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getAutoHyphenation() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setAutoHyphenation( ::sal_Bool _autohyphenation ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getHyphenationZone() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setHyphenationZone( ::sal_Int32 _hyphenationzone ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getConsecutiveHyphensLimit() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setConsecutiveHyphensLimit( ::sal_Int32 _consecutivehyphenslimit ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL Protect( ::sal_Int32 Type, const css::uno::Any& NOReset, const css::uno::Any& Password, const css::uno::Any& UseIRM, const css::uno::Any& EnforceStyleLock ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL PrintOut( const css::uno::Any& Background, const css::uno::Any& Append, const css::uno::Any& Range, const css::uno::Any& OutputFileName, const css::uno::Any& From, const css::uno::Any& To, const css::uno::Any& Item, const css::uno::Any& Copies, const css::uno::Any& Pages, const css::uno::Any& PageType, const css::uno::Any& PrintToFile, const css::uno::Any& Collate, const css::uno::Any& FileName, const css::uno::Any& ActivePrinterMacGX, const css::uno::Any& ManualDuplexPrint, const css::uno::Any& PrintZoomColumn, const css::uno::Any& PrintZoomRow, const css::uno::Any& PrintZoomPaperWidth, const css::uno::Any& PrintZoomPaperHeight ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL PrintPreview( ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL ClosePrintPreview( ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Revisions( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Frames( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+
- // XInvocation
- 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);
-diff --git sw/source/ui/vba/vbadocumentproperties.cxx sw/source/ui/vba/vbadocumentproperties.cxx
-index 475ca93..0a3270c 100644
---- sw/source/ui/vba/vbadocumentproperties.cxx
-+++ sw/source/ui/vba/vbadocumentproperties.cxx
-@@ -203,16 +203,16 @@ public:
-
- static DocPropInfo createDocPropInfo( const rtl::OUString& sDesc, const rtl::OUString& sPropName, boost::shared_ptr< PropertGetSetHelper >& rHelper )
- {
-- return createDocPropInfo( rtl::OUStringToOString( sDesc, RTL_TEXTENCODING_UTF8 ).getStr(), rtl::OUStringToOString( sPropName, RTL_TEXTENCODING_UTF8 ).getStr(), rHelper );
-+ DocPropInfo aItem;
-+ aItem.msMSODesc = sDesc;
-+ aItem.msOOOPropName = sPropName;
-+ aItem.mpPropGetSetHelper = rHelper;
-+ return aItem;
- }
-
- static DocPropInfo createDocPropInfo( const sal_Char* sDesc, const sal_Char* sPropName, boost::shared_ptr< PropertGetSetHelper >& rHelper )
- {
-- DocPropInfo aItem;
-- aItem.msMSODesc = rtl::OUString::createFromAscii( sDesc );
-- aItem.msOOOPropName = rtl::OUString::createFromAscii( sPropName );
-- aItem.mpPropGetSetHelper = rHelper;
-- return aItem;
-+ return createDocPropInfo( rtl::OUString::createFromAscii( sDesc ), rtl::OUString::createFromAscii( sPropName ), rHelper );
- }
- uno::Any getValue()
- {
-diff --git sw/source/ui/vba/vbafield.cxx sw/source/ui/vba/vbafield.cxx
-index 8e9661d..60042e8 100644
---- sw/source/ui/vba/vbafield.cxx
-+++ sw/source/ui/vba/vbafield.cxx
-@@ -33,6 +33,7 @@
- #include <ooo/vba/word/WdFieldType.hpp>
- #include <com/sun/star/text/FilenameDisplayFormat.hpp>
- #include <com/sun/star/util/XRefreshable.hpp>
-+#include <com/sun/star/util/XUpdatable.hpp>
- #include <swtypes.hxx>
-
- using namespace ::ooo::vba;
-@@ -45,6 +46,17 @@ SwVbaField::SwVbaField( const uno::Reference< ooo::vba::XHelperInterface >& rPa
- mxTextField.set( xTextField, uno::UNO_QUERY_THROW );
- }
-
-+sal_Bool SAL_CALL SwVbaField::Update() throw (uno::RuntimeException)
-+{
-+ uno::Reference< util::XUpdatable > xUpdatable( mxTextField, uno::UNO_QUERY );
-+ if( xUpdatable.is() )
-+ {
-+ xUpdatable->update();
-+ return sal_True;
-+ }
-+ return sal_False;
-+}
-+
- // XHelperInterface
- rtl::OUString&
- SwVbaField::getServiceImplName()
-@@ -368,6 +380,7 @@ SwVbaFields::Add( const css::uno::Reference< ::ooo::vba::word::XRange >& Range,
- {
- _ReadFieldParams aReadParam(sText);
- sFieldName = aReadParam.GetFieldName();
-+ OSL_TRACE("SwVbaFields::Add, the field name is %s ",rtl::OUStringToOString( sFieldName, RTL_TEXTENCODING_UTF8 ).getStr() );
- }
-
- uno::Reference< text::XTextContent > xTextField;
-@@ -375,6 +388,10 @@ SwVbaFields::Add( const css::uno::Reference< ::ooo::vba::word::XRange >& Range,
- {
- xTextField.set( Create_Field_FileName( sText ), uno::UNO_QUERY_THROW );
- }
-+ else if( nType == word::WdFieldType::wdFieldDocProperty || sFieldName.EqualsIgnoreCaseAscii("DOCPROPERTY") )
-+ {
-+ xTextField.set( Create_Field_DocProperty( sText ), uno::UNO_QUERY_THROW );
-+ }
- else
- {
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-@@ -419,6 +436,104 @@ uno::Reference< text::XTextField > SwVbaFields::Create_Field_FileName( const rtl
- return xTextField;
- }
-
-+struct DocPropertyTable
-+{
-+ const char* sDocPropertyName;
-+ const char* sFieldService;
-+};
-+
-+static const DocPropertyTable aDocPropertyTables[] =
-+{
-+ { "Author", "com.sun.star.text.textfield.docinfo.CreateAuthor" },
-+ { "Bytes", NULL },
-+ { "Category", NULL },
-+ { "Characters",NULL },
-+ { "CharactersWithSpaces", NULL },
-+ { "Comments", "com.sun.star.text.textfield.docinfo.Description" },
-+ { "Company", NULL },
-+ { "CreateTime", "com.sun.star.text.textfield.docinfo.CreateDateTime" },
-+ { "HyperlinkBase", NULL },
-+ { "Keywords", "com.sun.star.text.textfield.docinfo.Keywords" },
-+ { "LastPrinted", "com.sun.star.text.textfield.docinfo.PrintDateTime" },
-+ { "LastSavedBy", "com.sun.star.text.textfield.docinfo.ChangeAuthor" },
-+ { "LastSavedTime", "com.sun.star.text.textfield.docinfo.ChangeDateTime" },
-+ { "Lines", NULL },
-+ { "Manager", NULL },
-+ { "NameofApplication", NULL },
-+ { "ODMADocID", NULL },
-+ { "Pages", "com.sun.star.text.textfield.PageCount" },
-+ { "Paragraphs", "com.sun.star.text.textfield.ParagraphCount" },
-+ { "RevisionNumber", "com.sun.star.text.textfield.docinfo.Revision" },
-+ { "Security", NULL },
-+ { "Subject", "com.sun.star.text.textfield.docinfo.Subject" },
-+ { "Template", "com.sun.star.text.textfield.TemplateName" },
-+ { "Title", "com.sun.star.text.textfield.docinfo.Title" },
-+ { "TotalEditingTime", "com.sun.star.text.textfield.docinfo.EditTime" },
-+ { "Words", "com.sun.star.text.textfield.WordCount" },
-+ { NULL, NULL }
-+};
-+
-+uno::Reference< text::XTextField > SwVbaFields::Create_Field_DocProperty( const rtl::OUString _text ) throw (uno::RuntimeException)
-+{
-+ String aDocProperty;
-+ _ReadFieldParams aReadParam( _text );
-+ long nRet;
-+ while( -1 != ( nRet = aReadParam.SkipToNextToken() ))
-+ {
-+ switch( nRet )
-+ {
-+ case -2:
-+ if( !aDocProperty.Len() )
-+ aDocProperty = aReadParam.GetResult();
-+ break;
-+ case '*':
-+ //Skip over MERGEFORMAT
-+ aReadParam.SkipToNextToken();
-+ break;
-+ }
-+ }
-+ aDocProperty.EraseAllChars('"');
-+ OSL_TRACE("SwVbaFields::Create_Field_DocProperty, the document property name is %s ",rtl::OUStringToOString( aDocProperty, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ if( aDocProperty.Len() == 0 )
-+ {
-+ throw uno::RuntimeException();
-+ }
-+
-+ sal_Bool bCustom = sal_True;
-+ rtl::OUString sFieldService;
-+ // find the build in document properties
-+ for( const DocPropertyTable* pTable = aDocPropertyTables; pTable->sDocPropertyName != NULL; pTable++ )
-+ {
-+ if( aDocProperty.EqualsIgnoreCaseAscii( pTable->sDocPropertyName ) )
-+ {
-+ if( pTable->sFieldService != NULL )
-+ sFieldService = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( pTable->sFieldService ) );
-+ bCustom = sal_False;
-+ break;
-+ }
-+ }
-+
-+ if( bCustom )
-+ {
-+ sFieldService = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.textfield.docinfo.Custom" ) );
-+ }
-+ else if( sFieldService.getLength() == 0 )
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+
-+ uno::Reference< text::XTextField > xTextField( mxMSF->createInstance( sFieldService ), uno::UNO_QUERY_THROW );
-+
-+ if( bCustom )
-+ {
-+ uno::Reference< beans::XPropertySet > xProps( xTextField, uno::UNO_QUERY_THROW );
-+ rtl::OUString sDocPropertyName( aDocProperty );
-+ xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ), uno::makeAny( sDocPropertyName ) );
-+ }
-+
-+ return xTextField;
-+}
-+
- uno::Reference< container::XEnumeration > SAL_CALL
- SwVbaFields::createEnumeration() throw (uno::RuntimeException)
- {
-diff --git sw/source/ui/vba/vbafield.hxx sw/source/ui/vba/vbafield.hxx
-index f421179..99f9d7e 100644
---- sw/source/ui/vba/vbafield.hxx
-+++ sw/source/ui/vba/vbafield.hxx
-@@ -41,7 +41,8 @@ class SwVbaField : public SwVbaField_BASE
- css::uno::Reference< css::text::XTextField > mxTextField;
- public:
- SwVbaField( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rDocument, const css::uno::Reference< css::text::XTextField >& xTextField) throw ( css::uno::RuntimeException);
--
-+
-+ virtual sal_Bool SAL_CALL Update() throw ( css::uno::RuntimeException);
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-@@ -57,6 +58,7 @@ class SwVbaFields : public SwVbaFields_BASE
- css::uno::Reference< css::lang::XMultiServiceFactory > mxMSF;
- private:
- css::uno::Reference< css::text::XTextField > Create_Field_FileName( const rtl::OUString _text ) throw (css::uno::RuntimeException);
-+ css::uno::Reference< css::text::XTextField > Create_Field_DocProperty( const rtl::OUString _text ) throw (css::uno::RuntimeException);
-
- public:
- SwVbaFields( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel );
-diff --git sw/source/ui/vba/vbaformfield.cxx sw/source/ui/vba/vbaformfield.cxx
-new file mode 100644
-index 0000000..944ffbb
---- /dev/null
-+++ sw/source/ui/vba/vbaformfield.cxx
-@@ -0,0 +1,139 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbaformfield.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include <com/sun/star/text/XTextContent.hpp>
-+#include <com/sun/star/text/XTextViewCursor.hpp>
-+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
-+#include <ecmaflds.hxx>
-+#include "vbacheckbox.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaFormField::SwVbaFormField( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< frame::XModel >& rModel, const uno::Reference< text::XFormField >& xFormField ) throw ( uno::RuntimeException ) : SwVbaFormField_BASE( rParent, rContext ), mxModel( rModel ), mxFormField( xFormField )
-+{
-+}
-+
-+SwVbaFormField::~SwVbaFormField()
-+{
-+}
-+
-+rtl::OUString SAL_CALL SwVbaFormField::getResult() throw ( uno::RuntimeException )
-+{
-+ rtl::OUString sResult;
-+ rtl::OUString sType = mxFormField->getFieldType();
-+ if( sType.equalsIgnoreAsciiCaseAscii( ECMA_FORMTEXT ) )
-+ {
-+ uno::Reference< text::XTextContent > xTextContent( mxFormField, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextRange > xTextRange = xTextContent->getAnchor();
-+ sResult = xTextRange->getString();
-+ }
-+ else if( sType.equalsIgnoreAsciiCaseAscii( ECMA_FORMCHECKBOX ) )
-+ {
-+ sal_Int32 nValue = 0;
-+ sal_Int32 nCount = mxFormField->getParamCount();
-+ for( sal_Int32 i = 0; i < nCount; i++ )
-+ {
-+ if( mxFormField->getParamName(i).equalsIgnoreAsciiCaseAscii( ECMA_FORMCHECKBOX_CHECKED ) )
-+ {
-+ if( mxFormField->getParamValue(i).equalsIgnoreAsciiCaseAscii("on") )
-+ nValue = 1;
-+ else
-+ nValue = 0;
-+ break;
-+ }
-+
-+ }
-+ sResult = rtl::OUString::valueOf( nValue );
-+ }
-+ else
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+ return sResult;
-+}
-+
-+void SAL_CALL SwVbaFormField::setResult( const rtl::OUString& result ) throw ( uno::RuntimeException )
-+{
-+ rtl::OUString sType = mxFormField->getFieldType();
-+ if( sType.equalsIgnoreAsciiCaseAscii( ECMA_FORMTEXT ) )
-+ {
-+ uno::Reference< text::XTextContent > xTextContent( mxFormField, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextRange > xTextRange = xTextContent->getAnchor();
-+ xTextRange->setString( result );
-+ }
-+ else if( sType.equalsIgnoreAsciiCaseAscii( ECMA_FORMCHECKBOX ) )
-+ {
-+ // do nothing
-+ }
-+ else
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+}
-+
-+sal_Bool SAL_CALL SwVbaFormField::getEnabled() throw ( uno::RuntimeException )
-+{
-+ //allways return true
-+ return sal_True;
-+}
-+
-+void SAL_CALL SwVbaFormField::setEnabled( sal_Bool/* enabled */ ) throw ( uno::RuntimeException )
-+{
-+ // not support in Writer
-+}
-+
-+uno::Any SAL_CALL SwVbaFormField::CheckBox() throw ( uno::RuntimeException )
-+{
-+ return uno::makeAny( uno::Reference< word::XCheckBox >( new SwVbaCheckBox( this, mxContext, mxModel, mxFormField ) ) );
-+}
-+
-+rtl::OUString&
-+SwVbaFormField::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaFormField") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaFormField::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.FormField" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbaformfield.hxx sw/source/ui/vba/vbaformfield.hxx
-new file mode 100644
-index 0000000..e3a2d7f
---- /dev/null
-+++ sw/source/ui/vba/vbaformfield.hxx
-@@ -0,0 +1,61 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_FORMFIELD_HXX
-+#define SW_VBA_FORMFIELD_HXX
-+
-+#include <ooo/vba/word/XFormField.hpp>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/text/XFormField.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XFormField > SwVbaFormField_BASE;
-+
-+class SwVbaFormField : public SwVbaFormField_BASE
-+{
-+private:
-+ css::uno::Reference< css::frame::XModel > mxModel;
-+ css::uno::Reference< css::text::XFormField > mxFormField;
-+
-+public:
-+ SwVbaFormField( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& rModel, const css::uno::Reference< css::text::XFormField >& xFormField ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaFormField();
-+
-+ // Methods
-+ rtl::OUString SAL_CALL getResult() throw ( css::uno::RuntimeException );
-+ void SAL_CALL setResult( const rtl::OUString& result ) throw ( css::uno::RuntimeException );
-+ sal_Bool SAL_CALL getEnabled() throw ( css::uno::RuntimeException );
-+ void SAL_CALL setEnabled( sal_Bool enabled ) throw ( css::uno::RuntimeException );
-+ css::uno::Any SAL_CALL CheckBox() throw ( css::uno::RuntimeException );
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_FORMFIELD_HXX */
-diff --git sw/source/ui/vba/vbaformfields.cxx sw/source/ui/vba/vbaformfields.cxx
-new file mode 100644
-index 0000000..b56cff8
---- /dev/null
-+++ sw/source/ui/vba/vbaformfields.cxx
-@@ -0,0 +1,205 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbaformfields.hxx"
-+#include "vbaformfield.hxx"
-+#include <com/sun/star/container/XNamed.hpp>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include <com/sun/star/text/XTextViewCursor.hpp>
-+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
-+#include "wordvbahelper.hxx"
-+#include <cppuhelper/implbase3.hxx>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+typedef std::vector< uno::Reference< text::XFormField > > XFormFieldVec;
-+typedef ::cppu::WeakImplHelper1< container::XEnumeration > FormFiledEnumeration_BASE;
-+typedef ::cppu::WeakImplHelper3< container::XNameAccess, container::XIndexAccess, container::XEnumerationAccess > FormFieldCollectionHelper_BASE;
-+
-+rtl::OUString lcl_getFormFieldName( const uno::Reference< text::XFormField >& xFormField )
-+{
-+ rtl::OUString sName;
-+ sal_Int32 nCount = xFormField->getParamCount();
-+ for( sal_Int32 i = 0; i < nCount; i++ )
-+ {
-+ if( xFormField->getParamName(i).equalsIgnoreAsciiCaseAscii( "Name" ) )
-+ {
-+ sName = xFormField->getParamValue(i);
-+ OSL_TRACE("lcl_getFormFieldName: %s", rtl::OUStringToOString( sName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ break;
-+ }
-+ }
-+ return sName;
-+}
-+
-+class FormFieldsEnumeration : public FormFiledEnumeration_BASE
-+{
-+private:
-+ uno::Reference< XHelperInterface > mxParent;
-+ uno::Reference< uno::XComponentContext > mxContext;
-+ uno::Reference< frame::XModel > mxModel;
-+ XFormFieldVec mxFormFields;
-+ XFormFieldVec::iterator cachePos;
-+public:
-+ FormFieldsEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel, const XFormFieldVec& xFormFiels ) throw (uno::RuntimeException) : mxParent( xParent ), mxContext( xContext ), mxModel( xModel ), mxFormFields( xFormFiels ), cachePos( mxFormFields.begin() )
-+ {
-+ }
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( cachePos != mxFormFields.end() );
-+ }
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( !hasMoreElements() )
-+ throw container::NoSuchElementException();
-+ uno::Reference< text::XFormField > xFormField( *cachePos++ );
-+ return uno::makeAny( uno::Reference< word::XFormField > ( new SwVbaFormField( mxParent, mxContext, mxModel, xFormField ) ) );
-+ }
-+
-+};
-+
-+class FormFieldCollectionHelper : public FormFieldCollectionHelper_BASE
-+{
-+private:
-+ uno::Reference< XHelperInterface > mxParent;
-+ uno::Reference< uno::XComponentContext > mxContext;
-+ uno::Reference< frame::XModel > mxModel;
-+ XFormFieldVec mxFormFields;
-+ XFormFieldVec::iterator cachePos;
-+public:
-+ FormFieldCollectionHelper( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException) : mxParent( xParent ), mxContext( xContext ), mxModel( xModel )
-+ {
-+ uno::Reference< text::XBookmarksSupplier > xBookmarksSupplier( xModel,uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xIndexAccess( xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY_THROW );
-+ sal_Int32 nCount = xIndexAccess->getCount();
-+ for( sal_Int32 i = 0; i < nCount; i++ )
-+ {
-+ uno::Reference< text::XFormField > xFormField( xIndexAccess->getByIndex( i ), uno::UNO_QUERY );
-+ if( xFormField.is() )
-+ mxFormFields.push_back( xFormField );
-+ }
-+ cachePos = mxFormFields.begin();
-+ }
-+ // XElementAccess
-+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) { return word::XFormField::static_type(0); }
-+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) { return getCount() > 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();
-+ uno::Reference< text::XFormField > xFormField( *cachePos, uno::UNO_QUERY_THROW );
-+ return uno::makeAny( uno::Reference< word::XFormField >( new SwVbaFormField( mxParent, mxContext, mxModel, xFormField ) ) );
-+ }
-+ virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException)
-+ {
-+ uno::Sequence< rtl::OUString > sNames( mxFormFields.size() );
-+ rtl::OUString* pString = sNames.getArray();
-+ XFormFieldVec::iterator it = mxFormFields.begin();
-+ XFormFieldVec::iterator it_end = mxFormFields.end();
-+ for ( ; it != it_end; ++it, ++pString )
-+ {
-+ uno::Reference< text::XFormField > xFormField( *cachePos, uno::UNO_QUERY_THROW );
-+ *pString = lcl_getFormFieldName( xFormField );
-+ }
-+ return sNames;
-+ }
-+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
-+ {
-+ cachePos = mxFormFields.begin();
-+ XFormFieldVec::iterator it_end = mxFormFields.end();
-+ for ( ; cachePos != it_end; ++cachePos )
-+ {
-+ //uno::Reference< container::XNamed > xName( *cachePos, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XFormField > xFormField( *cachePos, uno::UNO_QUERY_THROW );
-+ if ( aName.equalsIgnoreAsciiCase( lcl_getFormFieldName( xFormField )) )
-+ break;
-+ }
-+ return ( cachePos != it_end );
-+ }
-+ // XIndexAccess
-+ virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
-+ {
-+ return mxFormFields.size();
-+ }
-+ virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
-+ {
-+ if ( Index < 0 || Index >= getCount() )
-+ throw lang::IndexOutOfBoundsException();
-+ return uno::makeAny( uno::Reference< word::XFormField >( new SwVbaFormField( mxParent, mxContext, mxModel, mxFormFields[ Index ] ) ) );
-+ }
-+ // XEnumerationAccess
-+ virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
-+ {
-+ return new FormFieldsEnumeration( mxParent, mxContext, mxModel, mxFormFields );
-+ }
-+};
-+
-+SwVbaFormFields::SwVbaFormFields( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel ): SwVbaFormFields_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new FormFieldCollectionHelper( xParent, xContext, xModel ) ) ), mxModel( xModel )
-+{
-+}
-+// XEnumerationAccess
-+uno::Type
-+SwVbaFormFields::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XFormField::static_type(0);
-+}
-+uno::Reference< container::XEnumeration >
-+SwVbaFormFields::createEnumeration() throw (uno::RuntimeException)
-+{
-+ uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
-+ return xEnumAccess->createEnumeration();
-+}
-+
-+uno::Any
-+SwVbaFormFields::createCollectionObject( const css::uno::Any& aSource )
-+{
-+ return aSource;
-+}
-+
-+rtl::OUString&
-+SwVbaFormFields::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaFormFields") );
-+ return sImplName;
-+}
-+
-+css::uno::Sequence<rtl::OUString>
-+SwVbaFormFields::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.FormFields") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbaformfields.hxx sw/source/ui/vba/vbaformfields.hxx
-new file mode 100644
-index 0000000..76ef6bb
---- /dev/null
-+++ sw/source/ui/vba/vbaformfields.hxx
-@@ -0,0 +1,60 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_FORMFIELDS_HXX
-+#define SW_VBA_FORMFIELDS_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XFormFields.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/text/XBookmarksSupplier.hpp>
-+#include <com/sun/star/text/XTextRange.hpp>
-+
-+typedef CollTestImplHelper< ooo::vba::word::XFormFields > SwVbaFormFields_BASE;
-+
-+class SwVbaFormFields : public SwVbaFormFields_BASE
-+{
-+private:
-+ css::uno::Reference< css::frame::XModel > mxModel;
-+
-+public:
-+ SwVbaFormFields( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel );
-+ virtual ~SwVbaFormFields() {}
-+
-+ // 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);
-+
-+ // SwVbaFormFields_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* SW_VBA_FORMFIELDS_HXX */
-diff --git sw/source/ui/vba/vbaframe.cxx sw/source/ui/vba/vbaframe.cxx
-new file mode 100644
-index 0000000..bec1aa6
---- /dev/null
-+++ sw/source/ui/vba/vbaframe.cxx
-@@ -0,0 +1,75 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbaframe.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include <com/sun/star/text/XTextContent.hpp>
-+#include <com/sun/star/text/XTextViewCursor.hpp>
-+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
-+#include <com/sun/star/view/XSelectionSupplier.hpp>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaFrame::SwVbaFrame( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const css::uno::Reference< frame::XModel >& rModel, const css::uno::Reference< text::XTextFrame >& xTextFrame ) throw ( css::uno::RuntimeException ) :
-+ SwVbaFrame_BASE( rParent, rContext ), mxModel( rModel ), mxTextFrame( xTextFrame )
-+{
-+}
-+
-+SwVbaFrame::~SwVbaFrame()
-+{
-+}
-+
-+void SAL_CALL SwVbaFrame::Select() throw ( uno::RuntimeException )
-+{
-+ uno::Reference< view::XSelectionSupplier > xSelectSupp( mxModel->getCurrentController(), uno::UNO_QUERY_THROW );
-+ xSelectSupp->select( uno::makeAny( mxTextFrame ) );
-+}
-+
-+rtl::OUString&
-+SwVbaFrame::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaFrame") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaFrame::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Frame" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbaframe.hxx sw/source/ui/vba/vbaframe.hxx
-new file mode 100644
-index 0000000..a36ebf8
---- /dev/null
-+++ sw/source/ui/vba/vbaframe.hxx
-@@ -0,0 +1,57 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_FRAME_HXX
-+#define SW_VBA_FRAME_HXX
-+
-+#include <ooo/vba/word/XFrame.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/text/XTextFrame.hpp>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XFrame > SwVbaFrame_BASE;
-+
-+class SwVbaFrame : public SwVbaFrame_BASE
-+{
-+private:
-+ css::uno::Reference< css::frame::XModel > mxModel;
-+ css::uno::Reference< css::text::XTextFrame > mxTextFrame;
-+
-+public:
-+ SwVbaFrame( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& rModel, const css::uno::Reference< css::text::XTextFrame >& xTextFrame ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaFrame();
-+
-+ // Methods
-+ virtual void SAL_CALL Select() throw ( css::uno::RuntimeException );
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_FRAME_HXX */
-diff --git sw/source/ui/vba/vbaframes.cxx sw/source/ui/vba/vbaframes.cxx
-new file mode 100644
-index 0000000..2c9fa92
---- /dev/null
-+++ sw/source/ui/vba/vbaframes.cxx
-@@ -0,0 +1,109 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbaframes.hxx"
-+#include "vbaframe.hxx"
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include <com/sun/star/text/XTextViewCursor.hpp>
-+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
-+#include "wordvbahelper.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+typedef ::cppu::WeakImplHelper1< container::XEnumeration > FramesEnumeration_Base;
-+class FramesEnumeration : public FramesEnumeration_Base
-+{
-+private:
-+ uno::Reference< XHelperInterface > mxParent;
-+ uno::Reference< uno::XComponentContext > mxContext;
-+ uno::Reference< container::XIndexAccess> mxIndexAccess;
-+ uno::Reference< frame::XModel > mxModel;
-+ sal_Int32 nCurrentPos;
-+public:
-+ FramesEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess, const uno::Reference< frame::XModel >& xModel ) throw ( uno::RuntimeException ) : mxParent( xParent ), mxContext( xContext), mxIndexAccess( xIndexAccess ), mxModel( xModel ), nCurrentPos(0)
-+ {
-+ }
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( nCurrentPos < mxIndexAccess->getCount() );
-+ }
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( !hasMoreElements() )
-+ throw container::NoSuchElementException();
-+ uno::Reference< text::XTextFrame > xTextFrame( mxIndexAccess->getByIndex( nCurrentPos++ ), uno::UNO_QUERY_THROW );
-+ return uno::makeAny( uno::Reference< word::XFrame > ( new SwVbaFrame( mxParent, mxContext, mxModel, xTextFrame ) ) );
-+ }
-+
-+};
-+
-+SwVbaFrames::SwVbaFrames( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< container::XIndexAccess >& xFrames, const uno::Reference< frame::XModel >& xModel ): SwVbaFrames_BASE( xParent, xContext, xFrames ), mxModel( xModel )
-+{
-+ mxFramesSupplier.set( mxModel, uno::UNO_QUERY_THROW );
-+}
-+// XEnumerationAccess
-+uno::Type
-+SwVbaFrames::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XFrame::static_type(0);
-+}
-+
-+uno::Reference< container::XEnumeration >
-+SwVbaFrames::createEnumeration() throw (uno::RuntimeException)
-+{
-+ return new FramesEnumeration( this, mxContext,m_xIndexAccess, mxModel );
-+}
-+
-+uno::Any
-+SwVbaFrames::createCollectionObject( const css::uno::Any& aSource )
-+{
-+ uno::Reference< text::XTextFrame > xTextFrame( aSource, uno::UNO_QUERY_THROW );
-+ return uno::makeAny( uno::Reference< word::XFrame > ( new SwVbaFrame( this, mxContext, mxModel, xTextFrame ) ) );
-+}
-+
-+rtl::OUString&
-+SwVbaFrames::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaFrames") );
-+ return sImplName;
-+}
-+
-+css::uno::Sequence<rtl::OUString>
-+SwVbaFrames::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Frames") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbaframes.hxx sw/source/ui/vba/vbaframes.hxx
-new file mode 100644
-index 0000000..0957820
---- /dev/null
-+++ sw/source/ui/vba/vbaframes.hxx
-@@ -0,0 +1,61 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_FRAMES_HXX
-+#define SW_VBA_FRAMES_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XFrames.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/text/XTextFramesSupplier.hpp>
-+
-+typedef CollTestImplHelper< ooo::vba::word::XFrames > SwVbaFrames_BASE;
-+
-+class SwVbaFrames : public SwVbaFrames_BASE
-+{
-+private:
-+ css::uno::Reference< css::frame::XModel > mxModel;
-+ css::uno::Reference< css::text::XTextFramesSupplier > mxFramesSupplier;
-+
-+public:
-+ SwVbaFrames( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::container::XIndexAccess >& xFrames, const css::uno::Reference< css::frame::XModel >& xModel );
-+ virtual ~SwVbaFrames() {}
-+
-+ // 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);
-+
-+ // SwVbaFrames_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+
-+};
-+
-+#endif /* SW_VBA_FRAMES_HXX */
-diff --git sw/source/ui/vba/vbaglobals.cxx sw/source/ui/vba/vbaglobals.cxx
-index 0770ea3..c801294 100644
---- sw/source/ui/vba/vbaglobals.cxx
-+++ sw/source/ui/vba/vbaglobals.cxx
-@@ -129,6 +129,12 @@ SwVbaGlobals::Dialogs( const uno::Any& index ) throw (uno::RuntimeException)
- return getApplication()->Dialogs( index );
- }
-
-+uno::Any SAL_CALL
-+SwVbaGlobals::ListGalleries( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ return getApplication()->ListGalleries( index );
-+}
-+
- uno::Reference<word::XSelection > SAL_CALL
- SwVbaGlobals::getSelection() throw (uno::RuntimeException)
- {
-diff --git sw/source/ui/vba/vbaglobals.hxx sw/source/ui/vba/vbaglobals.hxx
-index ad6ce95..1e7d587 100644
---- sw/source/ui/vba/vbaglobals.hxx
-+++ sw/source/ui/vba/vbaglobals.hxx
-@@ -69,6 +69,7 @@ public:
- virtual css::uno::Any SAL_CALL Documents( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Addins( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Dialogs( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL ListGalleries( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
- virtual float SAL_CALL CentimetersToPoints( float _Centimeters ) throw (css::uno::RuntimeException);
- // XMultiServiceFactory
- virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames( ) throw (css::uno::RuntimeException);
-diff --git sw/source/ui/vba/vbaheaderfooter.cxx sw/source/ui/vba/vbaheaderfooter.cxx
-index ec3b0ce..6cdbfcb 100644
---- sw/source/ui/vba/vbaheaderfooter.cxx
-+++ sw/source/ui/vba/vbaheaderfooter.cxx
-@@ -81,6 +81,7 @@ uno::Reference< word::XRange > SAL_CALL SwVbaHeaderFooter::getRange() throw (uno
- uno::Any SAL_CALL
- SwVbaHeaderFooter::Shapes( const uno::Any& index ) throw (uno::RuntimeException)
- {
-+ // #FIXME: only get the shapes in the current header/footer
- uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxModel, uno::UNO_QUERY_THROW );
- //uno::Reference< drawing::XShapes > xShapes( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
- uno::Reference< container::XIndexAccess > xIndexAccess( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
-diff --git sw/source/ui/vba/vbaheaderfooterhelper.cxx sw/source/ui/vba/vbaheaderfooterhelper.cxx
-index d91f37a..36a921b 100644
---- sw/source/ui/vba/vbaheaderfooterhelper.cxx
-+++ sw/source/ui/vba/vbaheaderfooterhelper.cxx
-@@ -29,8 +29,12 @@
- #include <comphelper/processfactory.hxx>
- #include <com/sun/star/frame/XController.hpp>
- #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
-+#include <com/sun/star/text/XTextRangeCompare.hpp>
-+#include <com/sun/star/text/XTextRange.hpp>
- #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
- #include <com/sun/star/container/XNameAccess.hpp>
-+#include <com/sun/star/lang/XServiceInfo.hpp>
-+#include <com/sun/star/lang/IllegalArgumentException.hpp>
-
- using namespace ::com::sun::star;
- using namespace ::ooo::vba;
-@@ -38,41 +42,61 @@ using namespace ::ooo::vba;
- #define FIRST_PAGE 1;
-
- // Class HeaderFooterHelper
-+sal_Bool HeaderFooterHelper::isHeaderFooter( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
-+{
-+ return isHeaderFooter( word::getCurrentXText( xModel ) );
-+}
-
--sal_Bool HeaderFooterHelper::isHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
-+sal_Bool HeaderFooterHelper::isHeaderFooter( const uno::Reference< text::XText >& xText ) throw (uno::RuntimeException)
- {
-- uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
-- uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW );
--
-- sal_Bool isOn = sal_False;
-- xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn"))) >>= isOn;
-- if( !isOn )
-- return sal_False;
-+ uno::Reference< lang::XServiceInfo > xServiceInfo( xText, uno::UNO_QUERY_THROW );
-+ rtl::OUString aImplName = xServiceInfo->getImplementationName();
-+ if( aImplName.equalsAscii("SwXHeadFootText") )
-+ return sal_True;
-+ return sal_False;
-+}
-
-- sal_Bool isShared = sal_False;
-- xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsShared"))) >>= isShared;
-+sal_Bool HeaderFooterHelper::isHeader( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
-+{
-+ const uno::Reference< text::XText > xCurrentText = word::getCurrentXText( xModel );
-+ if( !isHeaderFooter( xCurrentText ) )
-+ return sal_False;
-
-+ rtl::OUString aPropIsShared = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsShared") );
- rtl::OUString aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderText") );
-+ uno::Reference< style::XStyle > xPageStyle = word::getCurrentPageStyle( xModel );
-+ uno::Reference< beans::XPropertySet > xPageProps( xPageStyle, uno::UNO_QUERY_THROW );
-+ sal_Bool isShared = sal_True;
-+ xPageProps->getPropertyValue( aPropIsShared ) >>= isShared;
- if( !isShared )
- {
-+ uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
- if( 0 == xPageCursor->getPage() % 2 )
-- {
- aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderTextLeft") );
-- }
- else
-- {
- aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderTextRight") );
-- }
- }
--
-- uno::Reference< text::XText > xText( xStyleProps->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW );
-- //FIXME: can not compare in this way?
-- return ( xText == xCurrentText );
-+
-+ uno::Reference< text::XText > xHeaderText( xPageProps->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextRangeCompare > xTRC( xHeaderText, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextRange > xTR1( xCurrentText, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextRange > xTR2( xHeaderText, uno::UNO_QUERY_THROW );
-+ try
-+ {
-+ if( xTRC->compareRegionStarts( xTR1, xTR2 ) == 0 )
-+ return sal_True;
-+ }
-+ catch( lang::IllegalArgumentException& )
-+ {
-+ return sal_False;
-+ }
-+
-+ return sal_False;
- }
-
--sal_Bool HeaderFooterHelper::isFirstPageHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
-+sal_Bool HeaderFooterHelper::isFirstPageHeader( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
- {
-- if( isHeader( xModel, xCurrentText ) )
-+ if( isHeader( xModel ) )
- {
- uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
- // FIXME: getPage allways returns 1
-@@ -82,9 +106,9 @@ sal_Bool HeaderFooterHelper::isFirstPageHeader( const uno::Reference< frame::XMo
- return sal_False;
- }
-
--sal_Bool HeaderFooterHelper::isEvenPagesHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
-+sal_Bool HeaderFooterHelper::isEvenPagesHeader( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
- {
-- if( isHeader( xModel, xCurrentText ) )
-+ if( isHeader( xModel ) )
- {
- uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW );
- sal_Bool isShared = sal_False;
-@@ -98,40 +122,47 @@ sal_Bool HeaderFooterHelper::isEvenPagesHeader( const uno::Reference< frame::XMo
- return sal_False;
- }
-
--sal_Bool HeaderFooterHelper::isFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
-+sal_Bool HeaderFooterHelper::isFooter( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
- {
-- uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
-- uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW );
--
-- sal_Bool isOn = sal_False;
-- xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn"))) >>= isOn;
-- if( !isOn )
-+ const uno::Reference< text::XText > xCurrentText = word::getCurrentXText( xModel );
-+ if( !isHeaderFooter( xCurrentText ) )
- return sal_False;
-
-- sal_Bool isShared = sal_False;
-- xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsShared"))) >>= isShared;
--
-+ rtl::OUString aPropIsShared = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsShared") );
- rtl::OUString aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterText") );
-+ uno::Reference< style::XStyle > xPageStyle = word::getCurrentPageStyle( xModel );
-+ uno::Reference< beans::XPropertySet > xPageProps( xPageStyle, uno::UNO_QUERY_THROW );
-+ sal_Bool isShared = sal_True;
-+ xPageProps->getPropertyValue( aPropIsShared ) >>= isShared;
- if( !isShared )
- {
-+ uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
- if( 0 == xPageCursor->getPage() % 2 )
-- {
- aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterTextLeft") );
-- }
- else
-- {
- aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterTextRight") );
-- }
- }
--
-- uno::Reference< text::XText > xText( xStyleProps->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW );
-
-- return ( xText == xCurrentText );
-+ uno::Reference< text::XText > xFooterText( xPageProps->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextRangeCompare > xTRC( xFooterText, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextRange > xTR1( xCurrentText, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextRange > xTR2( xFooterText, uno::UNO_QUERY_THROW );
-+ try
-+ {
-+ if( xTRC->compareRegionStarts( xTR1, xTR2 ) == 0 )
-+ return sal_True;
-+ }
-+ catch( lang::IllegalArgumentException& )
-+ {
-+ return sal_False;
-+ }
-+
-+ return sal_False;
- }
-
--sal_Bool HeaderFooterHelper::isFirstPageFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
-+sal_Bool HeaderFooterHelper::isFirstPageFooter( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
- {
-- if( isFooter( xModel, xCurrentText ) )
-+ if( isFooter( xModel ) )
- {
- uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
- sal_Int32 nPage = xPageCursor->getPage();
-@@ -140,9 +171,9 @@ sal_Bool HeaderFooterHelper::isFirstPageFooter( const uno::Reference< frame::XMo
- return sal_False;
- }
-
--sal_Bool HeaderFooterHelper::isEvenPagesFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
-+sal_Bool HeaderFooterHelper::isEvenPagesFooter( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
- {
-- if( isFooter( xModel, xCurrentText ) )
-+ if( isFooter( xModel ) )
- {
- uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW );
- sal_Bool isShared = sal_False;
-@@ -158,18 +189,18 @@ sal_Bool HeaderFooterHelper::isEvenPagesFooter( const uno::Reference< frame::XMo
- #ifdef TOMORROW
- sal_Bool HeaderFooterHelper::isPrimaryHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
- {
-- if( isHeader( xModel, xCurrentText ) )
-+ if( isHeader( xModel ) )
- {
-- return( !( isFirstPageHeader( xModel, xCurrentText ) && isEvenPagesHeader( xModel, xCurrentText ) ) );
-+ return( !( isFirstPageHeader( xModel ) && isEvenPagesHeader( xModel ) ) );
- }
- return sal_False;
- }
-
--sal_Bool HeaderFooterHelper::isPrimaryFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
-+sal_Bool HeaderFooterHelper::isPrimaryFooter( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
- {
-- if( isHeader( xModel, xCurrentText ) )
-+ if( isHeader( xModel ) )
- {
-- return( !( isFirstPageFooter( xModel, xCurrentText ) && isEvenPagesFooter( xModel, xCurrentText ) ) );
-+ return( !( isFirstPageFooter( xModel ) && isEvenPagesFooter( xModel ) ) );
- }
- return sal_False;
- }
-diff --git sw/source/ui/vba/vbaheaderfooterhelper.hxx sw/source/ui/vba/vbaheaderfooterhelper.hxx
-index 0e5fd4c..dbcd53d 100644
---- sw/source/ui/vba/vbaheaderfooterhelper.hxx
-+++ sw/source/ui/vba/vbaheaderfooterhelper.hxx
-@@ -36,12 +36,16 @@
- class HeaderFooterHelper
- {
- public:
-- static sal_Bool isHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-- static sal_Bool isFirstPageHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-- static sal_Bool isEvenPagesHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-- static sal_Bool isFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-- static sal_Bool isFirstPageFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-- static sal_Bool isEvenPagesFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-+ static sal_Bool isHeaderFooter( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
-+ static sal_Bool isHeaderFooter( const css::uno::Reference< css::text::XText >& xText ) throw (css::uno::RuntimeException);
-+ static sal_Bool isHeader( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
-+ static sal_Bool isFirstPageHeader( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
-+ static sal_Bool isEvenPagesHeader( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
-+ static sal_Bool isFooter( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
-+ static sal_Bool isFirstPageFooter( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
-+ static sal_Bool isEvenPagesFooter( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
-+ static sal_Bool isPrimaryHeader( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
-+ static sal_Bool isPrimaryFooter( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
- #ifdef TOMORROW
- static sal_Bool isPrimaryHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
- static sal_Bool isPrimaryFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-diff --git sw/source/ui/vba/vbaheadersfooters.cxx sw/source/ui/vba/vbaheadersfooters.cxx
-new file mode 100644
-index 0000000..295314a
---- /dev/null
-+++ sw/source/ui/vba/vbaheadersfooters.cxx
-@@ -0,0 +1,150 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbaheadersfooters.hxx"
-+#include "vbaheaderfooter.hxx"
-+#include <ooo/vba/word/WdHeaderFooterIndex.hpp>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+// I assume there is only one headersfooters in Writer
-+typedef ::cppu::WeakImplHelper1<container::XIndexAccess > HeadersFootersIndexAccess_Base;
-+class HeadersFootersIndexAccess : public HeadersFootersIndexAccess_Base
-+{
-+private:
-+ uno::Reference< XHelperInterface > mxParent;
-+ uno::Reference< uno::XComponentContext > mxContext;
-+ uno::Reference< frame::XModel > mxModel;
-+ uno::Reference< beans::XPropertySet > mxPageStyleProps;
-+ sal_Bool mbHeader;
-+
-+public:
-+ HeadersFootersIndexAccess( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< beans::XPropertySet >& xPageStyleProps, sal_Bool bHeader ) : mxParent( xParent ), mxContext( xContext ), mxModel( xModel ), mxPageStyleProps( xPageStyleProps ), mbHeader( bHeader ) {}
-+ ~HeadersFootersIndexAccess(){}
-+
-+ // XIndexAccess
-+ virtual sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
-+ {
-+ // first page, evenpages and primary page
-+ return 3;
-+ }
-+ virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if( Index < 1 || Index > 3 )
-+ throw container::NoSuchElementException();
-+ return uno::makeAny( uno::Reference< word::XHeaderFooter >( new SwVbaHeaderFooter( mxParent, mxContext, mxModel, mxPageStyleProps, mbHeader, Index ) ) );
-+ }
-+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
-+ {
-+ return word::XHeaderFooter::static_type(0);
-+ }
-+ virtual sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
-+ {
-+ return sal_True;
-+ }
-+};
-+
-+class HeadersFootersEnumWrapper : public EnumerationHelper_BASE
-+{
-+ SwVbaHeadersFooters* pHeadersFooters;
-+ sal_Int32 nIndex;
-+public:
-+ HeadersFootersEnumWrapper( SwVbaHeadersFooters* _pHeadersFooters ) : pHeadersFooters( _pHeadersFooters ), nIndex( 0 ) {}
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( nIndex < pHeadersFooters->getCount() );
-+ }
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( nIndex < pHeadersFooters->getCount() )
-+ return pHeadersFooters->Item( uno::makeAny( ++nIndex ), uno::Any() );
-+ throw container::NoSuchElementException();
-+ }
-+};
-+
-+SwVbaHeadersFooters::SwVbaHeadersFooters( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< beans::XPropertySet >& xPageStyleProps, sal_Bool isHeader ): SwVbaHeadersFooters_BASE( xParent, xContext, new HeadersFootersIndexAccess( xParent, xContext, xModel, xPageStyleProps, isHeader ) ), mxModel( xModel ), mxPageStyleProps( xPageStyleProps ), mbHeader( isHeader )
-+{
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaHeadersFooters::getCount() throw (uno::RuntimeException)
-+{
-+ // wdHeaderFooterFirstPage, wdHeaderFooterPrimary and wdHeaderFooterEvenPages
-+ return 3;
-+}
-+
-+uno::Any SAL_CALL SwVbaHeadersFooters::Item( const uno::Any& Index1, const uno::Any& ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nIndex = 0;
-+ Index1 >>= nIndex;
-+ if( ( nIndex < 1 ) || ( nIndex > 3 ) )
-+ {
-+ throw container::NoSuchElementException();
-+ }
-+ return uno::makeAny( uno::Reference< word::XHeaderFooter >( new SwVbaHeaderFooter( this, mxContext, mxModel, mxPageStyleProps, mbHeader, nIndex ) ) );
-+}
-+
-+// XEnumerationAccess
-+uno::Type
-+SwVbaHeadersFooters::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XHeaderFooter::static_type(0);
-+}
-+uno::Reference< container::XEnumeration >
-+
-+SwVbaHeadersFooters::createEnumeration() throw (uno::RuntimeException)
-+{
-+ return new HeadersFootersEnumWrapper( this );
-+}
-+
-+uno::Any
-+SwVbaHeadersFooters::createCollectionObject( const uno::Any& aSource )
-+{
-+ return aSource;
-+}
-+
-+rtl::OUString&
-+SwVbaHeadersFooters::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaHeadersFooters") );
-+ return sImplName;
-+}
-+
-+uno::Sequence<rtl::OUString>
-+SwVbaHeadersFooters::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.HeadersFooters") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbaheadersfooters.hxx sw/source/ui/vba/vbaheadersfooters.hxx
-new file mode 100644
-index 0000000..9bd7683
---- /dev/null
-+++ sw/source/ui/vba/vbaheadersfooters.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:
-+ * $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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_HEADERSFOOTERS_HXX
-+#define SW_VBA_HEADERSFOOTERS_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XHeadersFooters.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+
-+typedef CollTestImplHelper< ooo::vba::word::XHeadersFooters > SwVbaHeadersFooters_BASE;
-+
-+class SwVbaHeadersFooters : public SwVbaHeadersFooters_BASE
-+{
-+private:
-+ css::uno::Reference< css::frame::XModel > mxModel;
-+ css::uno::Reference< css::beans::XPropertySet > mxPageStyleProps;
-+ sal_Bool mbHeader;
-+
-+public:
-+ SwVbaHeadersFooters( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::beans::XPropertySet >& xProps, sal_Bool isHeader );
-+ virtual ~SwVbaHeadersFooters() {}
-+
-+ virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index1, const css::uno::Any& )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);
-+
-+ // SwVbaHeadersFooters_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* SW_VBA_HEADERSFOOTERS_HXX */
-diff --git sw/source/ui/vba/vbalistformat.cxx sw/source/ui/vba/vbalistformat.cxx
-new file mode 100644
-index 0000000..05d9380
---- /dev/null
-+++ sw/source/ui/vba/vbalistformat.cxx
-@@ -0,0 +1,121 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbalistformat.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include <ooo/vba/word/WdListApplyTo.hpp>
-+#include <ooo/vba/word/WdDefaultListBehavior.hpp>
-+#include <com/sun/star/container/XEnumerationAccess.hpp>
-+#include <com/sun/star/container/XEnumeration.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include "vbalisttemplate.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaListFormat::SwVbaListFormat( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextRange >& xTextRange ) throw ( uno::RuntimeException ) : SwVbaListFormat_BASE( rParent, rContext ), mxTextRange( xTextRange )
-+{
-+}
-+
-+SwVbaListFormat::~SwVbaListFormat()
-+{
-+}
-+
-+void SAL_CALL SwVbaListFormat::ApplyListTemplate( const css::uno::Reference< word::XListTemplate >& ListTemplate, const css::uno::Any& ContinuePreviousList, const css::uno::Any& ApplyTo, const css::uno::Any& DefaultListBehavior ) throw (css::uno::RuntimeException)
-+{
-+ sal_Bool bContinuePreviousList = sal_True;
-+ if( ContinuePreviousList.hasValue() )
-+ ContinuePreviousList >>= bContinuePreviousList;
-+
-+ // "applyto" must be current selection
-+ sal_Int32 bApplyTo = word::WdListApplyTo::wdListApplyToSelection;
-+ if( ApplyTo.hasValue() )
-+ ApplyTo >>= bApplyTo;
-+ if( bApplyTo != word::WdListApplyTo::wdListApplyToSelection )
-+ throw uno::RuntimeException();
-+
-+ // default behaviour must be wdWord8ListBehavior
-+ sal_Int32 nDefaultListBehavior = word::WdDefaultListBehavior::wdWord8ListBehavior;
-+ if( DefaultListBehavior.hasValue() )
-+ DefaultListBehavior >>= nDefaultListBehavior;
-+ if( nDefaultListBehavior != word::WdDefaultListBehavior::wdWord8ListBehavior )
-+ throw uno::RuntimeException();
-+
-+ SwVbaListTemplate* pListTemplate = dynamic_cast< SwVbaListTemplate* >( ListTemplate.get() );
-+
-+ uno::Reference< container::XEnumerationAccess > xEnumAccess( mxTextRange, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XEnumeration > xEnum = xEnumAccess->createEnumeration();
-+ sal_Bool isFirstElement = sal_True;
-+ while( xEnum->hasMoreElements() )
-+ {
-+ uno::Reference< beans::XPropertySet > xProps( xEnum->nextElement(), uno::UNO_QUERY_THROW );
-+ if( isFirstElement )
-+ {
-+ sal_Bool isNumberingRestart = !bContinuePreviousList;
-+ xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaIsNumberingRestart") ), uno::makeAny( isNumberingRestart ) );
-+ if( isNumberingRestart )
-+ {
-+ sal_Int16 nStartValue = 1;
-+ xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingStartValue") ), uno::makeAny( nStartValue ) );
-+ }
-+ isFirstElement = sal_False;
-+ }
-+ else
-+ {
-+ xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaIsNumberingRestart") ), uno::makeAny( sal_False ) );
-+ }
-+ pListTemplate->applyListTemplate( xProps );
-+ }
-+}
-+
-+void SAL_CALL SwVbaListFormat::ConvertNumbersToText( ) throw (css::uno::RuntimeException)
-+{
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+}
-+
-+rtl::OUString&
-+SwVbaListFormat::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaListFormat") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaListFormat::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ListFormat" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbalistformat.hxx sw/source/ui/vba/vbalistformat.hxx
-new file mode 100644
-index 0000000..184312a
---- /dev/null
-+++ sw/source/ui/vba/vbalistformat.hxx
-@@ -0,0 +1,60 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_LISTFORMAT_HXX
-+#define SW_VBA_LISTFORMAT_HXX
-+
-+#include <ooo/vba/word/XListFormat.hpp>
-+#include <ooo/vba/word/XListTemplate.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/text/XTextRange.hpp>
-+#include "vbalisthelper.hxx"
-+
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XListFormat > SwVbaListFormat_BASE;
-+
-+class SwVbaListFormat : public SwVbaListFormat_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XTextRange > mxTextRange;
-+
-+public:
-+ SwVbaListFormat( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextRange >& xTextRange ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaListFormat();
-+
-+ // Methods
-+ virtual void SAL_CALL ApplyListTemplate( const css::uno::Reference< ::ooo::vba::word::XListTemplate >& ListTemplate, const css::uno::Any& ContinuePreviousList, const css::uno::Any& ApplyTo, const css::uno::Any& DefaultListBehavior ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL ConvertNumbersToText( ) throw (css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_LISTFORMAT_HXX */
-diff --git sw/source/ui/vba/vbalistgalleries.cxx sw/source/ui/vba/vbalistgalleries.cxx
-new file mode 100644
-index 0000000..ff09ae2
---- /dev/null
-+++ sw/source/ui/vba/vbalistgalleries.cxx
-@@ -0,0 +1,115 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbalistgalleries.hxx"
-+#include "vbalistgallery.hxx"
-+#include <ooo/vba/word/WdListGalleryType.hpp>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+class ListGalleriesEnumWrapper : public EnumerationHelper_BASE
-+{
-+ SwVbaListGalleries* pListGalleries;
-+ sal_Int32 nIndex;
-+public:
-+ ListGalleriesEnumWrapper( SwVbaListGalleries* pGalleries ) : pListGalleries( pGalleries ), nIndex( 1 ) {}
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( nIndex <= pListGalleries->getCount() );
-+ }
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( nIndex <= pListGalleries->getCount() )
-+ return pListGalleries->Item( uno::makeAny( nIndex++ ), uno::Any() );
-+ throw container::NoSuchElementException();
-+ }
-+};
-+
-+SwVbaListGalleries::SwVbaListGalleries( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextDocument >& xTextDoc ) throw (uno::RuntimeException) : SwVbaListGalleries_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >() ), mxTextDocument( xTextDoc )
-+{
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaListGalleries::getCount() throw (uno::RuntimeException)
-+{
-+ // 3 types of list( bullet, numbered and outline )
-+ return 3;
-+}
-+
-+uno::Any SAL_CALL SwVbaListGalleries::Item( const uno::Any& Index1, const uno::Any& /*not processed in this base class*/ ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nIndex = 0;
-+ if( ( Index1 >>= nIndex ) == sal_True )
-+ {
-+ if( nIndex == word::WdListGalleryType::wdBulletGallery
-+ || nIndex == word::WdListGalleryType::wdNumberGallery
-+ || nIndex == word::WdListGalleryType::wdOutlineNumberGallery )
-+ return uno::makeAny( uno::Reference< word::XListGallery >( new SwVbaListGallery( this, mxContext, mxTextDocument, nIndex ) ) );
-+ }
-+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Index out of bounds") ), uno::Reference< uno::XInterface >() );
-+}
-+
-+// XEnumerationAccess
-+uno::Type
-+SwVbaListGalleries::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XListGallery::static_type(0);
-+}
-+
-+uno::Reference< container::XEnumeration >
-+SwVbaListGalleries::createEnumeration() throw (uno::RuntimeException)
-+{
-+ return new ListGalleriesEnumWrapper( this );
-+}
-+
-+uno::Any
-+SwVbaListGalleries::createCollectionObject( const css::uno::Any& aSource )
-+{
-+ return aSource;
-+}
-+
-+rtl::OUString&
-+SwVbaListGalleries::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaListGalleries") );
-+ return sImplName;
-+}
-+
-+css::uno::Sequence<rtl::OUString>
-+SwVbaListGalleries::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ListGalleries") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbalistgalleries.hxx sw/source/ui/vba/vbalistgalleries.hxx
-new file mode 100644
-index 0000000..36cd0ba
---- /dev/null
-+++ sw/source/ui/vba/vbalistgalleries.hxx
-@@ -0,0 +1,61 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_LISTGALLERIES_HXX
-+#define SW_VBA_LISTGALLERIES_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XListGalleries.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+
-+typedef CollTestImplHelper< ooo::vba::word::XListGalleries > SwVbaListGalleries_BASE;
-+
-+class SwVbaListGalleries : public SwVbaListGalleries_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XTextDocument > mxTextDocument;
-+
-+public:
-+ SwVbaListGalleries( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::text::XTextDocument >& xTextDoc ) throw (css::uno::RuntimeException);
-+ virtual ~SwVbaListGalleries() {}
-+
-+ virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException);
-+ 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 );
-+ // 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);
-+
-+ // SwVbaListGalleries_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* SW_VBA_LISTGALLERIES_HXX */
-diff --git sw/source/ui/vba/vbalistgallery.cxx sw/source/ui/vba/vbalistgallery.cxx
-new file mode 100644
-index 0000000..6ac7e7c
---- /dev/null
-+++ sw/source/ui/vba/vbalistgallery.cxx
-@@ -0,0 +1,73 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbalistgallery.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include "vbalisttemplates.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaListGallery::SwVbaListGallery( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& xTextDoc, sal_Int32 nType ) throw ( uno::RuntimeException ) : SwVbaListGallery_BASE( rParent, rContext ), mxTextDocument( xTextDoc ), mnType( nType )
-+{
-+}
-+
-+SwVbaListGallery::~SwVbaListGallery()
-+{
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaListGallery::ListTemplates( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< XCollection > xCol( new SwVbaListTemplates( mxParent, mxContext, mxTextDocument, mnType ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+rtl::OUString&
-+SwVbaListGallery::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaListGallery") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaListGallery::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ListGallery" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbalistgallery.hxx sw/source/ui/vba/vbalistgallery.hxx
-new file mode 100644
-index 0000000..0ece178
---- /dev/null
-+++ sw/source/ui/vba/vbalistgallery.hxx
-@@ -0,0 +1,58 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_LISTGALLERY_HXX
-+#define SW_VBA_LISTGALLERY_HXX
-+
-+#include <ooo/vba/word/XListGallery.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XListGallery > SwVbaListGallery_BASE;
-+
-+class SwVbaListGallery : public SwVbaListGallery_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XTextDocument > mxTextDocument;
-+ sal_Int32 mnType;
-+
-+public:
-+ SwVbaListGallery( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& xTextDoc, sal_Int32 nType ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaListGallery();
-+
-+ // Methods
-+ virtual css::uno::Any SAL_CALL ListTemplates( const css::uno::Any& index ) throw ( css::uno::RuntimeException );
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_LISTGALLERY_HXX */
-diff --git sw/source/ui/vba/vbalisthelper.cxx sw/source/ui/vba/vbalisthelper.cxx
-new file mode 100644
-index 0000000..34cd6be
---- /dev/null
-+++ sw/source/ui/vba/vbalisthelper.cxx
-@@ -0,0 +1,707 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbalisthelper.hxx"
-+#include <tools/diagnose_ex.h>
-+#include <ooo/vba/word/WdListGalleryType.hpp>
-+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
-+#include <com/sun/star/style/NumberingType.hpp>
-+#include <com/sun/star/container/XIndexReplace.hpp>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+static const sal_Int32 LIST_LEVEL_COUNT = 9;
-+
-+static const char WORD_BULLET_GALLERY[] = "WdBullet";
-+static const char WORD_NUMBER_GALLERY[] = "WdNumber";
-+static const char WORD_OUTLINE_NUMBER_GALLERY[] = "WdOutlineNumber";
-+
-+static const char UNO_NAME_ADJUST[] = "Adjust";
-+static const char UNO_NAME_PARENT_NUMBERING[] = "ParentNumbering";
-+static const char UNO_NAME_PREFIX[] = "Prefix";
-+static const char UNO_NAME_SUFFIX[] = "Suffix";
-+static const char UNO_NAME_CHAR_STYLE_NAME[] = "CharStyleName";
-+static const char UNO_NAME_START_WITH[] = "StartWith";
-+static const char UNO_NAME_POSITION_AND_SPACE_MODE[] = "PositionAndSpaceMode";
-+static const char UNO_NAME_LABEL_FOLLOWED_BY[] = "LabelFollowedBy";
-+static const char UNO_NAME_LIST_TAB_STOP_POSITION[] = "ListtabStopPosition";
-+static const char UNO_NAME_FIRST_LINE_INDENT[] = "FirstLineIndent";
-+static const char UNO_NAME_INDENT_AT[] = "IndentAt";
-+static const char UNO_NAME_NUMBERING_TYPE[] = "NumberingType";
-+static const char UNO_NAME_BULLET_ID[] = "BulletId";
-+static const char UNO_NAME_BULLET_CHAR[] = "BulletChar";
-+static const char UNO_NAME_BULLET_FONT_NAME[] = "BulletFontName";
-+static const char UNO_NAME_BULLET_FONT[] = "BulletFont";
-+
-+static const sal_Int16 CHAR_CLOSED_DOT = 8226;
-+static const sal_Int16 CHAR_EMPTY_DOT = 111;
-+static const sal_Int16 CHAR_SQUARE = 9632;
-+static const sal_Int16 CHAR_STAR_SYMBOL = 10026;
-+static const sal_Int16 CHAR_FOUR_DIAMONDS = 10070;
-+static const sal_Int16 CHAR_DIAMOND = 10022;
-+static const sal_Int16 CHAR_ARROW = 10146;
-+static const sal_Int16 CHAR_CHECK_MARK = 10003;
-+
-+SwVbaListHelper::SwVbaListHelper( const css::uno::Reference< css::text::XTextDocument >& xTextDoc, sal_Int32 nGalleryType, sal_Int32 nTemplateType ) throw( css::uno::RuntimeException ) : mxTextDocument( xTextDoc ), mnGalleryType( nGalleryType ), mnTemplateType( nTemplateType )
-+{
-+ Init();
-+}
-+
-+void SwVbaListHelper::Init() throw( css::uno::RuntimeException )
-+{
-+ // set the numbering style name
-+ switch( mnGalleryType )
-+ {
-+ case word::WdListGalleryType::wdBulletGallery:
-+ {
-+ msStyleName = rtl::OUString::createFromAscii( WORD_BULLET_GALLERY );
-+ break;
-+ }
-+ case word::WdListGalleryType::wdNumberGallery:
-+ {
-+ msStyleName = rtl::OUString::createFromAscii( WORD_NUMBER_GALLERY );
-+ break;
-+ }
-+ case word::WdListGalleryType::wdOutlineNumberGallery:
-+ {
-+ msStyleName = rtl::OUString::createFromAscii( WORD_OUTLINE_NUMBER_GALLERY );
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException();
-+ }
-+ }
-+ msStyleName += rtl::OUString::valueOf( mnTemplateType );
-+
-+ // get the numbering style
-+ uno::Reference< style::XStyleFamiliesSupplier > xStyleSupplier( mxTextDocument, uno::UNO_QUERY_THROW );
-+ mxStyleFamily.set( xStyleSupplier->getStyleFamilies()->getByName(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingStyles") ) ), uno::UNO_QUERY_THROW );
-+ OSL_TRACE("SwVbaListHelper::Init: numbering style name: %s", rtl::OUStringToOString( msStyleName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ if( mxStyleFamily->hasByName( msStyleName ) )
-+ {
-+ mxStyleProps.set( mxStyleFamily->getByName( msStyleName ), uno::UNO_QUERY_THROW );
-+ mxNumberingRules.set( mxStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingRules") ) ), uno::UNO_QUERY_THROW );
-+ }
-+ else
-+ {
-+ // create new numbering style
-+ uno::Reference< lang::XMultiServiceFactory > xDocMSF( mxTextDocument, uno::UNO_QUERY_THROW );
-+ mxStyleProps.set( xDocMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.NumberingStyle") ) ), uno::UNO_QUERY_THROW );
-+ // insert this style into style family, or the property NumberingRules doesn't exist.
-+ mxStyleFamily->insertByName( msStyleName, uno::makeAny( mxStyleProps ) );
-+ mxStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingRules") ) ) >>= mxNumberingRules;
-+ //mxNumberingRules.set( xDocMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.NumberingRules") ) ), uno::UNO_QUERY_THROW );
-+
-+ CreateListTemplate();
-+
-+ mxStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingRules") ) , uno::makeAny( mxNumberingRules ) );
-+ }
-+}
-+
-+void SwVbaListHelper::CreateListTemplate() throw( css::uno::RuntimeException )
-+{
-+ switch( mnGalleryType )
-+ {
-+ case word::WdListGalleryType::wdBulletGallery:
-+ {
-+ CreateBulletListTemplate();
-+ break;
-+ }
-+ case word::WdListGalleryType::wdNumberGallery:
-+ {
-+ CreateNumberListTemplate();
-+ break;
-+ }
-+ case word::WdListGalleryType::wdOutlineNumberGallery:
-+ {
-+ CreateOutlineNumberListTemplate();
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException();
-+ }
-+ }
-+}
-+
-+void SwVbaListHelper::CreateBulletListTemplate() throw( css::uno::RuntimeException )
-+{
-+ // there is only 1 level for each bullet list in MSWord
-+ sal_Int32 nLevel = 0;
-+ uno::Sequence< beans::PropertyValue > aPropertyValues;
-+ mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
-+ rtl::OUString sCharStyleName( RTL_CONSTASCII_USTRINGPARAM("Bullet Symbols") );
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_CHAR_STYLE_NAME ), uno::makeAny( sCharStyleName ) );
-+ sal_Int16 nNumberingType = style::NumberingType::CHAR_SPECIAL;
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
-+
-+ rtl::OUString aBulletChar;
-+ switch( mnTemplateType )
-+ {
-+ case 1:
-+ {
-+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_CLOSED_DOT ) );
-+ break;
-+ }
-+ case 2:
-+ {
-+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_EMPTY_DOT ) );
-+ break;
-+ }
-+ case 3:
-+ {
-+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_SQUARE ) );
-+ break;
-+ }
-+ case 4:
-+ {
-+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_STAR_SYMBOL ) );
-+ break;
-+ }
-+ case 5:
-+ {
-+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_FOUR_DIAMONDS ) );
-+ break;
-+ }
-+ case 6:
-+ {
-+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_ARROW ) );
-+ break;
-+ }
-+ case 7:
-+ {
-+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_CHECK_MARK ) );
-+ break;
-+ }
-+ default:
-+ {
-+ // we only support 7 types template now
-+ throw css::uno::RuntimeException();
-+ }
-+ }
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_BULLET_CHAR ), uno::makeAny( aBulletChar ) );
-+
-+ mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
-+}
-+
-+void SwVbaListHelper::CreateNumberListTemplate() throw( css::uno::RuntimeException )
-+{
-+ // there is only 1 level for each bullet list in MSWord
-+ sal_Int32 nLevel = 0;
-+ uno::Sequence< beans::PropertyValue > aPropertyValues;
-+ mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
-+
-+ sal_Int16 nNumberingType = 0;
-+ rtl::OUString sSuffix;
-+ switch( mnTemplateType )
-+ {
-+ case 1:
-+ {
-+ nNumberingType = style::NumberingType::ARABIC;
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ case 2:
-+ {
-+ nNumberingType = style::NumberingType::ARABIC;
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 3:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_UPPER;
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ case 4:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_UPPER_LETTER;
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ case 5:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 6:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ case 7:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_LOWER;
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ default:
-+ {
-+ // we only support 7 types template now
-+ throw css::uno::RuntimeException();
-+ }
-+ }
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_SUFFIX ), uno::makeAny( sSuffix ) );
-+
-+ mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
-+}
-+
-+void SwVbaListHelper::CreateOutlineNumberListTemplate() throw( css::uno::RuntimeException )
-+{
-+ switch( mnTemplateType )
-+ {
-+ case 1:
-+ {
-+ CreateOutlineNumberForType1();
-+ break;
-+ }
-+ case 2:
-+ {
-+ CreateOutlineNumberForType2();
-+ break;
-+ }
-+ case 3:
-+ {
-+ CreateOutlineNumberForType3();
-+ break;
-+ }
-+ case 4:
-+ {
-+ CreateOutlineNumberForType4();
-+ break;
-+ }
-+ case 5:
-+ {
-+ CreateOutlineNumberForType5();
-+ break;
-+ }
-+ case 6:
-+ {
-+ CreateOutlineNumberForType6();
-+ break;
-+ }
-+ case 7:
-+ {
-+ CreateOutlineNumberForType7();
-+ break;
-+ }
-+ default:
-+ {
-+ // we only support 7 types template now
-+ throw css::uno::RuntimeException();
-+ }
-+ }
-+}
-+
-+void SwVbaListHelper::CreateOutlineNumberForType1() throw( css::uno::RuntimeException )
-+{
-+ sal_Int16 nNumberingType = 0;
-+ rtl::OUString sPrefix;
-+ rtl::OUString sSuffix;
-+ uno::Sequence< beans::PropertyValue > aPropertyValues;
-+
-+ for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
-+ {
-+ mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
-+ switch( nLevel )
-+ {
-+ case 0:
-+ case 1:
-+ {
-+ nNumberingType = style::NumberingType::ARABIC;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 2:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_LOWER;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 3:
-+ {
-+ nNumberingType = style::NumberingType::ARABIC;
-+ sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 4:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
-+ sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 5:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_LOWER;
-+ sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 6:
-+ {
-+ nNumberingType = style::NumberingType::ARABIC;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ case 7:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ case 8:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_LOWER;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException();
-+ }
-+ }
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_PREFIX ), uno::makeAny( sPrefix ) );
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_SUFFIX ), uno::makeAny( sSuffix ) );
-+ mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
-+ }
-+}
-+
-+void SwVbaListHelper::CreateOutlineNumberForType2() throw( css::uno::RuntimeException )
-+{
-+ sal_Int16 nNumberingType = style::NumberingType::ARABIC;
-+ sal_Int16 nParentNumbering = 0;
-+ rtl::OUString sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ uno::Sequence< beans::PropertyValue > aPropertyValues;
-+
-+ for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
-+ {
-+ mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_SUFFIX ), uno::makeAny( sSuffix ) );
-+ if( nLevel != 0 )
-+ {
-+ nParentNumbering = sal_Int16( nLevel - 1 );
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_PARENT_NUMBERING ), uno::makeAny( nParentNumbering ) );
-+ }
-+ mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
-+ }
-+}
-+
-+void SwVbaListHelper::CreateOutlineNumberForType3() throw( css::uno::RuntimeException )
-+{
-+ sal_Int16 nNumberingType = style::NumberingType::CHAR_SPECIAL;
-+ rtl::OUString sCharStyleName( RTL_CONSTASCII_USTRINGPARAM("Bullet Symbols") );
-+ rtl::OUString aBulletChar;
-+ uno::Sequence< beans::PropertyValue > aPropertyValues;
-+
-+ for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
-+ {
-+ mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_CHAR_STYLE_NAME ), uno::makeAny( sCharStyleName ) );
-+ switch( nLevel )
-+ {
-+ case 0:
-+ {
-+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_FOUR_DIAMONDS ) );
-+ break;
-+ }
-+ case 1:
-+ case 5:
-+ {
-+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_ARROW ) );
-+ break;
-+ }
-+ case 2:
-+ case 6:
-+ {
-+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_SQUARE ) );
-+ break;
-+ }
-+ case 3:
-+ case 7:
-+ {
-+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_CLOSED_DOT ) );
-+ break;
-+ }
-+ case 4:
-+ case 8:
-+ {
-+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_DIAMOND ) );
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException();
-+ }
-+ }
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_BULLET_CHAR ), uno::makeAny( aBulletChar ) );
-+ mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
-+ }
-+}
-+
-+void SwVbaListHelper::CreateOutlineNumberForType4() throw( css::uno::RuntimeException )
-+{
-+ sal_Int16 nNumberingType = 0;
-+ rtl::OUString sPrefix;
-+ rtl::OUString sSuffix;
-+ uno::Sequence< beans::PropertyValue > aPropertyValues;
-+
-+ for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
-+ {
-+ mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
-+ switch( nLevel )
-+ {
-+ case 0:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_UPPER;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ case 1:
-+ {
-+ nNumberingType = style::NumberingType::ARABIC;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ sal_Int16 nParentNumbering = 0;
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_PARENT_NUMBERING ), uno::makeAny( nParentNumbering ) );
-+ break;
-+ }
-+ case 2:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
-+ sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 3:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_LOWER;
-+ sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 4:
-+ {
-+ nNumberingType = style::NumberingType::ARABIC;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 5:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 6:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_LOWER;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 7:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ case 8:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_LOWER;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException();
-+ }
-+ }
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_PREFIX ), uno::makeAny( sPrefix ) );
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_SUFFIX ), uno::makeAny( sSuffix ) );
-+ mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
-+ }
-+}
-+
-+void SwVbaListHelper::CreateOutlineNumberForType5() throw( css::uno::RuntimeException )
-+{
-+ sal_Int16 nNumberingType = style::NumberingType::ARABIC;
-+ sal_Int16 nParentNumbering = 0;
-+ uno::Sequence< beans::PropertyValue > aPropertyValues;
-+
-+ for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
-+ {
-+ mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
-+ if( nLevel != 0 )
-+ {
-+ nParentNumbering = sal_Int16( nLevel - 1 );
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_PARENT_NUMBERING ), uno::makeAny( nParentNumbering ) );
-+ }
-+ mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
-+ }
-+}
-+
-+void SwVbaListHelper::CreateOutlineNumberForType6() throw( css::uno::RuntimeException )
-+{
-+ sal_Int16 nNumberingType = 0;
-+ rtl::OUString sPrefix;
-+ rtl::OUString sSuffix;
-+ uno::Sequence< beans::PropertyValue > aPropertyValues;
-+
-+ for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
-+ {
-+ mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
-+ switch( nLevel )
-+ {
-+ case 0:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_UPPER;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ case 1:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_UPPER_LETTER;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ case 2:
-+ {
-+ nNumberingType = style::NumberingType::ARABIC;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 3:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 4:
-+ {
-+ nNumberingType = style::NumberingType::ARABIC;
-+ sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 5:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
-+ sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 6:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_LOWER;
-+ sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 7:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
-+ sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ case 8:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_LOWER;
-+ sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException();
-+ }
-+ }
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_PREFIX ), uno::makeAny( sPrefix ) );
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_SUFFIX ), uno::makeAny( sSuffix ) );
-+ mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
-+ }
-+}
-+
-+void SwVbaListHelper::CreateOutlineNumberForType7() throw( css::uno::RuntimeException )
-+{
-+ sal_Int16 nNumberingType = style::NumberingType::ARABIC;
-+ uno::Sequence< beans::PropertyValue > aPropertyValues;
-+ rtl::OUString sPrefix = rtl::OUString::createFromAscii("Chapter ");
-+
-+ for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
-+ {
-+ mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_PREFIX ), uno::makeAny( sPrefix ) );
-+ mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
-+ }
-+}
-+
-+uno::Any SwVbaListHelper::getPropertyValueWithNameAndLevel( sal_Int32 nLevel, const rtl::OUString& sName ) throw( css::uno::RuntimeException )
-+{
-+ uno::Sequence< beans::PropertyValue > aPropertyValues;
-+ mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
-+ return getPropertyValue( aPropertyValues, sName );
-+}
-+
-+void SwVbaListHelper::setPropertyValueWithNameAndLevel( sal_Int32 nLevel, const rtl::OUString& sName, const css::uno::Any& aValue ) throw( css::uno::RuntimeException )
-+{
-+ uno::Sequence< beans::PropertyValue > aPropertyValues;
-+ mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
-+ setOrAppendPropertyValue( aPropertyValues, sName, aValue );
-+ mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
-+ mxStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingRules") ) , uno::makeAny( mxNumberingRules ) );
-+}
-+
-diff --git sw/source/ui/vba/vbalisthelper.hxx sw/source/ui/vba/vbalisthelper.hxx
-new file mode 100644
-index 0000000..0f5fa26
---- /dev/null
-+++ sw/source/ui/vba/vbalisthelper.hxx
-@@ -0,0 +1,82 @@
-+/*************************************************************************
-+ *
-+ * 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 SW_VBA_LISTHELPER_HXX
-+#define SW_VBA_LISTHELPER_HXX
-+
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/container/XIndexReplace.hpp>
-+#include <com/sun/star/container/XNameContainer.hpp>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include <boost/shared_ptr.hpp>
-+
-+
-+class SwVbaListHelper;
-+typedef ::boost::shared_ptr< SwVbaListHelper > SwVbaListHelperRef;
-+
-+class SwVbaListHelper
-+{
-+private:
-+ css::uno::Reference< css::text::XTextDocument > mxTextDocument;
-+ css::uno::Reference< css::container::XIndexReplace > mxNumberingRules;
-+ css::uno::Reference< css::container::XNameContainer > mxStyleFamily;
-+ css::uno::Reference< css::beans::XPropertySet > mxStyleProps;
-+ sal_Int32 mnGalleryType;
-+ sal_Int32 mnTemplateType;
-+ rtl::OUString msStyleName;
-+
-+ void Init() throw( css::uno::RuntimeException );
-+ void CreateListTemplate() throw( css::uno::RuntimeException );
-+ void CreateBulletListTemplate() throw( css::uno::RuntimeException );
-+ void CreateNumberListTemplate() throw( css::uno::RuntimeException );
-+ void CreateOutlineNumberListTemplate() throw( css::uno::RuntimeException );
-+ void CreateOutlineNumberForType1() throw( css::uno::RuntimeException );
-+ void CreateOutlineNumberForType2() throw( css::uno::RuntimeException );
-+ void CreateOutlineNumberForType3() throw( css::uno::RuntimeException );
-+ void CreateOutlineNumberForType4() throw( css::uno::RuntimeException );
-+ void CreateOutlineNumberForType5() throw( css::uno::RuntimeException );
-+ void CreateOutlineNumberForType6() throw( css::uno::RuntimeException );
-+ void CreateOutlineNumberForType7() throw( css::uno::RuntimeException );
-+
-+public:
-+ SwVbaListHelper( const css::uno::Reference< css::text::XTextDocument >& xTextDoc, sal_Int32 nGalleryType, sal_Int32 nTemplateType ) throw( css::uno::RuntimeException );
-+
-+ sal_Int32 getGalleryType() { return mnGalleryType; }
-+ css::uno::Reference< css::container::XIndexReplace > getNumberingRules() { return mxNumberingRules; }
-+ css::uno::Any getPropertyValueWithNameAndLevel( sal_Int32 nLevel, const rtl::OUString& sName ) throw( css::uno::RuntimeException );
-+ void setPropertyValueWithNameAndLevel( sal_Int32 nLevel, const rtl::OUString& sName, const css::uno::Any& aValue ) throw( css::uno::RuntimeException );
-+
-+};
-+
-+#endif//SW_VBA_LISTHELPER_HXX
-diff --git sw/source/ui/vba/vbalistlevel.cxx sw/source/ui/vba/vbalistlevel.cxx
-new file mode 100644
-index 0000000..7a769ac
---- /dev/null
-+++ sw/source/ui/vba/vbalistlevel.cxx
-@@ -0,0 +1,401 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbalistlevel.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include <com/sun/star/style/NumberingType.hpp>
-+#include <ooo/vba/word/WdListNumberStyle.hpp>
-+#include <ooo/vba/word/WdTrailingCharacter.hpp>
-+#include <com/sun/star/text/HoriOrientation.hpp>
-+#include <ooo/vba/word/WdListLevelAlignment.hpp>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaListLevel::SwVbaListLevel( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, SwVbaListHelperRef pHelper, sal_Int32 nLevel ) throw ( uno::RuntimeException ) : SwVbaListLevel_BASE( rParent, rContext ), pListHelper( pHelper ), mnLevel( nLevel )
-+{
-+}
-+
-+SwVbaListLevel::~SwVbaListLevel()
-+{
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaListLevel::getAlignment() throw (uno::RuntimeException)
-+{
-+ sal_Int16 nAlignment = 0;
-+ pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Adjust") ) ) >>= nAlignment;
-+ switch( nAlignment )
-+ {
-+ case text::HoriOrientation::LEFT:
-+ {
-+ nAlignment = word::WdListLevelAlignment::wdListLevelAlignLeft;
-+ break;
-+ }
-+ case text::HoriOrientation::RIGHT:
-+ {
-+ nAlignment = word::WdListLevelAlignment::wdListLevelAlignRight;
-+ break;
-+ }
-+ case text::HoriOrientation::CENTER:
-+ {
-+ nAlignment = word::WdListLevelAlignment::wdListLevelAlignCenter;
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException();
-+ }
-+ }
-+ return nAlignment;
-+}
-+
-+void SAL_CALL SwVbaListLevel::setAlignment( ::sal_Int32 _alignment ) throw (uno::RuntimeException)
-+{
-+ sal_Int16 nAlignment = text::HoriOrientation::LEFT;
-+ switch( _alignment )
-+ {
-+ case word::WdListLevelAlignment::wdListLevelAlignLeft:
-+ {
-+ nAlignment = text::HoriOrientation::LEFT;
-+ break;
-+ }
-+ case word::WdListLevelAlignment::wdListLevelAlignRight:
-+ {
-+ nAlignment = text::HoriOrientation::RIGHT;
-+ break;
-+ }
-+ case word::WdListLevelAlignment::wdListLevelAlignCenter:
-+ {
-+ nAlignment = text::HoriOrientation::CENTER;
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException();
-+ }
-+ }
-+ pListHelper->setPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Adjust") ), uno::makeAny( nAlignment ) );
-+}
-+
-+uno::Reference< ::ooo::vba::word::XFont > SAL_CALL SwVbaListLevel::getFont() throw (uno::RuntimeException)
-+{
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ return uno::Reference< word::XFont >();
-+}
-+
-+void SAL_CALL SwVbaListLevel::setFont( const uno::Reference< ::ooo::vba::word::XFont >& /*_font*/ ) throw (uno::RuntimeException)
-+{
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaListLevel::getIndex() throw (uno::RuntimeException)
-+{
-+ return mnLevel + 1;
-+}
-+
-+::rtl::OUString SAL_CALL SwVbaListLevel::getLinkedStyle() throw (uno::RuntimeException)
-+{
-+ // TODO:
-+ return rtl::OUString();
-+}
-+
-+void SAL_CALL SwVbaListLevel::setLinkedStyle( const ::rtl::OUString& /*_linkedstyle*/ ) throw (uno::RuntimeException)
-+{
-+ // TODO:
-+}
-+
-+::rtl::OUString SAL_CALL SwVbaListLevel::getNumberFormat() throw (uno::RuntimeException)
-+{
-+ // TODO::
-+ return rtl::OUString();
-+}
-+
-+void SAL_CALL SwVbaListLevel::setNumberFormat( const ::rtl::OUString& /*_numberformat*/ ) throw (uno::RuntimeException)
-+{
-+ // TODO::
-+}
-+
-+float SAL_CALL SwVbaListLevel::getNumberPosition() throw (uno::RuntimeException)
-+{
-+ // indentAt + firstlineindent
-+ sal_Int32 nIndentAt = 0;
-+ sal_Int32 nFirstLineIndent = 0;
-+ pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IndentAt") ) ) >>= nIndentAt;
-+ pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FirstLineIndent") ) ) >>= nFirstLineIndent;
-+
-+ sal_Int32 nResult = nIndentAt + nFirstLineIndent;
-+
-+ return static_cast< float >( Millimeter::getInPoints( nResult ) );
-+}
-+
-+void SAL_CALL SwVbaListLevel::setNumberPosition( float _numberposition ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nNumberPosition = Millimeter::getInHundredthsOfOneMillimeter( _numberposition );
-+
-+ sal_Int32 nIndentAt = 0;
-+ pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IndentAt") ) ) >>= nIndentAt;
-+
-+ sal_Int32 nFirstLineIndent = nNumberPosition - nIndentAt;
-+ pListHelper->setPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FirstLineIndent") ), uno::makeAny( nFirstLineIndent ) );
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaListLevel::getNumberStyle() throw (uno::RuntimeException)
-+{
-+ sal_Int16 nNumberingType = 0;
-+ pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingType") ) ) >>= nNumberingType;
-+ switch( nNumberingType )
-+ {
-+ case style::NumberingType::CHAR_SPECIAL:
-+ {
-+ nNumberingType = word::WdListNumberStyle::wdListNumberStyleBullet;
-+ break;
-+ }
-+ case style::NumberingType::CHARS_UPPER_LETTER:
-+ {
-+ nNumberingType = word::WdListNumberStyle::wdListNumberStyleUppercaseLetter;
-+ break;
-+ }
-+ case style::NumberingType::CHARS_LOWER_LETTER:
-+ {
-+ nNumberingType = word::WdListNumberStyle::wdListNumberStyleLowercaseLetter;
-+ break;
-+ }
-+ case style::NumberingType::ROMAN_UPPER:
-+ {
-+ nNumberingType = word::WdListNumberStyle::wdListNumberStyleUppercaseRoman;
-+ break;
-+ }
-+ case style::NumberingType::ROMAN_LOWER:
-+ {
-+ nNumberingType = word::WdListNumberStyle::wdListNumberStyleLowercaseRoman;
-+ break;
-+ }
-+ case style::NumberingType::ARABIC:
-+ {
-+ nNumberingType = word::WdListNumberStyle::wdListNumberStyleArabic;
-+ break;
-+ }
-+ case style::NumberingType::NUMBER_NONE:
-+ {
-+ nNumberingType = word::WdListNumberStyle::wdListNumberStyleNone;
-+ break;
-+ }
-+ case style::NumberingType::FULLWIDTH_ARABIC:
-+ {
-+ nNumberingType = word::WdListNumberStyle::wdListNumberStyleArabicFullWidth;
-+ break;
-+ }
-+ case style::NumberingType::CIRCLE_NUMBER:
-+ {
-+ nNumberingType = word::WdListNumberStyle::wdListNumberStyleNumberInCircle;
-+ break;
-+ }
-+ case style::NumberingType::CHARS_ARABIC:
-+ {
-+ nNumberingType = word::WdListNumberStyle::wdListNumberStyleCardinalText;
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+ }
-+ return nNumberingType;
-+}
-+
-+void SAL_CALL SwVbaListLevel::setNumberStyle( ::sal_Int32 _numberstyle ) throw (uno::RuntimeException)
-+{
-+ sal_Int16 nNumberingType = 0;
-+ switch( _numberstyle )
-+ {
-+ case word::WdListNumberStyle::wdListNumberStyleBullet:
-+ {
-+ nNumberingType = style::NumberingType::CHAR_SPECIAL;
-+ break;
-+ }
-+ case word::WdListNumberStyle::wdListNumberStyleUppercaseLetter:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_UPPER_LETTER_N;
-+ break;
-+ }
-+ case word::WdListNumberStyle::wdListNumberStyleLowercaseLetter:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER_N;
-+ break;
-+ }
-+ case word::WdListNumberStyle::wdListNumberStyleUppercaseRoman:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_UPPER;
-+ break;
-+ }
-+ case word::WdListNumberStyle::wdListNumberStyleLowercaseRoman:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_LOWER;
-+ break;
-+ }
-+ case word::WdListNumberStyle::wdListNumberStyleArabic:
-+ {
-+ nNumberingType = style::NumberingType::ARABIC;
-+ break;
-+ }
-+ case word::WdListNumberStyle::wdListNumberStyleNone:
-+ {
-+ nNumberingType = style::NumberingType::NUMBER_NONE;
-+ break;
-+ }
-+ case word::WdListNumberStyle::wdListNumberStyleArabicFullWidth:
-+ {
-+ nNumberingType = style::NumberingType::FULLWIDTH_ARABIC;
-+ break;
-+ }
-+ case word::WdListNumberStyle::wdListNumberStyleNumberInCircle:
-+ {
-+ nNumberingType = style::NumberingType::CIRCLE_NUMBER;
-+ break;
-+ }
-+ case word::WdListNumberStyle::wdListNumberStyleCardinalText:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_ARABIC;
-+ break;
-+ }
-+ case word::WdListNumberStyle::wdListNumberStyleOrdinal:
-+ case word::WdListNumberStyle::wdListNumberStyleOrdinalText:
-+ case word::WdListNumberStyle::wdListNumberStyleKanji:
-+ case word::WdListNumberStyle::wdListNumberStyleKanjiDigit:
-+ case word::WdListNumberStyle::wdListNumberStyleAiueoHalfWidth:
-+ case word::WdListNumberStyle::wdListNumberStyleIrohaHalfWidth:
-+ {
-+ nNumberingType = style::NumberingType::ARABIC;
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+ }
-+
-+ pListHelper->setPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingType") ), uno::makeAny( nNumberingType ) );
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaListLevel::getResetOnHigher() throw (uno::RuntimeException)
-+{
-+ //seems not support?
-+ return 0;
-+}
-+
-+void SAL_CALL SwVbaListLevel::setResetOnHigher( ::sal_Int32 /*_resetonhigher*/ ) throw (uno::RuntimeException)
-+{
-+ //seems not support?
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaListLevel::getStartAt() throw (uno::RuntimeException)
-+{
-+ sal_Int16 nStartWith = 0;
-+ pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StartWith") ) ) >>= nStartWith;
-+ return nStartWith;
-+}
-+
-+void SAL_CALL SwVbaListLevel::setStartAt( ::sal_Int32 _startat ) throw (uno::RuntimeException)
-+{
-+ sal_Int16 nStartWith = (sal_Int16)_startat;
-+ pListHelper->setPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StartWith") ), uno::makeAny( nStartWith ) );
-+}
-+
-+float SAL_CALL SwVbaListLevel::getTabPosition() throw (uno::RuntimeException)
-+{
-+ sal_Int32 nTabPosition = 0;
-+ pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ListtabStopPosition") ) ) >>= nTabPosition;
-+
-+ return static_cast< float >( Millimeter::getInPoints( nTabPosition ) );
-+}
-+
-+void SAL_CALL SwVbaListLevel::setTabPosition( float _tabposition ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nTabPosition = Millimeter::getInHundredthsOfOneMillimeter( _tabposition );
-+ pListHelper->setPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ListtabStopPosition") ), uno::makeAny( nTabPosition ) );
-+}
-+
-+float SAL_CALL SwVbaListLevel::getTextPosition() throw (uno::RuntimeException)
-+{
-+ // indentAt
-+ sal_Int32 nIndentAt = 0;
-+ pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IndentAt") ) ) >>= nIndentAt;
-+
-+ return static_cast< float >( Millimeter::getInPoints( nIndentAt ) );
-+}
-+
-+void SAL_CALL SwVbaListLevel::setTextPosition( float _textposition ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nIndentAt = 0;
-+ sal_Int32 nFirstLineIndent = 0;
-+ pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IndentAt") ) ) >>= nIndentAt;
-+ pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FirstLineIndent") ) ) >>= nFirstLineIndent;
-+
-+ sal_Int32 nAlignedAt = nIndentAt + nFirstLineIndent;
-+
-+ nIndentAt = Millimeter::getInHundredthsOfOneMillimeter( _textposition );
-+ nFirstLineIndent = nAlignedAt - nIndentAt;
-+ pListHelper->setPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IndentAt") ), uno::makeAny( nIndentAt ) );
-+ pListHelper->setPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FirstLineIndent") ), uno::makeAny( nFirstLineIndent ) );
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaListLevel::getTrailingCharacter() throw (uno::RuntimeException)
-+{
-+ sal_Int16 nLabelFollowedBy= 0;
-+ pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LabelFollowedBy") ) ) >>= nLabelFollowedBy;
-+
-+ return nLabelFollowedBy;
-+}
-+
-+void SAL_CALL SwVbaListLevel::setTrailingCharacter( ::sal_Int32 _trailingcharacter ) throw (uno::RuntimeException)
-+{
-+ sal_Int16 nLabelFollowedBy = (sal_Int16)_trailingcharacter;
-+ pListHelper->setPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LabelFollowedBy") ), uno::makeAny( nLabelFollowedBy ) );
-+}
-+
-+rtl::OUString&
-+SwVbaListLevel::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaListLevel") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaListLevel::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ListLevel" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbalistlevel.hxx sw/source/ui/vba/vbalistlevel.hxx
-new file mode 100644
-index 0000000..4bcb147
---- /dev/null
-+++ sw/source/ui/vba/vbalistlevel.hxx
-@@ -0,0 +1,81 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_LISTLEVEL_HXX
-+#define SW_VBA_LISTLEVEL_HXX
-+
-+#include <ooo/vba/word/XListLevel.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include "vbalisthelper.hxx"
-+
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XListLevel > SwVbaListLevel_BASE;
-+
-+class SwVbaListLevel : public SwVbaListLevel_BASE
-+{
-+private:
-+ SwVbaListHelperRef pListHelper;
-+ sal_Int32 mnLevel;
-+
-+public:
-+ SwVbaListLevel( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, SwVbaListHelperRef pHelper, sal_Int32 nLevel ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaListLevel();
-+
-+ // Attributes
-+ virtual ::sal_Int32 SAL_CALL getAlignment() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setAlignment( ::sal_Int32 _alignment ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Reference< ::ooo::vba::word::XFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setFont( const css::uno::Reference< ::ooo::vba::word::XFont >& _font ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getIndex() throw (css::uno::RuntimeException);
-+ virtual ::rtl::OUString SAL_CALL getLinkedStyle() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setLinkedStyle( const ::rtl::OUString& _linkedstyle ) throw (css::uno::RuntimeException);
-+ virtual ::rtl::OUString SAL_CALL getNumberFormat() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setNumberFormat( const ::rtl::OUString& _numberformat ) throw (css::uno::RuntimeException);
-+ virtual float SAL_CALL getNumberPosition() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setNumberPosition( float _numberposition ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getNumberStyle() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setNumberStyle( ::sal_Int32 _numberstyle ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getResetOnHigher() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setResetOnHigher( ::sal_Int32 _resetonhigher ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getStartAt() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setStartAt( ::sal_Int32 _startat ) throw (css::uno::RuntimeException);
-+ virtual float SAL_CALL getTabPosition() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setTabPosition( float _tabposition ) throw (css::uno::RuntimeException);
-+ virtual float SAL_CALL getTextPosition() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setTextPosition( float _textposition ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getTrailingCharacter() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setTrailingCharacter( ::sal_Int32 _trailingcharacter ) throw (css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_LISTLEVEL_HXX */
-diff --git sw/source/ui/vba/vbalistlevels.cxx sw/source/ui/vba/vbalistlevels.cxx
-new file mode 100644
-index 0000000..019b6f5
---- /dev/null
-+++ sw/source/ui/vba/vbalistlevels.cxx
-@@ -0,0 +1,118 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbalistlevels.hxx"
-+#include "vbalistlevel.hxx"
-+#include <ooo/vba/word/WdListGalleryType.hpp>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+class ListLevelsEnumWrapper : public EnumerationHelper_BASE
-+{
-+ SwVbaListLevels* pListLevels;
-+ sal_Int32 nIndex;
-+public:
-+ ListLevelsEnumWrapper( SwVbaListLevels* pLevels ) : pListLevels( pLevels ), nIndex( 1 ) {}
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( nIndex <= pListLevels->getCount() );
-+ }
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( nIndex <= pListLevels->getCount() )
-+ return pListLevels->Item( uno::makeAny( nIndex++ ), uno::Any() );
-+ throw container::NoSuchElementException();
-+ }
-+};
-+
-+SwVbaListLevels::SwVbaListLevels( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, SwVbaListHelperRef pHelper ) throw (uno::RuntimeException) : SwVbaListLevels_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >() ), pListHelper( pHelper )
-+{
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaListLevels::getCount() throw (uno::RuntimeException)
-+{
-+ sal_Int32 nGalleryType = pListHelper->getGalleryType();
-+ if( nGalleryType == word::WdListGalleryType::wdBulletGallery
-+ || nGalleryType == word::WdListGalleryType::wdNumberGallery )
-+ return 1;
-+ else if( nGalleryType == word::WdListGalleryType::wdOutlineNumberGallery )
-+ return 9;
-+ return 0;
-+}
-+
-+uno::Any SAL_CALL SwVbaListLevels::Item( const uno::Any& Index1, const uno::Any& /*not processed in this base class*/ ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nIndex = 0;
-+ if( ( Index1 >>= nIndex ) == sal_False )
-+ throw uno::RuntimeException();
-+ if( nIndex <=0 || nIndex > getCount() )
-+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Index out of bounds") ), uno::Reference< uno::XInterface >() );
-+
-+ return uno::makeAny( uno::Reference< word::XListLevel >( new SwVbaListLevel( this, mxContext, pListHelper, nIndex - 1 ) ) );
-+}
-+
-+// XEnumerationAccess
-+uno::Type
-+SwVbaListLevels::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XListLevel::static_type(0);
-+}
-+
-+uno::Reference< container::XEnumeration >
-+SwVbaListLevels::createEnumeration() throw (uno::RuntimeException)
-+{
-+ return new ListLevelsEnumWrapper( this );
-+}
-+
-+uno::Any
-+SwVbaListLevels::createCollectionObject( const css::uno::Any& aSource )
-+{
-+ return aSource;
-+}
-+
-+rtl::OUString&
-+SwVbaListLevels::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaListLevels") );
-+ return sImplName;
-+}
-+
-+css::uno::Sequence<rtl::OUString>
-+SwVbaListLevels::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ListLevels") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbalistlevels.hxx sw/source/ui/vba/vbalistlevels.hxx
-new file mode 100644
-index 0000000..c57da55
---- /dev/null
-+++ sw/source/ui/vba/vbalistlevels.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:
-+ * $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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_LISTLEVELS_HXX
-+#define SW_VBA_LISTLEVELS_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XListLevels.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include "vbalisthelper.hxx"
-+
-+
-+typedef CollTestImplHelper< ooo::vba::word::XListLevels > SwVbaListLevels_BASE;
-+
-+class SwVbaListLevels : public SwVbaListLevels_BASE
-+{
-+private:
-+ SwVbaListHelperRef pListHelper;
-+
-+public:
-+ SwVbaListLevels( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, SwVbaListHelperRef pHelper ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaListLevels() {}
-+
-+ virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException);
-+ 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 );
-+ // 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);
-+
-+ // SwVbaListLevels_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* SW_VBA_LISTLEVELS_HXX */
-diff --git sw/source/ui/vba/vbalisttemplate.cxx sw/source/ui/vba/vbalisttemplate.cxx
-new file mode 100644
-index 0000000..1ad091e
---- /dev/null
-+++ sw/source/ui/vba/vbalisttemplate.cxx
-@@ -0,0 +1,80 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbalisttemplate.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include "vbalistlevels.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaListTemplate::SwVbaListTemplate( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& xTextDoc, sal_Int32 nGalleryType, sal_Int32 nTemplateType ) throw ( uno::RuntimeException ) : SwVbaListTemplate_BASE( rParent, rContext )
-+{
-+ pListHelper.reset( new SwVbaListHelper( xTextDoc, nGalleryType, nTemplateType ) );
-+}
-+
-+SwVbaListTemplate::~SwVbaListTemplate()
-+{
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaListTemplate::ListLevels( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< XCollection > xCol( new SwVbaListLevels( mxParent, mxContext, pListHelper ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+void SwVbaListTemplate::applyListTemplate( uno::Reference< beans::XPropertySet >& xProps ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< container::XIndexReplace > xNumberingRules = pListHelper->getNumberingRules();
-+ xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingRules") ) , uno::makeAny( xNumberingRules ) );
-+}
-+
-+rtl::OUString&
-+SwVbaListTemplate::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaListTemplate") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaListTemplate::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ListTemplate" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbalisttemplate.hxx sw/source/ui/vba/vbalisttemplate.hxx
-new file mode 100644
-index 0000000..733ef76
---- /dev/null
-+++ sw/source/ui/vba/vbalisttemplate.hxx
-@@ -0,0 +1,60 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_LISTTEMPLATE_HXX
-+#define SW_VBA_LISTTEMPLATE_HXX
-+
-+#include <ooo/vba/word/XListTemplate.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include "vbalisthelper.hxx"
-+
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XListTemplate > SwVbaListTemplate_BASE;
-+
-+class SwVbaListTemplate : public SwVbaListTemplate_BASE
-+{
-+private:
-+ SwVbaListHelperRef pListHelper;
-+
-+public:
-+ SwVbaListTemplate( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& xTextDoc, sal_Int32 nGalleryType, sal_Int32 nTemplateType ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaListTemplate();
-+
-+ void applyListTemplate( css::uno::Reference< css::beans::XPropertySet >& xProps ) throw ( css::uno::RuntimeException );
-+
-+ // Methods
-+ virtual css::uno::Any SAL_CALL ListLevels( const css::uno::Any& index ) throw ( css::uno::RuntimeException );
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_LISTTEMPLATE_HXX */
-diff --git sw/source/ui/vba/vbalisttemplates.cxx sw/source/ui/vba/vbalisttemplates.cxx
-new file mode 100644
-index 0000000..ba560d3
---- /dev/null
-+++ sw/source/ui/vba/vbalisttemplates.cxx
-@@ -0,0 +1,112 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbalisttemplates.hxx"
-+#include "vbalisttemplate.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+class ListTemplatesEnumWrapper : public EnumerationHelper_BASE
-+{
-+ SwVbaListTemplates* pListTemplates;
-+ sal_Int32 nIndex;
-+public:
-+ ListTemplatesEnumWrapper( SwVbaListTemplates* pTemplates ) : pListTemplates( pTemplates ), nIndex( 1 ) {}
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( nIndex <= pListTemplates->getCount() );
-+ }
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( nIndex <= pListTemplates->getCount() )
-+ return pListTemplates->Item( uno::makeAny( nIndex++ ), uno::Any() );
-+ throw container::NoSuchElementException();
-+ }
-+};
-+
-+SwVbaListTemplates::SwVbaListTemplates( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextDocument >& xTextDoc, sal_Int32 nType ) throw (uno::RuntimeException) : SwVbaListTemplates_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >() ), mxTextDocument( xTextDoc ), mnGalleryType( nType )
-+{
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaListTemplates::getCount() throw (uno::RuntimeException)
-+{
-+ // 3 types of list( bullet, numbered and outline )
-+ return 7;
-+}
-+
-+uno::Any SAL_CALL SwVbaListTemplates::Item( const uno::Any& Index1, const uno::Any& /*not processed in this base class*/ ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nIndex = 0;
-+ if( ( Index1 >>= nIndex ) == sal_False )
-+ throw uno::RuntimeException();
-+ if( nIndex <=0 || nIndex > getCount() )
-+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Index out of bounds") ), uno::Reference< uno::XInterface >() );
-+
-+ return uno::makeAny( uno::Reference< word::XListTemplate >( new SwVbaListTemplate( this, mxContext, mxTextDocument, mnGalleryType, nIndex ) ) );
-+}
-+
-+// XEnumerationAccess
-+uno::Type
-+SwVbaListTemplates::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XListTemplate::static_type(0);
-+}
-+
-+uno::Reference< container::XEnumeration >
-+SwVbaListTemplates::createEnumeration() throw (uno::RuntimeException)
-+{
-+ return new ListTemplatesEnumWrapper( this );
-+}
-+
-+uno::Any
-+SwVbaListTemplates::createCollectionObject( const css::uno::Any& aSource )
-+{
-+ return aSource;
-+}
-+
-+rtl::OUString&
-+SwVbaListTemplates::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaListTemplates") );
-+ return sImplName;
-+}
-+
-+css::uno::Sequence<rtl::OUString>
-+SwVbaListTemplates::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ListTemplates") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbalisttemplates.hxx sw/source/ui/vba/vbalisttemplates.hxx
-new file mode 100644
-index 0000000..214d01b
---- /dev/null
-+++ sw/source/ui/vba/vbalisttemplates.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:
-+ * $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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_LISTTEMPLATES_HXX
-+#define SW_VBA_LISTTEMPLATES_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XListTemplates.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+
-+typedef CollTestImplHelper< ooo::vba::word::XListTemplates > SwVbaListTemplates_BASE;
-+
-+class SwVbaListTemplates : public SwVbaListTemplates_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XTextDocument > mxTextDocument;
-+ sal_Int32 mnGalleryType;
-+
-+public:
-+ SwVbaListTemplates( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::text::XTextDocument >& xTextDoc, sal_Int32 nType ) throw (css::uno::RuntimeException);
-+ virtual ~SwVbaListTemplates() {}
-+
-+ virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException);
-+ 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 );
-+ // 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);
-+
-+ // SwVbaListTemplates_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* SW_VBA_LISTTEMPLATES_HXX */
-diff --git sw/source/ui/vba/vbaparagraph.cxx sw/source/ui/vba/vbaparagraph.cxx
-index 075ea6f..4e088a6 100644
---- sw/source/ui/vba/vbaparagraph.cxx
-+++ sw/source/ui/vba/vbaparagraph.cxx
-@@ -48,6 +48,20 @@ SwVbaParagraph::getRange( ) throw ( uno::RuntimeException )
- return uno::Reference< word::XRange >( new SwVbaRange( this, mxContext, mxTextDocument, mxTextRange->getStart(), mxTextRange->getEnd(), mxTextRange->getText(), sal_True ) );
- }
-
-+uno::Any SAL_CALL
-+SwVbaParagraph::getStyle( ) throw ( uno::RuntimeException )
-+{
-+ uno::Reference< word::XRange > xRange = getRange();
-+ return xRange->getStyle();
-+}
-+
-+void SAL_CALL
-+SwVbaParagraph::setStyle( const uno::Any& style ) throw ( uno::RuntimeException )
-+{
-+ uno::Reference< word::XRange > xRange = getRange();
-+ xRange->setStyle( style );
-+}
-+
- rtl::OUString&
- SwVbaParagraph::getServiceImplName()
- {
-diff --git sw/source/ui/vba/vbaparagraph.hxx sw/source/ui/vba/vbaparagraph.hxx
-index 4c2cc44..ea994f9 100644
---- sw/source/ui/vba/vbaparagraph.hxx
-+++ sw/source/ui/vba/vbaparagraph.hxx
-@@ -50,6 +50,8 @@ public:
-
- // XParagraph
- virtual css::uno::Reference< ooo::vba::word::XRange > SAL_CALL getRange() throw ( css::uno::RuntimeException );
-+ virtual css::uno::Any SAL_CALL getStyle() throw ( css::uno::RuntimeException );
-+ virtual void SAL_CALL setStyle( const css::uno::Any& style ) throw ( css::uno::RuntimeException );
-
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
-diff --git sw/source/ui/vba/vbaparagraphformat.cxx sw/source/ui/vba/vbaparagraphformat.cxx
-index dbcadac..1285ca7 100644
---- sw/source/ui/vba/vbaparagraphformat.cxx
-+++ sw/source/ui/vba/vbaparagraphformat.cxx
-@@ -34,6 +34,7 @@
- #include <ooo/vba/word/WdOutlineLevel.hpp>
- #include <com/sun/star/style/ParagraphAdjust.hpp>
- #include <com/sun/star/style/BreakType.hpp>
-+#include "vbatabstops.hxx"
-
-
- using namespace ::ooo::vba;
-@@ -200,9 +201,12 @@ sal_Int32 SAL_CALL SwVbaParagraphFormat::getOutlineLevel() throw (uno::RuntimeEx
- return nLevel;
- }
-
--void SAL_CALL SwVbaParagraphFormat::setOutlineLevel( sal_Int32 /*_outlinelevel*/ ) throw (uno::RuntimeException)
-+void SAL_CALL SwVbaParagraphFormat::setOutlineLevel( sal_Int32 _outlinelevel ) throw (uno::RuntimeException)
- {
-- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ if( _outlinelevel != getOutlineLevel() )
-+ {
-+ // TODO: in my test in msword, there is no effect for this function.
-+ }
- }
-
- uno::Any SAL_CALL SwVbaParagraphFormat::getPageBreakBefore() throw (uno::RuntimeException)
-@@ -296,7 +300,7 @@ void SAL_CALL SwVbaParagraphFormat::setRightIndent( float _rightindent ) throw (
-
- uno::Any SAL_CALL SwVbaParagraphFormat::getTabStops() throw (uno::RuntimeException)
- {
-- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ return uno::makeAny( uno::Reference< word::XTabStops >( new SwVbaTabStops( this, mxContext, mxParaProps ) ) );
- }
-
- void SAL_CALL SwVbaParagraphFormat::setTabStops( const uno::Any& /*_tabstops*/ ) throw (uno::RuntimeException)
-diff --git sw/source/ui/vba/vbarange.cxx sw/source/ui/vba/vbarange.cxx
-index d6f719d..20c52ec 100644
---- sw/source/ui/vba/vbarange.cxx
-+++ sw/source/ui/vba/vbarange.cxx
-@@ -32,12 +32,21 @@
- #include <com/sun/star/style/BreakType.hpp>
- #include <com/sun/star/text/ControlCharacter.hpp>
- #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
--#include "wordvbahelper.hxx"
-+#include <com/sun/star/text/XTextRangeCompare.hpp>
-+#include <com/sun/star/text/XWordCursor.hpp>
-+#include <com/sun/star/text/XParagraphCursor.hpp>
-+#include <ooo/vba/word/WdUnits.hpp>
-+#include <ooo/vba/word/WdMovementType.hpp>
- #include "vbaparagraphformat.hxx"
- #include "vbastyle.hxx"
- #include "vbafont.hxx"
- #include "vbapalette.hxx"
- #include "vbapagesetup.hxx"
-+#include "vbalistformat.hxx"
-+#include "vbarevisions.hxx"
-+#include "vbabookmarks.hxx"
-+#include "vbasections.hxx"
-+#include "vbafield.hxx"
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-@@ -70,6 +79,8 @@ void SwVbaRange::initialize( const uno::Reference< text::XTextRange >& rStart, c
- }
-
- mxTextCursor = SwVbaRangeHelper::initCursor( rStart, mxText );
-+ if( !mxTextCursor.is() )
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Fails to create text cursor") ), uno::Reference< uno::XInterface >() );
- mxTextCursor->collapseToStart();
-
- if( rEnd.is() )
-@@ -90,6 +101,67 @@ void SwVbaRange::setXTextRange( const uno::Reference< text::XTextRange >& xRange
- mxTextCursor->gotoRange( xRange->getStart(), sal_False );
- mxTextCursor->gotoRange( xRange->getEnd(), sal_True );
- }
-+
-+void
-+SwVbaRange::Move( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend, word::E_DIRECTION eDirection ) throw ( uno::RuntimeException )
-+{
-+ sal_Int32 nUnit = word::WdUnits::wdCharacter;
-+ sal_Int32 nCount = 1;
-+ sal_Int32 nExtend = word::WdMovementType::wdMove;
-+
-+ if( _unit.hasValue() )
-+ _unit >>= nUnit;
-+ if( _count.hasValue() )
-+ _count >>= nCount;
-+ if( _extend.hasValue() )
-+ _extend >>= nExtend;
-+
-+ if( nCount == 0 )
-+ return;
-+
-+ sal_Bool bExpand = ( nExtend == word::WdMovementType::wdMove ) ? sal_False : sal_True;
-+
-+ switch( nUnit )
-+ {
-+ case word::WdUnits::wdParagraph:
-+ {
-+ if( eDirection == word::MOVE_LEFT || eDirection == word::MOVE_RIGHT )
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+ uno::Reference< text::XParagraphCursor > xParagraphCursor( mxTextCursor, uno::UNO_QUERY_THROW );
-+ for( sal_Int32 i=0; i<nCount; i++ )
-+ {
-+ if( ( eDirection == word::MOVE_UP ) && ( xParagraphCursor->gotoPreviousParagraph( bExpand ) == sal_False ) )
-+ break;
-+ else if( ( eDirection == word::MOVE_DOWN ) && ( xParagraphCursor->gotoNextParagraph( bExpand ) == sal_False ) )
-+ break;
-+ }
-+ break;
-+ }
-+ case word::WdUnits::wdWord:
-+ {
-+ if( eDirection == word::MOVE_UP || eDirection == word::MOVE_DOWN )
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+ uno::Reference< text::XWordCursor > xWordCursor( mxTextCursor, uno::UNO_QUERY_THROW );
-+ for( sal_Int32 i=0; i<nCount; i++ )
-+ {
-+ if( (eDirection == word::MOVE_LEFT ) && ( xWordCursor->gotoPreviousWord( bExpand ) == sal_False ) )
-+ break;
-+ else if( ( eDirection == word::MOVE_RIGHT ) && ( xWordCursor->gotoNextWord( bExpand ) == sal_False ) )
-+ break;
-+ }
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ break;
-+ }
-+ }
-+}
- #endif
- /**
- * The complexity in this method is because we need to workaround
-@@ -128,17 +200,46 @@ SwVbaRange::getText() throw ( uno::RuntimeException )
- void SAL_CALL
- SwVbaRange::setText( const rtl::OUString& rText ) throw ( uno::RuntimeException )
- {
-+ // Emulate the MSWord behavior, Don't delete the bookmark
-+ // which contains no text string in current inserting position,
-+ rtl::OUString sName;
-+ uno::Reference< text::XTextRange > xRange( mxTextCursor, uno::UNO_QUERY_THROW );
-+ try
-+ {
-+ uno::Reference< text::XTextContent > xBookmark = SwVbaRangeHelper::findBookmarkByPosition( mxTextDocument, xRange->getStart() );
-+ if( xBookmark.is() )
-+ {
-+ uno::Reference< container::XNamed > xNamed( xBookmark, uno::UNO_QUERY_THROW );
-+ sName = xNamed->getName();
-+ }
-+ }
-+ catch( uno::Exception& )
-+ {
-+ // do nothing
-+ }
-+
- if( rText.indexOf( '\n' ) != -1 )
- {
- mxTextCursor->setString( rtl::OUString() );
- // process CR in strings
-- uno::Reference< text::XTextRange > xRange( mxTextCursor, uno::UNO_QUERY_THROW );
- SwVbaRangeHelper::insertString( xRange, mxText, rText, sal_True );
- }
- else
- {
- mxTextCursor->setString( rText );
- }
-+
-+ // insert the bookmark if the bookmark is deleted during setting text string
-+ if( sName.getLength() )
-+ {
-+ uno::Reference< text::XBookmarksSupplier > xBookmarksSupplier( mxTextDocument, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XNameAccess > xNameAccess( xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY_THROW );
-+ if( !xNameAccess->hasByName( sName ) )
-+ {
-+ uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW );
-+ SwVbaBookmarks::addBookmarkByName( xModel, sName, xRange->getStart() );
-+ }
-+ }
- }
-
- // FIXME: test is not pass
-@@ -229,11 +330,8 @@ SwVbaRange::setParagraphFormat( const uno::Reference< word::XParagraphFormat >&
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
- }
-
--uno::Reference< word::XStyle > SAL_CALL
--SwVbaRange::getStyle() throw ( uno::RuntimeException )
-+void SwVbaRange::GetStyleInfo(rtl::OUString& aStyleName, rtl::OUString& aStyleType ) throw ( uno::RuntimeException )
- {
-- rtl::OUString aStyleName;
-- rtl::OUString aStyleType;
- uno::Reference< beans::XPropertySet > xProp( mxTextCursor, uno::UNO_QUERY_THROW );
- if( ( xProp->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CharStyleName") ) ) >>= aStyleName ) && aStyleName.getLength() )
- {
-@@ -247,14 +345,23 @@ SwVbaRange::getStyle() throw ( uno::RuntimeException )
- {
- DebugHelper::exception( SbERR_INTERNAL_ERROR, rtl::OUString() );
- }
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaRange::getStyle() throw ( uno::RuntimeException )
-+{
-+ rtl::OUString aStyleName;
-+ rtl::OUString aStyleType;
-+ GetStyleInfo( aStyleName, aStyleType );
- uno::Reference< style::XStyleFamiliesSupplier > xStyleSupplier( mxTextDocument, uno::UNO_QUERY_THROW);
- uno::Reference< container::XNameAccess > xStylesAccess( xStyleSupplier->getStyleFamilies()->getByName( aStyleType ), uno::UNO_QUERY_THROW );
- uno::Reference< beans::XPropertySet > xStyleProps( xStylesAccess->getByName( aStyleName ), uno::UNO_QUERY_THROW );
-- return uno::Reference< word::XStyle >( new SwVbaStyle( this, mxContext, xStyleProps ) );
-+ uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW );
-+ return uno::makeAny( uno::Reference< word::XStyle >( new SwVbaStyle( this, mxContext, xModel, xStyleProps ) ) );
- }
-
- void SAL_CALL
--SwVbaRange::setStyle( const uno::Reference< word::XStyle >& rStyle ) throw ( uno::RuntimeException )
-+SwVbaRange::setStyle( const uno::Any& rStyle ) throw ( uno::RuntimeException )
- {
- uno::Reference< beans::XPropertySet > xParaProps( mxTextCursor, uno::UNO_QUERY_THROW );
- SwVbaStyle::setStyle( xParaProps, rStyle );
-@@ -267,6 +374,12 @@ SwVbaRange::getFont() throw ( uno::RuntimeException )
- return new SwVbaFont( mxParent, mxContext, aColors.getPalette(), uno::Reference< beans::XPropertySet >( getXTextRange(), uno::UNO_QUERY_THROW ) );
- }
-
-+uno::Reference< word::XListFormat > SAL_CALL
-+SwVbaRange::getListFormat() throw ( uno::RuntimeException )
-+{
-+ return uno::Reference< word::XListFormat >( new SwVbaListFormat( this, mxContext, getXTextRange() ) );
-+}
-+
- ::sal_Int32 SAL_CALL SwVbaRange::getLanguageID() throw (uno::RuntimeException)
- {
- uno::Reference< beans::XPropertySet > xParaProps( mxTextCursor, uno::UNO_QUERY_THROW );
-@@ -324,6 +437,50 @@ void SAL_CALL SwVbaRange::setEnd( ::sal_Int32 _end ) throw (uno::RuntimeExceptio
- mxTextCursor->gotoRange( xEnd, sal_True );
- }
-
-+::sal_Bool SAL_CALL SwVbaRange::InRange( const uno::Reference< ::ooo::vba::word::XRange >& Range ) throw (uno::RuntimeException)
-+{
-+ SwVbaRange* pRange = dynamic_cast< SwVbaRange* >( Range.get() );
-+ if( !pRange )
-+ throw uno::RuntimeException();
-+ uno::Reference< text::XTextRange > xTextRange = pRange->getXTextRange();
-+ uno::Reference< text::XTextRangeCompare > xTRC( mxTextCursor->getText(), uno::UNO_QUERY_THROW );
-+ if( xTRC->compareRegionStarts( xTextRange, getXTextRange() ) >= 0 && xTRC->compareRegionEnds( xTextRange, getXTextRange() ) <= 0 )
-+ return sal_True;
-+ return sal_False;
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaRange::Revisions( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< text::XTextRange > xTextRange = getXTextRange();
-+ uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW );
-+ uno::Reference< XCollection > xCol( new SwVbaRevisions( mxParent, mxContext, xModel, xTextRange ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaRange::Sections( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< text::XTextRange > xTextRange = getXTextRange();
-+ uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW );
-+ uno::Reference< XCollection > xCol( new SwVbaSections( mxParent, mxContext, xModel, xTextRange ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaRange::Fields( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ //FIXME: should be get the field in current range
-+ uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW );
-+ uno::Reference< XCollection > xCol( new SwVbaFields( mxParent, mxContext, xModel ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
- rtl::OUString&
- SwVbaRange::getServiceImplName()
- {
-diff --git sw/source/ui/vba/vbarange.hxx sw/source/ui/vba/vbarange.hxx
-index ca3a4ea..a23bf2d 100644
---- sw/source/ui/vba/vbarange.hxx
-+++ sw/source/ui/vba/vbarange.hxx
-@@ -35,6 +35,8 @@
- #include <com/sun/star/text/XTextRange.hpp>
- #include <com/sun/star/text/XTextDocument.hpp>
- #include <ooo/vba/word/XStyle.hpp>
-+#include <ooo/vba/word/XListFormat.hpp>
-+#include "wordvbahelper.hxx"
-
- typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XRange > SwVbaRange_BASE;
-
-@@ -48,6 +50,7 @@ private:
-
- private:
- void initialize( const css::uno::Reference< css::text::XTextRange >& rStart, const css::uno::Reference< css::text::XTextRange >& rEnd ) throw (css::uno::RuntimeException);
-+ void GetStyleInfo(rtl::OUString& aStyleName, rtl::OUString& aStyleType ) throw ( css::uno::RuntimeException );
- public:
- SwVbaRange( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rTextDocument, const css::uno::Reference< css::text::XTextRange >& rStart, sal_Bool _bMaySpanEndOfDocument = sal_False ) throw (css::uno::RuntimeException);
- SwVbaRange( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rTextDocument, const css::uno::Reference< css::text::XTextRange >& rStart, const css::uno::Reference< css::text::XTextRange >& rEnd, sal_Bool _bMaySpanEndOfDocument = sal_False ) throw (css::uno::RuntimeException);
-@@ -61,16 +64,18 @@ public:
- #endif
- css::uno::Reference< css::text::XText > getXText() { return mxText; }
- void setXTextCursor( const css::uno::Reference< css::text::XTextCursor >& xTextCursor ) { mxTextCursor = xTextCursor; }
-+ void Move( const css::uno::Any& _unit, const css::uno::Any& _count, const css::uno::Any& _extend, ooo::vba::word::E_DIRECTION eDirection ) throw (css::uno::RuntimeException);
-
- // Attribute
- virtual rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setText( const rtl::OUString& rText ) throw (css::uno::RuntimeException);
- virtual css::uno::Reference< ooo::vba::word::XParagraphFormat > SAL_CALL getParagraphFormat() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setParagraphFormat( const css::uno::Reference< ooo::vba::word::XParagraphFormat >& rParagraphFormat ) throw (css::uno::RuntimeException);
-- virtual css::uno::Reference< ooo::vba::word::XStyle > SAL_CALL getStyle() throw (css::uno::RuntimeException);
-- virtual void SAL_CALL setStyle( const css::uno::Reference< ooo::vba::word::XStyle >& _xStyle ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL getStyle() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setStyle( const css::uno::Any& _xStyle ) throw (css::uno::RuntimeException);
-
- virtual css::uno::Reference< ooo::vba::word::XFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
-+ virtual css::uno::Reference< ooo::vba::word::XListFormat > SAL_CALL getListFormat() throw (css::uno::RuntimeException);
- // Methods
- virtual void SAL_CALL InsertBreak( const css::uno::Any& _breakType ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Select() throw (css::uno::RuntimeException);
-@@ -84,6 +89,10 @@ public:
- virtual void SAL_CALL setStart( ::sal_Int32 _start ) throw (css::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getEnd() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setEnd( ::sal_Int32 _end ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL InRange( const css::uno::Reference< ::ooo::vba::word::XRange >& Range ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Revisions( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Sections( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Fields( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
-diff --git sw/source/ui/vba/vbarangehelper.cxx sw/source/ui/vba/vbarangehelper.cxx
-index 337fd9d..1ec6d46 100644
---- sw/source/ui/vba/vbarangehelper.cxx
-+++ sw/source/ui/vba/vbarangehelper.cxx
-@@ -27,6 +27,7 @@
- #include "vbarangehelper.hxx"
- #include <com/sun/star/text/ControlCharacter.hpp>
- #include <com/sun/star/text/XTextRangeCompare.hpp>
-+#include <com/sun/star/text/XBookmarksSupplier.hpp>
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-@@ -111,7 +112,7 @@ uno::Reference< text::XTextCursor > SwVbaRangeHelper::initCursor( const uno::Ref
- DebugHelper::exception(e);
- }
-
-- if( !bGotTextCursor )
-+ if( !bGotTextCursor || !xTextCursor.is() )
- {
- try
- {
-@@ -125,7 +126,7 @@ uno::Reference< text::XTextCursor > SwVbaRangeHelper::initCursor( const uno::Ref
- }
- }
-
-- if( !bGotTextCursor )
-+ if( !bGotTextCursor || !xTextCursor.is() )
- {
- try
- {
-@@ -169,3 +170,29 @@ sal_Int32 SwVbaRangeHelper::getPosition( const uno::Reference< text::XText >& rT
-
- return nPosition;
- }
-+
-+uno::Reference< text::XTextContent > SwVbaRangeHelper::findBookmarkByPosition( const uno::Reference< text::XTextDocument >& xTextDoc, const uno::Reference< text::XTextRange >& xTextRange ) throw ( css::uno::RuntimeException )
-+{
-+ uno::Reference< text::XBookmarksSupplier > xBookmarksSupplier( xTextDoc, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xIndexAccess( xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY_THROW );
-+ for( sal_Int32 index = 0; index < xIndexAccess->getCount(); index++ )
-+ {
-+ uno::Reference< text::XTextContent > xBookmark( xIndexAccess->getByIndex( index ), uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextRange > xBkAnchor = xBookmark->getAnchor();
-+ uno::Reference< text::XTextRangeCompare > xCompare( xBkAnchor->getText(), uno::UNO_QUERY_THROW );
-+ if( xCompare->compareRegionStarts( xBkAnchor->getStart(), xBkAnchor->getEnd() ) == 0 )
-+ {
-+ try
-+ {
-+ if( xCompare->compareRegionStarts( xTextRange, xBkAnchor->getStart() ) == 0 )
-+ return xBookmark;
-+ }
-+ catch( uno::Exception& )
-+ {
-+ continue;
-+ }
-+ }
-+ }
-+ return uno::Reference< text::XTextContent >();
-+}
-+
-diff --git sw/source/ui/vba/vbarangehelper.hxx sw/source/ui/vba/vbarangehelper.hxx
-index 530c7e1..bf27480 100644
---- sw/source/ui/vba/vbarangehelper.hxx
-+++ sw/source/ui/vba/vbarangehelper.hxx
-@@ -30,6 +30,8 @@
- #include <vbahelper/vbahelperinterface.hxx>
- #include <com/sun/star/text/XTextViewCursor.hpp>
- #include <com/sun/star/text/XText.hpp>
-+#include <com/sun/star/text/XTextRange.hpp>
-+#include <com/sun/star/text/XTextDocument.hpp>
-
- class SwVbaRangeHelper
- {
-@@ -38,6 +40,7 @@ public:
- static void insertString( css::uno::Reference< css::text::XTextRange >& rTextRange, css::uno::Reference< css::text::XText >& rText, const rtl::OUString& rStr, sal_Bool _bAbsorb ) throw ( css::uno::RuntimeException );
- static css::uno::Reference< css::text::XTextCursor > initCursor( const css::uno::Reference< css::text::XTextRange >& rTextRange, const css::uno::Reference< css::text::XText >& rText ) throw ( css::uno::RuntimeException );
- static sal_Int32 getPosition( const css::uno::Reference< css::text::XText >& rText, const css::uno::Reference< css::text::XTextRange >& rTextRange ) throw ( css::uno::RuntimeException );
-+ static css::uno::Reference< css::text::XTextContent > findBookmarkByPosition( const css::uno::Reference< css::text::XTextDocument >& xTextDoc, const css::uno::Reference< css::text::XTextRange >& xTextRange ) throw ( css::uno::RuntimeException );
-
- };
- #endif /* SW_VBA_RANGEHELPER_HXX */
-diff --git sw/source/ui/vba/vbareplacement.cxx sw/source/ui/vba/vbareplacement.cxx
-index 2bd7dcf..097699b 100644
---- sw/source/ui/vba/vbareplacement.cxx
-+++ sw/source/ui/vba/vbareplacement.cxx
-@@ -50,6 +50,12 @@ void SAL_CALL SwVbaReplacement::setText( const ::rtl::OUString& _text ) throw (u
- mxPropertyReplace->setReplaceString( _text );
- }
-
-+void SAL_CALL SwVbaReplacement::ClearFormatting( ) throw (uno::RuntimeException)
-+{
-+ uno::Sequence< beans::PropertyValue > aPropValues;
-+ mxPropertyReplace->setReplaceAttributes( aPropValues );
-+}
-+
- rtl::OUString&
- SwVbaReplacement::getServiceImplName()
- {
-diff --git sw/source/ui/vba/vbareplacement.hxx sw/source/ui/vba/vbareplacement.hxx
-index c0f66af..62e1143 100644
---- sw/source/ui/vba/vbareplacement.hxx
-+++ sw/source/ui/vba/vbareplacement.hxx
-@@ -47,6 +47,9 @@ public:
- 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 ClearFormatting() throw (css::uno::RuntimeException);
-+
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-diff --git sw/source/ui/vba/vbarevision.cxx sw/source/ui/vba/vbarevision.cxx
-new file mode 100644
-index 0000000..0c48b1d
---- /dev/null
-+++ sw/source/ui/vba/vbarevision.cxx
-@@ -0,0 +1,105 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbarevision.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include <com/sun/star/document/XRedlinesSupplier.hpp>
-+#include "wordvbahelper.hxx"
-+#include <docsh.hxx>
-+#include <doc.hxx>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaRevision::SwVbaRevision( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< beans::XPropertySet >& xRedlineProps ) throw ( uno::RuntimeException ) : SwVbaRevision_BASE( rParent, rContext ), mxModel( xModel ), mxRedlineProps( xRedlineProps )
-+{
-+}
-+
-+SwVbaRevision::~SwVbaRevision()
-+{
-+}
-+
-+sal_Int32 SwVbaRevision::GetPosition() throw (css::uno::RuntimeException)
-+{
-+ sal_Int32 nPos = -1;
-+ uno::Reference< document::XRedlinesSupplier > xRedlinesSupp( mxModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xRedlines( xRedlinesSupp->getRedlines(), uno::UNO_QUERY_THROW );
-+ sal_Int32 nCount = xRedlines->getCount();
-+ for( sal_Int32 i = 0; i < nCount; i++ )
-+ {
-+ uno::Reference< beans::XPropertySet > xProps( xRedlines->getByIndex( i ), uno::UNO_QUERY_THROW );
-+ if( xProps == mxRedlineProps )
-+ {
-+ nPos = i;
-+ OSL_TRACE(" SwVbaRevision::SwVbaRevision, the redline position is %d, ", nPos );
-+ break;
-+ }
-+ }
-+ if( nPos == -1 )
-+ throw uno::RuntimeException();
-+
-+ return nPos;
-+}
-+
-+void SAL_CALL
-+SwVbaRevision::Accept() throw ( css::uno::RuntimeException )
-+{
-+ SwDoc* pDoc = word::getDocShell( mxModel )->GetDoc();
-+ if( pDoc )
-+ pDoc->AcceptRedline( GetPosition(), sal_True );
-+}
-+
-+void SAL_CALL
-+SwVbaRevision::Reject( ) throw ( css::uno::RuntimeException )
-+{
-+ SwDoc* pDoc = word::getDocShell( mxModel )->GetDoc();
-+ if( pDoc )
-+ pDoc->RejectRedline( GetPosition(), sal_True );
-+}
-+
-+rtl::OUString&
-+SwVbaRevision::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaRevision") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaRevision::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Revision" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbarevision.hxx sw/source/ui/vba/vbarevision.hxx
-new file mode 100644
-index 0000000..0384370
---- /dev/null
-+++ sw/source/ui/vba/vbarevision.hxx
-@@ -0,0 +1,60 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_REVISION_HXX
-+#define SW_VBA_REVISION_HXX
-+
-+#include <ooo/vba/word/XRevision.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XRevision > SwVbaRevision_BASE;
-+
-+class SwVbaRevision : public SwVbaRevision_BASE
-+{
-+private:
-+ css::uno::Reference< css::frame::XModel > mxModel;
-+ css::uno::Reference< css::beans::XPropertySet > mxRedlineProps;
-+
-+private:
-+ sal_Int32 GetPosition() throw (css::uno::RuntimeException);
-+
-+public:
-+ SwVbaRevision( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::beans::XPropertySet >& xRedlineProps ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaRevision();
-+
-+ // Methods
-+ virtual void SAL_CALL Accept( ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL Reject( ) throw (css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_REVISION_HXX */
-diff --git sw/source/ui/vba/vbarevisions.cxx sw/source/ui/vba/vbarevisions.cxx
-new file mode 100644
-index 0000000..eea1394
---- /dev/null
-+++ sw/source/ui/vba/vbarevisions.cxx
-@@ -0,0 +1,188 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbarevisions.hxx"
-+#include "vbarevision.hxx"
-+#include <cppuhelper/implbase2.hxx>
-+#include <com/sun/star/document/XRedlinesSupplier.hpp>
-+#include <com/sun/star/text/XTextRangeCompare.hpp>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+typedef ::cppu::WeakImplHelper1< container::XEnumeration > RevisionEnumeration_BASE;
-+typedef ::cppu::WeakImplHelper2< container::XIndexAccess, container::XEnumerationAccess > RevisionCollectionHelper_BASE;
-+typedef std::vector< uno::Reference< beans::XPropertySet > > RevisionMap;
-+
-+class RedlinesEnumeration : public RevisionEnumeration_BASE
-+{
-+ RevisionMap mRevisionMap;
-+ RevisionMap::iterator mIt;
-+public:
-+ RedlinesEnumeration( const RevisionMap& sMap ) : mRevisionMap( sMap ), mIt( mRevisionMap.begin() ) {}
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( mIt != mRevisionMap.end() );
-+ }
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( !hasMoreElements() )
-+ throw container::NoSuchElementException();
-+ uno::Reference< beans::XPropertySet > xRevision( *mIt++ );
-+ return uno::makeAny( xRevision ) ;
-+ }
-+};
-+
-+class RevisionCollectionHelper : public RevisionCollectionHelper_BASE
-+{
-+ RevisionMap mRevisionMap;
-+public:
-+RevisionCollectionHelper( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XTextRange >& xTextRange ) throw (uno::RuntimeException);
-+
-+ // XElementAccess
-+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) { return beans::XPropertySet::static_type(0); }
-+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) { return ( mRevisionMap.size() > 0 ); }
-+ // XIndexAccess
-+ virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException) { return mRevisionMap.size(); }
-+ virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
-+ {
-+ if ( Index < 0 || Index >= getCount() )
-+ throw lang::IndexOutOfBoundsException();
-+
-+ return uno::makeAny( mRevisionMap[ Index ] );
-+
-+ }
-+ // XEnumerationAccess
-+ virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
-+ {
-+ return new RedlinesEnumeration( mRevisionMap );
-+ }
-+};
-+
-+RevisionCollectionHelper::RevisionCollectionHelper( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XTextRange >& xTextRange ) throw (uno::RuntimeException)
-+ {
-+ uno::Reference< text::XTextRangeCompare > xTRC( xTextRange->getText(), uno::UNO_QUERY_THROW );
-+ uno::Reference< document::XRedlinesSupplier > xRedlinesSupp( xModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xRedlines( xRedlinesSupp->getRedlines(), uno::UNO_QUERY_THROW );
-+ sal_Int32 nCount = xRedlines->getCount();
-+ for( sal_Int32 index = 0; index < nCount; index++ )
-+ {
-+ uno::Reference< text::XTextRange > xRedlineRange( xRedlines->getByIndex( index ), uno::UNO_QUERY_THROW );
-+ if( xTRC->compareRegionStarts( xTextRange, xRedlineRange ) >= 0 && xTRC->compareRegionEnds( xTextRange, xRedlineRange ) <= 0 )
-+ {
-+ uno::Reference< beans::XPropertySet > xRedlineProps( xRedlineRange, uno::UNO_QUERY_THROW );
-+ mRevisionMap.push_back( xRedlineProps );
-+ }
-+ }
-+ }
-+class RevisionsEnumeration : public EnumerationHelperImpl
-+{
-+ uno::Reference< frame::XModel > m_xModel;
-+public:
-+ RevisionsEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration, const uno::Reference< frame::XModel >& xModel ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xParent, xContext, xEnumeration ), m_xModel( xModel ) {}
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ uno::Reference< beans::XPropertySet > xRevision( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
-+ return uno::makeAny( uno::Reference< word::XRevision > ( new SwVbaRevision( m_xParent, m_xContext, m_xModel, xRevision ) ) );
-+ }
-+
-+};
-+
-+SwVbaRevisions::SwVbaRevisions( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XTextRange >& xTextRange ): SwVbaRevisions_BASE( xParent, xContext, new RevisionCollectionHelper( xModel, xTextRange ) ), mxModel( xModel )
-+{
-+}
-+
-+SwVbaRevisions::SwVbaRevisions( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< container::XIndexAccess >& xIndexAccess ): SwVbaRevisions_BASE( xParent, xContext, xIndexAccess ), mxModel( xModel )
-+{
-+}
-+
-+// XEnumerationAccess
-+uno::Type
-+SwVbaRevisions::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XRevision::static_type(0);
-+}
-+uno::Reference< container::XEnumeration >
-+SwVbaRevisions::createEnumeration() throw (uno::RuntimeException)
-+{
-+ uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
-+ return new RevisionsEnumeration( this, mxContext, xEnumAccess->createEnumeration(), mxModel );
-+}
-+
-+uno::Any
-+SwVbaRevisions::createCollectionObject( const css::uno::Any& aSource )
-+{
-+ uno::Reference< beans::XPropertySet > xRevision( aSource, uno::UNO_QUERY_THROW );
-+ return uno::makeAny( uno::Reference< word::XRevision > ( new SwVbaRevision( this, mxContext, mxModel, xRevision ) ) );
-+}
-+
-+void SAL_CALL SwVbaRevisions::AcceptAll( ) throw (css::uno::RuntimeException)
-+{
-+ // First we need to put all the redline into a vector, because if the redline is accepted,
-+ // it will auto delete in the document.
-+ std::vector< uno::Reference< word::XRevision > > aRevisions;
-+ uno::Reference< container::XEnumeration > xEnumeration = createEnumeration();
-+ while( xEnumeration->hasMoreElements() )
-+ {
-+ uno::Reference< word::XRevision > xRevision( xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
-+ aRevisions.push_back( xRevision );
-+ }
-+
-+ std::vector< uno::Reference< word::XRevision > >::iterator it = aRevisions.begin();
-+ for( ; it != aRevisions.end(); it++ )
-+ {
-+ uno::Reference< word::XRevision > xRevision( *it );
-+ xRevision->Accept();
-+ }
-+}
-+
-+void SAL_CALL SwVbaRevisions::RejectAll( ) throw (css::uno::RuntimeException)
-+{
-+ throw uno::RuntimeException();
-+}
-+
-+rtl::OUString&
-+SwVbaRevisions::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaRevisions") );
-+ return sImplName;
-+}
-+
-+css::uno::Sequence<rtl::OUString>
-+SwVbaRevisions::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Revisions") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbarevisions.hxx sw/source/ui/vba/vbarevisions.hxx
-new file mode 100644
-index 0000000..88db794
---- /dev/null
-+++ sw/source/ui/vba/vbarevisions.hxx
-@@ -0,0 +1,66 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_PANES_HXX
-+#define SW_VBA_PANES_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XRevisions.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/text/XTextRange.hpp>
-+
-+
-+typedef CollTestImplHelper< ooo::vba::word::XRevisions > SwVbaRevisions_BASE;
-+
-+class SwVbaRevisions : public SwVbaRevisions_BASE
-+{
-+private:
-+ css::uno::Reference< css::frame::XModel > mxModel;
-+
-+public:
-+ SwVbaRevisions( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XTextRange >& xTextRange );
-+
-+ SwVbaRevisions( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess );
-+ virtual ~SwVbaRevisions() {}
-+
-+ // Methods
-+ virtual void SAL_CALL AcceptAll( ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL RejectAll( ) 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);
-+
-+ // SwVbaRevisions_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* SW_VBA_PANES_HXX */
-diff --git sw/source/ui/vba/vbarow.cxx sw/source/ui/vba/vbarow.cxx
-new file mode 100644
-index 0000000..2f4132b
---- /dev/null
-+++ sw/source/ui/vba/vbarow.cxx
-@@ -0,0 +1,136 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbarow.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include <com/sun/star/table/XCellRange.hpp>
-+#include <com/sun/star/view/XSelectionSupplier.hpp>
-+#include <ooo/vba/word/WdRowHeightRule.hpp>
-+#include <ooo/vba/word/WdConstants.hpp>
-+#include <rtl/ustrbuf.hxx>
-+#include "wordvbahelper.hxx"
-+#include "vbatablehelper.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaRow::SwVbaRow( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext,const uno::Reference< text::XTextTable >& xTextTable, sal_Int32 nIndex ) throw ( uno::RuntimeException ) :
-+ SwVbaRow_BASE( rParent, rContext ), mxTextTable( xTextTable ), mnIndex( nIndex )
-+{
-+ mxTableRows = mxTextTable->getRows();
-+ mxRowProps.set( mxTableRows->getByIndex( mnIndex ), uno::UNO_QUERY_THROW );
-+}
-+
-+SwVbaRow::~SwVbaRow()
-+{
-+}
-+
-+uno::Any SAL_CALL SwVbaRow::getHeight() throw (css::uno::RuntimeException)
-+{
-+ if( getHeightRule() == word::WdRowHeightRule::wdRowHeightAuto )
-+ return uno::makeAny( sal_Int32( word::WdConstants::wdUndefined ) );
-+
-+ sal_Int32 nHeight = 0;
-+ mxRowProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Height") ) ) >>= nHeight;
-+ return uno::makeAny( (float)Millimeter::getInPoints( nHeight ) );
-+}
-+
-+void SAL_CALL SwVbaRow::setHeight( const uno::Any& _height ) throw (css::uno::RuntimeException)
-+{
-+ float height = 0;
-+ _height >>= height;
-+
-+ sal_Int32 nHeight = Millimeter::getInHundredthsOfOneMillimeter( height );
-+ mxRowProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Height") ), uno::makeAny( nHeight ) );
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaRow::getHeightRule() throw (css::uno::RuntimeException)
-+{
-+ sal_Bool isAutoHeight = sal_False;
-+ mxRowProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsAutoHeight") ) ) >>= isAutoHeight;
-+ return isAutoHeight ? word::WdRowHeightRule::wdRowHeightAuto : word::WdRowHeightRule::wdRowHeightExactly;
-+}
-+
-+void SAL_CALL SwVbaRow::setHeightRule( ::sal_Int32 _heightrule ) throw (css::uno::RuntimeException)
-+{
-+ sal_Bool isAutoHeight = ( _heightrule == word::WdRowHeightRule::wdRowHeightAuto );
-+ mxRowProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsAutoHeight") ), uno::makeAny( isAutoHeight ) );
-+}
-+
-+void SAL_CALL
-+SwVbaRow::Select( ) throw ( uno::RuntimeException )
-+{
-+ SelectRow( getCurrentWordDoc(mxContext), mxTextTable, mnIndex, mnIndex );
-+}
-+
-+void SwVbaRow::SelectRow( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XTextTable >& xTextTable, sal_Int32 nStartRow, sal_Int32 nEndRow ) throw ( uno::RuntimeException )
-+{
-+ rtl::OUStringBuffer aRangeName;
-+ aRangeName.appendAscii("A").append(sal_Int32( nStartRow + 1 ) );
-+ SwVbaTableHelper aTableHelper( xTextTable );
-+ sal_Int32 nColCount = aTableHelper.getTabColumnsCount( nEndRow );
-+ // FIXME: the column count > 26
-+ //sal_Char cCol = 'A' + nColCount - 1;
-+ rtl::OUString sCol = aTableHelper.getColumnStr( nColCount - 1);
-+ aRangeName.appendAscii(":").append( sCol ).append( sal_Int32( nEndRow + 1 ) );
-+
-+ uno::Reference< table::XCellRange > xCellRange( xTextTable, uno::UNO_QUERY_THROW );
-+ rtl::OUString sSelRange = aRangeName.makeStringAndClear();
-+ uno::Reference< table::XCellRange > xSelRange = xCellRange->getCellRangeByName( sSelRange );
-+
-+ uno::Reference< view::XSelectionSupplier > xSelection( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
-+ xSelection->select( uno::makeAny( xSelRange ) );
-+}
-+
-+void SAL_CALL SwVbaRow::SetHeight( float height, sal_Int32 heightrule ) throw (css::uno::RuntimeException)
-+{
-+ setHeightRule( heightrule );
-+ setHeight( uno::makeAny( height ) );
-+}
-+
-+rtl::OUString&
-+SwVbaRow::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaRow") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaRow::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Row" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbarow.hxx sw/source/ui/vba/vbarow.hxx
-new file mode 100644
-index 0000000..cfbfb4d
---- /dev/null
-+++ sw/source/ui/vba/vbarow.hxx
-@@ -0,0 +1,69 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_ROW_HXX
-+#define SW_VBA_ROW_HXX
-+
-+#include <ooo/vba/word/XRow.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/table/XTableRows.hpp>
-+#include <com/sun/star/text/XTextTable.hpp>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XRow > SwVbaRow_BASE;
-+
-+class SwVbaRow : public SwVbaRow_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XTextTable > mxTextTable;
-+ css::uno::Reference< css::table::XTableRows > mxTableRows;
-+ css::uno::Reference< css::beans::XPropertySet > mxRowProps;
-+ sal_Int32 mnIndex;
-+
-+public:
-+ SwVbaRow( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextTable >& xTextTable, sal_Int32 nIndex ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaRow();
-+
-+ // Attributes
-+ virtual css::uno::Any SAL_CALL getHeight() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setHeight( const css::uno::Any& _height ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getHeightRule() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setHeightRule( ::sal_Int32 _heightrule ) throw (css::uno::RuntimeException);
-+
-+ // Methods
-+ virtual void SAL_CALL Select( ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL SetHeight( float height, sal_Int32 heightrule ) throw (css::uno::RuntimeException);
-+
-+ static void SelectRow( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XTextTable >& xTextTable, sal_Int32 nStartRow, sal_Int32 nEndRow ) throw (css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_ROW_HXX */
-diff --git sw/source/ui/vba/vbarows.cxx sw/source/ui/vba/vbarows.cxx
-new file mode 100644
-index 0000000..e2737a4
---- /dev/null
-+++ sw/source/ui/vba/vbarows.cxx
-@@ -0,0 +1,368 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbarows.hxx"
-+#include "vbarow.hxx"
-+#include <com/sun/star/text/HoriOrientation.hpp>
-+#include <com/sun/star/table/XCellRange.hpp>
-+#include <ooo/vba/word/WdRowAlignment.hpp>
-+#include <ooo/vba/word/WdConstants.hpp>
-+#include <ooo/vba/word/WdRulerStyle.hpp>
-+#include "wordvbahelper.hxx"
-+#include "vbacolumns.hxx"
-+#include "vbatablehelper.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+class RowsEnumWrapper : public EnumerationHelper_BASE
-+{
-+ uno::WeakReference< XHelperInterface > mxParent;
-+ uno::Reference< uno::XComponentContext > mxContext;
-+ uno::Reference< text::XTextTable > mxTextTable;
-+ uno::Reference< container::XIndexAccess > mxIndexAccess;
-+ sal_Int32 nIndex;
-+
-+public:
-+ RowsEnumWrapper( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< text::XTextTable >& xTextTable ) : mxParent( xParent ), mxContext( xContext ), mxTextTable( xTextTable ), nIndex( 0 )
-+ {
-+ mxIndexAccess.set( mxTextTable->getRows(), uno::UNO_QUERY );
-+ }
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( nIndex < mxIndexAccess->getCount() );
-+ }
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if( nIndex < mxIndexAccess->getCount() )
-+ {
-+ return uno::makeAny( uno::Reference< word::XRow > ( new SwVbaRow( mxParent, mxContext, mxTextTable, nIndex++ ) ) );
-+ }
-+ throw container::NoSuchElementException();
-+ }
-+};
-+
-+SwVbaRows::SwVbaRows( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextTable >& xTextTable, const uno::Reference< table::XTableRows >& xTableRows ) throw (uno::RuntimeException) : SwVbaRows_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( xTableRows, uno::UNO_QUERY_THROW ) ), mxTextTable( xTextTable ), mxTableRows( xTableRows )
-+{
-+ mnStartRowIndex = 0;
-+ mnEndRowIndex = m_xIndexAccess->getCount() - 1;
-+}
-+
-+SwVbaRows::SwVbaRows( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextTable >& xTextTable, const uno::Reference< table::XTableRows >& xTableRows, sal_Int32 nStarIndex, sal_Int32 nEndIndex ) throw (uno::RuntimeException) : SwVbaRows_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( xTableRows, uno::UNO_QUERY_THROW ) ), mxTextTable( xTextTable ), mxTableRows( xTableRows ), mnStartRowIndex( nStarIndex ), mnEndRowIndex( nEndIndex )
-+{
-+ if( mnEndRowIndex < mnStartRowIndex )
-+ throw uno::RuntimeException();
-+}
-+
-+/**
-+ * get the alignment of the rows: SO format com.sun.star.text.HoriOrientation
-+ * is mapped to WdRowAlignment in Word
-+ * @return the alignment
-+ */
-+::sal_Int32 SAL_CALL SwVbaRows::getAlignment() throw (uno::RuntimeException)
-+{
-+ sal_Int16 nAlignment = text::HoriOrientation::LEFT;
-+ uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, uno::UNO_QUERY_THROW );
-+ xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HoriOrient") ) ) >>= nAlignment;
-+ sal_Int32 nRet = 0;
-+ switch( nAlignment )
-+ {
-+ case text::HoriOrientation::CENTER:
-+ {
-+ nRet = word::WdRowAlignment::wdAlignRowCenter;
-+ break;
-+ }
-+ case text::HoriOrientation::RIGHT:
-+ {
-+ nRet = word::WdRowAlignment::wdAlignRowRight;
-+ break;
-+ }
-+ default:
-+ {
-+ nRet = word::WdRowAlignment::wdAlignRowLeft;
-+ }
-+ }
-+ return nRet;
-+}
-+
-+void SAL_CALL SwVbaRows::setAlignment( ::sal_Int32 _alignment ) throw (uno::RuntimeException)
-+{
-+ sal_Int16 nAlignment = text::HoriOrientation::LEFT;
-+ switch( _alignment )
-+ {
-+ case word::WdRowAlignment::wdAlignRowCenter:
-+ {
-+ nAlignment = text::HoriOrientation::CENTER;
-+ break;
-+ }
-+ case word::WdRowAlignment::wdAlignRowRight:
-+ {
-+ nAlignment = text::HoriOrientation::RIGHT;
-+ break;
-+ }
-+ default:
-+ {
-+ nAlignment = text::HoriOrientation::LEFT;
-+ }
-+ }
-+ uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, uno::UNO_QUERY_THROW );
-+ xTableProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HoriOrient") ), uno::makeAny( nAlignment ) );
-+}
-+
-+uno::Any SAL_CALL SwVbaRows::getAllowBreakAcrossPages() throw (uno::RuntimeException)
-+{
-+ sal_Bool bAllowBreak = sal_False;
-+ uno::Reference< container::XIndexAccess > xRowsAccess( mxTableRows, uno::UNO_QUERY_THROW );
-+ for( sal_Int32 index = mnStartRowIndex; index <= mnEndRowIndex; ++index )
-+ {
-+ uno::Reference< beans::XPropertySet > xRowProps( xRowsAccess->getByIndex( index ), uno::UNO_QUERY_THROW );
-+ sal_Bool bSplit = sal_False;
-+ xRowProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsSplitAllowed") ) ) >>= bSplit;
-+ if( index == 0 )
-+ {
-+ bAllowBreak = bSplit;
-+ }
-+ if( bSplit != bAllowBreak )
-+ {
-+ sal_Int32 nRet = word::WdConstants::wdUndefined;
-+ return uno::makeAny( nRet );
-+ }
-+ }
-+ return uno::makeAny( bAllowBreak );
-+}
-+
-+void SAL_CALL SwVbaRows::setAllowBreakAcrossPages( const uno::Any& _allowbreakacrosspages ) throw (uno::RuntimeException)
-+{
-+ sal_Bool bAllowBreak = sal_False;
-+ _allowbreakacrosspages >>= bAllowBreak;
-+ uno::Reference< container::XIndexAccess > xRowsAccess( mxTableRows, uno::UNO_QUERY_THROW );
-+ for( sal_Int32 index = mnStartRowIndex; index <= mnEndRowIndex; ++index )
-+ {
-+ uno::Reference< beans::XPropertySet > xRowProps( xRowsAccess->getByIndex( index ), uno::UNO_QUERY_THROW );
-+ xRowProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsSplitAllowed") ), uno::makeAny( bAllowBreak ) );
-+ }
-+}
-+
-+float SAL_CALL SwVbaRows::getSpaceBetweenColumns() throw (uno::RuntimeException)
-+{
-+ // just get the first spacing of the first cell
-+ uno::Reference< table::XCellRange > xCellRange( mxTextTable, uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xCellProps( xCellRange->getCellByPosition( 0, mnStartRowIndex ), uno::UNO_QUERY_THROW );
-+ sal_Int32 nLeftBorderDistance = 0;
-+ sal_Int32 nRightBorderDistance = 0;
-+ xCellProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftBorderDistance") ) ) >>= nLeftBorderDistance;
-+ xCellProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightBorderDistance") ) ) >>= nRightBorderDistance;
-+ return static_cast< float >( Millimeter::getInPoints( nLeftBorderDistance + nRightBorderDistance ) );
-+}
-+
-+void SAL_CALL SwVbaRows::setSpaceBetweenColumns( float _spacebetweencolumns ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nSpace = Millimeter::getInHundredthsOfOneMillimeter( _spacebetweencolumns ) / 2;
-+ uno::Reference< container::XIndexAccess > xColumnAccess( mxTextTable->getColumns(), uno::UNO_QUERY_THROW );
-+ uno::Reference< table::XCellRange > xCellRange( mxTextTable, uno::UNO_QUERY_THROW );
-+ SwVbaTableHelper aTableHelper( mxTextTable );
-+ for( sal_Int32 row = mnStartRowIndex; row <= mnEndRowIndex; ++row )
-+ {
-+ sal_Int32 nColumns = aTableHelper.getTabColumnsCount( row );
-+ for( sal_Int32 column = 0; column < nColumns; ++column )
-+ {
-+ uno::Reference< beans::XPropertySet > xCellProps( xCellRange->getCellByPosition( column, row ), uno::UNO_QUERY_THROW );
-+ xCellProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftBorderDistance") ), uno::makeAny( nSpace ) );
-+ xCellProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightBorderDistance") ), uno::makeAny( nSpace ) );
-+ }
-+ }
-+}
-+
-+void SAL_CALL SwVbaRows::Delete( ) throw (uno::RuntimeException)
-+{
-+ mxTableRows->removeByIndex( mnStartRowIndex, getCount() );
-+}
-+
-+void SAL_CALL SwVbaRows::SetLeftIndent( float LeftIndent, ::sal_Int32 RulerStyle ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< word::XColumns > xColumns( new SwVbaColumns( getParent(), mxContext, mxTextTable, mxTextTable->getColumns() ) );
-+ sal_Int32 nIndent = (sal_Int32)( LeftIndent );
-+ switch( RulerStyle )
-+ {
-+ case word::WdRulerStyle::wdAdjustFirstColumn:
-+ {
-+ setIndentWithAdjustFirstColumn( xColumns, nIndent );
-+ break;
-+ }
-+ case word::WdRulerStyle::wdAdjustNone:
-+ {
-+ setIndentWithAdjustNone( nIndent );
-+ break;
-+ }
-+ case word::WdRulerStyle::wdAdjustProportional:
-+ {
-+ setIndentWithAdjustProportional( xColumns, nIndent );
-+ break;
-+ }
-+ case word::WdRulerStyle::wdAdjustSameWidth:
-+ {
-+ setIndentWithAdjustSameWidth( xColumns, nIndent );
-+ break;
-+ }
-+ default:
-+ {
-+ DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
-+ }
-+ }
-+}
-+
-+void SwVbaRows::setIndentWithAdjustNone( sal_Int32 indent ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, uno::UNO_QUERY_THROW );
-+ sal_Int32 nMargin = 0;
-+ xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftMargin") ) ) >>= nMargin;
-+ nMargin += indent;
-+ xTableProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftMargin") ), uno::makeAny( nMargin ) );
-+}
-+
-+ void SwVbaRows::setIndentWithAdjustFirstColumn( const uno::Reference< word::XColumns >& xColumns, sal_Int32 indent ) throw (uno::RuntimeException)
-+ {
-+ sal_Int32 nIndex = 1;
-+ uno::Reference< XCollection > xCol( xColumns, uno::UNO_QUERY_THROW );
-+ uno::Reference< word::XColumn > xColumn( xCol->Item( uno::makeAny( nIndex ), uno::Any() ), uno::UNO_QUERY_THROW );
-+ sal_Int32 nWidth = xColumn->getWidth();
-+ nWidth -= indent;
-+ xColumn->setWidth( nWidth );
-+ setIndentWithAdjustNone( indent );
-+ }
-+
-+ void SwVbaRows::setIndentWithAdjustProportional( const uno::Reference< word::XColumns >& xColumns, sal_Int32 indent ) throw (uno::RuntimeException)
-+ {
-+ // calculate the new width and get the proportion between old and new
-+ uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, uno::UNO_QUERY_THROW );
-+ sal_Int32 nWidth = 0;
-+ xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ) ) >>= nWidth;
-+ sal_Int32 nNewWidth = nWidth - indent;
-+ double propFactor = (double)nNewWidth/(double)nWidth;
-+
-+ // get all columns, calculate and set the new width of the columns
-+ uno::Reference< XCollection > xCol( xColumns, uno::UNO_QUERY_THROW );
-+ sal_Int32 nColCount = xCol->getCount();
-+ for( sal_Int32 i = 0; i < nColCount; i++ )
-+ {
-+ uno::Reference< word::XColumn > xColumn( xCol->Item( uno::makeAny( i ), uno::Any() ), uno::UNO_QUERY_THROW );
-+ sal_Int32 nColWidth = xColumn->getWidth();
-+ sal_Int32 nNewColWidth = ( sal_Int32 )( propFactor * nColWidth );
-+ xColumn->setWidth( nNewColWidth );
-+ }
-+
-+ // set the width and position of the table
-+ setIndentWithAdjustNone( indent );
-+ xTableProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ), uno::makeAny( nNewWidth ) );
-+ }
-+
-+ void SwVbaRows::setIndentWithAdjustSameWidth( const uno::Reference< word::XColumns >& xColumns, sal_Int32 indent ) throw (uno::RuntimeException)
-+ {
-+ // calculate the new width and get the width of all columns
-+ uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, uno::UNO_QUERY_THROW );
-+ sal_Int32 nWidth = 0;
-+ xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ) ) >>= nWidth;
-+ sal_Int32 nNewWidth = nWidth - indent;
-+
-+ // get all columns, calculate and set the new width of the columns
-+ uno::Reference< XCollection > xCol( xColumns, uno::UNO_QUERY_THROW );
-+ sal_Int32 nColCount = xCol->getCount();
-+ sal_Int32 nNewColWidth = (sal_Int32)( double( nNewWidth )/nColCount );
-+ for( sal_Int32 i = 0; i < nColCount; i++ )
-+ {
-+ uno::Reference< word::XColumn > xColumn( xCol->Item( uno::makeAny( i ), uno::Any() ), uno::UNO_QUERY_THROW );
-+ xColumn->setWidth( nNewColWidth );
-+ }
-+
-+ // set the width and position of the table
-+ setIndentWithAdjustNone( indent );
-+ xTableProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ), uno::makeAny( nNewWidth ) );
-+ }
-+
-+void SAL_CALL SwVbaRows::Select( ) throw (uno::RuntimeException)
-+{
-+ SwVbaRow::SelectRow( getCurrentWordDoc(mxContext), mxTextTable, mnStartRowIndex, mnEndRowIndex );
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaRows::getCount() throw (uno::RuntimeException)
-+{
-+ return ( mnEndRowIndex - mnStartRowIndex + 1 );
-+}
-+
-+uno::Any SAL_CALL SwVbaRows::Item( const uno::Any& Index1, const uno::Any& /*not processed in this base class*/ ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nIndex = 0;
-+ if( ( Index1 >>= nIndex ) == sal_True )
-+ {
-+ if( nIndex <= 0 || nIndex > getCount() )
-+ {
-+ throw lang::IndexOutOfBoundsException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Index out of bounds") ), uno::Reference< uno::XInterface >() );
-+ }
-+ return uno::makeAny( uno::Reference< word::XRow >( new SwVbaRow( this, mxContext, mxTextTable, nIndex - 1 ) ) );
-+ }
-+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Index out of bounds") ), uno::Reference< uno::XInterface >() );
-+}
-+
-+// XEnumerationAccess
-+uno::Type
-+SwVbaRows::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XRow::static_type(0);
-+}
-+uno::Reference< container::XEnumeration >
-+SwVbaRows::createEnumeration() throw (uno::RuntimeException)
-+{
-+ return new RowsEnumWrapper( this, mxContext, mxTextTable );
-+}
-+
-+uno::Any
-+SwVbaRows::createCollectionObject( const uno::Any& aSource )
-+{
-+ return aSource;
-+}
-+
-+rtl::OUString&
-+SwVbaRows::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaRows") );
-+ return sImplName;
-+}
-+
-+uno::Sequence<rtl::OUString>
-+SwVbaRows::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Rows") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbarows.hxx sw/source/ui/vba/vbarows.hxx
-new file mode 100644
-index 0000000..ccff1ef
---- /dev/null
-+++ sw/source/ui/vba/vbarows.hxx
-@@ -0,0 +1,87 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_ROWS_HXX
-+#define SW_VBA_ROWS_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XRows.hpp>
-+#include <ooo/vba/word/XColumns.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/table/XTableRows.hpp>
-+#include <com/sun/star/text/XTextTable.hpp>
-+
-+typedef CollTestImplHelper< ooo::vba::word::XRows > SwVbaRows_BASE;
-+
-+class SwVbaRows : public SwVbaRows_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XTextTable > mxTextTable;
-+ css::uno::Reference< css::table::XTableRows > mxTableRows;
-+ sal_Int32 mnStartRowIndex;
-+ sal_Int32 mnEndRowIndex;
-+
-+private:
-+ void setIndentWithAdjustNone( sal_Int32 indent ) throw (css::uno::RuntimeException);
-+ void setIndentWithAdjustFirstColumn( const css::uno::Reference< ooo::vba::word::XColumns >& xColumns, sal_Int32 indent ) throw (css::uno::RuntimeException);
-+ void setIndentWithAdjustProportional( const css::uno::Reference< ooo::vba::word::XColumns >& xColumns, sal_Int32 indent ) throw (css::uno::RuntimeException);
-+ void setIndentWithAdjustSameWidth( const css::uno::Reference< ooo::vba::word::XColumns >& xColumns, sal_Int32 indent ) throw (css::uno::RuntimeException);
-+
-+public:
-+ SwVbaRows( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::text::XTextTable >& xTextTable, const css::uno::Reference< css::table::XTableRows >& xTableRows ) throw ( css::uno::RuntimeException );
-+ SwVbaRows( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::text::XTextTable >& xTextTable, const css::uno::Reference< css::table::XTableRows >& xTableRows, sal_Int32 nStarIndex, sal_Int32 nEndIndex ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaRows() {}
-+
-+ // Attributes
-+ virtual ::sal_Int32 SAL_CALL getAlignment() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setAlignment( ::sal_Int32 _alignment ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL getAllowBreakAcrossPages() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setAllowBreakAcrossPages( const css::uno::Any& _allowbreakacrosspages ) throw (css::uno::RuntimeException);
-+ virtual float SAL_CALL getSpaceBetweenColumns() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setSpaceBetweenColumns( float _spacebetweencolumns ) throw (css::uno::RuntimeException);
-+
-+ // Methods
-+ virtual void SAL_CALL Delete( ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL SetLeftIndent( float LeftIndent, ::sal_Int32 RulerStyle ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL Select( ) throw (css::uno::RuntimeException);
-+
-+ //XCollection
-+ virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException);
-+ 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 );
-+ // 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);
-+
-+ // SwVbaRows_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* SW_VBA_ROWS_HXX */
-diff --git sw/source/ui/vba/vbasection.cxx sw/source/ui/vba/vbasection.cxx
-index 4df6f0b..fd747b3 100644
---- sw/source/ui/vba/vbasection.cxx
-+++ sw/source/ui/vba/vbasection.cxx
-@@ -28,6 +28,7 @@
- #include <vbahelper/vbahelper.hxx>
- #include <tools/diagnose_ex.h>
- #include "vbapagesetup.hxx"
-+#include "vbaheadersfooters.hxx"
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-@@ -50,14 +51,20 @@ void SAL_CALL SwVbaSection::setProtectedForForms( ::sal_Bool /*_protectedforform
- {
- }
-
--uno::Any SAL_CALL SwVbaSection::Headers( ) throw (uno::RuntimeException)
-+uno::Any SAL_CALL SwVbaSection::Headers( const uno::Any& index ) throw (uno::RuntimeException)
- {
-- return uno::Any();
-+ uno::Reference< XCollection > xCol( new SwVbaHeadersFooters( this, mxContext, mxModel, mxPageProps, sal_True ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
- }
-
--uno::Any SAL_CALL SwVbaSection::Footers( ) throw (uno::RuntimeException)
-+uno::Any SAL_CALL SwVbaSection::Footers( const uno::Any& index ) throw (uno::RuntimeException)
- {
-- return uno::Any();
-+ uno::Reference< XCollection > xCol( new SwVbaHeadersFooters( this, mxContext, mxModel, mxPageProps, sal_False ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
- }
-
- uno::Any SAL_CALL
-diff --git sw/source/ui/vba/vbasection.hxx sw/source/ui/vba/vbasection.hxx
-index 9dd4058..dc1984f 100644
---- sw/source/ui/vba/vbasection.hxx
-+++ sw/source/ui/vba/vbasection.hxx
-@@ -48,8 +48,8 @@ public:
- virtual void SAL_CALL setProtectedForForms( ::sal_Bool _protectedforforms ) throw (css::uno::RuntimeException);
-
- // Methods
-- virtual css::uno::Any SAL_CALL Headers( ) throw (css::uno::RuntimeException);
-- virtual css::uno::Any SAL_CALL Footers( ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Headers( const css::uno::Any& index ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Footers( const css::uno::Any& index ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL PageSetup( ) throw (css::uno::RuntimeException);
-
- // XHelperInterface
-diff --git sw/source/ui/vba/vbasections.cxx sw/source/ui/vba/vbasections.cxx
-index 6a4ae0e..6e6ee9b 100644
---- sw/source/ui/vba/vbasections.cxx
-+++ sw/source/ui/vba/vbasections.cxx
-@@ -87,6 +87,15 @@ public:
- }
- }
-
-+ SectionCollectionHelper( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XTextRange >& xTextRange ) throw (uno::RuntimeException) : mxParent( xParent ), mxContext( xContext ), mxModel( xModel )
-+ {
-+ // Hacky implementation of Range.Sections, only support 1 secction
-+ uno::Reference< beans::XPropertySet > xRangeProps( xTextRange, uno::UNO_QUERY_THROW );
-+ uno::Reference< style::XStyle > xStyle = word::getCurrentPageStyle( mxModel, xRangeProps );
-+ uno::Reference< beans::XPropertySet > xPageProps( xStyle, uno::UNO_QUERY_THROW );
-+ mxSections.push_back( xPageProps );
-+ }
-+
- ~SectionCollectionHelper(){}
-
- // XIndexAccess
-@@ -134,6 +143,10 @@ SwVbaSections::SwVbaSections( const uno::Reference< XHelperInterface >& xParent,
- {
- }
-
-+SwVbaSections::SwVbaSections( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XTextRange >& xTextRange ): SwVbaSections_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new SectionCollectionHelper( xParent, xContext, xModel, xTextRange ) ) ), mxModel( xModel )
-+{
-+}
-+
- uno::Any SAL_CALL
- SwVbaSections::PageSetup( ) throw (uno::RuntimeException)
- {
-diff --git sw/source/ui/vba/vbasections.hxx sw/source/ui/vba/vbasections.hxx
-index 9cb35cf..74812a3 100644
---- sw/source/ui/vba/vbasections.hxx
-+++ sw/source/ui/vba/vbasections.hxx
-@@ -31,6 +31,7 @@
- #include <ooo/vba/word/XSections.hpp>
- #include <com/sun/star/container/XEnumerationAccess.hpp>
- #include <com/sun/star/container/XIndexAccess.hpp>
-+#include <com/sun/star/text/XTextRange.hpp>
- #include <vbahelper/vbahelperinterface.hxx>
-
- typedef CollTestImplHelper< ooo::vba::word::XSections > SwVbaSections_BASE;
-@@ -42,6 +43,7 @@ private:
-
- public:
- SwVbaSections( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel );
-+ SwVbaSections( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XTextRange >& xTextRange );
- virtual ~SwVbaSections() {}
-
- // XEnumerationAccess
-diff --git sw/source/ui/vba/vbaselection.cxx sw/source/ui/vba/vbaselection.cxx
-index 17d4e2f..90c9e51 100644
---- sw/source/ui/vba/vbaselection.cxx
-+++ sw/source/ui/vba/vbaselection.cxx
-@@ -29,7 +29,6 @@
- #include <tools/diagnose_ex.h>
- #include "vbarange.hxx"
- #include "vbafind.hxx"
--#include "wordvbahelper.hxx"
- #include <com/sun/star/text/XTextRange.hpp>
- #include <com/sun/star/text/XTextTable.hpp>
- #include <com/sun/star/text/XTextTableCursor.hpp>
-@@ -41,14 +40,19 @@
- #include <ooo/vba/word/WdGoToDirection.hpp>
- #include <ooo/vba/word/XBookmark.hpp>
- #include <ooo/vba/word/XApplication.hpp>
-+#include <ooo/vba/word/WdCollapseDirection.hpp>
- #include <com/sun/star/text/XPageCursor.hpp>
- #include "unotbl.hxx"
- #include "unocoll.hxx"
- #include "vbatable.hxx"
- #include <com/sun/star/view/XSelectionSupplier.hpp>
- #include <com/sun/star/view/XViewCursor.hpp>
-+#include <com/sun/star/view/XLineCursor.hpp>
-+#include <com/sun/star/text/XWordCursor.hpp>
-+#include <com/sun/star/text/XParagraphCursor.hpp>
- #include <ooo/vba/word/WdInformation.hpp>
- #include <ooo/vba/word/WdHeaderFooterIndex.hpp>
-+#include <ooo/vba/word/WdSeekView.hpp>
- #include "vbainformationhelper.hxx"
- #include "vbafield.hxx"
- #include "vbaheaderfooter.hxx"
-@@ -56,6 +60,17 @@
- #include <vbahelper/vbashaperange.hxx>
- #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
- #include <com/sun/star/drawing/XDrawPage.hpp>
-+#include <com/sun/star/text/ControlCharacter.hpp>
-+#include "vbarows.hxx"
-+#include "vbacolumns.hxx"
-+#include "vbatablehelper.hxx"
-+#include "vbacells.hxx"
-+#include "vbaview.hxx"
-+#include "vbaparagraph.hxx"
-+#include "vbastyle.hxx"
-+#include <docsh.hxx>
-+#include <tblenum.hxx>
-+#include <fesh.hxx>
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-@@ -123,23 +138,25 @@ SwVbaSelection::HomeKey( const uno::Any& _unit, const uno::Any& _extend ) throw
- sal_Int32 nExtend = word::WdMovementType::wdMove;
- _unit >>= nUnit;
- _extend >>= nExtend;
-+ sal_Bool bExtend = ( nExtend == word::WdMovementType::wdExtend ) ? sal_True : sal_False;
-
- switch( nUnit )
- {
- case word::WdUnits::wdStory:
- {
-+ // go to the valid text first so that the current view cursor is valid to call gotoRange.
-+ word::gotoSelectedObjectAnchor(mxModel);
- // go to the begin of the document
-- rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToStartOfDoc"));
-- dispatchRequests( mxModel,url );
-- // If something is selected, it needs to go twice
-- dispatchRequests( mxModel,url );
-+ uno::Reference< text::XText > xCurrentText = word::getCurrentXText( mxModel );
-+ uno::Reference< text::XTextRange > xFirstRange = word::getFirstObjectPosition( xCurrentText );
-+ mxTextViewCursor->gotoRange( xFirstRange, bExtend );
- break;
- }
- case word::WdUnits::wdLine:
- {
- // go to the begin of the Line
-- rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToStartOfLine"));
-- dispatchRequests( mxModel,url );
-+ uno::Reference< view::XLineCursor > xLineCursor( mxTextViewCursor, uno::UNO_QUERY_THROW );
-+ xLineCursor->gotoStartOfLine( bExtend );
- break;
- }
- default:
-@@ -157,23 +174,25 @@ SwVbaSelection::EndKey( const uno::Any& _unit, const uno::Any& _extend ) throw (
- sal_Int32 nExtend = word::WdMovementType::wdMove;
- _unit >>= nUnit;
- _extend >>= nExtend;
-+ sal_Bool bExtend = ( nExtend == word::WdMovementType::wdExtend ) ? sal_True : sal_False;
-
- switch( nUnit )
- {
- case word::WdUnits::wdStory:
- {
-- // go to the end of the document
-- rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToEndOfDoc"));
-- dispatchRequests( mxModel,url );
-- // If something is selected, it needs to go twice
-- dispatchRequests( mxModel,url );
-+ // go to the valid text first so that the current view cursor is valid to call gotoRange.
-+ word::gotoSelectedObjectAnchor(mxModel);
-+ // go to the end of the document
-+ uno::Reference< text::XText > xCurrentText = word::getCurrentXText( mxModel );
-+ uno::Reference< text::XTextRange > xEnd = xCurrentText->getEnd();
-+ mxTextViewCursor->gotoRange( xEnd, bExtend );
- break;
- }
- case word::WdUnits::wdLine:
- {
- // go to the end of the Line
-- rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToEndOfLine"));
-- dispatchRequests( mxModel,url );
-+ uno::Reference< view::XLineCursor > xLineCursor( mxTextViewCursor, uno::UNO_QUERY_THROW );
-+ xLineCursor->gotoEndOfLine( bExtend );
- break;
- }
- default:
-@@ -185,14 +204,161 @@ SwVbaSelection::EndKey( const uno::Any& _unit, const uno::Any& _extend ) throw (
- }
-
- void SAL_CALL
--SwVbaSelection::Delete( const uno::Any& /*_unit*/, const uno::Any& /*_count*/ ) throw ( uno::RuntimeException )
-+SwVbaSelection::Delete( const uno::Any& _unit, const uno::Any& _count ) throw ( uno::RuntimeException )
- {
-- // FIXME: handle the arguments: _unit and _count
-+ sal_Int32 nUnit = word::WdUnits::wdLine;
-+ sal_Int32 nCount = 0;
-+ if( _count.hasValue() )
-+ _count >>= nCount;
-+ if( _unit.hasValue() && ( nCount > 0 ) )
-+ {
-+ _unit >>= nUnit;
-+ switch( nUnit )
-+ {
-+ case word::WdUnits::wdCharacter:
-+ {
-+ if( HasSelection() )
-+ nCount--;
-+ mxTextViewCursor->goRight( nCount, sal_True );
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+ }
-+ }
- rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Delete"));
- dispatchRequests( mxModel,url );
- }
-
--void SwVbaSelection::NextCell( sal_Int32 nCount, E_DIRECTION eDirection ) throw ( uno::RuntimeException )
-+void
-+SwVbaSelection::Move( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend, word::E_DIRECTION eDirection ) throw ( uno::RuntimeException )
-+{
-+ sal_Int32 nUnit = word::WdUnits::wdCharacter;
-+ sal_Int32 nCount = 1;
-+ sal_Int32 nExtend = word::WdMovementType::wdMove;
-+
-+ if( _unit.hasValue() )
-+ _unit >>= nUnit;
-+ if( _count.hasValue() )
-+ _count >>= nCount;
-+ if( _extend.hasValue() )
-+ _extend >>= nExtend;
-+
-+ if( nCount == 0 )
-+ return;
-+
-+ sal_Bool bExpand = ( nExtend == word::WdMovementType::wdMove ) ? sal_False : sal_True;
-+
-+ switch( nUnit )
-+ {
-+ case word::WdUnits::wdCell:
-+ {
-+ if( nExtend == word::WdMovementType::wdExtend )
-+ {
-+ DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
-+ return;
-+ }
-+ NextCell( nCount, eDirection );
-+ break;
-+ }
-+ case word::WdUnits::wdLine:
-+ {
-+ if( eDirection == word::MOVE_LEFT || eDirection == word::MOVE_RIGHT )
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+ uno::Reference< view::XViewCursor > xViewCursor( mxTextViewCursor, uno::UNO_QUERY_THROW );
-+ if( eDirection == word::MOVE_UP )
-+ xViewCursor->goUp( nCount, bExpand );
-+ else if( eDirection == word::MOVE_DOWN )
-+ xViewCursor->goDown( nCount, bExpand );
-+ break;
-+ }
-+ case word::WdUnits::wdCharacter:
-+ {
-+ if( eDirection == word::MOVE_UP || eDirection == word::MOVE_DOWN )
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+ if( word::gotoSelectedObjectAnchor( mxModel ) )
-+ {
-+ nCount--;
-+ }
-+ uno::Reference< view::XViewCursor > xViewCursor( mxTextViewCursor, uno::UNO_QUERY_THROW );
-+ if( eDirection == word::MOVE_LEFT )
-+ {
-+ // if current select is a cellrange or table,
-+ // the first count of move should move to the first selected cell.
-+ uno::Reference< text::XTextTableCursor > xTextTableCursor( mxModel->getCurrentSelection(), uno::UNO_QUERY );
-+ if ( xTextTableCursor.is() )
-+ {
-+ uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextTable > xTextTable;
-+ xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ) >>= xTextTable;
-+ if( xTextTable.is() )
-+ {
-+ uno::Reference< text::XTextRange > xRange( xTextTable->getCellByName( xTextTableCursor->getRangeName()), uno::UNO_QUERY_THROW );
-+ mxTextViewCursor->gotoRange( xRange->getStart(), bExpand );
-+ nCount--;
-+ }
-+ }
-+ xViewCursor->goLeft( nCount, bExpand );
-+ }
-+ else if( eDirection == word::MOVE_RIGHT )
-+ xViewCursor->goRight( nCount, bExpand );
-+ break;
-+ }
-+ case word::WdUnits::wdWord:
-+ case word::WdUnits::wdParagraph:
-+ {
-+ uno::Reference< text::XTextRange > xRange = GetSelectedRange();
-+ uno::Reference< text::XText > xText = xRange->getText();
-+ uno::Reference< text::XTextCursor > xTextCursor = xText->createTextCursorByRange( xRange );
-+ if( nUnit == word::WdUnits::wdParagraph )
-+ {
-+ if( eDirection == word::MOVE_LEFT || eDirection == word::MOVE_RIGHT )
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+ uno::Reference< text::XParagraphCursor > xParagraphCursor( xTextCursor, uno::UNO_QUERY_THROW );
-+ for( sal_Int32 i=0; i<nCount; i++ )
-+ {
-+ if( ( eDirection == word::MOVE_UP ) && ( xParagraphCursor->gotoPreviousParagraph( bExpand ) == sal_False ) )
-+ break;
-+ else if( ( eDirection == word::MOVE_DOWN ) && ( xParagraphCursor->gotoNextParagraph( bExpand ) == sal_False ) )
-+ break;
-+ }
-+ }
-+ else if( nUnit == word::WdUnits::wdWord )
-+ {
-+ if( eDirection == word::MOVE_UP || eDirection == word::MOVE_DOWN )
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+ uno::Reference< text::XWordCursor > xWordCursor( xTextCursor, uno::UNO_QUERY_THROW );
-+ for( sal_Int32 i=0; i<nCount; i++ )
-+ {
-+ if( (eDirection == word::MOVE_LEFT ) && ( xWordCursor->gotoPreviousWord( bExpand ) == sal_False ) )
-+ break;
-+ else if( ( eDirection == word::MOVE_RIGHT ) && ( xWordCursor->gotoNextWord( bExpand ) == sal_False ) )
-+ break;
-+ }
-+ }
-+ mxTextViewCursor->gotoRange( xTextCursor->getStart(), sal_False );
-+ mxTextViewCursor->gotoRange( xTextCursor->getEnd(), sal_True );
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ break;
-+ }
-+ }
-+}
-+
-+void SwVbaSelection::NextCell( sal_Int32 nCount, word::E_DIRECTION eDirection ) throw ( uno::RuntimeException )
- {
- uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
- uno::Reference< text::XTextTable > xTextTable;
-@@ -211,22 +377,22 @@ void SwVbaSelection::NextCell( sal_Int32 nCount, E_DIRECTION eDirection ) throw
- // move the table cursor
- switch( eDirection )
- {
-- case MOVE_LEFT:
-+ case word::MOVE_LEFT:
- {
- xTextTableCursor->goLeft( nCount, sal_False );
- break;
- }
-- case MOVE_RIGHT:
-+ case word::MOVE_RIGHT:
- {
- xTextTableCursor->goRight( nCount, sal_False );
- break;
- }
-- case MOVE_UP:
-+ case word::MOVE_UP:
- {
- xTextTableCursor->goUp( nCount, sal_False );
- break;
- }
-- case MOVE_DOWN:
-+ case word::MOVE_DOWN:
- {
- xTextTableCursor->goDown( nCount, sal_False );
- break;
-@@ -245,61 +411,29 @@ void SwVbaSelection::NextCell( sal_Int32 nCount, E_DIRECTION eDirection ) throw
- void SAL_CALL
- SwVbaSelection::MoveRight( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend ) throw ( uno::RuntimeException )
- {
-- sal_Int32 nUnit = word::WdUnits::wdCharacter;
- sal_Int32 nCount = 1;
-- sal_Int32 nExtend = word::WdMovementType::wdMove;
-
-- if( _unit.hasValue() )
-- _unit >>= nUnit;
- if( _count.hasValue() )
- _count >>= nCount;
-- if( _extend.hasValue() )
-- _extend >>= nExtend;
-
- if( nCount == 0 )
- return;
-
- if( nCount < 0 )
- {
-- // TODO: call MoveLeft;
- MoveLeft( _unit, uno::makeAny( -nCount ), _extend );
- return;
- }
--
-- switch( nUnit )
-- {
-- case word::WdUnits::wdCell:
-- {
-- if( nExtend == word::WdMovementType::wdExtend )
-- {
-- DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
-- return;
-- }
-- NextCell( nCount, MOVE_RIGHT );
-- break;
-- }
-- default:
-- {
-- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-- break;
-- }
-- }
-
-+ Move( _unit, _count, _extend, word::MOVE_RIGHT );
- }
-
- void SAL_CALL
- SwVbaSelection::MoveLeft( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend ) throw ( uno::RuntimeException )
- {
-- sal_Int32 nUnit = word::WdUnits::wdCharacter;
- sal_Int32 nCount = 1;
-- sal_Int32 nExtend = word::WdMovementType::wdMove;
--
-- if( _unit.hasValue() )
-- _unit >>= nUnit;
- if( _count.hasValue() )
- _count >>= nCount;
-- if( _extend.hasValue() )
-- _extend >>= nExtend;
-
- if( nCount == 0 )
- return;
-@@ -310,67 +444,47 @@ SwVbaSelection::MoveLeft( const uno::Any& _unit, const uno::Any& _count, const u
- return;
- }
-
-- switch( nUnit )
-- {
-- case word::WdUnits::wdCell:
-- {
-- if( nExtend == word::WdMovementType::wdExtend )
-- {
-- DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
-- return;
-- }
-- NextCell( nCount, MOVE_LEFT );
-- break;
-- }
-- default:
-- {
-- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-- break;
-- }
-- }
--
-+ Move( _unit, _count, _extend, word::MOVE_LEFT );
- }
-
- void SAL_CALL
- SwVbaSelection::MoveDown( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend ) throw ( uno::RuntimeException )
- {
-- sal_Int32 nUnit = word::WdUnits::wdCharacter;
- sal_Int32 nCount = 1;
-- sal_Int32 nExtend = word::WdMovementType::wdMove;
-
-- if( _unit.hasValue() )
-- _unit >>= nUnit;
- if( _count.hasValue() )
- _count >>= nCount;
-- if( _extend.hasValue() )
-- _extend >>= nExtend;
-
- if( nCount == 0 )
- return;
-
- if( nCount < 0 )
- {
-- // TODO: call MoveLeft;
-- //MoveUp( _unit, uno::makeAny( -nCount ), _extend );
-+ MoveUp( _unit, uno::makeAny( -nCount ), _extend );
- return;
- }
-
-- switch( nUnit )
-+ Move( _unit, _count, _extend, word::MOVE_DOWN );
-+}
-+
-+void SAL_CALL
-+SwVbaSelection::MoveUp( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend ) throw ( uno::RuntimeException )
-+{
-+ sal_Int32 nCount = 1;
-+
-+ if( _count.hasValue() )
-+ _count >>= nCount;
-+
-+ if( nCount == 0 )
-+ return;
-+
-+ if( nCount < 0 )
- {
-- case word::WdUnits::wdLine:
-- {
-- uno::Reference< view::XViewCursor > xViewCursor( mxTextViewCursor, uno::UNO_QUERY_THROW );
-- sal_Bool bExpand = ( nExtend == word::WdMovementType::wdMove ) ? sal_False : sal_True;
-- xViewCursor->goDown( nCount, bExpand );
-- break;
-- }
-- default:
-- {
-- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-- break;
-- }
-+ MoveDown( _unit, uno::makeAny( -nCount ), _extend );
-+ return;
- }
--
-+
-+ Move( _unit, _count, _extend, word::MOVE_UP );
- }
-
- void SAL_CALL
-@@ -422,16 +536,17 @@ SwVbaSelection::getFind() throw ( uno::RuntimeException )
- return uno::Reference< word::XFind >( new SwVbaFind( this, mxContext, mxModel, xTextRange ) );
- }
-
--uno::Reference< word::XStyle > SAL_CALL
-+uno::Any SAL_CALL
- SwVbaSelection::getStyle() throw ( uno::RuntimeException )
- {
- return getRange()->getStyle();
- }
-
- void SAL_CALL
--SwVbaSelection::setStyle( const uno::Reference< word::XStyle >& rStyle ) throw ( uno::RuntimeException )
-+SwVbaSelection::setStyle( const uno::Any& rStyle ) throw ( uno::RuntimeException )
- {
-- return getRange()->setStyle( rStyle );
-+ uno::Reference< beans::XPropertySet > xParaProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
-+ return SwVbaStyle::setStyle( xParaProps, rStyle );
- }
-
- uno::Reference< word::XFont > SAL_CALL
-@@ -474,39 +589,79 @@ uno::Reference< word::XRange > SAL_CALL SwVbaSelection::GoTo( const uno::Any& _w
- sal_Int32 nWhich = 0;
- if( _which.hasValue() )
- _which >>= nWhich;
-- sal_Int32 nPage = 0;
-- switch( nWhich )
-- {
-- case word::WdGoToDirection::wdGoToLast:
-- {
-- nPage = nLastPage;
-- break;
-- }
-- case word::WdGoToDirection::wdGoToNext:
-- {
-- nPage = nCurrPage + 1;
-- break;
-- }
-- case word::WdGoToDirection::wdGoToPrevious:
-- {
-- nPage = nCurrPage - 1;
-- break;
-- }
-- default:
-- {
-- nPage = nCount;
-- }
-- }
-- if( nPage <= 0 )
-- nPage = 1;
-- if( nPage > nLastPage )
-- nPage = nLastPage;
-- xPageCursor->jumpToPage( ( sal_Int16 )( nPage ) );
-- break;
-+ sal_Int32 nPage = 0;
-+ switch( nWhich )
-+ {
-+ case word::WdGoToDirection::wdGoToLast:
-+ {
-+ nPage = nLastPage;
-+ break;
-+ }
-+ case word::WdGoToDirection::wdGoToNext:
-+ {
-+ if( nCount !=0 )
-+ nPage = nCurrPage + nCount;
-+ else
-+ nPage = nCurrPage + 1;
-+ break;
-+ }
-+ case word::WdGoToDirection::wdGoToPrevious:
-+ {
-+ if( nCount !=0 )
-+ nPage = nCurrPage - nCount;
-+ else
-+ nPage = nCurrPage - 1;
-+ break;
-+ }
-+ default:
-+ {
-+ nPage = nCount;
-+ }
-+ }
-+ if( _name.hasValue() )
-+ {
-+ rtl::OUString sName;
-+ _name >>= sName;
-+ sal_Int32 nName = sName.toInt32();
-+ if( nName !=0 )
-+ nPage = nName;
-+ }
-+ if( nPage <= 0 )
-+ nPage = 1;
-+ if( nPage > nLastPage )
-+ nPage = nLastPage;
-+ xPageCursor->jumpToPage( ( sal_Int16 )( nPage ) );
-+ break;
- }
- case word::WdGoToItem::wdGoToSection:
- {
-- // TODO: implement Section object
-+ uno::Reference< text::XPageCursor > xPageCursor( mxTextViewCursor, uno::UNO_QUERY_THROW );
-+ sal_Int32 nCount = 0;
-+ if( _count.hasValue() )
-+ _count >>= nCount;
-+ sal_Int32 nWhich = 0;
-+ if( _which.hasValue() )
-+ _which >>= nWhich;
-+ sal_Int32 nPage = 0;
-+ switch( nWhich )
-+ {
-+ case word::WdGoToDirection::wdGoToAbsolute:
-+ {
-+ // currently only support this type
-+ if( nCount == 1 )
-+ nPage = 1;
-+ break;
-+ }
-+ default:
-+ {
-+ nPage = 0;
-+ }
-+ }
-+ if( nPage != 0 )
-+ xPageCursor->jumpToPage( ( sal_Int16 )( nPage ) );
-+ else
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ break;
- }
- default:
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-@@ -546,6 +701,82 @@ uno::Any SAL_CALL SwVbaSelection::Information( sal_Int32 _type ) throw (uno::Run
- result = uno::makeAny( SwVbaInformationHelper::handleWdVerticalPositionRelativeToPage( mxModel, mxTextViewCursor ) );
- break;
- }
-+ case word::WdInformation::wdWithInTable:
-+ {
-+ uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextTable > xTextTable;
-+ xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ) >>= xTextTable;
-+ if( xTextTable.is() )
-+ result = uno::makeAny( sal_True );
-+ else
-+ result = uno::makeAny( sal_False );
-+ break;
-+ }
-+ case word::WdInformation::wdHeaderFooterType:
-+ {
-+ uno::Reference< word::XView > xView( new SwVbaView( this, mxContext, mxModel ) );
-+ sal_Int32 nView = xView->getSeekView();
-+ sal_Int32 nHeaderFooterType = 0;
-+ switch( nView )
-+ {
-+ case word::WdSeekView::wdSeekMainDocument:
-+ {
-+ nHeaderFooterType = -1; // not in a header or footer
-+ break;
-+ }
-+ case word::WdSeekView::wdSeekEvenPagesHeader:
-+ {
-+ nHeaderFooterType = 0; // even page header
-+ break;
-+ }
-+ case word::WdSeekView::wdSeekPrimaryHeader:
-+ {
-+ nHeaderFooterType = 1; // odd page header
-+ break;
-+ }
-+ case word::WdSeekView::wdSeekEvenPagesFooter:
-+ {
-+ nHeaderFooterType = 2; // even page footer
-+ break;
-+ }
-+ case word::WdSeekView::wdSeekPrimaryFooter:
-+ {
-+ nHeaderFooterType = 3; // odd page footer
-+ break;
-+ }
-+ case word::WdSeekView::wdSeekFirstPageHeader:
-+ case word::WdSeekView::wdSeekFirstPageFooter:
-+ {
-+ uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
-+ rtl::OUString aPageStyleName;
-+ xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyleName"))) >>= aPageStyleName;
-+ sal_Bool bFirstPage = sal_False;
-+ if( aPageStyleName.equalsAscii( "First Page" ) )
-+ bFirstPage = sal_True;
-+ if( nView == word::WdSeekView::wdSeekFirstPageHeader )
-+ {
-+ if( bFirstPage )
-+ nHeaderFooterType = 4;
-+ else
-+ nHeaderFooterType = 1;
-+ }
-+ else
-+ {
-+ if( bFirstPage )
-+ nHeaderFooterType = 5;
-+ else
-+ nHeaderFooterType = 3;
-+ }
-+ break;
-+ }
-+ default:
-+ {
-+ nHeaderFooterType = -1;
-+ }
-+ }
-+ result = uno::makeAny( nHeaderFooterType );
-+ break;
-+ }
- default:
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
- }
-@@ -566,11 +797,6 @@ SwVbaSelection::Tables( const uno::Any& aIndex ) throw (uno::RuntimeException)
- // we can only support a selection that is a single table
- if ( !aIndex.hasValue() ) // currently we can't support multiple tables in a selection
- throw uno::RuntimeException();
-- // if the current selection is a XTextTableCursor and the index is 1 then we can service this request, otherwise we just have to throw
-- uno::Reference< text::XTextTableCursor > xTextTableCursor( mxModel->getCurrentSelection(), uno::UNO_QUERY );
--
-- if ( !xTextTableCursor.is() )
-- throw uno::RuntimeException();
-
- sal_Int32 nIndex = 0;
- aIndex >>= nIndex;
-@@ -579,6 +805,24 @@ SwVbaSelection::Tables( const uno::Any& aIndex ) throw (uno::RuntimeException)
-
- if ( nIndex != 1 )
- throw uno::RuntimeException();
-+
-+ uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextTable > xTextTable;
-+ xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ) >>= xTextTable;
-+ if( xTextTable.is() )
-+ {
-+ uno::Reference< css::text::XTextDocument > xTextDoc( mxModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< word::XTable > xVBATbl = new SwVbaTable( mxParent, mxContext, xTextDoc, xTextTable );
-+ aRet <<= xVBATbl;
-+ return aRet;
-+ }
-+
-+ // if the current selection is a XTextTableCursor and the index is 1 then we can service this request, otherwise we just have to throw
-+ uno::Reference< text::XTextTableCursor > xTextTableCursor( mxModel->getCurrentSelection(), uno::UNO_QUERY );
-+
-+ if ( !xTextTableCursor.is() )
-+ throw uno::RuntimeException();
-+
- SwXTextTableCursor* pTTCursor = dynamic_cast< SwXTextTableCursor* >( xTextTableCursor.get() );
- if ( pTTCursor )
- {
-@@ -608,15 +852,14 @@ SwVbaSelection::Fields( const uno::Any& index ) throw (uno::RuntimeException)
- uno::Reference< word::XHeaderFooter > SAL_CALL
- SwVbaSelection::getHeaderFooter() throw ( uno::RuntimeException )
- {
-- uno::Reference< text::XText > xCurrentText = word::getXTextViewCursor( mxModel )->getText();
-- if( HeaderFooterHelper::isHeader( mxModel, xCurrentText ) || HeaderFooterHelper::isFooter( mxModel, xCurrentText ) )
-+ if( HeaderFooterHelper::isHeaderFooter( mxModel ) )
- {
- uno::Reference< beans::XPropertySet > xPageStyleProps( word::getCurrentPageStyle( mxModel ), uno::UNO_QUERY_THROW );
- sal_Int32 nIndex = word::WdHeaderFooterIndex::wdHeaderFooterPrimary;
-- sal_Bool isHeader = HeaderFooterHelper::isHeader( mxModel, xCurrentText );
-- if( HeaderFooterHelper::isEvenPagesHeader( mxModel, xCurrentText ) || HeaderFooterHelper::isEvenPagesFooter( mxModel, xCurrentText ) )
-+ sal_Bool isHeader = HeaderFooterHelper::isHeader( mxModel );
-+ if( HeaderFooterHelper::isEvenPagesHeader( mxModel ) || HeaderFooterHelper::isEvenPagesFooter( mxModel ) )
- nIndex = word::WdHeaderFooterIndex::wdHeaderFooterEvenPages;
-- else if( HeaderFooterHelper::isFirstPageHeader( mxModel, xCurrentText ) || HeaderFooterHelper::isFirstPageFooter( mxModel, xCurrentText ) )
-+ else if( HeaderFooterHelper::isFirstPageHeader( mxModel ) || HeaderFooterHelper::isFirstPageFooter( mxModel ) )
- nIndex = word::WdHeaderFooterIndex::wdHeaderFooterFirstPage;
-
- return uno::Reference< word::XHeaderFooter >( new SwVbaHeaderFooter( this, mxContext, mxModel, xPageStyleProps, isHeader, nIndex ) );
-@@ -629,9 +872,13 @@ uno::Any SAL_CALL
- SwVbaSelection::ShapeRange( ) throw (uno::RuntimeException)
- {
- uno::Reference< drawing::XShapes > xShapes( mxModel->getCurrentSelection(), uno::UNO_QUERY );
--
- if ( !xShapes.is() )
-- throw uno::RuntimeException();
-+ {
-+ uno::Reference< drawing::XShape > xShape( mxModel->getCurrentSelection(), uno::UNO_QUERY_THROW );
-+ uno::Reference< lang::XMultiServiceFactory > xMSF( mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
-+ xShapes.set( xMSF->createInstance( rtl::OUString::createFromAscii( "com.sun.star.drawing.ShapeCollection" ) ), uno::UNO_QUERY_THROW );
-+ xShapes->add( xShape );
-+ }
-
- uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxModel, uno::UNO_QUERY_THROW );
- uno::Reference< drawing::XDrawPage > xDrawPage = xDrawPageSupplier->getDrawPage();
-@@ -658,6 +905,281 @@ void SAL_CALL SwVbaSelection::setEnd( ::sal_Int32 _end ) throw (uno::RuntimeExce
- getRange()->setEnd( _end );
- }
-
-+void SAL_CALL SwVbaSelection::SelectRow() throw (uno::RuntimeException)
-+{
-+ uno::Reference< word::XRows > xRows( Rows( uno::Any() ), uno::UNO_QUERY_THROW );
-+ xRows->Select();
-+}
-+
-+void SAL_CALL SwVbaSelection::SelectColumn() throw (uno::RuntimeException)
-+{
-+ uno::Reference< word::XColumns > xColumns( Columns( uno::Any() ), uno::UNO_QUERY_THROW );
-+ xColumns->Select();
-+}
-+
-+uno::Any SAL_CALL SwVbaSelection::Rows( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ rtl::OUString sTLName;
-+ rtl::OUString sBRName;
-+ GetSelectedCellRange( sTLName, sBRName );
-+
-+ sal_Int32 nStartRow = 0;
-+ sal_Int32 nEndRow = 0;
-+ uno::Reference< text::XTextTable > xTextTable = GetXTextTable();
-+ SwVbaTableHelper aTableHelper( xTextTable );
-+ nStartRow = aTableHelper.getTabRowIndex( sTLName );
-+ if( sBRName.getLength() > 0 )
-+ {
-+ nEndRow = aTableHelper.getTabRowIndex( sBRName );
-+ }
-+ else
-+ {
-+ nEndRow = nStartRow;
-+ }
-+
-+ uno::Reference< XCollection > xCol( new SwVbaRows( this, mxContext, xTextTable, xTextTable->getRows(), nStartRow, nEndRow ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+uno::Any SAL_CALL SwVbaSelection::Columns( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ rtl::OUString sTLName;
-+ rtl::OUString sBRName;
-+ GetSelectedCellRange( sTLName, sBRName );
-+ sal_Int32 nStartColumn = 0;
-+ sal_Int32 nEndColumn = 0;
-+
-+ uno::Reference< text::XTextTable > xTextTable = GetXTextTable();
-+ SwVbaTableHelper aTableHelper( xTextTable );
-+ nStartColumn = aTableHelper.getTabColIndex( sTLName );
-+ if( sBRName.getLength() > 0 )
-+ {
-+ nEndColumn = aTableHelper.getTabColIndex( sBRName );
-+ }
-+ else
-+ {
-+ nEndColumn = nStartColumn;
-+ }
-+
-+ uno::Reference< XCollection > xCol( new SwVbaColumns( this, mxContext, xTextTable, xTextTable->getColumns(), nStartColumn, nEndColumn ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+uno::Reference< text::XTextTable > SwVbaSelection::GetXTextTable() throw( uno::RuntimeException )
-+{
-+ uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextTable > xTextTable;
-+ xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ) >>= xTextTable;
-+ return xTextTable;
-+}
-+
-+sal_Bool SwVbaSelection::IsInTable() throw( uno::RuntimeException )
-+{
-+ uno::Reference< text::XTextTable > xTextTable = GetXTextTable();
-+ if( xTextTable.is() )
-+ return sal_True;
-+ return sal_False;
-+}
-+
-+sal_Bool SwVbaSelection::HasSelection() throw( uno::RuntimeException )
-+{
-+ uno::Reference< text::XTextRange > xStart = mxTextViewCursor->getStart();
-+ uno::Reference< text::XTextRange > xEnd = mxTextViewCursor->getEnd();
-+ uno::Reference< text::XTextRangeCompare > xTRC( mxTextViewCursor->getText(), uno::UNO_QUERY_THROW );
-+ if( xTRC->compareRegionStarts( xStart, xEnd ) == 0 && xTRC->compareRegionEnds( xStart, xEnd ) == 0 )
-+ return sal_False;
-+ return sal_True;
-+}
-+
-+void SwVbaSelection::GetSelectedCellRange( rtl::OUString& sTLName, rtl::OUString& sBRName ) throw( uno::RuntimeException )
-+{
-+ uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextTable > xTextTable;
-+ xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ) >>= xTextTable;
-+ if( !xTextTable.is() )
-+ throw uno::RuntimeException( );
-+
-+ uno::Reference< text::XTextTableCursor > xTextTableCursor( mxModel->getCurrentSelection(), uno::UNO_QUERY );
-+ if( xTextTableCursor.is() )
-+ {
-+ String sRange( xTextTableCursor->getRangeName() );
-+ if( sRange.GetTokenCount(':') > 0 )
-+ {
-+ sTLName = sRange.GetToken(0, ':');
-+ sBRName = sRange.GetToken(1, ':');
-+ }
-+ }
-+ if( !sTLName.getLength() )
-+ {
-+ uno::Reference< table::XCell > xCell;
-+ xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Cell") ) ) >>= xCell;
-+ if( !xCell.is() )
-+ {
-+ throw uno::RuntimeException( );
-+ }
-+ uno::Reference< beans::XPropertySet > xCellProps( xCell, uno::UNO_QUERY_THROW );
-+ xCellProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CellName") ) ) >>= sTLName;
-+ }
-+}
-+
-+uno::Any SAL_CALL SwVbaSelection::Cells( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ rtl::OUString sTLName;
-+ rtl::OUString sBRName;
-+ GetSelectedCellRange( sTLName, sBRName );
-+ sal_Int32 nLeft = 0;
-+ sal_Int32 nTop = 0;
-+ sal_Int32 nRight = 0;
-+ sal_Int32 nBottom = 0;
-+
-+ uno::Reference< text::XTextTable > xTextTable = GetXTextTable();
-+ SwVbaTableHelper aTableHelper( xTextTable );
-+ nLeft = aTableHelper.getTabColIndex( sTLName );
-+ nTop = aTableHelper.getTabRowIndex( sTLName );
-+ if( sBRName.getLength() > 0 )
-+ {
-+ nRight = aTableHelper.getTabColIndex( sBRName );
-+ nBottom = aTableHelper.getTabRowIndex( sBRName );
-+ }
-+ else
-+ {
-+ nRight = nLeft;
-+ nBottom = nTop;
-+ }
-+
-+ uno::Reference< XCollection > xCol( new SwVbaCells( this, mxContext, xTextTable, nLeft, nTop, nRight, nBottom ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+void SAL_CALL SwVbaSelection::Copy( ) throw (uno::RuntimeException)
-+{
-+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Copy"));
-+ dispatchRequests( mxModel,url );
-+}
-+
-+void SAL_CALL SwVbaSelection::CopyAsPicture( ) throw (uno::RuntimeException)
-+{
-+ // seems not support in Writer
-+ Copy();
-+}
-+
-+void SAL_CALL SwVbaSelection::Paste( ) throw (uno::RuntimeException)
-+{
-+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Paste"));
-+ dispatchRequests( mxModel,url );
-+}
-+
-+void SAL_CALL SwVbaSelection::Collapse( const uno::Any& Direction ) throw (uno::RuntimeException)
-+{
-+ if( word::gotoSelectedObjectAnchor( mxModel ) )
-+ return;
-+
-+ sal_Int32 nDirection = word::WdCollapseDirection::wdCollapseStart;
-+ if( Direction.hasValue() )
-+ Direction >>= nDirection;
-+
-+ uno::Reference< text::XTextViewCursor > xTextViewCursor = word::getXTextViewCursor( mxModel );
-+ if( nDirection == word::WdCollapseDirection::wdCollapseStart )
-+ {
-+ // it is inaccurate if current seleciton is multipul cells, so it needs to go to start
-+ uno::Reference< text::XTextRange > xTextRange = mxTextViewCursor->getStart();
-+ xTextViewCursor->gotoRange( xTextRange, sal_False );
-+ xTextViewCursor->collapseToStart();
-+ }
-+ else if( nDirection == word::WdCollapseDirection::wdCollapseEnd )
-+ {
-+ uno::Reference< text::XTextRange > xTextRange = mxTextViewCursor->getEnd();
-+ xTextViewCursor->gotoRange( xTextRange, sal_False );
-+ xTextViewCursor->collapseToEnd();
-+ }
-+ else
-+ {
-+ throw uno::RuntimeException();
-+ }
-+}
-+
-+void SAL_CALL SwVbaSelection::WholeStory( ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< text::XText > xText = word::getCurrentXText( mxModel );
-+ // FIXME: for i#7747,if the first line is a table, it fails to select all the contents in the story.
-+ // Temporary solution, insert an empty line before the table so that it could select all the contents.
-+ uno::Reference< container::XEnumerationAccess > xParaAccess( xText, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XEnumeration> xParaEnum = xParaAccess->createEnumeration();
-+ if( xParaEnum->hasMoreElements() )
-+ {
-+ uno::Reference< text::XTextTable > xTextTable( xParaEnum->nextElement(), uno::UNO_QUERY );
-+ if( xTextTable.is() )
-+ {
-+ // insert an empty line
-+ uno::Reference< text::XTextRange > xFirstCellRange = word::getFirstObjectPosition( xText );
-+ mxTextViewCursor->gotoRange( xFirstCellRange, sal_False );
-+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertPara"));
-+ dispatchRequests( mxModel,url );
-+ }
-+ }
-+ uno::Reference< text::XTextRange > xStart = xText->getStart();
-+ uno::Reference< text::XTextRange > xEnd = xText->getEnd();
-+ mxTextViewCursor->gotoRange( xStart, sal_False );
-+ mxTextViewCursor->gotoRange( xEnd, sal_True );
-+}
-+
-+::sal_Bool SAL_CALL SwVbaSelection::InRange( const uno::Reference< ::ooo::vba::word::XRange >& Range ) throw (uno::RuntimeException)
-+{
-+ return getRange()->InRange( Range );
-+}
-+
-+void SAL_CALL SwVbaSelection::SplitTable( ) throw (uno::RuntimeException)
-+{
-+ if( !IsInTable() )
-+ throw uno::RuntimeException();
-+
-+ SwDocShell* pDocShell = word::getDocShell( mxModel );
-+ if( pDocShell )
-+ {
-+ SwFEShell* pFEShell = pDocShell->GetFEShell();
-+ if( pFEShell )
-+ {
-+ pFEShell->SplitTable( HEADLINE_CNTNTCOPY );
-+ }
-+ }
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaSelection::Paragraphs( const uno::Any& aIndex ) throw (uno::RuntimeException)
-+{
-+ // Hacky implementation due to missing api ( and lack of knowledge )
-+ // we can only support a selection that is a single paragraph
-+ if ( !aIndex.hasValue() ) // currently we can't support multiple paragraphs in a selection
-+ throw uno::RuntimeException();
-+
-+ sal_Int32 nIndex = 0;
-+ aIndex >>= nIndex;
-+
-+ uno::Any aRet;
-+
-+ if ( nIndex != 1 )
-+ throw uno::RuntimeException();
-+
-+ uno::Reference< text::XTextRange > xTextRange = mxTextViewCursor->getStart();
-+ uno::Reference< text::XText > xText = xTextRange->getText();
-+ uno::Reference< text::XParagraphCursor > xParaCursor( xText->createTextCursor(), uno::UNO_QUERY_THROW );
-+ xParaCursor->gotoStartOfParagraph( sal_False );
-+ xParaCursor->gotoStartOfParagraph( sal_True );
-+
-+ uno::Reference< text::XTextDocument > xTextDoc( mxModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextRange > xParaRange( xParaCursor, uno::UNO_QUERY_THROW );
-+ uno::Reference< word::XParagraph > xParagraph = new SwVbaParagraph( mxParent, mxContext, xTextDoc, xParaRange );
-+
-+ aRet <<= xParagraph;
-+ return aRet;
-+}
-+
- rtl::OUString&
- SwVbaSelection::getServiceImplName()
- {
-diff --git sw/source/ui/vba/vbaselection.hxx sw/source/ui/vba/vbaselection.hxx
-index afbf79a..0b398cd 100644
---- sw/source/ui/vba/vbaselection.hxx
-+++ sw/source/ui/vba/vbaselection.hxx
-@@ -31,11 +31,13 @@
- #include <ooo/vba/word/XRange.hpp>
- #include <vbahelper/vbahelperinterface.hxx>
- #include <com/sun/star/text/XTextViewCursor.hpp>
-+#include <com/sun/star/text/XTextTable.hpp>
- #include <ooo/vba/word/XParagraphFormat.hpp>
- #include <ooo/vba/word/XFind.hpp>
- #include <ooo/vba/word/XStyle.hpp>
- #include <ooo/vba/word/XFont.hpp>
- #include <ooo/vba/word/XHeaderFooter.hpp>
-+#include "wordvbahelper.hxx"
-
- typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XSelection > SwVbaSelection_BASE;
-
-@@ -46,17 +48,14 @@ private:
- css::uno::Reference< css::text::XTextViewCursor > mxTextViewCursor;
- css::uno::Reference< ooo::vba::word::XRange > mxRange;
-
-- enum E_DIRECTION
-- {
-- MOVE_LEFT = 1,
-- MOVE_RIGHT,
-- MOVE_UP,
-- MOVE_DOWN
-- };
--
- private:
-- void NextCell( sal_Int32 nCount, E_DIRECTION eDirection ) throw ( css::uno::RuntimeException );
-+ void Move( const css::uno::Any& _unit, const css::uno::Any& _count, const css::uno::Any& _extend, ooo::vba::word::E_DIRECTION eDirection ) throw (css::uno::RuntimeException);
-+ void NextCell( sal_Int32 nCount, ooo::vba::word::E_DIRECTION eDirection ) throw ( css::uno::RuntimeException );
- css::uno::Reference< css::text::XTextRange > GetSelectedRange() throw ( css::uno::RuntimeException );
-+ void GetSelectedCellRange( rtl::OUString& sTLName, rtl::OUString& sBRName ) throw ( css::uno::RuntimeException );
-+ css::uno::Reference< css::text::XTextTable > GetXTextTable() throw ( css::uno::RuntimeException );
-+ sal_Bool IsInTable() throw ( css::uno::RuntimeException );
-+ sal_Bool HasSelection() throw ( css::uno::RuntimeException );
-
- public:
- SwVbaSelection( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& rModel ) throw ( css::uno::RuntimeException );
-@@ -73,6 +72,7 @@ public:
- virtual void SAL_CALL MoveRight( const css::uno::Any& _unit, const css::uno::Any& _count, const css::uno::Any& _extend ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL MoveLeft( const css::uno::Any& _unit, const css::uno::Any& _count, const css::uno::Any& _extend ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL MoveDown( const css::uno::Any& _unit, const css::uno::Any& _count, const css::uno::Any& _extend ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL MoveUp( const css::uno::Any& _unit, const css::uno::Any& _count, const css::uno::Any& _extend ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL TypeParagraph() throw (css::uno::RuntimeException);
- virtual void SAL_CALL InsertParagraph() throw (css::uno::RuntimeException);
- virtual void SAL_CALL InsertParagraphBefore() throw (css::uno::RuntimeException);
-@@ -80,8 +80,8 @@ public:
- virtual css::uno::Reference< ooo::vba::word::XParagraphFormat > SAL_CALL getParagraphFormat() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setParagraphFormat( const css::uno::Reference< ooo::vba::word::XParagraphFormat >& rParagraphFormat ) throw (css::uno::RuntimeException);
- virtual css::uno::Reference< ooo::vba::word::XFind > SAL_CALL getFind() throw (css::uno::RuntimeException);
-- virtual css::uno::Reference< ooo::vba::word::XStyle > SAL_CALL getStyle() throw (css::uno::RuntimeException);
-- virtual void SAL_CALL setStyle( const css::uno::Reference< ooo::vba::word::XStyle >& _xStyle ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL getStyle() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setStyle( const css::uno::Any& _xStyle ) throw (css::uno::RuntimeException);
- virtual css::uno::Reference< ooo::vba::word::XFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
- virtual void SAL_CALL TypeBackspace() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< ooo::vba::word::XRange > SAL_CALL GoTo( const css::uno::Any& _what, const css::uno::Any& _which, const css::uno::Any& _count, const css::uno::Any& _name ) throw (css::uno::RuntimeException);
-@@ -97,6 +97,19 @@ public:
- virtual void SAL_CALL setStart( ::sal_Int32 _start ) throw (css::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getEnd() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setEnd( ::sal_Int32 _end ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL SelectRow() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL SelectColumn() throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Rows( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Columns( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Cells( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL Copy( ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL CopyAsPicture( ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL Paste( ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL Collapse( const css::uno::Any& Direction ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL WholeStory( ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL InRange( const css::uno::Reference< ::ooo::vba::word::XRange >& Range ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL SplitTable( ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Paragraphs( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
-diff --git sw/source/ui/vba/vbastyle.cxx sw/source/ui/vba/vbastyle.cxx
-index a8bb6be..984dbae 100644
---- sw/source/ui/vba/vbastyle.cxx
-+++ sw/source/ui/vba/vbastyle.cxx
-@@ -28,15 +28,18 @@
- #include "vbastyle.hxx"
- #include <ooo/vba/word/WdStyleType.hpp>
- #include <com/sun/star/lang/Locale.hpp>
-+#include <com/sun/star/text/XTextDocument.hpp>
- #include <i18npool/mslangid.hxx>
- #include "vbafont.hxx"
- #include "vbapalette.hxx"
-+#include "vbaparagraphformat.hxx"
-+#include "vbastyles.hxx"
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-
-
--SwVbaStyle::SwVbaStyle( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< beans::XPropertySet >& _xPropertySet ) throw ( script::BasicErrorException, uno::RuntimeException ) : SwVbaStyle_BASE( xParent, xContext ) , mxStyleProps( _xPropertySet )
-+SwVbaStyle::SwVbaStyle( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel>& xModel, const uno::Reference< beans::XPropertySet >& _xPropertySet ) throw ( script::BasicErrorException, uno::RuntimeException ) : SwVbaStyle_BASE( xParent, xContext ) , mxModel( xModel ), mxStyleProps( _xPropertySet )
- {
- mxStyle.set( _xPropertySet, uno::UNO_QUERY_THROW );
- }
-@@ -84,7 +87,7 @@ void SAL_CALL SwVbaStyle::setLanguageID( ::sal_Int32 _languageid ) throw (uno::R
- nType = word::WdStyleType::wdStyleTypeParagraph;
- else if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.CharacterStyle") ) ) )
- nType = word::WdStyleType::wdStyleTypeCharacter;
-- else // if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.NumberingStyle") ) ) )
-+ else
- nType = word::WdStyleType::wdStyleTypeList;
- return nType;
- }
-@@ -96,10 +99,31 @@ SwVbaStyle::getFont() throw ( uno::RuntimeException )
- return new SwVbaFont( mxParent, mxContext, aColors.getPalette(), mxStyleProps );
- }
-
--void SwVbaStyle::setStyle( const uno::Reference< beans::XPropertySet >& xTCProps, const uno::Reference< ooo::vba::word::XStyle >& xStyle )throw (uno::RuntimeException)
-+
-+void SAL_CALL SwVbaStyle::LinkToListTemplate( const uno::Reference< word::XListTemplate >& /*ListTemplate*/, const uno::Any& /*ListLevelNumber*/ ) throw (uno::RuntimeException)
-+{
-+}
-+
-+void SwVbaStyle::setStyle( const uno::Reference< beans::XPropertySet >& xParaProps, const uno::Any& rStyle )throw (uno::RuntimeException)
- {
-- rtl::OUString aStyleType = getOOoStyleTypeFromMSWord( xStyle->getType() );
-- xTCProps->setPropertyValue( aStyleType, uno::makeAny( xStyle->getName() ) );
-+ rtl::OUString sStyle;
-+ uno::Reference< word::XStyle > xStyle;
-+ if( rStyle >>= xStyle )
-+ {
-+ sStyle = xStyle->getName();
-+ }
-+ else
-+ {
-+ rStyle >>= sStyle;
-+ }
-+
-+ if( sStyle.getLength() )
-+ {
-+ xParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaStyleName") ), uno::makeAny( sStyle ) );
-+ return;
-+ }
-+
-+ throw uno::RuntimeException();
- }
-
- rtl::OUString SwVbaStyle::getOOoStyleTypeFromMSWord( sal_Int32 _wdStyleType )
-@@ -129,6 +153,115 @@ rtl::OUString SwVbaStyle::getOOoStyleTypeFromMSWord( sal_Int32 _wdStyleType )
- return aStyleType;
- }
-
-+::rtl::OUString SAL_CALL SwVbaStyle::getNameLocal() throw (uno::RuntimeException)
-+{
-+ rtl::OUString sNameLocal;
-+ mxStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DisplayName") ) ) >>= sNameLocal;
-+ return sNameLocal;
-+}
-+
-+void SAL_CALL SwVbaStyle::setNameLocal( const ::rtl::OUString& _namelocal ) throw (uno::RuntimeException)
-+{
-+ mxStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DisplayName") ), uno::makeAny( _namelocal ) );
-+}
-+
-+uno::Reference< word::XParagraphFormat > SAL_CALL SwVbaStyle::getParagraphFormat() throw (uno::RuntimeException)
-+{
-+ if( word::WdStyleType::wdStyleTypeParagraph == getType() )
-+ {
-+ uno::Reference< text::XTextDocument > xTextDocument( mxModel, uno::UNO_QUERY_THROW );
-+ return uno::Reference< word::XParagraphFormat >( new SwVbaParagraphFormat( this, mxContext, xTextDocument, mxStyleProps ) );
-+ }
-+ else
-+ {
-+ throw uno::RuntimeException();
-+ }
-+ return uno::Reference< word::XParagraphFormat >();
-+}
-+
-+::sal_Bool SAL_CALL SwVbaStyle::getAutomaticallyUpdate() throw (uno::RuntimeException)
-+{
-+ sal_Bool isAutoUpdate = sal_False;
-+ mxStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsAutoUpdate") ) ) >>= isAutoUpdate;
-+ return isAutoUpdate;
-+}
-+
-+void SAL_CALL SwVbaStyle::setAutomaticallyUpdate( ::sal_Bool _automaticallyupdate ) throw (uno::RuntimeException)
-+{
-+ mxStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsAutoUpdate") ), uno::makeAny( _automaticallyupdate ) );
-+}
-+
-+uno::Any SAL_CALL SwVbaStyle::getBaseStyle() throw (uno::RuntimeException)
-+{
-+ // ParentStyle
-+ rtl::OUString sBaseStyle;
-+ mxStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParentStyle") ) ) >>= sBaseStyle;
-+ if( sBaseStyle.getLength() > 0 )
-+ {
-+ uno::Reference< XCollection > xCol( new SwVbaStyles( this, mxContext, mxModel ) );
-+ return xCol->Item( uno::makeAny( sBaseStyle ), uno::Any() );
-+ }
-+ else
-+ {
-+ throw uno::RuntimeException();
-+ }
-+ return uno::Any();
-+}
-+
-+void SAL_CALL SwVbaStyle::setBaseStyle( const uno::Any& _basestyle ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< word::XStyle > xStyle;
-+ _basestyle >>= xStyle;
-+ if( xStyle.is() )
-+ {
-+ rtl::OUString sBaseStyle = xStyle->getName();
-+ mxStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParentStyle") ), uno::makeAny( sBaseStyle ) );
-+ }
-+ else
-+ {
-+ throw uno::RuntimeException();
-+ }
-+}
-+
-+uno::Any SAL_CALL SwVbaStyle::getNextParagraphStyle() throw (uno::RuntimeException)
-+{
-+ //FollowStyle
-+ rtl::OUString sFollowStyle;
-+ mxStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FollowStyle") ) ) >>= sFollowStyle;
-+ if( sFollowStyle.getLength() > 0 )
-+ {
-+ uno::Reference< XCollection > xCol( new SwVbaStyles( this, mxContext, mxModel ) );
-+ return xCol->Item( uno::makeAny( sFollowStyle ), uno::Any() );
-+ }
-+ else
-+ {
-+ throw uno::RuntimeException();
-+ }
-+ return uno::Any();
-+}
-+
-+void SAL_CALL SwVbaStyle::setNextParagraphStyle( const uno::Any& _nextparagraphstyle ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< word::XStyle > xStyle;
-+ _nextparagraphstyle >>= xStyle;
-+ if( xStyle.is() )
-+ {
-+ rtl::OUString sFollowStyle = xStyle->getName();
-+ mxStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FollowStyle") ), uno::makeAny( sFollowStyle ) );
-+ }
-+ else
-+ {
-+ throw uno::RuntimeException();
-+ }
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaStyle::getListLevelNumber() throw (uno::RuntimeException)
-+{
-+ sal_Int16 nNumberingLevel = 0;
-+ mxStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingLevel") ) ) >>= nNumberingLevel;
-+ return nNumberingLevel;
-+}
-+
- rtl::OUString&
- SwVbaStyle::getServiceImplName()
- {
-diff --git sw/source/ui/vba/vbastyle.hxx sw/source/ui/vba/vbastyle.hxx
-index bfa12e0..fdff04f 100644
---- sw/source/ui/vba/vbastyle.hxx
-+++ sw/source/ui/vba/vbastyle.hxx
-@@ -33,6 +33,7 @@
- #include <com/sun/star/container/XNameContainer.hpp>
- #include <com/sun/star/style/XStyle.hpp>
- #include <ooo/vba/word/XFont.hpp>
-+#include <ooo/vba/word/XListTemplate.hpp>
-
-
- typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XStyle > SwVbaStyle_BASE;
-@@ -40,13 +41,14 @@ typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XStyle > SwVbaStyle_BASE;
- class SwVbaStyle : public SwVbaStyle_BASE
- {
- private:
-+ css::uno::Reference< css::frame::XModel > mxModel;
- css::uno::Reference< css::beans::XPropertySet > mxStyleProps;
- css::uno::Reference< css::style::XStyle > mxStyle;
- public:
-- SwVbaStyle( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::beans::XPropertySet >& _xPropertySet ) throw ( css::script::BasicErrorException, css::uno::RuntimeException );
-+ SwVbaStyle( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::beans::XPropertySet >& _xPropertySet ) throw ( css::script::BasicErrorException, css::uno::RuntimeException );
- virtual ~SwVbaStyle(){}
-
-- static void setStyle( const css::uno::Reference< css::beans::XPropertySet >& xTCProps, const css::uno::Reference< ooo::vba::word::XStyle >& xStyle ) throw (css::uno::RuntimeException);
-+ static void setStyle( const css::uno::Reference< css::beans::XPropertySet >& xParaProps, const css::uno::Any& xStyle ) throw (css::uno::RuntimeException);
- static rtl::OUString getOOoStyleTypeFromMSWord( sal_Int32 _wdStyleType );
- static sal_Int32 getLanguageID( const css::uno::Reference< css::beans::XPropertySet >& xTCProps ) throw (css::uno::RuntimeException);
- static void setLanguageID( const css::uno::Reference< css::beans::XPropertySet >& xTCProps, sal_Int32 _languageid ) throw (css::uno::RuntimeException);
-@@ -58,6 +60,20 @@ public:
- virtual void SAL_CALL setLanguageID( ::sal_Int32 _languageid ) throw (css::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< ooo::vba::word::XFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL LinkToListTemplate( const css::uno::Reference< ooo::vba::word::XListTemplate >& ListTemplate, const css::uno::Any& ListLevelNumber ) throw (css::uno::RuntimeException);
-+ virtual ::rtl::OUString SAL_CALL getNameLocal() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setNameLocal( const ::rtl::OUString& _namelocal ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Reference< ::ooo::vba::word::XParagraphFormat > SAL_CALL getParagraphFormat() throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getAutomaticallyUpdate() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setAutomaticallyUpdate( ::sal_Bool _automaticallyupdate ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL getBaseStyle() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setBaseStyle( const css::uno::Any& _basestyle ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL getNextParagraphStyle() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setNextParagraphStyle( const css::uno::Any& _nextparagraphstyle ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getListLevelNumber() throw (css::uno::RuntimeException);
-+
-+ //XDefaultProperty
-+ virtual ::rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return rtl::OUString::createFromAscii("Name"); }
-
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
-diff --git sw/source/ui/vba/vbastyles.cxx sw/source/ui/vba/vbastyles.cxx
-index 58a88e2..99b4ef4 100644
---- sw/source/ui/vba/vbastyles.cxx
-+++ sw/source/ui/vba/vbastyles.cxx
-@@ -44,7 +44,7 @@ struct BuiltinStyleTable
- sal_Int32 wdStyleType;
- };
-
--const BuiltinStyleTable aBuiltinStyleTable[] =
-+static const BuiltinStyleTable aBuiltinStyleTable[] =
- {
- { word::WdBuiltinStyle::wdStyleBlockQuotation, "", word::WdStyleType::wdStyleTypeParagraph },
- { word::WdBuiltinStyle::wdStyleBodyText, "Text body", word::WdStyleType::wdStyleTypeParagraph },
-@@ -152,7 +152,20 @@ const BuiltinStyleTable aBuiltinStyleTable[] =
- { 0, 0, 0 }
- };
-
-+struct MSOStyleNameTable
-+{
-+ const sal_Char* pMSOStyleName;
-+ const sal_Char* pOOoStyleName;
-+ const sal_Char* pOOoStyleType;
-+};
-+
-+static const MSOStyleNameTable aMSOStyleNameTable[] =
-+{
-+ { "Normal", "Default", "ParagraphStyles" },
-+ { 0, 0, 0 }
-+};
-
-+#ifdef FUTURE // seems this isn't used
- static uno::Sequence< rtl::OUString > getStyleTypes()
- {
- uno::Sequence< rtl::OUString > aRet(3);
-@@ -162,41 +175,25 @@ static uno::Sequence< rtl::OUString > getStyleTypes()
- pArray[2] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingStyles") );
- return aRet;
- }
-+#endif
-
- typedef ::cppu::WeakImplHelper1< container::XEnumeration > StyleEnumeration_BASE;
- typedef ::cppu::WeakImplHelper3< container::XNameAccess, container::XIndexAccess, container::XEnumerationAccess > StyleCollectionHelper_BASE;
--/*
--class StylesEnumeration : public StyleEnumeration_BASE
--{
--public:
-- StylesEnumeration( const SheetMap& sMap ) : mSheetMap( sMap ), mIt( mSheetMap.begin() ) {}
-- virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-- {
-- return ( mIt != mSheetMap.end() );
-- }
-- virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-- {
-- if ( !hasMoreElements() )
-- throw container::NoSuchElementException();
-- uno::Reference< sheet::XSpreadsheet > xSheet( *mIt++ );
-- return uno::makeAny( xSheet ) ;
-- }
--};
--*/
-+
- class StyleCollectionHelper : public StyleCollectionHelper_BASE
- {
- private:
- uno::Reference< frame::XModel > mxModel;
-- uno::Reference< container::XNameAccess > mxStyleFamilies;
-- uno::Reference< container::XNameContainer > mxCurrentStyleFamily;
-+ uno::Reference< container::XNameAccess > mxParaStyles;
- uno::Any cachePos;
- public:
- StyleCollectionHelper( const uno::Reference< frame::XModel >& _xModel ) : mxModel( _xModel )
- {
-+ // we only concern about the Paragraph styles
- uno::Reference< style::XStyleFamiliesSupplier > xStyleSupplier( _xModel, uno::UNO_QUERY_THROW);
-- mxStyleFamilies = xStyleSupplier->getStyleFamilies();
-+ uno::Reference< container::XNameAccess > xStyleFamilies = xStyleSupplier->getStyleFamilies();
-+ mxParaStyles.set( xStyleFamilies->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParagraphStyles") ) ), uno::UNO_QUERY_THROW );
- }
-- uno::Reference< container::XNameContainer > getCurrentStyleFamily(){ return mxCurrentStyleFamily; }
- // XElementAccess
- virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) { return style::XStyle::static_type(0); }
- virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) { return getCount() > 0; }
-@@ -209,32 +206,42 @@ public:
- }
- virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException)
- {
-- uno::Sequence< rtl::OUString > sNames( getCount() );
-- rtl::OUString* pString = sNames.getArray();
-- uno::Sequence< rtl::OUString > aStyleTypes = getStyleTypes();
-- sal_Int32 nCount = 0;
-- for( sal_Int32 i = 0; i < aStyleTypes.getLength(); i++ )
-+ return mxParaStyles->getElementNames();
-+ }
-+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
-+ {
-+ // search in the MSOStyleName table first
-+ for( const MSOStyleNameTable* pTable = aMSOStyleNameTable; pTable->pMSOStyleName != NULL; pTable++ )
- {
-- uno::Reference< container::XNameAccess > xNameAccess( mxStyleFamilies->getByName( aStyleTypes[i] ), uno::UNO_QUERY_THROW );
-- uno::Sequence< rtl::OUString > sElementNames = xNameAccess->getElementNames();
-- for( sal_Int32 j = 0; j < sElementNames.getLength(); j++ )
-+ if( aName.equalsIgnoreAsciiCaseAscii( pTable->pMSOStyleName ) )
- {
-- pString[nCount++] = sElementNames[j];
-+ //Found it
-+ rtl::OUString sStyleName = rtl::OUString::createFromAscii( pTable->pOOoStyleName );
-+ if( mxParaStyles->hasByName( sStyleName ) )
-+ {
-+ cachePos = mxParaStyles->getByName( sStyleName );
-+ return sal_True;
-+ }
-+ return sal_False;
- }
- }
-- return sNames;
-- }
-- virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
-- {
-- uno::Sequence< rtl::OUString > aStyleTypes = getStyleTypes();
-- for( sal_Int32 i = 0; i < aStyleTypes.getLength(); i++ )
-+
-+ if( mxParaStyles->hasByName( aName ) )
- {
-- uno::Reference< container::XNameAccess > xNameAccess( mxStyleFamilies->getByName( aStyleTypes[i] ), uno::UNO_QUERY_THROW );
-- if( xNameAccess->hasByName( aName ) )
-+ cachePos = mxParaStyles->getByName( aName );
-+ return sal_True;
-+ }
-+ else
-+ {
-+ uno::Sequence< rtl::OUString > sElementNames = mxParaStyles->getElementNames();
-+ for( sal_Int32 j = 0; j < sElementNames.getLength(); j++ )
- {
-- cachePos = xNameAccess->getByName( aName );
-- mxCurrentStyleFamily.set( xNameAccess, uno::UNO_QUERY_THROW );
-- return sal_True;
-+ rtl::OUString aStyleName = sElementNames[j];
-+ if( aStyleName.equalsIgnoreAsciiCase( aName ) )
-+ {
-+ cachePos = mxParaStyles->getByName( aStyleName );
-+ return sal_True;
-+ }
- }
- }
- return sal_False;
-@@ -243,41 +250,40 @@ public:
- // XIndexAccess
- virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
- {
-- uno::Sequence< rtl::OUString > aStyleTypes = getStyleTypes();
-- sal_Int32 nCount = 0;
-- for( sal_Int32 i = 0; i < aStyleTypes.getLength(); i++ )
-- {
-- uno::Reference< container::XIndexAccess > xIndexAccess( mxStyleFamilies->getByName( aStyleTypes[i] ), uno::UNO_QUERY_THROW );
-- nCount += xIndexAccess->getCount();
-- }
-- return nCount;
-+ uno::Reference< container::XIndexAccess > xIndexAccess( mxParaStyles, uno::UNO_QUERY_THROW );
-+ return xIndexAccess->getCount();
- }
- virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
- {
- if ( Index < 0 || Index >= getCount() )
- throw lang::IndexOutOfBoundsException();
-
-- // FIXME: need to make a alphabetically sorted list of style names
-- uno::Sequence< rtl::OUString > aStyleTypes = getStyleTypes();
-- for( sal_Int32 i = 0; i < aStyleTypes.getLength(); i++ )
-- {
-- uno::Reference< container::XIndexAccess > xIndexAccess( mxStyleFamilies->getByName( aStyleTypes[i] ), uno::UNO_QUERY_THROW );
-- sal_Int32 nCount = xIndexAccess->getCount();
-- if( Index >= nCount )
-- Index -= nCount;
-- else
-- {
-- mxCurrentStyleFamily.set( xIndexAccess, uno::UNO_QUERY_THROW );
-- return xIndexAccess->getByIndex( Index );
-- }
-- }
-- throw lang::IndexOutOfBoundsException();
-+ uno::Reference< container::XIndexAccess > xIndexAccess( mxParaStyles, uno::UNO_QUERY_THROW );
-+ return xIndexAccess->getByIndex( Index );
- }
- // XEnumerationAccess
- virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
- {
-- // FIXME:
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+};
-+
-+class StylesEnumWrapper : public EnumerationHelper_BASE
-+{
-+ SwVbaStyles* pStyles;
-+ sal_Int32 nIndex;
-+public:
-+ StylesEnumWrapper( SwVbaStyles* _pStyles ) : pStyles( _pStyles ), nIndex( 1 ) {}
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( nIndex <= pStyles->getCount() );
-+ }
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( nIndex <= pStyles->getCount() )
-+ return pStyles->Item( uno::makeAny( nIndex++ ), uno::Any() );
-+ throw container::NoSuchElementException();
- }
- };
-
-@@ -290,7 +296,7 @@ uno::Any
- SwVbaStyles::createCollectionObject(const uno::Any& aObject)
- {
- uno::Reference< beans::XPropertySet > xStyleProp( aObject, uno::UNO_QUERY_THROW );
-- return uno::makeAny( uno::Reference< word::XStyle >( new SwVbaStyle( this, mxContext, xStyleProp ) ) );
-+ return uno::makeAny( uno::Reference< word::XStyle >( new SwVbaStyle( this, mxContext, mxModel, xStyleProp ) ) );
- }
-
- uno::Type SAL_CALL
-@@ -302,7 +308,7 @@ SwVbaStyles::getElementType() throw (uno::RuntimeException)
- uno::Reference< container::XEnumeration > SAL_CALL
- SwVbaStyles::createEnumeration() throw (uno::RuntimeException)
- {
-- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ return new StylesEnumWrapper( this );
- }
-
- uno::Any SAL_CALL
-@@ -319,7 +325,8 @@ SwVbaStyles::Item( const uno::Any& Index1, const uno::Any& Index2 ) throw (uno::
- rtl::OUString aStyleName = rtl::OUString::createFromAscii( pTable->pOOoStyleName );
- if( aStyleName.getLength() > 0 )
- {
-- rtl::OUString aStyleType = SwVbaStyle::getOOoStyleTypeFromMSWord( pTable->wdStyleType );
-+ //rtl::OUString aStyleType = SwVbaStyle::getOOoStyleTypeFromMSWord( pTable->wdStyleType );
-+ rtl::OUString aStyleType;
- switch( pTable->wdStyleType )
- {
- case word::WdStyleType::wdStyleTypeParagraph:
-@@ -335,7 +342,8 @@ SwVbaStyles::Item( const uno::Any& Index1, const uno::Any& Index2 ) throw (uno::
- }
- case word::WdStyleType::wdStyleTypeList:
- {
-- aStyleType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingStyles") );
-+ // should use Paragraph style and set the property "NumberingStyleName"
-+ aStyleType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParagraphStyles") );
- break;
- }
- default:
-@@ -344,7 +352,12 @@ SwVbaStyles::Item( const uno::Any& Index1, const uno::Any& Index2 ) throw (uno::
- uno::Reference< style::XStyleFamiliesSupplier > xStyleSupplier( mxModel, uno::UNO_QUERY_THROW);
- uno::Reference< container::XNameAccess > xStylesAccess( xStyleSupplier->getStyleFamilies()->getByName( aStyleType ), uno::UNO_QUERY_THROW );
- uno::Reference< beans::XPropertySet > xStyleProps( xStylesAccess->getByName( aStyleName ), uno::UNO_QUERY_THROW );
-- return uno::makeAny( uno::Reference< word::XStyle >( new SwVbaStyle( this, mxContext, xStyleProps ) ) );
-+ // set the property "NumberingStyleName" if it is a listbullet
-+ if( pTable->wdStyleType == word::WdStyleType::wdStyleTypeList )
-+ {
-+ xStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingStyleName") ), uno::makeAny( aStyleName ) );
-+ }
-+ return uno::makeAny( uno::Reference< word::XStyle >( new SwVbaStyle( this, mxContext, mxModel, xStyleProps ) ) );
- }
- else
- {
-diff --git sw/source/ui/vba/vbasystem.cxx sw/source/ui/vba/vbasystem.cxx
-index 66e5d1f..ae42994 100644
---- sw/source/ui/vba/vbasystem.cxx
-+++ sw/source/ui/vba/vbasystem.cxx
-@@ -34,6 +34,13 @@
- #include <tools/urlobj.hxx>
- #include <tools/string.hxx>
-
-+#ifdef WNT
-+#include <tools/prewin.h>
-+#include <windows.h>
-+#include <tools/postwin.h>
-+#include <tchar.h>
-+#endif
-+
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-
-@@ -47,13 +54,79 @@ void PrivateProfileStringListener::Initialize( const rtl::OUString& rFileName, c
- maGroupName = rGroupName;
- maKey = rKey;
- }
-+#ifdef WNT
-+void lcl_getRegKeyInfo( const ByteString& sKeyInfo, HKEY& hBaseKey, ByteString& sSubKey )
-+{
-+ sal_Int32 nBaseKeyIndex = sKeyInfo.Search('\\');
-+ if( nBaseKeyIndex > 0 )
-+ {
-+ ByteString sBaseKey = sKeyInfo.Copy( 0, nBaseKeyIndex );
-+ sSubKey = sKeyInfo.Copy( nBaseKeyIndex + 1 );
-+ if( sBaseKey.Equals("HKEY_CURRENT_USER") )
-+ {
-+ hBaseKey = HKEY_CURRENT_USER;
-+ }
-+ else if( sBaseKey.Equals("HKEY_LOCAL_MACHINE") )
-+ {
-+ hBaseKey = HKEY_LOCAL_MACHINE;
-+ }
-+ else if( sBaseKey.Equals("HKEY_CLASSES_ROOT") )
-+ {
-+ hBaseKey = HKEY_CLASSES_ROOT;
-+ }
-+ else if( sBaseKey.Equals("HKEY_USERS") )
-+ {
-+ hBaseKey = HKEY_USERS;
-+ }
-+ else if( sBaseKey.Equals("HKEY_CURRENT_CONFIG") )
-+ {
-+ hBaseKey = HKEY_CURRENT_CONFIG;
-+ }
-+ }
-+}
-+#endif
-
- uno::Any PrivateProfileStringListener::getValueEvent()
- {
- // get the private profile string
-- Config aCfg( maFileName );
-- aCfg.SetGroup( maGroupName );
-- rtl::OUString sValue = String( aCfg.ReadKey( maKey ), RTL_TEXTENCODING_DONTKNOW );
-+ rtl::OUString sValue;
-+ if(maFileName.getLength())
-+ {
-+ // get key/value from a file
-+ Config aCfg( maFileName );
-+ aCfg.SetGroup( maGroupName );
-+ sValue = String( aCfg.ReadKey( maKey ), RTL_TEXTENCODING_DONTKNOW );
-+ }
-+ else
-+ {
-+ // get key/value from windows register
-+#ifdef WNT
-+ HKEY hBaseKey = NULL;
-+ ByteString sSubKey;
-+ sal_Int32 nBaseKeyIndex = maGroupName.Search('\\');
-+ lcl_getRegKeyInfo( maGroupName, hBaseKey, sSubKey );
-+ if( hBaseKey != NULL )
-+ {
-+ HKEY hKey = NULL;
-+ LONG lResult;
-+ LPCTSTR lpSubKey = TEXT( sSubKey.GetBuffer());
-+ TCHAR szBuffer[1024];
-+ DWORD cbData = sizeof( szBuffer );
-+ lResult = RegOpenKeyEx( hBaseKey, lpSubKey, 0, KEY_QUERY_VALUE, &hKey );
-+ if( ERROR_SUCCESS == lResult )
-+ {
-+ LPCTSTR lpValueName = TEXT(maKey.GetBuffer());
-+ lResult = RegQueryValueEx( hKey, lpValueName, NULL, NULL, (LPBYTE)szBuffer, &cbData );
-+ RegCloseKey( hKey );
-+ sValue = rtl::OUString::createFromAscii(szBuffer);
-+ }
-+ }
-+
-+ return uno::makeAny( sValue );
-+#endif
-+ throw uno::RuntimeException( rtl::OUString(
-+ RTL_CONSTASCII_USTRINGPARAM("Only support on Windows")), uno::Reference< uno::XInterface >() );
-+ }
-
- return uno::makeAny( sValue );
- }
-@@ -61,12 +134,44 @@ uno::Any PrivateProfileStringListener::getValueEvent()
- void PrivateProfileStringListener::setValueEvent( const css::uno::Any& value )
- {
- // set the private profile string
-- Config aCfg( maFileName );
-- aCfg.SetGroup( maGroupName );
--
- rtl::OUString aValue;
- value >>= aValue;
-- aCfg.WriteKey( maKey, ByteString( aValue.getStr(), RTL_TEXTENCODING_DONTKNOW ) );
-+ if(maFileName.getLength())
-+ {
-+ // set value into a file
-+ Config aCfg( maFileName );
-+ aCfg.SetGroup( maGroupName );
-+ aCfg.WriteKey( maKey, ByteString( aValue.getStr(), RTL_TEXTENCODING_DONTKNOW ) );
-+ }
-+ else
-+ {
-+ //set value into windows register
-+#ifdef WNT
-+ HKEY hBaseKey = NULL;
-+ ByteString sSubKey;
-+ sal_Int32 nBaseKeyIndex = maGroupName.Search('\\');
-+ lcl_getRegKeyInfo( maGroupName, hBaseKey, sSubKey );
-+ if( hBaseKey != NULL )
-+ {
-+ HKEY hKey = NULL;
-+ LONG lResult;
-+ LPCTSTR lpSubKey = TEXT( sSubKey.GetBuffer());
-+ lResult = RegCreateKeyEx( hBaseKey, lpSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, NULL );
-+ if( ERROR_SUCCESS == lResult )
-+ {
-+ LPCTSTR szValue = TEXT( rtl::OUStringToOString( aValue, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ DWORD cbData = sizeof(TCHAR) * (_tcslen(szValue) + 1);
-+ LPCTSTR lpValueName = TEXT(maKey.GetBuffer());
-+ lResult = RegSetValueEx( hKey, lpValueName, NULL, REG_SZ, (LPBYTE)szValue, cbData );
-+ RegCloseKey( hKey );
-+ }
-+ }
-+ return;
-+#endif
-+ throw uno::RuntimeException( rtl::OUString(
-+ RTL_CONSTASCII_USTRINGPARAM("Not implemented")), uno::Reference< uno::XInterface >() );
-+ }
-+
- }
-
- SwVbaSystem::SwVbaSystem( uno::Reference<uno::XComponentContext >& xContext ): SwVbaSystem_BASE( uno::Reference< XHelperInterface >(), xContext )
-@@ -146,19 +251,19 @@ SwVbaSystem::setCursor( sal_Int32 _cursor ) throw (uno::RuntimeException)
- uno::Any SAL_CALL
- SwVbaSystem::PrivateProfileString( const rtl::OUString& rFilename, const rtl::OUString& rSection, const rtl::OUString& rKey ) throw ( uno::RuntimeException )
- {
-- if( rFilename.getLength() == 0 )
-- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Failed to access document from shell" ) ), uno::Reference< uno::XInterface >() );
--
- // FIXME: need to detect whether it is a relative file path
- // we need to detect if this is a URL, if not then assume its a file path
- rtl::OUString sFileUrl;
-- INetURLObject aObj;
-- aObj.SetURL( rFilename );
-- bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
-- if ( bIsURL )
-- sFileUrl = rFilename;
-- else
-- osl::FileBase::getFileURLFromSystemPath( rFilename, sFileUrl);
-+ if( rFilename.getLength() )
-+ {
-+ INetURLObject aObj;
-+ aObj.SetURL( rFilename );
-+ bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
-+ if ( bIsURL )
-+ sFileUrl = rFilename;
-+ else
-+ osl::FileBase::getFileURLFromSystemPath( rFilename, sFileUrl);
-+ }
-
- ByteString aGroupName = ByteString( rSection.getStr(), RTL_TEXTENCODING_DONTKNOW);
- ByteString aKey = ByteString( rKey.getStr(), RTL_TEXTENCODING_DONTKNOW);
-diff --git sw/source/ui/vba/vbatable.cxx sw/source/ui/vba/vbatable.cxx
-index 7598dfc..1ff9294 100644
---- sw/source/ui/vba/vbatable.cxx
-+++ sw/source/ui/vba/vbatable.cxx
-@@ -9,11 +9,13 @@
- #include <com/sun/star/container/XNamed.hpp>
- #include "vbaborders.hxx"
- #include "vbapalette.hxx"
-+#include "vbarows.hxx"
-+#include "vbacolumns.hxx"
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-
--SwVbaTable::SwVbaTable( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rDocument, const uno::Reference< css::text::XTextTable >& xTextTable) throw ( uno::RuntimeException ) : SwVbaTable_BASE( rParent, rContext ), mxTextDocument( rDocument )
-+SwVbaTable::SwVbaTable( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& rDocument, const uno::Reference< text::XTextTable >& xTextTable) throw ( uno::RuntimeException ) : SwVbaTable_BASE( rParent, rContext ), mxTextDocument( rDocument )
- {
- mxTextTable.set( xTextTable, uno::UNO_QUERY_THROW );
- }
-@@ -75,6 +77,26 @@ SwVbaTable::Borders( const uno::Any& index ) throw (uno::RuntimeException)
- return uno::makeAny( xCol );
- }
-
-+uno::Any SAL_CALL
-+SwVbaTable::Rows( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< table::XTableRows > xTableRows( mxTextTable->getRows(), uno::UNO_QUERY_THROW );
-+ uno::Reference< XCollection > xCol( new SwVbaRows( this, mxContext, mxTextTable, xTableRows ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaTable::Columns( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< table::XTableColumns > xTableColumns( mxTextTable->getColumns(), uno::UNO_QUERY_THROW );
-+ uno::Reference< XCollection > xCol( new SwVbaColumns( this, mxContext, mxTextTable, xTableColumns ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
- // XHelperInterface
- rtl::OUString&
- SwVbaTable::getServiceImplName()
-diff --git sw/source/ui/vba/vbatable.hxx sw/source/ui/vba/vbatable.hxx
-index c28a3cd..1348c60 100644
---- sw/source/ui/vba/vbatable.hxx
-+++ sw/source/ui/vba/vbatable.hxx
-@@ -21,6 +21,9 @@ public:
- virtual css::uno::Reference< ::ooo::vba::word::XRange > SAL_CALL ConvertToText( const css::uno::Any& Separator, const css::uno::Any& NestedTables ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual rtl::OUString SAL_CALL getName( ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Borders( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Rows( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Columns( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-diff --git sw/source/ui/vba/vbatablehelper.cxx sw/source/ui/vba/vbatablehelper.cxx
-new file mode 100644
-index 0000000..c4c7413
---- /dev/null
-+++ sw/source/ui/vba/vbatablehelper.cxx
-@@ -0,0 +1,306 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbatablehelper.hxx"
-+#include <swtable.hxx>
-+#include <unotbl.hxx>
-+#include <docsh.hxx>
-+
-+using namespace ::com::sun::star;
-+using namespace ::ooo::vba;
-+
-+#define UNO_TABLE_COLUMN_SUM 10000
-+
-+SwVbaTableHelper::SwVbaTableHelper( const uno::Reference< text::XTextTable >& xTextTable ) throw (uno::RuntimeException) : mxTextTable( xTextTable ), pDoc( NULL )
-+{
-+ pTable = GetSwTable( mxTextTable );
-+}
-+
-+SwTable* SwVbaTableHelper::GetSwTable( const uno::Reference< text::XTextTable >& xTextTable ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< lang::XUnoTunnel > xTunnel( xTextTable, uno::UNO_QUERY_THROW );
-+ SwXTextTable* pXTextTable = reinterpret_cast< SwXTextTable * >( sal::static_int_cast< sal_IntPtr >(xTunnel->getSomething(SwXTextTable::getUnoTunnelId())));
-+ if( !pXTextTable )
-+ throw uno::RuntimeException();
-+
-+ SwFrmFmt* pFrmFmt = pXTextTable->GetFrmFmt();
-+ if( !pFrmFmt )
-+ throw uno::RuntimeException();
-+
-+ SwTable* pTable = SwTable::FindTable( pFrmFmt );
-+ return pTable;
-+}
-+
-+sal_Int32 SwVbaTableHelper::getTabColumnsCount( sal_Int32 nRowIndex ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nRet = 0;
-+ if(!pTable->IsTblComplex())
-+ {
-+ SwTableLines& rLines = pTable->GetTabLines();
-+ SwTableLine* pLine = rLines.GetObject( nRowIndex );
-+ nRet = pLine->GetTabBoxes().Count();
-+ }
-+ return nRet;
-+}
-+
-+sal_Int32 SwVbaTableHelper::getTabColumnsMaxCount( ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nRet = 0;
-+ //sal_Int32 nRowCount = mxTextTable->getRows()->getCount();
-+ sal_Int32 nRowCount = pTable->GetTabLines().Count();
-+ for( sal_Int32 index = 0; index < nRowCount; index++ )
-+ {
-+ sal_Int32 nColCount = getTabColumnsCount( index );
-+ if( nRet < nColCount )
-+ nRet = nColCount;
-+ }
-+ return nRet;
-+}
-+
-+sal_Int32 SwVbaTableHelper::getTabRowIndex( const rtl::OUString& CellName ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nRet = 0;
-+ String sCellName(CellName);
-+ SwTableBox* pBox = (SwTableBox*)pTable->GetTblBox( sCellName );
-+ if( !pBox )
-+ throw uno::RuntimeException();
-+
-+ const SwTableLine* pLine = pBox->GetUpper();
-+ const SwTableLines* pLines = pLine->GetUpper()
-+ ? &pLine->GetUpper()->GetTabLines() : &pTable->GetTabLines();
-+ nRet = pLines->GetPos( pLine );
-+ return nRet;
-+}
-+
-+sal_Int32 SwVbaTableHelper::getTabColIndex( const rtl::OUString& CellName ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nRet = 0;
-+ String sCellName(CellName);
-+ const SwTableBox* pBox = (SwTableBox*)pTable->GetTblBox( sCellName );
-+ if( !pBox )
-+ throw uno::RuntimeException();
-+ const SwTableBoxes* pBoxes = &pBox->GetUpper()->GetTabBoxes();
-+ nRet = pBoxes->GetPos( pBox );
-+ return nRet;
-+}
-+
-+rtl::OUString SwVbaTableHelper::getColumnStr( sal_Int32 nCol )
-+{
-+ const sal_Int32 coDiff = 52; // 'A'-'Z' 'a' - 'z'
-+ sal_Int32 nCalc = 0;
-+
-+ String sRet;
-+ do{
-+ nCalc = nCol % coDiff;
-+ if( nCalc >= 26 )
-+ sRet.Insert( sal_Unicode('a' - 26 + nCalc ), 0 );
-+ else
-+ sRet.Insert( sal_Unicode('A' + nCalc ), 0 );
-+
-+ if( 0 == ( nCol = nCol - nCalc ) )
-+ break;
-+ nCol /= coDiff;
-+ --nCol;
-+ }while(1);
-+ return sRet;
-+}
-+
-+sal_Int32 SwVbaTableHelper::getTableWidth( ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nWidth = 0;
-+ sal_Bool isWidthRelatvie = sal_False;
-+ uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, uno::UNO_QUERY_THROW );
-+ xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsWidthRelative") ) ) >>= isWidthRelatvie;
-+ if( isWidthRelatvie )
-+ {
-+ xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RelativeWidth") ) ) >>= nWidth;
-+ }
-+ else
-+ {
-+ xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ) ) >>= nWidth;
-+ }
-+ return nWidth;
-+}
-+
-+void SwVbaTableHelper::setTableWidth( sal_Int32 _width ) throw (uno::RuntimeException)
-+{
-+ sal_Bool isWidthRelatvie = sal_False;
-+ uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, uno::UNO_QUERY_THROW );
-+ xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsWidthRelative") ) ) >>= isWidthRelatvie;
-+ if( isWidthRelatvie )
-+ {
-+ xTableProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RelativeWidth") ), uno::makeAny( _width ));
-+ }
-+ else
-+ {
-+ xTableProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ), uno::makeAny( _width ) );
-+ }
-+}
-+
-+SwTableBox* SwVbaTableHelper::GetTabBox( sal_Int32 nCol, sal_Int32 nRow ) throw (css::uno::RuntimeException)
-+{
-+ SwTableLines& rLines = pTable->GetTabLines();
-+ sal_Int32 nRowCount = rLines.Count();
-+ if( nRowCount < nRow )
-+ throw uno::RuntimeException();
-+
-+ SwTableBox* pStart = NULL;
-+ SwTableLine* pLine = rLines.GetObject( nRow );
-+ if( pLine->GetTabBoxes().Count() < nCol )
-+ throw uno::RuntimeException();
-+
-+ pStart = pLine->GetTabBoxes()[ nCol ];
-+
-+ if( !pStart )
-+ throw uno::RuntimeException();
-+
-+ return pStart;
-+}
-+
-+void SwVbaTableHelper::InitTabCols( SwTabCols& rCols, const SwTableBox *pStart, BOOL /*bCurRowOnly*/ )
-+{
-+ rCols.SetLeftMin ( 0 );
-+ rCols.SetLeft ( 0 );
-+ rCols.SetRight ( UNO_TABLE_COLUMN_SUM );
-+ rCols.SetRightMax( UNO_TABLE_COLUMN_SUM );
-+
-+ //if( !pDoc )
-+ // {
-+ // pDoc = word::getDocShell( getCurrentDocument() )->GetDoc();
-+ // }
-+ pTable->GetTabCols( rCols, pStart, sal_False, sal_False );
-+}
-+
-+sal_Int32 SwVbaTableHelper::GetColCount( SwTabCols& rCols ) const
-+{
-+ sal_Int32 nCount = 0;
-+ for(sal_Int32 i = 0; i < rCols.Count(); i++ )
-+ if(rCols.IsHidden(i))
-+ nCount ++;
-+ return rCols.Count() - nCount;
-+}
-+
-+sal_Int32 SwVbaTableHelper::GetRightSeparator( SwTabCols& rCols, sal_Int32 nNum) const
-+{
-+ DBG_ASSERT( nNum < (sal_Int32)GetColCount( rCols ) ,"Index out of range");
-+ sal_Int32 i = 0;
-+ while( nNum >= 0 )
-+ {
-+ if( !rCols.IsHidden( static_cast< USHORT >(i)) )
-+ nNum--;
-+ i++;
-+ }
-+ return i - 1;
-+}
-+
-+sal_Int32 SwVbaTableHelper::GetColWidth( sal_Int32 nCol, sal_Int32 nRow, sal_Bool bCurRowOnly ) throw (uno::RuntimeException)
-+{
-+ SwTableBox* pStart = GetTabBox( nCol, nRow );
-+ SwTabCols aCols;
-+ InitTabCols( aCols, pStart, bCurRowOnly );
-+ sal_Int32 nWidth = GetColWidth( aCols, nCol );
-+
-+ sal_Int32 nTableWidth = getTableWidth( );
-+ double dAbsWidth = ( (double)nWidth / UNO_TABLE_COLUMN_SUM ) * (double) nTableWidth;
-+ return ( sal_Int32 )Millimeter::getInPoints( dAbsWidth );
-+}
-+
-+sal_Int32 SwVbaTableHelper::GetColWidth( SwTabCols& rCols, sal_Int32 nNum ) throw (uno::RuntimeException)
-+{
-+ SwTwips nWidth = 0;
-+
-+ if( rCols.Count() > 0 )
-+ {
-+ if(rCols.Count() == GetColCount( rCols ))
-+ {
-+ nWidth = (SwTwips)((nNum == rCols.Count()) ?
-+ rCols.GetRight() - rCols[nNum-1] :
-+ nNum == 0 ? rCols[nNum] - rCols.GetLeft() :
-+ rCols[nNum] - rCols[nNum-1]);
-+ }
-+ else
-+ {
-+ SwTwips nRValid = nNum < GetColCount( rCols ) ?
-+ rCols[(USHORT)GetRightSeparator( rCols, nNum)]:
-+ rCols.GetRight();
-+ SwTwips nLValid = nNum ?
-+ rCols[(USHORT)GetRightSeparator( rCols, nNum - 1)]:
-+ rCols.GetLeft();
-+ nWidth = nRValid - nLValid;
-+ }
-+ }
-+ else
-+ nWidth = rCols.GetRight();
-+
-+ return nWidth;
-+}
-+
-+void SwVbaTableHelper::SetColWidth( sal_Int32 _width, sal_Int32 nCol, sal_Int32 nRow, sal_Bool bCurRowOnly ) throw (css::uno::RuntimeException)
-+{
-+ double dAbsWidth = Millimeter::getInHundredthsOfOneMillimeter( _width );
-+ sal_Int32 nTableWidth = getTableWidth( );
-+ sal_Int32 nNewWidth = (sal_Int32)( dAbsWidth/nTableWidth * UNO_TABLE_COLUMN_SUM );
-+
-+ SwTableBox* pStart = GetTabBox( nCol, nRow );
-+ SwTabCols aOldCols;
-+ InitTabCols( aOldCols, pStart, bCurRowOnly );
-+
-+ //BOOL bCurRowOnly = FALSE;
-+ SwTwips nWidth = 0;
-+
-+ SwTabCols aCols( aOldCols );
-+ if ( aCols.Count() > 0 )
-+ {
-+ // if(aCols.Count() != GetColCount( aCols ))
-+ // bCurRowOnly = TRUE;
-+ nWidth = GetColWidth( aCols, nCol);
-+
-+ int nDiff = (int)(nNewWidth - nWidth);
-+ if( !nCol )
-+ aCols[ static_cast< USHORT >(GetRightSeparator(aCols, 0)) ] += nDiff;
-+ else if( nCol < GetColCount( aCols ) )
-+ {
-+ if(nDiff < GetColWidth( aCols, nCol + 1) - MINLAY)
-+ aCols[ static_cast< USHORT >(GetRightSeparator( aCols, nCol)) ] += nDiff;
-+ else
-+ {
-+ int nDiffLeft = nDiff - (int)GetColWidth( aCols, nCol + 1) + (int)MINLAY;
-+ aCols[ static_cast< USHORT >(GetRightSeparator( aCols, nCol)) ] += (nDiff - nDiffLeft);
-+ aCols[ static_cast< USHORT >(GetRightSeparator( aCols, nCol - 1)) ] -= nDiffLeft;
-+ }
-+ }
-+ else
-+ aCols[ static_cast< USHORT >(GetRightSeparator( aCols, nCol-1)) ] -= nDiff;
-+ }
-+ else
-+ aCols.SetRight( Min( (long)nNewWidth, aCols.GetRightMax()) );
-+
-+ //pDoc->SetTabCols(*pTable, aCols, aOldCols, pStartBox, bCurRowOnly );
-+ pTable->SetTabCols(aCols, aOldCols, pStart, bCurRowOnly );
-+}
-diff --git sw/source/ui/vba/vbatablehelper.hxx sw/source/ui/vba/vbatablehelper.hxx
-new file mode 100644
-index 0000000..73425d4
---- /dev/null
-+++ sw/source/ui/vba/vbatablehelper.hxx
-@@ -0,0 +1,70 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_WORD_VBA_TABLEHELPER_HXX
-+#define SW_WORD_VBA_TABLEHELPER_HXX
-+
-+#include <com/sun/star/text/XTextTable.hpp>
-+#include "wordvbahelper.hxx"
-+#include <swtable.hxx>
-+#include <tabcol.hxx>
-+#include <doc.hxx>
-+
-+class SwVbaTableHelper
-+{
-+private:
-+ css::uno::Reference< css::text::XTextTable > mxTextTable;
-+ SwTable* pTable;
-+ SwDoc* pDoc;
-+
-+private:
-+ SwTableBox* GetTabBox( sal_Int32 nCol, sal_Int32 nRow ) throw (css::uno::RuntimeException);
-+ void InitTabCols( SwTabCols& rCols, const SwTableBox *pStart, sal_Bool bCurRowOnly = FALSE );
-+ sal_Int32 GetRightSeparator( SwTabCols& rCols, sal_Int32 nNum) const;
-+ sal_Int32 GetColCount( SwTabCols& rCols ) const;
-+ sal_Int32 GetColWidth( SwTabCols& rCols, sal_Int32 nNum ) throw (css::uno::RuntimeException);
-+
-+public:
-+ SwVbaTableHelper( const css::uno::Reference< css::text::XTextTable >& xTextTable ) throw (css::uno::RuntimeException);
-+ ~SwVbaTableHelper() {}
-+ sal_Int32 getTabColumnsCount( sal_Int32 nRowIndex ) throw (css::uno::RuntimeException);
-+ sal_Int32 getTabColumnsMaxCount( ) throw (css::uno::RuntimeException);
-+ sal_Int32 getTabRowIndex( const rtl::OUString& sCellName ) throw (css::uno::RuntimeException);
-+ sal_Int32 getTabColIndex( const rtl::OUString& sCellName ) throw (css::uno::RuntimeException);
-+ sal_Int32 getTableWidth( ) throw (css::uno::RuntimeException);
-+ void setTableWidth( sal_Int32 _width ) throw (css::uno::RuntimeException);
-+
-+ sal_Int32 GetColWidth( sal_Int32 nCol, sal_Int32 nRow = 0, sal_Bool bCurRowOnly = FALSE ) throw (css::uno::RuntimeException);
-+ void SetColWidth( sal_Int32 _width, sal_Int32 nCol, sal_Int32 nRow = 0, sal_Bool bCurRowOnly = FALSE ) throw (css::uno::RuntimeException);
-+
-+ static SwTable* GetSwTable( const css::uno::Reference< css::text::XTextTable >& xTextTable ) throw (css::uno::RuntimeException);
-+ static rtl::OUString getColumnStr( sal_Int32 nCol );
-+};
-+
-+#endif
-diff --git sw/source/ui/vba/vbatableofcontents.cxx sw/source/ui/vba/vbatableofcontents.cxx
-new file mode 100644
-index 0000000..1c37e96
---- /dev/null
-+++ sw/source/ui/vba/vbatableofcontents.cxx
-@@ -0,0 +1,125 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbatableofcontents.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include <ooo/vba/word/WdTabLeader.hpp>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaTableOfContents::SwVbaTableOfContents( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& xDoc, const uno::Reference< text::XDocumentIndex >& xDocumentIndex ) throw ( uno::RuntimeException ) :
-+ SwVbaTableOfContents_BASE( rParent, rContext ), mxTextDocument( xDoc ), mxDocumentIndex( xDocumentIndex )
-+{
-+ mxTocProps.set( mxDocumentIndex, uno::UNO_QUERY_THROW );
-+}
-+
-+
-+SwVbaTableOfContents::~SwVbaTableOfContents()
-+{
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaTableOfContents::getLowerHeadingLevel() throw (uno::RuntimeException)
-+{
-+ sal_Int16 nLevel = 0;
-+ mxTocProps->getPropertyValue(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Level") ) ) >>= nLevel;
-+ return nLevel;
-+}
-+
-+void SAL_CALL SwVbaTableOfContents::setLowerHeadingLevel( ::sal_Int32 _lowerheadinglevel ) throw (uno::RuntimeException)
-+{
-+ mxTocProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Level") ), uno::makeAny( sal_Int8( _lowerheadinglevel ) ) );
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaTableOfContents::getTabLeader() throw (uno::RuntimeException)
-+{
-+ // not support in Writer
-+ return word::WdTabLeader::wdTabLeaderDots;
-+}
-+
-+void SAL_CALL SwVbaTableOfContents::setTabLeader( ::sal_Int32 /*_tableader*/ ) throw (uno::RuntimeException)
-+{
-+ // not support in Writer
-+}
-+
-+::sal_Bool SAL_CALL SwVbaTableOfContents::getUseFields() throw (css::uno::RuntimeException)
-+{
-+ sal_Bool bUseFields = sal_False;
-+ mxTocProps->getPropertyValue(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CreateFromMarks") ) ) >>= bUseFields;
-+ return bUseFields;
-+}
-+
-+void SAL_CALL SwVbaTableOfContents::setUseFields( ::sal_Bool _useFields ) throw (css::uno::RuntimeException)
-+{
-+ mxTocProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CreateFromMarks") ), uno::makeAny( _useFields ) );
-+}
-+
-+::sal_Bool SAL_CALL SwVbaTableOfContents::getUseOutlineLevels() throw (css::uno::RuntimeException)
-+{
-+ sal_Bool bUseOutlineLevels = sal_False;
-+ mxTocProps->getPropertyValue(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CreateFromOutline") ) ) >>= bUseOutlineLevels;
-+ return bUseOutlineLevels;
-+}
-+
-+void SAL_CALL SwVbaTableOfContents::setUseOutlineLevels( ::sal_Bool _useOutlineLevels ) throw (css::uno::RuntimeException)
-+{
-+ mxTocProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CreateFromOutline") ), uno::makeAny( _useOutlineLevels ) );
-+}
-+
-+void SAL_CALL SwVbaTableOfContents::Delete( ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< text::XTextContent > xTextContent( mxDocumentIndex, uno::UNO_QUERY_THROW );
-+ mxTextDocument->getText()->removeTextContent( xTextContent );
-+}
-+
-+void SAL_CALL SwVbaTableOfContents::Update( ) throw (uno::RuntimeException)
-+{
-+ mxDocumentIndex->update();
-+}
-+
-+rtl::OUString&
-+SwVbaTableOfContents::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaTableOfContents") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaTableOfContents::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.TableOfContents" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbatableofcontents.hxx sw/source/ui/vba/vbatableofcontents.hxx
-new file mode 100644
-index 0000000..8e9394a
---- /dev/null
-+++ sw/source/ui/vba/vbatableofcontents.hxx
-@@ -0,0 +1,70 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_TABLEOFCONTENTS_HXX
-+#define SW_VBA_TABLEOFCONTENTS_HXX
-+
-+#include <ooo/vba/word/XTableOfContents.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include <com/sun/star/text/XDocumentIndex.hpp>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XTableOfContents > SwVbaTableOfContents_BASE;
-+
-+class SwVbaTableOfContents : public SwVbaTableOfContents_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XTextDocument > mxTextDocument;
-+ css::uno::Reference< css::text::XDocumentIndex > mxDocumentIndex;
-+ css::uno::Reference< css::beans::XPropertySet > mxTocProps;
-+
-+public:
-+ SwVbaTableOfContents( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& xDoc, const css::uno::Reference< css::text::XDocumentIndex >& xDocumentIndex ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaTableOfContents();
-+
-+ // Attributes
-+ virtual ::sal_Int32 SAL_CALL getLowerHeadingLevel() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setLowerHeadingLevel( ::sal_Int32 _lowerheadinglevel ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getTabLeader() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setTabLeader( ::sal_Int32 _tableader ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getUseFields() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setUseFields( ::sal_Bool _useFields ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getUseOutlineLevels() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setUseOutlineLevels( ::sal_Bool _useOutlineLevels ) throw (css::uno::RuntimeException);
-+
-+ // Methods
-+ virtual void SAL_CALL Delete( ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL Update( ) throw (css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_TABLEOFCONTENTS_HXX */
-diff --git sw/source/ui/vba/vbatables.cxx sw/source/ui/vba/vbatables.cxx
-index 53178d1..7423216 100644
---- sw/source/ui/vba/vbatables.cxx
-+++ sw/source/ui/vba/vbatables.cxx
-@@ -4,6 +4,9 @@
- #include <com/sun/star/text/XTextTable.hpp>
- #include <com/sun/star/text/XTextTablesSupplier.hpp>
- #include <com/sun/star/text/XTextDocument.hpp>
-+#include <com/sun/star/lang/XServiceInfo.hpp>
-+#include <com/sun/star/text/XText.hpp>
-+#include <com/sun/star/table/XCellRange.hpp>
- #include <comphelper/componentcontext.hxx>
-
- using namespace ::ooo::vba;
-@@ -26,7 +29,89 @@ uno::Any lcl_createTable( const uno::Reference< XHelperInterface >& xParent, con
- return uno::makeAny( xTable );
- }
-
-+sal_Bool lcl_isInHeaderFooter( const uno::Reference< text::XTextTable >& xTable )
-+{
-+ uno::Reference< text::XTextContent > xTextContent( xTable, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XText > xText = xTextContent->getAnchor()->getText();
-+ uno::Reference< lang::XServiceInfo > xServiceInfo( xText, uno::UNO_QUERY_THROW );
-+ rtl::OUString aImplName = xServiceInfo->getImplementationName();
-+ if( aImplName.equalsAscii("SwXHeadFootText") )
-+ return sal_True;
-+ return sal_False;
-+}
-+
- typedef ::cppu::WeakImplHelper1< css::container::XEnumeration > EnumBase;
-+typedef ::cppu::WeakImplHelper2< container::XIndexAccess, container::XNameAccess > TableCollectionHelper_Base;
-+typedef std::vector< uno::Reference< text::XTextTable > > XTextTableVec;
-+
-+class TableCollectionHelper : public TableCollectionHelper_Base
-+{
-+ XTextTableVec mxTables;
-+ XTextTableVec::iterator cachePos;
-+
-+public:
-+ TableCollectionHelper( const uno::Reference< frame::XModel >& xDocument )
-+ {
-+ // only count the tables in the body text, not in the header/footer
-+ uno::Reference< container::XIndexAccess > xTables = lcl_getTables( xDocument );
-+ sal_Int32 nCount = xTables->getCount();
-+ for( sal_Int32 i = 0; i < nCount; i++ )
-+ {
-+ uno::Reference< text::XTextTable > xTable( xTables->getByIndex( i ) , uno::UNO_QUERY_THROW );
-+ if( !lcl_isInHeaderFooter( xTable ) )
-+ mxTables.push_back( xTable );
-+ }
-+ cachePos = mxTables.begin();
-+ }
-+ // XIndexAccess
-+ virtual sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
-+ {
-+ return mxTables.size();
-+ }
-+ virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( Index < 0 || Index >= getCount() )
-+ throw lang::IndexOutOfBoundsException();
-+ uno::Reference< text::XTextTable > xTable( mxTables[ Index ], uno::UNO_QUERY_THROW );
-+ return uno::makeAny( xTable );
-+ }
-+ // XElementAccess
-+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) { return text::XTextTable::static_type(0); }
-+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) { return getCount() > 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();
-+ uno::Reference< text::XTextTable > xTable( *cachePos, uno::UNO_QUERY_THROW );
-+ return uno::makeAny( xTable );
-+ }
-+ virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException)
-+ {
-+ uno::Sequence< rtl::OUString > sNames( mxTables.size() );
-+ rtl::OUString* pString = sNames.getArray();
-+ XTextTableVec::iterator it = mxTables.begin();
-+ XTextTableVec::iterator it_end = mxTables.end();
-+ for ( ; it != it_end; ++it, ++pString )
-+ {
-+ uno::Reference< container::XNamed > xName( *it, uno::UNO_QUERY_THROW );
-+ *pString = xName->getName();
-+ }
-+ return sNames;
-+ }
-+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
-+ {
-+ cachePos = mxTables.begin();
-+ XTextTableVec::iterator it_end = mxTables.end();
-+ for ( ; cachePos != it_end; ++cachePos )
-+ {
-+ uno::Reference< container::XNamed > xName( *cachePos, uno::UNO_QUERY_THROW );
-+ if ( aName.equalsIgnoreAsciiCase( xName->getName() ) )
-+ break;
-+ }
-+ return ( cachePos != it_end );
-+ }
-+};
-
- class TableEnumerationImpl : public EnumBase
- {
-@@ -52,7 +137,7 @@ public:
-
- };
-
--SwVbaTables::SwVbaTables( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xDocument ) : SwVbaTables_BASE( xParent, xContext , lcl_getTables( xDocument ) ), mxDocument( xDocument )
-+SwVbaTables::SwVbaTables( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xDocument ) : SwVbaTables_BASE( xParent, xContext , uno::Reference< container::XIndexAccess >( new TableCollectionHelper( xDocument ) ) ), mxDocument( xDocument )
- {
- }
-
-@@ -85,6 +170,12 @@ SwVbaTables::Add( const uno::Reference< word::XRange >& Range, const uno::Any& N
- uno::Reference< text::XTextContent > xContext( xTable, uno::UNO_QUERY_THROW );
-
- xText->insertTextContent( xTextRange, xContext, true );
-+
-+ // move the current cursor to the first table cell
-+ uno::Reference< table::XCellRange > xCellRange( xTable, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XText> xFirstCellText( xCellRange->getCellByPosition(0, 0), uno::UNO_QUERY_THROW );
-+ word::getXTextViewCursor( mxDocument )->gotoRange( xFirstCellText->getStart(), sal_False );
-+
- uno::Reference< word::XTable > xVBATable( new SwVbaTable( mxParent, mxContext, pVbaRange->getDocument(), xTable ) );
- return xVBATable;
- }
-diff --git sw/source/ui/vba/vbatablesofcontents.cxx sw/source/ui/vba/vbatablesofcontents.cxx
-new file mode 100644
-index 0000000..020f19c
---- /dev/null
-+++ sw/source/ui/vba/vbatablesofcontents.cxx
-@@ -0,0 +1,197 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbatablesofcontents.hxx"
-+#include "vbatableofcontents.hxx"
-+#include "vbarange.hxx"
-+#include <com/sun/star/text/XDocumentIndexesSupplier.hpp>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+typedef ::cppu::WeakImplHelper2< container::XIndexAccess, container::XEnumerationAccess > TableOfContentsCollectionHelper_Base;
-+typedef std::vector< uno::Reference< text::XDocumentIndex > > XTocVec;
-+
-+class TablesOfContentsEnumWrapper : public EnumerationHelper_BASE
-+{
-+ uno::Reference< container::XIndexAccess > mxIndexAccess;
-+ sal_Int32 nIndex;
-+
-+public:
-+ TablesOfContentsEnumWrapper( const uno::Reference< container::XIndexAccess >& xIndexAccess ) : mxIndexAccess( xIndexAccess ), nIndex( 0 )
-+ {
-+ }
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( nIndex < mxIndexAccess->getCount() );
-+ }
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if( nIndex < mxIndexAccess->getCount() )
-+ {
-+ return mxIndexAccess->getByIndex( nIndex++ );
-+ }
-+ throw container::NoSuchElementException();
-+ }
-+};
-+
-+class TableOfContentsCollectionHelper : public TableOfContentsCollectionHelper_Base
-+{
-+private:
-+ uno::Reference< XHelperInterface > mxParent;
-+ uno::Reference< uno::XComponentContext > mxContext;
-+ uno::Reference< text::XTextDocument > mxTextDocument;
-+ XTocVec maToc;
-+
-+public:
-+ TableOfContentsCollectionHelper( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextDocument >& xDoc ) throw ( uno::RuntimeException ): mxParent( xParent ), mxContext( xContext ), mxTextDocument( xDoc )
-+ {
-+ uno::Reference< text::XDocumentIndexesSupplier > xDocIndexSupp( mxTextDocument, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xDocIndexes = xDocIndexSupp->getDocumentIndexes();
-+ sal_Int32 nCount = xDocIndexes->getCount();
-+ for( sal_Int32 i = 0; i < nCount; i++ )
-+ {
-+ uno::Reference< text::XDocumentIndex > xToc( xDocIndexes->getByIndex(i), uno::UNO_QUERY_THROW );
-+ if( xToc->getServiceName().equalsAscii("com.sun.star.text.ContentIndex") )
-+ {
-+ maToc.push_back( xToc );
-+ }
-+ }
-+ }
-+
-+ virtual ~TableOfContentsCollectionHelper() {}
-+
-+ virtual sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
-+ {
-+ return maToc.size();
-+ }
-+ virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( Index < 0 || Index >= getCount() )
-+ throw lang::IndexOutOfBoundsException();
-+
-+ uno::Reference< text::XDocumentIndex > xToc( maToc[Index], uno::UNO_QUERY_THROW );
-+ return uno::makeAny( uno::Reference< word::XTableOfContents >( new SwVbaTableOfContents( mxParent, mxContext, mxTextDocument, xToc ) ) );
-+ }
-+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
-+ {
-+ return word::XTableOfContents::static_type(0);
-+ }
-+ virtual sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
-+ {
-+ return sal_True;
-+ }
-+ // XEnumerationAccess
-+ virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
-+ {
-+ return new TablesOfContentsEnumWrapper( this );
-+ }
-+};
-+
-+SwVbaTablesOfContents::SwVbaTablesOfContents( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextDocument >& xDoc ) throw (uno::RuntimeException) : SwVbaTablesOfContents_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new TableOfContentsCollectionHelper( xParent, xContext, xDoc ) ) ), mxTextDocument( xDoc )
-+{
-+}
-+
-+uno::Reference< word::XTableOfContents > SAL_CALL
-+SwVbaTablesOfContents::Add( const uno::Reference< word::XRange >& Range, const uno::Any& /*UseHeadingStyles*/, const uno::Any& /*UpperHeadingLevel*/, const uno::Any& LowerHeadingLevel, const uno::Any& UseFields, const uno::Any& /*TableID*/, const uno::Any& /*RightAlignPageNumbers*/, const uno::Any& /*IncludePageNumbers*/, const uno::Any& /*AddedStyles*/, const uno::Any& /*UseHyperlinks*/, const uno::Any& /*HidePageNumbersInWeb*/, const uno::Any& /*UseOutlineLevels*/ ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< lang::XMultiServiceFactory > xDocMSF( mxTextDocument, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XDocumentIndex > xDocumentIndex( xDocMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.ContentIndex")) ), uno::UNO_QUERY_THROW );
-+
-+ uno::Reference< beans::XPropertySet > xTocProps( xDocumentIndex, uno::UNO_QUERY_THROW );
-+ sal_Bool isProtected = sal_False;
-+ xTocProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsProtected") ), uno::makeAny( isProtected ) );
-+
-+ uno::Reference< word::XTableOfContents > xToc( new SwVbaTableOfContents( this, mxContext, mxTextDocument, xDocumentIndex ) );
-+
-+ sal_Int32 nLowerHeadingLevel = 9;
-+ if( LowerHeadingLevel.hasValue() )
-+ LowerHeadingLevel >>= nLowerHeadingLevel;
-+ xToc->setLowerHeadingLevel( nLowerHeadingLevel );
-+
-+ sal_Bool bUseFields = sal_False;
-+ if( UseFields.hasValue() )
-+ UseFields >>= bUseFields;
-+ xToc->setUseFields( bUseFields );
-+
-+ sal_Bool bUseOutlineLevels = sal_True;
-+ //if( UseOutlineLevels.hasValue() )
-+ // UseOutlineLevels >>= bUseOutlineLevels;
-+ xToc->setUseOutlineLevels( bUseOutlineLevels );
-+
-+ SwVbaRange* pVbaRange = dynamic_cast<SwVbaRange*>( Range.get() );
-+ if( !pVbaRange )
-+ throw uno::RuntimeException();
-+
-+ uno::Reference< text::XTextRange > xTextRange = pVbaRange->getXTextRange();
-+ uno::Reference< text::XText > xText = pVbaRange->getXText();
-+ uno::Reference< text::XTextContent > xTextContent( xDocumentIndex, uno::UNO_QUERY_THROW );
-+ xText->insertTextContent( xTextRange, xTextContent, sal_False );
-+ xToc->Update();
-+
-+ return xToc;
-+}
-+
-+// XEnumerationAccess
-+uno::Type
-+SwVbaTablesOfContents::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XTableOfContents::static_type(0);
-+}
-+uno::Reference< container::XEnumeration >
-+SwVbaTablesOfContents::createEnumeration() throw (uno::RuntimeException)
-+{
-+ return new TablesOfContentsEnumWrapper( m_xIndexAccess );
-+}
-+
-+uno::Any
-+SwVbaTablesOfContents::createCollectionObject( const uno::Any& aSource )
-+{
-+ return aSource;
-+}
-+
-+rtl::OUString&
-+SwVbaTablesOfContents::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaTablesOfContents") );
-+ return sImplName;
-+}
-+
-+uno::Sequence<rtl::OUString>
-+SwVbaTablesOfContents::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.TablesOfContents") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbatablesofcontents.hxx sw/source/ui/vba/vbatablesofcontents.hxx
-new file mode 100644
-index 0000000..e193df7
---- /dev/null
-+++ sw/source/ui/vba/vbatablesofcontents.hxx
-@@ -0,0 +1,64 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_TABLESOFCONTENTS_HXX
-+#define SW_VBA_TABLESOFCONTENTS_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XTablesOfContents.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include <ooo/vba/word/XTableOfContents.hpp>
-+#include <ooo/vba/word/XRange.hpp>
-+
-+typedef CollTestImplHelper< ooo::vba::word::XTablesOfContents > SwVbaTablesOfContents_BASE;
-+
-+class SwVbaTablesOfContents : public SwVbaTablesOfContents_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XTextDocument > mxTextDocument;
-+
-+public:
-+ SwVbaTablesOfContents( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::text::XTextDocument >& xDoc ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaTablesOfContents() {}
-+
-+ // Methods
-+ virtual css::uno::Reference< ::ooo::vba::word::XTableOfContents > SAL_CALL Add( const css::uno::Reference< ::ooo::vba::word::XRange >& Range, const css::uno::Any& UseHeadingStyles, const css::uno::Any& UpperHeadingLevel, const css::uno::Any& LowerHeadingLevel, const css::uno::Any& UseFields, const css::uno::Any& TableID, const css::uno::Any& RightAlignPageNumbers, const css::uno::Any& IncludePageNumbers, const css::uno::Any& AddedStyles, const css::uno::Any& UseHyperlinks, const css::uno::Any& HidePageNumbersInWeb, const css::uno::Any& UseOutlineLevels ) 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);
-+
-+ // SwVbaTablesOfContents_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* SW_VBA_TABLESOFCONTENTS_HXX */
-diff --git sw/source/ui/vba/vbatabstop.cxx sw/source/ui/vba/vbatabstop.cxx
-new file mode 100644
-index 0000000..259c508
---- /dev/null
-+++ sw/source/ui/vba/vbatabstop.cxx
-@@ -0,0 +1,63 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbatabstop.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaTabStop::SwVbaTabStop( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< beans::XPropertySet >& xParaProps, const style::TabStop& aTabStop ) throw ( uno::RuntimeException ) : SwVbaTabStop_BASE( rParent, rContext ), mxParaProps( xParaProps ), maTabStop( aTabStop )
-+{
-+}
-+
-+SwVbaTabStop::~SwVbaTabStop()
-+{
-+}
-+
-+rtl::OUString&
-+SwVbaTabStop::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaTabStop") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaTabStop::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.TabStop" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbatabstop.hxx sw/source/ui/vba/vbatabstop.hxx
-new file mode 100644
-index 0000000..77780c7
---- /dev/null
-+++ sw/source/ui/vba/vbatabstop.hxx
-@@ -0,0 +1,54 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_TABSTOP_HXX
-+#define SW_VBA_TABSTOP_HXX
-+
-+#include <ooo/vba/word/XTabStop.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/style/TabStop.hpp>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XTabStop > SwVbaTabStop_BASE;
-+
-+class SwVbaTabStop : public SwVbaTabStop_BASE
-+{
-+private:
-+ css::uno::Reference< css::beans::XPropertySet > mxParaProps;
-+ css::style::TabStop maTabStop;
-+
-+public:
-+ SwVbaTabStop( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::beans::XPropertySet >& xParaProps, const css::style::TabStop& aTabStop ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaTabStop();
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_TABSTOP_HXX */
-diff --git sw/source/ui/vba/vbatabstops.cxx sw/source/ui/vba/vbatabstops.cxx
-new file mode 100644
-index 0000000..8d19875
---- /dev/null
-+++ sw/source/ui/vba/vbatabstops.cxx
-@@ -0,0 +1,280 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbatabstops.hxx"
-+#include "vbatabstop.hxx"
-+#include <com/sun/star/style/TabAlign.hpp>
-+#include <ooo/vba/word/WdTabLeader.hpp>
-+#include <ooo/vba/word/WdTabAlignment.hpp>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+uno::Sequence< style::TabStop > lcl_getTabStops( const uno::Reference< beans::XPropertySet >& xParaProps ) throw (uno::RuntimeException)
-+{
-+ uno::Sequence< style::TabStop > aSeq;
-+ xParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaTabStops") ) ) >>= aSeq;
-+ return aSeq;
-+}
-+
-+void lcl_setTabStops( const uno::Reference< beans::XPropertySet >& xParaProps, const uno::Sequence< style::TabStop >& aSeq ) throw (uno::RuntimeException)
-+{
-+ xParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaTabStops") ), uno::makeAny( aSeq ) );
-+}
-+
-+typedef ::cppu::WeakImplHelper2< container::XIndexAccess, container::XEnumerationAccess > TabStopCollectionHelper_Base;
-+
-+class TabStopsEnumWrapper : public EnumerationHelper_BASE
-+{
-+ uno::Reference< container::XIndexAccess > mxIndexAccess;
-+ sal_Int32 nIndex;
-+
-+public:
-+ TabStopsEnumWrapper( const uno::Reference< container::XIndexAccess >& xIndexAccess ) : mxIndexAccess( xIndexAccess ), nIndex( 0 )
-+ {
-+ }
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( nIndex < mxIndexAccess->getCount() );
-+ }
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if( nIndex < mxIndexAccess->getCount() )
-+ {
-+ return mxIndexAccess->getByIndex( nIndex++ );
-+ }
-+ throw container::NoSuchElementException();
-+ }
-+};
-+
-+class TabStopCollectionHelper : public TabStopCollectionHelper_Base
-+{
-+private:
-+ uno::Reference< XHelperInterface > mxParent;
-+ uno::Reference< uno::XComponentContext > mxContext;
-+ uno::Reference< beans::XPropertySet > mxParaProps;
-+ uno::Sequence< style::TabStop > maTabStops;
-+
-+public:
-+ TabStopCollectionHelper( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::beans::XPropertySet >& xParaProps ) throw ( css::uno::RuntimeException ): mxParent( xParent ), mxContext( xContext ), mxParaProps( xParaProps )
-+ {
-+ maTabStops = lcl_getTabStops( xParaProps );
-+ }
-+
-+ virtual ~TabStopCollectionHelper() {}
-+
-+ virtual sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
-+ {
-+ return maTabStops.getLength();
-+ }
-+ virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( Index < 0 || Index >= getCount() )
-+ throw css::lang::IndexOutOfBoundsException();
-+
-+ const style::TabStop* pTabs = maTabStops.getConstArray();
-+ return uno::makeAny( uno::Reference< word::XTabStop >( new SwVbaTabStop( mxParent, mxContext, mxParaProps, pTabs[ Index ] ) ) );
-+ }
-+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
-+ {
-+ return word::XTabStop::static_type(0);
-+ }
-+ virtual sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
-+ {
-+ return sal_True;
-+ }
-+ // XEnumerationAccess
-+ virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
-+ {
-+ return new TabStopsEnumWrapper( this );
-+ }
-+};
-+
-+SwVbaTabStops::SwVbaTabStops( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< beans::XPropertySet >& xParaProps ) throw (uno::RuntimeException) : SwVbaTabStops_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new TabStopCollectionHelper( xParent, xContext, xParaProps ) ) ), mxParaProps( xParaProps )
-+{
-+}
-+
-+uno::Reference< word::XTabStop > SAL_CALL SwVbaTabStops::Add( float Position, const uno::Any& Alignment, const uno::Any& Leader ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nPosition = Millimeter::getInHundredthsOfOneMillimeter( Position );
-+
-+ style::TabAlign nAlign = style::TabAlign_LEFT;
-+ if( Alignment.hasValue() )
-+ {
-+ sal_Int32 wdAlign = word::WdTabAlignment::wdAlignTabLeft;
-+ Alignment >>= wdAlign;
-+ switch( wdAlign )
-+ {
-+ case word::WdTabAlignment::wdAlignTabLeft:
-+ {
-+ nAlign = style::TabAlign_LEFT;
-+ break;
-+ }
-+ case word::WdTabAlignment::wdAlignTabRight:
-+ {
-+ nAlign = style::TabAlign_RIGHT;
-+ break;
-+ }
-+ case word::WdTabAlignment::wdAlignTabCenter:
-+ {
-+ nAlign = style::TabAlign_CENTER;
-+ break;
-+ }
-+ case word::WdTabAlignment::wdAlignTabDecimal:
-+ {
-+ nAlign = style::TabAlign_DECIMAL;
-+ break;
-+ }
-+ case word::WdTabAlignment::wdAlignTabBar:
-+ case word::WdTabAlignment::wdAlignTabList:
-+ {
-+ DebugHelper::exception( SbERR_NOT_IMPLEMENTED, rtl::OUString() );
-+ break;
-+ }
-+ default:
-+ {
-+ //left
-+ }
-+ }
-+ }
-+
-+ sal_Char cLeader = ' '; // default is space
-+ if( Leader.hasValue() )
-+ {
-+ sal_Int32 wdLeader = word::WdTabLeader::wdTabLeaderSpaces;
-+ Leader >>= wdLeader;
-+ switch( wdLeader )
-+ {
-+ case word::WdTabLeader::wdTabLeaderSpaces:
-+ {
-+ cLeader = ' ';
-+ break;
-+ }
-+ case word::WdTabLeader::wdTabLeaderMiddleDot:
-+ {
-+ cLeader = 183;
-+ break;
-+ }
-+ case word::WdTabLeader::wdTabLeaderDots:
-+ {
-+ cLeader = '.';
-+ break;
-+ }
-+ case word::WdTabLeader::wdTabLeaderDashes:
-+ case word::WdTabLeader::wdTabLeaderHeavy:
-+ case word::WdTabLeader::wdTabLeaderLines:
-+ {
-+ cLeader = '_';
-+ break;
-+ }
-+ default:
-+ {
-+ //left
-+ }
-+ }
-+ }
-+
-+ sal_Char cDecimal = '.'; // default value
-+
-+ style::TabStop aTab;
-+ aTab.Position = nPosition;
-+ aTab.Alignment = nAlign;
-+ aTab.DecimalChar = cDecimal;
-+ aTab.FillChar = cLeader;
-+
-+ uno::Sequence< style::TabStop > aOldTabs = lcl_getTabStops( mxParaProps );
-+ sal_Bool bOverWriter = sal_False;
-+
-+ sal_Int32 nTabs = aOldTabs.getLength();
-+ uno::Sequence< style::TabStop > aNewTabs( nTabs + 1 );
-+
-+ style::TabStop* pOldTab = aOldTabs.getArray();
-+ style::TabStop* pNewTab = aNewTabs.getArray();
-+ pNewTab[0] = aTab;
-+ for( sal_Int32 nIndex = 0; nIndex < nTabs && !bOverWriter; nIndex++ )
-+ {
-+ if( pOldTab[nIndex].Position == nPosition )
-+ {
-+ bOverWriter = sal_True;
-+ pOldTab[nIndex] = aTab;
-+ break;
-+ }
-+ pNewTab[ nIndex+1 ] = pOldTab[ nIndex ];
-+ }
-+ if( bOverWriter )
-+ lcl_setTabStops( mxParaProps, aOldTabs );
-+ else
-+ lcl_setTabStops( mxParaProps, aNewTabs );
-+
-+ return uno::Reference< word::XTabStop >( new SwVbaTabStop( this, mxContext, mxParaProps, aTab ) );
-+}
-+
-+void SAL_CALL SwVbaTabStops::ClearAll() throw (uno::RuntimeException)
-+{
-+ uno::Sequence< style::TabStop > aSeq;
-+ lcl_setTabStops( mxParaProps, aSeq );
-+}
-+
-+// XEnumerationAccess
-+uno::Type
-+SwVbaTabStops::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XTabStop::static_type(0);
-+}
-+uno::Reference< container::XEnumeration >
-+SwVbaTabStops::createEnumeration() throw (uno::RuntimeException)
-+{
-+ return new TabStopsEnumWrapper( m_xIndexAccess );
-+}
-+
-+uno::Any
-+SwVbaTabStops::createCollectionObject( const css::uno::Any& aSource )
-+{
-+ return aSource;
-+}
-+
-+rtl::OUString&
-+SwVbaTabStops::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaTabStops") );
-+ return sImplName;
-+}
-+
-+css::uno::Sequence<rtl::OUString>
-+SwVbaTabStops::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.TabStops") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbatabstops.hxx sw/source/ui/vba/vbatabstops.hxx
-new file mode 100644
-index 0000000..913e12b
---- /dev/null
-+++ sw/source/ui/vba/vbatabstops.hxx
-@@ -0,0 +1,65 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_TABSTOPS_HXX
-+#define SW_VBA_TABSTOPS_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XTabStops.hpp>
-+#include <ooo/vba/word/XTabStop.hpp>
-+#include <com/sun/star/container/XEnumerationAccess.hpp>
-+#include <com/sun/star/container/XIndexAccess.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+
-+typedef CollTestImplHelper< ooo::vba::word::XTabStops > SwVbaTabStops_BASE;
-+
-+class SwVbaTabStops : public SwVbaTabStops_BASE
-+{
-+private:
-+ css::uno::Reference< css::beans::XPropertySet > mxParaProps;
-+
-+public:
-+ SwVbaTabStops( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::beans::XPropertySet >& xParaProps ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaTabStops() {}
-+
-+ // Methods
-+ virtual css::uno::Reference< ::ooo::vba::word::XTabStop > SAL_CALL Add( float Position, const css::uno::Any& Alignment, const css::uno::Any& Leader ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL ClearAll( ) 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);
-+
-+ // SwVbaTabStops_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* SW_VBA_TABSTOPS_HXX */
-diff --git sw/source/ui/vba/vbatemplate.cxx sw/source/ui/vba/vbatemplate.cxx
-index 71dc7ac..31b7ed7 100644
---- sw/source/ui/vba/vbatemplate.cxx
-+++ sw/source/ui/vba/vbatemplate.cxx
-@@ -30,12 +30,35 @@
- #include "vbaautotextentry.hxx"
- #include <comphelper/processfactory.hxx>
- #include <com/sun/star/text/XAutoTextContainer.hpp>
-+#include <tools/urlobj.hxx>
-+#include <osl/file.hxx>
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-
--SwVbaTemplate::SwVbaTemplate( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& rModel, const rtl::OUString& rName )
-- : SwVbaTemplate_BASE( rParent, rContext ), mxModel( rModel ), msName( rName )
-+String lcl_CheckGroupName( const String& rGroupName )
-+{
-+ String sRet;
-+ //group name should contain only A-Z and a-z and spaces
-+ for( xub_StrLen i = 0; i < rGroupName.Len(); i++ )
-+ {
-+ sal_Unicode cChar = rGroupName.GetChar(i);
-+ if( (cChar >= 'A' && cChar <= 'Z') ||
-+ (cChar >= 'a' && cChar <= 'z') ||
-+ (cChar >= '0' && cChar <= '9') ||
-+ cChar == '_' || cChar == 0x20 )
-+ {
-+ sRet += cChar;
-+ }
-+ }
-+ sRet.EraseLeadingChars();
-+ sRet.EraseTrailingChars();
-+ return sRet;
-+}
-+
-+
-+SwVbaTemplate::SwVbaTemplate( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& rModel, const rtl::OUString& rFullUrl )
-+ : SwVbaTemplate_BASE( rParent, rContext ), mxModel( rModel ), msFullUrl( rFullUrl )
- {
- }
-
-@@ -47,7 +70,27 @@ SwVbaTemplate::~SwVbaTemplate()
- rtl::OUString
- SwVbaTemplate::getName() throw ( css::uno::RuntimeException )
- {
-- return msName;
-+ rtl::OUString sName;
-+ if( msFullUrl.getLength() )
-+ {
-+ INetURLObject aURL( msFullUrl );
-+ ::osl::File::getSystemPathFromFileURL( aURL.GetLastName(), sName );
-+ }
-+ return sName;
-+}
-+
-+rtl::OUString
-+SwVbaTemplate::getPath() throw ( css::uno::RuntimeException )
-+{
-+ rtl::OUString sPath;
-+ if( msFullUrl.getLength() )
-+ {
-+ INetURLObject aURL( msFullUrl );
-+ rtl::OUString sURL( aURL.GetMainURL( INetURLObject::DECODE_TO_IURI ) );
-+ sURL = sURL.copy( 0, sURL.getLength() - aURL.GetLastName().getLength() - 1 );
-+ ::osl::File::getSystemPathFromFileURL( sURL, sPath );
-+ }
-+ return sPath;
- }
-
- uno::Any SAL_CALL
-@@ -58,17 +101,18 @@ SwVbaTemplate::AutoTextEntries( const uno::Any& index ) throw (uno::RuntimeExcep
-
- // the default template is "Normal.dot" in Word.
- rtl::OUString sGroup( RTL_CONSTASCII_USTRINGPARAM("Normal") );
-- sal_Int32 nIndex = msName.lastIndexOf( sal_Unicode('.') );
-+ rtl::OUString sName = getName();
-+ sal_Int32 nIndex = sName.lastIndexOf( sal_Unicode('.') );
- if( nIndex > 0 )
- {
-- sGroup = msName.copy( 0, msName.lastIndexOf( sal_Unicode('.') ) );
-- // OSL_TRACE("SwVbaTemplate::AutoTextEntries: %s", rtl::OUStringToOString( sGroup, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ sGroup = sName.copy( 0, sName.lastIndexOf( sal_Unicode('.') ) );
- }
--
-+ String sNewGroup = lcl_CheckGroupName( sGroup );
-+
- uno::Reference< container::XIndexAccess > xGroup;
-- if( xAutoTextContainer->hasByName( sGroup ) )
-+ if( xAutoTextContainer->hasByName( sNewGroup ) )
- {
-- xGroup.set( xAutoTextContainer->getByName( sGroup ), uno::UNO_QUERY_THROW );
-+ xGroup.set( xAutoTextContainer->getByName( sNewGroup ), uno::UNO_QUERY_THROW );
- }
- else
- {
-diff --git sw/source/ui/vba/vbatemplate.hxx sw/source/ui/vba/vbatemplate.hxx
-index 4e33599..0abbc36 100644
---- sw/source/ui/vba/vbatemplate.hxx
-+++ sw/source/ui/vba/vbatemplate.hxx
-@@ -36,7 +36,7 @@ class SwVbaTemplate : public SwVbaTemplate_BASE
- {
- private:
- css::uno::Reference< css::frame::XModel > mxModel;
-- rtl::OUString msName;
-+ rtl::OUString msFullUrl;
- public:
- SwVbaTemplate( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext,
- const css::uno::Reference< css::frame::XModel >& rModel, const rtl::OUString& );
-@@ -44,6 +44,7 @@ public:
-
- // XTemplate
- virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
-+ virtual rtl::OUString SAL_CALL getPath() throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL AutoTextEntries( const css::uno::Any& index ) throw (css::uno::RuntimeException);
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
-diff --git sw/source/ui/vba/vbaview.cxx sw/source/ui/vba/vbaview.cxx
-index 2cf6194..3dba711 100644
---- sw/source/ui/vba/vbaview.cxx
-+++ sw/source/ui/vba/vbaview.cxx
-@@ -92,20 +92,20 @@ SwVbaView::getSeekView() throw (css::uno::RuntimeException)
- }
- else if( aImplName.equalsAscii("SwXHeadFootText") )
- {
-- if( HeaderFooterHelper::isHeader( mxModel, xCurrentText ) )
-+ if( HeaderFooterHelper::isHeader( mxModel ) )
- {
-- if( HeaderFooterHelper::isFirstPageHeader( mxModel, xCurrentText ) )
-+ if( HeaderFooterHelper::isFirstPageHeader( mxModel ) )
- return word::WdSeekView::wdSeekFirstPageHeader;
-- else if( HeaderFooterHelper::isEvenPagesHeader( mxModel, xCurrentText ) )
-+ else if( HeaderFooterHelper::isEvenPagesHeader( mxModel ) )
- return word::WdSeekView::wdSeekEvenPagesHeader;
- else
- return word::WdSeekView::wdSeekPrimaryHeader;
- }
- else
- {
-- if( HeaderFooterHelper::isFirstPageFooter( mxModel, xCurrentText ) )
-+ if( HeaderFooterHelper::isFirstPageFooter( mxModel ) )
- return word::WdSeekView::wdSeekFirstPageFooter;
-- else if( HeaderFooterHelper::isEvenPagesFooter( mxModel, xCurrentText ) )
-+ else if( HeaderFooterHelper::isEvenPagesFooter( mxModel ) )
- return word::WdSeekView::wdSeekEvenPagesFooter;
- else
- return word::WdSeekView::wdSeekPrimaryFooter;
-@@ -132,6 +132,7 @@ SwVbaView::setSeekView( ::sal_Int32 _seekview ) throw (css::uno::RuntimeExceptio
- // if( _seekview == getSeekView() )
- // return;
-
-+ word::gotoSelectedObjectAnchor( mxModel );
- switch( _seekview )
- {
- case word::WdSeekView::wdSeekFirstPageFooter:
-@@ -181,7 +182,7 @@ SwVbaView::setSeekView( ::sal_Int32 _seekview ) throw (css::uno::RuntimeExceptio
- {
- uno::Reference< text::XTextDocument > xTextDocument( mxModel, uno::UNO_QUERY_THROW );
- uno::Reference< text::XText > xText = xTextDocument->getText();
-- mxViewCursor->gotoRange( getFirstObjectPosition( xText ), sal_False );
-+ mxViewCursor->gotoRange( word::getFirstObjectPosition( xText ), sal_False );
- break;
- }
- }
-@@ -376,28 +377,7 @@ uno::Reference< text::XTextRange > SwVbaView::getHFTextRange( sal_Int32 nType )
- {
- DebugHelper::exception( SbERR_INTERNAL_ERROR, rtl::OUString() );
- }
-- uno::Reference< text::XTextRange > xTextRange = getFirstObjectPosition( xText );
-- return xTextRange;
--}
--
--uno::Reference< text::XTextRange > SwVbaView::getFirstObjectPosition( const uno::Reference< text::XText >& xText ) throw (uno::RuntimeException)
--{
-- // if the first object is table, get the position of first cell
-- uno::Reference< text::XTextRange > xTextRange;
-- uno::Reference< container::XEnumerationAccess > xParaAccess( xText, uno::UNO_QUERY_THROW );
-- uno::Reference< container::XEnumeration> xParaEnum = xParaAccess->createEnumeration();
-- if( xParaEnum->hasMoreElements() )
-- {
-- uno::Reference< lang::XServiceInfo > xServiceInfo( xParaEnum->nextElement(), uno::UNO_QUERY_THROW );
-- if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextTable") ) ) )
-- {
-- uno::Reference< table::XCellRange > xCellRange( xServiceInfo, uno::UNO_QUERY_THROW );
-- uno::Reference< text::XText> xFirstCellText( xCellRange->getCellByPosition(0, 0), uno::UNO_QUERY_THROW );
-- xTextRange = xFirstCellText->getStart();
-- }
-- }
-- if( !xTextRange.is() )
-- xTextRange = xText->getStart();
-+ uno::Reference< text::XTextRange > xTextRange = word::getFirstObjectPosition( xText );
- return xTextRange;
- }
-
-diff --git sw/source/ui/vba/vbawindow.cxx sw/source/ui/vba/vbawindow.cxx
-index dc5913a..687868d 100644
---- sw/source/ui/vba/vbawindow.cxx
-+++ sw/source/ui/vba/vbawindow.cxx
-@@ -25,12 +25,21 @@
- *
- ************************************************************************/
- #include <vbahelper/helperdecl.hxx>
-+#include <ooo/vba/word/WdWindowState.hpp>
-+#include <vcl/wrkwin.hxx>
-+
- #include "vbawindow.hxx"
- #include "vbaglobals.hxx"
- #include "vbadocument.hxx"
- #include "vbaview.hxx"
- #include "vbapanes.hxx"
- #include "vbapane.hxx"
-+#include "wordvbahelper.hxx"
-+#include <view.hxx>
-+// #FIXME where has SfxTopViewFrame gone
-+#if 0
-+#include <sfx2/topfrm.hxx>
-+#endif
-
- using namespace ::com::sun::star;
- using namespace ::ooo::vba;
-@@ -73,6 +82,44 @@ void SAL_CALL SwVbaWindow::setView( const uno::Any& _view ) throw (uno::RuntimeE
- }
-
- uno::Any SAL_CALL
-+SwVbaWindow::getWindowState() throw (uno::RuntimeException)
-+{
-+ sal_Int32 nwindowState = word::WdWindowState::wdWindowStateNormal;
-+ SwView* pView = word::getView( m_xModel );
-+ SfxViewFrame* pViewFrame = pView -> GetViewFrame();
-+ WorkWindow* pWork = (WorkWindow*) pViewFrame->GetFrame().GetSystemWindow();
-+ if ( pWork )
-+ {
-+ if ( pWork -> IsMaximized())
-+ nwindowState = word::WdWindowState::wdWindowStateMaximize;
-+ else if (pWork -> IsMinimized())
-+ nwindowState = word::WdWindowState::wdWindowStateMinimize;
-+ }
-+ return uno::makeAny( nwindowState );
-+}
-+
-+void SAL_CALL
-+SwVbaWindow::setWindowState( const uno::Any& _windowstate ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nwindowState = word::WdWindowState::wdWindowStateMaximize;
-+ _windowstate >>= nwindowState;
-+ SwView* pView = word::getView( m_xModel );
-+ SfxViewFrame* pViewFrame = pView -> GetViewFrame();
-+ WorkWindow* pWork = (WorkWindow*) pViewFrame->GetFrame().GetSystemWindow();
-+ if ( pWork )
-+ {
-+ if ( nwindowState == word::WdWindowState::wdWindowStateMaximize )
-+ pWork -> Maximize();
-+ else if (nwindowState == word::WdWindowState::wdWindowStateMinimize)
-+ pWork -> Minimize();
-+ else if (nwindowState == word::WdWindowState::wdWindowStateNormal)
-+ pWork -> Restore();
-+ else
-+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Invalid Parameter" ) ), uno::Reference< uno::XInterface >() );
-+ }
-+}
-+
-+uno::Any SAL_CALL
- SwVbaWindow::Panes( const uno::Any& aIndex ) throw (uno::RuntimeException)
- {
- uno::Reference< XCollection > xPanes( new SwVbaPanes( this, mxContext, m_xModel ) );
-diff --git sw/source/ui/vba/vbawindow.hxx sw/source/ui/vba/vbawindow.hxx
-index 1ef1ff9..a5e03e9 100644
---- sw/source/ui/vba/vbawindow.hxx
-+++ sw/source/ui/vba/vbawindow.hxx
-@@ -44,6 +44,8 @@ public:
- // Attributes
- 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 css::uno::Any SAL_CALL getWindowState() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setWindowState( const css::uno::Any& _windowstate ) throw (css::uno::RuntimeException);
- // Methods
- virtual void SAL_CALL Activate( ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Close( const css::uno::Any& SaveChanges, const css::uno::Any& RouteDocument ) throw (css::uno::RuntimeException);
-diff --git sw/source/ui/vba/wordvbahelper.cxx sw/source/ui/vba/wordvbahelper.cxx
-index e489b0b..281eb70 100644
---- sw/source/ui/vba/wordvbahelper.cxx
-+++ sw/source/ui/vba/wordvbahelper.cxx
-@@ -29,11 +29,16 @@
- #include <comphelper/processfactory.hxx>
- #include <com/sun/star/frame/XController.hpp>
- #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
-+#include <com/sun/star/text/XTextTable.hpp>
-+#include <com/sun/star/table/XCellRange.hpp>
- #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
- #include <com/sun/star/container/XNameAccess.hpp>
-+#include <com/sun/star/container/XIndexAccess.hpp>
- #include <com/sun/star/lang/XUnoTunnel.hpp>
-+#include <com/sun/star/view/XSelectionSupplier.hpp>
- #include <unotxdoc.hxx>
- #include <doc.hxx>
-+#include <view.hxx>
-
- using namespace ::com::sun::star;
- using namespace ::ooo::vba;
-@@ -71,8 +76,13 @@ uno::Reference< text::XTextViewCursor > getXTextViewCursor( const uno::Reference
- uno::Reference< style::XStyle > getCurrentPageStyle( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
- {
- uno::Reference< beans::XPropertySet > xCursorProps( getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
-+ return getCurrentPageStyle( xModel, xCursorProps );
-+}
-+
-+uno::Reference< style::XStyle > getCurrentPageStyle( const uno::Reference< frame::XModel >& xModel, const uno::Reference< beans::XPropertySet >& xProps ) throw (uno::RuntimeException)
-+{
- rtl::OUString aPageStyleName;
-- xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyleName"))) >>= aPageStyleName;
-+ xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyleName"))) >>= aPageStyleName;
- uno::Reference< style::XStyleFamiliesSupplier > xSytleFamSupp( xModel, uno::UNO_QUERY_THROW );
- uno::Reference< container::XNameAccess > xSytleFamNames( xSytleFamSupp->getStyleFamilies(), uno::UNO_QUERY_THROW );
- uno::Reference< container::XNameAccess > xPageStyles( xSytleFamNames->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyles") ) ), uno::UNO_QUERY_THROW );
-@@ -87,6 +97,92 @@ sal_Int32 getPageCount( const uno::Reference< frame::XModel>& xModel ) throw (un
- return pDocShell ? pDocShell->GetDoc()->GetPageCount() : 0;
- }
-
-+uno::Reference< style::XStyle > getDefaultParagraphStyle( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< style::XStyleFamiliesSupplier > xSytleFamSupp( xModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XNameAccess > xSytleFamNames( xSytleFamSupp->getStyleFamilies(), uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XNameAccess > xParaStyles( xSytleFamNames->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParagraphStyles") ) ), uno::UNO_QUERY_THROW );
-+ uno::Reference< style::XStyle > xStyle( xParaStyles->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Standard") ) ), uno::UNO_QUERY_THROW );
-+
-+ return xStyle;
-+}
-+
-+uno::Reference< text::XTextRange > getFirstObjectPosition( const uno::Reference< text::XText >& xText ) throw (uno::RuntimeException)
-+{
-+ // if the first object is table, get the position of first cell
-+ uno::Reference< text::XTextRange > xTextRange;
-+ uno::Reference< container::XEnumerationAccess > xParaAccess( xText, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XEnumeration> xParaEnum = xParaAccess->createEnumeration();
-+ if( xParaEnum->hasMoreElements() )
-+ {
-+ uno::Reference< lang::XServiceInfo > xServiceInfo( xParaEnum->nextElement(), uno::UNO_QUERY_THROW );
-+ if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextTable") ) ) )
-+ {
-+ uno::Reference< table::XCellRange > xCellRange( xServiceInfo, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XText> xFirstCellText( xCellRange->getCellByPosition(0, 0), uno::UNO_QUERY_THROW );
-+ xTextRange = xFirstCellText->getStart();
-+ }
-+ }
-+ if( !xTextRange.is() )
-+ xTextRange = xText->getStart();
-+ return xTextRange;
-+}
-+
-+uno::Reference< text::XText > getCurrentXText( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< text::XTextRange > xTextRange;
-+ uno::Reference< text::XTextContent > xTextContent( xModel->getCurrentSelection(), uno::UNO_QUERY );
-+ if( !xTextContent.is() )
-+ {
-+ uno::Reference< container::XIndexAccess > xIndexAccess( xModel->getCurrentSelection(), uno::UNO_QUERY );
-+ if( xIndexAccess.is() )
-+ {
-+ xTextContent.set( xIndexAccess->getByIndex(0), uno::UNO_QUERY );
-+ }
-+ }
-+
-+ if( xTextContent.is() )
-+ xTextRange.set( xTextContent->getAnchor(), uno::UNO_QUERY );
-+
-+ if( !xTextRange.is() )
-+ xTextRange.set( getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
-+
-+ uno::Reference< text::XText > xText;
-+ try
-+ {
-+ xText.set( xTextRange->getText(), uno::UNO_QUERY );
-+ }
-+ catch( uno::RuntimeException& )
-+ {
-+ //catch exception "no text selection"
-+ }
-+ uno::Reference< beans::XPropertySet > xVCProps( xTextRange, uno::UNO_QUERY_THROW );
-+ while( xVCProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ) >>= xTextContent )
-+ {
-+ xText = xTextContent->getAnchor()->getText();
-+ xVCProps.set( xText->createTextCursor(), uno::UNO_QUERY_THROW );
-+ }
-+
-+ if( !xText.is() )
-+ throw uno::RuntimeException( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), uno::Reference< uno::XInterface >() );
-+
-+ return xText;
-+}
-+
-+sal_Bool gotoSelectedObjectAnchor( const uno::Reference< frame::XModel>& xModel ) throw (uno::RuntimeException)
-+{
-+ sal_Bool isObjectSelected = sal_False;
-+ uno::Reference< text::XTextContent > xTextContent( xModel->getCurrentSelection(), uno::UNO_QUERY );
-+ if( xTextContent.is() )
-+ {
-+ uno::Reference< text::XTextRange > xTextRange( xTextContent->getAnchor(), uno::UNO_QUERY_THROW );
-+ uno::Reference< view::XSelectionSupplier > xSelectSupp( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
-+ xSelectSupp->select( uno::makeAny( xTextRange ) );
-+ isObjectSelected = sal_True;
-+ }
-+ return isObjectSelected;
-+}
-+
- } // word
- } //
- } //
-diff --git sw/source/ui/vba/wordvbahelper.hxx sw/source/ui/vba/wordvbahelper.hxx
-index 489cf25..47d718e 100644
---- sw/source/ui/vba/wordvbahelper.hxx
-+++ sw/source/ui/vba/wordvbahelper.hxx
-@@ -32,6 +32,8 @@
- #include <com/sun/star/text/XTextViewCursor.hpp>
- #include <com/sun/star/text/XPageCursor.hpp>
- #include <com/sun/star/style/XStyle.hpp>
-+#include <com/sun/star/text/XTextTable.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-
- class SwDocShell;
- class SwView;
-@@ -46,7 +48,20 @@ namespace ooo
- SwView* getView( const css::uno::Reference< css::frame::XModel>& xModel );
- css::uno::Reference< css::text::XTextViewCursor > getXTextViewCursor( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
- css::uno::Reference< css::style::XStyle > getCurrentPageStyle( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
-+ css::uno::Reference< css::style::XStyle > getCurrentPageStyle( const css::uno::Reference< css::frame::XModel>& xModel, const css::uno::Reference< css::beans::XPropertySet >& xProps ) throw (css::uno::RuntimeException);
- sal_Int32 getPageCount( const css::uno::Reference< css::frame::XModel>& xModel ) throw (css::uno::RuntimeException);
-+ css::uno::Reference< css::style::XStyle > getDefaultParagraphStyle( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
-+ css::uno::Reference< css::text::XTextRange > getFirstObjectPosition( const css::uno::Reference< css::text::XText >& xText ) throw (css::uno::RuntimeException);
-+ css::uno::Reference< css::text::XText > getCurrentXText( const css::uno::Reference< css::frame::XModel>& xModel ) throw (css::uno::RuntimeException);
-+ sal_Bool gotoSelectedObjectAnchor( const css::uno::Reference< css::frame::XModel>& xModel ) throw (css::uno::RuntimeException);
-+
-+ enum E_DIRECTION
-+ {
-+ MOVE_LEFT = 1,
-+ MOVE_RIGHT,
-+ MOVE_UP,
-+ MOVE_DOWN
-+ };
-
- } // word
- } // vba
-diff --git sw/util/makefile.mk sw/util/makefile.mk
-index ce1419b..3993ad0 100644
---- sw/util/makefile.mk
-+++ sw/util/makefile.mk
-@@ -335,6 +335,7 @@ SHL4STDLIBS= \
- $(SALLIB) \
- $(ICUUCLIB) \
- $(BASICLIB) \
-+ $(MSFILTERLIB) \
- $(I18NUTILLIB)
-
- .IF "$(ENABLE_VBA)" == "YES"
-@@ -369,6 +371,10 @@ SHL5STDLIBS= \
- $(SVXCORELIB) \
- $(MSFILTERLIB)
-
-+.IF "$(GUI)"=="WNT"
-+SHL5STDLIBS+=$(SHELLLIB)
-+.ENDIF #WNT
-+
- SHL5DEPN=$(SHL1TARGETN)
- SHL5LIBS=$(SLB)$/$(TARGET_VBA).lib
- .ENDIF # .IF "$(ENABLE_VBA)" == "YES"
-diff --git toolkit/inc/toolkit/awt/vclxmenu.hxx toolkit/inc/toolkit/awt/vclxmenu.hxx
-index 9fefbe9..88be605 100644
---- toolkit/inc/toolkit/awt/vclxmenu.hxx
-+++ toolkit/inc/toolkit/awt/vclxmenu.hxx
-@@ -45,6 +45,7 @@
- class Menu;
- class MenuBar;
- class VclSimpleEvent;
-+class PopupMenu;
-
- DECLARE_LIST( PopupMenuRefList, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >* )
-
-@@ -181,6 +182,7 @@ class TOOLKIT_DLLPUBLIC VCLXPopupMenu : public VCLXMenu
- {
- public:
- VCLXPopupMenu();
-+ VCLXPopupMenu( PopupMenu* pPopMenu );
- };
-
- #endif // _TOOLKIT_AWT_VCLXMENU_HXX_
-diff --git toolkit/inc/toolkit/awt/vclxwindows.hxx toolkit/inc/toolkit/awt/vclxwindows.hxx
-index 8c286bd..b32f7ec 100644
---- toolkit/inc/toolkit/awt/vclxwindows.hxx
-+++ toolkit/inc/toolkit/awt/vclxwindows.hxx
-@@ -94,6 +94,7 @@
- #include <vcl/pointr.hxx>
- #include <vcl/image.hxx>
-
-+#include <com/sun/star/document/XVbaMethodParameter.hpp> //liuchen 2009-6-22, add the support of input/output parameters to VBA Dialog_QueryClose event
- class Button;
- class CheckBox;
- class RadioButton;
-@@ -378,6 +379,7 @@ public:
- // class VCLXDialog
- // ----------------------------------------------------
- class VCLXDialog : public ::com::sun::star::awt::XDialog2,
-+ public ::com::sun::star::document::XVbaMethodParameter, //liuchen 2009-6-22, add the support of input/output parameters to VBA UserForm_QueryClose event
- public VCLXTopWindow
- {
- public:
-@@ -415,6 +417,10 @@ public:
- // ::com::sun::star::awt::XVclWindowPeer
- void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
-
-+ //liuchen 2009-6-23, support Excel VBA UserForm_QueryClose event
-+ // ::com::sun::star::document::XVBAMethodParameter
-+ void SAL_CALL setVbaMethodParameter( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
-+ ::com::sun::star::uno::Any SAL_CALL getVbaMethodParameter( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
- };
-
- // ----------------------------------------------------
-diff --git toolkit/inc/toolkit/controls/dialogcontrol.hxx toolkit/inc/toolkit/controls/dialogcontrol.hxx
-index 7b8e025..a1725f2 100644
---- toolkit/inc/toolkit/controls/dialogcontrol.hxx
-+++ toolkit/inc/toolkit/controls/dialogcontrol.hxx
-@@ -48,6 +48,8 @@
- #include <cppuhelper/propshlp.hxx>
- #include <cppuhelper/basemutex.hxx>
- #include <list>
-+#include <map>
-+#include <com/sun/star/graphic/XGraphicObject.hpp>
-
- // ----------------------------------------------------
- // class UnoControlDialogModel
-@@ -88,7 +90,9 @@ private:
-
- AllGroups maGroups;
- sal_Bool mbGroupsUpToDate;
--
-+
-+ ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicObject > mxGrfObj;
-+ bool mbAdjustingGraphic;
- protected:
- ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
- ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
-@@ -175,10 +179,20 @@ public:
- protected:
- void startControlListening( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxChildModel );
- void stopControlListening( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxChildModel );
-+ // ::cppu::OPropertySetHelper
-+ void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception);
-
- void implNotifyTabModelChange( const ::rtl::OUString& _rAccessor );
-
- void implUpdateGroupStructure();
-+private:
-+ void AddRadioButtonToGroup (
-+ const ::com::sun::star::uno::Reference< XControlModel >& rControlModel,
-+ const ::rtl::OUString& rPropertyName,
-+ ::std::map< ::rtl::OUString, ModelGroup >& pNamedGroups,
-+ ModelGroup*& rpCurrentGroup );
-+ void AddRadioButtonGroup (
-+ ::std::map< ::rtl::OUString, ModelGroup >& pNamedGroups );
- };
-
- // ----------------------------------------------------
-diff --git toolkit/inc/toolkit/controls/unocontrols.hxx toolkit/inc/toolkit/controls/unocontrols.hxx
-index 7f0e9cb..c3d1de0 100644
---- toolkit/inc/toolkit/controls/unocontrols.hxx
-+++ toolkit/inc/toolkit/controls/unocontrols.hxx
-@@ -223,7 +223,6 @@ private:
- bool mbAdjustingGraphic;
-
- ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicObject > mxGrfObj;
-- ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL );
-
- protected:
- GraphicControlModel() : mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ) { }
-@@ -637,6 +636,44 @@ public:
-
- };
-
-+class UnoMultiPageModel : public UnoControlModel
-+{
-+protected:
-+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
-+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
-+
-+public:
-+ UnoMultiPageModel();
-+ UnoMultiPageModel( const UnoMultiPageModel& rModel ) : UnoControlModel( rModel ) {;}
-+
-+ UnoControlModel* Clone() const { return new UnoMultiPageModel( *this ); }
-+
-+ // ::com::sun::star::io::XPersistObject
-+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
-+
-+ // ::com::sun::star::beans::XMultiPropertySet
-+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
-+
-+ // ::com::sun::star::lang::XServiceInfo
-+ DECLIMPL_SERVICEINFO_DERIVED( UnoMultiPageModel, UnoControlModel, szServiceName_UnoMultiPageModel )
-+
-+};
-+// ----------------------------------------------------
-+// class UnoGroupBoxControl
-+// ----------------------------------------------------
-+class UnoMultiPageControl : public UnoControlBase
-+{
-+public:
-+ UnoMultiPageControl();
-+ ::rtl::OUString GetComponentServiceName();
-+
-+ sal_Bool SAL_CALL isTransparent( ) throw(::com::sun::star::uno::RuntimeException);
-+
-+ // ::com::sun::star::lang::XServiceInfo
-+ DECLIMPL_SERVICEINFO_DERIVED( UnoMultiPageControl, UnoControlBase, szServiceName_UnoMultiPageControl )
-+
-+};
-+
- // ----------------------------------------------------
- // class UnoFixedTextControl
- // ----------------------------------------------------
-diff --git toolkit/inc/toolkit/helper/property.hxx toolkit/inc/toolkit/helper/property.hxx
-index 2fb64b2..3c8e4a1 100644
---- toolkit/inc/toolkit/helper/property.hxx
-+++ toolkit/inc/toolkit/helper/property.hxx
-@@ -195,6 +195,7 @@ namespace rtl {
- #define BASEPROPERTY_GRID_SELECTIONMODE 144
- #define BASEPROPERTY_ENABLEVISIBLE 145 // sal_Bool
- #define BASEPROPERTY_REFERENCE_DEVICE 146
-+
- #define BASEPROPERTY_HIGHCONTRASTMODE 147
- #define BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND 148
- #define BASEPROPERTY_GRID_HEADER_BACKGROUND 149
-@@ -202,6 +203,8 @@ namespace rtl {
- #define BASEPROPERTY_GRID_ROW_BACKGROUND 151
- #define BASEPROPERTY_MULTISELECTION_SIMPLEMODE 152
- #define BASEPROPERTY_ITEM_SEPARATOR_POS 153
-+#define BASEPROPERTY_GROUPNAME 154 // ::rtl::OUString
-+#define BASEPROPERTY_VBAFORM 155 // sal_Bool
-
-
- // Keine gebundenen Properties, werden immer aus der Property BASEPROPERTY_FONTDESCRIPTOR entnommen.
-diff --git toolkit/inc/toolkit/helper/servicenames.hxx toolkit/inc/toolkit/helper/servicenames.hxx
-index 91ece3a..374373b 100644
---- toolkit/inc/toolkit/helper/servicenames.hxx
-+++ toolkit/inc/toolkit/helper/servicenames.hxx
-@@ -37,6 +37,8 @@ extern const sal_Char __FAR_DATA szServiceName_PopupMenu[], szServiceName2_Popup
- extern const sal_Char __FAR_DATA szServiceName_MenuBar[], szServiceName2_MenuBar[];
- extern const sal_Char __FAR_DATA szServiceName_Pointer[], szServiceName2_Pointer[];
- extern const sal_Char __FAR_DATA szServiceName_UnoControlContainer[], szServiceName2_UnoControlContainer[];
-+extern const sal_Char __FAR_DATA szServiceName_UnoMultiPageControl[], szServiceName2_UnoMultiPageControl[];
-+extern const sal_Char __FAR_DATA szServiceName_UnoMultiPageModel[], szServiceName2_UnoMultiPageModel[];
- extern const sal_Char __FAR_DATA szServiceName_UnoControlContainerModel[], szServiceName2_UnoControlContainerModel[];
- extern const sal_Char __FAR_DATA szServiceName_TabController[], szServiceName2_TabController[];
- extern const sal_Char __FAR_DATA szServiceName_TabControllerModel[], szServiceName2_TabControllerModel[];
-diff --git toolkit/source/awt/vclxmenu.cxx toolkit/source/awt/vclxmenu.cxx
-index c6294c8..eb5cb3b 100644
---- toolkit/source/awt/vclxmenu.cxx
-+++ toolkit/source/awt/vclxmenu.cxx
-@@ -539,6 +539,14 @@ void VCLXMenu::setPopupMenu( sal_Int16 nItemId, const ::com::sun::star::uno::Ref
- break;
- }
- }
-+ // it seems the popup menu is not insert into maPopupMenueRefs
-+ // if the popup men is not created by stardiv.Toolkit.VCLXPopupMenu
-+ if( !aRef.is() )
-+ {
-+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > * pNewRef = new ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > ;
-+ *pNewRef = new VCLXPopupMenu( (PopupMenu*)pMenu );
-+ aRef = *pNewRef;
-+ }
- }
- return aRef;
- }
-@@ -1101,3 +1109,8 @@ VCLXPopupMenu::VCLXPopupMenu()
- DBG_CTOR( VCLXPopupMenu, 0 );
- ImplCreateMenu( TRUE );
- }
-+
-+VCLXPopupMenu::VCLXPopupMenu( PopupMenu* pPopMenu ) : VCLXMenu( (Menu *)pPopMenu )
-+{
-+ DBG_CTOR( VCLXPopupMenu, 0 );
-+}
-diff --git toolkit/source/awt/vclxwindows.cxx toolkit/source/awt/vclxwindows.cxx
-index 5c7c319..1e1aa1d 100644
---- toolkit/source/awt/vclxwindows.cxx
-+++ toolkit/source/awt/vclxwindows.cxx
-@@ -1082,6 +1082,7 @@ void VCLXRadioButton::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
- BASEPROPERTY_WRITING_MODE,
- BASEPROPERTY_CONTEXT_WRITING_MODE,
- BASEPROPERTY_REFERENCE_DEVICE,
-+ BASEPROPERTY_GROUPNAME,
- 0);
- VCLXGraphicControl::ImplGetPropertyIds( rIds );
- }
-@@ -2303,6 +2304,7 @@ VCLXDialog::~VCLXDialog()
- ::com::sun::star::uno::Any VCLXDialog::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
- {
- ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
-+ SAL_STATIC_CAST( ::com::sun::star::document::XVbaMethodParameter*, this ), //liuchen 2009-6-23
- SAL_STATIC_CAST( ::com::sun::star::awt::XDialog2*, this ),
- SAL_STATIC_CAST( ::com::sun::star::awt::XDialog*, this ) );
- return (aRet.hasValue() ? aRet : VCLXTopWindow::queryInterface( rType ));
-@@ -2310,6 +2312,7 @@ VCLXDialog::~VCLXDialog()
-
- // ::com::sun::star::lang::XTypeProvider
- IMPL_XTYPEPROVIDER_START( VCLXDialog )
-+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::document::XVbaMethodParameter>* ) NULL ), //liuchen 2009-6-23
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDialog2>* ) NULL ),
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDialog>* ) NULL ),
- VCLXTopWindow::getTypes()
-@@ -2412,6 +2415,40 @@ void SAL_CALL VCLXDialog::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::s
- return aInfo;
- }
-
-+//liuchen 2009-7-22
-+// ::com::sun::star::document::XVbaMethodParameter
-+void SAL_CALL VCLXDialog::setVbaMethodParameter(
-+ const ::rtl::OUString& PropertyName,
-+ const ::com::sun::star::uno::Any& Value )
-+throw(::com::sun::star::uno::RuntimeException)
-+{
-+ if (rtl::OUString::createFromAscii( "Cancel" ) == PropertyName)
-+ {
-+ ::vos::OGuard aGuard( GetMutex() );
-+ if ( GetWindow() )
-+ {
-+ sal_Int8 nCancel;
-+ Value >>= nCancel;
-+
-+ Dialog* pDlg = (Dialog*) GetWindow();
-+ pDlg->SetCloseFlag(nCancel);
-+ }
-+ }
-+}
-+
-+::com::sun::star::uno::Any SAL_CALL VCLXDialog::getVbaMethodParameter(
-+ const ::rtl::OUString& PropertyName )
-+throw(::com::sun::star::uno::RuntimeException)
-+{
-+ ::vos::OGuard aGuard( GetMutex() );
-+
-+ ::com::sun::star::uno::Any aRet;
-+ return aRet;
-+}
-+//liuchen 2009-7-22
-+
-+
-+
-
- void SAL_CALL VCLXDialog::setProperty(
- const ::rtl::OUString& PropertyName,
-diff --git toolkit/source/controls/dialogcontrol.cxx toolkit/source/controls/dialogcontrol.cxx
-index 7f23b49..1fe21d2 100644
---- toolkit/source/controls/dialogcontrol.cxx
-+++ toolkit/source/controls/dialogcontrol.cxx
-@@ -81,6 +81,7 @@ using namespace ::com::sun::star::lang;
- using namespace ::com::sun::star::container;
- using namespace ::com::sun::star::beans;
- using namespace ::com::sun::star::util;
-+using namespace ::com::sun::star::script;
- using namespace toolkit;
-
- #define PROPERTY_RESOURCERESOLVER ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ))
-@@ -91,6 +92,8 @@ using namespace toolkit;
- //HELPER
- ::rtl::OUString getPhysicalLocation( const ::com::sun::star::uno::Any& rbase, const ::com::sun::star::uno::Any& rUrl );
-
-+uno::Reference< graphic::XGraphic > getGraphicFromURL_nothrow( uno::Reference< graphic::XGraphicObject >& rxGrfObj, const ::rtl::OUString& _rURL );
-+
- struct LanguageDependentProp
- {
- const char* pPropName;
-@@ -116,7 +119,7 @@ namespace
- }
- return s_aLanguageDependentProperties;
- }
--
-+
- static uno::Reference< graphic::XGraphic > lcl_getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL )
- {
- uno::Reference< graphic::XGraphic > xGraphic;
-@@ -143,6 +146,18 @@ namespace
- return xGraphic;
- }
-
-+ static ::rtl::OUString lcl_GetStringProperty( const ::rtl::OUString& sProperty, const Reference< XPropertySet >& xSet )
-+ {
-+ ::rtl::OUString sValue;
-+ Reference< XPropertySetInfo > xPSI;
-+ if (xSet.is() && (xPSI = xSet->getPropertySetInfo()).is() &&
-+ xPSI->hasPropertyByName( sProperty ) )
-+ {
-+ xSet->getPropertyValue( sProperty ) >>= sValue;
-+ }
-+ return sValue;
-+ }
-+
- }
-
- // ----------------------------------------------------------------------------
-@@ -254,7 +269,7 @@ static const ::rtl::OUString& getStepPropertyName( )
- UnoControlDialogModel::UnoControlDialogModel()
- :maContainerListeners( *this )
- ,maChangeListeners ( GetMutex() )
-- ,mbGroupsUpToDate( sal_False )
-+ ,mbGroupsUpToDate( sal_False ), mbAdjustingGraphic( false )
- {
- ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
- // ImplRegisterProperty( BASEPROPERTY_BORDER );
-@@ -276,6 +291,8 @@ UnoControlDialogModel::UnoControlDialogModel()
- aBool <<= (sal_Bool) sal_True;
- ImplRegisterProperty( BASEPROPERTY_MOVEABLE, aBool );
- ImplRegisterProperty( BASEPROPERTY_CLOSEABLE, aBool );
-+ aBool <<= (sal_Bool) sal_False;
-+ ImplRegisterProperty( BASEPROPERTY_VBAFORM, aBool );
- }
-
- UnoControlDialogModel::UnoControlDialogModel( const UnoControlDialogModel& rModel )
-@@ -283,7 +300,7 @@ UnoControlDialogModel::UnoControlDialogModel( const UnoControlDialogModel& rMode
- , UnoControlDialogModel_Base( rModel )
- , maContainerListeners( *this )
- , maChangeListeners ( GetMutex() )
-- , mbGroupsUpToDate( sal_False )
-+ , mbGroupsUpToDate( sal_False ), mbAdjustingGraphic( false )
- {
- }
-
-@@ -314,6 +331,40 @@ Sequence< Type > UnoControlDialogModel::getTypes() throw(RuntimeException)
- return ::rtl::OUString::createFromAscii( szServiceName_UnoControlDialogModel );
- }
-
-+void SAL_CALL UnoControlDialogModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception)
-+{
-+ UnoControlModel::setFastPropertyValue_NoBroadcast( nHandle, rValue );
-+ try
-+ {
-+ switch ( nHandle )
-+ {
-+ case BASEPROPERTY_IMAGEURL:
-+ if ( !mbAdjustingGraphic && ImplHasProperty( BASEPROPERTY_GRAPHIC ) )
-+ {
-+ mbAdjustingGraphic = true;
-+ ::rtl::OUString sImageURL;
-+ OSL_VERIFY( rValue >>= sImageURL );
-+ setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( getGraphicFromURL_nothrow( mxGrfObj, sImageURL ) ) );
-+ mbAdjustingGraphic = false;
-+ }
-+ break;
-+
-+ case BASEPROPERTY_GRAPHIC:
-+ if ( !mbAdjustingGraphic && ImplHasProperty( BASEPROPERTY_IMAGEURL ) )
-+ {
-+ mbAdjustingGraphic = true;
-+ setPropertyValue( GetPropertyName( BASEPROPERTY_IMAGEURL ), uno::makeAny( ::rtl::OUString() ) );
-+ mbAdjustingGraphic = false;
-+ }
-+ break;
-+ }
-+ }
-+ catch( const ::com::sun::star::uno::Exception& )
-+ {
-+ OSL_ENSURE( sal_False, "UnoControlDialogModel::setFastPropertyValue_NoBroadcast: caught an exception while setting Graphic/ImageURL properties!" );
-+ }
-+}
-+
- Any UnoControlDialogModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
- {
- Any aAny;
-@@ -906,6 +957,63 @@ void UnoControlDialogModel::implNotifyTabModelChange( const ::rtl::OUString& _rA
- }
- }
-
-+// ----------------------------------------------------------------------------
-+void UnoControlDialogModel::AddRadioButtonGroup (
-+ ::std::map< ::rtl::OUString, ModelGroup >& rNamedGroups )
-+{
-+ if ( rNamedGroups.size() == 0 )
-+ return;
-+
-+ size_t nGroups = maGroups.size();
-+ maGroups.reserve( nGroups + rNamedGroups.size() );
-+ ::std::map< ::rtl::OUString, ModelGroup >::const_iterator i = rNamedGroups.begin(), e = rNamedGroups.end();
-+ for( ; i != e; ++i)
-+ {
-+ maGroups.push_back( i->second );
-+ }
-+
-+ rNamedGroups.clear();
-+}
-+
-+void UnoControlDialogModel::AddRadioButtonToGroup (
-+ const Reference< XControlModel >& rControlModel,
-+ const ::rtl::OUString& rPropertyName,
-+ ::std::map< ::rtl::OUString, ModelGroup >& rNamedGroups,
-+ ModelGroup*& rpCurrentGroup )
-+{
-+ Reference< XPropertySet > xCurProps( rControlModel, UNO_QUERY );
-+ ::rtl::OUString sGroup = lcl_GetStringProperty( rPropertyName, xCurProps );
-+ const sal_Int32 nControlModelStep = lcl_getDialogStep( rControlModel );
-+
-+ if ( sGroup.getLength() == 0 )
-+ {
-+ // Create a new group if:
-+ if ( maGroups.size() == 0 || // no groups
-+ rpCurrentGroup == NULL || // previous group was closed
-+ (nControlModelStep != 0 && // control step matches current group
-+ maGroups.back().size() > 0 && // (group 0 == display everywhere)
-+ nControlModelStep != lcl_getDialogStep( maGroups.back().back() ) ) )
-+ {
-+ size_t nGroups = maGroups.size();
-+ maGroups.resize( nGroups + 1 );
-+ }
-+ rpCurrentGroup = &maGroups.back();
-+ }
-+ else
-+ {
-+ // Different steps get different sets of named groups
-+ if ( rNamedGroups.size() > 0 &&
-+ rNamedGroups.begin()->second.size() > 0 )
-+ {
-+ const sal_Int32 nPrevStep = lcl_getDialogStep( rNamedGroups.begin()->second.front() );
-+ if ( nControlModelStep != nPrevStep )
-+ AddRadioButtonGroup( rNamedGroups );
-+ }
-+
-+ rpCurrentGroup = &rNamedGroups[ sGroup ];
-+ }
-+ rpCurrentGroup->push_back( rControlModel );
-+}
-
- // ----------------------------------------------------------------------------
- void UnoControlDialogModel::implUpdateGroupStructure()
-@@ -930,10 +1038,13 @@ void UnoControlDialogModel::implUpdateGroupStructure()
-
- GroupingMachineState eState = eLookingForGroup; // the current state of our machine
- Reference< XServiceInfo > xModelSI; // for checking for a radion button
-- AllGroups::iterator aCurrentGroup = maGroups.end(); // the group which we're currently building
-- sal_Int32 nCurrentGroupStep = -1; // the step which all controls of the current group belong to
-+ ModelGroup* aCurrentGroup = NULL; // the group which we're currently building
- sal_Bool bIsRadioButton; // is it a radio button?
-
-+ const ::rtl::OUString GROUP_NAME( RTL_CONSTASCII_USTRINGPARAM( "GroupName" ) );
-+
-+ ::std::map< ::rtl::OUString, ModelGroup > aNamedGroups;
-+
- #if OSL_DEBUG_LEVEL > 1
- ::std::vector< ::rtl::OUString > aCurrentGroupLabels;
- #endif
-@@ -954,14 +1065,8 @@ void UnoControlDialogModel::implUpdateGroupStructure()
- // the current model is a radio button
- // -> we found the beginning of a new group
- // create the place for this group
-- size_t nGroups = maGroups.size();
-- maGroups.resize( nGroups + 1 );
-- aCurrentGroup = maGroups.begin() + nGroups;
-- // and add the (only, til now) member
-- aCurrentGroup->push_back( *pControlModels );
--
-- // get the step which all controls of this group now have to belong to
-- nCurrentGroupStep = lcl_getDialogStep( *pControlModels );
-+ AddRadioButtonToGroup( *pControlModels, GROUP_NAME, aNamedGroups, aCurrentGroup );
-+
- // new state: looking for further members
- eState = eExpandingGroup;
-
-@@ -979,7 +1084,7 @@ void UnoControlDialogModel::implUpdateGroupStructure()
- {
- if ( !bIsRadioButton )
- { // no radio button -> the group is done
-- aCurrentGroup = maGroups.end();
-+ aCurrentGroup = NULL;
- eState = eLookingForGroup;
- #if OSL_DEBUG_LEVEL > 1
- aCurrentGroupLabels.clear();
-@@ -987,47 +1092,8 @@ void UnoControlDialogModel::implUpdateGroupStructure()
- continue;
- }
-
-- // it is a radio button - is it on the proper page?
-- const sal_Int32 nThisModelStep = lcl_getDialogStep( *pControlModels );
-- if ( ( nThisModelStep == nCurrentGroupStep ) // the current button is on the same dialog page
-- || ( 0 == nThisModelStep ) // the current button appears on all pages
-- )
-- {
-- // -> it belongs to the same group
-- aCurrentGroup->push_back( *pControlModels );
-- // state still is eExpandingGroup - we're looking for further elements
-- eState = eExpandingGroup;
--
--#if OSL_DEBUG_LEVEL > 1
-- Reference< XPropertySet > xModelProps( *pControlModels, UNO_QUERY );
-- ::rtl::OUString sLabel;
-- if ( xModelProps.is() && xModelProps->getPropertySetInfo().is() && xModelProps->getPropertySetInfo()->hasPropertyByName( ::rtl::OUString::createFromAscii( "Label" ) ) )
-- xModelProps->getPropertyValue( ::rtl::OUString::createFromAscii( "Label" ) ) >>= sLabel;
-- aCurrentGroupLabels.push_back( sLabel );
--#endif
-- continue;
-- }
--
-- // it's a radio button, but on a different page
-- // -> we open a new group for it
--
-- // close the old group
-- aCurrentGroup = maGroups.end();
--#if OSL_DEBUG_LEVEL > 1
-- aCurrentGroupLabels.clear();
--#endif
--
-- // open a new group
-- size_t nGroups = maGroups.size();
-- maGroups.resize( nGroups + 1 );
-- aCurrentGroup = maGroups.begin() + nGroups;
-- // and add the (only, til now) member
-- aCurrentGroup->push_back( *pControlModels );
--
-- nCurrentGroupStep = nThisModelStep;
-+ AddRadioButtonToGroup( *pControlModels, GROUP_NAME, aNamedGroups, aCurrentGroup );
-
-- // state is the same: we still are looking for further elements of the current group
-- eState = eExpandingGroup;
- #if OSL_DEBUG_LEVEL > 1
- Reference< XPropertySet > xModelProps( *pControlModels, UNO_QUERY );
- ::rtl::OUString sLabel;
-@@ -1040,6 +1106,7 @@ void UnoControlDialogModel::implUpdateGroupStructure()
- }
- }
-
-+ AddRadioButtonGroup( aNamedGroups );
- mbGroupsUpToDate = sal_True;
- }
-
-@@ -1420,17 +1487,32 @@ void UnoDialogControl::ImplSetPosSize( Reference< XControl >& rxCtrl )
- xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" ) ) ) >>= nWidth;
- xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) ) >>= nHeight;
-
-- // Currentley we are simply using MAP_APPFONT
-+ // Currentley we are simply using MAP_APPFONT ( for normal Dialogs )
-+ // and MAP_100TH_MM for imported Userforms
-+ MapMode aMode( MAP_APPFONT );
-+ sal_Bool bVBAForm = sal_False;
-+ Reference< XPropertySet > xDlgModelProps( getModel(), UNO_QUERY );
-+ if ( xDlgModelProps.is() )
-+ {
-+ try
-+ {
-+ xDlgModelProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAForm" ) ) ) >>= bVBAForm;
-+ }
-+ catch( Exception& )
-+ {
-+ }
-+ }
-+ if ( bVBAForm )
-+ aMode = MapMode( MAP_100TH_MM );
- OutputDevice*pOutDev = Application::GetDefaultDevice();
-- DBG_ASSERT( pOutDev, "Missing Default Device!" );
- if ( pOutDev )
- {
- ::Size aTmp( nX, nY );
-- aTmp = pOutDev->LogicToPixel( aTmp, MAP_APPFONT );
-+ aTmp = pOutDev->LogicToPixel( aTmp, aMode );
- nX = aTmp.Width();
- nY = aTmp.Height();
- aTmp = ::Size( nWidth, nHeight );
-- aTmp = pOutDev->LogicToPixel( aTmp, MAP_APPFONT );
-+ aTmp = pOutDev->LogicToPixel( aTmp, aMode );
- nWidth = aTmp.Width();
- nHeight = aTmp.Height();
- }
-@@ -1649,17 +1731,16 @@ void UnoDialogControl::PrepareWindowDescriptor( ::com::sun::star::awt::WindowDes
- // can lead to overwrites we have to set the graphic property
- // before the propertiesChangeEvents are sent!
- ::rtl::OUString aImageURL;
-- Reference< graphic::XGraphic > xGraphic;
- if (( ImplGetPropertyValue( PROPERTY_IMAGEURL ) >>= aImageURL ) &&
- ( aImageURL.getLength() > 0 ))
- {
-- ::rtl::OUString absoluteUrl =
-+ aImageURL =
- getPhysicalLocation( ImplGetPropertyValue( PROPERTY_DIALOGSOURCEURL ),
- ImplGetPropertyValue( PROPERTY_IMAGEURL ));
-
-- xGraphic = lcl_getGraphicFromURL_nothrow( absoluteUrl );
-- ImplSetPropertyValue( PROPERTY_GRAPHIC, uno::makeAny( xGraphic ), sal_True );
- }
-+ if ( aImageURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) != 0 )
-+ ImplSetPropertyValue( PROPERTY_IMAGEURL, uno::makeAny( aImageURL ), sal_True );
- }
-
- void UnoDialogControl::elementInserted( const ContainerEvent& Event ) throw(RuntimeException)
-@@ -1891,18 +1972,16 @@ void UnoDialogControl::ImplModelPropertiesChanged( const Sequence< PropertyChang
- if ( bOwnModel && rEvt.PropertyName.equalsAsciiL( "ImageURL", 8 ))
- {
- ::rtl::OUString aImageURL;
-- Reference< graphic::XGraphic > xGraphic;
- if (( ImplGetPropertyValue( PROPERTY_IMAGEURL ) >>= aImageURL ) &&
- ( aImageURL.getLength() > 0 ))
- {
-- ::rtl::OUString absoluteUrl =
-+ aImageURL =
- getPhysicalLocation( ImplGetPropertyValue( PROPERTY_DIALOGSOURCEURL ),
- ImplGetPropertyValue( PROPERTY_IMAGEURL ));
-
-- xGraphic = lcl_getGraphicFromURL_nothrow( absoluteUrl );
- }
-
-- ImplSetPropertyValue( PROPERTY_GRAPHIC, uno::makeAny( xGraphic ), sal_True );
-+ ImplSetPropertyValue( PROPERTY_IMAGEURL, uno::makeAny( aImageURL ), sal_True );
- break;
- }
- }
-@@ -2103,6 +2182,9 @@ throw (RuntimeException)
-
- ::rtl::OUString getPhysicalLocation( const ::com::sun::star::uno::Any& rbase, const ::com::sun::star::uno::Any& rUrl )
- {
-+
-+ ::rtl::OUString ret;
-+
- ::rtl::OUString baseLocation;
- ::rtl::OUString url;
-
-@@ -2112,9 +2194,16 @@ throw (RuntimeException)
- ::rtl::OUString absoluteURL( url );
- if ( url.getLength() > 0 )
- {
-- INetURLObject urlObj(baseLocation);
-- urlObj.removeSegment();
-- baseLocation = urlObj.GetMainURL( INetURLObject::NO_DECODE );
-+ // Don't adjust GraphicObject url(s)
-+ if ( url.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) != 0 )
-+ {
-+ INetURLObject urlObj(baseLocation);
-+ urlObj.removeSegment();
-+ baseLocation = urlObj.GetMainURL( INetURLObject::NO_DECODE );
-+ ::osl::FileBase::getAbsoluteFileURL( baseLocation, url, ret );
-+ }
-+ else
-+ ret = url;
-
- const INetURLObject protocolCheck( url );
- const INetProtocol protocol = protocolCheck.GetProtocol();
-diff --git toolkit/source/controls/unocontrolmodel.cxx toolkit/source/controls/unocontrolmodel.cxx
-index 7e6346b..9335711 100644
---- toolkit/source/controls/unocontrolmodel.cxx
-+++ toolkit/source/controls/unocontrolmodel.cxx
-@@ -349,6 +349,7 @@ sal_Bool UnoControlModel::ImplHasProperty( sal_uInt16 nPropId ) const
- case BASEPROPERTY_ENABLEVISIBLE:
- case BASEPROPERTY_DECORATION: aDefault <<= (sal_Bool) sal_True; break;
-
-+ case BASEPROPERTY_GROUPNAME:
- case BASEPROPERTY_HELPTEXT:
- case BASEPROPERTY_HELPURL:
- case BASEPROPERTY_IMAGEURL:
-diff --git toolkit/source/controls/unocontrols.cxx toolkit/source/controls/unocontrols.cxx
-index db87a58..1edb424 100644
---- toolkit/source/controls/unocontrols.cxx
-+++ toolkit/source/controls/unocontrols.cxx
-@@ -526,7 +526,7 @@ uno::Any GraphicControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-
- return UnoControlModel::ImplGetDefaultValue( nPropId );
- }
-- uno::Reference< graphic::XGraphic > GraphicControlModel::getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL )
-+ uno::Reference< graphic::XGraphic > getGraphicFromURL_nothrow( uno::Reference< graphic::XGraphicObject >& rxGrfObj, const ::rtl::OUString& _rURL )
- {
- uno::Reference< graphic::XGraphic > xGraphic;
-
-@@ -536,10 +536,10 @@ uno::Any GraphicControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
- rtl::OUString sID = _rURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 );
- // get the DefaultContext
- ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
-- mxGrfObj = graphic::GraphicObject::createWithId( aContext.getUNOContext(), sID );
-+ rxGrfObj = graphic::GraphicObject::createWithId( aContext.getUNOContext(), sID );
- }
- else // linked
-- mxGrfObj = NULL; // release the GraphicObject
-+ rxGrfObj = NULL; // release the GraphicObject
-
- if ( !_rURL.getLength() )
- return xGraphic;
-@@ -580,7 +580,7 @@ void SAL_CALL GraphicControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 n
- mbAdjustingGraphic = true;
- ::rtl::OUString sImageURL;
- OSL_VERIFY( rValue >>= sImageURL );
-- setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( getGraphicFromURL_nothrow( sImageURL ) ) );
-+ setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( getGraphicFromURL_nothrow( mxGrfObj, sImageURL ) ) );
- mbAdjustingGraphic = false;
- }
- break;
-@@ -1718,6 +1718,75 @@ sal_Bool UnoGroupBoxControl::isTransparent() throw(uno::RuntimeException)
- return sal_True;
- }
-
-+// MultiPage
-+
-+UnoMultiPageModel::UnoMultiPageModel()
-+{
-+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
-+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
-+ ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
-+ ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
-+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
-+ ImplRegisterProperty( BASEPROPERTY_LABEL );
-+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
-+ ImplRegisterProperty( BASEPROPERTY_PROGRESSVALUE );
-+ ImplRegisterProperty( BASEPROPERTY_PROGRESSVALUE_MAX );
-+}
-+
-+::rtl::OUString UnoMultiPageModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
-+{
-+ return ::rtl::OUString::createFromAscii( szServiceName_UnoMultiPageModel );
-+}
-+
-+uno::Any UnoMultiPageModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-+{
-+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
-+ {
-+ uno::Any aAny;
-+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlGroupBox );
-+ //aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoMultiPageControl );
-+ return aAny;
-+ }
-+ return UnoControlModel::ImplGetDefaultValue( nPropId );
-+}
-+
-+::cppu::IPropertyArrayHelper& UnoMultiPageModel::getInfoHelper()
-+{
-+ static UnoPropertyArrayHelper* pHelper = NULL;
-+ if ( !pHelper )
-+ {
-+ uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
-+ pHelper = new UnoPropertyArrayHelper( aIDs );
-+ }
-+ return *pHelper;
-+}
-+
-+// beans::XMultiPropertySet
-+uno::Reference< beans::XPropertySetInfo > UnoMultiPageModel::getPropertySetInfo( ) throw(uno::RuntimeException)
-+{
-+ static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
-+ return xInfo;
-+}
-+
-+// ----------------------------------------------------
-+// class MultiPageControl
-+// ----------------------------------------------------
-+UnoMultiPageControl::UnoMultiPageControl()
-+{
-+ maComponentInfos.nWidth = 100;
-+ maComponentInfos.nHeight = 100;
-+}
-+
-+::rtl::OUString UnoMultiPageControl::GetComponentServiceName()
-+{
-+ return ::rtl::OUString::createFromAscii( "multipage" );
-+}
-+
-+sal_Bool UnoMultiPageControl::isTransparent() throw(uno::RuntimeException)
-+{
-+ return sal_True;
-+}
-+
- // =====================================================================================================================
- // = UnoControlListBoxModel_Data
- // =====================================================================================================================
-diff --git toolkit/source/helper/property.cxx toolkit/source/helper/property.cxx
-index b6d47ff..3b937d7 100644
---- toolkit/source/helper/property.cxx
-+++ toolkit/source/helper/property.cxx
-@@ -182,6 +182,7 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount )
- DECL_PROP_3 ( "FormatsSupplier", FORMATSSUPPLIER, Reference< ::com::sun::star::util::XNumberFormatsSupplier >, BOUND, MAYBEVOID, TRANSIENT ),
-
- DECL_PROP_2 ( "Graphic", GRAPHIC, Reference< ::com::sun::star::graphic::XGraphic >, BOUND, TRANSIENT ),
-+ DECL_PROP_2 ( "GroupName", GROUPNAME, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "HelpText", HELPTEXT, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "HelpURL", HELPURL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "HideInactiveSelection", HIDEINACTIVESELECTION, bool, BOUND, MAYBEDEFAULT ),
-@@ -284,6 +285,7 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount )
- DECL_PROP_3 ( "SelectionModel", GRID_SELECTIONMODE, ::com::sun::star::view::SelectionType, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_2 ( "EnableVisible", ENABLEVISIBLE, sal_Bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_3 ( "ReferenceDevice", REFERENCE_DEVICE, Reference< XDevice >,BOUND, MAYBEDEFAULT, TRANSIENT ),
-+ DECL_PROP_2 ( "VBAForm", VBAFORM, sal_Bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_3 ( "EvenRowBackgroundColor", GRID_EVEN_ROW_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_3 ( "HeaderBackgroundColor", GRID_HEADER_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_3 ( "GridLineColor", GRID_LINE_COLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
-diff --git toolkit/source/helper/registerservices.cxx toolkit/source/helper/registerservices.cxx
-index 424f9b2..bcaa925 100644
---- toolkit/source/helper/registerservices.cxx
-+++ toolkit/source/helper/registerservices.cxx
-@@ -165,6 +165,7 @@ IMPL_CREATEINSTANCE( UnoControlTimeFieldModel )
- IMPL_CREATEINSTANCE( UnoControlProgressBarModel )
- IMPL_CREATEINSTANCE( UnoControlScrollBarModel )
- IMPL_CREATEINSTANCE( UnoSpinButtonModel )
-+IMPL_CREATEINSTANCE( UnoMultiPageModel )
- IMPL_CREATEINSTANCE( UnoControlFixedLineModel )
- IMPL_CREATEINSTANCE( UnoCurrencyFieldControl )
- IMPL_CREATEINSTANCE( UnoDateFieldControl )
-@@ -184,6 +185,7 @@ IMPL_CREATEINSTANCE( UnoTimeFieldControl )
- IMPL_CREATEINSTANCE( UnoProgressBarControl )
- IMPL_CREATEINSTANCE( UnoScrollBarControl )
- IMPL_CREATEINSTANCE( UnoSpinButtonControl )
-+IMPL_CREATEINSTANCE( UnoMultiPageControl )
- IMPL_CREATEINSTANCE( UnoFixedLineControl )
- IMPL_CREATEINSTANCE( VCLXMenuBar )
- IMPL_CREATEINSTANCE( VCLXPointer )
-@@ -276,6 +278,8 @@ TOOLKIT_DLLPUBLIC sal_Bool SAL_CALL component_writeInfo( void* _pServiceManager,
- registerServices( xRegistryKey, "UnoControlScrollBarModel", szServiceName_UnoControlScrollBarModel, szServiceName2_UnoControlScrollBarModel );
- registerServices( xRegistryKey, "UnoSpinButtonModel", szServiceName_UnoSpinButtonModel );
- registerServices( xRegistryKey, "UnoSpinButtonControl", szServiceName_UnoSpinButtonControl );
-+ registerServices( xRegistryKey, "UnoMultiPageModel", szServiceName_UnoMultiPageModel );
-+ registerServices( xRegistryKey, "UnoMultiPageControl", szServiceName_UnoMultiPageControl );
- registerServices( xRegistryKey, "UnoFixedLineControl", szServiceName_UnoControlFixedLine, szServiceName2_UnoControlFixedLine );
- registerServices( xRegistryKey, "UnoControlFixedLineModel", szServiceName_UnoControlFixedLineModel, szServiceName2_UnoControlFixedLineModel );
- registerServices( xRegistryKey, "VCLXPrinterServer", szServiceName_PrinterServer, szServiceName2_PrinterServer );
-@@ -366,6 +370,8 @@ TOOLKIT_DLLPUBLIC void* SAL_CALL component_getFactory( const sal_Char* sImplemen
- CHECKANDCREATEFACTORY( VCLXPrinterServer, szServiceName_PrinterServer, szServiceName2_PrinterServer )
- CHECKANDCREATEFACTORY( UnoRoadmapControl, szServiceName_UnoControlRoadmap, szServiceName2_UnoControlRoadmap )
- CHECKANDCREATEFACTORY( UnoControlRoadmapModel, szServiceName_UnoControlRoadmapModel, szServiceName2_UnoControlRoadmapModel )
-+ CHECKANDCREATEFACTORY( UnoMultiPageModel, szServiceName_UnoMultiPageModel, NULL )
-+ CHECKANDCREATEFACTORY( UnoMultiPageControl, szServiceName_UnoMultiPageControl, NULL )
- CHECKANDCREATEFACTORY( UnoSpinButtonModel, szServiceName_UnoSpinButtonModel, NULL )
- CHECKANDCREATEFACTORY( UnoSpinButtonControl, szServiceName_UnoSpinButtonControl, NULL )
- CHECKANDCREATEFACTORY( TreeControl, szServiceName_TreeControl, NULL )
-diff --git toolkit/source/helper/servicenames.cxx toolkit/source/helper/servicenames.cxx
-index 184f4be..06cb4a3 100644
---- toolkit/source/helper/servicenames.cxx
-+++ toolkit/source/helper/servicenames.cxx
-@@ -37,6 +37,8 @@ const sal_Char __FAR_DATA szServiceName_PopupMenu[] = "stardiv.vcl.PopupMenu", s
- const sal_Char __FAR_DATA szServiceName_MenuBar[] = "stardiv.vcl.MenuBar", szServiceName2_MenuBar[] = "com.sun.star.awt.MenuBar";
- const sal_Char __FAR_DATA szServiceName_Pointer[] = "stardiv.vcl.Pointer", szServiceName2_Pointer[] = "com.sun.star.awt.Pointer";
- const sal_Char __FAR_DATA szServiceName_UnoControlContainer[] = "stardiv.vcl.control.ControlContainer", szServiceName2_UnoControlContainer[] = "com.sun.star.awt.UnoControlContainer";
-+
-+
- const sal_Char __FAR_DATA szServiceName_UnoControlContainerModel[] = "stardiv.vcl.controlmodel.ControlContainer", szServiceName2_UnoControlContainerModel[] = "com.sun.star.awt.UnoControlContainerModel";
- const sal_Char __FAR_DATA szServiceName_TabController[] = "stardiv.vcl.control.TabController", szServiceName2_TabController[] = "com.sun.star.awt.TabController";
- const sal_Char __FAR_DATA szServiceName_TabControllerModel[] = "stardiv.vcl.controlmodel.TabController", szServiceName2_TabControllerModel[] = "com.sun.star.awt.TabControllerModel";
-@@ -88,6 +90,8 @@ const sal_Char __FAR_DATA szServiceName_UnoControlRoadmap[] = "stardiv.vcl.contr
- const sal_Char __FAR_DATA szServiceName_UnoControlRoadmapModel[] = "stardiv.vcl.controlmodel.Roadmap", szServiceName2_UnoControlRoadmapModel[] = "com.sun.star.awt.UnoControlRoadmapModel";
- const sal_Char __FAR_DATA szServiceName_UnoSpinButtonControl[] = "com.sun.star.awt.UnoControlSpinButton";
- const sal_Char __FAR_DATA szServiceName_UnoSpinButtonModel[] = "com.sun.star.awt.UnoControlSpinButtonModel";
-+const sal_Char __FAR_DATA szServiceName_UnoMultiPageControl[] = "com.sun.star.awt.UnoControlMultiPage";
-+const sal_Char __FAR_DATA szServiceName_UnoMultiPageModel[] = "com.sun.star.awt.UnoMultiPageModel";
- const sal_Char __FAR_DATA szServiceName_TreeControl[] = "com.sun.star.awt.tree.TreeControl";
- const sal_Char __FAR_DATA szServiceName_TreeControlModel[] = "com.sun.star.awt.tree.TreeControlModel";
- const sal_Char __FAR_DATA szServiceName_MutableTreeDataModel[] = "com.sun.star.awt.tree.MutableTreeDataModel";
-diff --git udkapi/com/sun/star/script/XAutomationInvocation.idl udkapi/com/sun/star/script/XAutomationInvocation.idl
-new file mode 100644
-index 0000000..9dcf61b
---- /dev/null
-+++ udkapi/com/sun/star/script/XAutomationInvocation.idl
-@@ -0,0 +1,51 @@
-+/*************************************************************************
-+ *
-+ * 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: XInvocation2.idl,v $
-+ * $Revision: 1.10 $
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __com_sun_star_script_XAutomationInvocation_idl__
-+#define __com_sun_star_script_XAutomationInvocation_idl__
-+
-+#ifndef __com_sun_star_script_XInvocation_idl__
-+#include <com/sun/star/script/XInvocation.idl>
-+#endif
-+
-+
-+ module com { module sun { module star { module script {
-+
-+interface XAutomationInvocation: com::sun::star::script::XInvocation
-+{
-+ any invokeGetProperty( [in] string aFunctionName, [in] sequence<any> aParams, [out] sequence<short> aOutParamIndex, [out] sequence<any> aOutParam ) raises( com::sun::star::lang::IllegalArgumentException, com::sun::star::script::CannotConvertException, com::sun::star::reflection::InvocationTargetException );
-+ any invokePutProperty( [in] string aFunctionName, [in] sequence<any> aParams, [out] sequence<short> aOutParamIndex, [out] sequence<any> aOutParam ) raises( com::sun::star::lang::IllegalArgumentException, com::sun::star::script::CannotConvertException, com::sun::star::reflection::InvocationTargetException );
-+
-+};
-+
-+//=============================================================================
-+
-+}; }; }; };
-+
-+#endif
-diff --git udkapi/com/sun/star/script/XErrorQuery.idl udkapi/com/sun/star/script/XErrorQuery.idl
-new file mode 100644
-index 0000000..9a1860e
---- /dev/null
-+++ udkapi/com/sun/star/script/XErrorQuery.idl
-@@ -0,0 +1,25 @@
-+#ifndef __com_sun_star_script_XErrorQuery_idl__
-+#define __com_sun_star_script_XErrorQuery_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+module com { module sun { module star { module script {
-+//==============================================================================
-+
-+interface XErrorQuery : ::com::sun::star::uno::XInterface
-+{
-+ //-----------------------------------------------------------------------
-+ /**
-+ Returns whether this object has an error
-+
-+ @return
-+ <atom>boolean</atom> indicating an error or not
-+ */
-+ boolean hasError();
-+
-+};
-+
-+}; }; }; };
-+#endif
-diff --git udkapi/com/sun/star/script/makefile.mk udkapi/com/sun/star/script/makefile.mk
-index 32aa58f..e6f49a9 100644
---- udkapi/com/sun/star/script/makefile.mk
-+++ udkapi/com/sun/star/script/makefile.mk
-@@ -81,6 +81,8 @@ IDLFILES=\
- XScriptEventsAttacher.idl\
- XDefaultMethod.idl\
- XDefaultProperty.idl\
-+ XAutomationInvocation.idl\
-+ XErrorQuery.idl\
-
- # ------------------------------------------------------------------
-
-diff --git unotools/inc/unotools/fltrcfg.hxx unotools/inc/unotools/fltrcfg.hxx
-index 26a1b22..2c948bc 100644
---- unotools/inc/unotools/fltrcfg.hxx
-+++ unotools/inc/unotools/fltrcfg.hxx
-@@ -48,6 +48,8 @@ public:
-
- void SetLoadWordBasicCode( sal_Bool bFlag );
- sal_Bool IsLoadWordBasicCode() const;
-+ void SetLoadWordBasicExecutable( sal_Bool bFlag );
-+ sal_Bool IsLoadWordBasicExecutable() const;
- void SetLoadWordBasicStorage( sal_Bool bFlag );
- sal_Bool IsLoadWordBasicStorage() const;
-
-diff --git unotools/source/config/fltrcfg.cxx unotools/source/config/fltrcfg.cxx
-index 4707b4a..8bf8307 100644
---- unotools/source/config/fltrcfg.cxx
-+++ unotools/source/config/fltrcfg.cxx
-@@ -61,6 +61,7 @@ using namespace com::sun::star::uno;
- #define FILTERCFG_ENABLE_EXCEL_PREVIEW 0x40000
- #define FILTERCFG_ENABLE_WORD_PREVIEW 0x80000
- #define FILTERCFG_USE_ENHANCED_FIELDS 0x100000
-+#define FILTERCFG_WORD_WBCTBL 0x200000
-
- static SvtFilterOptions* pOptions=0;
-
-@@ -150,6 +151,52 @@ void SvtAppFilterOptions_Impl::Load()
- }
-
- // -----------------------------------------------------------------------
-+class SvtWriterFilterOptions_Impl : public SvtAppFilterOptions_Impl
-+{
-+ sal_Bool bLoadExecutable;
-+public:
-+ SvtWriterFilterOptions_Impl(const OUString& rRoot) :
-+ SvtAppFilterOptions_Impl(rRoot),
-+ bLoadExecutable(sal_False)
-+ {}
-+ virtual void Commit();
-+ void Load();
-+
-+ sal_Bool IsLoadExecutable() const {return bLoadExecutable;}
-+ void SetLoadExecutable(sal_Bool bSet)
-+ {
-+ if(bSet != bLoadExecutable)
-+ SetModified();
-+ bLoadExecutable = bSet;
-+ }
-+};
-+
-+void SvtWriterFilterOptions_Impl::Commit()
-+{
-+ SvtAppFilterOptions_Impl::Commit();
-+
-+ Sequence<OUString> aNames(1);
-+ aNames[0] = C2U("Executable");
-+ Sequence<Any> aValues(1);
-+ aValues[0] <<= bLoadExecutable;
-+
-+ PutProperties(aNames, aValues);
-+}
-+
-+void SvtWriterFilterOptions_Impl::Load()
-+{
-+ SvtAppFilterOptions_Impl::Load();
-+
-+ Sequence<OUString> aNames(1);
-+ aNames[0] = C2U("Executable");
-+
-+ Sequence<Any> aValues = GetProperties(aNames);
-+ const Any* pValues = aValues.getConstArray();
-+ if(pValues[0].hasValue())
-+ bLoadExecutable = *(sal_Bool*)pValues[0].getValue();
-+}
-+
-+// -----------------------------------------------------------------------
- class SvtCalcFilterOptions_Impl : public SvtAppFilterOptions_Impl
- {
- sal_Bool bLoadExecutable;
-@@ -201,7 +248,7 @@ void SvtCalcFilterOptions_Impl::Load()
- struct SvtFilterOptions_Impl
- {
- ULONG nFlags;
-- SvtAppFilterOptions_Impl aWriterCfg;
-+ SvtWriterFilterOptions_Impl aWriterCfg;
- SvtCalcFilterOptions_Impl aCalcCfg;
- SvtAppFilterOptions_Impl aImpressCfg;
-
-@@ -246,6 +293,7 @@ void SvtFilterOptions_Impl::SetFlag( ULONG nFlag, BOOL bSet )
- {
- case FILTERCFG_WORD_CODE: aWriterCfg.SetLoad(bSet);break;
- case FILTERCFG_WORD_STORAGE: aWriterCfg.SetSave(bSet);break;
-+ case FILTERCFG_WORD_WBCTBL: aWriterCfg.SetLoadExecutable(bSet);break;
- case FILTERCFG_EXCEL_CODE: aCalcCfg.SetLoad(bSet);break;
- case FILTERCFG_EXCEL_STORAGE: aCalcCfg.SetSave(bSet);break;
- case FILTERCFG_EXCEL_EXECTBL: aCalcCfg.SetLoadExecutable(bSet);break;
-@@ -268,6 +316,7 @@ BOOL SvtFilterOptions_Impl::IsFlag( ULONG nFlag ) const
- {
- case FILTERCFG_WORD_CODE : bRet = aWriterCfg.IsLoad();break;
- case FILTERCFG_WORD_STORAGE : bRet = aWriterCfg.IsSave();break;
-+ case FILTERCFG_WORD_WBCTBL : bRet = aWriterCfg.IsLoadExecutable();break;
- case FILTERCFG_EXCEL_CODE : bRet = aCalcCfg.IsLoad();break;
- case FILTERCFG_EXCEL_STORAGE : bRet = aCalcCfg.IsSave();break;
- case FILTERCFG_EXCEL_EXECTBL : bRet = aCalcCfg.IsLoadExecutable();break;
-@@ -410,6 +459,17 @@ BOOL SvtFilterOptions::IsLoadWordBasicCode() const
- return pImp->IsFlag( FILTERCFG_WORD_CODE );
- }
-
-+void SvtFilterOptions::SetLoadWordBasicExecutable( BOOL bFlag )
-+{
-+ pImp->SetFlag( FILTERCFG_WORD_WBCTBL, bFlag );
-+ SetModified();
-+}
-+
-+BOOL SvtFilterOptions::IsLoadWordBasicExecutable() const
-+{
-+ return pImp->IsFlag( FILTERCFG_WORD_WBCTBL );
-+}
-+
- void SvtFilterOptions::SetLoadWordBasicStorage( sal_Bool bFlag )
- {
- pImp->SetFlag( FILTERCFG_WORD_STORAGE, bFlag );
-diff --git vbahelper/inc/vbahelper/vbaaccesshelper.hxx vbahelper/inc/vbahelper/vbaaccesshelper.hxx
-index cfbe9e7..29c90f2 100644
---- vbahelper/inc/vbahelper/vbaaccesshelper.hxx
-+++ vbahelper/inc/vbahelper/vbaaccesshelper.hxx
-@@ -71,7 +71,9 @@ namespace ooo
- return bRes;
- }
- VBAHELPER_DLLPUBLIC inline bool isAlienExcelDoc( SfxObjectShell& rDocShell ) { return isAlienDoc( rDocShell, "application/vnd.ms-excel" ); }
-- VBAHELPER_DLLPUBLIC inline bool isAlienWordDoc( SfxObjectShell& rDocShell ) { return isAlienDoc( rDocShell, "application/vnd.ms-word" ); }
-+ //VBAHELPER_DLLPUBLIC inline bool isAlienWordDoc( SfxObjectShell& rDocShell ) { return isAlienDoc( rDocShell, "application/vnd.ms-word" ); }
-+ // word seems to return an erroneous mime type :-/ "application/msword" not consistent with the excel one
-+ VBAHELPER_DLLPUBLIC inline bool isAlienWordDoc( SfxObjectShell& rDocShell ) { return isAlienDoc( rDocShell, "application/msword" ); }
-
- } // openoffice
- } // org
-diff --git vbahelper/inc/vbahelper/vbaapplicationbase.hxx vbahelper/inc/vbahelper/vbaapplicationbase.hxx
-index 4ba494f..d1ef76c 100644
---- vbahelper/inc/vbahelper/vbaapplicationbase.hxx
-+++ vbahelper/inc/vbahelper/vbaapplicationbase.hxx
-@@ -62,7 +62,7 @@ public:
- virtual css::uno::Any SAL_CALL getVBE() throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getVBProjects() throw (css::uno::RuntimeException);
-
-- virtual void SAL_CALL Run( const ::rtl::OUString& MacroName, const css::uno::Any& varg1, const css::uno::Any& varg2, const css::uno::Any& varg3, const css::uno::Any& varg4, const css::uno::Any& varg5, const css::uno::Any& varg6, const css::uno::Any& varg7, const css::uno::Any& varg8, const css::uno::Any& varg9, const css::uno::Any& varg10, const css::uno::Any& varg11, const css::uno::Any& varg12, const css::uno::Any& varg13, const css::uno::Any& varg14, const css::uno::Any& varg15, const css::uno::Any& varg16, const css::uno::Any& varg17, const css::uno::Any& varg18, const css::uno::Any& varg19, const css::uno::Any& varg20, const css::uno::Any& varg21, const css::uno::Any& varg22, const css::uno::Any& varg23, const css::uno::Any& varg24, const css::uno::Any& varg25, const css::uno::Any& varg26, const css::uno::Any& varg27, const css::uno::Any& varg28, const css::uno::Any& varg29, const css::uno::Any& varg30 ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Run( const ::rtl::OUString& MacroName, const css::uno::Any& varg1, const css::uno::Any& varg2, const css::uno::Any& varg3, const css::uno::Any& varg4, const css::uno::Any& varg5, const css::uno::Any& varg6, const css::uno::Any& varg7, const css::uno::Any& varg8, const css::uno::Any& varg9, const css::uno::Any& varg10, const css::uno::Any& varg11, const css::uno::Any& varg12, const css::uno::Any& varg13, const css::uno::Any& varg14, const css::uno::Any& varg15, const css::uno::Any& varg16, const css::uno::Any& varg17, const css::uno::Any& varg18, const css::uno::Any& varg19, const css::uno::Any& varg20, const css::uno::Any& varg21, const css::uno::Any& varg22, const css::uno::Any& varg23, const css::uno::Any& varg24, const css::uno::Any& varg25, const css::uno::Any& varg26, const css::uno::Any& varg27, const css::uno::Any& varg28, const css::uno::Any& varg29, const css::uno::Any& varg30 ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL OnTime( const css::uno::Any& aEarliestTime, const ::rtl::OUString& aFunction, const css::uno::Any& aLatestTime, const css::uno::Any& aSchedule ) throw (css::uno::RuntimeException);
- virtual float SAL_CALL CentimetersToPoints( float _Centimeters ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Undo() throw (css::uno::RuntimeException);
-diff --git vbahelper/inc/vbahelper/vbacollectionimpl.hxx vbahelper/inc/vbahelper/vbacollectionimpl.hxx
-index 27ffa25..590b551 100644
---- vbahelper/inc/vbahelper/vbacollectionimpl.hxx
-+++ vbahelper/inc/vbahelper/vbacollectionimpl.hxx
-@@ -243,12 +243,25 @@ typedef InheritedHelperInterfaceImpl< Ifc1 > BaseColBase;
- protected:
- css::uno::Reference< css::container::XIndexAccess > m_xIndexAccess;
- css::uno::Reference< css::container::XNameAccess > m_xNameAccess;
-+ sal_Bool mbIgnoreCase;
-
- 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 >() );
--
-+
-+ if( mbIgnoreCase )
-+ {
-+ css::uno::Sequence< rtl::OUString > sElementNames = m_xNameAccess->getElementNames();
-+ for( sal_Int32 i = 0; i < sElementNames.getLength(); i++ )
-+ {
-+ rtl::OUString aName = sElementNames[i];
-+ if( aName.equalsIgnoreAsciiCase( sIndex ) )
-+ {
-+ return createCollectionObject( m_xNameAccess->getByName( aName ) );
-+ }
-+ }
-+ }
- return createCollectionObject( m_xNameAccess->getByName( sIndex ) );
- }
-
-@@ -275,7 +288,7 @@ protected:
- }
-
- 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); }
-+ ScVbaCollectionBase( 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 bIgnoreCase = sal_False ) : BaseColBase( xParent, xContext ), m_xIndexAccess( xIndexAccess ), mbIgnoreCase( bIgnoreCase ) { m_xNameAccess.set(m_xIndexAccess, css::uno::UNO_QUERY); }
- //XCollection
- virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException)
- {
-@@ -340,7 +353,7 @@ class VBAHELPER_DLLPUBLIC CollTestImplHelper : public ScVbaCollectionBase< ::cp
- 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 ) {}
-+ CollTestImplHelper( 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 bIgnoreCase = sal_False ) throw( css::uno::RuntimeException ) : ImplBase1( xParent, xContext, xIndexAccess, bIgnoreCase ) {}
- };
-
-
-diff --git vbahelper/inc/vbahelper/vbadialogbase.hxx vbahelper/inc/vbahelper/vbadialogbase.hxx
-index 70bd565..f7fc1ad 100644
---- vbahelper/inc/vbahelper/vbadialogbase.hxx
-+++ vbahelper/inc/vbahelper/vbadialogbase.hxx
-@@ -44,7 +44,7 @@ public:
- virtual ~VbaDialogBase() {}
-
- // Methods
-- virtual void SAL_CALL Show() throw (css::uno::RuntimeException);
-+ virtual sal_Bool SAL_CALL Show() throw (css::uno::RuntimeException);
- virtual rtl::OUString mapIndexToName( sal_Int32 nIndex ) = 0;
- };
-
-diff --git vbahelper/inc/vbahelper/vbadocumentbase.hxx vbahelper/inc/vbahelper/vbadocumentbase.hxx
-index b68eb06..ecde17d 100644
---- vbahelper/inc/vbahelper/vbadocumentbase.hxx
-+++ vbahelper/inc/vbahelper/vbadocumentbase.hxx
-@@ -58,7 +58,7 @@ public:
- 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 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);
-diff --git vbahelper/inc/vbahelper/vbahelper.hxx vbahelper/inc/vbahelper/vbahelper.hxx
-index 5383608..8c3aa6a 100644
---- vbahelper/inc/vbahelper/vbahelper.hxx
-+++ vbahelper/inc/vbahelper/vbahelper.hxx
-@@ -35,6 +35,10 @@
- #include <com/sun/star/lang/IllegalArgumentException.hpp>
- #include <com/sun/star/awt/XControl.hpp>
- #include <com/sun/star/awt/XDevice.hpp>
-+#include <com/sun/star/frame/XDispatchResultListener.hpp>
-+#include <com/sun/star/frame/DispatchResultEvent.hpp>
-+#include <com/sun/star/frame/DispatchResultState.hpp>
-+#include <com/sun/star/lang/EventObject.hpp>
- #include <com/sun/star/awt/XUnitConversion.hpp>
- #include <basic/basmgr.hxx>
- #include <basic/sberrors.hxx>
-@@ -77,7 +81,7 @@ namespace ooo
- VBAHELPER_DLLPUBLIC css::uno::Reference< css::script::XTypeConverter > getTypeConverter( const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException);
-
- VBAHELPER_DLLPUBLIC void dispatchRequests( const css::uno::Reference< css::frame::XModel>& xModel, const rtl::OUString& aUrl );
-- VBAHELPER_DLLPUBLIC void dispatchRequests( const css::uno::Reference< css::frame::XModel>& xModel, const rtl::OUString& aUrl, const css::uno::Sequence< css::beans::PropertyValue >& sProps );
-+ VBAHELPER_DLLPUBLIC void dispatchRequests (const css::uno::Reference< css::frame::XModel>& xModel, const rtl::OUString & aUrl, const css::uno::Sequence< css::beans::PropertyValue >& sProps, const css::uno::Reference< css::frame::XDispatchResultListener >& rListener = css::uno::Reference< css::frame::XDispatchResultListener >(), const sal_Bool bSilent = sal_True );
- VBAHELPER_DLLPUBLIC void dispatchExecute(SfxViewShell* pView, USHORT nSlot, SfxCallMode nCall = SFX_CALLMODE_SYNCHRON );
- VBAHELPER_DLLPUBLIC sal_Int32 OORGBToXLRGB( sal_Int32 );
- VBAHELPER_DLLPUBLIC sal_Int32 XLRGBToOORGB( sal_Int32 );
-@@ -102,6 +106,7 @@ namespace ooo
- VBAHELPER_DLLPUBLIC void setDefaultPropByIntrospection( const css::uno::Any& aObj, const css::uno::Any& aValue ) throw ( css::uno::RuntimeException );
- VBAHELPER_DLLPUBLIC css::uno::Any getPropertyValue( const css::uno::Sequence< css::beans::PropertyValue >& aProp, const rtl::OUString& aName );
- VBAHELPER_DLLPUBLIC sal_Bool setPropertyValue( css::uno::Sequence< css::beans::PropertyValue >& aProp, const rtl::OUString& aName, const css::uno::Any& aValue );
-+ VBAHELPER_DLLPUBLIC void setOrAppendPropertyValue( css::uno::Sequence< css::beans::PropertyValue >& aProp, const rtl::OUString& aName, const css::uno::Any& aValue );
-
- class VBAHELPER_DLLPUBLIC Millimeter
- {
-@@ -225,6 +230,25 @@ public:
-
- static void exception( css::uno::Exception& ex ) throw( css::script::BasicErrorException );
- };
-+
-+class VBAHELPER_DLLPUBLIC VBADispatchListener : public cppu::WeakImplHelper1< css::frame::XDispatchResultListener >
-+{
-+private:
-+ css::uno::Any m_Result;
-+ sal_Bool m_State;
-+
-+public:
-+ VBADispatchListener();
-+ ~VBADispatchListener();
-+
-+ css::uno::Any getResult() { return m_Result; }
-+ sal_Bool getState() { return m_State; }
-+
-+ // XDispatchResultListener
-+ virtual void SAL_CALL dispatchFinished( const css::frame::DispatchResultEvent& aEvent ) throw ( css::uno::RuntimeException );
-+ virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw ( css::uno::RuntimeException );
-+};
-+
- } // openoffice
- } // org
-
-diff --git vbahelper/inc/vbahelper/vbashape.hxx vbahelper/inc/vbahelper/vbashape.hxx
-index 8fc2590..bb39d6b 100644
---- vbahelper/inc/vbahelper/vbashape.hxx
-+++ vbahelper/inc/vbahelper/vbashape.hxx
-@@ -109,6 +109,7 @@ public:
- // 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 );
-+ virtual void SAL_CALL Copy( ) throw (css::uno::RuntimeException);
- // XEventListener
- virtual void SAL_CALL disposing( const css::lang::EventObject& rEventObject ) throw( css::uno::RuntimeException );
- };
-diff --git vbahelper/inc/vbahelper/vbashaperange.hxx vbahelper/inc/vbahelper/vbashaperange.hxx
-index d1bc1e5..97d9f42 100644
---- vbahelper/inc/vbahelper/vbashaperange.hxx
-+++ vbahelper/inc/vbahelper/vbashaperange.hxx
-@@ -56,6 +56,8 @@ public:
- 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 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);
-@@ -76,6 +78,7 @@ public:
- virtual void SAL_CALL setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL SAL_CALL TextFrame( ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL SAL_CALL WrapFormat( ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL ZOrder( sal_Int32 ZOrderCmd ) 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);
-diff --git vbahelper/prj/d.lst vbahelper/prj/d.lst
-index 2d20ab1..92b01be 100644
---- vbahelper/prj/d.lst
-+++ vbahelper/prj/d.lst
-@@ -27,3 +27,4 @@ mkdir: %_DEST%\inc%_EXT%\basic
- ..\inc\vbahelper\vbashaperange.hxx %_DEST%\inc%_EXT%\vbahelper\vbashaperange.hxx
- ..\inc\vbahelper\vbapagesetupbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbapagesetupbase.hxx
- ..\inc\vbahelper\vbaeventshelperbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbaeventshelperbase.hxx
-+..\inc\vbahelper\vbaeventshelperbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbaeventshelperbase.hxx
-diff --git vbahelper/source/msforms/makefile.mk vbahelper/source/msforms/makefile.mk
-index 5fce646..30ce221 100644
---- vbahelper/source/msforms/makefile.mk
-+++ vbahelper/source/msforms/makefile.mk
-@@ -34,13 +34,10 @@ VISIBILITY_HIDDEN=TRUE
-
- # --- Settings -----------------------------------------------------
-
--.IF "$(ENABLE_VBA)" == "NO"
--dummy:
-- @echo "Nothing to build"
--.ENDIF
--
- .INCLUDE : settings.mk
-
-+CDEFS+=-DVBA_OOBUILD_HACK
-+
- SLOFILES=\
- $(SLO)$/vbacontrol.obj \
- $(SLO)$/vbacontrols.obj \
-diff --git vbahelper/source/msforms/vbacheckbox.cxx vbahelper/source/msforms/vbacheckbox.cxx
-index 15175f0..16f5d16 100644
---- vbahelper/source/msforms/vbacheckbox.cxx
-+++ vbahelper/source/msforms/vbacheckbox.cxx
-@@ -70,6 +70,8 @@ void SAL_CALL
- ScVbaCheckbox::setValue( const uno::Any& _value ) throw (css::uno::RuntimeException)
- {
- sal_Int16 nValue = 0;
-+ sal_Int16 nOldValue = 0;
-+ m_xProps->getPropertyValue( STATE ) >>= nOldValue;
- sal_Bool bValue = false;
- if( _value >>= nValue )
- {
-@@ -82,6 +84,8 @@ ScVbaCheckbox::setValue( const uno::Any& _value ) throw (css::uno::RuntimeExcept
- nValue = 1;
- }
- m_xProps->setPropertyValue( STATE, uno::makeAny( nValue ) );
-+ if ( nValue != nOldValue )
-+ fireClickEvent();
- }
- rtl::OUString&
- ScVbaCheckbox::getServiceImplName()
-diff --git vbahelper/source/msforms/vbacheckbox.hxx vbahelper/source/msforms/vbacheckbox.hxx
-index d3922d8..b99850b 100644
---- vbahelper/source/msforms/vbacheckbox.hxx
-+++ vbahelper/source/msforms/vbacheckbox.hxx
-@@ -27,12 +27,12 @@
- #ifndef SC_VBA_CHECKBOX_HXX
- #define SC_VBA_CHECKBOX_HXX
- #include <cppuhelper/implbase2.hxx>
--#include <ooo/vba/msforms/XRadioButton.hpp>
-+#include <ooo/vba/msforms/XCheckBox.hpp>
-
- #include "vbacontrol.hxx"
- #include <vbahelper/vbahelper.hxx>
-
--typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XRadioButton, css::script::XDefaultProperty > CheckBoxImpl_BASE;
-+typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XCheckBox, css::script::XDefaultProperty > CheckBoxImpl_BASE;
-
- class ScVbaCheckbox : public CheckBoxImpl_BASE
- {
-diff --git vbahelper/source/msforms/vbacombobox.cxx vbahelper/source/msforms/vbacombobox.cxx
-index 4dfbf29..5c05894 100644
---- vbahelper/source/msforms/vbacombobox.cxx
-+++ vbahelper/source/msforms/vbacombobox.cxx
-@@ -26,6 +26,9 @@
- ************************************************************************/
- #include "vbacombobox.hxx"
- #include <vector>
-+#include <filter/msfilter/msvbahelper.hxx>
-+#include <basic/sbstar.hxx>
-+#include <basic/sbmod.hxx>
-
- using namespace com::sun::star;
- using namespace ooo::vba;
-@@ -63,12 +66,18 @@ ScVbaComboBox::setListIndex( const uno::Any& _value ) throw (uno::RuntimeExcepti
- sal_Int16 nIndex = 0;
- if( _value >>= nIndex )
- {
-+ sal_Int32 nOldIndex = -1;
-+ getListIndex() >>= nOldIndex;
- uno::Sequence< rtl::OUString > sItems;
- m_xProps->getPropertyValue( ITEMS ) >>= sItems;
- if( ( nIndex >= 0 ) && ( sItems.getLength() > nIndex ) )
- {
- rtl::OUString sText = sItems[ nIndex ];
- m_xProps->setPropertyValue( TEXT, uno::makeAny( sText ) );
-+
-+ // fire the _Change event
-+ if( nOldIndex != nIndex )
-+ fireClickEvent();
- }
- }
- }
-@@ -103,7 +112,38 @@ ScVbaComboBox::getListIndex() throw (uno::RuntimeException)
- void SAL_CALL
- ScVbaComboBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
- {
-- m_xProps->setPropertyValue( sSourceName, _value );
-+ rtl::OUString sOldValue, sNewValue;
-+ getValue() >>= sOldValue;
-+
-+ uno::Any aConverted = _value;
-+ uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( mxContext );
-+ try
-+ {
-+ aConverted = xConverter.is() ? xConverter->convertTo( _value, getCppuType( static_cast< const rtl::OUString* >(0) ) ) : aConverted;
-+ }
-+ catch( const uno::Exception& /*ex*/ )
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Invalid value" ) ), uno::Reference< uno::XInterface >() );
-+ }
-+
-+ m_xProps->setPropertyValue( sSourceName, aConverted );
-+
-+ aConverted >>= sNewValue;
-+ if ( sNewValue != sOldValue )
-+ {
-+ // If the new value is in current list, we should fire click event, otherwise fire the change event.
-+ sal_Int32 nListIndex = -1;
-+ getListIndex() >>= nListIndex;
-+ sal_Bool bIsInList = ( nListIndex >= 0 );
-+ if ( bIsInList )
-+ {
-+ fireClickEvent();
-+ }
-+ else
-+ {
-+ fireChangeEvent();
-+ }
-+ }
- }
-
- // see Value
-diff --git vbahelper/source/msforms/vbacontrol.cxx vbahelper/source/msforms/vbacontrol.cxx
-index 7485073..046bcb0 100644
---- vbahelper/source/msforms/vbacontrol.cxx
-+++ vbahelper/source/msforms/vbacontrol.cxx
-@@ -28,6 +28,7 @@
- #include <com/sun/star/awt/XControlModel.hpp>
- #include <com/sun/star/awt/XControl.hpp>
- #include <com/sun/star/awt/XWindow2.hpp>
-+#include <com/sun/star/awt/XActionListener.hpp>
- #include <com/sun/star/lang/XEventListener.hpp>
- #include <com/sun/star/drawing/XShape.hpp>
- #include <com/sun/star/drawing/XControlShape.hpp>
-@@ -39,6 +40,9 @@
- #include <com/sun/star/form/binding/XListEntrySink.hpp>
- #include <com/sun/star/table/CellAddress.hpp>
- #include <com/sun/star/table/CellRangeAddress.hpp>
-+#include <com/sun/star/script/XScriptListener.hpp>
-+#include <com/sun/star/document/XCodeNameQuery.hpp>
-+#include <com/sun/star/form/XChangeListener.hpp>
- #include <ooo/vba/XControlProvider.hpp>
- #ifdef VBA_OOBUILD_HACK
- #include <svtools/bindablecontrolhelper.hxx>
-@@ -127,7 +131,7 @@ ScVbaControlListener::disposing( const lang::EventObject& ) throw( uno::RuntimeE
-
- //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 )
-+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 ), bIsDialog(false), m_xControl( xControl ), m_xModel( xModel )
- {
- //add listener
- m_xEventListener.set( new ScVbaControlListener( this ) );
-@@ -139,9 +143,18 @@ ScVbaControl::ScVbaControl( const uno::Reference< XHelperInterface >& xParent, c
- 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 );
-+ rtl::OUString sDefaultControl;
-+ m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DefaultControl") ) ) >>= sDefaultControl;
-+ uno::Reference< lang::XMultiComponentFactory > xMFac( mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
-+ m_xEmptyFormControl.set( xMFac->createInstanceWithContext( sDefaultControl, mxContext ), uno::UNO_QUERY_THROW );
-+ }
- else if ( xUserFormControl.is() ) // userform control
-+ {
- m_xProps.set( xUserFormControl->getModel(), uno::UNO_QUERY_THROW );
-+ bIsDialog = true;
-+ }
- }
-
- ScVbaControl::~ScVbaControl()
-@@ -398,6 +411,85 @@ void SAL_CALL ScVbaControl::setTag( const ::rtl::OUString& aTag )
- m_aControlTag = aTag;
- }
-
-+::sal_Int32 SAL_CALL ScVbaControl::getForeColor() throw (::com::sun::star::uno::RuntimeException)
-+{
-+ sal_Int32 nForeColor = -1;
-+ m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextColor" ) ) ) >>= nForeColor;
-+ return OORGBToXLRGB( nForeColor );
-+}
-+
-+void SAL_CALL ScVbaControl::setForeColor( ::sal_Int32 _forecolor ) throw (::com::sun::star::uno::RuntimeException)
-+{
-+ m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextColor" ) ), uno::makeAny( XLRGBToOORGB( _forecolor ) ) );
-+}
-+
-+void ScVbaControl::fireEvent( script::ScriptEvent& evt )
-+{
-+ uno::Reference<lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
-+ uno::Reference< script::XScriptListener > xScriptListener( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.EventListener" ) ), mxContext ), uno::UNO_QUERY_THROW );
-+
-+ uno::Reference< beans::XPropertySet > xProps( xScriptListener, uno::UNO_QUERY_THROW );
-+ xProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Model" ) ), uno::makeAny( m_xModel ) );
-+
-+ // handling for sheet control
-+ uno::Reference< msforms::XControl > xThisControl( this );
-+ try
-+ {
-+ evt.Arguments.realloc( 1 );
-+ lang::EventObject aEvt;
-+
-+ uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY ) ;
-+ uno::Reference< awt::XControl > xControl( m_xControl, uno::UNO_QUERY ) ;
-+
-+ if ( xControlShape.is() )
-+ {
-+ evt.Source = xControlShape;
-+ aEvt.Source = m_xEmptyFormControl;
-+ // Set up proper scriptcode
-+ uno::Reference< lang::XMultiServiceFactory > xDocFac( m_xModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< document::XCodeNameQuery > xNameQuery( xDocFac->createInstance( rtl::OUString::createFromAscii( "ooo.vba.VBACodeNameProvider" ) ), uno::UNO_QUERY_THROW );
-+ uno::Reference< uno::XInterface > xIf( xControlShape->getControl(), uno::UNO_QUERY_THROW );
-+ evt.ScriptCode = xNameQuery->getCodeNameForObject( xIf );
-+ evt.Arguments[ 0 ] = uno::makeAny( aEvt );
-+ xScriptListener->firing( evt );
-+ }
-+ else
-+ {
-+ if ( xControl.is() ) // normal control ( from dialog/userform )
-+ {
-+ // #FIXME We should probably store a reference to the
-+ // parent dialog/userform here ( other wise the name of
-+ // dialog could be changed and we won't be aware of it.
-+ // ( OTOH this is probably an unlikely scenario )
-+ evt.Source = xThisControl;
-+ aEvt.Source = xControl;
-+ evt.ScriptCode = m_sLibraryAndCodeName;
-+ evt.Arguments[ 0 ] = uno::makeAny( aEvt );
-+ xScriptListener->firing( evt );
-+ }
-+ }
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ }
-+}
-+void ScVbaControl::fireChangeEvent()
-+{
-+ script::ScriptEvent evt;
-+ evt.ScriptType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VBAInterop") );
-+ evt.ListenerType = form::XChangeListener::static_type(0);
-+ evt.MethodName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("changed") );
-+ fireEvent( evt );
-+}
-+
-+void ScVbaControl::fireClickEvent()
-+{
-+ script::ScriptEvent evt;
-+ evt.ScriptType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VBAInterop") );
-+ evt.ListenerType = awt::XActionListener::static_type(0);
-+ evt.MethodName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("actionPerformed") );
-+ fireEvent( evt );
-+}
-
- //ScVbaControlFactory
-
-@@ -423,16 +515,25 @@ ScVbaControl* ScVbaControlFactory::createControl(const uno::Reference< drawing::
- 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 )
-+ sal_Bool bToggle = sal_False; //liuchen 2009-8-11,
-+ 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:
-+ //liuchen 2009-8-11
-+ xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Toggle") ) ) >>= bToggle;
-+ if ( bToggle )
-+ return new ScVbaToggleButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
-+ else
-+ return new ScVbaButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
-+ //liuchen 2009-8-11
-+ 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::CHECKBOX:
-+ return new ScVbaCheckbox( 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:
-diff --git vbahelper/source/msforms/vbacontrol.hxx vbahelper/source/msforms/vbacontrol.hxx
-index d2631c7..8878102 100644
---- vbahelper/source/msforms/vbacontrol.hxx
-+++ vbahelper/source/msforms/vbacontrol.hxx
-@@ -34,6 +34,7 @@
- #include <com/sun/star/drawing/XControlShape.hpp>
- #include <com/sun/star/awt/XControl.hpp>
- #include <com/sun/star/awt/XWindowPeer.hpp>
-+#include <com/sun/star/script/ScriptEvent.hpp>
- #include <ooo/vba/msforms/XControl.hpp>
-
- #include <vbahelper/vbahelper.hxx>
-@@ -47,17 +48,23 @@ class ScVbaControl : public ControlImpl_BASE
- {
- private:
- com::sun::star::uno::Reference< com::sun::star::lang::XEventListener > m_xEventListener;
-+ com::sun::star::uno::Reference< com::sun::star::awt::XControl > m_xEmptyFormControl;
- protected:
- // awt control has nothing similar to Tag property of Mso controls,
- // whether it is necessary is another question
- ::rtl::OUString m_aControlTag;
-
-+ bool bIsDialog;
-+ rtl::OUString m_sLibraryAndCodeName;
- 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);
-+ void fireChangeEvent();
-+ void fireClickEvent();
-+ void fireEvent( css::script::ScriptEvent& evt );
- 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 );
-@@ -65,6 +72,10 @@ public:
- // This class will own the helper, so make sure it is allocated from
- // the heap
- void setGeometryHelper( ov::AbstractGeometryAttributes* pHelper );
-+ // sets the name of the associated library ( used for UserForm controls )
-+ void setLibraryAndCodeName( const rtl::OUString& sLibCodeName ) { m_sLibraryAndCodeName = sLibCodeName; }
-+ rtl::OUString getLibraryAndCodeName() { return m_sLibraryAndCodeName; }
-+
- // XControl
- virtual sal_Bool SAL_CALL getEnabled() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setEnabled( sal_Bool _enabled ) throw (css::uno::RuntimeException);
-@@ -94,6 +105,8 @@ public:
- virtual void SAL_CALL setTag( const ::rtl::OUString& aTag ) 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 );
-+ virtual ::sal_Int32 SAL_CALL getForeColor() throw (::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL setForeColor( ::sal_Int32 _forecolor ) throw (::com::sun::star::uno::RuntimeException);
- //XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-diff --git vbahelper/source/msforms/vbaframe.cxx vbahelper/source/msforms/vbaframe.cxx
-index 3c202f1..79e0b00 100644
---- vbahelper/source/msforms/vbaframe.cxx
-+++ vbahelper/source/msforms/vbaframe.cxx
-@@ -64,6 +64,30 @@ ScVbaFrame::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::Run
- _value >>= sCaption;
- setCaption( sCaption );
- }
-+//liuchen 2009-7-6
-+::sal_Int32 SAL_CALL ScVbaFrame::getForeColor() throw (::com::sun::star::uno::RuntimeException)
-+{
-+ return 0;
-+}
-+
-+void SAL_CALL ScVbaFrame::setForeColor( ::sal_Int32 /*_forecolor*/ ) throw (::com::sun::star::uno::RuntimeException)
-+{
-+ return;
-+}
-+//liuchen 2009-7-6 end
-+
-+rtl::OUString SAL_CALL
-+ScVbaFrame::getAccelerator() throw (css::uno::RuntimeException)
-+{
-+ //FIXME: seems not support?
-+ return rtl::OUString();
-+}
-+
-+void SAL_CALL
-+ScVbaFrame::setAccelerator( const rtl::OUString& /*_accelerator*/ ) throw (::com::sun::star::uno::RuntimeException)
-+{
-+ //FIXME: seems not support?
-+}
-
- rtl::OUString&
- ScVbaFrame::getServiceImplName()
-diff --git vbahelper/source/msforms/vbaframe.hxx vbahelper/source/msforms/vbaframe.hxx
-index c55a41b..f5d49aa 100644
---- vbahelper/source/msforms/vbaframe.hxx
-+++ vbahelper/source/msforms/vbaframe.hxx
-@@ -43,6 +43,12 @@ public:
- 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);
-+ //liuchen 2009-7-6
-+ virtual ::sal_Int32 SAL_CALL getForeColor() throw (::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL setForeColor( ::sal_Int32 _forecolor ) throw (::com::sun::star::uno::RuntimeException);
-+ //liuchen 2009-7-6 end
-+ virtual rtl::OUString SAL_CALL getAccelerator() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setAccelerator( const rtl::OUString& _accelerator ) throw (css::uno::RuntimeException);
- //XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-diff --git vbahelper/source/msforms/vbalabel.cxx vbahelper/source/msforms/vbalabel.cxx
-index 5fb6ebe..d50f2e3 100644
---- vbahelper/source/msforms/vbalabel.cxx
-+++ vbahelper/source/msforms/vbalabel.cxx
-@@ -64,6 +64,18 @@ ScVbaLabel::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::Run
- setCaption( sCaption );
- }
-
-+rtl::OUString SAL_CALL
-+ScVbaLabel::getAccelerator() throw (css::uno::RuntimeException)
-+{
-+ //FIXME: seems not support?
-+ return rtl::OUString();
-+}
-+
-+void SAL_CALL
-+ScVbaLabel::setAccelerator( const rtl::OUString& /*_accelerator*/ ) throw (::com::sun::star::uno::RuntimeException)
-+{
-+ //FIXME: seems not support?
-+}
-
- rtl::OUString&
- ScVbaLabel::getServiceImplName()
-diff --git vbahelper/source/msforms/vbalabel.hxx vbahelper/source/msforms/vbalabel.hxx
-index fd6b1c1..ff7822f 100644
---- vbahelper/source/msforms/vbalabel.hxx
-+++ vbahelper/source/msforms/vbalabel.hxx
-@@ -44,6 +44,8 @@ public:
- 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);
-+ virtual rtl::OUString SAL_CALL getAccelerator() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setAccelerator( const rtl::OUString& _accelerator ) throw (css::uno::RuntimeException);
- //XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-diff --git vbahelper/source/msforms/vbalistbox.cxx vbahelper/source/msforms/vbalistbox.cxx
-index 8538fc2..437a95b 100644
---- vbahelper/source/msforms/vbalistbox.cxx
-+++ vbahelper/source/msforms/vbalistbox.cxx
-@@ -108,9 +108,13 @@ ScVbaListBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
- "Attribute use invalid." ), uno::Reference< uno::XInterface >() );
-
- uno::Sequence< sal_Int16 > nSelectedIndices(1);
-+ uno::Sequence< sal_Int16 > nOldSelectedIndices;
-+ m_xProps->getPropertyValue( SELECTEDITEMS ) >>= nOldSelectedIndices;
- nSelectedIndices[ 0 ] = nValue;
- m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nSelectedIndices ) );
-- m_xProps->setPropertyValue( TEXT, uno::makeAny( sValue ) );
-+ if ( nSelectedIndices != nOldSelectedIndices )
-+ fireClickEvent();
-+ //m_xProps->setPropertyValue( TEXT, uno::makeAny( sValue ) ); //liuchen 2009-8-12 solve the problem that ListBox.Text and ListBox.Value cannot be set
- }
-
- ::rtl::OUString SAL_CALL
-@@ -127,20 +131,22 @@ ScVbaListBox::setText( const ::rtl::OUString& _text ) throw (uno::RuntimeExcepti
- setValue( uno::makeAny( _text ) ); // seems the same
- }
-
--sal_Bool SAL_CALL
-+sal_Int32 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;
-+ return bMultiSelect ? 1 : 0 ;
- }
-
- void SAL_CALL
--ScVbaListBox::setMultiSelect( sal_Bool _multiselect ) throw (css::uno::RuntimeException)
-+ScVbaListBox::setMultiSelect( sal_Int32 _multiselect ) throw (css::uno::RuntimeException)
- {
-- m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiSelection" ) ), uno::makeAny( _multiselect ) );
-+ sal_Bool bMultiSelect = _multiselect == 1 ? 1 : 0;
-+ m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiSelection" ) ), uno::makeAny( bMultiSelect ) );
- }
-
-+
- css::uno::Any SAL_CALL
- ScVbaListBox::Selected( sal_Int32 index ) throw (css::uno::RuntimeException)
- {
-@@ -205,6 +211,7 @@ ScVbaListBox::setValueEvent( const uno::Any& value )
- }
- nList.realloc( nLength - 1 );
- //m_xProps->setPropertyValue( sSourceName, uno::makeAny( nList ) );
-+ fireClickEvent();
- m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nList ) );
- return;
- }
-@@ -223,6 +230,7 @@ ScVbaListBox::setValueEvent( const uno::Any& value )
- nList[0] = nIndex;
- }
- //m_xProps->setPropertyValue( sSourceName, uno::makeAny( nList ) );
-+ fireClickEvent();
- m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nList ) );
- }
- }
-diff --git vbahelper/source/msforms/vbalistbox.hxx vbahelper/source/msforms/vbalistbox.hxx
-index 01c53d1..d540102 100644
---- vbahelper/source/msforms/vbalistbox.hxx
-+++ vbahelper/source/msforms/vbalistbox.hxx
-@@ -58,8 +58,8 @@ public:
- 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 ::sal_Int32 SAL_CALL getMultiSelect() throw (css::uno::RuntimeException); //liuchen 2009-7-31
-+ virtual void SAL_CALL setMultiSelect( ::sal_Int32 _multiselect ) throw (css::uno::RuntimeException); //liuchen 2009-7-31
- virtual css::uno::Any SAL_CALL Selected( ::sal_Int32 index ) throw (css::uno::RuntimeException);
-
- // Methods
-diff --git vbahelper/source/msforms/vbalistcontrolhelper.cxx vbahelper/source/msforms/vbalistcontrolhelper.cxx
-index 36683ae..977fdde 100644
---- vbahelper/source/msforms/vbalistcontrolhelper.cxx
-+++ vbahelper/source/msforms/vbalistcontrolhelper.cxx
-@@ -1,11 +1,69 @@
- #include <vbalistcontrolhelper.hxx>
- #include <vector>
-+#include <vbahelper/vbapropvalue.hxx>
-
- using namespace com::sun::star;
- using namespace ooo::vba;
-
- const static rtl::OUString ITEMS( RTL_CONSTASCII_USTRINGPARAM("StringItemList") );
-
-+class ListPropListener : public PropListener
-+{
-+private:
-+ uno::Reference< beans::XPropertySet > m_xProps;
-+ uno::Any m_pvargIndex;
-+ uno::Any m_pvarColumn;
-+
-+public:
-+ ListPropListener( const uno::Reference< beans::XPropertySet >& xProps, const uno::Any& pvargIndex, const uno::Any& pvarColumn );
-+ virtual void setValueEvent( const css::uno::Any& value );
-+ virtual css::uno::Any getValueEvent();
-+};
-+
-+ListPropListener::ListPropListener( const uno::Reference< beans::XPropertySet >& xProps, const uno::Any& pvargIndex, const uno::Any& pvarColumn ) : m_xProps( xProps ), m_pvargIndex( pvargIndex ), m_pvarColumn( pvarColumn )
-+{
-+}
-+
-+void ListPropListener::setValueEvent( const uno::Any& value )
-+{
-+ if( m_pvargIndex.hasValue() || m_pvarColumn.hasValue() )
-+ throw uno::RuntimeException( rtl::OUString::createFromAscii(
-+ "Bad argument" ), uno::Reference< uno::XInterface >() );
-+
-+ m_xProps->setPropertyValue( ITEMS, value );
-+}
-+
-+uno::Any ListPropListener::getValueEvent()
-+{
-+ uno::Sequence< rtl::OUString > sList;
-+ m_xProps->getPropertyValue( ITEMS ) >>= sList;
-+ sal_Int16 nLength = static_cast< sal_Int16 >( sList.getLength() );
-+ uno::Any aRet;
-+ if ( m_pvargIndex.hasValue() )
-+ {
-+ sal_Int16 nIndex = -1;
-+ m_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 ( m_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;
-+}
-+
- void SAL_CALL
- ListControlHelper::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex ) throw (uno::RuntimeException)
- {
-@@ -116,31 +174,5 @@ ListControlHelper::getListCount() throw (uno::RuntimeException)
- 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;
-+ return uno::makeAny( uno::Reference< XPropValue > ( new ScVbaPropValue( new ListPropListener( m_xProps, pvargIndex, pvarColumn ) ) ) );
- }
-diff --git vbahelper/source/msforms/vbamultipage.cxx vbahelper/source/msforms/vbamultipage.cxx
-index 4cdf220..8b3592c 100644
---- vbahelper/source/msforms/vbamultipage.cxx
-+++ vbahelper/source/msforms/vbamultipage.cxx
-@@ -88,8 +88,12 @@ 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 )
-+ sal_Int32 nVal = _value; // will be _value + 1 when cws container_controls is integrated
-+ sal_Int32 nOldVal = getValue();
- m_xProps->setPropertyValue( SVALUE, uno::makeAny( _value ) );
- mxDialogProps->setPropertyValue( SSTEP, uno::makeAny( _value + 1) );
-+ if ( nVal != nOldVal )
-+ fireChangeEvent();
- }
-
-
-diff --git vbahelper/source/msforms/vbaradiobutton.cxx vbahelper/source/msforms/vbaradiobutton.cxx
-index 3853f38..f8d6e21 100644
---- vbahelper/source/msforms/vbaradiobutton.cxx
-+++ vbahelper/source/msforms/vbaradiobutton.cxx
-@@ -70,6 +70,9 @@ void SAL_CALL
- ScVbaRadioButton::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
- {
- sal_Int16 nValue = 0;
-+ sal_Int16 nOldValue = 0;
-+ m_xProps->getPropertyValue( STATE ) >>= nOldValue;
-+
- sal_Bool bValue = sal_False;
- if( _value >>= nValue )
- {
-@@ -82,6 +85,15 @@ ScVbaRadioButton::setValue( const uno::Any& _value ) throw (uno::RuntimeExceptio
- nValue = 1;
- }
- m_xProps->setPropertyValue( STATE, uno::makeAny( nValue ) );
-+ if ( nValue != nOldValue )
-+ {
-+ fireChangeEvent();
-+ // In Excel, only when the radio button is checked, the click event is fired.
-+ if ( nValue != 0 )
-+ {
-+ fireClickEvent();
-+ }
-+ }
- }
-
- rtl::OUString&
-diff --git vbahelper/source/msforms/vbatextbox.cxx vbahelper/source/msforms/vbatextbox.cxx
-index 730f24c..be6e348 100644
---- vbahelper/source/msforms/vbatextbox.cxx
-+++ vbahelper/source/msforms/vbatextbox.cxx
-@@ -67,13 +67,20 @@ ScVbaTextBox::getText() throw (css::uno::RuntimeException)
- void SAL_CALL
- ScVbaTextBox::setText( const rtl::OUString& _text ) throw (css::uno::RuntimeException)
- {
-+ rtl::OUString sOldText = getText();
-+
- if ( !mbDialog )
- {
-- uno::Reference< text::XTextRange > xTextRange( m_xProps, uno::UNO_QUERY_THROW );
-- xTextRange->setString( _text );
--}
-+ 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 ) );
-+
-+ if ( _text != sOldText )
-+ {
-+ fireChangeEvent();
-+ }
- }
-
- sal_Int32 SAL_CALL
-@@ -90,7 +97,8 @@ ScVbaTextBox::getMaxLength() throw (css::uno::RuntimeException)
- void SAL_CALL
- ScVbaTextBox::setMaxLength( sal_Int32 _maxlength ) throw (css::uno::RuntimeException)
- {
-- uno::Any aValue( _maxlength );
-+ sal_Int16 _maxlength16 = static_cast<sal_Int16> (_maxlength); //liuchen 2009-7-24, resolve the problem that MaxLength cannot be set correctly
-+ uno::Any aValue( _maxlength16 ); //liuchen 2009-7-24, resolve the problem that MaxLength cannot be set correctly
- m_xProps->setPropertyValue
- (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MaxTextLen" ) ), aValue);
- }
-diff --git vbahelper/source/msforms/vbatogglebutton.cxx vbahelper/source/msforms/vbatogglebutton.cxx
-index d16fab9..f5abb73 100644
---- vbahelper/source/msforms/vbatogglebutton.cxx
-+++ vbahelper/source/msforms/vbatogglebutton.cxx
-@@ -68,16 +68,33 @@ ScVbaToggleButton::getValue() throw (uno::RuntimeException)
- return uno::makeAny( nState ? sal_Int16( -1 ) : sal_Int16( 0 ) );
- }
-
-+//liuchen 2009-7-23, resolve the defect that ToggleButton.Value cannot be set correctly
- void SAL_CALL
- ScVbaToggleButton::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
- {
- sal_Int16 nState = 0;
-- _value >>= nState;
-+ if (_value.getValueTypeClass() == uno::TypeClass_BOOLEAN)
-+ {
-+ sal_Bool bValue;
-+ _value >>= bValue;
-+ nState = static_cast< sal_Int16 >(bValue);
-+ }
-+ else if (_value.getValueTypeClass() == uno::TypeClass_BYTE)
-+ {
-+ sal_Int8 nValue;
-+ _value >>= nValue;
-+ nState = ( nValue == 1) ? 1 : 0;
-+ }
-+ else
-+ {
-+ _value >>= nState;
- OSL_TRACE( "nState - %d", nState );
-- nState = ( nState == -1 ) ? 1 : 0;
-+ nState = ( nState == -1 ) ? 1 : 0;
- OSL_TRACE( "nState - %d", nState );
-+ }
- m_xProps->setPropertyValue( STATE, uno::makeAny( nState ) );
- }
-+//liuchen 2009-7-23
-
- rtl::OUString&
- ScVbaToggleButton::getServiceImplName()
-diff --git vbahelper/source/msforms/vbauserform.cxx vbahelper/source/msforms/vbauserform.cxx
-index 12422bc..5218610 100644
---- vbahelper/source/msforms/vbauserform.cxx
-+++ vbahelper/source/msforms/vbauserform.cxx
-@@ -53,6 +53,8 @@ ScVbaUserForm::ScVbaUserForm( uno::Sequence< uno::Any > const& aArgs, uno::Refer
- uno::Reference< awt::XControl > xControl( m_xDialog, uno::UNO_QUERY_THROW );
- m_xProps.set( xControl->getModel(), uno::UNO_QUERY_THROW );
- setGeometryHelper( new UserFormGeometryHelper( xContext, xControl ) );
-+ if ( aArgs.getLength() >= 4 )
-+ aArgs[ 3 ] >>= m_sLibName;
- }
-
- ScVbaUserForm::~ScVbaUserForm()
-@@ -181,9 +181,11 @@ ScVbaUserForm::getValue( const ::rtl::OUString& aPropertyName ) throw (beans::Un
- 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 ) );
-+ uno::Reference< msforms::XControl > xVBAControl( aFac.createControl( xDialogControl->getModel() ) );
-+ ScVbaControl* pControl = dynamic_cast< ScVbaControl* >( xVBAControl.get() );
-+ pControl->setGeometryHelper( new UserFormGeometryHelper( mxContext, xControl ) );
-+ if ( m_sLibName.getLength() )
-+ pControl->setLibraryAndCodeName( m_sLibName.concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "." ) ) ).concat( getName() ) );
- aResult = uno::makeAny( xVBAControl );
- }
-
-diff --git vbahelper/source/msforms/vbauserform.hxx vbahelper/source/msforms/vbauserform.hxx
-index 463a3cb..fc55bb3 100644
---- vbahelper/source/msforms/vbauserform.hxx
-+++ vbahelper/source/msforms/vbauserform.hxx
-@@ -43,6 +43,7 @@ class ScVbaUserForm : public ScVbaUserForm_BASE
- private:
- css::uno::Reference< css::awt::XDialog > m_xDialog;
- bool mbDispose;
-+ rtl::OUString m_sLibName;
- protected:
- public:
- ScVbaUserForm( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext ) throw ( css::lang::IllegalArgumentException );
-diff --git vbahelper/source/vbahelper/makefile.mk vbahelper/source/vbahelper/makefile.mk
-index 22ed40a..31fefa8 100644
---- vbahelper/source/vbahelper/makefile.mk
-+++ vbahelper/source/vbahelper/makefile.mk
-@@ -33,11 +33,6 @@ ENABLE_EXCEPTIONS := TRUE
- VISIBILITY_HIDDEN=TRUE
- # --- Settings -----------------------------------------------------
-
--.IF "$(ENABLE_VBA)" == "NO"
--dummy:
-- @echo "Nothing to build"
--.ENDIF
--
- .INCLUDE : settings.mk
-
- SLOFILES=\
-diff --git vbahelper/source/vbahelper/vbaapplicationbase.cxx vbahelper/source/vbahelper/vbaapplicationbase.cxx
-index 57e3038..bb12c44 100644
---- vbahelper/source/vbahelper/vbaapplicationbase.cxx
-+++ vbahelper/source/vbahelper/vbaapplicationbase.cxx
-@@ -200,6 +200,8 @@ void SAL_CALL
- VbaApplicationBase::setScreenUpdating(sal_Bool bUpdate) throw (uno::RuntimeException)
- {
- uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
-+ if( bUpdate != xModel->hasControllersLocked() )
-+ return;
- if (bUpdate)
- xModel->unlockControllers();
- else
-@@ -293,7 +295,7 @@ VbaApplicationBase::getVersion() throw (uno::RuntimeException)
- return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(OFFICEVERSION));
- }
-
--void SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, const uno::Any& varg1, const uno::Any& varg2, const uno::Any& varg3, const uno::Any& varg4, const uno::Any& varg5, const uno::Any& varg6, const uno::Any& varg7, const uno::Any& varg8, const uno::Any& varg9, const uno::Any& varg10, const uno::Any& varg11, const uno::Any& varg12, const uno::Any& varg13, const uno::Any& varg14, const uno::Any& varg15, const uno::Any& varg16, const uno::Any& varg17, const uno::Any& varg18, const uno::Any& varg19, const uno::Any& varg20, const uno::Any& varg21, const uno::Any& varg22, const uno::Any& varg23, const uno::Any& varg24, const uno::Any& varg25, const uno::Any& varg26, const uno::Any& varg27, const uno::Any& varg28, const uno::Any& varg29, const uno::Any& varg30 ) throw (uno::RuntimeException)
-+uno::Any SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, const uno::Any& varg1, const uno::Any& varg2, const uno::Any& varg3, const uno::Any& varg4, const uno::Any& varg5, const uno::Any& varg6, const uno::Any& varg7, const uno::Any& varg8, const uno::Any& varg9, const uno::Any& varg10, const uno::Any& varg11, const uno::Any& varg12, const uno::Any& varg13, const uno::Any& varg14, const uno::Any& varg15, const uno::Any& varg16, const uno::Any& varg17, const uno::Any& varg18, const uno::Any& varg19, const uno::Any& varg20, const uno::Any& varg21, const uno::Any& varg22, const uno::Any& varg23, const uno::Any& varg24, const uno::Any& varg25, const uno::Any& varg26, const uno::Any& varg27, const uno::Any& varg28, const uno::Any& varg29, const uno::Any& varg30 ) throw (uno::RuntimeException)
- {
- ::rtl::OUString sSeparator = ::rtl::OUString::createFromAscii("/");
- ::rtl::OUString sMacroSeparator = ::rtl::OUString::createFromAscii("!");
-@@ -342,7 +344,8 @@ void SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, const u
- }
-
-
-- VBAMacroResolvedInfo aMacroInfo = resolveVBAMacro( getSfxObjShell( aMacroDocumentModel ), sMacro_only_Name );
-+ // search the global tempalte
-+ VBAMacroResolvedInfo aMacroInfo = resolveVBAMacro( getSfxObjShell( aMacroDocumentModel ), sMacro_only_Name, sal_True );
- if( aMacroInfo.IsResolved() )
- {
- // handle the arguments
-@@ -370,6 +373,8 @@ void SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, const u
- uno::Any aRet;
- uno::Any aDummyCaller;
- executeMacro( aMacroInfo.MacroDocContext(), aMacroInfo.ResolvedMacro(), aArgs, aRet, aDummyCaller );
-+
-+ return aRet;
- }
- else
- {
-diff --git vbahelper/source/vbahelper/vbadialogbase.cxx vbahelper/source/vbahelper/vbadialogbase.cxx
-index ec7ecae..472b2b4 100644
---- vbahelper/source/vbahelper/vbadialogbase.cxx
-+++ vbahelper/source/vbahelper/vbadialogbase.cxx
-@@ -30,11 +30,10 @@
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-
--// fails silently
--void
--VbaDialogBase::Show() throw(uno::RuntimeException)
-+sal_Bool SAL_CALL VbaDialogBase::Show() throw ( uno::RuntimeException )
- {
- rtl::OUString aURL;
-+ sal_Bool bSuccess = sal_False;
- if ( m_xModel.is() )
- {
- aURL = mapIndexToName( mnIndex );
-@@ -42,7 +41,26 @@ VbaDialogBase::Show() throw(uno::RuntimeException)
- throw uno::RuntimeException(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " Unable to open the specified dialog " ) ),
- uno::Reference< XInterface > () );
-- dispatchRequests( m_xModel, aURL );
-- }
--}
-
-+ uno::Sequence< beans::PropertyValue > dispatchProps(0);
-+ if ( aURL.equalsAscii(".uno:PrinterSetup") )
-+ {
-+ dispatchProps.realloc(1);
-+ dispatchProps[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBADialogResultRequest" ) );
-+ dispatchProps[0].Value <<= (sal_Bool) sal_True;
-+ }
-+
-+ VBADispatchListener *pNotificationListener = new VBADispatchListener();
-+ uno::Reference< frame::XDispatchResultListener > rListener = pNotificationListener;
-+ dispatchRequests( m_xModel, aURL, dispatchProps, rListener, sal_False );
-+
-+ bSuccess = pNotificationListener->getState();
-+ uno::Any aResult = pNotificationListener->getResult();
-+ if ( bSuccess )
-+ {
-+ if ( aResult.getValueTypeClass() == uno::TypeClass_BOOLEAN )
-+ aResult >>= bSuccess;
-+ }
-+ }
-+ return bSuccess;
-+}
-diff --git vbahelper/source/vbahelper/vbadocumentbase.cxx vbahelper/source/vbahelper/vbadocumentbase.cxx
-index 0eba699..49692e1 100644
---- vbahelper/source/vbahelper/vbadocumentbase.cxx
-+++ vbahelper/source/vbahelper/vbadocumentbase.cxx
-@@ -33,6 +33,7 @@
- #include <com/sun/star/util/XCloseable.hpp>
- #include <com/sun/star/frame/XStorable.hpp>
- #include <com/sun/star/frame/XFrame.hpp>
-+#include <com/sun/star/frame/XTitle.hpp>
- #include <com/sun/star/document/XEmbeddedScripts.hpp> //Michael E. Bohn
- #include <com/sun/star/beans/XPropertySet.hpp>
-
-@@ -68,13 +69,8 @@ VbaDocumentBase::getName() throw (uno::RuntimeException)
- }
- 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);
-+ uno::Reference< frame::XTitle > xTitle( getModel(), uno::UNO_QUERY_THROW );
-+ sName = xTitle->getTitle();
- }
- return sName;
- }
-@@ -130,12 +126,20 @@ VbaDocumentBase::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg,
- 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);
-+ try{
-+ xCloseable->close(sal_True);
-+ }
-+ catch( util::CloseVetoException )
-+ {
-+ //close is cancelled, nothing to do
-+ }
-+ }
- // 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.
-@@ -143,7 +147,16 @@ VbaDocumentBase::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg,
- {
- uno::Reference< lang::XComponent > xDisposable ( getModel(), uno::UNO_QUERY );
- if ( xDisposable.is() )
-- xDisposable->dispose();
-+ {
-+ // To be on the safe side, catch possible veto exception anyway.
-+ try
-+ {
-+ xDisposable->dispose();
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+ }
- }
- }
-
-diff --git vbahelper/source/vbahelper/vbadocumentsbase.cxx vbahelper/source/vbahelper/vbadocumentsbase.cxx
-index 61cdb52..d3eb535 100644
---- vbahelper/source/vbahelper/vbadocumentsbase.cxx
-+++ vbahelper/source/vbahelper/vbadocumentsbase.cxx
-@@ -34,6 +34,7 @@
- #include <com/sun/star/lang/XComponent.hpp>
- #include <com/sun/star/frame/XModel.hpp>
- #include <com/sun/star/frame/XFrame.hpp>
-+#include <com/sun/star/frame/XTitle.hpp>
- #include <com/sun/star/frame/FrameSearchFlag.hpp>
- #include <com/sun/star/util/XModifiable.hpp>
- #include <com/sun/star/frame/XStorable.hpp>
-@@ -143,8 +144,18 @@ public:
- {
- uno::Reference< frame::XModel > xModel( xServiceInfo, uno::UNO_QUERY_THROW ); // that the spreadsheetdocument is a xmodel is a given
- m_documents.push_back( xModel );
-- INetURLObject aURL( xModel->getURL() );
-- namesToIndices[ aURL.GetLastName() ] = nIndex++;
-+ rtl::OUString sName = xModel->getURL();
-+ if( sName.getLength() )
-+ {
-+ INetURLObject aURL( xModel->getURL() );
-+ namesToIndices[ aURL.GetLastName() ] = nIndex++;
-+ }
-+ else
-+ {
-+ uno::Reference< frame::XTitle > xTitle( xModel, uno::UNO_QUERY_THROW );
-+ sName = xTitle->getTitle();
-+ namesToIndices[ sName ] = nIndex++;
-+ }
- }
- }
-
-diff --git vbahelper/source/vbahelper/vbahelper.cxx vbahelper/source/vbahelper/vbahelper.cxx
-index 86d8e47..b3c904e 100644
---- vbahelper/source/vbahelper/vbahelper.cxx
-+++ vbahelper/source/vbahelper/vbahelper.cxx
-@@ -32,6 +32,7 @@
- #include <com/sun/star/frame/XDesktop.hpp>
- #include <com/sun/star/frame/XController.hpp>
- #include <com/sun/star/frame/XModel2.hpp>
-+#include <com/sun/star/frame/XNotifyingDispatch.hpp>
- #include <com/sun/star/script/XDefaultProperty.hpp>
- #include <com/sun/star/uno/XComponentContext.hpp>
- #include <com/sun/star/lang/XMultiComponentFactory.hpp>
-@@ -311,7 +312,7 @@ void dispatchExecute(SfxViewShell* pViewShell, USHORT nSlot, SfxCallMode nCall)
- }
-
- void
--dispatchRequests( const uno::Reference< frame::XModel>& xModel, const rtl::OUString& aUrl, const uno::Sequence< beans::PropertyValue >& sProps )
-+dispatchRequests (const uno::Reference< frame::XModel>& xModel, const rtl::OUString & aUrl, const uno::Sequence< beans::PropertyValue >& sProps, const uno::Reference< frame::XDispatchResultListener >& rListener, const sal_Bool bSilent )
- {
- util::URL url;
- url.Complete = aUrl;
-@@ -343,6 +344,7 @@ dispatchRequests( const uno::Reference< frame::XModel>& xModel, const rtl::OUStr
- }
-
- uno::Reference<frame::XDispatch> xDispatcher = xDispatchProvider->queryDispatch(url,emptyString,0);
-+ uno::Reference< frame::XNotifyingDispatch > xNotifyingDispatcher( xDispatcher, uno::UNO_QUERY );
-
- uno::Sequence<beans::PropertyValue> dispatchProps(1);
-
-@@ -358,11 +360,20 @@ dispatchRequests( const uno::Reference< frame::XModel>& xModel, const rtl::OUStr
- *pDest = *pSrc;
- }
-
-- (*pDest).Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Silent" ));
-- (*pDest).Value <<= (sal_Bool)sal_True;
-+ if ( bSilent )
-+ {
-+ (*pDest).Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Silent" ));
-+ (*pDest).Value <<= (sal_Bool)sal_True;
-+ }
-
-- if (xDispatcher.is())
-+ if ( !rListener.is() && xDispatcher.is() )
-+ {
- xDispatcher->dispatch( url, dispatchProps );
-+ }
-+ else if ( rListener.is() && xNotifyingDispatcher.is() )
-+ {
-+ xNotifyingDispatcher->dispatchWithNotification( url, dispatchProps, rListener );
-+ }
- }
-
- void
-@@ -962,6 +973,18 @@ sal_Bool setPropertyValue( uno::Sequence< beans::PropertyValue >& aProp, const r
- return sal_False;
- }
-
-+void setOrAppendPropertyValue( uno::Sequence< beans::PropertyValue >& aProp, const rtl::OUString& aName, const uno::Any& aValue )
-+{
-+ if( setPropertyValue( aProp, aName, aValue ) )
-+ return;
-+
-+ // append the property
-+ sal_Int32 nLength = aProp.getLength();
-+ aProp.realloc( nLength + 1 );
-+ aProp[ nLength ].Name = aName;
-+ aProp[ nLength ].Value = aValue;
-+}
-+
- // ====UserFormGeomentryHelper====
- //---------------------------------------------
- UserFormGeometryHelper::UserFormGeometryHelper( const uno::Reference< uno::XComponentContext >& /*xContext*/, const uno::Reference< awt::XControl >& xControl )
-@@ -1424,6 +1447,28 @@ void UserFormGeometryHelper::setHeight( double nHeight )
- return xIf;
- }
-
-+ // Listener for XNotifyingDispatch
-+ VBADispatchListener::VBADispatchListener() : m_State( sal_False )
-+ {
-+ }
-+
-+ // Listener for XNotifyingDispatch
-+ VBADispatchListener::~VBADispatchListener()
-+ {
-+ }
-+
-+ // Listener for XNotifyingDispatch
-+ void SAL_CALL VBADispatchListener::dispatchFinished( const frame::DispatchResultEvent& aEvent ) throw ( uno::RuntimeException )
-+ {
-+ m_Result = aEvent.Result;
-+ m_State = ( aEvent.State == frame::DispatchResultState::SUCCESS ) ? sal_True : sal_False;
-+ }
-+
-+ // Listener for XNotifyingDispatch
-+ void SAL_CALL VBADispatchListener::disposing( const lang::EventObject& /*aEvent*/ ) throw( uno::RuntimeException )
-+ {
-+ }
-+
- SfxObjectShell* getSfxObjShell( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
- {
- SfxObjectShell* pFoundShell = NULL;
-diff --git vbahelper/source/vbahelper/vbapictureformat.cxx vbahelper/source/vbahelper/vbapictureformat.cxx
-index bcdf83a..71fe406 100644
---- vbahelper/source/vbahelper/vbapictureformat.cxx
-+++ vbahelper/source/vbahelper/vbapictureformat.cxx
-@@ -112,13 +112,14 @@ ScVbaPictureFormat::IncrementContrast( double increment ) throw (uno::RuntimeExc
- {
- double nContrast = getContrast();
- nContrast += increment;
-- if( increment < 0 )
-+ //VBA, minz@cn.ibm.com.
-+ if( nContrast < 0 )
- {
-- increment = 0.0;
-+ nContrast = 0.0;
- }
-- if( increment > 1 )
-+ if( nContrast > 1 )
- {
-- increment = 1.0;
-+ nContrast = 1.0;
- }
- setContrast( nContrast );
- }
-diff --git vbahelper/source/vbahelper/vbashape.cxx vbahelper/source/vbahelper/vbashape.cxx
-index e0ec739..f95ede4 100644
---- vbahelper/source/vbahelper/vbashape.cxx
-+++ vbahelper/source/vbahelper/vbashape.cxx
-@@ -35,6 +35,7 @@
- #include <com/sun/star/lang/XServiceInfo.hpp>
- #include <com/sun/star/lang/XMultiServiceFactory.hpp>
- #include <com/sun/star/text/TextContentAnchorType.hpp>
-+#include <com/sun/star/text/RelOrientation.hpp>
- #include <ooo/vba/word/WdRelativeHorizontalPosition.hpp>
- #include <ooo/vba/word/WdRelativeVerticalPosition.hpp>
-
-@@ -219,25 +220,66 @@ ScVbaShape::setWidth( double _width ) throw (uno::RuntimeException)
- double SAL_CALL
- ScVbaShape::getLeft() throw (uno::RuntimeException)
- {
-- return m_pShapeHelper->getLeft();
-+ double left = 0;
-+ try
-+ {
-+ left = m_pShapeHelper->getLeft();
-+ }
-+ catch( uno::Exception& )
-+ {
-+ // fail to get position by using XShape::getPosition()
-+ sal_Int32 nLeft = 0;
-+ m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HoriOrientPosition") ) ) >>= nLeft;
-+ left = Millimeter::getInPoints( nLeft );
-+ }
-+ return left;
- }
-
- void SAL_CALL
- ScVbaShape::setLeft( double _left ) throw (uno::RuntimeException)
- {
-- m_pShapeHelper->setLeft( _left );
-+ try
-+ {
-+ m_pShapeHelper->setLeft( _left );
-+ }
-+ catch( uno::Exception& )
-+ {
-+ sal_Int32 nLeft = 0;
-+ nLeft = Millimeter::getInHundredthsOfOneMillimeter( _left );
-+ m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "HoriOrientPosition" ), uno::makeAny( nLeft ) );
-+ }
- }
-
- double SAL_CALL
- ScVbaShape::getTop() throw (uno::RuntimeException)
- {
-- return m_pShapeHelper->getTop();
-+ double top = 0;
-+ try
-+ {
-+ top = m_pShapeHelper->getTop();
-+ }
-+ catch( uno::Exception& )
-+ {
-+ sal_Int32 nTop = 0;
-+ m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VertOrientPosition") ) ) >>= nTop;
-+ top = Millimeter::getInPoints( nTop );
-+ }
-+ return top;
- }
-
- void SAL_CALL
- ScVbaShape::setTop( double _top ) throw (uno::RuntimeException)
- {
-- return m_pShapeHelper->setTop( _top );
-+ try
-+ {
-+ m_pShapeHelper->setTop( _top );
-+ }
-+ catch( uno::Exception& )
-+ {
-+ sal_Int32 nTop = 0;
-+ nTop = Millimeter::getInHundredthsOfOneMillimeter( _top );
-+ m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "VertOrientPosition" ), uno::makeAny( nTop ) );
-+ }
- }
-
- sal_Bool SAL_CALL
-@@ -474,6 +516,17 @@ ScVbaShape::ShapeRange( const uno::Any& index ) throw ( uno::RuntimeException )
- return uno::makeAny( xShapeRange );
- }
-
-+void SAL_CALL ScVbaShape::Copy() throw (uno::RuntimeException)
-+{
-+ if ( m_xModel.is() )
-+ {
-+ Select( uno::Any() );
-+ // Copy this Shape.
-+ rtl::OUString sUrl = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".uno:Copy") );
-+ dispatchRequests( m_xModel, sUrl );
-+ }
-+}
-+
- sal_Bool SAL_CALL
- ScVbaShape::getLockAspectRatio() throw (uno::RuntimeException)
- {
-@@ -504,35 +557,34 @@ sal_Int32 SAL_CALL
- ScVbaShape::getRelativeHorizontalPosition() throw (uno::RuntimeException)
- {
- sal_Int32 nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin;
-- text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH;
-- m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ) ) >>= eType;
-+ sal_Int16 nType = text::RelOrientation::PAGE_LEFT;
-+ m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HoriOrientRelation") ) ) >>= nType;
-
-- switch( eType )
-+ switch( nType )
- {
-- case text::TextContentAnchorType_AT_PARAGRAPH:
-+ case text::RelOrientation::FRAME:
- {
- nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionColumn;
- break;
- }
-- case text::TextContentAnchorType_AT_PAGE:
-+ case text::RelOrientation::PAGE_FRAME:
- {
- nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionPage;
- break;
- }
-- case text::TextContentAnchorType_AT_CHARACTER:
-+ case text::RelOrientation::CHAR:
- {
- nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionCharacter;
- break;
- }
-- case text::TextContentAnchorType_AT_FRAME:
-- case text::TextContentAnchorType_AS_CHARACTER:
-+ case text::RelOrientation::PAGE_PRINT_AREA:
- {
- nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin;
- break;
- }
- default:
- {
-- nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin;
-+ throw uno::RuntimeException( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Shape::RelativeHorizontalPosition: not implemented" ) ), uno::Reference< uno::XInterface >() );
- }
- }
- return nRelativeHorizontalPosition;
-@@ -541,23 +593,27 @@ ScVbaShape::getRelativeHorizontalPosition() throw (uno::RuntimeException)
- void SAL_CALL
- ScVbaShape::setRelativeHorizontalPosition( ::sal_Int32 _relativehorizontalposition ) throw (uno::RuntimeException)
- {
-- text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH;
-+ sal_Int16 nType = text::RelOrientation::PAGE_FRAME;
- switch( _relativehorizontalposition )
- {
- case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionCharacter:
- {
-- eType = text::TextContentAnchorType_AT_CHARACTER;
-+ nType = text::RelOrientation::CHAR;
- break;
- }
- case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionColumn:
-+ {
-+ nType = text::RelOrientation::PAGE_FRAME;
-+ break;
-+ }
- case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin:
- {
-- eType = text::TextContentAnchorType_AT_PARAGRAPH;
-+ nType = text::RelOrientation::PAGE_PRINT_AREA;
- break;
- }
- case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionPage:
- {
-- eType = text::TextContentAnchorType_AT_PAGE;
-+ nType = text::RelOrientation::PAGE_FRAME;
- break;
- }
- default:
-@@ -565,42 +621,41 @@ ScVbaShape::setRelativeHorizontalPosition( ::sal_Int32 _relativehorizontalpositi
- DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
- }
- }
-- m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ), uno::makeAny( eType ) );
-+ m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HoriOrientRelation") ), uno::makeAny( nType ) );
- }
-
- sal_Int32 SAL_CALL
- ScVbaShape::getRelativeVerticalPosition() throw (uno::RuntimeException)
- {
- sal_Int32 nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin;
-- text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH;
-- m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ) ) >>= eType;
-+ sal_Int16 nType = text::RelOrientation::PAGE_FRAME;
-+ m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VertOrientRelation") ) ) >>= nType;
-
-- switch( eType )
-+ switch( nType )
- {
-- case text::TextContentAnchorType_AT_PARAGRAPH:
-+ case text::RelOrientation::FRAME:
- {
- nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionParagraph;
- break;
- }
-- case text::TextContentAnchorType_AT_PAGE:
-+ case text::RelOrientation::PAGE_FRAME:
- {
- nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionPage;
- break;
- }
-- case text::TextContentAnchorType_AT_CHARACTER:
-+ case text::RelOrientation::TEXT_LINE:
- {
- nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionLine;
- break;
- }
-- case text::TextContentAnchorType_AT_FRAME:
-- case text::TextContentAnchorType_AS_CHARACTER:
-+ case text::RelOrientation::PAGE_PRINT_AREA:
- {
- nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin;
- break;
- }
- default:
- {
-- nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin;
-+ throw uno::RuntimeException( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Shape::RelativeVerticalPosition: not implemented" ) ), uno::Reference< uno::XInterface >() );
- }
- }
- return nRelativeVerticalPosition;
-@@ -609,23 +664,27 @@ ScVbaShape::getRelativeVerticalPosition() throw (uno::RuntimeException)
- void SAL_CALL
- ScVbaShape::setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition ) throw (uno::RuntimeException)
- {
-- text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH;
-+ sal_Int16 nType = text::RelOrientation::PAGE_FRAME;
- switch( _relativeverticalposition )
- {
- case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionLine:
- {
-- eType = text::TextContentAnchorType_AT_CHARACTER;
-+ nType = text::RelOrientation::TEXT_LINE;
- break;
- }
- case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionParagraph:
-+ {
-+ nType = text::RelOrientation::FRAME;
-+ break;
-+ }
- case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin:
- {
-- eType = text::TextContentAnchorType_AT_PARAGRAPH;
-+ nType = text::RelOrientation::PAGE_PRINT_AREA;
- break;
- }
- case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionPage:
- {
-- eType = text::TextContentAnchorType_AT_PAGE;
-+ nType = text::RelOrientation::PAGE_FRAME;
- break;
- }
- default:
-@@ -633,7 +692,7 @@ ScVbaShape::setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition )
- DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
- }
- }
-- m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ), uno::makeAny( eType ) );
-+ m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VertOrientRelation") ), uno::makeAny( nType ) );
- }
-
- uno::Any SAL_CALL
-diff --git vbahelper/source/vbahelper/vbashaperange.cxx vbahelper/source/vbahelper/vbashaperange.cxx
-index f6dc8ad..cfdf185 100644
---- vbahelper/source/vbahelper/vbashaperange.cxx
-+++ vbahelper/source/vbahelper/vbashaperange.cxx
-@@ -122,6 +122,27 @@ ScVbaShapeRange::IncrementTop( double Increment ) throw (uno::RuntimeException)
- {
- uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW );
- xShape->IncrementTop( Increment );
-+ }
-+}
-+
-+rtl::OUString SAL_CALL ScVbaShapeRange::getName() 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 );
-+ return xShape->getName( );
-+ }
-+ throw uno::RuntimeException();
-+}
-+
-+void SAL_CALL ScVbaShapeRange::setName( const rtl::OUString& _name ) 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->setName( _name );
- }
- }
-
-@@ -337,6 +358,16 @@ uno::Any SAL_CALL ScVbaShapeRange::WrapFormat( ) throw (css::uno::RuntimeExcept
- throw uno::RuntimeException();
- }
-
-+void SAL_CALL ScVbaShapeRange::ZOrder( sal_Int32 ZOrderCmd ) 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->ZOrder( ZOrderCmd );
-+ }
-+}
-+
- uno::Type SAL_CALL
- ScVbaShapeRange::getElementType() throw (uno::RuntimeException)
- {
-diff --git vbahelper/source/vbahelper/vbashapes.cxx vbahelper/source/vbahelper/vbashapes.cxx
-index f64b4aa..1b77ef8 100644
---- vbahelper/source/vbahelper/vbashapes.cxx
-+++ vbahelper/source/vbahelper/vbashapes.cxx
-@@ -86,7 +86,7 @@ void ScVbaShapes::initBaseCollection()
- 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, const uno::Reference< frame::XModel>& xModel ): ScVbaShapes_BASE( xParent, xContext, xShapes ), m_nNewShapeCount(0), m_xModel( xModel )
-+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, const uno::Reference< frame::XModel>& xModel ): ScVbaShapes_BASE( xParent, xContext, xShapes, sal_True ), m_nNewShapeCount(0), m_xModel( xModel )
- {
- m_xShapes.set( xShapes, uno::UNO_QUERY_THROW );
- m_xDrawPage.set( xShapes, uno::UNO_QUERY_THROW );
-diff --git vbahelper/util/makefile.mk vbahelper/util/makefile.mk
-index dda4be0..33c4900 100644
---- vbahelper/util/makefile.mk
-+++ vbahelper/util/makefile.mk
-@@ -95,6 +95,7 @@ SHL2STDLIBS= \
- $(VCLLIB) \
- $(TKLIB) \
- $(BASICLIB) \
-+ $(SVXMSFILTERLIB) \
-
- SHL2DEPN=$(SHL1TARGETN)
- SHL2LIBS=$(SLB)$/$(TARGET_MSFORMS).lib
-diff --git vcl/inc/vcl/bitmap.hxx vcl/inc/vcl/bitmap.hxx
-index 435e4c6..d3f2282 100644
---- vcl/inc/vcl/bitmap.hxx
-+++ vcl/inc/vcl/bitmap.hxx
-@@ -267,9 +267,9 @@ public:
- SAL_DLLPRIVATE void ImplSetImpBitmap( ImpBitmap* pImpBmp );
- SAL_DLLPRIVATE void ImplAssignWithSize( const Bitmap& rBitmap );
-
-- SAL_DLLPRIVATE static BOOL ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, ULONG nOffset );
-+ SAL_DLLPRIVATE static BOOL ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, ULONG nOffset, BOOL bMSOFormat=FALSE );
- SAL_DLLPRIVATE static BOOL ImplReadDIBFileHeader( SvStream& rIStm, ULONG& rOffset );
-- SAL_DLLPRIVATE static BOOL ImplReadDIBInfoHeader( SvStream& rIStm, DIBInfoHeader& rHeader, sal_Bool& bTopDown );
-+ SAL_DLLPRIVATE static BOOL ImplReadDIBInfoHeader( SvStream& rIStm, DIBInfoHeader& rHeader, sal_Bool& bTopDown, BOOL bMSOFormat = FALSE );
- SAL_DLLPRIVATE static BOOL ImplReadDIBPalette( SvStream& rIStm, BitmapWriteAccess& rAcc, BOOL bQuad );
- SAL_DLLPRIVATE static BOOL ImplReadDIBBits( SvStream& rIStm, DIBInfoHeader& rHeader, BitmapWriteAccess& rAcc, sal_Bool bTopDown );
- SAL_DLLPRIVATE BOOL ImplWriteDIB( SvStream& rOStm, BitmapReadAccess& rAcc, BOOL bCompressed ) const;
-@@ -764,7 +764,7 @@ public:
-
- public:
-
-- BOOL Read( SvStream& rIStm, BOOL bFileHeader = TRUE );
-+ BOOL Read( SvStream& rIStm, BOOL bFileHeader = TRUE, BOOL bMSOFormat = FALSE );
- BOOL Write( SvStream& rOStm, BOOL bCompressed = TRUE, BOOL bFileHeader = TRUE ) const;
-
- friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, Bitmap& rBitmap );
-diff --git vcl/inc/vcl/bitmapex.hxx vcl/inc/vcl/bitmapex.hxx
-index a7185da..29dfe13 100644
---- vcl/inc/vcl/bitmapex.hxx
-+++ vcl/inc/vcl/bitmapex.hxx
-@@ -395,6 +395,7 @@ public:
-
- friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const BitmapEx& rBitmapEx );
- friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, BitmapEx& rBitmapEx );
-+ static BitmapEx AutoScaleBitmap(BitmapEx & aBitmap, const long aStandardSize);
- };
-
- #endif // _SV_BITMAPEX_HXX
-diff --git vcl/inc/vcl/dialog.hxx vcl/inc/vcl/dialog.hxx
-index 1032908..f771333 100644
---- vcl/inc/vcl/dialog.hxx
-+++ vcl/inc/vcl/dialog.hxx
-@@ -53,6 +53,7 @@ private:
- BOOL mbOldSaveBack;
- BOOL mbInClose;
- BOOL mbModalMode;
-+ sal_Int8 mnCancelClose; //liuchen 2009-7-22, support Excel VBA UserForm_QueryClose event
-
- SAL_DLLPRIVATE void ImplInitDialogData();
- SAL_DLLPRIVATE void ImplInitSettings();
-@@ -91,6 +92,9 @@ public:
- virtual short Execute();
- BOOL IsInExecute() const { return mbInExecute; }
-
-+ sal_Int8 GetCloseFlag() const { return mnCancelClose; } //liuchen 2009-7-22, support Excel VBA UserForm_QueryClose event
-+ void SetCloseFlag( sal_Int8 nCancel ) { mnCancelClose = nCancel; } //liuchen 2009-7-22, support Excel VBA UserForm_QueryClose event
-+
- ////////////////////////////////////////
- // Dialog::Execute replacement API
- public:
-diff --git vcl/source/control/combobox.cxx vcl/source/control/combobox.cxx
-index 4dbc78a..c96c1d6 100644
---- vcl/source/control/combobox.cxx
-+++ vcl/source/control/combobox.cxx
-@@ -468,8 +468,11 @@ IMPL_LINK( ComboBox, ImplSelectHdl, void*, EMPTYARG )
- mpSubEdit->SetModifyFlag();
- mbSyntheticModify = TRUE;
- Modify();
-- mbSyntheticModify = FALSE;
-- Select();
-+ mbSyntheticModify = FALSE;
-+ if (ImplGetWindowImpl() != NULL) //liuchen 2009-7-28, resolve the problem that soffice get crashed if in ComboBox_Change event a Worksheets("SheetX").Activate sentence needs to be executed
-+ {
-+ Select();
-+ }
- }
-
- return 0;
-diff --git vcl/source/gdi/bitmap2.cxx vcl/source/gdi/bitmap2.cxx
-index d982d64..50c7bad 100644
---- vcl/source/gdi/bitmap2.cxx
-+++ vcl/source/gdi/bitmap2.cxx
-@@ -46,6 +46,8 @@
-
- #define DIBCOREHEADERSIZE ( 12UL )
- #define DIBINFOHEADERSIZE ( sizeof( DIBInfoHeader ) )
-+#define BITMAPINFOHEADER 0x28
-+
- #define SETPIXEL4( pBuf, nX, cChar )( (pBuf)[ (nX) >> 1 ] |= ( (nX) & 1 ) ? ( cChar ): (cChar) << 4 );
-
- // ----------------------
-@@ -129,7 +131,7 @@ SvStream& operator<<( SvStream& rOStm, const Bitmap& rBitmap )
-
- // ------------------------------------------------------------------
-
--BOOL Bitmap::Read( SvStream& rIStm, BOOL bFileHeader )
-+BOOL Bitmap::Read( SvStream& rIStm, BOOL bFileHeader, BOOL bIsMSOFormat )
- {
- const USHORT nOldFormat = rIStm.GetNumberFormatInt();
- const ULONG nOldPos = rIStm.Tell();
-@@ -144,7 +146,7 @@ BOOL Bitmap::Read( SvStream& rIStm, BOOL bFileHeader )
- bRet = ImplReadDIB( rIStm, *this, nOffset );
- }
- else
-- bRet = ImplReadDIB( rIStm, *this, nOffset );
-+ bRet = ImplReadDIB( rIStm, *this, nOffset, bIsMSOFormat );
-
- if( !bRet )
- {
-@@ -161,14 +163,14 @@ BOOL Bitmap::Read( SvStream& rIStm, BOOL bFileHeader )
-
- // ------------------------------------------------------------------
-
--BOOL Bitmap::ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, ULONG nOffset )
-+BOOL Bitmap::ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, ULONG nOffset, BOOL bIsMSOFormat )
- {
- DIBInfoHeader aHeader;
- const ULONG nStmPos = rIStm.Tell();
- BOOL bRet = FALSE;
- sal_Bool bTopDown = sal_False;
-
-- if( ImplReadDIBInfoHeader( rIStm, aHeader, bTopDown ) && aHeader.nWidth && aHeader.nHeight && aHeader.nBitCount )
-+ if( ImplReadDIBInfoHeader( rIStm, aHeader, bTopDown, bIsMSOFormat ) && aHeader.nWidth && aHeader.nHeight && aHeader.nBitCount )
- {
- const USHORT nBitCount( discretizeBitcount(aHeader.nBitCount) );
-
-@@ -299,20 +301,36 @@ BOOL Bitmap::ImplReadDIBFileHeader( SvStream& rIStm, ULONG& rOffset )
-
- // ------------------------------------------------------------------
-
--BOOL Bitmap::ImplReadDIBInfoHeader( SvStream& rIStm, DIBInfoHeader& rHeader, sal_Bool& bTopDown )
-+BOOL Bitmap::ImplReadDIBInfoHeader( SvStream& rIStm, DIBInfoHeader& rHeader, sal_Bool& bTopDown, sal_Bool bIsMSOFormat )
- {
- // BITMAPINFOHEADER or BITMAPCOREHEADER
- rIStm >> rHeader.nSize;
-
- // BITMAPCOREHEADER
-+ sal_Int16 nTmp16 = 0;
-+ sal_uInt8 nTmp8 = 0;
- if ( rHeader.nSize == DIBCOREHEADERSIZE )
- {
-- sal_Int16 nTmp16;
-
- rIStm >> nTmp16; rHeader.nWidth = nTmp16;
- rIStm >> nTmp16; rHeader.nHeight = nTmp16;
- rIStm >> rHeader.nPlanes;
- rIStm >> rHeader.nBitCount;
-+ }
-+ else if ( bIsMSOFormat && ( rHeader.nSize == BITMAPINFOHEADER ) )
-+ {
-+ rIStm >> nTmp16; rHeader.nWidth = nTmp16;
-+ rIStm >> nTmp16; rHeader.nHeight = nTmp16;
-+ rIStm >> nTmp8; rHeader.nPlanes = nTmp8;
-+ rIStm >> nTmp8; rHeader.nBitCount = nTmp8;
-+ rIStm >> nTmp16; rHeader.nSizeImage = nTmp16;
-+ rIStm >> nTmp16; rHeader.nCompression = nTmp16;
-+ if ( !rHeader.nSizeImage ) // uncompressed?
-+ rHeader.nSizeImage = ((rHeader.nWidth * rHeader.nBitCount + 31) & ~31) / 8 * rHeader.nHeight;
-+ rIStm >> rHeader.nXPelsPerMeter;
-+ rIStm >> rHeader.nYPelsPerMeter;
-+ rIStm >> rHeader.nColsUsed;
-+ rIStm >> rHeader.nColsImportant;
- }
- else
- {
-diff --git vcl/source/gdi/bitmapex.cxx vcl/source/gdi/bitmapex.cxx
-index cfa9e4c..1997455 100644
---- vcl/source/gdi/bitmapex.cxx
-+++ vcl/source/gdi/bitmapex.cxx
-@@ -45,6 +45,7 @@
- #include <tools/rc.h>
- #include <vcl/svapp.hxx>
- #include <vcl/bmpacc.hxx>
-+#include <vcl/virdev.hxx>
-
- // ------------
- // - BitmapEx -
-@@ -757,6 +758,61 @@ void BitmapEx::Draw( OutputDevice* pOutDev,
- pOutDev->DrawBitmapEx( rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel, *this );
- }
-
-+BitmapEx BitmapEx:: AutoScaleBitmap(BitmapEx & aBitmap, const long aStandardSize)
-+{
-+ Point aEmptyPoint(0,0);
-+ sal_Int32 imgNewWidth = 0;
-+ sal_Int32 imgNewHeight = 0;
-+ double imgposX = 0;
-+ double imgposY = 0;
-+ BitmapEx aRet = aBitmap;
-+ double imgOldWidth = aRet.GetSizePixel().Width();
-+ double imgOldHeight =aRet.GetSizePixel().Height();
-+
-+ Size aScaledSize;
-+ if (imgOldWidth >= aStandardSize || imgOldHeight >= aStandardSize)
-+ {
-+ if (imgOldWidth >= imgOldHeight)
-+ {
-+ imgNewWidth = aStandardSize;
-+ imgNewHeight = sal_Int32(imgOldHeight / (imgOldWidth / aStandardSize) + 0.5);
-+ imgposX = 0;
-+ imgposY = (aStandardSize - (imgOldHeight / (imgOldWidth / aStandardSize) + 0.5)) / 2 + 0.5;
-+ }
-+ else
-+ {
-+ imgNewHeight = aStandardSize;
-+ imgNewWidth = sal_Int32(imgOldWidth / (imgOldHeight / aStandardSize) + 0.5);
-+ imgposY = 0;
-+ imgposX = (aStandardSize - (imgOldWidth / (imgOldHeight / aStandardSize) + 0.5)) / 2 + 0.5;
-+ }
-+
-+ aScaledSize = Size( imgNewWidth, imgNewHeight );
-+ aRet.Scale( aScaledSize, BMP_SCALE_INTERPOLATE );
-+ }
-+ else
-+ {
-+ imgposX = (aStandardSize - imgOldWidth) / 2 + 0.5;
-+ imgposY = (aStandardSize - imgOldHeight) / 2 + 0.5;
-+ }
-+
-+ Size aBmpSize = aRet.GetSizePixel();
-+ Size aStdSize( aStandardSize, aStandardSize );
-+ Rectangle aRect(aEmptyPoint, aStdSize );
-+
-+ VirtualDevice aVirDevice( *Application::GetDefaultDevice(), 0, 1 );
-+ aVirDevice.SetOutputSizePixel( aStdSize );
-+ aVirDevice.SetFillColor( COL_TRANSPARENT );
-+ aVirDevice.SetLineColor( COL_TRANSPARENT );
-+
-+ //draw a rect into virDevice
-+ aVirDevice.DrawRect( aRect );
-+ Point aPointPixel( (long)imgposX, (long)imgposY );
-+ aVirDevice.DrawBitmapEx( aPointPixel, aRet );
-+ aRet = aVirDevice.GetBitmapEx( aEmptyPoint, aStdSize );
-+
-+ return aRet;
-+}
- // ------------------------------------------------------------------
-
- sal_uInt8 BitmapEx::GetTransparency(sal_Int32 nX, sal_Int32 nY) const
-diff --git vcl/source/window/dialog.cxx vcl/source/window/dialog.cxx
-index 86b7e85..1e493ce 100644
---- vcl/source/window/dialog.cxx
-+++ vcl/source/window/dialog.cxx
-@@ -559,7 +559,14 @@ BOOL Dialog::Close()
- {
- ImplDelData aDelData;
- ImplAddDel( &aDelData );
-- ImplCallEventListeners( VCLEVENT_WINDOW_CLOSE );
-+ //liuchen 2009-7-22, support Excel VBA UserForm_QueryClose event
-+ mnCancelClose = 0;
-+ ImplCallEventListeners( VCLEVENT_WINDOW_CLOSE );
-+ if (mnCancelClose == 1)
-+ {
-+ return FALSE;
-+ }
-+ //liuchen 2009-7-22
- if ( aDelData.IsDelete() )
- return FALSE;
- ImplRemoveDel( &aDelData );
-diff --git vcl/source/window/toolbox2.cxx vcl/source/window/toolbox2.cxx
-index 9f15df6..9fb1d55 100644
---- vcl/source/window/toolbox2.cxx
-+++ vcl/source/window/toolbox2.cxx
-@@ -56,6 +56,8 @@ using namespace rtl;
-
- #define TB_SEP_SIZE 8
-
-+ButtonType determineButtonType( ImplToolItem* pItem, ButtonType defaultType );
-+
- // -----------------------------------------------------------------------
-
- ImplToolBoxPrivateData::ImplToolBoxPrivateData() :
-diff --git xmloff/inc/xmlnmspe.hxx xmloff/inc/xmlnmspe.hxx
-index 1451cde..33de6ea 100644
---- xmloff/inc/xmlnmspe.hxx
-+++ xmloff/inc/xmlnmspe.hxx
-@@ -104,6 +104,7 @@ XML_OLD_NAMESPACE( META, 6U )
-
- // experimental namespaces
- XML_NAMESPACE( FIELD, 100U )
-+XML_NAMESPACE( FORMX, 101U ) // form interop extensions
- XML_NAMESPACE( CSS3TEXT, 103U ) // CSS Text Level 3
-
- #endif // _XMLOFF_XMLNMSPE_HXX
-diff --git xmloff/inc/xmloff/shapeexport.hxx xmloff/inc/xmloff/shapeexport.hxx
-index 9f28c27..43cabbe 100644
---- xmloff/inc/xmloff/shapeexport.hxx
-+++ xmloff/inc/xmloff/shapeexport.hxx
-@@ -199,11 +199,6 @@ private:
- const rtl::OUString msStartShape;
- const rtl::OUString msEndShape;
- const rtl::OUString msOnClick;
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
-- const rtl::OUString msOnAction;
-- const rtl::OUString msAction;
-- const rtl::OUString msURL;
--#endif
- const rtl::OUString msEventType;
- const rtl::OUString msPresentation;
- const rtl::OUString msMacroName;
-diff --git xmloff/inc/xmloff/xmltoken.hxx xmloff/inc/xmloff/xmltoken.hxx
-index 3ea86c2..f174cbf 100644
---- xmloff/inc/xmloff/xmltoken.hxx
-+++ xmloff/inc/xmloff/xmltoken.hxx
-@@ -145,6 +145,10 @@ namespace xmloff { namespace token {
- XML_NP_OFFICE_EXT,
- XML_N_OFFICE_EXT,
-
-+ // jonp: 2008-09-24 Excel Interop
-+ XML_NP_FORMX,
-+ XML_N_FORMX,
-+
- XML_NP_TABLE_EXT,
- XML_N_TABLE_EXT,
-
-diff --git xmloff/source/core/xmlexp.cxx xmloff/source/core/xmlexp.cxx
-index 9b1ddcb..e8a2c22 100644
---- xmloff/source/core/xmlexp.cxx
-+++ xmloff/source/core/xmlexp.cxx
-@@ -409,6 +409,7 @@ void SvXMLExport::_InitCtor()
- mpNamespaceMap->Add( GetXMLToken(XML_NP_XSD), GetXMLToken(XML_N_XSD), XML_NAMESPACE_XSD );
- mpNamespaceMap->Add( GetXMLToken(XML_NP_XSI), GetXMLToken(XML_N_XSI), XML_NAMESPACE_XSI );
- mpNamespaceMap->Add( GetXMLToken(XML_NP_FIELD), GetXMLToken(XML_N_FIELD), XML_NAMESPACE_FIELD );
-+ mpNamespaceMap->Add( GetXMLToken(XML_NP_FORMX), GetXMLToken(XML_N_FORMX), XML_NAMESPACE_FORMX );
- }
- // RDFa: needed for content and header/footer styles
- if( (getExportFlags() & (EXPORT_STYLES|EXPORT_AUTOSTYLES|EXPORT_MASTERSTYLES|EXPORT_CONTENT) ) != 0 )
-diff --git xmloff/source/core/xmlimp.cxx xmloff/source/core/xmlimp.cxx
-index ba559a0..e6105d8 100644
---- xmloff/source/core/xmlimp.cxx
-+++ xmloff/source/core/xmlimp.cxx
-@@ -115,6 +115,7 @@ sal_Char __READONLY_DATA sXML_np__script[] = "_script";
- sal_Char __READONLY_DATA sXML_np__config[] = "_config";
- sal_Char __READONLY_DATA sXML_np__db[] = "_db";
- sal_Char __READONLY_DATA sXML_np__xforms[] = "_xforms";
-+sal_Char __READONLY_DATA sXML_np__formx[] = "_formx";
- sal_Char __READONLY_DATA sXML_np__xsd[] = "_xsd";
- sal_Char __READONLY_DATA sXML_np__xsi[] = "_xsi";
- sal_Char __READONLY_DATA sXML_np__field[] = "_field";
-@@ -309,6 +310,9 @@ void SvXMLImport::_InitCtor()
- mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__xforms) ),
- GetXMLToken(XML_N_XFORMS_1_0),
- XML_NAMESPACE_XFORMS );
-+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__formx) ),
-+ GetXMLToken( XML_N_FORMX ),
-+ XML_NAMESPACE_FORMX );
- mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__xsd) ),
- GetXMLToken(XML_N_XSD),
- XML_NAMESPACE_XSD );
-diff --git xmloff/source/core/xmltoken.cxx xmloff/source/core/xmltoken.cxx
-index ba3840e..bc02a51 100644
---- xmloff/source/core/xmltoken.cxx
-+++ xmloff/source/core/xmltoken.cxx
-@@ -153,6 +153,9 @@ namespace xmloff { namespace token {
- TOKEN( "officeooo", XML_NP_OFFICE_EXT ),
- TOKEN( "http://openoffice.org/2009/office", XML_N_OFFICE_EXT ),
-
-+ // jonp: 2008-09-24 Excel Interop
-+ TOKEN( "formx", XML_NP_FORMX ),
-+ TOKEN( "urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0", XML_N_FORMX ),
- TOKEN( "tableooo", XML_NP_TABLE_EXT ),
- TOKEN( "http://openoffice.org/2009/table", XML_N_TABLE_EXT ),
-
-diff --git xmloff/source/draw/eventimp.cxx xmloff/source/draw/eventimp.cxx
-index dcc9ff4..732fc07 100644
---- xmloff/source/draw/eventimp.cxx
-+++ xmloff/source/draw/eventimp.cxx
-@@ -101,9 +101,6 @@ public:
-
- sal_Bool mbValid;
- sal_Bool mbScript;
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
-- sal_Bool mbActionEvent;
--#endif
- ClickAction meClickAction;
- XMLEffect meEffect;
- XMLEffectDirection meDirection;
-@@ -115,9 +112,6 @@ public:
- OUString msMacroName;
- OUString msBookmark;
- OUString msLanguage;
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
-- OUString msHyperURL;
--#endif
- };
-
- ///////////////////////////////////////////////////////////////////////
-@@ -176,18 +170,11 @@ TYPEINIT1( SdXMLEventContext, SvXMLImportContext );
-
- SdXMLEventContext::SdXMLEventContext( SvXMLImport& rImp, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, const Reference< XShape >& rxShape )
- : SvXMLImportContext(rImp, nPrfx, rLocalName),
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
-- mxShape( rxShape ), mbScript( sal_False ), mbActionEvent( sal_False ), meClickAction( ClickAction_NONE ),
--#else
- mxShape( rxShape ), mbScript( sal_False ), meClickAction( ClickAction_NONE ),
--#endif
- meEffect( EK_none ), meDirection( ED_none ), mnStartScale( 100 ),
- meSpeed( AnimationSpeed_MEDIUM ), mnVerb(0), mbPlayFull( sal_False )
- {
- static const OUString sXMLClickName( RTL_CONSTASCII_USTRINGPARAM( "click" ) );
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
-- static const OUString sXMLActionName( RTL_CONSTASCII_USTRINGPARAM( "action" ) );
--#endif
-
- if( nPrfx == XML_NAMESPACE_PRESENTATION && IsXMLToken( rLocalName, XML_EVENT_LISTENER ) )
- {
-@@ -258,12 +245,7 @@ SdXMLEventContext::SdXMLEventContext( SvXMLImport& rImp, sal_uInt16 nPrfx, cons
- sEventName = sValue;
- sal_uInt16 nScriptPrefix =
- GetImport().GetNamespaceMap().GetKeyByAttrName( sValue, &sEventName );
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
-- mbValid = XML_NAMESPACE_DOM == nScriptPrefix && ( sEventName == sXMLClickName || sEventName == sXMLActionName );
-- mbActionEvent = mbValid && (sEventName == sXMLActionName);
--#else
- mbValid = XML_NAMESPACE_DOM == nScriptPrefix && sEventName == sXMLClickName;
--#endif
- }
- else if( IsXMLToken( aAttrLocalName, XML_LANGUAGE ) )
- {
-@@ -292,12 +274,6 @@ SdXMLEventContext::SdXMLEventContext( SvXMLImport& rImp, sal_uInt16 nPrfx, cons
- {
- msMacroName = sValue;
- }
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
-- else if ( mbActionEvent )
-- {
-- msHyperURL = sValue;
-- }
--#endif
- else
- {
- const rtl::OUString &rTmp =
-@@ -343,26 +319,6 @@ void SdXMLEventContext::EndElement()
- OUString sAPIEventName;
- uno::Sequence< beans::PropertyValue > aProperties;
-
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
-- if( mbActionEvent )
-- {
-- sAPIEventName = OUString( RTL_CONSTASCII_USTRINGPARAM( "OnAction" ) );
-- aProperties.realloc( 2 );
-- beans::PropertyValue* pProperty = aProperties.getArray();
--
-- pProperty->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "EventType" ) );
-- pProperty->Handle = -1;
-- pProperty->Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "Action" ) );
-- pProperty->State = beans::PropertyState_DIRECT_VALUE;
-- ++pProperty;
-- pProperty->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
-- pProperty->Handle = -1;
-- pProperty->Value <<= msHyperURL;
-- pProperty->State = beans::PropertyState_DIRECT_VALUE;
-- }
-- else
--#endif
-- {
- sAPIEventName = OUString( RTL_CONSTASCII_USTRINGPARAM( "OnClick" ) );
-
- if( mbScript )
-@@ -547,8 +503,6 @@ void SdXMLEventContext::EndElement()
- break;
- }
- }
-- }
--
- xEvents->replaceByName( sAPIEventName, uno::Any( aProperties ) );
-
- } while(0);
-diff --git xmloff/source/draw/shapeexport.cxx xmloff/source/draw/shapeexport.cxx
-index 76353ba..7dc8ce6 100644
---- xmloff/source/draw/shapeexport.cxx
-+++ xmloff/source/draw/shapeexport.cxx
-@@ -90,11 +90,6 @@ XMLShapeExport::XMLShapeExport(SvXMLExport& rExp,
- msStartShape( RTL_CONSTASCII_USTRINGPARAM("StartShape") ),
- msEndShape( RTL_CONSTASCII_USTRINGPARAM("EndShape") ),
- msOnClick( RTL_CONSTASCII_USTRINGPARAM("OnClick") ),
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
-- msOnAction( RTL_CONSTASCII_USTRINGPARAM("OnAction") ),
-- msAction( RTL_CONSTASCII_USTRINGPARAM("Action") ),
-- msURL( RTL_CONSTASCII_USTRINGPARAM("URL") ),
--#endif
- msEventType( RTL_CONSTASCII_USTRINGPARAM("EventType") ),
- msPresentation( RTL_CONSTASCII_USTRINGPARAM("Presentation") ),
- msMacroName( RTL_CONSTASCII_USTRINGPARAM("MacroName") ),
-diff --git xmloff/source/draw/shapeexport2.cxx xmloff/source/draw/shapeexport2.cxx
-index be5d6e2..0ac32d3 100644
---- xmloff/source/draw/shapeexport2.cxx
-+++ xmloff/source/draw/shapeexport2.cxx
-@@ -293,9 +293,6 @@ const sal_Int32 FOUND_CLICKEVENTTYPE = 0x00000080;
- const sal_Int32 FOUND_MACRO = 0x00000100;
- const sal_Int32 FOUND_LIBRARY = 0x00000200;
- const sal_Int32 FOUND_ACTIONEVENTTYPE = 0x00000400;
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
--const sal_Int32 FOUND_URL = 0x00000800;
--#endif
-
- } // namespace
-
-@@ -385,33 +382,6 @@ void XMLShapeExport::ImpExportEvents( const uno::Reference< drawing::XShape >& x
- }
- }
-
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
-- // extract properties from "OnAction" event -------------------------------
--
-- OUString aActionEventType;
-- OUString aHyperURL;
--
-- uno::Sequence< beans::PropertyValue > aActionProperties;
-- if( xEvents->hasByName( msOnAction ) && (xEvents->getByName( msOnAction ) >>= aActionProperties) )
-- {
-- const beans::PropertyValue* pProperty = aActionProperties.getConstArray();
-- const beans::PropertyValue* pPropertyEnd = pProperty + aActionProperties.getLength();
-- for( ; pProperty != pPropertyEnd; ++pProperty )
-- {
-- if( ( ( nFound & FOUND_ACTIONEVENTTYPE ) == 0 ) && pProperty->Name == msEventType )
-- {
-- if( pProperty->Value >>= aActionEventType )
-- nFound |= FOUND_ACTIONEVENTTYPE;
-- }
-- else if( ( ( nFound & FOUND_URL ) == 0 ) && ( pProperty->Name == msURL ) )
-- {
-- if( pProperty->Value >>= aHyperURL )
-- nFound |= FOUND_URL;
-- }
-- }
-- }
--#endif
--
- // create the XML elements
-
- if( aClickEventType == msPresentation )
-@@ -563,15 +533,9 @@ void XMLShapeExport::ImpExportEvents( const uno::Reference< drawing::XShape >& x
- SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_SCRIPT, XML_EVENT_LISTENER, sal_True, sal_True);
- }
- }
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
-- else if( aClickEventType == msScript || aActionEventType == msAction )
-- {
-- if( nFound & ( FOUND_MACRO | FOUND_URL ) )
--#else
- else if( aClickEventType == msScript )
- {
- if( nFound & FOUND_MACRO )
--#endif
- {
- SvXMLElementExport aEventsElemt(mrExport, XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS, sal_True, sal_True);
- if ( nFound & FOUND_MACRO )
-@@ -586,18 +550,6 @@ void XMLShapeExport::ImpExportEvents( const uno::Reference< drawing::XShape >& x
-
- SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_SCRIPT, XML_EVENT_LISTENER, sal_True, sal_True);
- }
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
-- if ( nFound & FOUND_URL )
-- {
-- OUString aEventQName(
-- mrExport.GetNamespaceMap().GetQNameByKey(
-- XML_NAMESPACE_DOM, OUString( RTL_CONSTASCII_USTRINGPARAM( "action" ) ) ) );
-- mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_EVENT_NAME, aEventQName );
-- mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, aHyperURL );
--
-- SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_PRESENTATION, XML_EVENT_LISTENER, sal_True, sal_True);
-- }
--#endif
- }
- }
- }
-diff --git xmloff/source/draw/ximpshap.cxx xmloff/source/draw/ximpshap.cxx
-index 82285ba..77f1bae 100644
---- xmloff/source/draw/ximpshap.cxx
-+++ xmloff/source/draw/ximpshap.cxx
-@@ -374,9 +374,15 @@ void SdXMLShapeContext::EndElement()
-
- if( msHyperlink.getLength() != 0 ) try
- {
-+ uno::Reference< beans::XPropertySet > xProp( mxShape, uno::UNO_QUERY );
-+
-+ rtl::OUString sLink( RTL_CONSTASCII_USTRINGPARAM( "Hyperlink" ) );
-+ if ( xProp.is() && xProp->getPropertySetInfo()->hasPropertyByName( sLink ) )
-+ xProp->setPropertyValue( sLink, uno::Any( msHyperlink ) );
-+ Reference< XEventsSupplier > xEventsSupplier( mxShape, UNO_QUERY_THROW );
-+ Reference< XNameReplace > xEvents( xEventsSupplier->getEvents(), UNO_QUERY_THROW );
- const OUString sBookmark( RTL_CONSTASCII_USTRINGPARAM( "Bookmark" ) );
-
-- Reference< XEventsSupplier > xEventsSupplier( mxShape, UNO_QUERY );
- if( xEventsSupplier.is() )
- {
- const OUString sEventType( RTL_CONSTASCII_USTRINGPARAM( "EventType" ) );
-@@ -3306,9 +3312,16 @@ SvXMLImportContext *SdXMLFrameShapeContext::CreateChildContext( USHORT nPrefix,
-
- if( !mxImplContext.Is() )
- {
-- pContext = GetImport().GetShapeImport()->CreateFrameChildContext(
-+
-+ SvXMLShapeContext* pShapeContext= GetImport().GetShapeImport()->CreateFrameChildContext(
- GetImport(), nPrefix, rLocalName, xAttrList, mxShapes, mxAttrList );
-
-+ pContext = pShapeContext;
-+
-+ // propagate the hyperlink to child context
-+ if ( msHyperlink.getLength() > 0 )
-+ pShapeContext->setHyperlink( msHyperlink );
-+
- mxImplContext = pContext;
- mbSupportsReplacement = IsXMLToken( rLocalName, XML_OBJECT ) ||
- IsXMLToken( rLocalName, XML_OBJECT_OLE );
-diff --git xmloff/source/forms/elementexport.cxx xmloff/source/forms/elementexport.cxx
-index d3f39ec..7814c30 100644
---- xmloff/source/forms/elementexport.cxx
-+++ xmloff/source/forms/elementexport.cxx
-@@ -1107,6 +1107,39 @@ namespace xmloff
- }
-
- // ----------------------------------
-+ // the string properties
-+ {
-+ static sal_Int32 nStringPropertyAttributeIds[] =
-+ { // attribute flags
-+ SCA_GROUP_NAME
-+ };
-+ static const ::rtl::OUString* pStringPropertyNames[] =
-+ { // property names
-+ &PROPERTY_GROUP_NAME
-+ };
-+
-+ sal_Int32 nIdCount = sizeof( nStringPropertyAttributeIds ) / sizeof( nStringPropertyAttributeIds[0] );
-+ #if OSL_DEBUG_LEVEL > 0
-+ sal_Int32 nNameCount = sizeof( pStringPropertyNames ) / sizeof( pStringPropertyNames[0] );
-+ OSL_ENSURE( ( nIdCount == nNameCount ),
-+ "OControlExport::exportSpecialAttributes: somebody tampered with the maps (2)!" );
-+ #endif
-+ for ( i = 0; i < nIdCount; ++i )
-+ if ( nStringPropertyAttributeIds[i] & m_nIncludeSpecial )
-+ {
-+ exportStringPropertyAttribute(
-+ OAttributeMetaData::getSpecialAttributeNamespace( nStringPropertyAttributeIds[i] ),
-+ OAttributeMetaData::getSpecialAttributeName( nStringPropertyAttributeIds[i] ),
-+ *( pStringPropertyNames[i] )
-+ );
-+ #if OSL_DEBUG_LEVEL > 0
-+ // reset the bit for later checking
-+ m_nIncludeSpecial = m_nIncludeSpecial & ~nStringPropertyAttributeIds[i];
-+ #endif
-+ }
-+ }
-+
-+ // ----------------------------------
- if ((SCA_MIN_VALUE | SCA_MAX_VALUE) & m_nIncludeSpecial)
- {
- // need to export the min value and the max value as attributes
-@@ -1564,6 +1597,8 @@ namespace xmloff
- }
- if ( m_xPropertyInfo->hasPropertyByName( PROPERTY_IMAGE_POSITION ) )
- m_nIncludeSpecial |= SCA_IMAGE_POSITION;
-+ if ( m_xPropertyInfo->hasPropertyByName( PROPERTY_GROUP_NAME ) )
-+ m_nIncludeSpecial |= SCA_GROUP_NAME;
- m_nIncludeDatabase = DA_DATA_FIELD | DA_INPUT_REQUIRED;
- m_nIncludeEvents = EA_CONTROL_EVENTS | EA_ON_CHANGE;
- break;
-diff --git xmloff/source/forms/formattributes.cxx xmloff/source/forms/formattributes.cxx
-index 430b257..de11567 100644
---- xmloff/source/forms/formattributes.cxx
-+++ xmloff/source/forms/formattributes.cxx
-@@ -192,6 +192,7 @@ namespace xmloff
- case SCA_MAX_VALUE: return "max-value";
- case SCA_MIN_VALUE: return "min-value";
- case SCA_VALIDATION: return "validation";
-+ case SCA_GROUP_NAME: return "group-name";
- case SCA_MULTI_LINE: return "multi-line";
- case SCA_AUTOMATIC_COMPLETION: return "auto-complete";
- case SCA_MULTIPLE: return "multiple";
-@@ -212,9 +213,12 @@ namespace xmloff
- }
-
- //---------------------------------------------------------------------
-- sal_uInt16 OAttributeMetaData::getSpecialAttributeNamespace(sal_Int32 /*_nId*/)
-+ sal_uInt16 OAttributeMetaData::getSpecialAttributeNamespace(sal_Int32 _nId)
- {
-- // nothing special here
-+ switch( _nId )
-+ {
-+ case SCA_GROUP_NAME: return XML_NAMESPACE_FORMX;
-+ }
- return XML_NAMESPACE_FORM;
- }
-
-diff --git xmloff/source/forms/formattributes.hxx xmloff/source/forms/formattributes.hxx
-index f2e7bb7..a406a6e 100644
---- xmloff/source/forms/formattributes.hxx
-+++ xmloff/source/forms/formattributes.hxx
-@@ -123,6 +123,7 @@ namespace xmloff
- #define SCA_MAX_VALUE 0x00000002
- #define SCA_MIN_VALUE 0x00000004
- #define SCA_VALIDATION 0x00000008
-+ #define SCA_GROUP_NAME 0x00000010
- #define SCA_MULTI_LINE 0x00000020
- #define SCA_AUTOMATIC_COMPLETION 0x00000080
- #define SCA_MULTIPLE 0x00000100
-diff --git xmloff/source/forms/layerimport.cxx xmloff/source/forms/layerimport.cxx
-index 5fe178f..3c29834 100644
---- xmloff/source/forms/layerimport.cxx
-+++ xmloff/source/forms/layerimport.cxx
-@@ -95,6 +95,8 @@ OFormLayerXMLImport_Impl::OFormLayerXMLImport_Impl(SvXMLImport& _rImporter)
- m_aAttributeMetaData.addStringProperty(
- OAttributeMetaData::getCommonControlAttributeName(CCA_NAME), PROPERTY_NAME);
- m_aAttributeMetaData.addStringProperty(
-+ OAttributeMetaData::getSpecialAttributeName(SCA_GROUP_NAME), PROPERTY_GROUP_NAME);
-+ m_aAttributeMetaData.addStringProperty(
- OAttributeMetaData::getCommonControlAttributeName(CCA_IMAGE_DATA), PROPERTY_IMAGEURL);
- m_aAttributeMetaData.addStringProperty(
- OAttributeMetaData::getCommonControlAttributeName(CCA_LABEL), PROPERTY_LABEL);
-diff --git xmloff/source/forms/strings.hxx xmloff/source/forms/strings.hxx
-index 83d4262..8b7b6ef 100644
---- xmloff/source/forms/strings.hxx
-+++ xmloff/source/forms/strings.hxx
-@@ -205,6 +205,7 @@ namespace xmloff
- XMLFORM_CONSTASCII_STRING( PROPERTY_IMAGE_POSITION, "ImagePosition");
- XMLFORM_CONSTASCII_STRING( PROPERTY_IMAGE_ALIGN, "ImageAlign");
- XMLFORM_CONSTASCII_STRING( PROPERTY_SCALE_IMAGE, "ScaleImage");
-+ XMLFORM_CONSTASCII_STRING( PROPERTY_GROUP_NAME, "GroupName");
-
- XMLFORM_CONSTASCII_STRING( PROPERTY_BOUND_CELL, "BoundCell");
- XMLFORM_CONSTASCII_STRING( PROPERTY_LIST_CELL_RANGE, "CellRange");
-diff --git xmlscript/inc/xmlscript/xmldlg_imexp.hxx xmlscript/inc/xmlscript/xmldlg_imexp.hxx
-index 2fe6f35..987a8c3 100644
---- xmlscript/inc/xmlscript/xmldlg_imexp.hxx
-+++ xmlscript/inc/xmlscript/xmldlg_imexp.hxx
-@@ -27,6 +27,8 @@
- #ifndef _XMLSCRIPT_XMLDLG_IMEXP_HXX_
- #define _XMLSCRIPT_XMLDLG_IMEXP_HXX_
-
-+#include <com/sun/star/frame/XModel.hpp>
-+
- #include <com/sun/star/container/XNameContainer.hpp>
- #include <com/sun/star/io/XInputStreamProvider.hpp>
- #include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
-@@ -51,7 +53,9 @@ void SAL_CALL exportDialogModel(
- ::com::sun::star::uno::Reference<
- ::com::sun::star::xml::sax::XExtendedDocumentHandler > const & xOut,
- ::com::sun::star::uno::Reference<
-- ::com::sun::star::container::XNameContainer > const & xDialogModel )
-+ ::com::sun::star::container::XNameContainer > const & xDialogModel,
-+ ::com::sun::star::uno::Reference<
-+ ::com::sun::star::frame::XModel > const & xDocument )
- SAL_THROW( (::com::sun::star::uno::Exception) );
-
- //==============================================================================
-@@ -60,7 +64,9 @@ SAL_CALL importDialogModel(
- ::com::sun::star::uno::Reference<
- ::com::sun::star::container::XNameContainer > const & xDialogModel,
- ::com::sun::star::uno::Reference<
-- ::com::sun::star::uno::XComponentContext > const & xContext )
-+ ::com::sun::star::uno::XComponentContext > const & xContext,
-+ ::com::sun::star::uno::Reference<
-+ ::com::sun::star::frame::XModel > const & xDocument )
- SAL_THROW( (::com::sun::star::uno::Exception) );
-
- // additional functions for convenience
-@@ -71,7 +77,9 @@ SAL_CALL exportDialogModel(
- ::com::sun::star::uno::Reference<
- ::com::sun::star::container::XNameContainer > const & xDialogModel,
- ::com::sun::star::uno::Reference<
-- ::com::sun::star::uno::XComponentContext > const & xContext )
-+ ::com::sun::star::uno::XComponentContext > const & xContext,
-+ ::com::sun::star::uno::Reference<
-+ ::com::sun::star::frame::XModel > const & xDocument )
- SAL_THROW( (::com::sun::star::uno::Exception) );
-
- //==============================================================================
-@@ -81,7 +89,9 @@ void SAL_CALL importDialogModel(
- ::com::sun::star::uno::Reference<
- ::com::sun::star::container::XNameContainer > const & xDialogModel,
- ::com::sun::star::uno::Reference<
-- ::com::sun::star::uno::XComponentContext > const & xContext )
-+ ::com::sun::star::uno::XComponentContext > const & xContext,
-+ ::com::sun::star::uno::Reference<
-+ ::com::sun::star::frame::XModel > const & xDocument )
- SAL_THROW( (::com::sun::star::uno::Exception) );
-
- }
-diff --git xmlscript/source/xmldlg_imexp/exp_share.hxx xmlscript/source/xmldlg_imexp/exp_share.hxx
-index 9ea565f..d06ffee 100644
---- xmlscript/source/xmldlg_imexp/exp_share.hxx
-+++ xmlscript/source/xmldlg_imexp/exp_share.hxx
-@@ -171,15 +171,17 @@ public:
- //
- void readDialogModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
-+ void readMultiPageModel( StyleBag * all_styles )
-+ SAL_THROW( (css::uno::Exception) );
- void readButtonModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
- void readEditModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
- void readCheckBoxModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
-- void readRadioButtonModel( StyleBag * all_styles )
-+ void readRadioButtonModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
- SAL_THROW( (css::uno::Exception) );
-- void readComboBoxModel( StyleBag * all_styles )
-+ void readComboBoxModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
- SAL_THROW( (css::uno::Exception) );
- void readCurrencyFieldModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
-@@ -193,9 +195,9 @@ public:
- SAL_THROW( (css::uno::Exception) );
- void readGroupBoxModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
-- void readImageControlModel( StyleBag * all_styles )
-+ void readImageControlModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
- SAL_THROW( (css::uno::Exception) );
-- void readListBoxModel( StyleBag * all_styles )
-+ void readListBoxModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
- SAL_THROW( (css::uno::Exception) );
- void readNumericFieldModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
-@@ -209,7 +211,9 @@ public:
- SAL_THROW( (css::uno::Exception) );
- void readProgressBarModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
-- void readScrollBarModel( StyleBag * all_styles )
-+ void readScrollBarModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
-+ SAL_THROW( (css::uno::Exception) );
-+ void readSpinButtonModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
- SAL_THROW( (css::uno::Exception) );
- void readFixedHyperLinkModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
-diff --git xmlscript/source/xmldlg_imexp/imp_share.hxx xmlscript/source/xmldlg_imexp/imp_share.hxx
-index ce9e43f..0bc9756 100644
---- xmlscript/source/xmldlg_imexp/imp_share.hxx
-+++ xmlscript/source/xmldlg_imexp/imp_share.hxx
-@@ -42,6 +42,7 @@
- #include <com/sun/star/awt/FontEmphasisMark.hpp>
- #include <com/sun/star/awt/FontRelief.hpp>
- #include <com/sun/star/xml/input/XRoot.hpp>
-+#include <com/sun/star/script/XLibraryContainer.hpp>
- #include <vector>
-
-
-@@ -128,6 +129,8 @@ struct DialogImport
-
- css::uno::Reference< css::container::XNameContainer > _xDialogModel;
- css::uno::Reference< css::lang::XMultiServiceFactory > _xDialogModelFactory;
-+ css::uno::Reference< css::frame::XModel > _xDoc;
-+ css::uno::Reference< css::script::XLibraryContainer > _xScriptLibraryContainer;
-
- sal_Int32 XMLNS_DIALOGS_UID, XMLNS_SCRIPT_UID;
-
-@@ -161,16 +164,20 @@ public:
- inline DialogImport(
- css::uno::Reference<css::uno::XComponentContext> const & xContext,
- css::uno::Reference<css::container::XNameContainer>
-- const & xDialogModel )
-+ const & xDialogModel,
-+ css::uno::Reference<css::frame::XModel> const & xDoc )
- SAL_THROW( () )
- : _xContext( xContext )
- , _xDialogModel( xDialogModel )
-- , _xDialogModelFactory( xDialogModel, css::uno::UNO_QUERY_THROW )
-+ , _xDialogModelFactory( xDialogModel, css::uno::UNO_QUERY_THROW ), _xDoc( xDoc )
- { OSL_ASSERT( _xDialogModel.is() && _xDialogModelFactory.is() &&
- _xContext.is() ); }
- virtual ~DialogImport()
- SAL_THROW( () );
-
-+ inline css::uno::Reference< css::frame::XModel > getDocOwner() { return _xDoc; }
-+
-+ css::uno::Reference< css::script::XLibraryContainer > getScriptLibraryContainer();
- // XRoot
- virtual void SAL_CALL startDocument(
- css::uno::Reference< css::xml::input::XNamespaceMapping >
-@@ -996,6 +1003,49 @@ public:
- };
-
- //==============================================================================
-+class SpinButtonElement
-+ : public ControlElement
-+{
-+public:
-+ virtual css::uno::Reference< css::xml::input::XElement >
-+ SAL_CALL startChildElement(
-+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
-+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
-+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-+ virtual void SAL_CALL endElement()
-+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-+
-+ inline SpinButtonElement(
-+ ::rtl::OUString const & rLocalName,
-+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
-+ ElementBase * pParent, DialogImport * pImport )
-+ SAL_THROW( () )
-+ : ControlElement( rLocalName, xAttributes, pParent, pImport )
-+ {}
-+};
-+
-+//==============================================================================
-+class MultiPage
-+ : public ControlElement
-+{
-+public:
-+ virtual css::uno::Reference< css::xml::input::XElement >
-+ SAL_CALL startChildElement(
-+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
-+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
-+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-+ virtual void SAL_CALL endElement()
-+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-+
-+ inline MultiPage(
-+ ::rtl::OUString const & rLocalName,
-+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
-+ ElementBase * pParent, DialogImport * pImport )
-+ SAL_THROW( () )
-+ : ControlElement( rLocalName, xAttributes, pParent, pImport )
-+ {}
-+};
-+
- class ProgressBarElement
- : public ControlElement
- {
-diff --git xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx
-index 0a5d74a..abfa771 100644
---- xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx
-+++ xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx
-@@ -41,6 +41,7 @@
- using namespace ::rtl;
- using namespace ::com::sun::star;
- using namespace ::com::sun::star::uno;
-+using namespace ::com::sun::star::frame;
-
- namespace xmlscript
- {
-@@ -70,7 +71,8 @@ Reference< io::XInputStream > InputStreamProvider::createInputStream()
- //==================================================================================================
- Reference< io::XInputStreamProvider > SAL_CALL exportDialogModel(
- Reference< container::XNameContainer > const & xDialogModel,
-- Reference< XComponentContext > const & xContext )
-+ Reference< XComponentContext > const & xContext,
-+ Reference< XModel > const & xDocument )
- SAL_THROW( (Exception) )
- {
- Reference< lang::XMultiComponentFactory > xSMgr( xContext->getServiceManager() );
-@@ -95,7 +97,7 @@ Reference< io::XInputStreamProvider > SAL_CALL exportDialogModel(
-
- Reference< io::XActiveDataSource > xSource( xHandler, UNO_QUERY );
- xSource->setOutputStream( createOutputStream( &aBytes ) );
-- exportDialogModel( xHandler, xDialogModel );
-+ exportDialogModel( xHandler, xDialogModel, xDocument );
-
- return new InputStreamProvider( aBytes );
- }
-@@ -104,7 +106,8 @@ Reference< io::XInputStreamProvider > SAL_CALL exportDialogModel(
- void SAL_CALL importDialogModel(
- Reference< io::XInputStream > xInput,
- Reference< container::XNameContainer > const & xDialogModel,
-- Reference< XComponentContext > const & xContext )
-+ Reference< XComponentContext > const & xContext,
-+ Reference< XModel > const & xDocument )
- SAL_THROW( (Exception) )
- {
- Reference< lang::XMultiComponentFactory > xSMgr( xContext->getServiceManager() );
-@@ -126,7 +129,7 @@ void SAL_CALL importDialogModel(
- }
-
- // error handler, entity resolver omitted for this helper function
-- xParser->setDocumentHandler( importDialogModel( xDialogModel, xContext ) );
-+ xParser->setDocumentHandler( importDialogModel( xDialogModel, xContext, xDocument ) );
-
- xml::sax::InputSource source;
- source.aInputStream = xInput;
-diff --git xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
-index 2449c09..1c67f19 100644
---- xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
-+++ xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
-@@ -29,7 +29,16 @@
- #include "precompiled_xmlscript.hxx"
- #include "exp_share.hxx"
-
-+#include <com/sun/star/form/binding/XListEntrySink.hpp>
-+#include <com/sun/star/form/binding/XBindableValue.hpp>
-+#include <com/sun/star/form/binding/XValueBinding.hpp>
-+#include <com/sun/star/table/CellAddress.hpp>
-+#include <com/sun/star/table/CellRangeAddress.hpp>
- #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
-+#include <com/sun/star/document/XStorageBasedDocument.hpp>
-+#include <com/sun/star/document/XGraphicObjectResolver.hpp>
-+#include <comphelper/componentcontext.hxx>
-+#include <comphelper/processfactory.hxx>
-
-
- using namespace ::com::sun::star;
-@@ -39,6 +48,66 @@ using ::rtl::OUString;
- namespace xmlscript
- {
-
-+void lclExportBindableAndListSourceBits( Reference< frame::XModel > const & xDocument, const Reference< beans::XPropertySet >& _xProps, ElementDescriptor& rModel )
-+{
-+ Reference< lang::XMultiServiceFactory > xFac;
-+ if ( xDocument.is() )
-+ xFac.set( xDocument, uno::UNO_QUERY );
-+
-+ Reference< form::binding::XBindableValue > xBinding( _xProps, UNO_QUERY );
-+
-+ if ( xFac.is() && xBinding.is() )
-+ {
-+ try
-+ {
-+ Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellAddressConversion" )), uno::UNO_QUERY );
-+ Reference< beans::XPropertySet > xBindable( xBinding->getValueBinding(), UNO_QUERY );
-+ if ( xBindable.is() )
-+ {
-+ table::CellAddress aAddress;
-+ xBindable->getPropertyValue( OUSTR("BoundCell") ) >>= aAddress;
-+ xConvertor->setPropertyValue( OUSTR("Address"), makeAny( aAddress ) );
-+ rtl::OUString sAddress;
-+ xConvertor->getPropertyValue( OUSTR("PersistentRepresentation") ) >>= sAddress;
-+ if ( sAddress.getLength() > 0 )
-+ rModel.addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell"), sAddress );
-+
-+ OSL_TRACE( "*** Bindable value %s", rtl::OUStringToOString( sAddress, RTL_TEXTENCODING_UTF8 ).getStr() );
-+
-+ }
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+ }
-+ Reference< form::binding::XListEntrySink > xEntrySink( _xProps, UNO_QUERY );
-+ if ( xEntrySink.is() )
-+ {
-+ Reference< beans::XPropertySet > xListSource( xEntrySink->getListEntrySource(), UNO_QUERY );
-+ if ( xListSource.is() )
-+ {
-+ try
-+ {
-+ Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellRangeAddressConversion" )), uno::UNO_QUERY );
-+
-+ table::CellRangeAddress aAddress;
-+ xListSource->getPropertyValue( OUSTR( "CellRange" ) ) >>= aAddress;
-+
-+ rtl::OUString sAddress;
-+ xConvertor->setPropertyValue( OUSTR("Address"), makeAny( aAddress ) );
-+ xConvertor->getPropertyValue( OUSTR("PersistentRepresentation") ) >>= sAddress;
-+ OSL_TRACE("**** cell range source list %s",
-+ rtl::OUStringToOString( sAddress, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ if ( sAddress.getLength() > 0 );
-+ rModel.addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":source-cell-range"), sAddress );
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+ }
-+ }
-+
-+}
- static inline bool readBorderProps(
- ElementDescriptor * element, Style & style )
- {
-@@ -65,6 +134,42 @@ static inline bool readFontProps( ElementDescriptor * element, Style & style )
- }
-
- //__________________________________________________________________________________________________
-+void ElementDescriptor::readMultiPageModel( StyleBag * all_styles )
-+{
-+ // collect styles
-+ Style aStyle( 0x2 | 0x8 | 0x20 );
-+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
-+ aStyle._set |= 0x2;
-+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
-+ aStyle._set |= 0x20;
-+ if (readFontProps( this, aStyle ))
-+ aStyle._set |= 0x8;
-+ if (aStyle._set)
-+ {
-+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
-+ all_styles->getStyleId( aStyle ) );
-+ }
-+
-+ // collect elements
-+ readDefaults();
-+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
-+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) );
-+
-+ OUString aTitle;
-+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ) ) >>= aTitle)
-+ {
-+ ElementDescriptor * title = new ElementDescriptor(
-+ _xProps, _xPropState,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ) );
-+ title->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ),
-+ aTitle );
-+ addSubElement( title );
-+ }
-+
-+ readEvents();
-+}
- void ElementDescriptor::readButtonModel( StyleBag * all_styles )
- SAL_THROW( (Exception) )
- {
-@@ -206,7 +311,7 @@ void ElementDescriptor::readCheckBoxModel( StyleBag * all_styles )
- readEvents();
- }
- //__________________________________________________________________________________________________
--void ElementDescriptor::readComboBoxModel( StyleBag * all_styles )
-+void ElementDescriptor::readComboBoxModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
- SAL_THROW( (Exception) )
- {
- // collect styles
-@@ -247,7 +352,8 @@ void ElementDescriptor::readComboBoxModel( StyleBag * all_styles )
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxlength") ) );
- readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linecount") ) );
--
-+ // Cell Range, Ref Cell etc.
-+ lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
- // string item list
- Sequence< OUString > itemValues;
- if ((readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ) ) >>= itemValues) &&
-@@ -273,7 +379,7 @@ void ElementDescriptor::readComboBoxModel( StyleBag * all_styles )
- readEvents();
- }
- //__________________________________________________________________________________________________
--void ElementDescriptor::readListBoxModel( StyleBag * all_styles )
-+void ElementDescriptor::readListBoxModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
- SAL_THROW( (Exception) )
- {
- // collect styles
-@@ -308,7 +414,7 @@ void ElementDescriptor::readListBoxModel( StyleBag * all_styles )
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linecount") ) );
- readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
--
-+ lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
- // string item list
- Sequence< OUString > itemValues;
- if ((readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ) ) >>= itemValues) &&
-@@ -348,7 +454,7 @@ void ElementDescriptor::readListBoxModel( StyleBag * all_styles )
- readEvents();
- }
- //__________________________________________________________________________________________________
--void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles )
-+void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
- SAL_THROW( (Exception) )
- {
- // collect styles
-@@ -385,6 +491,8 @@ void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles )
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-position") ) );
- readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multiline") ) );
-+ readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("GroupName") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":group-name") ) );
-
- sal_Int16 nState = 0;
- if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ) ) >>= nState)
-@@ -404,6 +512,7 @@ void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles )
- break;
- }
- }
-+ lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
- readEvents();
- }
- //__________________________________________________________________________________________________
-@@ -576,7 +685,7 @@ void ElementDescriptor::readEditModel( StyleBag * all_styles )
- readEvents();
- }
- //__________________________________________________________________________________________________
--void ElementDescriptor::readImageControlModel( StyleBag * all_styles )
-+void ElementDescriptor::readImageControlModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
- SAL_THROW( (Exception) )
- {
- // collect styles
-@@ -595,8 +704,31 @@ void ElementDescriptor::readImageControlModel( StyleBag * all_styles )
- readDefaults();
- readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleImage") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":scale-image") ) );
-- readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":src") ) );
-+ rtl::OUString sURL;
-+ _xProps->getPropertyValue( OUSTR("ImageURL") ) >>= sURL;
-+
-+ if ( sURL.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.GraphicObject:" ) ) ) == 0 )
-+ {
-+ Reference< document::XStorageBasedDocument > xDocStorage( xDocument, UNO_QUERY );
-+
-+ if ( xDocStorage.is() )
-+ {
-+ uno::Sequence< Any > aArgs( 1 );
-+ aArgs[ 0 ] <<= xDocStorage->getDocumentStorage();
-+
-+ ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
-+ uno::Reference< document::XGraphicObjectResolver > xGraphicResolver;
-+ aContext.createComponentWithArguments( OUSTR( "com.sun.star.comp.Svx.GraphicExportHelper" ), aArgs, xGraphicResolver );
-+ if ( xGraphicResolver.is() )
-+ {
-+ sURL = xGraphicResolver->resolveGraphicObjectURL( sURL );
-+ }
-+ }
-+ }
-+ if ( sURL.getLength() > 0 )
-+ {
-+ addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":src"), sURL );
-+ }
- readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
- readEvents();
-@@ -1073,7 +1205,7 @@ void ElementDescriptor::readProgressBarModel( StyleBag * all_styles )
- readEvents();
- }
- //__________________________________________________________________________________________________
--void ElementDescriptor::readScrollBarModel( StyleBag * all_styles )
-+void ElementDescriptor::readScrollBarModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
- SAL_THROW( (Exception) )
- {
- // collect styles
-@@ -1111,6 +1243,47 @@ void ElementDescriptor::readScrollBarModel( StyleBag * all_styles )
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":live-scroll") ) );
- readHexLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":symbol-color") ) );
-+ // Cell Range, Ref Cell etc.
-+ lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
-+ readEvents();
-+}
-+//__________________________________________________________________________________________________
-+void ElementDescriptor::readSpinButtonModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
-+ SAL_THROW( (Exception) )
-+{
-+ // collect styles
-+ Style aStyle( 0x1 | 0x4 );
-+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
-+ aStyle._set |= 0x1;
-+ if (readBorderProps( this, aStyle ))
-+ aStyle._set |= 0x4;
-+ if (aStyle._set)
-+ {
-+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
-+ all_styles->getStyleId( aStyle ) );
-+ }
-+
-+ // collect elements
-+ readDefaults();
-+ readOrientationAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
-+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinIncrement") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":increment") ) );
-+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValue") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":curval") ) );
-+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValueMax") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxval") ) );
-+ readLongAttr( OUSTR("SpinValueMin"),
-+ OUSTR(XMLNS_DIALOGS_PREFIX ":minval") );
-+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Repeat") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":repeat") ) );
-+ readLongAttr( OUSTR("RepeatDelay"), OUSTR(XMLNS_DIALOGS_PREFIX ":repeat-delay") );
-+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
-+ readHexLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":symbol-color") ) );
-+ // Cell Range, Ref Cell etc.
-+ lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
- readEvents();
- }
- //__________________________________________________________________________________________________
-diff --git xmlscript/source/xmldlg_imexp/xmldlg_export.cxx xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
-index 2898ac1..47b1d2f 100644
---- xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
-+++ xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
-@@ -1325,7 +1325,8 @@ void StyleBag::dump( Reference< xml::sax::XExtendedDocumentHandler > const & xOu
- //==================================================================================================
- void SAL_CALL exportDialogModel(
- Reference< xml::sax::XExtendedDocumentHandler > const & xOut,
-- Reference< container::XNameContainer > const & xDialogModel )
-+ Reference< container::XNameContainer > const & xDialogModel,
-+ Reference< frame::XModel > const & xDocument )
- SAL_THROW( (Exception) )
- {
- StyleBag all_styles;
-@@ -1373,7 +1374,7 @@ void SAL_CALL exportDialogModel(
- xProps, xPropState,
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":radio") ) );
- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readRadioButtonModel( &all_styles );
-+ pElem->readRadioButtonModel( &all_styles, xDocument );
- pRadioGroup->addSubElement( xElem );
- }
- else // no radio
-@@ -1402,7 +1403,7 @@ void SAL_CALL exportDialogModel(
- xProps, xPropState,
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":combobox") ) );
- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readComboBoxModel( &all_styles );
-+ pElem->readComboBoxModel( &all_styles, xDocument );
- }
- else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) ) )
- {
-@@ -1410,7 +1411,7 @@ void SAL_CALL exportDialogModel(
- xProps, xPropState,
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menulist") ) );
- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readListBoxModel( &all_styles );
-+ pElem->readListBoxModel( &all_styles, xDocument );
- }
- else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) ) )
- {
-@@ -1420,6 +1421,14 @@ void SAL_CALL exportDialogModel(
- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
- pElem->readGroupBoxModel( &all_styles );
- }
-+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoMultiPageModel") ) ) )
-+ {
-+ pElem = new ElementDescriptor(
-+ xProps, xPropState,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multipage") ) );
-+ xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-+ pElem->readMultiPageModel( &all_styles );
-+ }
- else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedTextModel") ) ) )
- {
- pElem = new ElementDescriptor(
-@@ -1451,7 +1460,7 @@ void SAL_CALL exportDialogModel(
- xProps, xPropState,
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":img") ) );
- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readImageControlModel( &all_styles );
-+ pElem->readImageControlModel( &all_styles, xDocument );
- }
- else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFileControlModel") ) ) )
- {
-@@ -1531,7 +1540,15 @@ void SAL_CALL exportDialogModel(
- xProps, xPropState,
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":scrollbar") ) );
- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readScrollBarModel( &all_styles );
-+ pElem->readScrollBarModel( &all_styles, xDocument );
-+ }
-+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlSpinButtonModel") ) ) )
-+ {
-+ pElem = new ElementDescriptor(
-+ xProps, xPropState,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spinbutton") ) );
-+ xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-+ pElem->readSpinButtonModel( &all_styles, xDocument );
- }
- else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlProgressBarModel") ) ) )
- {
-diff --git xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
-index 1c43cc8..37a561f 100644
---- xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
-+++ xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
-@@ -28,17 +28,195 @@
- // MARKER(update_precomp.py): autogen include statement, do not remove
- #include "precompiled_xmlscript.hxx"
- #include "imp_share.hxx"
--
-+#include <com/sun/star/form/binding/XBindableValue.hpp>
-+#include <com/sun/star/form/binding/XValueBinding.hpp>
-+#include <com/sun/star/form/binding/XListEntrySink.hpp>
-+#include <com/sun/star/beans/NamedValue.hpp>
-+#include <com/sun/star/table/CellAddress.hpp>
-+#include <com/sun/star/table/CellRangeAddress.hpp>
- #include <com/sun/star/beans/XPropertySet.hpp>
- #include <com/sun/star/beans/XPropertyState.hpp>
-+#include <com/sun/star/document/XStorageBasedDocument.hpp>
-+#include <com/sun/star/document/XGraphicObjectResolver.hpp>
-+#include <com/sun/star/script/vba/XVBACompatibility.hpp>
-
--
-+#include <comphelper/componentcontext.hxx>
-+#include <comphelper/processfactory.hxx>
- using namespace ::com::sun::star;
- using namespace ::com::sun::star::uno;
- using ::rtl::OUString;
-
- namespace xmlscript
- {
-+Reference< xml::input::XElement > MultiPage::startChildElement(
-+ sal_Int32 nUid, OUString const & rLocalName,
-+ Reference< xml::input::XAttributes > const & xAttributes )
-+ throw (xml::sax::SAXException, RuntimeException)
-+{
-+ // event
-+rtl::OUString _label = rtl::OUString::createFromAscii("foo");
-+ if (_pImport->isEventElement( nUid, rLocalName ))
-+ {
-+ return new EventElement(
-+ nUid, rLocalName, xAttributes, this, _pImport );
-+ }
-+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("title") ))
-+ {
-+ getStringAttr( &_label,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
-+ xAttributes,
-+ _pImport->XMLNS_DIALOGS_UID );
-+
-+ return new ElementBase(
-+ _pImport->XMLNS_DIALOGS_UID,
-+ rLocalName, xAttributes, this, _pImport );
-+ }
-+ else
-+ {
-+
-+ throw xml::sax::SAXException(
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
-+ Reference< XInterface >(), Any() );
-+ }
-+}
-+//__________________________________________________________________________________________________
-+
-+void MultiPage::endElement()
-+ throw (xml::sax::SAXException, RuntimeException)
-+{
-+ ControlImportContext ctx(
-+ _pImport, getControlId( _xAttributes ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoMultiPageModel") ) );
-+// OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) );
-+ Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
-+
-+ Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
-+ if (xStyle.is())
-+ {
-+ StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
-+ pStyle->importTextColorStyle( xControlModel );
-+ pStyle->importTextLineColorStyle( xControlModel );
-+ pStyle->importFontStyle( xControlModel );
-+ }
-+
-+ ctx.importDefaults( 0, 0, _xAttributes ); // inherited from BulletinBoardElement
-+ ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
-+ _xAttributes );
-+ ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ),
-+ _xAttributes );
-+ ctx.importEvents( _events );
-+ // avoid ring-reference:
-+ // vector< event elements > holding event elements holding this (via _pParent)
-+ _events.clear();
-+}
-+
-+// #FIXME cut'n'pasted from xmloff/source/core/xmlimp.cxx:1251
-+// of course we need to find a common home for this helper
-+
-+bool IsPackageURL( const ::rtl::OUString& rURL )
-+{
-+ // Some quick tests: Some may rely on the package structure!
-+ sal_Int32 nLen = rURL.getLength();
-+ if( (nLen > 0 && '/' == rURL[0]) )
-+ // RFC2396 net_path or abs_path
-+ return false;
-+ else if( nLen > 1 && '.' == rURL[0] )
-+ {
-+ if( '.' == rURL[1] )
-+ // ../: We are never going up one level, so we know
-+ // it's not an external URI
-+ return false;
-+ else if( '/' == rURL[1] )
-+ // we are remaining on a level, so it's an package URI
-+ return true;
-+ }
-+
-+ // Now check for a RFC2396 schema
-+ sal_Int32 nPos = 1;
-+ while( nPos < nLen )
-+ {
-+ switch( rURL[nPos] )
-+ {
-+ case '/':
-+ // a relative path segement
-+ return true;
-+ case ':':
-+ // a schema
-+ return false;
-+ default:
-+ break;
-+ // we don't care about any other characters
-+ }
-+ ++nPos;
-+ }
-+
-+ return true;
-+}
-+
-+void importBindableAndListRangeBits( DialogImport* _pImport, const rtl::OUString sLinkedCell, const rtl::OUString & sCellRange, ControlImportContext& ctx )
-+{
-+ Reference< lang::XMultiServiceFactory > xFac( _pImport->getDocOwner(), UNO_QUERY );
-+ if ( xFac.is() && ( sLinkedCell.getLength() || sCellRange.getLength() ) )
-+ {
-+ // Set up Celllink
-+ if ( sLinkedCell.getLength() )
-+ {
-+ Reference< form::binding::XBindableValue > xBindable( ctx.getControlModel(), uno::UNO_QUERY );
-+ Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellAddressConversion" )), uno::UNO_QUERY );
-+ if ( xBindable.is() && xConvertor.is() )
-+ {
-+ table::CellAddress aAddress;
-+ xConvertor->setPropertyValue( OUSTR( "PersistentRepresentation" ), uno::makeAny( sLinkedCell ) );
-+ xConvertor->getPropertyValue( OUSTR( "Address" ) ) >>= aAddress;
-+ beans::NamedValue aArg1;
-+ aArg1.Name = OUSTR("BoundCell");
-+ aArg1.Value <<= aAddress;
-+
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[ 0 ] <<= aArg1;
-+
-+ uno::Reference< form::binding::XValueBinding > xBinding( xFac->createInstanceWithArguments( OUSTR("com.sun.star.table.CellValueBinding" ), aArgs ), uno::UNO_QUERY );
-+ xBindable->setValueBinding( xBinding );
-+
-+ }
-+ }
-+ // Set up CelllRange
-+ if ( sCellRange.getLength() )
-+ {
-+ Reference< form::binding::XListEntrySink > xListEntrySink( ctx.getControlModel(), uno::UNO_QUERY );
-+ Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellRangeAddressConversion" )), uno::UNO_QUERY );
-+ if ( xListEntrySink.is() && xConvertor.is() )
-+ {
-+ table::CellRangeAddress aAddress;
-+ xConvertor->setPropertyValue( OUSTR( "PersistentRepresentation" ), uno::makeAny( sCellRange ) );
-+ xConvertor->getPropertyValue( OUSTR( "Address" ) ) >>= aAddress;
-+ beans::NamedValue aArg1;
-+ aArg1.Name = OUSTR("CellRange");
-+ aArg1.Value <<= aAddress;
-+
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[ 0 ] <<= aArg1;
-+
-+ uno::Reference< form::binding::XListEntrySource > xSource( xFac->createInstanceWithArguments( OUSTR("com.sun.star.table.CellRangeListSource" ), aArgs ), uno::UNO_QUERY );
-+ xListEntrySink->setListEntrySource( xSource );
-+
-+ }
-+ }
-+ }
-+}
-+
-+sal_Bool isVBACompatibilityMode( DialogImport* _pImport )
-+{
-+ sal_Bool bVBAMode = sal_False;
-+ Reference< script::vba::XVBACompatibility > xVBACompat( _pImport->getScriptLibraryContainer(), UNO_QUERY );
-+ if( xVBACompat.is() )
-+ {
-+ bVBAMode = xVBACompat->getVBACompatibilityMode();
-+ }
-+ return bVBAMode;
-+}
-
- // progessmeter
- //__________________________________________________________________________________________________
-@@ -119,10 +297,24 @@ Reference< xml::input::XElement > ScrollBarElement::startChildElement(
- void ScrollBarElement::endElement()
- throw (xml::sax::SAXException, RuntimeException)
- {
-+ OUString sService( OUSTR("com.sun.star.awt.UnoControlScrollBarModel") );
-+ // we should probably limit this to vba mode also ( leave for now )
-+ if ( isVBACompatibilityMode( _pImport ) )
-+ sService = OUSTR("com.sun.star.form.component.ScrollBar");
-+
-+ OUString sLinkedCell;
-+ try
-+ {
-+ sLinkedCell = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
-+ }
-+ catch( Exception& /*e*/ )
-+ {
-+ }
-+
- ControlImportContext ctx(
- _pImport, getControlId( _xAttributes ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlScrollBarModel") ) );
--
-+ sService );
-+
- Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
- if (xStyle.is())
- {
-@@ -165,6 +357,92 @@ void ScrollBarElement::endElement()
- OUString( RTL_CONSTASCII_USTRINGPARAM("symbol-color") ),
- _xAttributes );
-
-+ // import cell-link
-+ OUString sCellRange;
-+ importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
-+
-+ ctx.importEvents( _events );
-+ // avoid ring-reference:
-+ // vector< event elements > holding event elements holding this (via _pParent)
-+ _events.clear();
-+}
-+
-+//##################################################################################################
-+
-+// spinbutton
-+//__________________________________________________________________________________________________
-+Reference< xml::input::XElement > SpinButtonElement::startChildElement(
-+ sal_Int32 nUid, OUString const & rLocalName,
-+ Reference< xml::input::XAttributes > const & xAttributes )
-+ throw (xml::sax::SAXException, RuntimeException)
-+{
-+ // event
-+ if (_pImport->isEventElement( nUid, rLocalName ))
-+ {
-+ return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
-+ }
-+ else
-+ {
-+ throw xml::sax::SAXException(
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
-+ Reference< XInterface >(), Any() );
-+ }
-+}
-+//__________________________________________________________________________________________________
-+void SpinButtonElement::endElement()
-+ throw (xml::sax::SAXException, RuntimeException)
-+{
-+ OUString sLinkedCell;
-+ try
-+ {
-+ sLinkedCell = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
-+ }
-+ catch( Exception& /*e*/ )
-+ {
-+ }
-+
-+ ControlImportContext ctx(
-+ _pImport, getControlId( _xAttributes ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.SpinButton") ) );
-+
-+ Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
-+ if (xStyle.is())
-+ {
-+ StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
-+ Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
-+ pStyle->importBackgroundColorStyle( xControlModel );
-+ pStyle->importBorderStyle( xControlModel );
-+ }
-+
-+ ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
-+ ctx.importOrientationProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
-+ _xAttributes );
-+ ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinIncrement") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("increment") ),
-+ _xAttributes );
-+ ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValue") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("curval") ),
-+ _xAttributes );
-+ ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValueMax") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("maxval") ),
-+ _xAttributes );
-+ ctx.importLongProperty( OUSTR("SpinValueMin"), OUSTR("minval"),
-+ _xAttributes );
-+ ctx.importLongProperty( OUSTR("Repeat"), OUSTR("repeat"),
-+ _xAttributes );
-+ ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat-delay"),
-+ _xAttributes );
-+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
-+ _xAttributes );
-+ ctx.importHexLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("symbol-color") ),
-+ _xAttributes );
-+ // import cell-link
-+ OUString sCellRange;
-+ importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
-+
- ctx.importEvents( _events );
- // avoid ring-reference:
- // vector< event elements > holding event elements holding this (via _pParent)
-@@ -1003,9 +1281,37 @@ void ImageControlElement::endElement()
- ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleImage") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("scale-image") ),
- _xAttributes );
-- ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM("src") ),
-- _xAttributes );
-+ rtl::OUString sURL = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "src" ) );
-+ Reference< document::XStorageBasedDocument > xDocStorage( _pImport->getDocOwner(), UNO_QUERY );
-+
-+ if ( xDocStorage.is() && IsPackageURL( sURL ) )
-+ {
-+ uno::Sequence< Any > aArgs( 1 );
-+ aArgs[ 0 ] <<= xDocStorage->getDocumentStorage();
-+
-+ ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
-+ uno::Reference< document::XGraphicObjectResolver > xGraphicResolver;
-+ aContext.createComponentWithArguments( OUSTR( "com.sun.star.comp.Svx.GraphicImportHelper" ), aArgs, xGraphicResolver );
-+
-+ if ( xGraphicResolver.is() )
-+ {
-+ rtl::OUString aTmp( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.Package:" ) );
-+ aTmp += sURL;
-+ sURL = xGraphicResolver->resolveGraphicObjectURL( aTmp );
-+ Reference< beans::XPropertySet > xProps( ctx.getControlModel(), UNO_QUERY );
-+ // we must set the url while the graphic object ( held by the resolver is in scope )
-+ if ( xProps.is() )
-+ xProps->setPropertyValue( OUSTR("ImageURL"), makeAny( sURL ) );
-+ }
-+ }
-+
-+ else if ( sURL.getLength() > 0 )
-+ {
-+ Reference< beans::XPropertySet > xProps( ctx.getControlModel(), UNO_QUERY );
-+ if ( xProps.is() )
-+ xProps->setPropertyValue( OUSTR("ImageURL"), makeAny( sURL ) );
-+ }
-+
- ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
- _xAttributes );
-@@ -1338,10 +1644,24 @@ void TitledBoxElement::endElement()
- Reference< xml::input::XElement > xRadio( _radios[ nPos ] );
- Reference< xml::input::XAttributes > xAttributes(
- xRadio->getAttributes() );
-+ OUString sLinkedCell;
-+ OUString sCellRange;
-+ OUString sService( OUSTR("com.sun.star.awt.UnoControlRadioButtonModel") );
-+ try
-+ {
-+ sLinkedCell = xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
-+ // we should probably limit this to vba mode also ( leave for now )
-+ if ( isVBACompatibilityMode( _pImport ) )
-+ sService = OUSTR("com.sun.star.form.component.RadioButton");
-+ }
-+ catch( Exception& /*e*/ )
-+ {
-+ }
-+
-
- ControlImportContext ctx(
- _pImport, getControlId( xAttributes ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) );
-+ sService );
- Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
-
- Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) );
-@@ -1377,6 +1697,9 @@ void TitledBoxElement::endElement()
- ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
- xAttributes );
-+ ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("GroupName") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("group-name") ),
-+ xAttributes );
-
- sal_Int16 nVal = 0;
- sal_Bool bChecked = sal_False;
-@@ -1390,7 +1713,7 @@ void TitledBoxElement::endElement()
- }
- xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
- makeAny( nVal ) );
--
-+ importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
- ::std::vector< Reference< xml::input::XElement > > * radioEvents =
- static_cast< RadioElement * >( xRadio.get() )->getEvents();
- ctx.importEvents( *radioEvents );
-@@ -1466,10 +1789,23 @@ void RadioGroupElement::endElement()
- Reference< xml::input::XElement > xRadio( _radios[ nPos ] );
- Reference< xml::input::XAttributes > xAttributes(
- xRadio->getAttributes() );
-+ OUString sLinkedCell;
-+ OUString sCellRange;
-+ OUString sService( OUSTR("com.sun.star.awt.UnoControlRadioButtonModel") );
-+ try
-+ {
-+ sLinkedCell = xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
-+ // we should probably limit this to vba mode also ( leave for now )
-+ if ( isVBACompatibilityMode( _pImport ) )
-+ sService = OUSTR("com.sun.star.form.component.RadioButton");
-+ }
-+ catch( Exception& /*e*/ )
-+ {
-+ }
-
- ControlImportContext ctx(
- _pImport, getControlId( xAttributes ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) );
-+ sService );
- Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
-
- Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) );
-@@ -1505,6 +1841,9 @@ void RadioGroupElement::endElement()
- ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
- xAttributes );
-+ ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("GroupName") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("group-name") ),
-+ xAttributes );
- sal_Int16 nVal = 0;
- sal_Bool bChecked = sal_False;
- if (getBoolAttr( &bChecked,
-@@ -1518,6 +1857,7 @@ void RadioGroupElement::endElement()
- xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
- makeAny( nVal ) );
-
-+ importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
- ::std::vector< Reference< xml::input::XElement > > * radioEvents =
- static_cast< RadioElement * >( xRadio.get() )->getEvents();
- ctx.importEvents( *radioEvents );
-@@ -1638,9 +1978,26 @@ Reference< xml::input::XElement > MenuListElement::startChildElement(
- void MenuListElement::endElement()
- throw (xml::sax::SAXException, RuntimeException)
- {
-+ OUString sLinkedCell;
-+ OUString sCellRange;
-+ OUString sListBoxService( OUSTR("com.sun.star.awt.UnoControlListBoxModel") );
-+
-+ // we should probably limit this to vba mode also ( leave for now )
-+ if ( isVBACompatibilityMode( _pImport ) )
-+ sListBoxService = OUSTR("com.sun.star.form.component.ListBox");
-+
-+ try
-+ {
-+ sLinkedCell = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
-+ sCellRange = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "source-cell-range" ) );
-+ }
-+ catch( Exception& /*e*/ )
-+ {
-+ }
- ControlImportContext ctx(
- _pImport, getControlId( _xAttributes ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) );
-+ //OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) );
-+ sListBoxService );
- Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
-
- Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
-@@ -1673,13 +2030,16 @@ void MenuListElement::endElement()
- ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
- _xAttributes );
--
-+ // import cell-link and cell source range
-+ importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
- if (_popup.is())
- {
- MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() );
-- xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ),
-+ if ( !sCellRange.getLength() )
-+ xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ),
- makeAny( p->getItemValues() ) );
-- xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") ),
-+ if ( !sLinkedCell.getLength() )
-+ xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") ),
- makeAny( p->getSelectedItems() ) );
- }
- ctx.importEvents( _events );
-@@ -1725,9 +2085,26 @@ Reference< xml::input::XElement > ComboBoxElement::startChildElement(
- void ComboBoxElement::endElement()
- throw (xml::sax::SAXException, RuntimeException)
- {
-+ OUString sService( OUSTR("com.sun.star.awt.UnoControlComboBoxModel") );
-+
-+ // we should probably limit this to vba mode also ( leave for now )
-+ if ( isVBACompatibilityMode( _pImport ) )
-+ sService = OUSTR("com.sun.star.form.component.ComboBox");
-+
-+ OUString sLinkedCell;
-+ OUString sCellRange;
-+ try
-+ {
-+ sLinkedCell = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
-+ sCellRange = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "source-cell-range" ) );
-+ }
-+ catch( Exception& /*e*/ )
-+ {
-+ }
-+
- ControlImportContext ctx(
- _pImport, getControlId( _xAttributes ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ) );
-+ sService );
- Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
-
- Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
-@@ -1769,8 +2146,10 @@ void ComboBoxElement::endElement()
- ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
- _xAttributes );
-+ // import cell-link and cell source range
-+ importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
-
-- if (_popup.is())
-+ if (_popup.is() && !sCellRange.getLength() )
- {
- MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() );
- xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ),
-@@ -2096,10 +2475,19 @@ Reference< xml::input::XElement > BulletinBoardElement::startChildElement(
- {
- return new ScrollBarElement( rLocalName, xAttributes, this, _pImport );
- }
-+ // spinbutton
-+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("spinbutton") ) && isVBACompatibilityMode( _pImport ) )
-+ {
-+ return new SpinButtonElement( rLocalName, xAttributes, this, _pImport );
-+ }
- // progressmeter
- else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("progressmeter") ))
- {
- return new ProgressBarElement( rLocalName, xAttributes, this, _pImport );
-+ }
-+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("multipage") ))
-+ {
-+ return new MultiPage( rLocalName, xAttributes, this, _pImport );
- }
- // bulletinboard
- else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bulletinboard") ))
-diff --git xmlscript/source/xmldlg_imexp/xmldlg_import.cxx xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
-index f3c0e55..0f03070 100644
---- xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
-+++ xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
-@@ -57,9 +57,13 @@
- #include <com/sun/star/script/ScriptEventDescriptor.hpp>
-
- #include <com/sun/star/view/SelectionType.hpp>
-+#include <com/sun/star/document/XStorageBasedDocument.hpp>
-+#include <com/sun/star/script/DocumentScriptLibraryContainer.hpp>
-+#include <com/sun/star/script/vba/XVBACompatibility.hpp>
-
- using namespace ::com::sun::star;
- using namespace ::com::sun::star::uno;
-+using namespace ::com::sun::star::frame;
- using ::rtl::OUString;
-
- namespace xmlscript
-@@ -1888,18 +1892,42 @@ Reference< xml::input::XElement > DialogImport::getStyle(
- }
- return 0;
- }
-+//__________________________________________________________________________________________________
-+Reference< script::XLibraryContainer > DialogImport::getScriptLibraryContainer()
-+{
-+ if( !_xScriptLibraryContainer.is() )
-+ {
-+ try
-+ {
-+ Reference< beans::XPropertySet > xProps( _xDoc, UNO_QUERY );
-+ if( xProps.is() )
-+ _xScriptLibraryContainer.set( xProps->getPropertyValue( OUSTR("BasicLibraries") ), UNO_QUERY );
-+ }
-+ catch( const Exception& )
-+ {
-+ }
-+ }
-+
-+ return _xScriptLibraryContainer;
-+}
-
- //##################################################################################################
-
- //==================================================================================================
- Reference< xml::sax::XDocumentHandler > SAL_CALL importDialogModel(
- Reference< container::XNameContainer > const & xDialogModel,
-- Reference< XComponentContext > const & xContext )
-+ Reference< XComponentContext > const & xContext,
-+ Reference< XModel > const & xDocument )
- SAL_THROW( (Exception) )
- {
-+ DialogImport* pImport = new DialogImport( xContext, xDialogModel, xDocument );
-+ uno::Reference< script::vba::XVBACompatibility > xVBAModeSource( pImport->getScriptLibraryContainer(), uno::UNO_QUERY );
-+
-+ uno::Reference< beans::XPropertySet > xDlgProps( xDialogModel, uno::UNO_QUERY );
-+ if ( xVBAModeSource.is() && xDlgProps.is() && xVBAModeSource->getVBACompatibilityMode() )
-+ xDlgProps->setPropertyValue( OUSTR("VBAForm"), uno::makeAny( sal_True ) );
- return ::xmlscript::createDocumentHandler(
-- static_cast< xml::input::XRoot * >(
-- new DialogImport( xContext, xDialogModel ) ) );
-+ static_cast< xml::input::XRoot * >( pImport ) );
- }
-
- }
-diff --git xmlscript/util/makefile.mk xmlscript/util/makefile.mk
-index 3ccf63d..7a391cd 100644
---- xmlscript/util/makefile.mk
-+++ xmlscript/util/makefile.mk
-@@ -54,6 +54,7 @@ SHL1LIBS= \
- $(LIB1TARGET)
-
- SHL1STDLIBS= \
-+ $(COMPHELPERLIB) \
- $(CPPUHELPERLIB) \
- $(CPPULIB) \
- $(SALLIB)
diff --git a/patches/vba/cws-vbasupportdev300_m83-fix.diff b/patches/vba/cws-vbasupportdev300_m83-fix.diff
deleted file mode 100644
index c069505b1..000000000
--- a/patches/vba/cws-vbasupportdev300_m83-fix.diff
+++ /dev/null
@@ -1,168 +0,0 @@
-Fix for the VBA use of fields
-
-From: Cédric Bosdonnat <cedricbosdo@openoffice.org>
-
-
----
-
- sw/source/ui/vba/vbacheckbox.cxx | 23 ++++++++++-------------
- sw/source/ui/vba/vbaformfield.cxx | 28 ++++++++++++----------------
- sw/source/ui/vba/vbaformfields.cxx | 15 +++++----------
- 3 files changed, 27 insertions(+), 39 deletions(-)
-
-
-diff --git sw/source/ui/vba/vbacheckbox.cxx sw/source/ui/vba/vbacheckbox.cxx
-index 307f7a2..d16cf54 100644
---- sw/source/ui/vba/vbacheckbox.cxx
-+++ sw/source/ui/vba/vbacheckbox.cxx
-@@ -34,7 +34,7 @@
- #include <com/sun/star/text/XTextContent.hpp>
- #include <com/sun/star/text/XTextViewCursor.hpp>
- #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
--#include <ecmaflds.hxx>
-+#include <xmloff/odffields.hxx>
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-@@ -42,7 +42,7 @@ using namespace ::com::sun::star;
- SwVbaCheckBox::SwVbaCheckBox( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< frame::XModel >& rModel, const uno::Reference< text::XFormField >& xFormField ) throw ( uno::RuntimeException ) : SwVbaCheckBox_BASE( rParent, rContext ), mxModel( rModel ), mxFormField( xFormField )
- {
- rtl::OUString sType = mxFormField->getFieldType();
-- if( !sType.equalsIgnoreAsciiCaseAscii( ECMA_FORMCHECKBOX ) )
-+ if( !sType.equalsIgnoreAsciiCaseAscii( ODF_FORMCHECKBOX ) )
- {
- throw uno::RuntimeException( rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("It is not a CheckBox")), uno::Reference< uno::XInterface >() );
-@@ -56,17 +56,14 @@ SwVbaCheckBox::~SwVbaCheckBox()
- sal_Bool SAL_CALL SwVbaCheckBox::getValue() throw ( uno::RuntimeException )
- {
- sal_Bool bValue = sal_False;
-- sal_Int32 nCount = mxFormField->getParamCount();
-- for( sal_Int32 i = 0; i < nCount; i++ )
-+ uno::Any aVal = mxFormField->getParameters()->getByName( rtl::OUString::createFromAscii( ODF_FORMCHECKBOX_RESULT ) );
-+ rtl::OUString sVal;
-+ if ( aVal >>= sVal )
- {
-- if( mxFormField->getParamName(i).equalsIgnoreAsciiCaseAscii( ECMA_FORMCHECKBOX_CHECKED ) )
-- {
-- if( mxFormField->getParamValue(i).equalsIgnoreAsciiCaseAscii("on") )
-- bValue = sal_True;
-- else
-- bValue = sal_False;
-- break;
-- }
-+ if ( sVal.equalsIgnoreAsciiCaseAscii("on") )
-+ bValue = sal_True;
-+ else
-+ bValue = sal_False;
- }
- return bValue;
- }
-@@ -74,7 +71,7 @@ sal_Bool SAL_CALL SwVbaCheckBox::getValue() throw ( uno::RuntimeException )
- void SAL_CALL SwVbaCheckBox::setValue( sal_Bool value ) throw ( uno::RuntimeException )
- {
- rtl::OUString sValue = value ? rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("on")) : rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("off"));
-- mxFormField->addParam( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ECMA_FORMCHECKBOX_CHECKED )), sValue, sal_True );
-+ mxFormField->getParameters()->insertByName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ODF_FORMCHECKBOX_RESULT )), uno::makeAny( sValue ) );
- }
-
- rtl::OUString&
-diff --git sw/source/ui/vba/vbaformfield.cxx sw/source/ui/vba/vbaformfield.cxx
-index 944ffbb..ba6aec5 100644
---- sw/source/ui/vba/vbaformfield.cxx
-+++ sw/source/ui/vba/vbaformfield.cxx
-@@ -34,7 +34,7 @@
- #include <com/sun/star/text/XTextContent.hpp>
- #include <com/sun/star/text/XTextViewCursor.hpp>
- #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
--#include <ecmaflds.hxx>
-+#include <xmloff/odffields.hxx>
- #include "vbacheckbox.hxx"
-
- using namespace ::ooo::vba;
-@@ -52,27 +52,23 @@ rtl::OUString SAL_CALL SwVbaFormField::getResult() throw ( uno::RuntimeException
- {
- rtl::OUString sResult;
- rtl::OUString sType = mxFormField->getFieldType();
-- if( sType.equalsIgnoreAsciiCaseAscii( ECMA_FORMTEXT ) )
-+ if( sType.equalsIgnoreAsciiCaseAscii( ODF_FORMTEXT ) )
- {
- uno::Reference< text::XTextContent > xTextContent( mxFormField, uno::UNO_QUERY_THROW );
- uno::Reference< text::XTextRange > xTextRange = xTextContent->getAnchor();
- sResult = xTextRange->getString();
- }
-- else if( sType.equalsIgnoreAsciiCaseAscii( ECMA_FORMCHECKBOX ) )
-+ else if( sType.equalsIgnoreAsciiCaseAscii( ODF_FORMCHECKBOX ) )
- {
- sal_Int32 nValue = 0;
-- sal_Int32 nCount = mxFormField->getParamCount();
-- for( sal_Int32 i = 0; i < nCount; i++ )
-+ uno::Any aVal = mxFormField->getParameters()->getByName( rtl::OUString::createFromAscii( ODF_FORMCHECKBOX_RESULT ) );
-+ rtl::OUString sVal;
-+ if ( aVal >>= sVal )
- {
-- if( mxFormField->getParamName(i).equalsIgnoreAsciiCaseAscii( ECMA_FORMCHECKBOX_CHECKED ) )
-- {
-- if( mxFormField->getParamValue(i).equalsIgnoreAsciiCaseAscii("on") )
-- nValue = 1;
-- else
-- nValue = 0;
-- break;
-- }
--
-+ if ( sVal.equalsIgnoreAsciiCaseAscii("on") )
-+ nValue = 1;
-+ else
-+ nValue = 0;
- }
- sResult = rtl::OUString::valueOf( nValue );
- }
-@@ -86,13 +82,13 @@ rtl::OUString SAL_CALL SwVbaFormField::getResult() throw ( uno::RuntimeException
- void SAL_CALL SwVbaFormField::setResult( const rtl::OUString& result ) throw ( uno::RuntimeException )
- {
- rtl::OUString sType = mxFormField->getFieldType();
-- if( sType.equalsIgnoreAsciiCaseAscii( ECMA_FORMTEXT ) )
-+ if( sType.equalsIgnoreAsciiCaseAscii( ODF_FORMTEXT ) )
- {
- uno::Reference< text::XTextContent > xTextContent( mxFormField, uno::UNO_QUERY_THROW );
- uno::Reference< text::XTextRange > xTextRange = xTextContent->getAnchor();
- xTextRange->setString( result );
- }
-- else if( sType.equalsIgnoreAsciiCaseAscii( ECMA_FORMCHECKBOX ) )
-+ else if( sType.equalsIgnoreAsciiCaseAscii( ODF_FORMCHECKBOX ) )
- {
- // do nothing
- }
-diff --git sw/source/ui/vba/vbaformfields.cxx sw/source/ui/vba/vbaformfields.cxx
-index b56cff8..a5bd6f5 100644
---- sw/source/ui/vba/vbaformfields.cxx
-+++ sw/source/ui/vba/vbaformfields.cxx
-@@ -35,6 +35,7 @@
- #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
- #include "wordvbahelper.hxx"
- #include <cppuhelper/implbase3.hxx>
-+#include <xmloff/odffields.hxx>
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-@@ -46,16 +47,10 @@ typedef ::cppu::WeakImplHelper3< container::XNameAccess, container::XIndexAccess
- rtl::OUString lcl_getFormFieldName( const uno::Reference< text::XFormField >& xFormField )
- {
- rtl::OUString sName;
-- sal_Int32 nCount = xFormField->getParamCount();
-- for( sal_Int32 i = 0; i < nCount; i++ )
-- {
-- if( xFormField->getParamName(i).equalsIgnoreAsciiCaseAscii( "Name" ) )
-- {
-- sName = xFormField->getParamValue(i);
-- OSL_TRACE("lcl_getFormFieldName: %s", rtl::OUStringToOString( sName, RTL_TEXTENCODING_UTF8 ).getStr() );
-- break;
-- }
-- }
-+ // FIXME What about Textfields? the name property has been removed when upstreaming cbosdo02
-+ uno::Any aVal = xFormField->getParameters()->getByName( rtl::OUString::createFromAscii( ODF_FORMCHECKBOX_NAME ) );
-+ if ( aVal >>= sName )
-+ OSL_TRACE("lcl_getFormFieldName: %s", rtl::OUStringToOString( sName, RTL_TEXTENCODING_UTF8 ).getStr() );
- return sName;
- }
-
diff --git a/patches/vba/cws-vbasupportdev300_m83.diff b/patches/vba/cws-vbasupportdev300_m83.diff
deleted file mode 100644
index 2119a2372..000000000
--- a/patches/vba/cws-vbasupportdev300_m83.diff
+++ /dev/null
@@ -1,50376 +0,0 @@
-diff --git basctl/source/basicide/baside2.cxx basctl/source/basicide/baside2.cxx
-index 1c9e37a..8d474c6 100644
---- basctl/source/basicide/baside2.cxx
-+++ basctl/source/basicide/baside2.cxx
-@@ -367,8 +367,9 @@ BOOL ModulWindow::BasicExecute()
- }
- else if ( !pMethod || ( nStart < nCurMethodStart ) )
- {
-+ nCurMethodStart = nStart;
- pMethod = pM;
-- nCurMethodStart = nStart;
-+ break;
- }
- }
- if ( !pMethod )
-diff --git basctl/source/basicide/baside3.cxx basctl/source/basicide/baside3.cxx
-index e307720..fbd83c8 100644
---- basctl/source/basicide/baside3.cxx
-+++ basctl/source/basicide/baside3.cxx
-@@ -82,6 +82,7 @@
- #include <com/sun/star/resource/XStringResourceResolver.hpp>
- #include <com/sun/star/resource/StringResourceWithLocation.hpp>
- #include <com/sun/star/task/XInteractionHandler.hpp>
-+#include <com/sun/star/script/XVBACompat.hpp>
-
- using namespace comphelper;
- using namespace ::com::sun::star;
-@@ -112,8 +113,16 @@ DialogWindow::DialogWindow( Window* pParent, const ScriptDocument& rDocument, St
- {
- InitSettings( TRUE, TRUE, TRUE );
-
-- pEditor = new DlgEditor();
-+ pEditor = new DlgEditor( rDocument.isDocument() ? rDocument.getDocument() : Reference< frame::XModel >() );
- pEditor->SetWindow( this );
-+ // set vba mode on DialogModel ( allows it to work in 100thmm instead of MAP_APPFONT )
-+ if ( rDocument.isDocument() && rDocument.getDocument().is() )
-+ {
-+ uno::Reference< script::XVBACompat > xDocVBAMode( rDocument.getLibraryContainer( E_SCRIPTS ), uno::UNO_QUERY );
-+ uno::Reference< script::XVBACompat > xDialogModelVBAMode( xDialogModel, uno::UNO_QUERY );
-+ if ( xDocVBAMode.is() && xDialogModelVBAMode.is() )
-+ xDialogModelVBAMode->setVBACompatModeOn( xDocVBAMode->getVBACompatModeOn() );
-+ }
- pEditor->SetDialog( xDialogModel );
-
- // Undo einrichten
-@@ -728,7 +737,7 @@ BOOL DialogWindow::SaveDialog()
- Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
- OSL_ASSERT( xProps.is() );
- OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
-- Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext );
-+ Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, GetDocument().isDocument() ? GetDocument().getDocument() : Reference< frame::XModel >() );
- Reference< XInputStream > xInput( xISP->createInputStream() );
-
- Reference< XSimpleFileAccess > xSFI( xMSF->createInstance
-@@ -1010,7 +1019,7 @@ BOOL implImportDialog( Window* pWin, const String& rCurPath, const ScriptDocumen
- Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
- OSL_ASSERT( xProps.is() );
- OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
-- ::xmlscript::importDialogModel( xInput, xDialogModel, xContext );
-+ ::xmlscript::importDialogModel( xInput, xDialogModel, xContext, rDocument.isDocument() ? rDocument.getDocument() : Reference< frame::XModel >() );
-
- String aXmlDlgName;
- Reference< beans::XPropertySet > xDialogModelPropSet( xDialogModel, UNO_QUERY );
-@@ -1236,7 +1245,7 @@ BOOL implImportDialog( Window* pWin, const String& rCurPath, const ScriptDocumen
- }
- }
-
-- Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext );
-+ Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, rDocument.isDocument() ? rDocument.getDocument() : Reference< frame::XModel >() );
- bool bSuccess = rDocument.insertDialog( aLibName, aNewDlgName, xISP );
- if( bSuccess )
- {
-@@ -1346,7 +1355,7 @@ void DialogWindow::StoreData()
- Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
- OSL_ASSERT( xProps.is() );
- OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
-- Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext );
-+ Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, GetDocument().isDocument() ? GetDocument().getDocument() : Reference< frame::XModel >() );
- xLib->replaceByName( ::rtl::OUString( GetName() ), makeAny( xISP ) );
- }
- }
-diff --git basctl/source/basicide/basides3.cxx basctl/source/basicide/basides3.cxx
-index 1b71e43..6ec1dcd 100644
---- basctl/source/basicide/basides3.cxx
-+++ basctl/source/basicide/basides3.cxx
-@@ -96,7 +96,7 @@ DialogWindow* BasicIDEShell::CreateDlgWin( const ScriptDocument& rDocument, cons
- Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
- OSL_ASSERT( xProps.is() );
- OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
-- ::xmlscript::importDialogModel( xInput, xDialogModel, xContext );
-+ ::xmlscript::importDialogModel( xInput, xDialogModel, xContext, rDocument.isDocument() ? rDocument.getDocument() : Reference< frame::XModel >() );
- LocalizationMgr::setStringResourceAtDialog( rDocument, rLibName, aDlgName, xDialogModel );
-
- // new dialog window
-diff --git basctl/source/basicide/moduldlg.cxx basctl/source/basicide/moduldlg.cxx
-index e2a2377..b00acdd 100644
---- basctl/source/basicide/moduldlg.cxx
-+++ basctl/source/basicide/moduldlg.cxx
-@@ -312,7 +312,7 @@ void BasicIDEShell::CopyDialogResources( Reference< io::XInputStreamProvider >&
- Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
- OSL_ASSERT( xProps.is() );
- OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
-- ::xmlscript::importDialogModel( xInput, xDialogModel, xContext );
-+ ::xmlscript::importDialogModel( xInput, xDialogModel, xContext, rSourceDoc.isDocument() ? rSourceDoc.getDocument() : Reference< frame::XModel >() );
-
- if( xDialogModel.is() )
- {
-@@ -329,7 +329,7 @@ void BasicIDEShell::CopyDialogResources( Reference< io::XInputStreamProvider >&
- {
- LocalizationMgr::setResourceIDsForDialog( xDialogModel, xDestMgr );
- }
-- io_xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext );
-+ io_xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, rDestDoc.isDocument() ? rDestDoc.getDocument() : Reference< frame::XModel >() );
- }
- }
-
-diff --git basctl/source/basicide/scriptdocument.cxx basctl/source/basicide/scriptdocument.cxx
-index b85ac92..faf47ad 100644
---- basctl/source/basicide/scriptdocument.cxx
-+++ basctl/source/basicide/scriptdocument.cxx
-@@ -453,14 +453,12 @@ namespace basctl
- bool ScriptDocument_Impl::isInVBAMode() const
- {
- bool bResult = false;
--#ifdef FUTURE_VBA_CWS
- if ( !isApplication() )
- {
- Reference< XVBACompat > xVBACompat( getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
- if ( xVBACompat.is() )
- bResult = xVBACompat->getVBACompatModeOn();
- }
--#endif
- return bResult;
- }
-
-@@ -678,7 +676,7 @@ namespace basctl
- if ( !_rxExistingDialogModel.is() )
- {
- Reference< XInputStream > xInput( xISP->createInputStream(), UNO_QUERY_THROW );
-- ::xmlscript::importDialogModel( xInput, xDialogModel, aContext.getUNOContext() );
-+ ::xmlscript::importDialogModel( xInput, xDialogModel, aContext.getUNOContext(), isDocument() ? getDocument() : Reference< XModel >() );
- }
-
- // set new name as property
-@@ -686,12 +684,12 @@ namespace basctl
- xDlgPSet->setPropertyValue( DLGED_PROP_NAME, makeAny( _rNewName ) );
-
- // export dialog model
-- xISP = ::xmlscript::exportDialogModel( xDialogModel, aContext.getUNOContext() );
-+ xISP = ::xmlscript::exportDialogModel( xDialogModel, aContext.getUNOContext(), isDocument() ? getDocument() : Reference< XModel >() );
- aElement <<= xISP;
- }
-
- // insert element by new name in container
-- else if ( _eType == E_SCRIPTS )
-+ if ( _eType == E_SCRIPTS )
- {
- Reference< XVBAModuleInfo > xVBAModuleInfo( xLib, UNO_QUERY );
- if ( xVBAModuleInfo->hasModuleInfo( _rOldName ) )
-@@ -798,7 +796,7 @@ namespace basctl
- xDlgPSet->setPropertyValue( DLGED_PROP_NAME, makeAny( _rDialogName ) );
-
- // export dialog model
-- _out_rDialogProvider = ::xmlscript::exportDialogModel( xDialogModel, aContext.getUNOContext() );
-+ _out_rDialogProvider = ::xmlscript::exportDialogModel( xDialogModel, aContext.getUNOContext(), isDocument() ? getDocument() : Reference< XModel >() );
-
- // insert dialog into library
- xLib->insertByName( _rDialogName, makeAny( _out_rDialogProvider ) );
-diff --git basctl/source/dlged/dlged.cxx basctl/source/dlged/dlged.cxx
-index 04bc7e5..020f934 100644
---- basctl/source/dlged/dlged.cxx
-+++ basctl/source/dlged/dlged.cxx
-@@ -205,7 +205,7 @@ BOOL DlgEditor::RemarkDialog()
-
- //----------------------------------------------------------------------------
-
--DlgEditor::DlgEditor()
-+DlgEditor::DlgEditor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel )
- :pHScroll(NULL)
- ,pVScroll(NULL)
- ,pDlgEdModel(NULL)
-@@ -227,6 +227,7 @@ DlgEditor::DlgEditor()
- ,bCreateOK(TRUE)
- ,bDialogModelChanged(FALSE)
- ,mnPaintGuard(0)
-+ ,m_xDocument( xModel )
- {
- pDlgEdModel = new DlgEdModel();
- pDlgEdModel->GetItemPool().FreezeIdRanges();
-@@ -835,7 +836,7 @@ void DlgEditor::Copy()
- Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
- OSL_ASSERT( xProps.is() );
- OSL_VERIFY( xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
-- Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xClipDialogModel, xContext );
-+ Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xClipDialogModel, xContext, m_xDocument );
- Reference< XInputStream > xStream( xISP->createInputStream() );
- Sequence< sal_Int8 > DialogModelBytes;
- implCopyStreamToByteSequence( xStream, DialogModelBytes );
-@@ -868,7 +869,7 @@ void DlgEditor::Copy()
- uno::Reference< resource::XStringResourceManager >
- xStringResourceManager( xStringResourcePersistence, uno::UNO_QUERY );
- LocalizationMgr::resetResourceForDialog( xClipDialogModel, xStringResourceManager );
-- Reference< XInputStreamProvider > xISP2 = ::xmlscript::exportDialogModel( xClipDialogModel, xContext );
-+ Reference< XInputStreamProvider > xISP2 = ::xmlscript::exportDialogModel( xClipDialogModel, xContext, m_xDocument );
- Reference< XInputStream > xStream2( xISP2->createInputStream() );
- Sequence< sal_Int8 > NoResourceDialogModelBytes;
- implCopyStreamToByteSequence( xStream2, NoResourceDialogModelBytes );
-@@ -1014,7 +1015,7 @@ void DlgEditor::Paste()
- Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
- OSL_ASSERT( xProps.is() );
- OSL_VERIFY( xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
-- ::xmlscript::importDialogModel( ::xmlscript::createInputStream( *((::rtl::ByteSequence*)(&DialogModelBytes)) ) , xClipDialogModel, xContext );
-+ ::xmlscript::importDialogModel( ::xmlscript::createInputStream( *((::rtl::ByteSequence*)(&DialogModelBytes)) ) , xClipDialogModel, xContext, m_xDocument );
- }
-
- // get control models from clipboard dialog model
-diff --git basctl/source/dlged/dlgedobj.cxx basctl/source/dlged/dlgedobj.cxx
-index 50b54c6..a56985e 100644
---- basctl/source/dlged/dlgedobj.cxx
-+++ basctl/source/dlged/dlgedobj.cxx
-@@ -74,6 +74,22 @@ TYPEINIT1(DlgEdObj, SdrUnoObj);
- DBG_NAME(DlgEdObj);
-
- //----------------------------------------------------------------------------
-+MapMode lcl_getMapModeForForm( DlgEdForm* pForm )
-+{
-+ MapMode aMode( MAP_APPFONT ); //Default
-+ try
-+ {
-+ uno::Reference< beans::XPropertySet > xProps( pForm ? pForm->GetUnoControlModel() : NULL, uno::UNO_QUERY_THROW );
-+ sal_Bool bVBAForm = sal_False;
-+ xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VBAForm") ) ) >>= bVBAForm;
-+ if ( bVBAForm )
-+ aMode = MapMode( MAP_100TH_MM );
-+ }
-+ catch ( Exception& )
-+ {
-+ }
-+ return aMode;
-+}
-
- DlgEdObj::DlgEdObj()
- :SdrUnoObj(String(), sal_False)
-@@ -194,8 +210,9 @@ bool DlgEdObj::TransformSdrToControlCoordinates(
- }
-
- // convert pixel to logic units
-- aPos = pDevice->PixelToLogic( aPos, MapMode( MAP_APPFONT ) );
-- aSize = pDevice->PixelToLogic( aSize, MapMode( MAP_APPFONT ) );
-+ MapMode aConvMode = lcl_getMapModeForForm( pForm );
-+ aPos = pDevice->PixelToLogic( aPos, aConvMode );
-+ aSize = pDevice->PixelToLogic( aSize, aConvMode );
-
- // set out parameters
- nXOut = aPos.Width();
-@@ -242,10 +259,10 @@ bool DlgEdObj::TransformSdrToFormCoordinates(
- aSize.Width() -= aDeviceInfo.LeftInset + aDeviceInfo.RightInset;
- aSize.Height() -= aDeviceInfo.TopInset + aDeviceInfo.BottomInset;
- }
--
-+ MapMode aConvMode = lcl_getMapModeForForm( pForm );
- // convert pixel to logic units
-- aPos = pDevice->PixelToLogic( aPos, MapMode( MAP_APPFONT ) );
-- aSize = pDevice->PixelToLogic( aSize, MapMode( MAP_APPFONT ) );
-+ aPos = pDevice->PixelToLogic( aPos, aConvMode );
-+ aSize = pDevice->PixelToLogic( aSize, aConvMode );
-
- // set out parameters
- nXOut = aPos.Width();
-@@ -287,9 +304,10 @@ bool DlgEdObj::TransformControlToSdrCoordinates(
- DBG_ASSERT( pDevice, "DlgEdObj::TransformControlToSdrCoordinates: missing default device!" );
- if ( !pDevice )
- return false;
-- aPos = pDevice->LogicToPixel( aPos, MapMode( MAP_APPFONT ) );
-- aSize = pDevice->LogicToPixel( aSize, MapMode( MAP_APPFONT ) );
-- aFormPos = pDevice->LogicToPixel( aFormPos, MapMode( MAP_APPFONT ) );
-+ MapMode aConvMode = lcl_getMapModeForForm( pForm );
-+ aPos = pDevice->LogicToPixel( aPos, aConvMode );
-+ aSize = pDevice->LogicToPixel( aSize, aConvMode );
-+ aFormPos = pDevice->LogicToPixel( aFormPos, aConvMode );
-
- // add form position
- aPos.Width() += aFormPos.Width();
-@@ -333,14 +351,16 @@ bool DlgEdObj::TransformFormToSdrCoordinates(
- DBG_ASSERT( pDevice, "DlgEdObj::TransformFormToSdrCoordinates: missing default device!" );
- if ( !pDevice )
- return false;
-- aPos = pDevice->LogicToPixel( aPos, MapMode( MAP_APPFONT ) );
-- aSize = pDevice->LogicToPixel( aSize, MapMode( MAP_APPFONT ) );
-
- // take window borders into account
- DlgEdForm* pForm = NULL;
- if ( !lcl_getDlgEdForm( this, pForm ) )
- return false;
-
-+ MapMode aConvMode = lcl_getMapModeForForm( pForm );
-+ aPos = pDevice->LogicToPixel( aPos, aConvMode );
-+ aSize = pDevice->LogicToPixel( aSize, aConvMode );
-+
- // take window borders into account
- Reference< beans::XPropertySet > xPSetForm( pForm->GetUnoControlModel(), UNO_QUERY );
- DBG_ASSERT( xPSetForm.is(), "DlgEdObj::TransformFormToSdrCoordinates: no form property set!" );
-diff --git basctl/source/inc/dlged.hxx basctl/source/inc/dlged.hxx
-index a8adcda..a2ea57c 100644
---- basctl/source/inc/dlged.hxx
-+++ basctl/source/inc/dlged.hxx
-@@ -32,6 +32,7 @@
- #include <com/sun/star/awt/XControlContainer.hpp>
- #include <com/sun/star/datatransfer/DataFlavor.hpp>
- #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
-+#include <com/sun/star/frame/XModel.hpp>
- #include <tools/link.hxx>
- #include <tools/gen.hxx>
- #include <vcl/timer.hxx>
-@@ -128,9 +129,11 @@ protected:
- BOOL bDialogModelChanged;
- Timer aMarkTimer;
- long mnPaintGuard;
-+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xDocument;
-
-+ DlgEditor(); // not implemented
- public:
-- DlgEditor();
-+ DlgEditor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel );
- ~DlgEditor();
-
- void SetWindow( Window* pWindow );
-diff --git basic/inc/basic/basmgr.hxx basic/inc/basic/basmgr.hxx
-index 886aa7f..58cf623 100644
---- basic/inc/basic/basmgr.hxx
-+++ basic/inc/basic/basmgr.hxx
-@@ -236,7 +236,7 @@ public:
- takes the names of modules whose size exceeds the legacy limit
- */
- bool LegacyPsswdBinaryLimitExceeded( ::com::sun::star::uno::Sequence< rtl::OUString >& _out_rModuleNames );
--
-+ bool HasExeCode( const String& );
- private:
- BOOL IsReference( USHORT nLib );
-
-diff --git basic/inc/basic/sbmeth.hxx basic/inc/basic/sbmeth.hxx
-index 38319ac..89f88da 100644
---- basic/inc/basic/sbmeth.hxx
-+++ basic/inc/basic/sbmeth.hxx
-@@ -46,6 +46,7 @@ class SbMethod : public SbxMethod
- friend class SbIfaceMapperMethod;
-
- SbMethodImpl* mpSbMethodImpl; // Impl data
-+ SbxVariable* mCaller; // caller
- SbModule* pMod;
- USHORT nDebugFlags;
- USHORT nLine1, nLine2;
-@@ -72,7 +73,7 @@ public:
- void GetLineRange( USHORT&, USHORT& );
-
- // Schnittstelle zum Ausfuehren einer Methode aus den Applikationen
-- virtual ErrCode Call( SbxValue* pRet = NULL );
-+ virtual ErrCode Call( SbxValue* pRet = NULL, SbxVariable* pCaller = NULL );
- virtual void Broadcast( ULONG nHintId );
- };
-
-diff --git basic/inc/basic/sbmod.hxx basic/inc/basic/sbmod.hxx
-index 9681149..59017f2 100644
---- basic/inc/basic/sbmod.hxx
-+++ basic/inc/basic/sbmod.hxx
-@@ -28,10 +28,12 @@
- #ifndef _SB_SBMOD_HXX
- #define _SB_SBMOD_HXX
-
-+#include <com/sun/star/script/XInvocation.hpp>
- #include <basic/sbdef.hxx>
- #include <basic/sbxobj.hxx>
- #include <basic/sbxdef.hxx>
- #include <rtl/ustring.hxx>
-+#include <vector>
-
- class SbMethod;
- class SbProperty;
-@@ -54,8 +56,12 @@ class SbModule : public SbxObject
- friend class SbClassModuleObject;
-
- SbModuleImpl* mpSbModuleImpl; // Impl data
-+ std::vector< String > mModuleVariableNames;
-+ SbModule();
-+ SbModule(const SbModule&);
-
- protected:
-+ com::sun::star::uno::Reference< com::sun::star::script::XInvocation > mxWrapper;
- ::rtl::OUString aOUSource;
- String aComment;
- SbiImage* pImage; // the Image
-@@ -125,11 +131,15 @@ public:
- BOOL LoadBinaryData( SvStream& );
- BOOL ExceedsLegacyModuleSize();
- void fixUpMethodStart( bool bCvtToLegacy, SbiImage* pImg = NULL ) const;
-+ bool HasExeCode();
- BOOL IsVBACompat();
- void SetVBACompat( BOOL bCompat );
- INT32 GetModuleType() { return mnType; }
- void SetModuleType( INT32 nType ) { mnType = nType; }
- bool GetIsProxyModule() { return bIsProxyModule; }
-+ void AddVarName( const String& aName );
-+ void RemoveVars();
-+ ::com::sun::star::uno::Reference< ::com::sun::star::script::XInvocation > GetUnoModule();
- };
-
- #ifndef __SB_SBMODULEREF_HXX
-diff --git basic/inc/basic/sbuno.hxx basic/inc/basic/sbuno.hxx
-index 27fe320..c5e0209 100644
---- basic/inc/basic/sbuno.hxx
-+++ basic/inc/basic/sbuno.hxx
-@@ -38,6 +38,7 @@ SbxObjectRef GetSbUnoObject( const String& aName, const com::sun::star::uno::Any
-
- // Force creation of all properties for debugging
- void createAllObjectProperties( SbxObject* pObj );
-+void SetSbUnoObjectDfltPropName( SbxObject* pObj );
-
- ::com::sun::star::uno::Any sbxToUnoValue( SbxVariable* pVar );
-
-diff --git basic/source/basmgr/basmgr.cxx basic/source/basmgr/basmgr.cxx
-index a18b9bb..bebcc4f 100644
---- basic/source/basmgr/basmgr.cxx
-+++ basic/source/basmgr/basmgr.cxx
-@@ -1139,6 +1139,25 @@ void BasicManager::LegacyDeleteBasicManager( BasicManager*& _rpManager )
- _rpManager = NULL;
- }
-
-+
-+bool BasicManager::HasExeCode( const String& sLib )
-+{
-+ StarBASIC* pLib = GetLib(sLib);
-+ if ( pLib )
-+ {
-+ SbxArray* pMods = pLib->GetModules();
-+ USHORT nMods = pMods ? pMods->Count() : 0;
-+ for( USHORT i = 0; i < nMods; i++ )
-+ {
-+ SbModule* p = (SbModule*) pMods->Get( i );
-+ if ( p )
-+ if ( p->HasExeCode() )
-+ return true;
-+ }
-+ }
-+ return false;
-+}
-+
- void BasicManager::Init()
- {
- DBG_CHKTHIS( BasicManager, 0 );
-diff --git basic/source/classes/sb.cxx basic/source/classes/sb.cxx
-index a7d1c50..0131057 100755
---- basic/source/classes/sb.cxx
-+++ basic/source/classes/sb.cxx
-@@ -531,72 +531,7 @@ SbClassModuleObject::~SbClassModuleObject()
- void SbClassModuleObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
- const SfxHint& rHint, const TypeId& rHintType )
- {
-- bool bDone = false;
--
-- const SbxHint* pHint = PTR_CAST(SbxHint,&rHint);
-- if( pHint )
-- {
-- SbxVariable* pVar = pHint->GetVar();
-- SbProcedureProperty* pProcProperty = PTR_CAST( SbProcedureProperty, pVar );
-- if( pProcProperty )
-- {
-- bDone = true;
--
-- if( pHint->GetId() == SBX_HINT_DATAWANTED )
-- {
-- String aProcName;
-- aProcName.AppendAscii( "Property Get " );
-- aProcName += pProcProperty->GetName();
--
-- SbxVariable* pMeth = Find( aProcName, SbxCLASS_METHOD );
-- if( pMeth )
-- {
-- SbxValues aVals;
-- aVals.eType = SbxVARIANT;
-- pMeth->Get( aVals );
-- pVar->Put( aVals );
-- }
-- }
-- else if( pHint->GetId() == SBX_HINT_DATACHANGED )
-- {
-- SbxVariable* pMeth = NULL;
--
-- bool bSet = pProcProperty->isSet();
-- if( bSet )
-- {
-- pProcProperty->setSet( false );
--
-- String aProcName;
-- aProcName.AppendAscii( "Property Set " );
-- aProcName += pProcProperty->GetName();
-- pMeth = Find( aProcName, SbxCLASS_METHOD );
-- }
-- if( !pMeth ) // Let
-- {
-- String aProcName;
-- aProcName.AppendAscii( "Property Let " );
-- aProcName += pProcProperty->GetName();
-- pMeth = Find( aProcName, SbxCLASS_METHOD );
-- }
--
-- if( pMeth )
-- {
-- // Setup parameters
-- SbxArrayRef xArray = new SbxArray;
-- xArray->Put( pMeth, 0 ); // Method as parameter 0
-- xArray->Put( pVar, 1 );
-- pMeth->SetParameters( xArray );
--
-- SbxValues aVals;
-- pMeth->Get( aVals );
-- pMeth->SetParameters( NULL );
-- }
-- }
-- }
-- }
--
-- if( !bDone )
-- SbModule::SFX_NOTIFY( rBC, rBCType, rHint, rHintType );
-+ SbModule::SFX_NOTIFY( rBC, rBCType, rHint, rHintType );
- }
-
- SbxVariable* SbClassModuleObject::Find( const XubString& rName, SbxClassType t )
-@@ -1022,7 +957,6 @@ SbxVariable* StarBASIC::Find( const String& rName, SbxClassType t )
- INT32 nType = p->GetModuleType();
- if ( nType == ModuleType::DOCUMENT || nType == ModuleType::FORM )
- continue;
--
- // otherwise check if the element is available
- // unset GBLSEARCH-Flag (due to Rekursion)
- USHORT nGblFlag = p->GetFlags() & SBX_GBLSEARCH;
-diff --git basic/source/classes/sbunoobj.cxx basic/source/classes/sbunoobj.cxx
-index f80e5e0..907474d 100644
---- basic/source/classes/sbunoobj.cxx
-+++ basic/source/classes/sbunoobj.cxx
-@@ -60,6 +60,7 @@
- #include <com/sun/star/script/XInvocationAdapterFactory.hpp>
- #include <com/sun/star/script/XTypeConverter.hpp>
- #include <com/sun/star/script/XDefaultProperty.hpp>
-+#include <com/sun/star/script/XDefaultMethod.hpp>
- #include <com/sun/star/container/XNameAccess.hpp>
- #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
- #include <com/sun/star/reflection/XIdlArray.hpp>
-@@ -70,7 +71,7 @@
- #include <com/sun/star/bridge/oleautomation/Date.hpp>
- #include <com/sun/star/bridge/oleautomation/Decimal.hpp>
- #include <com/sun/star/bridge/oleautomation/Currency.hpp>
--
-+#include <com/sun/star/script/XAutomationInvocation.hpp>
-
- using com::sun::star::uno::Reference;
- using namespace com::sun::star::uno;
-@@ -156,6 +157,21 @@ SbxVariable* getDefaultProp( SbxVariable* pRef )
- return pDefaultProp;
- }
-
-+void SetSbUnoObjectDfltPropName( SbxObject* pObj )
-+{
-+ SbUnoObject* pUnoObj = PTR_CAST(SbUnoObject,(SbxObject*) pObj);
-+ if ( pUnoObj )
-+ {
-+ String sDfltPropName;
-+
-+ if ( SbUnoObject::getDefaultPropName( pUnoObj, sDfltPropName ) )
-+ {
-+ OSL_TRACE("SetSbUnoObjectDfltPropName setting dflt prop for %s", rtl::OUStringToOString( pObj->GetName(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ pUnoObj->SetDfltProperty( sDfltPropName );
-+ }
-+ }
-+}
-+
- Reference< XComponentContext > getComponentContext_Impl( void )
- {
- static Reference< XComponentContext > xContext;
-@@ -452,6 +468,32 @@ void implHandleWrappedTargetException( const Any& _rWrappedTargetException )
- SbError nError( ERRCODE_BASIC_EXCEPTION );
- ::rtl::OUStringBuffer aMessageBuf;
-
-+ // Add for VBA, to get the correct error code and message.
-+ if ( SbiRuntime::isVBAEnabled() )
-+ {
-+ if ( aExamine >>= aBasicError )
-+ {
-+ if ( aBasicError.ErrorCode != 0 )
-+ {
-+ nError = StarBASIC::GetSfxFromVBError( (USHORT) aBasicError.ErrorCode );
-+ if ( nError == 0 )
-+ {
-+ nError = (SbError) aBasicError.ErrorCode;
-+ }
-+ aMessageBuf.append( aBasicError.ErrorMessageArgument );
-+ aExamine.clear();
-+ }
-+ }
-+
-+ IndexOutOfBoundsException aIdxOutBndsExp;
-+ if ( aExamine >>= aIdxOutBndsExp )
-+ {
-+ nError = SbERR_OUT_OF_RANGE;
-+ aExamine.clear();
-+ }
-+ }
-+ // End add
-+
- // strip any other WrappedTargetException instances, but this time preserve the error messages.
- WrappedTargetException aWrapped;
- sal_Int32 nLevel = 0;
-@@ -1490,6 +1532,103 @@ Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty
- return aRetVal;
- }
-
-+void processAutomationParams( SbxArray* pParams, Sequence< Any >& args, bool bOLEAutomation, UINT32 nParamCount )
-+{
-+ AutomationNamedArgsSbxArray* pArgNamesArray = NULL;
-+ if( bOLEAutomation )
-+ pArgNamesArray = PTR_CAST(AutomationNamedArgsSbxArray,pParams);
-+
-+ args.realloc( nParamCount );
-+ Any* pAnyArgs = args.getArray();
-+ bool bBlockConversionToSmallestType = pINST->IsCompatibility();
-+ UINT32 i = 0;
-+ if( pArgNamesArray )
-+ {
-+ Sequence< ::rtl::OUString >& rNameSeq = pArgNamesArray->getNames();
-+ ::rtl::OUString* pNames = rNameSeq.getArray();
-+ Any aValAny;
-+ for( i = 0 ; i < nParamCount ; i++ )
-+ {
-+ USHORT iSbx = (USHORT)(i+1);
-+
-+ // ACHTUNG: Bei den Sbx-Parametern den Offset nicht vergessen!
-+ aValAny = sbxToUnoValueImpl( pParams->Get( iSbx ),
-+ bBlockConversionToSmallestType );
-+
-+ ::rtl::OUString aParamName = pNames[iSbx];
-+ if( aParamName.getLength() )
-+ {
-+ oleautomation::NamedArgument aNamedArgument;
-+ aNamedArgument.Name = aParamName;
-+ aNamedArgument.Value = aValAny;
-+ pAnyArgs[i] <<= aNamedArgument;
-+ }
-+ else
-+ {
-+ pAnyArgs[i] = aValAny;
-+ }
-+ }
-+ }
-+ else
-+ {
-+ for( i = 0 ; i < nParamCount ; i++ )
-+ {
-+ // ACHTUNG: Bei den Sbx-Parametern den Offset nicht vergessen!
-+ pAnyArgs[i] = sbxToUnoValueImpl( pParams->Get( (USHORT)(i+1) ),
-+ bBlockConversionToSmallestType );
-+ }
-+ }
-+
-+}
-+enum INVOKETYPE
-+{
-+ GetProp = 0,
-+ SetProp,
-+ Func
-+};
-+Any invokeAutomationMethod( const String& Name, Sequence< Any >& args, SbxArray* pParams, UINT32 nParamCount, Reference< XInvocation >& rxInvocation, INVOKETYPE invokeType = Func )
-+{
-+ Sequence< INT16 > OutParamIndex;
-+ Sequence< Any > OutParam;
-+
-+ Any aRetAny;
-+ switch( invokeType )
-+ {
-+ case Func:
-+ aRetAny = rxInvocation->invoke( Name, args, OutParamIndex, OutParam );
-+ break;
-+ case GetProp:
-+ {
-+ Reference< XAutomationInvocation > xAutoInv( rxInvocation, UNO_QUERY );
-+ aRetAny = xAutoInv->invokeGetProperty( Name, args, OutParamIndex, OutParam );
-+ break;
-+ }
-+ case SetProp:
-+ {
-+ Reference< XAutomationInvocation > xAutoInv( rxInvocation, UNO_QUERY_THROW );
-+ aRetAny = xAutoInv->invokePutProperty( Name, args, OutParamIndex, OutParam );
-+ break;
-+ }
-+ default:
-+ break; // should introduce an error here
-+
-+ }
-+ const INT16* pIndices = OutParamIndex.getConstArray();
-+ UINT32 nLen = OutParamIndex.getLength();
-+ if( nLen )
-+ {
-+ const Any* pNewValues = OutParam.getConstArray();
-+ for( UINT32 j = 0 ; j < nLen ; j++ )
-+ {
-+ INT16 iTarget = pIndices[ j ];
-+ if( iTarget >= (INT16)nParamCount )
-+ break;
-+ unoToSbxValue( (SbxVariable*)pParams->Get( (USHORT)(j+1) ), pNewValues[ j ] );
-+ }
-+ }
-+ return aRetAny;
-+}
-+
- // Dbg-Hilfsmethode zum Auslesen der in einem Object implementierten Interfaces
- String Impl_GetInterfaceInfo( const Reference< XInterface >& x, const Reference< XIdlClass >& xClass, USHORT nRekLevel )
- {
-@@ -1990,11 +2129,26 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
- {
- try
- {
-- // Wert holen
-- Any aRetAny = mxInvocation->getValue( pProp->GetName() );
-+ UINT32 nParamCount = pParams ? ((UINT32)pParams->Count() - 1) : 0;
-+ sal_Bool bCanBeConsideredAMethod = mxInvocation->hasMethod( pProp->GetName() );
-+ Any aRetAny;
-+ if ( bCanBeConsideredAMethod && nParamCount )
-+ {
-+ // Automation properties have methods, so.. we need to invoke this through
-+ // XInvocation
-+ Sequence<Any> args;
-+ processAutomationParams( pParams, args, true, nParamCount );
-+ aRetAny = invokeAutomationMethod( pProp->GetName(), args, pParams, nParamCount, mxInvocation, GetProp );
-+ }
-+ else
-+ // Wert holen
-+ aRetAny = mxInvocation->getValue( pProp->GetName() );
-
- // Wert von Uno nach Sbx uebernehmen
- unoToSbxValue( pVar, aRetAny );
-+ if( pParams && bCanBeConsideredAMethod )
-+ pVar->SetParameters( NULL );
-+
- }
- catch( const Exception& )
- {
-@@ -2119,52 +2273,7 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
- else if( bInvocation && pParams && mxInvocation.is() )
- {
- bool bOLEAutomation = true;
-- // TODO: bOLEAutomation = xOLEAutomation.is()
--
-- AutomationNamedArgsSbxArray* pArgNamesArray = NULL;
-- if( bOLEAutomation )
-- pArgNamesArray = PTR_CAST(AutomationNamedArgsSbxArray,pParams);
--
-- args.realloc( nParamCount );
-- Any* pAnyArgs = args.getArray();
-- bool bBlockConversionToSmallestType = pINST->IsCompatibility();
-- if( pArgNamesArray )
-- {
-- Sequence< ::rtl::OUString >& rNameSeq = pArgNamesArray->getNames();
-- ::rtl::OUString* pNames = rNameSeq.getArray();
--
-- Any aValAny;
-- for( i = 0 ; i < nParamCount ; i++ )
-- {
-- USHORT iSbx = (USHORT)(i+1);
--
-- // ACHTUNG: Bei den Sbx-Parametern den Offset nicht vergessen!
-- aValAny = sbxToUnoValueImpl( pParams->Get( iSbx ),
-- bBlockConversionToSmallestType );
--
-- ::rtl::OUString aParamName = pNames[iSbx];
-- if( aParamName.getLength() )
-- {
-- oleautomation::NamedArgument aNamedArgument;
-- aNamedArgument.Name = aParamName;
-- aNamedArgument.Value = aValAny;
-- pAnyArgs[i] <<= aNamedArgument;
-- }
-- else
-- {
-- pAnyArgs[i] = aValAny;
-- }
-- }
-- }
-- else
-- {
-- for( i = 0 ; i < nParamCount ; i++ )
-- {
-- // ACHTUNG: Bei den Sbx-Parametern den Offset nicht vergessen!
-- pAnyArgs[i] = sbxToUnoValueImpl( pParams->Get( (USHORT)(i+1) ),
-- bBlockConversionToSmallestType );
-- }
-- }
-+ processAutomationParams( pParams, args, bOLEAutomation, nParamCount );
- }
-
- // Methode callen
-@@ -2199,26 +2308,8 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
- }
- else if( bInvocation && mxInvocation.is() )
- {
-- Sequence< INT16 > OutParamIndex;
-- Sequence< Any > OutParam;
-- Any aRetAny = mxInvocation->invoke( pMeth->GetName(), args, OutParamIndex, OutParam );
--
-- // Wert von Uno nach Sbx uebernehmen
-+ Any aRetAny = invokeAutomationMethod( pMeth->GetName(), args, pParams, nParamCount, mxInvocation );
- unoToSbxValue( pVar, aRetAny );
--
-- const INT16* pIndices = OutParamIndex.getConstArray();
-- UINT32 nLen = OutParamIndex.getLength();
-- if( nLen )
-- {
-- const Any* pNewValues = OutParam.getConstArray();
-- for( UINT32 j = 0 ; j < nLen ; j++ )
-- {
-- INT16 iTarget = pIndices[ j ];
-- if( iTarget >= (INT16)nParamCount )
-- break;
-- unoToSbxValue( (SbxVariable*)pParams->Get( (USHORT)(j+1) ), pNewValues[ j ] );
-- }
-- }
- }
-
- // #55460, Parameter hier weghauen, da das in unoToSbxValue()
-@@ -3147,11 +3238,16 @@ getTypeDescriptorEnumeration( const ::rtl::OUString& sSearchRoot,
-
- typedef std::hash_map< ::rtl::OUString, Any, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > VBAConstantsHash;
-
--SbxVariable* getVBAConstant( const String& rName )
-+VBAConstantHelper&
-+VBAConstantHelper::instance()
-+{
-+ static VBAConstantHelper aHelper;
-+ return aHelper;
-+}
-+
-+void
-+VBAConstantHelper::init()
- {
-- SbxVariable* pConst = NULL;
-- static VBAConstantsHash aConstCache;
-- static bool isInited = false;
- if ( !isInited )
- {
- Sequence< TypeClass > types(1);
-@@ -3159,39 +3255,77 @@ SbxVariable* getVBAConstant( const String& rName )
- Reference< XTypeDescriptionEnumeration > xEnum = getTypeDescriptorEnumeration( defaultNameSpace, types, TypeDescriptionSearchDepth_INFINITE );
-
- if ( !xEnum.is() )
-- return NULL;
-+ return; //NULL;
-
- while ( xEnum->hasMoreElements() )
- {
- Reference< XConstantsTypeDescription > xConstants( xEnum->nextElement(), UNO_QUERY );
- if ( xConstants.is() )
- {
-+ // store constant group name
-+ ::rtl::OUString sFullName = xConstants->getName();
-+ sal_Int32 indexLastDot = sFullName.lastIndexOf('.');
-+ ::rtl::OUString sLeafName( sFullName );
-+ if ( indexLastDot > -1 )
-+ sLeafName = sFullName.copy( indexLastDot + 1);
-+ aConstCache.push_back( sLeafName ); // assume constant group names are unique
- Sequence< Reference< XConstantTypeDescription > > aConsts = xConstants->getConstants();
- Reference< XConstantTypeDescription >* pSrc = aConsts.getArray();
- sal_Int32 nLen = aConsts.getLength();
- for ( sal_Int32 index =0; index<nLen; ++pSrc, ++index )
- {
-+ // store constant member name
- Reference< XConstantTypeDescription >& rXConst =
- *pSrc;
-- ::rtl::OUString sFullName = rXConst->getName();
-- sal_Int32 indexLastDot = sFullName.lastIndexOf('.');
-- ::rtl::OUString sLeafName;
-+ sFullName = rXConst->getName();
-+ indexLastDot = sFullName.lastIndexOf('.');
-+ sLeafName = sFullName;
- if ( indexLastDot > -1 )
- sLeafName = sFullName.copy( indexLastDot + 1);
-- aConstCache[ sLeafName.toAsciiLowerCase() ] = rXConst->getConstantValue();
-+ aConstHash[ sLeafName.toAsciiLowerCase() ] = rXConst->getConstantValue();
- }
- }
- }
- isInited = true;
- }
-+}
-+
-+bool
-+VBAConstantHelper::isVBAConstantType( const String& rName )
-+{
-+ init();
-+ bool bConstant = false;
-+ ::rtl::OUString sKey( rName );
-+ VBAConstantsVector::const_iterator it = aConstCache.begin();
-+
-+ for( ; it != aConstCache.end(); it++ )
-+ {
-+ if( sKey.equalsIgnoreAsciiCase( *it ) )
-+ {
-+ bConstant = true;
-+ break;
-+ }
-+ }
-+ return bConstant;
-+}
-+
-+SbxVariable*
-+VBAConstantHelper::getVBAConstant( const String& rName )
-+{
-+ SbxVariable* pConst = NULL;
-+ init();
-+
- ::rtl::OUString sKey( rName );
-- VBAConstantsHash::const_iterator it = aConstCache.find( sKey.toAsciiLowerCase() );
-- if ( it != aConstCache.end() )
-+
-+ VBAConstantsHash::const_iterator it = aConstHash.find( sKey.toAsciiLowerCase() );
-+
-+ if ( it != aConstHash.end() )
- {
- pConst = new SbxVariable( SbxVARIANT );
- pConst->SetName( rName );
- unoToSbxValue( pConst, it->second );
- }
-+
- return pConst;
- }
-
-diff --git basic/source/classes/sbxmod.cxx basic/source/classes/sbxmod.cxx
-index 8c3ef89..df3838b 100644
---- basic/source/classes/sbxmod.cxx
-+++ basic/source/classes/sbxmod.cxx
-@@ -85,6 +85,361 @@ using namespace com::sun::star;
- #include <com/sun/star/awt/XControl.hpp>
- #include <cppuhelper/implbase1.hxx>
- #include <comphelper/anytostring.hxx>
-+#include <com/sun/star/document/XVbaMethodParameter.hpp> //liuchen 2009-7-21
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+
-+extern void unoToSbxValue( SbxVariable* pVar, const ::com::sun::star::uno::Any& aValue ); //liuchen 2009-7-21
-+extern ::com::sun::star::uno::Any sbxToUnoValue( SbxVariable* pVar ); //liuchen 2009-7-21
-+
-+#include <com/sun/star/frame/XDesktop.hpp>
-+#include <vcl/svapp.hxx>
-+#include <map>
-+#include <com/sun/star/reflection/XProxyFactory.hpp>
-+#include <cppuhelper/implbase1.hxx>
-+#include <basic/sbobjmod.hxx>
-+#include <com/sun/star/uno/XAggregation.hpp>
-+#include <map>
-+#include <com/sun/star/script/XInvocation.hpp>
-+
-+using namespace ::com::sun::star;
-+using namespace com::sun::star::lang;
-+using namespace com::sun::star::reflection;
-+using namespace com::sun::star::beans;
-+using namespace com::sun::star::script;
-+
-+typedef ::cppu::WeakImplHelper1< XInvocation > DocObjectWrapper_BASE;
-+typedef ::std::map< sal_Int16, Any, ::std::less< sal_Int16 > > OutParamMap;
-+::com::sun::star::uno::Any sbxToUnoValue( SbxVariable* pVar );
-+void unoToSbxValue( SbxVariable* pVar, const ::com::sun::star::uno::Any& aValue );
-+
-+class DocObjectWrapper : public DocObjectWrapper_BASE
-+{
-+ Reference< XAggregation > m_xAggProxy;
-+ Reference< XInvocation > m_xAggInv;
-+ Reference< XTypeProvider > m_xAggregateTypeProv;
-+ Sequence< Type > m_Types;
-+ SbModule* m_pMod;
-+ SbMethodRef getMethod( const rtl::OUString& aName ) throw (RuntimeException);
-+ SbPropertyRef getProperty( const rtl::OUString& aName ) throw (RuntimeException);
-+ String mName; // for debugging
-+
-+public:
-+ DocObjectWrapper( SbModule* pMod );
-+ ~DocObjectWrapper();
-+
-+ virtual void SAL_CALL acquire() throw();
-+ virtual void SAL_CALL release() throw();
-+
-+ virtual Sequence< sal_Int8 > SAL_CALL getImplementationId()
-+ throw ( com::sun::star::uno::RuntimeException )
-+ {
-+ return m_xAggregateTypeProv->getImplementationId();
-+
-+ }
-+
-+ virtual Reference< XIntrospectionAccess > SAL_CALL getIntrospection( ) throw (RuntimeException);
-+
-+ virtual Any SAL_CALL invoke( const ::rtl::OUString& aFunctionName, const Sequence< Any >& aParams, Sequence< ::sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam ) throw (IllegalArgumentException, CannotConvertException, InvocationTargetException, RuntimeException);
-+ virtual void SAL_CALL setValue( const ::rtl::OUString& aPropertyName, const Any& aValue ) throw (UnknownPropertyException, CannotConvertException, InvocationTargetException, RuntimeException);
-+ virtual Any SAL_CALL getValue( const ::rtl::OUString& aPropertyName ) throw (UnknownPropertyException, RuntimeException);
-+ virtual ::sal_Bool SAL_CALL hasMethod( const ::rtl::OUString& aName ) throw (RuntimeException);
-+ virtual ::sal_Bool SAL_CALL hasProperty( const ::rtl::OUString& aName ) throw (RuntimeException);
-+ virtual Any SAL_CALL queryInterface( const Type& aType ) throw ( RuntimeException );
-+
-+ virtual Sequence< Type > SAL_CALL getTypes() throw ( RuntimeException );
-+};
-+
-+DocObjectWrapper::DocObjectWrapper( SbModule* pVar ) : m_pMod( pVar ), mName( pVar->GetName() )
-+{
-+ SbObjModule* pMod = PTR_CAST(SbObjModule,pVar);
-+ if ( pMod )
-+ {
-+ sal_Int16 nType = pMod->GetModuleType();
-+ if ( pMod->GetModuleType() == ModuleType::DOCUMENT )
-+ {
-+ Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
-+ // Use proxy factory service to create aggregatable proxy.
-+ SbUnoObject* pUnoObj = PTR_CAST(SbUnoObject,pMod->GetObject() );
-+ Reference< XInterface > xIf;
-+ if ( pUnoObj )
-+ {
-+ Any aObj = pUnoObj->getUnoAny();
-+ aObj >>= xIf;
-+ if ( xIf.is() )
-+ {
-+ m_xAggregateTypeProv.set( xIf, UNO_QUERY );
-+ m_xAggInv.set( xIf, UNO_QUERY );
-+ }
-+ }
-+ if ( xIf.is() )
-+ {
-+ try
-+ {
-+ Reference< XMultiComponentFactory > xMFac( xFactory, UNO_QUERY_THROW );
-+ Reference< XPropertySet> xPSMPropertySet( xMFac, UNO_QUERY_THROW );
-+ Reference< XComponentContext > xCtx;
-+ xPSMPropertySet->getPropertyValue(
-+ String( RTL_CONSTASCII_USTRINGPARAM("DefaultContext") ) ) >>= xCtx;
-+ Reference< XProxyFactory > xProxyFac( xMFac->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.reflection.ProxyFactory" ) ), xCtx ), UNO_QUERY_THROW );
-+ m_xAggProxy = xProxyFac->createProxy( xIf );
-+ }
-+ catch( Exception& )
-+ {
-+ OSL_ENSURE( false, "DocObjectWrapper::DocObjectWrapper: Caught exception!" );
-+ }
-+ }
-+
-+ if ( m_xAggProxy.is() )
-+ {
-+ osl_incrementInterlockedCount( &m_refCount );
-+
-+ /* i35609 - Fix crash on Solaris. The setDelegator call needs
-+ to be in its own block to ensure that all temporary Reference
-+ instances that are acquired during the call are released
-+ before m_refCount is decremented again */
-+ {
-+ m_xAggProxy->setDelegator( static_cast< cppu::OWeakObject * >( this ) );
-+ }
-+
-+ osl_decrementInterlockedCount( &m_refCount );
-+ }
-+ }
-+ }
-+}
-+
-+void SAL_CALL
-+DocObjectWrapper::acquire() throw ()
-+{
-+ osl_incrementInterlockedCount( &m_refCount );
-+ OSL_TRACE("DocObjectWrapper::acquire(%s) 0x%x refcount is now %d", rtl::OUStringToOString( mName, RTL_TEXTENCODING_UTF8 ).getStr(), this, m_refCount );
-+}
-+void SAL_CALL
-+DocObjectWrapper::release() throw ()
-+{
-+ if ( osl_decrementInterlockedCount( &m_refCount ) == 0 )
-+ {
-+ OSL_TRACE("DocObjectWrapper::release(%s) 0x%x refcount is now %d", rtl::OUStringToOString( mName, RTL_TEXTENCODING_UTF8 ).getStr(), this, m_refCount );
-+ delete this;
-+ }
-+ else
-+ OSL_TRACE("DocObjectWrapper::release(%s) 0x%x refcount is now %d", rtl::OUStringToOString( mName, RTL_TEXTENCODING_UTF8 ).getStr(), this, m_refCount );
-+}
-+
-+DocObjectWrapper::~DocObjectWrapper()
-+{
-+}
-+
-+Sequence< Type > SAL_CALL DocObjectWrapper::getTypes()
-+ throw ( RuntimeException )
-+{
-+ if ( m_Types.getLength() == 0 )
-+ {
-+ Sequence< Type > sTypes;
-+ if ( m_xAggregateTypeProv.is() )
-+ sTypes = m_xAggregateTypeProv->getTypes();
-+ m_Types.realloc( sTypes.getLength() + 1 );
-+ Type* pPtr = m_Types.getArray();
-+ for ( int i=0; i<m_Types.getLength(); ++i, ++pPtr )
-+ {
-+ if ( i == 0 )
-+ *pPtr = XInvocation::static_type( NULL );
-+ else
-+ *pPtr = sTypes[ i - 1 ];
-+ }
-+ }
-+ return m_Types;
-+}
-+
-+Reference< XIntrospectionAccess > SAL_CALL
-+DocObjectWrapper::getIntrospection( ) throw (RuntimeException)
-+{
-+ return NULL;
-+}
-+
-+Any SAL_CALL
-+DocObjectWrapper::invoke( const ::rtl::OUString& aFunctionName, const Sequence< Any >& aParams, Sequence< ::sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam ) throw (IllegalArgumentException, CannotConvertException, InvocationTargetException, RuntimeException)
-+{
-+ if ( m_xAggInv.is() && m_xAggInv->hasMethod( aFunctionName ) )
-+ return m_xAggInv->invoke( aFunctionName, aParams, aOutParamIndex, aOutParam );
-+ SbMethodRef pMethod = getMethod( aFunctionName );
-+ if ( !pMethod )
-+ throw RuntimeException();
-+ // check number of parameters
-+ sal_Int32 nParamsCount = aParams.getLength();
-+ SbxInfo* pInfo = pMethod->GetInfo();
-+ if ( pInfo )
-+ {
-+ sal_Int32 nSbxOptional = 0;
-+ USHORT n = 1;
-+ for ( const SbxParamInfo* pParamInfo = pInfo->GetParam( n ); pParamInfo; pParamInfo = pInfo->GetParam( ++n ) )
-+ {
-+ if ( ( pParamInfo->nFlags & SBX_OPTIONAL ) != 0 )
-+ ++nSbxOptional;
-+ else
-+ nSbxOptional = 0;
-+ }
-+ sal_Int32 nSbxCount = n - 1;
-+ if ( nParamsCount < nSbxCount - nSbxOptional )
-+ {
-+ throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "wrong number of parameters!" ) ), Reference< XInterface >() );
-+ }
-+ }
-+ // set parameters
-+ SbxArrayRef xSbxParams;
-+ if ( nParamsCount > 0 )
-+ {
-+ xSbxParams = new SbxArray;
-+ const Any* pParams = aParams.getConstArray();
-+ for ( sal_Int32 i = 0; i < nParamsCount; ++i )
-+ {
-+ SbxVariableRef xSbxVar = new SbxVariable( SbxVARIANT );
-+ unoToSbxValue( static_cast< SbxVariable* >( xSbxVar ), pParams[i] );
-+ xSbxParams->Put( xSbxVar, static_cast< USHORT >( i ) + 1 );
-+
-+ // Enable passing by ref
-+ if ( xSbxVar->GetType() != SbxVARIANT )
-+ xSbxVar->SetFlag( SBX_FIXED );
-+ }
-+ }
-+ if ( xSbxParams.Is() )
-+ pMethod->SetParameters( xSbxParams );
-+
-+ // call method
-+ SbxVariableRef xReturn = new SbxVariable;
-+ ErrCode nErr = SbxERR_OK;
-+
-+ nErr = pMethod->Call( xReturn );
-+ Any aReturn;
-+ // get output parameters
-+ if ( xSbxParams.Is() )
-+ {
-+ SbxInfo* pInfo_ = pMethod->GetInfo();
-+ if ( pInfo_ )
-+ {
-+ OutParamMap aOutParamMap;
-+ for ( USHORT n = 1, nCount = xSbxParams->Count(); n < nCount; ++n )
-+ {
-+ const SbxParamInfo* pParamInfo = pInfo_->GetParam( n );
-+ if ( pParamInfo && ( pParamInfo->eType & SbxBYREF ) != 0 )
-+ {
-+ SbxVariable* pVar = xSbxParams->Get( n );
-+ if ( pVar )
-+ {
-+ SbxVariableRef xVar = pVar;
-+ aOutParamMap.insert( OutParamMap::value_type( n - 1, sbxToUnoValue( xVar ) ) );
-+ }
-+ }
-+ }
-+ sal_Int32 nOutParamCount = aOutParamMap.size();
-+ aOutParamIndex.realloc( nOutParamCount );
-+ aOutParam.realloc( nOutParamCount );
-+ sal_Int16* pOutParamIndex = aOutParamIndex.getArray();
-+ Any* pOutParam = aOutParam.getArray();
-+ for ( OutParamMap::iterator aIt = aOutParamMap.begin(); aIt != aOutParamMap.end(); ++aIt, ++pOutParamIndex, ++pOutParam )
-+ {
-+ *pOutParamIndex = aIt->first;
-+ *pOutParam = aIt->second;
-+ }
-+ }
-+ }
-+
-+ // get return value
-+ aReturn = sbxToUnoValue( xReturn );
-+
-+ pMethod->SetParameters( NULL );
-+
-+ return aReturn;
-+}
-+
-+void SAL_CALL
-+DocObjectWrapper::setValue( const ::rtl::OUString& aPropertyName, const Any& aValue ) throw (UnknownPropertyException, CannotConvertException, InvocationTargetException, RuntimeException)
-+{
-+ if ( m_xAggInv.is() && m_xAggInv->hasProperty( aPropertyName ) )
-+ return m_xAggInv->setValue( aPropertyName, aValue );
-+
-+ SbPropertyRef pProperty = getProperty( aPropertyName );
-+ if ( !pProperty.Is() )
-+ throw UnknownPropertyException();
-+ unoToSbxValue( (SbxVariable*) pProperty, aValue );
-+}
-+
-+Any SAL_CALL
-+DocObjectWrapper::getValue( const ::rtl::OUString& aPropertyName ) throw (UnknownPropertyException, RuntimeException)
-+{
-+ if ( m_xAggInv.is() && m_xAggInv->hasProperty( aPropertyName ) )
-+ return m_xAggInv->getValue( aPropertyName );
-+
-+ SbPropertyRef pProperty = getProperty( aPropertyName );
-+ if ( !pProperty.Is() )
-+ throw UnknownPropertyException();
-+
-+ SbxVariable* pProp = ( SbxVariable* ) pProperty;
-+ if ( pProp->GetType() == SbxEMPTY )
-+ pProperty->Broadcast( SBX_HINT_DATAWANTED );
-+
-+ Any aRet = sbxToUnoValue( pProp );
-+ return aRet;
-+}
-+
-+::sal_Bool SAL_CALL
-+DocObjectWrapper::hasMethod( const ::rtl::OUString& aName ) throw (RuntimeException)
-+{
-+ if ( m_xAggInv.is() && m_xAggInv->hasMethod( aName ) )
-+ return sal_True;
-+ return getMethod( aName ).Is();
-+}
-+
-+::sal_Bool SAL_CALL
-+DocObjectWrapper::hasProperty( const ::rtl::OUString& aName ) throw (RuntimeException)
-+{
-+ sal_Bool bRes = sal_False;
-+ if ( m_xAggInv.is() && m_xAggInv->hasProperty( aName ) )
-+ bRes = sal_True;
-+ else bRes = getProperty( aName ).Is();
-+ return bRes;
-+}
-+
-+Any SAL_CALL DocObjectWrapper::queryInterface( const Type& aType )
-+ throw ( RuntimeException )
-+{
-+ Any aRet = DocObjectWrapper_BASE::queryInterface( aType );
-+ if ( aRet.hasValue() )
-+ return aRet;
-+ else if ( m_xAggProxy.is() )
-+ aRet = m_xAggProxy->queryAggregation( aType );
-+ return aRet;
-+}
-+
-+SbMethodRef DocObjectWrapper::getMethod( const rtl::OUString& aName ) throw (RuntimeException)
-+{
-+ SbMethodRef pMethod = NULL;
-+ if ( m_pMod )
-+ {
-+ USHORT nSaveFlgs = m_pMod->GetFlags();
-+ // Limit search to this module
-+ m_pMod->ResetFlag( SBX_GBLSEARCH );
-+ pMethod = (SbMethod*) m_pMod->SbModule::Find( aName, SbxCLASS_METHOD );
-+ m_pMod->SetFlags( nSaveFlgs );
-+ }
-+
-+ return pMethod;
-+}
-+
-+SbPropertyRef DocObjectWrapper::getProperty( const rtl::OUString& aName ) throw (RuntimeException)
-+{
-+ SbPropertyRef pProperty = NULL;
-+ if ( m_pMod )
-+ {
-+ USHORT nSaveFlgs = m_pMod->GetFlags();
-+ // Limit search to this module.
-+ m_pMod->ResetFlag( SBX_GBLSEARCH );
-+ pProperty = (SbProperty*)m_pMod->SbModule::Find( aName, SbxCLASS_PROPERTY );
-+ m_pMod->SetFlag( nSaveFlgs );
-+ }
-+
-+ return pProperty;
-+}
-+
-
- TYPEINIT1(SbModule,SbxObject)
- TYPEINIT1(SbMethod,SbxMethod)
-@@ -151,7 +506,6 @@ IMPL_LINK( AsyncQuitHandler, OnAsyncQuit, void*, /*pNull*/ )
- return 0L;
- }
-
--#if 0
- bool UnlockControllerHack( StarBASIC* pBasic )
- {
- bool bRes = false;
-@@ -177,7 +531,7 @@ bool UnlockControllerHack( StarBASIC* pBasic )
- }
- return bRes;
- }
--#endif
-+
- /////////////////////////////////////////////////////////////////////////////
-
- // Ein BASIC-Modul hat EXTSEARCH gesetzt, damit die im Modul enthaltenen
-@@ -194,14 +548,25 @@ SbModule::SbModule( const String& rName, BOOL bVBACompat )
-
- SbModule::~SbModule()
- {
-+ OSL_TRACE("Module named %s is destructing", rtl::OUStringToOString( GetName(), RTL_TEXTENCODING_UTF8 ).getStr() );
- if( pImage )
- delete pImage;
- if( pBreaks )
- delete pBreaks;
- if( pClassData )
- delete pClassData;
-+ mxWrapper = NULL;
- }
-
-+uno::Reference< script::XInvocation >
-+SbModule::GetUnoModule()
-+{
-+ if ( !mxWrapper.is() )
-+ mxWrapper = new DocObjectWrapper( this );
-+
-+ OSL_TRACE("Module named %s returning wrapper mxWrapper (0x%x)", rtl::OUStringToOString( GetName(), RTL_TEXTENCODING_UTF8 ).getStr(), mxWrapper.get() );
-+ return mxWrapper;
-+}
- BOOL SbModule::IsCompiled() const
- {
- return BOOL( pImage != 0 );
-@@ -429,6 +794,64 @@ void SbModule::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
- SbxVariable* pVar = pHint->GetVar();
- SbProperty* pProp = PTR_CAST(SbProperty,pVar);
- SbMethod* pMeth = PTR_CAST(SbMethod,pVar);
-+ SbProcedureProperty* pProcProperty = PTR_CAST( SbProcedureProperty, pVar );
-+ if( pProcProperty )
-+ {
-+ if( pHint->GetId() == SBX_HINT_DATAWANTED )
-+ {
-+ String aProcName;
-+ aProcName.AppendAscii( "Property Get " );
-+ aProcName += pProcProperty->GetName();
-+
-+ SbxVariable* pPropMeth = Find( aProcName, SbxCLASS_METHOD );
-+ if( pPropMeth )
-+ {
-+ // Setup parameters
-+ pPropMeth->SetParameters( pVar->GetParameters() );
-+
-+ SbxValues aVals;
-+ aVals.eType = SbxVARIANT;
-+ pPropMeth->Get( aVals );
-+ pVar->Put( aVals );
-+ }
-+ }
-+ else if( pHint->GetId() == SBX_HINT_DATACHANGED )
-+ {
-+ SbxVariable* pPropMeth = NULL;
-+
-+ bool bSet = pProcProperty->isSet();
-+ if( bSet )
-+ {
-+ pProcProperty->setSet( false );
-+
-+ String aProcName;
-+ aProcName.AppendAscii( "Property Set " );
-+ aProcName += pProcProperty->GetName();
-+ pPropMeth = Find( aProcName, SbxCLASS_METHOD );
-+ }
-+ if( !pPropMeth ) // Let
-+ {
-+ String aProcName;
-+ aProcName.AppendAscii( "Property Let " );
-+ aProcName += pProcProperty->GetName();
-+ pPropMeth = Find( aProcName, SbxCLASS_METHOD );
-+ }
-+
-+ if( pPropMeth )
-+ {
-+ // Setup parameters
-+ SbxArrayRef xArray = new SbxArray;
-+ xArray->Put( pPropMeth, 0 ); // Method as parameter 0
-+ xArray->Put( pVar, 1 );
-+ pPropMeth->SetParameters( xArray );
-+
-+ SbxValues aVals;
-+ pPropMeth->Get( aVals );
-+ pPropMeth->SetParameters( NULL );
-+ }
-+ }
-+ }
-+
- if( pProp )
- {
- if( pProp->GetModule() != this )
-@@ -452,7 +875,19 @@ void SbModule::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
- }
- }
- else
-- SbxObject::SFX_NOTIFY( rBC, rBCType, rHint, rHintType );
-+ {
-+ // #i92642: Special handling for name property to avoid
-+ // side effects when using name as variable implicitely
-+ bool bForwardToSbxObject = true;
-+
-+ ULONG nId = pHint->GetId();
-+ if( (nId == SBX_HINT_DATAWANTED || nId == SBX_HINT_DATACHANGED) &&
-+ pVar->GetName().EqualsIgnoreCaseAscii( "name" ) )
-+ bForwardToSbxObject = false;
-+
-+ if( bForwardToSbxObject )
-+ SbxObject::SFX_NOTIFY( rBC, rBCType, rHint, rHintType );
-+ }
- }
- }
-
-@@ -471,6 +906,7 @@ void SbModule::SetSource32( const ::rtl::OUString& r )
- aOUSource = r;
- StartDefinitions();
- SbiTokenizer aTok( r );
-+ aTok.SetCompatible( IsVBACompat() );
- while( !aTok.IsEof() )
- {
- SbiToken eEndTok = NIL;
-@@ -658,12 +1094,14 @@ void SbModule::SetVBACompat( BOOL bCompat )
- // Ausfuehren eines BASIC-Unterprogramms
- USHORT SbModule::Run( SbMethod* pMeth )
- {
-+ OSL_TRACE("About to run %s, vba compatmode is %d", rtl::OUStringToOString( pMeth->GetName(), RTL_TEXTENCODING_UTF8 ).getStr(), mbVBACompat );
- static USHORT nMaxCallLevel = 0;
- static String aMSOMacroRuntimeLibName = String::CreateFromAscii( "Launcher" );
- static String aMSOMacroRuntimeAppSymbol = String::CreateFromAscii( "Application" );
-
- USHORT nRes = 0;
- BOOL bDelInst = BOOL( pINST == NULL );
-+ bool bQuit = false;
- StarBASICRef xBasic;
- if( bDelInst )
- {
-@@ -783,6 +1221,15 @@ USHORT SbModule::Run( SbMethod* pMeth )
-
- delete pRt;
- pMOD = pOldMod;
-+ if ( pINST->nCallLvl == 0 && IsVBACompat() )
-+ {
-+ // VBA always ensure screenupdating is enabled after completing
-+ StarBASIC* pBasic = PTR_CAST(StarBASIC,GetParent());
-+ if ( pBasic && pBasic->IsDocBasic() )
-+ {
-+ UnlockControllerHack( pBasic );
-+ }
-+ }
- if( bDelInst )
- {
- // #57841 Uno-Objekte, die in RTL-Funktionen gehalten werden,
-@@ -810,10 +1257,8 @@ USHORT SbModule::Run( SbMethod* pMeth )
-
- // VBA always ensure screenupdating is enabled after completing
- StarBASIC* pBasic = PTR_CAST(StarBASIC,GetParent());
--#if 0
- if ( pBasic && pBasic->IsDocBasic() && !pINST )
- UnlockControllerHack( pBasic );
--#endif
- if( bDelInst )
- {
- // #57841 Uno-Objekte, die in RTL-Funktionen gehalten werden,
-@@ -824,6 +1269,8 @@ USHORT SbModule::Run( SbMethod* pMeth )
- pINST = NULL;
- }
- if ( pBasic && pBasic->IsDocBasic() && pBasic->IsQuitApplication() && !pINST )
-+ bQuit = true;
-+ if ( bQuit )
- {
- Application::PostUserEvent( LINK( &AsyncQuitHandler::instance(), AsyncQuitHandler, OnAsyncQuit ), NULL );
- }
-@@ -867,6 +1314,33 @@ void SbModule::RunInit()
- }
-
- // Mit private/dim deklarierte Variablen loeschen
-+
-+void SbModule::AddVarName( const String& aName )
-+{
-+ // see if the name is added allready
-+ std::vector< String >::iterator it_end = mModuleVariableNames.end();
-+ for ( std::vector< String >::iterator it = mModuleVariableNames.begin(); it != it_end; ++it )
-+ {
-+ if ( aName == *it )
-+ return;
-+ }
-+ mModuleVariableNames.push_back( aName );
-+}
-+
-+void SbModule::RemoveVars()
-+{
-+ std::vector< String >::iterator it_end = mModuleVariableNames.end();
-+ for ( std::vector< String >::iterator it = mModuleVariableNames.begin(); it != it_end; ++it )
-+ {
-+ // We don't want a Find being called in a derived class ( e.g.
-+ // SbUserform because it could trigger say an initialise event
-+ // which would cause basic to be re-run in the middle of the init ( and remember RemoveVars is called from compile and we don't want code to run as part of the compile )
-+ SbxVariableRef p = SbModule::Find( *it, SbxCLASS_PROPERTY );
-+ if( p.Is() )
-+ Remove (p);
-+ }
-+}
-+
- void SbModule::ClearPrivateVars()
- {
- for( USHORT i = 0 ; i < pProps->Count() ; i++ )
-@@ -1247,6 +1721,48 @@ BOOL SbModule::ExceedsLegacyModuleSize()
- return false;
- }
-
-+class ErrorHdlResetter
-+{
-+ Link mErrHandler;
-+ bool mbError;
-+ public:
-+ ErrorHdlResetter() : mbError( false )
-+ {
-+ // save error handler
-+ mErrHandler = StarBASIC::GetGlobalErrorHdl();
-+ // set new error handler
-+ StarBASIC::SetGlobalErrorHdl( LINK( this, ErrorHdlResetter, BasicErrorHdl ) );
-+ }
-+ ~ErrorHdlResetter()
-+ {
-+ // restore error handler
-+ StarBASIC::SetGlobalErrorHdl(mErrHandler);
-+ }
-+ DECL_LINK( BasicErrorHdl, StarBASIC * );
-+ bool HasError() { return mbError; }
-+};
-+IMPL_LINK( ErrorHdlResetter, BasicErrorHdl, StarBASIC *, /*pBasic*/)
-+{
-+ mbError = true;
-+ return 0;
-+}
-+
-+bool SbModule::HasExeCode()
-+{
-+
-+ ErrorHdlResetter aGblErrHdl;
-+ // And empty Image always has the Global Chain set up
-+ static const unsigned char pEmptyImage[] = { 0x45, 0x0 , 0x0, 0x0, 0x0 };
-+ // lets be stricter for the moment than VBA
-+
-+ bool bRes = false;
-+ if ( !IsCompiled() )
-+ Compile();
-+ if ( pImage && !( pImage->GetCodeSize() == 5 && ( memcmp( pImage->GetCode(), pEmptyImage, pImage->GetCodeSize() ) == 0 ) )
-+ || aGblErrHdl.HasError() )
-+ bRes = true;
-+ return bRes;
-+}
-
- // Store only image, no source
- BOOL SbModule::StoreBinaryData( SvStream& rStrm )
-@@ -1296,7 +1812,6 @@ BOOL SbModule::LoadBinaryData( SvStream& rStrm )
- return bRet;
- }
-
--
- BOOL SbModule::LoadCompleted()
- {
- SbxArray* p = GetMethods();
-@@ -1364,6 +1879,7 @@ SbMethod::SbMethod( const String& r, SbxDataType t, SbModule* p )
- nLine1 =
- nLine2 = 0;
- refStatics = new SbxArray;
-+ mCaller = 0;
- // AB: 2.7.1996: HACK wegen 'Referenz kann nicht gesichert werden'
- SetFlag( SBX_NO_MODIFY );
- }
-@@ -1378,6 +1894,7 @@ SbMethod::SbMethod( const SbMethod& r )
- nLine1 = r.nLine1;
- nLine2 = r.nLine2;
- refStatics = r.refStatics;
-+ mCaller = r.mCaller;
- SetFlag( SBX_NO_MODIFY );
- }
-
-@@ -1446,8 +1963,13 @@ SbxInfo* SbMethod::GetInfo()
- // Schnittstelle zum Ausfuehren einer Methode aus den Applikationen
- // #34191# Mit speziellem RefCounting, damit das Basic nicht durch CloseDocument()
- // abgeschossen werden kann. Rueckgabewert wird als String geliefert.
--ErrCode SbMethod::Call( SbxValue* pRet )
-+ErrCode SbMethod::Call( SbxValue* pRet, SbxVariable* pCaller )
- {
-+ if ( pCaller )
-+ {
-+ OSL_TRACE("SbMethod::Call Have been passed a caller 0x%x", pCaller );
-+ mCaller = pCaller;
-+ }
- // RefCount vom Modul hochzaehlen
- SbModule* pMod_ = (SbModule*)GetParent();
- pMod_->AddRef();
-@@ -1475,7 +1997,7 @@ ErrCode SbMethod::Call( SbxValue* pRet )
- // Objekte freigeben
- pMod_->ReleaseRef();
- pBasic->ReleaseRef();
--
-+ mCaller = 0;
- return nErr;
- }
-
-@@ -1640,9 +2162,8 @@ public:
- }
-
- //liuchen 2009-7-21, support Excel VBA Form_QueryClose event
-- virtual void SAL_CALL windowClosing( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException)
-+ virtual void SAL_CALL windowClosing( const lang::EventObject& e ) throw (uno::RuntimeException)
- {
--#if IN_THE_FUTURE
- uno::Reference< awt::XDialog > xDialog( e.Source, uno::UNO_QUERY );
- if ( xDialog.is() )
- {
-@@ -1670,7 +2191,6 @@ public:
- }
-
- mpUserForm->triggerMethod( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Userform_QueryClose") ) );
--#endif
- }
- //liuchen 2009-7-21
-
-@@ -1730,14 +2250,13 @@ void SbUserFormModule::triggerMethod( const String& aMethodToRun )
- Sequence< Any > aArguments;
- triggerMethod( aMethodToRun, aArguments );
- }
--void SbUserFormModule::triggerMethod( const String& aMethodToRun, Sequence< Any >& /*aArguments*/)
-+void SbUserFormModule::triggerMethod( const String& aMethodToRun, Sequence< Any >& aArguments)
- {
- OSL_TRACE("*** trigger %s ***", rtl::OUStringToOString( aMethodToRun, RTL_TEXTENCODING_UTF8 ).getStr() );
- // Search method
- SbxVariable* pMeth = SbObjModule::Find( aMethodToRun, SbxCLASS_METHOD );
- if( pMeth )
- {
--#if IN_THE_FUTURE
- //liuchen 2009-7-21, support Excel VBA UserForm_QueryClose event with parameters
- if ( aArguments.getLength() > 0 ) // Setup parameters
- {
-@@ -1767,7 +2286,6 @@ void SbUserFormModule::triggerMethod( const String& aMethodToRun, Sequence< Any
- }
- else
- //liuchen 2009-7-21
--#endif
- {
- SbxValues aVals;
- pMeth->Get( aVals );
-@@ -1893,7 +2411,7 @@ void SbUserFormModule::InitObject()
- aArgs[ 0 ] = uno::Any();
- aArgs[ 1 ] <<= m_xDialog;
- aArgs[ 2 ] <<= m_xModel;
-- aArgs[ 3 ] <<= rtl::OUString( GetParent()->GetName() );
-+ aArgs[ 3 ] <<= sProjectName;
- pDocObject = new SbUnoObject( GetName(), uno::makeAny( xVBAFactory->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.UserForm")), aArgs ) ) );
- uno::Reference< lang::XComponent > xComponent( aArgs[ 1 ], uno::UNO_QUERY_THROW );
- // remove old listener if it exists
-diff --git basic/source/comp/codegen.cxx basic/source/comp/codegen.cxx
-index c7e8f11..be7c357 100644
---- basic/source/comp/codegen.cxx
-+++ basic/source/comp/codegen.cxx
-@@ -161,8 +161,6 @@ void SbiCodeGen::Save()
- rMod.mnType = com::sun::star::script::ModuleType::NORMAL;
- rMod.bIsProxyModule = false;
- }
-- if( pParser->bText )
-- p->SetFlag( SBIMG_COMPARETEXT );
- // GlobalCode-Flag
- if( pParser->HasGlobalCode() )
- p->SetFlag( SBIMG_INITCODE );
-@@ -242,6 +240,8 @@ void SbiCodeGen::Save()
- if( nPass == 1 )
- aPropName = aPropName.Copy( aIfaceName.Len() + 1 );
- SbProcedureProperty* pProcedureProperty = NULL;
-+ OSL_TRACE("*** getProcedureProperty for thing %s",
-+ rtl::OUStringToOString( aPropName,RTL_TEXTENCODING_UTF8 ).getStr() );
- pProcedureProperty = rMod.GetProcedureProperty( aPropName, ePropType );
- }
- if( nPass == 1 )
-diff --git basic/source/comp/dim.cxx basic/source/comp/dim.cxx
-index 36bbb8d..23a8692 100644
---- basic/source/comp/dim.cxx
-+++ basic/source/comp/dim.cxx
-@@ -29,6 +29,8 @@
- #include "precompiled_basic.hxx"
- #include <basic/sbx.hxx>
- #include "sbcomp.hxx"
-+#include "sbunoobj.hxx"
-+
-
- // Deklaration einer Variablen
- // Bei Fehlern wird bis zum Komma oder Newline geparst.
-@@ -141,7 +143,7 @@ void SbiParser::TypeDecl( SbiSymDef& rDef, BOOL bAsNewAlreadyParsed )
- }
- }
- }
-- else if( rEnumArray->Find( aCompleteName, SbxCLASS_OBJECT ) )
-+ else if( rEnumArray->Find( aCompleteName, SbxCLASS_OBJECT ) || ( IsVBASupportOn() && VBAConstantHelper::instance().isVBAConstantType( aCompleteName ) ) )
- {
- eType = SbxLONG;
- break;
-@@ -398,7 +400,10 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic )
- aExpr.Gen();
- SbiOpcode eOp_ = pDef->IsNew() ? _CREATE : _TCREATE;
- aGen.Gen( eOp_, pDef->GetId(), pDef->GetTypeId() );
-- aGen.Gen( _SET );
-+ if ( bVBASupportOn )
-+ aGen.Gen( _VBASET );
-+ else
-+ aGen.Gen( _SET );
- }
- }
- else
-@@ -944,6 +949,24 @@ void SbiParser::DefDeclare( BOOL bPrivate )
- }
- }
-
-+void SbiParser::Attribute()
-+{
-+ // TODO: Need to implement the method as an attributed object.
-+ while( Next() != EQ )
-+ {
-+ String aSym( GetSym() );
-+ if( Next() != DOT)
-+ break;
-+ }
-+
-+ if( eCurTok != EQ )
-+ Error( SbERR_SYNTAX );
-+ else
-+ SbiExpression aValue( this );
-+
-+ // Don't generate any code - just discard it.
-+}
-+
- // Aufruf einer SUB oder FUNCTION
-
- void SbiParser::Call()
-diff --git basic/source/comp/exprtree.cxx basic/source/comp/exprtree.cxx
-index eafe38d..6eb2a59 100644
---- basic/source/comp/exprtree.cxx
-+++ basic/source/comp/exprtree.cxx
-@@ -38,7 +38,8 @@
- |*
- ***************************************************************************/
-
--SbiExpression::SbiExpression( SbiParser* p, SbiExprType t, SbiExprMode eMode )
-+SbiExpression::SbiExpression( SbiParser* p, SbiExprType t,
-+ SbiExprMode eMode, const KeywordSymbolInfo* pKeywordSymbolInfo )
- {
- pParser = p;
- bError = bByVal = bBased = bBracket = FALSE;
-@@ -46,7 +47,7 @@ SbiExpression::SbiExpression( SbiParser* p, SbiExprType t, SbiExprMode eMode )
- eCurExpr = t;
- m_eMode = eMode;
- pNext = NULL;
-- pExpr = (t != SbSTDEXPR ) ? Term() : Boolean();
-+ pExpr = (t != SbSTDEXPR ) ? Term( pKeywordSymbolInfo ) : Boolean();
- if( t != SbSYMBOL )
- pExpr->Optimize();
- if( t == SbLVALUE && !pExpr->IsLvalue() )
-@@ -177,7 +178,7 @@ static SbiSymDef* AddSym
-
- // Zur Zeit sind sogar Keywords zugelassen (wg. gleichnamiger Dflt-Properties)
-
--SbiExprNode* SbiExpression::Term( void )
-+SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
- {
- if( pParser->Peek() == DOT )
- {
-@@ -204,11 +205,11 @@ SbiExprNode* SbiExpression::Term( void )
- return pNd;
- }
-
-- SbiToken eTok = pParser->Next();
-+ SbiToken eTok = (pKeywordSymbolInfo == NULL) ? pParser->Next() : pKeywordSymbolInfo->m_eTok;
- // Anfang des Parsings merken
- pParser->LockColumn();
-- String aSym( pParser->GetSym() );
-- SbxDataType eType = pParser->GetType();
-+ String aSym( (pKeywordSymbolInfo == NULL) ? pParser->GetSym() : pKeywordSymbolInfo->m_aKeywordSymbol );
-+ SbxDataType eType = (pKeywordSymbolInfo == NULL) ? pParser->GetType() : pKeywordSymbolInfo->m_eSbxDataType;
- SbiParameters* pPar = NULL;
- SbiExprListVector* pvMoreParLcl = NULL;
- // Folgen Parameter?
-@@ -375,8 +376,12 @@ SbiExprNode* SbiExpression::Term( void )
- // Typ SbxOBJECT sein
- if( pDef->GetType() != SbxOBJECT && pDef->GetType() != SbxVARIANT )
- {
-- pParser->Error( SbERR_BAD_DECLARATION, aSym );
-- bError = TRUE;
-+ // defer error until runtime if in vba mode
-+ if ( !pParser->IsVBASupportOn() )
-+ {
-+ pParser->Error( SbERR_BAD_DECLARATION, aSym );
-+ bError = TRUE;
-+ }
- }
- if( !bError )
- pNd->aVar.pNext = ObjTerm( *pDef );
-@@ -567,7 +572,11 @@ SbiExprNode* SbiExpression::Unary()
- eTok = NEG;
- case NOT:
- pParser->Next();
-- pNd = new SbiExprNode( pParser, Unary(), eTok, NULL );
-+ // process something like "Do While Not "foo"="" "
-+ if( pParser->IsVBASupportOn() )
-+ pNd = new SbiExprNode( pParser, Like(), eTok, NULL );
-+ else
-+ pNd = new SbiExprNode( pParser, Unary(), eTok, NULL );
- break;
- case PLUS:
- pParser->Next();
-@@ -713,7 +722,7 @@ SbiExprNode* SbiExpression::Like()
- pNd = new SbiExprNode( pParser, pNd, eTok, Comp() ), nCount++;
- }
- // Mehrere Operatoren hintereinander gehen nicht
-- if( nCount > 1 )
-+ if( nCount > 1 && !pParser->IsVBASupportOn() )
- {
- pParser->Error( SbERR_SYNTAX );
- bError = TRUE;
-diff --git basic/source/comp/io.cxx basic/source/comp/io.cxx
-index 7575381..90933f3 100644
---- basic/source/comp/io.cxx
-+++ basic/source/comp/io.cxx
-@@ -115,6 +115,30 @@ void SbiParser::Write()
- aGen.Gen( _CHAN0 );
- }
-
-+
-+// #i92642 Handle LINE keyword outside ::Next()
-+void SbiParser::Line()
-+{
-+ // #i92642: Special handling to allow name as symbol
-+ if( Peek() == INPUT )
-+ {
-+ Next();
-+ LineInput();
-+ }
-+ else
-+ {
-+ aGen.Statement();
-+
-+ KeywordSymbolInfo aInfo;
-+ aInfo.m_aKeywordSymbol = String( RTL_CONSTASCII_USTRINGPARAM( "line" ) );
-+ aInfo.m_eSbxDataType = GetType();
-+ aInfo.m_eTok = SYMBOL;
-+
-+ Symbol( &aInfo );
-+ }
-+}
-+
-+
- // LINE INPUT [prompt], var$
-
- void SbiParser::LineInput()
-@@ -288,6 +312,19 @@ void SbiParser::Open()
-
- void SbiParser::Name()
- {
-+ // #i92642: Special handling to allow name as symbol
-+ if( Peek() == EQ )
-+ {
-+ aGen.Statement();
-+
-+ KeywordSymbolInfo aInfo;
-+ aInfo.m_aKeywordSymbol = String( RTL_CONSTASCII_USTRINGPARAM( "name" ) );
-+ aInfo.m_eSbxDataType = GetType();
-+ aInfo.m_eTok = SYMBOL;
-+
-+ Symbol( &aInfo );
-+ return;
-+ }
- SbiExpression aExpr1( this );
- TestToken( AS );
- SbiExpression aExpr2( this );
-diff --git basic/source/comp/parser.cxx basic/source/comp/parser.cxx
-index eecc229..a366ac8 100644
---- basic/source/comp/parser.cxx
-+++ basic/source/comp/parser.cxx
-@@ -49,6 +49,7 @@ struct SbiStatement {
- #define N FALSE
-
- static SbiStatement StmntTable [] = {
-+{ ATTRIBUTE, &SbiParser::Attribute, Y, Y, }, // ATTRIBUTE
- { CALL, &SbiParser::Call, N, Y, }, // CALL
- { CLOSE, &SbiParser::Close, N, Y, }, // CLOSE
- { _CONST_, &SbiParser::Dim, Y, Y, }, // CONST
-@@ -83,6 +84,7 @@ static SbiStatement StmntTable [] = {
- { IMPLEMENTS, &SbiParser::Implements, Y, N, }, // IMPLEMENTS
- { INPUT, &SbiParser::Input, N, Y, }, // INPUT
- { LET, &SbiParser::Assign, N, Y, }, // LET
-+{ LINE, &SbiParser::Line, N, Y, }, // LINE, -> LINE INPUT (#i92642)
- { LINEINPUT,&SbiParser::LineInput, N, Y, }, // LINE INPUT
- { LOOP, &SbiParser::BadBlock, N, Y, }, // LOOP
- { LSET, &SbiParser::LSet, N, Y, }, // LSET
-@@ -381,6 +383,18 @@ BOOL SbiParser::Parse()
- Next(); return TRUE;
- }
-
-+ // In vba it's possible to do Error.foobar ( even if it results in
-+ // a runtime error
-+ if ( eCurTok == _ERROR_ && IsVBASupportOn() ) // we probably need to define a subset of keywords where this madness applies e.g. if ( IsVBASupportOn() && SymbolCanBeRedined( eCurTok ) )
-+ {
-+ SbiTokenizer tokens( *(SbiTokenizer*)this );
-+ tokens.Next();
-+ if ( tokens.Peek() == DOT )
-+ {
-+ eCurTok = SYMBOL;
-+ ePush = eCurTok;
-+ }
-+ }
- // Kommt ein Symbol, ist es entweder eine Variable( LET )
- // oder eine SUB-Prozedur( CALL ohne Klammern )
- // DOT fuer Zuweisungen im WITH-Block: .A=5
-@@ -477,10 +491,10 @@ SbiExprNode* SbiParser::GetWithVar()
-
- // Zuweisung oder Subroutine Call
-
--void SbiParser::Symbol()
-+void SbiParser::Symbol( const KeywordSymbolInfo* pKeywordSymbolInfo )
- {
- SbiExprMode eMode = bVBASupportOn ? EXPRMODE_STANDALONE : EXPRMODE_STANDARD;
-- SbiExpression aVar( this, SbSYMBOL, eMode );
-+ SbiExpression aVar( this, SbSYMBOL, eMode, pKeywordSymbolInfo );
-
- bool bEQ = ( Peek() == EQ );
- if( !bEQ && bVBASupportOn && aVar.IsBracket() )
-@@ -745,12 +759,16 @@ void SbiParser::Option()
- break;
- }
- case COMPARE:
-- switch( Next() )
-- {
-- case TEXT: bText = TRUE; return;
-- case BINARY: bText = FALSE; return;
-- default:;
-- } // Fall thru!
-+ {
-+ SbiToken eTok = Next();
-+ if( eTok == BINARY )
-+ bText = FALSE;
-+ else if( eTok == SYMBOL && GetSym().EqualsIgnoreCaseAscii("text") )
-+ bText = TRUE;
-+ else
-+ Error( SbERR_EXPECTED, "Text/Binary" );
-+ break;
-+ }
- case COMPATIBLE:
- EnableCompatibility();
- break;
-@@ -759,7 +777,7 @@ void SbiParser::Option()
- bClassModule = TRUE;
- aGen.GetModule().SetModuleType( com::sun::star::script::ModuleType::CLASS );
- break;
-- case VBASUPPORT:
-+ case VBASUPPORT: // Option VBASupport used to override the module mode ( in fact this must reset the mode
- if( Next() == NUMBER )
- {
- if ( nVal == 1 || nVal == 0 )
-diff --git basic/source/comp/sbcomp.cxx basic/source/comp/sbcomp.cxx
-index c91624d..5bec939 100644
---- basic/source/comp/sbcomp.cxx
-+++ basic/source/comp/sbcomp.cxx
-@@ -131,6 +131,7 @@ BOOL SbModule::Compile()
- if( bRet )
- {
- pBasic->ClearAllModuleVars();
-+ RemoveVars(); // remove 'this' Modules variables
- // clear all method statics
- for( USHORT i = 0; i < pMethods->Count(); i++ )
- {
-diff --git basic/source/comp/token.cxx basic/source/comp/token.cxx
-index a41944c..44b7b3e 100644
---- basic/source/comp/token.cxx
-+++ basic/source/comp/token.cxx
-@@ -58,6 +58,7 @@ static TokenTable aTokTable_Basic [] = { // Token-Tabelle:
- { ANY, "Any" },
- { APPEND, "Append" },
- { AS, "As" },
-+ { ATTRIBUTE,"Attribute" },
- { BASE, "Base" },
- { BINARY, "Binary" },
- { TBOOLEAN, "Boolean" },
-@@ -513,7 +514,8 @@ SbiToken SbiTokenizer::Next()
- tp = &pTokTable[ lb + delta ];
- StringCompare res = aSym.CompareIgnoreCaseToAscii( tp->s );
- // Gefunden?
-- if( res == COMPARE_EQUAL ) goto special;
-+ if( res == COMPARE_EQUAL )
-+ goto special;
- // Groesser? Dann untere Haelfte
- if( res == COMPARE_LESS )
- {
-@@ -534,24 +536,14 @@ SbiToken SbiTokenizer::Next()
- return eCurTok = SYMBOL;
- }
- special:
-- // LINE INPUT
-- if( tp->t == LINE )
-- {
-- short nC1 = nCol1;
-- String aOldSym = aSym;
-- eCurTok = Peek();
-- if( eCurTok == INPUT )
-- {
-- Next();
-- nCol1 = nC1;
-- return eCurTok = LINEINPUT;
-- }
-- else
-- {
-- aSym = aOldSym;
-- return eCurTok = LINE;
-- }
-- }
-+ // #i92642
-+ if( eCurTok != NIL && eCurTok != REM && eCurTok != EOLN && (tp->t == NAME || tp->t == LINE) )
-+ return eCurTok = SYMBOL;
-+ else if( tp->t == TEXT )
-+ return eCurTok = SYMBOL;
-+
-+ // #i92642: Special LINE token handling -> SbiParser::Line()
-+
- // END IF, CASE, SUB, DEF, FUNCTION, TYPE, CLASS, WITH
- if( tp->t == END )
- {
-diff --git basic/source/inc/dlgcont.hxx basic/source/inc/dlgcont.hxx
-index b5387ce..6162398 100644
---- basic/source/inc/dlgcont.hxx
-+++ basic/source/inc/dlgcont.hxx
-@@ -93,7 +93,9 @@ public:
- throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
- throw (::com::sun::star::uno::RuntimeException);
--
-+ // XLibraryQueryExecutable
-+ virtual sal_Bool SAL_CALL HasExecutableCode(const rtl::OUString&)
-+ throw (::com::sun::star::uno::RuntimeException);
- // Service
- static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static();
- static ::rtl::OUString getImplementationName_static();
-diff --git basic/source/inc/expr.hxx basic/source/inc/expr.hxx
-index 712ae8b..47a8848 100644
---- basic/source/inc/expr.hxx
-+++ basic/source/inc/expr.hxx
-@@ -52,6 +52,13 @@ struct SbVar { // Variablen-Element:
- SbiExprListVector* pvMorePar; // Array of arrays foo(pPar)(avMorePar[0])(avMorePar[1])...
- };
-
-+struct KeywordSymbolInfo
-+{
-+ String m_aKeywordSymbol;
-+ SbxDataType m_eSbxDataType;
-+ SbiToken m_eTok;
-+};
-+
- enum SbiExprType { // Expression-Typen:
- SbSTDEXPR, // normaler Ausdruck
- SbLVALUE, // beliebiger lValue
-@@ -166,7 +173,7 @@ protected:
- BOOL bByVal; // TRUE: ByVal-Parameter
- BOOL bBracket; // TRUE: Parameter list with brackets
- USHORT nParenLevel;
-- SbiExprNode* Term();
-+ SbiExprNode* Term( const KeywordSymbolInfo* pKeywordSymbolInfo = NULL );
- SbiExprNode* ObjTerm( SbiSymDef& );
- SbiExprNode* Operand();
- SbiExprNode* Unary();
-@@ -180,7 +187,8 @@ protected:
- SbiExprNode* Comp();
- SbiExprNode* Boolean();
- public:
-- SbiExpression( SbiParser*, SbiExprType = SbSTDEXPR, SbiExprMode eMode = EXPRMODE_STANDARD ); // Parsender Ctor
-+ SbiExpression( SbiParser*, SbiExprType = SbSTDEXPR,
-+ SbiExprMode eMode = EXPRMODE_STANDARD, const KeywordSymbolInfo* pKeywordSymbolInfo = NULL ); // Parsender Ctor
- SbiExpression( SbiParser*, const String& );
- SbiExpression( SbiParser*, double, SbxDataType = SbxDOUBLE );
- SbiExpression( SbiParser*, const SbiSymDef&, SbiExprList* = NULL );
-diff --git basic/source/inc/namecont.hxx basic/source/inc/namecont.hxx
-index 7bbe896..4cd5ce1 100644
---- basic/source/inc/namecont.hxx
-+++ basic/source/inc/namecont.hxx
-@@ -35,6 +35,7 @@
- #include <com/sun/star/script/XStorageBasedLibraryContainer.hpp>
- #include <com/sun/star/script/XLibraryContainerPassword.hpp>
- #include <com/sun/star/script/XLibraryContainerExport.hpp>
-+#include <com/sun/star/script/XLibraryQueryExecutable.hpp>
- #include <com/sun/star/container/XNameContainer.hpp>
- #include <com/sun/star/container/XContainer.hpp>
- #include <com/sun/star/ucb/XSimpleFileAccess.hpp>
-@@ -59,6 +60,7 @@
- #include <cppuhelper/implbase2.hxx>
- #include <cppuhelper/compbase6.hxx>
- #include <cppuhelper/compbase7.hxx>
-+#include <cppuhelper/compbase8.hxx>
- #include <cppuhelper/interfacecontainer.hxx>
- #include <com/sun/star/script/XVBACompat.hpp>
-
-@@ -67,12 +69,13 @@ class BasicManager;
- namespace basic
- {
-
--typedef ::cppu::WeakComponentImplHelper7<
-+typedef ::cppu::WeakComponentImplHelper8<
- ::com::sun::star::lang::XInitialization,
- ::com::sun::star::script::XStorageBasedLibraryContainer,
- ::com::sun::star::script::XLibraryContainerPassword,
- ::com::sun::star::script::XLibraryContainerExport,
- ::com::sun::star::container::XContainer,
-+ ::com::sun::star::script::XLibraryQueryExecutable,
- ::com::sun::star::script::XVBACompat,
- ::com::sun::star::lang::XServiceInfo > LibraryContainerHelper;
-
-diff --git basic/source/inc/parser.hxx basic/source/inc/parser.hxx
-index 04c0269..e35cc03 100644
---- basic/source/inc/parser.hxx
-+++ basic/source/inc/parser.hxx
-@@ -99,13 +99,14 @@ public:
- BOOL TestComma(); // Komma oder EOLN?
- void TestEoln(); // EOLN?
-
-- void Symbol(); // Let oder Call
-+ void Symbol( const KeywordSymbolInfo* pKeywordSymbolInfo = NULL ); // Let oder Call
- void ErrorStmnt(); // ERROR n
- void NotImp(); // nicht implementiert
- void BadBlock(); // LOOP/WEND/NEXT
- void BadSyntax(); // Falsches SbiToken
- void NoIf(); // ELSE/ELSE IF ohne IF
- void Assign(); // LET
-+ void Attribute(); // Attribute
- void Call(); // CALL
- void Close(); // CLOSE
- void Declare(); // DECLARE
-@@ -119,6 +120,7 @@ public:
- void If(); // IF
- void Implements(); // IMPLEMENTS
- void Input(); // INPUT, INPUT #
-+ void Line(); // LINE -> LINE INPUT [#] (#i92642)
- void LineInput(); // LINE INPUT, LINE INPUT #
- void LSet(); // LSET
- void Name(); // NAME .. AS ..
-diff --git basic/source/inc/runtime.hxx basic/source/inc/runtime.hxx
-index 64ecac2..5844f3a 100644
---- basic/source/inc/runtime.hxx
-+++ basic/source/inc/runtime.hxx
-@@ -203,7 +203,6 @@ class SbiInstance
- BOOL bCompatibility; // Flag: TRUE = VBA runtime compatibility mode
-
- ComponentVector_t ComponentVector;
--
- public:
- SbiRuntime* pRun; // Call-Stack
- SbiInstance* pNext; // Instanzen-Chain
-@@ -292,7 +291,9 @@ class SbiRuntime
- SbxArrayRef refExprStk; // expression stack
- SbxArrayRef refCaseStk; // CASE expression stack
- SbxArrayRef refRedimpArray; // Array saved to use for REDIM PRESERVE
-+ SbxVariableRef refRedim; // Array saved to use for REDIM
- SbxVariableRef xDummyVar; // Ersatz fuer nicht gefundene Variablen
-+ SbxVariable* mpExtCaller; // Caller ( external - e.g. button name, shape, range object etc. - only in vba mode )
- SbiArgvStack* pArgvStk; // ARGV-Stack
- SbiGosubStack* pGosubStk; // GOSUB stack
- SbiForStack* pForStk; // FOR/NEXT-Stack
-@@ -461,6 +462,7 @@ public:
- SbMethod* GetCaller();
- SbxArray* GetLocals();
- SbxArray* GetParams();
-+ SbxVariable* GetExternalCaller(){ return mpExtCaller; }
-
- SbxBase* FindElementExtern( const String& rName );
- static bool isVBAEnabled();
-diff --git basic/source/inc/sbunoobj.hxx basic/source/inc/sbunoobj.hxx
-index b8993c1..edbe260 100644
---- basic/source/inc/sbunoobj.hxx
-+++ basic/source/inc/sbunoobj.hxx
-@@ -43,6 +43,7 @@
- #include <com/sun/star/reflection/XServiceTypeDescription2.hpp>
- #include <com/sun/star/reflection/XSingletonTypeDescription.hpp>
- #include <rtl/ustring.hxx>
-+#include <hash_map>
-
- class SbUnoObject: public SbxObject
- {
-@@ -320,6 +321,26 @@ public:
- virtual void Clear();
- };
-
-+typedef std::hash_map< ::rtl::OUString, ::com::sun::star::uno::Any, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > VBAConstantsHash;
-+
-+typedef std::vector< rtl::OUString > VBAConstantsVector;
-+
-+class VBAConstantHelper
-+{
-+private:
-+
-+ VBAConstantsVector aConstCache;
-+ VBAConstantsHash aConstHash;
-+ bool isInited;
-+ VBAConstantHelper():isInited( false ) {}
-+ VBAConstantHelper(const VBAConstantHelper&);
-+ void init();
-+public:
-+ static VBAConstantHelper& instance();
-+ SbxVariable* getVBAConstant( const String& rName );
-+ bool isVBAConstantType( const String& rName );
-+};
-+
- #endif
-
-
-diff --git basic/source/inc/scriptcont.hxx basic/source/inc/scriptcont.hxx
-index b1abdcd..e8a8b17 100644
---- basic/source/inc/scriptcont.hxx
-+++ basic/source/inc/scriptcont.hxx
-@@ -119,7 +119,9 @@ public:
- throw (::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::container::NoSuchElementException,
- ::com::sun::star::uno::RuntimeException);
--
-+ // XLibraryQueryExecutable
-+ virtual sal_Bool SAL_CALL HasExecutableCode(const rtl::OUString&)
-+ throw (::com::sun::star::uno::RuntimeException);
- // Methods XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName( )
- throw (::com::sun::star::uno::RuntimeException);
-diff --git basic/source/inc/token.hxx basic/source/inc/token.hxx
-index 737075a..422379c 100644
---- basic/source/inc/token.hxx
-+++ basic/source/inc/token.hxx
-@@ -72,7 +72,7 @@ enum SbiToken {
- IF, _IN_, INPUT,
- LET, LINE, LINEINPUT, LOCAL, LOOP, LPRINT, LSET,
- NAME, NEW, NEXT,
-- ON, OPEN, OPTION, IMPLEMENTS,
-+ ON, OPEN, OPTION, ATTRIBUTE, IMPLEMENTS,
- PRINT, PRIVATE, PROPERTY, PUBLIC,
- REDIM, REM, RESUME, RETURN, RSET,
- SELECT, SET, SHARED, STATIC, STEP, STOP, SUB,
-diff --git basic/source/runtime/methods.cxx basic/source/runtime/methods.cxx
-index 41e7df4..cd38296 100644
---- basic/source/runtime/methods.cxx
-+++ basic/source/runtime/methods.cxx
-@@ -48,6 +48,7 @@
- #include <unotools/ucbstreamhelper.hxx>
- #include <tools/wldcrd.hxx>
- #include <i18npool/lang.h>
-+#include <rtl/string.hxx>
-
- #include "runtime.hxx"
- #include "sbunoobj.hxx"
-@@ -75,13 +76,16 @@
- #include <com/sun/star/io/XOutputStream.hpp>
- #include <com/sun/star/io/XStream.hpp>
- #include <com/sun/star/io/XSeekable.hpp>
--
-+#include <com/sun/star/script/XErrorQuery.hpp>
-+#include <ooo/vba/XHelperInterface.hpp>
-+#include <com/sun/star/bridge/oleautomation/XAutomationObject.hpp>
- using namespace comphelper;
- using namespace osl;
- using namespace com::sun::star::uno;
- using namespace com::sun::star::lang;
- using namespace com::sun::star::ucb;
- using namespace com::sun::star::io;
-+using namespace com::sun::star::script;
-
- #endif /* _USE_UNO */
-
-@@ -103,6 +107,8 @@ using namespace com::sun::star::io;
- #include <stdlib.h>
- #include <ctype.h>
-
-+SbxVariable* getDefaultProp( SbxVariable* pRef );
-+
- #if defined (WIN) || defined (WNT) || defined (OS2)
- #include <direct.h> // _getdcwd get current work directory, _chdrive
- #endif
-@@ -121,6 +127,10 @@ using namespace com::sun::star::io;
- #include <io.h>
- #endif
-
-+using namespace rtl;
-+
-+#include <basic/sbobjmod.hxx>
-+
- #include <basic/sbobjmod.hxx>
-
- static void FilterWhiteSpace( String& rStr )
-@@ -706,6 +716,36 @@ RTLFUNC(MkDir) // JSM
- {
- try
- {
-+ if ( SbiRuntime::isVBAEnabled() )
-+ {
-+ // If aPath is the folder name, not a path, then create the folder under current directory.
-+ INetURLObject aTryPathURL( aPath );
-+ ::rtl::OUString sPathURL = aTryPathURL.GetMainURL( INetURLObject::NO_DECODE );
-+ if ( !sPathURL.getLength() )
-+ {
-+ File::getFileURLFromSystemPath( aPath, sPathURL );
-+ }
-+ INetURLObject aPathURL( sPathURL );
-+ if ( !aPathURL.GetPath().getLength() )
-+ {
-+ ::rtl::OUString sCurDirURL;
-+ SbxArrayRef pPar = new SbxArray;
-+ SbxVariableRef pVar = new SbxVariable();
-+ pPar->Put( pVar, 0 );
-+ SbRtl_CurDir( pBasic, *pPar, FALSE );
-+ String aCurPath = pPar->Get(0)->GetString();
-+
-+ File::getFileURLFromSystemPath( aCurPath, sCurDirURL );
-+ INetURLObject aDirURL( sCurDirURL );
-+ aDirURL.Append( aPath );
-+ ::rtl::OUString aTmpPath = aDirURL.GetMainURL( INetURLObject::NO_DECODE );
-+ if ( aTmpPath.getLength() > 0 )
-+ {
-+ aPath = aTmpPath;
-+ }
-+ }
-+ }
-+
- xSFI->createFolder( getFullPath( aPath ) );
- }
- catch( Exception & )
-@@ -858,6 +898,15 @@ RTLFUNC(SendKeys) // JSM
- StarBASIC::Error(SbERR_NOT_IMPLEMENTED);
- }
-
-+// Stub, basic already yields by default
-+RTLFUNC(DoEvents)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ rPar.Get(0)->PutInteger( 0 );
-+}
-+
- RTLFUNC(Exp)
- {
- (void)pBasic;
-@@ -940,6 +989,26 @@ RTLFUNC(Hex)
- }
- }
-
-+RTLFUNC(FuncCaller)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+ if ( SbiRuntime::isVBAEnabled() && pINST && pINST->pRun )
-+ {
-+ if ( pINST->pRun->GetExternalCaller() )
-+ *rPar.Get(0) = *pINST->pRun->GetExternalCaller();
-+ else
-+ {
-+ SbxVariableRef pVar = new SbxVariable(SbxVARIANT);
-+ *rPar.Get(0) = *pVar;
-+ }
-+ }
-+ else
-+ {
-+ StarBASIC::Error( SbERR_NOT_IMPLEMENTED );
-+ }
-+
-+}
- // InStr( [start],string,string,[compare] )
-
- RTLFUNC(InStr)
-@@ -2411,7 +2480,18 @@ RTLFUNC(IsEmpty)
- if ( rPar.Count() < 2 )
- StarBASIC::Error( SbERR_BAD_ARGUMENT );
- else
-- rPar.Get( 0 )->PutBool( rPar.Get(1)->IsEmpty() );
-+ {
-+ SbxVariable* pVar = NULL;
-+ if( SbiRuntime::isVBAEnabled() )
-+ pVar = getDefaultProp( rPar.Get(1) );
-+ if ( pVar )
-+ {
-+ pVar->Broadcast( SBX_HINT_DATAWANTED );
-+ rPar.Get( 0 )->PutBool( pVar->IsEmpty() );
-+ }
-+ else
-+ rPar.Get( 0 )->PutBool( rPar.Get(1)->IsEmpty() );
-+ }
- }
-
- RTLFUNC(IsError)
-@@ -2422,7 +2502,22 @@ RTLFUNC(IsError)
- if ( rPar.Count() < 2 )
- StarBASIC::Error( SbERR_BAD_ARGUMENT );
- else
-- rPar.Get( 0 )->PutBool( rPar.Get(1)->IsErr() );
-+ {
-+ SbxVariable* pVar =rPar.Get( 1 );
-+ SbUnoObject* pObj = PTR_CAST(SbUnoObject,pVar );
-+ if ( !pObj )
-+ {
-+ if ( SbxBase* pBaseObj = pVar->GetObject() )
-+ pObj = PTR_CAST(SbUnoObject, pBaseObj );
-+ }
-+ Reference< XErrorQuery > xError;
-+ if ( pObj )
-+ xError.set( pObj->getUnoAny(), UNO_QUERY );
-+ if ( xError.is() )
-+ rPar.Get( 0 )->PutBool( xError->hasError() );
-+ else
-+ rPar.Get( 0 )->PutBool( rPar.Get(1)->IsErr() );
-+ }
- }
-
- RTLFUNC(IsNull)
-@@ -3542,6 +3637,13 @@ RTLFUNC(Shell)
- NAMESPACE_VOS(OArgumentList) aArgList( pArgumentList, nParamCount );
- bSucc = pApp->execute( eOptions, aArgList ) == NAMESPACE_VOS(OProcess)::E_None;
- }
-+ long nResult = 0;
-+ NAMESPACE_VOS(OProcess)::TProcessInfo aInfo;
-+ // We should return the identifier of the executing process when is running VBA, because method Shell(...) returns it in Excel.
-+ if ( bSucc && SbiRuntime::isVBAEnabled() && pApp->getInfo( NAMESPACE_VOS(OProcess)::TData_Identifier, &aInfo ) == NAMESPACE_VOS(OProcess)::E_None )
-+ {
-+ nResult = aInfo.Ident;
-+ }
-
- /*
- if( nParamCount == 0 )
-@@ -3556,7 +3658,7 @@ RTLFUNC(Shell)
- if( !bSucc )
- StarBASIC::Error( SbERR_FILE_NOT_FOUND );
- else
-- rPar.Get(0)->PutLong( 0 );
-+ rPar.Get(0)->PutLong( nResult );
- }
- }
-
-@@ -3627,6 +3729,65 @@ String getBasicTypeName( SbxDataType eType )
- return aRetStr;
- }
-
-+String getObjectTypeName( SbxVariable* pVar )
-+{
-+ rtl::OUString sRet( RTL_CONSTASCII_USTRINGPARAM("Object") );
-+ if ( pVar )
-+ {
-+ SbxBase* pObj = pVar->GetObject();
-+ if( !pObj )
-+ sRet = String( RTL_CONSTASCII_USTRINGPARAM("Nothing") );
-+ else
-+ {
-+ SbUnoObject* pUnoObj = PTR_CAST(SbUnoObject,pVar );
-+ if ( !pUnoObj )
-+ {
-+ if ( SbxBase* pBaseObj = pVar->GetObject() )
-+ pUnoObj = PTR_CAST(SbUnoObject, pBaseObj );
-+ }
-+ if ( pUnoObj )
-+ {
-+ Any aObj = pUnoObj->getUnoAny();
-+ // For upstreaming unless we start to build oovbaapi by default
-+ // we need to get detect the vba-ness of the object in some
-+ // other way
-+ // note: Automation objects do not support XServiceInfo
-+ Reference< XServiceInfo > xServInfo( aObj, UNO_QUERY );
-+ if ( xServInfo.is() )
-+ {
-+ // is this a VBA object ?
-+ Reference< ooo::vba::XHelperInterface > xVBA( aObj, UNO_QUERY );
-+ Sequence< rtl::OUString > sServices = xServInfo->getSupportedServiceNames();
-+ if ( sServices.getLength() )
-+ sRet = sServices[ 0 ];
-+ }
-+ else
-+ {
-+ Reference< com::sun::star::bridge::oleautomation::XAutomationObject > xAutoMation( aObj, UNO_QUERY );
-+ if ( xAutoMation.is() )
-+ {
-+ Reference< XInvocation > xInv( aObj, UNO_QUERY );
-+ if ( xInv.is() )
-+ {
-+ try
-+ {
-+ xInv->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("$GetTypeName") ) ) >>= sRet;
-+ }
-+ catch( Exception& )
-+ {
-+ }
-+ }
-+ }
-+ }
-+ sal_Int32 nDot = sRet.lastIndexOf( '.' );
-+ if ( nDot != -1 && nDot < sRet.getLength() )
-+ sRet = sRet.copy( nDot + 1 );
-+ }
-+ }
-+ }
-+ return sRet;
-+}
-+
- RTLFUNC(TypeName)
- {
- (void)pBasic;
-@@ -3638,7 +3799,12 @@ RTLFUNC(TypeName)
- {
- SbxDataType eType = rPar.Get(1)->GetType();
- BOOL bIsArray = ( ( eType & SbxARRAY ) != 0 );
-- String aRetStr = getBasicTypeName( eType );
-+
-+ String aRetStr;
-+ if ( SbiRuntime::isVBAEnabled() && eType == SbxOBJECT )
-+ aRetStr = getObjectTypeName( rPar.Get(1) );
-+ else
-+ aRetStr = getBasicTypeName( eType );
- if( bIsArray )
- aRetStr.AppendAscii( "()" );
- rPar.Get(0)->PutString( aRetStr );
-diff --git basic/source/runtime/methods1.cxx basic/source/runtime/methods1.cxx
-index 69c6713..21aba9a 100644
---- basic/source/runtime/methods1.cxx
-+++ basic/source/runtime/methods1.cxx
-@@ -78,11 +78,15 @@
- #include <com/sun/star/uno/Sequence.hxx>
- #include <com/sun/star/lang/XMultiServiceFactory.hpp>
- #include <com/sun/star/i18n/XCalendar.hpp>
-+#include <com/sun/star/sheet/XFunctionAccess.hpp>
-
- using namespace comphelper;
-+using namespace com::sun::star::sheet;
- using namespace com::sun::star::uno;
- using namespace com::sun::star::i18n;
-
-+void unoToSbxValue( SbxVariable* pVar, const Any& aValue );
-+Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, com::sun::star::beans::Property* pUnoProperty = NULL );
-
- static Reference< XCalendar > getLocaleCalendar( void )
- {
-@@ -2507,6 +2511,546 @@ RTLFUNC(Round)
- rPar.Get(0)->PutDouble( dRes );
- }
-
-+void CallFunctionAccessFunction( const Sequence< Any >& aArgs, const rtl::OUString& sFuncName, SbxVariable* pRet )
-+{
-+ static Reference< XFunctionAccess > xFunc;
-+ Any aRes;
-+ try
-+ {
-+ if ( !xFunc.is() )
-+ {
-+ Reference< XMultiServiceFactory > xFactory( getProcessServiceFactory() );
-+ if( xFactory.is() )
-+ {
-+ xFunc.set( xFactory->createInstance(::rtl::OUString::createFromAscii( "com.sun.star.sheet.FunctionAccess")), UNO_QUERY_THROW);
-+ }
-+ }
-+ Any aRet = xFunc->callFunction( sFuncName, aArgs );
-+
-+ unoToSbxValue( pRet, aRet );
-+
-+ }
-+ catch( Exception& )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ }
-+}
-+
-+RTLFUNC(SYD)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ ULONG nArgCount = rPar.Count()-1;
-+
-+ if ( nArgCount < 4 )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ return;
-+ }
-+
-+ // retrieve non-optional params
-+
-+ Sequence< Any > aParams( 4 );
-+ aParams[ 0 ] <<= makeAny( rPar.Get(1)->GetDouble() );
-+ aParams[ 1 ] <<= makeAny( rPar.Get(2)->GetDouble() );
-+ aParams[ 2 ] <<= makeAny( rPar.Get(3)->GetDouble() );
-+ aParams[ 3 ] <<= makeAny( rPar.Get(4)->GetDouble() );
-+
-+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SYD") ), rPar.Get( 0 ) );
-+}
-+
-+RTLFUNC(SLN)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ ULONG nArgCount = rPar.Count()-1;
-+
-+ if ( nArgCount < 3 )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ return;
-+ }
-+
-+ // retrieve non-optional params
-+
-+ Sequence< Any > aParams( 3 );
-+ aParams[ 0 ] <<= makeAny( rPar.Get(1)->GetDouble() );
-+ aParams[ 1 ] <<= makeAny( rPar.Get(2)->GetDouble() );
-+ aParams[ 2 ] <<= makeAny( rPar.Get(3)->GetDouble() );
-+
-+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SLN") ), rPar.Get( 0 ) );
-+}
-+
-+RTLFUNC(Pmt)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ ULONG nArgCount = rPar.Count()-1;
-+
-+ if ( nArgCount < 3 || nArgCount > 5 )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ return;
-+ }
-+ // retrieve non-optional params
-+
-+ double rate = rPar.Get(1)->GetDouble();
-+ double nper = rPar.Get(2)->GetDouble();
-+ double pmt = rPar.Get(3)->GetDouble();
-+
-+ // set default values for Optional args
-+ double fv = 0;
-+ double type = 0;
-+
-+ // fv
-+ if ( nArgCount >= 4 )
-+ {
-+ if( rPar.Get(4)->GetType() != SbxEMPTY )
-+ fv = rPar.Get(4)->GetDouble();
-+ }
-+ // type
-+ if ( nArgCount >= 5 )
-+ {
-+ if( rPar.Get(5)->GetType() != SbxEMPTY )
-+ type = rPar.Get(5)->GetDouble();
-+ }
-+
-+ Sequence< Any > aParams( 5 );
-+ aParams[ 0 ] <<= rate;
-+ aParams[ 1 ] <<= nper;
-+ aParams[ 2 ] <<= pmt;
-+ aParams[ 3 ] <<= fv;
-+ aParams[ 4 ] <<= type;
-+
-+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Pmt") ), rPar.Get( 0 ) );
-+}
-+
-+RTLFUNC(PPmt)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ ULONG nArgCount = rPar.Count()-1;
-+
-+ if ( nArgCount < 4 || nArgCount > 6 )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ return;
-+ }
-+ // retrieve non-optional params
-+
-+ double rate = rPar.Get(1)->GetDouble();
-+ double per = rPar.Get(2)->GetDouble();
-+ double nper = rPar.Get(3)->GetDouble();
-+ double pv = rPar.Get(4)->GetDouble();
-+
-+ // set default values for Optional args
-+ double fv = 0;
-+ double type = 0;
-+
-+ // fv
-+ if ( nArgCount >= 5 )
-+ {
-+ if( rPar.Get(5)->GetType() != SbxEMPTY )
-+ fv = rPar.Get(5)->GetDouble();
-+ }
-+ // type
-+ if ( nArgCount >= 6 )
-+ {
-+ if( rPar.Get(6)->GetType() != SbxEMPTY )
-+ type = rPar.Get(6)->GetDouble();
-+ }
-+
-+ Sequence< Any > aParams( 6 );
-+ aParams[ 0 ] <<= rate;
-+ aParams[ 1 ] <<= per;
-+ aParams[ 2 ] <<= nper;
-+ aParams[ 3 ] <<= pv;
-+ aParams[ 4 ] <<= fv;
-+ aParams[ 5 ] <<= type;
-+
-+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PPmt") ), rPar.Get( 0 ) );
-+}
-+
-+RTLFUNC(PV)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ ULONG nArgCount = rPar.Count()-1;
-+
-+ if ( nArgCount < 3 || nArgCount > 5 )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ return;
-+ }
-+ // retrieve non-optional params
-+
-+ double rate = rPar.Get(1)->GetDouble();
-+ double nper = rPar.Get(2)->GetDouble();
-+ double pmt = rPar.Get(3)->GetDouble();
-+
-+ // set default values for Optional args
-+ double fv = 0;
-+ double type = 0;
-+
-+ // fv
-+ if ( nArgCount >= 4 )
-+ {
-+ if( rPar.Get(4)->GetType() != SbxEMPTY )
-+ fv = rPar.Get(4)->GetDouble();
-+ }
-+ // type
-+ if ( nArgCount >= 5 )
-+ {
-+ if( rPar.Get(5)->GetType() != SbxEMPTY )
-+ type = rPar.Get(5)->GetDouble();
-+ }
-+
-+ Sequence< Any > aParams( 5 );
-+ aParams[ 0 ] <<= rate;
-+ aParams[ 1 ] <<= nper;
-+ aParams[ 2 ] <<= pmt;
-+ aParams[ 3 ] <<= fv;
-+ aParams[ 4 ] <<= type;
-+
-+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PV") ), rPar.Get( 0 ) );
-+}
-+
-+RTLFUNC(NPV)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ ULONG nArgCount = rPar.Count()-1;
-+
-+ if ( nArgCount < 1 || nArgCount > 2 )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ return;
-+ }
-+
-+ Sequence< Any > aParams( 2 );
-+ aParams[ 0 ] <<= makeAny( rPar.Get(1)->GetDouble() );
-+ Any aValues = sbxToUnoValue( rPar.Get(2),
-+ getCppuType( (Sequence<double>*)0 ) );
-+
-+ // convert for calc functions
-+ Sequence< Sequence< double > > sValues(1);
-+ aValues >>= sValues[ 0 ];
-+ aValues <<= sValues;
-+
-+ aParams[ 1 ] <<= aValues;
-+
-+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NPV") ), rPar.Get( 0 ) );
-+}
-+
-+RTLFUNC(NPer)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ ULONG nArgCount = rPar.Count()-1;
-+
-+ if ( nArgCount < 3 || nArgCount > 5 )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ return;
-+ }
-+ // retrieve non-optional params
-+
-+ double rate = rPar.Get(1)->GetDouble();
-+ double pmt = rPar.Get(2)->GetDouble();
-+ double pv = rPar.Get(3)->GetDouble();
-+
-+ // set default values for Optional args
-+ double fv = 0;
-+ double type = 0;
-+
-+ // fv
-+ if ( nArgCount >= 4 )
-+ {
-+ if( rPar.Get(4)->GetType() != SbxEMPTY )
-+ fv = rPar.Get(4)->GetDouble();
-+ }
-+ // type
-+ if ( nArgCount >= 5 )
-+ {
-+ if( rPar.Get(5)->GetType() != SbxEMPTY )
-+ type = rPar.Get(5)->GetDouble();
-+ }
-+
-+ Sequence< Any > aParams( 5 );
-+ aParams[ 0 ] <<= rate;
-+ aParams[ 1 ] <<= pmt;
-+ aParams[ 2 ] <<= pv;
-+ aParams[ 3 ] <<= fv;
-+ aParams[ 4 ] <<= type;
-+
-+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NPer") ), rPar.Get( 0 ) );
-+}
-+
-+RTLFUNC(MIRR)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ ULONG nArgCount = rPar.Count()-1;
-+
-+ if ( nArgCount < 3 )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ return;
-+ }
-+
-+ // retrieve non-optional params
-+
-+ Sequence< Any > aParams( 3 );
-+ Any aValues = sbxToUnoValue( rPar.Get(1),
-+ getCppuType( (Sequence<double>*)0 ) );
-+
-+ // convert for calc functions
-+ Sequence< Sequence< double > > sValues(1);
-+ aValues >>= sValues[ 0 ];
-+ aValues <<= sValues;
-+
-+ aParams[ 0 ] <<= aValues;
-+ aParams[ 1 ] <<= makeAny( rPar.Get(2)->GetDouble() );
-+ aParams[ 2 ] <<= makeAny( rPar.Get(3)->GetDouble() );
-+
-+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("MIRR") ), rPar.Get( 0 ) );
-+}
-+
-+RTLFUNC(IRR)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ ULONG nArgCount = rPar.Count()-1;
-+
-+ if ( nArgCount < 1 || nArgCount > 2 )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ return;
-+ }
-+ // retrieve non-optional params
-+ Any aValues = sbxToUnoValue( rPar.Get(1),
-+ getCppuType( (Sequence<double>*)0 ) );
-+
-+ // convert for calc functions
-+ Sequence< Sequence< double > > sValues(1);
-+ aValues >>= sValues[ 0 ];
-+ aValues <<= sValues;
-+
-+ // set default values for Optional args
-+ double guess = 0.1;
-+ // guess
-+ if ( nArgCount >= 2 )
-+ {
-+ if( rPar.Get(2)->GetType() != SbxEMPTY )
-+ guess = rPar.Get(2)->GetDouble();
-+ }
-+
-+ Sequence< Any > aParams( 2 );
-+ aParams[ 0 ] <<= aValues;
-+ aParams[ 1 ] <<= guess;
-+
-+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IRR") ), rPar.Get( 0 ) );
-+}
-+
-+RTLFUNC(IPmt)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ ULONG nArgCount = rPar.Count()-1;
-+
-+ if ( nArgCount < 4 || nArgCount > 6 )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ return;
-+ }
-+ // retrieve non-optional params
-+
-+ double rate = rPar.Get(1)->GetDouble();
-+ double per = rPar.Get(2)->GetInteger();
-+ double nper = rPar.Get(3)->GetDouble();
-+ double pv = rPar.Get(4)->GetDouble();
-+
-+ // set default values for Optional args
-+ double fv = 0;
-+ double type = 0;
-+
-+ // fv
-+ if ( nArgCount >= 5 )
-+ {
-+ if( rPar.Get(5)->GetType() != SbxEMPTY )
-+ fv = rPar.Get(5)->GetDouble();
-+ }
-+ // type
-+ if ( nArgCount >= 6 )
-+ {
-+ if( rPar.Get(6)->GetType() != SbxEMPTY )
-+ type = rPar.Get(6)->GetDouble();
-+ }
-+
-+ Sequence< Any > aParams( 6 );
-+ aParams[ 0 ] <<= rate;
-+ aParams[ 1 ] <<= per;
-+ aParams[ 2 ] <<= nper;
-+ aParams[ 3 ] <<= pv;
-+ aParams[ 4 ] <<= fv;
-+ aParams[ 5 ] <<= type;
-+
-+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IPmt") ), rPar.Get( 0 ) );
-+}
-+
-+RTLFUNC(FV)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ ULONG nArgCount = rPar.Count()-1;
-+
-+ if ( nArgCount < 3 || nArgCount > 5 )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ return;
-+ }
-+ // retrieve non-optional params
-+
-+ double rate = rPar.Get(1)->GetDouble();
-+ double nper = rPar.Get(2)->GetDouble();
-+ double pmt = rPar.Get(3)->GetDouble();
-+
-+ // set default values for Optional args
-+ double pv = 0;
-+ double type = 0;
-+
-+ // pv
-+ if ( nArgCount >= 4 )
-+ {
-+ if( rPar.Get(4)->GetType() != SbxEMPTY )
-+ pv = rPar.Get(4)->GetDouble();
-+ }
-+ // type
-+ if ( nArgCount >= 5 )
-+ {
-+ if( rPar.Get(5)->GetType() != SbxEMPTY )
-+ type = rPar.Get(5)->GetDouble();
-+ }
-+
-+ Sequence< Any > aParams( 5 );
-+ aParams[ 0 ] <<= rate;
-+ aParams[ 1 ] <<= nper;
-+ aParams[ 2 ] <<= pmt;
-+ aParams[ 3 ] <<= pv;
-+ aParams[ 4 ] <<= type;
-+
-+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FV") ), rPar.Get( 0 ) );
-+}
-+
-+RTLFUNC(DDB)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ ULONG nArgCount = rPar.Count()-1;
-+
-+ if ( nArgCount < 4 || nArgCount > 5 )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ return;
-+ }
-+ // retrieve non-optional params
-+
-+ double cost = rPar.Get(1)->GetDouble();
-+ double salvage = rPar.Get(2)->GetDouble();
-+ double life = rPar.Get(3)->GetDouble();
-+ double period = rPar.Get(4)->GetDouble();
-+
-+ // set default values for Optional args
-+ double factor = 2;
-+
-+ // factor
-+ if ( nArgCount >= 5 )
-+ {
-+ if( rPar.Get(5)->GetType() != SbxEMPTY )
-+ factor = rPar.Get(5)->GetDouble();
-+ }
-+
-+ Sequence< Any > aParams( 5 );
-+ aParams[ 0 ] <<= cost;
-+ aParams[ 1 ] <<= salvage;
-+ aParams[ 2 ] <<= life;
-+ aParams[ 3 ] <<= period;
-+ aParams[ 4 ] <<= factor;
-+
-+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DDB") ), rPar.Get( 0 ) );
-+}
-+
-+RTLFUNC(Rate)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ ULONG nArgCount = rPar.Count()-1;
-+
-+ if ( nArgCount < 3 || nArgCount > 6 )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ return;
-+ }
-+ // retrieve non-optional params
-+
-+ double nper = 0;
-+ double pmt = 0;
-+ double pv = 0;
-+
-+ nper = rPar.Get(1)->GetDouble();
-+ pmt = rPar.Get(2)->GetDouble();
-+ pv = rPar.Get(3)->GetDouble();
-+
-+ // set default values for Optional args
-+ double fv = 0;
-+ double type = 0;
-+ double guess = 0.1;
-+
-+ // fv
-+ if ( nArgCount >= 4 )
-+ {
-+ if( rPar.Get(4)->GetType() != SbxEMPTY )
-+ fv = rPar.Get(4)->GetDouble();
-+ }
-+
-+ // type
-+ if ( nArgCount >= 5 )
-+ {
-+ if( rPar.Get(5)->GetType() != SbxEMPTY )
-+ type = rPar.Get(5)->GetDouble();
-+ }
-+
-+ // guess
-+ if ( nArgCount >= 6 )
-+ {
-+ if( rPar.Get(6)->GetType() != SbxEMPTY )
-+ type = rPar.Get(6)->GetDouble();
-+ }
-+
-+ Sequence< Any > aParams( 6 );
-+ aParams[ 0 ] <<= nper;
-+ aParams[ 1 ] <<= pmt;
-+ aParams[ 2 ] <<= pv;
-+ aParams[ 3 ] <<= fv;
-+ aParams[ 4 ] <<= type;
-+ aParams[ 5 ] <<= guess;
-+
-+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Rate") ), rPar.Get( 0 ) );
-+}
-+
- RTLFUNC(StrReverse)
- {
- (void)pBasic;
-diff --git basic/source/runtime/rtlproto.hxx basic/source/runtime/rtlproto.hxx
-index 485abe4..d3cf77d 100644
---- basic/source/runtime/rtlproto.hxx
-+++ basic/source/runtime/rtlproto.hxx
-@@ -164,28 +164,41 @@ extern RTLFUNC(Kill); // JSM
- extern RTLFUNC(MkDir); // JSM
- extern RTLFUNC(RmDir); // JSM
- extern RTLFUNC(SendKeys); // JSM
-+extern RTLFUNC(DDB);
-+extern RTLFUNC(DoEvents);
- extern RTLFUNC(DimArray);
- extern RTLFUNC(Dir);
- extern RTLFUNC(Exp);
- extern RTLFUNC(FileLen);
- extern RTLFUNC(Fix);
-+extern RTLFUNC(FV);
- extern RTLFUNC(Hex);
- extern RTLFUNC(Input);
- extern RTLFUNC(InStr);
- extern RTLFUNC(InStrRev);
- extern RTLFUNC(Int);
-+extern RTLFUNC(IPmt);
-+extern RTLFUNC(IRR);
- extern RTLFUNC(Join);
- extern RTLFUNC(LCase);
- extern RTLFUNC(Left);
- extern RTLFUNC(Log);
- extern RTLFUNC(LTrim);
- extern RTLFUNC(Mid);
-+extern RTLFUNC(MIRR);
-+extern RTLFUNC(NPer);
-+extern RTLFUNC(NPV);
- extern RTLFUNC(Oct);
-+extern RTLFUNC(Pmt);
-+extern RTLFUNC(PPmt);
-+extern RTLFUNC(PV);
-+extern RTLFUNC(Rate);
- extern RTLFUNC(Replace);
- extern RTLFUNC(Right);
- extern RTLFUNC(RTrim);
- extern RTLFUNC(RTL);
- extern RTLFUNC(Sgn);
-+extern RTLFUNC(SLN);
- extern RTLFUNC(Space);
- extern RTLFUNC(Split);
- extern RTLFUNC(Sqr);
-@@ -193,6 +206,7 @@ extern RTLFUNC(Str);
- extern RTLFUNC(StrComp);
- extern RTLFUNC(String);
- extern RTLFUNC(StrReverse);
-+extern RTLFUNC(SYD);
- extern RTLFUNC(Tan);
- extern RTLFUNC(UCase);
- extern RTLFUNC(Val);
-@@ -295,6 +309,7 @@ extern RTLFUNC(Switch);
- extern RTLFUNC(Wait);
- //i#64882# add new WaitUntil
- extern RTLFUNC(WaitUntil);
-+extern RTLFUNC(FuncCaller);
-
- extern RTLFUNC(GetGUIVersion);
- extern RTLFUNC(Choose);
-diff --git basic/source/runtime/runtime.cxx basic/source/runtime/runtime.cxx
-index c7d2d4e..2cff5d9 100755
---- basic/source/runtime/runtime.cxx
-+++ basic/source/runtime/runtime.cxx
-@@ -45,6 +45,8 @@
- #include "sbunoobj.hxx"
- #include "errobject.hxx"
-
-+SbxVariable* getDefaultProp( SbxVariable* pRef );
-+
- using namespace ::com::sun::star;
-
- bool SbiRuntime::isVBAEnabled()
-@@ -542,7 +544,7 @@ SbxArray* SbiInstance::GetLocals( SbMethod* pMeth )
-
- SbiRuntime::SbiRuntime( SbModule* pm, SbMethod* pe, UINT32 nStart )
- : rBasic( *(StarBASIC*)pm->pParent ), pInst( pINST ),
-- pMod( pm ), pMeth( pe ), pImg( pMod->pImage ), m_nLastTime(0)
-+ pMod( pm ), pMeth( pe ), pImg( pMod->pImage ), mpExtCaller(0), m_nLastTime(0)
- {
- nFlags = pe ? pe->GetDebugFlags() : 0;
- pIosys = pInst->pIosys;
-@@ -599,6 +601,13 @@ SbiRuntime::~SbiRuntime()
- void SbiRuntime::SetVBAEnabled(bool bEnabled )
- {
- bVBAEnabled = bEnabled;
-+ if ( bVBAEnabled )
-+ {
-+ if ( pMeth )
-+ mpExtCaller = pMeth->mCaller;
-+ }
-+ else
-+ mpExtCaller = 0;
- }
-
- // Aufbau der Parameterliste. Alle ByRef-Parameter werden direkt
-@@ -1009,7 +1018,25 @@ SbxVariable* SbiRuntime::GetTOS( short n )
- void SbiRuntime::TOSMakeTemp()
- {
- SbxVariable* p = refExprStk->Get( nExprLvl - 1 );
-- if( p->GetRefCount() != 1 )
-+ if ( p->GetType() == SbxEMPTY )
-+ p->Broadcast( SBX_HINT_DATAWANTED );
-+
-+ SbxVariable* pDflt = NULL;
-+ if ( bVBAEnabled && ( p->GetType() == SbxOBJECT || p->GetType() == SbxVARIANT ) && ( pDflt = getDefaultProp( p ) ) )
-+ {
-+ pDflt->Broadcast( SBX_HINT_DATAWANTED );
-+ // replacing new p on stack causes object pointed by
-+ // pDft->pParent to be deleted, when p2->Compute() is
-+ // called below pParent is accessed ( but its deleted )
-+ // so set it to NULL now
-+ pDflt->SetParent( NULL );
-+ p = new SbxVariable( *pDflt );
-+ p->SetFlag( SBX_READWRITE );
-+ refExprStk->Put( p, nExprLvl - 1 );
-+// return;
-+ }
-+
-+ else if( p->GetRefCount() != 1 )
- {
- SbxVariable* pNew = new SbxVariable( *p );
- pNew->SetFlag( SBX_READWRITE );
-@@ -1018,7 +1045,6 @@ void SbiRuntime::TOSMakeTemp()
- }
-
- // Der GOSUB-Stack nimmt Returnadressen fuer GOSUBs auf
--
- void SbiRuntime::PushGosub( const BYTE* pc )
- {
- if( ++nGosubLvl > MAXRECURSION )
-diff --git basic/source/runtime/stdobj.cxx basic/source/runtime/stdobj.cxx
-index c9baf95..55f88fd 100644
---- basic/source/runtime/stdobj.cxx
-+++ basic/source/runtime/stdobj.cxx
-@@ -33,7 +33,7 @@
- #include <basic/sbstdobj.hxx>
- #include "rtlproto.hxx"
- #include "sbintern.hxx"
--
-+#include <hash_map>
- // Das nArgs-Feld eines Tabelleneintrags ist wie folgt verschluesselt:
- // Zur Zeit wird davon ausgegangen, dass Properties keine Parameter
- // benoetigen!
-@@ -69,6 +69,45 @@ struct Methods {
- USHORT nHash; // Hashcode
- };
-
-+struct StringHashCode
-+{
-+ size_t operator()( const String& rStr ) const
-+ {
-+ return rtl_ustr_hashCode_WithLength( rStr.GetBuffer(), rStr.Len() );
-+ }
-+};
-+
-+class VBABlacklist
-+{
-+friend class VBABlackListQuery;
-+ std::hash_map< String, bool, StringHashCode > mBlackList;
-+ VBABlacklist()
-+ {
-+ const char* list[] = { "Red" };
-+ sal_Int32 nSize = sizeof( list ) / sizeof( list[ 0 ] );
-+ for ( sal_Int32 index = 0; index < nSize; ++index )
-+ {
-+ mBlackList[ String::CreateFromAscii( list[ index ] ).ToLowerAscii() ] = true;
-+ }
-+ }
-+public:
-+ bool isBlackListed( const String& sName )
-+ {
-+ String sNameLower( sName );
-+ sNameLower.ToLowerAscii();
-+ return ( mBlackList.find( sNameLower ) != mBlackList.end() );
-+ }
-+};
-+
-+class VBABlackListQuery
-+{
-+public:
-+ static bool isBlackListed( const String& sName )
-+ {
-+ static VBABlacklist blackList;
-+ return blackList.isBlackListed( sName );
-+ }
-+};
- static Methods aMethods[] = {
-
- { "AboutStarBasic", SbxNULL, 1 | _FUNCTION, RTLNAME(AboutStarBasic),0 },
-@@ -171,7 +210,12 @@ static Methods aMethods[] = {
- { "expression", SbxVARIANT, 0,NULL,0 },
- { "CVErr", SbxVARIANT, 1 | _FUNCTION, RTLNAME(CVErr),0 },
- { "expression", SbxVARIANT, 0,NULL,0 },
--
-+{ "DDB", SbxDOUBLE, 5 | _FUNCTION | _COMPTMASK, RTLNAME(DDB),0 },
-+ { "Cost", SbxDOUBLE, 0, NULL,0 },
-+ { "Salvage", SbxDOUBLE, 0, NULL,0 },
-+ { "Life", SbxDOUBLE, 0, NULL,0 },
-+ { "Period", SbxDOUBLE, 0, NULL,0 },
-+ { "Factor", SbxVARIANT, _OPT, NULL,0 },
- { "Date", SbxDATE, _LFUNCTION,RTLNAME(Date),0 },
- { "DateAdd", SbxDATE, 3 | _FUNCTION, RTLNAME(DateAdd),0 },
- { "Interval", SbxSTRING, 0,NULL,0 },
-@@ -269,6 +313,12 @@ static Methods aMethods[] = {
- { "FreeLibrary", SbxNULL, 1 | _FUNCTION, RTLNAME(FreeLibrary),0 },
- { "Modulename", SbxSTRING, 0,NULL,0 },
-
-+{ "FV", SbxDOUBLE, 5 | _FUNCTION | _COMPTMASK, RTLNAME(FV),0 },
-+ { "Rate", SbxDOUBLE, 0, NULL,0 },
-+ { "NPer", SbxDOUBLE, 0, NULL,0 },
-+ { "Pmt", SbxDOUBLE, 0, NULL,0 },
-+ { "PV", SbxVARIANT, _OPT, NULL,0 },
-+ { "Due", SbxVARIANT, _OPT, NULL,0 },
- { "Get", SbxNULL, 3 | _FUNCTION, RTLNAME(Get),0 },
- { "filenumber", SbxINTEGER, 0,NULL,0 },
- { "recordnumber", SbxLONG, 0,NULL,0 },
-@@ -329,6 +379,16 @@ static Methods aMethods[] = {
- { "Compare", SbxINTEGER, _OPT, NULL,0 },
- { "Int", SbxDOUBLE, 1 | _FUNCTION, RTLNAME(Int),0 },
- { "number", SbxDOUBLE, 0,NULL,0 },
-+{ "IPmt", SbxDOUBLE, 6 | _FUNCTION | _COMPTMASK, RTLNAME(IPmt),0 },
-+ { "Rate", SbxDOUBLE, 0, NULL,0 },
-+ { "Per", SbxDOUBLE, 0, NULL,0 },
-+ { "NPer", SbxDOUBLE, 0, NULL,0 },
-+ { "PV", SbxDOUBLE, 0, NULL,0 },
-+ { "FV", SbxVARIANT, _OPT, NULL,0 },
-+ { "Due", SbxVARIANT, _OPT, NULL,0 },
-+{ "IRR", SbxDOUBLE, 2 | _FUNCTION | _COMPTMASK, RTLNAME(IRR),0 },
-+ { "ValueArray", SbxARRAY, 0, NULL,0 },
-+ { "Guess", SbxVARIANT, _OPT, NULL,0 },
- { "IsArray", SbxBOOL, 1 | _FUNCTION, RTLNAME(IsArray),0 },
- { "Variant", SbxVARIANT, 0,NULL,0 },
- { "IsDate", SbxBOOL, 1 | _FUNCTION, RTLNAME(IsDate),0 },
-@@ -397,6 +457,10 @@ static Methods aMethods[] = {
- { "Length", SbxLONG, _OPT, NULL,0 },
- { "Minute", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Minute),0 },
- { "Date", SbxDATE, 0,NULL,0 },
-+{ "MIRR", SbxDOUBLE, 2 | _FUNCTION | _COMPTMASK, RTLNAME(MIRR),0 },
-+ { "ValueArray", SbxARRAY, 0, NULL,0 },
-+ { "FinanceRate", SbxDOUBLE, 0, NULL,0 },
-+ { "ReinvestRate", SbxDOUBLE, 0, NULL,0 },
- { "MkDir", SbxNULL, 1 | _FUNCTION, RTLNAME(MkDir),0 },
- { "pathname", SbxSTRING, 0,NULL,0 },
- { "Month", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Month),0 },
-@@ -413,6 +477,15 @@ static Methods aMethods[] = {
-
- { "Nothing", SbxOBJECT, _CPROP, RTLNAME(Nothing),0 },
- { "Now", SbxDATE, _FUNCTION, RTLNAME(Now),0 },
-+{ "NPer", SbxDOUBLE, 5 | _FUNCTION | _COMPTMASK, RTLNAME(NPer),0 },
-+ { "Rate", SbxDOUBLE, 0, NULL,0 },
-+ { "Pmt", SbxDOUBLE, 0, NULL,0 },
-+ { "PV", SbxDOUBLE, 0, NULL,0 },
-+ { "FV", SbxVARIANT, _OPT, NULL,0 },
-+ { "Due", SbxVARIANT, _OPT, NULL,0 },
-+{ "NPV", SbxDOUBLE, 2 | _FUNCTION | _COMPTMASK, RTLNAME(NPV),0 },
-+ { "Rate", SbxDOUBLE, 0, NULL,0 },
-+ { "ValueArray", SbxARRAY, 0, NULL,0 },
- { "Null", SbxNULL, _CPROP, RTLNAME(Null),0 },
-
- { "Oct", SbxSTRING, 1 | _FUNCTION, RTLNAME(Oct),0 },
-@@ -424,16 +497,46 @@ static Methods aMethods[] = {
- { "stop", SbxLONG, 0,NULL,0 },
- { "interval", SbxLONG, 0,NULL,0 },
- { "Pi", SbxDOUBLE, _CPROP, RTLNAME(PI),0 },
-+
-+{ "Pmt", SbxDOUBLE, 5 | _FUNCTION | _COMPTMASK, RTLNAME(Pmt),0 },
-+ { "Rate", SbxDOUBLE, 0, NULL,0 },
-+ { "NPer", SbxDOUBLE, 0, NULL,0 },
-+ { "PV", SbxDOUBLE, 0, NULL,0 },
-+ { "FV", SbxVARIANT, _OPT, NULL,0 },
-+ { "Due", SbxVARIANT, _OPT, NULL,0 },
-+
-+{ "PPmt", SbxDOUBLE, 6 | _FUNCTION | _COMPTMASK, RTLNAME(PPmt),0 },
-+ { "Rate", SbxDOUBLE, 0, NULL,0 },
-+ { "Per", SbxDOUBLE, 0, NULL,0 },
-+ { "NPer", SbxDOUBLE, 0, NULL,0 },
-+ { "PV", SbxDOUBLE, 0, NULL,0 },
-+ { "FV", SbxVARIANT, _OPT, NULL,0 },
-+ { "Due", SbxVARIANT, _OPT, NULL,0 },
-+
- { "Put", SbxNULL, 3 | _FUNCTION, RTLNAME(Put),0 },
- { "filenumber", SbxINTEGER, 0,NULL,0 },
- { "recordnumber", SbxLONG, 0,NULL,0 },
- { "variablename", SbxVARIANT, 0,NULL,0 },
-
-+{ "PV", SbxDOUBLE, 5 | _FUNCTION | _COMPTMASK, RTLNAME(PV),0 },
-+ { "Rate", SbxDOUBLE, 0, NULL,0 },
-+ { "NPer", SbxDOUBLE, 0, NULL,0 },
-+ { "Pmt", SbxDOUBLE, 0, NULL,0 },
-+ { "FV", SbxVARIANT, _OPT, NULL,0 },
-+ { "Due", SbxVARIANT, _OPT, NULL,0 },
-+
- { "QBColor", SbxLONG, 1 | _FUNCTION, RTLNAME(QBColor),0 },
- { "number", SbxINTEGER, 0,NULL,0 },
-
- { "Randomize", SbxNULL, 1 | _FUNCTION, RTLNAME(Randomize),0 },
- { "Number", SbxDOUBLE, _OPT, NULL,0 },
-+{ "Rate", SbxDOUBLE, 6 | _FUNCTION | _COMPTMASK, RTLNAME(Rate),0 },
-+ { "NPer", SbxDOUBLE, 0, NULL,0 },
-+ { "Pmt", SbxDOUBLE, 0, NULL,0 },
-+ { "PV", SbxDOUBLE, 0, NULL,0 },
-+ { "FV", SbxVARIANT, _OPT, NULL,0 },
-+ { "Due", SbxVARIANT, _OPT, NULL,0 },
-+ { "Guess", SbxVARIANT, _OPT, NULL,0 },
- { "Red", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Red),0 },
- { "RGB-Value", SbxLONG, 0,NULL,0 },
- { "Reset", SbxNULL, 0 | _FUNCTION, RTLNAME(Reset),0 },
-@@ -474,6 +577,7 @@ static Methods aMethods[] = {
- { "SendKeys", SbxNULL, 2 | _FUNCTION, RTLNAME(SendKeys),0 },
- { "String", SbxSTRING, 0,NULL,0 },
- { "Wait", SbxBOOL, _OPT, NULL,0 },
-+{ "DoEvents", SbxINTEGER, 0 | _FUNCTION, RTLNAME(DoEvents),0 },
- { "SetAttr", SbxNULL, 2 | _FUNCTION, RTLNAME(SetAttr),0 },
- { "File" , SbxSTRING, 0,NULL,0 },
- { "Attributes", SbxINTEGER, 0,NULL,0 },
-@@ -487,6 +591,15 @@ static Methods aMethods[] = {
- { "WindowStyle", SbxINTEGER, _OPT, NULL,0 },
- { "Sin", SbxDOUBLE, 1 | _FUNCTION, RTLNAME(Sin),0 },
- { "number", SbxDOUBLE, 0,NULL,0 },
-+{ "SLN", SbxDOUBLE, 2 | _FUNCTION | _COMPTMASK, RTLNAME(SLN),0 },
-+ { "Cost", SbxDOUBLE, 0,NULL,0 },
-+ { "Double", SbxDOUBLE, 0,NULL,0 },
-+ { "Life", SbxDOUBLE, 0,NULL,0 },
-+{ "SYD", SbxDOUBLE, 2 | _FUNCTION | _COMPTMASK, RTLNAME(SYD),0 },
-+ { "Cost", SbxDOUBLE, 0,NULL,0 },
-+ { "Salvage", SbxDOUBLE, 0,NULL,0 },
-+ { "Life", SbxDOUBLE, 0,NULL,0 },
-+ { "Period", SbxDOUBLE, 0,NULL,0 },
- { "Space", SbxSTRING, 1 | _FUNCTION, RTLNAME(Space),0 },
- { "string", SbxLONG, 0,NULL,0 },
- { "Spc", SbxSTRING, 1 | _FUNCTION, RTLNAME(Spc),0 },
-@@ -601,6 +714,7 @@ static Methods aMethods[] = {
-
- { "Wait", SbxNULL, 1 | _FUNCTION, RTLNAME(Wait),0 },
- { "Milliseconds", SbxLONG, 0,NULL,0 },
-+{ "FuncCaller", SbxVARIANT, _FUNCTION, RTLNAME(FuncCaller),0 },
- //#i64882#
- { "WaitUntil", SbxNULL, 1 | _FUNCTION, RTLNAME(WaitUntil),0 },
- { "Date", SbxDOUBLE, 0,NULL,0 },
-@@ -628,6 +742,10 @@ SbiStdObject::SbiStdObject( const String& r, StarBASIC* pb ) : SbxObject( r )
- p += ( p->nArgs & _ARGSMASK ) + 1;
- }
-
-+ // #i92642: Remove default properties
-+ Remove( XubString( RTL_CONSTASCII_USTRINGPARAM("Name") ), SbxCLASS_DONTCARE );
-+ Remove( XubString( RTL_CONSTASCII_USTRINGPARAM("Parent") ), SbxCLASS_DONTCARE );
-+
- SetParent( pb );
-
- pStdFactory = new SbStdFactory;
-@@ -675,13 +793,15 @@ SbxVariable* SbiStdObject::Find( const String& rName, SbxClassType t )
- && ( p->nHash == nHash_ )
- && ( rName.EqualsIgnoreCaseAscii( p->pName ) ) )
- {
-+ SbiInstance* pInst = pINST;
- bFound = TRUE;
- if( p->nArgs & _COMPTMASK )
- {
-- SbiInstance* pInst = pINST;
- if( !pInst || !pInst->IsCompatibility() )
- bFound = FALSE;
- }
-+ if ( pInst && pInst->IsCompatibility() && VBABlackListQuery::isBlackListed( rName ) )
-+ bFound = FALSE;
- break;
- }
- nIndex += ( p->nArgs & _ARGSMASK ) + 1;
-diff --git basic/source/runtime/step0.cxx basic/source/runtime/step0.cxx
-index 96a3e80..92c9e11 100644
---- basic/source/runtime/step0.cxx
-+++ basic/source/runtime/step0.cxx
-@@ -45,6 +45,11 @@
-
- #include <algorithm>
-
-+// for a patch forward declaring these methods below makes sense
-+// but, #FIXME lets really just move the methods to the top
-+void lcl_clearImpl( SbxVariableRef& refVar, SbxDataType& eType );
-+void lcl_eraseImpl( SbxVariableRef& refVar, bool bVBAEnabled );
-+
- SbxVariable* getDefaultProp( SbxVariable* pRef );
-
- void SbiRuntime::StepNOP()
-@@ -56,34 +61,6 @@ void SbiRuntime::StepArith( SbxOperator eOp )
- TOSMakeTemp();
- SbxVariable* p2 = GetTOS();
-
--
-- // This could & should be moved to the MakeTempTOS() method in runtime.cxx
-- // In the code which this is cut'npaste from there is a check for a ref
-- // count != 1 based on which the copy of the SbxVariable is done.
-- // see orig code in MakeTempTOS ( and I'm not sure what the significance,
-- // of that is )
-- // here we alway seem to have a refcount of 1. Also it seems that
-- // MakeTempTOS is called for other operation, so I hold off for now
-- // until I have a better idea
-- if ( bVBAEnabled
-- && ( p2->GetType() == SbxOBJECT || p2->GetType() == SbxVARIANT )
-- )
-- {
-- SbxVariable* pDflt = getDefaultProp( p2 );
-- if ( pDflt )
-- {
-- pDflt->Broadcast( SBX_HINT_DATAWANTED );
-- // replacing new p2 on stack causes object pointed by
-- // pDft->pParent to be deleted, when p2->Compute() is
-- // called below pParent is accessed ( but its deleted )
-- // so set it to NULL now
-- pDflt->SetParent( NULL );
-- p2 = new SbxVariable( *pDflt );
-- p2->SetFlag( SBX_READWRITE );
-- refExprStk->Put( p2, nExprLvl - 1 );
-- }
-- }
--
- p2->ResetFlag( SBX_FIXED );
- p2->Compute( eOp, *p1 );
-
-@@ -106,19 +83,24 @@ void SbiRuntime::StepCompare( SbxOperator eOp )
- // values ( and type ) set as appropriate
- SbxDataType p1Type = p1->GetType();
- SbxDataType p2Type = p2->GetType();
-+ if ( p1Type == SbxEMPTY )
-+ {
-+ p1->Broadcast( SBX_HINT_DATAWANTED );
-+ p1Type = p1->GetType();
-+ }
-+ if ( p2Type == SbxEMPTY )
-+ {
-+ p2->Broadcast( SBX_HINT_DATAWANTED );
-+ p2Type = p2->GetType();
-+ }
- if ( p1Type == p2Type )
- {
-- if ( p1Type == SbxEMPTY )
-- {
-- p1->Broadcast( SBX_HINT_DATAWANTED );
-- p2->Broadcast( SBX_HINT_DATAWANTED );
-- }
- // if both sides are an object and have default props
- // then we need to use the default props
- // we don't need to worry if only one side ( lhs, rhs ) is an
- // object ( object side will get coerced to correct type in
- // Compare )
-- else if ( p1Type == SbxOBJECT )
-+ if ( p1Type == SbxOBJECT )
- {
- SbxVariable* pDflt = getDefaultProp( p1 );
- if ( pDflt )
-@@ -138,8 +120,21 @@ void SbiRuntime::StepCompare( SbxOperator eOp )
- #ifndef WIN
- static SbxVariable* pTRUE = NULL;
- static SbxVariable* pFALSE = NULL;
--
-- if( p2->Compare( eOp, *p1 ) )
-+ static SbxVariable* pNULL = NULL;
-+ // why do this on non-windows ?
-+ // why do this at all ?
-+ // I dumbly follow the pattern :-/
-+ if ( bVBAEnabled && ( p1->IsNull() || p2->IsNull() ) )
-+ {
-+ if( !pNULL )
-+ {
-+ pNULL = new SbxVariable;
-+ pNULL->PutNull();
-+ pNULL->AddRef();
-+ }
-+ PushVar( pNULL );
-+ }
-+ else if( p2->Compare( eOp, *p1 ) )
- {
- if( !pTRUE )
- {
-@@ -160,9 +155,14 @@ void SbiRuntime::StepCompare( SbxOperator eOp )
- PushVar( pFALSE );
- }
- #else
-- BOOL bRes = p2->Compare( eOp, *p1 );
- SbxVariable* pRes = new SbxVariable;
-- pRes->PutBool( bRes );
-+ if ( bVBAEnabled && ( p1->IsNull() || p2->IsNull() ) )
-+ pRes->PutNull();
-+ else
-+ {
-+ BOOL bRes = p2->Compare( eOp, *p1 );
-+ pRes->PutBool( bRes );
-+ }
- PushVar( pRes );
- #endif
- }
-@@ -639,6 +639,17 @@ void SbiRuntime::StepDIM()
- // #56204 DIM-Funktionalitaet in Hilfsmethode auslagern (step0.cxx)
- void SbiRuntime::DimImpl( SbxVariableRef refVar )
- {
-+ // If refDim then this DIM statement is terminating a ReDIM and
-+ // previous StepERASE_CLEAR for an array, the following actions have
-+ // been delayed from ( StepERASE_CLEAR ) 'till here
-+ if ( refRedim )
-+ {
-+ if ( !refRedimpArray ) // only erase the array not ReDim Preserve
-+ lcl_eraseImpl( refVar, bVBAEnabled );
-+ SbxDataType eType = refVar->GetType();
-+ lcl_clearImpl( refVar, eType );
-+ refRedim = NULL;
-+ }
- SbxArray* pDims = refVar->GetParameters();
- // Muss eine gerade Anzahl Argumente haben
- // Man denke daran, dass Arg[0] nicht zaehlt!
-@@ -804,6 +815,7 @@ void SbiRuntime::StepREDIMP()
- void SbiRuntime::StepREDIMP_ERASE()
- {
- SbxVariableRef refVar = PopVar();
-+ refRedim = refVar;
- SbxDataType eType = refVar->GetType();
- if( eType & SbxARRAY )
- {
-@@ -814,12 +826,6 @@ void SbiRuntime::StepREDIMP_ERASE()
- refRedimpArray = pDimArray;
- }
-
-- // As in ERASE
-- USHORT nSavFlags = refVar->GetFlags();
-- refVar->ResetFlag( SBX_FIXED );
-- refVar->SetType( SbxDataType(eType & 0x0FFF) );
-- refVar->SetFlags( nSavFlags );
-- refVar->Clear();
- }
- else
- if( refVar->IsFixed() )
-@@ -892,10 +898,7 @@ void SbiRuntime::StepERASE()
-
- void SbiRuntime::StepERASE_CLEAR()
- {
-- SbxVariableRef refVar = PopVar();
-- lcl_eraseImpl( refVar, bVBAEnabled );
-- SbxDataType eType = refVar->GetType();
-- lcl_clearImpl( refVar, eType );
-+ refRedim = PopVar();
- }
-
- void SbiRuntime::StepARRAYACCESS()
-diff --git basic/source/runtime/step1.cxx basic/source/runtime/step1.cxx
-index cfbea24..fc8e952 100644
---- basic/source/runtime/step1.cxx
-+++ basic/source/runtime/step1.cxx
-@@ -93,6 +93,15 @@ void SbiRuntime::StepARGN( UINT32 nOp1 )
- {
- String aAlias( pImg->GetString( static_cast<short>( nOp1 ) ) );
- SbxVariableRef pVal = PopVar();
-+ if( bVBAEnabled && ( pVal->ISA(SbxMethod) || pVal->ISA(SbUnoProperty) || pVal->ISA(SbProcedureProperty) ) )
-+ {
-+ // named variables ( that are Any especially properties ) can be empty at this point and need a broadcast
-+ if ( pVal->GetType() == SbxEMPTY )
-+ pVal->Broadcast( SBX_HINT_DATAWANTED );
-+ // Methoden und Properties evaluieren!
-+ SbxVariable* pRes = new SbxVariable( *pVal );
-+ pVal = pRes;
-+ }
- refArgv->Put( pVal, nArgc );
- refArgv->PutAlias( aAlias, nArgc++ );
- }
-@@ -182,7 +191,9 @@ void SbiRuntime::StepJUMPT( UINT32 nOp1 )
- void SbiRuntime::StepJUMPF( UINT32 nOp1 )
- {
- SbxVariableRef p = PopVar();
-- if( !p->GetBool() )
-+ // In a test e.g. If Null then
-+ // will evaluate Null will act as if False
-+ if( ( bVBAEnabled && p->IsNull() ) || !p->GetBool() )
- StepJUMP( nOp1 );
- }
-
-diff --git basic/source/runtime/step2.cxx basic/source/runtime/step2.cxx
-index fb79d2f..3693aff 100644
---- basic/source/runtime/step2.cxx
-+++ basic/source/runtime/step2.cxx
-@@ -141,7 +141,7 @@ SbxVariable* SbiRuntime::FindElement
- if ( pElem )
- bSetName = false; // don't overwrite uno name
- else
-- pElem = getVBAConstant( aName );
-+ pElem = VBAConstantHelper::instance().getVBAConstant( aName );
- }
- // #72382 VORSICHT! Liefert jetzt wegen unbekannten
- // Modulen IMMER ein Ergebnis!
-@@ -263,8 +263,10 @@ SbxVariable* SbiRuntime::FindElement
- pElem = pNew;
- }
- // Index-Access bei UnoObjekten beruecksichtigen
-- /*
-- else if( pElem->ISA(SbUnoProperty) )
-+ // definitely we want this for VBA where properties are often
-+ // collections ( which need index access ), but lets only do
-+ // this if we actually have params following
-+ else if( bVBAEnabled && pElem->ISA(SbUnoProperty) && pElem->GetParameters() )
- {
- // pElem auf eine Ref zuweisen, um ggf. eine Temp-Var zu loeschen
- SbxVariableRef refTemp = pElem;
-@@ -274,7 +276,6 @@ SbxVariable* SbiRuntime::FindElement
- pElem->SetParameters( NULL ); // sonst bleibt Ref auf sich selbst
- pElem = pNew;
- }
-- */
- }
- return CheckArray( pElem );
- }
-@@ -377,7 +378,8 @@ void SbiRuntime::SetupArgs( SbxVariable* p, UINT32 nOp1 )
- bool bError_ = true;
-
- SbUnoMethod* pUnoMethod = PTR_CAST(SbUnoMethod,p);
-- if( pUnoMethod )
-+ SbUnoProperty* pUnoProperty = PTR_CAST(SbUnoProperty,p);
-+ if( pUnoMethod || pUnoProperty )
- {
- SbUnoObject* pParentUnoObj = PTR_CAST( SbUnoObject,p->GetParent() );
- if( pParentUnoObj )
-@@ -455,7 +457,7 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
- {
- // Falls wir ein Array haben, wollen wir bitte das Array-Element!
- SbxArray* pPar;
-- if( pElem->GetType() & SbxARRAY )
-+ if( ( pElem->GetType() & SbxARRAY ) && (SbxVariable*)refRedim != pElem )
- {
- SbxBase* pElemObj = pElem->GetObject();
- SbxDimArray* pDimArray = PTR_CAST(SbxDimArray,pElemObj);
-@@ -487,7 +489,7 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
- pPar->Put( NULL, 0 );
- }
- // Index-Access bei UnoObjekten beruecksichtigen
-- else if( pElem->GetType() == SbxOBJECT && !pElem->ISA(SbxMethod) )
-+ else if( pElem->GetType() == SbxOBJECT && !pElem->ISA(SbxMethod) && !pElem->ISA(SbxProperty) )
- {
- pPar = pElem->GetParameters();
- if ( pPar )
-@@ -720,6 +722,8 @@ void SbiRuntime::StepPARAM( UINT32 nOp1, UINT32 nOp2 )
- SaveRef( q );
- *q = *p;
- p = q;
-+ if ( i )
-+ refParams->Put( p, i );
- }
- SetupArgs( p, nOp1 );
- PushVar( CheckArray( p ) );
-@@ -1132,16 +1136,26 @@ void SbiRuntime::StepGLOBAL( UINT32 nOp1, UINT32 nOp2 )
- if( pImg->GetFlag( SBIMG_CLASSMODULE ) )
- StepPUBLIC_Impl( nOp1, nOp2, true );
-
-+ SbxObject* pStorage = &rBasic;
- String aName( pImg->GetString( static_cast<short>( nOp1 ) ) );
-+ // Store module scope variables at module scope
-+ // in non vba mode these are stored at the library level :/
-+ // not sure if this really should not be enabled for ALL basic
-+ if ( SbiRuntime::isVBAEnabled() )
-+ {
-+ pStorage = pMod;
-+ pMod->AddVarName( aName );
-+ }
-+
- SbxDataType t = (SbxDataType) nOp2;
-- BOOL bFlag = rBasic.IsSet( SBX_NO_MODIFY );
-+ BOOL bFlag = pStorage->IsSet( SBX_NO_MODIFY );
- rBasic.SetFlag( SBX_NO_MODIFY );
-- SbxVariableRef p = rBasic.Find( aName, SbxCLASS_PROPERTY );
-+ SbxVariableRef p = pStorage->Find( aName, SbxCLASS_PROPERTY );
- if( p.Is() )
-- rBasic.Remove (p);
-- p = rBasic.Make( aName, SbxCLASS_PROPERTY, t );
-+ pStorage->Remove (p);
-+ p = pStorage->Make( aName, SbxCLASS_PROPERTY, t );
- if( !bFlag )
-- rBasic.ResetFlag( SBX_NO_MODIFY );
-+ pStorage->ResetFlag( SBX_NO_MODIFY );
- if( p )
- {
- p->SetFlag( SBX_DONTSTORE );
-diff --git basic/source/sbx/sbxvalue.cxx basic/source/sbx/sbxvalue.cxx
-index 34ca872..f535925 100644
---- basic/source/sbx/sbxvalue.cxx
-+++ basic/source/sbx/sbxvalue.cxx
-@@ -1144,8 +1144,8 @@ BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
- {
- SbxValues aL, aR;
- bool bDecimal = false;
-- if( bVBAInterop && ( ( eThisType == SbxSTRING && eOpType != SbxSTRING ) ||
-- ( eThisType != SbxSTRING && eOpType == SbxSTRING ) ) &&
-+ if( bVBAInterop && ( ( eThisType == SbxSTRING && eOpType != SbxSTRING && eOpType != SbxEMPTY ) ||
-+ ( eThisType != SbxSTRING && eThisType != SbxEMPTY && eOpType == SbxSTRING ) ) &&
- ( eOp == SbxMUL || eOp == SbxDIV || eOp == SbxPLUS || eOp == SbxMINUS ) )
- {
- goto Lbl_OpIsDouble;
-@@ -1192,6 +1192,8 @@ BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
- aL.eType = aR.eType = GetType();
- // else if( GetType() == SbxDouble || GetType() == SbxSingle )
- // aL.eType = aR.eType = SbxLONG64;
-+ else if ( bVBAInterop && eOpType == SbxBOOL )
-+ aL.eType = aR.eType = SbxBOOL;
- else
- aL.eType = aR.eType = SbxLONG;
- }
-@@ -1278,7 +1280,12 @@ BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
- break;
- case SbxNOT:
- if( aL.eType != SbxLONG && aL.eType != SbxULONG )
-- aL.nLong64 = ~aL.nLong64;
-+ {
-+ if ( aL.eType != SbxBOOL )
-+ aL.nLong64 = ~aL.nLong64;
-+ else
-+ aL.nLong = ~aL.nLong;
-+ }
- else
- aL.nLong = ~aL.nLong;
- break;
-diff --git basic/source/uno/dlgcont.cxx basic/source/uno/dlgcont.cxx
-index 4bbcb31..4985e35 100644
---- basic/source/uno/dlgcont.cxx
-+++ basic/source/uno/dlgcont.cxx
-@@ -318,8 +318,8 @@ Any SAL_CALL SfxDialogLibraryContainer::importLibraryElement
- source.sSystemId = aFile;
-
- try {
-- // start parsing
-- xParser->setDocumentHandler( ::xmlscript::importDialogModel( xDialogModel, xContext ) );
-+ // start parsing
-+ xParser->setDocumentHandler( ::xmlscript::importDialogModel( xDialogModel, xContext, mxOwnerDocument ) );
- xParser->parseStream( source );
- }
- catch( Exception& )
-@@ -333,7 +333,7 @@ Any SAL_CALL SfxDialogLibraryContainer::importLibraryElement
-
- // Create InputStream, TODO: Implement own InputStreamProvider
- // to avoid creating the DialogModel here!
-- Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext );
-+ Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, mxOwnerDocument );
- aRetAny <<= xISP;
- return aRetAny;
- }
-@@ -481,7 +481,11 @@ void SfxDialogLibraryContainer::onNewRootStorage()
- }
- }
-
--
-+sal_Bool SAL_CALL
-+SfxDialogLibraryContainer:: HasExecutableCode( const ::rtl::OUString& Library ) throw (uno::RuntimeException)
-+{
-+ return sal_False; // dialog library has no executable code
-+}
- //============================================================================
- // Service
-
-diff --git basic/source/uno/scriptcont.cxx basic/source/uno/scriptcont.cxx
-index c490571..025aeca 100644
---- basic/source/uno/scriptcont.cxx
-+++ basic/source/uno/scriptcont.cxx
-@@ -64,7 +64,8 @@
- #include <xmlscript/xmlmod_imexp.hxx>
- #include <cppuhelper/factory.hxx>
- #include <com/sun/star/util/VetoException.hpp>
--
-+#include <com/sun/star/script/XLibraryQueryExecutable.hpp>
-+#include <cppuhelper/implbase1.hxx>
- namespace basic
- {
-
-@@ -135,7 +136,6 @@ sal_Bool SfxScriptLibraryContainer::hasLibraryPassword( const String& rLibraryNa
- return pImplLib->mbPasswordProtected;
- }
-
--
- // Ctor for service
- SfxScriptLibraryContainer::SfxScriptLibraryContainer( void )
- :maScriptLanguage( RTL_CONSTASCII_USTRINGPARAM( "StarBasic" ) )
-@@ -1047,6 +1047,17 @@ void SfxScriptLibraryContainer::onNewRootStorage()
- {
- }
-
-+sal_Bool SAL_CALL
-+SfxScriptLibraryContainer:: HasExecutableCode( const ::rtl::OUString& Library ) throw (uno::RuntimeException)
-+{
-+ BasicManager* pBasicMgr = getBasicManager();
-+ OSL_ENSURE( pBasicMgr, "we need a basicmanager, really we do" );
-+ if ( pBasicMgr )
-+ return pBasicMgr->HasExeCode( Library ); // need to change this to take name
-+ // default to it has code if we can't decide
-+ return sal_True;
-+}
-+
- //============================================================================
- // Service
- void createRegistryInfo_SfxScriptLibraryContainer()
-diff --git cui/source/customize/cfg.cxx cui/source/customize/cfg.cxx
-index 211deef..b4a8c88 100644
---- cui/source/customize/cfg.cxx
-+++ cui/source/customize/cfg.cxx
-@@ -5718,7 +5718,7 @@ bool SvxIconSelectorDialog::ReplaceGraphicItem(
- if ( bOK && ((aSize.Width != m_nExpectedSize) || (aSize.Height != m_nExpectedSize)) )
- {
- BitmapEx aBitmap = aImage.GetBitmapEx();
-- BitmapEx aBitmapex = AutoScaleBitmap(aBitmap, m_nExpectedSize);
-+ BitmapEx aBitmapex = BitmapEx::AutoScaleBitmap(aBitmap, m_nExpectedSize);
- aImage = Image( aBitmapex);
- }
- aTbSymbol.InsertItem( nId,aImage, aURL, 0, 0 ); //modify
-@@ -5882,7 +5882,7 @@ bool SvxIconSelectorDialog::ImportGraphic( const OUString& aURL )
- if ( bOK && ((aSize.Width != m_nExpectedSize) || (aSize.Height != m_nExpectedSize)) )
- {
- BitmapEx aBitmap = aImage.GetBitmapEx();
-- BitmapEx aBitmapex = AutoScaleBitmap(aBitmap, m_nExpectedSize);
-+ BitmapEx aBitmapex = BitmapEx::AutoScaleBitmap(aBitmap, m_nExpectedSize);
- aImage = Image( aBitmapex);
- }
- if ( bOK && !!aImage )
-diff --git cui/source/options/optfltr.cxx cui/source/options/optfltr.cxx
-index 51034c9..229ee76 100644
---- cui/source/options/optfltr.cxx
-+++ cui/source/options/optfltr.cxx
-@@ -54,6 +54,7 @@ OfaMSFilterTabPage::OfaMSFilterTabPage(Window* pParent, const SfxItemSet& rSet)
- : SfxTabPage( pParent, CUI_RES( RID_OFAPAGE_MSFILTEROPT ), rSet ),
- aMSWordGB ( this, CUI_RES( GB_WORD ) ),
- aWBasicCodeCB ( this, CUI_RES( CB_WBAS_CODE ) ),
-+ aWBasicWbctblCB ( this, CUI_RES( CB_WBAS_WBCTBL ) ),
- aWBasicStgCB ( this, CUI_RES( CB_WBAS_STG ) ),
- aMSExcelGB ( this, CUI_RES( GB_EXCEL ) ),
- aEBasicCodeCB ( this, CUI_RES( CB_EBAS_CODE ) ),
-@@ -65,6 +66,7 @@ OfaMSFilterTabPage::OfaMSFilterTabPage(Window* pParent, const SfxItemSet& rSet)
- {
- FreeResource();
-
-+ aWBasicCodeCB.SetClickHdl( LINK( this, OfaMSFilterTabPage, LoadWordBasicCheckHdl_Impl ) );
- aEBasicCodeCB.SetClickHdl( LINK( this, OfaMSFilterTabPage, LoadExcelBasicCheckHdl_Impl ) );
- }
-
-@@ -72,6 +74,12 @@ OfaMSFilterTabPage::~OfaMSFilterTabPage()
- {
- }
-
-+IMPL_LINK( OfaMSFilterTabPage, LoadWordBasicCheckHdl_Impl, CheckBox*, EMPTYARG )
-+{
-+ aWBasicWbctblCB.Enable( aWBasicCodeCB.IsChecked() );
-+ return 0;
-+}
-+
- IMPL_LINK( OfaMSFilterTabPage, LoadExcelBasicCheckHdl_Impl, CheckBox*, EMPTYARG )
- {
- aEBasicExectblCB.Enable( aEBasicCodeCB.IsChecked() );
-@@ -91,6 +99,8 @@ BOOL OfaMSFilterTabPage::FillItemSet( SfxItemSet& )
- BOOL bFlag;
- if( aWBasicCodeCB.GetSavedValue() != (bFlag = aWBasicCodeCB.IsChecked()))
- pOpt->SetLoadWordBasicCode( bFlag );
-+ if( aWBasicWbctblCB.GetSavedValue() != (bFlag = aWBasicWbctblCB.IsChecked()))
-+ pOpt->SetLoadWordBasicExecutable( bFlag );
- if( aWBasicStgCB.GetSavedValue() != (bFlag = aWBasicStgCB.IsChecked()))
- pOpt->SetLoadWordBasicStorage( bFlag );
-
-@@ -119,8 +129,11 @@ void OfaMSFilterTabPage::Reset( const SfxItemSet& )
-
- aWBasicCodeCB.Check( pOpt->IsLoadWordBasicCode() );
- aWBasicCodeCB.SaveValue();
-+ aWBasicWbctblCB.Check( pOpt->IsLoadWordBasicExecutable() );
-+ aWBasicWbctblCB.SaveValue();
- aWBasicStgCB.Check( pOpt->IsLoadWordBasicStorage() );
- aWBasicStgCB.SaveValue();
-+ LoadWordBasicCheckHdl_Impl( &aWBasicCodeCB );
-
- aEBasicCodeCB.Check( pOpt->IsLoadExcelBasicCode() );
- aEBasicCodeCB.SaveValue();
-diff --git cui/source/options/optfltr.hrc cui/source/options/optfltr.hrc
-index 5938604..40204b7 100644
---- cui/source/options/optfltr.hrc
-+++ cui/source/options/optfltr.hrc
-@@ -40,6 +40,7 @@
- #define CB_EBAS_STG 5
- #define CB_PBAS_CODE 6
- #define CB_PBAS_STG 7
-+#define CB_WBAS_WBCTBL 8
-
- #define CLB_SETTINGS 1
- #define ST_CHG_MATH 1
-diff --git cui/source/options/optfltr.hxx cui/source/options/optfltr.hxx
-index 8014281..0fb4aee 100644
---- cui/source/options/optfltr.hxx
-+++ cui/source/options/optfltr.hxx
-@@ -43,6 +43,7 @@ class OfaMSFilterTabPage : public SfxTabPage
- {
- FixedLine aMSWordGB;
- CheckBox aWBasicCodeCB;
-+ CheckBox aWBasicWbctblCB;
- CheckBox aWBasicStgCB;
- FixedLine aMSExcelGB;
- CheckBox aEBasicCodeCB;
-@@ -55,6 +56,7 @@ class OfaMSFilterTabPage : public SfxTabPage
- OfaMSFilterTabPage( Window* pParent, const SfxItemSet& rSet );
- virtual ~OfaMSFilterTabPage();
-
-+ DECL_LINK( LoadWordBasicCheckHdl_Impl, CheckBox* );
- DECL_LINK( LoadExcelBasicCheckHdl_Impl, CheckBox* );
- public:
-
-diff --git cui/source/options/optfltr.src cui/source/options/optfltr.src
-index 56d7897..cf00150 100644
---- cui/source/options/optfltr.src
-+++ cui/source/options/optfltr.src
-@@ -51,9 +51,16 @@ TabPage RID_OFAPAGE_MSFILTEROPT
- TabStop = TRUE ;
- Text [ en-US ] = "Load Basic ~code";
- };
-+ CheckBox CB_WBAS_WBCTBL
-+ {
-+ Pos = MAP_APPFONT ( 22 , 28 ) ;
-+ Size = MAP_APPFONT ( 236 , 10 ) ;
-+ TabStop = TRUE ;
-+ Text [ en-US ] = "E~xecutable code";
-+ };
- CheckBox CB_WBAS_STG
- {
-- Pos = MAP_APPFONT ( 12 , 28 ) ;
-+ Pos = MAP_APPFONT ( 12 , 42 ) ;
- Size = MAP_APPFONT ( 236 , 10 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "Save ~original Basic code";
-@@ -61,27 +68,27 @@ TabPage RID_OFAPAGE_MSFILTEROPT
-
- FixedLine GB_EXCEL
- {
-- Pos = MAP_APPFONT ( 6 , 44 ) ;
-+ Pos = MAP_APPFONT ( 6 , 58 ) ;
- Size = MAP_APPFONT ( 248 , 8 ) ;
- Text [ en-US ] = "Microsoft Excel 97/2000/XP";
- };
- CheckBox CB_EBAS_CODE
- {
-- Pos = MAP_APPFONT ( 12 , 55 ) ;
-+ Pos = MAP_APPFONT ( 12 , 69 ) ;
- Size = MAP_APPFONT ( 236 , 10 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "Lo~ad Basic code";
- };
- CheckBox CB_EBAS_EXECTBL
- {
-- Pos = MAP_APPFONT ( 22 , 69 ) ;
-+ Pos = MAP_APPFONT ( 22 , 83 ) ;
- Size = MAP_APPFONT ( 236 , 10 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "E~xecutable code";
- };
- CheckBox CB_EBAS_STG
- {
-- Pos = MAP_APPFONT ( 12 , 83 ) ;
-+ Pos = MAP_APPFONT ( 12 , 97 ) ;
- Size = MAP_APPFONT ( 236 , 10 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "Sa~ve original Basic code";
-diff --git dbaccess/source/ext/macromigration/migrationengine.cxx dbaccess/source/ext/macromigration/migrationengine.cxx
-index 9e6781d..b54c3be 100644
---- dbaccess/source/ext/macromigration/migrationengine.cxx
-+++ dbaccess/source/ext/macromigration/migrationengine.cxx
-@@ -1835,7 +1835,7 @@ namespace dbmm
- Reference< XInputStream > xInput( xISP->createInputStream(), UNO_QUERY_THROW );
-
- Reference< XNameContainer > xDialogModel( m_aContext.createComponent( "com.sun.star.awt.UnoControlDialogModel" ), UNO_QUERY_THROW );
-- ::xmlscript::importDialogModel( xInput, xDialogModel, m_aContext.getUNOContext() );
-+ ::xmlscript::importDialogModel( xInput, xDialogModel, m_aContext.getUNOContext(), m_xDocumentModel );
-
- // adjust the events of the dialog
- impl_adjustDialogElementEvents_throw( xDialogModel );
-@@ -1850,7 +1850,7 @@ namespace dbmm
- }
-
- // export dialog model
-- xISP = ::xmlscript::exportDialogModel( xDialogModel, m_aContext.getUNOContext() );
-+ xISP = ::xmlscript::exportDialogModel( xDialogModel, m_aContext.getUNOContext(), m_xDocumentModel );
- _inout_rDialogLibraryElement <<= xISP;
- }
- catch( const Exception& )
-diff --git extensions/inc/propctrlr.hrc extensions/inc/propctrlr.hrc
-index a559b30..ab11bf4 100644
---- extensions/inc/propctrlr.hrc
-+++ extensions/inc/propctrlr.hrc
-@@ -326,9 +326,10 @@
- #define HID_FM_PROPDLG_TAB_GENERAL ( HID_PROPC_START + 294)
- #define HID_FM_PROPDLG_TAB_DATA ( HID_PROPC_START + 295)
- #define HID_FM_PROPDLG_TAB_EVT ( HID_PROPC_START + 296)
-+#define HID_PROP_GROUP_NAME ( HID_PROPC_START + 297)
- // please adjust HID_LAST_PROPC_ID if you add new ids here!
-
--#define HID_LAST_PROPC_ID HID_FM_PROPDLG_TAB_EVT
-+#define HID_LAST_PROPC_ID HID_PROP_GROUP_NAME
-
- #if HID_LAST_PROPC_ID > HID_PROPC_END
- #error help id overflow (PROPC)
-diff --git extensions/source/ole/oleobjw.cxx extensions/source/ole/oleobjw.cxx
-index 1aadd37..b0c0f8a 100644
---- extensions/source/ole/oleobjw.cxx
-+++ extensions/source/ole/oleobjw.cxx
-@@ -49,6 +49,7 @@
- #include <com/sun/star/script/XEngine.hpp>
- #include <com/sun/star/script/InterruptEngineEvent.hpp>
- #include <com/sun/star/script/XLibraryAccess.hpp>
-+#include <com/sun/star/script/BasicErrorException.hpp>
- #include <com/sun/star/bridge/ModelDependent.hpp>
-
- #include "com/sun/star/bridge/oleautomation/NamedArgument.hpp"
-@@ -69,6 +70,7 @@ using namespace boost;
- using namespace osl;
- using namespace rtl;
- using namespace cppu;
-+using namespace com::sun::star::script;
- using namespace com::sun::star::lang;
- using namespace com::sun::star::bridge;
- using namespace com::sun::star::bridge::oleautomation;
-@@ -108,7 +110,7 @@ IUnknownWrapper_Impl::IUnknownWrapper_Impl( Reference<XMultiServiceFactory>& xFa
- sal_uInt8 unoWrapperClass, sal_uInt8 comWrapperClass):
- UnoConversionUtilities<IUnknownWrapper_Impl>( xFactory, unoWrapperClass, comWrapperClass),
- m_pxIdlClass( NULL), m_eJScript( JScriptUndefined),
-- m_bComTlbIndexInit(false)
-+ m_bComTlbIndexInit(false), m_bHasDfltMethod(false), m_bHasDfltProperty(false)
- {
- }
-
-@@ -147,17 +149,15 @@ IUnknownWrapper_Impl::~IUnknownWrapper_Impl()
- Any IUnknownWrapper_Impl::queryInterface(const Type& t)
- throw (RuntimeException)
- {
-- if (t == getCppuType(static_cast<Reference<XInvocation>*>( 0)))
-- {
-- if (m_spDispatch)
-- return WeakImplHelper4<XInvocation, XBridgeSupplier2,
-- XInitialization, XAutomationObject>::queryInterface(t);
-- else
-- return Any();
-- }
--
-- return WeakImplHelper4<XInvocation, XBridgeSupplier2,
-- XInitialization, XAutomationObject>::queryInterface(t);
-+ if (t == getCppuType(static_cast<Reference<XDefaultMethod>*>( 0)) && !m_bHasDfltMethod )
-+ return Any();
-+ if (t == getCppuType(static_cast<Reference<XDefaultProperty>*>( 0)) && !m_bHasDfltProperty )
-+ return Any();
-+ if ( ( t == getCppuType(static_cast<Reference<XInvocation>*>( 0)) || t == getCppuType(static_cast<Reference<XAutomationInvocation>*>( 0)) ) && !m_spDispatch)
-+ return Any();
-+
-+ return WeakImplHelper6<XAutomationInvocation, XBridgeSupplier2,
-+ XInitialization, XAutomationObject, XDefaultProperty, XDefaultMethod>::queryInterface(t);
- }
-
- Reference<XIntrospectionAccess> SAL_CALL IUnknownWrapper_Impl::getIntrospection(void)
-@@ -168,6 +168,61 @@ Reference<XIntrospectionAccess> SAL_CALL IUnknownWrapper_Impl::getIntrospection(
- return ret;
- }
-
-+Any SAL_CALL IUnknownWrapper_Impl::invokeGetProperty( const OUString& aPropertyName, const Sequence< Any >& aParams, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam )
-+{
-+ Any aResult;
-+ try
-+ {
-+ o2u_attachCurrentThread();
-+ ITypeInfo * pInfo = getTypeInfo();
-+ FuncDesc aDescGet(pInfo);
-+ FuncDesc aDescPut(pInfo);
-+ VarDesc aVarDesc(pInfo);
-+ getPropDesc(aPropertyName, & aDescGet, & aDescPut, & aVarDesc);
-+ if ( !aDescGet )
-+ {
-+ OUString msg(OUSTR("[automation bridge]Property \"") + aPropertyName +
-+ OUSTR("\" is not supported"));
-+ throw UnknownPropertyException(msg, Reference<XInterface>());
-+ }
-+ aResult = invokeWithDispIdComTlb( aDescGet, aPropertyName, aParams, aOutParamIndex, aOutParam );
-+ }
-+ catch ( Exception& e )
-+ {
-+ throw RuntimeException(OUSTR("[automation bridge] unexpected exception in "
-+ "IUnknownWrapper_Impl::invokeGetProperty ! Message : \n") +
-+ e.Message, Reference<XInterface>());
-+ }
-+ return aResult;
-+}
-+
-+Any SAL_CALL IUnknownWrapper_Impl::invokePutProperty( const OUString& aPropertyName, const Sequence< Any >& aParams, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam )
-+{
-+ Any aResult;
-+ try
-+ {
-+ o2u_attachCurrentThread();
-+ ITypeInfo * pInfo = getTypeInfo();
-+ FuncDesc aDescGet(pInfo);
-+ FuncDesc aDescPut(pInfo);
-+ VarDesc aVarDesc(pInfo);
-+ getPropDesc(aPropertyName, & aDescGet, & aDescPut, & aVarDesc);
-+ if ( !aDescPut )
-+ {
-+ OUString msg(OUSTR("[automation bridge]Property \"") + aPropertyName +
-+ OUSTR("\" is not supported"));
-+ throw UnknownPropertyException(msg, Reference<XInterface>());
-+ }
-+ aResult = invokeWithDispIdComTlb( aDescPut, aPropertyName, aParams, aOutParamIndex, aOutParam );
-+ }
-+ catch ( Exception& e )
-+ {
-+ throw RuntimeException(OUSTR("[automation bridge] unexpected exception in "
-+ "IUnknownWrapper_Impl::invokePutProperty ! Message : \n") +
-+ e.Message, Reference<XInterface>());
-+ }
-+ return aResult;
-+}
-
-
- Any SAL_CALL IUnknownWrapper_Impl::invoke( const OUString& aFunctionName,
-@@ -211,6 +266,10 @@ Any SAL_CALL IUnknownWrapper_Impl::invoke( const OUString& aFunctionName,
- throw;
- }
- catch (CannotConvertException &)
-+ {
-+ throw;
-+ }
-+ catch (InvocationTargetException &)
- {
- throw;
- }
-@@ -659,12 +718,16 @@ sal_Bool SAL_CALL IUnknownWrapper_Impl::hasProperty( const OUString& aName )
- FuncDesc aDescPut(pInfo);
- VarDesc aVarDesc(pInfo);
- getPropDesc(aName, & aDescGet, & aDescPut, & aVarDesc);
-- // Automation properties can have parameters. If so, we access them through
-- // XInvocation::invoke. Thas is, hasProperty must return false for such a
-- // property
-+
-+ // we should probably just check the funckind
-+ // basic has been modified to handle properties ( 'get' ) props at
-+ // least with paramaters
-+ // additionally you can call invoke(Get|Set)Property on the bridge
-+ // you can determine if a property has parameter is hasMethod
-+ // returns true for the name
- if (aVarDesc
-- || aDescPut && aDescPut->cParams == 0
-- || aDescGet && aDescGet->cParams == 0)
-+ || aDescPut
-+ || aDescGet )
- {
- ret = sal_True;
- }
-@@ -1194,6 +1257,47 @@ void SAL_CALL IUnknownWrapper_Impl::initialize( const Sequence< Any >& aArgument
-
- aArguments[1] >>= m_bOriginalDispatch;
- aArguments[2] >>= m_seqTypes;
-+ try
-+ {
-+ ITypeInfo* pType= getTypeInfo();
-+ // Get Default member
-+ CComBSTR defaultMemberName;
-+ if ( SUCCEEDED( pType->GetDocumentation(0, &defaultMemberName, 0, 0, 0 ) ) )
-+ {
-+ OUString usName(reinterpret_cast<const sal_Unicode*>(LPCOLESTR(defaultMemberName)));
-+ FuncDesc aDescGet(pType);
-+ FuncDesc aDescPut(pType);
-+ VarDesc aVarDesc(pType);
-+ // see if this is a property first ( more likely to be a property then a method )
-+ getPropDesc( usName, & aDescGet, & aDescPut, & aVarDesc);
-+
-+ if ( !aDescGet && !aDescPut )
-+ {
-+ getFuncDesc( usName, &aDescGet );
-+ if ( !aDescGet )
-+ // we're knackered
-+ throw RuntimeException();
-+
-+ }
-+ // now for some funny heuristics to make basic understand what to do
-+ // a single aDescGet ( that doesn't take any params ) would be
-+ // a read only ( defaultmember ) property e.g. this object
-+ // should implement XDefaultProperty
-+ // a single aDescGet ( that *does* ) take params is basically a
-+ // default method e.g. implement XDefaultMethod
-+
-+ // a DescPut ( I guess we only really support a default param with '1' param ) as a setValue ( but I guess we can leave it through, the object will fail if we don't get it right anyway )
-+ if ( aDescPut || ( aDescGet && aDescGet->cParams == 0 ) )
-+ m_bHasDfltProperty = true;
-+ if ( aDescGet->cParams > 0 )
-+ m_bHasDfltMethod = true;
-+ if ( m_bHasDfltProperty || m_bHasDfltMethod )
-+ m_sDefaultMember = usName;
-+ }
-+ }
-+ catch( Exception& )
-+ {
-+ }
- }
-
- // UnoConversionUtilities --------------------------------------------------------------------------------
-@@ -1331,6 +1435,19 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(const OUString& sFuncName,
- Sequence< sal_Int16 >& OutParamIndex,
- Sequence< Any >& OutParam)
- {
-+ // Get type info for the call. It can be a method call or property put or
-+ // property get operation.
-+ FuncDesc aFuncDesc(getTypeInfo());
-+ getFuncDescForInvoke(sFuncName, Params, & aFuncDesc);
-+ return invokeWithDispIdComTlb( aFuncDesc, sFuncName, Params, OutParamIndex, OutParam );
-+}
-+
-+Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc,
-+ const OUString& sFuncName,
-+ const Sequence< Any >& Params,
-+ Sequence< sal_Int16 >& OutParamIndex,
-+ Sequence< Any >& OutParam)
-+{
- Any ret;
- HRESULT result;
-
-@@ -1349,10 +1466,6 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(const OUString& sFuncName,
- sal_Int32 revIndex = 0;
- bool bVarargParam = false;
-
-- // Get type info for the call. It can be a method call or property put or
-- // property get operation.
-- FuncDesc aFuncDesc(getTypeInfo());
-- getFuncDescForInvoke(sFuncName, Params, & aFuncDesc);
-
- //Set the array of DISPIDs for named args if it is a property put operation.
- //If there are other named arguments another array is set later on.
-@@ -1445,6 +1558,9 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(const OUString& sFuncName,
- arDispidNamedArgs.reset(new DISPID[nSizeAr]);
- HRESULT hr = getTypeInfo()->GetIDsOfNames(arNames, nSizeAr,
- arDispidNamedArgs.get());
-+ if ( hr == E_NOTIMPL )
-+ hr = m_spDispatch->GetIDsOfNames(IID_NULL, arNames, nSizeAr, LOCALE_USER_DEFAULT, arDispidNamedArgs.get() );
-+
- if (hr == S_OK)
- {
- // In a "property put" operation, the property value is a named param with the
-@@ -1768,11 +1884,24 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(const OUString& sFuncName,
- "DISP_E_BADVARTYPE."), 0);
- break;
- case DISP_E_EXCEPTION:
-+ {
- message = OUSTR("[automation bridge]: ");
- message += OUString(reinterpret_cast<const sal_Unicode*>(excepinfo.bstrDescription),
- ::SysStringLen(excepinfo.bstrDescription));
-- throw InvocationTargetException(message, Reference<XInterface>(), Any());
-+
-+ // Add for VBA, to throw an exception with the correct error code and message.
-+ sal_Int32 nErrorCode = excepinfo.wCode;
-+ if ( nErrorCode == 0 )
-+ {
-+ // The low 16-bit of scode describing the error or warning.
-+ nErrorCode = ( excepinfo.scode & 0xFFFF );
-+ }
-+ BasicErrorException aBasicErrExp(message, Reference<XInterface>(), nErrorCode, message);
-+ throw InvocationTargetException(message, Reference<XInterface>(), makeAny(aBasicErrExp));
-+ // End add
-+
- break;
-+ }
- case DISP_E_MEMBERNOTFOUND:
- message = OUSTR("[automation bridge]: A function with the name \"")
- + sFuncName + OUSTR("\" is not supported. Object returned "
-@@ -1905,11 +2034,17 @@ void IUnknownWrapper_Impl::getFuncDesc(const OUString & sFuncName, FUNCDESC ** p
- //get the associated index and add an entry to the map
- //with the name sFuncName which differs in the casing of the letters to
- //the actual name as obtained from ITypeInfo
-- cit itOrg = m_mapComFunc.find(OUString(reinterpret_cast<const sal_Unicode*>(LPCOLESTR(memberName))));
-+ OUString sRealName(reinterpret_cast<const sal_Unicode*>(LPCOLESTR(memberName)));
-+ cit itOrg = m_mapComFunc.find(sRealName);
- OSL_ASSERT(itOrg != m_mapComFunc.end());
-+ // maybe this is a property, if so we need
-+ // to store either both id's ( put/get ) or
-+ // just the get. Storing both is more consistent
-+ pair<cit, cit> pItems = m_mapComFunc.equal_range( sRealName );
-+ for ( ;pItems.first != pItems.second; ++pItems.first )
-+ m_mapComFunc.insert( TLBFuncIndexMap::value_type ( make_pair(sFuncName, pItems.first->second ) ));
- itIndex =
-- m_mapComFunc.insert( TLBFuncIndexMap::value_type
-- ( make_pair(sFuncName, itOrg->second ) ));
-+ m_mapComFunc.find( sFuncName );
- }
- }
- }
-@@ -2016,56 +2151,69 @@ void IUnknownWrapper_Impl::getPropDesc(const OUString & sFuncName, FUNCDESC ** p
- //else no entry for sFuncName, pFuncDesc will not be filled in
- }
-
--VARTYPE IUnknownWrapper_Impl::getElementTypeDesc(const TYPEDESC *desc)
-+VARTYPE IUnknownWrapper_Impl::getUserDefinedElementType( ITypeInfo* pTypeInfo, const DWORD nHrefType )
- {
- VARTYPE _type( VT_NULL );
--
-- if (desc->vt == VT_PTR)
-+ if ( pTypeInfo )
- {
-- _type = getElementTypeDesc(desc->lptdesc);
-- _type |= VT_BYREF;
-- }
-- else if (desc->vt == VT_SAFEARRAY)
-- {
-- _type = getElementTypeDesc(desc->lptdesc);
-- _type |= VT_ARRAY;
-- }
-- else if (desc->vt == VT_USERDEFINED)
-- {
-- ITypeInfo* thisInfo = getTypeInfo(); //kept by this instance
-- CComPtr<ITypeInfo> spRefInfo;
-- thisInfo->GetRefTypeInfo(desc->hreftype, & spRefInfo.p);
-- if (spRefInfo)
-+ CComPtr<ITypeInfo> spRefInfo;
-+ pTypeInfo->GetRefTypeInfo( nHrefType, &spRefInfo.p );
-+ if ( spRefInfo )
- {
-- TypeAttr attr(spRefInfo);
-- spRefInfo->GetTypeAttr( & attr);
-- if (attr->typekind == TKIND_ENUM)
-+ TypeAttr attr( spRefInfo );
-+ spRefInfo->GetTypeAttr( &attr );
-+ if ( attr->typekind == TKIND_ENUM )
- {
-- //We use the type of the first enum value.
-- if (attr->cVars == 0)
-+ // We use the type of the first enum value.
-+ if ( attr->cVars == 0 )
- {
-- throw BridgeRuntimeError(OUSTR("[automation bridge] Could "
-- "not obtain type description"));
-+ throw BridgeRuntimeError(OUSTR("[automation bridge] Could not obtain type description"));
- }
-- VarDesc var(spRefInfo);
-- spRefInfo->GetVarDesc(0, & var);
-- _type = var->lpvarValue->vt;
-+ VarDesc var( spRefInfo );
-+ spRefInfo->GetVarDesc( 0, &var );
-+ _type = var->lpvarValue->vt;
- }
-- else if (attr->typekind == TKIND_INTERFACE)
-+ else if ( attr->typekind == TKIND_INTERFACE )
- {
- _type = VT_UNKNOWN;
- }
-- else if (attr->typekind == TKIND_DISPATCH)
-+ else if ( attr->typekind == TKIND_DISPATCH )
- {
- _type = VT_DISPATCH;
- }
-- else
-+ else if ( attr->typekind == TKIND_ALIAS )
- {
-- throw BridgeRuntimeError(OUSTR("[automation bridge] "
-- "Unhandled user defined type."));
-+ // TKIND_ALIAS is a type that is an alias for another type. So get that alias type.
-+ _type = getUserDefinedElementType( pTypeInfo, attr->tdescAlias.hreftype );
-+ }
-+ else
-+ {
-+ throw BridgeRuntimeError( OUSTR("[automation bridge] Unhandled user defined type.") );
- }
- }
- }
-+ return _type;
-+}
-+
-+VARTYPE IUnknownWrapper_Impl::getElementTypeDesc(const TYPEDESC *desc)
-+{
-+ VARTYPE _type( VT_NULL );
-+
-+ if (desc->vt == VT_PTR)
-+ {
-+ _type = getElementTypeDesc(desc->lptdesc);
-+ _type |= VT_BYREF;
-+ }
-+ else if (desc->vt == VT_SAFEARRAY)
-+ {
-+ _type = getElementTypeDesc(desc->lptdesc);
-+ _type |= VT_ARRAY;
-+ }
-+ else if (desc->vt == VT_USERDEFINED)
-+ {
-+ ITypeInfo* thisInfo = getTypeInfo(); //kept by this instance
-+ _type = getUserDefinedElementType( thisInfo, desc->hreftype );
-+ }
- else
- {
- _type = desc->vt;
-diff --git extensions/source/ole/oleobjw.hxx extensions/source/ole/oleobjw.hxx
-index dfc88a5..1d56933 100644
---- extensions/source/ole/oleobjw.hxx
-+++ extensions/source/ole/oleobjw.hxx
-@@ -50,11 +50,15 @@
- #endif
- #include <cppuhelper/implbase3.hxx>
- #include <cppuhelper/implbase4.hxx>
-+#include <cppuhelper/implbase6.hxx>
-
- #include <com/sun/star/lang/XInitialization.hpp>
- #include <com/sun/star/bridge/oleautomation/XAutomationObject.hpp>
-+#include <com/sun/star/script//XAutomationInvocation.hpp>
- #include <rtl/ustring.hxx>
-
-+#include <com/sun/star/script/XDefaultProperty.hpp>
-+#include <com/sun/star/script/XDefaultMethod.hpp>
-
- #include <typelib/typedescription.hxx>
- #include "unoconversionutilities.hxx"
-@@ -78,7 +82,8 @@ typedef hash_multimap<OUString, unsigned int, hashOUString_Impl, equalOUString_I
- // This class wraps an IDispatch and maps XInvocation calls to IDispatch calls on the wrapped object.
- // If m_TypeDescription is set then this class represents an UNO interface implemented in a COM component.
- // The interface is not a real interface in terms of an abstract class but is realized through IDispatch.
--class IUnknownWrapper_Impl : public WeakImplHelper4<XInvocation, XBridgeSupplier2, XInitialization, XAutomationObject>,
-+class IUnknownWrapper_Impl : public WeakImplHelper6<XAutomationInvocation, XBridgeSupplier2, XInitialization, XAutomationObject, XDefaultProperty, XDefaultMethod>,
-+
- public UnoConversionUtilities<IUnknownWrapper_Impl>
-
- {
-@@ -126,8 +131,14 @@ public:
- // XInitialization
- virtual void SAL_CALL initialize( const Sequence< Any >& aArguments )
- throw(Exception, RuntimeException);
-+ virtual ::rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (::com::sun::star::uno::RuntimeException) { return m_sDefaultMember; }
- protected:
--
-+ virtual ::rtl::OUString SAL_CALL getDefaultMethodName( ) throw (::com::sun::star::uno::RuntimeException) { return m_sDefaultMember; }
-+
-+ virtual ::com::sun::star::uno::Any SAL_CALL invokeGetProperty( const ::rtl::OUString& aFunctionName, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aParams, ::com::sun::star::uno::Sequence< ::sal_Int16 >& aOutParamIndex, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::script::CannotConvertException, ::com::sun::star::reflection::InvocationTargetException, ::com::sun::star::uno::RuntimeException);
-+ virtual ::com::sun::star::uno::Any SAL_CALL invokePutProperty( const ::rtl::OUString& aFunctionName, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aParams, ::com::sun::star::uno::Sequence< ::sal_Int16 >& aOutParamIndex, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::script::CannotConvertException, ::com::sun::star::reflection::InvocationTargetException, ::com::sun::star::uno::RuntimeException);
-+
-+
- // ----------------------------------------------------------------------------
- virtual Any invokeWithDispIdUnoTlb(const OUString& sFunctionName,
- const Sequence< Any >& Params,
-@@ -139,6 +150,13 @@ protected:
- Sequence< sal_Int16 >& OutParamIndex,
- Sequence< Any >& OutParam);
-
-+ // Is used for OleObjectFactory service
-+ Any invokeWithDispIdComTlb( FuncDesc& aInvokeDesc,
-+ const OUString& sFuncName,
-+ const Sequence< Any >& Params,
-+ Sequence< sal_Int16 >& OutParamIndex,
-+ Sequence< Any >& OutParam);
-+
- // virtual void setValueWithDispId(DISPID dispID, const Any& Value);
-
- // virtual Any getValueWithDispId(const OUString& sName, DISPID dispID);
-@@ -184,6 +202,8 @@ protected:
- */
- bool getDispid(const OUString& sFuncName, DISPID * id);
-
-+ VARTYPE getUserDefinedElementType( ITypeInfo* pTypeInfo, const DWORD nHrefType );
-+
- /** Gets the element type in a VARIANT like style. E.g. if desc->lptdesc contains
- a VT_PTR than it is replaced by VT_BYREF and VT_SAFEARRAY is replaced by VT_ARRAY
- If the TYPEDESC describes an SAFEARRAY then varType is a combination of VT_ARRAY
-@@ -253,6 +273,9 @@ protected:
- bool m_bComTlbIndexInit;
- // Keeps the ITypeInfo obtained from IDispatch::GetTypeInfo
- CComPtr< ITypeInfo > m_spTypeInfo;
-+ rtl::OUString m_sDefaultMember;
-+ bool m_bHasDfltMethod;
-+ bool m_bHasDfltProperty;
- };
-
- } // end namespace
-diff --git extensions/source/propctrlr/defaultforminspection.cxx extensions/source/propctrlr/defaultforminspection.cxx
-index 2fab077..ac57f9e 100644
---- extensions/source/propctrlr/defaultforminspection.cxx
-+++ extensions/source/propctrlr/defaultforminspection.cxx
-@@ -149,7 +149,7 @@ namespace pcr
- { "com.sun.star.form.inspection.EventHandler", false },
-
- // a handler which introduces virtual properties for binding controls to spreadsheet cells
-- { "com.sun.star.form.inspection.CellBindingPropertyHandler", true },
-+ { "com.sun.star.form.inspection.CellBindingPropertyHandler", false },
-
- // properties related to binding to an XForms DOM node
- { "com.sun.star.form.inspection.XMLFormsPropertyHandler", true },
-diff --git extensions/source/propctrlr/formmetadata.cxx extensions/source/propctrlr/formmetadata.cxx
-index f6ab37e..58df4cd 100644
---- extensions/source/propctrlr/formmetadata.cxx
-+++ extensions/source/propctrlr/formmetadata.cxx
-@@ -138,6 +138,7 @@ namespace pcr
- DEF_INFO_3( LABEL, LABEL, LABEL, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
- DEF_INFO_2( CONTROLLABEL, LABELCONTROL, CONTROLLABEL, FORM_VISIBLE, COMPOSEABLE ),
- DEF_INFO_3( WRITING_MODE, WRITING_MODE, WRITING_MODE, FORM_VISIBLE, ENUM, COMPOSEABLE ),
-+ DEF_INFO_3( GROUP_NAME, GROUP_NAME, GROUP_NAME, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
- DEF_INFO_2( TEXT, TEXT, TEXT, DIALOG_VISIBLE, COMPOSEABLE ),
- DEF_INFO_3( MAXTEXTLEN, MAXTEXTLEN, MAXTEXTLEN, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
- DEF_INFO_3( EDITMASK, EDITMASK, EDITMASK, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
-diff --git extensions/source/propctrlr/formmetadata.hxx extensions/source/propctrlr/formmetadata.hxx
-index e5413f2..c11797a 100644
---- extensions/source/propctrlr/formmetadata.hxx
-+++ extensions/source/propctrlr/formmetadata.hxx
-@@ -163,6 +163,7 @@ namespace pcr
- #define PROPERTY_ID_ALLOWADDITIONS 20
- #define PROPERTY_ID_ALLOWEDITS 21
- #define PROPERTY_ID_ALLOWDELETIONS 22
-+ #define PROPERTY_ID_GROUP_NAME 23
- #define PROPERTY_ID_NAVIGATION 24
- #define PROPERTY_ID_CYCLE 25
- #define PROPERTY_ID_HIDDEN_VALUE 26
-diff --git extensions/source/propctrlr/formres.src extensions/source/propctrlr/formres.src
-index c853723..11c08c0 100644
---- extensions/source/propctrlr/formres.src
-+++ extensions/source/propctrlr/formres.src
-@@ -231,6 +231,10 @@ String RID_STR_NAME
- {
- Text [ en-US ] = "Name" ;
- };
-+String RID_STR_GROUP_NAME
-+{
-+ Text [ en-US ] = "Group name" ;
-+};
- String RID_STR_TABINDEX
- {
- Text [ en-US ] = "Tab order" ;
-diff --git extensions/source/propctrlr/formresid.hrc extensions/source/propctrlr/formresid.hrc
-index 613db7d..e05a6bb 100644
---- extensions/source/propctrlr/formresid.hrc
-+++ extensions/source/propctrlr/formresid.hrc
-@@ -149,6 +149,7 @@
- #define RID_STR_CURSOR_TYPE ( RID_FORMBROWSER_START + 121 )
- #define RID_STR_ENABLE_VISIBLE ( RID_FORMBROWSER_START + 122 )
- #define RID_STR_WHEEL_BEHAVIOR ( RID_FORMBROWSER_START + 123 )
-+#define RID_STR_GROUP_NAME ( RID_FORMBROWSER_START + 124 )
- // FREE
- // FREE
- // FREE
-diff --git extensions/source/propctrlr/formstrings.hxx extensions/source/propctrlr/formstrings.hxx
-index b338653..95a57b1 100644
---- extensions/source/propctrlr/formstrings.hxx
-+++ extensions/source/propctrlr/formstrings.hxx
-@@ -48,6 +48,7 @@ namespace pcr
- PCR_CONSTASCII_STRING( PROPERTY_WHEEL_BEHAVIOR, "MouseWheelBehavior");
- PCR_CONSTASCII_STRING( PROPERTY_TAG, "Tag");
- PCR_CONSTASCII_STRING( PROPERTY_NAME, "Name");
-+ PCR_CONSTASCII_STRING( PROPERTY_GROUP_NAME, "GroupName");
- PCR_CONSTASCII_STRING( PROPERTY_VALUE, "Value");
- PCR_CONSTASCII_STRING( PROPERTY_TEXT, "Text");
- PCR_CONSTASCII_STRING( PROPERTY_NAVIGATION, "NavigationBarMode");
-diff --git extensions/util/hidother.src extensions/util/hidother.src
-index 2aa0413..48f2e8e 100644
---- extensions/util/hidother.src
-+++ extensions/util/hidother.src
-@@ -207,6 +207,7 @@ hidspecial HID_PROP_FOCUSONCLICK { HelpId = HID_PROP_FOCUSONCLICK
- hidspecial HID_PROP_FONT { HelpId = HID_PROP_FONT; }
- hidspecial HID_PROP_FORMATKEY { HelpId = HID_PROP_FORMATKEY; }
- hidspecial HID_PROP_GROUPBOX { HelpId = HID_PROP_GROUPBOX; }
-+hidspecial HID_PROP_GROUP_NAME { HelpId = HID_PROP_GROUP_NAME; }
- hidspecial HID_PROP_HEIGHT { HelpId = HID_PROP_HEIGHT; }
- hidspecial HID_PROP_HELPTEXT { HelpId = HID_PROP_HELPTEXT; }
- hidspecial HID_PROP_HELPURL { HelpId = HID_PROP_HELPURL; }
-diff --git filter/inc/filter/msfilter/escherex.hxx filter/inc/filter/msfilter/escherex.hxx
-index 53f6f9b..0ee4916 100644
---- filter/inc/filter/msfilter/escherex.hxx
-+++ filter/inc/filter/msfilter/escherex.hxx
-@@ -45,6 +45,7 @@
- #include <com/sun/star/drawing/BitmapMode.hpp>
- #include <com/sun/star/drawing/Hatch.hpp>
- #include <svx/msdffdef.hxx>
-+#include <memory>
- #include "filter/msfilter/msfilterdllapi.h"
-
- /*Record Name FBT-Value Instance Contents Wrd Exl PPt Ver*/
-@@ -1305,6 +1306,19 @@ public:
- const Rectangle& rRect ) = 0;
- };
-
-+class InteractionInfo
-+{
-+ bool mbHasInteraction;
-+ std::auto_ptr<SvMemoryStream> mpHyperlinkRecord;
-+ InteractionInfo();
-+public:
-+ InteractionInfo( SvMemoryStream* pStream, bool bInteraction ) : mbHasInteraction( bInteraction )
-+ {
-+ mpHyperlinkRecord.reset( pStream );
-+ }
-+ bool hasInteraction() { return mbHasInteraction; }
-+ const std::auto_ptr< SvMemoryStream >& getHyperlinkRecord() { return mpHyperlinkRecord; }
-+};
-
- class EscherExHostAppData
- {
-@@ -1312,14 +1326,17 @@ private:
- EscherExClientAnchor_Base* pClientAnchor;
- EscherExClientRecord_Base* pClientData;
- EscherExClientRecord_Base* pClientTextbox;
-+ InteractionInfo* pInteractionInfo;
- // ignore single shape if entire pages are written
- BOOL bDontWriteShape;
-
- public:
- EscherExHostAppData() : pClientAnchor(0), pClientData(0),
-- pClientTextbox(0), bDontWriteShape(FALSE)
-+ pClientTextbox(0), pInteractionInfo(0), bDontWriteShape(FALSE)
- {}
-
-+ void SetInteractionInfo( InteractionInfo* p )
-+ { pInteractionInfo = p; }
- void SetClientAnchor( EscherExClientAnchor_Base* p )
- { pClientAnchor = p; }
- void SetClientData( EscherExClientRecord_Base* p )
-@@ -1328,6 +1345,8 @@ public:
- { pClientTextbox = p; }
- void SetDontWriteShape( BOOL b )
- { bDontWriteShape = b; }
-+ InteractionInfo* GetInteractionInfo() const
-+ { return pInteractionInfo; }
- EscherExClientAnchor_Base* GetClientAnchor() const
- { return pClientAnchor; }
- EscherExClientRecord_Base* GetClientData() const
-diff --git filter/inc/filter/msfilter/msocximex.hxx filter/inc/filter/msfilter/msocximex.hxx
-index b8733b1..7caf854 100644
---- filter/inc/filter/msfilter/msocximex.hxx
-+++ filter/inc/filter/msfilter/msocximex.hxx
-@@ -29,6 +29,7 @@
-
- #include <sot/storage.hxx>
- #include <tools/debug.hxx>
-+#include <com/sun/star/graphic/XGraphicObject.hpp>
-
- //!! no such defines in global namespaces - it will break other existing code that uses the same define!!
- //#ifndef C2U
-@@ -287,7 +288,10 @@ public:
- bool mbVisible;
- UniString sName;
- UniString msToolTip;
-+ UniString msParentName;
- OCX_FontData aFontData;
-+ rtl::OUString msCtrlSource;
-+ rtl::OUString msRowSource;
- SfxObjectShell *pDocSh;
- protected:
-
-@@ -324,14 +328,13 @@ public:
- nMultiState(0), nValueLen(0), nCaptionLen(0), nVertPos(1), nHorzPos(7),
- nSpecialEffect(2), nIcon(0), nPicture(0), nAccelerator(0), nGroupNameLen(0),
- pValue(0), pCaption(0), pGroupName(0), nIconLen(0), pIcon(0),
-- nPictureLen(0), pPicture(0) {}
-+ nPictureLen(0) {}
-
- ~OCX_ModernControl() {
- if (pValue) delete[] pValue;
- if (pCaption) delete[] pCaption;
- if (pGroupName) delete[] pGroupName;
- if (pIcon) delete[] pIcon;
-- if (pPicture) delete[] pPicture;
- }
- sal_Bool Read(SotStorageStream *pS);
-
-@@ -412,7 +415,8 @@ public:
-
- sal_uInt8 pPictureHeader[20];
- sal_uInt32 nPictureLen;
-- sal_uInt8 *pPicture;
-+ ::rtl::OUString sImageUrl;
-+ com::sun::star::uno::Reference< com::sun::star::graphic::XGraphicObject> mxGrfObj;
-
- };
-
-@@ -461,6 +465,7 @@ public:
-
- bool bAutoSize;
- ::rtl::OUString sImageUrl;
-+ com::sun::star::uno::Reference< com::sun::star::graphic::XGraphicObject> mxGrfObj;
- sal_Bool Read(SotStorageStream *pS);
-
- using OCX_Control::Import; // to not hide the other two import methods
-@@ -485,6 +490,8 @@ struct ContainerRecord
-
- ::rtl::OUString cName;
- ::rtl::OUString controlTip;
-+ ::rtl::OUString sCtrlSource;
-+ ::rtl::OUString sRowSource;
-
- sal_uInt32 nTop;
- sal_uInt32 nLeft;
-@@ -499,54 +506,8 @@ typedef std::vector<OCX_Control*>::iterator CtrlIterator;
- typedef std::vector<OCX_Control*>::const_iterator CtrlIteratorConst;
- typedef std::vector<OCX_Control*> CtrlList;
-
--
--
--class RBGroup
--{
-- public:
-- RBGroup():mRBGroupPos(0){}
-- RBGroup(sal_uInt16& groupPos ):mRBGroupPos(groupPos){}
-- sal_Int16 tabPos() const { return mRBGroupPos; }
-- std::vector<OCX_Control*>::size_type numControls()
-- { return mpControls.size(); }
-- std::vector<OCX_Control*>& controls() { return mpControls; }
--
-- void add(OCX_Control* pRB);
-- private:
-- sal_uInt16 mRBGroupPos;
-- std::vector<OCX_Control*> mpControls;
--};
--
--typedef ::std::hash_map < ::rtl::OUString, RBGroup*, ::rtl::OUStringHash,
-- ::std::equal_to< ::rtl::OUString > > RBGroupHash;
--typedef std::vector<RBGroup*>::iterator GroupIterator;
--
- class OCX_OptionButton;
-
--class RBGroupManager
--{
--public:
-- RBGroupManager( String& defaultName );
-- ~RBGroupManager();
--
-- CtrlList insertGroupsIntoControlList( const CtrlList& sourceList );
-- void addRadioButton( OCX_OptionButton* pRButton );
--private:
--
-- void addSeperator( std::vector< OCX_Control* >& dest );
-- void copyList( std::vector< OCX_Control* >& src,
-- std::vector< OCX_Control* >& dest,
-- bool addGroupSeperator );
--
-- RBGroupHash rbGroups;
-- String mSDefaultName;
-- std::vector< RBGroup* > groupList;
-- sal_uInt16 numRadioButtons;
--};
--
--
--
--
- class OCX_ContainerControl : public OCX_Control
- {
- public:
-@@ -572,8 +533,9 @@ public:
- SotStorageStreamRef getContainerStream() { return mContainerStream; }
-
- virtual void ProcessControl( OCX_Control* pControl, SvStorageStream* pS, ContainerRecord& rec );
-- bool createFromContainerRecord( const ContainerRecord& record,
-+ bool createFromContainerRecord( ContainerRecord& record,
- OCX_Control*& );
-+ SotStorageStreamRef getContainedControlsStream(){ return mContainedControlsStream; }
- protected:
- // This class not meant to be instantiated
- // needs to be subclassed
-@@ -585,10 +547,10 @@ protected:
- OCX_Control* pParent = NULL );
- rtl::OUString createSubStreamName( const sal_uInt32& subStorageID );
-
-- RBGroupManager rbGroupMgr;
- com::sun::star::uno::Reference<
- com::sun::star::container::XNameContainer > mxParent;
- std::vector<OCX_Control*> mpControls;
-+ std::hash_map<sal_uInt16, sal_uInt16> mActiveXIDMap;
- SotStorageRef mContainerStorage;
- SotStorageStreamRef mContainerStream;
- SotStorageStreamRef mContainedControlsStream;
-@@ -856,7 +818,6 @@ public:
- {
- delete[] pCaption;
- delete[] pIcon;
-- delete[] pPicture;
- }
-
- virtual sal_Bool Read(SvStorageStream *pS);
-@@ -920,7 +881,8 @@ public:
-
- sal_uInt8 pPictureHeader[20];
- sal_uInt32 nPictureLen;
-- sal_uInt8 *pPicture;
-+ ::rtl::OUString sImageUrl;
-+ com::sun::star::uno::Reference< com::sun::star::graphic::XGraphicObject> mxGrfObj;
- private:
- com::sun::star::uno::Reference<
- com::sun::star::uno::XComponentContext> mxCtx;
-@@ -959,7 +921,8 @@ public:
- OCX_OptionButton() : OCX_ModernControl(rtl::OUString::createFromAscii("OptionButton"))
- {
- msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.RadioButton");
-- msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlRadioButtonModel");
-+ //msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlRadioButtonModel");
-+ msDialogType = rtl::OUString::createFromAscii("com.sun.star.form.component.RadioButton");
- mnBackColor = 0x80000005L;
- mnForeColor = 0x80000008L;
- aFontData.SetHasAlign(TRUE);
-@@ -1060,7 +1023,7 @@ class OCX_ComboBox : public OCX_ModernControl
- public:
- OCX_ComboBox() : OCX_ModernControl(rtl::OUString::createFromAscii("ComboBox")){
- msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.ComboBox");
-- msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlComboBoxModel");
-+ msDialogType = rtl::OUString::createFromAscii("com.sun.star.form.component.ComboBox");
- mnBackColor = 0x80000005;
- mnForeColor = 0x80000008;
- nBorderColor = 0x80000006;
-@@ -1085,7 +1048,8 @@ class OCX_ListBox : public OCX_ModernControl
- public:
- OCX_ListBox() : OCX_ModernControl(rtl::OUString::createFromAscii("ListBox")){
- msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.ListBox");
-- msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlListBoxModel");
-+ //msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlListBoxModel");
-+ msDialogType = rtl::OUString::createFromAscii("com.sun.star.form.component.ListBox");
- mnBackColor = 0x80000005;
- mnForeColor = 0x80000008;
- nBorderColor = 0x80000006;
-@@ -1113,7 +1077,7 @@ public:
- fEnabled(1), fLocked(0), fBackStyle(1), fWordWrap(0), fAutoSize(0),
- nCaptionLen(0), nVertPos(1), nHorzPos(7), nMousePointer(0), nPicture(0),
- nAccelerator(0), nIcon(0), pCaption(0), nIconLen(0), pIcon(0), nPictureLen(0),
-- pPicture(0), mbTakeFocus( true )
-+ mbTakeFocus( true )
- {
- msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.CommandButton");
- msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlButtonModel");
-@@ -1124,7 +1088,6 @@ public:
- ~OCX_CommandButton() {
- if (pCaption) delete[] pCaption;
- if (pIcon) delete[] pIcon;
-- if (pPicture) delete[] pPicture;
- }
- sal_Bool Read(SotStorageStream *pS);
-
-@@ -1167,7 +1130,8 @@ public:
-
- sal_uInt8 pPictureHeader[20];
- sal_uInt32 nPictureLen;
-- sal_uInt8 *pPicture;
-+ ::rtl::OUString sImageUrl;
-+ com::sun::star::uno::Reference< com::sun::star::graphic::XGraphicObject> mxGrfObj;
-
- bool mbTakeFocus;
-
-@@ -1285,7 +1249,7 @@ public:
-
- sal_uInt8 pPictureHeader[20];
- sal_uInt32 nPictureLen;
-- sal_uInt8 *pPicture;
-+ sal_uInt8 *pPicture;
-
- static OCX_Control *Create() { return new OCX_Label;}
-
-diff --git filter/inc/filter/msfilter/mstoolbar.hxx filter/inc/filter/msfilter/mstoolbar.hxx
-new file mode 100644
-index 0000000..c117645
---- /dev/null
-+++ filter/inc/filter/msfilter/mstoolbar.hxx
-@@ -0,0 +1,334 @@
-+#ifndef _MSTOOLBAR_HXX
-+#define _MSTOOLBAR_HXX
-+#include "filter/msfilter/msfilterdllapi.h"
-+#include <tools/string.hxx>
-+#include <sot/storage.hxx>
-+#include <ostream>
-+#include <memory>
-+#include <vector>
-+#include <boost/shared_ptr.hpp>
-+#include <com/sun/star/frame/XModel.hpp>
-+#include <com/sun/star/container/XIndexContainer.hpp>
-+#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
-+#include <com/sun/star/ui/ImageType.hpp>
-+#include <com/sun/star/graphic/XGraphic.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <vcl/bitmap.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+
-+namespace css = ::com::sun::star;
-+
-+class TBCHeader;
-+
-+
-+class MSOCommandConvertor
-+{
-+public:
-+ virtual ~MSOCommandConvertor() {}
-+ virtual rtl::OUString MSOCommandToOOCommand( sal_Int16 msoCmd ) = 0;
-+ virtual rtl::OUString MSOTCIDToOOCommand( sal_Int16 msoTCID ) = 0;
-+};
-+
-+class SfxObjectShell;
-+
-+class MSFILTER_DLLPUBLIC CustomToolBarImportHelper
-+{
-+ struct iconcontrolitem
-+ {
-+ rtl::OUString sCommand;
-+ css::uno::Reference< css::graphic::XGraphic > image;
-+ };
-+ std::vector< iconcontrolitem > iconcommands;
-+ std::auto_ptr< MSOCommandConvertor > pMSOCmdConvertor;
-+ css::uno::Reference< css::ui::XUIConfigurationManagerSupplier > m_xCfgSupp;
-+ css::uno::Reference< css::ui::XUIConfigurationManager > m_xAppCfgMgr;
-+ SfxObjectShell& mrDocSh;
-+ void ScaleImage( css::uno::Reference< css::graphic::XGraphic >& xGraphic, long nNewSize );
-+public:
-+ CustomToolBarImportHelper( SfxObjectShell& rDocSh, const css::uno::Reference< css::ui::XUIConfigurationManager >& rxAppCfgMgr );
-+
-+ void setMSOCommandMap( MSOCommandConvertor* pCnvtr ) { pMSOCmdConvertor.reset( pCnvtr ); }
-+ css::uno::Reference< css::ui::XUIConfigurationManager > getCfgManager();
-+ css::uno::Reference< css::ui::XUIConfigurationManager > getAppCfgManager();
-+
-+
-+ css::uno::Any createCommandFromMacro( const rtl::OUString& sCmd );
-+
-+ void addIcon( const css::uno::Reference< css::graphic::XGraphic >& xImage, const rtl::OUString& sString );
-+ void applyIcons();
-+ rtl::OUString MSOCommandToOOCommand( sal_Int16 msoCmd );
-+ rtl::OUString MSOTCIDToOOCommand( sal_Int16 msoTCID );
-+ SfxObjectShell& GetDocShell() { return mrDocSh; }
-+ void showToolbar( const rtl::OUString& rName );
-+ bool createMenu( const rtl::OUString& rName, const css::uno::Reference< css::container::XIndexAccess >& xMenuDesc, bool bPersist );
-+};
-+
-+class MSFILTER_DLLPUBLIC TBBase
-+{
-+friend class Indent;
-+ static int nIndent; // num spaces to indent before printing
-+protected:
-+ void indent_printf(FILE* fp, const char* format, ... );
-+ sal_uInt32 nOffSet; // usually for debug we can store the offset in the stream to this record
-+public:
-+ TBBase() : nOffSet( 0 ) {}
-+ virtual ~TBBase(){}
-+ rtl::OUString readUnicodeString( SvStream* pS, sal_Int32 nChars );
-+
-+ virtual bool Read(SvStream *pS) = 0;
-+ virtual void Print( FILE* ) {} // #FIXME remove this an implement the debug routines in all the classes below to enable some sort of readable output
-+ sal_uInt32 GetOffset() { return nOffSet; }
-+};
-+
-+class Indent
-+{
-+public:
-+ Indent( bool binit = false )
-+ {
-+ if ( binit )
-+ init();
-+ else
-+ TBBase::nIndent = TBBase::nIndent + 2;
-+ }
-+ ~Indent() { TBBase::nIndent = TBBase::nIndent - 2; }
-+ void init() { TBBase::nIndent = 0; }
-+};
-+
-+
-+class MSFILTER_DLLPUBLIC WString : public TBBase
-+{
-+ rtl::OUString sString;
-+
-+public:
-+ WString(){};
-+ ~WString(){};
-+ bool Read(SvStream *pS);
-+ rtl::OUString getString(){ return sString; }
-+};
-+
-+class MSFILTER_DLLPUBLIC TBCExtraInfo : public TBBase
-+{
-+ WString wstrHelpFile;
-+ sal_Int32 idHelpContext;
-+ WString wstrTag;
-+ WString wstrOnAction;
-+ WString wstrParam;
-+ sal_Int8 tbcu;
-+ sal_Int8 tbmg;
-+
-+ TBCExtraInfo(const TBCExtraInfo&);
-+ TBCExtraInfo& operator = ( const TBCExtraInfo&);
-+public:
-+ TBCExtraInfo();
-+ ~TBCExtraInfo(){}
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+ rtl::OUString getOnAction();
-+};
-+
-+class MSFILTER_DLLPUBLIC TBCGeneralInfo : public TBBase
-+{
-+ sal_uInt8 bFlags;
-+ WString customText;
-+ WString descriptionText;
-+ WString tooltip;
-+ TBCExtraInfo extraInfo;
-+
-+public:
-+ TBCGeneralInfo();
-+ ~TBCGeneralInfo() {}
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+ bool ImportToolBarControlData( CustomToolBarImportHelper&, std::vector< css::beans::PropertyValue >& );
-+ rtl::OUString CustomText() { return customText.getString(); }
-+ rtl::OUString DescriptionText() { return descriptionText.getString(); }
-+ rtl::OUString Tooltip() { return tooltip.getString(); }
-+};
-+
-+class MSFILTER_DLLPUBLIC TBCBitMap : public TBBase
-+{
-+friend class TBCBSpecific; // #FIXME hacky access, need to fix
-+ sal_Int32 cbDIB;
-+ Bitmap mBitMap;
-+ int size;
-+public:
-+ TBCBitMap();
-+ ~TBCBitMap();
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+ Bitmap& getBitMap();
-+};
-+
-+class MSFILTER_DLLPUBLIC TBCMenuSpecific : public TBBase
-+{
-+ sal_Int32 tbid;
-+ boost::shared_ptr< WString > name; //exist only if tbid equals 0x00000001
-+public:
-+ TBCMenuSpecific();
-+ ~TBCMenuSpecific(){}
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+ rtl::OUString Name();
-+};
-+
-+class MSFILTER_DLLPUBLIC TBCCDData : public TBBase
-+{
-+ sal_Int16 cwstrItems; //Signed integer that specifies the number of items in wstrList. MUST be positive.
-+ std::vector< WString > wstrList; // Zero-based index array of WString structures. Number of elements MUST be equal to cwstrItems.
-+ sal_Int16 cwstrMRU; // Signed integer that specifies the number of most recently used string
-+ sal_Int16 iSel ; // Signed integer that specifies the zero-based index of the selected item in the wstrList field. MUST be equal to 0xFFFF (-1) or greater than or equal to 0x0000.
-+ sal_Int16 cLines; // Signed integer that specifies the suggested number of lines that the toolbar control will display at any time when displaying the elements of wstrList of available items.
-+ sal_Int16 dxWidth; // Signed integer that specifies the width in pixels that the interior of the dropdown has. This excludes the width of the toolbar control border and scroll bar.
-+ WString wstrEdit; //Structure of type WString. Editable text for editable area of the ComboBox toolbar control.
-+
-+public:
-+ TBCCDData();
-+ ~TBCCDData();
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+};
-+
-+class TBCComboDropdownSpecific : public TBBase
-+{
-+ boost::shared_ptr< TBCCDData > data;
-+public:
-+ TBCComboDropdownSpecific( const TBCHeader& header );
-+ TBCComboDropdownSpecific(){}
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+};
-+
-+class TBCBSpecific : public TBBase
-+{
-+ sal_uInt8 bFlags;
-+ boost::shared_ptr< TBCBitMap > icon; // optional
-+ boost::shared_ptr< TBCBitMap > iconMask; // optional
-+ boost::shared_ptr< sal_uInt16 > iBtnFace; // optional
-+ boost::shared_ptr< WString > wstrAcc; // optional
-+
-+public:
-+ TBCBSpecific();
-+ ~TBCBSpecific(){}
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+ // #TODO just add a getGraphic member here
-+ TBCBitMap* getIcon();
-+ TBCBitMap* getIconMask();
-+ sal_uInt16* getBtnFace() { return iBtnFace.get(); }
-+};
-+
-+/* TBCHeader.tct controlSpecificInfo type
-+
-+0x01 (Button control) TBCBSpecific
-+0x10 (ExpandingGrid control) TBCBSpecific
-+0x0A (Popup control) TBCMenuSpecific
-+0x0C (ButtonPopup control) TBCMenuSpecific
-+0x0D (SplitButtonPopup control) TBCMenuSpecific
-+0x0E (SplitButtonMRUPopup control) TBCMenuSpecific
-+0x02 (Edit control) TBCComboDropdow nSpecific
-+0x04 (ComboBox control) TBCComboDropdow nSpecific
-+0x14 (GraphicCombo control) TBCComboDropdow nSpecific
-+0x03 (DropDown control) TBCComboDropdow nSpecific
-+0x06 (SplitDropDown control) TBCComboDropdow nSpecific
-+0x09 (GraphicDropDown control) TBCComboDropdow nSpecific
-+0x07 (OCXDropDown control) controlSpecificInfo MUST NOT exist
-+0x0F (Label control) controlSpecificInfo MUST NOT exist
-+0x12 (Grid control) controlSpecificInfo MUST NOT exist
-+0x13 (Gauge control) controlSpecificInfo MUST NOT exist
-+0x16 (ActiveX control) controlSpecificInfo MUST NOT exist
-+
-+*/
-+class MSFILTER_DLLPUBLIC TBCHeader : public TBBase
-+{
-+ sal_Int8 bSignature;
-+ sal_Int8 bVersion;
-+ sal_uInt8 bFlagsTCR;
-+ sal_uInt8 tct;
-+ sal_uInt16 tcid;
-+ sal_uInt32 tbct;
-+ sal_uInt8 bPriority;
-+ boost::shared_ptr< sal_uInt16 > width; //optional
-+ boost::shared_ptr< sal_uInt16 > height; //optional
-+
-+public:
-+ TBCHeader();
-+ ~TBCHeader();
-+ sal_uInt8 getTct() const { return tct; }
-+ sal_uInt16 getTcID() const { return tcid; }
-+ bool isVisible() { return !( bFlagsTCR & 0x1 ); }
-+ bool isBeginGroup() { return ( bFlagsTCR & 0x2 ); }
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+ sal_uInt32 getTbct() { return tbct; };
-+};
-+
-+class MSFILTER_DLLPUBLIC TBCData : public TBBase
-+{
-+ TBCHeader rHeader;
-+ TBCGeneralInfo controlGeneralInfo;
-+ boost::shared_ptr< TBBase > controlSpecificInfo; // can be one of TBCBSpecific, TBCMenuSpecific or TBCComboDropdow nSpecific depending on the control type specified by TBCHeader.tct
-+ TBCData(const TBCData&);
-+ TBCData& operator = ( const TBCData&);
-+public:
-+ TBCData( const TBCHeader& Header );
-+ ~TBCData(){}
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+ bool ImportToolBarControl( CustomToolBarImportHelper&, std::vector< css::beans::PropertyValue >&, bool& bBeginGroup, bool bIsMenuBar );
-+ TBCGeneralInfo& getGeneralInfo() { return controlGeneralInfo; }
-+ TBCMenuSpecific* getMenuSpecific();
-+};
-+
-+class MSFILTER_DLLPUBLIC TB : public TBBase
-+{
-+ sal_uInt8 bSignature;// Signed integer that specifies the toolbar signature number. MUST be 0x02.
-+ sal_uInt8 bVersion; // Signed integer that specifies the toolbar version number. MUST be 0x01.
-+ sal_Int16 cCL; // Signed integer that SHOULD specify the number of toolbar controls contained in this toolbar.
-+ sal_Int32 ltbid;// Signed integer that specifies the toolbar ID. MUST be 0x0001 (custom toolbar ID).
-+ sal_uInt32 ltbtr;// Unsigned integer of type TBTRFlags that specifies the toolbar type and toolbar restrictions.
-+ sal_uInt16 cRowsDefault;// Unsigned integer that specifies the number of preferred rows for the toolbar when the toolbar is not docked. MUST be less than or equal to 255.
-+ sal_uInt16 bFlags; //Unsigned integer of type TBFlags.
-+ WString name; //Structure of type WString that specifies the toolbar name
-+public:
-+ TB();
-+ ~TB(){}
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+ sal_Int16 getcCL(){ return cCL; }
-+ WString& getName(){ return name; }
-+ bool IsEnabled();
-+ bool IsMenuToolbar(){ return ( ( ltbtr & 0x2000000 ) == 0x2000000 ); }
-+ bool NeedsPositioning();
-+};
-+
-+class MSFILTER_DLLPUBLIC SRECT : public TBBase
-+{
-+public:
-+ SRECT() : left(0), top(0), right(0), bottom(0) {}
-+ sal_Int16 left;
-+ sal_Int16 top;
-+ sal_Int16 right;
-+ sal_Int16 bottom;
-+ bool Read( SvStream* pS ) { *pS >> left >> top >> right >> bottom; return true; }
-+ void Print( FILE* fo );
-+};
-+
-+typedef cppu::WeakImplHelper1< css::container::XIndexContainer > PropertyValueIndexContainer_BASE;
-+
-+class MSFILTER_DLLPUBLIC TBVisualData : public TBBase
-+{
-+ sal_Int8 tbds;
-+ sal_Int8 tbv;
-+ sal_Int8 tbdsDock;
-+ sal_Int8 iRow;
-+
-+ SRECT rcDock;
-+ SRECT rcFloat;
-+
-+public:
-+ TBVisualData();
-+ ~TBVisualData(){}
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+};
-+#endif
-diff --git filter/inc/filter/msfilter/svxmsbas.hxx filter/inc/filter/msfilter/svxmsbas.hxx
-index ba8f40b..520c8f1 100644
---- filter/inc/filter/msfilter/svxmsbas.hxx
-+++ filter/inc/filter/msfilter/svxmsbas.hxx
-@@ -32,6 +32,8 @@
- #include "filter/msfilter/msfilterdllapi.h"
-
- #include <sot/storage.hxx>
-+#include <map>
-+#include <hash_map>
-
- class SfxObjectShell;
-
-@@ -50,6 +52,12 @@ class SfxObjectShell;
- * probably what the user expects to see when viewing the code
- */
-
-+typedef std::hash_map< sal_Int32, String > ObjIdToName;
-+
-+typedef std::map< String, ObjIdToName > ControlAttributeInfo;
-+
-+class VBA_Impl;
-+
- class MSFILTER_DLLPUBLIC SvxImportMSVBasic
- {
- public:
-@@ -76,23 +84,31 @@ public:
-
- // check if the MS-VBA-Storage exist in the RootStorage of the DocShell.
- // If it exist, then return the WarningId for loosing the information.
-+
-+ const ControlAttributeInfo& ControlNameForObjectId(){ return m_ModuleNameToObjIdHash; }
- static ULONG GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocS );
-
- static String GetMSBasicStorageName();
-+ rtl::OUString GetVBAProjectName() { return msProjectName; }
- private:
- SotStorageRef xRoot;
- SfxObjectShell &rDocSh;
- BOOL bImport;
- BOOL bCopy;
-+ ControlAttributeInfo m_ModuleNameToObjIdHash;
-+ MSFILTER_DLLPRIVATE void extractAttribute( const String& rAttribute, const String& rModName );
-
- MSFILTER_DLLPRIVATE BOOL ImportCode_Impl( const String& rStorageName,
- const String &rSubStorageName,
- const std::vector< String >& codeNames,
- BOOL bAsComment, BOOL bStripped);
- MSFILTER_DLLPRIVATE bool ImportForms_Impl(const String& rStorageName,
-- const String &rSubStorageName);
-+ const String &rSubStorageName, BOOL bVBAMode);
- MSFILTER_DLLPRIVATE BOOL CopyStorage_Impl( const String& rStorageName,
- const String &rSubStorageName);
-+ rtl::OUString msProjectName;
-+ MSFILTER_DLLPRIVATE BOOL ImportCode_Impl( VBA_Impl&, const std::vector< String >&, BOOL, BOOL );
-+ MSFILTER_DLLPRIVATE bool ImportForms_Impl( VBA_Impl&, const String&, const String&, BOOL);
- };
-
- #endif
-diff --git filter/source/msfilter/eschesdo.cxx filter/source/msfilter/eschesdo.cxx
-index ed82269..e8fe184 100644
---- filter/source/msfilter/eschesdo.cxx
-+++ filter/source/msfilter/eschesdo.cxx
-@@ -244,6 +244,19 @@ UINT32 ImplEESdrWriter::ImplWriteShape( ImplEESdrObject& rObj,
- // #i51348# shape name
- if( aShapeName.Len() > 0 )
- aPropOpt.AddOpt( ESCHER_Prop_wzName, aShapeName );
-+ if ( InteractionInfo* pInteraction = mpHostAppData->GetInteractionInfo() )
-+ {
-+ const std::auto_ptr< SvMemoryStream >& pMemStrm = pInteraction->getHyperlinkRecord();
-+ if ( pMemStrm.get() )
-+ {
-+ pMemStrm->ObjectOwnsMemory( FALSE );
-+ sal_uInt8* pBuf = (sal_uInt8*) pMemStrm->GetData();
-+ sal_uInt32 nSize = pMemStrm->Seek( STREAM_SEEK_TO_END );
-+ aPropOpt.AddOpt( ESCHER_Prop_pihlShape, sal_False, nSize, pBuf, nSize );;
-+ }
-+ if ( pInteraction->hasInteraction() )
-+ aPropOpt.AddOpt( ESCHER_Prop_fPrint, 0x00080008 );
-+ }
-
- if ( rObj.GetType().EqualsAscii( "drawing.Custom" ) )
- {
-diff --git filter/source/msfilter/makefile.mk filter/source/msfilter/makefile.mk
-index 7780529..c59a126 100644
---- filter/source/msfilter/makefile.mk
-+++ filter/source/msfilter/makefile.mk
-@@ -53,6 +53,7 @@ SLOFILES= \
- $(SLO)$/svdfppt.obj \
- $(SLO)$/svxmsbas2.obj \
- $(SLO)$/msvbahelper.obj \
-+ $(SLO)$/mstoolbar.obj\
-
- SHL1TARGET= msfilter$(DLLPOSTFIX)
- SHL1IMPLIB= i$(TARGET)
-@@ -61,6 +62,7 @@ SHL1USE_EXPORTS=name
- SHL1STDLIBS= \
- $(EDITENGLIB) \
- $(SVXCORELIB) \
-+ $(SVTOOLLIB) \
- $(SFX2LIB) \
- $(XMLOFFLIB) \
- $(BASEGFXLIB) \
-diff --git filter/source/msfilter/msocximex.cxx filter/source/msfilter/msocximex.cxx
-index 0391c5c..3405ad4 100644
---- filter/source/msfilter/msocximex.cxx
-+++ filter/source/msfilter/msocximex.cxx
-@@ -46,6 +46,10 @@
- #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
- #include <com/sun/star/form/XFormsSupplier.hpp>
- #include <com/sun/star/form/XForm.hpp>
-+#include <com/sun/star/form/binding/XBindableValue.hpp>
-+#include <com/sun/star/form/binding/XValueBinding.hpp>
-+#include <com/sun/star/form/binding/XListEntrySink.hpp>
-+#include <com/sun/star/form/binding/XListEntrySource.hpp>
- #include <com/sun/star/form/FormComponentType.hpp>
- #include <com/sun/star/awt/FontWeight.hpp>
- #include <com/sun/star/awt/FontSlant.hpp>
-@@ -70,7 +74,22 @@
- #include <com/sun/star/ucb/XSimpleFileAccess.hpp>
- #include <algorithm>
- #include <memory>
--
-+#include <com/sun/star/graphic/GraphicObject.hpp>
-+#include <com/sun/star/graphic/XGraphicProvider.hpp>
-+#include <com/sun/star/graphic/XGraphic.hpp>
-+#include <com/sun/star/io/XInputStream.hpp>
-+#include <comphelper/componentcontext.hxx>
-+#include <unotools/streamwrap.hxx>
-+
-+#include <com/sun/star/beans/NamedValue.hpp>
-+#include <com/sun/star/table/XCellRange.hpp>
-+#include <com/sun/star/table/CellRangeAddress.hpp>
-+#include <com/sun/star/table/CellAddress.hpp>
-+#include <com/sun/star/sheet/XSpreadsheetView.hpp>
-+#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
-+#include <com/sun/star/sheet/XCellRangeReferrer.hpp>
-+#include <svtools/filterutils.hxx>
-+
- #ifndef C2S
- #define C2S(cChar) String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(cChar))
- #endif
-@@ -84,6 +103,7 @@ using namespace cppu;
-
-
- #define WW8_ASCII2STR(s) String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(s))
-+#define GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:"
-
-
- static char sWW8_form[] = "WW-Standard";
-@@ -112,126 +132,48 @@ long ReadAlign(SvStorageStream *pS, long nPos, int nAmount)
- return 0;
- }
-
--
- // NP - Images in controls in OO2.0/SO8 exist as links, e.g. they are not part of the document so are
- // referenced externally. On import from ms document try to save images for controls here.
- // Images are stored in directory called temp in the user installation directory. Next version of OO/SO
- // hopefully will address this issue and allow a choice e.g. images for controls to be stored as links
- // or embeded in the document.
--
--// [out]location path to the stream to where the image is to be stored,
--// if same name exists in folder then this function calcuates a new name
--// [in] data raw bytes of image to be stored.
--// [in] dataLen no. byte to be stored
--//
--// returns, true if successful
--
--bool storePictureInFileSystem( OUString& location, sal_uInt8* data, sal_uInt32 dataLen )
--{
-- bool result = true;
-- OUString origPath = location;
-- try
-- {
-- uno::Reference<lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(),
-- uno::UNO_QUERY_THROW );
-- uno::Reference< com::sun::star::ucb::XSimpleFileAccess> xSFA( xMSF->createInstance(
-- S2U("com.sun.star.ucb.SimpleFileAccess" ) ),
-- uno::UNO_QUERY_THROW );
-- OUString ext;
-- sal_Int32 index = 0;
-- while ( xSFA->exists( location ) )
-- {
-- ext = OUString::valueOf( ++index );
-- location = origPath + ext;
-- }
--
-- SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( location, STREAM_WRITE | STREAM_TRUNC );
-- if ( pStream )
-- {
-- pStream->Write(data, dataLen);
-- delete pStream;
-- }
-- else
-- {
-- result = false;
-- }
-- }
-- catch( uno::Exception& )
-- {
-- result = false;
-- }
-- return result;
-+uno::Reference< graphic::XGraphicObject> lcl_readGraphicObject( SotStorageStream *pS )
-+{
-+ uno::Reference< graphic::XGraphicObject > xGrfObj;
-+ uno::Reference< lang::XMultiServiceFactory > xServiceManager = ::comphelper::getProcessServiceFactory();
-+ if( xServiceManager.is() )
-+ {
-+ try
-+ {
-+ // use the GraphicProvider service to get the XGraphic
-+ uno::Reference< graphic::XGraphicProvider > xGraphProvider(
-+ xServiceManager->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.graphic.GraphicProvider" ) ), uno::UNO_QUERY );
-+ if( xGraphProvider.is() )
-+ {
-+ uno::Reference< io::XInputStream > xStream( new utl::OInputStreamWrapper( *pS ) );
-+ if( xStream.is() )
-+ {
-+ uno::Sequence< beans::PropertyValue > aMediaProps( 1 );
-+ aMediaProps[0].Name = ::rtl::OUString::createFromAscii( "InputStream" );
-+ aMediaProps[0].Value <<= xStream;
-+ uno::Reference< graphic::XGraphic > xGraphic = xGraphProvider->queryGraphic( aMediaProps );
-+ if( xGraphic.is() )
-+ {
-+ // create an XGraphicObject
-+ ::comphelper::ComponentContext aContext( xServiceManager );
-+ xGrfObj = graphic::GraphicObject::create( aContext.getUNOContext() );
-+ xGrfObj->setGraphic(xGraphic);
-+ }
-+ }
-+ }
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+ }
-+ return xGrfObj;
- }
-
--// NP - Images in controls in OO2.0/SO8 exist as links, e.g. they are not part of the document so are
--// referenced externally. On import from ms document try to save images from controls here so this
--// at least a macro programmer has a chance to accessed them manually later. Next version of OO/SO
--// hopefully will address this issue.
--// Images will be stored in a top level folder in the document package, folder is named "MigratedImages"
--
--// [in] pDocSh* the document shell.
--// [in] name name of stream image to stored in.
--// [in] data raw bytes of image to be stored.
--// [in] dataLen no. byte to be stored
--
--bool storePictureInDoc( SfxObjectShell* pDocSh, OUString& name, sal_uInt8* data, sal_uInt32 dataLen )
--{
-- uno::Reference < embed::XStorage > xStor;
-- if (pDocSh)
-- {
-- xStor = pDocSh->GetStorage();
-- if( xStor.is() )
-- {
-- try
-- {
-- uno::Reference< embed::XStorage > xPictures = xStor->openStorageElement(
-- OUString( RTL_CONSTASCII_USTRINGPARAM( "MigratedImages" ) ),
-- embed::ElementModes::READWRITE );
-- uno::Reference< beans::XPropertySet > xPropSet( xPictures, uno::UNO_QUERY );
--
-- // Set media type of folder MigratedImages to something ( that is unknown ) so that
-- // it will get copied to exported OO/SO format after SaveAs
-- if ( xPropSet.is() )
-- {
-- OUString aMediaType = C2U("MigrationImages");
-- uno::Any a;
-- a <<= aMediaType;
-- xPropSet->setPropertyValue( C2U("MediaType"), a );
-- }
--
-- uno::Reference< io::XStream > xObjReplStr = xPictures->openStreamElement(
-- name,
-- embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE );
-- uno::Reference< io::XOutputStream > xOutStream( xObjReplStr->getOutputStream(), uno::UNO_QUERY_THROW );
-- uno::Sequence< sal_Int8 > imageBytes( (sal_Int8*)data, dataLen );
-- xOutStream->writeBytes( imageBytes );
-- xOutStream->closeOutput();
--
-- uno::Reference< embed::XTransactedObject > xTransact( xPictures, uno::UNO_QUERY );
-- if ( xTransact.is() )
-- {
-- xTransact->commit();
-- }
-- }
-- catch( uno::Exception& )
-- {
-- return false;
-- }
--
-- }
-- else
-- {
-- // no storage something wrong
-- return false;
-- }
-- }
-- else
-- {
-- //No doc shell
-- return false;
-- }
-- return true;
--}
-
- long WriteAlign(SvStorageStream *pS, int nAmount)
- {
-@@ -395,35 +337,11 @@ void lclReadCharArray( SvStorageStream& rStrm, char*& rpcCharArr, sal_uInt32 nLe
- */
- OUString lclCreateOUString( const char* pcCharArr, sal_uInt32 nLenFld )
- {
-- OUStringBuffer aBuffer;
- sal_uInt32 nBufSize = lclGetBufferSize( nLenFld );
- if( lclIsCompressed( nLenFld ) )
-- {
-- // buffer contains compressed Unicode, not encoded bytestring
-- sal_Int32 nStrLen = static_cast< sal_Int32 >( nBufSize );
-- aBuffer.setLength( nStrLen );
-- const char* pcCurrChar = pcCharArr;
-- for( sal_Int32 nChar = 0; nChar < nStrLen; ++nChar, ++pcCurrChar )
-- /* *pcCurrChar may contain negative values and therefore MUST be
-- casted to unsigned char, before assigned to a sal_Unicode. */
-- aBuffer.setCharAt( nChar, static_cast< unsigned char >( *pcCurrChar ) );
-- }
-- else
-- {
-- // buffer contains Little-Endian Unicode
-- sal_Int32 nStrLen = static_cast< sal_Int32 >( nBufSize ) / 2;
-- aBuffer.setLength( nStrLen );
-- const char* pcCurrChar = pcCharArr;
-- for( sal_Int32 nChar = 0; nChar < nStrLen; ++nChar )
-- {
-- /* *pcCurrChar may contain negative values and therefore MUST be
-- casted to unsigned char, before assigned to a sal_Unicode. */
-- sal_Unicode cChar = static_cast< unsigned char >( *pcCurrChar++ );
-- cChar |= (static_cast< unsigned char >( *pcCurrChar++ ) << 8);
-- aBuffer.setCharAt( nChar, cChar );
-- }
-- }
-- return aBuffer.makeStringAndClear();
-+ return svt::BinFilterUtils::CreateOUStringFromStringArray( pcCharArr, nBufSize );
-+
-+ return svt::BinFilterUtils::CreateOUStringFromUniStringArray( pcCharArr, nBufSize );
- }
-
- // export ---------------------------------------------------------------------
-@@ -543,8 +461,129 @@ const sal_uInt16 TOGGLEBUTTON = (sal_uInt16)0x1C;
- const sal_uInt16 SCROLLBAR = (sal_uInt16)0x2F;
-
- const sal_uInt16 MULTIPAGE = (sal_uInt16)0x39;
-+// The IDs with bit 0x8000 set appear to be generated.
-+// It looks like these ID's are used with the non-toolbox [1]
-+// ActiveX controls that can be present in a Userform
-+// ( note: RefEdit seems to be an exception )
-+// In UserForm::Read just before the Container record starts
-+// you will notice there can be sometimes trailing records,
-+// it seems that these records have a 1:1 relationship with the non-toolbox
-+// controls present in the Userform. An id in the trailing record
-+// seems to identify the specific ActiveX control and an artificial nTypeIdent
-+// e.g. 0x8000, 0x8001 etc. is created so as to be able to associate
-+// the ActiveX control when referenced later
-+// [1] Such ActiveX controls are added via Tools/AddionalControls
-+// menu
-+
-+// create a fixed set of those special id(s)
-+// ahem, we can only read one Progress bars at the moment so....
- const sal_uInt16 PROGRESSBAR = (sal_uInt16)0x8000;
-
-+// A set of IDs from the trailing records mentioned above that seem to
-+// identify the following ActiveX controls
-+// Currently we only can process ( in a limited way ) the ProgressBar
-+// the other ID's are for reference ( & future )
-+
-+// RefEdit control {00024512-0000-0000-c000-000000000046}
-+const sal_uInt8 aRefEditID[] =
-+{
-+0x12, 0x45, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46,
-+};
-+
-+// Microsoft ProgressBar Control, version 6.0 {35053A22-8589-11D1-B16A-00C0F0283628}
-+const sal_uInt8 aProgressID[] =
-+{
-+0x22, 0x3a, 0x05, 0x35, 0x89, 0x85, 0xd1, 0x11, 0xb1, 0x6a, 0x00, 0xc0, 0xf0, 0x28, 0x36, 0x28,
-+};
-+
-+// Calendar Control 10.0
-+const sal_uInt8 aCalendarID[] =
-+{
-+0x2b, 0xc9, 0x27, 0x8e, 0x64, 0x12, 0x1c, 0x10, 0x8a, 0x2f, 0x04, 0x02, 0x24, 0x00, 0x9c, 0x02,
-+};
-+
-+
-+// Microsoft ImageComboxBox Control, version 6.0 {DD9DA666-8594-11D1-B16A-00C0F0283628}
-+const sal_uInt8 aImageComboID[] =
-+{
-+0x66, 0xa6, 0x9d, 0xdd, 0x94, 0x85, 0xd1, 0x11, 0xb1, 0x6a, 0x00, 0xc0, 0xf0, 0x28, 0x36, 0x28,
-+};
-+
-+// Microsoft ImageList Control, version 6.0 {2C247F23-8591-11D1-B16A-00C0F0283628}
-+const sal_uInt8 aImageListID[] =
-+{
-+0x23, 0x7f, 0x24, 0x2c, 0x91, 0x85, 0xd1, 0x11, 0xb1, 0x6a, 0x00, 0xc0, 0xf0, 0x28, 0x36, 0x28,
-+};
-+
-+// Microsoft Slider Control, version 6.0 {F08DF954-8592-11D1-B16A-00C0F0283628}
-+const sal_uInt8 aSliderID[] =
-+{
-+0x54, 0xf9, 0x8d, 0xf0, 0x92, 0x85, 0xd1, 0x11, 0xb1, 0x6a, 0x00, 0xc0, 0xf0, 0x28, 0x36, 0x28,
-+};
-+
-+// Microsoft StatusBar Control, version 6.0 {8E3867A3-8586-11D1-B16A-00C0F0283628}
-+const sal_uInt8 aStatusBarID[] =
-+{
-+0xa3, 0x67, 0x38, 0x8e, 0x86, 0x85, 0xd1, 0x11, 0xb1, 0x6a, 0x00, 0xc0, 0xf0, 0x28, 0x36, 0x28,
-+};
-+
-+// Microsoft Office Chart 10.0
-+const sal_uInt8 aChartSpaceID[] =
-+{
-+0x46, 0xe5, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46,
-+};
-+
-+const sal_Int16 ActiveXIDLen = 0x10; // CLSID len
-+const sal_Int16 ActiveXIDBlockLen = 0x30; // the block len that contains the CLSID
-+
-+bool lcl_handleActiveXControl( SvStorageStream *pS, sal_uInt16& nTypeID )
-+{
-+ nTypeID = 0; // Illegal ActiveX ID
-+ bool bRes = false;
-+ sal_uInt16 nIdentifier, nFixedAreaLen;
-+ *pS >> nIdentifier;
-+ *pS >> nFixedAreaLen;
-+ pS->SeekRel( ( nFixedAreaLen - ActiveXIDBlockLen ) );
-+ sal_uInt8 aID[ ActiveXIDLen ];
-+ if ( !pS->IsEof() )
-+ {
-+ pS->Read( aID, ActiveXIDLen );
-+ pS->SeekRel( ActiveXIDBlockLen - ActiveXIDLen ); // read remainer of record
-+ if ( memcmp( aID, aProgressID, ActiveXIDLen ) == 0 )
-+ {
-+ nTypeID = PROGRESSBAR;
-+ OSL_TRACE("Found supported ***PROGRESSBAR*** ActiveX control");
-+ bRes = true;
-+ }
-+#if (OSL_DEBUG_LEVEL > 0)
-+ // If we really want to process these more controls we should put them in
-+ // a list or array and have a single loop testing each id. For the moment
-+ // as we only can process PROGRESSBAR, not much point doing that until
-+ // we add support for at least another activex control
-+
-+ else if ( memcmp( aID, aCalendarID, ActiveXIDLen ) == 0 )
-+ OSL_TRACE("Found unsupported ***CALENDAR*** ActiveX control");
-+ else if ( memcmp( aID, aRefEditID, ActiveXIDLen ) == 0 )
-+ OSL_TRACE("Found unsupported ***REFEDIT*** ActiveX control");
-+ else if ( memcmp( aID, aImageComboID, ActiveXIDLen ) == 0 )
-+ OSL_TRACE("Found unsupported ***IMAGECOMBO*** ActiveX control");
-+ else if ( memcmp( aID, aImageListID, ActiveXIDLen ) == 0 )
-+ OSL_TRACE("Found unsupported ***IMAGELIST*** ActiveX control");
-+ else if ( memcmp( aID, aChartSpaceID, ActiveXIDLen ) == 0 )
-+ OSL_TRACE("Found unsupported ***CHARTSPACE*** ActiveX control");
-+ else if ( memcmp( aID, aSliderID, ActiveXIDLen ) == 0 )
-+ OSL_TRACE("Found unsupported ***SLIDER*** ActiveX control");
-+ else if ( memcmp( aID, aStatusBarID, ActiveXIDLen ) == 0 )
-+ OSL_TRACE("Found unsupported ***STATUSBAR*** ActiveX control");
-+#endif
-+ else
-+ {
-+ OSL_TRACE("Unknown activeX ID !");
-+ }
-+ }
-+ return bRes;
-+}
-+
- typedef std::vector< ContainerRecord > ContainerRecordList;
-
- class ContainerRecReader
-@@ -619,6 +658,8 @@ class ContainerRecReader
- // control type
- if( nContentFlags & 0x00000080 )
- *pS >> rec.nTypeIdent;
-+ if( nContentFlags & 0x00000200 )
-+ pS->SeekRel( 4 ); // Grouping?
- // length of infotip
- sal_uInt32 nTipLen = 0;
- if( nContentFlags & 0x00000800 )
-@@ -693,14 +734,22 @@ class ContainerRecReader
- if( nCtrlSrcBufSize > 0 )
- {
- ReadAlign( pS, pS->Tell() - nStartPos, 4 );
-- pS->SeekRel( nCtrlSrcBufSize );
-+ std::auto_ptr< sal_Char > pCtrlSrcName;
-+ pCtrlSrcName.reset( new sal_Char[ nCtrlSrcBufSize ] );
-+ pS->Read( pCtrlSrcName.get(), nCtrlSrcBufSize );
-+ rec.sCtrlSource = lclCreateOUString( pCtrlSrcName.get(), nCtrlSrcLen );
-+ OSL_TRACE("*** *** *** ControlSourceName -> %s ", rtl::OUStringToOString( rec.sCtrlSource, RTL_TEXTENCODING_UTF8 ).getStr() );
- }
- // row source name
- sal_uInt32 nRowSrcBufSize = lclGetBufferSize( nRowSrcLen );
- if( nRowSrcBufSize > 0 )
- {
- ReadAlign( pS, pS->Tell() - nStartPos, 4 );
-- pS->SeekRel( nRowSrcBufSize );
-+ std::auto_ptr< sal_Char > pRowSrcName;
-+ pRowSrcName.reset( new sal_Char[ nRowSrcBufSize ] );
-+ pS->Read( pRowSrcName.get(), nRowSrcBufSize );
-+ rec.sRowSource = lclCreateOUString( pRowSrcName.get(), nRowSrcLen );
-+ OSL_TRACE("*** *** *** RowSourceName -> %s ", rtl::OUStringToOString( rec.sRowSource, RTL_TEXTENCODING_UTF8 ).getStr() );
- }
-
- // seek to end of data
-@@ -717,6 +766,13 @@ class ContainerRecReader
- pControl->pDocSh = pContainerControl->pDocSh;
- pContainerControl->ProcessControl( pControl, pS, rec );
- }
-+ else if ( rec.nTypeIdent & 0x8000 )
-+ {
-+ // Skip ActiveX Controls we can't import
-+ SotStorageStreamRef oStream = pContainerControl->getContainedControlsStream();
-+ ULONG nStrmPos = oStream->Tell();
-+ oStream->Seek( nStrmPos + rec.nSubStreamLen );
-+ }
- else
- {
- DBG_ERROR("Terminating import, unexpected error");
-@@ -737,6 +793,11 @@ class ContainerRecReader
- {
- sal_uInt8 aUnknown11[4];
- pS->Read(aUnknown11, sizeof(aUnknown11));
-+ // discovered a dialog with value of 0xFF for aUnknown11
-+ // needed an extra 4 bytes to offset correctly into the control
-+ // records. Valid test or coincidence ?
-+ if ( aUnknown11[1] == 0xFF )
-+ pS->Read( aUnknown11, sizeof(aUnknown11));
- return true;
- }
-
-@@ -811,176 +872,6 @@ class ContainerRecordReaderFac
-
- // ============================================================================
-
--void RBGroup::add(OCX_Control* pRB)
--{
-- // The tab index for the group is calculated as
-- // the lowest tab index found in the list of RadioButtons
-- if ( pRB->mnTabPos < mRBGroupPos )
-- {
-- mRBGroupPos = pRB->mnTabPos;
-- CtrlIterator aEnd = mpControls.end();
-- for (CtrlIterator aIter = mpControls.begin(); aIter != aEnd; ++ aIter )
-- {
-- (*aIter)->mnTabPos = mRBGroupPos;
-- }
-- }
-- mpControls.push_back( pRB );
--}
--
--struct SortGroupByTabPos
--{
-- bool operator()( const RBGroup* a, const RBGroup* b )
-- {
-- return a->tabPos() < b->tabPos();
-- }
--};
--
--RBGroupManager::RBGroupManager( String& defaultName ):mSDefaultName( defaultName ),
-- numRadioButtons(0)
--{
-- groupList.reserve( 8 ); // reserve far more than we expect
--}
--
--RBGroupManager::~RBGroupManager()
--{
-- for ( GroupIterator gIter=groupList.begin(); gIter!=groupList.end(); ++gIter )
-- {
-- delete( *gIter );
-- }
--}
--
--// Loose description of the method below ( I sure there is a better way to do
--// this )
--// In order to "fake" MS grouping behavior for OptionButtons the OptionButtons
--// in the same group need to have consecutive tab indices ( regardless of the
--// imported tab indices of the RadioButtons ). Additionally if two
--// groups of OptionButtons end up having all consecutive indices they
--// will be treated as a single group by OpenOffice. In this case
--// a dummy seperator control needs to be inserted between the groups.
--//
--// This method returns a new list "destinationList" containing the controls
--// passed in "sourceList" and the OptionButtons contained in the various
--// Groups maintained by this class.
--// Controls are ordered in the destination list by tab index.
--// Each RadioButtonGroup has a tab index associated with it.
--// ( Tab index of a RadioGroup is determined as the tab index of the
--// OptionButton control with the lowest tab index in the group )
--
--
--void RBGroupManager::addRadioButton( OCX_OptionButton* pRButton )
--{
-- if ( pRButton )
-- {
-- OUString groupName = mSDefaultName;
-- if ( pRButton->nGroupNameLen )
-- {
-- groupName =
-- lclCreateOUString(pRButton->pGroupName,
-- pRButton->nGroupNameLen);
-- }
-- ++numRadioButtons;
-- RBGroupHash::iterator iter = rbGroups.find( groupName );
-- if ( iter != rbGroups.end() )
-- {
-- iter->second->controls().push_back( pRButton );
-- }
-- else
-- {
-- RBGroup* newGroup = new RBGroup(pRButton->mnTabPos);
-- newGroup->controls().push_back( pRButton );
-- rbGroups[ groupName ] = newGroup;
-- groupList.push_back( newGroup );
-- }
--
-- }
--}
--
--CtrlList RBGroupManager::insertGroupsIntoControlList( const CtrlList& sourceList )
--{
-- ::std::sort( groupList.begin(), groupList.end(), SortGroupByTabPos() );
-- std::vector<OCX_Control*> destinationList;
-- if ( groupList.size() )
-- {
-- destinationList.reserve( sourceList.size() + numRadioButtons );
--
-- GroupIterator groupEnd = groupList.end();
-- CtrlIteratorConst sourceEnd = sourceList.end();
--
-- size_t prevGroupListSize = 0;
--
-- CtrlIteratorConst containees = sourceList.begin();
-- GroupIterator groupIter=groupList.begin();
-- while ( containees != sourceEnd ||
-- groupIter != groupEnd )
-- {
-- bool addGroupSeperator = false;
-- if ( containees != sourceEnd )
-- {
-- if ( groupIter != groupEnd )
-- {
-- sal_Int16 groupTabPos = (*groupIter)->tabPos();
-- if ( (*containees)->mnTabPos >= groupTabPos )
-- {
-- if ( !(destinationList.size() >= prevGroupListSize ))
-- {
-- addGroupSeperator = true;
-- }
-- copyList( (*groupIter)->controls(), destinationList, addGroupSeperator );
-- ++groupIter;
--
-- prevGroupListSize = destinationList.size();
-- }
-- }
-- destinationList.push_back(*containees);
-- ++containees;
-- }
-- else
-- {
-- if ( groupIter != groupEnd )
-- {
-- if ( !(destinationList.size() > prevGroupListSize ))
-- {
-- addGroupSeperator = true;
-- }
-- copyList( (*groupIter)->controls(), destinationList, addGroupSeperator );
-- ++groupIter;
-- prevGroupListSize = destinationList.size();
-- }
-- }
-- }
-- }
-- else
-- {
-- destinationList = sourceList;
-- }
-- return destinationList;
--
--}
--
--
--void RBGroupManager::addSeperator( std::vector< OCX_Control* >& dest )
--{
-- OCX_Control* seperator = new OCX_CommandButton;
-- seperator->SetInDialog(true);
-- seperator->sName = C2S("GroupSeperator");
-- dest.push_back( seperator );
--}
--
--void RBGroupManager::copyList( std::vector< OCX_Control* >& src,
-- std::vector< OCX_Control* >& dest,
-- bool addGroupSeperator )
--{
-- if ( addGroupSeperator )
-- {
-- addSeperator( dest );
-- }
--
-- for ( CtrlIterator rbIter = src.begin(); rbIter != src.end(); ++rbIter )
-- {
-- dest.push_back( *rbIter );
-- }
--}
--
- class OCX_UserFormLabel : public OCX_Label
- {
- public:
-@@ -1147,6 +1038,9 @@ sal_Bool OCX_Control::Import(
- sal_Bool OCX_Control::Import(uno::Reference<container::XNameContainer> &rDialog
- )
- {
-+ uno::Reference<beans::XPropertySet > xDlgProps( rDialog, uno::UNO_QUERY);
-+
-+
- uno::Reference<lang::XMultiServiceFactory>
- xFactory(rDialog, uno::UNO_QUERY);
-
-@@ -1159,11 +1053,15 @@ sal_Bool OCX_Control::Import(uno::Reference<container::XNameContainer> &rDialog
- if (!xModel.is())
- return sal_False;
-
-+ sal_Bool bVBA = sal_False;
- /* #147900# sometimes insertion of a control fails due to existing name,
- do not break entire form import then... */
- try
- {
- rDialog->insertByName(sName, uno::makeAny(xModel));
-+ if ( xDlgProps.is() )
-+ xDlgProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("VBAForm") ) ) >>= bVBA;
-+
- }
- catch( uno::Exception& )
- {
-@@ -1179,16 +1077,31 @@ sal_Bool OCX_Control::Import(uno::Reference<container::XNameContainer> &rDialog
-
- if (!Import(xPropSet))
- return sal_False;
--
-+
- uno::Any aTmp;
-- aTmp <<= sal_Int32((mnLeft * 2) / 100);
-- xPropSet->setPropertyValue(WW8_ASCII2STR("PositionX"), aTmp);
-- aTmp <<= sal_Int32((mnTop * 2) / 100);
-- xPropSet->setPropertyValue(WW8_ASCII2STR("PositionY"), aTmp);
-- aTmp <<= sal_Int32((nWidth * 2) / 100);
-- xPropSet->setPropertyValue(WW8_ASCII2STR("Width"), aTmp);
-- aTmp <<= sal_Int32((nHeight * 2) / 100);
-- xPropSet->setPropertyValue(WW8_ASCII2STR("Height"), aTmp);
-+
-+ if ( !bVBA )
-+ {
-+ aTmp <<= sal_Int32((mnLeft * 2) / 100);
-+ xPropSet->setPropertyValue(WW8_ASCII2STR("PositionX"), aTmp);
-+ aTmp <<= sal_Int32((mnTop * 2) / 100);
-+ xPropSet->setPropertyValue(WW8_ASCII2STR("PositionY"), aTmp);
-+ aTmp <<= sal_Int32((nWidth * 2) / 100);
-+ xPropSet->setPropertyValue(WW8_ASCII2STR("Width"), aTmp);
-+ aTmp <<= sal_Int32((nHeight * 2) / 100);
-+ xPropSet->setPropertyValue(WW8_ASCII2STR("Height"), aTmp);
-+ }
-+ else
-+ {
-+ aTmp <<= sal_Int32(mnLeft); // 100thmm
-+ xPropSet->setPropertyValue(WW8_ASCII2STR("PositionX"), aTmp);
-+ aTmp <<= sal_Int32(mnTop); //100th mm
-+ xPropSet->setPropertyValue(WW8_ASCII2STR("PositionY"), aTmp);
-+ aTmp <<= sal_Int32(nWidth); // 100thmm
-+ xPropSet->setPropertyValue(WW8_ASCII2STR("Width"), aTmp);
-+ aTmp <<= sal_Int32(nHeight); //100th mm
-+ xPropSet->setPropertyValue(WW8_ASCII2STR("Height"), aTmp);
-+ }
- if ( msToolTip.Len() > 0 )
- xPropSet->setPropertyValue(WW8_ASCII2STR("HelpText"), uno::Any(OUString(msToolTip)));
-
-@@ -1403,6 +1316,12 @@ sal_Bool OCX_CommandButton::Import( com::sun::star::uno::Reference<
- rPropSet->setPropertyValue( WW8_ASCII2STR( "FocusOnClick" ), aTmp );
-
- aFontData.Import(rPropSet);
-+
-+ if ( sImageUrl.getLength() )
-+ {
-+ aTmp <<= sImageUrl;
-+ rPropSet->setPropertyValue( WW8_ASCII2STR("ImageURL"), aTmp);
-+ }
- return sal_True;
- }
-
-@@ -1650,6 +1569,99 @@ sal_Bool OCX_ImageButton::Export(SvStorageRef &rObj,
- return WriteContents(xContents,rPropSet,rSize);
- }
-
-+bool lcl_isNamedRange( const rtl::OUString& sAddress, uno::Reference< frame::XModel >& xModel, table::CellRangeAddress& aAddress )
-+{
-+ bool bRes = false;
-+ const static rtl::OUString sNamedRanges( RTL_CONSTASCII_USTRINGPARAM("NamedRanges"));
-+ uno::Reference< sheet::XCellRangeReferrer > xReferrer;
-+ try
-+ {
-+ uno::Reference< beans::XPropertySet > xPropSet( xModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XNameAccess > xNamed( xPropSet->getPropertyValue( sNamedRanges ), uno::UNO_QUERY_THROW );
-+ xReferrer.set ( xNamed->getByName( sAddress ), uno::UNO_QUERY );
-+ }
-+ catch( uno::Exception& /*e*/ )
-+ {
-+ // do nothing
-+ }
-+ if ( xReferrer.is() )
-+ {
-+ uno::Reference< sheet::XCellRangeAddressable > xRangeAddressable( xReferrer->getReferredCells(), uno::UNO_QUERY );
-+ if ( xRangeAddressable.is() )
-+ {
-+ aAddress = xRangeAddressable->getRangeAddress();
-+ bRes = true;
-+ }
-+ }
-+ return bRes;
-+}
-+
-+void lcl_ApplyListSourceAndBindableStuff( uno::Reference< frame::XModel >& xModel, const uno::Reference< beans::XPropertySet >& rPropSet, const rtl::OUString& rsCtrlSource, const rtl::OUString& rsRowSource )
-+{
-+// XBindable etc.
-+ uno::Reference< lang::XMultiServiceFactory > xFac;
-+ if ( xModel.is() )
-+ xFac.set( xModel, uno::UNO_QUERY );
-+ uno::Reference< form::binding::XBindableValue > xBindable( rPropSet, uno::UNO_QUERY );
-+ if ( xFac.is() && rsCtrlSource.getLength() && xBindable.is() )
-+ {
-+
-+ // OOo address structures
-+ // RefCell - convert from XL
-+ // pretend we converted the imported string address into the
-+ // appropriate address structure
-+ uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( C2U( "com.sun.star.table.CellAddressConversion" )), uno::UNO_QUERY );
-+ table::CellAddress aAddress;
-+ if ( xConvertor.is() )
-+ {
-+ // we need this service to properly convert XL notation also
-+ // Should be easy to extend
-+ xConvertor->setPropertyValue( C2U( "XL_A1_Representation" ), uno::makeAny( rsCtrlSource ) );
-+ xConvertor->getPropertyValue( C2U( "Address" ) ) >>= aAddress;
-+ }
-+
-+ beans::NamedValue aArg1;
-+ aArg1.Name = C2U("BoundCell");
-+ aArg1.Value <<= aAddress;
-+
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[ 0 ] <<= aArg1;
-+
-+ uno::Reference< form::binding::XValueBinding > xBinding( xFac->createInstanceWithArguments( C2U("com.sun.star.table.CellValueBinding" ), aArgs ), uno::UNO_QUERY );
-+ xBindable->setValueBinding( xBinding );
-+ }
-+ uno::Reference< form::binding::XListEntrySink > xListEntrySink( rPropSet, uno::UNO_QUERY );
-+ if ( xFac.is() && rsRowSource.getLength() && xListEntrySink.is() )
-+ {
-+
-+ // OOo address structures
-+ // RefCell - convert from XL
-+ // pretend we converted the imported string address into the
-+ // appropriate address structure
-+ uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( C2U( "com.sun.star.table.CellRangeAddressConversion" )), uno::UNO_QUERY );
-+ table::CellRangeAddress aAddress;
-+ if ( xConvertor.is() )
-+ {
-+ if ( !lcl_isNamedRange( rsRowSource, xModel, aAddress ) )
-+ {
-+ // we need this service to properly convert XL notation also
-+ // Should be easy to extend
-+ xConvertor->setPropertyValue( C2U( "XL_A1_Representation" ), uno::makeAny( rsRowSource ) );
-+ xConvertor->getPropertyValue( C2U( "Address" ) ) >>= aAddress;
-+ }
-+ }
-+
-+ beans::NamedValue aArg1;
-+ aArg1.Name = C2U("CellRange");
-+ aArg1.Value <<= aAddress;
-+
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[ 0 ] <<= aArg1;
-+
-+ uno::Reference< form::binding::XListEntrySource > xSource( xFac->createInstanceWithArguments( C2U("com.sun.star.table.CellRangeListSource" ), aArgs ), uno::UNO_QUERY );
-+ xListEntrySink->setListEntrySource( xSource );
-+ }
-+}
-
- sal_Bool OCX_OptionButton::Import(com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet> &rPropSet)
-@@ -1682,12 +1694,51 @@ sal_Bool OCX_OptionButton::Import(com::sun::star::uno::Reference<
- aTmp <<= ImportSpecEffect( nSpecialEffect );
- rPropSet->setPropertyValue( WW8_ASCII2STR("VisualEffect"), aTmp);
-
-- if (pValue && !bSetInDialog)
-+ if (pValue)
- {
- INT16 nTmp = pValue[0]-0x30;
- aTmp <<= nTmp;
-- rPropSet->setPropertyValue( WW8_ASCII2STR("DefaultState"), aTmp);
-- }
-+ if (!bSetInDialog)
-+ rPropSet->setPropertyValue( WW8_ASCII2STR("DefaultState"), aTmp);
-+ else
-+ {
-+ // dialog ( but we might be using the form model )
-+ if ( rPropSet->getPropertySetInfo()->hasPropertyByName( WW8_ASCII2STR("DefaultState") ) )
-+ rPropSet->setPropertyValue( WW8_ASCII2STR("DefaultState"), aTmp);
-+ else
-+ rPropSet->setPropertyValue( WW8_ASCII2STR("State"), aTmp);
-+ }
-+ }
-+ // If this is a dialog control then we need to set a groupname *always*
-+ rtl::OUString sGroupName = lclCreateOUString( pGroupName, nGroupNameLen );
-+ if ( GetInDialog() ) // Userform/Dialog
-+ {
-+ // By default groupnames are not set in Excel, it's not unusual to have
-+ // a number of groups of radiobuttons located inside frame ( or other container
-+ // controls ) where there is *no* specific groupname set for the radiobuttons.
-+ // But... there is implicit grouping for radio buttons in seperate containers
-+ // e.g. radio buttons in a frame are by default in the same group.
-+ // Unfortunately in openoffice there are no containers below the dialog itself :-(
-+ // To ensure correct grouping for imported radiobuttons either with no groupname
-+ // or identical groupnames that are in separate containers we *must* ensure
-+ // that a suitable groupname is applied.
-+ // Because controlNames are unique even across different containers we can use the
-+ // controls container (e.g. parent) name as a prefix for a group name
-+ rtl::OUString sParentName = msParentName;
-+ sGroupName = sParentName.concat( C2U( ":" ) ).concat( sGroupName );
-+ }
-+ if ( sGroupName.getLength() == 0 )
-+ sGroupName = rtl::OUString::createFromAscii("DefaultGroup");
-+ OSL_TRACE("RadioButton %s has groupname %s",
-+ rtl::OUStringToOString( sName, RTL_TEXTENCODING_UTF8 ).getStr(), rtl::OUStringToOString( sGroupName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ try
-+ {
-+ aTmp <<= sGroupName;
-+ rPropSet->setPropertyValue( WW8_ASCII2STR("GroupName"), aTmp);
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-
- if (pCaption)
- {
-@@ -1699,6 +1750,14 @@ sal_Bool OCX_OptionButton::Import(com::sun::star::uno::Reference<
- aTmp <<= ::com::sun::star::style::VerticalAlignment_MIDDLE;
- rPropSet->setPropertyValue( WW8_ASCII2STR("VerticalAlign"), aTmp );
-
-+ uno::Reference< frame::XModel > xModel ( pDocSh ? pDocSh->GetModel() : NULL );
-+ lcl_ApplyListSourceAndBindableStuff( xModel, rPropSet, msCtrlSource, msRowSource );
-+ if ( sImageUrl.getLength() )
-+ {
-+ aTmp <<= sImageUrl;
-+ rPropSet->setPropertyValue( WW8_ASCII2STR("ImageURL"), aTmp);
-+ }
-+
- aFontData.Import(rPropSet);
- return sal_True;
- }
-@@ -2323,8 +2382,9 @@ sal_Bool OCX_ToggleButton::Import(com::sun::star::uno::Reference<
- if (pValue)
- {
- INT16 nTmp=pValue[0]-0x30;
-- aTmp <<= nTmp == 1;
-- rPropSet->setPropertyValue( WW8_ASCII2STR("DefaultState"), aTmp);
-+ //aTmp <<= nTmp == 1;
-+ aTmp <<= nTmp;
-+ rPropSet->setPropertyValue( WW8_ASCII2STR("State"), aTmp);
- }
-
- if (pCaption)
-@@ -2334,6 +2394,12 @@ sal_Bool OCX_ToggleButton::Import(com::sun::star::uno::Reference<
- }
-
- aFontData.Import(rPropSet);
-+
-+ if ( sImageUrl.getLength() )
-+ {
-+ aTmp <<= sImageUrl;
-+ rPropSet->setPropertyValue( WW8_ASCII2STR("ImageURL"), aTmp);
-+ }
- return sal_True;
- }
-
-@@ -2589,6 +2655,8 @@ sal_Bool OCX_ComboBox::Import(com::sun::star::uno::Reference<
- rPropSet->setPropertyValue( WW8_ASCII2STR("MaxTextLen"), aTmp);
-
- aFontData.Import(rPropSet);
-+ uno::Reference< frame::XModel > xModel ( pDocSh ? pDocSh->GetModel() : NULL );
-+ lcl_ApplyListSourceAndBindableStuff( xModel, rPropSet, msCtrlSource, msRowSource );
- return sal_True;
- }
-
-@@ -2808,7 +2876,8 @@ sal_Bool OCX_ListBox::Import(com::sun::star::uno::Reference<
-
- aTmp <<= ImportColor( nBorderColor );
- rPropSet->setPropertyValue( WW8_ASCII2STR("BorderColor"), aTmp);
--
-+ uno::Reference< frame::XModel > xModel ( pDocSh ? pDocSh->GetModel() : NULL );
-+ lcl_ApplyListSourceAndBindableStuff( xModel, rPropSet, msCtrlSource, msRowSource );
- aFontData.Import(rPropSet);
- return sal_True;
- }
-@@ -3186,8 +3255,15 @@ sal_Bool OCX_ModernControl::Read(SvStorageStream *pS)
- {
- pS->Read(pPictureHeader,20);
- *pS >> nPictureLen;
-- pPicture = new sal_uInt8[nPictureLen];
-- pS->Read(pPicture,nPictureLen);
-+ long imagePos = pS->Tell();
-+ mxGrfObj = lcl_readGraphicObject( pS );
-+ if( mxGrfObj.is() )
-+ {
-+ sImageUrl = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( GRAPHOBJ_URLPREFIX ) );
-+ sImageUrl = sImageUrl + mxGrfObj->getUniqueID();
-+ }
-+ // make sure the stream position should be pointing after the image
-+ pS->Seek( imagePos + nPictureLen );
- }
-
- return sal_True;
-@@ -3277,8 +3353,15 @@ sal_Bool OCX_CommandButton::Read(SvStorageStream *pS)
- {
- pS->Read(pPictureHeader,20);
- *pS >> nPictureLen;
-- pPicture = new sal_uInt8[nPictureLen];
-- pS->Read(pPicture,nPictureLen);
-+ long imagePos = pS->Tell();
-+ mxGrfObj = lcl_readGraphicObject( pS );
-+ if( mxGrfObj.is() )
-+ {
-+ sImageUrl = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( GRAPHOBJ_URLPREFIX ) );
-+ sImageUrl = sImageUrl + mxGrfObj->getUniqueID();
-+ }
-+ // make sure the stream position should be pointing after the image
-+ pS->Seek( imagePos + nPictureLen );
- }
-
- return sal_True;
-@@ -3399,7 +3482,7 @@ OCX_ContainerControl::OCX_ContainerControl( SotStorageRef& parent,
- const ::rtl::OUString& sN,
- const uno::Reference< container::XNameContainer > &rParent,
- OCX_Control* pParent ) :
-- OCX_Control(sN, pParent), rbGroupMgr( sName ), mxParent(rParent), nNoRecords(0), nTotalLen(0), containerType( STDCONTAINER )
-+ OCX_Control(sN, pParent), mxParent(rParent), nNoRecords(0), nTotalLen(0), containerType( STDCONTAINER )
- {
-
- mContainerStorage = parent->OpenSotStorage(storageName,
-@@ -3462,9 +3545,18 @@ OUString OCX_ContainerControl::createSubStreamName( const sal_uInt32& subStorage
- return buf.makeStringAndClear();
- }
-
--bool OCX_ContainerControl::createFromContainerRecord( const ContainerRecord& record, OCX_Control*& pControl )
-+
-+bool OCX_ContainerControl::createFromContainerRecord( ContainerRecord& record, OCX_Control*& pControl )
- {
- pControl = NULL;
-+ if ( record.nTypeIdent & 0x8000 )
-+ {
-+ std::hash_map<sal_uInt16, sal_uInt16>::iterator it = mActiveXIDMap.find( record.nTypeIdent );
-+ if ( it == mActiveXIDMap.end() )
-+ return false;
-+ // replace the generated id with our hardcoded one
-+ record.nTypeIdent = it->second;
-+ }
- switch ( record.nTypeIdent)
- {
- case CMDBUTTON:
-@@ -3572,8 +3664,7 @@ void OCX_ContainerControl::ProcessControl(OCX_Control* pControl,SvStorageStream*
- SotStorageStreamRef oStream = mContainedControlsStream;
-
- // can insert into OO Dialog (e.g is this a supported dialog control)??
-- if ( rec.nTypeIdent == SPINBUTTON ||
-- rec.nTypeIdent == TABSTRIP)
-+ if ( rec.nTypeIdent == TABSTRIP )
- {
- // skip the record in the stream, discard the control
- oStream->SeekRel( rec.nSubStreamLen );
-@@ -3583,15 +3674,27 @@ void OCX_ContainerControl::ProcessControl(OCX_Control* pControl,SvStorageStream*
- {
- // A container control needs to read the f stream in
- // the folder ( substorage ) associated with this control
-- if ( rec.nTypeIdent == FRAME ||
-- rec.nTypeIdent == MULTIPAGE||
-- rec.nTypeIdent == PAGE )
-+ switch ( rec.nTypeIdent )
- {
-- OCX_ContainerControl* pContainer =
-- static_cast< OCX_ContainerControl* >( pControl );
-- oStream = pContainer->getContainerStream();
-+ case FRAME:
-+ case MULTIPAGE:
-+ case PAGE:
-+ {
-+ OCX_ContainerControl* pContainer =
-+ static_cast< OCX_ContainerControl* >( pControl );
-+ oStream = pContainer->getContainerStream();
-+ break;
-+ }
-+ case LISTBOX:
-+ case OPTIONBUTTON:
-+ case COMBOBOX:
-+ case SPINBUTTON:
-+ case SCROLLBAR:
-+ {
-+ pControl->msCtrlSource = rec.sCtrlSource;
-+ pControl->msRowSource = rec.sRowSource;
-+ }
- }
--
- pControl->sName = rec.cName;
- pControl->msToolTip = rec.controlTip;
- // Position of controls is relative to the container
-@@ -3611,6 +3714,7 @@ void OCX_ContainerControl::ProcessControl(OCX_Control* pControl,SvStorageStream*
- // applied to all containees
- pControl->mnStep = mnStep;
- }
-+ pControl->msParentName = sName;
-
- // #117490# DR: container records provide size of substream, use it here...
-
-@@ -3621,17 +3725,7 @@ void OCX_ContainerControl::ProcessControl(OCX_Control* pControl,SvStorageStream*
- // set stream to position behind substream of this control
- oStream->Seek( nStrmPos + rec.nSubStreamLen );
-
-- //need to fake grouping behaviour for radio ( option ) buttons
-- if ( rec.nTypeIdent == OPTIONBUTTON )
-- {
-- OCX_OptionButton* pRButton =
-- static_cast< OCX_OptionButton*>(pControl);
-- rbGroupMgr.addRadioButton( pRButton );
-- }
-- else
-- {
-- mpControls.push_back( pControl );
-- }
-+ mpControls.push_back( pControl );
- }
- }
-
-@@ -3654,7 +3748,6 @@ sal_Bool OCX_ContainerControl::Read(SvStorageStream *pS)
- // this ensures that the default tab index created by Star/Open office
- // reflects the "flattened" ms tab order.
- ::std::sort( mpControls.begin(), mpControls.end(), SortOrderByTabPos() );
-- mpControls = rbGroupMgr.insertGroupsIntoControlList( mpControls );
- return true;
- }
-
-@@ -3672,7 +3765,8 @@ OCX_MultiPage::OCX_MultiPage( SotStorageRef& parent,
- nScrollWidth(0), nScrollHeight(0), nIconLen(0), pIcon(0), nPictureLen(0),
- pPicture(0)
- {
-- msDialogType = C2U("NotSupported");
-+ //msDialogType = C2U("NotSupported");
-+ msDialogType = C2U("com.sun.star.awt.UnoMultiPageModel");
- mnForeColor = 0x80000012L,
- mnBackColor = 0x8000000FL;
- bSetInDialog = true;// UserForm control only
-@@ -3736,7 +3830,6 @@ sal_Bool OCX_MultiPage::Read(SvStorageStream *pS)
- sal_Bool OCX_MultiPage::Import(com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet> &rPropSet)
- {
-- // Calls import on contained controls
- OCX_ContainerControl::Import( rPropSet );
- return sal_True;
- }
-@@ -3757,6 +3850,43 @@ sal_Bool OCX_MultiPage::Import(com::sun::star::uno::Reference<
-
- if ( xPropSet.is() )
- {
-+ uno::Reference<lang::XMultiServiceFactory>
-+ xFactory(rDialog, uno::UNO_QUERY);
-+ OSL_TRACE("** MultiPage creating control %s", rtl::OUStringToOString( msDialogType, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ uno::Reference<uno::XInterface> xCreate = xFactory->createInstance(msDialogType);
-+ if (!xCreate.is())
-+ return sal_False;
-+
-+ uno::Reference<awt::XControlModel> xModel(xCreate, uno::UNO_QUERY);
-+ if (!xModel.is())
-+ return sal_False;
-+
-+ try
-+ {
-+ // we should just call MultiPage::Import( XPropertySet )
-+ OSL_TRACE("********* MULTIPAGE cName %s", rtl::OUStringToOString( sName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ uno::Any aTmp(&sName,getCppuType((OUString *)0));
-+ uno::Reference<beans::XPropertySet> xPrps(xModel, uno::UNO_QUERY);
-+ xPrps->setPropertyValue( WW8_ASCII2STR("Name"), aTmp );
-+ aTmp = uno::makeAny( mnCurrentPageStep );
-+ xPrps->setPropertyValue( WW8_ASCII2STR("ProgressValueMax"), aTmp );
-+ // default current page to 0 ( #FIXME, we need to read this value )
-+ aTmp = uno::makeAny( sal_Int32(0) );
-+ xPrps->setPropertyValue( WW8_ASCII2STR("ProgressValue"), aTmp );
-+ OSL_TRACE("********* MULTIPAGE vomitted out properties");
-+
-+ // Calls import on contained controls
-+ rDialog->insertByName(sName, uno::makeAny(xModel));
-+ OSL_TRACE("*** inserted ***");
-+ }
-+ catch( uno::Exception& )
-+ {
-+ DBG_ERRORFILE(
-+ ByteString( "OCX_Control::Import - cannot insert control \"" ).
-+ Append( ByteString( sName, RTL_TEXTENCODING_UTF8 ) ).
-+ Append( '"' ).GetBuffer() );
-+ }
-+
- // Calls import on contained pages
- return OCX_ContainerControl::Import( xPropSet );
- }
-@@ -4043,8 +4173,7 @@ OCX_UserForm::OCX_UserForm( SotStorageRef& parent,
- nKeepScrollBarsVisible(3), nCycle(0), nBorderStyle(0), nSpecialEffect(0),
- nPicture(0), nPictureAlignment(2), nPictureSizeMode(0),
- bPictureTiling(FALSE), nAccelerator(0), nIcon(0), pCaption(0),
-- nScrollWidth(0), nScrollHeight(0), nScrollLeft(0), nScrollTop(0), nIconLen(0), pIcon(0), nPictureLen(0),
-- pPicture(0)
-+ nScrollWidth(0), nScrollHeight(0), nScrollLeft(0), nScrollTop(0), nIconLen(0), pIcon(0), nPictureLen(0)
- {
- mnForeColor = 0x80000012;
- mnBackColor = 0x8000000F;
-@@ -4174,24 +4303,30 @@ sal_Bool OCX_UserForm::Read(SvStorageStream *pS)
- pS->Read(pIcon,nIconLen);
- }
-
-+ ReadAlign( pS, pS->Tell() - nStart, 4);
-+ if (pBlockFlags[2] & 0x10)
-+ {
-+ //Font Stuff..
-+ pS->SeekRel(0x1a);
-+ sal_uInt8 nFontLen;
-+ *pS >> nFontLen;
-+ pS->SeekRel(nFontLen);
-+ }
- if (nPicture)
- {
- pS->Read(pPictureHeader,20);
- *pS >> nPictureLen;
-- pPicture = new sal_uInt8[nPictureLen];
-- pS->Read(pPicture,nPictureLen);
-- }
--
-- ReadAlign( pS, pS->Tell() - nStart, 4);
--
-- if (pBlockFlags[2] & 0x10)
-- {
-- //Font Stuff..
-- pS->SeekRel(0x1a);
-- sal_uInt8 nFontLen;
-- *pS >> nFontLen;
-- pS->SeekRel(nFontLen);
-- }
-+ long imagePos = pS->Tell();
-+ // great embedded object
-+ mxGrfObj = lcl_readGraphicObject( pS );
-+ if( mxGrfObj.is() )
-+ {
-+ sImageUrl = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( GRAPHOBJ_URLPREFIX ) );
-+ sImageUrl = sImageUrl + mxGrfObj->getUniqueID();
-+ }
-+ // make sure the stream position should be pointing after the image.
-+ pS->Seek( imagePos + nPictureLen );
-+ }
-
- sal_Int16 numTrailingRecs = 0;
- *pS >> numTrailingRecs;
-@@ -4200,10 +4335,14 @@ sal_Bool OCX_UserForm::Read(SvStorageStream *pS)
- // ( unknown what these trailing records are for)
- if ( numTrailingRecs )
- {
-- for ( ; numTrailingRecs ; --numTrailingRecs )
-+ for ( sal_Int16 i = 0 ; numTrailingRecs ; --numTrailingRecs, ++i )
- {
-- OCX_Control skip(C2S("dummy")) ;
-- skip.Read( pS );
-+ sal_uInt16 nTypeID = 0;
-+ if ( lcl_handleActiveXControl( pS, nTypeID ) )
-+ {
-+ if ( nTypeID & 0x8000 ) // valid ActiveXID
-+ mActiveXIDMap[ ( i | 0x8000 ) ] = nTypeID;
-+ }
- }
- }
- return OCX_ContainerControl::Read( pS );
-@@ -4214,6 +4353,8 @@ sal_Bool OCX_UserForm::Import(
- {
- uno::Reference<beans::XPropertySet>
- xDialogPropSet(mxParent, uno::UNO_QUERY);
-+ if ( !xDialogPropSet.is() )
-+ return sal_False;
- uno::Any aTmp(&sName,getCppuType((OUString *)0));
- xDialogPropSet->setPropertyValue(
- OUString(RTL_CONSTASCII_USTRINGPARAM("Name")), aTmp);
-@@ -4221,22 +4362,55 @@ sal_Bool OCX_UserForm::Import(
- OUString(RTL_CONSTASCII_USTRINGPARAM("Title")), aTmp);
- aTmp <<= ImportColor(mnBackColor);
- xDialogPropSet->setPropertyValue( WW8_ASCII2STR("BackgroundColor"), aTmp);
-+ sal_Bool bVBA = sal_False;
-+ // Ok we are importing xls but maybe we aren't in VBA mode
-+ // if we are not in VBA mode then we should import sizes etc. ( as before )
-+ try
-+ {
-+ xDialogPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("VBAForm") ) ) >>= bVBA;
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ }
-+ if ( !bVBA )
-+ {
-+ aTmp <<= sal_Int32((nWidth * 2) / 100);
-+ xDialogPropSet->setPropertyValue(WW8_ASCII2STR("Width"), aTmp);
-+ aTmp <<= sal_Int32((nHeight * 2) / 100);
-+ xDialogPropSet->setPropertyValue(WW8_ASCII2STR("Height"), aTmp);
-+ }
-+ else
-+ {
-+ aTmp <<= sal_Int32( nWidth + 160 ); // 100thmm
-+ xDialogPropSet->setPropertyValue(WW8_ASCII2STR("Width"), aTmp);
-+ aTmp <<= sal_Int32(nHeight + 662 - 714); //100th mm
-+ xDialogPropSet->setPropertyValue(WW8_ASCII2STR("Height"), aTmp);
-+ }
-
-- aTmp <<= sal_Int32((nWidth * 2) / 100);
-- xDialogPropSet->setPropertyValue(WW8_ASCII2STR("Width"), aTmp);
-- aTmp <<= sal_Int32((nHeight * 2) / 100);
-- xDialogPropSet->setPropertyValue(WW8_ASCII2STR("Height"), aTmp);
-
- uno::Reference<beans::XPropertySet> xPropSet( mxParent, uno::UNO_QUERY );
- OCX_ContainerControl::Import( xPropSet );
-
- uno::Reference<io::XInputStreamProvider> xSource =
-- xmlscript::exportDialogModel(mxParent, mxCtx);
-+ xmlscript::exportDialogModel(mxParent, mxCtx, pDocSh->GetModel() );
- uno::Any aSourceAny(uno::makeAny(xSource));
- if (rLib->hasByName(sName))
- rLib->replaceByName(sName, aSourceAny);
- else
- rLib->insertByName(sName, aSourceAny);
-+
-+ if ( sImageUrl.getLength() )
-+ {
-+ aTmp <<= sImageUrl;
-+ try
-+ {
-+ xDialogPropSet->setPropertyValue( WW8_ASCII2STR("ImageURL"), aTmp);
-+ }
-+ catch( uno::Exception& )
-+ {
-+ OSL_TRACE("OCX_UserForm::Import, Image fails to import");
-+ }
-+ }
- return sal_True;
- }
-
-@@ -4761,11 +4935,14 @@ sal_Bool OCX_CheckBox::Import(com::sun::star::uno::Reference<
- aTmp <<= ImportSpecEffect( nSpecialEffect );
- rPropSet->setPropertyValue( WW8_ASCII2STR("VisualEffect"), aTmp);
-
-- if (pValue && !bSetInDialog)
-+ if (pValue)
- {
- INT16 nTmp=pValue[0]-0x30;
- aTmp <<= nTmp;
-- rPropSet->setPropertyValue( WW8_ASCII2STR("DefaultState"), aTmp);
-+ if ( !bSetInDialog )
-+ rPropSet->setPropertyValue( WW8_ASCII2STR("DefaultState"), aTmp);
-+ else
-+ rPropSet->setPropertyValue( WW8_ASCII2STR("State"), aTmp);
- }
-
- if (pCaption)
-@@ -5175,12 +5352,6 @@ sal_Bool OCX_TabStrip::ReadFontData(SotStorageStream *pS)
-
- sal_Bool OCX_Image::Read(SotStorageStream *pS)
- {
-- if ( !bSetInDialog )
-- {
-- // preserve the present behavior at the moment.
-- // only import image control for UserForms
-- return sal_False;
-- }
- ULONG nStart = pS->Tell();
- *pS >> nIdentifier;
- DBG_ASSERT(nStandardId==nIdentifier,
-@@ -5271,16 +5442,14 @@ sal_Bool OCX_Image::Read(SotStorageStream *pS)
-
- long imagePos = pS->Tell();
-
-- pS->Seek( imagePos );
--
-- sImageUrl = C2U("vnd.sun.star.expand:${$BRAND_BASE_DIR/program/") + C2U( SAL_CONFIGFILE( "bootstrap" ) ) + C2U("::UserInstallation}/user/temp/") + sName;
--
-- sal_uInt8* pImage = new sal_uInt8[ nImageLen ];
-- pS->Read(pImage, nImageLen);
-- bool result = storePictureInFileSystem( sImageUrl, pImage, nImageLen );
-- OUString pictName = sImageUrl.copy( sImageUrl.lastIndexOf('/') + 1 );
-- result = storePictureInDoc( pDocSh, pictName, pImage, nImageLen );
-- delete [] pImage;
-+ mxGrfObj = lcl_readGraphicObject( pS );
-+ if( mxGrfObj.is() )
-+ {
-+ sImageUrl = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( GRAPHOBJ_URLPREFIX ) );
-+ sImageUrl = sImageUrl + mxGrfObj->getUniqueID();
-+ }
-+ // make sure the stream position should be pointing after the image
-+ pS->Seek( imagePos + nImageLen );
- }
- return sal_True;
- }
-@@ -5448,7 +5617,7 @@ OCX_SpinButton::OCX_SpinButton() :
- mbPropThumb( true )
- {
- msFormType = C2U("com.sun.star.form.component.SpinButton");
-- msDialogType = C2U("com.sun.star.awt.UnoControlSpinButtonModel");
-+ msDialogType = C2U("com.sun.star.form.component.SpinButton");
- mnBackColor = 0x8000000F;
- mnForeColor = 0x80000012;
- }
-@@ -5485,8 +5654,8 @@ sal_Bool OCX_SpinButton::Read( SvStorageStream *pS )
- if( mnBlockFlags & 0x00000080 ) rStrm >> mnValue;
- if( mnBlockFlags & 0x00000100 ) rStrm.SeekRel( 4 ); // unknown
- if( mnBlockFlags & 0x00000200 ) rStrm.SeekRel( 4 ); // unknown
-- if( mnBlockFlags & 0x00000400 ) rStrm.SeekRel( 4 ); // unknown
-- if( mnBlockFlags & 0x00000800 ) rStrm >> mnSmallStep;
-+ if( mnBlockFlags & 0x00000400 ) rStrm >> mnSmallStep;
-+ if( mnBlockFlags & 0x00000800 ) rStrm.SeekRel( 4 ); // unknown
- if( mnBlockFlags & 0x00001000 ) rStrm >> mnPageStep;
- if( mnBlockFlags & 0x00002000 ) rStrm >> mnOrient;
- if( mnBlockFlags & 0x00004000 )
-@@ -5571,6 +5740,9 @@ sal_Bool OCX_SpinButton::Import(com::sun::star::uno::Reference<
- aTmp <<= sal_Int16( 0 );
- rPropSet->setPropertyValue( WW8_ASCII2STR("Border"), aTmp);
-
-+ uno::Reference< frame::XModel > xModel ( pDocSh ? pDocSh->GetModel() : NULL );
-+ lcl_ApplyListSourceAndBindableStuff( xModel, rPropSet, msCtrlSource, msRowSource );
-+
- return sal_True;
- }
-
-@@ -5738,7 +5910,7 @@ OCX_ScrollBar::OCX_ScrollBar()
- sName = OUString( RTL_CONSTASCII_USTRINGPARAM( "ScrollBar" ) );
- mnMax = 32767;
- msFormType = C2U("com.sun.star.form.component.ScrollBar");
-- msDialogType = C2U("com.sun.star.awt.UnoControlScrollBarModel");
-+ msDialogType = C2U("com.sun.star.form.component.ScrollBar");
-
- }
-
-@@ -5804,6 +5976,9 @@ sal_Bool OCX_ScrollBar::Import(com::sun::star::uno::Reference<
- aTmp <<= sal_Int16( 0 );
- rPropSet->setPropertyValue( WW8_ASCII2STR("Border"), aTmp);
-
-+ uno::Reference< frame::XModel > xModel ( pDocSh ? pDocSh->GetModel() : NULL );
-+ lcl_ApplyListSourceAndBindableStuff( xModel, rPropSet, msCtrlSource, msRowSource );
-+
- return sal_True;
- }
-
-diff --git filter/source/msfilter/msoleexp.cxx filter/source/msfilter/msoleexp.cxx
-index e782c5f..76220ee 100644
---- filter/source/msfilter/msoleexp.cxx
-+++ filter/source/msfilter/msoleexp.cxx
-@@ -219,7 +219,12 @@ void SvxMSExportOLEObjects::ExportOLEObject( svt::EmbeddedObjectRef& rObj, SvSto
- aSeq[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterName" ) );
- aSeq[1].Value <<= ::rtl::OUString( pExpFilter->GetName() );
- uno::Reference < frame::XStorable > xStor( rObj->getComponent(), uno::UNO_QUERY );
-+ try
-+ {
- xStor->storeToURL( ::rtl::OUString::createFromAscii( "private:stream" ), aSeq );
-+ }
-+ catch( uno::Exception& ) {} // #TODO really handle exceptions - interactionalhandler etc. ?
-+
- SotStorageRef xOLEStor = new SotStorage( pStream, TRUE );
- xOLEStor->CopyTo( &rDestStg );
- rDestStg.Commit();
-diff --git filter/source/msfilter/mstoolbar.cxx filter/source/msfilter/mstoolbar.cxx
-new file mode 100644
-index 0000000..eead43c
---- /dev/null
-+++ filter/source/msfilter/mstoolbar.cxx
-@@ -0,0 +1,817 @@
-+#include <filter/msfilter/mstoolbar.hxx>
-+#include <rtl/ustrbuf.hxx>
-+#include <stdarg.h>
-+#include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
-+#include <com/sun/star/ui/XImageManager.hpp>
-+#include <com/sun/star/ui/ItemType.hpp>
-+#include <com/sun/star/ui/ItemStyle.hpp>
-+#include <com/sun/star/frame/XLayoutManager.hpp>
-+#include <fstream>
-+#include <vcl/graph.hxx>
-+#include <vcl/bitmapex.hxx>
-+#include <vcl/image.hxx>
-+#include <map>
-+#include <sfx2/objsh.hxx>
-+#include <basic/basmgr.hxx>
-+#include <svtools/filterutils.hxx>
-+#include <boost/scoped_array.hpp>
-+#include <filter/msfilter/msvbahelper.hxx>
-+#include <svtools/miscopt.hxx>
-+#include <vcl/svapp.hxx>
-+#include <vcl/window.hxx>
-+
-+using namespace com::sun::star;
-+
-+int TBBase::nIndent = 0;
-+
-+void CustomToolBarImportHelper::showToolbar( const rtl::OUString& rName )
-+{
-+ try
-+ {
-+ uno::Reference< frame::XController > xCntrller( mrDocSh.GetModel()->getCurrentController(), uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xProps( xCntrller->getFrame(), uno::UNO_QUERY_THROW );
-+ uno::Reference< frame::XLayoutManager > xLayoutMgr( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LayoutManager") ) ), uno::UNO_QUERY_THROW );
-+ xLayoutMgr->showElement( rName );
-+ }
-+ catch( uno::Exception& ) {}
-+}
-+
-+void CustomToolBarImportHelper::ScaleImage( uno::Reference< graphic::XGraphic >& xGraphic, long nNewSize )
-+{
-+ Graphic aGraphic( xGraphic );
-+ Size aSize = aGraphic.GetSizePixel();
-+ if ( aSize.Height() && ( aSize.Height() == aSize.Width() ) )
-+ {
-+ Image aImage( xGraphic );
-+ if ( aSize.Height() != nNewSize )
-+ {
-+ BitmapEx aBitmap = aImage.GetBitmapEx();
-+ BitmapEx aBitmapex = BitmapEx::AutoScaleBitmap(aBitmap, nNewSize );
-+ aImage = Image( aBitmapex);
-+ xGraphic = aImage.GetXGraphic();
-+ }
-+ }
-+}
-+
-+void CustomToolBarImportHelper::applyIcons()
-+{
-+ for ( std::vector< iconcontrolitem >::iterator it = iconcommands.begin(); it != iconcommands.end(); ++it )
-+ {
-+ uno::Sequence< rtl::OUString > commands(1);
-+ commands[ 0 ] = it->sCommand;
-+ uno::Sequence< uno::Reference< graphic::XGraphic > > images(1);
-+ images[ 0 ] = it->image;
-+
-+ OSL_TRACE("About to applyIcons for command %s, have image ? %s", rtl::OUStringToOString( commands[ 0 ], RTL_TEXTENCODING_UTF8 ).getStr(), images[ 0 ].is() ? "yes" : "no" );
-+ uno::Reference< ui::XImageManager > xImageManager( getCfgManager()->getImageManager(), uno::UNO_QUERY_THROW );
-+ sal_uInt16 nColor = ui::ImageType::COLOR_NORMAL;
-+
-+ Window* topwin = Application::GetActiveTopWindow();
-+ if ( topwin != NULL && topwin->GetDisplayBackground().GetColor().IsDark() )
-+ nColor = css::ui::ImageType::COLOR_HIGHCONTRAST;
-+
-+ ScaleImage( images[ 0 ], 16 );
-+ xImageManager->replaceImages( ui::ImageType::SIZE_DEFAULT | nColor, commands, images );
-+ ScaleImage( images[ 0 ], 26 );
-+ xImageManager->replaceImages( ui::ImageType::SIZE_LARGE | nColor, commands, images );
-+ }
-+}
-+
-+void CustomToolBarImportHelper::addIcon( const uno::Reference< graphic::XGraphic >& xImage, const rtl::OUString& sString )
-+{
-+ iconcontrolitem item;
-+ item.sCommand = sString;
-+ item.image = xImage;
-+ iconcommands.push_back( item );
-+}
-+
-+CustomToolBarImportHelper::CustomToolBarImportHelper( SfxObjectShell& rDocShell, const css::uno::Reference< css::ui::XUIConfigurationManager>& rxAppCfgMgr ) : mrDocSh( rDocShell )
-+{
-+ m_xCfgSupp.set( mrDocSh.GetModel(), uno::UNO_QUERY_THROW );
-+ m_xAppCfgMgr.set( rxAppCfgMgr, uno::UNO_QUERY_THROW );
-+}
-+
-+uno::Reference< ui::XUIConfigurationManager >
-+CustomToolBarImportHelper::getCfgManager()
-+{
-+ return m_xCfgSupp->getUIConfigurationManager();
-+}
-+
-+uno::Reference< ui::XUIConfigurationManager >
-+CustomToolBarImportHelper::getAppCfgManager()
-+{
-+ return m_xAppCfgMgr;
-+}
-+
-+uno::Any
-+CustomToolBarImportHelper::createCommandFromMacro( const rtl::OUString& sCmd )
-+{
-+//"vnd.sun.star.script:Standard.Module1.Main?language=Basic&location=document"
-+ static rtl::OUString scheme = rtl::OUString::createFromAscii( "vnd.sun.star.script:");
-+ static rtl::OUString part2 = rtl::OUString::createFromAscii("?language=Basic&location=document");
-+ // create script url
-+ rtl::OUString scriptURL = scheme + sCmd + part2;
-+ return uno::makeAny( scriptURL );
-+}
-+
-+rtl::OUString CustomToolBarImportHelper::MSOCommandToOOCommand( sal_Int16 msoCmd )
-+{
-+ rtl::OUString result;
-+ if ( pMSOCmdConvertor.get() )
-+ result = pMSOCmdConvertor->MSOCommandToOOCommand( msoCmd );
-+ return result;
-+}
-+
-+rtl::OUString CustomToolBarImportHelper::MSOTCIDToOOCommand( sal_Int16 msoTCID )
-+{
-+ rtl::OUString result;
-+ if ( pMSOCmdConvertor.get() )
-+ result = pMSOCmdConvertor->MSOTCIDToOOCommand( msoTCID );
-+ return result;
-+}
-+
-+bool
-+CustomToolBarImportHelper::createMenu( const rtl::OUString& rName, const uno::Reference< container::XIndexAccess >& xMenuDesc, bool bPersist )
-+{
-+ bool bRes = true;
-+ try
-+ {
-+ uno::Reference< ui::XUIConfigurationManager > xCfgManager( getCfgManager() );
-+ rtl::OUString sMenuBar( RTL_CONSTASCII_USTRINGPARAM("private:resource/menubar/") );
-+ sMenuBar += rName;
-+ uno::Reference< container::XIndexContainer > xPopup( xCfgManager->createSettings(), uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xProps( xPopup, uno::UNO_QUERY_THROW );
-+ // set name for menubar
-+ xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UIName") ), uno::makeAny( rName ) );
-+ if ( xPopup.is() )
-+ {
-+ uno::Sequence< beans::PropertyValue > aPopupMenu( 4 );
-+ aPopupMenu[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CommandURL") );
-+ aPopupMenu[0].Value = uno::makeAny( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("vnd.openoffice.org:") ) + rName );
-+ aPopupMenu[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Label") );
-+ aPopupMenu[1].Value <<= rName;
-+ aPopupMenu[2].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ItemDescriptorContainer") );
-+ aPopupMenu[2].Value = uno::makeAny( xMenuDesc );
-+ aPopupMenu[3].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Type" ) );
-+ aPopupMenu[3].Value <<= sal_Int32( 0 );
-+
-+ xPopup->insertByIndex( xPopup->getCount(), uno::makeAny( aPopupMenu ) );
-+ if ( bPersist )
-+ {
-+ xCfgManager->insertSettings( sMenuBar, uno::Reference< container::XIndexAccess >( xPopup, uno::UNO_QUERY ) );
-+ uno::Reference< ui::XUIConfigurationPersistence > xPersistence( xCfgManager, uno::UNO_QUERY_THROW );
-+ xPersistence->store();
-+ }
-+ }
-+ }
-+ catch( uno::Exception& )
-+ {
-+ bRes = false;
-+ }
-+ return bRes;
-+}
-+
-+void
-+TBBase::indent_printf( FILE* fp, const char* format, ... )
-+{
-+ va_list ap;
-+ va_start ( ap, format );
-+
-+ // indent nIndent spaces
-+ for ( int i=0; i<nIndent; ++i)
-+ fprintf(fp," ");
-+ // append the rest of the message
-+ vfprintf( fp, format, ap );
-+ va_end( ap );
-+}
-+
-+rtl::OUString TBBase::readUnicodeString( SvStream* pS, sal_Int32 nChars )
-+{
-+ sal_Int32 nBufSize = nChars * 2;
-+ boost::scoped_array< sal_uInt8 > pArray( new sal_uInt8[ nBufSize ] );
-+ pS->Read( pArray.get(), nBufSize );
-+ return svt::BinFilterUtils::CreateOUStringFromUniStringArray( reinterpret_cast< const char* >( pArray.get() ), nBufSize );
-+}
-+
-+TBCHeader::TBCHeader() : bSignature( 0x3 )
-+,bVersion( 0x01 )
-+,bFlagsTCR( 0 )
-+,tct(0x1) // default to Button
-+,tcid(0)
-+,tbct(0)
-+{
-+}
-+
-+
-+TBCHeader::~TBCHeader()
-+{
-+}
-+
-+bool TBCHeader::Read( SvStream* pS )
-+{
-+ OSL_TRACE("TBCHeader::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> bSignature >> bVersion >> bFlagsTCR >> tct >> tcid >> tbct >> bPriority;
-+ // bit 4 ( from lsb )
-+ if ( bFlagsTCR & 0x10 )
-+ {
-+ width.reset( new sal_uInt16 );
-+ height.reset( new sal_uInt16 );
-+ *pS >> *width >> *height;
-+ }
-+ return true;
-+}
-+
-+void TBCHeader::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf(fp,"[ 0x%x ] TBCHeader -- dump\n", nOffSet );
-+ indent_printf(fp," bSignature 0x%x\n", bSignature );
-+ indent_printf(fp," bVersion 0x%x\n", bVersion );
-+ indent_printf(fp," bFlagsTCR 0x%x\n", bFlagsTCR );
-+ indent_printf(fp," tct 0x%x\n", tct );
-+ indent_printf(fp," tcid 0x%x\n", tcid );
-+ indent_printf(fp," tbct 0x%x\n", static_cast< unsigned int >( tbct ));
-+ indent_printf(fp," bPriority 0x%x\n", bPriority );
-+ if ( width.get() )
-+ indent_printf(fp," width 0x%d(0x%x)\n", *width, *width);
-+ if ( height.get() )
-+ indent_printf(fp," height 0x%d(0x%x)\n", *height, *height);
-+}
-+
-+TBCData::TBCData( const TBCHeader& Header ) : rHeader( Header )
-+{
-+}
-+
-+bool TBCData::Read(SvStream *pS)
-+{
-+ OSL_TRACE("TBCData::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ if ( !controlGeneralInfo.Read(pS) /*|| !controlSpecificInfo.Read(pS)*/ )
-+ return false;
-+ switch ( rHeader.getTct() )
-+ {
-+ case 0x01: // (Button control)
-+ case 0x10: // (ExpandingGrid control)
-+ controlSpecificInfo.reset( new TBCBSpecific() );
-+ break;
-+ case 0x0A: // (Popup control)
-+ case 0x0C: // (ButtonPopup control)
-+ case 0x0D: // (SplitButtonPopup control)
-+ case 0x0E: // (SplitButtonMRUPopup control)
-+ controlSpecificInfo.reset( new TBCMenuSpecific() );
-+ break;
-+ case 0x02: // (Edit control)
-+ case 0x04: // (ComboBox control)
-+ case 0x14: // (GraphicCombo control)
-+ case 0x03: // (DropDown control)
-+ case 0x06: // (SplitDropDown control)
-+ case 0x09: // (GraphicDropDown control)
-+ controlSpecificInfo.reset( new TBCComboDropdownSpecific( rHeader ) );
-+ break;
-+ default:
-+ break;
-+ }
-+ if ( controlSpecificInfo.get() )
-+ return controlSpecificInfo->Read( pS );
-+ //#FIXME I need to be able to handle different controlSpecificInfo types.
-+ return true;
-+}
-+
-+TBCMenuSpecific* TBCData::getMenuSpecific()
-+{
-+ TBCMenuSpecific* pMenu = dynamic_cast< TBCMenuSpecific* >( controlSpecificInfo.get() );
-+ return pMenu;
-+}
-+bool TBCData::ImportToolBarControl( CustomToolBarImportHelper& helper, std::vector< css::beans::PropertyValue >& props, bool& bBeginGroup, bool bIsMenuBar )
-+{
-+ sal_uInt16 nStyle = 0;
-+ bBeginGroup = rHeader.isBeginGroup();
-+ controlGeneralInfo.ImportToolBarControlData( helper, props );
-+ beans::PropertyValue aProp;
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Visible") ) ;
-+ aProp.Value = uno::makeAny( rHeader.isVisible() ); // where is the visible attribute stored
-+ props.push_back( aProp );
-+ if ( rHeader.getTct() == 0x01
-+ || rHeader.getTct() == 0x10 )
-+ {
-+ TBCBSpecific* pSpecificInfo = dynamic_cast< TBCBSpecific* >( controlSpecificInfo.get() );
-+ if ( pSpecificInfo )
-+ {
-+ // if we have a icon then lets set it for the command
-+ rtl::OUString sCommand;
-+ for ( std::vector< css::beans::PropertyValue >::iterator it = props.begin(); it != props.end(); ++it )
-+ {
-+ if ( it->Name.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CommandURL") ) ) )
-+ it->Value >>= sCommand;
-+ }
-+ if ( TBCBitMap* pIcon = pSpecificInfo->getIcon() )
-+ {
-+ // Without a command openoffice won't display the icon
-+ if ( sCommand.getLength() )
-+ {
-+ BitmapEx aBitEx( pIcon->getBitMap() );
-+ if ( pSpecificInfo->getIconMask() )
-+ // according to the spec:
-+ // "the iconMask is white in all the areas in which the icon is
-+ // displayed as transparent and is black in all other areas."
-+ aBitEx = BitmapEx( aBitEx.GetBitmap(), pSpecificInfo->getIconMask()->getBitMap().CreateMask( Color( COL_WHITE ) ) );
-+
-+ Graphic aGraphic( aBitEx );
-+ helper.addIcon( aGraphic.GetXGraphic(), sCommand );
-+ }
-+ }
-+ else if ( pSpecificInfo->getBtnFace() )
-+ {
-+
-+ rtl::OUString sBuiltInCmd = helper.MSOTCIDToOOCommand( *pSpecificInfo->getBtnFace() );
-+ if ( sBuiltInCmd.getLength() )
-+ {
-+ uno::Sequence< rtl::OUString> sCmds(1);
-+ sCmds[ 0 ] = sBuiltInCmd;
-+ uno::Reference< ui::XImageManager > xImageManager( helper.getAppCfgManager()->getImageManager(), uno::UNO_QUERY_THROW );
-+ // 0 = default image size
-+ uno::Sequence< uno::Reference< graphic::XGraphic > > sImages = xImageManager->getImages( 0, sCmds );
-+ if ( sImages.getLength() && sImages[0].is() )
-+ helper.addIcon( sImages[0], sCommand );
-+ }
-+ }
-+ }
-+ }
-+ else if ( rHeader.getTct() == 0x0a )
-+ {
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CommandURL") ) ;
-+ rtl::OUString sMenuBar( RTL_CONSTASCII_USTRINGPARAM("private:resource/menubar/") );
-+
-+ TBCMenuSpecific* pMenu = getMenuSpecific();
-+ if ( pMenu )
-+ aProp.Value = uno::makeAny( sMenuBar += pMenu->Name() ); // name of popup
-+ nStyle |= ui::ItemStyle::DROP_DOWN;
-+ props.push_back( aProp );
-+ }
-+
-+ short icontext = ( rHeader.getTbct() & 0x03 );
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Style") ) ;
-+ if ( bIsMenuBar )
-+ {
-+ nStyle |= ui::ItemStyle::TEXT;
-+ if ( !icontext || icontext == 0x3 )
-+ // Text And image
-+ nStyle |= ui::ItemStyle::ICON;
-+ }
-+ else
-+ {
-+ if ( ( icontext & 0x02 ) == 0x02 )
-+ nStyle |= ui::ItemStyle::TEXT;
-+ if ( !icontext || ( icontext & 0x03 ) == 0x03 )
-+ nStyle |= ui::ItemStyle::ICON;
-+ }
-+ aProp.Value <<= nStyle;
-+ props.push_back( aProp );
-+ return true; // just ignore
-+}
-+
-+void TBCData::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf(fp,"[ 0x%x ] TBCData -- dump\n", nOffSet );
-+ indent_printf(fp," dumping controlGeneralInfo( TBCGeneralInfo )\n");
-+ controlGeneralInfo.Print( fp );
-+ //if ( rHeader.getTct() == 1 )
-+ if ( controlSpecificInfo.get() )
-+ {
-+ indent_printf(fp," dumping controlSpecificInfo( TBCBSpecificInfo )\n");
-+ controlSpecificInfo->Print( fp );
-+ }
-+}
-+
-+bool
-+WString::Read( SvStream *pS )
-+{
-+ OSL_TRACE("WString::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ sal_Int8 nChars = 0;
-+ *pS >> nChars;
-+ sString = readUnicodeString( pS, static_cast< sal_Int32 >( nChars ) );
-+ return true;
-+}
-+
-+TBCExtraInfo::TBCExtraInfo() : idHelpContext( 0 )
-+{
-+}
-+
-+bool
-+TBCExtraInfo::Read( SvStream *pS )
-+{
-+ OSL_TRACE("TBCExtraInfo::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ if( !wstrHelpFile.Read( pS ) )
-+ return false;
-+
-+ *pS >> idHelpContext;
-+
-+ if ( !wstrTag.Read( pS ) || !wstrOnAction.Read( pS ) || !wstrParam.Read( pS ) )
-+ return false;
-+
-+ *pS >> tbcu >> tbmg;
-+ return true;
-+}
-+
-+void
-+TBCExtraInfo::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf( fp, "[ 0x%x ] TBCExtraInfo -- dump\n", nOffSet );
-+ indent_printf( fp, " wstrHelpFile %s\n",
-+ rtl::OUStringToOString( wstrHelpFile.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ indent_printf( fp, " idHelpContext 0x%x\n", static_cast< unsigned int >( idHelpContext ) );
-+ indent_printf( fp, " wstrTag %s\n",
-+ rtl::OUStringToOString( wstrTag.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ indent_printf( fp, " wstrOnAction %s\n",
-+ rtl::OUStringToOString( wstrOnAction.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ indent_printf( fp, " wstrParam %s\n",
-+ rtl::OUStringToOString( wstrParam.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ indent_printf( fp, " tbcu 0x%x\n", tbcu );
-+ indent_printf( fp, " tbmg 0x%x\n", tbmg );
-+
-+}
-+
-+rtl::OUString
-+TBCExtraInfo::getOnAction()
-+{
-+ return wstrOnAction.getString();
-+}
-+
-+TBCGeneralInfo::TBCGeneralInfo() : bFlags( 0 )
-+{
-+}
-+
-+bool TBCGeneralInfo::Read( SvStream *pS )
-+{
-+ OSL_TRACE("TBCGeneralInfo::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> bFlags;
-+
-+ if ( ( bFlags & 0x1 ) && !customText.Read( pS ) )
-+ return false;
-+ if ( ( bFlags & 0x2 ) && ( !descriptionText.Read( pS ) || !tooltip.Read( pS ) ) )
-+ return false;
-+ if ( ( bFlags & 0x4 ) && !extraInfo.Read( pS ) )
-+ return false;
-+ return true;
-+}
-+
-+void
-+TBCGeneralInfo::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf( fp, "[ 0x%x ] TBCGeneralInfo -- dump\n", nOffSet );
-+ indent_printf( fp, " bFlags 0x%x\n", bFlags );
-+ indent_printf( fp, " customText %s\n",
-+ rtl::OUStringToOString( customText.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ indent_printf( fp, " description %s\n",
-+ rtl::OUStringToOString( descriptionText.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ indent_printf( fp, " tooltip %s\n",
-+ rtl::OUStringToOString( tooltip.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ if ( bFlags & 0x4 )
-+ extraInfo.Print( fp );
-+}
-+
-+bool
-+TBCGeneralInfo::ImportToolBarControlData( CustomToolBarImportHelper& helper, std::vector< beans::PropertyValue >& sControlData )
-+{
-+ if ( ( bFlags & 0x5 ) )
-+ {
-+ beans::PropertyValue aProp;
-+ // probably access to the header would be a better test than seeing if there is an action, e.g.
-+ // if ( rHeader.getTct() == 0x01 && rHeader.getTcID() == 0x01 ) // not defined, probably this is a command
-+ if ( extraInfo.getOnAction().getLength() )
-+ {
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CommandURL") );
-+ ooo::vba::VBAMacroResolvedInfo aMacroInf = ooo::vba::resolveVBAMacro( &helper.GetDocShell(), extraInfo.getOnAction(), true );
-+ if ( aMacroInf.IsResolved() )
-+ aProp.Value = helper.createCommandFromMacro( aMacroInf.ResolvedMacro() );
-+ else
-+ aProp.Value <<= rtl::OUString::createFromAscii("UnResolvedMacro[").concat( extraInfo.getOnAction() ).concat( rtl::OUString::createFromAscii("]") );
-+ sControlData.push_back( aProp );
-+ }
-+
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Label") );
-+ aProp.Value = uno::makeAny( customText.getString().replace('&','~') );
-+ sControlData.push_back( aProp );
-+
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Type") );
-+ aProp.Value = uno::makeAny( ui::ItemType::DEFAULT );
-+ sControlData.push_back( aProp );
-+
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Tooltip") );
-+ aProp.Value = uno::makeAny( tooltip.getString() );
-+ sControlData.push_back( aProp );
-+/*
-+aToolbarItem(0).Name = "CommandURL" wstrOnAction
-+aToolbarItem(0).Value = Command
-+aToolbarItem(1).Name = "Label" customText
-+aToolbarItem(1).Value = Label
-+aToolbarItem(2).Name = "Type"
-+aToolbarItem(2).Value = 0
-+aToolbarItem(3).Name = "Visible"
-+aToolbarItem(3).Value = true
-+*/
-+ }
-+ return true;
-+}
-+
-+TBCMenuSpecific::TBCMenuSpecific() : tbid( 0 )
-+{
-+}
-+
-+bool
-+TBCMenuSpecific::Read( SvStream *pS)
-+{
-+ OSL_TRACE("TBCMenuSpecific::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> tbid;
-+ if ( tbid == 1 )
-+ {
-+ name.reset( new WString() );
-+ return name->Read( pS );
-+ }
-+ return true;
-+}
-+
-+void
-+TBCMenuSpecific::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf( fp, "[ 0x%x ] TBCMenuSpecific -- dump\n", nOffSet );
-+ indent_printf( fp, " tbid 0x%x\n", static_cast< unsigned int >( tbid ) );
-+ if ( tbid == 1 )
-+ indent_printf( fp, " name %s\n", rtl::OUStringToOString( name->getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+
-+}
-+
-+rtl::OUString TBCMenuSpecific::Name()
-+{
-+ rtl::OUString aName;
-+ if ( name.get() )
-+ aName = name->getString();
-+ return aName;
-+}
-+TBCBSpecific::TBCBSpecific() : bFlags( 0 )
-+{
-+}
-+
-+bool TBCBSpecific::Read( SvStream *pS)
-+{
-+ OSL_TRACE("TBCBSpecific::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> bFlags;
-+
-+ // bFlags determines what we read next
-+
-+ // bFlags.fCustomBitmap = 1 ( 0x8 ) set
-+ if ( bFlags & 0x8 )
-+ {
-+ icon.reset( new TBCBitMap() );
-+ iconMask.reset( new TBCBitMap() );
-+ if ( !icon->Read( pS ) || !iconMask->Read( pS ) )
-+ return false;
-+ }
-+ // if bFlags.fCustomBtnFace = 1 ( 0x10 )
-+ if ( bFlags & 0x10 )
-+ {
-+ iBtnFace.reset( new sal_uInt16 );
-+ *pS >> *iBtnFace.get();
-+ }
-+ // if bFlags.fAccelerator equals 1 ( 0x04 )
-+ if ( bFlags & 0x04 )
-+ {
-+ wstrAcc.reset( new WString() );
-+ return wstrAcc->Read( pS );
-+ }
-+ return true;
-+}
-+
-+
-+void TBCBSpecific::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf( fp, "[ 0x%x ] TBCBSpecific -- dump\n", nOffSet );
-+ indent_printf( fp, " bFlags 0x%x\n", bFlags );
-+ bool bResult = ( icon.get() != NULL );
-+ indent_printf( fp, " icon present? %s\n", bResult ? "true" : "false" );
-+ if ( bResult )
-+ {
-+ Indent b;
-+ indent_printf( fp, " icon: \n");
-+ icon->Print( fp ); // will dump size
-+ }
-+ bResult = ( iconMask.get() != NULL );
-+ indent_printf( fp, " icon mask present? %s\n", bResult ? "true" : "false" );
-+ if ( bResult )
-+ {
-+ Indent c;
-+ indent_printf( fp, " icon mask: \n");
-+ iconMask->Print( fp ); // will dump size
-+ }
-+ if ( iBtnFace.get() )
-+ {
-+ indent_printf( fp, " iBtnFace 0x%x\n", *(iBtnFace.get()) );
-+ }
-+ bResult = ( wstrAcc.get() != NULL );
-+ indent_printf( fp, " option string present? %s ->%s<-\n", bResult ? "true" : "false", bResult ? rtl::OUStringToOString( wstrAcc->getString(), RTL_TEXTENCODING_UTF8 ).getStr() : "N/A" );
-+}
-+
-+TBCBitMap*
-+TBCBSpecific::getIcon()
-+{
-+ return icon.get();
-+}
-+
-+TBCBitMap*
-+TBCBSpecific::getIconMask()
-+{
-+ return iconMask.get();
-+}
-+
-+TBCComboDropdownSpecific::TBCComboDropdownSpecific(const TBCHeader& header )
-+{
-+ if ( header.getTcID() == 0x01 )
-+ data.reset( new TBCCDData() );
-+}
-+
-+bool TBCComboDropdownSpecific::Read( SvStream *pS)
-+{
-+ nOffSet = pS->Tell();
-+ if ( data.get() )
-+ return data->Read( pS );
-+ return true;
-+}
-+
-+void TBCComboDropdownSpecific::Print( FILE* fp)
-+{
-+ Indent a;
-+ indent_printf(fp,"[ 0x%x ] TBCComboDropdownSpecific -- dump\n", nOffSet );
-+ if ( data.get() )
-+ data->Print( fp );
-+ else
-+ indent_printf(fp," no data " );
-+}
-+
-+TBCCDData::TBCCDData() : cwstrItems( 0 )
-+,iSel( 0 )
-+,cLines( 0 )
-+,dxWidth( 0 )
-+{
-+}
-+
-+TBCCDData::~TBCCDData()
-+{
-+}
-+
-+bool TBCCDData::Read( SvStream *pS)
-+{
-+ nOffSet = pS->Tell();
-+ *pS >> cwstrItems;
-+ if ( cwstrItems )
-+ {
-+ for( sal_Int32 index=0; index < cwstrItems; ++index )
-+ {
-+ WString aString;
-+ if ( !aString.Read( pS ) )
-+ return false;
-+ wstrList.push_back( aString );
-+ }
-+ }
-+ *pS >> cwstrMRU >> iSel >> cLines >> dxWidth;
-+
-+ return wstrEdit.Read( pS );
-+}
-+
-+void TBCCDData::Print( FILE* fp)
-+{
-+ Indent a;
-+ indent_printf(fp,"[ 0x%x ] TBCCDData -- dump\n", nOffSet );
-+ indent_printf(fp," cwstrItems items in wstrList 0x%d\n", cwstrItems);
-+ for ( sal_Int32 index=0; index < cwstrItems; ++index )
-+ {
-+ Indent b;
-+ indent_printf(fp, " wstrList[%d] %s", static_cast< int >( index ), rtl::OUStringToOString( wstrList[index].getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ }
-+ indent_printf(fp," cwstrMRU num most recently used string 0x%d item\n", cwstrMRU);
-+ indent_printf(fp," iSel index of selected item 0x%d item\n", iSel);
-+ indent_printf(fp," cLines num of suggested lines to display 0x%d", cLines);
-+ indent_printf(fp," dxWidth width in pixels 0x%d", dxWidth);
-+ indent_printf(fp," wstrEdit %s", rtl::OUStringToOString( wstrEdit.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+}
-+
-+TBCBitMap::TBCBitMap() : cbDIB( 0 ), size( 0 )
-+{
-+}
-+
-+TBCBitMap::~TBCBitMap()
-+{
-+}
-+
-+// #FIXME Const-ness
-+Bitmap&
-+TBCBitMap::getBitMap()
-+{
-+ return mBitMap;
-+}
-+
-+bool TBCBitMap::Read( SvStream* pS)
-+{
-+ OSL_TRACE("TBCBitMap::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> cbDIB;
-+ // cbDIB = sizeOf(biHeader) + sizeOf(colors) + sizeOf(bitmapData) + 10
-+ return mBitMap.Read( *pS, FALSE, TRUE );
-+}
-+
-+void TBCBitMap::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf(fp, "[ 0x%x ] TBCBitMap -- dump\n", nOffSet );
-+ indent_printf(fp, " TBCBitMap size of bitmap data 0x%x\n", static_cast< unsigned int > ( cbDIB ) );
-+}
-+
-+TB::TB() : bSignature(0x2),
-+bVersion(0x1),
-+cCL(0),
-+ltbid( 0x1 ),
-+ltbtr(0),
-+cRowsDefault( 0 ),
-+bFlags( 0 )
-+{
-+}
-+
-+bool TB::Read(SvStream *pS)
-+{
-+ OSL_TRACE("TB::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> bSignature >> bVersion >> cCL >> ltbid >> ltbtr >> cRowsDefault >> bFlags;
-+ name.Read( pS );
-+ return true;
-+
-+}
-+
-+bool TB::IsEnabled()
-+{
-+ return ( bFlags & 0x01 ) != 0x01;
-+}
-+
-+bool TB::NeedsPositioning()
-+{
-+ return ( bFlags & 0x10 ) == 0x10;
-+}
-+
-+void TB::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf(fp,"[ 0x%x ] TB -- dump\n", nOffSet );
-+ indent_printf(fp," bSignature 0x%x\n", bSignature );
-+ indent_printf(fp," bVersion 0x%x\n", bVersion );
-+ indent_printf(fp," cCL 0x%x\n", cCL );
-+ indent_printf(fp," ltbid 0x%x\n", ltbid );
-+ indent_printf(fp," ltbtr 0x%x\n", ltbtr );
-+ indent_printf(fp," cRowsDefault 0x%x\n", cRowsDefault );
-+ indent_printf(fp," bFlags 0x%x\n", bFlags );
-+ indent_printf(fp, " name %s\n", rtl::OUStringToOString( name.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+}
-+
-+TBVisualData::TBVisualData() : tbds(0), tbv(0), tbdsDock(0), iRow(0)
-+{
-+}
-+
-+bool TBVisualData::Read( SvStream* pS )
-+{
-+ OSL_TRACE("TBVisualData::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> tbds >> tbv >> tbdsDock >> iRow;
-+ rcDock.Read( pS );
-+ rcFloat.Read( pS );
-+ return true;
-+}
-+
-+void SRECT::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf( fp, " left 0x%x\n", left);
-+ indent_printf( fp, " top 0x%x\n", top);
-+ indent_printf( fp, " right 0x%x\n", right);
-+ indent_printf( fp, " bottom 0x%x\n", bottom);
-+}
-+
-+void TBVisualData::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf( fp, "[ 0x%x ] TBVisualData -- dump\n", nOffSet );
-+ indent_printf( fp, " tbds 0x%x\n", tbds);
-+ indent_printf( fp, " tbv 0x%x\n", tbv);
-+ indent_printf( fp, " tbdsDoc 0x%x\n", tbdsDock);
-+ indent_printf( fp, " iRow 0x%x\n", iRow);
-+ rcDock.Print( fp );
-+ rcFloat.Print( fp );
-+}
-+
-diff --git filter/source/msfilter/msvbahelper.cxx filter/source/msfilter/msvbahelper.cxx
-index d1d40dc..ddd3528 100644
---- filter/source/msfilter/msvbahelper.cxx
-+++ filter/source/msfilter/msvbahelper.cxx
-@@ -38,6 +38,7 @@
- #include <com/sun/star/document/XDocumentInfoSupplier.hpp>
- #include <tools/urlobj.hxx>
- #include <osl/file.hxx>
-+#include <unotools/pathoptions.hxx>
-
- using namespace ::com::sun::star;
-
-@@ -97,7 +98,24 @@ SfxObjectShell* findShellForUrl( const rtl::OUString& sMacroURLOrPath )
- }
- else
- {
-- if ( aURL.equals( xModel->getURL() ) )
-+ // sometimes just the name of the document ( without the path
-+ // is used
-+ bool bDocNameNoPathMatch = false;
-+ if ( aURL.getLength() && aURL.indexOf( '/' ) == -1 )
-+ {
-+ sal_Int32 lastSlashIndex = xModel->getURL().lastIndexOf( '/' );
-+ if ( lastSlashIndex > -1 )
-+ {
-+ bDocNameNoPathMatch = xModel->getURL().copy( lastSlashIndex + 1 ).equals( aURL );
-+ if ( !bDocNameNoPathMatch )
-+ {
-+ rtl::OUString aTmpName = rtl::OUString::createFromAscii("'") + xModel->getURL().copy( lastSlashIndex + 1 ) + rtl::OUString::createFromAscii("'");
-+ bDocNameNoPathMatch = aTmpName.equals( aURL );
-+ }
-+ }
-+ }
-+
-+ if ( aURL.equals( xModel->getURL() ) || bDocNameNoPathMatch )
- {
- pFoundShell = pShell;
- break;
-@@ -204,9 +222,19 @@ VBAMacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const rtl::OUStrin
- String sDocUrlOrPath = MacroName.copy( 0, nDocSepIndex );
- sMacroUrl = MacroName.copy( nDocSepIndex + 1 );
- OSL_TRACE("doc search, current shell is 0x%x", pShell );
-- SfxObjectShell* pFoundShell = findShellForUrl( sDocUrlOrPath );
-+ SfxObjectShell* pFoundShell = NULL;
-+ if( bSearchGlobalTemplates )
-+ {
-+ SvtPathOptions aPathOpt;
-+ String aAddinPath = aPathOpt.GetAddinPath();
-+ if( rtl::OUString( sDocUrlOrPath ).indexOf( aAddinPath ) == 0 )
-+ pFoundShell = pShell;
-+ }
-+ if( pFoundShell == NULL )
-+ pFoundShell = findShellForUrl( sDocUrlOrPath );
- OSL_TRACE("doc search, after find, found shell is 0x%x", pFoundShell );
-- aRes = resolveVBAMacro( pFoundShell, sMacroUrl );
-+ aRes = resolveVBAMacro( pFoundShell, sMacroUrl, bSearchGlobalTemplates );
-+ return aRes;
- }
- else
- {
-@@ -320,14 +348,14 @@ VBAMacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const rtl::OUStrin
- break;
- }
- }
-+ aRes.SetResolvedMacro( sProcedure.Insert( '.', 0 ).Insert( sModule, 0).Insert( '.', 0 ).Insert( sContainer, 0 ) );
- }
-- aRes.SetResolvedMacro( sProcedure.Insert( '.', 0 ).Insert( sModule, 0).Insert( '.', 0 ).Insert( sContainer, 0 ) );
-
- return aRes;
- }
-
- // Treat the args as possible inouts ( convertion at bottom of method )
--sal_Bool executeMacro( SfxObjectShell* pShell, const String& sMacroName, uno::Sequence< uno::Any >& aArgs, uno::Any& /*aRet*/, const uno::Any& aCaller )
-+sal_Bool executeMacro( SfxObjectShell* pShell, const String& sMacroName, uno::Sequence< uno::Any >& aArgs, uno::Any& aRet, const uno::Any& aCaller )
- {
- sal_Bool bRes = sal_False;
- if ( !pShell )
-@@ -338,40 +366,23 @@ sal_Bool executeMacro( SfxObjectShell* pShell, const String& sMacroName, uno::Se
- uno::Sequence< uno::Any > aOutArgs;
-
- try
-- {
-- uno::Reference< script::provider::XScriptProvider > xScriptProvider;
-- uno::Reference< script::provider::XScriptProviderSupplier > xSPS( pShell->GetModel(), uno::UNO_QUERY_THROW );
--
-- xScriptProvider.set( xSPS->getScriptProvider(), uno::UNO_QUERY_THROW );
--
-- uno::Reference< script::provider::XScript > xScript( xScriptProvider->getScript( sUrl ), uno::UNO_QUERY_THROW );
--
-- if ( aCaller.hasValue() )
-+ { ErrCode nErr( ERRCODE_BASIC_INTERNAL_ERROR );
-+ if ( pShell )
- {
-- uno::Reference< beans::XPropertySet > xProps( xScript, uno::UNO_QUERY );
-- if ( xProps.is() )
-+ nErr = pShell->CallXScript( sUrl,
-+ aArgs, aRet, aOutArgsIndex, aOutArgs, false, &aCaller );
-+ sal_Int32 nLen = aOutArgs.getLength();
-+ // convert any out params to seem like they were inouts
-+ if ( nLen )
- {
-- uno::Sequence< uno::Any > aCallerHack(1);
-- aCallerHack[ 0 ] = aCaller;
-- xProps->setPropertyValue( rtl::OUString::createFromAscii( "Caller" ), uno::makeAny( aCallerHack ) );
-- }
-- }
--
--
-- xScript->invoke( aArgs, aOutArgsIndex, aOutArgs );
--
-- sal_Int32 nLen = aOutArgs.getLength();
-- // convert any out params to seem like they were inouts
-- if ( nLen )
-- {
-- for ( sal_Int32 index=0; index < nLen; ++index )
-- {
-- sal_Int32 nOutIndex = aOutArgsIndex[ index ];
-- aArgs[ nOutIndex ] = aOutArgs[ index ];
-- }
-+ for ( sal_Int32 index=0; index < nLen; ++index )
-+ {
-+ sal_Int32 nOutIndex = aOutArgsIndex[ index ];
-+ aArgs[ nOutIndex ] = aOutArgs[ index ];
-+ }
-+ }
- }
--
-- bRes = sal_True;
-+ bRes = ( nErr == ERRCODE_NONE );
- }
- catch ( uno::Exception& e )
- {
-diff --git filter/source/msfilter/msvbasic.cxx filter/source/msfilter/msvbasic.cxx
-index f616d39..51af70b 100644
---- filter/source/msfilter/msvbasic.cxx
-+++ filter/source/msfilter/msvbasic.cxx
-@@ -37,11 +37,804 @@
- #include <osl/endian.h>
- #include <rtl/tencinfo.h> //rtl_getTextEncodingFromWindowsCodePage
- #include "msvbasic.hxx"
-+#include <memory>
-+#include <rtl/ustrbuf.hxx>
-+#include <boost/shared_ptr.hpp>
-+#include <boost/scoped_array.hpp>
-+#include <boost/shared_array.hpp>
-+#include <svtools/filterutils.hxx>
-
- #include <com/sun/star/script/ModuleType.hpp>
-+#include <fstream>
-
- using namespace ::com::sun::star::script;
-
-+namespace MSLZSS {
-+
-+static unsigned int getShift( sal_uInt32 nPos )
-+{
-+ if (nPos <= 0x80) {
-+ if (nPos <= 0x20)
-+ return (nPos <= 0x10) ? 12 : 11;
-+ else
-+ return (nPos <= 0x40) ? 10 : 9;
-+ } else {
-+ if (nPos <= 0x200)
-+ return (nPos <= 0x100) ? 8 : 7;
-+ else if (nPos <= 0x800)
-+ return (nPos <= 0x400) ? 6 : 5;
-+ else
-+ return 4;
-+ }
-+}
-+
-+SvMemoryStream *decompressAsStream( SvStream *pStream, sal_uInt32 nOffset, sal_uInt32 *pCompressedLength = NULL, sal_uInt32 *pLength = NULL )
-+{
-+ SvMemoryStream *pResult;
-+ const sal_Int32 nWINDOWLEN = 4096;
-+ pResult = new SvMemoryStream();
-+
-+ sal_uInt8 nLeadbyte;
-+ unsigned int nPos = 0;
-+ int nLen, nDistance, nShift, nClean=1;
-+ sal_uInt8 aHistory[ nWINDOWLEN ];
-+
-+ pStream->Seek( nOffset + 3 );
-+
-+ while( pStream->Read( &nLeadbyte, 1 ) )
-+ {
-+ for(int nMask=0x01; nMask < 0x100; nMask = nMask<<1)
-+ {
-+ // we see if the leadbyte has flagged this location as a dataunit
-+ // which is actually a token which must be looked up in the history
-+ if( nLeadbyte & nMask )
-+ {
-+ sal_uInt16 nToken;
-+
-+ *pStream >> nToken;
-+
-+ if (nClean == 0)
-+ nClean=1;
-+
-+ //For some reason the division of the token into the length
-+ //field of the data to be inserted, and the distance back into
-+ //the history differs depending on how full the history is
-+ nShift = getShift( nPos % nWINDOWLEN );
-+
-+ nLen = (nToken & ((1<<nShift) - 1)) + 3;
-+ nDistance = nToken >> nShift;
-+
-+ //read the len of data from the history, wrapping around the
-+ //nWINDOWLEN boundary if necessary data read from the history
-+ //is also copied into the recent part of the history as well.
-+ for (int i = 0; i < nLen; i++)
-+ {
-+ unsigned char c;
-+ c = aHistory[(nPos-nDistance-1) % nWINDOWLEN];
-+ aHistory[nPos % nWINDOWLEN] = c;
-+ nPos++;
-+ }
-+ }
-+ else
-+ {
-+ // special boundary case code, not guarantueed to be correct
-+ // seems to work though, there is something wrong with the
-+ // compression scheme (or maybe a feature) where when the data
-+ // ends on a nWINDOWLEN boundary and the excess bytes in the 8
-+ // dataunit list are discarded, and not interpreted as tokens
-+ // or normal data.
-+ if ((nPos != 0) && ((nPos % nWINDOWLEN) == 0) && (nClean))
-+ {
-+ pStream->SeekRel(2);
-+ nClean=0;
-+ pResult->Write( aHistory, nWINDOWLEN );
-+ break;
-+ }
-+ //This is the normal case for when the data unit is not a
-+ //token to be looked up, but instead some normal data which
-+ //can be output, and placed in the history.
-+ if (pStream->Read(&aHistory[nPos % nWINDOWLEN],1))
-+ nPos++;
-+
-+ if (nClean == 0)
-+ nClean=1;
-+ }
-+ }
-+ }
-+ if (nPos % nWINDOWLEN)
-+ pResult->Write( aHistory, nPos % nWINDOWLEN );
-+ pResult->Flush();
-+
-+ if( pCompressedLength )
-+ *pCompressedLength = nPos;
-+
-+ if( pLength )
-+ *pLength = pResult->Tell();
-+
-+ pResult->Seek( 0 );
-+
-+ return pResult;
-+}
-+
-+} //MSZSS
-+
-+// also _VBA_PROJECT_VDPI can be used to create a usable
-+// ( and much smaller ) "_VBA_PROJECT" stream
-+
-+// _VBA_PROJECT Stream Version Dependant Project Information
-+// _VBA_PROJECT Stream Version Dependant Project Information
-+
-+class _VBA_PROJECT_VDPI
-+{
-+public:
-+sal_Int16 Reserved1;
-+sal_Int16 Version;
-+sal_Int8 Reserved2;
-+sal_Int16 Reserved3;
-+boost::scoped_array< sal_uInt8 > PerformanceCache;
-+sal_Int32 PerformanceCacheSize;
-+_VBA_PROJECT_VDPI(): Reserved1( 0x61CC), Version( 0xFFFF ), Reserved2(0x0), Reserved3(0x0), PerformanceCacheSize(0) {}
-+~_VBA_PROJECT_VDPI()
-+{
-+ PerformanceCacheSize = 0;
-+}
-+void read(){}
-+void write( SvStream* pStream )
-+{
-+ *pStream << Reserved1 << Version << Reserved2 << Reserved3;
-+ if ( PerformanceCacheSize )
-+ {
-+ PerformanceCache.reset( new sal_uInt8[ PerformanceCacheSize ] );
-+ pStream->Read( PerformanceCache.get(), PerformanceCacheSize );
-+ }
-+}
-+};
-+
-+class ProjectSysKindRecord
-+{
-+public:
-+sal_Int16 Id;
-+sal_Int32 Size;
-+sal_Int32 SysKind;
-+ProjectSysKindRecord(): Id(0x1), Size(0x4), SysKind( 0x1 ) {}
-+void read( SvStream* pStream )
-+{
-+ *pStream >> Id >> Size >> SysKind;
-+}
-+};
-+
-+class ProjectLcidRecord
-+{
-+public:
-+sal_Int16 Id;
-+sal_Int32 Size;
-+sal_Int32 Lcid;
-+
-+ProjectLcidRecord() : Id( 0x2 ), Size( 0x4 ), Lcid( 0x409 ) {}
-+void read( SvStream* pStream )
-+{
-+ OSL_TRACE("ProjectLcidRecord [0x%x]", pStream->Tell() );
-+ *pStream >> Id >> Size >> Lcid;
-+}
-+};
-+
-+class ProjectLcidInvokeRecord
-+{
-+sal_Int16 Id;
-+sal_Int32 Size;
-+sal_Int32 LcidInvoke;
-+public:
-+ProjectLcidInvokeRecord() : Id( 0x14 ), Size( 0x4 ), LcidInvoke( 0x409 ) {}
-+void read( SvStream* pStream )
-+{
-+ OSL_TRACE("ProjectLcidInvokeRecord [0x%x]", pStream->Tell() );
-+ *pStream >> Id >> Size >> LcidInvoke;
-+}
-+};
-+
-+class ProjectCodePageRecord
-+{
-+sal_Int16 Id;
-+sal_Int32 Size;
-+sal_Int16 CodePage;
-+public:
-+// #FIXME get a better default for the CodePage
-+ProjectCodePageRecord() : Id( 0x03 ), Size( 0x2 ), CodePage( 0x0 ) {}
-+void read( SvStream* pStream )
-+{
-+ OSL_TRACE("ProjectCodePageRecord [0x%x]", pStream->Tell() );
-+ *pStream >> Id >> Size >> CodePage;
-+}
-+};
-+class ProjectNameRecord
-+{
-+public:
-+sal_Int16 Id;
-+sal_Int32 SizeOfProjectName;
-+rtl::OUString ProjectName;
-+ProjectNameRecord() : Id( 0x04 ), SizeOfProjectName( 0x0 ){}
-+~ProjectNameRecord()
-+{
-+}
-+void read( SvStream* pStream )
-+{
-+ OSL_TRACE("ProjectNameRecord [0x%x]", pStream->Tell() );
-+ *pStream >> Id >> SizeOfProjectName;
-+
-+ if ( SizeOfProjectName )
-+ {
-+ boost::scoped_array< sal_uInt8 > pProjectName( new sal_uInt8[ SizeOfProjectName ] );
-+ OSL_TRACE("ProjectNameRecord about to read name from [0x%x], size %d", pStream->Tell(), SizeOfProjectName );
-+ pStream->Read( pProjectName.get(), SizeOfProjectName );
-+ ProjectName = svt::BinFilterUtils::CreateOUStringFromStringArray( reinterpret_cast< const char* >( pProjectName.get() ), SizeOfProjectName );
-+ }
-+}
-+};
-+
-+class ProjectDocStringRecord
-+{
-+public:
-+sal_Int16 Id;
-+sal_Int32 SizeOfDocString;
-+sal_Int16 Reserved;
-+sal_Int32 SizeOfDocStringUnicode;
-+rtl::OUString DocString;
-+rtl::OUString DocStringUnicode;
-+
-+ProjectDocStringRecord() : Id( 0x5 ), SizeOfDocString( 0x0 ), Reserved( 0x0 ), SizeOfDocStringUnicode( 0 ){}
-+
-+~ProjectDocStringRecord()
-+{
-+}
-+void read( SvStream* pStream )
-+{
-+ OSL_TRACE("ProjectDocStringRecord [0x%x]", pStream->Tell() );
-+ *pStream >> Id >> SizeOfDocString;
-+
-+
-+ boost::scoped_array< sal_uInt8 > pDocString( new sal_uInt8[ SizeOfDocString ] );
-+ pStream->Read( pDocString.get(), SizeOfDocString );
-+
-+ DocString = svt::BinFilterUtils::CreateOUStringFromStringArray( reinterpret_cast< const char* >( pDocString.get() ), SizeOfDocString );
-+
-+ *pStream >> Reserved >> SizeOfDocStringUnicode;
-+
-+ boost::scoped_array< sal_uInt8 > pDocStringUnicode( new sal_uInt8[ SizeOfDocStringUnicode ] );
-+
-+ pStream->Read( pDocStringUnicode.get(), SizeOfDocStringUnicode );
-+ DocStringUnicode = svt::BinFilterUtils::CreateOUStringFromUniStringArray( reinterpret_cast< const char* >( pDocStringUnicode.get() ), SizeOfDocString );
-+
-+}
-+
-+};
-+
-+class ProjectHelpFilePath
-+{
-+public:
-+sal_Int16 Id;
-+sal_Int32 SizeOfHelpFile1;
-+boost::scoped_array< sal_uInt8 > HelpFile1;
-+sal_Int16 Reserved;
-+sal_Int32 SizeOfHelpFile2;
-+boost::scoped_array< sal_uInt8 > HelpFile2;
-+
-+ProjectHelpFilePath() : Id( 0x06 ), SizeOfHelpFile1(0), Reserved(0x0), SizeOfHelpFile2(0) {}
-+~ProjectHelpFilePath()
-+{
-+}
-+
-+void read( SvStream* pStream )
-+{
-+ OSL_TRACE("ProjectHelpFilePath [0x%x]", pStream->Tell() );
-+ *pStream >> Id >> SizeOfHelpFile1;
-+
-+ HelpFile1.reset( new sal_uInt8[ SizeOfHelpFile1 ] );
-+ pStream->Read( HelpFile1.get(), SizeOfHelpFile1 );
-+
-+ *pStream >> Reserved >> SizeOfHelpFile2;
-+
-+ HelpFile2.reset( new sal_uInt8[ SizeOfHelpFile2 ] );
-+ pStream->Read( HelpFile2.get(), SizeOfHelpFile2 );
-+
-+}
-+};
-+
-+class ProjectHelpContextRecord
-+{
-+public:
-+sal_Int16 Id;
-+sal_Int32 Size;
-+sal_Int32 HelpContext;
-+
-+ProjectHelpContextRecord() : Id( 0x7 ), Size( 0x4 ), HelpContext( 0 ) {}
-+void read( SvStream* pStream )
-+{
-+
-+ OSL_TRACE("ProjectHelpContextRecord [0x%x]", pStream->Tell() );
-+ *pStream >> Id >> Size >> HelpContext;
-+}
-+
-+};
-+
-+class ProjectLibFlagsRecord
-+{
-+sal_Int16 Id;
-+sal_Int32 Size;
-+sal_Int32 ProjectLibFlags;
-+
-+public:
-+ProjectLibFlagsRecord() : Id( 0x8 ), Size( 0x4 ), ProjectLibFlags( 0x0 ) {}
-+void read( SvStream* pStream )
-+{
-+ OSL_TRACE("ProjectLibFlagsRecord [0x%x]", pStream->Tell() );
-+ *pStream >> Id >> Size >> ProjectLibFlags;
-+}
-+};
-+
-+class ProjectVersionRecord
-+{
-+public:
-+sal_Int16 Id;
-+sal_Int32 Reserved;
-+sal_Int32 VersionMajor;
-+sal_Int16 VersionMinor;
-+ProjectVersionRecord() : Id( 0x9 ), Reserved( 0x4 ), VersionMajor( 0x1 ), VersionMinor( 0 ) {}
-+void read( SvStream* pStream )
-+{
-+ OSL_TRACE("ProjectVersionRecord [0x%x]", pStream->Tell() );
-+ *pStream >> Id >> Reserved >> VersionMajor >> VersionMinor;
-+}
-+};
-+
-+class ProjectConstantsRecord
-+{
-+sal_Int16 Id;
-+sal_Int32 SizeOfConstants;
-+boost::scoped_array< sal_uInt8 > Constants;
-+sal_Int16 Reserved;
-+sal_Int32 SizeOfConstantsUnicode;
-+boost::scoped_array< sal_uInt8 > ConstantsUnicode;
-+public:
-+ProjectConstantsRecord() : Id( 0xC ), SizeOfConstants( 0 ), Constants( 0 ), Reserved( 0x3C ), SizeOfConstantsUnicode( 0 ), ConstantsUnicode(0) {}
-+
-+~ProjectConstantsRecord()
-+{
-+}
-+
-+void read( SvStream* pStream )
-+{
-+ OSL_TRACE("ProjectConstantsRecord [0x%x]", pStream->Tell() );
-+ *pStream >> Id >> SizeOfConstants;
-+ Constants.reset( new sal_uInt8[ SizeOfConstants ] );
-+
-+ pStream->Read( Constants.get(), SizeOfConstants );
-+
-+ *pStream >> Reserved;
-+
-+ *pStream >> SizeOfConstantsUnicode;
-+
-+ ConstantsUnicode.reset( new sal_uInt8[ SizeOfConstantsUnicode ] );
-+ pStream->Read( ConstantsUnicode.get(), SizeOfConstantsUnicode );
-+}
-+
-+};
-+
-+class ReferenceNameRecord
-+{
-+public:
-+sal_Int16 Id;
-+sal_Int32 SizeOfName;
-+rtl::OUString Name;
-+sal_Int16 Reserved;
-+sal_Int32 SizeOfNameUnicode;
-+rtl::OUString NameUnicode;
-+
-+ReferenceNameRecord() : Id( 0x16 ), SizeOfName( 0 ), Reserved( 0x3E ), SizeOfNameUnicode( 0 ){}
-+~ReferenceNameRecord()
-+{
-+}
-+
-+void read( SvStream* pStream )
-+{
-+ OSL_TRACE("NameRecord [0x%x]", pStream->Tell() );
-+ *pStream >> Id >> SizeOfName;
-+
-+ boost::scoped_array< sal_uInt8 > pName( new sal_uInt8[ SizeOfName ] );
-+
-+ pStream->Read( pName.get(), SizeOfName );
-+ Name = svt::BinFilterUtils::CreateOUStringFromStringArray( reinterpret_cast< const char* >( pName.get() ), SizeOfName );
-+
-+ *pStream >> Reserved >> SizeOfNameUnicode;
-+
-+ boost::scoped_array< sal_uInt8 > pNameUnicode( new sal_uInt8[ SizeOfNameUnicode ] );
-+ pStream->Read( pNameUnicode.get(), SizeOfNameUnicode );
-+ NameUnicode = svt::BinFilterUtils::CreateOUStringFromUniStringArray( reinterpret_cast< const char* >( pNameUnicode.get() ), SizeOfName );
-+}
-+
-+};
-+
-+// Baseclass for ReferenceControlRecord, ReferenceRegisteredRecord, ReferenceProjectRecord
-+class DirDumper;
-+
-+class BaseReferenceRecord
-+{
-+public:
-+virtual ~BaseReferenceRecord(){}
-+virtual bool read( SvStream* pStream ) = 0;
-+virtual void import( VBA_Impl& ){}
-+};
-+
-+
-+class ReferenceProjectRecord : public BaseReferenceRecord
-+{
-+public:
-+ sal_uInt16 Id;
-+ sal_uInt32 Size;
-+ sal_uInt32 SizeOfLibidAbsolute;
-+ sal_uInt32 SizeOfLibidRelative;
-+ sal_uInt32 MajorVersion;
-+ sal_uInt16 MinorVersion;
-+ rtl::OUString AbsoluteLibid;
-+ rtl::OUString RelativeLibid;
-+
-+ virtual bool read( SvStream* pStream );
-+ virtual void import( VBA_Impl& rDir );
-+ ReferenceProjectRecord();
-+ ~ReferenceProjectRecord();
-+};
-+
-+ReferenceProjectRecord::ReferenceProjectRecord() : Id( 0x000E ), Size( 0 ), SizeOfLibidAbsolute( 0 ), SizeOfLibidRelative( 0 ), MajorVersion( 0 ), MinorVersion( 0 )
-+{
-+}
-+
-+ReferenceProjectRecord::~ReferenceProjectRecord()
-+{
-+}
-+
-+bool ReferenceProjectRecord::read( SvStream* pStream )
-+{
-+ OSL_TRACE("ReferenceProjectRecord [0x%x]", pStream->Tell() );
-+ *pStream >> Id >> Size >> SizeOfLibidAbsolute;
-+
-+ boost::scoped_array< sal_uInt8 > pLibidAbsolute( new sal_uInt8[ SizeOfLibidAbsolute ] );
-+ OSL_TRACE("ReferenceProjectRecord about to read LibidAbsolute at [0x%x]", pStream->Tell() );
-+ pStream->Read( pLibidAbsolute.get(), SizeOfLibidAbsolute );
-+
-+ *pStream >> SizeOfLibidRelative;
-+
-+ boost::scoped_array< sal_uInt8 > pLibidRelative( new sal_uInt8[ SizeOfLibidRelative ] );
-+ OSL_TRACE("ReferenceProjectRecord about to read LibidRelative at [0x%x]", pStream->Tell() );
-+ pStream->Read( pLibidRelative.get(), SizeOfLibidRelative );
-+
-+ *pStream >> MajorVersion >> MinorVersion;
-+
-+ // array size is ORed with SVX_MSOCX_COMPRESSED to force processing of ascii bytes ( and not
-+ // 16 bit unicode )
-+ // the offset of 3 is needed to skip the ProjectReference "*\" and project kind ( 0x4[1-4] ) info.
-+
-+ AbsoluteLibid = svt::BinFilterUtils::CreateOUStringFromStringArray( reinterpret_cast< const char* >( pLibidAbsolute.get() + 3 ), (SizeOfLibidAbsolute - 3 ) );
-+ RelativeLibid = svt::BinFilterUtils::CreateOUStringFromStringArray( reinterpret_cast< const char* >( pLibidRelative.get() + 3 ), ( SizeOfLibidRelative -3 ) );
-+
-+ OSL_TRACE("ReferenceProjectRecord - absolute path %s", rtl::OUStringToOString( AbsoluteLibid, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ OSL_TRACE("ReferenceProjectRecord - relative path %s", rtl::OUStringToOString( RelativeLibid, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ return true;
-+}
-+
-+void ReferenceProjectRecord::import( VBA_Impl& rDir )
-+{
-+ rDir.AddProjectReference( AbsoluteLibid );
-+}
-+
-+class ReferenceRegisteredRecord : public BaseReferenceRecord
-+{
-+public:
-+ sal_uInt16 Id;
-+ sal_uInt32 Size;
-+ sal_uInt32 SizeOfLibid;
-+ boost::scoped_array< sal_uInt8> pLibid;
-+ sal_Int32 Reserved1;
-+ sal_Int16 Reserved2;
-+
-+ ReferenceRegisteredRecord();
-+ ~ReferenceRegisteredRecord();
-+ bool read( SvStream* pStream );
-+};
-+
-+ReferenceRegisteredRecord::ReferenceRegisteredRecord() : Id( 0x000D ), Size( 0 ), SizeOfLibid( 0 ), Reserved1( 0 ), Reserved2( 0 )
-+{
-+}
-+
-+ReferenceRegisteredRecord::~ReferenceRegisteredRecord()
-+{
-+}
-+
-+bool
-+ReferenceRegisteredRecord::read( SvStream* pStream )
-+{
-+ OSL_TRACE("ReferenceRegisteredRecord [0x%x]", pStream->Tell() );
-+ *pStream >> Id >> Size >> SizeOfLibid;
-+ if ( SizeOfLibid )
-+ {
-+ pLibid.reset( new sal_uInt8[ SizeOfLibid] );
-+ pStream->Read( pLibid.get(), SizeOfLibid );
-+ }
-+ *pStream >> Reserved1 >> Reserved2;
-+ return true;
-+}
-+
-+class ReferenceOriginalRecord
-+{
-+public:
-+ sal_uInt16 Id;
-+ sal_uInt32 SizeOfLibOriginal;
-+ boost::scoped_array< sal_uInt8 > pLibidOriginal;
-+
-+
-+ReferenceOriginalRecord() : Id( 0x033 ), SizeOfLibOriginal( 0 )
-+{
-+}
-+
-+~ReferenceOriginalRecord()
-+{
-+}
-+
-+void read( SvStream* pStream )
-+{
-+ *pStream >> Id >> SizeOfLibOriginal;
-+ if ( SizeOfLibOriginal )
-+ {
-+ pLibidOriginal.reset( new sal_uInt8[ SizeOfLibOriginal ] );
-+ pStream->Read( pLibidOriginal.get(), SizeOfLibOriginal );
-+ }
-+}
-+
-+};
-+
-+class ReferenceControlRecord : public BaseReferenceRecord
-+{
-+public:
-+std::auto_ptr< ReferenceOriginalRecord > OriginalRecord;
-+sal_Int16 Id;
-+sal_uInt32 SizeTwiddled;
-+sal_uInt32 SizeOfLibidTwiddled;
-+boost::shared_array< sal_uInt8 > LibidTwiddled;
-+sal_uInt32 Reserved1;
-+sal_uInt16 Reserved2;
-+std::auto_ptr< ReferenceNameRecord > NameRecordExtended;// Optional
-+sal_uInt16 Reserved3;
-+sal_uInt32 SizeExtended;
-+sal_uInt32 SizeOfLibidExtended;
-+boost::shared_array< sal_uInt8 > LibidExtended;
-+sal_uInt32 Reserved4;
-+sal_uInt16 Reserved5;
-+sal_uInt8 OriginalTypeLib[ 16 ];
-+sal_uInt32 Cookie;
-+
-+ReferenceControlRecord() : Id( 0x2F ), SizeTwiddled( 0 ), SizeOfLibidTwiddled( 0 ), Reserved1( 0 ), Reserved2( 0 ), Reserved3( 0x30 ), SizeExtended( 0 ), SizeOfLibidExtended( 0 ), Reserved4( 0 ), Reserved5( 0 ), Cookie( 0 )
-+{
-+ for( int i = 0; i < 16; ++i )
-+ OriginalTypeLib[ i ] = 0;
-+}
-+
-+~ReferenceControlRecord()
-+{
-+}
-+
-+bool read( SvStream* pStream )
-+{
-+ OSL_TRACE("ReferenceControlRecord [0x%x]", pStream->Tell() );
-+ long nPos = pStream->Tell();
-+
-+ *pStream >> Id;
-+ pStream->Seek( nPos ); // point before the peeked Id
-+ if ( Id == 0x33 ) // we have an OriginalRecord
-+ {
-+ OriginalRecord.reset( new ReferenceOriginalRecord() );
-+ OriginalRecord->read( pStream );
-+ }
-+ *pStream >> Id >> SizeTwiddled >> SizeOfLibidTwiddled;
-+
-+ if ( SizeOfLibidTwiddled )
-+ {
-+ LibidTwiddled.reset( new sal_uInt8[ SizeOfLibidTwiddled ] );
-+ pStream->Read( LibidTwiddled.get(), SizeOfLibidTwiddled );
-+ }
-+
-+ *pStream >> Reserved1 >> Reserved2;
-+
-+ nPos = pStream->Tell();
-+ // peek at the id for optional NameRecord
-+ sal_Int16 nTmpId;
-+ *pStream >> nTmpId;
-+ if ( nTmpId == 0x30 )
-+ {
-+ Reserved3 = 0x30;
-+ }
-+ else
-+ {
-+ pStream->Seek( nPos );
-+ NameRecordExtended.reset( new ReferenceNameRecord() );
-+ NameRecordExtended->read( pStream );
-+ *pStream >> Reserved3;
-+ }
-+ *pStream >> SizeExtended >> SizeOfLibidExtended;
-+
-+ if ( SizeExtended )
-+ {
-+ LibidExtended.reset( new sal_uInt8[ SizeOfLibidExtended ] );
-+ pStream->Read( LibidExtended.get(), SizeOfLibidExtended );
-+ }
-+
-+ *pStream >> Reserved4;
-+ *pStream >> Reserved5;
-+
-+ pStream->Read( OriginalTypeLib, sizeof( OriginalTypeLib ) );
-+ *pStream >> Cookie;
-+ return true;
-+}
-+
-+};
-+
-+class ReferenceRecord : public BaseReferenceRecord
-+{
-+public:
-+// NameRecord is Optional
-+std::auto_ptr< ReferenceNameRecord > NameRecord;
-+std::auto_ptr< BaseReferenceRecord > aReferenceRecord;
-+
-+ReferenceRecord(){}
-+~ReferenceRecord()
-+{
-+}
-+
-+// false return would mean failed to read Record e.g. end of array encountered
-+// Note: this read routine will make sure the stream is pointing to where it was the
-+// method was called )
-+
-+bool read( SvStream* pStream )
-+{
-+ OSL_TRACE("ReferenceRecord [0x%x]", pStream->Tell() );
-+ bool bRead = true;
-+ long nStart = pStream->Tell();
-+ long nPos = nStart;
-+ // Peek at the ID
-+ sal_Int16 Id;
-+ *pStream >> Id;
-+ pStream->Seek( nPos ); // place back before Id
-+ if ( Id == 0x16 ) // Optional NameRecord
-+ {
-+ NameRecord.reset( new ReferenceNameRecord() );
-+ NameRecord->read( pStream );
-+ }
-+ else if ( Id == 0x0f )
-+ {
-+ pStream->Seek( nStart );
-+ bRead = false;
-+ return bRead; // start of module, terminate read
-+ }
-+
-+ nPos = pStream->Tell(); // mark position, peek at next Id
-+ *pStream >> Id;
-+ pStream->Seek( nPos ); // place back before Id
-+
-+ switch( Id )
-+ {
-+ case 0x0D:
-+ aReferenceRecord.reset( new ReferenceRegisteredRecord() );
-+ break;
-+ case 0x0E:
-+ aReferenceRecord.reset( new ReferenceProjectRecord() );
-+ break;
-+ case 0x2F:
-+ case 0x33:
-+ aReferenceRecord.reset( new ReferenceControlRecord() );
-+ break;
-+ default:
-+ bRead = false;
-+ OSL_TRACE("Big fat error, unknown ID 0x%x", Id);
-+ break;
-+ }
-+ if ( bRead )
-+ aReferenceRecord->read( pStream );
-+ return bRead;
-+}
-+
-+void import( VBA_Impl& rVBA )
-+{
-+ if ( aReferenceRecord.get() )
-+ aReferenceRecord->import( rVBA );
-+}
-+
-+};
-+
-+class DirDumper
-+{
-+public:
-+ProjectSysKindRecord mSysKindRec;
-+ProjectLcidRecord mLcidRec;
-+ProjectLcidInvokeRecord mLcidInvokeRec;
-+ProjectCodePageRecord mCodePageRec;
-+ProjectNameRecord mProjectNameRec;
-+ProjectDocStringRecord mDocStringRec;
-+ProjectHelpFilePath mHelpFileRec;
-+ProjectHelpContextRecord mHelpContextRec;
-+ProjectLibFlagsRecord mLibFlagsRec;
-+ProjectVersionRecord mVersionRec;
-+ProjectConstantsRecord mConstantsRecord;
-+std::vector< ReferenceRecord* > ReferenceArray;
-+
-+DirDumper() {}
-+~DirDumper()
-+{
-+ for ( std::vector< ReferenceRecord* >::iterator it = ReferenceArray.begin(); it != ReferenceArray.end(); ++it )
-+ delete *it;
-+
-+}
-+
-+void read( SvStream* pStream )
-+{
-+ sal_Int32 nPos = pStream->Tell();
-+#ifdef DEBUG
-+ std::ofstream aDump("dir.dump");
-+ while ( !pStream->IsEof() )
-+ {
-+ sal_Int8 aByte;
-+ *pStream >> aByte;
-+ aDump << aByte;
-+ }
-+ aDump.flush();
-+#endif
-+ pStream->Seek( nPos );
-+ readProjectInformation( pStream );
-+ readProjectReferenceInformation( pStream );
-+}
-+
-+void readProjectReferenceInformation( SvStream* pStream )
-+{
-+ bool bKeepReading = true;
-+ while( bKeepReading )
-+ {
-+ ReferenceRecord* pRef = new ReferenceRecord();
-+ bKeepReading = pRef->read( pStream );
-+ if ( bKeepReading )
-+ ReferenceArray.push_back( pRef );
-+ }
-+}
-+
-+void readProjectInformation( SvStream* pStream )
-+{
-+ mSysKindRec.read( pStream );
-+ mLcidRec.read( pStream );
-+ mLcidInvokeRec.read( pStream );
-+ mCodePageRec.read( pStream );
-+ mProjectNameRec.read( pStream );
-+ mDocStringRec.read( pStream );
-+ mHelpFileRec.read( pStream );
-+ mHelpContextRec.read( pStream );
-+ mLibFlagsRec.read( pStream );
-+ mVersionRec.read( pStream );
-+ sal_Int32 nPos = pStream->Tell();
-+ sal_uInt16 nTmp;
-+ *pStream >> nTmp;
-+ if ( nTmp == 0x0C )
-+ {
-+ pStream->Seek( nPos );
-+ mConstantsRecord.read( pStream );
-+ }
-+ OSL_TRACE("After Information pos is 0x%x", pStream->Tell() );
-+}
-+
-+void import( VBA_Impl& rVBA )
-+{
-+ // get project references
-+ for ( std::vector< ReferenceRecord* >::iterator it = ReferenceArray.begin(); it != ReferenceArray.end(); ++it )
-+ (*it)->import( rVBA );
-+ rVBA.SetProjectName( mProjectNameRec.ProjectName );
-+
-+}
-+};
-+
-+
- /*
- A few urls which may in the future be of some use
- http://www.virusbtn.com/vb2000/Programme/papers/bontchev.pdf
-@@ -154,7 +947,21 @@ int VBA_Impl::ReadVBAProject(const SvStorageRef &rxVBAStorage)
- xVBAProject = rxVBAStorage->OpenSotStream(
- String( RTL_CONSTASCII_USTRINGPARAM( "_VBA_PROJECT" ) ),
- STREAM_STD_READ | STREAM_NOCREATE );
--
-+ // read Dir stream
-+ SvStorageStreamRef xDir = rxVBAStorage->OpenSotStream(
-+ String( RTL_CONSTASCII_USTRINGPARAM( "dir" ) ),
-+ STREAM_STD_READ | STREAM_NOCREATE );
-+// disable read and import of Dir stream bits, e.g. project references and
-+// project name for 3.1 ( a bit unstable yet )
-+#if 1
-+ // decompress the stream
-+ std::auto_ptr< SvMemoryStream > xCmpDir;
-+ xCmpDir.reset( MSLZSS::decompressAsStream( xDir, 0 ) );
-+ // try to parse the dir stream
-+ DirDumper dDump;
-+ dDump.read( xCmpDir.get() );
-+ dDump.import( *this );
-+#endif
- if( !xVBAProject.Is() || SVSTREAM_OK != xVBAProject->GetError() )
- {
- DBG_WARNING("Not able to find vba project, cannot find macros");
-@@ -454,6 +1261,7 @@ bool VBA_Impl::Open( const String &rToplevel, const String &rSublevel )
- if( !xMacros.Is() || SVSTREAM_OK != xMacros->GetError() )
- {
- DBG_WARNING("No Macros Storage");
-+ OSL_TRACE("No Macros Storage");
- }
- else
- {
-@@ -463,6 +1271,7 @@ bool VBA_Impl::Open( const String &rToplevel, const String &rSublevel )
- if( !xVBA.Is() || SVSTREAM_OK != xVBA->GetError() )
- {
- DBG_WARNING("No Visual Basic in Storage");
-+ OSL_TRACE("No Visual Basic in Storage");
- }
- else
- {
-@@ -477,6 +1286,7 @@ bool VBA_Impl::Open( const String &rToplevel, const String &rSublevel )
- * ( value ) is either a Class Module, Form Module or a plain VB Module. */
- SvStorageStreamRef xProject = xMacros->OpenSotStream(
- String( RTL_CONSTASCII_USTRINGPARAM( "PROJECT" ) ) );
-+
- SvStorageStream* pStp = xProject;
- UniString tmp;
- static const String sThisDoc( RTL_CONSTASCII_USTRINGPARAM( "ThisDocument" ) );
-diff --git filter/source/msfilter/msvbasic.hxx filter/source/msfilter/msvbasic.hxx
-index b163662..f35e3c8 100644
---- filter/source/msfilter/msvbasic.hxx
-+++ filter/source/msfilter/msvbasic.hxx
-@@ -36,6 +36,8 @@
- #include <tools/dynary.hxx>
- #include <vector>
- #include <map>
-+#include <com/sun/star/script/ModuleType.hpp>
-+using namespace ::com::sun::star::script::ModuleType;
-
- /* class VBA:
- * The VBA class provides a set of methods to handle Visual Basic For
-@@ -86,8 +88,14 @@ public:
- //
- // #117718# member map of module names to types of module
- ModType GetModuleType( const UniString& rModuleName );
-- std::vector<String> maReferences;
-+ rtl::OUString& ProjectName() { return msProjectName; }
-+ void SetProjectName( const rtl::OUString& rPName ) { msProjectName = rPName; }
-+ const std::vector<rtl::OUString>& ProjectReferences() { return maPrjReferences; }
-+ void AddProjectReference( const rtl::OUString& rProject ) { maPrjReferences.push_back( rProject); }
-+ SvStorage* GetStorage() { return xStor; }
- private:
-+ std::vector<rtl::OUString> maReferences;
-+ std::vector<rtl::OUString> maPrjReferences;
- struct VBAOffset_Impl
- {
- String sName;
-@@ -113,6 +121,7 @@ private:
- int ReadVBAProject(const SvStorageRef &rxVBAStorage);
- int DecompressVBA(int index, SvStorageStreamRef &rxVBAStream);
- sal_uInt8 ReadPString(SvStorageStreamRef &xVBAProject, bool bIsUnicode);
-+ rtl::OUString msProjectName;
- };
-
- #endif
-diff --git filter/source/msfilter/svxmsbas.cxx filter/source/msfilter/svxmsbas.cxx
-index 23ebeac..f98c1be 100644
---- filter/source/msfilter/svxmsbas.cxx
-+++ filter/source/msfilter/svxmsbas.cxx
-@@ -65,26 +65,47 @@ using rtl::OUString;
-
- static ::rtl::OUString sVBAOption( RTL_CONSTASCII_USTRINGPARAM( "Option VBASupport 1\n" ) );
-
-+void SvxImportMSVBasic::extractAttribute( const String& rAttribute, const String& rModName )
-+{
-+ // format of the attribute we are interested in is
-+ // Attribute VB_Control = "ControlName", intString, MSForms, ControlTypeAsString
-+ // e.g.
-+ // Attribute VB_Control = "CommandButton1, 201, 19, MSForms, CommandButton"
-+ String sControlAttribute( RTL_CONSTASCII_USTRINGPARAM("Attribute VB_Control = \"") );
-+ if ( rAttribute.Search( sControlAttribute ) != STRING_NOTFOUND )
-+ {
-+ String sRest = rAttribute.Copy( sControlAttribute.Len() );
-+ xub_StrLen nPos = 0;
-+ String sCntrlName = sRest.GetToken( 0, ',', nPos );
-+
-+ sal_Int32 nCntrlId = sRest.GetToken( 0, ',', nPos).ToInt32();
-+ OSL_TRACE("In module %s, assiging %d controlname %s",
-+ rtl::OUStringToOString( rModName, RTL_TEXTENCODING_UTF8 ).getStr(), nCntrlId,
-+ rtl::OUStringToOString( sCntrlName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ m_ModuleNameToObjIdHash[ rModName ][ nCntrlId ] = sCntrlName;
-+ }
-+}
-+
- int SvxImportMSVBasic::Import( const String& rStorageName,
-- const String &rSubStorageName,
-- BOOL bAsComment, BOOL bStripped )
-+ const String &rSubStorageName,
-+ BOOL bAsComment, BOOL bStripped )
- {
- std::vector< String > codeNames;
- return Import( rStorageName, rSubStorageName, codeNames, bAsComment, bStripped );
- }
--
- int SvxImportMSVBasic::Import( const String& rStorageName,
- const String &rSubStorageName,
- const std::vector< String >& codeNames,
- BOOL bAsComment, BOOL bStripped )
- {
-+ msProjectName = rtl::OUString();
- int nRet = 0;
-- if( bImport && ImportCode_Impl( rStorageName, rSubStorageName, codeNames,
-+ if( bImport && ImportCode_Impl( rStorageName, rSubStorageName, codeNames,
- bAsComment, bStripped ))
- nRet |= 1;
-
- if (bImport)
-- ImportForms_Impl(rStorageName, rSubStorageName);
-+ ImportForms_Impl(rStorageName, rSubStorageName, !bAsComment);
-
- if( bCopy && CopyStorage_Impl( rStorageName, rSubStorageName ))
- nRet |= 2;
-@@ -93,9 +114,44 @@ int SvxImportMSVBasic::Import( const String& rStorageName,
- }
-
- bool SvxImportMSVBasic::ImportForms_Impl(const String& rStorageName,
-- const String& rSubStorageName)
-+ const String& rSubStorageName, BOOL bVBAMode )
- {
-- SvStorageRef xVBAStg(xRoot->OpenSotStorage(rStorageName,
-+ BOOL bRet = FALSE;
-+ // #FIXME VBA_Impl ( or some other new class ) should handle both userforms
-+ // and code
-+ VBA_Impl aVBA( *xRoot, TRUE );
-+ // This call is a waste we read the source ( again ) only to get the refereneces
-+ // *AGAIN*, we really need to rewrite all of this
-+ aVBA.Open( rStorageName, rSubStorageName );
-+
-+ bRet = ImportForms_Impl( aVBA, rStorageName, rSubStorageName, bVBAMode );
-+ std::vector<rtl::OUString> sProjectRefs = aVBA.ProjectReferences();
-+
-+ for ( std::vector<rtl::OUString>::iterator it = sProjectRefs.begin(); it != sProjectRefs.end(); ++it )
-+ {
-+ rtl::OUString sFileName = *it;
-+#ifndef WIN
-+#ifdef DEBUG
-+ // hacky test code to read referenced projects on linux
-+ sal_Int32 nPos = (*it).lastIndexOf('\\');
-+ sFileName = (*it).copy( nPos + 1 );
-+ sFileName = rtl::OUString::createFromAscii("~/Documents/") + sFileName;
-+#endif
-+#endif
-+ SotStorageRef rRoot = new SotStorage( sFileName, STREAM_STD_READWRITE, STORAGE_TRANSACTED );
-+ VBA_Impl refVBA( *rRoot, TRUE );
-+ refVBA.Open( rStorageName, rSubStorageName );
-+ // The return from ImportForms doesn't indicate and error ( it could )
-+ // but also it just means no userforms were imported
-+ if ( ImportForms_Impl( refVBA, rStorageName, rSubStorageName, bVBAMode ) )
-+ bRet = true; // mark that at least on userform was imported
-+ }
-+ return bRet;
-+}
-+
-+bool SvxImportMSVBasic::ImportForms_Impl( VBA_Impl& rVBA, const String& rStorageName, const String& rSubStorageName, BOOL bVBAMode )
-+{
-+ SvStorageRef xVBAStg(rVBA.GetStorage()->OpenSotStorage(rStorageName,
- STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYALL));
- if (!xVBAStg.Is() || xVBAStg->GetError())
- return false;
-@@ -128,6 +184,10 @@ bool SvxImportMSVBasic::ImportForms_Impl(const String& rStorageName,
- DBG_ASSERT( xLibContainer.is(), "No BasicContainer!" );
-
- String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
-+
-+ if (rVBA.ProjectName().getLength() )
-+ aLibName = rVBA.ProjectName();
-+ OSL_TRACE( "userformage lib name %s", rtl::OUStringToOString( aLibName, RTL_TEXTENCODING_UTF8 ).getStr() );
- Reference<XNameContainer> xLib;
- if (xLibContainer.is())
- {
-@@ -177,7 +237,17 @@ bool SvxImportMSVBasic::ImportForms_Impl(const String& rStorageName,
- xSF->createInstance(
- OUString(RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.awt.UnoControlDialogModel"))), uno::UNO_QUERY);
--
-+ // #FIXME HACK - mark the Model with the VBA mode
-+ // In vba mode the imported userform uses 100th mm as units
-+ // or geometry
-+ // In non vba mode MAP_APPFONT is used ( same as normal basic
-+ // dialogs
-+ if ( bVBAMode )
-+ {
-+ Reference<XPropertySet> xDlgProps(xDialog, UNO_QUERY);
-+ if ( xDlgProps.is() )
-+ xDlgProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VBAForm") ), uno::makeAny( sal_True ) );
-+ }
- OCX_UserForm aForm(xVBAStg, *aIter, *aIter, xDialog, xSF );
- aForm.pDocSh = &rDocSh;
- sal_Bool bOk = aForm.Read(xTypes);
-@@ -246,8 +316,34 @@ BOOL SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName,
- {
- BOOL bRet = FALSE;
- VBA_Impl aVBA( *xRoot, bAsComment );
-+
- if( aVBA.Open(rStorageName,rSubStorageName) )
- {
-+ msProjectName = aVBA.ProjectName();
-+
-+ if ( msProjectName.getLength() )
-+ rDocSh.GetBasicManager()->SetName( msProjectName ); // set name of Project
-+
-+ bRet = ImportCode_Impl( aVBA, codeNames, bAsComment, bStripped );
-+ std::vector<rtl::OUString> sProjectRefs = aVBA.ProjectReferences();
-+
-+ for ( std::vector<rtl::OUString>::iterator it = sProjectRefs.begin(); it != sProjectRefs.end(); ++it )
-+ {
-+ rtl::OUString sFileName = *it;
-+ OSL_TRACE("referenced project %s ", rtl::OUStringToOString( sFileName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ SotStorageRef rRoot = new SotStorage( sFileName, STREAM_STD_READWRITE, STORAGE_TRANSACTED );
-+ VBA_Impl refVBA( *rRoot, bAsComment );
-+ std::vector< String > codeNamesNone;
-+ if( refVBA.Open(rStorageName,rSubStorageName) && ImportCode_Impl( refVBA, codeNamesNone, bAsComment, bStripped ) )
-+ bRet = TRUE; // mark that some code was imported
-+ }
-+ }
-+ return bRet;
-+}
-+
-+BOOL SvxImportMSVBasic::ImportCode_Impl( VBA_Impl& aVBA, const std::vector< String >& codeNames, BOOL bAsComment, BOOL bStripped )
-+{
-+ BOOL bRet = FALSE;
- SFX_APP()->EnterBasicCall();
- Reference<XLibraryContainer> xLibContainer = rDocSh.GetBasicContainer();
- Reference<XVBACompat> xVBACompat( xLibContainer, UNO_QUERY );
-@@ -260,6 +356,8 @@ BOOL SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName,
- UINT16 nStreamCount = aVBA.GetNoStreams();
- Reference<XNameContainer> xLib;
- String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
-+ if ( aVBA.ProjectName().getLength() )
-+ aLibName = aVBA.ProjectName();
- if( xLibContainer.is() && nStreamCount )
- {
- if( !xLibContainer->hasByName( aLibName ) )
-@@ -409,7 +507,11 @@ BOOL SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName,
- if( nEnd == STRING_NOTFOUND )
- pStr->Erase();
- else
-+ {
-+ String sAttr= pStr->Copy( nBegin, (nEnd-nBegin)+1);
-+ extractAttribute( sAttr, sModule );
- pStr->Erase(nBegin, (nEnd-nBegin)+1);
-+ }
- }
- }
- if( aDecompressed.Get(j)->Len() )
-@@ -488,7 +590,6 @@ BOOL SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName,
- bRet = true;
- }
- SFX_APP()->LeaveBasicCall();
-- }
- return bRet;
- }
-
-diff --git forms/source/component/FormComponent.cxx forms/source/component/FormComponent.cxx
-index 2513636..55d19fb 100644
---- forms/source/component/FormComponent.cxx
-+++ forms/source/component/FormComponent.cxx
-@@ -2751,8 +2751,8 @@ void SAL_CALL OBoundControlModel::setValueBinding( const Reference< XValueBindin
- OSL_PRECOND( m_bSupportsExternalBinding, "OBoundControlModel::setValueBinding: How did you reach this method?" );
- // the interface for this method should not have been exposed if we do not
- // support binding to external data
--
-- if ( !impl_approveValueBinding_nolock( _rxBinding ) )
-+ // allow reset
-+ if ( _rxBinding.is() && !impl_approveValueBinding_nolock( _rxBinding ) )
- {
- throw IncompatibleTypesException(
- FRM_RES_STRING( RID_STR_INCOMPATIBLE_TYPES ),
-diff --git forms/source/component/GroupManager.cxx forms/source/component/GroupManager.cxx
-index dfc679d..c4c8224 100644
---- forms/source/component/GroupManager.cxx
-+++ forms/source/component/GroupManager.cxx
-@@ -124,14 +124,13 @@ OGroupComp::OGroupComp(const Reference<XPropertySet>& rxSet, sal_Int32 nInsertPo
- ,m_xControlModel(rxSet,UNO_QUERY)
- ,m_nPos( nInsertPos )
- ,m_nTabIndex(0)
-+ ,m_aName( OGroupManager::GetGroupName( rxSet ) )
- {
- if (m_xComponent.is())
- {
- if (hasProperty( PROPERTY_TABINDEX, m_xComponent ) )
- // Indices kleiner 0 werden wie 0 behandelt
- m_nTabIndex = Max(getINT16(m_xComponent->getPropertyValue( PROPERTY_TABINDEX )) , sal_Int16(0));
--
-- m_xComponent->getPropertyValue( PROPERTY_NAME ) >>= m_aName;
- }
- }
-
-@@ -318,7 +317,8 @@ void OGroupManager::removeFromGroupMap(const ::rtl::OUString& _sGroupName,const
- aFind->second.RemoveComponent( _xSet );
-
- // Wenn Anzahl der Gruppenelemente == 1 ist, Gruppe deaktivieren
-- if ( aFind->second.Count() == 1 )
-+ sal_Int32 nCount = aFind->second.Count();
-+ if ( nCount == 1 || nCount == 0 )
- {
- OActiveGroups::iterator aActiveFind = ::std::find(
- m_aActiveGroupMap.begin(),
-@@ -329,7 +329,7 @@ void OGroupManager::removeFromGroupMap(const ::rtl::OUString& _sGroupName,const
- {
- // the group is active. Deactivate it if the remaining component
- // is *no* radio button
-- if ( !isRadioButton( aFind->second.GetObject( 0 ) ) )
-+ if ( nCount == 0 || !isRadioButton( aFind->second.GetObject( 0 ) ) )
- m_aActiveGroupMap.erase( aActiveFind );
- }
- }
-@@ -338,6 +338,8 @@ void OGroupManager::removeFromGroupMap(const ::rtl::OUString& _sGroupName,const
-
- // Bei Component als PropertyChangeListener abmelden
- _xSet->removePropertyChangeListener( PROPERTY_NAME, this );
-+ if (hasProperty(PROPERTY_GROUP_NAME, _xSet))
-+ _xSet->removePropertyChangeListener( PROPERTY_GROUP_NAME, this );
- if (hasProperty(PROPERTY_TABINDEX, _xSet))
- _xSet->removePropertyChangeListener( PROPERTY_TABINDEX, this );
- }
-@@ -348,10 +350,23 @@ void SAL_CALL OGroupManager::propertyChange(const PropertyChangeEvent& evt) thro
-
- // Component aus Gruppe entfernen
- ::rtl::OUString sGroupName;
-- if (evt.PropertyName == PROPERTY_NAME)
-+ if (hasProperty( PROPERTY_GROUP_NAME, xSet ))
-+ xSet->getPropertyValue( PROPERTY_GROUP_NAME ) >>= sGroupName;
-+ if (evt.PropertyName == PROPERTY_NAME) {
-+ if (sGroupName.getLength() > 0)
-+ return; // group hasn't changed; ignore this name change.
-+ // no GroupName; use Name as GroupNme
- evt.OldValue >>= sGroupName;
-+ }
-+ else if (evt.PropertyName == PROPERTY_GROUP_NAME) {
-+ evt.OldValue >>= sGroupName;
-+ if (sGroupName.getLength() == 0) {
-+ // No prior GroupName; fallback to Nme
-+ xSet->getPropertyValue( PROPERTY_NAME ) >>= sGroupName;
-+ }
-+ }
- else
-- xSet->getPropertyValue( PROPERTY_NAME ) >>= sGroupName;
-+ sGroupName = GetGroupName( xSet );
-
- removeFromGroupMap(sGroupName,xSet);
-
-@@ -434,8 +449,7 @@ void OGroupManager::InsertElement( const Reference<XPropertySet>& xSet )
- m_pCompGroup->InsertComponent( xSet );
-
- // Component in Gruppe aufnehmen
-- ::rtl::OUString sGroupName;
-- xSet->getPropertyValue( PROPERTY_NAME ) >>= sGroupName;
-+ ::rtl::OUString sGroupName( GetGroupName( xSet ) );
-
- OGroupArr::iterator aFind = m_aGroupArr.find(sGroupName);
-
-@@ -473,6 +487,8 @@ void OGroupManager::InsertElement( const Reference<XPropertySet>& xSet )
-
- // Bei Component als PropertyChangeListener anmelden
- xSet->addPropertyChangeListener( PROPERTY_NAME, this );
-+ if (hasProperty(PROPERTY_GROUP_NAME, xSet))
-+ xSet->addPropertyChangeListener( PROPERTY_GROUP_NAME, this );
-
- // Tabindex muss nicht jeder unterstuetzen
- if (hasProperty(PROPERTY_TABINDEX, xSet))
-@@ -489,12 +505,26 @@ void OGroupManager::RemoveElement( const Reference<XPropertySet>& xSet )
- return;
-
- // Component aus Gruppe entfernen
-- ::rtl::OUString sGroupName;
-- xSet->getPropertyValue( PROPERTY_NAME ) >>= sGroupName;
-+ ::rtl::OUString sGroupName( GetGroupName( xSet ) );
-
- removeFromGroupMap(sGroupName,xSet);
- }
-
-+::rtl::OUString OGroupManager::GetGroupName( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xComponent )
-+{
-+ if (!xComponent.is())
-+ return ::rtl::OUString();
-+ ::rtl::OUString sGroupName;
-+ if (hasProperty( PROPERTY_GROUP_NAME, xComponent )) {
-+ xComponent->getPropertyValue( PROPERTY_GROUP_NAME ) >>= sGroupName;
-+ if (sGroupName.getLength() == 0)
-+ xComponent->getPropertyValue( PROPERTY_NAME ) >>= sGroupName;
-+ }
-+ else
-+ xComponent->getPropertyValue( PROPERTY_NAME ) >>= sGroupName;
-+ return sGroupName;
-+}
-+
- //.........................................................................
- } // namespace frm
- //.........................................................................
-diff --git forms/source/component/GroupManager.hxx forms/source/component/GroupManager.hxx
-index f514771..2143c76 100644
---- forms/source/component/GroupManager.hxx
-+++ forms/source/component/GroupManager.hxx
-@@ -217,6 +217,8 @@ public:
- void getGroup(sal_Int32 nGroup, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel> >& _rGroup, ::rtl::OUString& Name);
- void getGroupByName(const ::rtl::OUString& Name, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel> >& _rGroup);
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel> > getControlModels();
-+
-+ static ::rtl::OUString GetGroupName( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xComponent );
- };
-
-
-diff --git forms/source/component/ListBox.cxx forms/source/component/ListBox.cxx
-index fe24fc2..51661d1 100644
---- forms/source/component/ListBox.cxx
-+++ forms/source/component/ListBox.cxx
-@@ -1555,6 +1555,8 @@ namespace frm
- void SAL_CALL OListBoxControl::itemStateChanged(const ItemEvent& _rEvent) throw(RuntimeException)
- {
- // forward this to our listeners
-+ Reference< XChild > xChild( getModel(), UNO_QUERY );
-+ if ( xChild.is() && xChild->getParent().is() )
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_aItemListeners.getLength() )
-@@ -1567,6 +1569,8 @@ namespace frm
- m_pItemBroadcaster->addEvent( new ItemEventDescription( _rEvent ), this );
- }
- }
-+ else
-+ m_aItemListeners.notifyEach( &XItemListener::itemStateChanged, _rEvent );
-
- // and do the handling for the ChangeListeners
- ::osl::ClearableMutexGuard aGuard(m_aMutex);
-diff --git forms/source/component/RadioButton.cxx forms/source/component/RadioButton.cxx
-index 27ae8cd..05e9bb6 100644
---- forms/source/component/RadioButton.cxx
-+++ forms/source/component/RadioButton.cxx
-@@ -28,6 +28,7 @@
- // MARKER(update_precomp.py): autogen include statement, do not remove
- #include "precompiled_forms.hxx"
- #include "RadioButton.hxx"
-+#include "GroupManager.hxx"
- #include "property.hxx"
- #ifndef _FRM_PROPERTY_HRC_
- #include "property.hrc"
-@@ -119,6 +120,7 @@ ORadioButtonModel::ORadioButtonModel(const Reference<XMultiServiceFactory>& _rxF
- m_nClassId = FormComponentType::RADIOBUTTON;
- m_aLabelServiceName = FRM_SUN_COMPONENT_GROUPBOX;
- initValueProperty( PROPERTY_STATE, PROPERTY_ID_STATE );
-+ startAggregatePropertyListening( PROPERTY_GROUP_NAME );
- }
-
- //------------------------------------------------------------------
-@@ -166,7 +168,11 @@ StringSequence SAL_CALL ORadioButtonModel::getSupportedServiceNames() throw(Runt
- void ORadioButtonModel::SetSiblingPropsTo(const ::rtl::OUString& rPropName, const Any& rValue)
- {
- // mein Name
-- ::rtl::OUString sMyName(m_aName);
-+ ::rtl::OUString sMyGroup;
-+ if (hasProperty(PROPERTY_GROUP_NAME, this))
-+ this->getPropertyValue(PROPERTY_GROUP_NAME) >>= sMyGroup;
-+ if (sMyGroup.getLength() == 0)
-+ sMyGroup = m_aName;
-
- // meine Siblings durchiterieren
- Reference<XIndexAccess> xIndexAccess(getParent(), UNO_QUERY);
-@@ -174,8 +180,9 @@ void ORadioButtonModel::SetSiblingPropsTo(const ::rtl::OUString& rPropName, cons
- {
- Reference<XPropertySet> xMyProps;
- query_interface(static_cast<XWeak*>(this), xMyProps);
-- ::rtl::OUString sCurrentName;
-- for (sal_Int32 i=0; i<xIndexAccess->getCount(); ++i)
-+ ::rtl::OUString sCurrentGroup;
-+ sal_Int32 nNumSiblings = xIndexAccess->getCount();
-+ for (sal_Int32 i=0; i<nNumSiblings; ++i)
- {
- Reference<XPropertySet> xSiblingProperties(*(InterfaceRef*)xIndexAccess->getByIndex(i).getValue(), UNO_QUERY);
- if (!xSiblingProperties.is())
-@@ -192,8 +199,8 @@ void ORadioButtonModel::SetSiblingPropsTo(const ::rtl::OUString& rPropName, cons
- continue;
-
- // das 'zur selben Gruppe gehoeren' wird am Namen festgemacht
-- xSiblingProperties->getPropertyValue(PROPERTY_NAME) >>= sCurrentName;
-- if (sCurrentName == sMyName)
-+ sCurrentGroup = OGroupManager::GetGroupName( xSiblingProperties );
-+ if (sCurrentGroup == sMyGroup)
- xSiblingProperties->setPropertyValue(rPropName, rValue);
- }
- }
-@@ -220,40 +227,7 @@ void ORadioButtonModel::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, cons
- // die andere Richtung : wenn sich mein Name aendert ...
- if (nHandle == PROPERTY_ID_NAME)
- {
-- // ... muss ich testen, ob ich Siblings mit dem selben Namen habe, damit ich deren ControlSource uebernehmen kann
-- Reference<XIndexAccess> xIndexAccess(getParent(), UNO_QUERY);
-- if (xIndexAccess.is())
-- {
-- ::rtl::OUString sName;
-- ::rtl::OUString sControlSource;
--
-- Reference<XPropertySet> xMyProps;
-- query_interface(static_cast<XWeak*>(this), xMyProps);
-- for (sal_Int32 i=0; i<xIndexAccess->getCount(); ++i)
-- {
-- Reference<XPropertySet> xSiblingProperties(*(InterfaceRef*)xIndexAccess->getByIndex(i).getValue(), UNO_QUERY);
-- if (!xSiblingProperties.is())
-- continue;
--
-- if (xMyProps == xSiblingProperties)
-- // nur wenn ich nicht mich selber gefunden habe
-- continue;
--
-- sal_Int16 nType = 0;
-- xSiblingProperties->getPropertyValue(PROPERTY_CLASSID) >>= nType;
-- if (nType != FormComponentType::RADIOBUTTON)
-- // nur Radio-Buttons
-- continue;
--
-- xSiblingProperties->getPropertyValue(PROPERTY_NAME) >>= sName;
-- // Control, das zur gleichen Gruppe gehoert ?
-- if (rValue == sName)
-- {
-- setPropertyValue(PROPERTY_CONTROLSOURCE, xSiblingProperties->getPropertyValue(PROPERTY_CONTROLSOURCE));
-- break;
-- }
-- }
-- }
-+ setControlSource();
- }
-
- if (nHandle == PROPERTY_ID_DEFAULT_STATE)
-@@ -271,6 +245,52 @@ void ORadioButtonModel::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, cons
- }
- }
-
-+void ORadioButtonModel::setControlSource()
-+{
-+ Reference<XIndexAccess> xIndexAccess(getParent(), UNO_QUERY);
-+ if (xIndexAccess.is())
-+ {
-+ ::rtl::OUString sName, sGroupName;
-+
-+ if (hasProperty(PROPERTY_GROUP_NAME, this))
-+ this->getPropertyValue(PROPERTY_GROUP_NAME) >>= sGroupName;
-+ this->getPropertyValue(PROPERTY_NAME) >>= sName;
-+
-+ Reference<XPropertySet> xMyProps;
-+ query_interface(static_cast<XWeak*>(this), xMyProps);
-+ for (sal_Int32 i=0; i<xIndexAccess->getCount(); ++i)
-+ {
-+ Reference<XPropertySet> xSiblingProperties(*(InterfaceRef*)xIndexAccess->getByIndex(i).getValue(), UNO_QUERY);
-+ if (!xSiblingProperties.is())
-+ continue;
-+
-+ if (xMyProps == xSiblingProperties)
-+ // nur wenn ich nicht mich selber gefunden habe
-+ continue;
-+
-+ sal_Int16 nType = 0;
-+ xSiblingProperties->getPropertyValue(PROPERTY_CLASSID) >>= nType;
-+ if (nType != FormComponentType::RADIOBUTTON)
-+ // nur Radio-Buttons
-+ continue;
-+
-+ ::rtl::OUString sSiblingName, sSiblingGroupName;
-+ if (hasProperty(PROPERTY_GROUP_NAME, xSiblingProperties))
-+ xSiblingProperties->getPropertyValue(PROPERTY_GROUP_NAME) >>= sSiblingGroupName;
-+ xSiblingProperties->getPropertyValue(PROPERTY_NAME) >>= sSiblingName;
-+
-+ if ((sGroupName.getLength() == 0 && sSiblingGroupName.getLength() == 0 && // (no group name
-+ sName == sSiblingName) || // names match) or
-+ (sGroupName.getLength() != 0 && sSiblingGroupName.getLength() != 0 && // (have group name
-+ sGroupName == sSiblingGroupName)) // they match)
-+ {
-+ setPropertyValue(PROPERTY_CONTROLSOURCE, xSiblingProperties->getPropertyValue(PROPERTY_CONTROLSOURCE));
-+ break;
-+ }
-+ }
-+ }
-+}
-+
- //------------------------------------------------------------------------------
- void ORadioButtonModel::describeFixedProperties( Sequence< Property >& _rProps ) const
- {
-@@ -360,6 +380,13 @@ void ORadioButtonModel::_propertyChanged(const PropertyChangeEvent& _rEvent) thr
- SetSiblingPropsTo( PROPERTY_STATE, aZero );
- }
- }
-+ else if ( _rEvent.PropertyName.equals( PROPERTY_GROUP_NAME ) )
-+ {
-+ setControlSource();
-+ // Can't call OReferenceValueComponent::_propertyChanged(), as it
-+ // doesn't know what to do with the GroupName property.
-+ return;
-+ }
-
- OReferenceValueComponent::_propertyChanged( _rEvent );
- }
-diff --git forms/source/component/RadioButton.hxx forms/source/component/RadioButton.hxx
-index 0b1ab0e..0d10b05 100644
---- forms/source/component/RadioButton.hxx
-+++ forms/source/component/RadioButton.hxx
-@@ -84,6 +84,8 @@ private:
- our mutex is aquired exactly once
- */
- void setNewAggregateState( const ::com::sun::star::uno::Any& _rValue );
-+
-+ void setControlSource();
- };
-
- //==================================================================
-diff --git forms/source/inc/frm_strings.hxx forms/source/inc/frm_strings.hxx
-index 1f57f42..ae411ac 100644
---- forms/source/inc/frm_strings.hxx
-+++ forms/source/inc/frm_strings.hxx
-@@ -97,6 +97,7 @@ namespace frm
- FORMS_CONSTASCII_STRING( PROPERTY_TABINDEX, "TabIndex" );
- FORMS_CONSTASCII_STRING( PROPERTY_TAG, "Tag" );
- FORMS_CONSTASCII_STRING( PROPERTY_NAME, "Name" );
-+ FORMS_CONSTASCII_STRING( PROPERTY_GROUP_NAME, "GroupName" );
- FORMS_CONSTASCII_STRING( PROPERTY_CLASSID, "ClassId" );
- FORMS_CONSTASCII_STRING( PROPERTY_FETCHSIZE, "FetchSize" );
- FORMS_CONSTASCII_STRING( PROPERTY_VALUE, "Value" );
-diff --git forms/source/inc/property.hrc forms/source/inc/property.hrc
-index e70dff4..5c44b93 100644
---- forms/source/inc/property.hrc
-+++ forms/source/inc/property.hrc
-@@ -60,7 +60,8 @@ namespace frm
- #define PROPERTY_ID_INPUT_REQUIRED (PROPERTY_ID_START + 19)
- #define PROPERTY_ID_WRITING_MODE (PROPERTY_ID_START + 20)
- #define PROPERTY_ID_CONTEXT_WRITING_MODE (PROPERTY_ID_START + 21)
--#define PROPERTY_ID_VERTICAL_ALIGN (PROPERTY_ID_START + 22)
-+#define PROPERTY_ID_GROUP_NAME (PROPERTY_ID_START + 22)
-+#define PROPERTY_ID_VERTICAL_ALIGN (PROPERTY_ID_START + 23)
- // free
- // free
- // free
-diff --git formula/inc/formula/FormulaCompiler.hxx formula/inc/formula/FormulaCompiler.hxx
-index 47fefb3..1f40d74 100644
---- formula/inc/formula/FormulaCompiler.hxx
-+++ formula/inc/formula/FormulaCompiler.hxx
-@@ -219,6 +219,8 @@ public:
- void SetCompileForFAP( BOOL bVal )
- { bCompileForFAP = bVal; bIgnoreErrors = bVal; }
-
-+ static bool IsOpCodeVolatile( OpCode eOp );
-+
- static BOOL DeQuote( String& rStr );
-
- static const String& GetNativeSymbol( OpCode eOp );
-diff --git formula/source/core/api/FormulaCompiler.cxx formula/source/core/api/FormulaCompiler.cxx
-index e54ac6a..4c2ab61 100644
---- formula/source/core/api/FormulaCompiler.cxx
-+++ formula/source/core/api/FormulaCompiler.cxx
-@@ -741,6 +741,30 @@ OpCode FormulaCompiler::GetEnglishOpCode( const String& rName ) const
- return bFound ? (*iLook).second : OpCode(ocNone);
- }
-
-+bool FormulaCompiler::IsOpCodeVolatile( OpCode eOp )
-+{
-+ switch (eOp)
-+ {
-+ // no parameters:
-+ case ocRandom:
-+ case ocGetActDate:
-+ case ocGetActTime:
-+ // one parameter:
-+ case ocFormula:
-+ case ocInfo:
-+ // more than one parameters:
-+ // ocIndirect/ocIndirectXL otherwise would have to do
-+ // StopListening and StartListening on a reference for every
-+ // interpreted value.
-+ case ocIndirect:
-+ case ocIndirectXL:
-+ // ocOffset results in indirect references.
-+ case ocOffset:
-+ return true;
-+ }
-+ return false;
-+}
-+
- // Remove quotes, escaped quotes are unescaped.
- BOOL FormulaCompiler::DeQuote( String& rStr )
- {
-@@ -957,44 +981,32 @@ void FormulaCompiler::Factor()
- {
- if( nNumFmt == NUMBERFORMAT_UNDEFINED )
- nNumFmt = lcl_GetRetFormat( eOp );
-- // Functions that have to be always recalculated
-- switch( eOp )
-+
-+ if ( IsOpCodeVolatile(eOp) )
-+ pArr->SetRecalcModeAlways();
-+ else
- {
-- // no parameters:
-- case ocRandom:
-- case ocGetActDate:
-- case ocGetActTime:
-- // one parameter:
-- case ocFormula:
-- case ocInfo:
-- // more than one parameters:
-- // ocIndirect/ocIndirectXL otherwise would have to do
-- // StopListening and StartListening on a reference for every
-- // interpreted value.
-- case ocIndirect:
-- case ocIndirectXL:
-- // ocOffset results in indirect references.
-- case ocOffset:
-- pArr->SetRecalcModeAlways();
-- break;
-- // Functions recalculated on every document load.
-- // Don't use SetRecalcModeOnLoad() which would override
-- // ModeAlways.
-- case ocConvert :
-- pArr->AddRecalcMode( RECALCMODE_ONLOAD );
-- break;
-- // If the referred cell is moved the value changes.
-- case ocColumn :
-- case ocRow :
-- // ocCell needs recalc on move for some possible type values.
-- case ocCell :
-- pArr->SetRecalcModeOnRefMove();
-- break;
-- case ocHyperLink :
-- pArr->SetHyperLink(TRUE);
-- break;
-- default:
-- ; // nothing
-+ switch( eOp )
-+ {
-+ // Functions recalculated on every document load.
-+ // Don't use SetRecalcModeOnLoad() which would override
-+ // ModeAlways.
-+ case ocConvert :
-+ pArr->AddRecalcMode( RECALCMODE_ONLOAD );
-+ break;
-+ // If the referred cell is moved the value changes.
-+ case ocColumn :
-+ case ocRow :
-+ // ocCell needs recalc on move for some possible type values.
-+ case ocCell :
-+ pArr->SetRecalcModeOnRefMove();
-+ break;
-+ case ocHyperLink :
-+ pArr->SetHyperLink(TRUE);
-+ break;
-+ default:
-+ ; // nothing
-+ }
- }
- if (SC_OPCODE_START_NO_PAR <= eOp && eOp < SC_OPCODE_STOP_NO_PAR)
- {
-diff --git offapi/com/sun/star/document/VbaEventId.idl offapi/com/sun/star/document/VbaEventId.idl
-new file mode 100644
-index 0000000..b5af431
---- /dev/null
-+++ offapi/com/sun/star/document/VbaEventId.idl
-@@ -0,0 +1,89 @@
-+/*************************************************************************
-+ *
-+ * 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 __org_openoffice_vba_VbaEventId_idl__
-+#define __org_openoffice_vba_VbaEventId_idl__
-+
-+//=============================================================================
-+
-+module com { module sun { module star { module document {
-+//=============================================================================
-+
-+/* VBA compatibility event id */
-+constants VbaEventId
-+{
-+ // Worksheet
-+ const long VBAEVENT_WORKSHEET_ACTIVATE = 1;
-+ const long VBAEVENT_WORKSHEET_BEFOREDOUBLECLICK = 2;
-+ const long VBAEVENT_WORKSHEET_BEFORERIGHTCLICK = 3;
-+ const long VBAEVENT_WORKSHEET_CALCULATE = 4;
-+ const long VBAEVENT_WORKSHEET_CHANGE = 5;
-+ const long VBAEVENT_WORKSHEET_DEACTIVATE = 6;
-+ const long VBAEVENT_WORKSHEET_FOLLOWHYPERLINK = 7;
-+ const long VBAEVENT_WORKSHEET_PIVOTTABLEUPDATE = 8;
-+ const long VBAEVENT_WORKSHEET_SELECTIONCHANGE = 9;
-+ // Workbook
-+ const long VBAEVENT_WORKBOOK_ACTIVATE = 20;
-+ const long VBAEVENT_WORKBOOK_DEACTIVATE = 21;
-+ const long VBAEVENT_WORKBOOK_OPEN = 22;
-+ const long VBAEVENT_WORKBOOK_AUTOOPEN = 23;
-+ const long VBAEVENT_WORKBOOK_BEFORECLOSE = 24;
-+ const long VBAEVENT_WORKBOOK_BEFOREPRINT = 25;
-+ const long VBAEVENT_WORKBOOK_BEFORESAVE = 26;
-+ const long VBAEVENT_WORKBOOK_NEWSHEET = 27;
-+ const long VBAEVENT_WORKBOOK_WINDOWACTIVATE = 28;
-+ const long VBAEVENT_WORKBOOK_WINDOWDEACTIVATE = 29;
-+ const long VBAEVENT_WORKBOOK_WINDOWRESIZE = 30;
-+ // Workbook_sheet
-+ const long VBAEVENT_WORKBOOK_SHEET_ACTIVATE = 51;
-+ const long VBAEVENT_WORKBOOK_SHEET_BEFOREDOUBLECLICK = 52;
-+ const long VBAEVENT_WORKBOOK_SHEET_BEFORERIGHTCLICK = 53;
-+ const long VBAEVENT_WORKBOOK_SHEET_CALCULATE = 54;
-+ const long VBAEVENT_WORKBOOK_SHEET_CHANGE = 55;
-+ const long VBAEVENT_WORKBOOK_SHEET_DEACTIVATE = 56;
-+ const long VBAEVENT_WORKBOOK_SHEET_FOLLOWHYPERLINK = 57;
-+ const long VBAEVENT_WORKBOOK_SHEET_PIVOTTABLEUPDATE = 58;
-+ const long VBAEVENT_WORKBOOK_SHEET_SELECTIONCHANGE = 59;
-+
-+ // Document event for Word
-+ const long VBAEVENT_DOCUMENT_NEW = 70;
-+ const long VBAEVENT_DOCUMENT_AUTONEW = 71;
-+ const long VBAEVENT_DOCUMENT_OPEN = 72;
-+ const long VBAEVENT_DOCUMENT_AUTOOPEN = 73;
-+ const long VBAEVENT_DOCUMENT_CLOSE = 74;
-+};
-+
-+}; }; }; };
-+
-+#endif
-diff --git offapi/com/sun/star/document/VbaEventsHelper.idl offapi/com/sun/star/document/VbaEventsHelper.idl
-new file mode 100644
-index 0000000..30f8f7e
---- /dev/null
-+++ offapi/com/sun/star/document/VbaEventsHelper.idl
-@@ -0,0 +1,55 @@
-+/*************************************************************************
-+ *
-+ * 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 __com_sun_star_document_VbaEventsHelper_idl__
-+#define __com_sun_star_document_VbaEventsHelper_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+#include <com/sun/star/frame/XModel.idl>
-+#include <com/sun/star/document/XVbaEventsHelper.idl>
-+//=============================================================================
-+
-+module com { module sun { module star { module document {
-+//=============================================================================
-+
-+service VbaEventsHelper : XVbaEventsHelper
-+{
-+ createVbaEventsHelper( [in] ::com::sun::star::frame::XModel xModel );
-+};
-+
-+}; }; }; };
-+
-+#endif
-diff --git offapi/com/sun/star/document/XCompatWriterDocProperties.idl offapi/com/sun/star/document/XCompatWriterDocProperties.idl
-new file mode 100644
-index 0000000..435ffb3
---- /dev/null
-+++ offapi/com/sun/star/document/XCompatWriterDocProperties.idl
-@@ -0,0 +1,49 @@
-+/*************************************************************************
-+ *
-+ * 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: XDocumentProperties.idl,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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __com_sun_star_document_XCompatWriterDocProperties_idl__
-+#define __com_sun_star_document_XCompatWriterDocProperties_idl__
-+
-+#ifndef __com_sun_star_document_XDocumentProperties_idl__
-+#include <com/sun/star/document/XDocumentProperties.idl>
-+#endif
-+//=============================================================================
-+
-+module com { module sun { module star { module document {
-+interface XCompatWriterDocProperties
-+{
-+// interface ::com::sun::star::document::XDocumentProperties;
-+ [attribute] string Manager;
-+ [attribute] string Category;
-+ [attribute] string Company;
-+
-+
-+}; }; }; };
-+};
-+#endif
-diff --git offapi/com/sun/star/document/XDocumentEventCompatibleHelper.idl offapi/com/sun/star/document/XDocumentEventCompatibleHelper.idl
-new file mode 100644
-index 0000000..d10deab
---- /dev/null
-+++ offapi/com/sun/star/document/XDocumentEventCompatibleHelper.idl
-@@ -0,0 +1,53 @@
-+/*************************************************************************
-+ *
-+ * 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: XVbaEventHelper.idl,v $
-+ * $Revision: 1.0 $
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __com_sun_star_document_XDocumentEventCompatibleHelper_idl__
-+#define __com_sun_star_document_XDocumentEventCompatibleHelper_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+//=============================================================================
-+
-+module com { module sun { module star { module document {
-+
-+//=============================================================================
-+interface XDocumentEventCompatibleHelper
-+{
-+ /* Execute some compatible VBA event related to document, such as document save, document print.
-+ nEventId: event id.
-+ */
-+ boolean processCompatibleEvent( [in] short nEventId );
-+};
-+
-+//=============================================================================
-+
-+}; }; }; };
-+
-+#endif
-diff --git offapi/com/sun/star/document/XVbaEventsHelper.idl offapi/com/sun/star/document/XVbaEventsHelper.idl
-new file mode 100644
-index 0000000..0c5abc7
---- /dev/null
-+++ offapi/com/sun/star/document/XVbaEventsHelper.idl
-@@ -0,0 +1,60 @@
-+/*************************************************************************
-+ *
-+ * 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 __org_openoffice_vba_XVbaEventsHelper_idl__
-+#define __org_openoffice_vba_XVbaEventsHelper_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+//=============================================================================
-+
-+module com { module sun { module star { module document {
-+//=============================================================================
-+
-+interface XVbaEventsHelper
-+{
-+ /**
-+ Execute VBA compatible event.
-+ VbaEvent: Compatible VBA event id.
-+ aArgs: the array of input arguments.
-+ return: True if execute successfully, or False.
-+ **/
-+ boolean ProcessCompatibleVbaEvent( [in] long nEventId, [in] sequence< any > aArgs );
-+ [attribute ] boolean IgnoreEvents;
-+};
-+
-+}; }; }; };
-+
-+#endif
-diff --git offapi/com/sun/star/document/XVbaMethodParameter.idl offapi/com/sun/star/document/XVbaMethodParameter.idl
-new file mode 100644
-index 0000000..7ef5296
---- /dev/null
-+++ offapi/com/sun/star/document/XVbaMethodParameter.idl
-@@ -0,0 +1,68 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009
-+ * Copyright 2009 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: XVbaMethodParameter,v $
-+ * $Revision: 1.13 $
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef __org_openoffice_vba_XVbaMethodParameter_idl__
-+#define __org_openoffice_vba_XVbaMethodParameter_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+//=============================================================================
-+
-+module com { module sun { module star { module document {
-+
-+//=============================================================================
-+//gives access to vba method input/output parameters
-+//
-+//some OO objects need to implement this interface to support the passing of input/output parameters
-+//for certain VBA events
-+
-+interface XVbaMethodParameter : com::sun::star::uno::XInterface
-+{
-+ //-------------------------------------------------------------------------
-+
-+ /** sets the value of the parameter with the specified name.
-+ */
-+ void setVbaMethodParameter( [in] string PropertyName,
-+ [in] any Value );
-+
-+ //-------------------------------------------------------------------------
-+
-+ /** returns the value of the parameter with the specified name.
-+ */
-+ any getVbaMethodParameter( [in] string PropertyName );
-+};
-+
-+//=============================================================================
-+
-+}; }; }; };
-+#endif
-diff --git offapi/com/sun/star/document/makefile.mk offapi/com/sun/star/document/makefile.mk
-index 48394a6..6796fcf 100644
---- offapi/com/sun/star/document/makefile.mk
-+++ offapi/com/sun/star/document/makefile.mk
-@@ -114,7 +114,13 @@ IDLFILES=\
- XDocumentRevisionListPersistence.idl\
- DocumentRevisionListPersistence.idl \
- XDocumentLanguages.idl \
-- XCodeNameQuery.idl
-+ XCodeNameQuery.idl \
-+ XDocumentEventCompatibleHelper.idl \
-+ XCompatWriterDocProperties.idl \
-+ XVbaMethodParameter.idl \
-+ VbaEventId.idl \
-+ XVbaEventsHelper.idl \
-+ VbaEventsHelper.idl \
-
-
- # ------------------------------------------------------------------
-diff --git offapi/com/sun/star/drawing/Shape.idl offapi/com/sun/star/drawing/Shape.idl
-index 360352a..92fbdff 100644
---- offapi/com/sun/star/drawing/Shape.idl
-+++ offapi/com/sun/star/drawing/Shape.idl
-@@ -200,6 +200,10 @@ published service Shape
- the z-order.
- */
- [optional, property] long NavigationOrder;
-+
-+ /** this property lets you get and set a hyperlink for this shape.
-+ */
-+ [optional, property] string Hyperlink;
- };
-
- //=============================================================================
-diff --git offapi/com/sun/star/script/XLibraryQueryExecutable.idl offapi/com/sun/star/script/XLibraryQueryExecutable.idl
-new file mode 100644
-index 0000000..48dbfaa
---- /dev/null
-+++ offapi/com/sun/star/script/XLibraryQueryExecutable.idl
-@@ -0,0 +1,51 @@
-+/*************************************************************************
-+ *
-+ * 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: XLibraryContainer.idl,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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __com_sun_star_script_XLibraryQueryExecutable_idl__
-+#define __com_sun_star_script_XLibraryQueryExecutable_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+//=============================================================================
-+
-+module com { module sun { module star { module script {
-+
-+interface XLibraryQueryExecutable: com::sun::star::uno::XInterface
-+{
-+ boolean HasExecutableCode( [in] string name );
-+};
-+
-+//=============================================================================
-+
-+
-+}; }; }; };
-+
-+#endif
-diff --git offapi/com/sun/star/script/makefile.mk offapi/com/sun/star/script/makefile.mk
-index b694a75..c6c6416 100644
---- offapi/com/sun/star/script/makefile.mk
-+++ offapi/com/sun/star/script/makefile.mk
-@@ -47,6 +47,7 @@ IDLFILES=\
- XLibraryContainerExport.idl\
- XPersistentLibraryContainer.idl\
- XStorageBasedLibraryContainer.idl\
-+ XLibraryQueryExecutable.idl \
- ModuleSizeExceededRequest.idl\
- XVBACompat.idl\
- XVBAModuleInfo.idl\
-diff --git offapi/com/sun/star/sheet/SpreadsheetDocumentVbaEventsHelper.idl offapi/com/sun/star/sheet/SpreadsheetDocumentVbaEventsHelper.idl
-new file mode 100644
-index 0000000..b08a58c
---- /dev/null
-+++ offapi/com/sun/star/sheet/SpreadsheetDocumentVbaEventsHelper.idl
-@@ -0,0 +1,52 @@
-+/*************************************************************************
-+ *
-+ * 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: TextDocument.idl,v $
-+ * $Revision: 1.18 $
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __com_sun_star_sheet_SpreadsheetDocumentVbaEventsHelper_idl__
-+#define __com_sun_star_sheet_SpreadsheetDocumentVbaEventsHelper_idl__
-+
-+#ifndef __com_sun_star_document_VbaEventsHelper_idl__
-+#include <com/sun/star/document/VbaEventsHelper.idl>
-+#endif
-+
-+//=============================================================================
-+
-+ module com { module sun { module star { module sheet {
-+
-+//=============================================================================
-+
-+service SpreadsheetDocumentVbaEventsHelper
-+{
-+ service com::sun::star::document::VbaEventsHelper;
-+};
-+
-+//=============================================================================
-+
-+}; }; }; };
-+
-+#endif
-diff --git offapi/com/sun/star/sheet/makefile.mk offapi/com/sun/star/sheet/makefile.mk
-index dc1935b..212383c 100644
---- offapi/com/sun/star/sheet/makefile.mk
-+++ offapi/com/sun/star/sheet/makefile.mk
-@@ -194,6 +194,7 @@ IDLFILES=\
- Spreadsheet.idl\
- SpreadsheetDocument.idl\
- SpreadsheetDocumentSettings.idl\
-+ SpreadsheetDocumentVbaEventsHelper.idl\
- SpreadsheetDrawPage.idl\
- SpreadsheetView.idl\
- SpreadsheetViewPane.idl\
-diff --git offapi/com/sun/star/text/TextDocumentVbaEventsHelper.idl offapi/com/sun/star/text/TextDocumentVbaEventsHelper.idl
-new file mode 100644
-index 0000000..b4f2707
---- /dev/null
-+++ offapi/com/sun/star/text/TextDocumentVbaEventsHelper.idl
-@@ -0,0 +1,52 @@
-+/*************************************************************************
-+ *
-+ * 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: TextDocument.idl,v $
-+ * $Revision: 1.18 $
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __com_sun_star_text_TextDocumentVbaEventsHelper_idl__
-+#define __com_sun_star_text_TextDocumentVbaEventsHelper_idl__
-+
-+#ifndef __com_sun_star_document_VbaEventsHelper_idl__
-+#include <com/sun/star/document/VbaEventsHelper.idl>
-+#endif
-+
-+//=============================================================================
-+
-+ module com { module sun { module star { module text {
-+
-+//=============================================================================
-+
-+service TextDocumentVbaEventsHelper
-+{
-+ service com::sun::star::document::VbaEventsHelper;
-+};
-+
-+//=============================================================================
-+
-+}; }; }; };
-+
-+#endif
-diff --git offapi/com/sun/star/text/makefile.mk offapi/com/sun/star/text/makefile.mk
-index 4e6d247..c05d256 100644
---- offapi/com/sun/star/text/makefile.mk
-+++ offapi/com/sun/star/text/makefile.mk
-@@ -152,6 +152,7 @@ IDLFILES=\
- TextContentCollection.idl\
- TextCursor.idl\
- TextDocument.idl\
-+ TextDocumentVbaEventsHelper.idl\
- TextDocumentView.idl\
- TextEmbeddedObject.idl\
- TextEmbeddedObjects.idl\
-diff --git officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
-index 1c71f00..df77d92 100644
---- officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
-+++ officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
-@@ -1197,6 +1197,12 @@
- <value xml:lang="en-US">~Remove Filter</value>
- </prop>
- </node>
-+ <node oor:name=".uno:DataForm" oor:op="replace">
-+ <prop oor:name="Label" oor:type="xs:string">
-+ <value xml:lang="de">D~atenForm...</value>
-+ <value xml:lang="en-US">D~ataForm...</value>
-+ </prop>
-+ </node>
- <node oor:name=".uno:DataSubTotals" oor:op="replace">
- <prop oor:name="Label" oor:type="xs:string">
- <value xml:lang="en-US">Sub~totals...</value>
-diff --git officecfg/registry/schema/org/openoffice/Office/Calc.xcs officecfg/registry/schema/org/openoffice/Office/Calc.xcs
-index 2db99d2..97a3cd2 100644
---- officecfg/registry/schema/org/openoffice/Office/Calc.xcs
-+++ officecfg/registry/schema/org/openoffice/Office/Calc.xcs
-@@ -1394,7 +1394,7 @@
- <desc>Indicates whether VBA macros are imported without comments to be executable.</desc>
- <label>Executable code</label>
- </info>
-- <value>false</value>
-+ <value>true</value>
- </prop>
- <prop oor:name="Save" oor:type="xs:boolean">
- <!-- OldPath: Filter/MS_Office/Basic/Excel -->
-diff --git officecfg/registry/schema/org/openoffice/Office/Writer.xcs officecfg/registry/schema/org/openoffice/Office/Writer.xcs
-index 9abada4..de76f80 100644
---- officecfg/registry/schema/org/openoffice/Office/Writer.xcs
-+++ officecfg/registry/schema/org/openoffice/Office/Writer.xcs
-@@ -746,6 +746,17 @@
- </group>
- </templates>
- <component>
-+ <group oor:name="GlobalTemplateList">
-+ <info>
-+ <desc>Contains the most recently opened documents.</desc>
-+ </info>
-+ <prop oor:name="Paths" oor:type="oor:string-list">
-+ <info>
-+ <desc>Lists the file global templates loaded when importing writer documents.</desc>
-+ </info>
-+ <value oor:separator=";"></value>
-+ </prop>
-+ </group>
- <group oor:name="MailMergeWizard">
- <info>
- <desc>Settings of the mail merge wizard.</desc>
-@@ -6021,6 +6032,14 @@
- </info>
- <value>true</value>
- </prop>
-+ <prop oor:name="Executable" oor:type="xs:boolean">
-+ <info>
-+ <author>pflin</author>
-+ <desc>Indicates whether VBA macros are imported without comments to be executable.</desc>
-+ <label>Executable code</label>
-+ </info>
-+ <value>true</value>
-+ </prop>
- <prop oor:name="Save" oor:type="xs:boolean">
- <!-- OldPath: Filter/MS_Office/Basic/Word -->
- <!-- OldLocation: soffice.cfg -->
-diff --git oovbaapi/genconstidl/api-to-idl.pl oovbaapi/genconstidl/api-to-idl.pl
-index 33e28e2..972e8b3 100644
---- oovbaapi/genconstidl/api-to-idl.pl
-+++ oovbaapi/genconstidl/api-to-idl.pl
-@@ -125,6 +125,9 @@ sub generate_idls($) {
- foreach $module ( keys %result ) {
- foreach $type ( keys %{$result{$module}} ) {
- my $fname = $path . "/" . $type . ".idl";
-+ if ( uc($module) eq "ADODB" || uc($module) eq "DAO" ) {
-+ $fname = $path . "/" . uc($module) . "_" . $type . ".idl";
-+ }
- open( IDL, ">$fname" ) || die "Cannot write $fname.";
-
- if( $module eq "vba" ) {
-diff --git oovbaapi/ooo/vba/XApplicationBase.idl oovbaapi/ooo/vba/XApplicationBase.idl
-index bfcc75e..644a60f 100644
---- oovbaapi/ooo/vba/XApplicationBase.idl
-+++ oovbaapi/ooo/vba/XApplicationBase.idl
-@@ -49,7 +49,7 @@ interface XApplicationBase
- void Quit();
-
- any CommandBars( [in] any aIndex );
-- void Run([in] string MacroName, [in] /*Optional*/ any varg1, [in] /*Optional*/ any varg2, [in] /*Optional*/ any varg3, [in] /*Optional*/ any varg4, [in] /*Optional*/ any varg5, [in] /*Optional*/ any varg6, [in] /*Optional*/ any varg7, [in] /*Optional*/ any varg8, [in] /*Optional*/ any varg9, [in] /*Optional*/ any varg10, [in] /*Optional*/ any varg11, [in] /*Optional*/ any varg12, [in] /*Optional*/ any varg13, [in] /*Optional*/ any varg14, [in] /*Optional*/ any varg15, [in] /*Optional*/ any varg16, [in] /*Optional*/ any varg17, [in] /*Optional*/ any varg18, [in] /*Optional*/ any varg19, [in] /*Optional*/ any varg20, [in] /*Optional*/ any varg21, [in] /*Optional*/ any varg22, [in] /*Optional*/ any varg23, [in] /*Optional*/ any varg24, [in] /*Optional*/ any varg25, [in] /*Optional*/ any varg26, [in] /*Optional*/ any varg27, [in] /*Optional*/ any varg28, [in] /*Optional*/ any varg29, [in] /*Optional*/ any varg30);
-+ any Run([in] string MacroName, [in] /*Optional*/ any varg1, [in] /*Optional*/ any varg2, [in] /*Optional*/ any varg3, [in] /*Optional*/ any varg4, [in] /*Optional*/ any varg5, [in] /*Optional*/ any varg6, [in] /*Optional*/ any varg7, [in] /*Optional*/ any varg8, [in] /*Optional*/ any varg9, [in] /*Optional*/ any varg10, [in] /*Optional*/ any varg11, [in] /*Optional*/ any varg12, [in] /*Optional*/ any varg13, [in] /*Optional*/ any varg14, [in] /*Optional*/ any varg15, [in] /*Optional*/ any varg16, [in] /*Optional*/ any varg17, [in] /*Optional*/ any varg18, [in] /*Optional*/ any varg19, [in] /*Optional*/ any varg20, [in] /*Optional*/ any varg21, [in] /*Optional*/ any varg22, [in] /*Optional*/ any varg23, [in] /*Optional*/ any varg24, [in] /*Optional*/ any varg25, [in] /*Optional*/ any varg26, [in] /*Optional*/ any varg27, [in] /*Optional*/ any varg28, [in] /*Optional*/ any varg29, [in] /*Optional*/ any varg30);
- float CentimetersToPoints([in] float Centimeters );
- };
-
-diff --git oovbaapi/ooo/vba/XDialogBase.idl oovbaapi/ooo/vba/XDialogBase.idl
-index ee5c833..48fa3d8 100644
---- oovbaapi/ooo/vba/XDialogBase.idl
-+++ oovbaapi/ooo/vba/XDialogBase.idl
-@@ -46,7 +46,7 @@ interface XDialogBase
- {
- interface ::ooo::vba::XHelperInterface;
-
-- void Show();
-+ boolean Show();
- };
-
- }; };
-diff --git oovbaapi/ooo/vba/XDocumentBase.idl oovbaapi/ooo/vba/XDocumentBase.idl
-index 5845d8b..5eabfb5 100644
---- oovbaapi/ooo/vba/XDocumentBase.idl
-+++ oovbaapi/ooo/vba/XDocumentBase.idl
-@@ -50,7 +50,6 @@ interface XDocumentBase
- void Close([in] any SaveChanges, [in] any FileName, [in] any RouteWorkBook);
- void Save();
- void Activate();
-- void Protect( [in] any Password );
- void Unprotect( [in] any Password );
- };
-
-diff --git oovbaapi/ooo/vba/XFileDialog.idl oovbaapi/ooo/vba/XFileDialog.idl
-new file mode 100644
-index 0000000..846e16f
---- /dev/null
-+++ oovbaapi/ooo/vba/XFileDialog.idl
-@@ -0,0 +1,54 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009, 2010.
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef __ooo_vba_excel_XFileDialog_idl__
-+#define __ooo_vba_excel_XFileDialog_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#include <ooo/vba/XFileDialogSelectedItems.idl>
-+
-+//=============================================================================
-+
-+module ooo { module vba {
-+
-+//=============================================================================
-+
-+interface XFileDialog : com::sun::star::uno::XInterface
-+{
-+ [attribute, readonly] ooo::vba::XFileDialogSelectedItems SelectedItems;
-+
-+ long Show();
-+};
-+
-+}; };
-+
-+#endif
-+
-diff --git oovbaapi/ooo/vba/XFileDialogSelectedItems.idl oovbaapi/ooo/vba/XFileDialogSelectedItems.idl
-new file mode 100644
-index 0000000..b844667
---- /dev/null
-+++ oovbaapi/ooo/vba/XFileDialogSelectedItems.idl
-@@ -0,0 +1,54 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009, 2010.
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+
-+#ifndef __ooo_vba_excel_XFileDialogSelectedItems_idl__
-+#define __ooo_vba_excel_XFileDialogSelectedItems_idl__
-+
-+// #ifndef __com_sun_star_uno_XInterface_idl__
-+// #include <com/sun/star/uno/XInterface.idl>
-+// #endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+//=============================================================================
-+
-+module ooo { module vba {
-+
-+//=============================================================================
-+
-+interface XFileDialogSelectedItems
-+{
-+ interface ooo::vba::XCollection;
-+};
-+
-+}; };
-+
-+#endif
-+
-diff --git oovbaapi/ooo/vba/XFileSearch.idl oovbaapi/ooo/vba/XFileSearch.idl
-new file mode 100644
-index 0000000..b88f87c
---- /dev/null
-+++ oovbaapi/ooo/vba/XFileSearch.idl
-@@ -0,0 +1,61 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009, 2010.
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef __ooo_vba_XFileSearch_idl__
-+#define __ooo_vba_XFileSearch_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XFoundFiles_idl__
-+#include <ooo/vba/XFoundFiles.idl>
-+#endif
-+
-+//=============================================================================
-+
-+module ooo { module vba {
-+//=============================================================================
-+
-+interface XFileSearch
-+{
-+ interface ::com::sun::star::uno::XInterface;
-+
-+ [attribute] string FileName;
-+ [attribute] string LookIn;
-+ [attribute] boolean SearchSubFolders;
-+ [attribute] boolean MatchTextExactly;
-+ [attribute, readonly] XFoundFiles FoundFiles;
-+
-+ long Execute();
-+ void NewSearch();
-+};
-+
-+}; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/XFoundFiles.idl oovbaapi/ooo/vba/XFoundFiles.idl
-new file mode 100644
-index 0000000..ce6dba1
---- /dev/null
-+++ oovbaapi/ooo/vba/XFoundFiles.idl
-@@ -0,0 +1,52 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009, 2010.
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef __ooo_vba_XFoundFiles_idl__
-+#define __ooo_vba_XFoundFiles_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+//=============================================================================
-+
-+module ooo { module vba {
-+//=============================================================================
-+
-+interface XFoundFiles
-+{
-+ interface ooo::vba::XCollection;
-+};
-+
-+}; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/excel/XApplication.idl oovbaapi/ooo/vba/excel/XApplication.idl
-index cae978d..1ab317d 100644
---- oovbaapi/ooo/vba/excel/XApplication.idl
-+++ oovbaapi/ooo/vba/excel/XApplication.idl
-@@ -39,6 +39,14 @@
- #include <ooo/vba/XAssistant.idl>
- #endif
-
-+#ifndef __ooo_vba_excel_XFileDialog_idl__
-+#include <ooo/vba/XFileDialog.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XFileSearch_idl__
-+#include <ooo/vba/XFileSearch.idl>
-+#endif
-+
- module ooo { module vba { module excel {
-
- interface XRange;
-@@ -48,6 +56,8 @@ interface XWorksheets;
- interface XWorksheetFunction;
- interface XWindow;
- interface XWorksheet;
-+interface XFileDialog;
-+interface XFileSearch;
-
- interface XApplication : com::sun::star::uno::XInterface
- {
-@@ -60,19 +70,27 @@ interface XApplication : com::sun::star::uno::XInterface
- [attribute, readonly] XWindow ActiveWindow;
- [attribute, readonly] XWorksheet ActiveSheet;
- [attribute, readonly] ooo::vba::XAssistant Assistant;
-+ [attribute, readonly] ooo::vba::XFileSearch FileSearch; //liuchen 2009-8-18, add the support of VBA Application.FileSearch
- [attribute] long Calculation;
- [attribute, readonly] XWorkbook ThisWorkbook;
-+ [attribute, readonly] ooo::vba::XFileDialog FileDialog;
- [attribute, readonly] string Name;
- [attribute] boolean DisplayAlerts;
- [attribute] boolean DisplayFormulaBar;
- [attribute] any CutCopyMode;
- [attribute] any StatusBar;
- [attribute] long Cursor;
-+ [attribute] boolean EnableEvents;
-+ [attribute] boolean Visible;
-+ [attribute] boolean Iteration; //liuchen 2009-11-25
-+ [attribute] long EnableCancelKey; //liuchen 2009-11-26
-
- void setDefaultFilePath([in] string DefaultFilePath) raises(com::sun::star::script::BasicErrorException);
-
- string getDefaultFilePath() raises(com::sun::star::script::BasicErrorException);
-
-+ any GetOpenFilename([in] /*Optional*/ any FileFilter, [in] /*Optional*/ any FilterIndex, [in] /*Optional*/ any Title, [in] /*Optional*/ any ButtonText, [in] /*Optional*/ any MultiSelect); //minz, 2009-07-08
-+
- string LibraryPath() raises(com::sun::star::script::BasicErrorException);
- string TemplatesPath() raises(com::sun::star::script::BasicErrorException);
- string PathSeparator() raises(com::sun::star::script::BasicErrorException);
-@@ -95,8 +113,14 @@ interface XApplication : com::sun::star::uno::XInterface
- XRange Union([in] XRange Arg1, [in] XRange Arg2, [in] /*Optional*/ any Arg3, [in] /*Optional*/ any Arg4, [in] /*Optional*/ any Arg5, [in] /*Optional*/ any Arg6, [in] /*Optional*/ any Arg7, [in] /*Optional*/ any Arg8, [in] /*Optional*/ any Arg9, [in] /*Optional*/ any Arg10, [in] /*Optional*/ any Arg11, [in] /*Optional*/ any Arg12, [in] /*Optional*/ any Arg13, [in] /*Optional*/ any Arg14, [in] /*Optional*/ any Arg15, [in] /*Optional*/ any Arg16, [in] /*Optional*/ any Arg17, [in] /*Optional*/ any Arg18, [in] /*Optional*/ any Arg19, [in] /*Optional*/ any Arg20, [in] /*Optional*/ any Arg21, [in] /*Optional*/ any Arg22, [in] /*Optional*/ any Arg23, [in] /*Optional*/ any Arg24, [in] /*Optional*/ any Arg25, [in] /*Optional*/ any Arg26, [in] /*Optional*/ any Arg27, [in] /*Optional*/ any Arg28, [in] /*Optional*/ any Arg29, [in] /*Optional*/ any Arg30)
- raises(com::sun::star::script::BasicErrorException);
- void Volatile([in] any Volatile);
-- void DoEvents();
- any Caller( [in] any aIndex );
-+ any MenuBars( [in] any aIndex );
-+ any International([in] long Index); //liuchen 2009-11-26
-+ any GetSaveAsFilename( [in] any InitialFilename, [in] any FileFilter, [in] any FilterIndex, [in] any Title,[in] any ButtonText);
-+ void Undo(); //2009-10-11 limingl
-+ double InchesToPoints([in] double Inches);
-+ void setSheetsInNewWorkbook( [in] long SheetsInNewWorkbook ) raises(com::sun::star::script::BasicErrorException);
-+ long getSheetsInNewWorkbook();
- };
-
- }; }; };
-diff --git oovbaapi/ooo/vba/excel/XComment.idl oovbaapi/ooo/vba/excel/XComment.idl
-index f5271e2..7c5a158 100644
---- oovbaapi/ooo/vba/excel/XComment.idl
-+++ oovbaapi/ooo/vba/excel/XComment.idl
-@@ -48,7 +48,7 @@ interface XComment
- interface ::ooo::vba::XHelperInterface;
-
- [attribute] string Author;
--// [attribute, readonly] Shape Shape;
-+ [attribute, readonly] any Shape;
- [attribute] boolean Visible;
-
- void Delete();
-diff --git oovbaapi/ooo/vba/excel/XGlobals.idl oovbaapi/ooo/vba/excel/XGlobals.idl
-index c54740a..1ffcfdc 100644
---- oovbaapi/ooo/vba/excel/XGlobals.idl
-+++ oovbaapi/ooo/vba/excel/XGlobals.idl
-@@ -73,6 +73,7 @@ XRange Intersect([in] XRange Arg1, [in] XRange Arg2, [in] /*Optional*/ any Arg3,
- any Names( [in] any Index );
- XRange Union([in] XRange Arg1, [in] XRange Arg2, [in] /*Optional*/ any Arg3, [in] /*Optional*/ any Arg4, [in] /*Optional*/ any Arg5, [in] /*Optional*/ any Arg6, [in] /*Optional*/ any Arg7, [in] /*Optional*/ any Arg8, [in] /*Optional*/ any Arg9, [in] /*Optional*/ any Arg10, [in] /*Optional*/ any Arg11, [in] /*Optional*/ any Arg12, [in] /*Optional*/ any Arg13, [in] /*Optional*/ any Arg14, [in] /*Optional*/ any Arg15, [in] /*Optional*/ any Arg16, [in] /*Optional*/ any Arg17, [in] /*Optional*/ any Arg18, [in] /*Optional*/ any Arg19, [in] /*Optional*/ any Arg20, [in] /*Optional*/ any Arg21, [in] /*Optional*/ any Arg22, [in] /*Optional*/ any Arg23, [in] /*Optional*/ any Arg24, [in] /*Optional*/ any Arg25, [in] /*Optional*/ any Arg26, [in] /*Optional*/ any Arg27, [in] /*Optional*/ any Arg28, [in] /*Optional*/ any Arg29, [in] /*Optional*/ any Arg30)
- raises(com::sun::star::script::BasicErrorException);
-+ any MenuBars( [in] any aIndex );
-
- };
-
-diff --git oovbaapi/ooo/vba/excel/XMenu.idl oovbaapi/ooo/vba/excel/XMenu.idl
-new file mode 100644
-index 0000000..cb3698b
---- /dev/null
-+++ oovbaapi/ooo/vba/excel/XMenu.idl
-@@ -0,0 +1,62 @@
-+/*************************************************************************
-+ *
-+ * 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 __ooo_vba_excel_XMenu_idl__
-+#define __ooo_vba_excel_XMenu_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+//=============================================================================
-+
-+module ooo { module vba { module excel {
-+//=============================================================================
-+
-+interface XMenu
-+{
-+ interface XHelperInterface;
-+
-+ [attribute] string Caption;
-+
-+ void Delete() raises ( com::sun::star::script::BasicErrorException );
-+ any MenuItems( [in] any Index ) raises ( com::sun::star::script::BasicErrorException );
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/excel/XMenuBar.idl oovbaapi/ooo/vba/excel/XMenuBar.idl
-new file mode 100644
-index 0000000..3ead272
---- /dev/null
-+++ oovbaapi/ooo/vba/excel/XMenuBar.idl
-@@ -0,0 +1,59 @@
-+/*************************************************************************
-+ *
-+ * 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 __ooo_vba_excel_XMenuBar_idl__
-+#define __ooo_vba_excel_XMenuBar_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+//=============================================================================
-+
-+module ooo { module vba { module excel {
-+//=============================================================================
-+
-+interface XMenuBar
-+{
-+ interface XHelperInterface;
-+
-+ any Menus( [in] any Index ) raises ( com::sun::star::script::BasicErrorException );
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/excel/XMenuBars.idl oovbaapi/ooo/vba/excel/XMenuBars.idl
-new file mode 100644
-index 0000000..3a46c3b
---- /dev/null
-+++ oovbaapi/ooo/vba/excel/XMenuBars.idl
-@@ -0,0 +1,66 @@
-+/*************************************************************************
-+ *
-+ * 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: XMenuBars.idl,v $
-+ * $Revision: 1.0 $
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_excel_XMenuBars_idl__
-+#define __ooo_vba_excel_XMenuBars_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+#ifndef __com_sun_star_helper_script_BasicErrorException_idl__
-+#include <com/sun/star/script/BasicErrorException.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+//=============================================================================
-+
-+module ooo { module vba { module excel {
-+
-+//=============================================================================
-+
-+interface XMenuBars
-+{
-+ interface ooo::vba::XCollection;
-+};
-+
-+//=============================================================================
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/excel/XMenuItem.idl oovbaapi/ooo/vba/excel/XMenuItem.idl
-new file mode 100644
-index 0000000..2dcfb2f
---- /dev/null
-+++ oovbaapi/ooo/vba/excel/XMenuItem.idl
-@@ -0,0 +1,62 @@
-+/*************************************************************************
-+ *
-+ * 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 __ooo_vba_excel_XMenuItem_idl__
-+#define __ooo_vba_excel_XMenuItem_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+//=============================================================================
-+
-+module ooo { module vba { module excel {
-+//=============================================================================
-+
-+interface XMenuItem
-+{
-+ interface XHelperInterface;
-+
-+ [attribute] string Caption;
-+ [attribute] string OnAction;
-+
-+ void Delete() raises ( com::sun::star::script::BasicErrorException );
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/excel/XMenuItems.idl oovbaapi/ooo/vba/excel/XMenuItems.idl
-new file mode 100644
-index 0000000..9ba7b38
---- /dev/null
-+++ oovbaapi/ooo/vba/excel/XMenuItems.idl
-@@ -0,0 +1,70 @@
-+/*************************************************************************
-+ *
-+ * 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: XMenuItems.idl,v $
-+ * $Revision: 1.0 $
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_excel_XMenuItems_idl__
-+#define __ooo_vba_excel_XMenuItems_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+#ifndef __com_sun_star_helper_script_BasicErrorException_idl__
-+#include <com/sun/star/script/BasicErrorException.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+//=============================================================================
-+
-+module ooo { module vba { module excel {
-+
-+//=============================================================================
-+
-+interface XMenuItem;
-+
-+interface XMenuItems
-+{
-+ interface ooo::vba::XCollection;
-+
-+ XMenuItem Add( [in] string Caption, [in] any OnAction, [in] any ShortcutKey, [in] any Before, [in] any Restore, [in] any StatusBar, [in] any HelpFile, [in] any HelpContextID ) raises ( com::sun::star::script::BasicErrorException );
-+};
-+
-+//=============================================================================
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/excel/XMenus.idl oovbaapi/ooo/vba/excel/XMenus.idl
-new file mode 100644
-index 0000000..c8e4ea2
---- /dev/null
-+++ oovbaapi/ooo/vba/excel/XMenus.idl
-@@ -0,0 +1,70 @@
-+/*************************************************************************
-+ *
-+ * 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: XMenus.idl,v $
-+ * $Revision: 1.0 $
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_excel_XMenus_idl__
-+#define __ooo_vba_excel_XMenus_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+#ifndef __com_sun_star_helper_script_BasicErrorException_idl__
-+#include <com/sun/star/script/BasicErrorException.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+//=============================================================================
-+
-+module ooo { module vba { module excel {
-+
-+//=============================================================================
-+
-+interface XMenu;
-+
-+interface XMenus
-+{
-+ interface ooo::vba::XCollection;
-+
-+ XMenu Add( [in] string Caption, [in] any Before, [in] any Restore ) raises ( com::sun::star::script::BasicErrorException );
-+};
-+
-+//=============================================================================
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/excel/XPageSetup.idl oovbaapi/ooo/vba/excel/XPageSetup.idl
-index 70a1ae8..31ad1a5 100644
---- oovbaapi/ooo/vba/excel/XPageSetup.idl
-+++ oovbaapi/ooo/vba/excel/XPageSetup.idl
-@@ -65,6 +65,7 @@ interface XPageSetup : com::sun::star::uno::XInterface
- [attribute] boolean CenterVertically;
- [attribute] boolean CenterHorizontally;
- [attribute] boolean PrintHeadings;
-+ [attribute] long PaperSize; //liuchen 2009-12-11
-
- };
-
-diff --git oovbaapi/ooo/vba/excel/XPivotCache.idl oovbaapi/ooo/vba/excel/XPivotCache.idl
-index 65fd014..09bbd63 100644
---- oovbaapi/ooo/vba/excel/XPivotCache.idl
-+++ oovbaapi/ooo/vba/excel/XPivotCache.idl
-@@ -45,6 +45,7 @@ interface XPivotCache
- {
- interface ::ooo::vba::XHelperInterface;
-
-+ [attribute] long MissingItemsLimit;
- void Refresh();
- };
-
-diff --git oovbaapi/ooo/vba/excel/XQueryTable.idl oovbaapi/ooo/vba/excel/XQueryTable.idl
-new file mode 100644
-index 0000000..c1a2442
---- /dev/null
-+++ oovbaapi/ooo/vba/excel/XQueryTable.idl
-@@ -0,0 +1,58 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009, 2010.
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef __ooo_vba_excel_XQueryTable_idl__
-+#define __ooo_vba_excel_XQueryTable_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba__XHelperInterface_idl__
-+#define __ooo_vba__XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module excel {
-+
-+//=============================================================================
-+
-+interface XQueryTable
-+{
-+ interface com::sun::star::uno::XInterface;
-+ //interface ooo::vba::XHelperInterface;
-+ boolean Refresh([in] any aBackgroundQuery);
-+};
-+
-+}; }; };
-+
-+#endif
-+
-diff --git oovbaapi/ooo/vba/excel/XRange.idl oovbaapi/ooo/vba/excel/XRange.idl
-index afb1de6..772b87a 100644
---- oovbaapi/ooo/vba/excel/XRange.idl
-+++ oovbaapi/ooo/vba/excel/XRange.idl
-@@ -42,6 +42,9 @@
- #ifndef __com_sun_star_script_XDefaultMethod_idl__
- #include <com/sun/star/script/XDefaultMethod.idl>
- #endif
-+#ifndef __com_sun_star_script_XErrorQuery_idl__
-+#include <com/sun/star/script/XErrorQuery.idl>
-+#endif
- #ifndef __ooo_vba_XCollection_idl__
- #include <ooo/vba/XCollection.idl>
- #endif
-@@ -69,11 +72,14 @@ interface XBorders;
- interface XValidation;
- interface XWorksheet;
-
-+interface XPivotTable;
-+interface XQueryTable;
- interface XRange
- {
- interface com::sun::star::container::XEnumerationAccess;
- interface com::sun::star::script::XDefaultMethod;
- interface com::sun::star::script::XDefaultProperty;
-+ interface com::sun::star::script::XErrorQuery;
- interface ::ooo::vba::excel::XFormat;
- //interface ::ooo::vba::XHelperInterface;
-
-@@ -101,6 +107,7 @@ interface XRange
- [attribute] any Style;
- [attribute] any AddIndent;
- [attribute] any ShowDetail;
-+ [attribute, readonly] XQueryTable QueryTable;
-
- XComment AddComment( [in] any Text );
- void Clear();
-@@ -164,7 +171,11 @@ interface XRange
- void RemoveSubtotal() raises ( com::sun::star::script::BasicErrorException );
- void Subtotal( [in] long GroupBy, [in] long Function, [in] /*Optional*/ sequence<long> TotalList, [in] /*Optional*/ any Replace, [in] /*Optional*/ any PageBreaks, [in] any SummaryBelowData ) raises ( com::sun::star::script::BasicErrorException );
- XRange MergeArea( ) raises ( com::sun::star::script::BasicErrorException );
--
-+ long CopyFromRecordset([in] any Data, [in] any MaxRows , [in] any MaxColumns) raises ( com::sun::star::script::BasicErrorException );
-+ XPivotTable PivotTable();
-+ void TextToColumns([in] any Destination, [in] any DataType, [in] any TextQualifier, [in] any ConsecutiveDelimiter, [in] any Tab, [in] any Semicolon, [in] any Comma,
-+ [in] any Space, [in] any Other, [in] any OtherChar, [in] any FieldInfo, [in] any DecimalSeparator, [in] any ThousandsSeparator, [in] any TrailingMinusNumbers );
-+ any AdvancedFilter([in] long Action, [in] any CriteriaRange, [in] any CopyToRange, [in] any Unique) raises ( com::sun::star::script::BasicErrorException );
- };
-
- //=============================================================================
-diff --git oovbaapi/ooo/vba/excel/XWorkbook.idl oovbaapi/ooo/vba/excel/XWorkbook.idl
-index e35b661..1a9807c 100644
---- oovbaapi/ooo/vba/excel/XWorkbook.idl
-+++ oovbaapi/ooo/vba/excel/XWorkbook.idl
-@@ -50,6 +50,7 @@ interface XWorkbook : com::sun::star::uno::XInterface
- [attribute, readonly] boolean ProtectStructure;
- [attribute, readonly] XWorksheet ActiveSheet;
- [attribute, readonly] string CodeName;
-+ [attribute, readonly] long FileFormat;
- [attribute] boolean PrecisionAsDisplayed;
-
- any Worksheets([in] any sheet);
-@@ -60,8 +61,9 @@ interface XWorkbook : com::sun::star::uno::XInterface
- void Activate();
- any Names( [in] any Index );
- any Colors([in] any Index) raises (com::sun::star::script::BasicErrorException);
-- long FileFormat() raises (com::sun::star::script::BasicErrorException);
- void SaveCopyAs( [in] string Filename );
-+ void Protect( [in] any Password );
-+ void SaveAs([in] string FileName, [in]any FileFormat, [in]any CreateBackup);
- };
-
- }; }; };
-diff --git oovbaapi/ooo/vba/excel/XWorksheet.idl oovbaapi/ooo/vba/excel/XWorksheet.idl
-index fb133ab..16c7f30 100644
---- oovbaapi/ooo/vba/excel/XWorksheet.idl
-+++ oovbaapi/ooo/vba/excel/XWorksheet.idl
-@@ -38,6 +38,7 @@
- #ifndef __com_sun_star_script_XInvocation_idl__
- #include <com/sun/star/script/XInvocation.idl>
- #endif
-+
-
- #ifndef __com_sun_star_container_XNamed_idl__
- #include <com/sun/star/container/XNamed.idl>
-@@ -60,7 +61,8 @@ interface XWorksheet
- interface ::com::sun::star::script::XInvocation;
- interface ::com::sun::star::container::XNamed;
-
-- [attribute] boolean Visible;
-+ [attribute] long Visible;
-+ [attribute] boolean AutoFilterMode;
- [attribute, readonly] long StandardHeight;
- [attribute, readonly] long StandardWidth;
- [attribute, readonly] boolean ProtectionMode;
-@@ -75,7 +77,7 @@ interface XWorksheet
-
- void Activate();
- void Calculate( );
-- void Select();
-+ void Select([in] any Replace); //liuchen 2009-9-2, add the input parameter to support expand selection
- void Move([in] any Before,[in] any After );
- void Copy([in] any Before,[in] any After );
- void Paste([in] any Destination,[in] any Link);
-diff --git oovbaapi/ooo/vba/excel/makefile.mk oovbaapi/ooo/vba/excel/makefile.mk
-index 01e26d4..fd5c451 100644
---- oovbaapi/ooo/vba/excel/makefile.mk
-+++ oovbaapi/ooo/vba/excel/makefile.mk
-@@ -99,7 +99,13 @@ IDLFILES= XGlobals.idl\
- XVPageBreak.idl \
- XVPageBreaks.idl \
- TextFrame.idl \
--
-+ XMenuBar.idl \
-+ XMenuBars.idl \
-+ XMenu.idl \
-+ XMenus.idl \
-+ XMenuItem.idl \
-+ XMenuItems.idl \
-+ XQueryTable.idl
-
- # ------------------------------------------------------------------
-
-diff --git oovbaapi/ooo/vba/makefile.mk oovbaapi/ooo/vba/makefile.mk
-index 7fc7030..a40ba1b 100644
---- oovbaapi/ooo/vba/makefile.mk
-+++ oovbaapi/ooo/vba/makefile.mk
-@@ -61,7 +61,11 @@ IDLFILES=\
- XFontBase.idl\
- XDialogsBase.idl\
- XDialogBase.idl\
-+ XFileSearch.idl\
-+ XFoundFiles.idl\
- XPageSetupBase.idl \
-+ XFileDialog.idl \
-+ XFileDialogSelectedItems.idl
-
- # ------------------------------------------------------------------
- .ENDIF
-diff --git oovbaapi/ooo/vba/msforms/MSFormReturnTypes.idl oovbaapi/ooo/vba/msforms/MSFormReturnTypes.idl
-index e7532e3..8fa44f9 100644
---- oovbaapi/ooo/vba/msforms/MSFormReturnTypes.idl
-+++ oovbaapi/ooo/vba/msforms/MSFormReturnTypes.idl
-@@ -25,27 +25,15 @@
- *
- ************************************************************************/
- module msforms
--{
-- struct ReturnBoolean
-- {
-- boolean Value;
-- };
--
-+{
- struct ReturnEffect
- {
- //fmDropEffect Value;
- short Value;
- };
-
-- struct ReturnInteger
-- {
-- long Value;
-- };
--
- struct ReturnSingle
- {
- float Value;
- };
--
--
- };
-diff --git oovbaapi/ooo/vba/msforms/XCheckBox.idl oovbaapi/ooo/vba/msforms/XCheckBox.idl
-new file mode 100644
-index 0000000..30bdee0
---- /dev/null
-+++ oovbaapi/ooo/vba/msforms/XCheckBox.idl
-@@ -0,0 +1,53 @@
-+/*************************************************************************
-+ *
-+ * 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: XCheckBox.idl,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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_msforms_XCheckBox_idl__
-+#define __ooo_vba_msforms_XCheckBox_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+//=============================================================================
-+
-+module ooo { module vba { module msforms {
-+
-+//=============================================================================
-+interface XCheckBox: com::sun::star::uno::XInterface
-+{
-+ [attribute] string Caption;
-+ [attribute] any Value;
-+};
-+
-+//=============================================================================
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/msforms/XComboBox.idl oovbaapi/ooo/vba/msforms/XComboBox.idl
-index 8581392..49e4320 100644
---- oovbaapi/ooo/vba/msforms/XComboBox.idl
-+++ oovbaapi/ooo/vba/msforms/XComboBox.idl
-@@ -47,6 +47,7 @@ interface XComboBox: ::com::sun::star::uno::XInterface
- void AddItem( [in] any pvargItem, [in] any pvargIndex );
- void removeItem( [in] any index );
- void Clear();
-+ any List( [in] any pvargIndex, [in] any pvarColumn );
- };
-
- //=============================================================================
-diff --git oovbaapi/ooo/vba/msforms/XControl.idl oovbaapi/ooo/vba/msforms/XControl.idl
-index c3a050b..a3ce60d 100644
---- oovbaapi/ooo/vba/msforms/XControl.idl
-+++ oovbaapi/ooo/vba/msforms/XControl.idl
-@@ -59,6 +59,7 @@ interface XControl
- [attribute] double Top;
- [attribute] string Name;
- [attribute] string ControlTipText;
-+ [attribute] long ForeColor;
- };
-
- //=============================================================================
-diff --git oovbaapi/ooo/vba/msforms/XLabel.idl oovbaapi/ooo/vba/msforms/XLabel.idl
-index 60427f6..ea4d944 100644
---- oovbaapi/ooo/vba/msforms/XLabel.idl
-+++ oovbaapi/ooo/vba/msforms/XLabel.idl
-@@ -39,6 +39,7 @@ interface XLabel: com::sun::star::uno::XInterface
- {
- [attribute] string Caption;
- [attribute] any Value;
-+ [attribute] string Accelerator;
- };
-
- //=============================================================================
-diff --git oovbaapi/ooo/vba/msforms/XListBox.idl oovbaapi/ooo/vba/msforms/XListBox.idl
-index 627c541..2400602 100644
---- oovbaapi/ooo/vba/msforms/XListBox.idl
-+++ oovbaapi/ooo/vba/msforms/XListBox.idl
-@@ -40,7 +40,7 @@ interface XListBox: com::sun::star::uno::XInterface
- {
- [attribute] any Value;
- [attribute] string Text;
-- [attribute] boolean MultiSelect;
-+ [attribute] long MultiSelect; //liuchen 2009-7-31 MultiSelect property in Excel VBA is type long
- [attribute] any ListIndex;
- [attribute, readonly ] long ListCount;
- void AddItem( [in] any pvargItem, [in] any pvargIndex );
-diff --git oovbaapi/ooo/vba/msforms/XReturnBoolean.idl oovbaapi/ooo/vba/msforms/XReturnBoolean.idl
-new file mode 100644
-index 0000000..52eb69d
---- /dev/null
-+++ oovbaapi/ooo/vba/msforms/XReturnBoolean.idl
-@@ -0,0 +1,51 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009, 2010.
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef __ooo_vba_msforms_XReturnInteger_idl__
-+#define __ooo_vba_msforms_XReturnInteger_idl__
-+
-+#ifndef __com_sun_star_script_XDefaultProperty_idl__
-+#include <com/sun/star/script/XDefaultProperty.idl>
-+#endif
-+//=============================================================================
-+
-+module msforms
-+{
-+
-+//=============================================================================
-+interface XReturnBoolean: com::sun::star::script::XDefaultProperty
-+{
-+ [attribute] boolean Value;
-+};
-+//=============================================================================
-+
-+};
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/msforms/XReturnInteger.idl oovbaapi/ooo/vba/msforms/XReturnInteger.idl
-new file mode 100644
-index 0000000..8ca5c6a
---- /dev/null
-+++ oovbaapi/ooo/vba/msforms/XReturnInteger.idl
-@@ -0,0 +1,51 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009, 2010.
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef __ooo_vba_msforms_XReturnInteger_idl__
-+#define __ooo_vba_msforms_XReturnInteger_idl__
-+
-+#ifndef __com_sun_star_script_XDefaultProperty_idl__
-+#include <com/sun/star/script/XDefaultProperty.idl>
-+#endif
-+//=============================================================================
-+
-+module msforms
-+{
-+
-+//=============================================================================
-+interface XReturnInteger: com::sun::star::script::XDefaultProperty
-+{
-+ [attribute] long Value;
-+};
-+//=============================================================================
-+
-+};
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/msforms/XShape.idl oovbaapi/ooo/vba/msforms/XShape.idl
-index e8682a6..eec1a7f 100644
---- oovbaapi/ooo/vba/msforms/XShape.idl
-+++ oovbaapi/ooo/vba/msforms/XShape.idl
-@@ -75,6 +75,7 @@ interface XShape : ooo::vba::XHelperInterface
- void ScaleHeight( [in] double Factor, [in] boolean RelativeToOriginalSize, [in] long Scale );
- void ScaleWidth( [in] double Factor, [in] boolean RelativeToOriginalSize, [in] long Scale );
- any ShapeRange( [in] any index ); // only here for convience
-+ void Copy();
- };
- }; }; };
-
-diff --git oovbaapi/ooo/vba/msforms/XShapeRange.idl oovbaapi/ooo/vba/msforms/XShapeRange.idl
-index d5b0df2..2d936e0 100644
---- oovbaapi/ooo/vba/msforms/XShapeRange.idl
-+++ oovbaapi/ooo/vba/msforms/XShapeRange.idl
-@@ -47,6 +47,7 @@ interface XShapeRange
- {
- interface ooo::vba::XCollection;
-
-+ [attribute] string Name;
- [attribute] double Height;
- [attribute] double Width;
- [attribute] double Left;
-@@ -65,6 +66,7 @@ interface XShapeRange
- void IncrementRotation( [in] double Increment );
- void IncrementLeft( [in] double Increment );
- void IncrementTop( [in] double Increment );
-+ void ZOrder( [in] long ZOrderCmd );
- };
- }; }; };
-
-diff --git oovbaapi/ooo/vba/msforms/makefile.mk oovbaapi/ooo/vba/msforms/makefile.mk
-index 56ac4ca..79313a9 100644
---- oovbaapi/ooo/vba/msforms/makefile.mk
-+++ oovbaapi/ooo/vba/msforms/makefile.mk
-@@ -44,6 +44,7 @@ IDLFILES=\
- XLabel.idl \
- XTextBox.idl \
- XRadioButton.idl \
-+ XCheckBox.idl \
- XShape.idl \
- XShapes.idl \
- XLineFormat.idl \
-@@ -62,6 +63,8 @@ IDLFILES=\
- XSpinButton.idl \
- XImage.idl \
- XControls.idl \
-+ XReturnBoolean.idl \
-+ XReturnInteger.idl \
- XTextFrame.idl \
-
- # ------------------------------------------------------------------
-diff --git oovbaapi/ooo/vba/word/XApplication.idl oovbaapi/ooo/vba/word/XApplication.idl
-index e6cde02..311f981 100644
---- oovbaapi/ooo/vba/word/XApplication.idl
-+++ oovbaapi/ooo/vba/word/XApplication.idl
-@@ -57,6 +57,7 @@ interface XApplication : com::sun::star::uno::XInterface
- any Documents( [in] any aIndex );
- any Addins( [in] any aIndex );
- any Dialogs( [in] any aIndex );
-+ any ListGalleries( [in] any aIndex );
- float CentimetersToPoints([in] float Centimeters );
- };
-
-diff --git oovbaapi/ooo/vba/word/XCell.idl oovbaapi/ooo/vba/word/XCell.idl
-new file mode 100644
-index 0000000..700b9dc
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XCell.idl
-@@ -0,0 +1,59 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XCell_idl__
-+#define __ooo_vba_word_XCell_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XCell
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ [attribute] long Width;
-+ [attribute] any Height;
-+ [attribute] long HeightRule;
-+
-+ void SetWidth( [in] float ColumnWidth, [in] long RulerStyle );
-+ void SetHeight( [in] float RowHeight, [in] long HeightRule );
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XCells.idl oovbaapi/ooo/vba/word/XCells.idl
-new file mode 100644
-index 0000000..9a18c55
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XCells.idl
-@@ -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:
-+ * $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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XCells_idl__
-+#define __ooo_vba_word_XCells_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XCells
-+{
-+ interface ::ooo::vba::XCollection;
-+
-+ [attribute] long Width;
-+ [attribute] any Height;
-+ [attribute] long HeightRule;
-+
-+ void SetWidth( [in] float ColumnWidth, [in] long RulerStyle );
-+ void SetHeight( [in] float RowHeight, [in] long HeightRule );
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XCheckBox.idl oovbaapi/ooo/vba/word/XCheckBox.idl
-new file mode 100644
-index 0000000..1baafe5
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XCheckBox.idl
-@@ -0,0 +1,54 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XCheckBox_idl__
-+#define __ooo_vba_word_XCheckBox_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XCheckBox
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ [attribute] boolean Value;
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XColumn.idl oovbaapi/ooo/vba/word/XColumn.idl
-new file mode 100644
-index 0000000..78266fc
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XColumn.idl
-@@ -0,0 +1,56 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XColumn_idl__
-+#define __ooo_vba_word_XColumn_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XColumn
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ [attribute] long Width;
-+
-+ void Select();
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XColumns.idl oovbaapi/ooo/vba/word/XColumns.idl
-new file mode 100644
-index 0000000..84ed9cb
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XColumns.idl
-@@ -0,0 +1,59 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XColumns_idl__
-+#define __ooo_vba_word_XColumns_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XColumns
-+{
-+ interface ::ooo::vba::XCollection;
-+
-+ [attribute] long Width;
-+
-+ void Select();
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XDocument.idl oovbaapi/ooo/vba/word/XDocument.idl
-index 4b55552..2fc26bf 100644
---- oovbaapi/ooo/vba/word/XDocument.idl
-+++ oovbaapi/ooo/vba/word/XDocument.idl
-@@ -49,6 +49,11 @@ interface XDocument : com::sun::star::script::XInvocation
- {
- [attribute, readonly] XRange Content;
- [attribute] any AttachedTemplate;
-+ [attribute] long ProtectionType;
-+ [attribute] boolean UpdateStylesOnOpen;
-+ [attribute] boolean AutoHyphenation;
-+ [attribute] long HyphenationZone;
-+ [attribute] long ConsecutiveHyphensLimit;
-
- XRange Range( [in] any Start, [in] any End );
- any BuiltInDocumentProperties( [in] any index );
-@@ -63,6 +68,14 @@ interface XDocument : com::sun::star::script::XInvocation
- any Sections([in] any Index);
- void Activate();
- any PageSetup();
-+ any TablesOfContents([in] any Index);
-+ any FormFields([in] any Index);
-+ void Protect( [in] long Type, [in] any NOReset, [in] any Password, [in] any UseIRM, [in] any EnforceStyleLock );
-+ void PrintOut([in] any Background, [in] any Append, [in] any Range, [in] any OutputFileName, [in] any From, [in] any To, [in] any Item, [in] any Copies, [in] any Pages, [in] any PageType, [in] any PrintToFile, [in] any Collate, [in] any FileName, [in] any ActivePrinterMacGX, [in] any ManualDuplexPrint, [in] any PrintZoomColumn, [in] any PrintZoomRow, [in] any PrintZoomPaperWidth, [in] any PrintZoomPaperHeight);
-+ void PrintPreview();
-+ void ClosePrintPreview();
-+ any Revisions( [in] any index );
-+ any Frames( [in] any index );
- };
-
- }; }; };
-diff --git oovbaapi/ooo/vba/word/XField.idl oovbaapi/ooo/vba/word/XField.idl
-index d610da6..29d30aa 100644
---- oovbaapi/ooo/vba/word/XField.idl
-+++ oovbaapi/ooo/vba/word/XField.idl
-@@ -36,6 +36,8 @@ module ooo { module vba { module word {
- interface XField
- {
- interface ::ooo::vba::XHelperInterface;
-+
-+ boolean Update();
- };
-
- }; }; };
-diff --git oovbaapi/ooo/vba/word/XFormField.idl oovbaapi/ooo/vba/word/XFormField.idl
-new file mode 100644
-index 0000000..23d2a83
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XFormField.idl
-@@ -0,0 +1,58 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XFormField_idl__
-+#define __ooo_vba_word_XFormField_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XFormField
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ [attribute] string Result;
-+ [attribute] boolean Enabled;
-+
-+ any CheckBox();
-+
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XFormFields.idl oovbaapi/ooo/vba/word/XFormFields.idl
-new file mode 100644
-index 0000000..7a19d3b
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XFormFields.idl
-@@ -0,0 +1,55 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XFormFields_idl__
-+#define __ooo_vba_word_XFormFields_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XFormFields
-+{
-+ interface ::ooo::vba::XCollection;
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XFrame.idl oovbaapi/ooo/vba/word/XFrame.idl
-new file mode 100644
-index 0000000..5007405
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XFrame.idl
-@@ -0,0 +1,58 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XFrame_idl__
-+#define __ooo_vba_word_XFrame_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+#ifndef __com_sun_star_container_XNamed_idl__
-+#include <com/sun/star/container/XNamed.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XFrame
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ void Select();
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XFrames.idl oovbaapi/ooo/vba/word/XFrames.idl
-new file mode 100644
-index 0000000..4c81545
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XFrames.idl
-@@ -0,0 +1,55 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XFrames_idl__
-+#define __ooo_vba_word_XFrames_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XFrames
-+{
-+ interface ::ooo::vba::XCollection;
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XGlobals.idl oovbaapi/ooo/vba/word/XGlobals.idl
-index 45b52fc..c3cfd6d 100644
---- oovbaapi/ooo/vba/word/XGlobals.idl
-+++ oovbaapi/ooo/vba/word/XGlobals.idl
-@@ -49,6 +49,7 @@ interface XGlobals : com::sun::star::uno::XInterface
- any Documents( [in] any aIndex );
- any Addins( [in] any aIndex );
- any Dialogs( [in] any aIndex );
-+ any ListGalleries( [in] any aIndex );
- float CentimetersToPoints([in] float Centimeters );
- };
-
-diff --git oovbaapi/ooo/vba/word/XHeadersFooters.idl oovbaapi/ooo/vba/word/XHeadersFooters.idl
-new file mode 100644
-index 0000000..22066e8
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XHeadersFooters.idl
-@@ -0,0 +1,55 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XHeadersFooters_idl__
-+#define __ooo_vba_word_XHeadersFooters_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XHeadersFooters
-+{
-+ interface ::ooo::vba::XCollection;
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XListFormat.idl oovbaapi/ooo/vba/word/XListFormat.idl
-new file mode 100644
-index 0000000..d9aa65a
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XListFormat.idl
-@@ -0,0 +1,60 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XListFormat_idl__
-+#define __ooo_vba_word_XListFormat_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XListTemplate;
-+interface XListFormat
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ void ApplyListTemplate([in] XListTemplate ListTemplate,
-+ [in] any /* optional */ ContinuePreviousList,
-+ [in] any /* optional */ ApplyTo,
-+ [in] any /* optional */ DefaultListBehavior);
-+
-+ void ConvertNumbersToText();
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XListGalleries.idl oovbaapi/ooo/vba/word/XListGalleries.idl
-new file mode 100644
-index 0000000..9268afc
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XListGalleries.idl
-@@ -0,0 +1,55 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XListGalleries_idl__
-+#define __ooo_vba_word_XListGalleries_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XListGalleries
-+{
-+ interface ::ooo::vba::XCollection;
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XListGallery.idl oovbaapi/ooo/vba/word/XListGallery.idl
-new file mode 100644
-index 0000000..4bd83b9
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XListGallery.idl
-@@ -0,0 +1,54 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XListGallery_idl__
-+#define __ooo_vba_word_XListGallery_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XListGallery
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ any ListTemplates( [in] any aIndex );
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XListLevel.idl oovbaapi/ooo/vba/word/XListLevel.idl
-new file mode 100644
-index 0000000..0ea1be7
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XListLevel.idl
-@@ -0,0 +1,66 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XListLevel_idl__
-+#define __ooo_vba_word_XListLevel_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XFont;
-+interface XListLevel
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ [attribute] long Alignment;
-+ [attribute] XFont Font;
-+ [attribute, readonly] long Index;
-+ [attribute] string LinkedStyle;
-+ [attribute] string NumberFormat;
-+ [attribute] float NumberPosition;
-+ [attribute] long NumberStyle;
-+ [attribute] long ResetOnHigher;
-+ [attribute] long StartAt;
-+ [attribute] float TabPosition;
-+ [attribute] float TextPosition;
-+ [attribute] long TrailingCharacter;
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XListLevels.idl oovbaapi/ooo/vba/word/XListLevels.idl
-new file mode 100644
-index 0000000..522d474
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XListLevels.idl
-@@ -0,0 +1,55 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XListLevels_idl__
-+#define __ooo_vba_word_XListLevels_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XListLevels
-+{
-+ interface ::ooo::vba::XCollection;
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XListTemplate.idl oovbaapi/ooo/vba/word/XListTemplate.idl
-new file mode 100644
-index 0000000..403bfa9
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XListTemplate.idl
-@@ -0,0 +1,54 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XListTemplate_idl__
-+#define __ooo_vba_word_XListTemplate_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XListTemplate
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ any ListLevels( [in] any aIndex );
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XListTemplates.idl oovbaapi/ooo/vba/word/XListTemplates.idl
-new file mode 100644
-index 0000000..d6ec96d
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XListTemplates.idl
-@@ -0,0 +1,55 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XListTemplates_idl__
-+#define __ooo_vba_word_XListTemplates_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XListTemplates
-+{
-+ interface ::ooo::vba::XCollection;
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XParagraph.idl oovbaapi/ooo/vba/word/XParagraph.idl
-index 057875d..a585e32 100644
---- oovbaapi/ooo/vba/word/XParagraph.idl
-+++ oovbaapi/ooo/vba/word/XParagraph.idl
-@@ -43,6 +43,7 @@ interface XParagraph
- interface ooo::vba::XHelperInterface;
-
- [attribute, readonly] XRange Range;
-+ [attribute] any Style;
- };
-
- }; }; };
-diff --git oovbaapi/ooo/vba/word/XRange.idl oovbaapi/ooo/vba/word/XRange.idl
-index 868613c..4bed0c0 100644
---- oovbaapi/ooo/vba/word/XRange.idl
-+++ oovbaapi/ooo/vba/word/XRange.idl
-@@ -45,13 +45,14 @@ module ooo { module vba { module word {
- interface XParagraphFormat;
- interface XStyle;
- interface XFont;
-+interface XListFormat;
- interface XRange
- {
- interface ooo::vba::XHelperInterface;
-
- [attribute] string Text;
- [attribute] XParagraphFormat ParagraphFormat;
-- [attribute] XStyle Style;
-+ [attribute] any Style;
- [attribute,readonly] ::com::sun::star::text::XTextRange XTextRange;
- // Of course Font is NOT readonly, #FIXME #TODO
- // readonly though will force an error attempting to write
-@@ -59,6 +60,7 @@ interface XRange
- [attribute] long LanguageID;
- [attribute] long Start;
- [attribute] long End;
-+ [attribute, readonly] XListFormat ListFormat;
-
- void InsertBreak( [in] any Type );
- void Select();
-@@ -66,6 +68,10 @@ interface XRange
- void InsertParagraphBefore();
- void InsertParagraphAfter();
- any PageSetup();
-+ boolean InRange( [in] XRange Range );
-+ any Revisions( [in] any index );
-+ any Sections( [in] any index );
-+ any Fields( [in] any index );
- };
-
- }; }; };
-diff --git oovbaapi/ooo/vba/word/XReplacement.idl oovbaapi/ooo/vba/word/XReplacement.idl
-index 2d6dcd2..778f9e1 100644
---- oovbaapi/ooo/vba/word/XReplacement.idl
-+++ oovbaapi/ooo/vba/word/XReplacement.idl
-@@ -42,6 +42,8 @@ interface XReplacement
- interface ooo::vba::XHelperInterface;
-
- [attribute] string Text;
-+
-+ void ClearFormatting();
- };
-
- }; }; };
-diff --git oovbaapi/ooo/vba/word/XRevision.idl oovbaapi/ooo/vba/word/XRevision.idl
-new file mode 100644
-index 0000000..bb3e570
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XRevision.idl
-@@ -0,0 +1,56 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XRevision_idl__
-+#define __ooo_vba_word_XRevision_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XRange;
-+interface XRevision
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ void Accept();
-+ void Reject();
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XRevisions.idl oovbaapi/ooo/vba/word/XRevisions.idl
-new file mode 100644
-index 0000000..358face
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XRevisions.idl
-@@ -0,0 +1,58 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XRevisions_idl__
-+#define __ooo_vba_word_XRevisions_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XRevisions
-+{
-+ interface ::ooo::vba::XCollection;
-+
-+ void AcceptAll();
-+ void RejectAll();
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XRow.idl oovbaapi/ooo/vba/word/XRow.idl
-new file mode 100644
-index 0000000..2c54828
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XRow.idl
-@@ -0,0 +1,58 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XRow_idl__
-+#define __ooo_vba_word_XRow_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XRow
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ [attribute] any Height;
-+ [attribute] long HeightRule;
-+
-+ void Select();
-+ void SetHeight( [in] float RowHeight, [in] long HeightRule );
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XRows.idl oovbaapi/ooo/vba/word/XRows.idl
-new file mode 100644
-index 0000000..8d0ae61
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XRows.idl
-@@ -0,0 +1,63 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XRows_idl__
-+#define __ooo_vba_word_XRows_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XRows
-+{
-+ interface ::ooo::vba::XCollection;
-+
-+ [attribute] long Alignment;
-+ [attribute] any AllowBreakAcrossPages;
-+ [attribute] float SpaceBetweenColumns;
-+
-+ void Delete();
-+ void SetLeftIndent( [in] float LeftIndent, [in] long RulerStyle );
-+ void Select();
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XSection.idl oovbaapi/ooo/vba/word/XSection.idl
-index 325ddf5..ec4569b 100644
---- oovbaapi/ooo/vba/word/XSection.idl
-+++ oovbaapi/ooo/vba/word/XSection.idl
-@@ -43,8 +43,8 @@ interface XSection
-
- [attribute] boolean ProtectedForForms;
-
-- any Headers();
-- any Footers();
-+ any Headers( [in] any aIndex );
-+ any Footers( [in] any aIndex );
- any PageSetup();
- };
-
-diff --git oovbaapi/ooo/vba/word/XSelection.idl oovbaapi/ooo/vba/word/XSelection.idl
-index 053cbc6..3cbcfaa 100644
---- oovbaapi/ooo/vba/word/XSelection.idl
-+++ oovbaapi/ooo/vba/word/XSelection.idl
-@@ -52,7 +52,7 @@ interface XSelection
- [attribute, readonly] XRange Range;
- [attribute] XParagraphFormat ParagraphFormat;
- [attribute, readonly] XFind Find;
-- [attribute] XStyle Style;
-+ [attribute] any Style;
- [attribute, readonly] XFont Font;
- [attribute, readonly] XHeaderFooter HeaderFooter;
- [attribute] long LanguageID;
-@@ -68,6 +68,7 @@ interface XSelection
- void MoveRight( [in] any Unit, [in] any Count, [in] any Extend );
- void MoveLeft( [in] any Unit, [in] any Count, [in] any Extend );
- void MoveDown( [in] any Unit, [in] any Count, [in] any Extend );
-+ void MoveUp( [in] any Unit, [in] any Count, [in] any Extend );
- void TypeParagraph();
- void InsertParagraph();
- void InsertParagraphBefore();
-@@ -77,6 +78,19 @@ interface XSelection
- any Information( [in] long Type );
- void InsertBreak( [in] any Type );
- any ShapeRange();
-+ void SelectColumn();
-+ void SelectRow();
-+ any Rows( [in] any aIndex );
-+ any Columns( [in] any aIndex );
-+ any Cells( [in] any aIndex );
-+ void Copy();
-+ void CopyAsPicture();
-+ void Paste();
-+ void Collapse([in] any Direction);
-+ void WholeStory();
-+ boolean InRange( [in] XRange Range );
-+ void SplitTable();
-+ any Paragraphs( [in] any aIndex );
- };
-
- }; }; };
-diff --git oovbaapi/ooo/vba/word/XStyle.idl oovbaapi/ooo/vba/word/XStyle.idl
-index b89798d..1c0f305 100644
---- oovbaapi/ooo/vba/word/XStyle.idl
-+++ oovbaapi/ooo/vba/word/XStyle.idl
-@@ -35,17 +35,32 @@
- #include <ooo/vba/XHelperInterface.idl>
- #endif
-
-+#ifndef __com_sun_star_script_XDefaultProperty_idl__
-+#include <com/sun/star/script/XDefaultProperty.idl>
-+#endif
-+
- module ooo { module vba { module word {
-
- interface XFont;
-+interface XListTemplate;
-+interface XParagraphFormat;
- interface XStyle
- {
- interface ooo::vba::XHelperInterface;
-+ interface com::sun::star::script::XDefaultProperty;
-
- [attribute] string Name;
- [attribute] long LanguageID;
- [attribute, readonly] long Type;
- [attribute, readonly] XFont Font;
-+ [attribute] string NameLocal;
-+ [attribute, readonly] XParagraphFormat ParagraphFormat;
-+ [attribute] boolean AutomaticallyUpdate;
-+ [attribute] any BaseStyle;
-+ [attribute] any NextParagraphStyle;
-+ [attribute, readonly] long ListLevelNumber;
-+
-+ void LinkToListTemplate( [in] XListTemplate ListTemplate, [in] any ListLevelNumber );
- };
-
- }; }; };
-diff --git oovbaapi/ooo/vba/word/XTabStop.idl oovbaapi/ooo/vba/word/XTabStop.idl
-new file mode 100644
-index 0000000..b9cf94d
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XTabStop.idl
-@@ -0,0 +1,52 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XTabStop_idl__
-+#define __ooo_vba_word_XTabStop_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XTabStop
-+{
-+ interface ooo::vba::XHelperInterface;
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XTabStops.idl oovbaapi/ooo/vba/word/XTabStops.idl
-new file mode 100644
-index 0000000..318d492
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XTabStops.idl
-@@ -0,0 +1,59 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XTabStops_idl__
-+#define __ooo_vba_word_XTabStops_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XTabStop;
-+interface XTabStops
-+{
-+ interface ::ooo::vba::XCollection;
-+
-+ XTabStop Add([in] float Position, [in] any Alignment, [in] any Leader );
-+ void ClearAll();
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XTable.idl oovbaapi/ooo/vba/word/XTable.idl
-index 235067c..edd5b39 100644
---- oovbaapi/ooo/vba/word/XTable.idl
-+++ oovbaapi/ooo/vba/word/XTable.idl
-@@ -69,7 +69,9 @@ interface XTable
- raises(com::sun::star::script::BasicErrorException);
- */
- any Borders( [in] any aIndex );
--
-+
-+ any Rows([in] any aIndex );
-+ any Columns([in] any aIndex );
- };
-
- }; }; };
-diff --git oovbaapi/ooo/vba/word/XTableOfContents.idl oovbaapi/ooo/vba/word/XTableOfContents.idl
-new file mode 100644
-index 0000000..dcb7e8a
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XTableOfContents.idl
-@@ -0,0 +1,60 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XTableOfContents_idl__
-+#define __ooo_vba_word_XTableOfContents_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XTableOfContents
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ [attribute] long LowerHeadingLevel;
-+ [attribute] long TabLeader;
-+ [attribute] boolean UseFields;
-+ [attribute] boolean UseOutlineLevels;
-+
-+ void Delete();
-+ void Update();
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XTablesOfContents.idl oovbaapi/ooo/vba/word/XTablesOfContents.idl
-new file mode 100644
-index 0000000..53c557b
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XTablesOfContents.idl
-@@ -0,0 +1,59 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XTablesOfContents_idl__
-+#define __ooo_vba_word_XTablesOfContents_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XTableOfContents;
-+interface XRange;
-+interface XTablesOfContents
-+{
-+ interface ::ooo::vba::XCollection;
-+
-+ XTableOfContents Add([in] XRange Range, [in] any UseHeadingStyles, [in] any UpperHeadingLevel, [in] any LowerHeadingLevel, [in] any UseFields, [in] any TableID, [in] any RightAlignPageNumbers, [in] any IncludePageNumbers, [in] any AddedStyles, [in] any UseHyperlinks, [in] any HidePageNumbersInWeb, [in] any UseOutlineLevels );
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XTemplate.idl oovbaapi/ooo/vba/word/XTemplate.idl
-index 0a5f0ed..04e7063 100644
---- oovbaapi/ooo/vba/word/XTemplate.idl
-+++ oovbaapi/ooo/vba/word/XTemplate.idl
-@@ -42,6 +42,7 @@ interface XTemplate
- interface ooo::vba::XHelperInterface;
-
- [attribute, readonly] string Name;
-+ [attribute, readonly] string Path;
-
- any AutoTextEntries( [in] any aIndex );
- };
-diff --git oovbaapi/ooo/vba/word/XWindow.idl oovbaapi/ooo/vba/word/XWindow.idl
-index 225a923..4ef56da 100644
---- oovbaapi/ooo/vba/word/XWindow.idl
-+++ oovbaapi/ooo/vba/word/XWindow.idl
-@@ -44,6 +44,7 @@ module ooo { module vba { module word {
- interface XWindow : com::sun::star::uno::XInterface
- {
- [attribute] any View;
-+ [attribute] any WindowState;
- void Activate();
- void Close([in] any SaveChanges, [in] any RouteDocument);
- any Panes( [in] any aIndex ); // this is a fake api for it seems not support in Write
-diff --git oovbaapi/ooo/vba/word/makefile.mk oovbaapi/ooo/vba/word/makefile.mk
-index e3a19e6..454a890 100644
---- oovbaapi/ooo/vba/word/makefile.mk
-+++ oovbaapi/ooo/vba/word/makefile.mk
-@@ -79,6 +79,31 @@ IDLFILES= XGlobals.idl\
- XPageSetup.idl \
- XSection.idl \
- XSections.idl \
-+ XRow.idl \
-+ XRows.idl \
-+ XColumn.idl \
-+ XColumns.idl \
-+ XCell.idl \
-+ XCells.idl \
-+ XTabStop.idl \
-+ XTabStops.idl \
-+ XTableOfContents.idl \
-+ XTablesOfContents.idl \
-+ XListFormat.idl \
-+ XListGalleries.idl \
-+ XListGallery.idl \
-+ XListTemplate.idl \
-+ XListTemplates.idl \
-+ XListLevel.idl \
-+ XListLevels.idl \
-+ XFormField.idl \
-+ XFormFields.idl \
-+ XRevision.idl \
-+ XRevisions.idl \
-+ XFrame.idl \
-+ XFrames.idl \
-+ XCheckBox.idl \
-+ XHeadersFooters.idl \
-
- # ------------------------------------------------------------------
-
-diff --git oox/inc/oox/ole/vbacontrol.hxx oox/inc/oox/ole/vbacontrol.hxx
-index bc57d00..085a2f5 100755
---- oox/inc/oox/ole/vbacontrol.hxx
-+++ oox/inc/oox/ole/vbacontrol.hxx
-@@ -29,6 +29,7 @@
- #define OOX_OLE_VBACONTROL_HXX
-
- #include "oox/ole/axcontrol.hxx"
-+#include <com/sun/star/frame/XModel.hpp>
-
- namespace com { namespace sun { namespace star {
- namespace container { class XNameContainer; }
-@@ -188,6 +189,7 @@ public:
- /** Imports the form and its embedded controls, and inserts the form with
- all its controls into the passed dialog library. */
- void importForm(
-+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxDocModel,
- const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxDialogLib,
- StorageBase& rVbaFormStrg,
- const ::rtl::OUString& rModuleName,
-diff --git oox/source/ole/vbacontrol.cxx oox/source/ole/vbacontrol.cxx
-index 16e18b2..17cacce 100755
---- oox/source/ole/vbacontrol.cxx
-+++ oox/source/ole/vbacontrol.cxx
-@@ -57,6 +57,7 @@ using ::com::sun::star::uno::Reference;
- using ::com::sun::star::uno::UNO_QUERY_THROW;
- using ::com::sun::star::uno::UNO_SET_THROW;
- using ::com::sun::star::uno::XComponentContext;
-+using ::com::sun::star::frame::XModel;
-
- namespace oox {
- namespace ole {
-@@ -724,7 +725,7 @@ VbaUserForm::VbaUserForm( const Reference< XMultiServiceFactory >& rxGlobalFacto
- OSL_ENSURE( mxGlobalFactory.is(), "VbaUserForm::VbaUserForm - missing service factory" );
- }
-
--void VbaUserForm::importForm( const Reference< XNameContainer >& rxDialogLib,
-+void VbaUserForm::importForm( const Reference< XModel >& rxDocModel, const Reference< XNameContainer >& rxDialogLib,
- StorageBase& rVbaFormStrg, const OUString& rModuleName, rtl_TextEncoding eTextEnc )
- {
- OSL_ENSURE( rxDialogLib.is(), "VbaUserForm::importForm - missing dialog library" );
-@@ -795,7 +796,7 @@ void VbaUserForm::importForm( const Reference< XNameContainer >& rxDialogLib,
- // export the dialog to XML and insert it into the dialog library
- PropertySet aFactoryProps( mxGlobalFactory );
- Reference< XComponentContext > xCompContext( aFactoryProps.getAnyProperty( PROP_DefaultContext ), UNO_QUERY_THROW );
-- Reference< XInputStreamProvider > xDialogSource( ::xmlscript::exportDialogModel( xDialogNC, xCompContext ), UNO_SET_THROW );
-+ Reference< XInputStreamProvider > xDialogSource( ::xmlscript::exportDialogModel( xDialogNC, xCompContext, rxDocModel ), UNO_SET_THROW );
- OSL_ENSURE( !rxDialogLib->hasByName( aFormName ), "VbaUserForm::importForm - multiple dialogs with equal name" );
- ContainerHelper::insertByName( rxDialogLib, aFormName, Any( xDialogSource ) );
- }
-diff --git oox/source/ole/vbaproject.cxx oox/source/ole/vbaproject.cxx
-index b1d2574..04d37b8 100755
---- oox/source/ole/vbaproject.cxx
-+++ oox/source/ole/vbaproject.cxx
-@@ -484,7 +484,7 @@ void VbaProject::importVba( StorageBase& rVbaPrjStrg, const GraphicHelper& rGrap
- // create and import the form
- Reference< XNameContainer > xDialogLib( createDialogLibrary(), UNO_SET_THROW );
- VbaUserForm aForm( mxGlobalFactory, rGraphicHelper, bDefaultColorBgr );
-- aForm.importForm( xDialogLib, *xSubStrg, aModuleName, eTextEnc );
-+ aForm.importForm( mxDocModel, xDialogLib, *xSubStrg, aModuleName, eTextEnc );
- }
- catch( Exception& )
- {
-diff --git sc/inc/address.hxx sc/inc/address.hxx
-index 6bd785e..211d7e5 100644
---- sc/inc/address.hxx
-+++ sc/inc/address.hxx
-@@ -227,6 +227,9 @@ inline SCTAB SanitizeTab( SCTAB nTab, SCTAB nMaxTab )
- #define SCA_VALID_ROW 0x0100
- #define SCA_VALID_COL 0x0200
- #define SCA_VALID_TAB 0x0400
-+// SCA_BITS is a convience for
-+// (SCA_VALID_TAB | SCA_VALID_COL | SCA_VALID_ROW | SCA_TAB_3D | SCA_TAB_ABSOLUTE | SCA_ROW_ABSOLUTE | SCA_COL_ABSOLUTE)
-+#define SCA_BITS 0x070F
- // somewhat cheesy kludge to force the display of the document name even for
- // local references. Requires TAB_3D to be valid
- #define SCA_FORCE_DOC 0x0800
-diff --git sc/inc/addruno.hxx sc/inc/addruno.hxx
-index 2cf8eca..3e17398 100644
---- sc/inc/addruno.hxx
-+++ sc/inc/addruno.hxx
-@@ -47,7 +47,7 @@ private:
- sal_Int32 nRefSheet;
- sal_Bool bIsRange;
-
-- sal_Bool ParseUIString( const String& rUIString );
-+ sal_Bool ParseUIString( const String& rUIString, ::formula::FormulaGrammar::AddressConvention eConv = ::formula::FormulaGrammar::CONV_OOO );
-
- public:
-
-diff --git sc/inc/appoptio.hxx sc/inc/appoptio.hxx
-index 4056b3c..12b41ff 100644
---- sc/inc/appoptio.hxx
-+++ sc/inc/appoptio.hxx
-@@ -44,6 +44,10 @@ public:
-
- void SetDefaults();
-
-+ // Set or get the initial tab count for new spreadsheet, it is used by VBA API currently.
-+ void SetTabCountInNewSpreadsheet( sal_Int16 nCount ) { nTabCountInNewSpreadsheet = nCount; }
-+ sal_Int16 GetTabCountInNewSpreadsheet() const { return nTabCountInNewSpreadsheet; }
-+
- void SetAppMetric( FieldUnit eUnit ) { eMetric = eUnit; }
- FieldUnit GetAppMetric() const { return eMetric; }
- void SetZoom( USHORT nNew ) { nZoom = nNew; }
-@@ -87,6 +91,7 @@ public:
- const ScAppOptions& operator= ( const ScAppOptions& rOpt );
-
- private:
-+ sal_Int16 nTabCountInNewSpreadsheet;
- FieldUnit eMetric;
- USHORT nLRUFuncCount;
- USHORT* pLRUList;
-diff --git sc/inc/cell.hxx sc/inc/cell.hxx
-index 93818ec..3c1605e 100644
---- sc/inc/cell.hxx
-+++ sc/inc/cell.hxx
-@@ -406,7 +406,7 @@ public:
- const formula::FormulaGrammar::Grammar = formula::FormulaGrammar::GRAM_DEFAULT ) const;
-
- void SetDirty();
-- inline void SetDirtyVar() { bDirty = TRUE; }
-+ void SetDirtyVar();
- // If setting entire document dirty after load, no broadcasts but still append to FormulaTree.
- void SetDirtyAfterLoad();
- inline void ResetTableOpDirtyVar() { bTableOpDirty = FALSE; }
-diff --git sc/inc/document.hxx sc/inc/document.hxx
-index 21944f2..a30cd61 100644
---- sc/inc/document.hxx
-+++ sc/inc/document.hxx
-@@ -103,6 +103,7 @@ class ScDrawLayer;
- class ScExtDocOptions;
- class ScExternalRefManager;
- class ScFormulaCell;
-+class ScMacroManager;
- class ScMarkData;
- class ScOutlineTable;
- class ScPatternAttr;
-@@ -167,6 +168,9 @@ namespace com { namespace sun { namespace star {
- }
- } } }
-
-+namespace com { namespace sun { namespace star { namespace document {
-+ class XVbaEventsHelper;
-+} } } }
- #include <svl/zforlist.hxx>
- /*
- #ifdef _ZFORLIST_DECLARE_TABLE
-@@ -302,6 +306,8 @@ private:
- ::std::auto_ptr<ScClipParam> mpClipParam;
-
- ::std::auto_ptr<ScExternalRefManager> pExternalRefMgr;
-+ ::std::auto_ptr<ScMacroManager> mpMacroMgr;
-+
-
- // mutable for lazy construction
- mutable ::std::auto_ptr< ScFormulaParserPool >
-@@ -335,6 +341,8 @@ private:
-
- Timer aTrackTimer;
-
-+ com::sun::star::uno::Reference< com::sun::star::document::XVbaEventsHelper > mxVbaEventsHelper;
-+
- public:
- ScTabOpList aTableOpList; // list of ScInterpreterTableOpParams currently in use
- ScInterpreterTableOpParams aLastTableOpParams; // remember last params
-@@ -434,6 +442,9 @@ private:
-
- sal_Int16 mnNamedRangesLockCount;
-
-+ // for worksheet calculate event
-+ ::std::vector< SCTAB > maTabs;
-+
- public:
- SC_DLLPUBLIC ULONG GetCellCount() const; // alle Zellen
- SCSIZE GetCellCount(SCTAB nTab, SCCOL nCol) const;
-@@ -454,6 +465,8 @@ public:
- void SetName( const String& r ) { aDocName = r; }
- const String& GetCodeName() const { return aDocCodeName; }
- void SetCodeName( const String& r ) { aDocCodeName = r; }
-+
-+ SC_DLLPUBLIC NameToNameMap* GetLocalNameMap( SCTAB& rTab );
-
- void GetDocStat( ScDocStat& rDocStat );
-
-@@ -806,7 +819,7 @@ public:
- BOOL HasSelectionData( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
-
- /** Returns the pointer to a cell note object at the passed cell address. */
-- ScPostIt* GetNote( const ScAddress& rPos );
-+ SC_DLLPUBLIC ScPostIt* GetNote( const ScAddress& rPos );
- /** Sets the passed note at the cell with the passed cell address. */
- void TakeNote( const ScAddress& rPos, ScPostIt*& rpNote );
- /** Returns and forgets the cell note object at the passed cell address. */
-@@ -902,6 +915,10 @@ public:
- BOOL IsForcedFormulaPending() const { return bForcedFormulaPending; }
- // if CalcFormulaTree() is currently running
- BOOL IsCalculatingFormulaTree() { return bCalculatingFormulaTree; }
-+
-+ // for worksheet calculate event
-+ BOOL FireCalculateEvent( SCTAB nTab );
-+ void AddCalculateTable( SCTAB nTab );
-
- USHORT GetErrCode( const ScAddress& ) const;
-
-@@ -941,7 +958,7 @@ public:
- SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab,
- ScDirection eDir );
-
-- void FindAreaPos( SCCOL& rCol, SCROW& rRow, SCTAB nTab, SCsCOL nMovX, SCsROW nMovY );
-+ SC_DLLPUBLIC void FindAreaPos( SCCOL& rCol, SCROW& rRow, SCTAB nTab, SCsCOL nMovX, SCsROW nMovY );
- SC_DLLPUBLIC void GetNextPos( SCCOL& rCol, SCROW& rRow, SCTAB nTab, SCsCOL nMovX, SCsROW nMovY,
- BOOL bMarked, BOOL bUnprotected, const ScMarkData& rMark );
-
-@@ -962,7 +979,7 @@ public:
- SCROW nStartRow, SCSIZE nSize,
- ScDocument* pRefUndoDoc = NULL, BOOL* pUndoOutline = NULL,
- const ScMarkData* pTabMark = NULL );
-- void DeleteRow( const ScRange& rRange,
-+ SC_DLLPUBLIC void DeleteRow( const ScRange& rRange,
- ScDocument* pRefUndoDoc = NULL, BOOL* pUndoOutline = NULL );
- BOOL InsertCol( SCROW nStartRow, SCTAB nStartTab,
- SCROW nEndRow, SCTAB nEndTab,
-@@ -1000,7 +1017,7 @@ public:
- SC_DLLPUBLIC void ResetClip( ScDocument* pSourceDoc, const ScMarkData* pMarks );
- SC_DLLPUBLIC void ResetClip( ScDocument* pSourceDoc, SCTAB nTab );
- void SetCutMode( BOOL bCut );
-- BOOL IsCutMode();
-+ SC_DLLPUBLIC BOOL IsCutMode();
- void SetClipArea( const ScRange& rArea, BOOL bCut = FALSE );
-
- SC_DLLPUBLIC BOOL IsDocVisible() const { return bIsVisible; }
-@@ -1574,6 +1591,7 @@ public:
- SC_DLLPUBLIC ScLkUpdMode GetLinkMode() const { return eLinkMode ;}
- void SetLinkMode( ScLkUpdMode nSet ) { eLinkMode = nSet;}
-
-+ SC_DLLPUBLIC ScMacroManager* GetMacroManager();
-
- private:
- ScDocument(const ScDocument& r); // disabled with no definition
-@@ -1783,6 +1801,8 @@ public:
- void GetSortParam( ScSortParam& rParam, SCTAB nTab );
- void SetSortParam( ScSortParam& rParam, SCTAB nTab );
-
-+ com::sun::star::uno::Reference< com::sun::star::document::XVbaEventsHelper > GetVbaEventsHelper();
-+
- /** Should only be GRAM_PODF or GRAM_ODFF. */
- void SetStorageGrammar( formula::FormulaGrammar::Grammar eGrammar );
- formula::FormulaGrammar::Grammar GetStorageGrammar() const
-diff --git sc/inc/docuno.hxx sc/inc/docuno.hxx
-index aaf620e..5be5558 100644
---- sc/inc/docuno.hxx
-+++ sc/inc/docuno.hxx
-@@ -53,6 +53,7 @@
- #include <com/sun/star/beans/XPropertySet.hpp>
- #include <com/sun/star/sheet/XCellRangesAccess.hpp>
- #include <com/sun/star/util/XChangesNotifier.hpp>
-+#include <com/sun/star/document/XDocumentEventCompatibleHelper.hpp>
- #include <cppuhelper/implbase2.hxx>
- #include <cppuhelper/implbase3.hxx>
- #include <cppuhelper/implbase4.hxx>
-@@ -88,6 +89,7 @@ class SC_DLLPUBLIC ScModelObj : public SfxBaseModel,
- public com::sun::star::view::XRenderable,
- public com::sun::star::document::XLinkTargetSupplier,
- public com::sun::star::beans::XPropertySet,
-+ public com::sun::star::document::XDocumentEventCompatibleHelper,
- public SvxFmMSFactory, // derived from XMultiServiceFactory
- public com::sun::star::lang::XServiceInfo,
- public ::com::sun::star::util::XChangesNotifier
-@@ -320,6 +322,8 @@ public:
- virtual void SAL_CALL removeChangesListener( const ::com::sun::star::uno::Reference<
- ::com::sun::star::util::XChangesListener >& aListener )
- throw (::com::sun::star::uno::RuntimeException);
-+ // XVbaEventHelper
-+ virtual sal_Bool SAL_CALL processCompatibleEvent( sal_Int16 nEventId ) throw (::com::sun::star::uno::RuntimeException);
- };
-
-
-diff --git sc/inc/global.hxx sc/inc/global.hxx
-index e456fed..cde71d8 100644
---- sc/inc/global.hxx
-+++ sc/inc/global.hxx
-@@ -225,6 +225,7 @@ const USHORT IDF_HARDATTR = 0x0020; /// Hard cell attributes.
- const USHORT IDF_STYLES = 0x0040; /// Cell styles.
- const USHORT IDF_OBJECTS = 0x0080; /// Drawing objects.
- const USHORT IDF_EDITATTR = 0x0100; /// Rich-text attributes.
-+const USHORT IDF_SPECIAL_BOOLEAN = 0x1000;
- const USHORT IDF_ATTRIB = IDF_HARDATTR | IDF_STYLES;
- const USHORT IDF_CONTENTS = IDF_VALUE | IDF_DATETIME | IDF_STRING | IDF_NOTE | IDF_FORMULA;
- const USHORT IDF_ALL = IDF_CONTENTS | IDF_ATTRIB | IDF_OBJECTS;
-diff --git sc/inc/globstr.hrc sc/inc/globstr.hrc
-index a783120..7503ce2 100644
---- sc/inc/globstr.hrc
-+++ sc/inc/globstr.hrc
-@@ -577,7 +577,23 @@
- #define STR_UNDO_SET_TAB_BG_COLOR 438
- #define STR_UNDO_SET_MULTI_TAB_BG_COLOR 439
-
--#define STR_COUNT 440
-+#define STR_SHAPE_AUTOSHAPE 440
-+#define STR_SHAPE_RECTANGLE 441
-+#define STR_SHAPE_LINE 442
-+#define STR_SHAPE_OVAL 443
-+#define STR_SHAPE_TEXTBOX 444
-+
-+#define STR_FORM_BUTTON 445
-+#define STR_FORM_CHECKBOX 446
-+#define STR_FORM_OPTIONBUTTON 447
-+#define STR_FORM_LABEL 448
-+#define STR_FORM_LISTBOX 449
-+#define STR_FORM_GROUPBOX 450
-+#define STR_FORM_DROPDOWN 451
-+#define STR_FORM_SPINNER 452
-+#define STR_FORM_SCROLLBAR 453
-+
-+#define STR_COUNT 454
-
- #endif
-
-diff --git sc/inc/macromgr.hxx sc/inc/macromgr.hxx
-new file mode 100644
-index 0000000..35a3b2d
---- /dev/null
-+++ sc/inc/macromgr.hxx
-@@ -0,0 +1,70 @@
-+/*************************************************************************
-+ *
-+ * 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: document.hxx,v $
-+ * $Revision: 1.115.36.9 $
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef SC_MACROMGR_HXX
-+#define SC_MACROMGR_HXX
-+
-+#include <com/sun/star/container/XContainerListener.hpp>
-+
-+#include "rtl/ustring.hxx"
-+#include "scdllapi.h"
-+
-+#include <hash_map>
-+#include <memory>
-+
-+class ScDocument;
-+class ScFormulaCell;
-+class ScUserMacroDepTracker;
-+
-+class ScMacroManager
-+{
-+public:
-+ explicit ScMacroManager(ScDocument* pDoc);
-+ ~ScMacroManager();
-+
-+ SC_DLLPUBLIC void InitUserFuncData();
-+ SC_DLLPUBLIC void SetUserFuncVolatile( const rtl::OUString& sName, bool isVolatile );
-+ SC_DLLPUBLIC bool GetUserFuncVolatile( const rtl::OUString& sName );
-+
-+ void AddDependentCell(const ::rtl::OUString& aModuleName, ScFormulaCell* pCell);
-+ void RemoveDependentCell(ScFormulaCell* pCell);
-+ void BroadcastModuleUpdate(const ::rtl::OUString& aModuleName);
-+
-+private:
-+ typedef std::hash_map< ::rtl::OUString, bool, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > NameBoolMap;
-+ NameBoolMap mhFuncToVolatile;
-+ com::sun::star::uno::Reference< com::sun::star::container::XContainerListener > mxContainerListener;
-+
-+ ::std::auto_ptr<ScUserMacroDepTracker> mpDepTracker;
-+ ScDocument* mpDoc;
-+};
-+
-+#endif
-+
-diff --git sc/inc/rangenam.hxx sc/inc/rangenam.hxx
-index 7f3e123..651be23 100644
---- sc/inc/rangenam.hxx
-+++ sc/inc/rangenam.hxx
-@@ -142,7 +142,7 @@ public:
-
- SC_DLLPUBLIC BOOL IsReference( ScRange& rRef ) const;
- BOOL IsReference( ScRange& rRef, const ScAddress& rPos ) const;
-- BOOL IsValidReference( ScRange& rRef ) const;
-+ SC_DLLPUBLIC BOOL IsValidReference( ScRange& rRef ) const;
-
- //UNUSED2009-05 BOOL IsRangeAtCursor( const ScAddress&, BOOL bStartOnly ) const;
- BOOL IsRangeAtBlock( const ScRange& ) const;
-diff --git sc/inc/sc.hrc sc/inc/sc.hrc
-index f342d9c..5547bb4 100644
---- sc/inc/sc.hrc
-+++ sc/inc/sc.hrc
-@@ -592,11 +592,9 @@
- // #i59082# assign macro to shape
- #define SID_ASSIGNMACRO (SC_VIEW_START + 95)
-
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
- // #i66550# hyperlinks in shapes
- #define SID_DRAW_HLINK_EDIT (SC_VIEW_START + 96)
- #define SID_DRAW_HLINK_DELETE (SC_VIEW_START + 97)
--#endif
-
- // "Zoom / Synchronize sheets" in options dialog
- #define SID_SC_OPT_SYNCZOOM (SC_VIEW_START + 98)
-@@ -1671,6 +1669,13 @@
- #define RID_SCPAGE_FORMULA (SC_OOO_BUILD_START + 3)
- #define HID_SCPAGE_FORMULA (SC_OOO_BUILD_START + 4)
-
-+#define SC_OOO_BUILD_START (SC_DIALOGS_END)
-+
-+// Data Form
-+#define SID_DATAFORM_NEW (SC_OOO_BUILD_START + 1) // message
-+#define SID_DATA_FORM (SC_OOO_BUILD_START + 2) // menu (in Data menu)
-+#define RID_SCDLG_DATAFORM (SC_OOO_BUILD_START + 3) // dialog
-+
- #endif
-
-
-diff --git sc/inc/scabstdlg.hxx sc/inc/scabstdlg.hxx
-index 05ca719..e50f8cd 100644
---- sc/inc/scabstdlg.hxx
-+++ sc/inc/scabstdlg.hxx
-@@ -40,6 +40,8 @@
- #include "pivot.hxx"
- #include "i18npool/lang.h"
-
-+#include <tabvwsh.hxx>
-+
- class ScAsciiOptions;
- class ScAutoFormat;
- class ScAutoFormatData;
-@@ -113,6 +115,12 @@ public:
- virtual DelCellCmd GetDelCellCmd() const = 0;
- };
-
-+//for dataform
-+class AbstractScDataFormDlg : public VclAbstractDialog //add for ScDeleteCellDlg
-+{
-+
-+};
-+
- class AbstractScDeleteContentsDlg: public VclAbstractDialog //add for ScDeleteContentsDlg
- {
- public:
-@@ -309,7 +317,7 @@ public:
- class ScAbstractDialogFactory
- {
- public:
-- static ScAbstractDialogFactory* Create();
-+ SC_DLLPUBLIC static ScAbstractDialogFactory* Create();
-
- virtual AbstractScImportAsciiDlg * CreateScImportAsciiDlg( Window* pParent, String aDatName, //add for ScImportAsciiDlg
- SvStream* pInStream, int nId,
-@@ -343,6 +351,9 @@ public:
-
- virtual AbstractScDeleteCellDlg * CreateScDeleteCellDlg( Window* pParent, int nId, BOOL bDisallowCellMove = FALSE ) = 0 ; //add for ScDeleteCellDlg
-
-+ //for dataform
-+ virtual AbstractScDataFormDlg * CreateScDataFormDlg( Window* pParent, int nId, ScTabViewShell* pTabViewShell ) = 0 ; //add for ScDataFormDlg
-+
- virtual AbstractScDeleteContentsDlg * CreateScDeleteContentsDlg(Window* pParent,int nId, //add for ScDeleteContentsDlg
- USHORT nCheckDefaults = 0 ) = 0;
- virtual AbstractScFillSeriesDlg * CreateScFillSeriesDlg( Window* pParent, //add for ScFillSeriesDlg
-diff --git sc/inc/scmod.hxx sc/inc/scmod.hxx
-index 6bbcff0..e0b0aa8 100644
---- sc/inc/scmod.hxx
-+++ sc/inc/scmod.hxx
-@@ -201,12 +201,12 @@ public:
-
- // Options:
- const ScViewOptions& GetViewOptions ();
-- const ScDocOptions& GetDocOptions ();
-+SC_DLLPUBLIC const ScDocOptions& GetDocOptions ();
- SC_DLLPUBLIC const ScAppOptions& GetAppOptions ();
- const ScInputOptions& GetInputOptions ();
- SC_DLLPUBLIC const ScPrintOptions& GetPrintOptions ();
- void SetViewOptions ( const ScViewOptions& rOpt );
-- void SetDocOptions ( const ScDocOptions& rOpt );
-+SC_DLLPUBLIC void SetDocOptions ( const ScDocOptions& rOpt );
- SC_DLLPUBLIC void SetAppOptions ( const ScAppOptions& rOpt );
- void SetInputOptions ( const ScInputOptions& rOpt );
- void SetPrintOptions ( const ScPrintOptions& rOpt );
-diff --git sc/inc/shapeuno.hxx sc/inc/shapeuno.hxx
-index a80ad3c..1f8f1a5 100644
---- sc/inc/shapeuno.hxx
-+++ sc/inc/shapeuno.hxx
-@@ -52,6 +52,7 @@ namespace com { namespace sun { namespace star {
- class SdrObject;
- struct SvEventDescription;
- class ShapeUnoEventAccessImpl;
-+class ScMacroInfo;
-
- //------------------------------------------------------------------------
-
-@@ -70,6 +71,7 @@ class ScShapeObj :public ScShapeObj_Base
- ,public ScShapeObj_TextBase
- {
- private:
-+friend ScMacroInfo* lcl_getShapeHyperMacroInfo( ScShapeObj* pShape, BOOL bCreate );
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > mxShapeAgg;
- // cached pointers to avoid repeated queryAggregation calls:
- ::com::sun::star::beans::XPropertySet* pShapePropertySet;
-diff --git sc/inc/table.hxx sc/inc/table.hxx
-index f7edb92..27bf54b 100644
---- sc/inc/table.hxx
-+++ sc/inc/table.hxx
-@@ -86,6 +86,8 @@ class ScFlatBoolRowSegments;
- class ScFlatBoolColSegments;
- struct ScSetStringParam;
-
-+typedef std::hash_map< ::rtl::OUString, rtl::OUString, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > NameToNameMap;
-+
- class ScTable
- {
- private:
-@@ -177,6 +179,7 @@ private:
- Color aTabBgColor;
- USHORT nScenarioFlags;
- BOOL bActiveScenario;
-+ NameToNameMap localNameToGlobalName;
- bool mbPageBreaksValid;
-
- friend class ScDocument; // fuer FillInfo
-diff --git sc/inc/unonames.hxx sc/inc/unonames.hxx
-index 497fd00..11f741b 100644
---- sc/inc/unonames.hxx
-+++ sc/inc/unonames.hxx
-@@ -184,6 +184,8 @@
- #define SC_UNONAME_ANCHOR "Anchor"
- #define SC_UNONAME_HORIPOS "HoriOrientPosition"
- #define SC_UNONAME_VERTPOS "VertOrientPosition"
-+// #i66550 HLINK_FOR_SHAPES
-+#define SC_UNONAME_HYPERLINK "Hyperlink"
-
- // other cell properties
- #define SC_UNONAME_CHCOLHDR "ChartColumnAsLabel"
-@@ -529,6 +531,7 @@
- #define SC_UNO_ZOOMTYPE "ZoomType"
- #define SC_UNO_ZOOMVALUE "ZoomValue"
- #define SC_UNO_UPDTEMPL "UpdateFromTemplate"
-+#define SC_UNO_FILTERED_RANGE_SELECTION "FilteredRangeSelection"
-
- /*Stampit enable/disable print cancel */
- #define SC_UNO_ALLOWPRINTJOBCANCEL "AllowPrintJobCancel"
-@@ -610,6 +613,7 @@
- #define SC_UNONAME_ADDRESS "Address"
- #define SC_UNONAME_UIREPR "UserInterfaceRepresentation"
- #define SC_UNONAME_PERSREPR "PersistentRepresentation"
-+#define SC_UNONAME_XL_A1_REPR "XL_A1_Representation"
- #define SC_UNONAME_REFSHEET "ReferenceSheet"
-
- // --> PB 2004-08-23 #i33095# Security Options
-diff --git sc/inc/userdat.hxx sc/inc/userdat.hxx
-index 35020f8..a4fc379 100644
---- sc/inc/userdat.hxx
-+++ sc/inc/userdat.hxx
-@@ -99,16 +99,12 @@ public:
- void SetMacro( const rtl::OUString& rMacro ) { maMacro = rMacro; }
- const rtl::OUString& GetMacro() const { return maMacro; }
-
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
- void SetHlink( const rtl::OUString& rHlink ) { maHlink = rHlink; }
- const rtl::OUString& GetHlink() const { return maHlink; }
--#endif
-
- private:
- rtl::OUString maMacro;
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
- rtl::OUString maHlink;
--#endif
- };
-
- //-------------------------------------------------------------------------
-diff --git sc/inc/viewuno.hxx sc/inc/viewuno.hxx
-index fa4f08d..dcfe46c 100644
---- sc/inc/viewuno.hxx
-+++ sc/inc/viewuno.hxx
-@@ -196,6 +196,7 @@ private:
- XMouseClickHandlerArr_Impl aMouseClickHandlers;
- XActivationEventListenerArr_Impl aActivationListeners;
- sal_Bool bDrawSelModeSet;
-+ sal_Bool bFilteredRangeSelection;
-
- ScViewPaneObj* GetObjectByIndex_Impl(USHORT nIndex) const;
- INT16 GetZoom(void) const;
-@@ -310,6 +311,13 @@ public:
- ::com::sun::star::sheet::XSpreadsheet >& xActiveSheet )
- throw(::com::sun::star::uno::RuntimeException);
-
-+ //liuchen 2009-9-2 support expand (but not replace) the active sheet
-+ virtual void SAL_CALL selectSheet( const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::sheet::XSpreadsheet >& xActiveSheet,
-+ sal_Bool bExpand)
-+ throw(::com::sun::star::uno::RuntimeException);
-+ //liuchen 2009-9-2
-+
- //XEnhancedMouseClickBroadcaster
-
- virtual void SAL_CALL addEnhancedMouseClickHandler( const ::com::sun::star::uno::Reference<
-diff --git sc/sdi/cellsh.sdi sc/sdi/cellsh.sdi
-index 957c3d1..84b23d5 100644
---- sc/sdi/cellsh.sdi
-+++ sc/sdi/cellsh.sdi
-@@ -60,6 +60,7 @@ interface CellSelection
- SID_SBA_BRW_INSERT [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ]
- SID_SELECT_DB [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ]
- SID_SORT [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ]
-+ SID_DATA_FORM [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ]
- FID_FILTER_OK [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ]
- SID_AUTO_FILTER [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ]
- SID_AUTOFILTER_HIDE [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ]
-diff --git sc/sdi/drawsh.sdi sc/sdi/drawsh.sdi
-index e73f447..f330474 100644
---- sc/sdi/drawsh.sdi
-+++ sc/sdi/drawsh.sdi
-@@ -226,9 +226,9 @@ interface TableDraw
- SID_FONTWORK_CHARACTER_SPACING_DIALOG [ ExecMethod = ExecDrawFunc ; StateMethod = GetDrawFuncState ; ]
-
- // ISSUE66550_HLINK_FOR_SHAPES
--// SID_DRAW_HLINK_EDIT [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawFuncState; Export = FALSE; ]
--// SID_DRAW_HLINK_DELETE [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawFuncState; Export = FALSE; ]
--// SID_OPEN_HYPERLINK [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawFuncState; Export = FALSE; ]
-+ SID_DRAW_HLINK_EDIT [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawFuncState; Export = FALSE; ]
-+ SID_DRAW_HLINK_DELETE [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawFuncState; Export = FALSE; ]
-+ SID_OPEN_HYPERLINK [ ExecMethod = ExecDrawAttr; StateMethod = GetDrawFuncState; Export = FALSE; ]
- }
-
-
-diff --git sc/sdi/scalc.sdi sc/sdi/scalc.sdi
-index dade68a..0537507 100644
---- sc/sdi/scalc.sdi
-+++ sc/sdi/scalc.sdi
-@@ -1598,6 +1598,31 @@ SfxVoidItem DataSort SID_SORT
- ]
-
- //--------------------------------------------------------------------------
-+SfxVoidItem DataForm SID_DATA_FORM
-+()
-+[
-+ /* flags: */
-+ AutoUpdate = FALSE,
-+ Cachable = Cachable,
-+ FastCall = FALSE,
-+ HasCoreId = FALSE,
-+ HasDialog = TRUE,
-+ ReadOnlyDoc = TRUE,
-+ Toggle = FALSE,
-+ Container = FALSE,
-+ RecordAbsolute = FALSE,
-+ RecordPerSet;
-+ Synchron;
-+
-+ /* config: */
-+ AccelConfig = TRUE,
-+ MenuConfig = TRUE,
-+ StatusBarConfig = FALSE,
-+ ToolBoxConfig = FALSE,
-+ GroupId = GID_DATA;
-+]
-+
-+//--------------------------------------------------------------------------
- SfxVoidItem DataSubTotals SID_SUBTOTALS
- ()
- [
-@@ -6295,55 +6320,55 @@ SfxVoidItem StandardFonts SID_STANDARD_FONTS
-
- //--------------------------------------------------------------------------
- // ISSUE66550_HLINK_FOR_SHAPES
--//SfxVoidItem EditShapeHyperlink SID_DRAW_HLINK_EDIT
--//()
--//[
--// /* flags: */
--// AutoUpdate = FALSE,
--// Cachable = Cachable,
--// FastCall = TRUE,
--// HasCoreId = FALSE,
--// HasDialog = TRUE,
--// ReadOnlyDoc = TRUE,
--// Toggle = FALSE,
--// Container = FALSE,
--// RecordAbsolute = FALSE,
--// RecordPerSet;
--// Synchron;
--//
-+SfxVoidItem EditShapeHyperlink SID_DRAW_HLINK_EDIT
-+()
-+[
-+ /* flags: */
-+ AutoUpdate = FALSE,
-+ Cachable = Cachable,
-+ FastCall = TRUE,
-+ HasCoreId = FALSE,
-+ HasDialog = TRUE,
-+ ReadOnlyDoc = TRUE,
-+ Toggle = FALSE,
-+ Container = FALSE,
-+ RecordAbsolute = FALSE,
-+ RecordPerSet;
-+ Synchron;
-+
- // /* config: */
--// AccelConfig = TRUE,
--// MenuConfig = FALSE,
--// StatusBarConfig = FALSE,
--// ToolBoxConfig = FALSE,
--// GroupId = GID_DRAWING;
--//]
-+ AccelConfig = TRUE,
-+ MenuConfig = FALSE,
-+ StatusBarConfig = FALSE,
-+ ToolBoxConfig = FALSE,
-+ GroupId = GID_DRAWING;
-+]
-
- //--------------------------------------------------------------------------
- // ISSUE66550_HLINK_FOR_SHAPES
--//SfxVoidItem DeleteShapeHyperlink SID_DRAW_HLINK_DELETE
--//()
--//[
--// /* flags: */
--// AutoUpdate = TRUE,
--// Cachable = Cachable,
--// FastCall = TRUE,
--// HasCoreId = FALSE,
--// HasDialog = FALSE,
--// ReadOnlyDoc = TRUE,
--// Toggle = FALSE,
--// Container = FALSE,
--// RecordAbsolute = FALSE,
--// RecordPerSet;
--// Synchron;
--//
--// /* config: */
--// AccelConfig = TRUE,
--// MenuConfig = FALSE,
--// StatusBarConfig = FALSE,
--// ToolBoxConfig = FALSE,
--// GroupId = GID_DRAWING;
--//]
-+SfxVoidItem DeleteShapeHyperlink SID_DRAW_HLINK_DELETE
-+()
-+[
-+ /* flags: */
-+ AutoUpdate = TRUE,
-+ Cachable = Cachable,
-+ FastCall = TRUE,
-+ HasCoreId = FALSE,
-+ HasDialog = FALSE,
-+ ReadOnlyDoc = TRUE,
-+ Toggle = FALSE,
-+ Container = FALSE,
-+ RecordAbsolute = FALSE,
-+ RecordPerSet;
-+ Synchron;
-+
-+ /* config: */
-+ AccelConfig = TRUE,
-+ MenuConfig = FALSE,
-+ StatusBarConfig = FALSE,
-+ ToolBoxConfig = FALSE,
-+ GroupId = GID_DRAWING;
-+]
-
- //--------------------------------------------------------------------------
- SfxVoidItem StandardTextAttributes SID_TEXT_STANDARD
-diff --git sc/source/core/data/cell.cxx sc/source/core/data/cell.cxx
-index d73bc1f..cb6c36e 100644
---- sc/source/core/data/cell.cxx
-+++ sc/source/core/data/cell.cxx
-@@ -51,6 +51,7 @@
- #include "recursionhelper.hxx"
- #include "postit.hxx"
- #include "externalrefmgr.hxx"
-+#include "macromgr.hxx"
- #include <editeng/editobj.hxx>
- #include <svl/intitem.hxx>
- #include <editeng/flditem.hxx>
-@@ -819,6 +820,8 @@ ScFormulaCell::ScFormulaCell( const ScFormulaCell& rCell, ScDocument& rDoc, cons
- ScFormulaCell::~ScFormulaCell()
- {
- pDocument->RemoveFromFormulaTree( this );
-+ if (pCode->HasOpCode(ocMacro))
-+ pDocument->GetMacroManager()->RemoveDependentCell(this);
-
- if (pDocument->HasExternalRefManager())
- pDocument->GetExternalRefManager()->removeRefCell(this);
-@@ -1470,6 +1473,9 @@ void ScFormulaCell::Interpret()
- }
- } while (bIterationFromRecursion || bResumeIteration);
- }
-+
-+ // Fire worksheet calculate event
-+ pDocument->FireCalculateEvent( aPos.Tab() );
- }
-
- void ScFormulaCell::InterpretTail( ScInterpretTailParameter eTailParam )
-@@ -1742,6 +1748,36 @@ void ScFormulaCell::InterpretTail( ScInterpretTailParameter eTailParam )
- // Reschedule verlangsamt das ganze erheblich, nur bei Prozentaenderung ausfuehren
- ScProgress::GetInterpretProgress()->SetStateCountDownOnPercent(
- pDocument->GetFormulaCodeInTree()/MIN_NO_CODES_PER_PROGRESS_UPDATE );
-+
-+ switch (p->GetVolatileType())
-+ {
-+ case ScInterpreter::VOLATILE:
-+ // Volatile via built-in volatile functions. No actions needed.
-+ break;
-+ case ScInterpreter::VOLATILE_MACRO:
-+ // The formula contains a volatile macro.
-+ pCode->SetRecalcModeAlways();
-+ pDocument->PutInFormulaTree(this);
-+ StartListeningTo(pDocument);
-+ break;
-+ case ScInterpreter::NOT_VOLATILE:
-+ if (pCode->IsRecalcModeAlways())
-+ {
-+ // The formula was previously volatile, but no more.
-+ EndListeningTo(pDocument);
-+ pCode->SetRecalcModeNormal();
-+ }
-+ else
-+ {
-+ // non-volatile formula. End listening to the area in case
-+ // it's listening due to macro module change.
-+ pDocument->EndListeningArea(BCA_LISTEN_ALWAYS, this);
-+ }
-+ pDocument->RemoveFromFormulaTree(this);
-+ break;
-+ default:
-+ ;
-+ }
- }
- else
- {
-@@ -1809,7 +1845,7 @@ void __EXPORT ScFormulaCell::Notify( SvtBroadcaster&, const SfxHint& rHint)
- else
- {
- bForceTrack = !bDirty;
-- bDirty = TRUE;
-+ SetDirtyVar();
- }
- // #35962# Don't remove from FormulaTree to put in FormulaTrack to
- // put in FormulaTree again and again, only if necessary.
-@@ -1832,7 +1868,7 @@ void ScFormulaCell::SetDirty()
- if ( !IsInChangeTrack() )
- {
- if ( pDocument->GetHardRecalcState() )
-- bDirty = TRUE;
-+ SetDirtyVar();
- else
- {
- // Mehrfach-FormulaTracking in Load und in CompileAll
-@@ -1841,7 +1877,7 @@ void ScFormulaCell::SetDirty()
- // setzen, z.B. in CompileTokenArray
- if ( !bDirty || !pDocument->IsInFormulaTree( this ) )
- {
-- bDirty = TRUE;
-+ SetDirtyVar();
- pDocument->AppendToFormulaTrack( this );
- pDocument->TrackFormulas();
- }
-@@ -1852,6 +1888,13 @@ void ScFormulaCell::SetDirty()
- }
- }
-
-+void ScFormulaCell::SetDirtyVar()
-+{
-+ bDirty = TRUE;
-+ // mark the sheet of this cell to be calculated
-+ pDocument->AddCalculateTable( aPos.Tab() );
-+}
-+
- void ScFormulaCell::SetDirtyAfterLoad()
- {
- bDirty = TRUE;
-diff --git sc/source/core/data/column3.cxx sc/source/core/data/column3.cxx
-index 3b2965b..e691b1f 100644
---- sc/source/core/data/column3.cxx
-+++ sc/source/core/data/column3.cxx
-@@ -829,8 +829,10 @@ ScBaseCell* ScColumn::CloneCell(SCSIZE nIndex, USHORT nFlags, ScDocument& rDestD
- bool bCloneValue = (nFlags & IDF_VALUE) != 0;
- bool bCloneDateTime = (nFlags & IDF_DATETIME) != 0;
- bool bCloneString = (nFlags & IDF_STRING) != 0;
-+ bool bCloneSpecialBoolean = (nFlags & IDF_SPECIAL_BOOLEAN) != 0;
- bool bCloneFormula = (nFlags & IDF_FORMULA) != 0;
- bool bCloneNote = (nFlags & IDF_NOTE) != 0;
-+ bool bForceFormula = false;
-
- ScBaseCell* pNew = 0;
- ScBaseCell& rSource = *pItems[nIndex].pCell;
-@@ -854,7 +856,18 @@ ScBaseCell* ScColumn::CloneCell(SCSIZE nIndex, USHORT nFlags, ScDocument& rDestD
- break;
-
- case CELLTYPE_FORMULA:
-- if (bCloneFormula)
-+ if ( bCloneSpecialBoolean )
-+ {
-+ ScFormulaCell& rForm = (ScFormulaCell&)rSource;
-+ rtl::OUStringBuffer aBuf;
-+ // #TODO #FIXME do we have a localisation issue here?
-+ rForm.GetFormula( aBuf );
-+ rtl::OUString aVal( aBuf.makeStringAndClear() );
-+ if ( aVal.equalsAscii( "=TRUE()" )
-+ || aVal.equalsAscii( "=FALSE()" ) )
-+ bForceFormula = true;
-+ }
-+ if (bForceFormula || bCloneFormula)
- {
- // note will be cloned below
- pNew = rSource.CloneWithoutNote( rDestDoc, rDestPos );
-diff --git sc/source/core/data/documen2.cxx sc/source/core/data/documen2.cxx
-index 1ea0691..991f238 100755
---- sc/source/core/data/documen2.cxx
-+++ sc/source/core/data/documen2.cxx
-@@ -50,6 +50,7 @@
- #include <tools/tenccvt.hxx>
- #include <tools/list.hxx>
- #include <rtl/crc.h>
-+#include <basic/basmgr.hxx>
-
- #include "document.hxx"
- #include "table.hxx"
-@@ -93,6 +94,9 @@
- #include "tabprotection.hxx"
- #include "formulaparserpool.hxx"
- #include "clipparam.hxx"
-+#include "macromgr.hxx"
-+#include <com/sun/star/document/XVbaEventsHelper.hpp>
-+#include <vbahelper/vbaaccesshelper.hxx>
- #include <basic/basmgr.hxx>
-
- // pImpl because including lookupcache.hxx in document.hxx isn't wanted, and
-@@ -154,6 +158,7 @@ ScDocument::ScDocument( ScDocumentMode eMode,
- pCacheFieldEditEngine( NULL ),
- pDocProtection( NULL ),
- mpClipParam( NULL),
-+ mpMacroMgr( NULL ),
- pExternalRefMgr( NULL ),
- pViewOptions( NULL ),
- pDocOptions( NULL ),
-@@ -1289,6 +1294,29 @@ void ScDocument::RemoveLookupCache( ScLookupCache & rCache )
- }
- }
-
-+using namespace com::sun::star;
-+uno::Reference< document::XVbaEventsHelper >
-+ScDocument::GetVbaEventsHelper()
-+{
-+ if( !mxVbaEventsHelper.is() && pShell && ooo::vba::isAlienExcelDoc( *pShell ) )
-+ {
-+ try
-+ {
-+ uno::Reference< lang::XMultiServiceFactory > xSF( comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
-+ uno::Reference< frame::XModel > xModel( pShell ? pShell->GetModel() : NULL, uno::UNO_QUERY );
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] = uno::Any( xModel );
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper( xSF->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.SpreadsheetDocumentVbaEventsHelper" ) ), aArgs ), uno::UNO_QUERY );
-+ // helper will always be created successfully.
-+ mxVbaEventsHelper.set( xVbaEventsHelper, uno::UNO_QUERY );
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ }
-+ }
-+ return mxVbaEventsHelper;
-+}
-+
- void ScDocument::ClearLookupCaches()
- {
- if( pLookupCacheMapImpl )
-diff --git sc/source/core/data/documen7.cxx sc/source/core/data/documen7.cxx
-index b00414f..e9eaf73 100644
---- sc/source/core/data/documen7.cxx
-+++ sc/source/core/data/documen7.cxx
-@@ -56,7 +56,15 @@
-
-
- #include "globstr.hrc"
-+#include <algorithm>
-+#include <vector>
-
-+
-+#include <com/sun/star/document/XVbaEventsHelper.hpp>
-+#include <com/sun/star/document/VbaEventId.hpp>
-+
-+using namespace com::sun::star;
-+using namespace com::sun::star::document::VbaEventId;
- extern const ScFormulaCell* pLastFormulaTreeTop; // cellform.cxx Err527 WorkAround
-
- // STATIC DATA -----------------------------------------------------------
-@@ -524,5 +532,35 @@ void ScDocument::SetAutoCalc( BOOL bNewAutoCalc )
- }
- }
-
-+BOOL ScDocument::FireCalculateEvent( SCTAB nTab )
-+{
-+ BOOL bSuccess = FALSE;
-+ ::std::vector<SCTAB>::iterator iter;
-+ iter = ::std::find( maTabs.begin(), maTabs.end(), nTab );
-+ if( iter != maTabs.end() )
-+ {
-+ // make sure fire worksheet calculate event only once for each sheet
-+ // regardless of how many formula cells are calculated.
-+ maTabs.erase(iter);
-+
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper ( GetVbaEventsHelper(), uno::UNO_QUERY );
-+ if( xVbaEventsHelper.is() )
-+ {
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] <<= nTab;
-+ bSuccess = xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKSHEET_CALCULATE, aArgs );
-+ }
-+ }
-+ return bSuccess;
-+}
-
-+void ScDocument::AddCalculateTable( SCTAB nTab )
-+{
-+ ::std::vector<SCTAB>::iterator iter;
-+ iter = ::std::find( maTabs.begin(), maTabs.end(), nTab );
-+ if( iter == maTabs.end() )
-+ {
-+ maTabs.push_back( nTab );
-+ }
-+}
-
-diff --git sc/source/core/data/documen8.cxx sc/source/core/data/documen8.cxx
-index bc2bf8c..1daa520 100644
---- sc/source/core/data/documen8.cxx
-+++ sc/source/core/data/documen8.cxx
-@@ -93,6 +93,7 @@
- #include "globstr.hrc"
- #include "sc.hrc"
- #include "charthelper.hxx"
-+#include "macromgr.hxx"
- #include "dpobject.hxx"
-
- #define GET_SCALEVALUE(set,id) ((const SfxUInt16Item&)(set.Get( id ))).GetValue()
-@@ -412,6 +413,13 @@ BYTE ScDocument::GetEditTextDirection(SCTAB nTab) const
- return sal::static_int_cast<BYTE>(eRet);
- }
-
-+ScMacroManager* ScDocument::GetMacroManager()
-+{
-+ if (!mpMacroMgr.get())
-+ mpMacroMgr.reset(new ScMacroManager(this));
-+ return mpMacroMgr.get();
-+}
-+
- //------------------------------------------------------------------------
-
- void ScDocument::InvalidateTextWidth( const ScAddress* pAdrFrom, const ScAddress* pAdrTo,
-diff --git sc/source/core/data/document.cxx sc/source/core/data/document.cxx
-index 40acf12..cc14a95 100644
---- sc/source/core/data/document.cxx
-+++ sc/source/core/data/document.cxx
-@@ -97,6 +97,8 @@
- #include <map>
- #include <limits>
-
-+using namespace ::com::sun::star;
-+
- namespace WritingMode2 = ::com::sun::star::text::WritingMode2;
- using ::com::sun::star::uno::Sequence;
- using ::com::sun::star::sheet::TablePageBreakData;
-@@ -184,6 +186,13 @@ BOOL ScDocument::GetCodeName( SCTAB nTab, String& rName ) const
- return FALSE;
- }
-
-+NameToNameMap*
-+ScDocument::GetLocalNameMap( SCTAB& rTab )
-+{
-+ if ( !HasTable( rTab ) )
-+ return NULL;
-+ return &pTab[rTab]->localNameToGlobalName;
-+}
-
- BOOL ScDocument::GetTable( const String& rName, SCTAB& rTab ) const
- {
-@@ -448,6 +457,7 @@ BOOL ScDocument::DeleteTab( SCTAB nTab, ScDocument* pRefUndoDoc )
- delete pTab[nTab];
- for (i=nTab + 1; i < nTabCount; i++)
- pTab[i - 1] = pTab[i];
-+
- pTab[nTabCount - 1] = NULL;
- --nMaxTableNumber;
- // UpdateBroadcastAreas must be called between UpdateDeleteTab,
-diff --git sc/source/core/inc/interpre.hxx sc/source/core/inc/interpre.hxx
-index d80573a..b28bfc1 100644
---- sc/source/core/inc/interpre.hxx
-+++ sc/source/core/inc/interpre.hxx
-@@ -134,6 +134,15 @@ public:
- static inline double div( const double& fNumerator, const double& fDenominator );
-
- ScMatrixRef GetNewMat(SCSIZE nC, SCSIZE nR);
-+
-+ enum VolatileType {
-+ VOLATILE,
-+ VOLATILE_MACRO,
-+ NOT_VOLATILE
-+ };
-+
-+ VolatileType GetVolatileType() const;
-+
- private:
- static ScTokenStack* pGlobalStack;
- static BOOL bGlobalStackInUse;
-@@ -168,6 +177,8 @@ private:
- BOOL bCalcAsShown; // precision as shown
- BOOL bMatrixFormula; // formula cell is a matrix formula
-
-+ VolatileType meVolaileType;
-+
- //---------------------------------Funktionen in interpre.cxx---------
- // nMust <= nAct <= nMax ? ok : PushError
- inline BOOL MustHaveParamCount( short nAct, short nMust );
-diff --git sc/source/core/tool/address.cxx sc/source/core/tool/address.cxx
-index a4a77c9..78d2c31 100644
---- sc/source/core/tool/address.cxx
-+++ sc/source/core/tool/address.cxx
-@@ -1374,7 +1374,7 @@ lcl_ScRange_Parse_OOo( ScRange &aRange, const String& r, ScDocument* pDoc, ScAdd
- }
- nRes1 = ( ( nRes1 | nRes2 ) & SCA_VALID )
- | nRes1
-- | ( ( nRes2 & 0x070F ) << 4 );
-+ | ( ( nRes2 & SCA_BITS ) << 4 );
- return nRes1;
- }
-
-diff --git sc/source/core/tool/appoptio.cxx sc/source/core/tool/appoptio.cxx
-index e14b16c..8f27807 100644
---- sc/source/core/tool/appoptio.cxx
-+++ sc/source/core/tool/appoptio.cxx
-@@ -82,6 +82,9 @@ ScAppOptions::~ScAppOptions()
-
- void ScAppOptions::SetDefaults()
- {
-+ // Set default tab count for new spreadsheet.
-+ nTabCountInNewSpreadsheet = 3;
-+
- if ( ScOptionsUtil::IsMetricSystem() )
- eMetric = FUNIT_CM; // default for countries with metric system
- else
-@@ -119,6 +122,7 @@ void ScAppOptions::SetDefaults()
-
- const ScAppOptions& ScAppOptions::operator=( const ScAppOptions& rCpy )
- {
-+ nTabCountInNewSpreadsheet = rCpy.nTabCountInNewSpreadsheet;
- eMetric = rCpy.eMetric;
- eZoomType = rCpy.eZoomType;
- bSynchronizeZoom = rCpy.bSynchronizeZoom;
-diff --git sc/source/core/tool/interpr1.cxx sc/source/core/tool/interpr1.cxx
-index d53d565..5a53df9 100644
---- sc/source/core/tool/interpr1.cxx
-+++ sc/source/core/tool/interpr1.cxx
-@@ -71,6 +71,7 @@
- #include "rangenam.hxx"
- #include "compiler.hxx"
- #include "externalrefmgr.hxx"
-+#include <basic/sbstar.hxx>
- #include "doubleref.hxx"
- #include "queryparam.hxx"
-
-@@ -4186,7 +4187,17 @@ void ScInterpreter::ScMatch()
- }
- }
- if ( rEntry.bQueryByString )
-- rParam.bRegExp = MayBeRegExp( *rEntry.pStr, pDok );
-+ {
-+ BOOL bIsVBAMode = FALSE;
-+ if ( pDok )
-+ bIsVBAMode = pDok->IsInVBAMode();
-+
-+ // #TODO handle MSO wildcards
-+ if ( bIsVBAMode )
-+ rParam.bRegExp = FALSE;
-+ else
-+ rParam.bRegExp = MayBeRegExp( *rEntry.pStr, pDok );
-+ }
-
- if (pMatSrc) // The source data is matrix array.
- {
-diff --git sc/source/core/tool/interpr4.cxx sc/source/core/tool/interpr4.cxx
-index 9fe8b53..35177aa 100644
---- sc/source/core/tool/interpr4.cxx
-+++ sc/source/core/tool/interpr4.cxx
-@@ -33,10 +33,14 @@
- #include <sfx2/app.hxx>
- #include <sfx2/docfile.hxx>
- #include <sfx2/objsh.hxx>
-+#include <sfx2/docfilt.hxx>
- #include <basic/sbmeth.hxx>
- #include <basic/sbmod.hxx>
- #include <basic/sbstar.hxx>
- #include <basic/sbx.hxx>
-+#include <basic/sbxobj.hxx>
-+#include <basic/sbuno.hxx>
-+#include <svl/zforlist.hxx>
- #include <svl/zforlist.hxx>
- #include <tools/urlobj.hxx>
- #include <rtl/logfile.hxx>
-@@ -45,6 +49,8 @@
- #include <signal.h>
-
- #include <com/sun/star/table/XCellRange.hpp>
-+#include <com/sun/star/sheet/XSheetCellRange.hpp>
-+#include <comphelper/processfactory.hxx>
-
- #include "interpre.hxx"
- #include "global.hxx"
-@@ -65,6 +71,8 @@
- #include "jumpmatrix.hxx"
- #include "parclass.hxx"
- #include "externalrefmgr.hxx"
-+#include "formula/FormulaCompiler.hxx"
-+#include "macromgr.hxx"
- #include "doubleref.hxx"
-
- #include <math.h>
-@@ -72,6 +80,8 @@
- #include <map>
- #include <algorithm>
- #include <functional>
-+#include <basic/basmgr.hxx>
-+#include <vbahelper/vbaaccesshelper.hxx>
- #include <memory>
-
- using namespace com::sun::star;
-@@ -2679,6 +2689,61 @@ void ScInterpreter::ScMissing()
- PushTempToken( new FormulaMissingToken );
- }
-
-+uno::Any lcl_getSheetModule( const uno::Reference<table::XCellRange>& xCellRange, ScDocument* pDok )
-+{
-+ uno::Reference< sheet::XSheetCellRange > xSheetRange( xCellRange, uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xProps( xSheetRange->getSpreadsheet(), uno::UNO_QUERY_THROW );
-+ rtl::OUString sCodeName;
-+ xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CodeName") ) ) >>= sCodeName;
-+ // #TODO #FIXME ideally we should 'throw' here if we don't get a valid parent, but... it is possible
-+ // to create a module ( and use 'Option VBASupport 1' ) for a calc document, in this scenario there
-+ // are *NO* special document module objects ( of course being able to switch between vba/non vba mode at
-+ // the document in the future could fix this, especially IF the switching of the vba mode takes care to
-+ // create the special document module objects if they don't exist.
-+ BasicManager* pBasMgr = pDok->GetDocumentShell()->GetBasicManager();
-+
-+ uno::Reference< uno::XInterface > xIf;
-+ if ( pBasMgr && pBasMgr->GetName().Len() )
-+ {
-+ String sProj = String( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
-+ if ( pDok->GetDocumentShell()->GetBasicManager()->GetName().Len() )
-+ sProj = pDok->GetDocumentShell()->GetBasicManager()->GetName();
-+ StarBASIC* pBasic = pDok->GetDocumentShell()->GetBasicManager()->GetLib( sProj );
-+ if ( pBasic )
-+ {
-+ SbModule* pMod = pBasic->FindModule( sCodeName );
-+ if ( pMod )
-+ xIf = pMod->GetUnoModule();
-+ }
-+ }
-+ return uno::makeAny( xIf );
-+}
-+
-+bool
-+lcl_setVBARange( ScRange& aRange, ScDocument* pDok, SbxVariable* pPar )
-+{
-+ bool bOk = false;
-+ try
-+ {
-+ uno::Reference< uno::XInterface > xVBARange;
-+ uno::Reference<table::XCellRange> xCellRange = ScCellRangeObj::CreateRangeFromDoc( pDok, aRange );
-+ uno::Sequence< uno::Any > aArgs(2);
-+ aArgs[0] = lcl_getSheetModule( xCellRange, pDok );
-+ aArgs[1] = uno::Any( xCellRange );
-+ xVBARange = ooo::vba::createVBAUnoAPIServiceWithArgs( pDok->GetDocumentShell(), "ooo.vba.excel.Range", aArgs );
-+ if ( xVBARange.is() )
-+ {
-+ String sDummy(RTL_CONSTASCII_USTRINGPARAM("A-Range") );
-+ SbxObjectRef aObj = GetSbUnoObject( sDummy, uno::Any( xVBARange ) );
-+ SetSbUnoObjectDfltPropName( aObj );
-+ bOk = pPar->PutObject( aObj );
-+ }
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+ return bOk;
-+}
-
- void ScInterpreter::ScMacro()
- {
-@@ -2716,8 +2781,11 @@ void ScInterpreter::ScMacro()
- return;
- }
-
-+ bool bVolatileMacro = false;
- SbMethod* pMethod = (SbMethod*)pVar;
-+
- SbModule* pModule = pMethod->GetModule();
-+ bool bUseVBAObjects = pModule->IsVBACompat();
- SbxObject* pObject = pModule->GetParent();
- DBG_ASSERT(pObject->IsA(TYPE(StarBASIC)), "Kein Basic gefunden!");
- String aMacroStr = pObject->GetName();
-@@ -2727,7 +2795,13 @@ void ScInterpreter::ScMacro()
- aMacroStr += pMethod->GetName();
- String aBasicStr;
- if (pObject->GetParent())
-+ {
- aBasicStr = pObject->GetParent()->GetName(); // Dokumentenbasic
-+ const SfxFilter* pFilter = NULL;
-+ SfxMedium* pMedium = pDok->GetDocumentShell()->GetMedium();
-+ if ( pMedium )
-+ pFilter = pMedium->GetFilter();
-+ }
- else
- aBasicStr = SFX_APP()->GetName(); // Applikationsbasic
-
-@@ -2751,7 +2825,13 @@ void ScInterpreter::ScMacro()
- {
- ScAddress aAdr;
- PopSingleRef( aAdr );
-- bOk = SetSbxVariable( pPar, aAdr );
-+ if ( bUseVBAObjects )
-+ {
-+ ScRange aRange( aAdr );
-+ bOk = lcl_setVBARange( aRange, pDok, pPar );
-+ }
-+ else
-+ bOk = SetSbxVariable( pPar, aAdr );
- }
- break;
- case svDoubleRef:
-@@ -2770,24 +2850,32 @@ void ScInterpreter::ScMacro()
- }
- else
- {
-- SbxDimArrayRef refArray = new SbxDimArray;
-- refArray->AddDim32( 1, nRow2 - nRow1 + 1 );
-- refArray->AddDim32( 1, nCol2 - nCol1 + 1 );
-- ScAddress aAdr( nCol1, nRow1, nTab1 );
-- for( SCROW nRow = nRow1; bOk && nRow <= nRow2; nRow++ )
-+ if ( bUseVBAObjects )
- {
-- aAdr.SetRow( nRow );
-- INT32 nIdx[ 2 ];
-- nIdx[ 0 ] = nRow-nRow1+1;
-- for( SCCOL nCol = nCol1; bOk && nCol <= nCol2; nCol++ )
-- {
-- aAdr.SetCol( nCol );
-- nIdx[ 1 ] = nCol-nCol1+1;
-- SbxVariable* p = refArray->Get32( nIdx );
-- bOk = SetSbxVariable( p, aAdr );
-+ ScRange aRange( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
-+ bOk = lcl_setVBARange( aRange, pDok, pPar );
-+ }
-+ else
-+ {
-+ SbxDimArrayRef refArray = new SbxDimArray;
-+ refArray->AddDim32( 1, nRow2 - nRow1 + 1 );
-+ refArray->AddDim32( 1, nCol2 - nCol1 + 1 );
-+ ScAddress aAdr( nCol1, nRow1, nTab1 );
-+ for( SCROW nRow = nRow1; bOk && nRow <= nRow2; nRow++ )
-+ {
-+ aAdr.SetRow( nRow );
-+ INT32 nIdx[ 2 ];
-+ nIdx[ 0 ] = nRow-nRow1+1;
-+ for( SCCOL nCol = nCol1; bOk && nCol <= nCol2; nCol++ )
-+ {
-+ aAdr.SetCol( nCol );
-+ nIdx[ 1 ] = nCol-nCol1+1;
-+ SbxVariable* p = refArray->Get32( nIdx );
-+ bOk = SetSbxVariable( p, aAdr );
-+ }
- }
-+ pPar->PutObject( refArray );
- }
-- pPar->PutObject( refArray );
- }
- }
- break;
-@@ -2835,6 +2923,13 @@ void ScInterpreter::ScMacro()
- pDok->DecMacroInterpretLevel();
- pDok->UnlockTable( aPos.Tab() );
-
-+ ScMacroManager* pMacroMgr = pDok->GetMacroManager();
-+ if (pMacroMgr)
-+ {
-+ bVolatileMacro = pMacroMgr->GetUserFuncVolatile( pMethod->GetName() );
-+ pMacroMgr->AddDependentCell(pModule->GetName(), pMyFormulaCell);
-+ }
-+
- SbxDataType eResType = refRes->GetType();
- if( pVar->GetError() )
- SetError( errNoValue);
-@@ -2906,6 +3001,9 @@ void ScInterpreter::ScMacro()
- }
-
- pSfxApp->LeaveBasicCall();
-+
-+ if (bVolatileMacro && meVolaileType == NOT_VOLATILE)
-+ meVolaileType = VOLATILE_MACRO;
- }
-
-
-@@ -3278,7 +3376,8 @@ ScInterpreter::ScInterpreter( ScFormulaCell* pCell, ScDocument* pDoc,
- pMyFormulaCell( pCell ),
- pFormatter( pDoc->GetFormatTable() ),
- mnStringNoValueError( errNoValue),
-- bCalcAsShown( pDoc->GetDocOptions().IsCalcAsShown() )
-+ bCalcAsShown( pDoc->GetDocOptions().IsCalcAsShown() ),
-+ meVolaileType(NOT_VOLATILE)
- {
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScTTT" );
- // pStack = new ScToken*[ MAXSTACK ];
-@@ -3725,6 +3824,9 @@ StackVar ScInterpreter::Interpret()
- continue; // while( ( pCur = aCode.Next() ) != NULL ...
- }
-
-+ if (FormulaCompiler::IsOpCodeVolatile(eOp))
-+ meVolaileType = VOLATILE;
-+
- // Remember result matrix in case it could be reused.
- if (pTokenMatrixMap && sp && GetStackType() == svMatrix)
- pTokenMatrixMap->insert( ScTokenMatrixMap::value_type( pCur,
-diff --git sc/source/core/tool/interpr5.cxx sc/source/core/tool/interpr5.cxx
-index 3bf95dc..af98bd1 100644
---- sc/source/core/tool/interpr5.cxx
-+++ sc/source/core/tool/interpr5.cxx
-@@ -321,6 +321,11 @@ ScMatrixRef ScInterpreter::GetNewMat(SCSIZE nC, SCSIZE nR)
- return pMat;
- }
-
-+ScInterpreter::VolatileType ScInterpreter::GetVolatileType() const
-+{
-+ return meVolaileType;
-+}
-+
- ScMatrixRef ScInterpreter::CreateMatrixFromDoubleRef( const FormulaToken* pToken,
- SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
- SCCOL nCol2, SCROW nRow2, SCTAB nTab2 )
-diff --git sc/source/core/tool/rangelst.cxx sc/source/core/tool/rangelst.cxx
-index 6bd25c5..b4d5866 100644
---- sc/source/core/tool/rangelst.cxx
-+++ sc/source/core/tool/rangelst.cxx
-@@ -83,15 +83,18 @@ USHORT ScRangeList::Parse( const String& rStr, ScDocument* pDoc, USHORT nMask,
- for ( USHORT i=0; i<nTCount; i++ )
- {
- aOne = rStr.GetToken( i, cDelimiter );
-- // FIXME : broken for Lotus
-- if ( aOne.Search( ':' ) == STRING_NOTFOUND )
-- { // Range muss es sein
-- String aStrTmp( aOne );
-- aOne += ':';
-- aOne += aStrTmp;
-- }
- aRange.aStart.SetTab( nTab ); // Default Tab wenn nicht angegeben
-- USHORT nRes = aRange.Parse( aOne, pDoc, eConv );
-+ USHORT nRes = aRange.ParseAny( aOne, pDoc, eConv );
-+ USHORT nEndRangeBits = SCA_VALID_COL2 | SCA_VALID_ROW2 |
-+SCA_VALID_TAB2;
-+ USHORT nTmp1 = ( nRes & SCA_BITS );
-+ USHORT nTmp2 = ( nRes & nEndRangeBits );
-+ // If we have a valid single range with
-+ // any of the address bits we are interested in
-+ // set - set the equiv end range bits
-+ if ( (nRes & SCA_VALID ) && nTmp1 && ( nTmp2 != nEndRangeBits ) )
-+ nRes |= ( nTmp1 << 4 );
-+
- if ( (nRes & nMask) == nMask )
- Append( aRange );
- nResult &= nRes; // alle gemeinsamen Bits bleiben erhalten
-diff --git sc/source/filter/excel/excimp8.cxx sc/source/filter/excel/excimp8.cxx
-index d4facf9..a0e75b1 100644
---- sc/source/filter/excel/excimp8.cxx
-+++ sc/source/filter/excel/excimp8.cxx
-@@ -96,13 +96,16 @@
- #include "stlpool.hxx"
- #include "stlsheet.hxx"
- #include "detfunc.hxx"
-+#include "macromgr.hxx"
-
- #include <com/sun/star/document/XDocumentProperties.hpp>
- #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
-+#include <com/sun/star/script/ModuleInfo.hpp>
- #include <basic/basmgr.hxx>
- #include <cppuhelper/component_context.hxx>
- #include <com/sun/star/container/XNameContainer.hpp>
- #include <sfx2/app.hxx>
-+#include "xltoolbar.hxx"
-
- using namespace com::sun::star;
-
-@@ -110,7 +113,8 @@ using namespace com::sun::star;
- #define INVALID_POS 0xFFFFFFFF
-
-
--
-+// defined in docfunc.cxx ( really this needs a new name )
-+script::ModuleInfo lcl_InitModuleInfo( SfxObjectShell& rDocSh, String& sModule );
-
- ImportExcel8::ImportExcel8( XclImpRootData& rImpData, SvStream& rStrm ) :
- ImportExcel( rImpData, rStrm ), mnTab(0)
-@@ -279,7 +283,30 @@ void ImportExcel8::ReadBasic( void )
- if ( pAppMgr )
- pAppMgr->SetGlobalUNOConstant( "ThisExcelDoc", aArgs[ 0 ] );
- }
-+
-+ if ( !bAsComment )
-+ {
-+ ScDocument& rDoc = GetDoc();
-+#if 1
-+ // see if we have the XCB stream
-+ SvStorageStreamRef xXCB = xRootStrg->OpenSotStream( String( RTL_CONSTASCII_USTRINGPARAM( "XCB" ) ), STREAM_STD_READ | STREAM_NOCREATE );
-+ if ( xXCB.Is()|| SVSTREAM_OK == xXCB->GetError() )
-+ {
-+ CTBWrapper wrapper;
-+ if ( wrapper.Read( xXCB ) )
-+ {
-+#if DEBUG
-+ wrapper.Print( stderr );
-+#endif
-+ wrapper.ImportCustomToolBar( *pShell );
-+ }
-+ }
-+#endif
-+
-+ }
- aBasicImport.Import( EXC_STORAGE_VBA_PROJECT, EXC_STORAGE_VBA, bAsComment );
-+ if ( !bAsComment )
-+ GetObjectManager().SetOleNameOverrideInfo( aBasicImport.ControlNameForObjectId() );
- }
- }
- }
-diff --git sc/source/filter/excel/makefile.mk sc/source/filter/excel/makefile.mk
-index 04ba76d..a84f4aa 100644
---- sc/source/filter/excel/makefile.mk
-+++ sc/source/filter/excel/makefile.mk
-@@ -102,7 +102,8 @@ SLOFILES = \
- $(SLO)$/xlstyle.obj \
- $(SLO)$/xltools.obj \
- $(SLO)$/xltracer.obj \
-- $(SLO)$/xlview.obj
-+ $(SLO)$/xlview.obj \
-+ $(SLO)$/xltoolbar.obj \
-
- .IF "$(OS)$(COM)$(CPUNAME)"=="LINUXGCCSPARC"
- NOOPTFILES = \
-@@ -151,6 +152,7 @@ EXCEPTIONSFILES = \
- $(SLO)$/xlpivot.obj \
- $(SLO)$/xlroot.obj \
- $(SLO)$/xlstyle.obj \
-+ $(SLO)$/xltoolbar.obj \
- $(SLO)$/xltools.obj \
- $(SLO)$/xlview.obj
-
-diff --git sc/source/filter/excel/read.cxx sc/source/filter/excel/read.cxx
-index 1c38ead..8139481 100644
---- sc/source/filter/excel/read.cxx
-+++ sc/source/filter/excel/read.cxx
-@@ -831,6 +831,12 @@ FltError ImportExcel8::Read( void )
- sal_Size nProgressBasePos = 0;
- sal_Size nProgressBaseSize = 0;
-
-+ bool bSheetHasCodeName = false;
-+
-+ std::vector< String > CodeNames;
-+
-+ std::vector < SCTAB > nTabsWithNoCodeName;
-+
- while( eAkt != EXC_STATE_END )
- {
- if( eAkt == EXC_STATE_BEFORE_SHEET )
-@@ -912,6 +918,7 @@ FltError ImportExcel8::Read( void )
- // #i62752# possible to have BIFF8 sheet without globals
- NeueTabelle();
- eAkt = EXC_STATE_SHEET_PRE; // Shrfmla Prefetch, Row-Prefetch
-+ bSheetHasCodeName = false; // reset
- aIn.StoreGlobalPosition();
- }
- }
-@@ -1083,9 +1090,30 @@ FltError ImportExcel8::Read( void )
- case EXC_ID3_DIMENSIONS: ReadDimensions(); break;
-
- case 0x0A: // EOF [ 2345 ]
-+ {
- eAkt = EXC_STATE_SHEET;
-+ String sName;
-+ GetDoc().GetName( GetCurrScTab(), sName );
-+ if ( !bSheetHasCodeName )
-+ {
-+ nTabsWithNoCodeName.push_back( GetCurrScTab() );
-+ OSL_TRACE("No Codename for %d", GetCurrScTab() );
-+ }
-+ else
-+ {
-+ String sCodeName;
-+ GetDoc().GetCodeName( GetCurrScTab(), sCodeName );
-+ OSL_TRACE("Have CodeName %s for SheetName %s",
-+ rtl::OUStringToOString( sCodeName, RTL_TEXTENCODING_UTF8 ).getStr(), rtl::OUStringToOString( sName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ CodeNames.push_back( sCodeName );
-+ }
-+
-+ bSheetHasCodeName = false; // reset
-+
-+
- aIn.SeekGlobalPosition(); // und zurueck an alte Position
- break;
-+ }
- case 0x12: SheetProtect(); break;
- case 0x13: SheetPassword(); break;
- case 0x42: Codepage(); break; // CODEPAGE [ 2345 ]
-@@ -1097,7 +1125,7 @@ FltError ImportExcel8::Read( void )
- case 0x9B: FilterMode(); break; // FILTERMODE
- case 0x9D: AutoFilterInfo(); break;// AUTOFILTERINFO
- case 0x9E: AutoFilter(); break; // AUTOFILTER
-- case 0x01BA: Codename( FALSE ); break;
-+ case 0x01BA: Codename( FALSE ); bSheetHasCodeName = true; break;
- case 0x0208: Row34(); break; // ROW [ 34 ]
- case 0x0021:
- case 0x0221: Array34(); break; // ARRAY [ 34 ]
-@@ -1205,6 +1233,42 @@ FltError ImportExcel8::Read( void )
-
- if( eLastErr == eERR_OK )
- {
-+ // In some strange circumstances a the codename might be missing
-+ // # Create any missing Sheet CodeNames
-+ std::vector < SCTAB >::iterator it_end = nTabsWithNoCodeName.end();
-+ for ( std::vector < SCTAB >::iterator it = nTabsWithNoCodeName.begin(); it != it_end; ++it )
-+ {
-+ bool bGotCodeName = false;
-+ SCTAB nTab = 1;
-+ OSL_TRACE("Trying to find suitable codename for %d", *it );
-+ while ( true )
-+ {
-+ String sTmpName( RTL_CONSTASCII_USTRINGPARAM("Sheet" ) );
-+ sTmpName += String::CreateFromInt32( sal_Int32(nTab++) );
-+ std::vector< String >::iterator codeName_It = CodeNames.begin();
-+ std::vector< String >::iterator codeName_It_end = CodeNames.end();
-+ // search for codename
-+ for ( ; codeName_It != codeName_It_end; ++codeName_It )
-+ {
-+ if ( *codeName_It == sTmpName )
-+ break;
-+ }
-+
-+ if ( codeName_It == codeName_It_end ) // generated codename not found
-+ {
-+ OSL_TRACE("Using generated codename %s", rtl::OUStringToOString( sTmpName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ // Set new codename
-+ GetDoc().SetCodeName( *it, sTmpName );
-+ // Record newly used codename
-+ CodeNames.push_back( sTmpName );
-+ // Record those we have created so they can be created in
-+ // basic
-+ AutoGeneratedCodeNames.push_back( sTmpName );
-+ break;
-+ }
-+ }
-+
-+ }
- // #i45843# Convert pivot tables before calculation, so they are available
- // for the GETPIVOTDATA function.
- if( GetBiff() == EXC_BIFF8 )
-diff --git sc/source/filter/excel/xecontent.cxx sc/source/filter/excel/xecontent.cxx
-index c5c2620..f71c8be 100644
---- sc/source/filter/excel/xecontent.cxx
-+++ sc/source/filter/excel/xecontent.cxx
-@@ -524,12 +524,17 @@ void XclExpHyperlink::WriteBody( XclExpStream& rStrm )
- {
- sal_uInt16 nXclCol = static_cast< sal_uInt16 >( maScPos.Col() );
- sal_uInt16 nXclRow = static_cast< sal_uInt16 >( maScPos.Row() );
-- mxVarData->Seek( STREAM_SEEK_TO_BEGIN );
-+ rStrm << nXclRow << nXclRow << nXclCol << nXclCol;
-+ WriteEmbeddedData( rStrm );
-+}
-
-- rStrm << nXclRow << nXclRow << nXclCol << nXclCol
-- << XclTools::maGuidStdLink
-+void XclExpHyperlink::WriteEmbeddedData( XclExpStream& rStrm )
-+{
-+ rStrm << XclTools::maGuidStdLink
- << sal_uInt32( 2 )
- << mnFlags;
-+
-+ mxVarData->Seek( STREAM_SEEK_TO_BEGIN );
- rStrm.CopyFromStream( *mxVarData );
- }
-
-diff --git sc/source/filter/excel/xeescher.cxx sc/source/filter/excel/xeescher.cxx
-index 5055149..f3556a6 100644
---- sc/source/filter/excel/xeescher.cxx
-+++ sc/source/filter/excel/xeescher.cxx
-@@ -63,6 +63,9 @@
- #include "xelink.hxx"
- #include "xename.hxx"
- #include "xestyle.hxx"
-+#include "userdat.hxx"
-+#include "drwlayer.hxx"
-+#include "svx/unoapi.hxx"
-
- #include <oox/core/tokens.hxx>
-
-@@ -484,9 +487,9 @@ void XclExpOcxControlObj::WriteSubRecs( XclExpStream& rStrm )
-
- #else
-
--XclExpTbxControlObj::XclExpTbxControlObj( XclExpObjectManager& rObjMgr, Reference< XShape > xShape, const Rectangle* pChildAnchor ) :
-- XclObj( rObjMgr, EXC_OBJTYPE_UNKNOWN, true ),
-- XclExpControlHelper( rObjMgr.GetRoot() ),
-+XclExpTbxControlObj::XclExpTbxControlObj( XclExpObjectManager& rRoot, Reference< XShape > xShape , const Rectangle* pChildAnchor ) :
-+ XclObj( rRoot, EXC_OBJTYPE_UNKNOWN, true ),
-+ XclMacroHelper( rRoot ),
- mnHeight( 0 ),
- mnState( 0 ),
- mnLineCount( 0 ),
-@@ -735,6 +738,8 @@ XclExpTbxControlObj::XclExpTbxControlObj( XclExpObjectManager& rObjMgr, Referenc
-
- bool XclExpTbxControlObj::SetMacroLink( const ScriptEventDescriptor& rEvent )
- {
-+ return XclMacroHelper::SetMacroLink( rEvent, meEventType );
-+/*
- String aMacroName = XclControlHelper::ExtractFromMacroDescriptor( rEvent, meEventType );
- if( aMacroName.Len() )
- {
-@@ -744,6 +749,7 @@ bool XclExpTbxControlObj::SetMacroLink( const ScriptEventDescriptor& rEvent )
- return true;
- }
- return false;
-+*/
- }
-
- void XclExpTbxControlObj::WriteSubRecs( XclExpStream& rStrm )
-@@ -884,12 +890,6 @@ void XclExpTbxControlObj::WriteSubRecs( XclExpStream& rStrm )
- }
- }
-
--void XclExpTbxControlObj::WriteMacroSubRec( XclExpStream& rStrm )
--{
-- if( mxMacroLink.is() )
-- WriteFormulaSubRec( rStrm, EXC_ID_OBJMACRO, *mxMacroLink );
--}
--
- void XclExpTbxControlObj::WriteCellLinkSubRec( XclExpStream& rStrm, sal_uInt16 nSubRecId )
- {
- if( const XclTokenArray* pCellLink = GetCellLinkTokArr() )
-@@ -918,6 +918,7 @@ void XclExpTbxControlObj::WriteSbs( XclExpStream& rStrm )
-
- #endif
-
-+
- // ----------------------------------------------------------------------------
-
- XclExpChartObj::XclExpChartObj( XclExpObjectManager& rObjMgr, Reference< XShape > xShape, const Rectangle* pChildAnchor ) :
-@@ -1061,6 +1062,7 @@ void XclExpNote::Save( XclExpStream& rStrm )
- }
- }
-
-+
- void XclExpNote::WriteBody( XclExpStream& rStrm )
- {
- // BIFF5/BIFF7 is written separately
-@@ -1097,6 +1099,70 @@ void XclExpNote::WriteXml( sal_Int32 nAuthorId, XclExpXmlStream& rStrm )
-
- // ============================================================================
-
-+XclMacroHelper::XclMacroHelper( const XclExpRoot& rRoot ) :
-+ XclExpControlHelper( rRoot )
-+{
-+}
-+
-+XclMacroHelper::~XclMacroHelper()
-+{
-+}
-+
-+void XclMacroHelper::WriteMacroSubRec( XclExpStream& rStrm )
-+{
-+ if( mxMacroLink.is() )
-+ WriteFormulaSubRec( rStrm, EXC_ID_OBJMACRO, *mxMacroLink );
-+}
-+
-+bool
-+XclMacroHelper::SetMacroLink( const ScriptEventDescriptor& rEvent, const XclTbxEventType& nEventType )
-+{
-+ String aMacroName = XclControlHelper::ExtractFromMacroDescriptor( rEvent, nEventType, GetDocShell() );
-+ if( aMacroName.Len() )
-+ {
-+ return SetMacroLink( aMacroName );
-+ }
-+ return false;
-+}
-+
-+bool
-+XclMacroHelper::SetMacroLink( const String& rMacroName )
-+{
-+ OSL_TRACE("SetMacroLink( macroname:=%s )", rtl::OUStringToOString( rMacroName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ if( rMacroName.Len() )
-+ {
-+ sal_uInt16 nExtSheet = GetLocalLinkManager().FindExtSheet( EXC_EXTSH_OWNDOC );
-+ sal_uInt16 nNameIdx = GetNameManager().InsertMacroCall( rMacroName, true, false );
-+ mxMacroLink = GetFormulaCompiler().CreateNameXFormula( nExtSheet, nNameIdx );
-+ return true;
-+ }
-+ return false;
-+}
-+
-+XclExpShapeObj::XclExpShapeObj( XclExpObjectManager& rRoot, ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape ) :
-+ XclObjAny( rRoot ),
-+ XclMacroHelper( rRoot )
-+{
-+ if( SdrObject* pSdrObj = ::GetSdrObjectFromXShape( xShape ) )
-+ {
-+ ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( pSdrObj );
-+ if ( pInfo && pInfo->GetMacro().getLength() )
-+ SetMacroLink( XclControlHelper::GetXclMacroName( pInfo->GetMacro(), rRoot.GetDocShell() ) );
-+ }
-+}
-+
-+XclExpShapeObj::~XclExpShapeObj()
-+{
-+}
-+
-+void XclExpShapeObj::WriteSubRecs( XclExpStream& rStrm )
-+{
-+ XclObjAny::WriteSubRecs( rStrm );
-+ WriteMacroSubRec( rStrm );
-+}
-+
-+// ============================================================================
-+
- XclExpComments::XclExpComments( SCTAB nTab, XclExpRecordList< XclExpNote >& rNotes )
- : mnTab( nTab ), mrNotes( rNotes )
- {
-diff --git sc/source/filter/excel/xiescher.cxx sc/source/filter/excel/xiescher.cxx
-index e44a1c7..6edcf86 100644
---- sc/source/filter/excel/xiescher.cxx
-+++ sc/source/filter/excel/xiescher.cxx
-@@ -114,6 +114,8 @@
- #include "xipage.hxx"
- #include "xichart.hxx"
- #include "xicontent.hxx"
-+#include "scextopt.hxx"
-+
- #include "namebuff.hxx"
-
- using ::rtl::OUString;
-@@ -241,6 +243,7 @@ XclImpDrawObjBase::~XclImpDrawObjBase()
- }
- }
-
-+ xDrawObj->mnTab = rRoot.GetCurrScTab();
- xDrawObj->ImplReadObj3( rStrm );
- return xDrawObj;
- }
-@@ -273,6 +276,7 @@ XclImpDrawObjBase::~XclImpDrawObjBase()
- }
- }
-
-+ xDrawObj->mnTab = rRoot.GetCurrScTab();
- xDrawObj->ImplReadObj4( rStrm );
- return xDrawObj;
- }
-@@ -315,6 +319,7 @@ XclImpDrawObjBase::~XclImpDrawObjBase()
- }
- }
-
-+ xDrawObj->mnTab = rRoot.GetCurrScTab();
- xDrawObj->ImplReadObj5( rStrm );
- return xDrawObj;
- }
-@@ -373,6 +378,7 @@ XclImpDrawObjBase::~XclImpDrawObjBase()
- }
- }
-
-+ xDrawObj->mnTab = rRoot.GetCurrScTab();
- xDrawObj->ImplReadObj8( rStrm );
- return xDrawObj;
- }
-@@ -473,8 +479,8 @@ void XclImpDrawObjBase::PreProcessSdrObject( XclImpDffConverter& rDffConv, SdrOb
- }
-
- // macro and hyperlink
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
-- if( mbSimpleMacro && ((maMacroName.Len() > 0) || (maHyperlink.getLength() > 0)) )
-+ if( mbSimpleMacro && ((maMacroName.Len() > 0) ||
-+ (maHyperlink.Len() > 0)) )
- {
- if( ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( &rSdrObj, TRUE ) )
- {
-@@ -482,11 +488,6 @@ void XclImpDrawObjBase::PreProcessSdrObject( XclImpDffConverter& rDffConv, SdrOb
- pInfo->SetHlink( maHyperlink );
- }
- }
--#else
-- if( mbSimpleMacro && (maMacroName.Len() > 0) )
-- if( ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( &rSdrObj, TRUE ) )
-- pInfo->SetMacro( XclControlHelper::GetScMacroName( maMacroName, GetDocShell() ) );
--#endif
-
- // call virtual function for object type specific processing
- DoPreProcessSdrObj( rDffConv, rSdrObj );
-@@ -1775,22 +1776,15 @@ SdrObject* XclImpControlHelper::CreateSdrObjectFromShape(
- return xSdrObj.release();
- }
-
--void XclImpControlHelper::ProcessControl( const XclImpDrawObjBase& rDrawObj ) const
-+void XclImpControlHelper::ApplySheetLinkProps() const
- {
-+
- Reference< XControlModel > xCtrlModel = XclControlHelper::GetControlModel( mxShape );
- if( !xCtrlModel.is() )
- return;
--
- ScfPropertySet aPropSet( xCtrlModel );
-
-- // #118053# #i51348# set object name at control model
-- aPropSet.SetStringProperty( CREATE_OUSTRING( "Name" ), rDrawObj.GetObjName() );
--
-- // control visible and printable?
-- aPropSet.SetBoolProperty( CREATE_OUSTRING( "EnableVisible" ), rDrawObj.IsVisible() );
-- aPropSet.SetBoolProperty( CREATE_OUSTRING( "Printable" ), rDrawObj.IsPrintable() );
--
-- // sheet links
-+ // sheet links
- if( SfxObjectShell* pDocShell = mrRoot.GetDocShell() )
- {
- Reference< XMultiServiceFactory > xFactory( pDocShell->GetModel(), UNO_QUERY );
-@@ -1853,7 +1847,26 @@ void XclImpControlHelper::ProcessControl( const XclImpDrawObjBase& rDrawObj ) co
- }
- }
- }
-+}
-+
-+void XclImpControlHelper::ProcessControl( const XclImpDrawObjBase& rDrawObj ) const
-+{
-+ Reference< XControlModel > xCtrlModel = XclControlHelper::GetControlModel( mxShape );
-+ if( !xCtrlModel.is() )
-+ return;
-+
-+ ApplySheetLinkProps();
-+
-+ ScfPropertySet aPropSet( xCtrlModel );
-+
-+ // #118053# #i51348# set object name at control model
-+ aPropSet.SetStringProperty( CREATE_OUSTRING( "Name" ), rDrawObj.GetObjName() );
-+
-+ // control visible and printable?
-+ aPropSet.SetBoolProperty( CREATE_OUSTRING( "EnableVisible" ), rDrawObj.IsVisible() );
-+ aPropSet.SetBoolProperty( CREATE_OUSTRING( "Printable" ), rDrawObj.IsPrintable() );
-
-+
- // virtual call for type specific processing
- DoProcessControl( aPropSet );
- }
-@@ -2184,6 +2197,45 @@ void XclImpOptionButtonObj::DoProcessControl( ScfPropertySet& rPropSet ) const
- {
- XclImpCheckBoxObj::DoProcessControl( rPropSet );
- // TODO: grouping
-+ XclImpOptionButtonObj* pTbxObj = dynamic_cast< XclImpOptionButtonObj* >( GetObjectManager().GetSheetDrawing( GetTab() ).FindDrawObj( mnNextInGroup ).get() );
-+ if ( ( pTbxObj && pTbxObj->mnFirstInGroup ) )
-+ {
-+ // Group has terminated
-+ // traverse each RadioButton in group and
-+ // a) apply the groupname
-+ // b) propagate the linked cell from the lead radiobutton
-+ // c) apply the correct Ref value
-+ XclImpOptionButtonObj* pLeader = pTbxObj;
-+ ;
-+ sal_Int32 nRefVal = 1;
-+ OSL_TRACE( "0x%x start group ", pLeader->GetObjId()/*.mnObjId */);
-+ do
-+ {
-+
-+ Reference< XControlModel > xCtrlModel = XclControlHelper::GetControlModel( pTbxObj->mxShape );
-+ if ( xCtrlModel.is() )
-+ {
-+ ScfPropertySet aProps( xCtrlModel );
-+ rtl::OUString sGroupName = rtl::OUString::valueOf( static_cast< sal_Int32 >( pLeader->GetDffShapeId() ) );
-+
-+ aProps.SetStringProperty( CREATE_OUSTRING( "GroupName" ), sGroupName );
-+ aProps.SetStringProperty( CREATE_OUSTRING( "RefValue" ), rtl::OUString::valueOf( nRefVal++ ) );
-+ if ( pLeader->HasCellLink() && !pTbxObj->HasCellLink() )
-+ {
-+ // propagate cell link info
-+ pTbxObj->mxCellLink.reset( new ScAddress( *pLeader->mxCellLink.get() ) );
-+ pTbxObj->ApplySheetLinkProps();
-+ }
-+ pTbxObj = dynamic_cast< XclImpOptionButtonObj* >( GetObjectManager().GetSheetDrawing( GetTab() ).FindDrawObj( pTbxObj->mnNextInGroup ).get() );
-+ }
-+ else
-+ pTbxObj = NULL;
-+ } while ( pTbxObj && !( pTbxObj->mnFirstInGroup == 1 ) );
-+ }
-+ else
-+ {
-+ // not the leader? try and find it
-+ }
- }
-
- OUString XclImpOptionButtonObj::DoGetServiceName() const
-@@ -2820,6 +2872,17 @@ SdrObject* XclImpPictureObj::DoCreateSdrObj( XclImpDffConverter& rDffConv, const
- return xSdrObj.release();
- }
-
-+String XclImpPictureObj::GetObjName() const
-+{
-+ if( IsOcxControl() )
-+ {
-+ String sName( GetObjectManager().GetOleNameOverride( GetTab(), GetObjId() ) );
-+ if ( sName.Len() > 0 )
-+ return sName;
-+ }
-+ return XclImpDrawObjBase::GetObjName();
-+}
-+
- void XclImpPictureObj::DoPreProcessSdrObj( XclImpDffConverter& rDffConv, SdrObject& rSdrObj ) const
- {
- if( IsOcxControl() )
-@@ -3134,6 +3197,27 @@ XclImpDffConverter::~XclImpDffConverter()
- {
- }
-
-+String XclImpObjectManager::GetOleNameOverride( SCTAB nTab, sal_uInt16 nObjId )
-+{
-+ String sOleName;
-+ String sCodeName = GetExtDocOptions().GetCodeName( nTab );
-+
-+ CodeNameToCntrlObjIdInfo::iterator it = maOleCtrlNameOverride.find( sCodeName );
-+ if ( it != maOleCtrlNameOverride.end() )
-+ {
-+ CntrlObjIdToName::iterator it_id = it->second.find( nObjId );
-+ if ( it_id != it->second.end() )
-+ {
-+ sOleName = it_id->second;
-+ }
-+ }
-+ OSL_TRACE("XclImpObjectManager::GetOleNameOverride tab %d, ( module %s ) object id ( %d ) is %s", nTab,
-+ rtl::OUStringToOString( sCodeName, RTL_TEXTENCODING_UTF8 ).getStr(), nObjId,
-+ rtl::OUStringToOString( sOleName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+
-+ return sOleName;
-+}
-+
- void XclImpDffConverter::StartProgressBar( sal_Size nProgressSize )
- {
- mxProgress.reset( new ScfProgressBar( GetDocShell(), STR_PROGRESS_CALCULATING ) );
-@@ -4004,27 +4088,27 @@ XclImpObjectManager::XclImpObjectManager( const XclImpRoot& rRoot ) :
- XclImpRoot( rRoot )
- {
- maDefObjNames[ EXC_OBJTYPE_GROUP ] = CREATE_STRING( "Group" );
-- maDefObjNames[ EXC_OBJTYPE_LINE ] = CREATE_STRING( "Line" );
-- maDefObjNames[ EXC_OBJTYPE_RECTANGLE ] = CREATE_STRING( "Rectangle" );
-- maDefObjNames[ EXC_OBJTYPE_OVAL ] = CREATE_STRING( "Oval" );
-+ maDefObjNames[ EXC_OBJTYPE_LINE ] = ScGlobal::GetRscString( STR_SHAPE_LINE );
-+ maDefObjNames[ EXC_OBJTYPE_RECTANGLE ] = ScGlobal::GetRscString( STR_SHAPE_RECTANGLE );
-+ maDefObjNames[ EXC_OBJTYPE_OVAL ] = ScGlobal::GetRscString( STR_SHAPE_OVAL );
- maDefObjNames[ EXC_OBJTYPE_ARC ] = CREATE_STRING( "Arc" );
- maDefObjNames[ EXC_OBJTYPE_CHART ] = CREATE_STRING( "Chart" );
- maDefObjNames[ EXC_OBJTYPE_TEXT ] = CREATE_STRING( "Text" );
-- maDefObjNames[ EXC_OBJTYPE_BUTTON ] = CREATE_STRING( "Button" );
-+ maDefObjNames[ EXC_OBJTYPE_BUTTON ] = ScGlobal::GetRscString( STR_FORM_BUTTON );
- maDefObjNames[ EXC_OBJTYPE_PICTURE ] = CREATE_STRING( "Picture" );
- maDefObjNames[ EXC_OBJTYPE_POLYGON ] = CREATE_STRING( "Freeform" );
-- maDefObjNames[ EXC_OBJTYPE_CHECKBOX ] = CREATE_STRING( "Check Box" );
-- maDefObjNames[ EXC_OBJTYPE_OPTIONBUTTON ] = CREATE_STRING( "Option Button" );
-+ maDefObjNames[ EXC_OBJTYPE_CHECKBOX ] = ScGlobal::GetRscString( STR_FORM_CHECKBOX );
-+ maDefObjNames[ EXC_OBJTYPE_OPTIONBUTTON ] = ScGlobal::GetRscString( STR_FORM_OPTIONBUTTON );
- maDefObjNames[ EXC_OBJTYPE_EDIT ] = CREATE_STRING( "Edit Box" );
-- maDefObjNames[ EXC_OBJTYPE_LABEL ] = CREATE_STRING( "Label" );
-+ maDefObjNames[ EXC_OBJTYPE_LABEL ] = ScGlobal::GetRscString( STR_FORM_LABEL );
- maDefObjNames[ EXC_OBJTYPE_DIALOG ] = CREATE_STRING( "Dialog Frame" );
-- maDefObjNames[ EXC_OBJTYPE_SPIN ] = CREATE_STRING( "Spinner" );
-- maDefObjNames[ EXC_OBJTYPE_SCROLLBAR ] = CREATE_STRING( "Scroll Bar" );
-- maDefObjNames[ EXC_OBJTYPE_LISTBOX ] = CREATE_STRING( "List Box" );
-- maDefObjNames[ EXC_OBJTYPE_GROUPBOX ] = CREATE_STRING( "Group Box" );
-- maDefObjNames[ EXC_OBJTYPE_DROPDOWN ] = CREATE_STRING( "Drop Down" );
-+ maDefObjNames[ EXC_OBJTYPE_SPIN ] = ScGlobal::GetRscString( STR_FORM_SPINNER );
-+ maDefObjNames[ EXC_OBJTYPE_SCROLLBAR ] = ScGlobal::GetRscString( STR_FORM_SCROLLBAR );
-+ maDefObjNames[ EXC_OBJTYPE_LISTBOX ] = ScGlobal::GetRscString( STR_FORM_LISTBOX );
-+ maDefObjNames[ EXC_OBJTYPE_GROUPBOX ] = ScGlobal::GetRscString( STR_FORM_GROUPBOX );
-+ maDefObjNames[ EXC_OBJTYPE_DROPDOWN ] = ScGlobal::GetRscString( STR_FORM_DROPDOWN );
- maDefObjNames[ EXC_OBJTYPE_NOTE ] = CREATE_STRING( "Comment" );
-- maDefObjNames[ EXC_OBJTYPE_DRAWING ] = CREATE_STRING( "AutoShape" );
-+ maDefObjNames[ EXC_OBJTYPE_DRAWING ] = ScGlobal::GetRscString( STR_SHAPE_AUTOSHAPE );
- }
-
- XclImpObjectManager::~XclImpObjectManager()
-diff --git sc/source/filter/excel/xiname.cxx sc/source/filter/excel/xiname.cxx
-index dea4046..5a6380f 100644
---- sc/source/filter/excel/xiname.cxx
-+++ sc/source/filter/excel/xiname.cxx
-@@ -35,7 +35,8 @@
- #include "excform.hxx"
- // for filter manager
- #include "excimp8.hxx"
--
-+#include "scextopt.hxx"
-+#include "document.hxx"
- // ============================================================================
- // *** Implementation ***
- // ============================================================================
-@@ -127,6 +128,7 @@ XclImpName::XclImpName( XclImpStream& rStrm, sal_uInt16 nXclNameIdx ) :
- maScName = maXclName;
- ScfTools::ConvertToScDefinedName( maScName );
- }
-+ rtl::OUString aRealOrigName = maScName;
-
- // add index for local names
- if( nXclTab != EXC_NAME_GLOBAL )
-@@ -217,6 +219,25 @@ XclImpName::XclImpName( XclImpStream& rStrm, sal_uInt16 nXclNameIdx ) :
- pData->GuessPosition(); // calculate base position for relative refs
- pData->SetIndex( nXclNameIdx ); // used as unique identifier in formulas
- rRangeNames.Insert( pData ); // takes ownership of pData
-+ if( nXclTab != EXC_NAME_GLOBAL )
-+ {
-+ if (GetBiff() == EXC_BIFF8)
-+ {
-+ ScRange aRange;
-+ // discard deleted ranges ( for the moment at least )
-+ if ( pData->IsValidReference( aRange ) )
-+ {
-+ ScExtTabSettings& rTabSett = GetExtDocOptions().GetOrCreateTabSettings( nXclTab );
-+ // create a mapping between the unmodified localname to
-+ // the name in the global name container for named ranges
-+ OSL_TRACE(" mapping local name to global name for tab %d which exists? %s", nXclTab, GetDoc().HasTable( mnScTab ) ? "true" : "false" );
-+ SCTAB nTab( static_cast< SCTAB >( mnScTab ) );
-+ NameToNameMap* pMap = GetDoc().GetLocalNameMap( nTab );
-+ if ( pMap )
-+ (*pMap)[ aRealOrigName ] = maScName;
-+ }
-+ }
-+ }
- mpScData = pData; // cache for later use
- }
- }
-diff --git sc/source/filter/excel/xistyle.cxx sc/source/filter/excel/xistyle.cxx
-index b1ce3a0..fdd537a 100644
---- sc/source/filter/excel/xistyle.cxx
-+++ sc/source/filter/excel/xistyle.cxx
-@@ -65,10 +65,70 @@
- #include "root.hxx"
- #include "colrowst.hxx"
-
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/container/XIndexAccess.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+using namespace ::com::sun::star;
-+
-+typedef ::cppu::WeakImplHelper1< container::XIndexAccess > XIndexAccess_BASE;
-+typedef ::std::vector< ColorData > ColorDataVec;
-+
-+class PaletteIndex : public XIndexAccess_BASE
-+{
-+public:
-+ PaletteIndex( const ColorDataVec& rColorDataTable ) : maColorData( rColorDataTable ) {}
-+
-+ // Methods XIndexAccess
-+ virtual ::sal_Int32 SAL_CALL getCount() throw (uno::RuntimeException)
-+ {
-+ return maColorData.size();
-+ }
-+
-+ virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ //--Index; // apparently the palette is already 1 based
-+ return uno::makeAny( sal_Int32( maColorData[ Index ] ) );
-+ }
-+
-+ // Methods XElementAcess
-+ virtual uno::Type SAL_CALL getElementType() throw (uno::RuntimeException)
-+ {
-+ return ::getCppuType( (sal_Int32*)0 );
-+ }
-+ virtual ::sal_Bool SAL_CALL hasElements() throw (uno::RuntimeException)
-+ {
-+ return (maColorData.size() > 0);
-+ }
-+
-+private:
-+ ColorDataVec maColorData;
-+};
-+
-+void
-+XclImpPalette::ExportPalette()
-+{
-+ if( SfxObjectShell* pDocShell = mrRoot.GetDocShell() )
-+ {
-+ // copy values in color palette
-+ sal_Int16 nColors = maColorTable.size();
-+ ColorDataVec aColors;
-+ aColors.resize( nColors );
-+ for( sal_uInt16 nIndex = 0; nIndex < nColors; ++nIndex )
-+ aColors[ nIndex ] = GetColorData( nIndex );
-+
-+ uno::Reference< beans::XPropertySet > xProps( pDocShell->GetModel(), uno::UNO_QUERY );
-+ if ( xProps.is() )
-+ {
-+ uno::Reference< container::XIndexAccess > xIndex( new PaletteIndex( aColors ) );
-+ xProps->setPropertyValue( CREATE_OUSTRING("ColorPalette"), uno::makeAny( xIndex ) );
-+ }
-+ }
-+
-+}
- // PALETTE record - color information =========================================
-
- XclImpPalette::XclImpPalette( const XclImpRoot& rRoot ) :
-- XclDefaultPalette( rRoot )
-+ XclDefaultPalette( rRoot ), mrRoot( rRoot )
- {
- }
-
-@@ -102,6 +162,7 @@ void XclImpPalette::ReadPalette( XclImpStream& rStrm )
- rStrm >> aColor;
- maColorTable[ nIndex ] = aColor.GetColor();
- }
-+ ExportPalette();
- }
-
- // FONT record - font information =============================================
-diff --git sc/source/filter/excel/xlescher.cxx sc/source/filter/excel/xlescher.cxx
-index 0b808d3..fab4df4 100644
---- sc/source/filter/excel/xlescher.cxx
-+++ sc/source/filter/excel/xlescher.cxx
-@@ -35,6 +35,13 @@
- #include "document.hxx"
- #include "xistream.hxx"
- #include "xlescher.hxx"
-+#include "globstr.hrc"
-+
-+#include <sfx2/objsh.hxx>
-+#include <basic/sbstar.hxx>
-+#include <basic/sbmod.hxx>
-+#include <basic/sbmeth.hxx>
-+#include <basic/basmgr.hxx>
- #include <filter/msfilter/msvbahelper.hxx>
-
- using ::rtl::OUString;
-@@ -325,6 +332,7 @@ Reference< XControlModel > XclControlHelper::GetControlModel( Reference< XShape
- return xCtrlModel;
- }
-
-+#define EXC_MACRONAME_URI "vnd.sun.star.script:"
- #define EXC_MACRONAME_PRE "vnd.sun.star.script:Standard."
- #define EXC_MACRONAME_SUF "?language=Basic&location=document"
-
-@@ -341,7 +349,7 @@ OUString XclControlHelper::GetScMacroName( const String& rXclMacroName, SfxObjec
- return OUString();
- }
-
--String XclControlHelper::GetXclMacroName( const OUString& rScMacroName )
-+String XclControlHelper::GetXclMacroName( const OUString& rScMacroName, SfxObjectShell* pDocShell )
- {
- const OUString saMacroNamePre = CREATE_OUSTRING( EXC_MACRONAME_PRE );
- const OUString saMacroNameSuf = CREATE_OUSTRING( EXC_MACRONAME_SUF );
-@@ -350,6 +358,26 @@ String XclControlHelper::GetXclMacroName( const OUString& rScMacroName )
- if( (snXclMacroNameLen > 0) && rScMacroName.matchIgnoreAsciiCase( saMacroNamePre, 0 ) &&
- rScMacroName.matchIgnoreAsciiCase( saMacroNameSuf, snScMacroNameLen - saMacroNameSuf.getLength() ) )
- return rScMacroName.copy( saMacroNamePre.getLength(), snXclMacroNameLen );
-+
-+ // This Macro prefix name may not be "vnd.sun.star.script:Standard.", it may be any string that beginning with "vnd.sun.star.script:",
-+ // because Excel can change the VBA project name, such as the default name is "VBAProject", we can change it to "HelloVBA". We must
-+ // use library's name of current document to match with the macro name.
-+ if ( pDocShell )
-+ {
-+ BasicManager* pBasicManager = pDocShell->GetBasicManager();
-+ if ( pBasicManager )
-+ {
-+ const OUString sProjectName = pBasicManager->GetName();
-+ const OUString saMacroNamePre1 = CREATE_OUSTRING(EXC_MACRONAME_URI) + sProjectName + CREATE_OUSTRING(".");
-+ sal_Int32 snXclMacroNameLen1 = snScMacroNameLen - saMacroNamePre1.getLength() - saMacroNameSuf.getLength();
-+ if ( (snXclMacroNameLen1 > 0) && rScMacroName.matchIgnoreAsciiCase( saMacroNamePre1, 0 ) &&
-+ rScMacroName.matchIgnoreAsciiCase( saMacroNameSuf, snScMacroNameLen - saMacroNameSuf.getLength() ) )
-+ {
-+ return rScMacroName.copy( saMacroNamePre1.getLength(), snXclMacroNameLen1 );
-+ }
-+ }
-+ }
-+
- return String::EmptyString();
- }
-
-@@ -385,13 +413,13 @@ bool XclControlHelper::FillMacroDescriptor( ScriptEventDescriptor& rDescriptor,
- }
-
- String XclControlHelper::ExtractFromMacroDescriptor(
-- const ScriptEventDescriptor& rDescriptor, XclTbxEventType eEventType )
-+ const ScriptEventDescriptor& rDescriptor, XclTbxEventType eEventType, SfxObjectShell* pShell )
- {
- if( (rDescriptor.ScriptCode.getLength() > 0) &&
- rDescriptor.ScriptType.equalsIgnoreAsciiCaseAscii( EXC_MACROSCRIPT ) &&
- rDescriptor.ListenerType.equalsAscii( spTbxListenerData[ eEventType ].mpcListenerType ) &&
- rDescriptor.EventMethod.equalsAscii( spTbxListenerData[ eEventType ].mpcEventMethod ) )
-- return GetXclMacroName( rDescriptor.ScriptCode );
-+ return GetXclMacroName( rDescriptor.ScriptCode, pShell );
- return String::EmptyString();
- }
-
-diff --git sc/source/filter/excel/xltoolbar.cxx sc/source/filter/excel/xltoolbar.cxx
-new file mode 100644
-index 0000000..019a146
---- /dev/null
-+++ sc/source/filter/excel/xltoolbar.cxx
-@@ -0,0 +1,433 @@
-+#include "xltoolbar.hxx"
-+#include <rtl/ustrbuf.hxx>
-+#include <stdarg.h>
-+#include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
-+#include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
-+#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
-+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-+#include <com/sun/star/lang/XSingleComponentFactory.hpp>
-+#include <com/sun/star/lang/XMultiComponentFactory.hpp>
-+#include <com/sun/star/ui/XImageManager.hpp>
-+#include <com/sun/star/ui/ItemType.hpp>
-+#include <fstream>
-+#include <comphelper/processfactory.hxx>
-+#include <vcl/graph.hxx>
-+#include <map>
-+using namespace com::sun::star;
-+
-+typedef std::map< sal_Int16, rtl::OUString > IdToString;
-+
-+class MSOExcelCommandConvertor : public MSOCommandConvertor
-+{
-+ IdToString msoToOOcmd;
-+ IdToString tcidToOOcmd;
-+public:
-+ MSOExcelCommandConvertor();
-+ virtual rtl::OUString MSOCommandToOOCommand( sal_Int16 msoCmd );
-+ virtual rtl::OUString MSOTCIDToOOCommand( sal_Int16 key );
-+};
-+
-+MSOExcelCommandConvertor::MSOExcelCommandConvertor()
-+{
-+/*
-+ // mso command id to ooo command string
-+ // #FIXME and *HUNDREDS* of id's to added here
-+ msoToOOcmd[ 0x20b ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".uno:CloseDoc") );
-+ msoToOOcmd[ 0x50 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".uno:Open") );
-+
-+ // mso tcid to ooo command string
-+ // #FIXME and *HUNDREDS* of id's to added here
-+ tcidToOOcmd[ 0x9d9 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".uno:Print") );
-+*/
-+}
-+
-+rtl::OUString MSOExcelCommandConvertor::MSOCommandToOOCommand( sal_Int16 key )
-+{
-+ rtl::OUString sResult;
-+ IdToString::iterator it = msoToOOcmd.find( key );
-+ if ( it != msoToOOcmd.end() )
-+ sResult = it->second;
-+ return sResult;
-+}
-+
-+rtl::OUString MSOExcelCommandConvertor::MSOTCIDToOOCommand( sal_Int16 key )
-+{
-+ rtl::OUString sResult;
-+ IdToString::iterator it = tcidToOOcmd.find( key );
-+ if ( it != tcidToOOcmd.end() )
-+ sResult = it->second;
-+ return sResult;
-+}
-+
-+
-+
-+CTBS::CTBS() : bSignature(0), bVersion(0), reserved1(0), reserved2(0), reserved3(0), ctb(0), ctbViews(0), ictbView(0)
-+{
-+}
-+
-+CTB::CTB() : nViews( 0 ), ectbid(0)
-+{
-+}
-+
-+CTB::CTB(sal_uInt16 nNum ) : nViews( nNum ), ectbid(0)
-+{
-+}
-+
-+bool CTB::Read( SvStream *pS )
-+{
-+ OSL_TRACE("CTB::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ tb.Read( pS );
-+ for ( sal_uInt16 index = 0; index < nViews; ++index )
-+ {
-+ TBVisualData aVisData;
-+ aVisData.Read( pS );
-+ rVisualData.push_back( aVisData );
-+ }
-+ *pS >> ectbid;
-+
-+ for ( sal_Int16 index = 0; index < tb.getcCL(); ++index )
-+ {
-+ TBC aTBC;
-+ aTBC.Read( pS );
-+ rTBC.push_back( aTBC );
-+ }
-+ return true;
-+}
-+
-+void CTB::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf( fp, "[ 0x%x ] CTB -- dump\n", nOffSet );
-+ indent_printf( fp, " nViews 0x%x\n", nViews);
-+ tb.Print( fp );
-+
-+ std::vector<TBVisualData>::iterator visData_end = rVisualData.end();
-+ sal_Int32 counter = 0;
-+ for ( std::vector<TBVisualData>::iterator it = rVisualData.begin(); it != visData_end; ++it )
-+ {
-+
-+ indent_printf( fp, " TBVisualData [%d]\n", counter++ );
-+ Indent b;
-+ it->Print( fp );
-+ }
-+ indent_printf( fp, " ectbid 0x%x\n", ectbid);
-+ std::vector<TBC>::iterator it_end = rTBC.end();
-+ counter = 0;
-+ for ( std::vector<TBC>::iterator it = rTBC.begin(); it != it_end; ++it )
-+ {
-+ indent_printf( fp, " TBC [%d]\n", counter++);
-+ Indent c;
-+ it->Print( fp );
-+ }
-+}
-+
-+bool CTB::IsMenuToolbar()
-+{
-+ return tb.IsMenuToolbar();
-+}
-+
-+bool CTB::ImportMenuTB( CTBWrapper& rWrapper, const css::uno::Reference< css::container::XIndexContainer >& xMenuDesc, CustomToolBarImportHelper& helper )
-+{
-+ sal_Int32 index = 0;
-+ for ( std::vector< TBC >::iterator it = rTBC.begin(); it != rTBC.end(); ++it, ++index )
-+ {
-+ if ( !it->ImportToolBarControl( rWrapper, xMenuDesc, helper, IsMenuToolbar() ) )
-+ return false;
-+ }
-+ return true;
-+}
-+
-+bool CTB::ImportCustomToolBar( CTBWrapper& rWrapper, CustomToolBarImportHelper& helper )
-+{
-+
-+ static rtl::OUString sToolbarPrefix( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/custom_" ) );
-+ bool bRes = false;
-+ try
-+ {
-+ if ( !tb.IsEnabled() )
-+ return true; // didn't fail, just ignoring
-+
-+ // Create default setting
-+ uno::Reference< container::XIndexContainer > xIndexContainer( helper.getCfgManager()->createSettings(), uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xIndexAccess( xIndexContainer, uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xProps( xIndexContainer, uno::UNO_QUERY_THROW );
-+ WString& name = tb.getName();
-+ // set UI name for toolbar
-+ xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UIName") ), uno::makeAny( name.getString() ) );
-+
-+ rtl::OUString sToolBarName = sToolbarPrefix.concat( name.getString() );
-+ for ( std::vector< TBC >::iterator it = rTBC.begin(); it != rTBC.end(); ++it )
-+ {
-+ if ( !it->ImportToolBarControl( rWrapper, xIndexContainer, helper, IsMenuToolbar() ) )
-+ return false;
-+ }
-+
-+ OSL_TRACE("Name of toolbar :-/ %s", rtl::OUStringToOString( sToolBarName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+
-+ helper.getCfgManager()->insertSettings( sToolBarName, xIndexAccess );
-+ helper.applyIcons();
-+#if 1
-+ uno::Reference< ui::XUIConfigurationPersistence > xPersistence( helper.getCfgManager()->getImageManager(), uno::UNO_QUERY_THROW );
-+ xPersistence->store();
-+
-+ xPersistence.set( helper.getCfgManager(), uno::UNO_QUERY_THROW );
-+ xPersistence->store();
-+#endif
-+
-+ bRes = true;
-+ }
-+ catch( uno::Exception& )
-+ {
-+ bRes = false;
-+ }
-+ return bRes;
-+}
-+bool CTBS::Read( SvStream *pS )
-+{
-+ OSL_TRACE("CTBS::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> bSignature >> bVersion >> reserved1 >> reserved2 >> reserved3 >> ctb >> ctbViews >> ictbView;
-+ return true;
-+}
-+
-+void CTBS::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf( fp, "[ 0x%x ] CTBS -- dump\n", nOffSet );
-+
-+ indent_printf( fp, " bSignature 0x%x\n", bSignature);
-+ indent_printf( fp, " bVersion 0x%x\n", bVersion);
-+
-+ indent_printf( fp, " reserved1 0x%x\n", reserved1 );
-+ indent_printf( fp, " reserved2 0x%x\n", reserved2 );
-+ indent_printf( fp, " reserved3 0x%x\n", reserved3 );
-+
-+ indent_printf( fp, " ctb 0x%x\n", ctb );
-+ indent_printf( fp, " ctbViews 0x%x\n", ctbViews );
-+ indent_printf( fp, " ictbView 0x%x\n", ictbView );
-+}
-+
-+TBC::TBC()
-+{
-+}
-+
-+bool
-+TBC::Read(SvStream *pS)
-+{
-+ OSL_TRACE("TBC::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ if ( !tbch.Read( pS ) )
-+ return false;
-+ sal_uInt16 tcid = tbch.getTcID();
-+ sal_uInt8 tct = tbch.getTct();
-+ if ( ( tcid != 0x0001 && tcid != 0x06CC && tcid != 0x03D8 && tcid != 0x03EC && tcid != 0x1051 ) && ( ( tct > 0 && tct < 0x0B ) || ( ( tct > 0x0B && tct < 0x10 ) || tct == 0x15 ) ) )
-+ {
-+ tbcCmd.reset( new TBCCmd );
-+ if ( ! tbcCmd->Read( pS ) )
-+ return false;
-+ }
-+ if ( tct != 0x16 )
-+ {
-+ tbcd.reset( new TBCData( tbch ) );
-+ if ( !tbcd->Read( pS ) )
-+ return false;
-+ }
-+ return true;
-+}
-+
-+
-+void
-+TBC::Print(FILE* fp)
-+{
-+ Indent a;
-+ indent_printf( fp, "[ 0x%x ] TBC -- dump\n", nOffSet );
-+ tbch.Print( fp );
-+ if ( tbcCmd.get() )
-+ tbcCmd->Print( fp );
-+ if ( tbcd.get() )
-+ tbcd->Print( fp );
-+}
-+
-+bool TBC::ImportToolBarControl( CTBWrapper& rWrapper, const css::uno::Reference< css::container::XIndexContainer >& toolbarcontainer, CustomToolBarImportHelper& helper, bool bIsMenuToolbar )
-+{
-+ // how to identify built-in-command ?
-+// bool bBuiltin = false;
-+ if ( tbcd.get() )
-+ {
-+ std::vector< css::beans::PropertyValue > props;
-+/*
-+ if ( bBuiltin )
-+ {
-+ rtl::OUString sCommand = helper.MSOCommandToOOCommand( cmdId );
-+ if ( sCommand.getLength() > 0 )
-+ {
-+ beans::PropertyValue aProp;
-+
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CommandURL") );
-+ aProp.Value <<= sCommand;
-+ props.push_back( aProp );
-+ }
-+
-+ }
-+*/
-+ bool bBeginGroup = false;
-+ if ( ! tbcd->ImportToolBarControl( helper, props, bBeginGroup, bIsMenuToolbar ) )
-+ return false;
-+ TBCMenuSpecific* pMenu = tbcd->getMenuSpecific();
-+ if ( pMenu )
-+ {
-+ // search for CTB with the appropriate name ( it contains the
-+ // menu items, although we cannot import ( or create ) a menu on
-+ // a custom toolbar we can import the menu items in a separate
-+ // toolbar ( better than nothing )
-+ CTB* pCustTB = rWrapper.GetCustomizationData( pMenu->Name() );
-+ if ( pCustTB )
-+ {
-+ uno::Reference< container::XIndexContainer > xMenuDesc;
-+ uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+ xMenuDesc.set( xMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.IndexedPropertyValues" ) ) ), uno::UNO_QUERY_THROW );
-+ if ( !pCustTB->ImportMenuTB( rWrapper, xMenuDesc, helper ) )
-+ return false;
-+ if ( !bIsMenuToolbar )
-+ {
-+ if ( !helper.createMenu( pMenu->Name(), uno::Reference< container::XIndexAccess >( xMenuDesc, uno::UNO_QUERY ), true ) )
-+ return false;
-+ }
-+ else
-+ {
-+ beans::PropertyValue aProp;
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ItemDescriptorContainer") );
-+ aProp.Value <<= xMenuDesc;
-+ props.push_back( aProp );
-+ }
-+ }
-+ }
-+
-+ if ( bBeginGroup )
-+ {
-+ // insert spacer
-+ uno::Sequence< beans::PropertyValue > sProps( 1 );
-+ sProps[ 0 ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Type") );
-+ sProps[ 0 ].Value = uno::makeAny( ui::ItemType::SEPARATOR_LINE );
-+ toolbarcontainer->insertByIndex( toolbarcontainer->getCount(), uno::makeAny( sProps ) );
-+ }
-+ uno::Sequence< beans::PropertyValue > sProps( props.size() );
-+ beans::PropertyValue* pProp = sProps.getArray();
-+
-+ for ( std::vector< css::beans::PropertyValue >::iterator it = props.begin(); it != props.end(); ++it, ++pProp )
-+ *pProp = *it;
-+
-+ toolbarcontainer->insertByIndex( toolbarcontainer->getCount(), uno::makeAny( sProps ) );
-+ }
-+ return true;
-+}
-+
-+void
-+TBCCmd::Print(FILE* fp)
-+{
-+ Indent a;
-+ indent_printf( fp, " TBCCmd -- dump\n" );
-+ indent_printf( fp, " cmdID 0x%x\n", cmdID );
-+ indent_printf( fp, " A ( fHideDrawing ) %s\n", A ? "true" : "false" );
-+ indent_printf( fp, " B ( reserved - ignored ) %s\n", A ? "true" : "false" );
-+ indent_printf( fp, " cmdType 0x%x\n", cmdType );
-+ indent_printf( fp, " C ( reserved - ignored ) %s\n", A ? "true" : "false" );
-+ indent_printf( fp, " reserved3 0x%x\n", reserved3 );
-+}
-+
-+bool TBCCmd::Read( SvStream *pS )
-+{
-+ OSL_TRACE("TBCCmd::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> cmdID;
-+ sal_uInt16 temp;
-+ *pS >> temp;
-+ OSL_TRACE("TBCmd temp = 0x%x", temp );
-+ A = (temp & 0x8000 ) == 0x8000;
-+ B = (temp & 0x4000) == 0x4000;
-+ cmdType = ( temp & 0x3E00 ) >> 9;
-+ C = ( temp & 0x100 ) == 0x100;
-+ reserved3 = ( temp & 0xFF );
-+ return true;
-+}
-+
-+CTBWrapper::CTBWrapper()
-+{
-+}
-+
-+CTBWrapper::~CTBWrapper()
-+{
-+}
-+
-+bool
-+CTBWrapper::Read( SvStream *pS)
-+{
-+ OSL_TRACE("CTBWrapper::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ if ( !ctbSet.Read( pS ) )
-+ return false;
-+ for ( sal_uInt16 index = 0; index < ctbSet.ctb; ++index )
-+ {
-+ CTB aCTB( ctbSet.ctbViews );
-+ if ( !aCTB.Read( pS ) )
-+ return false;
-+ rCTB.push_back( aCTB );
-+ }
-+ return true;
-+}
-+
-+void
-+CTBWrapper::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf( fp, "[ 0x%x ] CTBWrapper -- dump\n", nOffSet );
-+ ctbSet.Print( fp );
-+ std::vector<CTB>::iterator it_end = rCTB.end();
-+ for ( std::vector<CTB>::iterator it = rCTB.begin(); it != it_end; ++it )
-+ {
-+ Indent b;
-+ it->Print( fp );
-+ }
-+}
-+
-+CTB* CTBWrapper::GetCustomizationData( const rtl::OUString& sTBName )
-+{
-+ CTB* pCTB = NULL;
-+ for ( std::vector< CTB >::iterator it = rCTB.begin(); it != rCTB.end(); ++it )
-+ {
-+ if ( it->GetName().equals( sTBName ) )
-+ {
-+ pCTB = &(*it);
-+ break;
-+ }
-+ }
-+ return pCTB;
-+}
-+
-+bool CTBWrapper::ImportCustomToolBar( SfxObjectShell& rDocSh )
-+{
-+ std::vector<CTB>::iterator it_end = rCTB.end();
-+ for ( std::vector<CTB>::iterator it = rCTB.begin(); it != it_end; ++it )
-+ {
-+ // for each customtoolbar
-+ uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+ uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xAppCfgSupp( xMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.ModuleUIConfigurationManagerSupplier" ) ) ), uno::UNO_QUERY_THROW );
-+ CustomToolBarImportHelper helper( rDocSh, xAppCfgSupp->getUIConfigurationManager( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.SpreadsheetDocument" ) ) ) );
-+ helper.setMSOCommandMap( new MSOExcelCommandConvertor() );
-+ // Ignore menu toolbars, excel doesn't ( afaics ) store
-+ // menu customizations ( but you can have menus in a customtoolbar
-+ // such menus will be dealt with when they are encountered
-+ // as part of importing the appropriate MenuSpecific toolbar control )
-+
-+
-+ if ( !(*it).IsMenuToolbar() )
-+ {
-+ if ( !(*it).ImportCustomToolBar( *this, helper ) )
-+ return false;
-+ }
-+ }
-+ return true;
-+}
-+
-+
-diff --git sc/source/filter/excel/xltoolbar.hxx sc/source/filter/excel/xltoolbar.hxx
-new file mode 100644
-index 0000000..5bfbe2c
---- /dev/null
-+++ sc/source/filter/excel/xltoolbar.hxx
-@@ -0,0 +1,95 @@
-+#ifndef _XLTOOLBAR_HXX
-+#define _XLTOOLBAR_HXX
-+
-+#include <filter/msfilter/mstoolbar.hxx>
-+
-+namespace css = ::com::sun::star;
-+
-+class CTBWrapper;
-+// hmm I don't normally use these packed structures
-+// but.. hey always good to do something different
-+class TBCCmd : public TBBase
-+{
-+public:
-+ TBCCmd() : cmdID(0), A(0), B(0), cmdType(0), C(0), reserved3(0) {}
-+ sal_uInt16 cmdID;
-+ sal_uInt16 A:1;
-+ sal_uInt16 B:1;
-+ sal_uInt16 cmdType:5;
-+ sal_uInt16 C:1;
-+ sal_uInt16 reserved3:8;
-+ bool Read( SvStream* pS );
-+ void Print(FILE* fp);
-+};
-+
-+class TBC : public TBBase
-+{
-+ TBCHeader tbch;
-+ boost::shared_ptr<TBCCmd> tbcCmd; // optional
-+ boost::shared_ptr<TBCData> tbcd;
-+public:
-+ TBC();
-+ ~TBC(){}
-+ void Print( FILE* );
-+ bool Read(SvStream *pS);
-+ bool ImportToolBarControl( CTBWrapper&, const com::sun::star::uno::Reference< com::sun::star::container::XIndexContainer >& toolbarcontainer, CustomToolBarImportHelper& helper, bool bIsMenuBar );
-+};
-+
-+class CTB : public TBBase
-+{
-+ sal_uInt16 nViews;
-+ TB tb;
-+ std::vector<TBVisualData> rVisualData;
-+ sal_uInt32 ectbid;
-+ std::vector< TBC > rTBC;
-+ bool ImportCustomToolBar_Impl( CTBWrapper&, CustomToolBarImportHelper& );
-+public:
-+ CTB();
-+ CTB(sal_uInt16);
-+ ~CTB(){}
-+ void Print( FILE* );
-+ bool Read(SvStream *pS);
-+ bool IsMenuToolbar();
-+ bool ImportCustomToolBar( CTBWrapper&, CustomToolBarImportHelper& );
-+ bool ImportMenuTB( CTBWrapper&, const css::uno::Reference< css::container::XIndexContainer >&, CustomToolBarImportHelper& );
-+ rtl::OUString GetName() { return tb.getName().getString(); }
-+
-+
-+};
-+
-+class CTBS : public TBBase
-+{
-+public:
-+ sal_uInt8 bSignature;
-+ sal_uInt8 bVersion;
-+ sal_uInt16 reserved1;
-+ sal_uInt16 reserved2;
-+ sal_uInt16 reserved3;
-+ sal_uInt16 ctb;
-+ sal_uInt16 ctbViews;
-+ sal_uInt16 ictbView;
-+ CTBS(const CTBS&);
-+ CTBS& operator = ( const CTBS&);
-+ CTBS();
-+ ~CTBS(){}
-+ void Print( FILE* );
-+ bool Read(SvStream *pS);
-+};
-+
-+class CTBWrapper : public TBBase
-+{
-+ CTBS ctbSet;
-+
-+ std::vector< CTB > rCTB;
-+
-+public:
-+ CTBWrapper();
-+ ~CTBWrapper();
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+ bool ImportCustomToolBar( SfxObjectShell& rDocSh );
-+ CTB* GetCustomizationData( const rtl::OUString& name );
-+};
-+
-+
-+#endif //_XLTOOLBAR_HXX
-diff --git sc/source/filter/inc/excimp8.hxx sc/source/filter/inc/excimp8.hxx
-index e87dc02..4447768 100644
---- sc/source/filter/inc/excimp8.hxx
-+++ sc/source/filter/inc/excimp8.hxx
-@@ -52,6 +52,9 @@ class ImportExcel8 : public ImportExcel
- {
- SCTAB mnTab;
- protected:
-+ // represents codename ( and associated modules )
-+ // not speficied directly in the binary format
-+ std::vector< String > AutoGeneratedCodeNames;
- ExcScenarioList aScenList;
-
- BOOL bHasBasic;
-diff --git sc/source/filter/inc/xcl97esc.hxx sc/source/filter/inc/xcl97esc.hxx
-index e40e3f1..2c52717 100644
---- sc/source/filter/inc/xcl97esc.hxx
-+++ sc/source/filter/inc/xcl97esc.hxx
-@@ -70,6 +70,15 @@ class XclExpOcxControlObj;
- #else
- class XclExpTbxControlObj;
- #endif
-+class XclExpShapeObj;
-+class EscherExHostAppData;
-+class ShapeInteractionHelper
-+{
-+public:
-+ static XclExpShapeObj* CreateShapeObj( XclExpObjectManager& rObjMgr, const ::com::sun::star::uno::Reference<
-+ ::com::sun::star::drawing::XShape >& xShape );
-+ static void PopulateShapeInteractionInfo( XclExpObjectManager& rObjMgr, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape, EscherExHostAppData& rHostAppData );
-+};
-
- class XclEscherEx : public EscherEx, protected XclExpRoot
- {
-diff --git sc/source/filter/inc/xcl97rec.hxx sc/source/filter/inc/xcl97rec.hxx
-index 299b80d..bf55dea 100644
---- sc/source/filter/inc/xcl97rec.hxx
-+++ sc/source/filter/inc/xcl97rec.hxx
-@@ -220,7 +220,7 @@ public:
-
- class XclObjAny : public XclObj
- {
--private:
-+protected:
- virtual void WriteSubRecs( XclExpStream& rStrm );
-
- public:
-diff --git sc/source/filter/inc/xecontent.hxx sc/source/filter/inc/xecontent.hxx
-index 4783814..ddb6162 100644
---- sc/source/filter/inc/xecontent.hxx
-+++ sc/source/filter/inc/xecontent.hxx
-@@ -113,6 +113,8 @@ public:
- inline const String* GetRepr() const { return mxRepr.get(); }
-
- virtual void SaveXml( XclExpXmlStream& rStrm );
-+
-+ virtual void WriteEmbeddedData( XclExpStream& rStrm );
- private:
- /** Builds file name from the passed file URL. Tries to convert to relative file name.
- @param rnLevel (out-param) The parent directory level.
-diff --git sc/source/filter/inc/xeescher.hxx sc/source/filter/inc/xeescher.hxx
-index 259ab97..c57993c 100644
---- sc/source/filter/inc/xeescher.hxx
-+++ sc/source/filter/inc/xeescher.hxx
-@@ -207,6 +207,34 @@ private:
- sal_uInt16 mnEntryCount; /// Number of entries in source range.
- };
-
-+class XclMacroHelper : public XclExpControlHelper
-+{
-+protected:
-+ XclTokenArrayRef mxMacroLink; /// Token array containing a link to an attached macro.
-+
-+public:
-+ explicit XclMacroHelper( const XclExpRoot& rRoot );
-+ virtual ~XclMacroHelper();
-+ /** Writes an ftMacro subrecord containing a macro link, or nothing, if no macro present. */
-+ void WriteMacroSubRec( XclExpStream& rStrm );
-+ /** Sets the name of a macro for object of passed type
-+ @return true = The passed event descriptor was valid, macro name has been found. */
-+ bool SetMacroLink( const ::com::sun::star::script::ScriptEventDescriptor& rEvent, const XclTbxEventType& nEventType );
-+
-+ /** Sets the name of a macro
-+ @return true = The passed macro name has been found. */
-+ bool SetMacroLink( const String& rMacro );
-+};
-+
-+class XclExpShapeObj : public XclObjAny, public XclMacroHelper
-+{
-+public:
-+ explicit XclExpShapeObj( XclExpObjectManager& rRoot, ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
-+ virtual ~XclExpShapeObj();
-+private:
-+ virtual void WriteSubRecs( XclExpStream& rStrm );
-+};
-+
- // ----------------------------------------------------------------------------
-
- #if EXC_EXP_OCX_CTRL
-@@ -234,7 +262,7 @@ private:
- #else
-
- /** Represents an OBJ record for an TBX form control. */
--class XclExpTbxControlObj : public XclObj, public XclExpControlHelper
-+class XclExpTbxControlObj : public XclObj, public XclMacroHelper
- {
- public:
- explicit XclExpTbxControlObj(
-@@ -249,8 +277,6 @@ public:
- private:
- virtual void WriteSubRecs( XclExpStream& rStrm );
-
-- /** Writes an ftMacro subrecord containing a macro link, or nothing, if no macro present. */
-- void WriteMacroSubRec( XclExpStream& rStrm );
- /** Writes a subrecord containing a cell link, or nothing, if no link present. */
- void WriteCellLinkSubRec( XclExpStream& rStrm, sal_uInt16 nSubRecId );
- /** Writes the ftSbs sub structure containing scrollbar data. */
-@@ -258,7 +284,6 @@ private:
-
- private:
- ScfInt16Vec maMultiSel; /// Indexes of all selected entries in a multi selection.
-- XclTokenArrayRef mxMacroLink; /// Token array containing a link to an attached macro.
- XclTbxEventType meEventType; /// Type of supported macro event.
- sal_Int32 mnHeight; /// Height of the control.
- sal_uInt16 mnState; /// Checked/unchecked state.
-diff --git sc/source/filter/inc/xiescher.hxx sc/source/filter/inc/xiescher.hxx
-index b845207..a5998ed 100644
---- sc/source/filter/inc/xiescher.hxx
-+++ sc/source/filter/inc/xiescher.hxx
-@@ -30,6 +30,7 @@
-
- #include <vector>
- #include <map>
-+#include <hash_map>
- #include <filter/msfilter/msdffimp.hxx>
- #include <filter/msfilter/msocximex.hxx>
- #include <vcl/graph.hxx>
-@@ -92,7 +93,7 @@ public:
- /** Returns the Excel object type from OBJ record. */
- inline sal_uInt16 GetObjType() const { return mnObjType; }
- /** Returns the name of this object, may generate a default name. */
-- String GetObjName() const;
-+ virtual String GetObjName() const;
- /** Returns associated macro name, if set, otherwise zero length string. */
- inline const String& GetMacroName() const { return maMacroName; }
-
-@@ -172,7 +173,7 @@ protected:
- virtual void DoPreProcessSdrObj( XclImpDffConverter& rDffConv, SdrObject& rSdrObj ) const;
- /** Derived classes may perform additional processing for the passed SdrObject after insertion. */
- virtual void DoPostProcessSdrObj( XclImpDffConverter& rDffConv, SdrObject& rSdrObj ) const;
--
-+ SCTAB GetTab() const { return mnTab; }
- private:
- /** Reads the contents of a BIFF3 OBJ record. */
- void ImplReadObj3( XclImpStream& rStrm );
-@@ -186,6 +187,7 @@ private:
- private:
- XclObjAnchor maAnchor; /// The position of the object in its parent.
- sal_uInt16 mnObjId; /// The object identifier (unique per drawing).
-+ SCTAB mnTab; /// Location of object
- sal_uInt16 mnObjType; /// The Excel object type from OBJ record.
- sal_uInt32 mnDffShapeId; /// Shape ID from DFF stream.
- sal_uInt32 mnDffFlags; /// Shape flags from DFF stream.
-@@ -502,6 +504,10 @@ protected:
- /** Derived classes will set additional properties for the current form control. */
- virtual void DoProcessControl( ScfPropertySet& rPropSet ) const;
-
-+ void ApplySheetLinkProps() const;
-+ mutable ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
-+ mxShape; /// The UNO wrapper of the control shape.
-+ ScfRef< ScAddress > mxCellLink; /// Linked cell in the Calc document.
- private:
- /** Reads a list of cell ranges from a formula at the current stream position. */
- void ReadRangeList( ScRangeList& rScRanges, XclImpStream& rStrm );
-@@ -510,9 +516,6 @@ private:
-
- private:
- const XclImpRoot& mrRoot; /// Not derived from XclImpRoot to allow multiple inheritance.
-- mutable ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
-- mxShape; /// The UNO wrapper of the control shape.
-- ScfRef< ScAddress > mxCellLink; /// Linked cell in the Calc document.
- ScfRef< ScRange > mxSrcRange; /// Source data range in the Calc document.
- XclCtrlBindMode meBindMode; /// Value binding mode.
- };
-@@ -614,6 +617,7 @@ protected:
- virtual XclTbxEventType DoGetEventType() const;
-
- protected:
-+ void ApplyGrouping( XclImpOptionButtonObj& rLeader, sal_Int32 nRefVal );
- sal_uInt16 mnNextInGroup; /// Next option button in a group.
- sal_uInt16 mnFirstInGroup; /// 1 = Button is the first in a group.
- };
-@@ -862,7 +866,8 @@ class XclImpPictureObj : public XclImpRectObj, public XclImpControlHelper
- {
- public:
- explicit XclImpPictureObj( const XclImpRoot& rRoot );
--
-+ /** Returns the ObjectName - can use non-obvious lookup for override in the associated vba document module stream**/
-+ virtual String GetObjName() const;
- /** Returns the graphic imported from the IMGDATA record. */
- inline const Graphic& GetGraphic() const { return maGraphic; }
- /** Returns the visible area of the imported graphic. */
-@@ -1209,6 +1214,8 @@ private:
- /** Stores all drawing and OLE objects and additional data related to these objects. */
- class XclImpObjectManager : protected XclImpRoot
- {
-+typedef std::hash_map< sal_Int32, String > CntrlObjIdToName;
-+typedef std::map< String, CntrlObjIdToName > CodeNameToCntrlObjIdInfo;
- public:
- explicit XclImpObjectManager( const XclImpRoot& rRoot );
- virtual ~XclImpObjectManager();
-@@ -1225,9 +1232,41 @@ public:
- String GetDefaultObjName( const XclImpDrawObjBase& rDrawObj ) const;
- /** Returns the used area in the sheet with the passed index. */
- ScRange GetUsedArea( SCTAB nScTab ) const;
-+ void SetOleNameOverrideInfo( const CodeNameToCntrlObjIdInfo& rOverrideInfo ) { maOleCtrlNameOverride = rOverrideInfo; }
-+ String GetOleNameOverride( SCTAB nTab, sal_uInt16 nObjId );
-+ // ------------------------------------------------------------------------
-+private:
-+
-+ CodeNameToCntrlObjIdInfo maOleCtrlNameOverride;
-+
-+ /** Reads and returns a bitmap from WMF/PICT format. */
-+ static void ReadWmf( Graphic& rGraphic, XclImpStream& rStrm );
-+ /** Reads and returns a bitmap from BMP format. */
-+ static void ReadBmp( Graphic& rGraphic, XclImpStream& rStrm );
-+
-+ /** Reads contents of an DFF record and append data to internal DFF stream. */
-+ void ReadDffRecord( XclImpStream& rStrm );
-+ /** Reads a BIFF8 OBJ record following an MSODRAWING record. */
-+ void ReadObj8( XclImpStream& rStrm );
-+ /** Reads the TXO record and following CONTINUE records containing string and formatting. */
-+ void ReadTxo( XclImpStream& rStrm );
-+
-+ /** Reads a BIFF3-BIFF5 NOTE record. */
-+ void ReadNote3( XclImpStream& rStrm );
-+ /** Reads a BIFF8 NOTE record. */
-+ void ReadNote8( XclImpStream& rStrm );
-+
-+ /** Returns the size of the progress bar shown while processing all objects. */
-+ sal_Size GetProgressSize() const;
-
- // ------------------------------------------------------------------------
- private:
-+ typedef ::std::map< sal_Size, XclImpDrawObjRef > XclImpObjMap;
-+ typedef ::std::map< XclObjId, XclImpDrawObjRef > XclImpObjMapById;
-+ typedef ScfRef< XclImpObjTextData > XclImpObjTextRef;
-+ typedef ::std::map< sal_Size, XclImpObjTextRef > XclImpObjTextMap;
-+ typedef ::std::vector< XclObjId > XclObjIdVec;
-+
- typedef ::std::map< sal_uInt16, String > DefObjNameMap;
- typedef ScfRef< XclImpSheetDrawing > XclImpSheetDrawingRef;
- typedef ::std::map< SCTAB, XclImpSheetDrawingRef > XclImpSheetDrawingMap;
-diff --git sc/source/filter/inc/xistyle.hxx sc/source/filter/inc/xistyle.hxx
-index 1d3047e..ba3448f 100644
---- sc/source/filter/inc/xistyle.hxx
-+++ sc/source/filter/inc/xistyle.hxx
-@@ -69,8 +69,10 @@ public:
- void ReadPalette( XclImpStream& rStrm );
-
- private:
-+ void ExportPalette();
- typedef ::std::vector< ColorData > ColorDataVec;
- ColorDataVec maColorTable; /// Colors read from file.
-+ const XclImpRoot& mrRoot;
- };
-
- // FONT record - font information =============================================
-diff --git sc/source/filter/inc/xlescher.hxx sc/source/filter/inc/xlescher.hxx
-index 6af4205..847a5fa 100644
---- sc/source/filter/inc/xlescher.hxx
-+++ sc/source/filter/inc/xlescher.hxx
-@@ -433,8 +433,9 @@ public:
-
- /** Returns the Calc macro name from an Excel macro name. */
- static ::rtl::OUString GetScMacroName( const String& rXclMacroName, SfxObjectShell* pShell = NULL );
-+
- /** Returns the Excel macro name from a Calc macro name. */
-- static String GetXclMacroName( const ::rtl::OUString& rScMacroName );
-+ static String GetXclMacroName( const ::rtl::OUString& rScMacroName, SfxObjectShell* pShell = NULL );
-
- /** Fills the macro descriptor according to the passed macro name. */
- static bool FillMacroDescriptor(
-@@ -444,7 +445,7 @@ public:
- /** Tries to extract an Excel macro name from the passed macro descriptor. */
- static String ExtractFromMacroDescriptor(
- const ::com::sun::star::script::ScriptEventDescriptor& rDescriptor,
-- XclTbxEventType eEventType );
-+ XclTbxEventType eEventType, SfxObjectShell* pShell = NULL );
- };
-
- // ============================================================================
-diff --git sc/source/filter/xcl97/xcl97esc.cxx sc/source/filter/xcl97/xcl97esc.cxx
-index b7e5de8..58ef6ad 100644
---- sc/source/filter/xcl97/xcl97esc.cxx
-+++ sc/source/filter/xcl97/xcl97esc.cxx
-@@ -54,6 +54,9 @@
- #include "global.hxx"
- #include "document.hxx"
- #include "drwlayer.hxx"
-+#include "xecontent.hxx"
-+#include <editeng/flditem.hxx>
-+#include "userdat.hxx"
- #include "xcl97rec.hxx"
- #include "xehelper.hxx"
- #include "xechart.hxx"
-@@ -256,7 +259,8 @@ EscherExHostAppData* XclEscherEx::StartShape( const Reference< XShape >& rxShape
- {
- // #107540# ignore permanent note shapes
- // #i12190# do not ignore callouts (do not filter by object type ID)
-- pCurrXclObj = new XclObjAny( mrObjMgr ); // just a metafile
-+ pCurrXclObj = ShapeInteractionHelper::CreateShapeObj( mrObjMgr, rxShape );
-+ ShapeInteractionHelper::PopulateShapeInteractionInfo( mrObjMgr, rxShape, *pCurrAppData );
- }
- }
- if ( pCurrXclObj )
-@@ -359,7 +363,6 @@ EscherExHostAppData* XclEscherEx::EnterAdditionalTextGroup()
- return pCurrAppData;
- }
-
--
- void XclEscherEx::EndDocument()
- {
- if( mbIsRootDff )
-@@ -478,6 +481,7 @@ void XclEscherEx::DeleteCurrAppData()
- delete pCurrAppData->GetClientAnchor();
- // delete pCurrAppData->GetClientData();
- delete pCurrAppData->GetClientTextbox();
-+ delete pCurrAppData->GetInteractionInfo();
- delete pCurrAppData;
- }
- }
-@@ -509,4 +513,40 @@ void XclEscherClientTextbox::WriteData( EscherEx& /*rEx*/ ) const
- pXclObj->SetText( GetRoot(), rTextObj );
- }
-
-+XclExpShapeObj*
-+ShapeInteractionHelper::CreateShapeObj( XclExpObjectManager& rObjMgr, const Reference< XShape >& xShape )
-+{
-+ return new XclExpShapeObj( rObjMgr, xShape );
-+}
-+
-+void
-+ShapeInteractionHelper::PopulateShapeInteractionInfo( XclExpObjectManager& rObjMgr, const Reference< XShape >& xShape, EscherExHostAppData& rHostAppData )
-+{
-+ try
-+ {
-+ SvMemoryStream* pMemStrm = NULL;
-+ rtl::OUString sHyperLink;
-+ rtl::OUString sMacro;
-+ if ( ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( ::GetSdrObjectFromXShape( xShape ) ) )
-+ {
-+ sHyperLink = pInfo->GetHlink();
-+ sMacro = pInfo->GetMacro();
-+ }
-+ if ( sHyperLink.getLength() > 0 )
-+ {
-+ pMemStrm = new SvMemoryStream();
-+ XclExpStream tmpStream( *pMemStrm, rObjMgr.GetRoot() );
-+ ScAddress dummyAddress;
-+ SvxURLField aUrlField;
-+ aUrlField.SetURL( sHyperLink );
-+ XclExpHyperlink hExpHlink( rObjMgr.GetRoot(), aUrlField, dummyAddress );
-+ hExpHlink.WriteEmbeddedData( tmpStream );
-+ }
-+ if ( ( sHyperLink.getLength() > 0 ) || ( sMacro.getLength() > 0 ) )
-+ rHostAppData.SetInteractionInfo( new InteractionInfo( pMemStrm, true ) );
-+ }
-+ catch( Exception& )
-+ {
-+ }
-+}
-
-diff --git sc/source/filter/xml/xmlexprt.cxx sc/source/filter/xml/xmlexprt.cxx
-index 4572ba5..d977dbc 100644
---- sc/source/filter/xml/xmlexprt.cxx
-+++ sc/source/filter/xml/xmlexprt.cxx
-@@ -3222,7 +3222,34 @@ void ScXMLExport::ExportShape(const uno::Reference < drawing::XShape >& xShape,
- }
- }
- if (!bIsChart)
-+ {
-+ // #i66550 HLINK_FOR_SHAPES
-+ rtl::OUString sHlink;
-+ uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY );
-+ if ( xProps.is() )
-+ xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_HYPERLINK ) ) ) >>= sHlink;
-+
-+ std::auto_ptr< SvXMLElementExport > pDrawA;
-+ // enlose shapes with <draw:a> element only if sHlink contains something
-+ if ( sHlink.getLength() > 0 )
-+ {
-+ // need to get delete the attributes that are pre-loaded
-+ // for the shape export ( otherwise they will become
-+ // attributes of the draw:a element ) This *shouldn't*
-+ // affect performance adversely as there are only a
-+ // couple of attributes involved
-+ uno::Reference< xml::sax::XAttributeList > xSaveAttribs( new SvXMLAttributeList( GetAttrList() ) );
-+ ClearAttrList();
-+ // Add Hlink
-+ AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
-+ AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, sHlink);
-+ pDrawA.reset( new SvXMLElementExport( *this, XML_NAMESPACE_DRAW, XML_A, sal_False, sal_False ) );
-+ // Attribute list has been cleared by previous operation
-+ // re-add pre-loaded attributes
-+ AddAttributeList( xSaveAttribs );
-+ }
- GetShapeExport()->exportShape(xShape, SEF_DEFAULT, pPoint);
-+ }
- IncrementProgressBar(sal_False);
- }
-
-diff --git sc/source/ui/attrdlg/scdlgfact.cxx sc/source/ui/attrdlg/scdlgfact.cxx
-index 3d261aa..901f317 100644
---- sc/source/ui/attrdlg/scdlgfact.cxx
-+++ sc/source/ui/attrdlg/scdlgfact.cxx
-@@ -80,6 +80,8 @@
- #include "tpusrlst.hxx" //add for ScTpUserLists
- #include "tpview.hxx" //add for ScTpContentOptions
- #include "tpformula.hxx"
-+//for dataform
-+#include "datafdlg.hxx" //add for ScDataFormDlg
-
- // ause
- #include "editutil.hxx"
-@@ -93,6 +95,8 @@ IMPL_ABSTDLG_BASE(AbstractScDataPilotDatabaseDlg_Impl); //add for ScDataPilotDat
- IMPL_ABSTDLG_BASE(AbstractScDataPilotSourceTypeDlg_Impl); //add for ScDataPilotSourceTypeDlg
- IMPL_ABSTDLG_BASE(AbstractScDataPilotServiceDlg_Impl); //add for ScDataPilotServiceDlg
- IMPL_ABSTDLG_BASE(AbstractScDeleteCellDlg_Impl); //add for ScDeleteCellDlg
-+//for dataform
-+IMPL_ABSTDLG_BASE(AbstractScDataFormDlg_Impl); //add for ScDataFormDlg
- IMPL_ABSTDLG_BASE(AbstractScDeleteContentsDlg_Impl); //add for ScDeleteContentsDlg
- IMPL_ABSTDLG_BASE(AbstractScFillSeriesDlg_Impl); //add for ScFillSeriesDlg
- IMPL_ABSTDLG_BASE(AbstractScGroupDlg_Impl); //add for ScGroupDlg
-@@ -864,6 +868,26 @@ AbstractScDeleteCellDlg* ScAbstractDialogFactory_Impl::CreateScDeleteCellDlg( Wi
-
- //add for ScDeleteCellDlg end
-
-+//add for ScDataFormDlg begin
-+AbstractScDataFormDlg* ScAbstractDialogFactory_Impl::CreateScDataFormDlg( Window* pParent, int nId, ScTabViewShell* pTabViewShell )
-+{
-+ ScDataFormDlg * pDlg=NULL;
-+ switch ( nId )
-+ {
-+ case RID_SCDLG_DATAFORM :
-+ pDlg = new ScDataFormDlg( pParent, pTabViewShell);
-+ break;
-+ default:
-+ break;
-+ }
-+
-+ if ( pDlg )
-+ return new AbstractScDataFormDlg_Impl( pDlg );
-+ return 0;
-+}
-+
-+//add for ScDataFormDlg end
-+
- //add for ScDeleteContentsDlg begin
- AbstractScDeleteContentsDlg* ScAbstractDialogFactory_Impl::CreateScDeleteContentsDlg(Window* pParent,int nId, //add for ScDeleteContentsDlg
- USHORT nCheckDefaults )
-diff --git sc/source/ui/attrdlg/scdlgfact.hxx sc/source/ui/attrdlg/scdlgfact.hxx
-index d8ae113..1174723 100644
---- sc/source/ui/attrdlg/scdlgfact.hxx
-+++ sc/source/ui/attrdlg/scdlgfact.hxx
-@@ -37,6 +37,7 @@ class ScDataPilotDatabaseDlg;
- class ScDataPilotSourceTypeDlg;
- class ScDataPilotServiceDlg;
- class ScDeleteCellDlg;
-+class ScDataFormDlg;
- class ScDeleteContentsDlg;
- class ScFillSeriesDlg;
- class ScGroupDlg;
-@@ -164,6 +165,12 @@ class AbstractScDeleteCellDlg_Impl : public AbstractScDeleteCellDlg //add for S
- virtual DelCellCmd GetDelCellCmd() const;
- };
-
-+//for dataform
-+class AbstractScDataFormDlg_Impl : public AbstractScDataFormDlg //add for ScDataFormDlg
-+{
-+ DECL_ABSTDLG_BASE(AbstractScDataFormDlg_Impl,ScDataFormDlg);
-+};
-+
- class AbstractScDeleteContentsDlg_Impl : public AbstractScDeleteContentsDlg //add for ScDeleteContentsDlg
- {
- DECL_ABSTDLG_BASE( AbstractScDeleteContentsDlg_Impl,ScDeleteContentsDlg)
-@@ -427,6 +434,9 @@ public:
- virtual AbstractScDeleteCellDlg * CreateScDeleteCellDlg( Window* pParent, int nId,
- BOOL bDisallowCellMove = FALSE ); //add for ScDeleteCellDlg
-
-+ //for dataform
-+ virtual AbstractScDataFormDlg * CreateScDataFormDlg( Window* pParent, int nId, ScTabViewShell* pTabViewShell); //add for ScDeleteCellDlg
-+
- virtual AbstractScDeleteContentsDlg * CreateScDeleteContentsDlg(Window* pParent,int nId, //add for ScDeleteContentsDlg
- USHORT nCheckDefaults = 0 );
-
-diff --git sc/source/ui/docshell/docfunc.cxx sc/source/ui/docshell/docfunc.cxx
-index cb2cb0f..8776518 100644
---- sc/source/ui/docshell/docfunc.cxx
-+++ sc/source/ui/docshell/docfunc.cxx
-@@ -110,6 +110,7 @@ using namespace com::sun::star;
- using ::com::sun::star::uno::Sequence;
- using ::std::vector;
-
-+
- // STATIC DATA -----------------------------------------------------------
-
- //========================================================================
-@@ -4225,6 +4226,13 @@ BOOL ScDocFunc::FillSeries( const ScRange& rRange, const ScMarkData* pTabMark,
- BOOL ScDocFunc::FillAuto( ScRange& rRange, const ScMarkData* pTabMark,
- FillDir eDir, ULONG nCount, BOOL bRecord, BOOL bApi )
- {
-+ double fStep = 1.0;
-+ double fMax = MAXDOUBLE;
-+ return FillAuto( rRange, pTabMark, eDir, FILL_AUTO, FILL_DAY, nCount, fStep, fMax, bRecord, bApi );
-+}
-+
-+BOOL ScDocFunc::FillAuto( ScRange& rRange, const ScMarkData* pTabMark, FillDir eDir, FillCmd eCmd, FillDateCmd eDateCmd, ULONG nCount, double fStep, double fMax, BOOL bRecord, BOOL bApi )
-+{
- ScDocShellModificator aModificator( rDocShell );
-
- ScDocument* pDoc = rDocShell.GetDocument();
-@@ -4250,10 +4258,6 @@ BOOL ScDocFunc::FillAuto( ScRange& rRange, const ScMarkData* pTabMark,
- ScRange aSourceArea = rRange;
- ScRange aDestArea = rRange;
-
-- FillCmd eCmd = FILL_AUTO;
-- FillDateCmd eDateCmd = FILL_DAY;
-- double fStep = 1.0;
-- double fMax = MAXDOUBLE;
-
- switch (eDir)
- {
-diff --git sc/source/ui/docshell/docsh.cxx sc/source/ui/docshell/docsh.cxx
-index 8d49218..ef33f94 100644
---- sc/source/ui/docshell/docsh.cxx
-+++ sc/source/ui/docshell/docsh.cxx
-@@ -123,9 +123,16 @@
- #include <rtl/logfile.hxx>
-
- #include <comphelper/processfactory.hxx>
-+#include "uiitems.hxx"
-+#include "cellsuno.hxx"
-+#include <com/sun/star/document/XVbaEventsHelper.hpp>
-+#include <com/sun/star/document/VbaEventId.hpp>
- #include <basic/sbstar.hxx>
- #include <basic/basmgr.hxx>
- using namespace com::sun::star;
-+using namespace com::sun::star::document::VbaEventId;
-+
-+using namespace com::sun::star;
- using ::rtl::OUString;
- using ::rtl::OUStringBuffer;
-
-@@ -271,7 +278,12 @@ sal_uInt16 ScDocShell::GetHiddenInformationState( sal_uInt16 nStates )
- void ScDocShell::BeforeXMLLoading()
- {
- aDocument.DisableIdle( TRUE );
--
-+ // suppress VBA events when loading the xml
-+ uno::Reference< document::XVbaEventsHelper > xEvt( aDocument.GetVbaEventsHelper() );
-+ if ( xEvt.is() )
-+ xEvt->setIgnoreEvents( sal_True );
-+
-+// if VBA enabled then we need to
- // prevent unnecessary broadcasts and updates
- DBG_ASSERT(pModificator == NULL, "The Modificator should not exist");
- pModificator = new ScDocShellModificator( *this );
-@@ -377,6 +389,12 @@ void ScDocShell::AfterXMLLoading(sal_Bool bRet)
- BasicManager* pAppMgr = SFX_APP()->GetBasicManager();
- if ( pAppMgr )
- pAppMgr->SetGlobalUNOConstant( "ThisExcelDoc", aArgs[ 0 ] );
-+#if 0 // this should be controlled by a compatibility mode
-+ // suppress VBA events when loading the xml
-+ uno::Reference< document::XVbaEventsHelper > xEvt( aDocument.GetVbaEventsHelper() );
-+ if ( xEvt.is() )
-+ xEvt->setIgnoreEvents( sal_False );
-+#endif
- #endif
- aDocument.SetImportingXML( FALSE );
- aDocument.EnableExecuteLink( true );
-@@ -520,9 +538,71 @@ BOOL __EXPORT ScDocShell::Load( SfxMedium& rMedium )
- return bRet;
- }
-
-+void lcl_processCompatibleSfxHint( uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper, const SfxHint& rHint )
-+{
-+ if (rHint.ISA(ScTablesHint) )
-+ {
-+ USHORT nId = ((ScTablesHint&)rHint).GetId();
-+ SCTAB nTab = ((ScTablesHint&)rHint).GetTab1();
-+ if( nId == SC_TAB_INSERTED )
-+ {
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] <<= nTab;
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_NEWSHEET, aArgs );
-+ }
-+ }
-+ else if ( rHint.ISA( SfxEventHint ) )
-+ {
-+ ULONG nEventId = ((SfxEventHint&)rHint).GetEventId();
-+ switch ( nEventId )
-+ {
-+ case SFX_EVENT_ACTIVATEDOC:
-+ {
-+ uno::Sequence< uno::Any > aArgs;
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_ACTIVATE, aArgs );
-+ }
-+ break;
-+ case SFX_EVENT_DEACTIVATEDOC:
-+ {
-+ uno::Sequence< uno::Any > aArgs;
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_DEACTIVATE, aArgs );
-+ }
-+ break;
-+ /*case SFX_EVENT_CLOSEDOC :
-+ {
-+ uno::Sequence< uno::Any > aArgs;
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_CLOSE, aArgs );
-+ }
-+ break;
-+ case SFX_EVENT_CLOSEVIEW :
-+ {
-+ uno::Sequence< uno::Any > aArgs;
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_WINDOWCOLSE, aArgs );
-+ }
-+ break;
-+ */
-+ case SFX_EVENT_OPENDOC:
-+ {
-+ // some later than workbook activate.
-+ uno::Sequence< uno::Any > aArgs;
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_OPEN, aArgs );
-+ }
-+ break;
-+ default:
-+ {
-+ }
-+ break;
-+ }
-+ }
-+}
-
- void __EXPORT ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
- {
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper ( aDocument.GetVbaEventsHelper(), uno::UNO_QUERY );
-+ if ( xVbaEventsHelper.is() )
-+ {
-+ lcl_processCompatibleSfxHint( xVbaEventsHelper, rHint );
-+ }
- if (rHint.ISA(SfxSimpleHint)) // ohne Parameter
- {
- ULONG nSlot = ((const SfxSimpleHint&)rHint).GetId();
-@@ -2225,6 +2305,16 @@ USHORT __EXPORT ScDocShell::PrepareClose( BOOL bUI, BOOL bForBrowsing )
-
- DoEnterHandler();
-
-+ // start handler for possible veto from DocBefore_Close
-+ uno::Sequence< uno::Any > aArgs;
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper ( aDocument.GetVbaEventsHelper(), uno::UNO_QUERY );
-+ if ( !IsInPrepareClose() && xVbaEventsHelper.is() )
-+ {
-+ if ( xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_BEFORECLOSE, aArgs ) )
-+ return sal_False;
-+ }
-+ // end handler code
-+
- USHORT nRet = SfxObjectShell::PrepareClose( bUI, bForBrowsing );
- if (nRet == TRUE) // TRUE = schliessen
- aDocument.DisableIdle(TRUE); // nicht mehr drin rumpfuschen !!!
-diff --git sc/source/ui/docshell/docsh5.cxx sc/source/ui/docshell/docsh5.cxx
-index aa3ca3e..82e797e 100644
---- sc/source/ui/docshell/docsh5.cxx
-+++ sc/source/ui/docshell/docsh5.cxx
-@@ -857,6 +857,47 @@ SCTAB ScDocShell::MakeScenario( SCTAB nTab, const String& rName, const String& r
- return nTab;
- }
-
-+ULONG ScDocShell::TransferTab( ScDocShell& rSrcDocShell, SCTAB nSrcPos,
-+ SCTAB nDestPos, BOOL bInsertNew,
-+ BOOL bNotifyAndPaint )
-+{
-+ ScDocument* pSrcDoc = rSrcDocShell.GetDocument();
-+
-+ ULONG nErrVal = aDocument.TransferTab( pSrcDoc, nSrcPos, nDestPos,
-+ bInsertNew ); // no insert
-+
-+ // TransferTab doesn't copy drawing objects with bInsertNew=FALSE
-+ if ( nErrVal > 0 && !bInsertNew)
-+ aDocument.TransferDrawPage( pSrcDoc, nSrcPos, nDestPos );
-+
-+ if(nErrVal>0 && pSrcDoc->IsScenario( nSrcPos ))
-+ {
-+ String aComment;
-+ Color aColor;
-+ USHORT nFlags;
-+
-+ pSrcDoc->GetScenarioData( nSrcPos, aComment,aColor, nFlags);
-+ aDocument.SetScenario(nDestPos,TRUE);
-+ aDocument.SetScenarioData(nDestPos,aComment,aColor,nFlags);
-+ BOOL bActive = pSrcDoc->IsActiveScenario(nSrcPos);
-+ aDocument.SetActiveScenario(nDestPos, bActive );
-+
-+ BOOL bVisible=pSrcDoc->IsVisible(nSrcPos);
-+ aDocument.SetVisible(nDestPos,bVisible );
-+
-+ }
-+
-+ if ( nErrVal > 0 && pSrcDoc->IsTabProtected( nSrcPos ) )
-+ aDocument.SetTabProtection(nDestPos, pSrcDoc->GetTabProtection(nSrcPos));
-+ if ( bNotifyAndPaint )
-+ {
-+ Broadcast( ScTablesHint( SC_TAB_INSERTED, nDestPos ) );
-+ PostPaintExtras();
-+ PostPaintGridAll();
-+ }
-+ return nErrVal;
-+}
-+
- BOOL ScDocShell::MoveTable( SCTAB nSrcTab, SCTAB nDestTab, BOOL bCopy, BOOL bRecord )
- {
- ScDocShellModificator aModificator( *this );
-diff --git sc/source/ui/docshell/macromgr.cxx sc/source/ui/docshell/macromgr.cxx
-new file mode 100644
-index 0000000..97623f3
---- /dev/null
-+++ sc/source/ui/docshell/macromgr.cxx
-@@ -0,0 +1,217 @@
-+/*************************************************************************
-+ *
-+ * 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: document.hxx,v $
-+ * $Revision: 1.115.36.9 $
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_sc.hxx"
-+
-+// INCLUDE ---------------------------------------------------------------
-+
-+#include "macromgr.hxx"
-+#include "document.hxx"
-+
-+#include "basic/basmgr.hxx"
-+#include "cppuhelper/implbase1.hxx"
-+#include "sfx2/objsh.hxx"
-+#include "cell.hxx"
-+#include <com/sun/star/container/XContainer.hpp>
-+
-+#include <list>
-+
-+using namespace ::com::sun::star;
-+using ::com::sun::star::uno::RuntimeException;
-+using ::com::sun::star::uno::Reference;
-+using ::rtl::OUString;
-+using ::rtl::OUStringHash;
-+using ::std::hash_map;
-+using ::std::list;
-+using ::std::for_each;
-+using ::std::pair;
-+
-+// ============================================================================
-+
-+/**
-+ * A simple container to keep track of cells that depend on basic modules
-+ * changes. We don't check for duplicates at insertion time; instead, we
-+ * remove duplicates at query time.
-+ */
-+class ScUserMacroDepTracker
-+{
-+public:
-+ void addCell(const OUString& rModuleName, ScFormulaCell* pCell)
-+ {
-+ ModuleCellMap::iterator itr = maCells.find(rModuleName);
-+ if (itr == maCells.end())
-+ {
-+ pair<ModuleCellMap::iterator, bool> r = maCells.insert(
-+ ModuleCellMap::value_type(rModuleName, list<ScFormulaCell*>()));
-+
-+ if (!r.second)
-+ // insertion failed.
-+ return;
-+
-+ itr = r.first;
-+ }
-+ itr->second.push_back(pCell);
-+ }
-+
-+ void removeCell(ScFormulaCell* pCell)
-+ {
-+ ModuleCellMap::iterator itr = maCells.begin(), itrEnd = maCells.end();
-+ for (; itr != itrEnd; ++itr)
-+ itr->second.remove(pCell);
-+ }
-+
-+ void getCellsByModule(const OUString& rModuleName, list<ScFormulaCell*>& rCells)
-+ {
-+ ModuleCellMap::iterator itr = maCells.find(rModuleName);
-+ if (itr == maCells.end())
-+ return;
-+
-+ list<ScFormulaCell*>& rCellList = itr->second;
-+
-+ // Remove duplicates.
-+ rCellList.sort();
-+ rCellList.unique();
-+ // exception safe copy
-+ list<ScFormulaCell*> temp(rCellList);
-+ rCells.swap(temp);
-+ }
-+
-+private:
-+ typedef hash_map<OUString, list<ScFormulaCell*>, OUStringHash> ModuleCellMap;
-+ ModuleCellMap maCells;
-+};
-+
-+
-+// ============================================================================
-+
-+ScMacroManager::ScMacroManager(ScDocument* pDoc) :
-+ mpDepTracker(new ScUserMacroDepTracker),
-+ mpDoc(pDoc)
-+{
-+}
-+
-+ScMacroManager::~ScMacroManager()
-+{
-+}
-+
-+typedef ::cppu::WeakImplHelper1< ::com::sun::star::container::XContainerListener > ContainerListenerHelper;
-+
-+class VBAProjectListener : public ContainerListenerHelper
-+{
-+ ScMacroManager* mpMacroMgr;
-+public:
-+ VBAProjectListener( ScMacroManager* pMacroMgr ) : mpMacroMgr( pMacroMgr ) {}
-+ // XEventListener
-+ virtual void SAL_CALL disposing( const lang::EventObject& /*Source*/ ) throw(RuntimeException) {}
-+
-+ // XContainerListener
-+ virtual void SAL_CALL elementInserted( const container::ContainerEvent& /*Event*/ ) throw(RuntimeException){}
-+ virtual void SAL_CALL elementReplaced( const container::ContainerEvent& Event ) throw(RuntimeException)
-+ {
-+ rtl::OUString sModuleName;
-+ Event.Accessor >>= sModuleName;
-+ OSL_TRACE("VBAProjectListener::elementReplaced(%s)", rtl::OUStringToOString( sModuleName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ mpMacroMgr->InitUserFuncData();
-+ mpMacroMgr->BroadcastModuleUpdate(sModuleName);
-+ }
-+ virtual void SAL_CALL elementRemoved( const container::ContainerEvent& /*Event*/ ) throw(RuntimeException){}
-+
-+};
-+
-+void ScMacroManager::InitUserFuncData()
-+{
-+ // Clear hash_map
-+ mhFuncToVolatile.clear();
-+ String sProjectName( RTL_CONSTASCII_USTRINGPARAM("Standard") );
-+
-+ Reference< container::XContainer > xModuleContainer;
-+ SfxObjectShell* pShell = mpDoc->GetDocumentShell();
-+ if ( pShell && pShell->GetBasicManager()->GetName().Len() > 0 )
-+ sProjectName = pShell->GetBasicManager()->GetName();
-+ try
-+ {
-+ Reference< script::XLibraryContainer > xLibraries( pShell->GetBasicContainer(), uno::UNO_QUERY_THROW );
-+ xModuleContainer.set( xLibraries->getByName( sProjectName ), uno::UNO_QUERY_THROW );
-+
-+ if ( xModuleContainer.is() )
-+ {
-+ // remove old listener ( if there was one )
-+ if ( mxContainerListener.is() )
-+ xModuleContainer->removeContainerListener( mxContainerListener );
-+ // Create listener
-+ mxContainerListener = new VBAProjectListener( this );
-+ xModuleContainer->addContainerListener( mxContainerListener );
-+ }
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+}
-+
-+void ScMacroManager::SetUserFuncVolatile( const OUString& sName, bool isVolatile )
-+{
-+ mhFuncToVolatile[ sName ] = isVolatile;
-+}
-+
-+bool ScMacroManager::GetUserFuncVolatile( const OUString& sName )
-+{
-+ NameBoolMap::iterator it = mhFuncToVolatile.find( sName );
-+ if ( it == mhFuncToVolatile.end() )
-+ return false;
-+ return it->second;
-+}
-+
-+void ScMacroManager::AddDependentCell(const OUString& aModuleName, ScFormulaCell* pCell)
-+{
-+ mpDepTracker->addCell(aModuleName, pCell);
-+}
-+
-+void ScMacroManager::RemoveDependentCell(ScFormulaCell* pCell)
-+{
-+ mpDepTracker->removeCell(pCell);
-+}
-+
-+void ScMacroManager::BroadcastModuleUpdate(const OUString& aModuleName)
-+{
-+ list<ScFormulaCell*> aCells;
-+ mpDepTracker->getCellsByModule(aModuleName, aCells);
-+ list<ScFormulaCell*>::iterator itr = aCells.begin(), itrEnd = aCells.end();
-+ for (; itr != itrEnd; ++itr)
-+ {
-+ ScFormulaCell* pCell = *itr;
-+ mpDoc->PutInFormulaTree(pCell); // for F9 recalc
-+
-+ // for recalc on cell value change. If the cell is not volatile, the
-+ // cell stops listening right away after it gets re-interpreted.
-+ mpDoc->StartListeningArea(BCA_LISTEN_ALWAYS, pCell);
-+ }
-+}
-+
-diff --git sc/source/ui/docshell/makefile.mk sc/source/ui/docshell/makefile.mk
-index 99a7495..6851f78 100644
---- sc/source/ui/docshell/makefile.mk
-+++ sc/source/ui/docshell/makefile.mk
-@@ -91,7 +91,8 @@ SLOFILES = \
- $(SLO)$/hiranges.obj \
- $(SLO)$/pntlock.obj \
- $(SLO)$/sizedev.obj \
-- $(SLO)$/editable.obj
-+ $(SLO)$/editable.obj \
-+ $(SLO)$/macromgr.obj
-
-
- EXCEPTIONSFILES= \
-@@ -101,7 +102,8 @@ EXCEPTIONSFILES= \
- $(SLO)$/docsh8.obj \
- $(SLO)$/externalrefmgr.obj \
- $(SLO)$/dbdocimp.obj \
-- $(SLO)$/docfunc.obj
-+ $(SLO)$/docfunc.obj \
-+ $(SLO)$/macromgr.obj
-
- SRS1NAME=$(TARGET)
- SRC1FILES = tpstat.src
-@@ -131,7 +133,8 @@ LIB1OBJFILES = \
- $(SLO)$/hiranges.obj \
- $(SLO)$/pntlock.obj \
- $(SLO)$/sizedev.obj \
-- $(SLO)$/editable.obj
-+ $(SLO)$/editable.obj \
-+ $(SLO)$/macromgr.obj
-
- # --- Tagets -------------------------------------------------------
-
-diff --git sc/source/ui/drawfunc/drawsh.cxx sc/source/ui/drawfunc/drawsh.cxx
-index d1ab807..04248ae 100644
---- sc/source/ui/drawfunc/drawsh.cxx
-+++ sc/source/ui/drawfunc/drawsh.cxx
-@@ -208,7 +208,6 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq )
- ExecuteTextAttrDlg( rReq );
- break;
-
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
- case SID_DRAW_HLINK_EDIT:
- if ( pSingleSelectedObj )
- pViewData->GetDispatcher().Execute( SID_HYPERLINK_DIALOG );
-@@ -236,7 +235,6 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq )
- ScGlobal::OpenURL( pInfo->GetHlink(), String::EmptyString() );
- }
- break;
--#endif
-
- case SID_ATTR_TRANSFORM:
- {
-@@ -489,7 +487,6 @@ void ScDrawShell::ExecuteTextAttrDlg( SfxRequest& rReq, USHORT /* nTabPage */ )
- delete( pDlg );
- }
-
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
- void ScDrawShell::SetHlinkForObject( SdrObject* pObj, const rtl::OUString& rHlnk )
- {
- if ( pObj )
-@@ -499,5 +496,4 @@ void ScDrawShell::SetHlinkForObject( SdrObject* pObj, const rtl::OUString& rHlnk
- lcl_setModified( GetObjectShell() );
- }
- }
--#endif
-
-diff --git sc/source/ui/drawfunc/drawsh2.cxx sc/source/ui/drawfunc/drawsh2.cxx
-index 7d1392b..05a7930 100644
---- sc/source/ui/drawfunc/drawsh2.cxx
-+++ sc/source/ui/drawfunc/drawsh2.cxx
-@@ -197,24 +197,20 @@ void ScDrawShell::GetDrawFuncState( SfxItemSet& rSet ) // Funktionen disablen
- BOOL bCanRename = FALSE;
- if ( nMarkCount > 1 )
- {
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
- // no hypelink options for a selected group
- rSet.DisableItem( SID_DRAW_HLINK_EDIT );
- rSet.DisableItem( SID_DRAW_HLINK_DELETE );
- rSet.DisableItem( SID_OPEN_HYPERLINK );
--#endif
- }
- else if ( nMarkCount == 1 )
- {
- SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
- ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( pObj );
- if ( !pInfo || (pInfo->GetHlink().getLength() == 0) )
- {
- rSet.DisableItem( SID_DRAW_HLINK_DELETE );
- rSet.DisableItem( SID_OPEN_HYPERLINK );
- }
--#endif
- SdrLayerID nLayerID = pObj->GetLayer();
- if ( nLayerID != SC_LAYER_INTERN )
- bCanRename = TRUE; // #i51351# anything except internal objects can be renamed
-diff --git sc/source/ui/drawfunc/drawsh5.cxx sc/source/ui/drawfunc/drawsh5.cxx
-index 2908af8..cb2e019 100644
---- sc/source/ui/drawfunc/drawsh5.cxx
-+++ sc/source/ui/drawfunc/drawsh5.cxx
-@@ -92,14 +92,12 @@ void ScDrawShell::GetHLinkState( SfxItemSet& rSet ) // Hyperlink
- if ( nMarkCount == 1 ) // URL-Button markiert ?
- {
- SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
- ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( pObj );
- if ( pInfo && (pInfo->GetHlink().getLength() > 0) )
- {
- aHLinkItem.SetURL( pInfo->GetHlink() );
- aHLinkItem.SetInsertMode(HLINK_FIELD);
- }
--#endif
- SdrUnoObj* pUnoCtrl = PTR_CAST(SdrUnoObj, pObj);
- if (pUnoCtrl && FmFormInventor == pUnoCtrl->GetObjInventor())
- {
-@@ -242,13 +240,11 @@ void ScDrawShell::ExecuteHLink( SfxRequest& rReq )
- bDone = TRUE;
- }
- }
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
- else
- {
- SetHlinkForObject( pObj, rURL );
- bDone = TRUE;
- }
--#endif
- }
- }
-
-diff --git sc/source/ui/drawfunc/fudraw.cxx sc/source/ui/drawfunc/fudraw.cxx
-index 4cbd08d..ee901e2 100644
---- sc/source/ui/drawfunc/fudraw.cxx
-+++ sc/source/ui/drawfunc/fudraw.cxx
-@@ -828,11 +828,7 @@ void FuDraw::ForcePointer(const MouseEvent* pMEvt)
- SdrObjMacroHitRec aHitRec; //! muss da noch irgendwas gesetzt werden ????
- pViewShell->SetActivePointer( pObj->GetMacroPointer(aHitRec) );
- }
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
- else if ( !bAlt && pInfo && ((pInfo->GetMacro().getLength() > 0) || (pInfo->GetHlink().getLength() > 0)) )
--#else
-- else if ( !bAlt && pInfo && (pInfo->GetMacro().getLength() > 0) )
--#endif
- pWindow->SetPointer( Pointer( POINTER_REFHAND ) );
- else if ( IsDetectiveHit( aPnt ) )
- pViewShell->SetActivePointer( Pointer( POINTER_DETECTIVE ) );
-diff --git sc/source/ui/drawfunc/fusel.cxx sc/source/ui/drawfunc/fusel.cxx
-index 2c284d3..538cf1f 100644
---- sc/source/ui/drawfunc/fusel.cxx
-+++ sc/source/ui/drawfunc/fusel.cxx
-@@ -202,7 +202,6 @@ BOOL __EXPORT FuSelection::MouseButtonDown(const MouseEvent& rMEvt)
- }
-
- ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( pObj, TRUE );
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
- // For interoperability favour links over macros if both are defined
- if ( pInfo->GetHlink().getLength() > 0 )
- {
-@@ -210,20 +209,27 @@ BOOL __EXPORT FuSelection::MouseButtonDown(const MouseEvent& rMEvt)
- sURL = pInfo->GetHlink();
- }
- else if ( pInfo->GetMacro().getLength() > 0 )
--#else
-- if ( pInfo->GetMacro().getLength() > 0 )
--#endif
- {
- SfxObjectShell* pObjSh = SfxObjectShell::Current();
- if ( pObjSh && SfxApplication::IsXScriptURL( pInfo->GetMacro() ) )
- {
-+ uno::Reference< beans::XPropertySet > xProps( pObj->getUnoShape(), uno::UNO_QUERY );
-+ uno::Any aCaller;
-+ if ( xProps.is() )
-+ {
-+ try
-+ {
-+ aCaller = xProps->getPropertyValue( rtl::OUString::createFromAscii("Name") );
-+ }
-+ catch( uno::Exception& ) {}
-+ }
- uno::Any aRet;
- uno::Sequence< sal_Int16 > aOutArgsIndex;
- uno::Sequence< uno::Any > aOutArgs;
- uno::Sequence< uno::Any >* pInArgs =
- new uno::Sequence< uno::Any >(0);
- pObjSh->CallXScript( pInfo->GetMacro(),
-- *pInArgs, aRet, aOutArgsIndex, aOutArgs);
-+ *pInArgs, aRet, aOutArgsIndex, aOutArgs, true, &aCaller );
- pViewShell->FakeButtonUp( pViewShell->GetViewData()->GetActivePart() );
- return TRUE; // kein CaptureMouse etc.
- }
-diff --git sc/source/ui/drawfunc/makefile.mk sc/source/ui/drawfunc/makefile.mk
-index a50c450..f82008e 100644
---- sc/source/ui/drawfunc/makefile.mk
-+++ sc/source/ui/drawfunc/makefile.mk
-@@ -75,6 +75,7 @@ SLOFILES = \
- $(SLO)$/mediash.obj
-
- EXCEPTIONSFILES= \
-+ $(SLO)$/fusel.obj \
- $(SLO)$/fuins2.obj \
- $(SLO)$/graphsh.obj \
- $(SLO)$/mediash.obj
-diff --git sc/source/ui/drawfunc/objdraw.src sc/source/ui/drawfunc/objdraw.src
-index 81d1e2c..9fb1b96 100644
---- sc/source/ui/drawfunc/objdraw.src
-+++ sc/source/ui/drawfunc/objdraw.src
-@@ -186,7 +186,6 @@
- ITEM_FORMAT_PARA_DLG\
- };
-
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
- #define MN_EDITLNK \
- MenuItem\
- {\
-@@ -202,7 +201,6 @@
- HelpID = SID_DRAW_HLINK_DELETE ; \
- Text [ en-US ] = "~Remove Hyperlink" ; \
- };
--#endif
-
- #define MN_DRWTXTATTR \
- MenuItem\
-@@ -1297,14 +1295,12 @@ Menu RID_POPUP_DRAW
- MenuItem { Separator = TRUE ; };
- //------------------------------
- ITEM_GROUP_MENU
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
- //------------------------------
- MenuItem { Separator = TRUE ; };
- //------------------------------
- MN_EDITLNK
- MN_DELLNK
- MenuItem { ITEM_OPEN_HYPERLINK };
--#endif
- };
- };
-
-@@ -1374,14 +1370,12 @@ Menu RID_POPUP_GRAPHIC
- MenuItem { Separator = TRUE ; };
- //------------------------------
- ITEM_GROUP_MENU
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
- //------------------------------
- MenuItem { Separator = TRUE ; };
- //------------------------------
- MN_EDITLNK
- MN_DELLNK
- MenuItem { ITEM_OPEN_HYPERLINK };
--#endif
- };
- };
-
-diff --git sc/source/ui/inc/asciiopt.hxx sc/source/ui/inc/asciiopt.hxx
-index 0c6df4b..783650c 100644
---- sc/source/ui/inc/asciiopt.hxx
-+++ sc/source/ui/inc/asciiopt.hxx
-@@ -56,7 +56,7 @@
-
- // ============================================================================
-
--class ScAsciiOptions
-+class SC_DLLPUBLIC ScAsciiOptions
- {
- private:
- BOOL bFixedLen;
-diff --git sc/source/ui/inc/datafdlg.hrc sc/source/ui/inc/datafdlg.hrc
-new file mode 100644
-index 0000000..8fa8999
---- /dev/null
-+++ sc/source/ui/inc/datafdlg.hrc
-@@ -0,0 +1,49 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: datafdlg.hrc,v $
-+ *
-+ * $Revision: 1.00 $
-+ *
-+ * last change: $Author: rt $ $Date: 2005/09/08 21:37:12 $
-+ *
-+ * 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 "sc.hrc" // -> RID_SCDLG_DATAFORM
-+
-+//dataform
-+#define BTN_DATAFORM_NEW 1001
-+#define BTN_DATAFORM_DELETE 1002
-+#define BTN_DATAFORM_RESTORE 1003
-+#define BTN_DATAFORM_LAST 1004
-+#define BTN_DATAFORM_NEXT 1005
-+#define BTN_DATAFORM_CLOSE 1007
-+#define WND_DATAFORM_SCROLLBAR 1008
-+#define LAB_DATAFORM_RECORDNO 1009
-+
-+#define FT_DATAFORM_FIXEDTEXT1 2001
-+#define ED_DATAFORM_EDIT1 2002
-\ No newline at end of file
-diff --git sc/source/ui/inc/datafdlg.hxx sc/source/ui/inc/datafdlg.hxx
-new file mode 100644
-index 0000000..3e6d8e3
---- /dev/null
-+++ sc/source/ui/inc/datafdlg.hxx
-@@ -0,0 +1,121 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: datafdlg.hxx,v $
-+ *
-+ * $Revision: 1.00 $
-+ *
-+ * last change: $Author: rt $ $Date: 2005/09/08 21:20:35 $
-+ *
-+ * 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_DATAFDLG_HXX
-+#define SC_DATAFDLG_HXX
-+
-+
-+#ifndef _SV_DIALOG_HXX //autogen
-+#include <vcl/dialog.hxx>
-+#endif
-+
-+#ifndef _SV_BUTTON_HXX //autogen
-+#include <vcl/imagebtn.hxx>
-+#endif
-+
-+#ifndef _SV_FIXED_HXX //autogen
-+#include <vcl/fixed.hxx>
-+#endif
-+
-+
-+#include "global.hxx"
-+
-+#include <tabvwsh.hxx>
-+#include <sfx2/bindings.hxx>
-+#include <sfx2/dispatch.hxx>
-+
-+#define MAX_DATAFORM_COLS 256
-+#define MAX_DATAFORM_ROWS 32000
-+#define CTRL_HEIGHT 22
-+#define FIXED_WIDTH 60
-+#define EDIT_WIDTH 140
-+#define FIXED_LEFT 12
-+#define EDIT_LEFT 78
-+#define LINE_HEIGHT 30
-+
-+//zhangyun
-+class ScDataFormDlg : public ModalDialog
-+{
-+private:
-+
-+ PushButton aBtnNew;
-+ PushButton aBtnDelete;
-+ PushButton aBtnRestore;
-+ PushButton aBtnLast;
-+ PushButton aBtnNext;
-+ PushButton aBtnClose;
-+ ScrollBar aSlider;
-+ FixedText aFixedText;
-+ //FixedText aFixedText1;
-+ //Edit aEdit1;
-+
-+ ScTabViewShell* pTabViewShell;
-+ ScDocument* pDoc;
-+ sal_uInt16 aColLength;
-+ SCROW aCurrentRow;
-+ SCCOL nStartCol;
-+ SCCOL nEndCol;
-+ SCROW nStartRow;
-+ SCROW nEndRow;
-+ SCTAB nTab;
-+ BOOL bNoSelection;
-+
-+ FixedText** pFixedTexts;
-+ Edit** pEdits;
-+
-+public:
-+ ScDataFormDlg( Window* pParent, ScTabViewShell* pTabViewShell);
-+ ~ScDataFormDlg();
-+
-+ void FillCtrls(SCROW nCurrentRow);
-+private:
-+
-+ void SetButtonState();
-+
-+ // Handler:
-+ DECL_LINK( Impl_NewHdl, PushButton* );
-+ DECL_LINK( Impl_LastHdl, PushButton* );
-+ DECL_LINK( Impl_NextHdl, PushButton* );
-+
-+ DECL_LINK( Impl_RestoreHdl, PushButton* );
-+ DECL_LINK( Impl_DeleteHdl, PushButton* );
-+ DECL_LINK( Impl_CloseHdl, PushButton* );
-+
-+ DECL_LINK( Impl_ScrollHdl, ScrollBar* );
-+ DECL_LINK( Impl_DataModifyHdl, Edit* );
-+};
-+#endif // SC_DATAFDLG_HXX
-+
-+
-diff --git sc/source/ui/inc/docfunc.hxx sc/source/ui/inc/docfunc.hxx
-index 7f63499..3bb85c2 100644
---- sc/source/ui/inc/docfunc.hxx
-+++ sc/source/ui/inc/docfunc.hxx
-@@ -169,6 +169,8 @@ public:
- double fStart, double fStep, double fMax,
- BOOL bRecord, BOOL bApi );
- // FillAuto: rRange wird von Source-Range auf Dest-Range angepasst
-+ SC_DLLPUBLIC BOOL FillAuto( ScRange& rRange, const ScMarkData* pTabMark, FillDir eDir, FillCmd eCmd, FillDateCmd eDateCmd, ULONG nCount, double fStep, double fMax, BOOL bRecord, BOOL bApi );
-+
- BOOL FillAuto( ScRange& rRange, const ScMarkData* pTabMark,
- FillDir eDir, ULONG nCount, BOOL bRecord, BOOL bApi );
-
-diff --git sc/source/ui/inc/docsh.hxx sc/source/ui/inc/docsh.hxx
-index beb3e4e..bb17dc9 100644
---- sc/source/ui/inc/docsh.hxx
-+++ sc/source/ui/inc/docsh.hxx
-@@ -42,6 +42,7 @@
- #include "refreshtimer.hxx"
-
- #include <hash_map>
-+#include <cppuhelper/implbase1.hxx>
-
- class ScEditEngineDefaulter;
- class FontList;
-@@ -297,6 +298,10 @@ public:
- ScMarkData& rMark, BOOL bRecord = TRUE );
- void ModifyScenario( SCTAB nTab, const String& rName, const String& rComment,
- const Color& rColor, USHORT nFlags );
-+ ULONG TransferTab( ScDocShell& rSrcDocShell, SCTAB nSrcPos,
-+ SCTAB nDestPos, BOOL bInsertNew,
-+ BOOL bNotifyAndPaint );
-+
- BOOL MoveTable( SCTAB nSrcTab, SCTAB nDestTab, BOOL bCopy, BOOL bRecord );
-
- void DoRecalc( BOOL bApi );
-diff --git sc/source/ui/inc/drawsh.hxx sc/source/ui/inc/drawsh.hxx
-index 47ea4ce..5e6e568 100644
---- sc/source/ui/inc/drawsh.hxx
-+++ sc/source/ui/inc/drawsh.hxx
-@@ -44,9 +44,7 @@ class ScDrawShell : public SfxShell
-
- DECL_LINK( NameObjectHdl, AbstractSvxNameDialog* );
-
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
- void SetHlinkForObject( SdrObject* pObj, const rtl::OUString& rHlnk );
--#endif
-
- protected:
- ScViewData* GetViewData() { return pViewData; }
-diff --git sc/source/ui/inc/impex.hxx sc/source/ui/inc/impex.hxx
-index e28b34e..491d933 100644
---- sc/source/ui/inc/impex.hxx
-+++ sc/source/ui/inc/impex.hxx
-@@ -50,7 +50,7 @@ struct ScExportTextOptions
- bool mbAddQuotes;
- };
-
--class ScImportExport
-+class SC_DLLPUBLIC ScImportExport
- {
- ScDocShell* pDocSh;
- ScDocument* pDoc;
-diff --git sc/source/ui/inc/tabvwsh.hxx sc/source/ui/inc/tabvwsh.hxx
-index 91add9d..aba6f9d 100644
---- sc/source/ui/inc/tabvwsh.hxx
-+++ sc/source/ui/inc/tabvwsh.hxx
-@@ -252,7 +252,7 @@ public:
-
- virtual ~ScTabViewShell();
-
-- Window* GetDialogParent();
-+ SC_DLLPUBLIC Window* GetDialogParent();
-
- bool IsRefInputMode() const;
- void ExecuteInputDirect();
-@@ -298,7 +298,7 @@ public:
- void GetSaveState( SfxItemSet& rSet );
- void ExecSearch( SfxRequest& rReq );
-
-- void ExecuteUndo(SfxRequest& rReq);
-+ SC_DLLPUBLIC void ExecuteUndo(SfxRequest& rReq);
- void GetUndoState(SfxItemSet &rSet);
-
- void ExecuteSbx( SfxRequest& rReq );
-diff --git sc/source/ui/inc/undodat.hxx sc/source/ui/inc/undodat.hxx
-index 81da22e..cba77ef 100644
---- sc/source/ui/inc/undodat.hxx
-+++ sc/source/ui/inc/undodat.hxx
-@@ -528,7 +528,43 @@ private:
- void Init();
- };
-
-+// amelia
-+class ScUndoDataForm: public ScBlockUndo
-+{
-+public:
-+ TYPEINFO();
-+ ScUndoDataForm( ScDocShell* pNewDocShell,
-+ SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
-+ SCCOL nEndX, SCROW nEndY, SCTAB nEndZ,
-+ const ScMarkData& rMark,
-+ ScDocument* pNewUndoDoc, ScDocument* pNewRedoDoc,
-+ USHORT nNewFlags,
-+ ScRefUndoData* pRefData, void* pFill1, void* pFill2, void* pFill3,
-+ BOOL bRedoIsFilled = TRUE
-+ );
-+ virtual ~ScUndoDataForm();
-+
-+ virtual void Undo();
-+ virtual void Redo();
-+ virtual void Repeat(SfxRepeatTarget& rTarget);
-+ virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
-+
-+ virtual String GetComment() const;
-
-+private:
-+ ScMarkData aMarkData;
-+ ScDocument* pUndoDoc;
-+ ScDocument* pRedoDoc;
-+ USHORT nFlags;
-+ ScRefUndoData* pRefUndoData;
-+ ScRefUndoData* pRefRedoData;
-+ ULONG nStartChangeAction;
-+ ULONG nEndChangeAction;
-+ BOOL bRedoFilled;
-+
-+ void DoChange( const BOOL bUndo );
-+ void SetChangeTrack();
-+};
-
-
- #endif
-diff --git sc/source/ui/inc/viewfunc.hxx sc/source/ui/inc/viewfunc.hxx
-index 8a5aeee..6e9ec02 100644
---- sc/source/ui/inc/viewfunc.hxx
-+++ sc/source/ui/inc/viewfunc.hxx
-@@ -338,6 +338,13 @@ public:
- void ForgetFormatArea() { bFormatValid = FALSE; }
- BOOL SelectionEditable( BOOL* pOnlyNotBecauseOfMatrix = NULL );
-
-+ // Amelia Wang
-+ SC_DLLPUBLIC void DataFormPutData( SCROW nCurrentRow ,
-+ SCROW nStartRow , SCCOL nStartCol ,
-+ SCROW nEndRow , SCCOL nEndCol ,
-+ Edit** pEdits ,
-+ sal_uInt16 aColLength );
-+
- // interne Hilfsfunktionen
- protected:
- void UpdateLineAttrs( SvxBorderLine& rLine,
-diff --git sc/source/ui/miscdlgs/datafdlg.cxx sc/source/ui/miscdlgs/datafdlg.cxx
-new file mode 100644
-index 0000000..619355c
---- /dev/null
-+++ sc/source/ui/miscdlgs/datafdlg.cxx
-@@ -0,0 +1,422 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: datafdlg.cxx,v $
-+ *
-+ * $Revision: 1.00 $
-+ *
-+ * last change: $Author: kz $ $Date: 2006/07/21 14:04:33 $
-+ *
-+ * 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
-+ *
-+ ************************************************************************/
-+
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_sc.hxx"
-+
-+#undef SC_DLLIMPLEMENTATION
-+
-+//------------------------------------------------------------------
-+
-+#include "datafdlg.hxx"
-+#include "scresid.hxx"
-+#include "datafdlg.hrc"
-+#include "viewdata.hxx"
-+//#include "document.hxx"
-+#include "docsh.hxx"
-+#include "refundo.hxx"
-+#include "undodat.hxx"
-+
-+#define HDL(hdl) LINK( this, ScDataFormDlg, hdl )
-+
-+//zhangyun
-+ScDataFormDlg::ScDataFormDlg( Window* pParent, ScTabViewShell* pTabViewShellOri) :
-+ ModalDialog ( pParent, ScResId( RID_SCDLG_DATAFORM ) ),
-+ //
-+ aBtnNew ( this, ScResId( BTN_DATAFORM_NEW ) ),
-+ aBtnDelete ( this, ScResId( BTN_DATAFORM_DELETE ) ),
-+ aBtnRestore ( this, ScResId( BTN_DATAFORM_RESTORE ) ),
-+ aBtnLast ( this, ScResId( BTN_DATAFORM_LAST ) ),
-+ aBtnNext ( this, ScResId( BTN_DATAFORM_NEXT ) ),
-+ aBtnClose ( this, ScResId( BTN_DATAFORM_CLOSE ) ),
-+ aSlider ( this, ScResId( WND_DATAFORM_SCROLLBAR ) ),
-+ aFixedText ( this, ScResId( LAB_DATAFORM_RECORDNO ) )
-+{
-+ pTabViewShell = pTabViewShellOri;
-+ FreeResource();
-+ //read header form current document, and add new controls
-+ DBG_ASSERT( pTabViewShell, "pTabViewShell is NULL! :-/" );
-+ ScViewData* pViewData = pTabViewShell->GetViewData();
-+
-+ pDoc = pViewData->GetDocument();
-+ if (pDoc)
-+ {
-+ ScRange aRange;
-+ pViewData->GetSimpleArea( aRange );
-+ ScAddress aStart = aRange.aStart;
-+ ScAddress aEnd = aRange.aEnd;
-+
-+ nStartCol = aStart.Col();
-+ nEndCol = aEnd.Col();
-+ nStartRow = aStart.Row();
-+ nEndRow = aEnd.Row();
-+
-+ nTab = pViewData->GetTabNo();
-+ //if there is no selection
-+ if ((nStartCol == nEndCol) && (nStartRow == nEndRow))
-+ bNoSelection = TRUE;
-+
-+ if (bNoSelection)
-+ {
-+ //find last not blank cell in row
-+ for (int i=1;i<=MAX_DATAFORM_COLS;i++)
-+ {
-+ String aColName;
-+ nEndCol++;
-+ pDoc->GetString( nEndCol, nStartRow, nTab, aColName );
-+ int nColWidth = pDoc->GetColWidth( nEndCol, nTab );
-+ if ( aColName.Len() == 0 && nColWidth)
-+ {
-+ nEndCol--;
-+ break;
-+ }
-+ }
-+
-+ //find first not blank cell in row
-+ for (int i=1;i<=MAX_DATAFORM_COLS;i++)
-+ {
-+ String aColName;
-+ if (nStartCol <= 0)
-+ break;
-+ nStartCol--;
-+
-+ pDoc->GetString( nStartCol, nStartRow, nTab, aColName );
-+ int nColWidth = pDoc->GetColWidth( nEndCol, nTab );
-+ if ( aColName.Len() == 0 && nColWidth)
-+ {
-+ nStartCol++;
-+ break;
-+ }
-+ }
-+
-+ //skip leading hide column
-+ for (int i=1;i<=MAX_DATAFORM_COLS;i++)
-+ {
-+ String aColName;
-+ int nColWidth = pDoc->GetColWidth( nStartCol, nTab );
-+ if (nColWidth)
-+ break;
-+ nStartCol++;
-+ }
-+
-+ if (nEndCol < nStartCol)
-+ nEndCol = nStartCol;
-+
-+ //find last not blank cell in row
-+ for (int i=1;i<=MAX_DATAFORM_ROWS;i++)
-+ {
-+ String aColName;
-+ nEndRow++;
-+ pDoc->GetString( nStartCol, nEndRow, nTab, aColName );
-+ if ( aColName.Len() == 0 )
-+ {
-+ nEndRow--;
-+ break;
-+ }
-+ }
-+
-+ //find first not blank cell in row
-+ for (int i=1;i<=MAX_DATAFORM_ROWS;i++)
-+ {
-+ String aColName;
-+ if (nStartRow <= 0)
-+ break;
-+ nStartRow--;
-+
-+ pDoc->GetString( nStartCol, nStartRow, nTab, aColName );
-+ if ( aColName.Len() == 0 )
-+ {
-+ nStartRow++;
-+ break;
-+ }
-+ }
-+
-+ if (nEndRow < nStartRow)
-+ nEndRow = nStartRow;
-+ }
-+
-+ aCurrentRow = nStartRow + 1;
-+
-+ String aFieldName;
-+
-+ int nTop = 12;
-+
-+ Size nFixedSize(FIXED_WIDTH, CTRL_HEIGHT );
-+ Size nEditSize(EDIT_WIDTH, CTRL_HEIGHT );
-+
-+ //pFtArray = new FixedText(this);
-+ aColLength = nEndCol - nStartCol + 1;
-+
-+ //new the controls
-+ pFixedTexts = new FixedText*[aColLength];
-+ pEdits = new Edit*[aColLength];
-+
-+ for(sal_uInt16 nIndex = 0; nIndex < aColLength; nIndex++)
-+ {
-+ pDoc->GetString( nIndex + nStartCol, nStartRow, nTab, aFieldName );
-+ int nColWidth = pDoc->GetColWidth( nIndex + nStartCol, nTab );
-+ if (nColWidth)
-+ {
-+ pFixedTexts[nIndex] = new FixedText(this);
-+ pEdits[nIndex] = new Edit(this, WB_BORDER);
-+
-+ pFixedTexts[nIndex]->SetSizePixel(nFixedSize);
-+ pEdits[nIndex]->SetSizePixel(nEditSize);
-+ pFixedTexts[nIndex]->SetPosPixel(Point(FIXED_LEFT, nTop));
-+ pEdits[nIndex]->SetPosPixel(Point(EDIT_LEFT, nTop));
-+ //pFixedTexts[nIndex]->SetText(String::CreateFromAscii("W4W-Filter Nr. "));
-+ pFixedTexts[nIndex]->SetText(aFieldName);
-+ pFixedTexts[nIndex]->Show();
-+ pEdits[nIndex]->Show();
-+
-+ nTop += LINE_HEIGHT;
-+ }
-+ else
-+ {
-+ pFixedTexts[nIndex] = NULL;
-+ pEdits[nIndex] = NULL;
-+ }
-+ pEdits[nIndex]->SetModifyHdl( HDL(Impl_DataModifyHdl) );
-+ }
-+
-+ Size nDialogSize = this->GetSizePixel();
-+ if (nTop > nDialogSize.Height())
-+ {
-+ nDialogSize.setHeight(nTop);
-+ this->SetSizePixel(nDialogSize);
-+ }
-+ Size nScrollSize = aSlider.GetSizePixel();
-+ nScrollSize.setHeight(nDialogSize.Height()-20);
-+ aSlider.SetSizePixel(nScrollSize);
-+ }
-+
-+ FillCtrls(aCurrentRow);
-+
-+ aSlider.SetPageSize( 10 );
-+ aSlider.SetVisibleSize( 1 );
-+ aSlider.SetLineSize( 1 );
-+ aSlider.SetRange( Range( 0, nEndRow - nStartRow + 1) );
-+ aSlider.Show();
-+
-+ aBtnNew.SetClickHdl ( HDL(Impl_NewHdl) );
-+ aBtnLast.SetClickHdl ( HDL(Impl_LastHdl) );
-+ aBtnNext.SetClickHdl ( HDL(Impl_NextHdl) );
-+
-+ aBtnRestore.SetClickHdl ( HDL(Impl_RestoreHdl) );
-+ aBtnDelete.SetClickHdl ( HDL(Impl_DeleteHdl) );
-+ aBtnClose.SetClickHdl ( HDL(Impl_CloseHdl) );
-+
-+ aSlider.SetEndScrollHdl( HDL( Impl_ScrollHdl ) );
-+
-+ SetButtonState();
-+
-+ //end
-+ //FreeResource();
-+}
-+
-+ScDataFormDlg::~ScDataFormDlg()
-+{
-+ for(sal_uInt16 i = 0; i < aColLength; i++)
-+ {
-+ if (pEdits[i])
-+ delete pEdits[i];
-+ if (pFixedTexts[i])
-+ delete pFixedTexts[i];
-+ }
-+ if (pEdits)
-+ delete pEdits;
-+ if (pFixedTexts)
-+ delete pFixedTexts;
-+}
-+
-+void ScDataFormDlg::FillCtrls(SCROW /*nCurrentRow*/)
-+{
-+ //ScViewData* pViewData = pTabViewShell->GetViewData();
-+
-+ //pDoc = pViewData->GetDocument();
-+ String aFieldName;
-+ int nRecordNum = nEndRow - nStartRow;
-+ for(sal_uInt16 i = 0; i < aColLength; i++)
-+ {
-+ if (pEdits[i])
-+ {
-+ if (aCurrentRow<=nEndRow)
-+ {
-+ pDoc->GetString( i + nStartCol, aCurrentRow, nTab, aFieldName );
-+ pEdits[i]->SetText(aFieldName);
-+ }
-+ else
-+ pEdits[i]->SetText(String());
-+ }
-+ }
-+ char sRecordStr[256];
-+ if (aCurrentRow<=nEndRow)
-+ aFixedText.SetText(String::CreateFromAscii(sRecordStr));
-+ else
-+ aFixedText.SetText(String::CreateFromAscii("New Record"));
-+
-+ aSlider.SetThumbPos(aCurrentRow-nStartRow-1);
-+}
-+
-+IMPL_LINK( ScDataFormDlg, Impl_DataModifyHdl, Edit*, pEdit)
-+{
-+ if ( pEdit->IsModified() )
-+ aBtnRestore.Enable( TRUE );
-+ return 0;
-+}
-+
-+IMPL_LINK( ScDataFormDlg, Impl_NewHdl, PushButton*, EMPTYARG )
-+{
-+ ScViewData* pViewData = pTabViewShell->GetViewData();
-+ ScDocShell* pDocSh = pViewData->GetDocShell();
-+ if ( pDoc )
-+ {
-+ sal_Bool bHasData = sal_False;
-+ for(sal_uInt16 i = 0; i < aColLength; i++)
-+ if (pEdits[i])
-+ if ( pEdits[i]->GetText().Len() != 0 )
-+ {
-+ bHasData = sal_True;
-+ break;
-+ }
-+
-+ if ( bHasData )
-+ {
-+ pTabViewShell->DataFormPutData( aCurrentRow , nStartRow , nStartCol , nEndRow , nEndCol , pEdits , aColLength );
-+ aCurrentRow++;
-+ if (aCurrentRow >= nEndRow + 2)
-+ {
-+ nEndRow ++ ;
-+ aSlider.SetRange( Range( 0, nEndRow - nStartRow + 1) );
-+ }
-+ SetButtonState();
-+ FillCtrls(aCurrentRow);
-+ pDocSh->SetDocumentModified();
-+ pDocSh->PostPaintGridAll();
-+ }
-+ }
-+ return 0;
-+}
-+
-+IMPL_LINK( ScDataFormDlg, Impl_LastHdl, PushButton*, EMPTYARG )
-+{
-+ if (pDoc)
-+ {
-+ if ( aCurrentRow > nStartRow +1 )
-+ aCurrentRow--;
-+
-+ SetButtonState();
-+ FillCtrls(aCurrentRow);
-+ }
-+ return 0;
-+}
-+
-+IMPL_LINK( ScDataFormDlg, Impl_NextHdl, PushButton*, EMPTYARG )
-+{
-+ if (pDoc)
-+ {
-+ if ( aCurrentRow <= nEndRow)
-+ aCurrentRow++;
-+
-+ SetButtonState();
-+ FillCtrls(aCurrentRow);
-+ }
-+ return 0;
-+}
-+
-+IMPL_LINK( ScDataFormDlg, Impl_RestoreHdl, PushButton*, EMPTYARG )
-+{
-+ if (pDoc)
-+ {
-+ FillCtrls(aCurrentRow);
-+ }
-+ return 0;
-+}
-+
-+IMPL_LINK( ScDataFormDlg, Impl_DeleteHdl, PushButton*, EMPTYARG )
-+{
-+ ScViewData* pViewData = pTabViewShell->GetViewData();
-+ ScDocShell* pDocSh = pViewData->GetDocShell();
-+ if (pDoc)
-+ {
-+ ScRange aRange(nStartCol, aCurrentRow, nTab, nEndCol, aCurrentRow, nTab);
-+ pDoc->DeleteRow(aRange);
-+ nEndRow--;
-+
-+ SetButtonState();
-+ pDocSh->GetUndoManager()->Clear();
-+
-+ FillCtrls(aCurrentRow);
-+ pDocSh->SetDocumentModified();
-+ pDocSh->PostPaintGridAll();
-+ }
-+ return 0;
-+}
-+
-+IMPL_LINK( ScDataFormDlg, Impl_CloseHdl, PushButton*, EMPTYARG )
-+{
-+ EndDialog( );
-+ return 0;
-+}
-+
-+IMPL_LINK( ScDataFormDlg, Impl_ScrollHdl, ScrollBar*, EMPTYARG )
-+{
-+ long nOffset = aSlider.GetThumbPos();
-+ aCurrentRow = nStartRow + nOffset + 1;
-+ SetButtonState();
-+ FillCtrls(aCurrentRow);
-+ return 0;
-+}
-+
-+void ScDataFormDlg::SetButtonState()
-+{
-+ if ( aCurrentRow > nEndRow )
-+ {
-+ aBtnDelete.Enable( FALSE );
-+ aBtnLast.Enable( TRUE );
-+ aBtnNext.Enable( FALSE );
-+ }
-+ else
-+ {
-+ aBtnDelete.Enable( TRUE );
-+ aBtnNext.Enable( TRUE );
-+ }
-+ if ( 1 == aCurrentRow )
-+ aBtnLast.Enable( FALSE );
-+
-+ aBtnRestore.Enable( FALSE );
-+ if ( pEdits )
-+ pEdits[0]->GrabFocus();
-+}
-diff --git sc/source/ui/miscdlgs/makefile.mk sc/source/ui/miscdlgs/makefile.mk
-index 8c56101..07e70a1 100644
---- sc/source/ui/miscdlgs/makefile.mk
-+++ sc/source/ui/miscdlgs/makefile.mk
-@@ -41,6 +41,7 @@ LIBTARGET=no
- # --- Files --------------------------------------------------------
-
- SLOFILES = \
-+ $(SLO)$/datafdlg.obj \
- $(SLO)$/delcldlg.obj \
- $(SLO)$/inscldlg.obj \
- $(SLO)$/delcodlg.obj \
-diff --git sc/source/ui/src/datafdlg.src sc/source/ui/src/datafdlg.src
-new file mode 100644
-index 0000000..535ec66
---- /dev/null
-+++ sc/source/ui/src/datafdlg.src
-@@ -0,0 +1,108 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: datafdlg.src,v $
-+ *
-+ * $Revision: 1.00 $
-+ *
-+ * last change: $Author: hr $ $Date: 2005/09/23 15:07:30 $
-+ *
-+ * 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 "datafdlg.hrc"
-+
-+//zhangyun, dataform
-+ModalDialog RID_SCDLG_DATAFORM
-+{
-+ OutputSize = TRUE ;
-+ SVLook = TRUE ;
-+ Size = MAP_APPFONT ( 191 , 180 ) ;
-+ Text [ en-US ] = "Data Form" ;
-+ Moveable = TRUE ;
-+ Closeable = TRUE ;
-+ FixedText LAB_DATAFORM_RECORDNO
-+ {
-+ Pos = MAP_APPFONT ( 136 , 6 ) ;
-+ Size = MAP_APPFONT ( 50 , 12 ) ;
-+ Text [ en-US ] = "/" ;
-+ };
-+ PushButton BTN_DATAFORM_NEW
-+ {
-+ Pos = MAP_APPFONT ( 135 , 23 ) ;
-+ Size = MAP_APPFONT ( 50 , 14 ) ;
-+ TabStop = TRUE ;
-+ DefButton = TRUE ;
-+ Text [ en-US ] = "New" ;
-+ };
-+ PushButton BTN_DATAFORM_DELETE
-+ {
-+ Pos = MAP_APPFONT ( 135 , 40 ) ;
-+ Size = MAP_APPFONT ( 50 , 14 ) ;
-+ TabStop = TRUE ;
-+ Text [ en-US ] = "Delete" ;
-+ };
-+ PushButton BTN_DATAFORM_RESTORE
-+ {
-+ Pos = MAP_APPFONT ( 135 , 57 ) ;
-+ Size = MAP_APPFONT ( 50 , 14 ) ;
-+ TabStop = TRUE ;
-+ Text [ en-US ] = "Restore" ;
-+ };
-+ PushButton BTN_DATAFORM_LAST
-+ {
-+ Pos = MAP_APPFONT ( 135 , 82 ) ;
-+ Size = MAP_APPFONT ( 50 , 14 ) ;
-+ TabStop = TRUE ;
-+ Text [ en-US ] = "Last Record" ;
-+ };
-+ PushButton BTN_DATAFORM_NEXT
-+ {
-+ Pos = MAP_APPFONT ( 135 , 99 ) ;
-+ Size = MAP_APPFONT ( 50 , 14 ) ;
-+ TabStop = TRUE ;
-+ Text [ en-US ] = "Next Record" ;
-+ };
-+ PushButton BTN_DATAFORM_CLOSE
-+ {
-+ Pos = MAP_APPFONT ( 135 , 116 ) ;
-+ Size = MAP_APPFONT ( 50 , 14 ) ;
-+ TabStop = TRUE ;
-+ Text [ en-US ] = "Close" ;
-+ };
-+ ScrollBar WND_DATAFORM_SCROLLBAR
-+ {
-+ Pos = MAP_APPFONT ( 124 , 6 ) ;
-+ Size = MAP_APPFONT ( 8 , 135 ) ;
-+ HScroll = FALSE ;
-+ TabStop = FALSE ;
-+ };
-+};
-+//end
-+
-+
-+
-+
-diff --git sc/source/ui/src/globstr.src sc/source/ui/src/globstr.src
-index 37f0d31..eceefa6 100644
---- sc/source/ui/src/globstr.src
-+++ sc/source/ui/src/globstr.src
-@@ -1718,6 +1718,77 @@ Resource RID_GLOBSTR
- {
- Text [ en-US ] = "Unknown User";
- };
-+
-+ String STR_SHAPE_AUTOSHAPE
-+ {
-+ Text [ en-US ] = "AutoShape";
-+ };
-+
-+ String STR_SHAPE_RECTANGLE
-+ {
-+ Text [ en-US ] = "Rectangle";
-+ };
-+
-+ String STR_SHAPE_LINE
-+ {
-+ Text [ en-US ] = "Line";
-+ };
-+
-+ String STR_SHAPE_OVAL
-+ {
-+ Text [ en-US ] = "Oval";
-+ };
-+
-+ String STR_SHAPE_TEXTBOX
-+ {
-+ Text [ en-US ] = "Text Box";
-+ };
-+
-+ String STR_FORM_BUTTON
-+ {
-+ Text [ en-US ] = "Button";
-+ };
-+
-+ String STR_FORM_CHECKBOX
-+ {
-+ Text [ en-US ] = "Check Box";
-+ };
-+
-+ String STR_FORM_OPTIONBUTTON
-+ {
-+ Text [ en-US ] = "Option Button";
-+ };
-+
-+ String STR_FORM_LABEL
-+ {
-+ Text [ en-US ] = "Label";
-+ };
-+
-+ String STR_FORM_LISTBOX
-+ {
-+ Text [ en-US ] = "List Box";
-+ };
-+
-+ String STR_FORM_GROUPBOX
-+ {
-+ Text [ en-US ] = "Group Box";
-+ };
-+
-+ String STR_FORM_DROPDOWN
-+ {
-+ Text [ en-US ] = "Drop Down";
-+ };
-+
-+ String STR_FORM_SPINNER
-+ {
-+ Text [ en-US ] = "Spinner";
-+ };
-+
-+ String STR_FORM_SCROLLBAR
-+ {
-+ Text [ en-US ] = "Scroll Bar";
-+ };
-+
- String STR_STYLE_FAMILY_CELL
- {
- Text [ en-US ] = "Cell Styles";
-diff --git sc/source/ui/src/makefile.mk sc/source/ui/src/makefile.mk
-index 96bb78e..c935a08 100644
---- sc/source/ui/src/makefile.mk
-+++ sc/source/ui/src/makefile.mk
-@@ -53,6 +53,7 @@ SRC1FILES = \
- dbnamdlg.src \
- subtdlg.src \
- miscdlgs.src \
-+ datafdlg.src \
- autofmt.src \
- solvrdlg.src \
- optsolver.src \
-diff --git sc/source/ui/undo/undodat.cxx sc/source/ui/undo/undodat.cxx
-index d42dc64..a175ea6 100644
---- sc/source/ui/undo/undodat.cxx
-+++ sc/source/ui/undo/undodat.cxx
-@@ -52,6 +52,8 @@
- #include "attrib.hxx"
- #include "hints.hxx"
- #include "sc.hrc"
-+#include "chgtrack.hxx" // Amelia Wang
-+#include "refundo.hxx" // Amelia Wang
-
- // -----------------------------------------------------------------------
-
-@@ -72,6 +74,7 @@ TYPEINIT1(ScUndoRepeatDB, ScSimpleUndo);
- TYPEINIT1(ScUndoDataPilot, ScSimpleUndo);
- TYPEINIT1(ScUndoConsolidate, ScSimpleUndo);
- TYPEINIT1(ScUndoChartData, ScSimpleUndo);
-+TYPEINIT1(ScUndoDataForm, SfxUndoAction); // amelia
-
- // -----------------------------------------------------------------------
-
-@@ -2186,8 +2189,210 @@ BOOL __EXPORT ScUndoChartData::CanRepeat(SfxRepeatTarget& /* rTarget */) const
- return FALSE;
- }
-
-+// Amelia Wang
-+ScUndoDataForm::ScUndoDataForm( ScDocShell* pNewDocShell,
-+ SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
-+ SCCOL nEndX, SCROW nEndY, SCTAB nEndZ,
-+ const ScMarkData& rMark,
-+ ScDocument* pNewUndoDoc, ScDocument* pNewRedoDoc,
-+ USHORT nNewFlags,
-+ ScRefUndoData* pRefData,
-+ void* /*pFill1*/, void* /*pFill2*/, void* /*pFill3*/,
-+ BOOL bRedoIsFilled ) :
-+ ScBlockUndo( pNewDocShell, ScRange( nStartX, nStartY, nStartZ, nEndX, nEndY, nEndZ ), SC_UNDO_SIMPLE ),
-+ aMarkData( rMark ),
-+ pUndoDoc( pNewUndoDoc ),
-+ pRedoDoc( pNewRedoDoc ),
-+ nFlags( nNewFlags ),
-+ pRefUndoData( pRefData ),
-+ pRefRedoData( NULL ),
-+ bRedoFilled( bRedoIsFilled )
-+{
-+ // pFill1,pFill2,pFill3 are there so the ctor calls for simple paste (without cutting)
-+ // don't have to be changed and branched for 641.
-+ // They can be removed later.
-+
-+ if ( !aMarkData.IsMarked() ) // no cell marked:
-+ aMarkData.SetMarkArea( aBlockRange ); // mark paste block
-+
-+ if ( pRefUndoData )
-+ pRefUndoData->DeleteUnchanged( pDocShell->GetDocument() );
-+
-+ SetChangeTrack();
-+}
-+
-+ScUndoDataForm::~ScUndoDataForm()
-+{
-+ delete pUndoDoc;
-+ delete pRedoDoc;
-+ delete pRefUndoData;
-+ delete pRefRedoData;
-+}
-+
-+String ScUndoDataForm::GetComment() const
-+{
-+ return ScGlobal::GetRscString( STR_UNDO_PASTE );
-+}
-+
-+void ScUndoDataForm::SetChangeTrack()
-+{
-+ ScChangeTrack* pChangeTrack = pDocShell->GetDocument()->GetChangeTrack();
-+ if ( pChangeTrack && (nFlags & IDF_CONTENTS) )
-+ pChangeTrack->AppendContentRange( aBlockRange, pUndoDoc,
-+ nStartChangeAction, nEndChangeAction, SC_CACM_PASTE );
-+ else
-+ nStartChangeAction = nEndChangeAction = 0;
-+}
-+
-+
-+void ScUndoDataForm::Undo()
-+{
-+ BeginUndo();
-+ DoChange( TRUE );
-+ ShowTable( aBlockRange );
-+ EndUndo();
-+ SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) );
-+}
-+
-+void ScUndoDataForm::Redo()
-+{
-+ BeginRedo();
-+ ScDocument* pDoc = pDocShell->GetDocument();
-+ EnableDrawAdjust( pDoc, FALSE ); //! include in ScBlockUndo?
-+ DoChange( FALSE );
-+ EnableDrawAdjust( pDoc, TRUE ); //! include in ScBlockUndo?
-+ EndRedo();
-+ SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) );
-+}
-+
-+void ScUndoDataForm::Repeat(SfxRepeatTarget& /*rTarget*/)
-+{
-+}
-+
-+BOOL ScUndoDataForm::CanRepeat(SfxRepeatTarget& rTarget) const
-+{
-+ return (rTarget.ISA(ScTabViewTarget));
-+}
-
-+void ScUndoDataForm::DoChange( const BOOL bUndo )
-+{
-+ ScDocument* pDoc = pDocShell->GetDocument();
-
-+ // RefUndoData for redo is created before first undo
-+ // (with DeleteUnchanged after the DoUndo call)
-+ BOOL bCreateRedoData = ( bUndo && pRefUndoData && !pRefRedoData );
-+ if ( bCreateRedoData )
-+ pRefRedoData = new ScRefUndoData( pDoc );
-
-+ ScRefUndoData* pWorkRefData = bUndo ? pRefUndoData : pRefRedoData;
-+
-+ // fuer Undo immer alle oder keine Inhalte sichern
-+ USHORT nUndoFlags = IDF_NONE;
-+ if (nFlags & IDF_CONTENTS)
-+ nUndoFlags |= IDF_CONTENTS;
-+ if (nFlags & IDF_ATTRIB)
-+ nUndoFlags |= IDF_ATTRIB;
-+
-+ BOOL bPaintAll = FALSE;
-+
-+ ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
-
-+ // marking is in ScBlockUndo...
-+ //ScUndoUtil::MarkSimpleBlock( pDocShell, aBlockRange );
-
-+ SCTAB nTabCount = pDoc->GetTableCount();
-+ if ( bUndo && !bRedoFilled )
-+ {
-+ if (!pRedoDoc)
-+ {
-+ BOOL bColInfo = ( aBlockRange.aStart.Row()==0 && aBlockRange.aEnd.Row()==MAXROW );
-+ BOOL bRowInfo = ( aBlockRange.aStart.Col()==0 && aBlockRange.aEnd.Col()==MAXCOL );
-+
-+ pRedoDoc = new ScDocument( SCDOCMODE_UNDO );
-+ pRedoDoc->InitUndoSelected( pDoc, aMarkData, bColInfo, bRowInfo );
-+ }
-+ // read "redo" data from the document in the first undo
-+ // all sheets - CopyToDocument skips those that don't exist in pRedoDoc
-+ ScRange aCopyRange = aBlockRange;
-+ aCopyRange.aStart.SetTab(0);
-+ aCopyRange.aEnd.SetTab(nTabCount-1);
-+ pDoc->CopyToDocument( aCopyRange, 1, FALSE, pRedoDoc );
-+ bRedoFilled = TRUE;
-+ }
-+
-+ USHORT nExtFlags = 0;
-+ pDocShell->UpdatePaintExt( nExtFlags, aBlockRange );
-+
-+ for ( sal_uInt16 i=0; i <= ( aBlockRange.aEnd.Col() - aBlockRange.aStart.Col() ); i++ )
-+ {
-+ String aOldString;
-+ pUndoDoc->GetString( aBlockRange.aStart.Col()+i , aBlockRange.aStart.Row() , aBlockRange.aStart.Tab() , aOldString );
-+ pDoc->SetString( aBlockRange.aStart.Col()+i , aBlockRange.aStart.Row() , aBlockRange.aStart.Tab() , aOldString );
-+ }
-+
-+ //ScRange aTabSelectRange = aBlockRange;
-+
-+ if (pWorkRefData)
-+ {
-+ pWorkRefData->DoUndo( pDoc, TRUE ); // TRUE = bSetChartRangeLists for SetChartListenerCollection
-+ if ( pDoc->RefreshAutoFilter( 0,0, MAXCOL,MAXROW, aBlockRange.aStart.Tab() ) )
-+ bPaintAll = TRUE;
-+ }
-+
-+ if ( bCreateRedoData && pRefRedoData )
-+ pRefRedoData->DeleteUnchanged( pDoc );
-+
-+ if ( bUndo )
-+ {
-+ ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
-+ if ( pChangeTrack )
-+ pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
-+ }
-+ else
-+ SetChangeTrack();
-+
-+ ScRange aDrawRange( aBlockRange );
-+ pDoc->ExtendMerge( aDrawRange, TRUE ); // only needed for single sheet (text/rtf etc.)
-+ USHORT nPaint = PAINT_GRID;
-+ if (bPaintAll)
-+ {
-+ aDrawRange.aStart.SetCol(0);
-+ aDrawRange.aStart.SetRow(0);
-+ aDrawRange.aEnd.SetCol(MAXCOL);
-+ aDrawRange.aEnd.SetRow(MAXROW);
-+ nPaint |= PAINT_TOP | PAINT_LEFT;
-+/*A*/ if (pViewShell)
-+ pViewShell->AdjustBlockHeight(FALSE);
-+ }
-+ else
-+ {
-+ if ( aBlockRange.aStart.Row() == 0 && aBlockRange.aEnd.Row() == MAXROW ) // ganze Spalte
-+ {
-+ nPaint |= PAINT_TOP;
-+ aDrawRange.aEnd.SetCol(MAXCOL);
-+ }
-+ if ( aBlockRange.aStart.Col() == 0 && aBlockRange.aEnd.Col() == MAXCOL ) // ganze Zeile
-+ {
-+ nPaint |= PAINT_LEFT;
-+ aDrawRange.aEnd.SetRow(MAXROW);
-+ }
-+/*A*/ if ((pViewShell) && pViewShell->AdjustBlockHeight(FALSE))
-+ {
-+ aDrawRange.aStart.SetCol(0);
-+ aDrawRange.aStart.SetRow(0);
-+ aDrawRange.aEnd.SetCol(MAXCOL);
-+ aDrawRange.aEnd.SetRow(MAXROW);
-+ nPaint |= PAINT_LEFT;
-+ }
-+ pDocShell->UpdatePaintExt( nExtFlags, aDrawRange );
-+ }
-+
-+ if ( !bUndo ) // draw redo after updating row heights
-+ RedoSdrUndoAction( pDrawUndo ); //! include in ScBlockUndo?
-+
-+ pDocShell->PostPaint( aDrawRange, nPaint, nExtFlags );
-+
-+ pDocShell->PostDataChanged();
-+ if (pViewShell)
-+ pViewShell->CellContentChanged();
-+}
-diff --git sc/source/ui/unoobj/addruno.cxx sc/source/ui/unoobj/addruno.cxx
-index 4bea38e..fa1d4ee 100644
---- sc/source/ui/unoobj/addruno.cxx
-+++ sc/source/ui/unoobj/addruno.cxx
-@@ -69,7 +69,7 @@ void ScAddressConversionObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
- }
- }
-
--sal_Bool ScAddressConversionObj::ParseUIString( const String& rUIString )
-+sal_Bool ScAddressConversionObj::ParseUIString( const String& rUIString, ::formula::FormulaGrammar::AddressConvention eConv )
- {
- if (!pDocShell)
- return sal_False;
-@@ -78,7 +78,7 @@ sal_Bool ScAddressConversionObj::ParseUIString( const String& rUIString )
- sal_Bool bSuccess = sal_False;
- if ( bIsRange )
- {
-- USHORT nResult = aRange.ParseAny( rUIString, pDoc );
-+ USHORT nResult = aRange.ParseAny( rUIString, pDoc, eConv );
- if ( nResult & SCA_VALID )
- {
- if ( ( nResult & SCA_TAB_3D ) == 0 )
-@@ -92,7 +92,7 @@ sal_Bool ScAddressConversionObj::ParseUIString( const String& rUIString )
- }
- else
- {
-- USHORT nResult = aRange.aStart.Parse( rUIString, pDoc );
-+ USHORT nResult = aRange.aStart.Parse( rUIString, pDoc, eConv );
- if ( nResult & SCA_VALID )
- {
- if ( ( nResult & SCA_TAB_3D ) == 0 )
-@@ -116,6 +116,7 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScAddressConversionObj::getProp
- {
- {MAP_CHAR_LEN(SC_UNONAME_ADDRESS), 0, &getCppuType((table::CellRangeAddress*)0), 0, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_PERSREPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
-+ {MAP_CHAR_LEN(SC_UNONAME_XL_A1_REPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_REFSHEET), 0, &getCppuType((sal_Int32*)0), 0, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_UIREPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
- {0,0,0,0,0,0}
-@@ -129,6 +130,7 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScAddressConversionObj::getProp
- {
- {MAP_CHAR_LEN(SC_UNONAME_ADDRESS), 0, &getCppuType((table::CellAddress*)0), 0, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_PERSREPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
-+ {MAP_CHAR_LEN(SC_UNONAME_XL_A1_REPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_REFSHEET), 0, &getCppuType((sal_Int32*)0), 0, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_UIREPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
- {0,0,0,0,0,0}
-@@ -190,8 +192,11 @@ void SAL_CALL ScAddressConversionObj::setPropertyValue( const rtl::OUString& aPr
- bSuccess = ParseUIString( aUIString );
- }
- }
-- else if ( aNameStr.EqualsAscii( SC_UNONAME_PERSREPR ) )
-+ else if ( aNameStr.EqualsAscii( SC_UNONAME_PERSREPR ) || aNameStr.EqualsAscii( SC_UNONAME_XL_A1_REPR ) )
- {
-+ ::formula::FormulaGrammar::AddressConvention aConv = ::formula::FormulaGrammar::CONV_OOO;
-+ if ( aNameStr.EqualsAscii( SC_UNONAME_XL_A1_REPR ) )
-+ aConv = ::formula::FormulaGrammar::CONV_XL_A1;
- // parse the file format string
- rtl::OUString sRepresentation;
- if (aValue >>= sRepresentation)
-@@ -212,7 +217,7 @@ void SAL_CALL ScAddressConversionObj::setPropertyValue( const rtl::OUString& aPr
- }
-
- // parse the rest like a UI string
-- bSuccess = ParseUIString( aUIString );
-+ bSuccess = ParseUIString( aUIString, aConv );
- }
- }
- else
-@@ -265,17 +270,24 @@ uno::Any SAL_CALL ScAddressConversionObj::getPropertyValue( const rtl::OUString&
- aRange.aStart.Format( aFormatStr, nFlags, pDoc );
- aRet <<= rtl::OUString( aFormatStr );
- }
-- else if ( aNameStr.EqualsAscii( SC_UNONAME_PERSREPR ) )
-+ else if ( aNameStr.EqualsAscii( SC_UNONAME_PERSREPR ) || aNameStr.EqualsAscii( SC_UNONAME_XL_A1_REPR ) )
- {
-+ ::formula::FormulaGrammar::AddressConvention aConv = ::formula::FormulaGrammar::CONV_OOO;
-+ if ( aNameStr.EqualsAscii( SC_UNONAME_XL_A1_REPR ) )
-+ aConv = ::formula::FormulaGrammar::CONV_XL_A1;
-+
- // generate file format string - always include sheet
- String aFormatStr;
-- aRange.aStart.Format( aFormatStr, SCA_VALID | SCA_TAB_3D, pDoc );
-+ aRange.aStart.Format( aFormatStr, SCA_VALID | SCA_TAB_3D, pDoc, aConv );
- if ( bIsRange )
- {
- // manually concatenate range so both parts always have the sheet name
- aFormatStr.Append( (sal_Unicode) ':' );
- String aSecond;
-- aRange.aEnd.Format( aSecond, SCA_VALID | SCA_TAB_3D, pDoc );
-+ USHORT nFlags = SCA_VALID;
-+ if( aConv != ::formula::FormulaGrammar::CONV_XL_A1 )
-+ nFlags |= SCA_TAB_3D;
-+ aRange.aEnd.Format( aSecond, SCA_VALID | SCA_TAB_3D, pDoc, aConv );
- aFormatStr.Append( aSecond );
- }
- aRet <<= rtl::OUString( aFormatStr );
-diff --git sc/source/ui/unoobj/docuno.cxx sc/source/ui/unoobj/docuno.cxx
-index 96e582e..fd60fdf 100644
---- sc/source/ui/unoobj/docuno.cxx
-+++ sc/source/ui/unoobj/docuno.cxx
-@@ -103,7 +103,12 @@
- #include <svx/unoshape.hxx>
- #endif
-
-+#include <com/sun/star/document/XVbaEventsHelper.hpp>
-+#include <com/sun/star/document/VbaEventId.hpp>
- using namespace com::sun::star;
-+using namespace com::sun::star::document::VbaEventId;
-+
-+#define SC_UNO_VBADOCOBJ "ThisVBADocObj" // perhaps we want to actually make this ThisWorkbook ?
-
- //------------------------------------------------------------------------
-
-@@ -119,6 +124,7 @@ const SfxItemPropertyMapEntry* lcl_GetDocOptPropertyMap()
- {MAP_CHAR_LEN(SC_UNO_AUTOCONTFOC), 0, &getBooleanCppuType(), 0, 0},
- {MAP_CHAR_LEN(SC_UNO_BASICLIBRARIES), 0, &getCppuType((uno::Reference< script::XLibraryContainer >*)0), beans::PropertyAttribute::READONLY, 0},
- {MAP_CHAR_LEN(SC_UNO_DIALOGLIBRARIES), 0, &getCppuType((uno::Reference< script::XLibraryContainer >*)0), beans::PropertyAttribute::READONLY, 0},
-+ {MAP_CHAR_LEN(SC_UNO_VBADOCOBJ), 0, &getCppuType((beans::PropertyValue*)0), beans::PropertyAttribute::READONLY, 0},
- {MAP_CHAR_LEN(SC_UNO_CALCASSHOWN), PROP_UNO_CALCASSHOWN, &getBooleanCppuType(), 0, 0},
- {MAP_CHAR_LEN(SC_UNONAME_CLOCAL), 0, &getCppuType((lang::Locale*)0), 0, 0},
- {MAP_CHAR_LEN(SC_UNO_CJK_CLOCAL), 0, &getCppuType((lang::Locale*)0), 0, 0},
-@@ -467,6 +473,7 @@ uno::Any SAL_CALL ScModelObj::queryInterface( const uno::Type& rType )
- SC_QUERYINTERFACE( view::XRenderable )
- SC_QUERYINTERFACE( document::XLinkTargetSupplier )
- SC_QUERYINTERFACE( beans::XPropertySet )
-+ SC_QUERYINTERFACE( document::XDocumentEventCompatibleHelper)
- SC_QUERYINTERFACE( lang::XMultiServiceFactory )
- SC_QUERYINTERFACE( lang::XServiceInfo )
- SC_QUERYINTERFACE( util::XChangesNotifier )
-@@ -1880,6 +1887,18 @@ uno::Any SAL_CALL ScModelObj::getPropertyValue( const rtl::OUString& aPropertyNa
- {
- aRet <<= pDocShell->GetDialogContainer();
- }
-+ else if ( aString.EqualsAscii( SC_UNO_VBADOCOBJ ) )
-+ {
-+ // PropertyValue seems extreme because we store
-+ // the model ( as the value member ) of the PropertyValue that is
-+ // itself a property of the model ( the intention however is to
-+ // store something like a Workbook object... but we don't do that )
-+ // yet
-+ beans::PropertyValue aProp;
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ThisExcelDoc") );
-+ aProp.Value <<= pDocShell->GetModel();
-+ aRet <<= aProp;
-+ }
- else if ( aString.EqualsAscii( SC_UNO_RUNTIMEUID ) )
- {
- aRet <<= getRuntimeUID();
-@@ -2053,6 +2072,39 @@ uno::Sequence<rtl::OUString> SAL_CALL ScModelObj::getAvailableServiceNames()
- return concatServiceNames( aMyServices, aDrawServices );
- }
-
-+// XVbaEventHelper
-+// For Vba Event
-+sal_Bool SAL_CALL
-+ScModelObj::processCompatibleEvent( sal_Int16 nSlotId ) throw( ::com::sun::star::uno::RuntimeException )
-+{
-+ USHORT nId = (USHORT)nSlotId;
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper( GetDocument()->GetVbaEventsHelper(), uno::UNO_QUERY );
-+ if( xVbaEventsHelper.is() )
-+ {
-+ switch( nId )
-+ {
-+ case SID_SAVEDOC:
-+ {
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] <<= sal_False;
-+ return xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_BEFORESAVE, aArgs );
-+ }
-+ case SID_SAVEASDOC:
-+ {
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] <<= sal_True;
-+ return xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_BEFORESAVE, aArgs );
-+ }
-+ case SID_PRINTDOC:
-+ case SID_PRINTDOCDIRECT:
-+ {
-+ uno::Sequence< uno::Any > aArgs;
-+ return xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_BEFOREPRINT, aArgs );
-+ }
-+ }
-+ }
-+ return sal_False;
-+}
- // XServiceInfo
-
- rtl::OUString SAL_CALL ScModelObj::getImplementationName() throw(uno::RuntimeException)
-@@ -2097,7 +2149,6 @@ sal_Int64 SAL_CALL ScModelObj::getSomething(
- {
- return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(pDocShell ));
- }
--
- // aggregated number formats supplier has XUnoTunnel, too
- // interface from aggregated object must be obtained via queryAggregation
-
-diff --git sc/source/ui/unoobj/servuno.cxx sc/source/ui/unoobj/servuno.cxx
-index b28c401..d6cb431 100644
---- sc/source/ui/unoobj/servuno.cxx
-+++ sc/source/ui/unoobj/servuno.cxx
-@@ -35,6 +35,7 @@
- #include <svx/unofill.hxx>
- #include <editeng/unonrule.hxx>
- #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
-+#include <com/sun/star/container/XNameAccess.hpp>
-
- #include "servuno.hxx"
- #include "unoguard.hxx"
-@@ -70,20 +71,27 @@
- #include <basic/basmgr.hxx>
- #include <sfx2/app.hxx>
-
-+#include <comphelper/processfactory.hxx>
-+#include <com/sun/star/document/XCodeNameQuery.hpp>
-+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
-+#include <com/sun/star/form/XFormsSupplier.hpp>
-+#include <com/sun/star/script/ScriptEventDescriptor.hpp>
-+#include <comphelper/componentcontext.hxx>
-+#include <cppuhelper/component_context.hxx>
-+#include <vbahelper/vbaaccesshelper.hxx>
-+#include <com/sun/star/script/XVBACompat.hpp>
-+
- using namespace ::com::sun::star;
-
--#ifndef CWS_NPOWER14MISCFIXES
--uno::Reference< uno::XInterface > lcl_createVBAUnoAPIServiceWithArgs( SfxObjectShell* pShell, const sal_Char* _pAsciiName, const uno::Sequence< uno::Any >& aArgs ) throw (uno::RuntimeException)
-+bool isInVBAMode( ScDocShell& rDocSh )
- {
-- uno::Any aUnoVar;
-- if ( !pShell || !pShell->GetBasicManager()->GetGlobalUNOConstant( "VBAGlobals", aUnoVar ) )
-- throw lang::IllegalArgumentException();
-- uno::Reference< lang::XMultiServiceFactory > xVBAFactory( aUnoVar, uno::UNO_QUERY_THROW );
-- ::rtl::OUString sVarName( ::rtl::OUString::createFromAscii( _pAsciiName ) );
-- uno::Reference< uno::XInterface > xIf = xVBAFactory->createInstanceWithArguments( sVarName, aArgs );
-- return xIf;
-+ uno::Reference<script::XLibraryContainer> xLibContainer = rDocSh.GetBasicContainer();
-+ uno::Reference<script::XVBACompat> xVBACompat( xLibContainer, uno::UNO_QUERY );
-+ if ( xVBACompat.is() )
-+ return xVBACompat->getVBACompatModeOn();
-+ return false;
- }
--#endif
-+
-
- class ScVbaObjectForCodeNameProvider : public ::cppu::WeakImplHelper1< container::XNameAccess >
- {
-@@ -98,13 +106,10 @@ public:
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("")), uno::Reference< uno::XInterface >() );
-
- uno::Sequence< uno::Any > aArgs(2);
-- aArgs[0] = uno::Any( uno::Reference< uno::XInterface >() );
-+ // access the application object ( parent for workbook )
-+ aArgs[0] = uno::Any( ooo::vba::createVBAUnoAPIServiceWithArgs( mpDocShell, "ooo.vba.Application", uno::Sequence< uno::Any >() ) );
- aArgs[1] = uno::Any( mpDocShell->GetModel() );
--#ifdef CWS_NPOWER14MISCFIXES
- maWorkbook <<= ooo::vba::createVBAUnoAPIServiceWithArgs( mpDocShell, "ooo.vba.excel.Workbook", aArgs );
--#else
-- maWorkbook <<= lcl_createVBAUnoAPIServiceWithArgs( mpDocShell, "ooo.vba.excel.Workbook", aArgs );
--#endif
- }
-
- virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException )
-@@ -139,13 +144,8 @@ public:
- aArgs[0] = maWorkbook;
- aArgs[1] = uno::Any( xModel );
- aArgs[2] = uno::Any( rtl::OUString( sSheetName ) );
--#ifdef CWS_NPOWER14MISCFIXES
- // use the convience function
- maCachedObject <<= ooo::vba::createVBAUnoAPIServiceWithArgs( mpDocShell, "ooo.vba.excel.Worksheet", aArgs );
--#else
-- // use the temp function
-- maCachedObject <<= lcl_createVBAUnoAPIServiceWithArgs( mpDocShell, "ooo.vba.excel.Worksheet", aArgs );
--#endif
- break;
- }
- }
-@@ -305,7 +305,8 @@ static const ProvNamesId_Type __FAR_DATA aProvNamesId[] =
- { "com.sun.star.text.textfield.Time", SC_SERVICE_TIMEFIELD },
- { "com.sun.star.text.textfield.DocumentTitle", SC_SERVICE_TITLEFIELD },
- { "com.sun.star.text.textfield.FileName", SC_SERVICE_FILEFIELD },
-- { "com.sun.star.text.textfield.SheetName", SC_SERVICE_SHEETFIELD }
-+ { "com.sun.star.text.textfield.SheetName", SC_SERVICE_SHEETFIELD },
-+ { "ooo.vba.VBAGlobals", SC_SERVICE_VBAGLOBALS },
- };
-
- //
-@@ -573,18 +574,12 @@ uno::Reference<uno::XInterface> ScServiceProvider::MakeInstance(
- }
- break;
- case SC_SERVICE_VBACODENAMEPROVIDER:
-+ if ( pDocShell && ooo::vba::isAlienExcelDoc( *pDocShell ) && isInVBAMode( *pDocShell ) )
- {
-- // Only create the excel faking service for excel docs
-- const SfxFilter *pFilt = pDocShell->GetMedium()->GetFilter();
-- if ( pFilt && pFilt->IsAlienFormat() )
-- {
-- // application/vnd.ms-excel is the mime type for Excel
-- static const rtl::OUString sExcelMimeType( RTL_CONSTASCII_USTRINGPARAM( "application/vnd.ms-excel" ) );
-- if ( sExcelMimeType.equals( pFilt->GetMimeType() ) )
-- xRet.set(static_cast<document::XCodeNameQuery*>(new ScVbaCodeNameProvider( pDocShell )));
-- }
-- break;
-+ OSL_TRACE("**** creating VBA Object provider");
-+ xRet.set(static_cast<document::XCodeNameQuery*>(new ScVbaCodeNameProvider( pDocShell )));
- }
-+ break;
- case SC_SERVICE_VBAGLOBALS:
- {
- uno::Any aGlobs;
-@@ -604,6 +599,7 @@ uno::Reference<uno::XInterface> ScServiceProvider::MakeInstance(
- aGlobs >>= xRet;
- }
- }
-+ break;
- }
-
- return xRet;
-diff --git sc/source/ui/unoobj/shapeuno.cxx sc/source/ui/unoobj/shapeuno.cxx
-index 2533354..dcea134 100644
---- sc/source/ui/unoobj/shapeuno.cxx
-+++ sc/source/ui/unoobj/shapeuno.cxx
-@@ -70,6 +70,8 @@ const SfxItemPropertyMapEntry* lcl_GetShapeMap()
- {MAP_CHAR_LEN(SC_UNONAME_HORIPOS), 0, &getCppuType((sal_Int32*)0), 0, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_IMAGEMAP), 0, &getCppuType((uno::Reference<container::XIndexContainer>*)0), 0, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_VERTPOS), 0, &getCppuType((sal_Int32*)0), 0, 0 },
-+ // #i66550 HLINK_FOR_SHAPES
-+ {MAP_CHAR_LEN(SC_UNONAME_HYPERLINK), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
- {0,0,0,0,0,0}
- };
- return aShapeMap_Impl;
-@@ -84,6 +86,14 @@ const SvEventDescription* ScShapeObj::GetSupportedMacroItems()
- };
- return aMacroDescriptionsImpl;
- }
-+// #i66550 HLINK_FOR_SHAPES
-+ScMacroInfo* lcl_getShapeHyperMacroInfo( ScShapeObj* pShape, BOOL bCreate = FALSE )
-+{
-+ if( pShape )
-+ if( SdrObject* pObj = pShape->GetSdrObject() )
-+ return ScDrawLayer::GetMacroInfo( pObj, bCreate );
-+ return 0;
-+}
-
- //------------------------------------------------------------------------
-
-@@ -635,6 +645,13 @@ void SAL_CALL ScShapeObj::setPropertyValue(
- }
- }
- }
-+ else if ( aNameString.EqualsAscii( SC_UNONAME_HYPERLINK ) )
-+ {
-+ rtl::OUString sHlink;
-+ ScMacroInfo* pInfo = lcl_getShapeHyperMacroInfo(this, TRUE);
-+ if ( ( aValue >>= sHlink ) && pInfo )
-+ pInfo->SetHlink( sHlink );
-+ }
- else
- {
- GetShapePropertySet();
-@@ -816,6 +833,13 @@ uno::Any SAL_CALL ScShapeObj::getPropertyValue( const rtl::OUString& aPropertyNa
- }
- }
- }
-+ else if ( aNameString.EqualsAscii( SC_UNONAME_HYPERLINK ) )
-+ {
-+ rtl::OUString sHlink;
-+ if ( ScMacroInfo* pInfo = lcl_getShapeHyperMacroInfo(this) )
-+ sHlink = pInfo->GetHlink();
-+ aAny <<= sHlink;
-+ }
- else
- {
- GetShapePropertySet();
-@@ -1339,11 +1363,6 @@ SdrObject* ScShapeObj::GetSdrObject() const throw()
- }
-
- #define SC_EVENTACC_ONCLICK ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnClick" ) )
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
--#define SC_EVENTACC_ONACTION ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnAction" ) )
--#define SC_EVENTACC_URL ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) )
--#define SC_EVENTACC_ACTION ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Action" ) )
--#endif
- #define SC_EVENTACC_SCRIPT ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Script" ) )
- #define SC_EVENTACC_EVENTTYPE ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EventType" ) )
-
-@@ -1355,10 +1374,7 @@ private:
-
- ScMacroInfo* getInfo( BOOL bCreate = FALSE )
- {
-- if( mpShape )
-- if( SdrObject* pObj = mpShape->GetSdrObject() )
-- return ScDrawLayer::GetMacroInfo( pObj, bCreate );
-- return 0;
-+ return lcl_getShapeHyperMacroInfo( mpShape, bCreate );
- }
-
- public:
-@@ -1384,11 +1400,7 @@ public:
- isEventType = true;
- continue;
- }
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
-- if ( isEventType && ((pProperties->Name == SC_EVENTACC_SCRIPT) || (pProperties->Name == SC_EVENTACC_URL)) )
--#else
- if ( isEventType && (pProperties->Name == SC_EVENTACC_SCRIPT) )
--#endif
- {
- rtl::OUString sValue;
- if ( pProperties->Value >>= sValue )
-@@ -1399,10 +1411,8 @@ public:
- break;
- if ( pProperties->Name == SC_EVENTACC_SCRIPT )
- pInfo->SetMacro( sValue );
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
- else
- pInfo->SetHlink( sValue );
--#endif
- }
- }
- }
-@@ -1425,19 +1435,6 @@ public:
- aProperties[ 1 ].Value <<= pInfo->GetMacro();
- }
- }
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
-- else if( aName == SC_EVENTACC_ONACTION )
-- {
-- if ( pInfo && (pInfo->GetHlink().getLength() > 0) )
-- {
-- aProperties.realloc( 2 );
-- aProperties[ 0 ].Name = SC_EVENTACC_EVENTTYPE;
-- aProperties[ 0 ].Value <<= SC_EVENTACC_ACTION;
-- aProperties[ 1 ].Name = SC_EVENTACC_URL;
-- aProperties[ 1 ].Value <<= pInfo->GetHlink();
-- }
-- }
--#endif
- else
- {
- throw container::NoSuchElementException();
-@@ -1448,25 +1445,14 @@ public:
-
- virtual uno::Sequence< rtl::OUString > SAL_CALL getElementNames() throw(uno::RuntimeException)
- {
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
-- uno::Sequence< rtl::OUString > aSeq( 2 );
--#else
- uno::Sequence< rtl::OUString > aSeq( 1 );
--#endif
- aSeq[ 0 ] = SC_EVENTACC_ONCLICK;
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
-- aSeq[ 1 ] = SC_EVENTACC_ONACTION;
--#endif
- return aSeq;
- }
-
- virtual sal_Bool SAL_CALL hasByName( const rtl::OUString& aName ) throw(uno::RuntimeException)
- {
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
-- return (aName == SC_EVENTACC_ONCLICK) || (aName == SC_EVENTACC_ONACTION);
--#else
- return aName == SC_EVENTACC_ONCLICK;
--#endif
- }
-
- // XElementAccess
-diff --git sc/source/ui/unoobj/viewuno.cxx sc/source/ui/unoobj/viewuno.cxx
-index 6617b4e..1ba956a 100644
---- sc/source/ui/unoobj/viewuno.cxx
-+++ sc/source/ui/unoobj/viewuno.cxx
-@@ -68,9 +68,13 @@
- #include "gridwin.hxx"
- #include <com/sun/star/view/DocumentZoomType.hpp>
- #include "AccessibilityHints.hxx"
-+#include <com/sun/star/awt/MouseButton.hpp>
-+#include <com/sun/star/document/XVbaEventsHelper.hpp>
-+#include <com/sun/star/document/VbaEventId.hpp>
- #include <svx/sdrhittesthelper.hxx>
-
- using namespace com::sun::star;
-+using namespace com::sun::star::document::VbaEventId;
-
- //------------------------------------------------------------------------
-
-@@ -456,6 +460,104 @@ void SAL_CALL ScViewPaneObj::release() throw()
- OWeakObject::release();
- }
-
-+// To process sheet compatibile event
-+typedef ::cppu::WeakImplHelper2< awt::XEnhancedMouseClickHandler, view::XSelectionChangeListener > TabViewEventListener_BASE;
-+class ScTabViewEventListener: public TabViewEventListener_BASE
-+{
-+private:
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper;
-+ ScTabViewObj* pViewObj;
-+ sal_Bool bDelaySelectionEvent;
-+ sal_Bool bSelectionChangeOccured;
-+
-+ void fireSelectionChangeEvent();
-+
-+public:
-+ ScTabViewEventListener( ScTabViewObj* pObj, uno::Reference< document::XVbaEventsHelper >& rVbaEventsHelper);
-+ ~ScTabViewEventListener();
-+ // XEnhancedMouseClickHandler
-+ virtual sal_Bool SAL_CALL mousePressed( const awt::EnhancedMouseEvent& e ) throw (uno::RuntimeException);
-+ virtual sal_Bool SAL_CALL mouseReleased( const awt::EnhancedMouseEvent& e ) throw (uno::RuntimeException);
-+
-+ // XSelectionChangeListener
-+ virtual void SAL_CALL selectionChanged( const lang::EventObject& aEvent ) throw ( uno::RuntimeException );
-+ // XEventListener
-+ virtual void SAL_CALL disposing( const lang::EventObject& aEvent ) throw ( uno::RuntimeException );
-+};
-+
-+ScTabViewEventListener::ScTabViewEventListener(ScTabViewObj* pObj, uno::Reference< document::XVbaEventsHelper >& rVbaEventsHelper):
-+ pViewObj( pObj ),xVbaEventsHelper( rVbaEventsHelper ), bDelaySelectionEvent( sal_False ), bSelectionChangeOccured( sal_False )
-+{
-+}
-+
-+ScTabViewEventListener::~ScTabViewEventListener()
-+{
-+}
-+
-+void SAL_CALL ScTabViewEventListener::disposing( const lang::EventObject& /*aEvent*/ ) throw ( uno::RuntimeException )
-+{
-+}
-+
-+void ScTabViewEventListener::fireSelectionChangeEvent()
-+{
-+ if ( xVbaEventsHelper.is() && pViewObj )
-+ {
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] = pViewObj->getSelection();
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKSHEET_SELECTIONCHANGE, aArgs );
-+ }
-+ bDelaySelectionEvent = sal_False;
-+ bSelectionChangeOccured = sal_False;
-+}
-+
-+sal_Bool SAL_CALL ScTabViewEventListener::mousePressed( const awt::EnhancedMouseEvent& e ) throw (uno::RuntimeException)
-+{
-+ // Delay to fire the selection change event if clicking the left mouse button to do selection.
-+ bDelaySelectionEvent = ( e.Buttons == ::com::sun::star::awt::MouseButton::RIGHT ) ? sal_False : sal_True;
-+ bSelectionChangeOccured = sal_False;
-+
-+ sal_Bool result = sal_False;
-+ // process BeforeDoubleClick and BeforeRightClick events
-+ if( e.ClickCount == 2 || e.Buttons == ::com::sun::star::awt::MouseButton::RIGHT )
-+ {
-+ // ensure the target is a cell
-+ uno::Reference< table::XCell > xCell( e.Target, uno::UNO_QUERY );
-+ if( xCell.is() && xVbaEventsHelper.is() && pViewObj)
-+ {
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] = pViewObj->getSelection();
-+ sal_Int32 nEventId = VBAEVENT_WORKSHEET_BEFORERIGHTCLICK;
-+ if( e.ClickCount == 2 )
-+ nEventId = VBAEVENT_WORKSHEET_BEFOREDOUBLECLICK;
-+
-+ result = xVbaEventsHelper->ProcessCompatibleVbaEvent( nEventId, aArgs );
-+ // TODO: process Cancel argument
-+ }
-+ }
-+ return result;
-+}
-+
-+sal_Bool SAL_CALL ScTabViewEventListener::mouseReleased( const awt::EnhancedMouseEvent&/*e*/) throw (uno::RuntimeException)
-+{
-+ if ( bSelectionChangeOccured )
-+ {
-+ fireSelectionChangeEvent();
-+ }
-+ return sal_False;
-+}
-+
-+void SAL_CALL ScTabViewEventListener::selectionChanged( const lang::EventObject& /*aEvent*/ ) throw ( uno::RuntimeException )
-+{
-+ if ( !bDelaySelectionEvent )
-+ {
-+ fireSelectionChangeEvent();
-+ }
-+ else
-+ {
-+ bSelectionChangeOccured = sal_True;
-+ }
-+}
-+
- //------------------------------------------------------------------------
-
- // Default-ctor wird fuer SMART_REFLECTION_IMPLEMENTATION gebraucht
-@@ -466,7 +568,8 @@ void SAL_CALL ScViewPaneObj::release() throw()
- //UNUSED2008-05 aPropSet( lcl_GetViewOptPropertyMap() ),
- //UNUSED2008-05 aMouseClickHandlers( 0 ),
- //UNUSED2008-05 aActivationListeners( 0 ),
--//UNUSED2008-05 bDrawSelModeSet(sal_False)
-+//UNUSED2008-05 bDrawSelModeSet(sal_False),
-+//UNUSED2008-05 bFilteredRangeSelection(sal_True)
- //UNUSED2008-05 {
- //UNUSED2008-05 }
-
-@@ -476,9 +579,22 @@ ScTabViewObj::ScTabViewObj( ScTabViewShell* pViewSh ) :
- aPropSet( lcl_GetViewOptPropertyMap() ),
- aMouseClickHandlers( 0 ),
- aActivationListeners( 0 ),
-- bDrawSelModeSet(sal_False)
--{
-- //! Listening oder so
-+ bDrawSelModeSet(sal_False),
-+ bFilteredRangeSelection(sal_True)
-+{
-+ if( pViewSh )
-+ {
-+ ScViewData* pViewData = pViewSh->GetViewData();
-+ if( pViewData )
-+ {
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper (pViewData->GetDocument()->GetVbaEventsHelper(), uno::UNO_QUERY );
-+ ScTabViewEventListener* pEventListener = new ScTabViewEventListener( this, xVbaEventsHelper );
-+ uno::Reference< awt::XEnhancedMouseClickHandler > aMouseClickHandler( *pEventListener, uno::UNO_QUERY );
-+ addEnhancedMouseClickHandler( aMouseClickHandler );
-+ uno::Reference< view::XSelectionChangeListener > aSelectionChangeListener( *pEventListener, uno::UNO_QUERY );
-+ addSelectionChangeListener( aSelectionChangeListener );
-+ }
-+ }
- }
-
- ScTabViewObj::~ScTabViewObj()
-@@ -881,6 +997,15 @@ uno::Any SAL_CALL ScTabViewObj::getSelection() throw(uno::RuntimeException)
-
- ScRange aRange;
- ScMarkType eMarkType = pViewData->GetSimpleArea(aRange);
-+
-+ if (!bFilteredRangeSelection)
-+ {
-+ if (eMarkType == SC_MARK_SIMPLE_FILTERED)
-+ eMarkType = SC_MARK_SIMPLE;
-+ else if (eMarkType == SC_MARK_FILTERED)
-+ eMarkType = SC_MARK_MULTI;
-+ }
-+
- if ( nTabs == 1 && (eMarkType == SC_MARK_SIMPLE) )
- {
- if (aRange.aStart == aRange.aEnd)
-@@ -1116,11 +1241,21 @@ uno::Reference<sheet::XSpreadsheet> SAL_CALL ScTabViewObj::getActiveSheet()
- return NULL;
- }
-
-+//liuchen 2009-9-2 support expand (but not replace) the active sheet
- void SAL_CALL ScTabViewObj::setActiveSheet( const uno::Reference<sheet::XSpreadsheet>& xActiveSheet )
- throw(uno::RuntimeException)
- {
-- ScUnoGuard aGuard;
-+ selectSheet(xActiveSheet, false);
-+}
-
-+void SAL_CALL
-+ScTabViewObj::selectSheet( const uno::Reference<sheet::XSpreadsheet>& xActiveSheet,
-+ sal_Bool bExpand)
-+ throw(uno::RuntimeException)
-+{
-+ ScUnoGuard aGuard;
-+ sal_Bool bNew = bExpand;
-+
- ScTabViewShell* pViewSh = GetViewShell();
- if ( pViewSh && xActiveSheet.is() )
- {
-@@ -1134,7 +1269,7 @@ void SAL_CALL ScTabViewObj::setActiveSheet( const uno::Reference<sheet::XSpreads
- {
- SCTAB nNewTab = rRanges.GetObject(0)->aStart.Tab();
- if ( pViewSh->GetViewData()->GetDocument()->HasTable(nNewTab) )
-- pViewSh->SetTabNo( nNewTab );
-+ pViewSh->SetTabNo( nNewTab, bNew, bExpand );
- }
- }
- }
-@@ -1726,6 +1861,12 @@ void SAL_CALL ScTabViewObj::setPropertyValue(
- ScUnoGuard aGuard;
- String aString(aPropertyName);
-
-+ if ( aString.EqualsAscii(SC_UNO_FILTERED_RANGE_SELECTION) )
-+ {
-+ bFilteredRangeSelection = ScUnoHelpFunctions::GetBoolFromAny(aValue);
-+ return;
-+ }
-+
- ScTabViewShell* pViewSh = GetViewShell();
- if (pViewSh)
- {
-@@ -1846,6 +1987,12 @@ uno::Any SAL_CALL ScTabViewObj::getPropertyValue( const rtl::OUString& aProperty
- String aString(aPropertyName);
- uno::Any aRet;
-
-+ if ( aString.EqualsAscii(SC_UNO_FILTERED_RANGE_SELECTION) )
-+ {
-+ ScUnoHelpFunctions::SetBoolInAny(aRet, bFilteredRangeSelection);
-+ return aRet;
-+ }
-+
- ScTabViewShell* pViewSh = GetViewShell();
- if (pViewSh)
- {
-diff --git sc/source/ui/vba/excelvbahelper.cxx sc/source/ui/vba/excelvbahelper.cxx
-index 2722781..6c4ffb3 100644
---- sc/source/ui/vba/excelvbahelper.cxx
-+++ sc/source/ui/vba/excelvbahelper.cxx
-@@ -31,6 +31,7 @@
- #include "scmod.hxx"
- #include "cellsuno.hxx"
- #include <comphelper/processfactory.hxx>
-+#include <com/sun/star/sheet/XSheetCellRange.hpp>
-
- using namespace ::com::sun::star;
- using namespace ::ooo::vba;
-@@ -41,6 +42,83 @@ namespace vba
- {
- namespace excel
- {
-+
-+uno::Reference< sheet::XDatabaseRanges >
-+GetDataBaseRanges( ScDocShell* pShell ) throw ( uno::RuntimeException )
-+{
-+ uno::Reference< frame::XModel > xModel;
-+ if ( pShell )
-+ xModel.set( pShell->GetModel(), uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xModelProps( xModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< sheet::XDatabaseRanges > xDBRanges( xModelProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DatabaseRanges") ) ), uno::UNO_QUERY_THROW );
-+ return xDBRanges;
-+}
-+
-+// returns the XDatabaseRange for the autofilter on sheet (nSheet)
-+// also populates sName with the name of range
-+uno::Reference< sheet::XDatabaseRange >
-+GetAutoFiltRange( ScDocShell* pShell, sal_Int16 nSheet, rtl::OUString& sName ) throw ( uno::RuntimeException )
-+{
-+ uno::Reference< container::XIndexAccess > xIndexAccess( GetDataBaseRanges( pShell ), uno::UNO_QUERY_THROW );
-+ uno::Reference< sheet::XDatabaseRange > xDataBaseRange;
-+ table::CellRangeAddress dbAddress;
-+ for ( sal_Int32 index=0; index < xIndexAccess->getCount(); ++index )
-+ {
-+ uno::Reference< sheet::XDatabaseRange > xDBRange( xIndexAccess->getByIndex( index ), uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XNamed > xNamed( xDBRange, uno::UNO_QUERY_THROW );
-+ // autofilters work weirdly with openoffice, unnamed is the default
-+ // named range which is used to create an autofilter, but
-+ // its also possible that another name could be used
-+ // this also causes problems when an autofilter is created on
-+ // another sheet
-+ // ( but.. you can use any named range )
-+ dbAddress = xDBRange->getDataArea();
-+ if ( dbAddress.Sheet == nSheet )
-+ {
-+ sal_Bool bHasAuto = sal_False;
-+ uno::Reference< beans::XPropertySet > xProps( xDBRange, uno::UNO_QUERY_THROW );
-+ xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AutoFilter") ) ) >>= bHasAuto;
-+ if ( bHasAuto )
-+ {
-+ sName = xNamed->getName();
-+ xDataBaseRange=xDBRange;
-+ break;
-+ }
-+ }
-+ }
-+ return xDataBaseRange;
-+}
-+
-+ScDocShell* GetDocShellFromRange( const uno::Reference< uno::XInterface >& xRange ) throw ( uno::RuntimeException )
-+{
-+ ScCellRangesBase* pScCellRangesBase = ScCellRangesBase::getImplementation( xRange );
-+ if ( !pScCellRangesBase )
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Failed to access underlying doc shell uno range object" ) ), uno::Reference< uno::XInterface >() );
-+ }
-+ return pScCellRangesBase->GetDocShell();
-+}
-+
-+ScDocument* GetDocumentFromRange( const uno::Reference< uno::XInterface >& xRange ) throw ( uno::RuntimeException )
-+{
-+ ScDocShell* pDocShell = GetDocShellFromRange( xRange );
-+ if ( !pDocShell )
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Failed to access underlying document from uno range object" ) ), uno::Reference< uno::XInterface >() );
-+ }
-+ return pDocShell->GetDocument();
-+}
-+
-+uno::Reference< frame::XModel > GetModelFromRange( const uno::Reference< uno::XInterface >& xRange ) throw ( uno::RuntimeException )
-+{
-+ ScDocShell* pDocShell = GetDocShellFromRange( xRange );
-+ if ( !pDocShell )
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Failed to access underlying model uno range object" ) ), uno::Reference< uno::XInterface >() );
-+ }
-+ return pDocShell->GetModel();
-+}
-+
- void implSetZoom( const uno::Reference< frame::XModel >& xModel, sal_Int16 nZoom, std::vector< SCTAB >& nTabs )
- {
- ScTabViewShell* pViewSh = excel::getBestViewShell( xModel );
-@@ -207,12 +285,53 @@ getViewFrame( const uno::Reference< frame::XModel >& xModel )
- return NULL;
- }
-
-+sal_Bool IsR1C1ReferFormat( ScDocument* pDoc, const rtl::OUString& sRangeStr )
-+{
-+ ScRangeList aCellRanges;
-+ String sAddress( sRangeStr );
-+ USHORT nMask = SCA_VALID;
-+ USHORT rResFlags = aCellRanges.Parse( sAddress, pDoc, nMask, formula::FormulaGrammar::CONV_XL_R1C1 );
-+ if ( rResFlags & SCA_VALID )
-+ {
-+ return sal_True;
-+ }
-+ return sal_False;
-+}
-+
-+uno::Reference< XHelperInterface >
-+getUnoSheetModuleObj( const uno::Reference< table::XCellRange >& xRange ) throw ( uno::RuntimeException )
-+{
-+ uno::Reference< sheet::XSheetCellRange > xSheetRange( xRange, uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xProps( xSheetRange->getSpreadsheet(), uno::UNO_QUERY_THROW );
-+ rtl::OUString sCodeName;
-+ xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CodeName") ) ) >>= sCodeName;
-+ // #TODO #FIXME ideally we should 'throw' here if we don't get a valid parent, but... it is possible
-+ // to create a module ( and use 'Option VBASupport 1' ) for a calc document, in this scenario there
-+ // are *NO* special document module objects ( of course being able to switch between vba/non vba mode at
-+ // the document in the future could fix this, especially IF the switching of the vba mode takes care to
-+ // create the special document module objects if they don't exist.
-+ uno::Reference< XHelperInterface > xParent( ov::getUnoDocModule( sCodeName, GetDocShellFromRange( xRange ) ), uno::UNO_QUERY );
-+
-+ return xParent;
-+}
-+
-+uno::Reference< XHelperInterface >
-+getUnoSheetModuleObj( const uno::Reference< sheet::XSheetCellRangeContainer >& xRanges ) throw ( uno::RuntimeException )
-+{
-+ uno::Reference< container::XEnumerationAccess > xEnumAccess( xRanges, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XEnumeration > xEnum = xEnumAccess->createEnumeration();
-+ uno::Reference< table::XCellRange > xRange( xEnum->nextElement(), uno::UNO_QUERY_THROW );
-+
-+ return getUnoSheetModuleObj( xRange );
-+}
-+
- SfxItemSet*
- ScVbaCellRangeAccess::GetDataSet( ScCellRangesBase* pRangeObj )
- {
- return pRangeObj ? pRangeObj->GetCurrentDataSet( true ) : 0;
- }
-
-+
- } //excel
- } //vba
- } //ooo
-diff --git sc/source/ui/vba/excelvbahelper.hxx sc/source/ui/vba/excelvbahelper.hxx
-index ce6ba35..4c8c4a1 100644
---- sc/source/ui/vba/excelvbahelper.hxx
-+++ sc/source/ui/vba/excelvbahelper.hxx
-@@ -29,6 +29,12 @@
-
- #include<vbahelper/vbahelper.hxx>
- #include <docsh.hxx>
-+#include <com/sun/star/sheet/XDatabaseRanges.hpp>
-+#include <com/sun/star/sheet/XDatabaseRange.hpp>
-+#include <com/sun/star/table/XCellRange.hpp>
-+#include <com/sun/star/sheet/XSheetCellRangeContainer.hpp>
-+#include <ooo/vba/XHelperInterface.hpp>
-+
-
- class ScCellRangesBase;
-
-@@ -36,24 +42,34 @@ namespace ooo
- {
- namespace vba
- {
-- namespace excel
-+ 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 );
-+ // 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 );
-+ sal_Bool IsR1C1ReferFormat( ScDocument* pDoc, const ::rtl::OUString& sRangeStr );
-+ css::uno::Reference< css::sheet::XDatabaseRanges > GetDataBaseRanges( ScDocShell* pShell ) throw ( css::uno::RuntimeException );
-+
-+ css::uno::Reference< css::sheet::XDatabaseRange > GetAutoFiltRange( ScDocShell* pShell, sal_Int16 nSheet, rtl::OUString& sName ) throw ( css::uno::RuntimeException );
-+ css::uno::Reference< ooo::vba::XHelperInterface > getUnoSheetModuleObj( const css::uno::Reference< css::sheet::XSheetCellRangeContainer >& xRanges ) throw ( css::uno::RuntimeException );
-+ css::uno::Reference< ooo::vba::XHelperInterface > getUnoSheetModuleObj( const css::uno::Reference< css::table::XCellRange >& xRange ) throw ( css::uno::RuntimeException );
-+ ScDocShell* GetDocShellFromRange( const css::uno::Reference< css::uno::XInterface >& xRange ) throw ( css::uno::RuntimeException );
-+ ScDocument* GetDocumentFromRange( const css::uno::Reference< css::uno::XInterface >& xRange ) throw ( css::uno::RuntimeException );
-+ css::uno::Reference< css::frame::XModel > GetModelFromRange( const css::uno::Reference< css::uno::XInterface >& xRange ) throw ( css::uno::RuntimeException );
-+
- class ScVbaCellRangeAccess
- {
- public:
- static SfxItemSet* GetDataSet( ScCellRangesBase* pRangeObj );
- };
--}
--}
-+ }
-+ }
- }
- #endif
-diff --git sc/source/ui/vba/makefile.mk sc/source/ui/vba/makefile.mk
-index 00a26e2..b2f6f2b 100644
---- sc/source/ui/vba/makefile.mk
-+++ sc/source/ui/vba/makefile.mk
-@@ -31,7 +31,7 @@ PRJNAME=sc
- TARGET=vbaobj
- ENABLE_EXCEPTIONS=TRUE
- VISIBILITY_HIDDEN=TRUE
--
-+CDEFS+=-DVBA_OOBUILD_HACK
- # --- Settings -----------------------------------------------------
-
- .INCLUDE : settings.mk
-@@ -50,6 +50,7 @@ SLOFILES= \
- $(SLO)$/vbaglobals.obj \
- $(SLO)$/vbaworkbook.obj \
- $(SLO)$/vbaworksheets.obj \
-+ $(SLO)$/vbafiledialog.obj \
- $(SLO)$/vbaapplication.obj \
- $(SLO)$/vbarange.obj \
- $(SLO)$/vbaname.obj \
-@@ -64,6 +65,7 @@ SLOFILES= \
- $(SLO)$/vbainterior.obj\
- $(SLO)$/vbawsfunction.obj\
- $(SLO)$/vbawindow.obj\
-+ $(SLO)$/vbaquerytable.obj \
- $(SLO)$/vbachart.obj\
- $(SLO)$/vbachartobject.obj\
- $(SLO)$/vbachartobjects.obj\
-@@ -81,6 +83,7 @@ SLOFILES= \
- $(SLO)$/vbaoleobject.obj \
- $(SLO)$/vbaoleobjects.obj \
- $(SLO)$/vbatextboxshape.obj \
-+ $(SLO)$/vbacommentshape.obj \
- $(SLO)$/vbapane.obj \
- $(SLO)$/vbatextframe.obj \
- $(SLO)$/vbacharttitle.obj \
-@@ -95,11 +98,22 @@ SLOFILES= \
- $(SLO)$/vbastyle.obj \
- $(SLO)$/vbastyles.obj \
- $(SLO)$/vbaassistant.obj \
-+ $(SLO)$/vbafilesearch.obj \
-+ $(SLO)$/vbafoundfiles.obj \
- $(SLO)$/vbahyperlink.obj \
- $(SLO)$/vbapagesetup.obj \
- $(SLO)$/vbapagebreak.obj \
- $(SLO)$/vbapagebreaks.obj \
-- $(SLO)$/service.obj
-+ $(SLO)$/service.obj \
-+ $(SLO)$/vbaeventshelper.obj \
-+ $(SLO)$/vbamenubar.obj \
-+ $(SLO)$/vbamenubars.obj \
-+ $(SLO)$/vbamenu.obj \
-+ $(SLO)$/vbamenus.obj \
-+ $(SLO)$/vbamenuitem.obj \
-+ $(SLO)$/vbamenuitems.obj \
-+ $(SLO)$/vbafiledialogselecteditems.obj \
-+
- .ENDIF
- # --- Targets ------------------------------------------------------
-
-diff --git sc/source/ui/vba/service.cxx sc/source/ui/vba/service.cxx
-index ab09d2c..22d3329 100644
---- sc/source/ui/vba/service.cxx
-+++ sc/source/ui/vba/service.cxx
-@@ -66,6 +66,10 @@ namespace application
- {
- extern sdecl::ServiceDecl const serviceDecl;
- }
-+namespace vbaeventshelper
-+{
-+extern sdecl::ServiceDecl const serviceDecl;
-+}
- namespace textframe
- {
- extern sdecl::ServiceDecl const serviceDecl;
-@@ -87,7 +91,7 @@ extern "C"
- #if 0
- // Component registration
- if ( component_writeInfoHelper( pServiceManager, pRegistryKey,
-- range::serviceDecl, workbook::serviceDecl, worksheet::serviceDecl, globals::serviceDecl, window::serviceDecl, hyperlink::serviceDecl, application::serviceDecl ) )
-+ range::serviceDecl, workbook::serviceDecl, worksheet::serviceDecl, globals::serviceDecl, window::serviceDecl, hyperlink::serviceDecl, application::serviceDecl ) && component_writeInfoHelper( pServiceManager, pRegistryKey, vbaeventshelper::serviceDecl ) )
- {
- // Singleton registration
- try
-@@ -110,7 +114,7 @@ extern "C"
- #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 );
-+ range::serviceDecl, workbook::serviceDecl, worksheet::serviceDecl, globals::serviceDecl, window::serviceDecl, hyperlink::serviceDecl, application::serviceDecl ) && component_writeInfoHelper( pServiceManager, pRegistryKey, vbaeventshelper::serviceDecl, textframe::serviceDecl );
- #endif
-
- }
-@@ -122,8 +126,8 @@ 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, window::serviceDecl, hyperlink::serviceDecl, application::serviceDecl );
-- if( !pRet )
-- pRet = component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey, textframe::serviceDecl );
-+ if( !pRet )
-+ pRet = component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey, vbaeventshelper::serviceDecl, textframe::serviceDecl );
- OSL_TRACE("Ret is 0x%x", pRet);
- return pRet;
- }
-diff --git sc/source/ui/vba/testvba/testvba.cxx sc/source/ui/vba/testvba/testvba.cxx
-index 990a37a..058c874 100644
---- sc/source/ui/vba/testvba/testvba.cxx
-+++ sc/source/ui/vba/testvba/testvba.cxx
-@@ -159,15 +159,15 @@ mxCompLoader( _xCompLoader ), msOutDirPath( convertToURL( _outDirPath ) )
- Reference< script::provider::XScript > xScript;
- try
- {
-- xScript = xProv->getScript( rtl::OUString::createFromAscii( "vnd.sun.star.script:Standard.TestMacros.Main?language=Basic&location=document" ));
-+ xScript = xProv->getScript( rtl::OUString::createFromAscii( "vnd.sun.star.script:VBAProject.TestMacros.Main?language=Basic&location=document" ));
- } catch ( uno::Exception& e )
- {
- try
- {
-- xScript = xProv->getScript( rtl::OUString::createFromAscii( "vnd.sun.star.script:Standard.testMacro.Main?language=Basic&location=document" ));
-+ xScript = xProv->getScript( rtl::OUString::createFromAscii( "vnd.sun.star.script:VBAProject.testMacro.Main?language=Basic&location=document" ));
- } catch ( uno::Exception& e2 )
- {
-- xScript = xProv->getScript( rtl::OUString::createFromAscii( "vnd.sun.star.script:Standard.testMain.Main?language=Basic&location=document" ));
-+ xScript = xProv->getScript( rtl::OUString::createFromAscii( "vnd.sun.star.script:VBAProject.testMain.Main?language=Basic&location=document" ));
- }
- }
- OSL_TRACE("Got script for doc %s", rtl::OUStringToOString( sUrl, RTL_TEXTENCODING_UTF8 ).getStr() );
-diff --git sc/source/ui/vba/vbaapplication.cxx sc/source/ui/vba/vbaapplication.cxx
-index 228ca64..3a4907b 100644
---- sc/source/ui/vba/vbaapplication.cxx
-+++ sc/source/ui/vba/vbaapplication.cxx
-@@ -26,12 +26,14 @@
- ************************************************************************/
- #include <stdio.h>
-
--
-+#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
-+#include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp>
- #include<com/sun/star/sheet/XSpreadsheetView.hpp>
- #include <com/sun/star/sheet/XSpreadsheets.hpp>
- #include<com/sun/star/view/XSelectionSupplier.hpp>
- #include <com/sun/star/lang/XServiceInfo.hpp>
- #include<ooo/vba/excel/XlCalculation.hpp>
-+#include<ooo/vba/excel/XlCutCopyMode.hpp>
- #include <com/sun/star/sheet/XCellRangeReferrer.hpp>
- #include <com/sun/star/sheet/XCalculatable.hpp>
- #include <com/sun/star/frame/XLayoutManager.hpp>
-@@ -40,6 +42,19 @@
- #include <ooo/vba/excel/XlMousePointer.hpp>
- #include <com/sun/star/sheet/XNamedRanges.hpp>
- #include <com/sun/star/sheet/XCellRangeAddressable.hpp>
-+#include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp>
-+#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
-+#include <com/sun/star/ui/dialogs/XFilePicker2.hpp>
-+#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
-+#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
-+//2009-11-06 add by limingl
-+#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
-+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
-+//end
-+#include<ooo/vba/XCommandBars.hpp>
-+#include <ooo/vba/excel/XlEnableCancelKey.hpp> //liuchen 2009-11-26
-+#include <ooo/vba/excel/XlApplicationInternational.hpp> //liuchen 2009-11-26
-+#include <unotools/localedatawrapper.hxx> //liuchen 2009-11-26
-
- #include "vbaapplication.hxx"
- #include "vbaworkbooks.hxx"
-@@ -51,21 +66,32 @@
- #include "vbawindow.hxx"
- #include "vbawindows.hxx"
- #include "vbaglobals.hxx"
-+#include "vbamenubars.hxx"
- #include "tabvwsh.hxx"
- #include "gridwin.hxx"
- #include "vbanames.hxx"
- #include <vbahelper/vbashape.hxx>
- #include "vbatextboxshape.hxx"
- #include "vbaassistant.hxx"
-+#include "vbafilesearch.hxx" //liuchen 2009-8-18, add the support of VBA Application.FileSearch
- #include "sc.hrc"
-+#include "macromgr.hxx"
-+#include "global.hxx" //liuchen 2009-11-26
-+#include "scmod.hxx" //liuchen 2009-11-26
-+#include "docoptio.hxx" //liuchen 2009-11-26
-+#include "appoptio.hxx"
-
- #include <osl/file.hxx>
-
-+#include <map>
-+
- #include <sfx2/request.hxx>
- #include <sfx2/objsh.hxx>
- #include <sfx2/viewfrm.hxx>
- #include <sfx2/app.hxx>
-
-+#include <comphelper/processfactory.hxx>
-+
- #include <toolkit/awt/vclxwindow.hxx>
- #include <toolkit/helper/vclunohelper.hxx>
-
-@@ -78,15 +104,29 @@
- #include <basic/sbuno.hxx>
- #include <basic/sbmeth.hxx>
-
-+#include "transobj.hxx"
- #include "convuno.hxx"
- #include "cellsuno.hxx"
-+#include "miscuno.hxx"
-+#include "unonames.hxx"
- #include "docsh.hxx"
- #include <vbahelper/helperdecl.hxx>
- #include "excelvbahelper.hxx"
-
--
-+#include <basic/sbmeth.hxx>
-+#include <basic/sbmod.hxx>
-+#include <basic/sbstar.hxx>
-+#include <basic/sbx.hxx>
-+#include <basic/sbxobj.hxx>
-+#include <basic/sbuno.hxx>
-+//limingl 2009-07-20
-+#include "vbafiledialog.hxx"
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-+using ::com::sun::star::uno::Reference;
-+using ::com::sun::star::uno::UNO_QUERY_THROW;
-+using ::com::sun::star::uno::UNO_QUERY;
-+using ::rtl::OUString;
-
- // Enable our own join detection for Intersection and Union
- // should be more efficient than using ScRangeList::Join ( because
-@@ -116,6 +156,7 @@ public:
-
- ScVbaApplication::ScVbaApplication( const uno::Reference<uno::XComponentContext >& xContext ): ScVbaApplication_BASE( xContext ), m_xCalculation( excel::XlCalculation::xlCalculationAutomatic )
- {
-+ m_bEnableEvents = sal_True;
- }
-
- ScVbaApplication::~ScVbaApplication()
-@@ -130,18 +171,47 @@ SfxObjectShell* ScVbaApplication::GetDocShell( const uno::Reference< frame::XMod
- uno::Reference< excel::XWorkbook >
- ScVbaApplication::getActiveWorkbook() throw (uno::RuntimeException)
- {
-- return new ActiveWorkbook( this, mxContext );
-+ uno::Reference< excel::XWorkbook > xWrkbk;
-+ ScDocShell* pShell = excel::getDocShell( getCurrentExcelDoc( mxContext ) );
-+ if ( pShell )
-+ {
-+ String aName;
-+ if ( pShell->GetDocument() )
-+ {
-+ aName = pShell->GetDocument()->GetCodeName();
-+ xWrkbk.set( getUnoDocModule( aName, pShell ), uno::UNO_QUERY );
-+ // fallback ( e.g. it's possible a new document was created via the api )
-+ // in that case the document will not have the appropriate Document Modules
-+ // #TODO #FIXME ( needs to be fixes as part of providing support for an overall document
-+ // vba mode etc. )
-+ if ( !xWrkbk.is() )
-+ return new ActiveWorkbook( this, mxContext );
-+ }
-+ }
-+ return xWrkbk;
- }
-
- uno::Reference< excel::XWorkbook > SAL_CALL
- ScVbaApplication::getThisWorkbook() throw (uno::RuntimeException)
- {
-- uno::Reference< frame::XModel > xModel = getThisExcelDoc(mxContext);
-- if( !xModel.is() )
-- return uno::Reference< excel::XWorkbook >();
--
-- ScVbaWorkbook *pWb = new ScVbaWorkbook( this, mxContext, xModel );
-- return uno::Reference< excel::XWorkbook > (pWb);
-+ uno::Reference< excel::XWorkbook > xWrkbk;
-+ ScDocShell* pShell = excel::getDocShell( getThisExcelDoc( mxContext ) );
-+ if ( pShell )
-+ {
-+ String aName;
-+ if ( pShell->GetDocument() )
-+ {
-+ aName = pShell->GetDocument()->GetCodeName();
-+ xWrkbk.set( getUnoDocModule( aName, pShell ), uno::UNO_QUERY );
-+ // fallback ( e.g. it's possible a new document was created via the api )
-+ // in that case the document will not have the appropriate Document Modules
-+ // #TODO #FIXME ( needs to be fixes as part of providing support for an overall document
-+ // vba mode etc. )
-+ if ( !xWrkbk.is() )
-+ return new ActiveWorkbook( this, mxContext );
-+ }
-+ }
-+ return xWrkbk;
- }
-
- uno::Reference< XAssistant > SAL_CALL
-@@ -150,16 +220,49 @@ ScVbaApplication::getAssistant() throw (uno::RuntimeException)
- return uno::Reference< XAssistant >( new ScVbaAssistant( this, mxContext ) );
- }
-
-+//liuchen 2009-8-18, add support of VBA Application.FileSearch
-+uno::Reference< XFileSearch > SAL_CALL
-+ScVbaApplication::getFileSearch() throw (uno::RuntimeException)
-+{
-+ if (! m_xFileSearch.get() )
-+ {
-+ m_xFileSearch = uno::Reference< XFileSearch >( new ScVbaFileSearch( this, uno::Reference< XHelperInterface >( this ), mxContext ) );
-+ }
-+
-+ return m_xFileSearch;
-+}
-+//liuchen
-+
- uno::Any SAL_CALL
- ScVbaApplication::getSelection() throw (uno::RuntimeException)
- {
- OSL_TRACE("** ScVbaApplication::getSelection() ** ");
- 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") )
-+
-+ Reference< view::XSelectionSupplier > xSelSupp( xModel->getCurrentController(), UNO_QUERY_THROW );
-+ Reference< beans::XPropertySet > xPropSet( xSelSupp, UNO_QUERY_THROW );
-+ OUString aPropName = OUString::createFromAscii( SC_UNO_FILTERED_RANGE_SELECTION );
-+ uno::Any aOldVal = xPropSet->getPropertyValue( aPropName );
-+ uno::Any any;
-+ any <<= sal_False;
-+ xPropSet->setPropertyValue( aPropName, any );
-+ uno::Reference< uno::XInterface > aSelection = ScUnoHelpFunctions::AnyToInterface(
-+ xSelSupp->getSelection() );
-+ xPropSet->setPropertyValue( aPropName, aOldVal );
-+
-+ if (!aSelection.is())
- {
-- uno::Reference< drawing::XShapes > xShapes( xModel->getCurrentSelection(), uno::UNO_QUERY_THROW );
-+ throw uno::RuntimeException(
-+ rtl::OUString::createFromAscii("failed to obtain current selection"),
-+ uno::Reference< uno::XInterface >() );
-+ }
-+
-+ uno::Reference< lang::XServiceInfo > xServiceInfo( aSelection, uno::UNO_QUERY_THROW );
-+ rtl::OUString sImplementationName = xServiceInfo->getImplementationName();
-+
-+ if( sImplementationName.equalsIgnoreAsciiCaseAscii("com.sun.star.drawing.SvxShapeCollection") )
-+ {
-+ uno::Reference< drawing::XShapes > xShapes( aSelection, 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
-@@ -178,19 +281,19 @@ ScVbaApplication::getSelection() throw (uno::RuntimeException)
- else if( xServiceInfo->supportsService( rtl::OUString::createFromAscii("com.sun.star.sheet.SheetCellRange")) ||
- xServiceInfo->supportsService( rtl::OUString::createFromAscii("com.sun.star.sheet.SheetCellRanges")))
- {
-- uno::Reference< table::XCellRange > xRange( getCurrentDocument()->getCurrentSelection(), ::uno::UNO_QUERY);
-+ uno::Reference< table::XCellRange > xRange( aSelection, ::uno::UNO_QUERY);
- if ( !xRange.is() )
- {
-- uno::Reference< sheet::XSheetCellRangeContainer > xRanges( getCurrentDocument()->getCurrentSelection(), ::uno::UNO_QUERY);
-+ uno::Reference< sheet::XSheetCellRangeContainer > xRanges( aSelection, ::uno::UNO_QUERY);
- if ( xRanges.is() )
-- return uno::makeAny( uno::Reference< excel::XRange >( new ScVbaRange( this, mxContext, xRanges ) ) );
-+ return uno::makeAny( uno::Reference< excel::XRange >( new ScVbaRange( excel::getUnoSheetModuleObj( xRanges ), mxContext, xRanges ) ) );
-
- }
-- return uno::makeAny( uno::Reference< excel::XRange >(new ScVbaRange( this, mxContext, xRange ) ) );
-+ return uno::makeAny( uno::Reference< excel::XRange >(new ScVbaRange( excel::getUnoSheetModuleObj( xRange ), mxContext, xRange ) ) );
- }
- else
- {
-- throw uno::RuntimeException( sImpementaionName + rtl::OUString::createFromAscii(" donot be surpported"), uno::Reference< uno::XInterface >() );
-+ throw uno::RuntimeException( sImplementationName + rtl::OUString::createFromAscii(" not surpported"), uno::Reference< uno::XInterface >() );
- }
- }
-
-@@ -276,16 +379,67 @@ ScVbaApplication::getActiveWindow() throw (uno::RuntimeException)
- uno::Any SAL_CALL
- ScVbaApplication::getCutCopyMode() throw (uno::RuntimeException)
- {
-- //# FIXME TODO, implementation
- uno::Any result;
-- result <<= sal_False;
-+ ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( NULL );
-+ ScDocument* pDoc = pOwnClip ? pOwnClip->GetDocument() : NULL;
-+ if ( pDoc )
-+ {
-+ if ( pDoc->IsCutMode() )
-+ {
-+ result <<= excel::XlCutCopyMode::xlCut;
-+ }
-+ else
-+ {
-+ result <<= excel::XlCutCopyMode::xlCopy;
-+ }
-+ }
-+ else
-+ {
-+ result <<= sal_False;
-+ }
- return result;
- }
-
- void SAL_CALL
--ScVbaApplication::setCutCopyMode( const uno::Any& /*_cutcopymode*/ ) throw (uno::RuntimeException)
-+ScVbaApplication::setCutCopyMode( const uno::Any& _cutcopymode ) throw (uno::RuntimeException)
- {
-- //# FIXME TODO, implementation
-+ // According to Excel's behavior, no matter what is the value of _cutcopymode, always releases the clip object.
-+ sal_Bool bCutCopyMode = sal_False;
-+ if ( ( _cutcopymode >>= bCutCopyMode ) )
-+ {
-+ ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( NULL );
-+ if ( pOwnClip )
-+ {
-+ pOwnClip->ObjectReleased();
-+ ScTabViewShell* pTabViewShell = excel::getBestViewShell( getCurrentDocument() );
-+ if ( pTabViewShell )
-+ {
-+ ScViewData* pView = pTabViewShell->GetViewData();
-+ Window* pWindow = pView ? pView->GetActiveWin() : NULL;
-+ if ( pWindow )
-+ {
-+ Reference< datatransfer::clipboard::XClipboard > xClipboard = pWindow->GetClipboard();
-+ Reference< datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( xClipboard, uno::UNO_QUERY );
-+ if ( xClipboard.is() )
-+ {
-+ xClipboard->setContents( NULL, NULL );
-+ if ( xFlushableClipboard.is() )
-+ {
-+ const sal_uInt32 nRef = Application::ReleaseSolarMutex();
-+ try
-+ {
-+ xFlushableClipboard->flushClipboard();
-+ }
-+ catch( const uno::Exception& )
-+ {
-+ }
-+ Application::AcquireSolarMutex( nRef );
-+ }
-+ }
-+ }
-+ }
-+ }
-+ }
- }
-
- uno::Any SAL_CALL
-@@ -631,6 +785,105 @@ ScVbaApplication::getDisplayAlerts() throw (uno::RuntimeException)
- {
- return sal_True;
- }
-+
-+//VBA by minz@cn.ibm.com. Add Application.EnableEvents.
-+void SAL_CALL
-+ScVbaApplication::setEnableEvents(sal_Bool bEnable) throw (uno::RuntimeException)
-+{
-+ m_bEnableEvents = bEnable;
-+}
-+
-+sal_Bool SAL_CALL
-+ScVbaApplication::getEnableEvents() throw (uno::RuntimeException)
-+{
-+ return m_bEnableEvents;
-+}
-+
-+sal_Bool SAL_CALL
-+ScVbaApplication::getVisible() throw (uno::RuntimeException)
-+{
-+ sal_Bool bVisible = sal_True;
-+ return bVisible;
-+}
-+
-+void SAL_CALL
-+ScVbaApplication::setVisible(sal_Bool /*bVisible*/) throw (uno::RuntimeException)
-+{
-+}
-+
-+//liuchen 2009-11-25 add the support of Excel VBA Application.Iteration
-+//The Excel Iteration option is global and unique, but in Symphony there is an Iteration property in ScModule and one in every ScDocument,
-+//so the set method will set all the Iteration properties
-+sal_Bool SAL_CALL
-+ScVbaApplication::getIteration() throw (uno::RuntimeException)
-+{
-+ ScModule* pScMod = SC_MOD();
-+ ScDocOptions aDocOpt = pScMod->GetDocOptions();
-+
-+ return aDocOpt.IsIter();
-+}
-+
-+void SAL_CALL
-+ScVbaApplication::setIteration(sal_Bool bIteration) throw (uno::RuntimeException)
-+{
-+ ScModule* pScMod = SC_MOD();
-+ ScDocOptions& aDocOpt = const_cast< ScDocOptions& > (pScMod->GetDocOptions());
-+ aDocOpt.SetIter( bIteration );
-+
-+ uno::Any aIteration;
-+ aIteration <<= bIteration;
-+
-+ OUString aPropName = OUString::createFromAscii( "IsIterationEnabled" );
-+
-+ uno::Reference< XCollection > xWorkbooks( new ScVbaWorkbooks( this, mxContext ) );
-+ sal_Int32 nCount = xWorkbooks->getCount();
-+
-+ for (sal_Int32 i = 1; i <= nCount; i++)
-+ {
-+ uno::Reference< ooo::vba::excel::XWorkbook > xWorkbook;
-+ uno::Any aWorkbook = xWorkbooks->Item(uno::makeAny(i), uno::Any());
-+ aWorkbook >>= xWorkbook;
-+ ScVbaWorkbook* pWorkbook = static_cast< ScVbaWorkbook* > ( xWorkbook.get() );
-+
-+ uno::Reference< frame::XModel > xModel( pWorkbook->getDocModel(), uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xPropertySet( xModel, uno::UNO_QUERY_THROW );
-+ xPropertySet->setPropertyValue( aPropName, aIteration );
-+ }
-+}
-+//liuchen 2009-11-25 end
-+
-+//liuchen 2009-11-26 add the support of Excel VBA Application.EnableCancelKey
-+sal_Int32 SAL_CALL
-+ScVbaApplication::getEnableCancelKey() throw (uno::RuntimeException)
-+{
-+ return ooo::vba::excel::XlEnableCancelKey::xlDisabled;
-+}
-+
-+void SAL_CALL
-+ScVbaApplication::setEnableCancelKey(sal_Int32 /*lEnableCancelKey*/) throw (uno::RuntimeException)
-+{
-+}
-+//liuchen 2009-11-26 end
-+
-+sal_Int32 SAL_CALL ScVbaApplication::getSheetsInNewWorkbook() throw (uno::RuntimeException)
-+{
-+ const ScAppOptions& rAppOpt = SC_MOD()->GetAppOptions();
-+ return rAppOpt.GetTabCountInNewSpreadsheet();
-+}
-+
-+void SAL_CALL ScVbaApplication::setSheetsInNewWorkbook( sal_Int32 SheetsInNewWorkbook ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ if ( SheetsInNewWorkbook < 1 || SheetsInNewWorkbook > MAXTAB )
-+ {
-+ DebugHelper::exception( OUString::createFromAscii("The number must be between 1 and 255"), uno::Exception(), SbERR_METHOD_FAILED, OUString() );
-+ }
-+ else
-+ {
-+ ScAppOptions& rAppOpt = const_cast< ScAppOptions& >(SC_MOD()->GetAppOptions());
-+ rAppOpt.SetTabCountInNewSpreadsheet( SheetsInNewWorkbook );
-+ }
-+}
-+
- void SAL_CALL
- ScVbaApplication::Calculate() throw( script::BasicErrorException , uno::RuntimeException )
- {
-@@ -1008,12 +1261,13 @@ ScVbaApplication::Intersect( const uno::Reference< excel::XRange >& Arg1, const
- ScDocShell* pDocShell = excel::getDocShell( xModel );
- if ( aCellRanges.Count() == 1 )
- {
-- xRefRange = new ScVbaRange( uno::Reference< XHelperInterface >(), mxContext, new ScCellRangeObj( pDocShell, *aCellRanges.First() ) );
-+ uno::Reference< table::XCellRange > xRange( new ScCellRangeObj( pDocShell, *aCellRanges.First() ));
-+ xRefRange = new ScVbaRange( excel::getUnoSheetModuleObj( xRange ), mxContext, xRange );
- }
- else if ( aCellRanges.Count() > 1 )
- {
- uno::Reference< sheet::XSheetCellRangeContainer > xRanges( new ScCellRangesObj( pDocShell, aCellRanges ) );
-- xRefRange = new ScVbaRange( uno::Reference< XHelperInterface >(), mxContext, xRanges );
-+ xRefRange = new ScVbaRange( excel::getUnoSheetModuleObj( xRanges ) , mxContext, xRanges );
-
- }
- return xRefRange;
-@@ -1098,12 +1352,13 @@ ScVbaApplication::Union( const uno::Reference< excel::XRange >& Arg1, const uno:
- if ( aCellRanges.Count() == 1 )
- {
- // normal range
-- xRange = new ScVbaRange( uno::Reference< XHelperInterface >(), mxContext, new ScCellRangeObj( pDocShell, *aCellRanges.First() ) );
-+ uno::Reference< table::XCellRange > xCalcRange( new ScCellRangeObj( pDocShell, *aCellRanges.First() ) );
-+ xRange = new ScVbaRange( excel::getUnoSheetModuleObj( xCalcRange ), mxContext, xCalcRange );
- }
- else if ( aCellRanges.Count() > 1 ) // Multi-Area
- {
- uno::Reference< sheet::XSheetCellRangeContainer > xRanges( new ScCellRangesObj( pDocShell, aCellRanges ) );
-- xRange = new ScVbaRange( uno::Reference< XHelperInterface >(), mxContext, xRanges );
-+ xRange = new ScVbaRange( excel::getUnoSheetModuleObj( xRanges ), mxContext, xRanges );
- }
-
- // #FIXME need proper (WorkSheet) parent
-@@ -1115,13 +1370,19 @@ ScVbaApplication::Volatile( const uno::Any& aVolatile ) throw ( uno::RuntimeExc
- {
- sal_Bool bVolatile = sal_True;
- aVolatile >>= bVolatile;
-+ SbMethod* pMeth = StarBASIC::GetActiveMethod();
-+ if ( pMeth )
-+ {
-+ OSL_TRACE("ScVbaApplication::Volatile() In method ->%s<-", rtl::OUStringToOString( pMeth->GetName(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ uno::Reference< frame::XModel > xModel( getCurrentDocument() );
-+ ScDocument* pDoc = excel::getDocShell( xModel )->GetDocument();
-+ pDoc->GetMacroManager()->SetUserFuncVolatile( pMeth->GetName(), bVolatile);
-+ }
-+
-+// this is bound to break when loading the document
- return;
- }
-
--void SAL_CALL
--ScVbaApplication::DoEvents() throw ( uno::RuntimeException )
--{
--}
- ::sal_Bool SAL_CALL
- ScVbaApplication::getDisplayFormulaBar() throw ( css::uno::RuntimeException )
- {
-@@ -1173,12 +1434,421 @@ ScVbaApplication::Caller( const uno::Any& /*aIndex*/ ) throw ( uno::RuntimeExcep
- return aRet;
- }
-
-+//Add by minz@cn.ibm.com. 2009-07-08.
-+uno::Any SAL_CALL
-+ScVbaApplication::GetOpenFilename(const uno::Any& FileFilter, const uno::Any& FilterIndex, const uno::Any& Title, const uno::Any& ButtonText, const uno::Any& MultiSelect) throw (uno::RuntimeException)
-+{
-+ uno::Any aRet = uno::makeAny( sal_False );
-+ try
-+ {
-+ const ::rtl::OUString sServiceName = ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.FilePicker" );
-+ uno::Reference< lang::XMultiServiceFactory > xMSF( comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
-+ // Set the type of File Picker Dialog: TemplateDescription::FILEOPEN_SIMPLE.
-+ uno::Sequence< uno::Any > aDialogType( 1 );
-+ aDialogType[0] <<= ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE;
-+ uno::Reference< ui::dialogs::XFilePicker > xFilePicker( xMSF->createInstanceWithArguments( sServiceName, aDialogType ), UNO_QUERY );
-+ uno::Reference< ui::dialogs::XFilePicker2 > xFilePicker2( xFilePicker, UNO_QUERY );
-+ uno::Reference< ui::dialogs::XFilterManager > xFilterManager( xFilePicker, UNO_QUERY );
-+ uno::Reference< ui::dialogs::XExecutableDialog > xExecutableDialog( xFilePicker, UNO_QUERY );
-+ uno::Reference< ui::dialogs::XFilePickerControlAccess > xPickerControlAccess( xFilePicker, UNO_QUERY );
-+
-+ if ( xFilterManager.is() && FileFilter.hasValue() )
-+ {
-+ sal_Int32 nFilterIndex = 1;
-+ if ( FilterIndex.hasValue() )
-+ {
-+ FilterIndex >>= nFilterIndex;
-+ }
-+ ::rtl::OUString strFilter;
-+ FileFilter >>= strFilter;
-+ sal_Int32 nCommaID = 0;
-+ sal_Int32 nIndex = 1;
-+ do
-+ {
-+ ::rtl::OUString aFilterTitleToken = strFilter.getToken( 0, ',' , nCommaID );
-+ ::rtl::OUString aFilterToken;
-+ if ( nCommaID >= 0 )
-+ {
-+ aFilterToken = strFilter.getToken( 0, ',' , nCommaID );
-+ }
-+ else if ( nCommaID < 0 && nIndex == 1 )
-+ {
-+ throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid FileFilter format!" ), uno::Reference< uno::XInterface >() );
-+ }
-+ xFilterManager->appendFilter( aFilterTitleToken, aFilterToken );
-+ if ( nFilterIndex == nIndex )
-+ {
-+ xFilterManager->setCurrentFilter( aFilterTitleToken );
-+ }
-+ nIndex++;
-+ } while ( nCommaID >= 0 );
-+ }
-+ if ( xExecutableDialog.is() && Title.hasValue() )
-+ {
-+ ::rtl::OUString sTitle;
-+ Title >>= sTitle;
-+ xExecutableDialog->setTitle( sTitle );
-+ }
-+ if ( xPickerControlAccess.is() && ButtonText.hasValue() )
-+ {
-+ ::rtl::OUString sButtonText;
-+ ButtonText >>= sButtonText;
-+ xPickerControlAccess->setLabel( ui::dialogs::CommonFilePickerElementIds::PUSHBUTTON_OK, sButtonText );
-+ }
-+ sal_Bool bMultiSelect = sal_False;
-+ if ( xFilePicker.is() && MultiSelect.hasValue() )
-+ {
-+ MultiSelect >>= bMultiSelect;
-+ xFilePicker->setMultiSelectionMode( bMultiSelect );
-+ }
-+
-+ if ( xFilePicker.is() && xFilePicker->execute() )
-+ {
-+ sal_Bool bUseXFilePicker2 = sal_False;
-+ uno::Reference< lang::XServiceInfo > xServiceInfo( xFilePicker, UNO_QUERY );
-+ if ( xServiceInfo.is() )
-+ {
-+ rtl::OUString sImplName = xServiceInfo->getImplementationName();
-+ if ( sImplName.equalsAscii("com.sun.star.comp.fpicker.VistaFileDialog") || sImplName.equalsAscii("com.sun.star.ui.dialogs.SalGtkFilePicker") )
-+ {
-+ bUseXFilePicker2 = sal_True;
-+ }
-+ }
-+ uno::Sequence< rtl::OUString > aSelectedFiles;
-+ if ( bUseXFilePicker2 && xFilePicker2.is() )
-+ {
-+ // On Linux, XFilePicker->getFiles() always return one selected file although we select more than one file, also on Vista
-+ // XFilePicker->getFiles() does not work well too, so we call XFilePicker2->getSelectedFiles() to get selected files.
-+ aSelectedFiles = xFilePicker2->getSelectedFiles();
-+ }
-+ else
-+ {
-+ // If only one file is selected, the first entry of the sequence contains the complete path/filename in URL format. If multiple files are selected,
-+ // the first entry of the sequence contains the path in URL format, and the other entries contains the names of the selected files without path information.
-+ uno::Sequence< rtl::OUString > aTmpFiles = xFilePicker->getFiles();
-+ aSelectedFiles = aTmpFiles;
-+ sal_Int32 iFileCount = aTmpFiles.getLength();
-+ if ( iFileCount > 1 )
-+ {
-+ aSelectedFiles.realloc( iFileCount - 1 );
-+ INetURLObject aPath( aTmpFiles[0] );
-+ aPath.setFinalSlash();
-+ for ( sal_Int32 i = 1; i < iFileCount; i++ )
-+ {
-+ if ( aTmpFiles[i].indexOf ('/') > 0 || aTmpFiles[i].indexOf ('\\') > 0 )
-+ {
-+ aSelectedFiles[i - 1] = aTmpFiles[i];
-+ }
-+ else
-+ {
-+ if ( i == 1 )
-+ aPath.Append( aTmpFiles[i] );
-+ else
-+ aPath.setName( aTmpFiles[i] );
-+ aSelectedFiles[i - 1] = aPath.GetMainURL( INetURLObject::NO_DECODE );
-+ }
-+ }
-+ }
-+ }
-+
-+ sal_Int32 iFileCount = aSelectedFiles.getLength();
-+ for ( sal_Int32 i = 0; i < iFileCount; i++ )
-+ {
-+ INetURLObject aObj( aSelectedFiles[i] );
-+ if ( aObj.GetProtocol() == INET_PROT_FILE )
-+ {
-+ rtl::OUString aTemp = aObj.PathToFileName();
-+ aSelectedFiles[i] = aTemp.getLength() > 0 ? aTemp : aSelectedFiles[i];
-+ }
-+ }
-+ if ( bMultiSelect )
-+ {
-+ aRet = uno::makeAny( aSelectedFiles );
-+ }
-+ else if ( aSelectedFiles.getLength() > 0 && !bMultiSelect )
-+ {
-+ aRet = uno::makeAny( aSelectedFiles[0] );
-+ }
-+ }
-+ }
-+ catch( const uno::Exception& )
-+ {
-+ DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
-+ }
-+
-+ return aRet;
-+}
-+
-+//liming 2009-7-17
-+::com::sun::star::uno::Reference< ::ooo::vba::XFileDialog > SAL_CALL
-+ScVbaApplication::getFileDialog() throw (::com::sun::star::uno::RuntimeException)
-+{
-+ uno::Reference< XFileDialog > xFileDialogs( new ScVbaFileDialog( uno::Reference< XHelperInterface >( this ), mxContext, getCurrentDocument() ) );
-+ return xFileDialogs;
-+}
-+
-+typedef std::map< ::rtl::OUString, ::rtl::OUString > FileFilterMap;
-+
-+//2009-11-06 add by limingl
-+uno::Any SAL_CALL
-+ScVbaApplication::GetSaveAsFilename( const ::com::sun::star::uno::Any& InitialFilename, const ::com::sun::star::uno::Any& FileFilter, const ::com::sun::star::uno::Any& FilterIndex, const ::com::sun::star::uno::Any& Title, const ::com::sun::star::uno::Any& ButtonText ) throw (::com::sun::star::uno::RuntimeException)
-+{
-+ uno::Any strRet;
-+ try
-+ {
-+ const ::rtl::OUString sServiceName = ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.FilePicker" );
-+ uno::Reference< lang::XMultiServiceFactory > xMSF( comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
-+
-+ uno::Sequence< uno::Any > aDialogType( 1 );
-+ aDialogType[0] <<= ui::dialogs::TemplateDescription::FILESAVE_SIMPLE;
-+ uno::Reference< ui::dialogs::XFilePicker > xFilePicker( xMSF->createInstanceWithArguments( sServiceName, aDialogType ), UNO_QUERY );
-+
-+ if (InitialFilename.hasValue())
-+ {
-+ ::rtl::OUString strInitFileName;
-+ InitialFilename >>= strInitFileName;
-+ xFilePicker->setDefaultName(strInitFileName);
-+ }
-+
-+ // Begin from 1.
-+ sal_Int32 nFilterIndex = 1;
-+ if (FilterIndex.hasValue())
-+ {
-+ FilterIndex >>= nFilterIndex;
-+ }
-+
-+ uno::Reference< ui::dialogs::XFilterManager > xFilter( xFilePicker, UNO_QUERY );
-+ FileFilterMap mFilterNameMap;
-+ if (FileFilter.hasValue())
-+ {
-+ ::rtl::OUString strFilter;
-+ sal_Int32 nCommaID = 0;
-+ FileFilter >>= strFilter;
-+
-+ sal_Int32 nIndex = 1;
-+ do
-+ {
-+ ::rtl::OUString aFilterTitleToken = strFilter.getToken( 0, ',' , nCommaID );
-+ ::rtl::OUString aFilterToken;
-+ if ( nCommaID >= 0 )
-+ {
-+ aFilterToken = strFilter.getToken( 0, ',' , nCommaID );
-+ }
-+ else if ( nCommaID < 0 && nIndex == 1 )
-+ {
-+ throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid FileFilter format!" ), uno::Reference< uno::XInterface >() );
-+ }
-+
-+ FileFilterMap::const_iterator aIt = mFilterNameMap.find( aFilterTitleToken );
-+ if ( aIt == mFilterNameMap.end() )
-+ {
-+ xFilter->appendFilter( aFilterTitleToken, aFilterToken );
-+ if ( nFilterIndex == nIndex )
-+ {
-+ xFilter->setCurrentFilter( aFilterTitleToken );
-+ }
-+ nIndex++;
-+ mFilterNameMap[aFilterTitleToken] = aFilterToken;
-+ }
-+ } while ( nCommaID >= 0 );
-+ }
-+
-+ if (Title.hasValue())
-+ {
-+ ::rtl::OUString strTitle;
-+ Title >>= strTitle;
-+ uno::Reference< ::com::sun::star::ui::dialogs::XExecutableDialog> xExcTblDlg(xFilePicker, UNO_QUERY );
-+ xExcTblDlg->setTitle(strTitle);
-+ }
-+
-+ if (ButtonText.hasValue())
-+ {
-+ ::rtl::OUString strBttTxt;
-+ ButtonText >>= strBttTxt;
-+ }
-+
-+
-+ if ( xFilePicker.is() )
-+ {
-+ sal_Int16 nRet = xFilePicker->execute();
-+ if (nRet == 0)
-+ {
-+ strRet <<= sal_False;
-+ }
-+ else
-+ {
-+ uno::Sequence < rtl::OUString > aPathSeq = xFilePicker->getFiles();
-+
-+ if ( aPathSeq.getLength() )
-+ {
-+ ::rtl::OUString sSelectedFilters;
-+ if ( xFilter.is() )
-+ {
-+ ::rtl::OUString sSelectedFilterName = xFilter->getCurrentFilter();
-+ FileFilterMap::const_iterator aIt = mFilterNameMap.find( sSelectedFilterName );
-+ if ( aIt != mFilterNameMap.end() )
-+ {
-+ sSelectedFilters = aIt->second;
-+ }
-+ }
-+ INetURLObject aURLObj( aPathSeq[0] );
-+ ::rtl::OUString aPathStr = aURLObj.PathToFileName();
-+ if ( aURLObj.GetProtocol() == INET_PROT_FILE )
-+ {
-+ sal_Int32 nSemicolonID = 0;
-+ ::rtl::OUString sFirstFilter = sSelectedFilters.getToken( 0, ';' , nSemicolonID );
-+ ::rtl::OUString sFileExtension = aURLObj.GetExtension();
-+ if ( sFileExtension.equalsAscii("") )
-+ {
-+ sFileExtension = sFirstFilter.equalsAscii("*.*") ? sFileExtension : sFirstFilter.copy( sFirstFilter.indexOfAsciiL("*.", 2) + 2 );
-+ aPathStr = sFileExtension.equalsAscii("") ? aPathStr : aPathStr + ::rtl::OUString::createFromAscii(".") + sFileExtension;
-+ }
-+ else
-+ {
-+ sal_Bool bValidFilter = sal_False;
-+ FileFilterMap::const_iterator aIt = mFilterNameMap.begin();
-+ while ( aIt != mFilterNameMap.end() )
-+ {
-+ sSelectedFilters = aIt->second;
-+ nSemicolonID = 0;
-+ do
-+ {
-+ ::rtl::OUString aFilterToken = sSelectedFilters.getToken( 0, ';' , nSemicolonID );
-+ if ( aFilterToken.trim().equalsIgnoreAsciiCase(::rtl::OUString::createFromAscii("*.") + sFileExtension) )
-+ {
-+ bValidFilter = sal_True;
-+ break;
-+ }
-+ } while ( nSemicolonID >= 0 );
-+ if ( bValidFilter )
-+ {
-+ break;
-+ }
-+ aIt++;
-+ }
-+ if ( !bValidFilter )
-+ {
-+ sFileExtension = sFirstFilter.equalsAscii("*.*") ? ::rtl::OUString::createFromAscii("") : sFirstFilter.copy( sFirstFilter.indexOfAsciiL("*.", 2) + 2 );
-+ aPathStr = sFileExtension.equalsAscii("") ? aPathStr : aPathStr + ::rtl::OUString::createFromAscii(".") + sFileExtension;
-+ }
-+ }
-+ }
-+ strRet <<= aPathStr;
-+ }
-+ }
-+ }
-+ }
-+ catch( const uno::Exception& )
-+ {
-+ DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
-+ }
-+ return strRet;
-+}
-+
-+//end add
-+
- uno::Reference< frame::XModel >
- ScVbaApplication::getCurrentDocument() throw (css::uno::RuntimeException)
- {
- return getCurrentExcelDoc(mxContext);
- }
-
-+uno::Any SAL_CALL
-+ScVbaApplication::MenuBars( const uno::Any& aIndex ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< XCommandBars > xCommandBars( CommandBars( uno::Any() ), uno::UNO_QUERY_THROW );
-+ uno::Reference< XCollection > xMenuBars( new ScVbaMenuBars( this, mxContext, xCommandBars ) );
-+ if ( aIndex.hasValue() )
-+ {
-+ return uno::Any ( xMenuBars->Item( aIndex, uno::Any() ) );
-+ }
-+
-+ return uno::Any( xMenuBars );
-+}
-+
-+//liuchen 2009-11-26 add the support of Application.International
-+sal_Int32 SAL_CALL
-+ConvertCountryCode(const OUString& language)
-+{
-+ sal_Int32 nCode = 0;
-+
-+ if( language == OUString::createFromAscii("ar") ) nCode = 966; // Arabic
-+ else if ( language == OUString::createFromAscii("cs") ) nCode = 42; // Czech
-+ else if ( language == OUString::createFromAscii("da") ) nCode = 45; // Danish
-+ else if ( language == OUString::createFromAscii("de") ) nCode = 49; // German
-+ else if ( language == OUString::createFromAscii("en") ) nCode = 1; // English
-+ else if ( language == OUString::createFromAscii("es") ) nCode = 34; // Spanish
-+ else if ( language == OUString::createFromAscii("el") ) nCode = 30; // Greek
-+ else if ( language == OUString::createFromAscii("fa") ) nCode = 98; // Persian = Farsi
-+ else if ( language == OUString::createFromAscii("fi") ) nCode = 358; // Finnish
-+ else if ( language == OUString::createFromAscii("fr") ) nCode = 33; // French
-+ else if ( language == OUString::createFromAscii("he") ) nCode = 972; // Hebrew
-+ else if ( language == OUString::createFromAscii("hi") ) nCode = 91; // Indian = Hindi
-+ else if ( language == OUString::createFromAscii("hu") ) nCode = 36; // Hungarian
-+ else if ( language == OUString::createFromAscii("it") ) nCode = 39; // Italian
-+ else if ( language == OUString::createFromAscii("ja") ) nCode = 81; // Japanese
-+ else if ( language == OUString::createFromAscii("ko") ) nCode = 82; // Korean
-+ else if ( language == OUString::createFromAscii("nl") ) nCode = 31; // Dutch
-+ else if ( language == OUString::createFromAscii("no") ) nCode = 47; // Norwegian
-+ else if ( language == OUString::createFromAscii("pl") ) nCode = 48; // Polish
-+ else if ( language == OUString::createFromAscii("pt") ) nCode = 351; // Portuguese
-+ else if ( language == OUString::createFromAscii("ru") ) nCode = 7; // Russian
-+ else if ( language == OUString::createFromAscii("sv") ) nCode = 46; // Swedish
-+ else if ( language == OUString::createFromAscii("th") ) nCode = 66; // Thai
-+ else if ( language == OUString::createFromAscii("tk") ) nCode = 90; // Turkish
-+ else if ( language == OUString::createFromAscii("ur") ) nCode = 92; // Urdu
-+ else if ( language == OUString::createFromAscii("vi") ) nCode = 84; // Vietnamese
-+ else if ( language == OUString::createFromAscii("zh") ) nCode = 86; // Simplified Chinese
-+
-+ return nCode;
-+}
-+
-+uno::Any SAL_CALL
-+ScVbaApplication::International( sal_Int32 Index ) throw (uno::RuntimeException)
-+{
-+ uno::Any aRet;
-+ OUString str;
-+ const LocaleDataWrapper* pLocaleData = ScGlobal::GetpLocaleData();
-+ switch ( Index )
-+ {
-+ case excel::XlApplicationInternational::xlCountryCode:
-+ aRet <<= ConvertCountryCode( pLocaleData->getLanguageCountryInfo().Language );
-+ break;
-+ case excel::XlApplicationInternational::xlDecimalSeparator:
-+ str = pLocaleData->getNumDecimalSep();
-+ aRet <<= str;
-+ break;
-+ case excel::XlApplicationInternational::xlDateSeparator:
-+ str = pLocaleData->getDateSep();
-+ aRet <<= str;
-+ break;
-+ default:
-+ break;
-+ }
-+ return aRet;
-+}
-+//liuchen 2009-11-26 end
-+
-+//2009-12-11 add by limingl
-+void SAL_CALL ScVbaApplication::Undo( ) throw (::com::sun::star::uno::RuntimeException)
-+{
-+ SfxAllItemSet reqList( SFX_APP()->GetPool() );
-+ SfxRequest rReq(SID_UNDO, 0, reqList);
-+ ScTabViewShell* pViewShell = excel::getCurrentBestViewShell( mxContext );
-+
-+ if (pViewShell != NULL)
-+ {
-+ pViewShell->ExecuteUndo(rReq);
-+ }
-+}
-+//end
-+
-+double SAL_CALL ScVbaApplication::InchesToPoints( double Inches ) throw (uno::RuntimeException)
-+{
-+ // Convert a measurement from Inch to Point (1 inch = 72 points).
-+ return MetricField::ConvertDoubleValue( Inches, 0, 0, FUNIT_INCH, FUNIT_POINT );
-+}
-+
- rtl::OUString&
- ScVbaApplication::getServiceImplName()
- {
-diff --git sc/source/ui/vba/vbaapplication.hxx sc/source/ui/vba/vbaapplication.hxx
-index 000f89d..818ae0b 100644
---- sc/source/ui/vba/vbaapplication.hxx
-+++ sc/source/ui/vba/vbaapplication.hxx
-@@ -43,7 +43,9 @@ class ScVbaApplication : public ScVbaApplication_BASE
- {
- private:
- sal_Int32 m_xCalculation;
-+ sal_Bool m_bEnableEvents;
- rtl::OUString getOfficePath( const rtl::OUString& sPath ) throw ( css::uno::RuntimeException );
-+ css::uno::Reference< ov::XFileSearch > m_xFileSearch; //
- protected:
- virtual css::uno::Reference< css::frame::XModel > getCurrentDocument() throw (css::uno::RuntimeException);
- public:
-@@ -73,6 +75,7 @@ public:
- 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::Reference< ov::XFileSearch > SAL_CALL getFileSearch() throw (css::uno::RuntimeException); //liuchen 2009-8-18 add the support of Application.FileSearch
- 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,9 +88,23 @@ public:
- virtual void SAL_CALL setStatusBar( const css::uno::Any& _statusbar ) throw (css::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getCursor() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setCursor( ::sal_Int32 _cursor ) throw (css::uno::RuntimeException);
-+
-+ virtual sal_Bool SAL_CALL getEnableEvents() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setEnableEvents( sal_Bool bEnable ) throw (css::uno::RuntimeException);
-+
-+ virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setVisible( sal_Bool bVisible ) throw (css::uno::RuntimeException);
-+
-+ virtual sal_Bool SAL_CALL getIteration() throw (css::uno::RuntimeException); //liuchen 2009-11-25 add the support of Iteration
-+ virtual void SAL_CALL setIteration( sal_Bool bIteration ) throw (css::uno::RuntimeException); //liuchen 2009-11-25 add the support of Iteration
-+ virtual sal_Int32 SAL_CALL getEnableCancelKey() throw (css::uno::RuntimeException); //liuchen 2009-11-26 add the support of EnableCancelKey
-+ virtual void SAL_CALL setEnableCancelKey( sal_Int32 lEnableCancelKey ) throw (css::uno::RuntimeException); //liuchen 2009-11-26 add the support of EnableCancelKey
-
- virtual double SAL_CALL CountA( const css::uno::Any& arg1 ) throw (css::uno::RuntimeException) ;
-
-+ virtual sal_Int32 SAL_CALL getSheetsInNewWorkbook() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setSheetsInNewWorkbook( sal_Int32 SheetsInNewWorkbook ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-+
- virtual css::uno::Any SAL_CALL Windows( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL wait( double time ) 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);
-@@ -97,8 +114,16 @@ public:
- 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);
- 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);
-+ virtual css::uno::Any SAL_CALL MenuBars( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL GetOpenFilename( const css::uno::Any& FileFilter, const css::uno::Any& FilterIndex, const css::uno::Any& Title, const css::uno::Any& ButtonText, const css::uno::Any& MultiSelect ) throw (css::uno::RuntimeException);
-+ virtual ::com::sun::star::uno::Reference< ::ooo::vba::XFileDialog > SAL_CALL getFileDialog() throw (::com::sun::star::uno::RuntimeException); //liminl 2009-08-12 add
-+ virtual css::uno::Any SAL_CALL International( sal_Int32 Index ) throw (css::uno::RuntimeException); //liuchen 2009-11-26
-+ //2009-12-04 add by limingl
-+ virtual css::uno::Any SAL_CALL GetSaveAsFilename( const ::com::sun::star::uno::Any& InitialFilename, const ::com::sun::star::uno::Any& FileFilter, const ::com::sun::star::uno::Any& FilterIndex, const ::com::sun::star::uno::Any& Title, const ::com::sun::star::uno::Any& ButtonText ) throw (::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL Undo( ) throw (::com::sun::star::uno::RuntimeException);
-+ virtual double SAL_CALL InchesToPoints( double Inches ) throw (css::uno::RuntimeException);
-+
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-diff --git sc/source/ui/vba/vbachartobjects.cxx sc/source/ui/vba/vbachartobjects.cxx
-index 2d2d7ff..cb5a669 100644
---- sc/source/ui/vba/vbachartobjects.cxx
-+++ sc/source/ui/vba/vbachartobjects.cxx
-@@ -47,16 +47,15 @@ using namespace ::ooo::vba;
- class ChartObjectEnumerationImpl : public EnumerationHelperImpl
- {
- uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier;
-- uno::Reference< XHelperInterface > xParent;
-
- public:
-
-- ChartObjectEnumerationImpl( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration, const uno::Reference< drawing::XDrawPageSupplier >& _xDrawPageSupplier, const uno::Reference< XHelperInterface >& _xParent ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xContext, xEnumeration ), xDrawPageSupplier( _xDrawPageSupplier ), xParent( _xParent ) {}
-+ ChartObjectEnumerationImpl( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration, const uno::Reference< drawing::XDrawPageSupplier >& _xDrawPageSupplier, const uno::Reference< XHelperInterface >& _xParent ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( _xParent, xContext, xEnumeration ), xDrawPageSupplier( _xDrawPageSupplier ) {}
- virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
- {
- uno::Reference< table::XTableChart > xTableChart( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
- // parent Object is sheet
-- return uno::makeAny( uno::Reference< excel::XChartObject > ( new ScVbaChartObject( xParent, m_xContext, xTableChart, xDrawPageSupplier ) ) );
-+ return uno::makeAny( uno::Reference< excel::XChartObject > ( new ScVbaChartObject( m_xParent, m_xContext, xTableChart, xDrawPageSupplier ) ) );
- }
- };
-
-diff --git sc/source/ui/vba/vbacomment.cxx sc/source/ui/vba/vbacomment.cxx
-index 16dfcf2..6802a78 100644
---- sc/source/ui/vba/vbacomment.cxx
-+++ sc/source/ui/vba/vbacomment.cxx
-@@ -31,13 +31,23 @@
- #include <com/sun/star/sheet/XSheetAnnotationAnchor.hpp>
- #include <com/sun/star/sheet/XSheetAnnotationsSupplier.hpp>
- #include <com/sun/star/sheet/XSheetCellRange.hpp>
-+#include <com/sun/star/sheet/XCellAddressable.hpp>
- #include <com/sun/star/table/CellAddress.hpp>
- #include <com/sun/star/table/XCell.hpp>
- #include <com/sun/star/text/XText.hpp>
-
-+#include <cellsuno.hxx>
-+#include <postit.hxx>
-+#include <svx/svdobj.hxx>
-+#include <svx/svdocapt.hxx>
-+#include <vbahelper/vbashape.hxx>
-+#include <ooo/vba/msforms/XShape.hpp>
-+#include <com/sun/star/drawing/XShape.hpp>
-+#include <com/sun/star/frame/XModel.hpp>
-+
- #include "vbaglobals.hxx"
- #include "vbacomments.hxx"
--
-+#include "vbacommentshape.hxx"
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-@@ -119,6 +129,39 @@ ScVbaComment::setAuthor( const rtl::OUString& /*_author*/ ) throw (uno::RuntimeE
- // #TODO #FIXME implementation needed
- }
-
-+uno::Any SAL_CALL ScVbaComment::getShape() throw (uno::RuntimeException)
-+{
-+ ScDocShell* pDocShell = excel::GetDocShellFromRange( mxRange );
-+ if ( !pDocShell && !pDocShell->GetModel().is() )
-+ {
-+ return uno::Any();
-+ }
-+
-+ // Get drawing::XShape
-+ uno::Reference< drawing::XShape > xShape;
-+ table::CellAddress aAddress = getAnnotation()->getPosition();
-+ ScAddress aPos( aAddress.Column, aAddress.Row, aAddress.Sheet );
-+ ScPostIt* pNote = pDocShell->GetDocument() ? pDocShell->GetDocument()->GetNote( aPos ) : NULL;
-+ if ( pNote && pNote->GetCaption() )
-+ {
-+ xShape.set( pNote->GetCaption()->getUnoShape(), uno::UNO_QUERY_THROW );
-+ }
-+ if ( !xShape.is() )
-+ {
-+ return uno::Any();
-+ }
-+
-+ // Get drawing::XShapes
-+ uno::Reference< sheet::XSheetCellRange > xSheetCellRange( mxRange, uno::UNO_QUERY_THROW );
-+ uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( xSheetCellRange->getSpreadsheet(), uno::UNO_QUERY_THROW );
-+ uno::Reference< drawing::XShapes > xShapes( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
-+
-+ // Get frame::XModel
-+ uno::Reference< frame::XModel > xModel = pDocShell->GetModel();
-+
-+ return uno::makeAny( uno::Reference< msforms::XShape >(new ScVbaCommentShape( this, mxContext, xShape, this, xShapes, xModel, office::MsoShapeType::msoComment ) ) );
-+}
-+
- sal_Bool SAL_CALL
- ScVbaComment::getVisible() throw (uno::RuntimeException)
- {
-@@ -158,8 +201,7 @@ ScVbaComment::Text( const uno::Any& aText, const uno::Any& aStart, const uno::An
- aText >>= sText;
-
- uno::Reference< text::XSimpleText > xAnnoText( getAnnotation(), uno::UNO_QUERY_THROW );
-- rtl::OUString sAnnoText = xAnnoText->getString();
--
-+
- if ( aStart.hasValue() )
- {
- sal_Int16 nStart = 0;
-@@ -191,8 +233,13 @@ ScVbaComment::Text( const uno::Any& aText, const uno::Any& aStart, const uno::An
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ScVbaComment::Text - bad Start value " ) ), uno::Reference< uno::XInterface >() );
- }
- else if ( aText.hasValue() )
-- xAnnoText->setString( sText );
-+ {
-+ uno::Reference< sheet::XCellAddressable > xCellAddr(mxRange->getCellByPosition(0, 0), uno::UNO_QUERY_THROW );
-+ table::CellAddress aAddress = xCellAddr->getCellAddress();
-+ getAnnotations()->insertNew( aAddress, sText );
-+ }
-
-+ rtl::OUString sAnnoText = xAnnoText->getString();
- return sAnnoText;
- }
-
-diff --git sc/source/ui/vba/vbacomment.hxx sc/source/ui/vba/vbacomment.hxx
-index 02f0f97..24df922 100644
---- sc/source/ui/vba/vbacomment.hxx
-+++ sc/source/ui/vba/vbacomment.hxx
-@@ -57,6 +57,7 @@ public:
- // Attributes
- virtual rtl::OUString SAL_CALL getAuthor() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setAuthor( const rtl::OUString& _author ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL getShape() 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);
-
-diff --git sc/source/ui/vba/vbacomments.cxx sc/source/ui/vba/vbacomments.cxx
-index 86aa71d..21b185a 100644
---- sc/source/ui/vba/vbacomments.cxx
-+++ sc/source/ui/vba/vbacomments.cxx
-@@ -47,7 +47,7 @@ uno::Any AnnotationToComment( const uno::Any& aSource, uno::Reference< uno::XCom
- class CommentEnumeration : public EnumerationHelperImpl
- {
- public:
-- CommentEnumeration( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xContext, xEnumeration ) {}
-+ CommentEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xParent, xContext, xEnumeration ) {}
-
- virtual uno::Any SAL_CALL nextElement() throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
- {
-@@ -68,7 +68,7 @@ ScVbaComments::createEnumeration() throw (uno::RuntimeException)
- {
- uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
-
-- return new CommentEnumeration( mxContext, xEnumAccess->createEnumeration() );
-+ return new CommentEnumeration( mxParent, mxContext, xEnumAccess->createEnumeration() );
- }
-
- uno::Any
-diff --git sc/source/ui/vba/vbacommentshape.cxx sc/source/ui/vba/vbacommentshape.cxx
-new file mode 100644
-index 0000000..ab97ac4
---- /dev/null
-+++ sc/source/ui/vba/vbacommentshape.cxx
-@@ -0,0 +1,46 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009, 2010.
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#include "vbacommentshape.hxx"
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+
-+ScVbaCommentShape::ScVbaCommentShape( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape >& xShape, const uno::Reference< excel::XComment >& xComment,
-+ const uno::Reference< drawing::XShapes >& xShapes, const uno::Reference< frame::XModel >& xModel, sal_Int32 nType ) : ScVbaShape( xParent, xContext, xShape, xShapes, xModel, nType )
-+{
-+ m_xComment.set( xComment, uno::UNO_QUERY );
-+}
-+
-+void SAL_CALL ScVbaCommentShape::Delete() throw (uno::RuntimeException)
-+{
-+ if ( m_xComment.is() )
-+ {
-+ m_xComment->Delete();
-+ }
-+}
-diff --git sc/source/ui/vba/vbacommentshape.hxx sc/source/ui/vba/vbacommentshape.hxx
-new file mode 100644
-index 0000000..ce1c9ed
---- /dev/null
-+++ sc/source/ui/vba/vbacommentshape.hxx
-@@ -0,0 +1,46 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009, 2010.
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef SC_VBA_COMMENTSHAPE_HXX
-+#define SC_VBA_COMMENTSHAPE_HXX
-+
-+#include <ooo/vba/excel/XComment.hpp>
-+#include <vbahelper/vbashape.hxx>
-+
-+class ScVbaCommentShape : public ScVbaShape
-+{
-+ css::uno::Reference< ooo::vba::excel::XComment > m_xComment;
-+
-+public:
-+ ScVbaCommentShape( 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< ooo::vba::excel::XComment >& xComment, const css::uno::Reference< css::drawing::XShapes >& xShapes, const css::uno::Reference< css::frame::XModel >& xModel, sal_Int32 nType );
-+
-+ // Methods
-+ virtual void SAL_CALL Delete() throw (css::uno::RuntimeException);
-+};
-+#endif //SC_VBA_COMMENTSHAPE_HXX
-diff --git sc/source/ui/vba/vbadialog.cxx sc/source/ui/vba/vbadialog.cxx
-index 891ac75..db56765 100644
---- sc/source/ui/vba/vbadialog.cxx
-+++ sc/source/ui/vba/vbadialog.cxx
-@@ -29,42 +29,58 @@
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-
--static const rtl::OUString aStringList[]=
-+//liuchen 2009-7-27
-+//solve the problem that "Application.Dialogs.Item(***).Show" and "Application.Dialogs.Count" cannot get the correct result
-+struct DialogMatch
- {
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Open" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormatCellDialog" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertCell" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Print" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:PasteSpecial" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ToolProtectionDocument" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ColumnWidth" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DefineName" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ConfigureDialog" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:HyperlinkDialog" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertGraphic" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertObject" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:PageFormatDialog" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DataSort" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:RowHeight" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:AutoCorrectDlg" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ConditionalFormatDialog" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DataConsolidate" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CreateNames" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillSeries" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Validation") ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DefineLabelRange" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DataFilterAutoFilter" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DataFilterSpecialFilter" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:AutoFormat" ) )
-+ sal_Int32 nVbaDlgIndex;
-+ rtl::OUString aOODlgName;
- };
-
--const sal_Int32 nDialogSize = sizeof( aStringList ) / sizeof( aStringList[ 0 ] );
-+static const DialogMatch aDialogMatchList[] =
-+{
-+ { 1, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Open" ) ) }, // xlDialogOpen -> .uno:Open
-+ { -1, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormatCellDialog" ) ) }, // ??? -> .uno:FormatCellDialog
-+ { 55, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertCell" ) ) }, // xlDialogInsert -> .uno:InsertCell
-+ { 8, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Print" ) ) }, // xlDialogPrint -> .uno:Print
-+ { 9, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:PrinterSetup" ) ) }, // xlDialogPrinterSetup -> .uno:PrinterSetup
-+ { 53, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:PasteSpecial" ) ) }, // xlDialogPasteSpecial -> .uno:PasteSpecial
-+ { 28, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ToolProtectionDocument" ) ) }, // xlDialogProtectDocument -> uno:ToolProtectionDocument
-+ { 47, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ColumnWidth" ) ) }, // xlDialogColumnWidth -> .uno:ColumnWidth
-+ { 61, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DefineName" ) ) }, // xlDialogDefineName -> .uno:DefineName
-+ { -1, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ConfigureDialog" ) ) }, // ??? -> .uno:ConfigureDialog
-+ { 596, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:HyperlinkDialog" ) ) }, // xlDialogInsertHyperlink -> .uno:HyperlinkDialog
-+ { 342, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertGraphic" ) ) }, // xlDialogInsertPicture -> .uno:InsertGraphic
-+ { 259, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertObject" ) ) }, // xlDialogInsertObject -> .uno:InsertObject
-+ { 7, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:PageFormatDialog" ) ) }, // xlDialogPageSetup -> .uno:PageFormatDialog
-+ { 39, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DataSort" ) ) }, // xlDialogSort -> .uno:DataSort
-+ { 127, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:RowHeight" ) ) }, // xlDialogRowHeight -> .uno:RowHeight
-+ { 485, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:AutoCorrectDlg" ) ) }, // xlDialogAutoCorrect -> .uno:AutoCorrectDlg
-+ { 583, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ConditionalFormatDialog" ) ) }, // xlDialogCondiationalFormatting -> .uno:ConditionalFormatDialog
-+ { 191, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DataConsolidate" ) ) }, // xlDialogConsolidate -> .uno:DataConsolidate
-+ { 62, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CreateNames" ) ) }, // xlDialogCreateNames -> .uno:CreateNames
-+ { -1, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillSeries" ) ) }, // ??? -> .uno:FillSeries
-+ { -1, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Validation" ) ) }, // ??? -> .uno:Validation"
-+ { -1, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DefineLabelRange" ) ) }, // ??? -> .uno:DefineLabelRange
-+ { -1, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DataFilterAutoFilter" ) ) }, // ??? -> .uno:DataFilterAutoFilter
-+ { -1, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DataFilterSpecialFilter" ) ) }, // ??? -> .uno:DataFilterSpecialFilter
-+ { 269, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:AutoFormat" ) ) } // xlDialogFormatAuto -> .uno:AutoFormat
-+};
-+
-+const sal_Int32 nDialogSize = sizeof( aDialogMatchList ) / sizeof( aDialogMatchList[ 0 ] );
-
-+//liuchen modified 2009-2-27
- rtl::OUString
- ScVbaDialog::mapIndexToName( sal_Int32 nIndex )
- {
-- if( nIndex < nDialogSize )
-- return aStringList[ nIndex ];
-+ for (int i = 0; i < nDialogSize; i++)
-+ {
-+ if ( aDialogMatchList[i].nVbaDlgIndex == nIndex )
-+ {
-+ return aDialogMatchList[i].aOODlgName;
-+ }
-+ }
-+
- return rtl::OUString();
- }
-
-@@ -86,3 +102,9 @@ ScVbaDialog::getServiceNames()
- }
- return aServiceNames;
- }
-+
-+//liuchen add 2009-7-27
-+sal_Int32 ScVbaDialog::GetSupportedDialogCount()
-+{
-+ return nDialogSize;
-+}
-\ No newline at end of file
-diff --git sc/source/ui/vba/vbadialog.hxx sc/source/ui/vba/vbadialog.hxx
-index a886fe3..ffbfb84 100644
---- sc/source/ui/vba/vbadialog.hxx
-+++ sc/source/ui/vba/vbadialog.hxx
-@@ -45,6 +45,9 @@ public:
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+
-+ //liuchen 2009-7-27
-+ static sal_Int32 GetSupportedDialogCount();
- };
-
- #endif /* SC_VBA_DIALOG_HXX */
-diff --git sc/source/ui/vba/vbadialogs.cxx sc/source/ui/vba/vbadialogs.cxx
-index 16d3dcb..0ff0bb6 100644
---- sc/source/ui/vba/vbadialogs.cxx
-+++ sc/source/ui/vba/vbadialogs.cxx
-@@ -64,5 +64,13 @@ ScVbaDialogs::getServiceNames()
- return aServiceNames;
- }
-
-+//liuchen 2009-7-27
-+::sal_Int32
-+ScVbaDialogs::getCount() throw (uno::RuntimeException)
-+{
-+ return ScVbaDialog::GetSupportedDialogCount();
-+}
-+
-+
-
-
-diff --git sc/source/ui/vba/vbadialogs.hxx sc/source/ui/vba/vbadialogs.hxx
-index 20fae2d..980dbf9 100644
---- sc/source/ui/vba/vbadialogs.hxx
-+++ sc/source/ui/vba/vbadialogs.hxx
-@@ -44,6 +44,7 @@ public:
-
- // XCollection
- virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException); //liuchen 2009-7-27
-
- // XDialogs
- virtual void SAL_CALL Dummy() throw (css::uno::RuntimeException);
-diff --git sc/source/ui/vba/vbaeventshelper.cxx sc/source/ui/vba/vbaeventshelper.cxx
-new file mode 100644
-index 0000000..db7340e
---- /dev/null
-+++ sc/source/ui/vba/vbaeventshelper.cxx
-@@ -0,0 +1,1079 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: vbaeventshelper.cxx,v $
-+ *
-+ * $Revision: 1.0 $
-+ *
-+ * last change: $Author: vg $ $Date: 2007/12/07 10:42:26 $
-+ *
-+ * 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, 2010 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 "vbaeventshelper.hxx"
-+#include <vbahelper/helperdecl.hxx>
-+#include <sfx2/objsh.hxx>
-+#include "scextopt.hxx"
-+#include <sfx2/evntconf.hxx>
-+#include <sfx2/event.hxx>
-+#include <sfx2/sfx.hrc>
-+#include <toolkit/unohlp.hxx>
-+#include <comphelper/processfactory.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/sheet/XSheetCellRangeContainer.hpp>
-+#include <com/sun/star/document/XEventsSupplier.hpp>
-+#include <com/sun/star/sheet/XCellRangeReferrer.hpp>
-+#include <com/sun/star/table/XCell.hpp>
-+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
-+#include <com/sun/star/sheet/XSpreadsheet.hpp>
-+#include <com/sun/star/container/XNamed.hpp>
-+#include <com/sun/star/awt/WindowEvent.hpp>
-+#include <com/sun/star/lang/EventObject.hpp>
-+#include <com/sun/star/util/XCloseListener.hpp>
-+#include <com/sun/star/util/XCloseBroadcaster.hpp>
-+#include <com/sun/star/frame/XControllerBorder.hpp>
-+#include <com/sun/star/frame/XBorderResizeListener.hpp>
-+#include <com/sun/star/util/XChangesListener.hpp>
-+#include <com/sun/star/util/ElementChange.hpp>
-+#include <com/sun/star/util/XChangesNotifier.hpp>
-+#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
-+#include <cellsuno.hxx>
-+#include <convuno.hxx>
-+#include <map>
-+#include <filter/msfilter/msvbahelper.hxx>
-+#include <vcl/svapp.hxx>
-+#include <basic/basmgr.hxx>
-+#include <ooo/vba/XHelperInterface.hpp>
-+
-+using namespace std;
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+using namespace com::sun::star::document::VbaEventId;
-+
-+typedef ::cppu::WeakImplHelper1< util::XChangesListener > WorksheetChangeListener_BASE;
-+
-+class WorksheetChangeListener : public WorksheetChangeListener_BASE
-+{
-+private:
-+ ScVbaEventsHelper* pVbaEventsHelper;
-+public:
-+ WorksheetChangeListener(ScVbaEventsHelper* pHelper ) : pVbaEventsHelper( pHelper ){}
-+ virtual void SAL_CALL changesOccurred(const util::ChangesEvent& /*aEvent*/) throw (uno::RuntimeException);
-+ virtual void SAL_CALL disposing(const lang::EventObject& /*aSource*/) throw(uno::RuntimeException){}
-+};
-+
-+void WorksheetChangeListener::changesOccurred(const util::ChangesEvent& aEvent) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nCount = aEvent.Changes.getLength();
-+ if( nCount == 0 )
-+ return;
-+
-+ util::ElementChange aChange = aEvent.Changes[ 0 ];
-+ rtl::OUString sOperation;
-+ aChange.Accessor >>= sOperation;
-+ if( !sOperation.equalsIgnoreAsciiCaseAscii("cell-change") )
-+ return;
-+
-+ if( nCount == 1 )
-+ {
-+ uno::Reference< table::XCellRange > xRangeObj;
-+ aChange.ReplacedElement >>= xRangeObj;
-+ if( xRangeObj.is() )
-+ {
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] <<= xRangeObj;
-+ pVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKSHEET_CHANGE, aArgs );
-+ }
-+ return;
-+ }
-+
-+ ScRangeList aRangeList;
-+ for( sal_Int32 nIndex = 0; nIndex < nCount; ++nIndex )
-+ {
-+ aChange = aEvent.Changes[ nIndex ];
-+ aChange.Accessor >>= sOperation;
-+ uno::Reference< table::XCellRange > xRangeObj;
-+ aChange.ReplacedElement >>= xRangeObj;
-+ if( xRangeObj.is() && sOperation.equalsIgnoreAsciiCaseAscii("cell-change") )
-+ {
-+ uno::Reference< sheet::XCellRangeAddressable > xCellRangeAddressable( xRangeObj, uno::UNO_QUERY );
-+ if( xCellRangeAddressable.is() )
-+ {
-+ ScRange aRange;
-+ ScUnoConversion::FillScRange( aRange, xCellRangeAddressable->getRangeAddress() );
-+ aRangeList.Append( aRange );
-+ }
-+ }
-+ }
-+
-+ if( aRangeList.Count() > 0 )
-+ {
-+ uno::Reference< sheet::XSheetCellRangeContainer > xRanges( new ScCellRangesObj( pVbaEventsHelper->getDocumentShell(), aRangeList ) );
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] <<= xRanges;
-+ pVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKSHEET_CHANGE, aArgs );
-+ }
-+}
-+
-+typedef ::cppu::WeakImplHelper3< awt::XWindowListener, util::XCloseListener, frame::XBorderResizeListener > WindowListener_BASE;
-+
-+// This class is to process Workbook window related event
-+class VbaEventsListener : public WindowListener_BASE
-+{
-+ ::osl::Mutex m_aMutex;
-+ ScVbaEventsHelper* pVbaEventsHelper;
-+ uno::Reference< frame::XModel > m_xModel;
-+ sal_Bool m_bWindowResized;
-+ sal_Bool m_bBorderChanged;
-+protected :
-+ uno::Reference< awt::XWindow > GetContainerWindow();
-+ uno::Reference< frame::XFrame > GetFrame();
-+ sal_Bool IsMouseReleased();
-+ DECL_LINK( fireResizeMacro, void* );
-+ void processWindowResizeMacro();
-+public :
-+ VbaEventsListener( ScVbaEventsHelper* pHelper );
-+ ~VbaEventsListener();
-+ void startEventsLinstener();
-+ void stopEventsLinstener();
-+ // XWindowListener
-+ virtual void SAL_CALL windowResized( const awt::WindowEvent& aEvent ) throw ( uno::RuntimeException );
-+ virtual void SAL_CALL windowMoved( const awt::WindowEvent& aEvent ) throw ( uno::RuntimeException );
-+ virtual void SAL_CALL windowShown( const lang::EventObject& aEvent ) throw ( uno::RuntimeException );
-+ virtual void SAL_CALL windowHidden( const lang::EventObject& aEvent ) throw ( uno::RuntimeException );
-+ virtual void SAL_CALL disposing( const lang::EventObject& aEvent ) throw ( uno::RuntimeException );
-+ // XCloseListener
-+ virtual void SAL_CALL queryClosing( const lang::EventObject& Source, ::sal_Bool GetsOwnership ) throw (util::CloseVetoException, uno::RuntimeException);
-+ virtual void SAL_CALL notifyClosing( const lang::EventObject& Source ) throw (uno::RuntimeException);
-+ // XBorderResizeListener
-+ virtual void SAL_CALL borderWidthsChanged( const uno::Reference< uno::XInterface >& aObject, const frame::BorderWidths& aNewSize ) throw (uno::RuntimeException);
-+};
-+VbaEventsListener::VbaEventsListener( ScVbaEventsHelper* pHelper ) : pVbaEventsHelper( pHelper )
-+{
-+ OSL_TRACE("VbaEventsListener::VbaEventsListener( 0x%x ) - ctor ", this );
-+ m_xModel.set( pVbaEventsHelper->getDocument()->GetDocumentShell()->GetModel(), uno::UNO_QUERY );
-+ m_bWindowResized = sal_False;
-+ m_bBorderChanged = sal_False;
-+}
-+
-+VbaEventsListener::~VbaEventsListener()
-+{
-+ OSL_TRACE("VbaEventsListener::~VbaEventsListener( 0x%x ) - dtor ", this );
-+}
-+uno::Reference< frame::XFrame >
-+VbaEventsListener::GetFrame()
-+{
-+ try
-+ {
-+ if( pVbaEventsHelper )
-+ {
-+ if( m_xModel.is() )
-+ {
-+ uno::Reference< frame::XController > xController( m_xModel->getCurrentController(), uno::UNO_QUERY );
-+ if( xController.is() )
-+ {
-+ uno::Reference< frame::XFrame > xFrame( xController->getFrame(), uno::UNO_QUERY );
-+ if( xFrame.is() )
-+ {
-+ return xFrame;
-+ }
-+ }
-+ }
-+ }
-+ }
-+ catch( uno::Exception& /*e*/ )
-+ {
-+ }
-+ return uno::Reference< frame::XFrame >();
-+}
-+uno::Reference< awt::XWindow >
-+VbaEventsListener::GetContainerWindow()
-+{
-+ try
-+ {
-+ uno::Reference< frame::XFrame > xFrame( GetFrame(), uno::UNO_QUERY );
-+ if( xFrame.is() )
-+ {
-+ uno::Reference< awt::XWindow > xWindow( xFrame->getContainerWindow(), uno::UNO_QUERY );
-+ if( xWindow.is() )
-+ return xWindow;
-+ }
-+ }
-+ catch( uno::Exception& /*e*/ )
-+ {
-+ }
-+ return uno::Reference< awt::XWindow >();
-+}
-+sal_Bool
-+VbaEventsListener::IsMouseReleased()
-+{
-+ Window* pWindow = (VCLUnoHelper::GetWindow( GetContainerWindow() ) );
-+ if( pWindow )
-+ {
-+ Window::PointerState aPointerState = pWindow->GetPointerState();
-+ if( !aPointerState.mnState & ( MOUSE_LEFT | MOUSE_MIDDLE | MOUSE_RIGHT ) )
-+ return sal_True;
-+ }
-+ return sal_False;
-+}
-+void
-+VbaEventsListener::startEventsLinstener()
-+{
-+ if( m_xModel.is() )
-+ {
-+ // add window listener
-+ uno::Reference< awt::XWindow > xWindow( GetContainerWindow(), uno::UNO_QUERY );
-+ if( xWindow.is() )
-+ xWindow->addWindowListener( this );
-+ // add close listener
-+ //uno::Reference< util::XCloseBroadcaster > xCloseBroadcaster( GetFrame(), uno::UNO_QUERY );
-+ uno::Reference< util::XCloseBroadcaster > xCloseBroadcaster( m_xModel, uno::UNO_QUERY );
-+ if( xCloseBroadcaster.is() )
-+ {
-+ xCloseBroadcaster->addCloseListener( this );
-+ }
-+ // add Border resize listener
-+ try
-+ {
-+ uno::Reference< frame::XController > xController( m_xModel->getCurrentController(), uno::UNO_QUERY );
-+ if( xController.is() )
-+ {
-+ uno::Reference< frame::XControllerBorder > xControllerBorder( xController, uno::UNO_QUERY );
-+ if( xControllerBorder.is() )
-+ {
-+ xControllerBorder->addBorderResizeListener( this );
-+ }
-+ }
-+ }
-+ catch( uno::Exception& e) {} // Disposed already most likely
-+ }
-+}
-+void
-+VbaEventsListener::stopEventsLinstener()
-+{
-+ if( m_xModel.is() )
-+ {
-+ uno::Reference< awt::XWindow > xWindow( GetContainerWindow(), uno::UNO_QUERY );
-+ if( xWindow.is() )
-+ {
-+ xWindow->removeWindowListener( this );
-+ }
-+ //uno::Reference< util::XCloseBroadcaster > xCloseBroadcaster( GetFrame(), uno::UNO_QUERY );
-+ uno::Reference< util::XCloseBroadcaster > xCloseBroadcaster( m_xModel, uno::UNO_QUERY );
-+ if( xCloseBroadcaster.is() )
-+ {
-+ xCloseBroadcaster->removeCloseListener( this );
-+ }
-+ try
-+ {
-+ uno::Reference< frame::XController > xController( m_xModel->getCurrentController(), uno::UNO_QUERY );
-+ if( xController.is() )
-+ {
-+ uno::Reference< frame::XControllerBorder > xControllerBorder( xController, uno::UNO_QUERY );
-+ if( xControllerBorder.is() )
-+ {
-+ xControllerBorder->removeBorderResizeListener( this );
-+ }
-+ }
-+ }
-+ catch ( uno::Exception& e ){}
-+ }
-+ pVbaEventsHelper = NULL;
-+}
-+
-+void
-+VbaEventsListener::processWindowResizeMacro()
-+{
-+ OSL_TRACE("**** Attempt to FIRE MACRO **** ");
-+ if( pVbaEventsHelper )
-+ pVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_WINDOWRESIZE, uno::Sequence< uno::Any >() );
-+}
-+
-+IMPL_LINK( VbaEventsListener, fireResizeMacro, void*, /*pParam*/ )
-+{
-+ if ( pVbaEventsHelper )
-+ {
-+ if( IsMouseReleased() )
-+ processWindowResizeMacro();
-+ }
-+ release();
-+ return 0;
-+}
-+
-+void SAL_CALL
-+VbaEventsListener::windowResized( const awt::WindowEvent& /*aEvent*/ ) throw ( uno::RuntimeException )
-+{
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ // Workbook_window_resize event
-+ m_bWindowResized = sal_True;
-+ Window* pWindow = (VCLUnoHelper::GetWindow( GetContainerWindow() ) );
-+
-+ if( pWindow && m_bBorderChanged )
-+ {
-+ m_bBorderChanged = m_bWindowResized = sal_False;
-+ acquire(); // ensure we don't get deleted before the event is handled
-+ Application::PostUserEvent( LINK( this, VbaEventsListener, fireResizeMacro ), NULL );
-+ }
-+}
-+void SAL_CALL
-+VbaEventsListener::windowMoved( const awt::WindowEvent& /*aEvent*/ ) throw ( uno::RuntimeException )
-+{
-+ // not interest this time
-+}
-+void SAL_CALL
-+VbaEventsListener::windowShown( const lang::EventObject& /*aEvent*/ ) throw ( uno::RuntimeException )
-+{
-+ // not interest this time
-+}
-+void SAL_CALL
-+VbaEventsListener::windowHidden( const lang::EventObject& /*aEvent*/ ) throw ( uno::RuntimeException )
-+{
-+ // not interest this time
-+}
-+void SAL_CALL
-+VbaEventsListener::disposing( const lang::EventObject& /*aEvent*/ ) throw ( uno::RuntimeException )
-+{
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ OSL_TRACE("VbaEventsListener::disposing(0x%x)", this);
-+ pVbaEventsHelper = NULL;
-+}
-+void SAL_CALL
-+VbaEventsListener::queryClosing( const lang::EventObject& /*Source*/, ::sal_Bool /*GetsOwnership*/ ) throw (util::CloseVetoException, uno::RuntimeException)
-+{
-+ // it can cancel the close, but need to throw a CloseVetoException, and it will be transmit to caller.
-+}
-+void SAL_CALL
-+VbaEventsListener::notifyClosing( const lang::EventObject& /*Source*/ ) throw (uno::RuntimeException)
-+{
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ stopEventsLinstener();
-+}
-+void SAL_CALL
-+VbaEventsListener::borderWidthsChanged( const uno::Reference< uno::XInterface >& /*aObject*/, const frame::BorderWidths& /*aNewSize*/ ) throw (uno::RuntimeException)
-+{
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ // work with WindowResized event to guard Window Resize event.
-+ m_bBorderChanged = sal_True;
-+ Window* pWindow = (VCLUnoHelper::GetWindow( GetContainerWindow() ) );
-+ if( pWindow && m_bWindowResized )
-+ {
-+ m_bWindowResized = m_bBorderChanged = sal_False;
-+ acquire(); // ensure we don't get deleted before the timer fires.
-+ Application::PostUserEvent( LINK( this, VbaEventsListener, fireResizeMacro ), NULL );
-+ }
-+}
-+
-+ScVbaEventsHelper::ScVbaEventsHelper( uno::Sequence< css::uno::Any > const& aArgs, uno::Reference< uno::XComponentContext > const& xContext ) : VbaEventsHelperBase( xContext ), mbOpened( sal_False ), mbDocDisposed( false )
-+{
-+ Initilize();
-+ uno::Reference< frame::XModel > xModel ( getXSomethingFromArgs< frame::XModel >( aArgs, 0 ), uno::UNO_QUERY );
-+ pDocShell = excel::getDocShell( xModel );
-+ pDoc = pDocShell->GetDocument();
-+ // Add worksheet change listener
-+ uno::Reference< util::XChangesNotifier > xChangesNotifier( xModel, uno::UNO_QUERY );
-+ if( xChangesNotifier.is() )
-+ xChangesNotifier->addChangesListener( uno::Reference< util::XChangesListener >( new WorksheetChangeListener( this ) ) );
-+ if ( xModel.is() )
-+ {
-+ uno::Reference< lang::XComponent > xComponent( xModel, uno::UNO_QUERY );
-+ if ( xComponent.is() )
-+ {
-+ xComponent->addEventListener( this );
-+ }
-+ }
-+}
-+
-+ScVbaEventsHelper::~ScVbaEventsHelper()
-+{
-+ stopListening();
-+}
-+
-+void ScVbaEventsHelper::stopListening()
-+{
-+ if ( mbDocDisposed )
-+ return;
-+ uno::Reference< frame::XModel > xModel( getDocument()->GetDocumentShell()->GetModel(), uno::UNO_QUERY );
-+ if ( xModel.is() )
-+ {
-+ uno::Reference< lang::XComponent > xComponent( xModel, uno::UNO_QUERY );
-+ if ( xComponent.is() )
-+ {
-+ try
-+ {
-+ xComponent->removeEventListener( this );
-+ }
-+ catch( uno::Exception& e ) {}
-+ }
-+ }
-+ if ( xModel.is() )
-+ {
-+ uno::Reference< lang::XComponent > xComponent( xModel, uno::UNO_QUERY );
-+ if ( xComponent.is() )
-+ {
-+ xComponent->addEventListener( this );
-+ }
-+ }
-+}
-+
-+#define CREATEOUSTRING(asciistr) rtl::OUString::createFromAscii(asciistr)
-+
-+#define INSERT_EVENT_INFO( Object, Event, ObjectName, EventName ) \
-+ insert( VBAEVENT_##Object##_##Event, ObjectName + CREATEOUSTRING( EventName ) )
-+
-+#define INSERT_WORKSHEET_EVENT_INFO( Event, EventName ) \
-+ INSERT_EVENT_INFO( WORKSHEET, Event,CREATEOUSTRING("Worksheet_"), EventName ); \
-+ INSERT_EVENT_INFO( WORKBOOK_SHEET, Event, CREATEOUSTRING("Workbook_Sheet"), EventName )
-+
-+#define INSERT_WORKBOOK_EVENT_INFO( Event, EventName ) \
-+ INSERT_EVENT_INFO( WORKBOOK, Event, CREATEOUSTRING("Workbook_"), EventName )
-+
-+void ScVbaEventsHelper::Initilize()
-+{
-+ INSERT_WORKSHEET_EVENT_INFO( ACTIVATE, "Activate");
-+ INSERT_WORKSHEET_EVENT_INFO( BEFOREDOUBLECLICK, "BeforeDoubleClick" );
-+ INSERT_WORKSHEET_EVENT_INFO( BEFORERIGHTCLICK, "BeforeRightClick" );
-+ INSERT_WORKSHEET_EVENT_INFO( CALCULATE, "Calculate" );
-+ INSERT_WORKSHEET_EVENT_INFO( CHANGE, "Change" );
-+ INSERT_WORKSHEET_EVENT_INFO( DEACTIVATE, "Deactivate" );
-+ INSERT_WORKSHEET_EVENT_INFO( FOLLOWHYPERLINK, "FollowHyperlink" );
-+ INSERT_WORKSHEET_EVENT_INFO( PIVOTTABLEUPDATE, "PivotTableUpdate" );
-+ INSERT_WORKSHEET_EVENT_INFO( SELECTIONCHANGE, "SelectionChange" );
-+
-+ // Workbook
-+ INSERT_WORKBOOK_EVENT_INFO( ACTIVATE, "Activate" );
-+ INSERT_WORKBOOK_EVENT_INFO( DEACTIVATE, "Deactivate" );
-+ INSERT_WORKBOOK_EVENT_INFO( OPEN, "Open" );
-+ // AUTOOPEN doesn't be used. TODO, this should be "auto_open"
-+ insert( VBAEVENT_WORKBOOK_AUTOOPEN, CREATEOUSTRING("Auto_Open") );
-+ INSERT_WORKBOOK_EVENT_INFO( BEFORECLOSE, "BeforeClose" );
-+ INSERT_WORKBOOK_EVENT_INFO( BEFOREPRINT, "BeforePrint" );
-+ INSERT_WORKBOOK_EVENT_INFO( BEFORESAVE, "BeforeSave" );
-+ INSERT_WORKBOOK_EVENT_INFO( NEWSHEET, "NewSheet" );
-+ INSERT_WORKBOOK_EVENT_INFO( WINDOWACTIVATE, "WindowActivate" );
-+ INSERT_WORKBOOK_EVENT_INFO( WINDOWDEACTIVATE, "WindowDeactivate" );
-+ INSERT_WORKBOOK_EVENT_INFO( WINDOWRESIZE, "WindowResize" );
-+}
-+
-+uno::Any ScVbaEventsHelper::createWorkSheet( ScDocument* pDok, SCTAB nTab )
-+{
-+ uno::Any aRet;
-+ try
-+ {
-+ String tmpCodeName;
-+ pDok->GetCodeName( nTab, tmpCodeName );
-+ aRet <<= ov::getUnoDocModule( tmpCodeName, pDok->GetDocumentShell() );
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ }
-+ return aRet;
-+}
-+
-+uno::Any ScVbaEventsHelper::createRange( const uno::Any& aRange )
-+{
-+ uno::Any aRet;
-+ try
-+ {
-+ uno::Reference< sheet::XSheetCellRangeContainer > xRanges( aRange, uno::UNO_QUERY );
-+ uno::Reference< table::XCellRange > xRange( aRange, uno::UNO_QUERY );
-+ uno::Reference< lang::XMultiComponentFactory > xSMgr( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xProps( xSMgr, uno::UNO_QUERY_THROW );
-+ if ( xRanges.is() || xRange.is() )
-+ {
-+ uno::Reference<uno::XComponentContext > xCtx( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
-+ uno::Sequence< uno::Any > aArgs(2);
-+ if ( xRanges.is() )
-+ {
-+ aArgs[0] = uno::makeAny( excel::getUnoSheetModuleObj( xRanges ) );
-+ aArgs[1] <<= xRanges;
-+ }
-+ else if ( xRange.is() )
-+ {
-+ aArgs[0] = uno::makeAny( excel::getUnoSheetModuleObj( xRange ) );
-+ aArgs[1] <<= xRange;
-+ }
-+ else
-+ {
-+ throw uno::RuntimeException(); //
-+ }
-+ aRet <<= ov::createVBAUnoAPIServiceWithArgs( pDoc->GetDocumentShell(), "ooo.vba.excel.Range", aArgs );
-+ }
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ }
-+ return aRet;
-+}
-+
-+uno::Any ScVbaEventsHelper::createHyperlink( const uno::Any& rCell )
-+{
-+ uno::Any aRet;
-+ try
-+ {
-+ uno::Reference< lang::XMultiComponentFactory > xSMgr( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xProps( xSMgr, uno::UNO_QUERY_THROW );
-+ uno::Reference< table::XCell > xCell( rCell, uno::UNO_QUERY );
-+ if( xCell.is() )
-+ {
-+ uno::Reference<uno::XComponentContext > xCtx( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
-+ uno::Sequence< uno::Any > aArgs(2);
-+ aArgs[0] = uno::Any( uno::Reference< uno::XInterface >() ); // dummy parent
-+ aArgs[1] <<= rCell;
-+
-+ aRet <<= ov::createVBAUnoAPIServiceWithArgs( pDoc->GetDocumentShell(), "ooo.vba.excel.Hyperlink", aArgs );
-+ }
-+ else
-+ {
-+ throw uno::RuntimeException(); //
-+ }
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ }
-+ return aRet;
-+}
-+
-+uno::Any ScVbaEventsHelper::createWindow( SfxObjectShell* pShell )
-+{
-+ try
-+ {
-+ uno::Reference< lang::XMultiServiceFactory > xSF( comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
-+ uno::Reference< frame::XModel > xModel( pShell->GetModel(), uno::UNO_QUERY );
-+ uno::Sequence< uno::Any > aWindowArgs(2);
-+ aWindowArgs[0] = uno::Any( createVBAUnoAPIService( pShell, "ooo.vba.Application" ) );
-+ aWindowArgs[1] = uno::Any( xModel );
-+ uno::Reference< uno::XInterface > xWindow( xSF->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Window" ) ), aWindowArgs ), uno::UNO_QUERY );
-+ if( xWindow.is() )
-+ return uno::makeAny( xWindow );
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ }
-+ return uno::Any();
-+}
-+
-+String ScVbaEventsHelper::getSheetModuleName( SCTAB nTab )
-+{
-+ String aCodeName;
-+ pDoc->GetCodeName( nTab, aCodeName);
-+ return aCodeName;
-+}
-+
-+rtl::OUString
-+ScVbaEventsHelper::getMacroPath( const sal_Int32 nEventId, const SCTAB nTab )
-+{
-+ SfxObjectShell* pShell = pDoc->GetDocumentShell();
-+ String sMacroName = getEventName( nEventId );
-+ VBAMacroResolvedInfo sMacroResolvedInfo;
-+ switch( nEventId )
-+ {
-+ // Worksheet
-+ case VBAEVENT_WORKSHEET_ACTIVATE :
-+ case VBAEVENT_WORKSHEET_BEFOREDOUBLECLICK :
-+ case VBAEVENT_WORKSHEET_BEFORERIGHTCLICK :
-+ case VBAEVENT_WORKSHEET_CALCULATE :
-+ case VBAEVENT_WORKSHEET_CHANGE :
-+ case VBAEVENT_WORKSHEET_DEACTIVATE :
-+ case VBAEVENT_WORKSHEET_FOLLOWHYPERLINK :
-+ case VBAEVENT_WORKSHEET_PIVOTTABLEUPDATE :
-+ case VBAEVENT_WORKSHEET_SELECTIONCHANGE :
-+ {
-+ String aSheetModuleName = getSheetModuleName( nTab );
-+ sMacroName.Insert( '.', 0 ).Insert( aSheetModuleName, 0);
-+ sMacroResolvedInfo = resolveVBAMacro( pShell, sMacroName );
-+ break;
-+ }
-+ // Workbook
-+ case VBAEVENT_WORKBOOK_ACTIVATE :
-+ case VBAEVENT_WORKBOOK_DEACTIVATE :
-+ case VBAEVENT_WORKBOOK_OPEN :
-+ case VBAEVENT_WORKBOOK_BEFORECLOSE :
-+ case VBAEVENT_WORKBOOK_BEFOREPRINT :
-+ case VBAEVENT_WORKBOOK_BEFORESAVE :
-+ case VBAEVENT_WORKBOOK_NEWSHEET :
-+ case VBAEVENT_WORKBOOK_WINDOWACTIVATE :
-+ case VBAEVENT_WORKBOOK_WINDOWDEACTIVATE :
-+ case VBAEVENT_WORKBOOK_WINDOWRESIZE :
-+ // Workbook_sheet
-+ case VBAEVENT_WORKBOOK_SHEET_ACTIVATE :
-+ case VBAEVENT_WORKBOOK_SHEET_BEFOREDOUBLECLICK :
-+ case VBAEVENT_WORKBOOK_SHEET_BEFORERIGHTCLICK :
-+ case VBAEVENT_WORKBOOK_SHEET_CALCULATE :
-+ case VBAEVENT_WORKBOOK_SHEET_CHANGE :
-+ case VBAEVENT_WORKBOOK_SHEET_DEACTIVATE :
-+ case VBAEVENT_WORKBOOK_SHEET_FOLLOWHYPERLINK :
-+ case VBAEVENT_WORKBOOK_SHEET_PIVOTTABLEUPDATE :
-+ case VBAEVENT_WORKBOOK_SHEET_SELECTIONCHANGE :
-+ {
-+ ScExtDocOptions* pExtOptions = pDoc->GetExtDocOptions();
-+ String sWorkbookModuleName = pDoc->GetCodeName();
-+ if( pExtOptions )
-+ {
-+ ScExtDocSettings aExtDocSettings = pExtOptions->GetDocSettings();
-+ sWorkbookModuleName = aExtDocSettings.maGlobCodeName;
-+ }
-+
-+ sMacroName.Insert( '.', 0 ).Insert( sWorkbookModuleName, 0);
-+ sMacroResolvedInfo = resolveVBAMacro( pShell, sMacroName );
-+ break;
-+ }
-+ case VBAEVENT_WORKBOOK_AUTOOPEN :
-+ {
-+ sMacroResolvedInfo = resolveVBAMacro( pShell, sMacroName );
-+ break;
-+ }
-+ default:
-+ break;
-+ }
-+ return sMacroResolvedInfo.ResolvedMacro();
-+}
-+
-+sal_Bool ScVbaEventsHelper::processVbaEvent( const sal_Int32 nEventId, const uno::Sequence< uno::Any >& rArgs, const SCTAB nTab )
-+{
-+ SfxObjectShell* pShell = pDoc->GetDocumentShell();
-+
-+ sal_Bool result = sal_False;
-+ sal_Bool bCancel = sal_False;
-+ uno::Sequence< uno::Any > aArgs;
-+ uno::Any aRet;
-+ uno::Any aDummyCaller;
-+
-+ // For most cases, there is no corresponsible event macro in the document.
-+ // It is better fo check if the event macro exists before process the arguments to improve performance.
-+ rtl::OUString sMacroPath = getMacroPath( nEventId, nTab );
-+ if( sMacroPath.getLength() )
-+ {
-+ switch( nEventId )
-+ {
-+ case VBAEVENT_WORKSHEET_ACTIVATE:
-+ case VBAEVENT_WORKSHEET_CALCULATE:
-+ case VBAEVENT_WORKSHEET_DEACTIVATE:
-+ case VBAEVENT_WORKBOOK_ACTIVATE:
-+ case VBAEVENT_WORKBOOK_DEACTIVATE:
-+ case VBAEVENT_WORKBOOK_OPEN:
-+ case VBAEVENT_WORKBOOK_AUTOOPEN:
-+ {
-+ // no arguments
-+ break;
-+ }
-+ case VBAEVENT_WORKBOOK_SHEET_DEACTIVATE:
-+ case VBAEVENT_WORKBOOK_SHEET_CALCULATE:
-+ case VBAEVENT_WORKBOOK_SHEET_ACTIVATE:
-+ case VBAEVENT_WORKBOOK_NEWSHEET:
-+ {
-+ aArgs = uno::Sequence< uno::Any >(1);
-+ aArgs[0] = createWorkSheet( pDoc, nTab );
-+ break;
-+ }
-+ case VBAEVENT_WORKSHEET_CHANGE:
-+ case VBAEVENT_WORKSHEET_SELECTIONCHANGE:
-+ {
-+ // one argument: range
-+ uno::Any aRange = createRange( rArgs[0] );
-+ aArgs = uno::Sequence< uno::Any >(1);
-+ aArgs[0] = aRange;
-+ break;
-+ }
-+ case VBAEVENT_WORKBOOK_SHEET_CHANGE:
-+ case VBAEVENT_WORKBOOK_SHEET_SELECTIONCHANGE:
-+ {
-+ uno::Any aRange = createRange( rArgs[0] );
-+ aArgs = uno::Sequence< uno::Any >(2);
-+ aArgs[0] = createWorkSheet( pDoc, nTab );
-+ aArgs[1] = aRange;
-+ break;
-+ }
-+ case VBAEVENT_WORKSHEET_BEFOREDOUBLECLICK:
-+ case VBAEVENT_WORKSHEET_BEFORERIGHTCLICK:
-+ {
-+ // two aruments: range and cancel
-+ uno::Any aRange = createRange( rArgs[0] );
-+ aArgs = uno::Sequence< uno::Any >(2);
-+ aArgs[0] = aRange;
-+ aArgs[1] <<= bCancel;
-+ // TODO: process "cancel" action
-+ break;
-+ }
-+ case VBAEVENT_WORKBOOK_SHEET_BEFOREDOUBLECLICK:
-+ case VBAEVENT_WORKBOOK_SHEET_BEFORERIGHTCLICK:
-+ {
-+ uno::Any aRange = createRange( rArgs[0] );
-+ aArgs = uno::Sequence< uno::Any >(3);
-+ aArgs[0] = createWorkSheet( pDoc, nTab );
-+ aArgs[1] = aRange;
-+ aArgs[2] <<= bCancel;
-+ // TODO: process "cancel" action
-+ break;
-+ }
-+ case VBAEVENT_WORKSHEET_FOLLOWHYPERLINK:
-+ {
-+ // one argument: hyperlink
-+ uno::Any aHyperlink = createHyperlink( rArgs[0] );
-+ aArgs = uno::Sequence< uno::Any >(1);
-+ aArgs[0] = aHyperlink;
-+ break;
-+ }
-+ case VBAEVENT_WORKBOOK_SHEET_FOLLOWHYPERLINK:
-+ {
-+ uno::Any aHyperlink = createHyperlink( rArgs[0] );
-+ aArgs = uno::Sequence< uno::Any >(2);
-+ aArgs[0] = createWorkSheet( pDoc, nTab );
-+ aArgs[1] = aHyperlink;
-+ break;
-+ }
-+ case VBAEVENT_WORKSHEET_PIVOTTABLEUPDATE:
-+ case VBAEVENT_WORKBOOK_SHEET_PIVOTTABLEUPDATE:
-+ {
-+ // one argument: pivottable
-+ // TODO: not support yet
-+ return result;
-+ }
-+ case VBAEVENT_WORKBOOK_BEFORECLOSE:
-+ case VBAEVENT_WORKBOOK_BEFOREPRINT:
-+ {
-+ // process Cancel argument
-+ aArgs = uno::Sequence< uno::Any >(1);
-+ aArgs[0] <<= bCancel;
-+ executeMacro( pShell, sMacroPath, aArgs, aRet, aDummyCaller );
-+ aArgs[0] >>= bCancel;
-+ return bCancel;
-+ }
-+ case VBAEVENT_WORKBOOK_BEFORESAVE:
-+ {
-+ // two arguments: SaveAs and Cancel
-+ aArgs = uno::Sequence< uno::Any >(2);
-+ aArgs[0] = rArgs[0];
-+ aArgs[1] <<= bCancel;
-+ executeMacro( pShell, sMacroPath, aArgs, aRet, aDummyCaller );
-+ aArgs[1] >>= bCancel;
-+ return bCancel;
-+ }
-+ case VBAEVENT_WORKBOOK_WINDOWACTIVATE:
-+ case VBAEVENT_WORKBOOK_WINDOWDEACTIVATE:
-+ case VBAEVENT_WORKBOOK_WINDOWRESIZE:
-+ {
-+ // one argument: windows
-+ aArgs = uno::Sequence< uno::Any >(1);
-+ aArgs[0] = createWindow( pShell );
-+ break;
-+ }
-+ default:
-+ return result;
-+ }
-+
-+ // excute the macro
-+ result = executeMacro( pShell, sMacroPath, aArgs, aRet, aDummyCaller );
-+ }
-+
-+ return result;
-+}
-+
-+SCTAB ScVbaEventsHelper::getTabFromArgs( const uno::Sequence< uno::Any > aArgs, const sal_Int32 nPos )
-+{
-+ SCTAB nTab = -1;
-+ uno::Reference< sheet::XCellRangeAddressable > xCellRangeAddressable( getXSomethingFromArgs< sheet::XCellRangeAddressable >( aArgs, nPos ), uno::UNO_QUERY );
-+ if( xCellRangeAddressable.is() )
-+ {
-+ table::CellRangeAddress aAddress = xCellRangeAddressable->getRangeAddress();
-+ nTab = aAddress.Sheet;
-+ }
-+ else
-+ {
-+ uno::Reference< sheet::XSheetCellRangeContainer > xRanges( getXSomethingFromArgs< sheet::XSheetCellRangeContainer >( aArgs, nPos ), uno::UNO_QUERY );
-+ if( xRanges.is() )
-+ {
-+ uno::Sequence< table::CellRangeAddress > aRangeAddresses = xRanges->getRangeAddresses();
-+ if( aRangeAddresses.getLength() > 0 )
-+ {
-+ nTab = aRangeAddresses[ 0 ].Sheet;
-+ }
-+ }
-+ }
-+ return nTab;
-+}
-+
-+void
-+ScVbaEventsHelper::disposing(const com::sun::star::lang::EventObject& /*aSource*/ ) throw (com::sun::star::uno::RuntimeException)
-+{
-+ OSL_TRACE("ScVbaEventsHelper::disposing");
-+ stopListening();
-+ mbDocDisposed = true;
-+}
-+
-+// Compares the old selection with the new selection to check if the selection is changed.
-+// Returns sal_True if selection is not changed, otherwise return sal_False.
-+sal_Bool ScVbaEventsHelper::compareSelection( uno::Any oldSelection, uno::Any newSelection )
-+{
-+ ScCellRangesBase* pNewCellRanges = ScCellRangesBase::getImplementation( uno::Reference< uno::XInterface >( oldSelection, uno::UNO_QUERY ) );
-+ ScCellRangesBase* pOldCellRanges = ScCellRangesBase::getImplementation( uno::Reference< uno::XInterface >( newSelection, uno::UNO_QUERY ) );
-+ if ( pNewCellRanges && pOldCellRanges && pNewCellRanges->GetRangeList() == pOldCellRanges->GetRangeList() )
-+ {
-+ return sal_True;
-+ }
-+ return sal_False;
-+}
-+
-+sal_Bool SAL_CALL
-+ScVbaEventsHelper::ProcessCompatibleVbaEvent( sal_Int32 nEventId, const uno::Sequence< uno::Any >& aArgs ) throw (uno::RuntimeException)
-+{
-+ // Get Application Object.
-+ uno::Reference< excel::XApplication > xApplication( m_xApplication.get(), uno::UNO_QUERY );
-+ if ( !xApplication.is() )
-+ {
-+ if ( pDocShell )
-+ {
-+ uno::Any aVBAGlobals;
-+ pDocShell->GetBasicManager()->GetGlobalUNOConstant( "VBAGlobals", aVBAGlobals );
-+ uno::Reference< ::ooo::vba::XHelperInterface > xHelperInterface( aVBAGlobals, uno::UNO_QUERY );
-+ if ( xHelperInterface.is() )
-+ {
-+ m_xApplication = uno::Reference< ::ooo::vba::excel::XApplication >( xHelperInterface->Application(), uno::UNO_QUERY );
-+ xApplication = m_xApplication;
-+ }
-+ }
-+ }
-+
-+ SfxObjectShell* pShell = pDoc->GetDocumentShell();
-+ if( !pShell || mbIgnoreEvents || mbDocDisposed || ( xApplication.is() && !xApplication->getEnableEvents() ) )
-+ return sal_False;
-+
-+ // In order to better support "withevents" in the future,
-+ // it is better to process a event at a time
-+ SCTAB nTab = INVALID_TAB;
-+ switch( nEventId )
-+ {
-+ // Worksheet
-+ case VBAEVENT_WORKSHEET_ACTIVATE:
-+ {
-+ aArgs[0] >>= nTab;
-+ if( nTab != INVALID_TAB )
-+ {
-+ // process the event
-+ processVbaEvent( nEventId, aArgs, nTab );
-+ // recursive process related workbook sheet event.
-+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_SHEET_ACTIVATE, aArgs );
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKSHEET_BEFOREDOUBLECLICK:
-+ {
-+ nTab = getTabFromArgs( aArgs );
-+ if( nTab != INVALID_TAB )
-+ {
-+ processVbaEvent( nEventId, aArgs, nTab );
-+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_SHEET_BEFOREDOUBLECLICK, aArgs );
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKSHEET_BEFORERIGHTCLICK:
-+ {
-+ nTab = getTabFromArgs( aArgs );
-+ if( nTab != INVALID_TAB )
-+ {
-+ processVbaEvent( nEventId, aArgs, nTab );
-+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_SHEET_BEFORERIGHTCLICK, aArgs );
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKSHEET_CALCULATE:
-+ {
-+ aArgs[0] >>= nTab;
-+ if( nTab != INVALID_TAB )
-+ {
-+ processVbaEvent( nEventId, aArgs, nTab );
-+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_SHEET_CALCULATE, aArgs );
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKSHEET_CHANGE:
-+ {
-+ nTab = getTabFromArgs( aArgs );
-+ if( nTab != INVALID_TAB )
-+ {
-+ processVbaEvent( nEventId, aArgs, nTab );
-+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_SHEET_CHANGE, aArgs );
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKSHEET_DEACTIVATE:
-+ {
-+ aArgs[0] >>= nTab;
-+ if( nTab != INVALID_TAB )
-+ {
-+ processVbaEvent( nEventId, aArgs, nTab );
-+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_SHEET_DEACTIVATE, aArgs );
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKSHEET_FOLLOWHYPERLINK:
-+ {
-+ nTab = getTabFromArgs( aArgs );
-+ if( nTab != INVALID_TAB )
-+ {
-+ processVbaEvent( nEventId, aArgs, nTab );
-+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_SHEET_FOLLOWHYPERLINK, aArgs );
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKSHEET_PIVOTTABLEUPDATE:
-+ // TODO
-+ break;
-+ case VBAEVENT_WORKSHEET_SELECTIONCHANGE:
-+ {
-+ nTab = getTabFromArgs( aArgs );
-+ // Check whether the selection is changed. If selection is not changed, then do not fire the SelectionChange event.
-+ if( nTab != INVALID_TAB && !compareSelection( m_curSelection, aArgs[0] ) )
-+ {
-+ m_curSelection = aArgs[0];
-+ processVbaEvent( nEventId, aArgs, nTab );
-+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_SHEET_SELECTIONCHANGE, aArgs );
-+ }
-+ break;
-+ }
-+ // Workbook_sheet
-+ case VBAEVENT_WORKBOOK_SHEET_ACTIVATE:
-+ case VBAEVENT_WORKBOOK_SHEET_CALCULATE:
-+ case VBAEVENT_WORKBOOK_SHEET_DEACTIVATE:
-+ {
-+ aArgs[0] >>= nTab;
-+ if( nTab != INVALID_TAB )
-+ {
-+ processVbaEvent( nEventId, aArgs, nTab );
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKBOOK_SHEET_BEFOREDOUBLECLICK:
-+ case VBAEVENT_WORKBOOK_SHEET_BEFORERIGHTCLICK:
-+ case VBAEVENT_WORKBOOK_SHEET_CHANGE:
-+ case VBAEVENT_WORKBOOK_SHEET_FOLLOWHYPERLINK:
-+ case VBAEVENT_WORKBOOK_SHEET_SELECTIONCHANGE:
-+ {
-+ nTab = getTabFromArgs( aArgs );
-+ if( nTab != INVALID_TAB )
-+ {
-+ processVbaEvent( nEventId, aArgs, nTab );
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKBOOK_SHEET_PIVOTTABLEUPDATE:
-+ // TODO
-+ break;
-+ // Workbook
-+ case VBAEVENT_WORKBOOK_ACTIVATE:
-+ {
-+ // if workbook open event do not be fired. fired it before
-+ // workbook activate event to compatible with MSO.
-+ if( mbOpened )
-+ {
-+ // process workbook activate event
-+ processVbaEvent( nEventId, aArgs );
-+ // process workbook window activate event at the same time
-+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_WINDOWACTIVATE, aArgs );
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKBOOK_DEACTIVATE:
-+ {
-+ processVbaEvent( nEventId, aArgs );
-+ // same as workbook window deactivate
-+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_WINDOWDEACTIVATE, aArgs );
-+ break;
-+ }
-+ case VBAEVENT_WORKBOOK_OPEN:
-+ {
-+ // process workbook open macro
-+ // does auto open work here?
-+ if( !mbOpened )
-+ {
-+ processVbaEvent( nEventId, aArgs );
-+ processVbaEvent( VBAEVENT_WORKBOOK_AUTOOPEN, aArgs );
-+ mbOpened = sal_True;
-+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_ACTIVATE, aArgs );
-+ }
-+ // register the window listener.
-+ if( !m_xVbaEventsListener.is() )
-+ {
-+ m_xVbaEventsListener = new VbaEventsListener( this );
-+ VbaEventsListener* pEventsListener = dynamic_cast< VbaEventsListener* >( m_xVbaEventsListener.get() );
-+ pEventsListener->startEventsLinstener();
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKBOOK_BEFORECLOSE:
-+ {
-+ sal_Bool bCancel = processVbaEvent( nEventId, aArgs );
-+ if( m_xVbaEventsListener.is() && !bCancel )
-+ {
-+ VbaEventsListener* pEventsListener = dynamic_cast< VbaEventsListener* >( m_xVbaEventsListener.get() );
-+ pEventsListener->stopEventsLinstener();
-+ m_xVbaEventsListener = NULL;
-+ }
-+ return bCancel;
-+ }
-+ case VBAEVENT_WORKBOOK_BEFOREPRINT:
-+ case VBAEVENT_WORKBOOK_BEFORESAVE:
-+ case VBAEVENT_WORKBOOK_WINDOWACTIVATE:
-+ case VBAEVENT_WORKBOOK_WINDOWDEACTIVATE:
-+ case VBAEVENT_WORKBOOK_WINDOWRESIZE:
-+ {
-+ return processVbaEvent( nEventId, aArgs );
-+ }
-+ case VBAEVENT_WORKBOOK_NEWSHEET:
-+ {
-+ aArgs[0] >>= nTab;
-+ if( nTab != INVALID_TAB )
-+ {
-+ processVbaEvent( nEventId, aArgs, nTab );
-+ }
-+ break;
-+ }
-+ default:
-+ OSL_TRACE( "Invalid Event" );
-+ }
-+
-+ return sal_True;
-+}
-+
-+::sal_Bool SAL_CALL
-+ScVbaEventsHelper::getIgnoreEvents() throw (uno::RuntimeException)
-+{
-+ return VbaEventsHelperBase::getIgnoreEvents();
-+}
-+
-+void SAL_CALL
-+ScVbaEventsHelper::setIgnoreEvents( ::sal_Bool _ignoreevents ) throw (uno::RuntimeException)
-+{
-+ VbaEventsHelperBase::setIgnoreEvents( _ignoreevents );
-+}
-+
-+namespace vbaeventshelper
-+{
-+namespace sdecl = comphelper::service_decl;
-+sdecl::class_<ScVbaEventsHelper, sdecl::with_args<true> > serviceImpl;
-+extern sdecl::ServiceDecl const serviceDecl(
-+ serviceImpl,
-+ "ScVbaEventsHelper",
-+ "com.sun.star.sheet.SpreadsheetDocumentVbaEventsHelper" );
-+}
-diff --git sc/source/ui/vba/vbaeventshelper.hxx sc/source/ui/vba/vbaeventshelper.hxx
-new file mode 100644
-index 0000000..38a79ef
---- /dev/null
-+++ sc/source/ui/vba/vbaeventshelper.hxx
-@@ -0,0 +1,95 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: vbaeventshelper.hxx,v $
-+ *
-+ * $Revision: 1.0 $
-+ *
-+ * last change: $Author: vg $ $Date: 2007/12/07 10:42:26 $
-+ *
-+ * 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, 2010 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_VBAEVENTS_HXX
-+#define SC_VBAEVENTS_HXX
-+
-+#include "document.hxx"
-+#include <cppuhelper/implbase1.hxx>
-+#include <cppuhelper/implbase2.hxx>
-+#include <com/sun/star/document/VbaEventId.hpp>
-+#include <com/sun/star/document/XVbaEventsHelper.hpp>
-+#include <com/sun/star/lang/XEventListener.hpp>
-+#include <com/sun/star/awt/XWindowListener.hpp>
-+#include <ooo/vba/excel/XApplication.hpp>
-+#include "excelvbahelper.hxx"
-+#include <vbahelper/vbaeventshelperbase.hxx>
-+
-+#define INVALID_TAB -1
-+
-+typedef ::cppu::WeakImplHelper2< com::sun::star::document::XVbaEventsHelper, com::sun::star::lang::XEventListener > VBAWorkbookEvent_BASE;
-+
-+class VbaEventsListener;
-+class ScDocShell;
-+class ScVbaEventsHelper : public VBAWorkbookEvent_BASE, public VbaEventsHelperBase
-+{
-+friend class VbaEventsListener;
-+private:
-+ ScDocument* pDoc;
-+ ScDocShell* pDocShell;
-+ css::uno::Reference< css::awt::XWindowListener > m_xVbaEventsListener;
-+ sal_Bool mbOpened;
-+ sal_Bool mbDocDisposed;
-+ css::uno::Any m_curSelection;
-+ css::uno::WeakReference< ::ooo::vba::excel::XApplication > m_xApplication;
-+
-+ String getSheetModuleName( SCTAB nTab );
-+ css::uno::Any createWorkSheet( ScDocument* pDoc, SCTAB nTab );
-+ css::uno::Any createRange( const css::uno::Any& aRange );
-+ css::uno::Any createHyperlink( const css::uno::Any& rCell );
-+ css::uno::Any createWindow( SfxObjectShell* pShell );
-+ SCTAB getTabFromArgs( const css::uno::Sequence< css::uno::Any > aArgs, const sal_Int32 nPos = 0 );
-+ rtl::OUString getMacroPath( const sal_Int32 nEventId, const SCTAB nTab = INVALID_TAB );
-+ sal_Bool processVbaEvent( const sal_Int32 nEventId, const css::uno::Sequence< css::uno::Any >& rArgs, const SCTAB nTab = INVALID_TAB );
-+ void Initilize();
-+ void stopListening();
-+ sal_Bool compareSelection( css::uno::Any oldSelection, css::uno::Any newSelection );
-+
-+public:
-+ //ScVbaEventsHelper( ScDocument* pDocument ):pDoc( pDocument ), mbOpened( sal_False ){};
-+ ScVbaEventsHelper( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext > const& xContext );
-+ ~ScVbaEventsHelper();
-+ ScDocument* getDocument() { return pDoc; };
-+ ScDocShell* getDocumentShell() { return pDocShell; };
-+ // XEventListener
-+ virtual void SAL_CALL disposing(const css::lang::EventObject& aSource) throw(css::uno::RuntimeException);
-+ // XVBAWorkbookEventHelper
-+ virtual sal_Bool SAL_CALL ProcessCompatibleVbaEvent( sal_Int32 nEventId, const css::uno::Sequence< css::uno::Any >& aArgs ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setIgnoreEvents( ::sal_Bool _ignoreevents ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getIgnoreEvents() throw (css::uno::RuntimeException);
-+};
-+
-+#endif
-+
-diff --git sc/source/ui/vba/vbafiledialog.cxx sc/source/ui/vba/vbafiledialog.cxx
-new file mode 100644
-index 0000000..b7fa59f
---- /dev/null
-+++ sc/source/ui/vba/vbafiledialog.cxx
-@@ -0,0 +1,186 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009, 2010.
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#include "vbafiledialog.hxx"
-+#include "comphelper/processfactory.hxx"
-+#include <com/sun/star/lang/XServiceInfo.hpp>
-+#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
-+#include <com/sun/star/ui/dialogs/XFilePicker2.hpp>
-+#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
-+#include "tools/urlobj.hxx"
-+
-+
-+using namespace ::com::sun::star;
-+using namespace ::com::sun::star::uno;
-+
-+
-+ScVbaFileDialog::ScVbaFileDialog( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext, const css::uno::Reference< css::frame::XModel >& xModel )
-+: ScVbaFileDialog_BASE( xParent, xContext, xModel )
-+{
-+ m_pFileDialogSelectedItems = new VbaFileDialogSelectedItems(xParent, xContext, (com::sun::star::container::XIndexAccess *)&m_FileDialogSelectedObj);
-+}
-+
-+ScVbaFileDialog::~ScVbaFileDialog()
-+{
-+ if (m_pFileDialogSelectedItems != NULL)
-+ {
-+ delete m_pFileDialogSelectedItems;
-+ }
-+}
-+
-+rtl::OUString&
-+ScVbaFileDialog::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaFileDialog") );
-+ return sImplName;
-+}
-+
-+css::uno::Sequence<rtl::OUString>
-+ScVbaFileDialog::getServiceNames()
-+{
-+ static Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.FileDialog" ) );
-+ }
-+ return aServiceNames;
-+
-+}
-+
-+css::uno::Reference< ov::XFileDialogSelectedItems > SAL_CALL
-+ScVbaFileDialog::getSelectedItems() throw (css::uno::RuntimeException)
-+{
-+ css::uno::Reference< ov::XFileDialogSelectedItems > xFileDlgSlc = (ov::XFileDialogSelectedItems *)m_pFileDialogSelectedItems;
-+ return xFileDlgSlc;
-+}
-+
-+::sal_Int32 SAL_CALL
-+ScVbaFileDialog::Show( ) throw (::com::sun::star::uno::RuntimeException)
-+{
-+ // Returns an Integer indicating if user pressed "Open" button(-1) or "Cancel" button(0).
-+ sal_Int32 nResult = -1;
-+ try
-+ {
-+ m_sSelectedItems.realloc(0);
-+
-+ const ::rtl::OUString sServiceName = ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.FilePicker" );
-+
-+ Reference< lang::XMultiServiceFactory > xMSF( comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
-+ // Set the type of File Picker Dialog: TemplateDescription::FILEOPEN_SIMPLE.
-+ Sequence< uno::Any > aDialogType( 1 );
-+ aDialogType[0] <<= ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE;
-+ Reference < ui::dialogs::XFilePicker > xFilePicker( xMSF->createInstanceWithArguments( sServiceName, aDialogType ), UNO_QUERY );
-+ Reference < ui::dialogs::XFilePicker2 > xFilePicker2( xFilePicker, UNO_QUERY );
-+ if ( xFilePicker.is() )
-+ {
-+ xFilePicker->setMultiSelectionMode(sal_True);
-+ if ( xFilePicker->execute() )
-+ {
-+ sal_Bool bUseXFilePicker2 = sal_False;
-+ Reference< lang::XServiceInfo > xServiceInfo( xFilePicker, UNO_QUERY );
-+ if (xServiceInfo.is())
-+ {
-+ rtl::OUString sImplName = xServiceInfo->getImplementationName();
-+ if (sImplName.equalsAscii("com.sun.star.comp.fpicker.VistaFileDialog") ||
-+ sImplName.equalsAscii("com.sun.star.ui.dialogs.SalGtkFilePicker"))
-+ {
-+ bUseXFilePicker2 = sal_True;
-+ }
-+ }
-+ if ( bUseXFilePicker2 && xFilePicker2.is() )
-+ {
-+ // On Linux, XFilePicker->getFiles() always return one selected file although we select
-+ // more than one file, also on Vista XFilePicker->getFiles() does not work well too,
-+ // so we call XFilePicker2->getSelectedFiles() to get selected files.
-+ m_sSelectedItems = xFilePicker2->getSelectedFiles();
-+ }
-+ else
-+ {
-+ // If only one file is selected, the first entry of the sequence contains the complete path/filename in
-+ // URL format. If multiple files are selected, the first entry of the sequence contains the path in URL
-+ // format, and the other entries contains the names of the selected files without path information.
-+ Sequence< rtl::OUString > aSelectedFiles = xFilePicker->getFiles();
-+ sal_Int32 iFileCount = aSelectedFiles.getLength();
-+ if ( iFileCount > 1 )
-+ {
-+ m_sSelectedItems.realloc( iFileCount - 1 );
-+ INetURLObject aPath( aSelectedFiles[0] );
-+ aPath.setFinalSlash();
-+ for ( sal_Int32 i = 1; i < iFileCount; i++ )
-+ {
-+ if ( aSelectedFiles[i].indexOf ('/') > 0 || aSelectedFiles[i].indexOf ('\\') > 0 )
-+ {
-+ m_sSelectedItems[i - 1] = aSelectedFiles[i];
-+ }
-+ else
-+ {
-+ if ( i == 1 )
-+ aPath.Append( aSelectedFiles[i] );
-+ else
-+ aPath.setName( aSelectedFiles[i] );
-+ m_sSelectedItems[i - 1] = aPath.GetMainURL(INetURLObject::NO_DECODE);
-+ }
-+ }
-+ }
-+ else if ( iFileCount == 1 )
-+ {
-+ m_sSelectedItems = aSelectedFiles;
-+ }
-+ }
-+
-+ sal_Int32 iFileCount = m_sSelectedItems.getLength();
-+ rtl::OUString aTemp;
-+ for ( sal_Int32 i = 0; i < iFileCount; i++ )
-+ {
-+ INetURLObject aObj( m_sSelectedItems[i] );
-+ if ( aObj.GetProtocol() == INET_PROT_FILE )
-+ {
-+ aTemp = aObj.PathToFileName();
-+ m_sSelectedItems[i] = aTemp.getLength() > 0 ? aTemp : m_sSelectedItems[i];
-+ }
-+ }
-+ }
-+ else
-+ {
-+ nResult = 0;
-+ }
-+ }
-+
-+ m_FileDialogSelectedObj.SetSelectedFile(m_sSelectedItems);
-+ }
-+ catch( const uno::Exception& )
-+ {
-+ return 0;
-+ }
-+
-+ return nResult;
-+}
-+
-+
-+
-diff --git sc/source/ui/vba/vbafiledialog.hxx sc/source/ui/vba/vbafiledialog.hxx
-new file mode 100644
-index 0000000..2273e4b
---- /dev/null
-+++ sc/source/ui/vba/vbafiledialog.hxx
-@@ -0,0 +1,60 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009, 2010.
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef _vbafiledialog_hxx_
-+#define _vbafiledialog_hxx_
-+
-+#include <cppuhelper/implbase1.hxx>
-+#include <vbahelper/vbadialogsbase.hxx>
-+#include <ooo/vba/XFileDialog.hpp>
-+#include "vbafiledialogselecteditems.hxx"
-+
-+
-+typedef cppu::ImplInheritanceHelper1< VbaDialogsBase, ov::XFileDialog > ScVbaFileDialog_BASE;
-+
-+class ScVbaFileDialog : public ScVbaFileDialog_BASE
-+{
-+public:
-+
-+ ScVbaFileDialog( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext, const css::uno::Reference< css::frame::XModel >& xModel ) ;
-+ virtual ~ScVbaFileDialog() ;
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+ //XFileDialog
-+ virtual css::uno::Reference< ov::XFileDialogSelectedItems > SAL_CALL getSelectedItems() throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL Show( ) throw (::com::sun::star::uno::RuntimeException) ;
-+
-+private:
-+ css::uno::Sequence < rtl::OUString > m_sSelectedItems;
-+ VbaFileDialogSelectedItems *m_pFileDialogSelectedItems;
-+ VbaFileDialogSelectedObj m_FileDialogSelectedObj;
-+};
-+
-+#endif
-\ No newline at end of file
-diff --git sc/source/ui/vba/vbafiledialogselecteditems.cxx sc/source/ui/vba/vbafiledialogselecteditems.cxx
-new file mode 100644
-index 0000000..fbf0e14
---- /dev/null
-+++ sc/source/ui/vba/vbafiledialogselecteditems.cxx
-@@ -0,0 +1,157 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009, 2010.
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#include "vbafiledialogselecteditems.hxx"
-+
-+using namespace ::com::sun::star;
-+
-+VbaFileDialogSelectedItems::VbaFileDialogSelectedItems( const css::uno::Reference< ov::XHelperInterface >& xParent,
-+ const css::uno::Reference< css::uno::XComponentContext >& xContext,
-+ const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess
-+ )
-+ : FileDialogSelectedItems_BASE( xParent, xContext, xIndexAccess )
-+{
-+}
-+
-+
-+rtl::OUString& VbaFileDialogSelectedItems::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("VbaFileDialogSelectedItems") );
-+ return sImplName;
-+
-+}
-+css::uno::Sequence<rtl::OUString> VbaFileDialogSelectedItems::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.FileDialogSelectedItems" ) );
-+ }
-+ return aServiceNames;
-+
-+}
-+
-+css::uno::Any VbaFileDialogSelectedItems::createCollectionObject( const css::uno::Any& aSource )
-+{
-+ css::uno::Any aRet;
-+ aRet = aSource;
-+ return aRet;
-+}
-+
-+
-+css::uno::Type SAL_CALL
-+VbaFileDialogSelectedItems::getElementType() throw (css::uno::RuntimeException)
-+{
-+ return ooo::vba::XFileDialogSelectedItems::static_type(0);
-+}
-+
-+css::uno::Reference< css::container::XEnumeration > SAL_CALL
-+VbaFileDialogSelectedItems::createEnumeration() throw (css::uno::RuntimeException)
-+{
-+ css::uno::Reference< css::container::XEnumeration > xEnumRet(m_xIndexAccess, css::uno::UNO_QUERY);
-+ return xEnumRet;
-+}
-+
-+
-+//VbaFileDialogSelectedObj
-+//////////////////////////////////////////////////////////////////////////
-+
-+VbaFileDialogSelectedObj::VbaFileDialogSelectedObj()
-+{
-+ m_nIndex = 0;
-+}
-+
-+
-+sal_Bool
-+VbaFileDialogSelectedObj::SetSelectedFile(css::uno::Sequence<rtl::OUString> &sFList)
-+{
-+ m_sFileList = sFList;
-+ return sal_True;
-+}
-+
-+sal_Int32 SAL_CALL
-+VbaFileDialogSelectedObj::getCount() throw(::com::sun::star::uno::RuntimeException)
-+{
-+ sal_Int32 nListCnt = m_sFileList.getLength();
-+ return nListCnt;
-+}
-+
-+::com::sun::star::uno::Any SAL_CALL VbaFileDialogSelectedObj::getByIndex( sal_Int32 nIndex )
-+throw(::com::sun::star::lang::IndexOutOfBoundsException,
-+ ::com::sun::star::lang::WrappedTargetException,
-+ ::com::sun::star::uno::RuntimeException)
-+{
-+ css::uno::Any aRet;
-+
-+ if ( nIndex >= getCount() )
-+ {
-+ throw css::lang::IndexOutOfBoundsException();
-+ }
-+
-+ return uno::makeAny(m_sFileList[nIndex]);
-+}
-+
-+::com::sun::star::uno::Type SAL_CALL
-+VbaFileDialogSelectedObj::getElementType()
-+throw(::com::sun::star::uno::RuntimeException)
-+{
-+ return getCppuType((uno::Reference<com::sun::star::container::XIndexAccess>*)0);
-+}
-+
-+sal_Bool SAL_CALL VbaFileDialogSelectedObj::hasElements()
-+throw(::com::sun::star::uno::RuntimeException)
-+{
-+ return ( getCount() != 0 );
-+}
-+
-+::sal_Bool SAL_CALL
-+VbaFileDialogSelectedObj::hasMoreElements( )
-+throw (uno::RuntimeException)
-+{
-+ if (getCount() > m_nIndex)
-+ {
-+ return sal_True;
-+ }
-+ return sal_False;
-+}
-+
-+uno::Any SAL_CALL
-+VbaFileDialogSelectedObj::nextElement( )
-+throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+{
-+ if (!hasMoreElements())
-+ {
-+ throw container::NoSuchElementException();
-+ }
-+
-+ return uno::makeAny(m_sFileList[m_nIndex++]);
-+}
-+
-+
-+
-diff --git sc/source/ui/vba/vbafiledialogselecteditems.hxx sc/source/ui/vba/vbafiledialogselecteditems.hxx
-new file mode 100644
-index 0000000..44a32cf
---- /dev/null
-+++ sc/source/ui/vba/vbafiledialogselecteditems.hxx
-@@ -0,0 +1,87 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009, 2010.
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef _vbafiledialogselecteditems_hxx_
-+#define _vbafiledialogselecteditems_hxx_
-+
-+#include <ooo/vba/XFileDialogSelectedItems.hpp>
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/container/XIndexAccess.hpp>
-+
-+typedef CollTestImplHelper< ov::XFileDialogSelectedItems > FileDialogSelectedItems_BASE;
-+
-+
-+class VbaFileDialogSelectedItems : public FileDialogSelectedItems_BASE
-+{
-+public:
-+ VbaFileDialogSelectedItems( const css::uno::Reference< ov::XHelperInterface >& xParent,
-+ const css::uno::Reference< css::uno::XComponentContext >& xContext,
-+ const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess );
-+
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ 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);
-+
-+protected:
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+private:
-+};
-+
-+
-+class VbaFileDialogSelectedObj : public cppu::WeakImplHelper2<css::container::XIndexAccess, css::container::XEnumeration>
-+{
-+public:
-+ VbaFileDialogSelectedObj();
-+ sal_Bool SetSelectedFile(css::uno::Sequence<rtl::OUString> &sFList);
-+ //XIndexAccess
-+ virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException);
-+
-+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 nIndex )
-+ throw(::com::sun::star::lang::IndexOutOfBoundsException,
-+ ::com::sun::star::lang::WrappedTargetException,
-+ ::com::sun::star::uno::RuntimeException);
-+
-+ // XElementAccess
-+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
-+ throw(::com::sun::star::uno::RuntimeException);
-+
-+ virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
-+
-+ //XEnumeration
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL nextElement( ) throw (css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException);
-+
-+protected:
-+private:
-+ css::uno::Sequence<rtl::OUString> m_sFileList;
-+ sal_Int32 m_nIndex;
-+};
-+
-+#endif
-diff --git sc/source/ui/vba/vbafilesearch.cxx sc/source/ui/vba/vbafilesearch.cxx
-new file mode 100644
-index 0000000..7369ae5
---- /dev/null
-+++ sc/source/ui/vba/vbafilesearch.cxx
-@@ -0,0 +1,242 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009, 2010.
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#include "vbafilesearch.hxx"
-+#include "vbaapplication.hxx"
-+#include "vbafoundfiles.hxx"
-+#include <comphelper/processfactory.hxx>
-+#include <tools/urlobj.hxx>
-+#include <tools/wldcrd.hxx>
-+#include <com/sun/star/ucb/XSimpleFileAccess3.hpp>
-+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-+#include <com/sun/star/uno/Sequence.hxx>
-+#include <vector>
-+#include "unotools/viewoptions.hxx"
-+#include <osl/file.hxx>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+using namespace ::com::sun::star::uno;
-+using namespace ::com::sun::star::ucb;
-+using namespace ::com::sun::star::lang;
-+using namespace comphelper;
-+
-+static Reference< XSimpleFileAccess3 > getFileAccess( void )
-+{
-+ static Reference< XSimpleFileAccess3 > xSFI;
-+ if( !xSFI.is() )
-+ {
-+ Reference< XMultiServiceFactory > xSMgr = getProcessServiceFactory();
-+ if( xSMgr.is() )
-+ {
-+ xSFI = Reference< XSimpleFileAccess3 >( xSMgr->createInstance
-+ ( ::rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY );
-+ }
-+ }
-+ return xSFI;
-+}
-+
-+ScVbaFileSearch::ScVbaFileSearch( ScVbaApplication* pApp, const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext )
-+ : ScVbaFileSearchImpl_BASE( xParent, xContext ), m_pApplication( pApp )
-+{
-+ NewSearch();
-+}
-+
-+ScVbaFileSearch::~ScVbaFileSearch()
-+{
-+}
-+
-+::rtl::OUString SAL_CALL ScVbaFileSearch::getFileName() throw (css::uno::RuntimeException)
-+{
-+ return m_sFileName;
-+}
-+
-+void SAL_CALL ScVbaFileSearch::setFileName(const ::rtl::OUString& _fileName ) throw (css::uno::RuntimeException)
-+{
-+ m_sFileName = _fileName;
-+}
-+
-+::rtl::OUString SAL_CALL ScVbaFileSearch::getLookIn() throw (css::uno::RuntimeException)
-+{
-+ return m_sLookIn;
-+}
-+
-+void SAL_CALL ScVbaFileSearch::setLookIn( const ::rtl::OUString& _lookIn ) throw (css::uno::RuntimeException)
-+{
-+ m_sLookIn = _lookIn;
-+}
-+
-+sal_Bool SAL_CALL ScVbaFileSearch::getSearchSubFolders() throw (css::uno::RuntimeException)
-+{
-+ return m_bSearchSubFolders;
-+}
-+
-+void SAL_CALL ScVbaFileSearch::setSearchSubFolders( sal_Bool _searchSubFolders ) throw (css::uno::RuntimeException)
-+{
-+ m_bSearchSubFolders = _searchSubFolders;
-+}
-+
-+sal_Bool SAL_CALL ScVbaFileSearch::getMatchTextExactly() throw (css::uno::RuntimeException)
-+{
-+ return m_bMatchTextExactly;
-+}
-+
-+void SAL_CALL ScVbaFileSearch::setMatchTextExactly( sal_Bool _matchTextExactly ) throw (css::uno::RuntimeException)
-+{
-+ m_bMatchTextExactly = _matchTextExactly;
-+}
-+
-+static bool IsWildCard( const ::rtl::OUString& fileName )
-+{
-+ static sal_Char cWild1 = '*';
-+ static sal_Char cWild2 = '?';
-+
-+ return ( ( fileName.indexOf( cWild1 ) >= 0 )
-+ || ( fileName.indexOf( cWild2 ) >= 0 ) );
-+}
-+
-+static void SearchWildCard(const WildCard& wildCard, const ::rtl::OUString& aDir, bool bSearchSubFolders, css::uno::Sequence< rtl::OUString >& aSearchedFiles)
-+{
-+ Reference< XSimpleFileAccess3 > xSFI = getFileAccess();
-+ Sequence< rtl::OUString > aDirSeq;
-+ try
-+ {
-+ if ( xSFI.is() )
-+ {
-+ aDirSeq = xSFI->getFolderContents( aDir, bSearchSubFolders );
-+ }
-+ }
-+ catch( css::uno::Exception& )
-+ {
-+ }
-+ sal_Int32 nLength = aDirSeq.getLength();
-+ for ( sal_Int32 i = 0; i < nLength; i++ )
-+ {
-+ rtl::OUString aURLStr = aDirSeq[i];
-+ if ( xSFI->isFolder( aURLStr ) )
-+ {
-+ if ( bSearchSubFolders )
-+ {
-+ SearchWildCard( wildCard, aURLStr, true, aSearchedFiles );
-+ }
-+ }
-+ else
-+ {
-+ INetURLObject aFileURL( aURLStr );
-+ rtl::OUString aFileName = aFileURL.GetLastName( INetURLObject::DECODE_UNAMBIGUOUS );
-+ if ( wildCard.Matches( aFileName.toAsciiLowerCase() ) )
-+ {
-+ sal_Int32 nFilesLength = aSearchedFiles.getLength();
-+ aSearchedFiles.realloc( nFilesLength + 1 );
-+ rtl::OUString sSystemPath;
-+ ::osl::File::getSystemPathFromFileURL( aURLStr, sSystemPath );
-+ aSearchedFiles[nFilesLength] = sSystemPath;
-+ }
-+ }
-+ }
-+}
-+
-+sal_Int32 SAL_CALL ScVbaFileSearch::Execute( ) throw (css::uno::RuntimeException)
-+{
-+ m_aSearchedFiles.realloc(0);
-+ Reference< XSimpleFileAccess3 > xSFI = getFileAccess();
-+ if ( !xSFI.is() || !xSFI->isFolder( m_sLookIn ) )
-+ {
-+ return 0;
-+ }
-+
-+ if ( m_sFileName == ::rtl::OUString::createFromAscii( "" ) )
-+ {
-+ return 1;
-+ }
-+
-+ ::rtl::OUString aTempFileName = m_sFileName.toAsciiLowerCase();
-+ if ( IsWildCard( aTempFileName ) )
-+ {
-+ bool bEndWithAsterisk = aTempFileName.endsWithAsciiL("*", 1);
-+ bool bStartWithAsterisk = (aTempFileName.indexOf(::rtl::OUString::createFromAscii("*")) == 0);
-+ if ( !bEndWithAsterisk && !bStartWithAsterisk )
-+ {
-+ aTempFileName = ::rtl::OUString::createFromAscii("*") + aTempFileName + ::rtl::OUString::createFromAscii("*");
-+ }
-+ }
-+ else
-+ {
-+ aTempFileName = ::rtl::OUString::createFromAscii("*") + aTempFileName + ::rtl::OUString::createFromAscii("*");
-+ }
-+ WildCard wildCard( aTempFileName );
-+ SearchWildCard( wildCard, m_sLookIn, m_bSearchSubFolders, m_aSearchedFiles );
-+
-+ return m_aSearchedFiles.getLength();
-+}
-+
-+//liuchen 2009-11-5 set ScVbaApplication::getDefaultFilePath( ) as the InitPath for FileSearch
-+ ::rtl::OUString ScVbaFileSearch::getInitPath() throw (css::uno::RuntimeException)
-+{
-+ String aPath;
-+
-+ if (m_pApplication != NULL)
-+ {
-+ aPath = m_pApplication->getDefaultFilePath();
-+ }
-+
-+ return aPath;
-+}
-+
-+void SAL_CALL ScVbaFileSearch::NewSearch( ) throw (css::uno::RuntimeException)
-+{
-+ m_sFileName = ::rtl::OUString::createFromAscii( "" );
-+ m_sLookIn = getInitPath();
-+ m_bSearchSubFolders = false;
-+ m_bMatchTextExactly = false;
-+ m_aSearchedFiles.realloc(0);
-+}
-+
-+Reference< XFoundFiles > SAL_CALL ScVbaFileSearch::getFoundFiles() throw (css::uno::RuntimeException)
-+{
-+ css::uno::Reference< ov::XFoundFiles > xFoundFiles = new VbaFoundFiles(
-+ mxParent, mxContext, (css::container::XIndexAccess *) new VbaFoundFilesEnum(m_aSearchedFiles) );
-+ return xFoundFiles;
-+}
-+
-+rtl::OUString& ScVbaFileSearch::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("VbaFileSearch") );
-+ return sImplName;
-+}
-+
-+css::uno::Sequence< rtl::OUString > ScVbaFileSearch::getServiceNames()
-+{
-+ static css::uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.FileSearch") );
-+ }
-+ return aServiceNames;
-+}
-diff --git sc/source/ui/vba/vbafilesearch.hxx sc/source/ui/vba/vbafilesearch.hxx
-new file mode 100644
-index 0000000..2857ac5
---- /dev/null
-+++ sc/source/ui/vba/vbafilesearch.hxx
-@@ -0,0 +1,77 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009, 2010.
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef SC_VBA_FILESEARCH_HXX
-+#define SC_VBA_FILESEARCH_HXX
-+
-+#include <ooo/vba/XFileSearch.hpp>
-+#include <cppuhelper/implbase1.hxx>
-+#include <vbahelper/vbahelperinterface.hxx>
-+
-+namespace css = ::com::sun::star;
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::XFileSearch > ScVbaFileSearchImpl_BASE;
-+
-+class ScVbaApplication;
-+
-+class ScVbaFileSearch : public ScVbaFileSearchImpl_BASE
-+{
-+private:
-+ rtl::OUString m_sFileName;
-+ rtl::OUString m_sLookIn;
-+ sal_Bool m_bSearchSubFolders;
-+ sal_Bool m_bMatchTextExactly;
-+ ScVbaApplication* m_pApplication;
-+ css::uno::Sequence< rtl::OUString > m_aSearchedFiles;
-+
-+ ::rtl::OUString getInitPath() throw (css::uno::RuntimeException);
-+
-+public:
-+ ScVbaFileSearch( ScVbaApplication* pApp, const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext );
-+ virtual ~ScVbaFileSearch();
-+
-+ // Attributes
-+ virtual ::rtl::OUString SAL_CALL getFileName() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setFileName(const ::rtl::OUString& _fileName ) throw (css::uno::RuntimeException);
-+ virtual ::rtl::OUString SAL_CALL getLookIn() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setLookIn(const ::rtl::OUString& _lookIn ) throw (css::uno::RuntimeException);
-+ virtual sal_Bool SAL_CALL getSearchSubFolders() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setSearchSubFolders( sal_Bool _searchSubFolders ) throw (css::uno::RuntimeException);
-+ virtual sal_Bool SAL_CALL getMatchTextExactly() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setMatchTextExactly( sal_Bool _matchTextExactly ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Reference< ::ooo::vba::XFoundFiles > SAL_CALL getFoundFiles() throw (css::uno::RuntimeException);
-+
-+ virtual sal_Int32 SAL_CALL Execute( ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL NewSearch( ) throw (css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence< rtl::OUString > getServiceNames();
-+};
-+
-+#endif /* SC_VBA_FILESEARCH_HXX */
-diff --git sc/source/ui/vba/vbaformatconditions.cxx sc/source/ui/vba/vbaformatconditions.cxx
-index b188773..6d48bb8 100644
---- sc/source/ui/vba/vbaformatconditions.cxx
-+++ sc/source/ui/vba/vbaformatconditions.cxx
-@@ -48,8 +48,8 @@ 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 >( Application(), uno::UNO_QUERY_THROW ), xContext, xModel );
-- mxStyles.set( xWorkbook->Styles( uno::Any() ), uno::UNO_QUERY_THROW );
-+ uno::Reference< excel::XApplication> xApp( Application(), uno::UNO_QUERY_THROW );
-+ mxStyles.set( xApp->getThisWorkbook()->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 sc/source/ui/vba/vbafoundfiles.cxx sc/source/ui/vba/vbafoundfiles.cxx
-new file mode 100644
-index 0000000..464b533
---- /dev/null
-+++ sc/source/ui/vba/vbafoundfiles.cxx
-@@ -0,0 +1,143 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009, 2010.
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#include "vbafoundfiles.hxx"
-+
-+////////////////////////////////VbaFoundFilesEnum//////////////////////////////////////////
-+VbaFoundFilesEnum::VbaFoundFilesEnum() : m_nIndex(0)
-+{
-+
-+}
-+
-+VbaFoundFilesEnum::VbaFoundFilesEnum( css::uno::Sequence<rtl::OUString>& sFileList ) : m_nIndex(0), m_sFileList(sFileList)
-+{
-+
-+}
-+
-+VbaFoundFilesEnum::~VbaFoundFilesEnum()
-+{
-+
-+}
-+
-+void VbaFoundFilesEnum::SetFileList( css::uno::Sequence<rtl::OUString>& sFileList )
-+{
-+ m_nIndex = 0;
-+ m_sFileList = sFileList;
-+}
-+
-+sal_Int32 SAL_CALL VbaFoundFilesEnum::getCount() throw (css::uno::RuntimeException)
-+{
-+ return m_sFileList.getLength();
-+}
-+
-+css::uno::Any SAL_CALL VbaFoundFilesEnum::getByIndex( sal_Int32 nIndex )
-+ throw (css::lang::IndexOutOfBoundsException, css::lang::WrappedTargetException, css::uno::RuntimeException)
-+{
-+ if ( nIndex >= getCount() )
-+ {
-+ throw css::lang::IndexOutOfBoundsException();
-+ }
-+
-+ return css::uno::makeAny( m_sFileList[nIndex] );
-+}
-+
-+css::uno::Type SAL_CALL VbaFoundFilesEnum::getElementType() throw (css::uno::RuntimeException)
-+{
-+ return getCppuType((css::uno::Reference< css::container::XIndexAccess >*)0);
-+}
-+
-+sal_Bool SAL_CALL VbaFoundFilesEnum::hasElements() throw (css::uno::RuntimeException)
-+{
-+ return ( getCount() != 0 );
-+}
-+
-+sal_Bool SAL_CALL VbaFoundFilesEnum::hasMoreElements() throw (css::uno::RuntimeException)
-+{
-+ if ( getCount() > m_nIndex )
-+ {
-+ return sal_True;
-+ }
-+ return sal_False;
-+}
-+
-+css::uno::Any SAL_CALL VbaFoundFilesEnum::nextElement() throw (css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException)
-+{
-+ if ( !hasMoreElements() )
-+ {
-+ throw css::container::NoSuchElementException();
-+ }
-+
-+ return css::uno::makeAny( m_sFileList[m_nIndex++] );
-+}
-+
-+////////////////////////////////VbaFoundFiles//////////////////////////////////////////
-+VbaFoundFiles::VbaFoundFiles( const css::uno::Reference< ov::XHelperInterface >& xParent,
-+ const css::uno::Reference< css::uno::XComponentContext >& xContext,
-+ const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess
-+ ) : VbaFoundFilesImpl_BASE( xParent, xContext, xIndexAccess )
-+{
-+
-+}
-+
-+VbaFoundFiles::~VbaFoundFiles()
-+{
-+
-+}
-+
-+css::uno::Reference< css::container::XEnumeration > VbaFoundFiles::createEnumeration() throw (css::uno::RuntimeException)
-+{
-+ css::uno::Reference< css::container::XEnumeration > xEnumRet( m_xIndexAccess, css::uno::UNO_QUERY );
-+ return xEnumRet;
-+}
-+
-+css::uno::Any VbaFoundFiles::createCollectionObject( const css::uno::Any& aSource )
-+{
-+ return aSource;
-+}
-+
-+css::uno::Type VbaFoundFiles::getElementType() throw (css::uno::RuntimeException)
-+{
-+ return ov::XFoundFiles::static_type(0);
-+}
-+
-+rtl::OUString& VbaFoundFiles::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("VbaFoundFiles") );
-+ return sImplName;
-+}
-+
-+css::uno::Sequence< rtl::OUString > VbaFoundFiles::getServiceNames()
-+{
-+ static css::uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.FoundFiles") );
-+ }
-+ return aServiceNames;
-+}
-diff --git sc/source/ui/vba/vbafoundfiles.hxx sc/source/ui/vba/vbafoundfiles.hxx
-new file mode 100644
-index 0000000..4a3a1db
---- /dev/null
-+++ sc/source/ui/vba/vbafoundfiles.hxx
-@@ -0,0 +1,88 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009, 2010.
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef SC_VBA_FOUNDFILES_HXX
-+#define SC_VBA_FOUNDFILES_HXX
-+
-+#include <cppuhelper/implbase2.hxx>
-+#include <com/sun/star/container/XIndexAccess.hpp>
-+#include <ooo/vba/XFoundFiles.hpp>
-+#include <vbahelper/vbacollectionimpl.hxx>
-+
-+namespace css = ::com::sun::star;
-+
-+typedef CollTestImplHelper< ooo::vba::XFoundFiles > VbaFoundFilesImpl_BASE;
-+
-+class VbaFoundFilesEnum : public cppu::WeakImplHelper2< css::container::XIndexAccess, css::container::XEnumeration >
-+{
-+private:
-+ sal_Int32 m_nIndex;
-+ css::uno::Sequence< rtl::OUString > m_sFileList;
-+
-+public:
-+ VbaFoundFilesEnum();
-+ VbaFoundFilesEnum( css::uno::Sequence< rtl::OUString >& sFileList );
-+ ~VbaFoundFilesEnum();
-+
-+ void SetFileList( css::uno::Sequence< rtl::OUString >& sFileList );
-+
-+ // XIndexAccess
-+ virtual sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 nIndex ) throw (css::lang::IndexOutOfBoundsException, css::lang::WrappedTargetException, css::uno::RuntimeException);
-+
-+ // XElementAccess
-+ virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
-+ virtual sal_Bool SAL_CALL hasElements() throw (css::uno::RuntimeException);
-+
-+ // XEnumeration
-+ virtual sal_Bool SAL_CALL hasMoreElements() throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL nextElement() throw (css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException);
-+};
-+
-+class VbaFoundFiles : public VbaFoundFilesImpl_BASE
-+{
-+private:
-+
-+public:
-+ VbaFoundFiles( const css::uno::Reference< ov::XHelperInterface >& xParent,
-+ const css::uno::Reference< css::uno::XComponentContext >& xContext,
-+ const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess );
-+ virtual ~VbaFoundFiles();
-+
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+
-+ // 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);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence< rtl::OUString > getServiceNames();
-+};
-+
-+#endif /* SC_VBA_FOUNDFILES_HXX */
-diff --git sc/source/ui/vba/vbaglobals.cxx sc/source/ui/vba/vbaglobals.cxx
-index 1c8c06c..3dcebe7 100644
---- sc/source/ui/vba/vbaglobals.cxx
-+++ sc/source/ui/vba/vbaglobals.cxx
-@@ -219,6 +219,12 @@ ScVbaGlobals::Rows( const uno::Any& aIndex ) throw (uno::RuntimeException)
-
- }
-
-+uno::Any SAL_CALL
-+ScVbaGlobals::MenuBars( const uno::Any& aIndex ) throw (uno::RuntimeException)
-+{
-+ return uno::Any( getApplication()->MenuBars(aIndex) );
-+}
-+
- uno::Sequence< ::rtl::OUString > SAL_CALL
- ScVbaGlobals::getAvailableServiceNames( ) throw (uno::RuntimeException)
- {
-diff --git sc/source/ui/vba/vbaglobals.hxx sc/source/ui/vba/vbaglobals.hxx
-index 38a51f2..f06acb4 100644
---- sc/source/ui/vba/vbaglobals.hxx
-+++ sc/source/ui/vba/vbaglobals.hxx
-@@ -83,6 +83,8 @@ typedef ::cppu::ImplInheritanceHelper1< VbaGlobalsBase, ov::excel::XGlobals > Sc
- 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);
-
-+ virtual css::uno::Any SAL_CALL MenuBars( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+
-
-
- // XMultiServiceFactory
-diff --git sc/source/ui/vba/vbahelper.cxx sc/source/ui/vba/vbahelper.cxx
-deleted file mode 100644
-index 27ce871..0000000
---- sc/source/ui/vba/vbahelper.cxx
-+++ /dev/null
-@@ -1,827 +0,0 @@
--/*************************************************************************
-- *
-- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-- *
-- * Copyright 2000, 2010 Oracle and/or its affiliates.
-- *
-- * OpenOffice.org - a multi-platform office productivity suite
-- *
-- * 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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--#include <cppuhelper/bootstrap.hxx>
--#include <com/sun/star/util/XURLTransformer.hpp>
--#include <com/sun/star/frame/XDispatchProvider.hpp>
--#include <com/sun/star/frame/XModel.hpp>
--#include <com/sun/star/frame/XFrame.hpp>
--#include <com/sun/star/frame/XDesktop.hpp>
--#include <com/sun/star/frame/XController.hpp>
--#include <com/sun/star/uno/XComponentContext.hpp>
--#include <com/sun/star/lang/XMultiComponentFactory.hpp>
--#include <com/sun/star/beans/XPropertySet.hpp>
--#include <com/sun/star/beans/XIntrospection.hpp>
--
--#include <comphelper/processfactory.hxx>
--
--#include <sfx2/objsh.hxx>
--#include <sfx2/viewfrm.hxx>
--#include <sfx2/dispatch.hxx>
--#include <sfx2/app.hxx>
--#include <svl/stritem.hxx>
--
--#include <docuno.hxx>
--
--#include <basic/sbx.hxx>
--#include <basic/sbstar.hxx>
--#include <rtl/math.hxx>
--
--#include <math.h>
--#include "vbahelper.hxx"
--#include "tabvwsh.hxx"
--#include "transobj.hxx"
--#include "scmod.hxx"
--#include "vbashape.hxx"
--#include "unonames.hxx"
--#include "cellsuno.hxx"
--using namespace ::com::sun::star;
--using namespace ::ooo::vba;
--
--#define POINTTO100THMILLIMETERFACTOR 35.27778
--void unoToSbxValue( SbxVariable* pVar, const uno::Any& aValue );
--
--uno::Any sbxToUnoValue( SbxVariable* pVar );
--
--
--namespace ooo
--{
--namespace vba
--{
--
--const double Millimeter::factor = 35.27778;
--
--uno::Reference< beans::XIntrospectionAccess >
--getIntrospectionAccess( const uno::Any& aObject ) throw (uno::RuntimeException)
--{
-- static uno::Reference< beans::XIntrospection > xIntrospection;
-- if( !xIntrospection.is() )
-- {
-- uno::Reference< lang::XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-- xIntrospection.set( xFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.beans.Introspection") ), uno::UNO_QUERY_THROW );
-- }
-- return xIntrospection->inspect( aObject );
--}
--
--uno::Reference< script::XTypeConverter >
--getTypeConverter( const uno::Reference< uno::XComponentContext >& xContext ) throw (uno::RuntimeException)
--{
-- static uno::Reference< script::XTypeConverter > xTypeConv( xContext->getServiceManager()->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter") ), xContext ), uno::UNO_QUERY_THROW );
-- return xTypeConv;
--}
--// helper method to determine if the view ( calc ) is in print-preview mode
--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"));
--const uno::Any&
--aNULL()
--{
-- static uno::Any aNULLL = uno::makeAny( uno::Reference< uno::XInterface >() );
-- return aNULLL;
--}
--
--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<uno::XComponentContext > xContext( xTmpProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
-- static uno::Reference<lang::XMultiComponentFactory > 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
--dispatchRequests (uno::Reference< frame::XModel>& xModel,rtl::OUString & aUrl, uno::Sequence< beans::PropertyValue >& sProps )
--{
--
-- util::URL url ;
-- url.Complete = aUrl;
-- rtl::OUString emptyString = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "" ));
-- uno::Reference<frame::XController> xController = xModel->getCurrentController();
-- uno::Reference<frame::XFrame> xFrame = xController->getFrame();
-- uno::Reference<frame::XDispatchProvider> xDispatchProvider (xFrame,uno::UNO_QUERY_THROW);
-- try
-- {
-- uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-- uno::Reference<uno::XComponentContext > xContext( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
-- if ( !xContext.is() )
-- {
-- return ;
-- }
--
-- uno::Reference<lang::XMultiComponentFactory > xServiceManager(
-- xContext->getServiceManager() );
-- if ( !xServiceManager.is() )
-- {
-- return ;
-- }
-- uno::Reference<util::XURLTransformer> xParser( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ) )
-- ,xContext), uno::UNO_QUERY_THROW );
-- if (!xParser.is())
-- return;
-- xParser->parseStrict (url);
-- }
-- catch ( uno::Exception & /*e*/ )
-- {
-- return ;
-- }
--
-- uno::Reference<frame::XDispatch> xDispatcher = xDispatchProvider->queryDispatch(url,emptyString,0);
--
-- uno::Sequence<beans::PropertyValue> dispatchProps(1);
--
-- sal_Int32 nProps = sProps.getLength();
-- beans::PropertyValue* pDest = dispatchProps.getArray();
-- if ( nProps )
-- {
-- dispatchProps.realloc( nProps + 1 );
-- // need to reaccquire pDest after realloc
-- pDest = dispatchProps.getArray();
-- beans::PropertyValue* pSrc = sProps.getArray();
-- for ( sal_Int32 index=0; index<nProps; ++index, ++pSrc, ++pDest )
-- *pDest = *pSrc;
-- }
--
-- (*pDest).Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Silent" ));
-- (*pDest).Value <<= (sal_Bool)sal_True;
--
-- if (xDispatcher.is())
-- xDispatcher->dispatch( url, dispatchProps );
--}
--
--void
--dispatchRequests (uno::Reference< frame::XModel>& xModel,rtl::OUString & aUrl)
--{
-- uno::Sequence<beans::PropertyValue> dispatchProps;
-- dispatchRequests( xModel, aUrl, dispatchProps );
--}
--
--
--void dispatchExecute(css::uno::Reference< css::frame::XModel>& xModel, USHORT nSlot, SfxCallMode nCall)
--{
-- ScTabViewShell* pViewShell = getBestViewShell( xModel );
-- SfxViewFrame* pViewFrame = NULL;
-- if ( pViewShell )
-- pViewFrame = pViewShell->GetViewFrame();
-- if ( pViewFrame )
-- {
-- SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
-- if( pDispatcher )
-- {
-- pDispatcher->Execute( nSlot , nCall );
-- }
-- }
--}
--
--void
--implnPaste()
--{
-- PasteCellsWarningReseter resetWarningBox;
-- ScTabViewShell* pViewShell = getCurrentBestViewShell();
-- if ( pViewShell )
-- {
-- pViewShell->PasteFromSystem();
-- pViewShell->CellContentChanged();
-- }
--}
--
--
--void
--implnCopy()
--{
-- ScTabViewShell* pViewShell = getCurrentBestViewShell();
-- if ( pViewShell )
-- pViewShell->CopyToClip(NULL,false,false,true);
--}
--
--void
--implnCut()
--{
-- ScTabViewShell* pViewShell = getCurrentBestViewShell();
-- if ( pViewShell )
-- pViewShell->CutToClip( NULL, TRUE );
--}
--
--void implnPasteSpecial(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 = ScTabViewShell::GetActiveViewShell();
-- if ( !pTabViewShell )
-- // none active, try next best
-- pTabViewShell = getCurrentBestViewShell();
-- 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();
-- }
-- }
-- }
--
--}
--
-- uno::Reference< frame::XModel >
--getCurrentDocument() throw (uno::RuntimeException)
--{
-- uno::Reference< frame::XModel > xModel;
-- SbxObject* pBasic = dynamic_cast< SbxObject* > ( SFX_APP()->GetBasic() );
-- SbxObject* basicChosen = pBasic ;
-- if ( basicChosen == NULL)
-- {
-- OSL_TRACE("getModelFromBasic() StarBASIC* is NULL" );
-- return xModel;
-- }
-- SbxObject* p = pBasic;
-- SbxObject* pParent = p->GetParent();
-- SbxObject* pParentParent = pParent ? pParent->GetParent() : NULL;
--
-- if( pParentParent )
-- {
-- basicChosen = pParentParent;
-- }
-- else if( pParent )
-- {
-- basicChosen = pParent;
-- }
--
--
-- uno::Any aModel;
-- SbxVariable *pCompVar = basicChosen->Find( UniString(RTL_CONSTASCII_USTRINGPARAM("ThisComponent")), SbxCLASS_OBJECT );
--
-- if ( pCompVar )
-- {
-- aModel = sbxToUnoValue( pCompVar );
-- if ( sal_False == ( aModel >>= xModel ) ||
-- !xModel.is() )
-- {
-- // trying last gasp try the current component
-- uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-- // test if vba service is present
-- uno::Reference< uno::XComponentContext > xCtx( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
-- uno::Reference<lang::XMultiComponentFactory > xSMgr( xCtx->getServiceManager(), uno::UNO_QUERY_THROW );
-- uno::Reference< frame::XDesktop > xDesktop (xSMgr->createInstanceWithContext(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"), xCtx), uno::UNO_QUERY_THROW );
-- xModel.set( xDesktop->getCurrentComponent(), uno::UNO_QUERY );
-- if ( !xModel.is() )
-- {
-- throw uno::RuntimeException(
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can't extract model from basic ( its obviously not set yet ) therefore don't know the currently selected document") ), uno::Reference< uno::XInterface >() );
-- }
-- return xModel;
-- }
-- else
-- {
-- OSL_TRACE("Have model ThisComponent points to url %s",
-- ::rtl::OUStringToOString( xModel->getURL(),
-- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-- }
-- }
-- else
-- {
-- OSL_TRACE("Failed to get ThisComponent");
-- throw uno::RuntimeException(
-- rtl::OUString(
-- RTL_CONSTASCII_USTRINGPARAM(
-- "Can't determine the currently selected document") ),
-- uno::Reference< uno::XInterface >() );
-- }
-- return xModel;
--}
--
--ScDocShell*
--getDocShell( 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( css::uno::Reference< css::frame::XModel>& xModel )
--{
-- ScDocShell* pDocShell = getDocShell( xModel );
-- if ( pDocShell )
-- return pDocShell->GetBestViewShell();
-- return NULL;
--}
--
--ScTabViewShell*
--getCurrentBestViewShell()
--{
-- uno::Reference< frame::XModel > xModel = getCurrentDocument();
-- return getBestViewShell( xModel );
--}
--
--SfxViewFrame*
--getCurrentViewFrame()
--{
-- ScTabViewShell* pViewShell = getCurrentBestViewShell();
-- if ( pViewShell )
-- return pViewShell->GetViewFrame();
-- return NULL;
--}
--
--sal_Int32
--OORGBToXLRGB( sal_Int32 nCol )
--{
-- sal_Int32 nRed = nCol;
-- nRed &= 0x00FF0000;
-- nRed >>= 16;
-- sal_Int32 nGreen = nCol;
-- nGreen &= 0x0000FF00;
-- nGreen >>= 8;
-- sal_Int32 nBlue = nCol;
-- nBlue &= 0x000000FF;
-- sal_Int32 nRGB = ( (nBlue << 16) | (nGreen << 8) | nRed );
-- return nRGB;
--}
--sal_Int32
--XLRGBToOORGB( sal_Int32 nCol )
--{
-- sal_Int32 nBlue = nCol;
-- nBlue &= 0x00FF0000;
-- nBlue >>= 16;
-- sal_Int32 nGreen = nCol;
-- nGreen &= 0x0000FF00;
-- nGreen >>= 8;
-- sal_Int32 nRed = nCol;
-- nRed &= 0x000000FF;
-- sal_Int32 nRGB = ( (nRed << 16) | (nGreen << 8) | nBlue );
-- return nRGB;
--}
--uno::Any
--OORGBToXLRGB( const uno::Any& aCol )
--{
-- sal_Int32 nCol=0;
-- aCol >>= nCol;
-- nCol = OORGBToXLRGB( nCol );
-- return uno::makeAny( nCol );
--}
--uno::Any
--XLRGBToOORGB( const uno::Any& aCol )
--{
-- sal_Int32 nCol=0;
-- aCol >>= nCol;
-- nCol = XLRGBToOORGB( nCol );
-- return uno::makeAny( nCol );
--}
--
--void PrintOutHelper( const uno::Any& From, const uno::Any& To, const uno::Any& Copies, const uno::Any& Preview, const uno::Any& /*ActivePrinter*/, const uno::Any& /*PrintToFile*/, const uno::Any& Collate, const uno::Any& PrToFileName, css::uno::Reference< frame::XModel >& xModel, sal_Bool bUseSelection )
--{
-- sal_Int32 nTo = 0;
-- sal_Int32 nFrom = 0;
-- sal_Int16 nCopies = 1;
-- sal_Bool bPreview = sal_False;
-- sal_Bool bCollate = sal_False;
-- sal_Bool bSelection = bUseSelection;
-- From >>= nFrom;
-- To >>= nTo;
-- Copies >>= nCopies;
-- Preview >>= bPreview;
-- if ( nCopies > 1 ) // Collate only useful when more that 1 copy
-- Collate >>= bCollate;
--
-- rtl::OUString sRange( RTL_CONSTASCII_USTRINGPARAM( "-" ) );
-- rtl::OUString sFileName;
--
-- if (( nFrom || nTo ) )
-- {
-- if ( nFrom )
-- sRange = ( ::rtl::OUString::valueOf( nFrom ) + sRange );
-- if ( nTo )
-- sRange += ::rtl::OUString::valueOf( nTo );
-- }
--
-- if ( PrToFileName.getValue() )
-- {
-- PrToFileName >>= sFileName;
-- }
-- ScTabViewShell* pViewShell = getBestViewShell( xModel );
-- SfxViewFrame* pViewFrame = NULL;
-- if ( pViewShell )
-- pViewFrame = pViewShell->GetViewFrame();
-- if ( pViewFrame )
-- {
-- SfxAllItemSet aArgs( SFX_APP()->GetPool() );
--
-- SfxBoolItem sfxCollate( SID_PRINT_COLLATE, bCollate );
-- aArgs.Put( sfxCollate, sfxCollate.Which() );
-- SfxInt16Item sfxCopies( SID_PRINT_COPIES, nCopies );
-- aArgs.Put( sfxCopies, sfxCopies.Which() );
-- if ( sFileName.getLength() )
-- {
-- SfxStringItem sfxFileName( SID_FILE_NAME, sFileName);
-- aArgs.Put( sfxFileName, sfxFileName.Which() );
--
-- }
-- if ( sRange.getLength() )
-- {
-- SfxStringItem sfxRange( SID_PRINT_PAGES, sRange );
-- aArgs.Put( sfxRange, sfxRange.Which() );
-- }
-- SfxBoolItem sfxSelection( SID_SELECTION, bSelection );
-- aArgs.Put( sfxSelection, sfxSelection.Which() );
-- SfxBoolItem sfxAsync( SID_ASYNCHRON, sal_False );
-- aArgs.Put( sfxAsync, sfxAsync.Which() );
-- SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
--
-- if ( pDispatcher )
-- {
-- if ( bPreview )
-- {
-- if ( !pViewFrame->GetFrame().IsInPlace() )
-- {
-- SC_MOD()->InputEnterHandler();
-- pViewFrame->GetDispatcher()->Execute( SID_VIEWSHELL1, SFX_CALLMODE_SYNCHRON );
-- while ( isInPrintPreview( pViewFrame ) )
-- Application::Yield();
-- }
-- }
-- else
-- pDispatcher->Execute( (USHORT)SID_PRINTDOC, (SfxCallMode)SFX_CALLMODE_SYNCHRON, aArgs );
-- }
--
-- }
--
-- // #FIXME #TODO
-- // 1 ActivePrinter ( how/can we switch a printer via API? )
-- // 2 PrintToFile ( ms behaviour if this option is specified but no
-- // filename supplied 'PrToFileName' then the user will be prompted )
-- // 3 Need to check behaviour of Selected sheets with range ( e.g. From & To
-- // values ) in oOO these options are mutually exclusive
-- // 4 There is a pop up to do with transparent objects in the print source
-- // should be able to disable that via configuration for the duration
-- // of this method
--}
--
-- void PrintPreviewHelper( const css::uno::Any& /*EnableChanges*/, css::uno::Reference< css::frame::XModel >& xModel )
--{
-- dispatchExecute( xModel, SID_VIEWSHELL1 );
--}
--
--rtl::OUString getAnyAsString( const uno::Any& pvargItem ) throw ( uno::RuntimeException )
--{
-- uno::Type aType = pvargItem.getValueType();
-- uno::TypeClass eTypeClass = aType.getTypeClass();
-- rtl::OUString sString;
-- switch ( eTypeClass )
-- {
-- case uno::TypeClass_BOOLEAN:
-- {
-- sal_Bool bBool = sal_False;
-- pvargItem >>= bBool;
-- sString = rtl::OUString::valueOf( bBool );
-- break;
-- }
-- case uno::TypeClass_STRING:
-- pvargItem >>= sString;
-- break;
-- case uno::TypeClass_FLOAT:
-- {
-- float aFloat = 0;
-- pvargItem >>= aFloat;
-- sString = rtl::OUString::valueOf( aFloat );
-- break;
-- }
-- case uno::TypeClass_DOUBLE:
-- {
-- double aDouble = 0;
-- pvargItem >>= aDouble;
-- sString = rtl::OUString::valueOf( aDouble );
-- break;
-- }
-- case uno::TypeClass_SHORT:
-- case uno::TypeClass_LONG:
-- case uno::TypeClass_BYTE:
-- {
-- sal_Int32 aNum = 0;
-- pvargItem >>= aNum;
-- sString = rtl::OUString::valueOf( aNum );
-- break;
-- }
--
-- case uno::TypeClass_HYPER:
-- {
-- sal_Int64 aHyper = 0;
-- pvargItem >>= aHyper;
-- sString = rtl::OUString::valueOf( aHyper );
-- break;
-- }
-- default:
-- throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid type, can't convert" ), uno::Reference< uno::XInterface >() );
-- }
-- return sString;
--}
--
--
--rtl::OUString
--ContainerUtilities::getUniqueName( const uno::Sequence< ::rtl::OUString >& _slist, const rtl::OUString& _sElementName, const ::rtl::OUString& _sSuffixSeparator)
--{
-- return getUniqueName(_slist, _sElementName, _sSuffixSeparator, sal_Int32(2));
--}
--
--rtl::OUString
--ContainerUtilities::getUniqueName( const uno::Sequence< rtl::OUString >& _slist, const rtl::OUString _sElementName, const rtl::OUString& _sSuffixSeparator, sal_Int32 _nStartSuffix)
--{
-- sal_Int32 a = _nStartSuffix;
-- rtl::OUString scompname = _sElementName;
-- bool bElementexists = true;
-- sal_Int32 nLen = _slist.getLength();
-- if ( nLen == 0 )
-- return _sElementName;
--
-- while (bElementexists == true)
-- {
-- for (sal_Int32 i = 0; i < nLen; i++)
-- {
-- if (FieldInList(_slist, scompname) == -1)
-- {
-- return scompname;
-- }
-- }
-- scompname = _sElementName + _sSuffixSeparator + rtl::OUString::valueOf( a++ );
-- }
-- return rtl::OUString();
--}
--
--sal_Int32
--ContainerUtilities::FieldInList( const uno::Sequence< rtl::OUString >& SearchList, const rtl::OUString& SearchString )
--{
-- sal_Int32 FieldLen = SearchList.getLength();
-- sal_Int32 retvalue = -1;
-- for (sal_Int32 i = 0; i < FieldLen; i++)
-- {
-- // I wonder why comparing lexicographically is done
-- // when its a match is whats interesting?
-- //if (SearchList[i].compareTo(SearchString) == 0)
-- if ( SearchList[i].equals( SearchString ) )
-- {
-- retvalue = i;
-- break;
-- }
-- }
-- return retvalue;
--
--}
--bool NeedEsc(sal_Unicode cCode)
--{
-- String sEsc(RTL_CONSTASCII_USTRINGPARAM(".^$+\\|{}()"));
-- return (STRING_NOTFOUND != sEsc.Search(cCode));
--}
--
--rtl::OUString VBAToRegexp(const rtl::OUString &rIn, bool bForLike )
--{
-- rtl::OUStringBuffer sResult;
-- const sal_Unicode *start = rIn.getStr();
-- const sal_Unicode *end = start + rIn.getLength();
--
-- int seenright = 0;
-- if ( bForLike )
-- sResult.append(static_cast<sal_Unicode>('^'));
--
-- while (start < end)
-- {
-- switch (*start)
-- {
-- case '?':
-- sResult.append(static_cast<sal_Unicode>('.'));
-- start++;
-- break;
-- case '*':
-- sResult.append(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".*")));
-- start++;
-- break;
-- case '#':
-- sResult.append(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("[0-9]")));
-- start++;
-- break;
-- case '~':
-- sResult.append(static_cast<sal_Unicode>('\\'));
-- sResult.append(*(++start));
-- start++;
-- break;
-- // dump the ~ and escape the next characture
-- case ']':
-- sResult.append(static_cast<sal_Unicode>('\\'));
-- sResult.append(*start++);
-- break;
-- case '[':
-- sResult.append(*start++);
-- seenright = 0;
-- while (start < end && !seenright)
-- {
-- switch (*start)
-- {
-- case '[':
-- case '?':
-- case '*':
-- sResult.append(static_cast<sal_Unicode>('\\'));
-- sResult.append(*start);
-- break;
-- case ']':
-- sResult.append(*start);
-- seenright = 1;
-- break;
-- case '!':
-- sResult.append(static_cast<sal_Unicode>('^'));
-- break;
-- default:
-- if (NeedEsc(*start))
-- sResult.append(static_cast<sal_Unicode>('\\'));
-- sResult.append(*start);
-- break;
-- }
-- start++;
-- }
-- break;
-- default:
-- if (NeedEsc(*start))
-- sResult.append(static_cast<sal_Unicode>('\\'));
-- sResult.append(*start++);
-- }
-- }
--
-- if ( bForLike )
-- sResult.append(static_cast<sal_Unicode>('$'));
--
-- return sResult.makeStringAndClear( );
--}
--
--double getPixelTo100thMillimeterConversionFactor( css::uno::Reference< css::awt::XDevice >& xDevice, sal_Bool bVertical)
--{
-- double fConvertFactor = 1.0;
-- if( bVertical )
-- {
-- fConvertFactor = xDevice->getInfo().PixelPerMeterY/100000;
-- }
-- else
-- {
-- fConvertFactor = xDevice->getInfo().PixelPerMeterX/100000;
-- }
-- return fConvertFactor;
--}
--
--double PointsToPixels( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical)
--{
-- double fConvertFactor = getPixelTo100thMillimeterConversionFactor( xDevice, bVertical );
-- return fPoints * POINTTO100THMILLIMETERFACTOR * fConvertFactor;
--}
--double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double fPixels, sal_Bool bVertical)
--{
-- double fConvertFactor = getPixelTo100thMillimeterConversionFactor( xDevice, bVertical );
-- return (fPixels/fConvertFactor)/POINTTO100THMILLIMETERFACTOR;
--}
--
--ConcreteXShapeGeometryAttributes::ConcreteXShapeGeometryAttributes( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape )
--{
-- m_xShape = new ScVbaShape( xContext, xShape );
--}
--
--#define VBA_LEFT "PositionX"
--#define VBA_TOP "PositionY"
--UserFormGeometryHelper::UserFormGeometryHelper( const uno::Reference< uno::XComponentContext >& /*xContext*/, const uno::Reference< awt::XControl >& xControl )
--{
-- mxModel.set( xControl->getModel(), uno::UNO_QUERY_THROW );
--}
-- double UserFormGeometryHelper::getLeft()
-- {
-- sal_Int32 nLeft = 0;
-- mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_LEFT ) ) ) >>= nLeft;
-- return Millimeter::getInPoints( nLeft );
-- }
-- void UserFormGeometryHelper::setLeft( double nLeft )
-- {
-- mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_LEFT ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nLeft ) ) );
-- }
-- double UserFormGeometryHelper::getTop()
-- {
-- sal_Int32 nTop = 0;
-- mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_TOP ) ) ) >>= nTop;
-- return Millimeter::getInPoints( nTop );
-- }
-- void UserFormGeometryHelper::setTop( double nTop )
-- {
-- mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_TOP ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nTop ) ) );
-- }
-- double UserFormGeometryHelper::getHeight()
-- {
-- sal_Int32 nHeight = 0;
-- mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CELLHGT ) ) ) >>= nHeight;
-- return Millimeter::getInPoints( nHeight );
-- }
-- void UserFormGeometryHelper::setHeight( double nHeight )
-- {
-- mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CELLHGT ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nHeight ) ) );
-- }
-- double UserFormGeometryHelper::getWidth()
-- {
-- sal_Int32 nWidth = 0;
-- mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CELLWID ) ) ) >>= nWidth;
-- return Millimeter::getInPoints( nWidth );
-- }
-- void UserFormGeometryHelper::setWidth( double nWidth)
-- {
-- mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CELLWID ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nWidth ) ) );
-- }
--
--SfxItemSet*
--ScVbaCellRangeAccess::GetDataSet( ScCellRangeObj* pRangeObj )
--{
-- SfxItemSet* pDataSet = pRangeObj ? pRangeObj->GetCurrentDataSet( true ) : NULL ;
-- return pDataSet;
--
--}
--
--} // openoffice
--} //org
--=======
-->>>>>>> other
-diff --git sc/source/ui/vba/vbamenu.cxx sc/source/ui/vba/vbamenu.cxx
-new file mode 100644
-index 0000000..58972b0
---- /dev/null
-+++ sc/source/ui/vba/vbamenu.cxx
-@@ -0,0 +1,91 @@
-+/*************************************************************************
-+ *
-+ * 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 "vbamenu.hxx"
-+#include "vbamenuitems.hxx"
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+
-+ScVbaMenu::ScVbaMenu( const uno::Reference< ov::XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< XCommandBarControl >& xCommandBarControl ) throw( uno::RuntimeException ) : Menu_BASE( xParent, xContext ), m_xCommandBarControl( xCommandBarControl )
-+{
-+}
-+
-+::rtl::OUString SAL_CALL
-+ScVbaMenu::getCaption() throw ( uno::RuntimeException )
-+{
-+ return m_xCommandBarControl->getCaption();
-+}
-+
-+void SAL_CALL
-+ScVbaMenu::setCaption( const ::rtl::OUString& _caption ) throw (uno::RuntimeException)
-+{
-+ m_xCommandBarControl->setCaption( _caption );
-+}
-+
-+void SAL_CALL
-+ScVbaMenu::Delete( ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ m_xCommandBarControl->Delete();
-+}
-+
-+uno::Any SAL_CALL
-+ScVbaMenu::MenuItems( const uno::Any& aIndex ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ uno::Reference< XCommandBarControls > xCommandBarControls( m_xCommandBarControl->Controls( uno::Any() ), uno::UNO_QUERY_THROW );
-+ uno::Reference< excel::XMenuItems > xMenuItems( new ScVbaMenuItems( this, mxContext, xCommandBarControls ) );
-+ if( aIndex.hasValue() )
-+ {
-+ return xMenuItems->Item( aIndex, uno::Any() );
-+ }
-+ return uno::makeAny( xMenuItems );
-+}
-+
-+rtl::OUString&
-+ScVbaMenu::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaMenu") );
-+ return sImplName;
-+}
-+uno::Sequence<rtl::OUString>
-+ScVbaMenu::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Menu" ) );
-+ }
-+ return aServiceNames;
-+}
-diff --git sc/source/ui/vba/vbamenu.hxx sc/source/ui/vba/vbamenu.hxx
-new file mode 100644
-index 0000000..cd96857
---- /dev/null
-+++ sc/source/ui/vba/vbamenu.hxx
-@@ -0,0 +1,62 @@
-+/*************************************************************************
-+ *
-+ * 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_MENU_HXX
-+#define SC_VBA_MENU_HXX
-+
-+#include <ooo/vba/excel/XMenu.hpp>
-+#include <ooo/vba/XCommandBarControl.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+
-+typedef InheritedHelperInterfaceImpl1< ov::excel::XMenu > Menu_BASE;
-+
-+class ScVbaMenu : public Menu_BASE
-+{
-+private:
-+ css::uno::Reference< ov::XCommandBarControl > m_xCommandBarControl;
-+
-+public:
-+ ScVbaMenu( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, const css::uno::Reference< ov::XCommandBarControl >& xCommandBarControl ) 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);
-+
-+ virtual void SAL_CALL Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL MenuItems( const css::uno::Any& aIndex ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif//SC_VBA_MENU_HXX
-diff --git sc/source/ui/vba/vbamenubar.cxx sc/source/ui/vba/vbamenubar.cxx
-new file mode 100644
-index 0000000..9386028
---- /dev/null
-+++ sc/source/ui/vba/vbamenubar.cxx
-@@ -0,0 +1,74 @@
-+/*************************************************************************
-+ *
-+ * 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 "vbamenubar.hxx"
-+#include "vbamenus.hxx"
-+#include <ooo/vba/XCommandBarControls.hpp>
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+
-+ScVbaMenuBar::ScVbaMenuBar( const uno::Reference< ov::XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< XCommandBar >& xCommandBar ) throw( uno::RuntimeException ) : MenuBar_BASE( xParent, xContext ), m_xCommandBar( xCommandBar )
-+{
-+}
-+
-+uno::Any SAL_CALL
-+ScVbaMenuBar::Menus( const uno::Any& aIndex ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ uno::Reference< XCommandBarControls > xCommandBarControls( m_xCommandBar->Controls( uno::Any() ), uno::UNO_QUERY_THROW );
-+ uno::Reference< excel::XMenus > xMenus( new ScVbaMenus( this, mxContext, xCommandBarControls ) );
-+ if( aIndex.hasValue() )
-+ {
-+ return xMenus->Item( aIndex, uno::Any() );
-+ }
-+ return uno::makeAny( xMenus );
-+}
-+
-+rtl::OUString&
-+ScVbaMenuBar::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaMenuBar") );
-+ return sImplName;
-+}
-+uno::Sequence<rtl::OUString>
-+ScVbaMenuBar::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.MenuBar" ) );
-+ }
-+ return aServiceNames;
-+}
-diff --git sc/source/ui/vba/vbamenubar.hxx sc/source/ui/vba/vbamenubar.hxx
-new file mode 100644
-index 0000000..fa39054
---- /dev/null
-+++ sc/source/ui/vba/vbamenubar.hxx
-@@ -0,0 +1,58 @@
-+/*************************************************************************
-+ *
-+ * 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_MENUBAR_HXX
-+#define SC_VBA_MENUBAR_HXX
-+
-+#include <ooo/vba/excel/XMenuBar.hpp>
-+#include <ooo/vba/XCommandBar.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+
-+typedef InheritedHelperInterfaceImpl1< ov::excel::XMenuBar > MenuBar_BASE;
-+
-+class ScVbaMenuBar : public MenuBar_BASE
-+{
-+private:
-+ css::uno::Reference< ov::XCommandBar > m_xCommandBar;
-+
-+public:
-+ ScVbaMenuBar( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, const css::uno::Reference< ov::XCommandBar >& xCommandBar ) throw( css::uno::RuntimeException );
-+
-+ virtual css::uno::Any SAL_CALL Menus( const css::uno::Any& aIndex ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif//SC_VBA_MENUBAR_HXX
-diff --git sc/source/ui/vba/vbamenubars.cxx sc/source/ui/vba/vbamenubars.cxx
-new file mode 100644
-index 0000000..a5f9e9b
---- /dev/null
-+++ sc/source/ui/vba/vbamenubars.cxx
-@@ -0,0 +1,146 @@
-+/*************************************************************************
-+ *
-+ * 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 "vbamenubars.hxx"
-+#include "vbamenubar.hxx"
-+#include <ooo/vba/excel/XlSheetType.hpp>
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+
-+
-+typedef ::cppu::WeakImplHelper1< container::XEnumeration > MenuBarEnumeration_BASE;
-+
-+class MenuBarEnumeration : public MenuBarEnumeration_BASE
-+{
-+ uno::Reference< XHelperInterface > m_xParent;
-+ uno::Reference< uno::XComponentContext > m_xContext;
-+ uno::Reference< container::XEnumeration > m_xEnumeration;
-+public:
-+ MenuBarEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration) throw ( uno::RuntimeException ) : m_xParent( xParent ), m_xContext( xContext ), m_xEnumeration( xEnumeration )
-+ {
-+ }
-+ virtual sal_Bool SAL_CALL hasMoreElements() throw ( uno::RuntimeException )
-+ {
-+ return m_xEnumeration->hasMoreElements();
-+ }
-+ virtual uno::Any SAL_CALL nextElement() throw ( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
-+ {
-+ // FIXME: should be add menubar
-+ if( hasMoreElements() )
-+ {
-+ uno::Reference< XCommandBar > xCommandBar( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
-+ uno::Reference< excel::XMenuBar > xMenuBar( new ScVbaMenuBar( m_xParent, m_xContext, xCommandBar ) );
-+ return uno::makeAny( xMenuBar );
-+ }
-+ else
-+ throw container::NoSuchElementException();
-+ return uno::Any();
-+ }
-+};
-+
-+ScVbaMenuBars::ScVbaMenuBars( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< XCommandBars >& xCommandBars ) throw ( uno::RuntimeException ) : MenuBars_BASE( xParent, xContext, uno::Reference< container::XIndexAccess>() ), m_xCommandBars( xCommandBars )
-+{
-+}
-+
-+ScVbaMenuBars::~ScVbaMenuBars()
-+{
-+}
-+
-+// XEnumerationAccess
-+uno::Type SAL_CALL
-+ScVbaMenuBars::getElementType() throw ( uno::RuntimeException )
-+{
-+ return excel::XMenuBar::static_type( 0 );
-+}
-+
-+uno::Reference< container::XEnumeration >
-+ScVbaMenuBars::createEnumeration() throw ( uno::RuntimeException )
-+{
-+ uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xCommandBars, uno::UNO_QUERY_THROW );
-+ return uno::Reference< container::XEnumeration >( new MenuBarEnumeration( this, mxContext, xEnumAccess->createEnumeration() ) );
-+}
-+
-+uno::Any
-+ScVbaMenuBars::createCollectionObject( const uno::Any& aSource )
-+{
-+ // make no sense
-+ return aSource;
-+}
-+
-+sal_Int32 SAL_CALL
-+ScVbaMenuBars::getCount() throw(css::uno::RuntimeException)
-+{
-+ return m_xCommandBars->getCount();
-+}
-+
-+// ScVbaCollectionBaseImpl
-+uno::Any SAL_CALL
-+ScVbaMenuBars::Item( const uno::Any& aIndex, const uno::Any& /*aIndex2*/ ) throw( uno::RuntimeException )
-+{
-+ sal_Int16 nIndex = 0;
-+ aIndex >>= nIndex;
-+ if( nIndex == excel::XlSheetType::xlWorksheet )
-+ {
-+ uno::Any aSource;
-+ aSource <<= rtl::OUString::createFromAscii( "Worksheet Menu Bar" );
-+ uno::Reference< XCommandBar > xCommandBar( m_xCommandBars->Item( aSource, uno::Any() ), uno::UNO_QUERY_THROW );
-+ uno::Reference< excel::XMenuBar > xMenuBar( new ScVbaMenuBar( this, mxContext, xCommandBar ) );
-+ return uno::makeAny( xMenuBar );
-+ }
-+
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+
-+ return uno::Any();
-+}
-+
-+// XHelperInterface
-+rtl::OUString&
-+ScVbaMenuBars::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaMenuBars") );
-+ return sImplName;
-+}
-+uno::Sequence<rtl::OUString>
-+ScVbaMenuBars::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.MenuBars" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sc/source/ui/vba/vbamenubars.hxx sc/source/ui/vba/vbamenubars.hxx
-new file mode 100644
-index 0000000..0d8ea58
---- /dev/null
-+++ sc/source/ui/vba/vbamenubars.hxx
-@@ -0,0 +1,69 @@
-+/*************************************************************************
-+ *
-+ * 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_MENUBARS_HXX
-+#define SC_VBA_MENUBARS_HXX
-+
-+#include <ooo/vba/excel/XMenuBars.hpp>
-+#include <ooo/vba/excel/XMenuBar.hpp>
-+#include <ooo/vba/XCommandBars.hpp>
-+#include <com/sun/star/container/XNameAccess.hpp>
-+#include <cppuhelper/implbase1.hxx>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <vbahelper/vbacollectionimpl.hxx>
-+
-+typedef CollTestImplHelper< ov::excel::XMenuBars > MenuBars_BASE;
-+
-+class ScVbaMenuBars : public MenuBars_BASE
-+{
-+private:
-+ css::uno::Reference< ov::XCommandBars > m_xCommandBars;
-+
-+public:
-+ ScVbaMenuBars( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< ov::XCommandBars >& xCommandBars ) throw (css::uno::RuntimeException);
-+ virtual ~ScVbaMenuBars();
-+
-+ // 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<rtl::OUString> getServiceNames();
-+};
-+
-+#endif//SC_VBA_MENUBARS_HXX
-diff --git sc/source/ui/vba/vbamenuitem.cxx sc/source/ui/vba/vbamenuitem.cxx
-new file mode 100644
-index 0000000..48254cc
---- /dev/null
-+++ sc/source/ui/vba/vbamenuitem.cxx
-@@ -0,0 +1,90 @@
-+/*************************************************************************
-+ *
-+ * 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 "vbamenuitem.hxx"
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+
-+ScVbaMenuItem::ScVbaMenuItem( const uno::Reference< ov::XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< XCommandBarControl >& xCommandBarControl ) throw( uno::RuntimeException ) : MenuItem_BASE( xParent, xContext ), m_xCommandBarControl( xCommandBarControl )
-+{
-+}
-+
-+::rtl::OUString SAL_CALL
-+ScVbaMenuItem::getCaption() throw ( uno::RuntimeException )
-+{
-+ return m_xCommandBarControl->getCaption();
-+}
-+
-+void SAL_CALL
-+ScVbaMenuItem::setCaption( const ::rtl::OUString& _caption ) throw (uno::RuntimeException)
-+{
-+ m_xCommandBarControl->setCaption( _caption );
-+}
-+
-+::rtl::OUString SAL_CALL
-+ScVbaMenuItem::getOnAction() throw ( uno::RuntimeException )
-+{
-+ return m_xCommandBarControl->getOnAction();
-+}
-+
-+void SAL_CALL
-+ScVbaMenuItem::setOnAction( const ::rtl::OUString& _onaction ) throw (uno::RuntimeException)
-+{
-+ m_xCommandBarControl->setOnAction( _onaction );
-+}
-+
-+void SAL_CALL
-+ScVbaMenuItem::Delete( ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ m_xCommandBarControl->Delete();
-+}
-+
-+rtl::OUString&
-+ScVbaMenuItem::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaMenuItem") );
-+ return sImplName;
-+}
-+uno::Sequence<rtl::OUString>
-+ScVbaMenuItem::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.MenuItem" ) );
-+ }
-+ return aServiceNames;
-+}
-diff --git sc/source/ui/vba/vbamenuitem.hxx sc/source/ui/vba/vbamenuitem.hxx
-new file mode 100644
-index 0000000..bf4c087
---- /dev/null
-+++ sc/source/ui/vba/vbamenuitem.hxx
-@@ -0,0 +1,63 @@
-+/*************************************************************************
-+ *
-+ * 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_MENUITEM_HXX
-+#define SC_VBA_MENUITEM_HXX
-+
-+#include <ooo/vba/excel/XMenuItem.hpp>
-+#include <ooo/vba/XCommandBarControl.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+
-+typedef InheritedHelperInterfaceImpl1< ov::excel::XMenuItem > MenuItem_BASE;
-+
-+class ScVbaMenuItem : public MenuItem_BASE
-+{
-+private:
-+ css::uno::Reference< ov::XCommandBarControl > m_xCommandBarControl;
-+
-+public:
-+ ScVbaMenuItem( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, const css::uno::Reference< ov::XCommandBarControl >& xCommandBarControl ) 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);
-+ virtual ::rtl::OUString SAL_CALL getOnAction() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setOnAction( const ::rtl::OUString& _onaction ) throw (css::uno::RuntimeException);
-+
-+ virtual void SAL_CALL Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif//SC_VBA_MENUITEM_HXX
-diff --git sc/source/ui/vba/vbamenuitems.cxx sc/source/ui/vba/vbamenuitems.cxx
-new file mode 100644
-index 0000000..3a5cd79
---- /dev/null
-+++ sc/source/ui/vba/vbamenuitems.cxx
-@@ -0,0 +1,159 @@
-+/*************************************************************************
-+ *
-+ * 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 "vbamenuitems.hxx"
-+#include "vbamenuitem.hxx"
-+#include "vbamenu.hxx"
-+#include <ooo/vba/office/MsoControlType.hpp>
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+
-+
-+typedef ::cppu::WeakImplHelper1< container::XEnumeration > MenuEnumeration_BASE;
-+
-+class MenuEnumeration : public MenuEnumeration_BASE
-+{
-+ uno::Reference< XHelperInterface > m_xParent;
-+ uno::Reference< uno::XComponentContext > m_xContext;
-+ uno::Reference< container::XEnumeration > m_xEnumeration;
-+public:
-+ MenuEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration) throw ( uno::RuntimeException ) : m_xParent( xParent ), m_xContext( xContext ), m_xEnumeration( xEnumeration )
-+ {
-+ }
-+ virtual sal_Bool SAL_CALL hasMoreElements() throw ( uno::RuntimeException )
-+ {
-+ return m_xEnumeration->hasMoreElements();
-+ }
-+ virtual uno::Any SAL_CALL nextElement() throw ( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
-+ {
-+ // FIXME: should be add menu
-+ if( hasMoreElements() )
-+ {
-+ uno::Reference< XCommandBarControl > xCommandBarControl( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
-+ if( xCommandBarControl->getType() == office::MsoControlType::msoControlPopup )
-+ {
-+ uno::Reference< excel::XMenu > xMenu( new ScVbaMenu( m_xParent, m_xContext, xCommandBarControl ) );
-+ return uno::makeAny( xMenu );
-+ }
-+ else if( xCommandBarControl->getType() == office::MsoControlType::msoControlButton )
-+ {
-+ uno::Reference< excel::XMenuItem > xMenuItem( new ScVbaMenuItem( m_xParent, m_xContext, xCommandBarControl ) );
-+ return uno::makeAny( xMenuItem );
-+ }
-+ nextElement();
-+ }
-+ else
-+ throw container::NoSuchElementException();
-+ return uno::Any();
-+ }
-+};
-+
-+ScVbaMenuItems::ScVbaMenuItems( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< XCommandBarControls >& xCommandBarControls ) throw ( uno::RuntimeException ) : MenuItems_BASE( xParent, xContext, uno::Reference< container::XIndexAccess>() ), m_xCommandBarControls( xCommandBarControls )
-+{
-+}
-+
-+// XEnumerationAccess
-+uno::Type SAL_CALL
-+ScVbaMenuItems::getElementType() throw ( uno::RuntimeException )
-+{
-+ return excel::XMenuItem::static_type( 0 );
-+}
-+
-+uno::Reference< container::XEnumeration >
-+ScVbaMenuItems::createEnumeration() throw ( uno::RuntimeException )
-+{
-+ uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xCommandBarControls, uno::UNO_QUERY_THROW );
-+ return uno::Reference< container::XEnumeration >( new MenuEnumeration( this, mxContext, xEnumAccess->createEnumeration() ) );
-+}
-+
-+uno::Any
-+ScVbaMenuItems::createCollectionObject( const uno::Any& aSource )
-+{
-+ // make no sense
-+ return aSource;
-+}
-+
-+sal_Int32 SAL_CALL
-+ScVbaMenuItems::getCount() throw(css::uno::RuntimeException)
-+{
-+ // FIXME: should check if it is a popup menu
-+ return m_xCommandBarControls->getCount();
-+}
-+
-+// ScVbaCollectionBaseImpl
-+uno::Any SAL_CALL
-+ScVbaMenuItems::Item( const uno::Any& aIndex, const uno::Any& /*aIndex2*/ ) throw( uno::RuntimeException )
-+{
-+ uno::Reference< XCommandBarControl > xCommandBarControl( m_xCommandBarControls->Item( aIndex, uno::Any() ), uno::UNO_QUERY_THROW );
-+ if( xCommandBarControl->getType() == office::MsoControlType::msoControlPopup )
-+ return uno::makeAny( uno::Reference< excel::XMenu > ( new ScVbaMenu( this, mxContext, xCommandBarControl ) ) );
-+ else if( xCommandBarControl->getType() == office::MsoControlType::msoControlButton )
-+ return uno::makeAny( uno::Reference< excel::XMenuItem > ( new ScVbaMenuItem( this, mxContext, xCommandBarControl ) ) );
-+ throw uno::RuntimeException();
-+}
-+
-+uno::Reference< excel::XMenuItem > SAL_CALL ScVbaMenuItems::Add( const rtl::OUString& Caption, const css::uno::Any& OnAction, const css::uno::Any& /*ShortcutKey*/, const css::uno::Any& Before, const css::uno::Any& Restore, const css::uno::Any& /*StatusBar*/, const css::uno::Any& /*HelpFile*/, const css::uno::Any& /*HelpContextID*/ ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
-+{
-+ sal_Int32 nType = office::MsoControlType::msoControlButton;
-+ uno::Reference< XCommandBarControl > xCommandBarControl = m_xCommandBarControls->Add( uno::makeAny( nType ), uno::Any(), uno::Any(), Before, Restore );
-+ xCommandBarControl->setCaption( Caption );
-+ if( OnAction.hasValue() )
-+ {
-+ rtl::OUString sAction;
-+ OnAction >>= sAction;
-+ xCommandBarControl->setOnAction( sAction );
-+ }
-+ return uno::Reference< excel::XMenuItem >( new ScVbaMenuItem( this, mxContext, xCommandBarControl ) );
-+}
-+
-+// XHelperInterface
-+rtl::OUString&
-+ScVbaMenuItems::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaMenuItems") );
-+ return sImplName;
-+}
-+uno::Sequence<rtl::OUString>
-+ScVbaMenuItems::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.MenuItems" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sc/source/ui/vba/vbamenuitems.hxx sc/source/ui/vba/vbamenuitems.hxx
-new file mode 100644
-index 0000000..8aeb931
---- /dev/null
-+++ sc/source/ui/vba/vbamenuitems.hxx
-@@ -0,0 +1,68 @@
-+/*************************************************************************
-+ *
-+ * 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_MENUITEMS_HXX
-+#define SC_VBA_MENUITEMS_HXX
-+
-+#include <ooo/vba/excel/XMenuItems.hpp>
-+#include <ooo/vba/excel/XMenuItem.hpp>
-+#include <ooo/vba/XCommandBarControls.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <vbahelper/vbacollectionimpl.hxx>
-+
-+typedef CollTestImplHelper< ov::excel::XMenuItems > MenuItems_BASE;
-+
-+class ScVbaMenuItems : public MenuItems_BASE
-+{
-+private:
-+ css::uno::Reference< ov::XCommandBarControls > m_xCommandBarControls;
-+
-+public:
-+ ScVbaMenuItems( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< ov::XCommandBarControls >& xCommandBarControls ) 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 sal_Int32 SAL_CALL getCount() throw(css::uno::RuntimeException);
-+ 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::excel::XMenuItem > SAL_CALL Add( const rtl::OUString& Caption, const css::uno::Any& OnAction, const css::uno::Any& ShortcutKey, const css::uno::Any& Before, const css::uno::Any& Restore, const css::uno::Any& StatusBar, const css::uno::Any& HelpFile, const css::uno::Any& HelpContextID ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif//SC_VBA_MENUITEMS_HXX
-diff --git sc/source/ui/vba/vbamenus.cxx sc/source/ui/vba/vbamenus.cxx
-new file mode 100644
-index 0000000..7d5a21b
---- /dev/null
-+++ sc/source/ui/vba/vbamenus.cxx
-@@ -0,0 +1,145 @@
-+/*************************************************************************
-+ *
-+ * 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 "vbamenus.hxx"
-+#include "vbamenu.hxx"
-+#include <ooo/vba/office/MsoControlType.hpp>
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+
-+
-+typedef ::cppu::WeakImplHelper1< container::XEnumeration > MenuEnumeration_BASE;
-+
-+class MenuEnumeration : public MenuEnumeration_BASE
-+{
-+ uno::Reference< XHelperInterface > m_xParent;
-+ uno::Reference< uno::XComponentContext > m_xContext;
-+ uno::Reference< container::XEnumeration > m_xEnumeration;
-+public:
-+ MenuEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration) throw ( uno::RuntimeException ) : m_xParent( xParent ), m_xContext( xContext ), m_xEnumeration( xEnumeration )
-+ {
-+ }
-+ virtual sal_Bool SAL_CALL hasMoreElements() throw ( uno::RuntimeException )
-+ {
-+ return m_xEnumeration->hasMoreElements();
-+ }
-+ virtual uno::Any SAL_CALL nextElement() throw ( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
-+ {
-+ // FIXME: should be add menu
-+ if( hasMoreElements() )
-+ {
-+ uno::Reference< XCommandBarControl > xCommandBarControl( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
-+ if( xCommandBarControl->getType() == office::MsoControlType::msoControlPopup )
-+ {
-+ uno::Reference< excel::XMenu > xMenu( new ScVbaMenu( m_xParent, m_xContext, xCommandBarControl ) );
-+ return uno::makeAny( xMenu );
-+ }
-+ nextElement();
-+ }
-+ else
-+ throw container::NoSuchElementException();
-+ return uno::Any();
-+ }
-+};
-+
-+ScVbaMenus::ScVbaMenus( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< XCommandBarControls >& xCommandBarControls ) throw ( uno::RuntimeException ) : Menus_BASE( xParent, xContext, uno::Reference< container::XIndexAccess>() ), m_xCommandBarControls( xCommandBarControls )
-+{
-+}
-+
-+// XEnumerationAccess
-+uno::Type SAL_CALL
-+ScVbaMenus::getElementType() throw ( uno::RuntimeException )
-+{
-+ return excel::XMenu::static_type( 0 );
-+}
-+
-+uno::Reference< container::XEnumeration >
-+ScVbaMenus::createEnumeration() throw ( uno::RuntimeException )
-+{
-+ uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xCommandBarControls, uno::UNO_QUERY_THROW );
-+ return uno::Reference< container::XEnumeration >( new MenuEnumeration( this, mxContext, xEnumAccess->createEnumeration() ) );
-+}
-+
-+uno::Any
-+ScVbaMenus::createCollectionObject( const uno::Any& aSource )
-+{
-+ // make no sense
-+ return aSource;
-+}
-+
-+sal_Int32 SAL_CALL
-+ScVbaMenus::getCount() throw(css::uno::RuntimeException)
-+{
-+ // FIXME: should check if it is a popup menu
-+ return m_xCommandBarControls->getCount();
-+}
-+
-+// ScVbaCollectionBaseImpl
-+uno::Any SAL_CALL
-+ScVbaMenus::Item( const uno::Any& aIndex, const uno::Any& /*aIndex2*/ ) throw( uno::RuntimeException )
-+{
-+ uno::Reference< XCommandBarControl > xCommandBarControl( m_xCommandBarControls->Item( aIndex, uno::Any() ), uno::UNO_QUERY_THROW );
-+ if( xCommandBarControl->getType() != office::MsoControlType::msoControlPopup )
-+ throw uno::RuntimeException();
-+ return uno::makeAny( uno::Reference< excel::XMenu > ( new ScVbaMenu( this, mxContext, xCommandBarControl ) ) );
-+}
-+
-+uno::Reference< excel::XMenu > SAL_CALL ScVbaMenus::Add( const rtl::OUString& Caption, const css::uno::Any& Before, const css::uno::Any& Restore ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
-+{
-+ sal_Int32 nType = office::MsoControlType::msoControlPopup;
-+ uno::Reference< XCommandBarControl > xCommandBarControl = m_xCommandBarControls->Add( uno::makeAny( nType ), uno::Any(), uno::Any(), Before, Restore );
-+ xCommandBarControl->setCaption( Caption );
-+ return uno::Reference< excel::XMenu >( new ScVbaMenu( this, mxContext, xCommandBarControl ) );
-+}
-+
-+// XHelperInterface
-+rtl::OUString&
-+ScVbaMenus::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaMenus") );
-+ return sImplName;
-+}
-+uno::Sequence<rtl::OUString>
-+ScVbaMenus::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Menus" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sc/source/ui/vba/vbamenus.hxx sc/source/ui/vba/vbamenus.hxx
-new file mode 100644
-index 0000000..596127e
---- /dev/null
-+++ sc/source/ui/vba/vbamenus.hxx
-@@ -0,0 +1,68 @@
-+/*************************************************************************
-+ *
-+ * 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_MENUS_HXX
-+#define SC_VBA_MENUS_HXX
-+
-+#include <ooo/vba/excel/XMenus.hpp>
-+#include <ooo/vba/excel/XMenu.hpp>
-+#include <ooo/vba/XCommandBarControls.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <vbahelper/vbacollectionimpl.hxx>
-+
-+typedef CollTestImplHelper< ov::excel::XMenus > Menus_BASE;
-+
-+class ScVbaMenus : public Menus_BASE
-+{
-+private:
-+ css::uno::Reference< ov::XCommandBarControls > m_xCommandBarControls;
-+
-+public:
-+ ScVbaMenus( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< ov::XCommandBarControls >& xCommandBarControls ) 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 sal_Int32 SAL_CALL getCount() throw(css::uno::RuntimeException);
-+ 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::excel::XMenu > SAL_CALL Add( const rtl::OUString& Caption, const css::uno::Any& Before, const css::uno::Any& Restore ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif//SC_VBA_MENUS_HXX
-diff --git sc/source/ui/vba/vbaname.cxx sc/source/ui/vba/vbaname.cxx
-index 667679c..4d7876d 100644
---- sc/source/ui/vba/vbaname.cxx
-+++ sc/source/ui/vba/vbaname.cxx
-@@ -69,8 +69,8 @@ ScVbaName::getWorkSheet() throw (css::uno::RuntimeException)
- ScVbaName::getName() throw (css::uno::RuntimeException)
- {
- String sName;
-- sName += UniString( getWorkSheet()->getName());
-- sName += String::CreateFromAscii("!");
-+ //sName += UniString( getWorkSheet()->getName()); //liuchen 2009-9-9 resolve the defect that the name get by macro code are not the same with that in UI (for example, if a name of "AA" is found in the UI "Define Names" dialog box, the result of get that name through macro code will be "Sheet1!AA")
-+ //sName += String::CreateFromAscii("!");
- sName += UniString ( mxNamedRange->getName() );
- return ::rtl::OUString( sName );
- }
-diff --git sc/source/ui/vba/vbanames.cxx sc/source/ui/vba/vbanames.cxx
-index 5373717..f993aee 100644
---- sc/source/ui/vba/vbanames.cxx
-+++ sc/source/ui/vba/vbanames.cxx
-@@ -48,7 +48,7 @@ class NamesEnumeration : public EnumerationHelperImpl
- uno::WeakReference< XHelperInterface > m_xParent;
- uno::Reference< sheet::XNamedRanges > m_xNames;
- public:
-- NamesEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration, const uno::Reference< frame::XModel >& xModel , const uno::Reference< sheet::XNamedRanges >& xNames ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xContext, xEnumeration ), m_xModel( xModel ), m_xParent( xParent ), m_xNames( xNames ) {}
-+ NamesEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration, const uno::Reference< frame::XModel >& xModel , const uno::Reference< sheet::XNamedRanges >& xNames ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xParent, xContext, xEnumeration ), m_xModel( xModel ), m_xParent( xParent ), m_xNames( xNames ) {}
-
- virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
- {
-diff --git sc/source/ui/vba/vbapagebreaks.cxx sc/source/ui/vba/vbapagebreaks.cxx
-index ebb5a0d..6103296 100644
---- sc/source/ui/vba/vbapagebreaks.cxx
-+++ sc/source/ui/vba/vbapagebreaks.cxx
-@@ -115,10 +115,13 @@ sal_Int32 SAL_CALL RangePageBreaks::getCount( ) throw (uno::RuntimeException)
- for( sal_Int32 i=0; i<nLength; i++ )
- {
- sal_Int32 nPos = aTablePageBreakData[i].Position;
-- if( nPos > nUsedEnd )
-- return nCount;
-- if( nPos >= nUsedStart )
-- nCount++;
-+
-+ // VBA. minz@cn.ibm.com. All page breaks before the used range should be counted.
-+ // And the page break at the end of the used range also should be counted.
-+ if( nPos <= nUsedEnd + 1 )
-+ nCount++;
-+ else
-+ return nCount;
- }
-
- return nCount;
-@@ -144,26 +147,15 @@ uno::Any SAL_CALL RangePageBreaks::getByIndex( sal_Int32 Index ) throw (lang::In
-
- sheet::TablePageBreakData RangePageBreaks::getTablePageBreakData( sal_Int32 nAPIItemIndex ) throw ( script::BasicErrorException, uno::RuntimeException)
- {
-- sal_Int32 index = -1;
- sheet::TablePageBreakData aTablePageBreakData;
- uno::Reference< excel::XWorksheet > xWorksheet( mxParent, uno::UNO_QUERY_THROW );
- uno::Reference< excel::XRange > xRange = xWorksheet->getUsedRange();
-- sal_Int32 nUsedStart = getAPIStartofRange( xRange );
-- sal_Int32 nUsedEnd = getAPIEndIndexofRange( xRange, nUsedStart );
- uno::Sequence<sheet::TablePageBreakData> aTablePageBreakDataList = getAllPageBreaks();
-
- sal_Int32 nLength = aTablePageBreakDataList.getLength();
-- for( sal_Int32 i=0; i<nLength; i++ )
-- {
-- aTablePageBreakData = aTablePageBreakDataList[i];
-- sal_Int32 nPos = aTablePageBreakData.Position;
-- if( nPos >= nUsedStart )
-- index++;
-- if( nPos > nUsedEnd )
-- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
-- if( index == nAPIItemIndex )
-- return aTablePageBreakData;
-- }
-+ //VBA. minz@cn.ibm.com. No need to filter the page break. All page breaks before the used range are counted.
-+ if ( nAPIItemIndex < nLength && nAPIItemIndex>=0 )
-+ aTablePageBreakData = aTablePageBreakDataList[nAPIItemIndex];
-
- return aTablePageBreakData;
- }
-diff --git sc/source/ui/vba/vbapagesetup.cxx sc/source/ui/vba/vbapagesetup.cxx
-index eeba5be..246aa5c 100644
---- sc/source/ui/vba/vbapagesetup.cxx
-+++ sc/source/ui/vba/vbapagesetup.cxx
-@@ -37,6 +37,9 @@
- #include <ooo/vba/excel/XlPageOrientation.hpp>
- #include <ooo/vba/excel/XlOrder.hpp>
- #include <ooo/vba/excel/Constants.hpp>
-+#include <i18npool/paper.hxx>
-+#include <editeng/paperinf.hxx>
-+#include <ooo/vba/excel/XlPaperSize.hpp>
-
- using namespace ::com::sun::star;
- using namespace ::ooo::vba;
-@@ -624,3 +627,105 @@ ScVbaPageSetup::getServiceNames()
- }
- return aServiceNames;
- }
-+
-+//liuchen 2009-12-11
-+
-+struct PaperSizeMap
-+{
-+ Paper ePaper;
-+ sal_Int32 xlPaper;
-+};
-+
-+static PaperSizeMap paperSizeMappings[] =
-+{
-+ { PAPER_A3, ooo::vba::excel::XlPaperSize::xlPaperA3 },
-+ { PAPER_A4, ooo::vba::excel::XlPaperSize::xlPaperA4 },
-+ { PAPER_A5, ooo::vba::excel::XlPaperSize::xlPaperA5 },
-+ { PAPER_B4_ISO, ooo::vba::excel::XlPaperSize::xlPaperB4 },
-+ { PAPER_B5_ISO, ooo::vba::excel::XlPaperSize::xlPaperB5 },
-+ { PAPER_LETTER, ooo::vba::excel::XlPaperSize::xlPaperLetter },
-+ { PAPER_LEGAL, ooo::vba::excel::XlPaperSize::xlPaperLegal },
-+ { PAPER_TABLOID, ooo::vba::excel::XlPaperSize::xlPaperTabloid },
-+ { PAPER_USER, ooo::vba::excel::XlPaperSize::xlPaperUser },
-+ { PAPER_B6_ISO, ooo::vba::excel::XlPaperSize::xlPaperEnvelopeB6 },
-+ { PAPER_ENV_C4, ooo::vba::excel::XlPaperSize::xlPaperEnvelopeC4 },
-+ { PAPER_ENV_C5, ooo::vba::excel::XlPaperSize::xlPaperEnvelopeC5 },
-+ { PAPER_ENV_C6, ooo::vba::excel::XlPaperSize::xlPaperEnvelopeC6 },
-+ { PAPER_ENV_C65, ooo::vba::excel::XlPaperSize::xlPaperEnvelopeC65 },
-+ { PAPER_ENV_DL, ooo::vba::excel::XlPaperSize::xlPaperEnvelopeDL },
-+ { PAPER_C, ooo::vba::excel::XlPaperSize::xlPaperCsheet },
-+ { PAPER_D, ooo::vba::excel::XlPaperSize::xlPaperDsheet },
-+ { PAPER_E, ooo::vba::excel::XlPaperSize::xlPaperEsheet },
-+ { PAPER_ENV_MONARCH, ooo::vba::excel::XlPaperSize::xlPaperEnvelopeMonarch },
-+ { PAPER_ENV_PERSONAL, ooo::vba::excel::XlPaperSize::xlPaperEnvelopePersonal },
-+ { PAPER_ENV_9, ooo::vba::excel::XlPaperSize::xlPaperEnvelope9 },
-+ { PAPER_ENV_10, ooo::vba::excel::XlPaperSize::xlPaperEnvelope10 },
-+ { PAPER_ENV_11, ooo::vba::excel::XlPaperSize::xlPaperEnvelope11 },
-+ { PAPER_ENV_12, ooo::vba::excel::XlPaperSize::xlPaperEnvelope12 }
-+};
-+
-+static const int nMapSize = sizeof(paperSizeMappings) / sizeof(paperSizeMappings[0]);
-+
-+sal_Int32 PaperSizeOOoToExcel(Paper ePaper)
-+{
-+ sal_Int32 nPaperSize = ooo::vba::excel::XlPaperSize::xlPaperUser;
-+
-+ for (int i = 0; i < nMapSize; i++)
-+ {
-+ if (ePaper == paperSizeMappings[i].ePaper)
-+ {
-+ nPaperSize = paperSizeMappings[i].xlPaper;
-+ break;
-+ }
-+ }
-+
-+ return nPaperSize;
-+}
-+
-+sal_Int32 SAL_CALL ScVbaPageSetup::getPaperSize() throw (css::uno::RuntimeException)
-+{
-+ com::sun::star::awt::Size size;
-+ Paper ePaper = PAPER_USER;
-+
-+ try
-+ {
-+ uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Size")));
-+ aValue >>= size;
-+ ePaper = SvxPaperInfo::GetSvxPaper( Size(size.Width, size.Height), MAP_100TH_MM, TRUE);
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+
-+ return PaperSizeOOoToExcel(ePaper);
-+}
-+
-+Paper PaperSizeExcelToOOo( sal_Int32 xlPaper)
-+{
-+ Paper ePaper = PAPER_USER;
-+
-+ for (int i = 0; i < nMapSize; i++)
-+ {
-+ if (xlPaper == paperSizeMappings[i].xlPaper)
-+ {
-+ ePaper = paperSizeMappings[i].ePaper;
-+ break;
-+ }
-+ }
-+
-+ return ePaper;
-+}
-+void SAL_CALL ScVbaPageSetup::setPaperSize( sal_Int32 paperSize) throw (css::uno::RuntimeException)
-+{
-+ Paper ePaper = PaperSizeExcelToOOo( paperSize );
-+
-+ try
-+ {
-+ Size size1 = SvxPaperInfo::GetPaperSize( ePaper, MAP_100TH_MM );
-+ com::sun::star::awt::Size size(size1.Width(), size1.Height());
-+ mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Size")), uno::makeAny( size ));
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+}
-diff --git sc/source/ui/vba/vbapagesetup.hxx sc/source/ui/vba/vbapagesetup.hxx
-index 09a996c..0afb600 100644
---- sc/source/ui/vba/vbapagesetup.hxx
-+++ sc/source/ui/vba/vbapagesetup.hxx
-@@ -82,6 +82,8 @@ public:
- virtual void SAL_CALL setCenterHorizontally( sal_Bool centerHorizontally ) throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getPrintHeadings() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setPrintHeadings( sal_Bool printHeadings ) throw (css::uno::RuntimeException);
-+ virtual sal_Int32 SAL_CALL getPaperSize() throw (css::uno::RuntimeException); //liuchen 2009-12-11
-+ virtual void SAL_CALL setPaperSize( sal_Int32 paperSize ) throw (css::uno::RuntimeException); //liuchen 2009-12-11
-
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
-diff --git sc/source/ui/vba/vbapivotcache.cxx sc/source/ui/vba/vbapivotcache.cxx
-index 1ca3ca3..8d128e0 100644
---- sc/source/ui/vba/vbapivotcache.cxx
-+++ sc/source/ui/vba/vbapivotcache.cxx
-@@ -34,6 +34,17 @@ ScVbaPivotCache::ScVbaPivotCache( const uno::Reference< XHelperInterface >& xPar
- {
- }
-
-+sal_Int32
-+ScVbaPivotCache::getMissingItemsLimit() throw (css::uno::RuntimeException)
-+{
-+ return -1;
-+}
-+
-+void
-+ScVbaPivotCache::setMissingItemsLimit( sal_Int32 /*aValue*/ ) throw ( css::uno::RuntimeException)
-+{
-+}
-+
- void SAL_CALL
- ScVbaPivotCache::Refresh() throw (css::uno::RuntimeException)
- {
-diff --git sc/source/ui/vba/vbapivotcache.hxx sc/source/ui/vba/vbapivotcache.hxx
-index 682c640..e32619b 100644
---- sc/source/ui/vba/vbapivotcache.hxx
-+++ sc/source/ui/vba/vbapivotcache.hxx
-@@ -40,6 +40,10 @@ class ScVbaPivotCache : public PivotCacheImpl_BASE
- css::uno::Reference< css::sheet::XDataPilotTable > m_xTable;
- public:
- ScVbaPivotCache( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::sheet::XDataPilotTable >& xTable );
-+
-+ virtual ::sal_Int32 SAL_CALL getMissingItemsLimit() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setMissingItemsLimit( ::sal_Int32 aValue ) throw ( css::uno::RuntimeException);
-+
- virtual void SAL_CALL Refresh() throw (css::uno::RuntimeException);
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
-diff --git sc/source/ui/vba/vbapivottables.cxx sc/source/ui/vba/vbapivottables.cxx
-index 2f8e077..f9014a4 100644
---- sc/source/ui/vba/vbapivottables.cxx
-+++ sc/source/ui/vba/vbapivottables.cxx
-@@ -42,7 +42,7 @@ uno::Any DataPilotToPivotTable( const uno::Any& aSource, uno::Reference< uno::XC
- class PivotTableEnumeration : public EnumerationHelperImpl
- {
- public:
-- PivotTableEnumeration( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xContext, xEnumeration ) {}
-+ PivotTableEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xParent, xContext, xEnumeration ) {}
-
- virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
- {
-@@ -59,7 +59,7 @@ uno::Reference< container::XEnumeration >
- ScVbaPivotTables::createEnumeration() throw (uno::RuntimeException)
- {
- uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
-- return new PivotTableEnumeration( mxContext, xEnumAccess->createEnumeration() );
-+ return new PivotTableEnumeration( mxParent, mxContext, xEnumAccess->createEnumeration() );
- }
-
- uno::Any
-diff --git sc/source/ui/vba/vbaquerytable.cxx sc/source/ui/vba/vbaquerytable.cxx
-new file mode 100644
-index 0000000..5ef6eec
---- /dev/null
-+++ sc/source/ui/vba/vbaquerytable.cxx
-@@ -0,0 +1,89 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009, 2010.
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#include "vbaquerytable.hxx"
-+#include "document.hxx"
-+#include "docsh.hxx"
-+#include "sfx2/lnkbase.hxx"
-+#include "sfx2/linkmgr.hxx"
-+#include "arealink.hxx"
-+#include "vbarange.hxx"
-+
-+using namespace com::sun::star;
-+
-+
-+ScVbaQueryTable::ScVbaQueryTable(const css::uno::Reference< ov::XHelperInterface >& xParent,
-+ const css::uno::Reference< css::uno::XComponentContext > & xContext,
-+ ScDocument *pDocument ,
-+ ScVbaRange *pParent
-+ )
-+//:QueryTable_Base(xParent, xContext)
-+{
-+ m_pDocument = pDocument;
-+ m_pParent = pParent;
-+}
-+
-+ScVbaQueryTable::~ScVbaQueryTable()
-+{
-+
-+}
-+
-+::sal_Bool SAL_CALL
-+ScVbaQueryTable::Refresh( const ::com::sun::star::uno::Any& aBackgroundQuery ) throw (::com::sun::star::uno::RuntimeException)
-+{
-+
-+ //Get parent Info
-+ sal_Int32 nRow = m_pParent->getRow();
-+ sal_Int32 nClm = m_pParent->getColumn();
-+ sal_Int16 nTab = m_pParent->getWorksheet()->getIndex() - 1; //The vba index begin from 1.
-+ ScAddress crrRngAddr(nClm, nRow, nTab);
-+
-+ //Get link info
-+ sfx2::LinkManager *pLinkMng = m_pDocument->GetLinkManager();
-+ const ::sfx2::SvBaseLinks &rLinks = pLinkMng->GetLinks();
-+ USHORT nCount = rLinks.Count();
-+
-+ for (USHORT i=0; i<nCount; i++)
-+ {
-+ ::sfx2::SvBaseLink* pBase = *rLinks[i];
-+ if (pBase->ISA(ScAreaLink))
-+ {
-+
-+ ScAreaLink *pAreaLink = (ScAreaLink *)pBase;
-+ const ScRange &destRange = pAreaLink->GetDestArea();
-+ if (destRange.In(crrRngAddr))
-+ {
-+ pBase->Update();
-+ }
-+ }
-+ }
-+
-+ return sal_True;
-+}
-+
-+
-diff --git sc/source/ui/vba/vbaquerytable.hxx sc/source/ui/vba/vbaquerytable.hxx
-new file mode 100644
-index 0000000..9c05e9a
---- /dev/null
-+++ sc/source/ui/vba/vbaquerytable.hxx
-@@ -0,0 +1,59 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009, 2010.
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef SC_VBA_QUERYTABLE_HXX
-+#define SC_VBA_QUERYTABLE_HXX
-+
-+
-+#include <ooo/vba/excel/XQueryTable.hpp>
-+#include "vbahelper/vbahelperinterface.hxx"
-+
-+using namespace ::ooo::vba;
-+typedef ::cppu::WeakImplHelper1<excel::XQueryTable> QueryTable_Base;
-+
-+class ScDocument;
-+class ScVbaRange;
-+
-+class ScVbaQueryTable : public QueryTable_Base
-+{
-+private:
-+ ScDocument *m_pDocument;
-+ ScVbaRange *m_pParent;
-+public:
-+ ScVbaQueryTable(const css::uno::Reference< ov::XHelperInterface >& xParent,
-+ const css::uno::Reference< css::uno::XComponentContext > & xContext,
-+ ScDocument *pDocument = NULL,
-+ ScVbaRange *pParent = NULL
-+ );
-+ ~ScVbaQueryTable();
-+ virtual ::sal_Bool SAL_CALL Refresh( const ::com::sun::star::uno::Any& aBackgroundQuery )
-+ throw (::com::sun::star::uno::RuntimeException);
-+
-+};
-+
-+#endif
-diff --git sc/source/ui/vba/vbarange.cxx sc/source/ui/vba/vbarange.cxx
-index fd136e6..d9cc4ea 100644
---- sc/source/ui/vba/vbarange.cxx
-+++ sc/source/ui/vba/vbarange.cxx
-@@ -43,7 +43,6 @@
- #include <com/sun/star/text/XTextRange.hpp>
- #include <com/sun/star/sheet/XCellRangeAddressable.hpp>
- #include <com/sun/star/table/CellRangeAddress.hpp>
--#include <com/sun/star/table/CellAddress.hpp>
- #include <com/sun/star/sheet/XSpreadsheetView.hpp>
- #include <com/sun/star/sheet/XCellRangeReferrer.hpp>
- #include <com/sun/star/sheet/XSheetCellRange.hpp>
-@@ -91,6 +90,15 @@
- #include <com/sun/star/sheet/XSubTotalDescriptor.hpp>
- #include <com/sun/star/sheet/GeneralFunction.hdl>
-
-+#include <com/sun/star/sheet/XSheetAnnotationsSupplier.hpp>
-+#include <com/sun/star/sheet/XSheetAnnotations.hpp>
-+
-+#include <com/sun/star/sheet/XDataPilotTable.hpp>
-+#include <com/sun/star/sheet/XDataPilotTable2.hpp>
-+#include <com/sun/star/sheet/XDataPilotTablesSupplier.hpp>
-+#include <com/sun/star/sheet/DataPilotTablePositionData.hpp>
-+#include <com/sun/star/sheet/DataPilotTablePositionType.hpp>
-+
- #include <ooo/vba/excel/XlPasteSpecialOperation.hpp>
- #include <ooo/vba/excel/XlPasteType.hpp>
- #include <ooo/vba/excel/Constants.hpp>
-@@ -116,12 +124,15 @@
- #include <ooo/vba/excel/XlSpecialCellsValue.hpp>
- #include <ooo/vba/excel/XlConsolidationFunction.hpp>
- #include <ooo/vba/excel/XlSearchDirection.hpp>
-+#include <ooo/vba/excel/XlColumnDataType.hpp>
-+#include <ooo/vba/excel/XlFilterAction.hpp>
-
- #include <scitems.hxx>
- #include <svl/srchitem.hxx>
- #include <cellsuno.hxx>
- #include <dbcolect.hxx>
- #include "docfunc.hxx"
-+#include <docuno.hxx>
-
- #include <sfx2/dispatch.hxx>
- #include <sfx2/app.hxx>
-@@ -132,6 +143,7 @@
- #include <sc.hrc>
- #include <globstr.hrc>
- #include <unonames.hxx>
-+#include <tools/stream.hxx>
-
- #include "vbarange.hxx"
- #include "vbafont.hxx"
-@@ -142,8 +154,13 @@
- #include "vbaworksheet.hxx"
- #include "vbavalidation.hxx"
-
-+#include "vbapivottable.hxx"
-+
-+#include "asciiopt.hxx"
-+#include "impex.hxx"
- #include "tabvwsh.hxx"
- #include "rangelst.hxx"
-+#include "rangenam.hxx"
- #include "convuno.hxx"
- #include "compiler.hxx"
- #include "attrib.hxx"
-@@ -200,11 +217,10 @@ double lcl_Round2DecPlaces( double nVal )
- return nVal;
- }
-
--uno::Any lcl_makeRange( uno::Reference< uno::XComponentContext >& xContext, const uno::Any aAny, bool bIsRows, bool bIsColumns )
-+uno::Any lcl_makeRange( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Any aAny, bool bIsRows, bool bIsColumns )
- {
- uno::Reference< table::XCellRange > xCellRange( aAny, uno::UNO_QUERY_THROW );
-- // #FIXME need proper (WorkSheet) parent
-- return uno::makeAny( uno::Reference< excel::XRange >( new ScVbaRange( uno::Reference< XHelperInterface >(), xContext, xCellRange, bIsRows, bIsColumns ) ) );
-+ return uno::makeAny( uno::Reference< excel::XRange >( new ScVbaRange( xParent, xContext, xCellRange, bIsRows, bIsColumns ) ) );
- }
-
- uno::Reference< excel::XRange > lcl_makeXRangeFromSheetCellRanges( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< sheet::XSheetCellRanges >& xLocSheetCellRanges, ScDocShell* pDoc )
-@@ -225,13 +241,11 @@ uno::Reference< excel::XRange > lcl_makeXRangeFromSheetCellRanges( const uno::Re
- if ( aCellRanges.First() == aCellRanges.Last() )
- {
- uno::Reference< table::XCellRange > xTmpRange( new ScCellRangeObj( pDoc, *aCellRanges.First() ) );
-- // #FIXME need proper (WorkSheet) parent
- xRange = new ScVbaRange( xParent, xContext, xTmpRange );
- }
- else
- {
- uno::Reference< sheet::XSheetCellRangeContainer > xRanges( new ScCellRangesObj( pDoc, aCellRanges ) );
-- // #FIXME need proper (WorkSheet) parent
- xRange = new ScVbaRange( xParent, xContext, xRanges );
- }
- }
-@@ -267,12 +281,13 @@ SfxItemSet* ScVbaRange::getCurrentDataSet( ) throw ( uno::RuntimeException )
-
- class SingleRangeEnumeration : public EnumerationHelper_BASE
- {
-+ uno::Reference< XHelperInterface > m_xParent;
- uno::Reference< table::XCellRange > m_xRange;
- uno::Reference< uno::XComponentContext > mxContext;
- bool bHasMore;
- public:
-
-- SingleRangeEnumeration( const uno::Reference< css::uno::XComponentContext >& xContext, const uno::Reference< table::XCellRange >& xRange ) throw ( uno::RuntimeException ) : m_xRange( xRange ), mxContext( xContext ), bHasMore( true ) { }
-+ SingleRangeEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< css::uno::XComponentContext >& xContext, const uno::Reference< table::XCellRange >& xRange ) throw ( uno::RuntimeException ) : m_xParent( xParent ), m_xRange( xRange ), mxContext( xContext ), bHasMore( true ) { }
- virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException) { return bHasMore; }
- virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
- {
-@@ -290,11 +305,12 @@ typedef ::cppu::WeakImplHelper2< container::XIndexAccess, container::XEnumeratio
- class SingleRangeIndexAccess : public SingleRange_BASE
- {
- private:
-+ uno::Reference< XHelperInterface > mxParent;
- uno::Reference< table::XCellRange > m_xRange;
- uno::Reference< uno::XComponentContext > mxContext;
- SingleRangeIndexAccess(); // not defined
- public:
-- SingleRangeIndexAccess( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< table::XCellRange >& xRange ):m_xRange( xRange ), mxContext( xContext ) {}
-+ SingleRangeIndexAccess( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< table::XCellRange >& xRange ):mxParent( xParent ), m_xRange( xRange ), mxContext( xContext ) {}
- // XIndexAccess
- virtual ::sal_Int32 SAL_CALL getCount() throw (::uno::RuntimeException) { return 1; }
- virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
-@@ -308,7 +324,7 @@ public:
-
- virtual ::sal_Bool SAL_CALL hasElements() throw (uno::RuntimeException) { return sal_True; }
- // XEnumerationAccess
-- virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration() throw (uno::RuntimeException) { return new SingleRangeEnumeration( mxContext, m_xRange ); }
-+ virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration() throw (uno::RuntimeException) { return new SingleRangeEnumeration( mxParent, mxContext, m_xRange ); }
-
- };
-
-@@ -320,10 +336,10 @@ class RangesEnumerationImpl : public EnumerationHelperImpl
- bool mbIsColumns;
- public:
-
-- RangesEnumerationImpl( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration, bool bIsRows, bool bIsColumns ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xContext, xEnumeration ), mbIsRows( bIsRows ), mbIsColumns( bIsColumns ) {}
-+ RangesEnumerationImpl( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration, bool bIsRows, bool bIsColumns ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xParent, xContext, xEnumeration ), mbIsRows( bIsRows ), mbIsColumns( bIsColumns ) {}
- virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
- {
-- return lcl_makeRange( m_xContext, m_xEnumeration->nextElement(), mbIsRows, mbIsColumns );
-+ return lcl_makeRange( m_xParent, m_xContext, m_xEnumeration->nextElement(), mbIsRows, mbIsColumns );
- }
- };
-
-@@ -333,7 +349,7 @@ class ScVbaRangeAreas : public ScVbaCollectionBaseImpl
- bool mbIsRows;
- bool mbIsColumns;
- public:
-- ScVbaRangeAreas( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess, bool bIsRows, bool bIsColumns ) : ScVbaCollectionBaseImpl( uno::Reference< XHelperInterface >(), xContext, xIndexAccess ), mbIsRows( bIsRows ), mbIsColumns( bIsColumns ) {}
-+ ScVbaRangeAreas( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess, bool bIsRows, bool bIsColumns ) : ScVbaCollectionBaseImpl( xParent, xContext, xIndexAccess ), mbIsRows( bIsRows ), mbIsColumns( bIsColumns ) {}
-
- // XEnumerationAccess
- virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration() throw (uno::RuntimeException);
-@@ -353,67 +369,26 @@ uno::Reference< container::XEnumeration > SAL_CALL
- ScVbaRangeAreas::createEnumeration() throw (uno::RuntimeException)
- {
- uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
-- return new RangesEnumerationImpl( mxContext, xEnumAccess->createEnumeration(), mbIsRows, mbIsColumns );
-+ return new RangesEnumerationImpl( mxParent, mxContext, xEnumAccess->createEnumeration(), mbIsRows, mbIsColumns );
-
- }
-
- uno::Any
- ScVbaRangeAreas::createCollectionObject( const uno::Any& aSource )
- {
-- return lcl_makeRange( mxContext, aSource, mbIsRows, mbIsColumns );
--}
--
--// assume that xIf is infact a ScCellRangesBase
--ScDocShell*
--getDocShellFromIf( const uno::Reference< uno::XInterface >& xIf ) throw ( uno::RuntimeException )
--{
-- ScCellRangesBase* pUno= dynamic_cast< ScCellRangesBase* >( xIf.get() );
-- if ( !pUno )
-- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Failed to access underlying uno range object" ) ), uno::Reference< uno::XInterface >() );
-- return pUno->GetDocShell();
--}
--
--ScDocShell*
--getDocShellFromRange( const uno::Reference< table::XCellRange >& xRange ) throw ( uno::RuntimeException )
--{
-- // need the ScCellRangesBase to get docshell
-- uno::Reference< uno::XInterface > xIf( xRange, uno::UNO_QUERY_THROW );
-- return getDocShellFromIf(xIf );
--}
--
--uno::Reference< frame::XModel > getModelFromXIf( const uno::Reference< uno::XInterface >& xIf ) throw ( uno::RuntimeException )
--{
-- ScDocShell* pDocShell = getDocShellFromIf(xIf );
-- return pDocShell->GetModel();
--}
--
--uno::Reference< frame::XModel > getModelFromRange( const uno::Reference< table::XCellRange >& xRange ) throw ( uno::RuntimeException )
--{
-- uno::Reference< uno::XInterface > xIf( xRange, uno::UNO_QUERY_THROW );
-- return getModelFromXIf( xIf );
-+ return lcl_makeRange( mxParent, mxContext, aSource, mbIsRows, mbIsColumns );
- }
-
- ScDocument*
--getDocumentFromRange( const uno::Reference< table::XCellRange >& xRange )
--{
-- ScDocShell* pDocShell = getDocShellFromRange( xRange );
-- if ( !pDocShell )
-- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Failed to access underlying docshell from uno range object" ) ), uno::Reference< uno::XInterface >() );
-- ScDocument* pDoc = pDocShell->GetDocument();
-- return pDoc;
--}
--
--
--ScDocument*
- ScVbaRange::getScDocument()
- {
- if ( mxRanges.is() )
- {
- uno::Reference< container::XIndexAccess > xIndex( mxRanges, uno::UNO_QUERY_THROW );
- uno::Reference< table::XCellRange > xRange( xIndex->getByIndex( 0 ), uno::UNO_QUERY_THROW );
-- return getDocumentFromRange( xRange );
-- }
-- return getDocumentFromRange( mxRange );
-+ return excel::GetDocumentFromRange( xRange );
-+ }
-+ return excel::GetDocumentFromRange( mxRange );
- }
-
- ScDocShell*
-@@ -423,9 +398,9 @@ ScVbaRange::getScDocShell()
- {
- uno::Reference< container::XIndexAccess > xIndex( mxRanges, uno::UNO_QUERY_THROW );
- uno::Reference< table::XCellRange > xRange( xIndex->getByIndex( 0 ), uno::UNO_QUERY_THROW );
-- return getDocShellFromRange( xRange );
-- }
-- return getDocShellFromRange( mxRange );
-+ return excel::GetDocShellFromRange( xRange );
-+ }
-+ return excel::GetDocShellFromRange( mxRange );
- }
-
- class NumFormatHelper
-@@ -436,7 +411,7 @@ class NumFormatHelper
- public:
- NumFormatHelper( const uno::Reference< table::XCellRange >& xRange )
- {
-- mxSupplier.set( getModelFromRange( xRange ), uno::UNO_QUERY_THROW );
-+ mxSupplier.set( excel::GetModelFromRange( xRange ), uno::UNO_QUERY_THROW );
- mxRangeProps.set( xRange, uno::UNO_QUERY_THROW);
- mxFormats = mxSupplier->getNumberFormats();
- }
-@@ -573,6 +548,7 @@ public:
-
- class CellsEnumeration : public CellsEnumeration_BASE
- {
-+ uno::WeakReference< XHelperInterface > mxParent;
- uno::Reference< uno::XComponentContext > mxContext;
- uno::Reference< XCollection > m_xAreas;
- vCellPos m_CellPositions;
-@@ -603,7 +579,7 @@ class CellsEnumeration : public CellsEnumeration_BASE
- }
- }
- public:
-- CellsEnumeration( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< XCollection >& xAreas ): mxContext( xContext ), m_xAreas( xAreas )
-+ CellsEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< XCollection >& xAreas ): mxParent( xParent ), mxContext( xContext ), m_xAreas( xAreas )
- {
- sal_Int32 nItems = m_xAreas->getCount();
- for ( sal_Int32 index=1; index <= nItems; ++index )
-@@ -622,8 +598,7 @@ public:
-
- uno::Reference< table::XCellRange > xRangeArea = getArea( aPos.m_nArea );
- uno::Reference< table::XCellRange > xCellRange( xRangeArea->getCellByPosition( aPos.m_nCol, aPos.m_nRow ), uno::UNO_QUERY_THROW );
-- // #FIXME need proper (WorkSheet) parent
-- return uno::makeAny( uno::Reference< excel::XRange >( new ScVbaRange( uno::Reference< XHelperInterface >(), mxContext, xCellRange ) ) );
-+ return uno::makeAny( uno::Reference< excel::XRange >( new ScVbaRange( mxParent, mxContext, xCellRange ) ) );
-
- }
- };
-@@ -704,7 +679,15 @@ CellValueSetter::processValue( const uno::Any& aValue, const uno::Reference< tab
- {
- double nDouble = 0.0;
- if ( aValue >>= nDouble )
-+ {
- xCell->setValue( nDouble );
-+ uno::Reference< table::XCellRange > xRange( xCell, uno::UNO_QUERY_THROW );
-+ NumFormatHelper cellNumFormat( xRange );
-+ if ( cellNumFormat.isBooleanType() )
-+ {
-+ cellNumFormat.setNumberFormat( util::NumberFormat::NUMBER );
-+ }
-+ }
- else
- isExtracted = false;
- break;
-@@ -798,9 +781,10 @@ protected:
- double aDblValue = 0.0;
- if ( aValue >>= sFormula )
- {
-- // convert to CONV_OOO style formula string because XCell::setFormula
-- // always compile it in CONV_OOO style. Perhaps css.sheet.FormulaParser
-- // should be used in future to directly pass formula tokens.
-+ // convert to GRAM_PODF_A1 style grammar because XCell::setFormula
-+ // always compile it in that grammar. Perhaps
-+ // css.sheet.FormulaParser should be used in future to directly
-+ // pass formula tokens when that API stabilizes.
- if ( m_eGrammar != formula::FormulaGrammar::GRAM_PODF_A1 && ( sFormula.trim().indexOf('=') == 0 ) )
- {
- uno::Reference< uno::XInterface > xIf( xCell, uno::UNO_QUERY_THROW );
-@@ -1046,11 +1030,10 @@ public:
- return uno::Reference< sheet::XSheetCellCursor >( getSpreadSheet()->createCursorByRange( getSheetCellRange() ), uno::UNO_QUERY_THROW );
- }
-
-- static uno::Reference< excel::XRange > createRangeFromRange( const uno::Reference<uno::XComponentContext >& xContext, const uno::Reference< table::XCellRange >& xRange, const uno::Reference< sheet::XCellRangeAddressable >& xCellRangeAddressable, sal_Int32 nStartColOffset = 0, sal_Int32 nStartRowOffset = 0,
-- sal_Int32 nEndColOffset = 0, sal_Int32 nEndRowOffset = 0 )
-- {
-- // #FIXME need proper (WorkSheet) parent
-- return uno::Reference< excel::XRange >( new ScVbaRange( uno::Reference< XHelperInterface >(), xContext,
-+ static uno::Reference< excel::XRange > createRangeFromRange( const uno::Reference< XHelperInterface >& xParent, const uno::Reference<uno::XComponentContext >& xContext, const uno::Reference< table::XCellRange >& xRange, const uno::Reference< sheet::XCellRangeAddressable >& xCellRangeAddressable, sal_Int32 nStartColOffset = 0, sal_Int32 nStartRowOffset = 0,
-+ sal_Int32 nEndColOffset = 0, sal_Int32 nEndRowOffset = 0 )
-+ {
-+ return uno::Reference< excel::XRange >( new ScVbaRange( xParent, xContext,
- xRange->getCellRangeByPosition(
- xCellRangeAddressable->getRangeAddress().StartColumn + nStartColOffset,
- xCellRangeAddressable->getRangeAddress().StartRow + nStartRowOffset,
-@@ -1106,6 +1089,24 @@ bool getScRangeListForAddress( const rtl::OUString& sName, ScDocShell* pDocSh, S
- formula::FormulaGrammar::AddressConvention eConv = aConv;
- // spaces are illegal ( but the user of course can enter them )
- rtl::OUString sAddress = (*it).trim();
-+ // if a local name ( on the active sheet ) exists this will
-+ // take precedence over a global with the same name
-+ if ( !xNameAccess->hasByName( sAddress ) && pDocSh )
-+ {
-+ // try a local name
-+ ScDocument* pDoc = pDocSh->GetDocument();
-+ SCTAB nCurTab = pDocSh->GetCurTab();
-+ if ( pDoc )
-+ {
-+ NameToNameMap* pMap = pDoc->GetLocalNameMap( nCurTab );
-+ if ( pMap )
-+ {
-+ NameToNameMap::iterator itTmp = pMap->find( sAddress );
-+ if ( itTmp != pMap->end() ) // found a mapping
-+ sAddress = itTmp->second;
-+ }
-+ }
-+ }
- if ( xNameAccess->hasByName( sAddress ) )
- {
- uno::Reference< sheet::XNamedRange > xNamed( xNameAccess->getByName( sAddress ), uno::UNO_QUERY_THROW );
-@@ -1147,13 +1148,13 @@ getRangeForName( const uno::Reference< uno::XComponentContext >& xContext, const
- if ( aCellRanges.First() == aCellRanges.Last() )
- {
- uno::Reference< table::XCellRange > xRange( new ScCellRangeObj( pDocSh, *aCellRanges.First() ) );
-- // #FIXME need proper (WorkSheet) parent
-- return new ScVbaRange( uno::Reference< XHelperInterface >(), xContext, xRange );
-+ uno::Reference< XHelperInterface > xFixThisParent = excel::getUnoSheetModuleObj( xRange );
-+ return new ScVbaRange( xFixThisParent, xContext, xRange );
- }
- uno::Reference< sheet::XSheetCellRangeContainer > xRanges( new ScCellRangesObj( pDocSh, aCellRanges ) );
--
-- // #FIXME need proper (WorkSheet) parent
-- return new ScVbaRange( uno::Reference< XHelperInterface >(), xContext, xRanges );
-+
-+ uno::Reference< XHelperInterface > xFixThisParent = excel::getUnoSheetModuleObj( xRanges );
-+ return new ScVbaRange( xFixThisParent, xContext, xRanges );
- }
-
- css::uno::Reference< excel::XRange >
-@@ -1163,6 +1164,28 @@ ScVbaRange::getRangeObjectForName( const uno::Reference< uno::XComponentContext
- return getRangeForName( xContext, sRangeName, pDocSh, refAddr, eConv );
- }
-
-+table::CellAddress ScVbaRange::getLeftUpperCellAddress()
-+{
-+ table::CellAddress aCellAddress;
-+ uno::Reference< table::XCellRange > xCellRange = mxRange;
-+ if ( mxRanges.is() && m_Areas.is() && m_Areas->getCount() > 1 )
-+ {
-+ uno::Reference< container::XIndexAccess > xIndex( mxRanges, uno::UNO_QUERY );
-+ if ( xIndex.is() && xIndex->getCount() > 0 )
-+ {
-+ xCellRange.set( xIndex->getByIndex( 0 ), uno::UNO_QUERY );
-+ }
-+ }
-+ if ( xCellRange.is() )
-+ {
-+ uno::Reference< sheet::XCellAddressable > xCellAddr( xCellRange->getCellByPosition( 0, 0 ), uno::UNO_QUERY );
-+ if ( xCellAddr.is() )
-+ {
-+ aCellAddress = xCellAddr->getCellAddress();
-+ }
-+ }
-+ return aCellAddress;
-+}
-
- table::CellRangeAddress getCellRangeAddressForVBARange( const uno::Any& aParam, ScDocShell* pDocSh, formula::FormulaGrammar::AddressConvention aConv = formula::FormulaGrammar::CONV_XL_A1) throw ( uno::RuntimeException )
- {
-@@ -1190,7 +1213,14 @@ table::CellRangeAddress getCellRangeAddressForVBARange( const uno::Any& aParam,
- uno::Reference< excel::XRange > xRange;
- aParam >>= xRange;
- if ( xRange.is() )
-+ {
-+ ScVbaRange* pRange = dynamic_cast< ScVbaRange* >( xRange.get() );
-+ if ( pRange && pDocSh && pRange->getScDocument() != pDocSh->GetDocument() )
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Invalid range" ) ), uno::Reference< uno::XInterface >() );
-+ }
- xRange->getCellRange() >>= xRangeParam;
-+ }
- break;
- }
- default:
-@@ -1205,7 +1235,7 @@ uno::Reference< XCollection >
- lcl_setupBorders( const uno::Reference< excel::XRange >& xParentRange, const uno::Reference<uno::XComponentContext>& xContext, const uno::Reference< table::XCellRange >& xRange ) throw( uno::RuntimeException )
- {
- uno::Reference< XHelperInterface > xParent( xParentRange, uno::UNO_QUERY_THROW );
-- ScDocument* pDoc = getDocumentFromRange(xRange);
-+ ScDocument* pDoc = excel::GetDocumentFromRange(xRange);
- if ( !pDoc )
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Failed to access document from shell" ) ), uno::Reference< uno::XInterface >() );
- ScVbaPalette aPalette( pDoc->GetDocumentShell() );
-@@ -1213,25 +1243,38 @@ lcl_setupBorders( const uno::Reference< excel::XRange >& xParentRange, const uno
- return borders;
- }
-
-+void lcl_NotifyRangeChanges( const uno::Reference< frame::XModel >& xModel, ScCellRangesBase* pUnoRangesBase )
-+{
-+ if ( xModel.is() && pUnoRangesBase )
-+ {
-+ ScModelObj* pModelObj = ScModelObj::getImplementation( xModel );
-+ const ScRangeList& aCellRanges = pUnoRangesBase->GetRangeList();
-+ if ( pModelObj && pModelObj->HasChangesListeners() )
-+ {
-+ pModelObj->NotifyChanges( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "cell-change" ) ), aCellRanges );
-+ }
-+ }
-+}
-+
- ScVbaRange::ScVbaRange( uno::Sequence< uno::Any> const & args,
-- uno::Reference< uno::XComponentContext> const & xContext ) throw ( lang::IllegalArgumentException ) : ScVbaRange_BASE( getXSomethingFromArgs< XHelperInterface >( args, 0 ), xContext, getXSomethingFromArgs< beans::XPropertySet >( args, 1, false ), getModelFromXIf( getXSomethingFromArgs< uno::XInterface >( args, 1 ) ), true ), mbIsRows( sal_False ), mbIsColumns( sal_False )
-+ uno::Reference< uno::XComponentContext> const & xContext ) throw ( lang::IllegalArgumentException ) : ScVbaRange_BASE( getXSomethingFromArgs< XHelperInterface >( args, 0 ), xContext, getXSomethingFromArgs< beans::XPropertySet >( args, 1, false ), excel::GetModelFromRange( getXSomethingFromArgs< uno::XInterface >( args, 1 ) ), true ), mbIsRows( sal_False ), mbIsColumns( sal_False )
- {
- mxRange.set( mxPropertySet, uno::UNO_QUERY );
- mxRanges.set( mxPropertySet, uno::UNO_QUERY );
- uno::Reference< container::XIndexAccess > xIndex;
- if ( mxRange.is() )
- {
-- xIndex = new SingleRangeIndexAccess( mxContext, mxRange );
-+ xIndex = new SingleRangeIndexAccess( mxParent, mxContext, mxRange );
- }
- else if ( mxRanges.is() )
- {
- xIndex.set( mxRanges, uno::UNO_QUERY_THROW );
- }
-- m_Areas = new ScVbaRangeAreas( mxContext, xIndex, mbIsRows, mbIsColumns );
-+ m_Areas = new ScVbaRangeAreas( mxParent, mxContext, xIndex, mbIsRows, mbIsColumns );
- }
-
- ScVbaRange::ScVbaRange( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< table::XCellRange >& xRange, sal_Bool bIsRows, sal_Bool bIsColumns ) throw( lang::IllegalArgumentException )
--: ScVbaRange_BASE( xParent, xContext, uno::Reference< beans::XPropertySet >( xRange, uno::UNO_QUERY_THROW ), getModelFromRange( xRange), true ), mxRange( xRange ),
-+: ScVbaRange_BASE( xParent, xContext, uno::Reference< beans::XPropertySet >( xRange, uno::UNO_QUERY_THROW ), excel::GetModelFromRange( xRange), true ), mxRange( xRange ),
- mbIsRows( bIsRows ),
- mbIsColumns( bIsColumns )
- {
-@@ -1240,17 +1283,17 @@ ScVbaRange::ScVbaRange( const uno::Reference< XHelperInterface >& xParent, const
- if ( !xRange.is() )
- throw lang::IllegalArgumentException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "range is not set " ) ), uno::Reference< uno::XInterface >() , 1 );
-
-- uno::Reference< container::XIndexAccess > xIndex( new SingleRangeIndexAccess( mxContext, xRange ) );
-- m_Areas = new ScVbaRangeAreas( mxContext, xIndex, mbIsRows, mbIsColumns );
-+ uno::Reference< container::XIndexAccess > xIndex( new SingleRangeIndexAccess( mxParent, mxContext, xRange ) );
-+ m_Areas = new ScVbaRangeAreas( mxParent, mxContext, xIndex, mbIsRows, mbIsColumns );
-
- }
-
- ScVbaRange::ScVbaRange( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< sheet::XSheetCellRangeContainer >& xRanges, sal_Bool bIsRows, sal_Bool bIsColumns ) throw ( lang::IllegalArgumentException )
--: ScVbaRange_BASE( xParent, xContext, uno::Reference< beans::XPropertySet >( xRanges, uno::UNO_QUERY_THROW ), getModelFromXIf( uno::Reference< uno::XInterface >( xRanges, uno::UNO_QUERY_THROW ) ), true ), mxRanges( xRanges ),mbIsRows( bIsRows ), mbIsColumns( bIsColumns )
-+: ScVbaRange_BASE( xParent, xContext, uno::Reference< beans::XPropertySet >( xRanges, uno::UNO_QUERY_THROW ), excel::GetModelFromRange( uno::Reference< uno::XInterface >( xRanges, uno::UNO_QUERY_THROW ) ), true ), mxRanges( xRanges ),mbIsRows( bIsRows ), mbIsColumns( bIsColumns )
-
- {
- uno::Reference< container::XIndexAccess > xIndex( mxRanges, uno::UNO_QUERY_THROW );
-- m_Areas = new ScVbaRangeAreas( mxContext, xIndex, mbIsRows, mbIsColumns );
-+ m_Areas = new ScVbaRangeAreas( xParent, mxContext, xIndex, mbIsRows, mbIsColumns );
-
- }
-
-@@ -1375,6 +1418,9 @@ ScVbaRange::setValue( const uno::Any &aValue ) throw (uno::RuntimeException)
- }
- CellValueSetter valueSetter( aValue );
- setValue( aValue, valueSetter );
-+
-+ // Fires the range change event.
-+ lcl_NotifyRangeChanges( getScDocShell()->GetModel(), getCellRangesBase() );
- }
-
- void
-@@ -1382,6 +1428,9 @@ ScVbaRange::Clear() throw (uno::RuntimeException)
- {
- sal_Int32 nFlags = sheet::CellFlags::VALUE | sheet::CellFlags::STRING | sheet::CellFlags::HARDATTR | sheet::CellFlags::FORMATTED | sheet::CellFlags::EDITATTR | sheet::CellFlags::FORMULA;
- ClearContents( nFlags );
-+
-+ // Fires the range change event.
-+ lcl_NotifyRangeChanges( getScDocShell()->GetModel(), getCellRangesBase() );
- }
-
- //helper ClearContent
-@@ -1422,6 +1471,9 @@ ScVbaRange::ClearContents() throw (uno::RuntimeException)
- sheet::CellFlags::STRING | sheet::CellFlags::DATETIME |
- sheet::CellFlags::FORMULA );
- ClearContents( nClearFlags );
-+
-+ // Fires the range change event.
-+ lcl_NotifyRangeChanges( getScDocShell()->GetModel(), getCellRangesBase() );
- }
-
- void
-@@ -1430,6 +1482,9 @@ ScVbaRange::ClearFormats() throw (uno::RuntimeException)
- //FIXME: need to check if we need to combine sheet::CellFlags::FORMATTED
- sal_Int32 nClearFlags = sheet::CellFlags::HARDATTR | sheet::CellFlags::FORMATTED | sheet::CellFlags::EDITATTR;
- ClearContents( nClearFlags );
-+
-+ // Fires the range change event.
-+ lcl_NotifyRangeChanges( getScDocShell()->GetModel(), getCellRangesBase() );
- }
-
- void
-@@ -1445,6 +1500,9 @@ ScVbaRange::setFormulaValue( const uno::Any& rFormula, formula::FormulaGrammar::
- }
- CellFormulaValueSetter formulaValueSetter( rFormula, getScDocument(), eGram );
- setValue( rFormula, formulaValueSetter );
-+
-+ // Fires the range change event.
-+ lcl_NotifyRangeChanges( getScDocShell()->GetModel(), getCellRangesBase() );
- }
-
- uno::Any
-@@ -1604,6 +1662,9 @@ ScVbaRange::fillSeries( sheet::FillDirection nFillDirection, sheet::FillMode nFi
-
- uno::Reference< sheet::XCellSeries > xCellSeries(mxRange, uno::UNO_QUERY_THROW );
- xCellSeries->fillSeries( nFillDirection, nFillMode, nFillDateMode, fStep, fEndValue );
-+
-+ // Fires the range change event.
-+ lcl_NotifyRangeChanges( getScDocShell()->GetModel(), getCellRangesBase() );
- }
-
- void
-@@ -1679,11 +1740,11 @@ ScVbaRange::Offset( const ::uno::Any &nRowOff, const uno::Any &nColOff ) throw (
- if ( aCellRanges.Count() > 1 ) // Multi-Area
- {
- uno::Reference< sheet::XSheetCellRangeContainer > xRanges( new ScCellRangesObj( pUnoRangesBase->GetDocShell(), aCellRanges ) );
-- return new ScVbaRange( getParent(), mxContext, xRanges );
-+ return new ScVbaRange( mxParent, mxContext, xRanges );
- }
- // normal range
- uno::Reference< table::XCellRange > xRange( new ScCellRangeObj( pUnoRangesBase->GetDocShell(), *aCellRanges.First() ) );
-- return new ScVbaRange( getParent(), mxContext, xRange );
-+ return new ScVbaRange( mxParent, mxContext, xRange );
- }
-
- uno::Reference< excel::XRange >
-@@ -1704,7 +1765,7 @@ ScVbaRange::CurrentRegion() throw (uno::RuntimeException)
- helper.getSheetCellCursor();
- xSheetCellCursor->collapseToCurrentRegion();
- uno::Reference< sheet::XCellRangeAddressable > xCellRangeAddressable(xSheetCellCursor, uno::UNO_QUERY_THROW);
-- return RangeHelper::createRangeFromRange( mxContext, helper.getCellRangeFromSheet(), xCellRangeAddressable );
-+ return RangeHelper::createRangeFromRange( mxParent, mxContext, helper.getCellRangeFromSheet(), xCellRangeAddressable );
- }
-
- uno::Reference< excel::XRange >
-@@ -1724,7 +1785,7 @@ ScVbaRange::CurrentArray() throw (uno::RuntimeException)
- helper.getSheetCellCursor();
- xSheetCellCursor->collapseToCurrentArray();
- uno::Reference< sheet::XCellRangeAddressable > xCellRangeAddressable(xSheetCellCursor, uno::UNO_QUERY_THROW);
-- return RangeHelper::createRangeFromRange( mxContext, helper.getCellRangeFromSheet(), xCellRangeAddressable );
-+ return RangeHelper::createRangeFromRange( mxParent, mxContext, helper.getCellRangeFromSheet(), xCellRangeAddressable );
- }
-
- uno::Any
-@@ -1743,7 +1804,16 @@ ScVbaRange::getFormulaArray() throw (uno::RuntimeException)
- uno::Reference< sheet::XCellRangeFormula> xCellRangeFormula( mxRange, uno::UNO_QUERY_THROW );
- uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( mxContext );
- uno::Any aMatrix;
-- aMatrix = xConverter->convertTo( uno::makeAny( xCellRangeFormula->getFormulaArray() ) , getCppuType((uno::Sequence< uno::Sequence< uno::Any > >*)0) ) ;
-+
-+ //VBA, minz@cn.ibm.com
-+ uno::Sequence< uno::Sequence<rtl::OUString> > aFmArray = xCellRangeFormula->getFormulaArray();
-+ if( aFmArray.getLength() )
-+ {
-+ if( aFmArray.getLength() == 1 && aFmArray[0].getLength() == 1 )
-+ aMatrix <<= aFmArray[0][0];
-+ else
-+ aMatrix = xConverter->convertTo( uno::makeAny( xCellRangeFormula->getFormulaArray() ) , getCppuType((uno::Sequence< uno::Sequence< uno::Any > >*)0) ) ;
-+ }
- return aMatrix;
- }
-
-@@ -1942,7 +2012,7 @@ ScVbaRange::Cells( const uno::Any &nRowIndex, const uno::Any &nColumnIndex ) thr
- uno::Reference< table::XCellRange > xSheetRange = thisRange.getCellRangeFromSheet();
- if( !bIsIndex && !bIsColumnIndex ) // .Cells
- // #FIXE needs proper parent ( Worksheet )
-- return uno::Reference< excel::XRange >( new ScVbaRange( uno::Reference< XHelperInterface >(), mxContext, mxRange ) );
-+ return uno::Reference< excel::XRange >( new ScVbaRange( mxParent, mxContext, mxRange ) );
-
- sal_Int32 nIndex = --nRow;
- if( bIsIndex && !bIsColumnIndex ) // .Cells(n)
-@@ -1960,7 +2030,7 @@ ScVbaRange::Cells( const uno::Any &nRowIndex, const uno::Any &nColumnIndex ) thr
- --nColumn;
- nRow = nRow + thisRangeAddress.StartRow;
- nColumn = nColumn + thisRangeAddress.StartColumn;
-- return new ScVbaRange( getParent(), mxContext, xSheetRange->getCellRangeByPosition( nColumn, nRow, nColumn, nRow ) );
-+ return new ScVbaRange( mxParent, mxContext, xSheetRange->getCellRangeByPosition( nColumn, nRow, nColumn, nRow ) );
- }
-
- void
-@@ -2099,7 +2169,7 @@ ScVbaRange::Rows(const uno::Any& aIndex ) throw (uno::RuntimeException)
- {
- ScAddress::Details dDetails( formula::FormulaGrammar::CONV_XL_A1, 0, 0 );
- ScRange tmpRange;
-- tmpRange.ParseRows( sAddress, getDocumentFromRange( mxRange ), dDetails );
-+ tmpRange.ParseRows( sAddress, excel::GetDocumentFromRange( mxRange ), dDetails );
- nStartRow = tmpRange.aStart.Row();
- nEndRow = tmpRange.aEnd.Row();
-
-@@ -2113,12 +2183,12 @@ ScVbaRange::Rows(const uno::Any& aIndex ) throw (uno::RuntimeException)
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Internal failure, illegal param"), uno::Reference< uno::XInterface >() );
- // return a normal range ( even for multi-selection
- uno::Reference< table::XCellRange > xRange( new ScCellRangeObj( pUnoRangesBase->GetDocShell(), aRange ) );
-- return new ScVbaRange( getParent(), mxContext, xRange, true );
-+ return new ScVbaRange( mxParent, mxContext, xRange, true );
- }
- // Rows() - no params
- if ( m_Areas->getCount() > 1 )
-- return new ScVbaRange( getParent(), mxContext, mxRanges, true );
-- return new ScVbaRange( getParent(), mxContext, mxRange, true );
-+ return new ScVbaRange( mxParent, mxContext, mxRanges, true );
-+ return new ScVbaRange( mxParent, mxContext, mxRange, true );
- }
-
- uno::Reference< excel::XRange >
-@@ -2146,7 +2216,7 @@ ScVbaRange::Columns(const uno::Any& aIndex ) throw (uno::RuntimeException)
- {
- ScAddress::Details dDetails( formula::FormulaGrammar::CONV_XL_A1, 0, 0 );
- ScRange tmpRange;
-- tmpRange.ParseCols( sAddress, getDocumentFromRange( mxRange ), dDetails );
-+ tmpRange.ParseCols( sAddress, excel::GetDocumentFromRange( mxRange ), dDetails );
- nStartCol = tmpRange.aStart.Col();
- nEndCol = tmpRange.aEnd.Col();
-
-@@ -2160,9 +2230,8 @@ ScVbaRange::Columns(const uno::Any& aIndex ) throw (uno::RuntimeException)
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Internal failure, illegal param"), uno::Reference< uno::XInterface >() );
- }
- // Columns() - no params
-- //return new ScVbaRange( getParent(), mxContext, mxRange, false, true );
- uno::Reference< table::XCellRange > xRange( new ScCellRangeObj( pUnoRangesBase->GetDocShell(), aRange ) );
-- return new ScVbaRange( getParent(), mxContext, xRange, false, true );
-+ return new ScVbaRange( mxParent, mxContext, xRange, false, true );
- }
-
- void
-@@ -2222,7 +2291,7 @@ ScVbaRange::Copy(const ::uno::Any& Destination) throw (uno::RuntimeException)
- }
- else
- {
-- uno::Reference< frame::XModel > xModel = getModelFromRange( mxRange );
-+ uno::Reference< frame::XModel > xModel = excel::GetModelFromRange( mxRange );
- Select();
- excel::implnCopy( xModel );
- }
-@@ -2246,8 +2315,9 @@ ScVbaRange::Cut(const ::uno::Any& Destination) throw (uno::RuntimeException)
- uno::Reference< sheet::XCellRangeAddressable > xSource( mxRange, uno::UNO_QUERY);
- xMover->moveRange( xDestination->getCellAddress(), xSource->getRangeAddress() );
- }
-- {
-- uno::Reference< frame::XModel > xModel = getModelFromRange( mxRange );
-+ //VBA, minz@cn.ibm.com.
-+ else {
-+ uno::Reference< frame::XModel > xModel = excel::GetModelFromRange( mxRange );
- Select();
- excel::implnCut( xModel );
- }
-@@ -2318,7 +2388,7 @@ ScVbaRange::Resize( const uno::Any &RowSize, const uno::Any &ColumnSize ) throw
- xCursor->collapseToSize( nColumnSize, nRowSize );
- uno::Reference< sheet::XCellRangeAddressable > xCellRangeAddressable(xCursor, ::uno::UNO_QUERY_THROW );
- uno::Reference< table::XCellRange > xRange( xSheetRange->getSpreadsheet(), ::uno::UNO_QUERY_THROW );
-- return new ScVbaRange( getParent(), mxContext,xRange->getCellRangeByPosition(
-+ return new ScVbaRange( mxParent, mxContext,xRange->getCellRangeByPosition(
- xCellRangeAddressable->getRangeAddress().StartColumn,
- xCellRangeAddressable->getRangeAddress().StartRow,
- xCellRangeAddressable->getRangeAddress().EndColumn,
-@@ -2482,7 +2552,7 @@ ScVbaRange::Range( const uno::Any &Cell1, const uno::Any &Cell2, bool bForceUseI
- }
- }
-
-- return new ScVbaRange( getParent(), mxContext, xCellRange );
-+ return new ScVbaRange( mxParent, mxContext, xCellRange );
-
- }
-
-@@ -2561,8 +2631,6 @@ ScVbaRange::PasteSpecial( const uno::Any& Paste, const uno::Any& Operation, cons
-
- 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( xModel->getCurrentSelection() );
- // select this range
- xSelection->select( uno::makeAny( mxRange ) );
- // set up defaults
-@@ -2583,8 +2651,6 @@ ScVbaRange::PasteSpecial( const uno::Any& Paste, const uno::Any& Operation, cons
- USHORT nFlags = getPasteFlags(nPaste);
- USHORT nFormulaBits = getPasteFormulaBits(nOperation);
- excel::implnPasteSpecial(pShell->GetModel(), nFlags,nFormulaBits,bSkipBlanks,bTranspose);
-- // restore selection
-- xSelection->select( uno::makeAny( xSel ) );
- }
-
- uno::Reference< excel::XRange >
-@@ -2611,10 +2677,10 @@ ScVbaRange::getEntireColumnOrRow( bool bColumn ) throw (uno::RuntimeException)
- {
- uno::Reference< sheet::XSheetCellRangeContainer > xRanges( new ScCellRangesObj( pUnoRangesBase->GetDocShell(), aCellRanges ) );
-
-- return new ScVbaRange( getParent(), mxContext, xRanges, !bColumn, bColumn );
-+ return new ScVbaRange( mxParent, mxContext, xRanges, !bColumn, bColumn );
- }
- uno::Reference< table::XCellRange > xRange( new ScCellRangeObj( pUnoRangesBase->GetDocShell(), *aCellRanges.First() ) );
-- return new ScVbaRange( getParent(), mxContext, xRange, !bColumn, bColumn );
-+ return new ScVbaRange( mxParent, mxContext, xRange, !bColumn, bColumn );
- }
-
- uno::Reference< excel::XRange > SAL_CALL
-@@ -2634,11 +2700,12 @@ ScVbaRange::AddComment( const uno::Any& Text ) throw (uno::RuntimeException)
- {
-
- uno::Reference< excel::XComment > xComment( new ScVbaComment( this, mxContext, mxRange ) );
-- // if you don't pass a valid text or if there is already a comment
-- // associated with the range then return NULL
-- if ( !xComment->Text( Text, uno::Any(), uno::Any() ).getLength()
-- || xComment->Text( uno::Any(), uno::Any(), uno::Any() ).getLength() )
-- return NULL;
-+ // if there is existing text then error
-+ if ( Text.hasValue() && xComment->Text( uno::Any(), uno::Any(), uno::Any() ).getLength() )
-+ throw uno::RuntimeException();
-+ // failed to write text? ( can this happen ?? )
-+ if ( !xComment->Text( Text, uno::Any(), uno::Any() ).getLength() )
-+ return NULL;
- return xComment;
- }
-
-@@ -2796,7 +2863,16 @@ ScVbaRange::Replace( const ::rtl::OUString& What, const ::rtl::OUString& Replace
- // OOo.org afaik
-
- uno::Reference< util::XSearchDescriptor > xSearch( xDescriptor, uno::UNO_QUERY );
-+ // Find all cells that being replaced, used to fire the range changed event.
-+ uno::Reference< container::XIndexAccess > xIndexAccess = xReplace->findAll( xSearch );
- xReplace->replaceAll( xSearch );
-+
-+ if ( xIndexAccess.is() && xIndexAccess->getCount() > 0 )
-+ {
-+ // Fires the range change event.
-+ ScCellRangesBase* pScCellRangesBase = ScCellRangesBase::getImplementation( xIndexAccess ); //liuchen 2010-01-05
-+ lcl_NotifyRangeChanges( getScDocShell()->GetModel(), pScCellRangesBase ); //liuchen 2010-01-05 the original convert method will fail in SUSE
-+ }
- }
- return sal_True; // always
- }
-@@ -2947,9 +3023,16 @@ ScVbaRange::Find( const uno::Any& What, const uno::Any& After, const uno::Any& L
- uno::Reference< util::XSearchDescriptor > xSearchDescriptor( xDescriptor, uno::UNO_QUERY );
- uno::Reference< uno::XInterface > xInterface = xStartCell.is() ? xSearch->findNext( xStartCell, xSearchDescriptor) : xSearch->findFirst( xSearchDescriptor );
- uno::Reference< table::XCellRange > xCellRange( xInterface, uno::UNO_QUERY );
-+ // if we are searching from a starting cell and failed to find a match
-+ // then try from the begining
-+ if ( !xCellRange.is() && xStartCell.is() )
-+ {
-+ xInterface = xSearch->findFirst( xSearchDescriptor );
-+ xCellRange.set( xInterface, uno::UNO_QUERY );
-+ }
- if ( xCellRange.is() )
- {
-- uno::Reference< excel::XRange > xResultRange = new ScVbaRange( this, mxContext, xCellRange );
-+ uno::Reference< excel::XRange > xResultRange = new ScVbaRange( mxParent, mxContext, xCellRange );
- if( xResultRange.is() )
- {
- xResultRange->Select();
-@@ -3240,76 +3323,45 @@ ScVbaRange::End( ::sal_Int32 Direction ) throw (uno::RuntimeException)
- return xRange->End( Direction );
- }
-
--
-- // #FIXME #TODO
-- // euch! found my orig implementation sucked, so
-- // trying this even suckier one ( really need to use/expose code in
-- // around ScTabView::MoveCursorArea(), thats the bit that calcutes
-- // where the cursor should go )
-- // Main problem with this method is the ultra hacky attempt to preserve
-- // the ActiveCell, there should be no need to go to these extreems
--
-- // Save ActiveCell pos ( to restore later )
-- uno::Any 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();
--
-- uno::Reference< frame::XModel > xModel = getModelFromRange( mxRange );
--
-- SfxViewFrame* pViewFrame = excel::getViewFrame( xModel );
-- if ( pViewFrame )
-- {
-- SfxAllItemSet aArgs( SFX_APP()->GetPool() );
-- // Hoping this will make sure this slot is called
-- // synchronously
-- SfxBoolItem sfxAsync( SID_ASYNCHRON, sal_False );
-- aArgs.Put( sfxAsync, sfxAsync.Which() );
-- SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
--
-- USHORT nSID = 0;
--
-- switch( Direction )
-- {
-- case excel::XlDirection::xlDown:
-- nSID = SID_CURSORBLKDOWN;
-- break;
-- case excel::XlDirection::xlUp:
-- nSID = SID_CURSORBLKUP;
-- break;
-- case excel::XlDirection::xlToLeft:
-- nSID = SID_CURSORBLKLEFT;
-- break;
-- case excel::XlDirection::xlToRight:
-- nSID = SID_CURSORBLKRIGHT;
-- break;
-- default:
-- throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ": Invalid ColumnIndex" ) ), uno::Reference< uno::XInterface >() );
-- }
-- if ( pDispatcher )
-- {
-- pDispatcher->Execute( nSID, (SfxCallMode)SFX_CALLMODE_SYNCHRON, aArgs );
-- }
-- }
--
-- // result is the ActiveCell
-- rtl::OUString sMoved = xApplication->getActiveCell()->Address(aDft, aDft, aDft, aDft, aDft );
--
-- // restore old ActiveCell
-- uno::Any aVoid;
--
-- 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( xApplication->getActiveSheet()->Range( uno::makeAny( sMoved ), aVoid ), uno::UNO_QUERY_THROW );
--
-- // return result
--
-- return resultCell;
-+ table::CellAddress aAddress = getLeftUpperCellAddress();
-+ SCTAB nTab = aAddress.Sheet;
-+ SCCOL nCurX = aAddress.Column;
-+ SCROW nCurY = aAddress.Row;
-+ SCCOL nNewX = nCurX;
-+ SCROW nNewY = nCurY;
-+
-+ ScDocShell* pDocShell = getScDocShell();
-+ ScDocument* pDoc = pDocShell->GetDocument();
-+
-+ SCsCOL nMoveX = 0;
-+ SCsROW nMoveY = 0;
-+ switch ( Direction )
-+ {
-+ case excel::XlDirection::xlDown:
-+ nMoveY = 1;
-+ break;
-+ case excel::XlDirection::xlUp:
-+ nMoveY = -1;
-+ break;
-+ case excel::XlDirection::xlToLeft:
-+ nMoveX = -1;
-+ break;
-+ case excel::XlDirection::xlToRight:
-+ nMoveX = 1;
-+ break;
-+ default:
-+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Invalid Direction" ) ), uno::Reference< uno::XInterface >() );
-+ }
-+
-+ if ( pDoc )
-+ {
-+ pDoc->FindAreaPos( nNewX, nNewY, nTab, nMoveX, nMoveY );
-+ }
-+
-+ ScRange aNewRange( (SCCOL)nNewX, (SCROW)nNewY, nTab, (SCCOL)nNewX, (SCROW)nNewY, nTab );
-+ uno::Reference< table::XCellRange > xCellRange( new ScCellRangeObj( getScDocShell(), aNewRange ) );
-+ uno::Reference< excel::XRange > xResultRange = new ScVbaRange( mxParent, mxContext, xCellRange );
-+ return xResultRange;
- }
-
- bool
-@@ -3327,7 +3379,7 @@ ScVbaRange::characters( const uno::Any& Start, const uno::Any& Length ) throw (u
- if ( !isSingleCellRange() )
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Can't create Characters property for multicell range ") ), uno::Reference< uno::XInterface >() );
- uno::Reference< text::XSimpleText > xSimple(mxRange->getCellByPosition(0,0) , uno::UNO_QUERY_THROW );
-- ScDocument* pDoc = getDocumentFromRange(mxRange);
-+ ScDocument* pDoc = excel::GetDocumentFromRange(mxRange);
- if ( !pDoc )
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Failed to access document from shell" ) ), uno::Reference< uno::XInterface >() );
-
-@@ -3410,7 +3462,7 @@ ScVbaRange::createEnumeration() throw (uno::RuntimeException)
- return new ColumnsRowEnumeration( mxContext, xRange, nElems );
-
- }
-- return new CellsEnumeration( mxContext, m_Areas );
-+ return new CellsEnumeration( mxParent, mxContext, m_Areas );
- }
-
- ::rtl::OUString SAL_CALL
-@@ -3444,7 +3496,7 @@ ScVbaRange::getCalcColWidth( const table::CellRangeAddress& rAddress) throw (uno
- double
- ScVbaRange::getCalcRowHeight( const table::CellRangeAddress& rAddress ) throw (uno::RuntimeException)
- {
-- ScDocument* pDoc = getDocumentFromRange( mxRange );
-+ ScDocument* pDoc = excel::GetDocumentFromRange( mxRange );
- USHORT nWidth = pDoc->GetOriginalHeight( rAddress.StartRow, rAddress.Sheet );
- double nPoints = lcl_TwipsToPoints( nWidth );
- nPoints = lcl_Round2DecPlaces( nPoints );
-@@ -3706,7 +3758,7 @@ ScVbaRange::setRowHeight( const uno::Any& _rowheight) throw (uno::RuntimeExcepti
- table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
- USHORT nTwips = lcl_pointsToTwips( nHeight );
-
-- ScDocShell* pDocShell = getDocShellFromRange( mxRange );
-+ ScDocShell* pDocShell = excel::GetDocShellFromRange( mxRange );
- ScDocFunc aFunc(*pDocShell);
- SCCOLROW nRowArr[2];
- nRowArr[0] = thisAddress.StartRow;
-@@ -3719,7 +3771,7 @@ uno::Any SAL_CALL
- ScVbaRange::getPageBreak() throw (uno::RuntimeException)
- {
- sal_Int32 nPageBreak = excel::XlPageBreak::xlPageBreakNone;
-- ScDocShell* pShell = getDocShellFromRange( mxRange );
-+ ScDocShell* pShell = excel::GetDocShellFromRange( mxRange );
- if ( pShell )
- {
- RangeHelper thisRange( mxRange );
-@@ -3732,7 +3784,7 @@ ScVbaRange::getPageBreak() throw (uno::RuntimeException)
- uno::Reference< frame::XModel > xModel = pShell->GetModel();
- if ( xModel.is() )
- {
-- ScDocument* pDoc = getDocumentFromRange( mxRange );
-+ ScDocument* pDoc = excel::GetDocumentFromRange( mxRange );
-
- ScBreakType nBreak = BREAK_NONE;
- if ( !bColumn )
-@@ -3757,7 +3809,7 @@ ScVbaRange::setPageBreak( const uno::Any& _pagebreak) throw (uno::RuntimeExcepti
- sal_Int32 nPageBreak = 0;
- _pagebreak >>= nPageBreak;
-
-- ScDocShell* pShell = getDocShellFromRange( mxRange );
-+ ScDocShell* pShell = excel::GetDocShellFromRange( mxRange );
- if ( pShell )
- {
- RangeHelper thisRange( mxRange );
-@@ -3851,7 +3903,7 @@ ScVbaRange::getWorksheet() throw (uno::RuntimeException)
- uno::Reference< container::XIndexAccess > xIndex( mxRanges, uno::UNO_QUERY_THROW );
- xRange.set( xIndex->getByIndex( 0 ), uno::UNO_QUERY_THROW );
- }
-- ScDocShell* pDocShell = getDocShellFromRange(xRange);
-+ ScDocShell* pDocShell = excel::GetDocShellFromRange(xRange);
- RangeHelper rHelper(xRange);
- // parent should be Thisworkbook
- xSheet.set( new ScVbaWorksheet( uno::Reference< XHelperInterface >(), mxContext,rHelper.getSpreadSheet(),pDocShell->GetModel()) );
-@@ -3901,69 +3953,49 @@ ScVbaRange::ApplicationRange( const uno::Reference< uno::XComponentContext >& xC
- uno::Reference< table::XCellRange > xRange = xReferrer->getReferredCells();
- if ( xRange.is() )
- {
-- // #FIXME need proper (WorkSheet) parent
-- uno::Reference< excel::XRange > xVbRange = new ScVbaRange( uno::Reference< XHelperInterface >(), xContext, xRange );
-+ uno::Reference< excel::XRange > xVbRange = new ScVbaRange( excel::getUnoSheetModuleObj( xRange ), xContext, xRange );
- return xVbRange;
- }
- }
- }
-- 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 );
-+
-+ // Add these codes for supporting shortcut: Application.Range(Range1, Range2), Range1 or Range2 is not the range of current active sheet.
-+ // If Range1 and Range2 are not in current active sheet, we should not use the active sheet, but use the sheet of Range1 and Range2.
-+ // If Range1 and Range2 are not in the same sheet, we throw an exception.
-+ uno::Reference< sheet::XSpreadsheet > xSpreadsheet;
-+ uno::Reference< excel::XRange > xRange1( Cell1, uno::UNO_QUERY ), xRange2( Cell2, uno::UNO_QUERY );
-+ if ( xRange1.is() )
-+ {
-+ RangeHelper thisRange( xRange1->getCellRange() );
-+ xSpreadsheet = thisRange.getSpreadSheet();
-+ }
-+ else if ( xRange2.is() )
-+ {
-+ RangeHelper thisRange( xRange2->getCellRange() );
-+ xSpreadsheet = thisRange.getSpreadSheet();
-+ }
-+ if ( !xSpreadsheet.is() )
-+ {
-+ uno::Reference< frame::XModel > xModel = getCurrentExcelDoc( xContext );
-+ if ( xModel.is() )
-+ {
-+ uno::Reference< sheet::XSpreadsheetView > xView( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
-+ xSpreadsheet = xView->getActiveSheet();
-+ }
-+ }
-+
-+ uno::Reference< table::XCellRange > xSheetRange( xSpreadsheet, uno::UNO_QUERY_THROW );
-+ ScVbaRange* pRange = new ScVbaRange( excel::getUnoSheetModuleObj( xSheetRange ), xContext, xSheetRange );
- uno::Reference< excel::XRange > xVbSheetRange( pRange );
- return pRange->Range( Cell1, Cell2, true );
- }
-
--uno::Reference< sheet::XDatabaseRanges >
--lcl_GetDataBaseRanges( ScDocShell* pShell ) throw ( uno::RuntimeException )
--{
-- uno::Reference< frame::XModel > xModel;
-- if ( pShell )
-- xModel.set( pShell->GetModel(), uno::UNO_QUERY_THROW );
-- uno::Reference< beans::XPropertySet > xModelProps( xModel, uno::UNO_QUERY_THROW );
-- uno::Reference< sheet::XDatabaseRanges > xDBRanges( xModelProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DatabaseRanges") ) ), uno::UNO_QUERY_THROW );
-- return xDBRanges;
--}
--// returns the XDatabaseRange for the autofilter on sheet (nSheet)
--// also populates sName with the name of range
--uno::Reference< sheet::XDatabaseRange >
--lcl_GetAutoFiltRange( ScDocShell* pShell, sal_Int16 nSheet, rtl::OUString& sName )
--{
-- uno::Reference< container::XIndexAccess > xIndexAccess( lcl_GetDataBaseRanges( pShell ), uno::UNO_QUERY_THROW );
-- uno::Reference< sheet::XDatabaseRange > xDataBaseRange;
-- table::CellRangeAddress dbAddress;
-- for ( sal_Int32 index=0; index < xIndexAccess->getCount(); ++index )
-- {
-- uno::Reference< sheet::XDatabaseRange > xDBRange( xIndexAccess->getByIndex( index ), uno::UNO_QUERY_THROW );
-- uno::Reference< container::XNamed > xNamed( xDBRange, uno::UNO_QUERY_THROW );
-- // autofilters work weirdly with openoffice, unnamed is the default
-- // named range which is used to create an autofilter, but
-- // its also possible that another name could be used
-- // this also causes problems when an autofilter is created on
-- // another sheet
-- // ( but.. you can use any named range )
-- dbAddress = xDBRange->getDataArea();
-- if ( dbAddress.Sheet == nSheet )
-- {
-- sal_Bool bHasAuto = sal_False;
-- uno::Reference< beans::XPropertySet > xProps( xDBRange, uno::UNO_QUERY_THROW );
-- xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AutoFilter") ) ) >>= bHasAuto;
-- if ( bHasAuto )
-- {
-- sName = xNamed->getName();
-- xDataBaseRange=xDBRange;
-- break;
-- }
-- }
-- }
-- return xDataBaseRange;
--}
-
- // Helper functions for AutoFilter
- ScDBData* lcl_GetDBData_Impl( ScDocShell* pDocShell, sal_Int16 nSheet )
- {
- rtl::OUString sName;
-- lcl_GetAutoFiltRange( pDocShell, nSheet, sName );
-+ excel::GetAutoFiltRange( pDocShell, nSheet, sName );
- OSL_TRACE("lcl_GetDBData_Impl got autofilter range %s for sheet %d",
- rtl::OUStringToOString( sName, RTL_TEXTENCODING_UTF8 ).getStr() , nSheet );
- ScDBData* pRet = NULL;
-@@ -4130,7 +4162,7 @@ ScVbaRange::AutoFilter( const uno::Any& Field, const uno::Any& Criteria1, const
- ScDocShell* pShell = getScDocShell();
- sal_Bool bHasAuto = sal_False;
- rtl::OUString sAutofiltRangeName;
-- uno::Reference< sheet::XDatabaseRange > xDataBaseRange = lcl_GetAutoFiltRange( pShell, nSheet, sAutofiltRangeName );
-+ uno::Reference< sheet::XDatabaseRange > xDataBaseRange = excel::GetAutoFiltRange( pShell, nSheet, sAutofiltRangeName );
- if ( xDataBaseRange.is() )
- bHasAuto = true;
-
-@@ -4163,7 +4195,7 @@ ScVbaRange::AutoFilter( const uno::Any& Field, const uno::Any& Criteria1, const
- autoFiltAddress = multiCellRange.getCellRangeAddressable()->getRangeAddress();
- }
-
-- uno::Reference< sheet::XDatabaseRanges > xDBRanges = lcl_GetDataBaseRanges( pShell );
-+ uno::Reference< sheet::XDatabaseRanges > xDBRanges = excel::GetDataBaseRanges( pShell );
- if ( xDBRanges.is() )
- {
- rtl::OUString sGenName( RTL_CONSTASCII_USTRINGPARAM("VBA_Autofilter_") );
-@@ -4216,8 +4248,21 @@ ScVbaRange::AutoFilter( const uno::Any& Field, const uno::Any& Criteria1, const
- // Use the normal uno api, sometimes e.g. when you want to use ALL as the filter
- // we can't use refresh as the uno interface doesn't have a concept of ALL
- // in this case we just call the core calc functionality -
-- bool bAll = false;;
-- if ( ( Field >>= nField ) )
-+ bool bAll = false;
-+ uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( mxContext );
-+ bool bIsValidFieldValue = ( Field >>= nField );
-+ if ( !bIsValidFieldValue && xConverter.is() )
-+ {
-+ try
-+ {
-+ uno::Any aConverted = xConverter->convertTo( Field, getCppuType( (sal_Int32*)0 ) );
-+ bIsValidFieldValue = ( aConverted >>= nField );
-+ }
-+ catch( const uno::Exception& ex )
-+ {
-+ }
-+ }
-+ if ( bIsValidFieldValue )
- {
- uno::Reference< sheet::XSheetFilterDescriptor2 > xDesc(
- xDataBaseRange->getFilterDescriptor(), uno::UNO_QUERY );
-@@ -4248,7 +4293,19 @@ ScVbaRange::AutoFilter( const uno::Any& Field, const uno::Any& Criteria1, const
- bAll = true;
- // not sure what the relationship between Criteria1 and Operator is,
- // e.g. can you have a Operator without a Criteria ? in openoffice it
-- if ( Operator.hasValue() && ( Operator >>= nOperator ) )
-+ bool bIsValidOpValue = ( Operator.hasValue() && ( Operator >>= nOperator ) );
-+ if ( Operator.hasValue() && !bIsValidOpValue && xConverter.is() )
-+ {
-+ try
-+ {
-+ uno::Any aConverted = xConverter->convertTo( Operator, getCppuType( (sal_Int32*)0 ) );
-+ bIsValidOpValue = ( aConverted >>= nOperator );
-+ }
-+ catch( const uno::Exception& ex )
-+ {
-+ }
-+ }
-+ if ( bIsValidOpValue )
- {
- // if its a bottom/top Ten(Percent/Value) and there
- // is no value specified for critera1 set it to 10
-@@ -4396,8 +4453,8 @@ ScVbaRange::Insert( const uno::Any& Shift, const uno::Any& CopyOrigin ) throw (u
- {
- // 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 ) );
-+ uno::Reference< table::XCellRange > xRange( new ScCellRangeObj( excel::GetDocShellFromRange( mxRange ) , aRange ) );
-+ uno::Reference< excel::XRange > xVbaRange( new ScVbaRange( mxParent, mxContext, xRange, mbIsRows, mbIsColumns ) );
- xVbaRange->PasteSpecial( uno::Any(), uno::Any(), uno::Any(), uno::Any() );
- }
- }
-@@ -4420,7 +4477,7 @@ ScVbaRange::Autofit() throw (uno::RuntimeException)
-
- if ( !( mbIsColumns || mbIsRows ) )
- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
-- ScDocShell* pDocShell = getDocShellFromRange( mxRange );
-+ ScDocShell* pDocShell = excel::GetDocShellFromRange( mxRange );
- if ( pDocShell )
- {
- RangeHelper thisRange( mxRange );
-@@ -4452,8 +4509,8 @@ ScVbaRange::Autofit() throw (uno::RuntimeException)
- ***************************************************************************************/
- void SAL_CALL
- ScVbaRange::TextToColumns( const css::uno::Any& Destination, const css::uno::Any& DataType, const css::uno::Any& TextQualifier,
-- const css::uno::Any& ConsecutinveDelimiter, const css::uno::Any& Tab, const css::uno::Any& Semicolon, const css::uno::Any& Comma,
-- const css::uno::Any& Space, const css::uno::Any& Other, const css::uno::Any& OtherChar, const css::uno::Any& /*FieldInfo*/,
-+ const css::uno::Any& ConsecutiveDelimiter, const css::uno::Any& Tab, const css::uno::Any& Semicolon, const css::uno::Any& Comma,
-+ const css::uno::Any& Space, const css::uno::Any& Other, const css::uno::Any& OtherChar, const css::uno::Any& FieldInfo,
- const css::uno::Any& DecimalSeparator, const css::uno::Any& ThousandsSeparator, const css::uno::Any& /*TrailingMinusNumbers*/ ) throw (css::uno::RuntimeException)
- {
- uno::Reference< excel::XRange > xRange;
-@@ -4490,13 +4547,13 @@ ScVbaRange::TextToColumns( const css::uno::Any& Destination, const css::uno::Any
- OSL_TRACE("set TextQualifier\n");
- }
-
-- sal_Bool bConsecutinveDelimiter = sal_False;
-- if( ConsecutinveDelimiter.hasValue() )
-+ sal_Bool bConsecutiveDelimiter = sal_False;
-+ if( ConsecutiveDelimiter.hasValue() )
- {
-- if( !( ConsecutinveDelimiter >>= bConsecutinveDelimiter ) )
-- throw uno::RuntimeException( rtl::OUString::createFromAscii( "ConsecutinveDelimiter parameter should be a boolean" ),
-+ if( !( ConsecutiveDelimiter >>= bConsecutiveDelimiter ) )
-+ throw uno::RuntimeException( rtl::OUString::createFromAscii( "ConsecutiveDelimiter parameter should be a boolean" ),
- uno::Reference< uno::XInterface >() );
-- OSL_TRACE("set ConsecutinveDelimiter\n");
-+ OSL_TRACE("set ConsecutiveDelimiter\n");
- }
-
- sal_Bool bTab = sal_False;
-@@ -4548,7 +4605,13 @@ ScVbaRange::TextToColumns( const css::uno::Any& Destination, const css::uno::Any
- throw uno::RuntimeException( rtl::OUString::createFromAscii( "Other parameter should be a True" ),
- uno::Reference< uno::XInterface >() );
- }
-- //TODO* FieldInfo Optional Variant. An array containing parse information for the individual columns of data. The interpretation depends on the value of DataType. When the data is delimited, this argument is an array of two-element arrays, with each two-element array specifying the conversion options for a particular column. The first element is the column number (1-based), and the second element is one of the xlColumnDataType constants specifying how the column is parsed.
-+ // FieldInfo, Optional Variant. An array containing parse information for the individual columns of data.
-+ // The interpretation depends on the value of DataType. When the data is delimited, this argument is an array
-+ // of two-element arrays, with each two-element array specifying the conversion options for a particular column.
-+ // The first element is the column number (1-based), and the second element is one of the xlColumnDataType
-+ // constants specifying how the column is parsed.
-+ uno::Sequence< uno::Sequence< uno::Any > > sFieldInfo;
-+ FieldInfo >>= sFieldInfo;
-
- rtl::OUString sDecimalSeparator;
- if( DecimalSeparator.hasValue() )
-@@ -4566,7 +4629,106 @@ ScVbaRange::TextToColumns( const css::uno::Any& Destination, const css::uno::Any
- uno::Reference< uno::XInterface >() );
- OSL_TRACE("set ThousandsSpeparator\n" );
- }
-- //TODO* TrailingMinusNumbers Optional Variant. Numbers that begin with a minus character.
-+ //TODO* TrailingMinusNumbers Optional Variant. Numbers that begin with a minus character.
-+
-+ // Get the destination range's left-upper cell address.
-+ ScVbaRange* pDestVbaRange = dynamic_cast< ScVbaRange* >( xRange.get() );
-+ ScAddress aScDestAddress;
-+ if ( pDestVbaRange )
-+ {
-+ ScUnoConversion::FillScAddress( aScDestAddress, pDestVbaRange->getLeftUpperCellAddress() );
-+ }
-+
-+ // Parse the value of parameter FieldInfo.
-+ USHORT nCount = 0, nRealCount = 0;
-+ xub_StrLen* pColumns = NULL;
-+ BYTE* pFormats = NULL;
-+ if ( sFieldInfo.getLength() > 0 )
-+ {
-+ nCount = sFieldInfo.getLength();
-+ pColumns = new xub_StrLen[nCount];
-+ pFormats = new BYTE[nCount];
-+ USHORT nFormat = 1;
-+ uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( mxContext );
-+ for ( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
-+ {
-+ if ( sFieldInfo[nIndex].getLength() >= 2 )
-+ {
-+ nFormat = 1;
-+ try
-+ {
-+ uno::Any aConverted = xConverter->convertTo( sFieldInfo[nIndex][0], getCppuType((xub_StrLen*)0) );
-+ aConverted >>= pColumns[nRealCount];
-+ aConverted = xConverter->convertTo( sFieldInfo[nIndex][1], getCppuType((USHORT*)0) );
-+ aConverted >>= nFormat;
-+ }
-+ catch( const uno::Exception& )
-+ {
-+ }
-+ pFormats[nRealCount++] = nFormat;
-+ }
-+ }
-+ }
-+
-+ sal_Unicode cTextQualifier = '"';
-+ cTextQualifier = xlTextQualifier == excel::XlTextQualifier::xlTextQualifierNone ? '\0' : cTextQualifier;
-+ cTextQualifier = xlTextQualifier == excel::XlTextQualifier::xlTextQualifierSingleQuote ? '\'' : cTextQualifier;
-+
-+ // Get field delimiters.
-+ String rFieldDelimiters;
-+ if ( bTab ) rFieldDelimiters += '\t';
-+ if ( bSemicolon ) rFieldDelimiters += ';';
-+ if ( bComma ) rFieldDelimiters += ',';
-+ if ( bSpace ) rFieldDelimiters += ' ';
-+ if ( bOther ) rFieldDelimiters += *sOtherChar.getStr();
-+
-+ // Get the text in current range to SvMemoryStream.
-+ ScRange aSrcScRange;
-+ ScCellRangesBase* pSrcCellRangesBase = getCellRangesBase();
-+ if ( pSrcCellRangesBase )
-+ {
-+ ScRangeList aRangeList = pSrcCellRangesBase->GetRangeList();
-+ if ( aRangeList.First() )
-+ {
-+ aSrcScRange = *aRangeList.First();
-+ }
-+ }
-+ ScImportExport aExport( getScDocument(), aSrcScRange );
-+ aExport.SetDelimiter( static_cast< sal_Unicode >( 0 ) );
-+ SvMemoryStream aStream;
-+ aStream.SetStreamCharSet( RTL_TEXTENCODING_UNICODE );
-+ ScImportExport::SetNoEndianSwap( aStream );
-+ aExport.ExportStream( aStream, String(), FORMAT_STRING );
-+ aStream.Seek( 0 );
-+
-+ // Set ScAsciiOptions according to the input parameters.
-+ ScAsciiOptions aOptions;
-+ aOptions.SetFixedLen( !bDilimited );
-+ aOptions.SetStartRow( 0 );
-+ aOptions.SetColInfo( nRealCount, pColumns, pFormats );
-+ if ( bDilimited )
-+ {
-+ aOptions.SetFieldSeps( rFieldDelimiters );
-+ aOptions.SetMergeSeps( bConsecutiveDelimiter );
-+ aOptions.SetTextSep( cTextQualifier );
-+ }
-+
-+ // Split the String in to columns.
-+ if ( pDestVbaRange && pDestVbaRange->getScDocument() )
-+ {
-+ ScImportExport aImport( pDestVbaRange->getScDocument(), aScDestAddress );
-+ aImport.SetExtOptions( aOptions );
-+ aImport.SetApi( false );
-+ aImport.ImportStream( aStream, String(), FORMAT_STRING );
-+ }
-+ if ( pColumns )
-+ {
-+ DELETEZ( pColumns );
-+ }
-+ if ( pFormats )
-+ {
-+ DELETEZ( pFormats );
-+ }
- }
-
- css::uno::Reference< excel::XValidation > SAL_CALL
-@@ -4599,7 +4761,7 @@ uno::Any ScVbaRange::getShowDetail() throw ( css::uno::RuntimeException)
- (thisAddress.StartColumn == thisAddress.EndColumn && thisAddress.EndColumn == aOutlineAddress.EndColumn ))
- {
- sal_Bool bColumn =thisAddress.StartRow == thisAddress.EndRow ? sal_False:sal_True;
-- ScDocument* pDoc = getDocumentFromRange( mxRange );
-+ ScDocument* pDoc = excel::GetDocumentFromRange( mxRange );
- ScOutlineTable* pOutlineTable = pDoc->GetOutlineTable(static_cast<SCTAB>(thisAddress.Sheet), sal_True);
- const ScOutlineArray* pOutlineArray = bColumn ? pOutlineTable->GetColArray(): pOutlineTable->GetRowArray();
- if( pOutlineArray )
-@@ -4656,6 +4818,24 @@ void ScVbaRange::setShowDetail(const uno::Any& aShowDetail) throw ( css::uno::Ru
- }
- }
-
-+//09-09-16 add by limingl
-+::com::sun::star::uno::Reference< ::ooo::vba::excel::XQueryTable > SAL_CALL
-+ScVbaRange::getQueryTable() throw (::com::sun::star::uno::RuntimeException)
-+{
-+ /*
-+ if (m_pQueryTable == NULL)
-+ {
-+ m_pQueryTable = new ScVbaQueryTable(mxParent ,mxContext, getScDocument(), this); //add by limingl
-+ }
-+ //*/
-+ if (!m_xQueryTable.is())
-+ {
-+ m_xQueryTable = new ScVbaQueryTable(mxParent ,mxContext, getScDocument(), this); //add by limingl
-+ }
-+
-+ return m_xQueryTable;
-+}
-+//end add
- uno::Reference< excel::XRange > SAL_CALL
- ScVbaRange::MergeArea() throw (script::BasicErrorException, uno::RuntimeException)
- {
-@@ -4671,20 +4851,132 @@ ScVbaRange::MergeArea() throw (script::BasicErrorException, uno::RuntimeExceptio
- if( aCellAddress.StartColumn ==0 && aCellAddress.EndColumn==0 &&
- aCellAddress.StartRow==0 && aCellAddress.EndRow==0)
- {
-- return new ScVbaRange( getParent(),mxContext,mxRange );
-+ return new ScVbaRange( mxParent,mxContext,mxRange );
- }
- else
- {
- ScRange refRange( static_cast< SCCOL >( aCellAddress.StartColumn ), static_cast< SCROW >( aCellAddress.StartRow ), static_cast< SCTAB >( aCellAddress.Sheet ),
- static_cast< SCCOL >( aCellAddress.EndColumn ), static_cast< SCROW >( aCellAddress.EndRow ), static_cast< SCTAB >( aCellAddress.Sheet ) );
- uno::Reference< table::XCellRange > xRange( new ScCellRangeObj( getScDocShell() , refRange ) );
-- return new ScVbaRange( getParent(),mxContext,xRange );
-+ return new ScVbaRange( mxParent, mxContext,xRange );
- }
- }
- }
-- return new ScVbaRange( getParent(),mxContext,mxRange );
--}
--
-+ return new ScVbaRange( mxParent, mxContext, mxRange );
-+}
-+
-+//2008-08-25 add by limingl
-+//The recordset's member: Recordset.Fields.Item will get a Field obj.
-+//Field.value is the column value.
-+::sal_Int32 SAL_CALL
-+ScVbaRange::CopyFromRecordset( const ::com::sun::star::uno::Any& Data, const ::com::sun::star::uno::Any& MaxRows, const ::com::sun::star::uno::Any& MaxColumns )
-+throw (::com::sun::star::script::BasicErrorException, ::com::sun::star::uno::RuntimeException)
-+{
-+ uno::Sequence< uno::Any > aParams;
-+ uno::Sequence< uno::Any > aFieldsParams(1);
-+ uno::Sequence< sal_Int16 > aOutParamIndex;
-+ uno::Sequence< uno::Any > aOutParam;
-+ uno::Reference< uno::XInterface > xIntRes;
-+ uno::Reference< uno::XInterface > xIntFields;
-+ uno::Reference< uno::XInterface > xIntFld;
-+ uno::Any aRet;
-+ uno::Any aPar;
-+ uno::Any aCrrCol;
-+ uno::Any aCrrRow;
-+ sal_Int16 nCrrCol = 0;
-+ sal_Int32 nCrrRow = 0;
-+ sal_Int32 nCol;
-+ sal_Int32 nMaxRows = 0;
-+ sal_Int32 nMaxColumns = 0;
-+ sal_Bool bEof;
-+// sal_Bool bColName = sal_True;
-+ long lColCnt = 0;
-+ if (MaxColumns.hasValue())
-+ {
-+ MaxColumns >>= nMaxColumns;
-+ }
-+
-+ long lMaxCol = nMaxColumns;
-+
-+ if (MaxRows.hasValue())
-+ {
-+ MaxRows >>= nMaxRows;
-+ }
-+
-+
-+ Data >>= xIntRes;
-+ uno::Reference< script::XInvocation > xInvRes(xIntRes, uno::UNO_QUERY_THROW);
-+ rtl::OUString oMoveNext = rtl::OUString::createFromAscii("MoveNext") ;
-+ rtl::OUString oEof = rtl::OUString::createFromAscii("EOF") ;
-+ rtl::OUString oFields = rtl::OUString::createFromAscii("Fields") ;
-+
-+ if( !xInvRes->hasMethod(oMoveNext))
-+ {
-+ return -1;
-+ }
-+
-+ //Get columns count
-+ aRet = xInvRes->getValue(oFields);
-+ aRet >>= xIntFields;
-+ uno::Reference< script::XInvocation > xInvFields(xIntFields, uno::UNO_QUERY_THROW);
-+ aRet = xInvFields->getValue( rtl::OUString::createFromAscii("Count")) ;
-+ aRet >>= lColCnt;
-+
-+ //Set the assign column number
-+ if (lMaxCol != 0)
-+ {
-+ if (lColCnt > lMaxCol)
-+ {
-+ lColCnt = lMaxCol;
-+ }
-+ }
-+
-+ aCrrRow <<= nCrrRow;
-+ aCrrCol <<= nCrrCol;
-+
-+
-+ //Get start position
-+ uno::Reference< excel::XRange > xRngStartRow = Rows(uno::Any(sal_Int32(1)) );
-+ uno::Reference< excel::XRange > xRngPos = xRngStartRow->Columns( uno::Any(sal_Int32(1)) );
-+
-+ while(1)
-+ {//travel recordset
-+ //get every column
-+ for (long l = 0; l < lColCnt ; l++)
-+ {
-+ nCol = l;
-+ aPar <<= nCol;
-+ //get every field
-+ aRet = xInvFields->invoke( rtl::OUString::createFromAscii("Item"), uno::Sequence< uno::Any >(&aPar,1) , aOutParamIndex,aOutParam);
-+ aRet >>= xIntFld;
-+ uno::Reference< script::XInvocation > xInvFld(xIntFld, uno::UNO_QUERY_THROW); //Get the Field obj
-+
-+ //set the field value
-+ aRet = xInvFld->getValue( rtl::OUString::createFromAscii("Value") );
-+ uno::Reference< excel::XRange > xRngToFill = xRngPos->Offset(aCrrRow,aCrrCol );
-+
-+ xRngToFill->setValue(aRet);
-+ nCrrCol++;
-+ aCrrCol <<= nCrrCol;
-+ }
-+
-+ aRet = xInvRes->invoke(oMoveNext, aParams,aOutParamIndex,aOutParam );
-+ aRet = xInvRes->getValue(oEof);
-+ aRet >>= bEof;
-+ if (bEof || ( nCrrRow >= nMaxRows && nMaxRows != 0) )
-+ {//Arrive the end of recordset
-+ break;
-+ }
-+
-+ nCrrRow++;
-+ aCrrRow <<= nCrrRow;
-+ nCrrCol = 0;
-+ aCrrCol <<= nCrrCol;
-+ }
-+
-+ return 0;
-+}
-+//end add
- void SAL_CALL
- ScVbaRange::PrintOut( const uno::Any& From, const uno::Any& To, const uno::Any& Copies, const uno::Any& Preview, const uno::Any& ActivePrinter, const uno::Any& PrintToFile, const uno::Any& Collate, const uno::Any& PrToFileName ) throw (uno::RuntimeException)
- {
-@@ -4703,7 +4995,7 @@ ScVbaRange::PrintOut( const uno::Any& From, const uno::Any& To, const uno::Any&
- {
- ScVbaRange* pRange = dynamic_cast< ScVbaRange* >( xRange.get() );
- // initialise the doc shell and the printareas
-- pShell = getDocShellFromRange( pRange->mxRange );
-+ pShell = excel::GetDocShellFromRange( pRange->mxRange );
- xPrintAreas.set( thisRange.getSpreadSheet(), uno::UNO_QUERY_THROW );
- }
- printAreas[ index - 1 ] = rangeAddress;
-@@ -4789,7 +5081,7 @@ ScVbaRange::AutoFill( const uno::Reference< excel::XRange >& Destination, const
- }
- }
- }
-- ScDocShell* pDocSh= getDocShellFromRange( mxRange );
-+ ScDocShell* pDocSh= excel::GetDocShellFromRange( mxRange );
-
- FillCmd eCmd = FILL_AUTO;
- FillDateCmd eDateCmd = FILL_DAY;
-@@ -4912,13 +5204,8 @@ ScVbaRange::AutoOutline( ) throw (script::BasicErrorException, uno::RuntimeExce
- RangeHelper thisRange( mxRange );
- table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
-
-- if ( isSingleCellRange() || mbIsRows )
-- {
-- uno::Reference< sheet::XSheetOutline > xSheetOutline( thisRange.getSpreadSheet(), uno::UNO_QUERY_THROW );
-- xSheetOutline->autoOutline( thisAddress );
-- }
-- else
-- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
-+ uno::Reference< sheet::XSheetOutline > xSheetOutline( thisRange.getSpreadSheet(), uno::UNO_QUERY_THROW );
-+ xSheetOutline->autoOutline( thisAddress );
- }
-
- void SAL_CALL
-@@ -4945,9 +5232,9 @@ ScVbaRange::groupUnGroup( bool bUnGroup ) throw ( script::BasicErrorException, u
- {
- if ( m_Areas->getCount() > 1 )
- DebugHelper::exception(SbERR_METHOD_FAILED, STR_ERRORMESSAGE_APPLIESTOSINGLERANGEONLY);
-- table::TableOrientation nOrient = table::TableOrientation_ROWS;
-- if ( mbIsColumns )
-- nOrient = table::TableOrientation_COLUMNS;
-+ table::TableOrientation nOrient = table::TableOrientation_COLUMNS;
-+ if ( mbIsRows )
-+ nOrient = table::TableOrientation_ROWS;
- RangeHelper thisRange( mxRange );
- table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
- uno::Reference< sheet::XSheetOutline > xSheetOutline( thisRange.getSpreadSheet(), uno::UNO_QUERY_THROW );
-@@ -5075,7 +5362,7 @@ ScVbaRange::PreviousNext( bool bIsPrevious )
-
- uno::Reference< table::XCellRange > xRange( new ScCellRangeObj( getScDocShell() , refRange ) );
-
-- return new ScVbaRange( getParent(), mxContext, xRange );
-+ return new ScVbaRange( mxParent, mxContext, xRange );
- }
-
- uno::Reference< excel::XRange > SAL_CALL
-@@ -5106,6 +5393,7 @@ ScVbaRange::SpecialCells( const uno::Any& _oType, const uno::Any& _oValue) throw
- bool bIsSingleCell = isSingleCellRange();
- bool bIsMultiArea = ( m_Areas->getCount() > 1 );
- ScVbaRange* pRangeToUse = this;
-+ uno::Reference< excel::XRange > xUsedRange( getWorksheet()->getUsedRange() );
- sal_Int32 nType = 0;
- if ( !( _oType >>= nType ) )
- DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() );
-@@ -5158,17 +5446,14 @@ ScVbaRange::SpecialCells( const uno::Any& _oType, const uno::Any& _oValue) throw
- if ( aCellRanges.First() == aCellRanges.Last() )
- {
- uno::Reference< table::XCellRange > xRange( new ScCellRangeObj( getScDocShell(), *aCellRanges.First() ) );
-- // #FIXME need proper (WorkSheet) parent
-- return new ScVbaRange( getParent(), mxContext, xRange );
-+ return new ScVbaRange( mxParent, mxContext, xRange );
- }
- uno::Reference< sheet::XSheetCellRangeContainer > xRanges( new ScCellRangesObj( getScDocShell(), aCellRanges ) );
-
-- // #FIXME need proper (WorkSheet) parent
-- return new ScVbaRange( getParent(), mxContext, xRanges );
-+ return new ScVbaRange( mxParent, mxContext, xRanges );
- }
- else if ( bIsSingleCell )
- {
-- uno::Reference< excel::XRange > xUsedRange = getWorksheet()->getUsedRange();
- pRangeToUse = static_cast< ScVbaRange* >( xUsedRange.get() );
- }
-
-@@ -5343,6 +5628,183 @@ ScVbaRange::Subtotal( ::sal_Int32 _nGroupBy, ::sal_Int32 _nFunction, const uno::
- }
- }
-
-+uno::Any SAL_CALL ScVbaRange::AdvancedFilter( sal_Int32 Action, const uno::Any& CriteriaRange,
-+ const uno::Any& CopyToRange, const uno::Any& Unique ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ uno::Any aRet;
-+ aRet <<= sal_True;
-+
-+ uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( mxContext );
-+ ScDocument* pDoc = getScDocument();
-+ if ( !pDoc )
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Failed to access document from range" ) ), uno::Reference< uno::XInterface >() );
-+ }
-+
-+ // Action
-+ if ( Action != excel::XlFilterAction::xlFilterInPlace && Action != excel::XlFilterAction::xlFilterCopy )
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Invalid input parameter" ) ), uno::Reference< uno::XInterface >() );
-+ }
-+ if ( m_Areas->getCount() > 1 )
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Invalid range" ) ), uno::Reference< uno::XInterface >() );
-+ }
-+
-+ sal_Bool bCopyOut = ( Action != excel::XlFilterAction::xlFilterInPlace );
-+ uno::Reference< sheet::XSheetFilterDescriptor > xFilterDesc;
-+ uno::Reference< sheet::XSheetFilterable > xSheetFilter( mxRange, uno::UNO_QUERY_THROW );
-+
-+ // CriteriaRange
-+ String aBuiltInCriteria; // Excel Built-In Filter Criteria.
-+ ScRangeData* pData = NULL;
-+ table::CellRangeAddress refParentAddr;
-+ uno::Any aCriteriaRange = CriteriaRange;
-+ formula::FormulaGrammar::AddressConvention aConv = formula::FormulaGrammar::CONV_XL_A1;
-+ if ( aCriteriaRange.hasValue() && aCriteriaRange.getValueTypeClass() == uno::TypeClass_STRING )
-+ {
-+ rtl::OUString rRangeString;
-+ aCriteriaRange >>= rRangeString;
-+ aConv = excel::IsR1C1ReferFormat( pDoc, rRangeString ) ? formula::FormulaGrammar::CONV_XL_R1C1 : aConv;
-+ }
-+ else
-+ {
-+ // Get Excel BuiltIn Filter Criteria.
-+ ScRangeName* pRangeNames = pDoc->GetRangeName();
-+ const USHORT nCount = pRangeNames ? pRangeNames->GetCount() : 0;
-+ for ( USHORT index = 0; index < nCount; index++ )
-+ {
-+ pData = ( ScRangeData* )( pRangeNames->At( index ) );
-+ if ( pData && pData->HasType( RT_CRITERIA ) )
-+ {
-+ pData->GetSymbol( aBuiltInCriteria, formula::FormulaGrammar::GRAM_NATIVE_XL_A1 );
-+ break;
-+ }
-+ }
-+ aCriteriaRange = aBuiltInCriteria.Len() > 0 ? uno::makeAny( rtl::OUString( aBuiltInCriteria ) ) : aCriteriaRange;
-+ }
-+ if ( aCriteriaRange.hasValue() )
-+ {
-+ table::CellRangeAddress criteriaRangeAddress = getCellRangeAddressForVBARange( aCriteriaRange, getScDocShell(), aConv );
-+ ScRange refRange;
-+ ScUnoConversion::FillScRange( refRange, criteriaRangeAddress );
-+ uno::Reference< table::XCellRange > xRange( new ScCellRangeObj( getScDocShell(), refRange ) );
-+ uno::Reference< sheet::XSheetFilterableEx > xCriteria( xRange, uno::UNO_QUERY );
-+ if ( xCriteria.is() )
-+ {
-+ xFilterDesc = xCriteria->createFilterDescriptorByObject( xSheetFilter );
-+ }
-+ }
-+ else if ( mxRange.is() )
-+ {
-+ uno::Reference< sheet::XSheetFilterableEx > xCriteria( mxRange, uno::UNO_QUERY );
-+ if ( xCriteria.is() )
-+ {
-+ xFilterDesc = xCriteria->createFilterDescriptorByObject( xSheetFilter );
-+ }
-+ }
-+
-+ uno::Reference< beans::XPropertySet > xPropertySet( xFilterDesc, uno::UNO_QUERY );
-+ if ( xPropertySet.is() )
-+ {
-+ xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_COPYOUT ) ), uno::makeAny( bCopyOut ) );
-+ }
-+
-+ // CopyToRange
-+ if ( bCopyOut && CopyToRange.hasValue() && xPropertySet.is() )
-+ {
-+ formula::FormulaGrammar::AddressConvention aTmpConv = formula::FormulaGrammar::CONV_XL_A1;
-+ if ( CopyToRange.getValueTypeClass() == uno::TypeClass_STRING )
-+ {
-+ rtl::OUString rRangeString;
-+ CopyToRange >>= rRangeString;
-+ aTmpConv = excel::IsR1C1ReferFormat( pDoc, rRangeString ) ? formula::FormulaGrammar::CONV_XL_R1C1 : aConv;
-+ }
-+ ScRange refRange;
-+ ScUnoConversion::FillScRange( refRange, getCellRangeAddressForVBARange( CopyToRange, getScDocShell(), aTmpConv ) );
-+ uno::Reference< table::XCellRange > xRange( new ScCellRangeObj( getScDocShell(), refRange ) );
-+ uno::Reference< sheet::XCellAddressable > xCellAddr( xRange->getCellByPosition( 0, 0 ), uno::UNO_QUERY_THROW );
-+ xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_OUTPOS ) ), uno::makeAny( xCellAddr->getCellAddress() ) );
-+ }
-+
-+ // Unique
-+ if ( xPropertySet.is() )
-+ {
-+ sal_Bool bUnique = sal_False;
-+ uno::Any aUnique;
-+ try
-+ {
-+ aUnique <<= bUnique;
-+ aUnique = ( xConverter.is() && Unique.hasValue() ) ? xConverter->convertTo( Unique, getCppuType( ( sal_Bool* ) 0 ) ) : aUnique;
-+ }
-+ catch( const uno::Exception& )
-+ {
-+ }
-+ xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_SKIPDUP ) ), aUnique );
-+ }
-+
-+ // Do filter.
-+ if ( xFilterDesc.is() )
-+ {
-+ xSheetFilter->filter( xFilterDesc );
-+ }
-+
-+ return aRet;
-+}
-+
-+//Add by minz@cn.ibm.com. Range.PivotTable.
-+//Returns a PivotTable object that represents the PivotTable report containing the upper-left corner of the specified range.
-+uno::Reference< excel::XPivotTable >
-+ScVbaRange::PivotTable() throw (uno::RuntimeException)
-+{
-+ uno::Reference< excel::XPivotTable > xDestPVTable;
-+
-+ uno::Reference< sheet::XSpreadsheet > xSheet;
-+ if ( mxRange.is() )
-+ {
-+ RangeHelper thisRange( mxRange );
-+ xSheet = thisRange.getSpreadSheet();
-+ }
-+ else if ( mxRanges.is() )
-+ {
-+ uno::Reference< container::XIndexAccess > xIndex( mxRanges, uno::UNO_QUERY_THROW );
-+ uno::Reference< table::XCellRange > xRange( xIndex->getByIndex( 0 ), uno::UNO_QUERY_THROW );
-+ RangeHelper thisRange( xRange );
-+ xSheet = thisRange.getSpreadSheet();
-+ }
-+
-+// RangeHelper thisRange( mxRange );
-+// uno::Reference< sheet::XSpreadsheet > xSheet = thisRange.getSpreadSheet();
-+ uno::Reference< sheet::XDataPilotTablesSupplier > xTables(xSheet, uno::UNO_QUERY_THROW ) ;
-+ uno::Reference< container::XIndexAccess > xIndexAccess( xTables->getDataPilotTables(), uno::UNO_QUERY_THROW );
-+ if ( xIndexAccess.is() )
-+ {
-+ //get the upper-left cell address
-+ table::CellAddress aAddress = getLeftUpperCellAddress();
-+
-+ sal_Int32 nCount = xIndexAccess->getCount();
-+ for (sal_Int32 i=0; i < nCount; i++)
-+ {
-+ uno::Reference< sheet::XDataPilotTable > xDPTable(xIndexAccess->getByIndex(i), uno::UNO_QUERY);
-+ uno::Reference< sheet::XDataPilotTable2 > xDPTable2(xDPTable, uno::UNO_QUERY);
-+
-+ //check if the cell is in the pivot table
-+ sheet::DataPilotTablePositionData posData = xDPTable2->getPositionData(aAddress);
-+ table::CellRangeAddress aCellRangeAddress = xDPTable->getOutputRange();
-+ ScRange aScRange( aCellRangeAddress.StartColumn, aCellRangeAddress.StartRow, aCellRangeAddress.Sheet,
-+ aCellRangeAddress.EndColumn, aCellRangeAddress.EndRow, aCellRangeAddress.Sheet );
-+ ScAddress aPos( aAddress.Column, aAddress.Row, aAddress.Sheet );
-+ if( !(posData.PositionType == sheet::DataPilotTablePositionType::NOT_IN_TABLE) || aScRange.In( aPos ) )
-+ {
-+ xDestPVTable = new ScVbaPivotTable( mxContext, xDPTable );
-+ break;
-+ }
-+ }
-+ }
-+ return xDestPVTable;
-+}
-+
-+
- rtl::OUString&
- ScVbaRange::getServiceImplName()
- {
-@@ -5362,6 +5824,25 @@ ScVbaRange::getServiceNames()
- return aServiceNames;
- }
-
-+sal_Bool SAL_CALL
-+ScVbaRange::hasError() throw (uno::RuntimeException)
-+{
-+ double dResult = sal_False;
-+ uno::Reference< excel::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW );
-+ uno::Reference< script::XInvocation > xInvoc( xApplication->WorksheetFunction(), uno::UNO_QUERY_THROW );
-+
-+ static rtl::OUString FunctionName( RTL_CONSTASCII_USTRINGPARAM("IsError" ) );
-+ uno::Sequence< uno::Any > Params(1);
-+ uno::Reference< excel::XRange > aRange( this );
-+ Params[0] = uno::makeAny( aRange );
-+ uno::Sequence< sal_Int16 > OutParamIndex;
-+ uno::Sequence< uno::Any > OutParam;
-+ xInvoc->invoke( FunctionName, Params, OutParamIndex, OutParam ) >>= dResult;
-+ if ( dResult > 0.0 )
-+ return sal_True;
-+ return sal_False;
-+}
-+
- namespace range
- {
- namespace sdecl = comphelper::service_decl;
-diff --git sc/source/ui/vba/vbarange.hxx sc/source/ui/vba/vbarange.hxx
-index b405589..2916b1d 100644
---- sc/source/ui/vba/vbarange.hxx
-+++ sc/source/ui/vba/vbarange.hxx
-@@ -35,6 +35,7 @@
- #include <ooo/vba/excel/XFont.hpp>
- #include <ooo/vba/excel/XComment.hpp>
- #include <ooo/vba/XCollection.hpp>
-+#include <ooo/vba/excel/XPivotTable.hpp>
- #include <ooo/vba/excel/XlPasteType.hdl>
- #include <ooo/vba/excel/XlPasteSpecialOperation.hdl>
-
-@@ -49,6 +50,8 @@
- #include <com/sun/star/sheet/FillDirection.hpp>
- #include <com/sun/star/sheet/XSpreadsheet.hpp>
- #include <com/sun/star/sheet/XSheetCellRangeContainer.hpp>
-+#include <com/sun/star/table/CellAddress.hpp>
-+#include "vbaquerytable.hxx" //09-09-18 add by limingl
-
- //#include <vbahelper/vbahelperinterface.hxx>
- #include "vbaformat.hxx"
-@@ -98,6 +101,7 @@ class ScVbaRange : public ScVbaRange_BASE
- sal_Bool mbIsRows;
- sal_Bool mbIsColumns;
- css::uno::Reference< ov::excel::XValidation > m_xValidation;
-+ css::uno::Reference<excel::XQueryTable> m_xQueryTable; //09-09-16 add by limingl
- double getCalcColWidth( const css::table::CellRangeAddress& ) throw (css::uno::RuntimeException);
- double getCalcRowHeight( const css::table::CellRangeAddress& ) throw (css::uno::RuntimeException);
- void visitArray( ArrayVisitor& vistor );
-@@ -133,7 +137,8 @@ public:
- virtual ~ScVbaRange();
- virtual css::uno::Reference< ov::XHelperInterface > thisHelperIface() { return this; }
- bool isSingleCellRange();
-- static css::uno::Reference< ov::excel::XRange > getRangeObjectForName( const css::uno::Reference< css::uno::XComponentContext >& xContext, const rtl::OUString& sRangeName, ScDocShell* pDocSh, formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_XL_A1 ) throw ( css::uno::RuntimeException );
-+ static css::uno::Reference< ov::excel::XRange > getRangeObjectForName( const css::uno::Reference< css::uno::XComponentContext >& xContext, const rtl::OUString& sRangeName, ScDocShell* pDocSh, formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_XL_A1 ) throw ( css::uno::RuntimeException );
-+ css::table::CellAddress getLeftUpperCellAddress();
-
- // Attributes
- virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
-@@ -175,6 +180,7 @@ public:
- virtual css::uno::Reference< ov::excel::XValidation > SAL_CALL getValidation() throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getShowDetail() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setShowDetail(const css::uno::Any& aShowDetail) throw (css::uno::RuntimeException);
-+ virtual ::com::sun::star::uno::Reference< ::ooo::vba::excel::XQueryTable > SAL_CALL getQueryTable() throw (::com::sun::star::uno::RuntimeException); //09-09-16 add by limingl
- // Methods
- sal_Bool IsRows() { return mbIsRows; }
- sal_Bool IsColumns() { return mbIsColumns; }
-@@ -223,8 +229,8 @@ public:
- virtual css::uno::Any SAL_CALL Borders( const css::uno::Any& ) throw ( css::script::BasicErrorException, css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL BorderAround( const css::uno::Any& LineStyle,
- const css::uno::Any& Weight, const css::uno::Any& ColorIndex, const css::uno::Any& Color ) throw (css::uno::RuntimeException);
-- virtual void SAL_CALL TextToColumns( const css::uno::Any& Destination, const css::uno::Any& DataType, const css::uno::Any& TextQualifier,
-- const css::uno::Any& ConsecutinveDelimiter, const css::uno::Any& Tab, const css::uno::Any& Semicolon, const css::uno::Any& Comma,
-+ virtual void SAL_CALL TextToColumns( const css::uno::Any& Destination, const css::uno::Any& DataType, const css::uno::Any& TextQualifier,
-+ const css::uno::Any& ConsecutiveDelimiter, const css::uno::Any& Tab, const css::uno::Any& Semicolon, const css::uno::Any& Comma,
- const css::uno::Any& Space, const css::uno::Any& Other, const css::uno::Any& OtherChar, const css::uno::Any& FieldInfo,
- const css::uno::Any& DecimalSeparator, const css::uno::Any& ThousandsSeparator, const css::uno::Any& TrailingMinusNumbers ) throw (css::uno::RuntimeException);
-
-@@ -248,6 +254,11 @@ public:
- virtual void SAL_CALL RemoveSubtotal( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual css::uno::Reference< ov::excel::XRange > SAL_CALL MergeArea() throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL Subtotal( ::sal_Int32 GroupBy, ::sal_Int32 Function, const css::uno::Sequence< ::sal_Int32 >& TotalList, const css::uno::Any& Replace, const css::uno::Any& PageBreaks, const css::uno::Any& SummaryBelowData ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL AdvancedFilter( ::sal_Int32 Action, const css::uno::Any& CriteriaRange, const css::uno::Any& CopyToRange, const css::uno::Any& Unique ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-+
-+ virtual css::uno::Reference< ov::excel::XPivotTable > SAL_CALL PivotTable( ) throw (css::uno::RuntimeException);
-+
-+ virtual ::sal_Int32 SAL_CALL CopyFromRecordset( const ::com::sun::star::uno::Any& Data, const ::com::sun::star::uno::Any& MaxRows, const ::com::sun::star::uno::Any& MaxColumns ) throw (::com::sun::star::script::BasicErrorException, ::com::sun::star::uno::RuntimeException); //2008-08-25 add by limingl
- // XEnumerationAccess
- virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
- // XElementAccess
-@@ -273,6 +284,8 @@ public:
- static css::uno::Reference< ov::excel::XRange > ApplicationRange( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Any &Cell1, const css::uno::Any &Cell2 ) throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL GoalSeek( const css::uno::Any& Goal, const css::uno::Reference< ov::excel::XRange >& ChangingCell ) throw (css::uno::RuntimeException);
- virtual css::uno::Reference< ov::excel::XRange > SAL_CALL SpecialCells( const css::uno::Any& _oType, const css::uno::Any& _oValue) throw ( css::script::BasicErrorException );
-+ // XErrorQuery
-+ virtual ::sal_Bool SAL_CALL hasError( ) throw (css::uno::RuntimeException);
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-diff --git sc/source/ui/vba/vbavalidation.cxx sc/source/ui/vba/vbavalidation.cxx
-index f76794e..e585343 100644
---- sc/source/ui/vba/vbavalidation.cxx
-+++ sc/source/ui/vba/vbavalidation.cxx
-@@ -25,6 +25,7 @@
- *
- ************************************************************************/
- #include "vbavalidation.hxx"
-+#include "vbaformatcondition.hxx"
- #include <com/sun/star/sheet/XSheetCondition.hpp>
- #include <com/sun/star/sheet/ValidationType.hpp>
- #include <com/sun/star/sheet/ValidationAlertStyle.hpp>
-@@ -225,8 +226,10 @@ ScVbaValidation::Delete( ) throw (uno::RuntimeException)
-
- lcl_setValidationProps( m_xRange, xProps );
- }
-+
-+// Fix the defect that validatation cannot work when the input should be limited between a lower bound and an upper bound
- void SAL_CALL
--ScVbaValidation::Add( const uno::Any& Type, const uno::Any& AlertStyle, const uno::Any& /*Operator*/, const uno::Any& Formula1, const uno::Any& Formula2 ) throw (uno::RuntimeException)
-+ScVbaValidation::Add( const uno::Any& Type, const uno::Any& AlertStyle, const uno::Any& Operator, const uno::Any& Formula1, const uno::Any& Formula2 ) throw (uno::RuntimeException)
- {
- uno::Reference< beans::XPropertySet > xProps( lcl_getValidationProps( m_xRange ) );
- uno::Reference< sheet::XSheetCondition > xCond( xProps, uno::UNO_QUERY_THROW );
-@@ -291,6 +294,13 @@ ScVbaValidation::Add( const uno::Any& Type, const uno::Any& AlertStyle, const un
-
- xProps->setPropertyValue( ALERTSTYLE, uno::makeAny( eStyle ) );
-
-+ //2009-11-11 fix the defect that validatation cannot work when the input should be limited between a lower bound and an upper bound
-+ if ( Operator.hasValue() )
-+ {
-+ css::sheet::ConditionOperator conOperator = ScVbaFormatCondition::retrieveAPIOperator( Operator );
-+ xCond->setOperator( conOperator );
-+ }
-+ //2009-11-11
- if ( sFormula1.getLength() )
- xCond->setFormula1( sFormula1 );
- if ( sFormula2.getLength() )
-diff --git sc/source/ui/vba/vbawindow.cxx sc/source/ui/vba/vbawindow.cxx
-index 1450d25..3a180a4 100644
---- sc/source/ui/vba/vbawindow.cxx
-+++ sc/source/ui/vba/vbawindow.cxx
-@@ -56,7 +56,7 @@ using namespace ::ooo::vba;
- using namespace ::ooo::vba::excel::XlWindowState;
-
- // nameExists defined in vbaworksheet.cxx
--bool nameExists( uno::Reference <sheet::XSpreadsheetDocument>& xSpreadDoc, ::rtl::OUString & name, SCTAB& nTab ) throw ( lang::IllegalArgumentException );
-+bool nameExists( const uno::Reference <sheet::XSpreadsheetDocument>& xSpreadDoc, const ::rtl::OUString & name, SCTAB& nTab ) throw ( lang::IllegalArgumentException );
-
- typedef std::hash_map< rtl::OUString,
- SCTAB, ::rtl::OUStringHash,
-diff --git sc/source/ui/vba/vbaworkbook.cxx sc/source/ui/vba/vbaworkbook.cxx
-index e75ed8c..8ef3362 100644
---- sc/source/ui/vba/vbaworkbook.cxx
-+++ sc/source/ui/vba/vbaworkbook.cxx
-@@ -36,6 +36,7 @@
- #include <com/sun/star/frame/XFrame.hpp>
- #include <com/sun/star/beans/XPropertySet.hpp>
- #include <ooo/vba/excel/XlFileFormat.hpp>
-+#include <ooo/vba/excel/XApplication.hpp> //liuchen 2009-12-16
-
- #include "scextopt.hxx"
- #include "vbaworksheet.hxx"
-@@ -124,7 +125,7 @@ ScVbaWorkbook::Colors( const ::uno::Any& Index ) throw (::script::BasicErrorExce
- }
-
- ::sal_Int32 SAL_CALL
--ScVbaWorkbook::FileFormat( ) throw (::script::BasicErrorException, ::uno::RuntimeException)
-+ScVbaWorkbook::getFileFormat( ) throw (::uno::RuntimeException)
- {
- sal_Int32 aFileFormat = 0;
- rtl::OUString aFilterName;
-@@ -184,6 +185,24 @@ ScVbaWorkbook::FileFormat( ) throw (::script::BasicErrorException, ::uno::Runti
- return aFileFormat;
- }
-
-+//VBA by minz@cn.ibm.com. Convert Excel fileformat to OO file filter
-+::rtl::OUString ScVbaWorkbook::convertFileFormat(sal_Int32 aFileFormat)
-+{
-+ rtl::OUString aFilterName;
-+
-+ switch(aFileFormat)
-+ {
-+ case excel::XlFileFormat::xlCSV:
-+ aFilterName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Text - txt - csv (StarCalc)" ) );
-+ break;
-+ case excel::XlFileFormat::xlExcel9795:
-+ aFilterName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MS Excel 97" ) );
-+ break;
-+ }
-+
-+ return aFilterName;
-+}
-+
- void
- ScVbaWorkbook::init()
- {
-@@ -261,6 +280,12 @@ ScVbaWorkbook::Activate() throw (uno::RuntimeException)
- VbaDocumentBase::Activate();
- }
-
-+void
-+ScVbaWorkbook::Protect( const uno::Any &aPassword ) throw (uno::RuntimeException)
-+{
-+ VbaDocumentBase::Protect( aPassword );
-+}
-+
- ::sal_Bool
- ScVbaWorkbook::getProtectStructure() throw (uno::RuntimeException)
- {
-@@ -296,6 +321,50 @@ ScVbaWorkbook::SaveCopyAs( const rtl::OUString& sFileName ) throw ( uno::Runtime
- xStor->storeToURL( aURL, storeProps );
- }
-
-+//VBA by minz@cn.ibm.com. Add Workbook.SaveAs.
-+void
-+ScVbaWorkbook::SaveAs( const rtl::OUString& FileName, const uno::Any& FileFormat, const uno::Any& /*CreateBackup*/ ) throw ( uno::RuntimeException)
-+{
-+ rtl::OUString aURL;
-+ osl::FileBase::getFileURLFromSystemPath( FileName, aURL );
-+ //liuchen 2009-12-16 if the input parameter "FileName" takes the form as "MyFile", we need to get the current directory and combine the current directory and the file name
-+ INetURLObject aFileNameURL( aURL );
-+ aURL = aFileNameURL.GetMainURL( INetURLObject::NO_DECODE );
-+ if ( aURL.getLength() == 0 )
-+ {
-+ uno::Reference< excel::XApplication > xApplication ( Application(),uno::UNO_QUERY_THROW );
-+ rtl::OUString aPathStr = xApplication->getDefaultFilePath();
-+ rtl::OUString aPathURLStr;
-+ osl::FileBase::getFileURLFromSystemPath( aPathStr, aPathURLStr );
-+ INetURLObject aPathURL( aPathURLStr );
-+ aPathURL.Append( FileName );
-+ aURL = aPathURL.GetMainURL( INetURLObject::NO_DECODE );
-+ }
-+ //liuchen 2009-12-16
-+ uno::Reference< frame::XStorable > xStor( getModel(), uno::UNO_QUERY_THROW );
-+
-+ sal_Int32 aFileFormat = excel::XlFileFormat::xlExcel9795;
-+ FileFormat >>= aFileFormat;
-+
-+ if ( FileName.indexOf('.') == -1 )
-+ {
-+ if ( aFileFormat == excel::XlFileFormat::xlExcel9795 )
-+ {
-+ aURL = aURL + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".xls" ) );
-+ }
-+ else if ( aFileFormat == excel::XlFileFormat::xlCSV )
-+ {
-+ aURL = aURL + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".csv" ) );
-+ }
-+ }
-+
-+ uno::Sequence< beans::PropertyValue > storeProps(1);
-+ storeProps[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterName" ) );
-+ storeProps[0].Value <<= convertFileFormat(aFileFormat);
-+
-+ xStor->storeAsURL( aURL, storeProps );
-+}
-+
- css::uno::Any SAL_CALL
- ScVbaWorkbook::Styles( const::uno::Any& Item ) throw (uno::RuntimeException)
- {
-diff --git sc/source/ui/vba/vbaworkbook.hxx sc/source/ui/vba/vbaworkbook.hxx
-index f89d682..acbef63 100644
---- sc/source/ui/vba/vbaworkbook.hxx
-+++ sc/source/ui/vba/vbaworkbook.hxx
-@@ -41,6 +41,8 @@ class ScVbaWorkbook : public ScVbaWorkbook_BASE
- static css::uno::Sequence< sal_Int32 > ColorData;
- void initColorData( const css::uno::Sequence< sal_Int32 >& sColors );
- void init();
-+
-+ ::rtl::OUString convertFileFormat(sal_Int32 aFileFormat);
- protected:
-
- ScVbaWorkbook( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext);
-@@ -61,14 +63,17 @@ public:
- 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 Activate() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL Protect( const css::uno::Any & aPassword ) throw (css::uno::RuntimeException);
- // Amelia Wang
- virtual css::uno::Any SAL_CALL Names( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-
- virtual css::uno::Any SAL_CALL Styles( const css::uno::Any& Item ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL ResetColors( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Colors( const css::uno::Any& Index ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-- virtual ::sal_Int32 SAL_CALL FileFormat( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getFileFormat( ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL SaveCopyAs( const rtl::OUString& Filename ) throw ( css::uno::RuntimeException);
-+ virtual void SAL_CALL SaveAs( const rtl::OUString& FileName, const css::uno::Any& FileFormat, const css::uno::Any& CreateBackup ) throw (css::uno::RuntimeException);
-+
- // code name
- virtual ::rtl::OUString SAL_CALL getCodeName() throw ( css::uno::RuntimeException);
- virtual void SAL_CALL setCodeName( const ::rtl::OUString& sGlobCodeName ) throw (css::uno::RuntimeException);
-@@ -76,6 +81,8 @@ public:
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+
-+ virtual css::uno::Reference< css::frame::XModel > getDocModel() { return mxModel; }
- };
-
- #endif /* SC_VBA_WORKBOOK_HXX */
-diff --git sc/source/ui/vba/vbaworkbooks.cxx sc/source/ui/vba/vbaworkbooks.cxx
-index a39358e..ada6f04 100644
---- sc/source/ui/vba/vbaworkbooks.cxx
-+++ sc/source/ui/vba/vbaworkbooks.cxx
-@@ -46,6 +46,10 @@
- #include <com/sun/star/document/XTypeDetection.hpp>
- #include <com/sun/star/uri/XUriReference.hpp>
- #include <com/sun/star/uri/XUriReferenceFactory.hpp>
-+#include <com/sun/star/script/XVBACompat.hpp>
-+#include <com/sun/star/script/XVBAModuleInfo.hpp>
-+#include <com/sun/star/script/ModuleInfo.hpp>
-+#include <com/sun/star/script/ModuleType.hpp>
-
- #include <sfx2/objsh.hxx>
- #include <tools/urlobj.hxx>
-@@ -56,21 +60,100 @@
- #include <vbahelper/vbahelper.hxx>
-
- #include <hash_map>
-+#include <vector>
- #include <osl/file.hxx>
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-
- const sal_Int16 CUSTOM_CHAR = 5;
-
-+void setUpDocumentModules( const uno::Reference< sheet::XSpreadsheetDocument >& xDoc )
-+{
-+ uno::Reference< frame::XModel > xModel( xDoc, uno::UNO_QUERY );
-+ ScDocShell* pShell = excel::getDocShell( xModel );
-+ if ( pShell )
-+ {
-+ uno::Reference<script::XLibraryContainer> xLibContainer = pShell->GetBasicContainer();
-+ uno::Reference<script::XVBACompat> xVBACompat( xLibContainer, uno::UNO_QUERY_THROW );
-+ xVBACompat->setVBACompatModeOn( sal_True );
-+ String aPrjName( RTL_CONSTASCII_USTRINGPARAM( "VBAProject" ) );
-+ pShell->GetBasicManager()->SetName( aPrjName );
-+
-+ if( xLibContainer.is() )
-+ {
-+ if( !xLibContainer->hasByName( aPrjName ) )
-+ xLibContainer->createLibrary( aPrjName );
-+ uno::Any aLibAny = xLibContainer->getByName( aPrjName );
-+ uno::Reference< container::XNameContainer > xLib;
-+ aLibAny >>= xLib;
-+ if( xLib.is() )
-+ {
-+ uno::Reference< script::XVBAModuleInfo > xVBAModuleInfo( xLib, uno::UNO_QUERY_THROW );
-+ uno::Reference< lang::XMultiServiceFactory> xSF( pShell->GetModel(), uno::UNO_QUERY_THROW);
-+ // bootstrap vbaglobals
-+ xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAGlobals")));
-+ uno::Reference< container::XNameAccess > xVBACodeNamedObjectAccess( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAObjectModuleObjectProvider"))), uno::UNO_QUERY_THROW );
-+ // set up the module info for the workbook and sheets in the nealy created
-+ // spreadsheet
-+ ScDocument* pDoc = pShell->GetDocument();
-+ String sCodeName = pDoc->GetCodeName();
-+ if ( sCodeName.Len() == 0 )
-+ {
-+ sCodeName = String( RTL_CONSTASCII_USTRINGPARAM("ThisWorkbook") );
-+ pDoc->SetCodeName( sCodeName );
-+ }
-+
-+ std::vector< rtl::OUString > sDocModuleNames;
-+ sDocModuleNames.push_back( sCodeName );
-+
-+ uno::Reference<container::XNameAccess > xSheets( xDoc->getSheets(), uno::UNO_QUERY_THROW );
-+ uno::Sequence< rtl::OUString > sSheets( xSheets->getElementNames() );
-+
-+ for ( sal_Int32 index=0; index < sSheets.getLength() ; ++index )
-+ {
-+ sDocModuleNames.push_back( sSheets[ index ] );
-+ }
-+
-+ std::vector<rtl::OUString>::iterator it_end = sDocModuleNames.end();
-+
-+ for ( std::vector<rtl::OUString>::iterator it = sDocModuleNames.begin(); it != it_end; ++it )
-+ {
-+ script::ModuleInfo sModuleInfo;
-+
-+ sModuleInfo.ModuleObject.set( xVBACodeNamedObjectAccess->getByName( *it ), uno::UNO_QUERY );
-+ sModuleInfo.ModuleType = script::ModuleType::DOCUMENT;
-+ xVBAModuleInfo->insertModuleInfo( *it, sModuleInfo );
-+ if( xLib->hasByName( *it ) )
-+ xLib->replaceByName( *it, uno::makeAny( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Option VBASupport 1\n") ) ) );
-+ else
-+ xLib->insertByName( *it, uno::makeAny( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Option VBASupport 1\n" ) ) ) );
-+ }
-+ }
-+ }
-+ }
-+}
-+
- static uno::Any
--getWorkbook( uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< sheet::XSpreadsheetDocument > &xDoc, const uno::Any& aApplication )
-+getWorkbook( uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< sheet::XSpreadsheetDocument > &xDoc, const uno::Reference< XHelperInterface >& xParent )
- {
- // 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 >( aApplication, uno::UNO_QUERY_THROW ), xContext, xModel );
-+ ScDocShell* pShell = excel::getDocShell( xModel );
-+ if ( pShell )
-+ {
-+ String sCodeName = pShell->GetDocument()->GetCodeName();
-+ uno::Reference< uno::XInterface > xIf = getUnoDocModule( sCodeName, pShell );
-+ if ( xIf.is() )
-+ {
-+ OSL_TRACE(" *** Returning Module uno Object *** ");
-+ return uno::makeAny( xIf );
-+ }
-+ }
-+
-+ ScVbaWorkbook *pWb = new ScVbaWorkbook( xParent, xContext, xModel );
- return uno::Any( uno::Reference< excel::XWorkbook > (pWb) );
- }
-
-@@ -78,12 +161,12 @@ class WorkBookEnumImpl : public EnumerationHelperImpl
- {
- uno::Any m_aApplication;
- public:
-- 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 ) {}
-+ WorkBookEnumImpl( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration, const uno::Any& aApplication ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xParent, 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, m_aApplication );
-+ return getWorkbook( m_xContext, xDoc, m_xParent );
- }
-
- };
-@@ -105,14 +188,14 @@ ScVbaWorkbooks::createEnumeration() throw (uno::RuntimeException)
- // safer to create an enumeration based on this objects state
- // rather than one effectively based of the desktop component
- uno::Reference< container::XEnumerationAccess > xEnumerationAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
-- return new WorkBookEnumImpl( mxContext, xEnumerationAccess->createEnumeration(), Application() );
-+ return new WorkBookEnumImpl( mxParent, mxContext, xEnumerationAccess->createEnumeration(), Application() );
- }
-
- uno::Any
- ScVbaWorkbooks::createCollectionObject( const css::uno::Any& aSource )
- {
- uno::Reference< sheet::XSpreadsheetDocument > xDoc( aSource, uno::UNO_QUERY_THROW );
-- return getWorkbook( mxContext, xDoc, Application() );
-+ return getWorkbook( mxContext, xDoc, mxParent );
- }
-
-
-@@ -120,9 +203,11 @@ uno::Any SAL_CALL
- ScVbaWorkbooks::Add() throw (uno::RuntimeException)
- {
- uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( VbaDocumentsBase::Add() , uno::UNO_QUERY_THROW );
--
-+
-+ // need to set up the document modules ( and vba mode ) here
-+ setUpDocumentModules( xSpreadDoc );
- if( xSpreadDoc.is() )
-- return getWorkbook( mxContext, xSpreadDoc, Application() );
-+ return getWorkbook( mxContext, xSpreadDoc, mxParent );
- return uno::Any();
- }
-
-@@ -249,7 +334,7 @@ ScVbaWorkbooks::Open( const rtl::OUString& rFileName, const uno::Any& /*UpdateLi
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Bad Format")), uno::Reference< uno::XInterface >() );
-
- uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( VbaDocumentsBase::Open( rFileName, ReadOnly, sProps ), uno::UNO_QUERY_THROW );
-- uno::Any aRet = getWorkbook( mxContext, xSpreadDoc, Application() );
-+ uno::Any aRet = getWorkbook( mxContext, xSpreadDoc, mxParent );
- uno::Reference< excel::XWorkbook > xWBook( aRet, uno::UNO_QUERY );
- if ( xWBook.is() )
- xWBook->Activate();
-diff --git sc/source/ui/vba/vbaworksheet.cxx sc/source/ui/vba/vbaworksheet.cxx
-index 2af3a04..8bc6dcf 100644
---- sc/source/ui/vba/vbaworksheet.cxx
-+++ sc/source/ui/vba/vbaworksheet.cxx
-@@ -58,6 +58,7 @@
- #include <com/sun/star/form/XFormsSupplier.hpp>
- #include <ooo/vba/excel/XlEnableSelection.hpp>
- #include <ooo/vba/XControlProvider.hpp>
-+#include <ooo/vba/excel/XlSheetVisibility.hpp>
-
- #include <comphelper/processfactory.hxx>
-
-@@ -74,7 +75,7 @@
-
- #include "cellsuno.hxx"
- #include "drwlayer.hxx"
--
-+#include "tabprotection.hxx"
- #include "scextopt.hxx"
- #include "vbaoutline.hxx"
- #include "vbarange.hxx"
-@@ -87,6 +88,7 @@
- #include <vbahelper/vbashapes.hxx>
- #include "vbapagesetup.hxx"
- #include "vbapagebreaks.hxx"
-+#include "viewuno.hxx" //liuchen 2009-9-2
-
- #define STANDARDWIDTH 2267
- #define STANDARDHEIGHT 427
-@@ -94,7 +96,7 @@
- using namespace com::sun::star;
- using namespace ooo::vba;
- bool
--nameExists( uno::Reference <sheet::XSpreadsheetDocument>& xSpreadDoc, ::rtl::OUString & name, SCTAB& nTab ) throw ( lang::IllegalArgumentException )
-+nameExists( const uno::Reference <sheet::XSpreadsheetDocument>& xSpreadDoc, const ::rtl::OUString & name, SCTAB& nTab ) throw ( lang::IllegalArgumentException )
- {
- if (!xSpreadDoc.is())
- throw lang::IllegalArgumentException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nameExists() xSpreadDoc is null" ) ), uno::Reference< uno::XInterface >(), 1 );
-@@ -230,7 +232,7 @@ ScVbaWorksheet::setName(const ::rtl::OUString &rName ) throw (uno::RuntimeExcept
- xNamed->setName( rName );
- }
-
--sal_Bool
-+::sal_Int32
- ScVbaWorksheet::getVisible() throw (uno::RuntimeException)
- {
- uno::Reference< beans::XPropertySet > xProps( getSheet(), uno::UNO_QUERY_THROW );
-@@ -238,13 +240,33 @@ ScVbaWorksheet::getVisible() throw (uno::RuntimeException)
- (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsVisible" ) ) );
- sal_Bool bRet = false;
- aValue >>= bRet;
-- return bRet;
-+ if ( bRet )
-+ {
-+ return excel::XlSheetVisibility::xlSheetVisible;
-+ }
-+ else
-+ {
-+ return excel::XlSheetVisibility::xlSheetHidden;
-+ }
- }
-
- void
--ScVbaWorksheet::setVisible( sal_Bool bVisible ) throw (uno::RuntimeException)
-+ScVbaWorksheet::setVisible( ::sal_Int32 _Visible ) throw (uno::RuntimeException)
- {
- uno::Reference< beans::XPropertySet > xProps( getSheet(), uno::UNO_QUERY_THROW );
-+
-+ //VBA by minz@cn.ibm.com.
-+ sal_Bool bVisible = true;
-+ switch( _Visible )
-+ {
-+ case excel::XlSheetVisibility::xlSheetHidden:
-+ case excel::XlSheetVisibility::xlSheetVeryHidden:
-+ bVisible = false;
-+ break;
-+ case excel::XlSheetVisibility::xlSheetVisible:
-+ bVisible = true;
-+ break;
-+ }
- uno::Any aValue( bVisible );
- xProps->setPropertyValue
- (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsVisible" ) ), aValue);
-@@ -406,6 +428,18 @@ ScVbaWorksheet::getProtectContents()throw (uno::RuntimeException)
- sal_Bool
- ScVbaWorksheet::getProtectDrawingObjects() throw (uno::RuntimeException)
- {
-+ SCTAB nTab = 0;
-+ rtl::OUString aSheetName = getName();
-+ uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( getModel(), uno::UNO_QUERY_THROW );
-+ 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);
-+ if ( pProtect )
-+ return pProtect->isOptionEnabled( ScTableProtection::OBJECTS );
-+ }
- return false;
- }
-
-@@ -417,10 +451,30 @@ ScVbaWorksheet::Activate() throw (uno::RuntimeException)
- xSpreadsheet->setActiveSheet(getSheet());
- }
-
-+//liuchen 2009-9-2, support expand (but not replace) the active sheet
- void
--ScVbaWorksheet::Select() throw (uno::RuntimeException)
--{
-- Activate();
-+ScVbaWorksheet::Select(const css::uno::Any& aReplace) throw (uno::RuntimeException)
-+{
-+ sal_Bool bReplace = true;
-+ if (aReplace.hasValue() && aReplace.getValueTypeClass() == uno::TypeClass_BOOLEAN)
-+ {
-+ aReplace >>= bReplace;
-+ }
-+
-+ uno::Reference< sheet::XSpreadsheetView > xSpreadsheet(
-+ getModel()->getCurrentController(), uno::UNO_QUERY_THROW );
-+ ScTabViewObj* pTabView = static_cast< ScTabViewObj* >( xSpreadsheet.get() );
-+
-+ if (bReplace)
-+ {
-+ pTabView->selectSheet(getSheet(), false);
-+ }
-+ else
-+ {
-+ uno::Reference< sheet::XSpreadsheet > xOldActiveSheet = pTabView->getActiveSheet();
-+ pTabView->selectSheet(getSheet(), true);
-+ pTabView->selectSheet(xOldActiveSheet, true);
-+ }
- }
-
- void
-@@ -486,20 +540,43 @@ ScVbaWorksheet::Copy( const uno::Any& Before, const uno::Any& After ) throw (uno
- return;
- }
-
-- uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( getModel(), uno::UNO_QUERY );
-+ ScVbaWorksheet* pDestSheet = static_cast< ScVbaWorksheet* >(xSheet.get());
-+ uno::Reference <sheet::XSpreadsheetDocument> xDestDoc( pDestSheet->getModel(), uno::UNO_QUERY );
-+ uno::Reference <sheet::XSpreadsheetDocument> xSrcDoc( getModel(), uno::UNO_QUERY );
-+
- SCTAB nDest = 0;
-+ SCTAB nSrc = 0;
- aSheetName = xSheet->getName();
-- bool bSheetExists = nameExists (xSpreadDoc, aSheetName, nDest );
-
-- if ( bSheetExists )
-+ bool bSameDoc = ( pDestSheet->getModel() == getModel() );
-+ bool bDestSheetExists = nameExists (xDestDoc, aSheetName, nDest );
-+ bool bSheetExists = nameExists (xSrcDoc, aCurrSheetName, nSrc );
-+
-+ // set sheet name to be newSheet name
-+ aSheetName = aCurrSheetName;
-+ SCTAB nDummy=0;
-+ if ( bSheetExists && bDestSheetExists )
- {
- sal_Bool bAfter = After.hasValue();
- if(bAfter)
- nDest++;
-- uno::Reference<sheet::XSpreadsheets> xSheets = xSpreadDoc->getSheets();
-- getNewSpreadsheetName(aSheetName,aCurrSheetName,xSpreadDoc);
-- xSheets->copyByName(aCurrSheetName,aSheetName,nDest);
-+ uno::Reference<sheet::XSpreadsheets> xSheets = xDestDoc->getSheets();
-+ if ( bSameDoc || nameExists( xDestDoc, aCurrSheetName, nDummy ) )
-+ getNewSpreadsheetName(aSheetName,aCurrSheetName,xDestDoc);
-+ if ( bSameDoc )
-+ xSheets->copyByName(aCurrSheetName,aSheetName,nDest);
-+ else
-+ {
-+ ScDocShell* pDestDocShell = excel::getDocShell( pDestSheet->getModel() );
-+ ScDocShell* pSrcDocShell = excel::getDocShell( getModel() );
-+ if ( pDestDocShell && pSrcDocShell )
-+ pDestDocShell->TransferTab( *pSrcDocShell, static_cast<SCTAB>(nSrc), static_cast<SCTAB>(nDest), TRUE, TRUE );
-+ }
- }
-+ // active the new sheet
-+ uno::Reference< excel::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW );
-+ uno::Reference< excel::XWorksheet > xNewSheet( xApplication->Worksheets( uno::makeAny( aSheetName ) ), uno::UNO_QUERY_THROW );
-+ xNewSheet->Activate();
- }
-
-
-@@ -554,13 +631,25 @@ ScVbaWorksheet::getSheetAtOffset(SCTAB offset) throw (uno::RuntimeException)
- uno::Reference< excel::XWorksheet >
- ScVbaWorksheet::getNext() throw (uno::RuntimeException)
- {
-- return getSheetAtOffset(static_cast<SCTAB>(1));
-+ //VBA, minz@cn.ibm.com. catch the exception for index out of bound
-+ try{
-+ return getSheetAtOffset(static_cast<SCTAB>(1));
-+ }catch( lang::IndexOutOfBoundsException& /*e*/ )
-+ {
-+ return NULL;
-+ }
- }
-
- uno::Reference< excel::XWorksheet >
- ScVbaWorksheet::getPrevious() throw (uno::RuntimeException)
- {
-- return getSheetAtOffset(-1);
-+ //VBA, minz@cn.ibm.com. catch the exception for index out of bound
-+ try{
-+ return getSheetAtOffset(-1);
-+ }catch( lang::IndexOutOfBoundsException& /*e*/ )
-+ {
-+ return NULL;
-+ }
- }
-
-
-@@ -644,7 +733,7 @@ ScVbaWorksheet::ChartObjects( const uno::Any& Index ) throw (uno::RuntimeExcepti
- uno::Reference< table::XTableChartsSupplier > xChartSupplier( getSheet(), uno::UNO_QUERY_THROW );
- uno::Reference< table::XTableCharts > xTableCharts = xChartSupplier->getCharts();
-
-- uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxSheet, uno::UNO_QUERY_THROW );
-+ uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( getSheet(), uno::UNO_QUERY_THROW ); //VBA, minz@cn.ibm.com.
- mxCharts = new ScVbaChartObjects( this, mxContext, xTableCharts, xDrawPageSupplier );
- }
- if ( Index.hasValue() )
-@@ -882,7 +971,7 @@ ScVbaWorksheet::getServiceNames()
- rtl::OUString SAL_CALL
- ScVbaWorksheet::getCodeName() throw (css::uno::RuntimeException)
- {
--#ifdef VBA_OOBUILD_HACK
-+#if 0
- uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( getModel(), uno::UNO_QUERY_THROW );
- SCTAB nTab = 0;
- rtl::OUString aSheetName = getName();
-@@ -903,7 +992,7 @@ ScVbaWorksheet::getCodeName() throw (css::uno::RuntimeException)
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
- #endif
- }
--#ifdef VBA_OOBUILD_HACK
-+#if 0
- void SAL_CALL
- ScVbaWorksheet::setCodeName( const rtl::OUString& sCodeName ) throw (css::uno::RuntimeException)
- {
-@@ -933,7 +1022,7 @@ ScVbaWorksheet::setCodeName( const rtl::OUString& ) throw (css::uno::RuntimeExce
- sal_Int16
- ScVbaWorksheet::getSheetID() throw (uno::RuntimeException)
- {
-- uno::Reference< sheet::XCellRangeAddressable > xAddressable( mxSheet, uno::UNO_QUERY_THROW );
-+ uno::Reference< sheet::XCellRangeAddressable > xAddressable( getSheet(), uno::UNO_QUERY_THROW ); //VBA. minz@cn.ibm.com. if ActiveSheet, mxSheet is null.
- return xAddressable->getRangeAddress().Sheet;
- }
-
-@@ -960,6 +1049,50 @@ ScVbaWorksheet::PrintOut( const uno::Any& From, const uno::Any& To, const uno::A
- PrintOutHelper( excel::getBestViewShell( xModel ), From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, bSelection );
- }
-
-+uno::Reference< sheet::XDatabaseRange > lcl_getXDatabase( const uno::Reference< frame::XModel >& xModel, const rtl::OUString& aSheetName ) throw ( uno::RuntimeException)
-+
-+{
-+ uno::Reference< sheet::XDatabaseRange > xDBRange;
-+ uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( xModel, uno::UNO_QUERY_THROW );
-+ SCTAB nTab(0);
-+ bool bSheetExists = nameExists (xSpreadDoc, aSheetName, nTab);
-+ if ( bSheetExists )
-+ {
-+ rtl::OUString sAutofilterRngName;
-+ ScDocShell* pShell = excel::getDocShell( xModel );
-+
-+ xDBRange = excel::GetAutoFiltRange( pShell, static_cast< sal_Int16 >( nTab ), sAutofilterRngName );
-+
-+ }
-+ return xDBRange;
-+}
-+
-+::sal_Bool SAL_CALL
-+ScVbaWorksheet::getAutoFilterMode() throw (uno::RuntimeException)
-+{
-+ if ( lcl_getXDatabase( getModel(), getName() ).is() )
-+ return sal_True;
-+ return sal_False;
-+}
-+
-+void SAL_CALL
-+ScVbaWorksheet::setAutoFilterMode( ::sal_Bool _autofiltermode ) throw (uno::RuntimeException)
-+{
-+ if ( !_autofiltermode )
-+ {
-+ uno::Reference< sheet::XDatabaseRange >xAutoFilt = lcl_getXDatabase( getModel(), getName() );
-+
-+ if ( xAutoFilt.is() )
-+ {
-+ uno::Reference< beans::XPropertySet > xProps( xAutoFilt, uno::UNO_QUERY_THROW );
-+ xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AutoFilter") ), uno::makeAny( sal_False ) );
-+ }
-+ }
-+ // Not possible to set to true
-+ else
-+ throw uno::RuntimeException();
-+}
-+
- namespace worksheet
- {
- namespace sdecl = comphelper::service_decl;
-diff --git sc/source/ui/vba/vbaworksheet.hxx sc/source/ui/vba/vbaworksheet.hxx
-index 9d4a003..05b9fc2 100644
---- sc/source/ui/vba/vbaworksheet.hxx
-+++ sc/source/ui/vba/vbaworksheet.hxx
-@@ -43,6 +43,7 @@
- #include <ooo/vba/excel/XHPageBreaks.hpp>
- #include <ooo/vba/excel/XVPageBreaks.hpp>
- #include <ooo/vba/excel/XChartObjects.hpp>
-+#include <com/sun/star/container/XNamed.hpp>
-
- #include <vbahelper/vbahelperinterface.hxx>
- #include "address.hxx"
-@@ -77,11 +78,14 @@ public:
- virtual css::uno::Reference< css::sheet::XSpreadsheet > getSheet()
- { return mxSheet; }
-
-- // Attributes
-+ // Attributes
-+ virtual ::sal_Bool SAL_CALL getAutoFilterMode() throw (::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL setAutoFilterMode( ::sal_Bool _autofiltermode ) throw (::com::sun::star::uno::RuntimeException);
-+
- virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setName( const ::rtl::OUString &rName ) throw (css::uno::RuntimeException);
-- virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException);
-- virtual void SAL_CALL setVisible( sal_Bool bVisible ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getVisible() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setVisible( ::sal_Int32 _Visible ) throw (css::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getStandardWidth() throw (css::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getStandardHeight() throw (css::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL getProtectionMode() throw (css::uno::RuntimeException);
-@@ -101,7 +105,7 @@ public:
-
- // Methods
- virtual void SAL_CALL Activate() throw (css::uno::RuntimeException);
-- virtual void SAL_CALL Select() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL Select(const css::uno::Any& aReplace) throw (css::uno::RuntimeException); //liuchen 2009-9-2, add the input parameter to support expand selection
- virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Range( const css::uno::Any& Cell1, const css::uno::Any& Cell2 ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Move( const css::uno::Any& Before, const css::uno::Any& After ) throw (css::uno::RuntimeException) ;
- virtual void SAL_CALL Copy( const css::uno::Any& Before, const css::uno::Any& After ) throw (css::uno::RuntimeException);
-diff --git sc/source/ui/vba/vbaworksheets.cxx sc/source/ui/vba/vbaworksheets.cxx
-index dc1402b..e08ad8e 100644
---- sc/source/ui/vba/vbaworksheets.cxx
-+++ sc/source/ui/vba/vbaworksheets.cxx
-@@ -52,6 +52,7 @@
- #include "vbaglobals.hxx"
- #include "vbaworksheet.hxx"
- #include "vbaworkbook.hxx"
-+#include <unonames.hxx>
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-@@ -63,6 +64,27 @@ typedef ::cppu::WeakImplHelper3< container::XNameAccess, container::XIndexAccess
- // (as added ) of the items
- typedef std::vector< uno::Reference< sheet::XSpreadsheet > > SheetMap;
-
-+
-+// #FIXME #TODO the implementation of the Sheets collections sucks,
-+// e.g. there is no support for tracking sheets added/removed from the collection
-+
-+uno::Reference< uno::XInterface >
-+lcl_getModulAsUnoObject( const uno::Reference< sheet::XSpreadsheet >& xSheet, const uno::Reference< frame::XModel >& xModel ) throw ( uno::RuntimeException )
-+{
-+ uno::Reference< uno::XInterface > xRet;
-+ if ( !xSheet.is() )
-+ throw uno::RuntimeException();
-+ uno::Reference< beans::XPropertySet > xProps( xSheet, uno::UNO_QUERY_THROW );
-+ rtl::OUString sName;
-+ xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_CODENAME ) ) ) >>= sName;
-+
-+ ScDocShell* pShell = excel::getDocShell( xModel );
-+
-+ if ( pShell )
-+ xRet = getUnoDocModule( sName, pShell );
-+ return xRet;
-+}
-+
- class WorkSheetsEnumeration : public SheetEnumeration_BASE
- {
- SheetMap mSheetMap;
-@@ -145,14 +167,24 @@ public:
- class SheetsEnumeration : public EnumerationHelperImpl
- {
- uno::Reference< frame::XModel > m_xModel;
-- uno::WeakReference< XHelperInterface > m_xParent;
- public:
-- SheetsEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration, const uno::Reference< frame::XModel >& xModel ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xContext, xEnumeration ), m_xModel( xModel ), m_xParent( xParent ) {}
-+ SheetsEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration, const uno::Reference< frame::XModel >& xModel ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xParent, xContext, xEnumeration ), m_xModel( xModel ) {}
-
- virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
- {
- uno::Reference< sheet::XSpreadsheet > xSheet( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
-- return uno::makeAny( uno::Reference< excel::XWorksheet > ( new ScVbaWorksheet( m_xParent, m_xContext, xSheet, m_xModel ) ) );
-+ uno::Reference< uno::XInterface > xIf = lcl_getModulAsUnoObject( xSheet, m_xModel );
-+ uno::Any aRet;
-+ if ( !xIf.is() )
-+ {
-+ // if the Sheet is in a document created by the api unfortunately ( at the
-+ // moment, it actually wont have the special Document modules
-+ uno::Reference< excel::XWorksheet > xNewSheet( new ScVbaWorksheet( m_xParent, m_xContext, xSheet, m_xModel ) );
-+ aRet <<= xNewSheet;
-+ }
-+ else
-+ aRet <<= xIf;
-+ return aRet;
- }
-
- };
-@@ -188,7 +220,18 @@ uno::Any
- ScVbaWorksheets::createCollectionObject( const uno::Any& aSource )
- {
- uno::Reference< sheet::XSpreadsheet > xSheet( aSource, uno::UNO_QUERY );
-- return uno::makeAny( uno::Reference< excel::XWorksheet > ( new ScVbaWorksheet( getParent(), mxContext, xSheet, mxModel ) ) );
-+ uno::Reference< XInterface > xIf = lcl_getModulAsUnoObject( xSheet, mxModel );
-+ uno::Any aRet;
-+ if ( !xIf.is() )
-+ {
-+ // if the Sheet is in a document created by the api unfortunately ( at the
-+ // moment, it actually wont have the special Document modules
-+ uno::Reference< excel::XWorksheet > xNewSheet( new ScVbaWorksheet( getParent(), mxContext, xSheet, mxModel ) );
-+ aRet <<= xNewSheet;
-+ }
-+ else
-+ aRet <<= xIf;
-+ return aRet;
- }
-
- // XWorksheets
-diff --git sc/source/ui/vba/vbawsfunction.cxx sc/source/ui/vba/vbawsfunction.cxx
-index a22bc3f..6242560 100644
---- sc/source/ui/vba/vbawsfunction.cxx
-+++ sc/source/ui/vba/vbawsfunction.cxx
-@@ -71,13 +71,58 @@ ScVbaWSFunction::invoke(const rtl::OUString& FunctionName, const uno::Sequence<
-
- for (int i=0; i < Params.getLength();i++)
- {
-+ aArrayTemp[i]= aArray[i];
- uno::Reference<excel::XRange> myRange( aArray[ i ], uno::UNO_QUERY );
- if ( myRange.is() )
- {
- aArrayTemp[i] = myRange->getCellRange();
- continue;
- }
-- aArrayTemp[i]= aArray[i];
-+ else if ( aArray[ i ].getValueType().getTypeClass() == uno::TypeClass_BOOLEAN )
-+ {
-+ sal_Bool bValue( sal_False );
-+ aArray[ i ] >>= bValue;
-+ if ( bValue )
-+ aArrayTemp[ i ] <<= double( 1.0 );
-+ else
-+ aArrayTemp[ i ] <<= double( 0.0 );
-+
-+ }
-+ else if ( aArray[ i ].getValueType().getTypeClass() == uno::TypeClass_SEQUENCE )
-+ {
-+ // the sheet.FunctionAccess service doesn't deal with Sequences, only Sequences of Sequence
-+ uno::Type aType = aArray[ i ].getValueType();
-+ if ( aType.equals( getCppuType( (uno::Sequence<sal_Int16>*)0 ) ) )
-+ {
-+ uno::Sequence< uno::Sequence< sal_Int16 > > aTmp(1);
-+ aArray[ i ] >>= aTmp[ 0 ];
-+ aArrayTemp[i] <<= aTmp;
-+ }
-+ else if ( aType.equals( getCppuType( (uno::Sequence<sal_Int32>*)0 ) ) )
-+ {
-+ uno::Sequence< uno::Sequence< sal_Int32 > > aTmp(1);
-+ aArray[ i ] >>= aTmp[ 0 ];
-+ aArrayTemp[i] <<= aTmp;
-+ }
-+ else if ( aType.equals( getCppuType( (uno::Sequence<double>*)0 ) ) )
-+ {
-+ uno::Sequence< uno::Sequence< double > > aTmp(1);
-+ aArray[ i ] >>= aTmp[ 0 ];
-+ aArrayTemp[i] <<= aTmp;
-+ }
-+ else if ( aType.equals( getCppuType( (uno::Sequence<rtl::OUString>*)0 ) ) )
-+ {
-+ uno::Sequence< uno::Sequence< rtl::OUString > > aTmp(1);
-+ aArray[ i ] >>= aTmp[ 0 ];
-+ aArrayTemp[i] <<= aTmp;
-+ }
-+ else if ( aType.equals( getCppuType( (uno::Sequence<uno::Any>*)0 ) ) )
-+ {
-+ uno::Sequence< uno::Sequence<uno::Any > > aTmp(1);
-+ aArray[ i ] >>= aTmp[ 0 ];
-+ aArrayTemp[i] <<= aTmp;
-+ }
-+ }
- }
-
- for ( int count=0; count < aParamTemp.getLength(); ++count )
-@@ -85,12 +130,13 @@ ScVbaWSFunction::invoke(const rtl::OUString& FunctionName, const uno::Sequence<
- count, rtl::OUStringToOString( comphelper::anyToString( aParamTemp[count] ), RTL_TEXTENCODING_UTF8 ).getStr() );
-
- uno::Any aRet = xFunctionAccess->callFunction(FunctionName,aParamTemp);
-+
- // MATCH function should alwayse return a double value, but currently if the first argument is XCellRange, MATCH function returns an array instead of a double value. Don't know why?
- // To fix this issue in safe, current solution is to convert this array to a double value just for MATCH function.
- String aUpper( FunctionName );
- ScCompiler aCompiler( NULL, ScAddress() );
- OpCode eOp = aCompiler.GetEnglishOpCode( aUpper.ToUpperAscii() );
-- if( eOp == ocMatch )
-+ if( eOp == ocMatch || eOp == ocIsError )
- {
- double fVal = 0.0;
- if( aRet >>= fVal )
-diff --git sc/source/ui/view/cellsh2.cxx sc/source/ui/view/cellsh2.cxx
-index 3908596..f4ba3d5 100644
---- sc/source/ui/view/cellsh2.cxx
-+++ sc/source/ui/view/cellsh2.cxx
-@@ -345,6 +345,20 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
- }
- break;
-
-+ case SID_DATA_FORM:
-+ {
-+ ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
-+ DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
-+
-+ AbstractScDataFormDlg* pDlg = pFact->CreateScDataFormDlg( pTabViewShell->GetDialogParent(),RID_SCDLG_DATAFORM, pTabViewShell);
-+ DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001
-+
-+ pDlg->Execute();
-+
-+ rReq.Done();
-+ }
-+ break;
-+
- case SID_SUBTOTALS:
- {
- const SfxItemSet* pArgs = rReq.GetArgs();
-diff --git sc/source/ui/view/gridwin.cxx sc/source/ui/view/gridwin.cxx
-index dc2c636..98a923a 100644
---- sc/source/ui/view/gridwin.cxx
-+++ sc/source/ui/view/gridwin.cxx
-@@ -129,7 +129,13 @@
- #include <vcl/svapp.hxx>
- #include <svx/sdr/overlay/overlayselection.hxx>
-
-+#include "cellsuno.hxx"
-+
-+#include <com/sun/star/document/XVbaEventsHelper.hpp>
-+#include <com/sun/star/document/VbaEventId.hpp>
-+
- using namespace com::sun::star;
-+using namespace com::sun::star::document::VbaEventId;
- using ::com::sun::star::uno::Sequence;
- using ::com::sun::star::uno::Any;
-
-@@ -371,6 +377,32 @@ void lcl_UnLockComment( ScDrawView* pView, SdrPageView* pPV, SdrModel* pDrDoc, c
- }
- }
-
-+sal_Bool lcl_GetHyperlinkCell(ScDocument* pDoc, SCCOL& rPosX, SCROW& rPosY, SCTAB nTab, ScBaseCell*& rpCell )
-+{
-+ BOOL bFound = FALSE;
-+ do
-+ {
-+ pDoc->GetCell( rPosX, rPosY, nTab, rpCell );
-+ if ( !rpCell || rpCell->GetCellType() == CELLTYPE_NOTE )
-+ {
-+ if ( rPosX <= 0 )
-+ return FALSE; // alles leer bis links
-+ else
-+ --rPosX; // weitersuchen
-+ }
-+ else if ( rpCell->GetCellType() == CELLTYPE_EDIT)
-+ bFound = TRUE;
-+ else if (rpCell->GetCellType() == CELLTYPE_FORMULA &&
-+ static_cast<ScFormulaCell*>(rpCell)->IsHyperLinkCell())
-+ bFound = TRUE;
-+ else
-+ return FALSE; // andere Zelle
-+ }
-+ while ( !bFound );
-+
-+ return bFound;
-+}
-+
- // ---------------------------------------------------------------------------
- // WB_DIALOGCONTROL noetig fuer UNO-Controls
- ScGridWindow::ScGridWindow( Window* pParent, ScViewData* pData, ScSplitPos eWhichPos )
-@@ -1491,6 +1523,7 @@ void ScGridWindow::HandleMouseButtonDown( const MouseEvent& rMEvt )
- SCCOL nOldColFBox = bWasFilterBox ? pFilterBox->GetCol() : 0;
- SCROW nOldRowFBox = bWasFilterBox ? pFilterBox->GetRow() : 0;
- #endif
-+#include "cellsuno.hxx"
-
- ClickExtern(); // loescht FilterBox, wenn vorhanden
-
-@@ -2126,6 +2159,26 @@ void __EXPORT ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt )
- {
- nMouseStatus = SC_GM_NONE; // keinen Doppelklick anfangen
- ScGlobal::OpenURL( aUrl, aTarget );
-+
-+ // fire worksheet_followhyperlink event
-+ Point aPos = rMEvt.GetPosPixel();
-+ SCsCOL nPosX;
-+ SCsROW nPosY;
-+ SCTAB nTab = pViewData->GetTabNo();
-+ pViewData->GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY );
-+ ScBaseCell* pCell = NULL;
-+
-+ BOOL bFound = lcl_GetHyperlinkCell( pDoc, nPosX, nPosY, nTab, pCell );
-+ if( bFound )
-+ {
-+ ScAddress aCellPos( nPosX, nPosY, nTab );
-+ ScCellObj* pObj = new ScCellObj( pViewData->GetDocShell(), aCellPos );
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] = uno::makeAny(uno::Reference<uno::XInterface>(static_cast<cppu::OWeakObject*>(pObj)));
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper ( pViewData->GetDocument()->GetVbaEventsHelper(), uno::UNO_QUERY );
-+ if( xVbaEventsHelper.is() )
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKSHEET_FOLLOWHYPERLINK, aArgs );
-+ }
- return;
- }
- }
-@@ -4887,26 +4940,9 @@ BOOL ScGridWindow::GetEditUrlOrError( BOOL bSpellErr, const Point& rPos,
- ScDocument* pDoc = pDocSh->GetDocument();
- ScBaseCell* pCell = NULL;
-
-- BOOL bFound = FALSE;
-- do
-- {
-- pDoc->GetCell( nPosX, nPosY, nTab, pCell );
-- if ( !pCell || pCell->GetCellType() == CELLTYPE_NOTE )
-- {
-- if ( nPosX <= 0 )
-- return FALSE; // alles leer bis links
-- else
-- --nPosX; // weitersuchen
-- }
-- else if ( pCell->GetCellType() == CELLTYPE_EDIT)
-- bFound = TRUE;
-- else if (pCell->GetCellType() == CELLTYPE_FORMULA &&
-- static_cast<ScFormulaCell*>(pCell)->IsHyperLinkCell())
-- bFound = TRUE;
-- else
-- return FALSE; // andere Zelle
-- }
-- while ( !bFound );
-+ BOOL bFound = lcl_GetHyperlinkCell( pDoc, nPosX, nPosY, nTab, pCell );
-+ if( !bFound )
-+ return FALSE;
-
- ScHideTextCursor aHideCursor( pViewData, eWhich ); // before GetEditArea (MapMode is changed)
-
-diff --git sc/source/ui/view/gridwin5.cxx sc/source/ui/view/gridwin5.cxx
-index 821d5da..d9e10ef 100644
---- sc/source/ui/view/gridwin5.cxx
-+++ sc/source/ui/view/gridwin5.cxx
-@@ -343,14 +343,12 @@ void ScGridWindow::RequestHelp(const HelpEvent& rHEvt)
- if ( pDrView->PickObj(aMDPos, pDrView->getHitTolLog(), pHit, pPV, SDRSEARCH_DEEP ) )
- pObj = pHit;
- }
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
- ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( pObj );
- if ( pInfo && (pInfo->GetHlink().getLength() > 0) )
- {
- aPixRect = LogicToPixel(aVEvt.pObj->GetLogicRect());
- aHelpText = pInfo->GetHlink();
- }
--#endif
- }
- }
- }
-diff --git sc/source/ui/view/tabview3.cxx sc/source/ui/view/tabview3.cxx
-index 061e3e4..2b31aa4 100644
---- sc/source/ui/view/tabview3.cxx
-+++ sc/source/ui/view/tabview3.cxx
-@@ -80,6 +80,10 @@
- #include "formula/FormulaCompiler.hxx"
-
- #include <com/sun/star/chart2/data/HighlightedRange.hpp>
-+#include <com/sun/star/document/XVbaEventsHelper.hpp>
-+#include <com/sun/star/document/VbaEventId.hpp>
-+
-+using namespace com::sun::star::document::VbaEventId;
-
- namespace
- {
-@@ -1419,10 +1423,12 @@ void ScTabView::MarkRange( const ScRange& rRange, BOOL bSetCursor, BOOL bContinu
- {
- SCCOL nAlignX = rRange.aStart.Col();
- SCROW nAlignY = rRange.aStart.Row();
-- if ( rRange.aStart.Col() == 0 && rRange.aEnd.Col() == MAXCOL )
-- nAlignX = aViewData.GetPosX(WhichH(aViewData.GetActivePart()));
-- if ( rRange.aStart.Row() == 0 && rRange.aEnd.Row() == MAXROW )
-- nAlignY = aViewData.GetPosY(WhichV(aViewData.GetActivePart()));
-+ bool bCol = ( rRange.aStart.Col() == 0 && rRange.aEnd.Col() == MAXCOL ) && !aViewData.GetDocument()->IsInVBAMode();
-+ bool bRow = ( rRange.aStart.Row() == 0 && rRange.aEnd.Row() == MAXROW );
-+ if ( bCol )
-+ nAlignX = aViewData.GetPosX(WhichH(aViewData.GetActivePart()));
-+ if ( bRow )
-+ nAlignY = aViewData.GetPosY(WhichV(aViewData.GetActivePart()));
- AlignToCursor( nAlignX, nAlignY, SC_FOLLOW_JUMP );
- }
- InitBlockMode( rRange.aStart.Col(), rRange.aStart.Row(), nTab );
-@@ -1535,6 +1544,17 @@ void ScTabView::SetTabNo( SCTAB nTab, BOOL bNew, BOOL bExtendSelection )
- // nicht InputEnterHandler wegen Referenzeingabe !
-
- ScDocument* pDoc = aViewData.GetDocument();
-+ if( !bNew )
-+ {
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper ( pDoc->GetVbaEventsHelper(), uno::UNO_QUERY );
-+ if( xVbaEventsHelper.is() )
-+ {
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] <<= aViewData.GetTabNo();
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKSHEET_DEACTIVATE, aArgs );
-+ }
-+ }
-+
- pDoc->MakeTable( nTab );
-
- // Update pending row heights before switching the sheet, so Reschedule from the progress bar
-@@ -1639,8 +1659,20 @@ void ScTabView::SetTabNo( SCTAB nTab, BOOL bNew, BOOL bExtendSelection )
- if ( pGridWin[i]->IsVisible() )
- pGridWin[i]->UpdateEditViewPos();
- }
-+
-+ TabChanged(); // DrawView
-
-- TabChanged(); // DrawView
-+ if( !bNew )
-+ {
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper ( pDoc->GetVbaEventsHelper(), uno::UNO_QUERY );
-+ if( xVbaEventsHelper.is() )
-+ {
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] <<= aViewData.GetTabNo();
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKSHEET_ACTIVATE, aArgs );
-+ }
-+ }
-+
- aViewData.GetViewShell()->WindowChanged(); // falls das aktive Fenster anders ist
- if ( !bUnoRefDialog )
- aViewData.GetViewShell()->DisconnectAllClients(); // important for floating frames
-diff --git sc/source/ui/view/tabvwsh4.cxx sc/source/ui/view/tabvwsh4.cxx
-index 095a6f3..43dd17a 100644
---- sc/source/ui/view/tabvwsh4.cxx
-+++ sc/source/ui/view/tabvwsh4.cxx
-@@ -1799,6 +1799,13 @@ void ScTabViewShell::Construct( BYTE nForceDesignMode )
- if ( pDocSh->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED )
- {
- SCTAB nInitTabCount = 3; //! konfigurierbar !!!
-+ // Get the customized initial tab count, we only can set the count by VBA API currently.
-+ const ScAppOptions& rAppOpt = SC_MOD()->GetAppOptions();
-+ SCTAB nNewTabCount = rAppOpt.GetTabCountInNewSpreadsheet();
-+ if ( nNewTabCount >= 1 && nNewTabCount <= MAXTAB )
-+ {
-+ nInitTabCount = nNewTabCount;
-+ }
- for (SCTAB i=1; i<nInitTabCount; i++)
- pDoc->MakeTable(i,false);
- }
-diff --git sc/source/ui/view/viewfun2.cxx sc/source/ui/view/viewfun2.cxx
-index 9f2bc5e..dea6ace 100644
---- sc/source/ui/view/viewfun2.cxx
-+++ sc/source/ui/view/viewfun2.cxx
-@@ -54,6 +54,11 @@
- #include <vcl/sound.hxx>
- #include <vcl/waitobj.hxx>
-
-+#include <basic/sbstar.hxx>
-+#include <com/sun/star/container/XNameContainer.hpp>
-+#include <com/sun/star/script/XLibraryContainer.hpp>
-+using namespace com::sun::star;
-+
- #include "viewfunc.hxx"
-
- #include "sc.hrc"
-@@ -2225,6 +2230,8 @@ BOOL ScViewFunc::DeleteTables(const SvShorts &TheTabs, BOOL bRecord )
- WaitObject aWait( GetFrameWin() );
- if (bRecord && !pDoc->IsUndoEnabled())
- bRecord = FALSE;
-+ if ( bVbaEnabled )
-+ bRecord = FALSE;
-
- while ( nNewTab > 0 && !pDoc->IsVisible( nNewTab ) )
- --nNewTab;
-@@ -2330,6 +2337,7 @@ BOOL ScViewFunc::DeleteTables(const SvShorts &TheTabs, BOOL bRecord )
- pDocSh->PostPaintExtras();
- pDocSh->SetDocumentModified();
-
-+
- SfxApplication* pSfxApp = SFX_APP(); // Navigator
- pSfxApp->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) );
- pSfxApp->Broadcast( SfxSimpleHint( SC_HINT_DBAREAS_CHANGED ) );
-@@ -2474,8 +2482,8 @@ void ScViewFunc::ImportTables( ScDocShell* pSrcShell,
- {
- SCTAB nSrcTab = pSrcTabs[i];
- SCTAB nDestTab1=nTab+i;
-- ULONG nErrVal = pDoc->TransferTab( pSrcDoc, nSrcTab, nDestTab1,
-- FALSE ); // no insert
-+ ULONG nErrVal = pDocSh->TransferTab( *pSrcShell, nSrcTab, nDestTab1,
-+ FALSE, FALSE ); // no insert
-
- switch (nErrVal)
- {
-@@ -2493,25 +2501,6 @@ void ScViewFunc::ImportTables( ScDocShell* pSrcShell,
- break;
- }
-
-- // TransferTab doesn't copy drawing objects with bInsertNew=FALSE
-- if ( !bError )
-- pDoc->TransferDrawPage( pSrcDoc, nSrcTab, nDestTab1 );
--
-- if(!bError &&pSrcDoc->IsScenario(nSrcTab))
-- {
-- String aComment;
-- Color aColor;
-- USHORT nFlags;
--
-- pSrcDoc->GetScenarioData(nSrcTab, aComment,aColor, nFlags);
-- pDoc->SetScenario( nDestTab1,TRUE);
-- pDoc->SetScenarioData( nTab+i,aComment,aColor,nFlags);
-- BOOL bActive = pSrcDoc->IsActiveScenario(nSrcTab );
-- pDoc->SetActiveScenario( nDestTab1, bActive );
-- BOOL bVisible=pSrcDoc->IsVisible(nSrcTab);
-- pDoc->SetVisible(nDestTab1,bVisible );
--
-- }
- }
-
- if (bLink)
-@@ -2695,33 +2684,7 @@ void ScViewFunc::MoveTable( USHORT nDestDocNo, SCTAB nDestTab, BOOL bCopy )
- nDestTab1 = nDestTab;
- for(USHORT i=0;i<TheTabs.Count();i++)
- {
-- nErrVal = pDestDoc->TransferTab( pDoc, TheTabs[i], nDestTab1,
-- FALSE ); // no insert
--
-- // TransferTab doesn't copy drawing objects with bInsertNew=FALSE
-- if ( nErrVal > 0 )
-- pDestDoc->TransferDrawPage( pDoc, TheTabs[i], nDestTab1 );
--
-- if(nErrVal>0 && pDoc->IsScenario(TheTabs[i]))
-- {
-- String aComment;
-- Color aColor;
-- USHORT nFlags;
--
-- pDoc->GetScenarioData(TheTabs[i], aComment,aColor, nFlags);
-- pDestDoc->SetScenario(nDestTab1,TRUE);
-- pDestDoc->SetScenarioData(nDestTab1,aComment,aColor,nFlags);
-- BOOL bActive = pDoc->IsActiveScenario(TheTabs[i]);
-- pDestDoc->SetActiveScenario(nDestTab1, bActive );
--
-- BOOL bVisible=pDoc->IsVisible(TheTabs[i]);
-- pDestDoc->SetVisible(nDestTab1,bVisible );
--
-- }
--
-- if ( nErrVal > 0 && pDoc->IsTabProtected( TheTabs[i] ) )
-- pDestDoc->SetTabProtection(nDestTab1, pDoc->GetTabProtection(TheTabs[i]));
--
-+ nErrVal = pDestShell->TransferTab( *pDocShell, static_cast<SCTAB>(TheTabs[i]), static_cast<SCTAB>(nDestTab1), FALSE, FALSE );
- nDestTab1++;
- }
- }
-diff --git sc/source/ui/view/viewfun3.cxx sc/source/ui/view/viewfun3.cxx
-index bc4a981..c40ec38 100644
---- sc/source/ui/view/viewfun3.cxx
-+++ sc/source/ui/view/viewfun3.cxx
-@@ -210,6 +210,7 @@
- #include "drwtrans.hxx"
- #include "docuno.hxx"
- #include "clipparam.hxx"
-+#include "undodat.hxx" // Amelia Wang
-
- using namespace com::sun::star;
-
-@@ -1784,6 +1785,85 @@ BOOL ScViewFunc::LinkBlock( const ScRange& rSource, const ScAddress& rDestPos, B
- return TRUE;
- }
-
-+void ScViewFunc::DataFormPutData( SCROW nCurrentRow ,
-+ SCROW nStartRow , SCCOL nStartCol ,
-+ SCROW nEndRow , SCCOL nEndCol ,
-+ Edit** pEdits ,
-+ sal_uInt16 aColLength )
-+{
-+ ScDocument* pDoc = GetViewData()->GetDocument();
-+ ScDocShell* pDocSh = GetViewData()->GetDocShell();
-+ ScMarkData& rMark = GetViewData()->GetMarkData();
-+ ScDocShellModificator aModificator( *pDocSh );
-+ SfxUndoManager* pUndoMgr = pDocSh->GetUndoManager();
-+ if ( pDoc )
-+ {
-+ const BOOL bRecord( pDoc->IsUndoEnabled());
-+ ScDocument* pUndoDoc = NULL;
-+ ScDocument* pRedoDoc = NULL;
-+ ScDocument* pRefUndoDoc = NULL;
-+ ScRefUndoData* pUndoData = NULL;
-+ SCTAB nTab = GetViewData()->GetTabNo();
-+ SCTAB nStartTab = nTab;
-+ SCTAB nEndTab = nTab;
-+
-+ {
-+ ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
-+ if ( pChangeTrack )
-+ pChangeTrack->ResetLastCut(); // kein CutMode mehr
-+ }
-+ ScRange aUserRange( nStartCol, nCurrentRow, nStartTab, nEndCol, nCurrentRow, nEndTab );
-+ BOOL bColInfo = ( nStartRow==0 && nEndRow==MAXROW );
-+ BOOL bRowInfo = ( nStartCol==0 && nEndCol==MAXCOL );
-+ SCCOL nUndoEndCol = nStartCol+aColLength-1;
-+ SCROW nUndoEndRow = nCurrentRow;
-+ USHORT nUndoFlags = IDF_NONE;
-+
-+ if ( bRecord )
-+ {
-+ pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
-+ pUndoDoc->InitUndoSelected( pDoc , rMark , bColInfo , bRowInfo );
-+ pDoc->CopyToDocument( aUserRange , 1 , FALSE , pUndoDoc );
-+ }
-+ USHORT nExtFlags = 0;
-+ pDocSh->UpdatePaintExt( nExtFlags, nStartCol, nStartRow, nStartTab , nEndCol, nEndRow, nEndTab ); // content before the change
-+ //rMark.SetMarkArea( aUserRange );
-+ pDoc->BeginDrawUndo();
-+
-+ for(sal_uInt16 i = 0; i < aColLength; i++)
-+ {
-+ if (pEdits[i])
-+ {
-+ String aFieldName=pEdits[i]->GetText();
-+ pDoc->SetString( nStartCol + i, nCurrentRow, nTab, aFieldName );
-+ }
-+ }
-+ //pDoc->ExtendMergeSel( nStartCol, nStartRow, nEndCol, nEndRow, rMark, TRUE ); // Refresh
-+ pDocSh->UpdatePaintExt( nExtFlags, nStartCol, nCurrentRow, nStartTab, nEndCol, nCurrentRow, nEndTab ); // content after the change
-+ SfxUndoAction* pUndo = new ScUndoDataForm( pDocSh,
-+ nStartCol, nCurrentRow, nStartTab,
-+ nUndoEndCol, nUndoEndRow, nEndTab, rMark,
-+ pUndoDoc, pRedoDoc, nUndoFlags,
-+ pUndoData, NULL, NULL, NULL,
-+ FALSE ); // FALSE = Redo data not yet copied
-+ pUndoMgr->AddUndoAction( new ScUndoWrapper( pUndo ), TRUE );
-+
-+ USHORT nPaint = PAINT_GRID;
-+ if (bColInfo)
-+ {
-+ nPaint |= PAINT_TOP;
-+ nUndoEndCol = MAXCOL; // nur zum Zeichnen !
-+ }
-+ if (bRowInfo)
-+ {
-+ nPaint |= PAINT_LEFT;
-+ nUndoEndRow = MAXROW; // nur zum Zeichnen !
-+ }
-
-+ pDocSh->PostPaint( nStartCol, nCurrentRow, nStartTab,
-+ nUndoEndCol, nUndoEndRow, nEndTab, nPaint, nExtFlags );
-+ pDocSh->UpdateOle(GetViewData());
-+ }
-+}
-
-
-diff --git sc/uiconfig/scalc/menubar/menubar.xml sc/uiconfig/scalc/menubar/menubar.xml
-index 67ef111..4217aa1 100644
---- sc/uiconfig/scalc/menubar/menubar.xml
-+++ sc/uiconfig/scalc/menubar/menubar.xml
-@@ -403,6 +403,7 @@
- <menu:menuitem menu:id=".uno:DataFilterHideAutoFilter"/>
- </menu:menupopup>
- </menu:menu>
-+ <menu:menuitem menu:id=".uno:DataForm"/>
- <menu:menuitem menu:id=".uno:DataSubTotals"/>
- <menu:menuitem menu:id=".uno:Validation"/>
- <menu:menuseparator/>
-diff --git sc/util/makefile.mk sc/util/makefile.mk
-index d9e23b5..676d345 100644
---- sc/util/makefile.mk
-+++ sc/util/makefile.mk
-@@ -273,6 +273,7 @@ LIB8OBJFILES = \
- $(SLO)$/filldlg.obj \
- $(SLO)$/delcodlg.obj \
- $(SLO)$/delcldlg.obj \
-+ $(SLO)$/datafdlg.obj \
- $(SLO)$/dapitype.obj \
- $(SLO)$/dapidata.obj \
- $(SLO)$/crdlg.obj \
-@@ -315,8 +316,9 @@ SHL9STDLIBS= \
- $(ISCLIB) \
- $(VCLLIB) \
- $(TKLIB) \
-- $(SVXMSFILTERLIB) \
-- $(FORLIB)
-+ $(MSFILTERLIB) \
-+ $(FORLIB) \
-+ $(UNOTOOLSLIB)
-
- SHL9DEPN=$(SHL1TARGETN) $(SHL8TARGETN)
- SHL9LIBS=$(SLB)$/$(TARGET_VBA).lib
-diff --git scripting/source/basprov/basprov.cxx scripting/source/basprov/basprov.cxx
-index c616371..1fd2f21 100644
---- scripting/source/basprov/basprov.cxx
-+++ scripting/source/basprov/basprov.cxx
-@@ -371,7 +371,33 @@ namespace basprov
- ::rtl::OUString::createFromAscii( "location" ) );
-
- sal_Int32 nIndex = 0;
-- ::rtl::OUString aLibrary = aDescription.getToken( 0, (sal_Unicode)'.', nIndex );
-+ // In some strange circumstances the Library name can have an
-+ // apparantly illegal '.' in it ( in imported VBA )
-+
-+ BasicManager* pBasicMgr = NULL;
-+ if ( aLocation.equals( ::rtl::OUString::createFromAscii("document") ) )
-+ {
-+ pBasicMgr = m_pDocBasicManager;
-+ }
-+ else if ( aLocation.equals( ::rtl::OUString::createFromAscii("application") ) )
-+ {
-+ pBasicMgr = m_pAppBasicManager;
-+ }
-+ rtl::OUString sProjectName;
-+ if ( pBasicMgr )
-+ sProjectName = pBasicMgr->GetName();
-+
-+ ::rtl::OUString aLibrary;
-+ if ( sProjectName.getLength() && aDescription.match( sProjectName ) )
-+ {
-+ OSL_TRACE("LibraryName %s is part of the url %s",
-+ rtl::OUStringToOString( sProjectName, RTL_TEXTENCODING_UTF8 ).getStr(),
-+ rtl::OUStringToOString( aDescription, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ aLibrary = sProjectName;
-+ nIndex = sProjectName.getLength() + 1;
-+ }
-+ else
-+ aLibrary = aDescription.getToken( 0, (sal_Unicode)'.', nIndex );
- ::rtl::OUString aModule;
- if ( nIndex != -1 )
- aModule = aDescription.getToken( 0, (sal_Unicode)'.', nIndex );
-@@ -381,15 +407,6 @@ namespace basprov
-
- if ( aLibrary.getLength() != 0 && aModule.getLength() != 0 && aMethod.getLength() != 0 && aLocation.getLength() != 0 )
- {
-- BasicManager* pBasicMgr = NULL;
-- if ( aLocation.equals( ::rtl::OUString::createFromAscii("document") ) )
-- {
-- pBasicMgr = m_pDocBasicManager;
-- }
-- else if ( aLocation.equals( ::rtl::OUString::createFromAscii("application") ) )
-- {
-- pBasicMgr = m_pAppBasicManager;
-- }
-
- if ( pBasicMgr )
- {
-diff --git scripting/source/basprov/basscript.cxx scripting/source/basprov/basscript.cxx
-index 620e249..e99a346 100644
---- scripting/source/basprov/basscript.cxx
-+++ scripting/source/basprov/basscript.cxx
-@@ -36,7 +36,10 @@
- #include <basic/sbmeth.hxx>
- #include <basic/basmgr.hxx>
- #include <com/sun/star/script/provider/ScriptFrameworkErrorType.hpp>
--
-+#include "bcholder.hxx"
-+#include <comphelper/proparrhlp.hxx>
-+#include <comphelper/propertycontainer.hxx>
-+#include <com/sun/star/beans/PropertyAttribute.hpp>
- #include <map>
-
-
-@@ -45,6 +48,7 @@ using namespace ::com::sun::star::lang;
- using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::script;
- using namespace ::com::sun::star::document;
-+using namespace ::com::sun::star::beans;
-
- extern ::com::sun::star::uno::Any sbxToUnoValue( SbxVariable* pVar );
- extern void unoToSbxValue( SbxVariable* pVar, const ::com::sun::star::uno::Any& aValue );
-@@ -54,6 +58,10 @@ extern void unoToSbxValue( SbxVariable* pVar, const ::com::sun::star::uno::Any&
- namespace basprov
- {
- //.........................................................................
-+#define BASSCRIPT_PROPERTY_ID_CALLER 1
-+#define BASSCRIPT_PROPERTY_CALLER ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Caller" ) )
-+
-+#define BASSCRIPT_DEFAULT_ATTRIBS() PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT
-
- typedef ::std::map< sal_Int16, Any, ::std::less< sal_Int16 > > OutParamMap;
-
-@@ -64,22 +72,28 @@ namespace basprov
- // -----------------------------------------------------------------------------
-
- BasicScriptImpl::BasicScriptImpl( const ::rtl::OUString& funcName, SbMethodRef xMethod )
-- :m_xMethod( xMethod )
-+ : ::scripting_helper::OBroadcastHelperHolder( m_aMutex )
-+ ,OPropertyContainer( GetBroadcastHelper() )
-+ ,m_xMethod( xMethod )
- ,m_funcName( funcName )
- ,m_documentBasicManager( NULL )
- ,m_xDocumentScriptContext()
- {
-+ registerProperty( BASSCRIPT_PROPERTY_CALLER, BASSCRIPT_PROPERTY_ID_CALLER, BASSCRIPT_DEFAULT_ATTRIBS(), &m_caller, ::getCppuType( &m_caller ) );
- }
-
- // -----------------------------------------------------------------------------
-
- BasicScriptImpl::BasicScriptImpl( const ::rtl::OUString& funcName, SbMethodRef xMethod,
-- BasicManager& documentBasicManager, const Reference< XScriptInvocationContext >& documentScriptContext )
-- :m_xMethod( xMethod )
-+ BasicManager& documentBasicManager, const Reference< XScriptInvocationContext >& documentScriptContext ) : ::scripting_helper::OBroadcastHelperHolder( m_aMutex )
-+ ,OPropertyContainer( GetBroadcastHelper() )
-+ ,m_xMethod( xMethod )
- ,m_funcName( funcName )
- ,m_documentBasicManager( &documentBasicManager )
- ,m_xDocumentScriptContext( documentScriptContext )
- {
-+ //
-+ registerProperty( BASSCRIPT_PROPERTY_CALLER, BASSCRIPT_PROPERTY_ID_CALLER, BASSCRIPT_DEFAULT_ATTRIBS(), &m_caller, ::getCppuType( &m_caller ) );
- }
-
- // -----------------------------------------------------------------------------
-@@ -88,6 +102,48 @@ namespace basprov
- }
-
- // -----------------------------------------------------------------------------
-+ // XInterface
-+ // -----------------------------------------------------------------------------
-+
-+ IMPLEMENT_FORWARD_XINTERFACE2( BasicScriptImpl, BasicScriptImpl_BASE, OPropertyContainer )
-+
-+ // -----------------------------------------------------------------------------
-+ // XTypeProvider
-+ // -----------------------------------------------------------------------------
-+
-+ IMPLEMENT_FORWARD_XTYPEPROVIDER2( BasicScriptImpl, BasicScriptImpl_BASE, OPropertyContainer )
-+
-+ // -----------------------------------------------------------------------------
-+ // OPropertySetHelper
-+ // -----------------------------------------------------------------------------
-+
-+ ::cppu::IPropertyArrayHelper& BasicScriptImpl::getInfoHelper( )
-+ {
-+ return *getArrayHelper();
-+ }
-+
-+ // -----------------------------------------------------------------------------
-+ // OPropertyArrayUsageHelper
-+ // -----------------------------------------------------------------------------
-+
-+ ::cppu::IPropertyArrayHelper* BasicScriptImpl::createArrayHelper( ) const
-+ {
-+ Sequence< Property > aProps;
-+ describeProperties( aProps );
-+ return new ::cppu::OPropertyArrayHelper( aProps );
-+ }
-+
-+ // -----------------------------------------------------------------------------
-+ // XPropertySet
-+ // -----------------------------------------------------------------------------
-+
-+ Reference< XPropertySetInfo > BasicScriptImpl::getPropertySetInfo( ) throw (RuntimeException)
-+ {
-+ Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
-+ return xInfo;
-+ }
-+
-+ // -----------------------------------------------------------------------------
- // XScript
- // -----------------------------------------------------------------------------
-
-@@ -166,8 +222,14 @@ namespace basprov
- if ( m_documentBasicManager && m_xDocumentScriptContext.is() )
- aOldThisComponent = m_documentBasicManager->SetGlobalUNOConstant( "ThisComponent", makeAny( m_xDocumentScriptContext ) );
-
-+ if ( m_caller.getLength() && m_caller[ 0 ].hasValue() )
-+ {
-+ SbxVariableRef xCallerVar = new SbxVariable( SbxVARIANT );
-+ unoToSbxValue( static_cast< SbxVariable* >( xCallerVar ), m_caller[ 0 ] );
-+ nErr = m_xMethod->Call( xReturn, xCallerVar );
-+ }
-+ else
- nErr = m_xMethod->Call( xReturn );
--
- if ( m_documentBasicManager && m_xDocumentScriptContext.is() )
- m_documentBasicManager->SetGlobalUNOConstant( "ThisComponent", aOldThisComponent );
- }
-diff --git scripting/source/basprov/basscript.hxx scripting/source/basprov/basscript.hxx
-index a524c18..12ac0a0 100644
---- scripting/source/basprov/basscript.hxx
-+++ scripting/source/basprov/basscript.hxx
-@@ -28,12 +28,14 @@
- #ifndef SCRIPTING_BASSCRIPT_HXX
- #define SCRIPTING_BASSCRIPT_HXX
-
-+#include "bcholder.hxx"
- #include <com/sun/star/script/provider/XScript.hpp>
- #include <com/sun/star/document/XScriptInvocationContext.hpp>
- #include <cppuhelper/implbase1.hxx>
-+#include <comphelper/proparrhlp.hxx>
-+#include <comphelper/propertycontainer.hxx>
- #include <basic/sbmeth.hxx>
-
--
- class BasicManager;
-
- //.........................................................................
-@@ -49,7 +51,11 @@ namespace basprov
- ::com::sun::star::script::provider::XScript > BasicScriptImpl_BASE;
-
-
-- class BasicScriptImpl : public BasicScriptImpl_BASE
-+ class BasicScriptImpl : public BasicScriptImpl_BASE,
-+ public ::scripting_helper::OMutexHolder,
-+ public ::scripting_helper::OBroadcastHelperHolder,
-+ public ::comphelper::OPropertyContainer,
-+ public ::comphelper::OPropertyArrayUsageHelper< BasicScriptImpl >
- {
- private:
- SbMethodRef m_xMethod;
-@@ -57,6 +63,16 @@ namespace basprov
- BasicManager* m_documentBasicManager;
- ::com::sun::star::uno::Reference< ::com::sun::star::document::XScriptInvocationContext >
- m_xDocumentScriptContext;
-+ // hack, OPropertyContainer doesn't allow you to define a property of unknown
-+ // type ( I guess because an Any can't contain an Any... I've always wondered why?
-+ // as its not unusual to do that in corba )
-+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > m_caller;
-+ protected:
-+ // OPropertySetHelper
-+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper( );
-+
-+ // OPropertyArrayUsageHelper
-+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
-
- public:
- BasicScriptImpl(
-@@ -71,6 +87,12 @@ namespace basprov
- );
- virtual ~BasicScriptImpl();
-
-+ // XInterface
-+ DECLARE_XINTERFACE()
-+
-+ // XTypeProvider
-+ DECLARE_XTYPEPROVIDER()
-+
- // XScript
- virtual ::com::sun::star::uno::Any SAL_CALL invoke(
- const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aParams,
-@@ -80,6 +102,9 @@ namespace basprov
- ::com::sun::star::script::provider::ScriptFrameworkErrorException,
- ::com::sun::star::reflection::InvocationTargetException,
- ::com::sun::star::uno::RuntimeException );
-+ // XPropertySet
-+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( )
-+ throw (::com::sun::star::uno::RuntimeException);
- };
-
- //.........................................................................
-diff --git scripting/source/dlgprov/dlgevtatt.cxx scripting/source/dlgprov/dlgevtatt.cxx
-index 11a1014..2d8c853 100644
---- scripting/source/dlgprov/dlgevtatt.cxx
-+++ scripting/source/dlgprov/dlgevtatt.cxx
-@@ -108,13 +108,14 @@ namespace dlgprov
- {
- protected:
- rtl::OUString msDialogCodeName;
-+ rtl::OUString msDialogLibName;
- Reference< script::XScriptListener > mxListener;
- virtual void firing_impl( const script::ScriptEvent& aScriptEvent, uno::Any* pRet );
- public:
-- DialogVBAScriptListenerImpl( const Reference< XComponentContext >& rxContext, const Reference< awt::XControl >& rxControl, const Reference< frame::XModel >& xModel );
-+ DialogVBAScriptListenerImpl( const Reference< XComponentContext >& rxContext, const Reference< awt::XControl >& rxControl, const Reference< frame::XModel >& xModel, const rtl::OUString& sDialogLibName );
- };
-
-- DialogVBAScriptListenerImpl::DialogVBAScriptListenerImpl( const Reference< XComponentContext >& rxContext, const Reference< awt::XControl >& rxControl, const Reference< frame::XModel >& xModel ) : DialogScriptListenerImpl( rxContext )
-+ DialogVBAScriptListenerImpl::DialogVBAScriptListenerImpl( const Reference< XComponentContext >& rxContext, const Reference< awt::XControl >& rxControl, const Reference< frame::XModel >& xModel, const rtl::OUString& sDialogLibName ) : DialogScriptListenerImpl( rxContext ), msDialogLibName( sDialogLibName )
- {
- Reference< XMultiComponentFactory > xSMgr( m_xContext->getServiceManager() );
- Sequence< Any > args(1);
-@@ -145,7 +146,7 @@ namespace dlgprov
- if ( aScriptEvent.ScriptType.equals( rtl::OUString::createFromAscii("VBAInterop") ) && mxListener.is() )
- {
- ScriptEvent aScriptEventCopy( aScriptEvent );
-- aScriptEventCopy.ScriptCode = msDialogCodeName;
-+ aScriptEventCopy.ScriptCode = msDialogLibName.concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "." ) ) ).concat( msDialogCodeName );
- try
- {
- mxListener->firing( aScriptEventCopy );
-@@ -163,7 +164,7 @@ namespace dlgprov
- // DialogEventsAttacherImpl
- // =============================================================================
-
-- DialogEventsAttacherImpl::DialogEventsAttacherImpl( const Reference< XComponentContext >& rxContext, const Reference< frame::XModel >& rxModel, const Reference< awt::XControl >& rxControl, const Reference< XInterface >& rxHandler, const Reference< beans::XIntrospectionAccess >& rxIntrospect, bool bProviderMode, const Reference< script::XScriptListener >& rxRTLListener )
-+ DialogEventsAttacherImpl::DialogEventsAttacherImpl( const Reference< XComponentContext >& rxContext, const Reference< frame::XModel >& rxModel, const Reference< awt::XControl >& rxControl, const Reference< XInterface >& rxHandler, const Reference< beans::XIntrospectionAccess >& rxIntrospect, bool bProviderMode, const Reference< script::XScriptListener >& rxRTLListener, const rtl::OUString& sDialogLibName )
- :mbUseFakeVBAEvents( false ), m_xContext( rxContext )
- {
- // key listeners by protocol when ScriptType = 'Script'
-@@ -186,11 +187,11 @@ namespace dlgprov
- {
- pFoundShell = reinterpret_cast<SfxObjectShell*>( xObjShellTunnel->getSomething(SfxObjectShell::getUnoTunnelId()));
- if ( pFoundShell )
-- mbUseFakeVBAEvents = ooo::vba::isAlienExcelDoc( *pFoundShell );
-+ mbUseFakeVBAEvents = ooo::vba::isAlienExcelDoc( *pFoundShell ) || ooo::vba::isAlienWordDoc( *pFoundShell ) ;
- }
- }
- if ( mbUseFakeVBAEvents )
-- listernersForTypes[ rtl::OUString::createFromAscii("VBAInterop") ] = new DialogVBAScriptListenerImpl( rxContext, rxControl, rxModel );
-+ listernersForTypes[ rtl::OUString::createFromAscii("VBAInterop") ] = new DialogVBAScriptListenerImpl( rxContext, rxControl, rxModel, sDialogLibName );
- }
-
- // -----------------------------------------------------------------------------
-@@ -217,6 +218,7 @@ namespace dlgprov
- Reference< ooo::vba::XVBAToOOEventDescGen > xVBAToOOEvtDesc( xSMgr->createInstanceWithContext( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAToOOEventDesc" ) ), m_xContext ), UNO_QUERY );
- if ( xVBAToOOEvtDesc.is() )
- xEventsSupplier.set( xVBAToOOEvtDesc->getEventSupplier( xControl, sControlName ), UNO_QUERY );
-+
- }
- return xEventsSupplier;
- }
-@@ -409,7 +411,7 @@ namespace dlgprov
-
- void DialogAllListenerImpl::firing( const AllEventObject& Event ) throw ( RuntimeException )
- {
-- ::osl::MutexGuard aGuard( getMutex() );
-+ //::osl::MutexGuard aGuard( getMutex() );
-
- firing_impl( Event, NULL );
- }
-@@ -419,7 +421,7 @@ namespace dlgprov
- Any DialogAllListenerImpl::approveFiring( const AllEventObject& Event )
- throw ( reflection::InvocationTargetException, RuntimeException )
- {
-- ::osl::MutexGuard aGuard( getMutex() );
-+ //::osl::MutexGuard aGuard( getMutex() );
-
- Any aReturn;
- firing_impl( Event, &aReturn );
-@@ -655,7 +657,7 @@ namespace dlgprov
-
- void DialogScriptListenerImpl::firing( const ScriptEvent& aScriptEvent ) throw ( RuntimeException )
- {
-- ::osl::MutexGuard aGuard( getMutex() );
-+ //::osl::MutexGuard aGuard( getMutex() );
-
- firing_impl( aScriptEvent, NULL );
- }
-@@ -665,7 +667,7 @@ namespace dlgprov
- Any DialogScriptListenerImpl::approveFiring( const ScriptEvent& aScriptEvent )
- throw ( reflection::InvocationTargetException, RuntimeException )
- {
-- ::osl::MutexGuard aGuard( getMutex() );
-+ //::osl::MutexGuard aGuard( getMutex() );
-
- Any aReturn;
- firing_impl( aScriptEvent, &aReturn );
-diff --git scripting/source/dlgprov/dlgevtatt.hxx scripting/source/dlgprov/dlgevtatt.hxx
-index c76ee09..0df79b2 100644
---- scripting/source/dlgprov/dlgevtatt.hxx
-+++ scripting/source/dlgprov/dlgevtatt.hxx
-@@ -78,7 +78,7 @@ namespace dlgprov
- const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xHandler,
- const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XIntrospectionAccess >& xIntrospect,
- bool bProviderMode,
-- const ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptListener >& xRTLListener );
-+ const ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptListener >& xRTLListener ,const rtl::OUString& sDialogLibName );
- virtual ~DialogEventsAttacherImpl();
-
- // XScriptEventsAttacher
-diff --git scripting/source/dlgprov/dlgprov.cxx scripting/source/dlgprov/dlgprov.cxx
-index 49c07a4..aa88326 100644
---- scripting/source/dlgprov/dlgprov.cxx
-+++ scripting/source/dlgprov/dlgprov.cxx
-@@ -189,7 +189,15 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
- Reference< beans::XPropertySet > xDlgPropSet( xDialogModel, UNO_QUERY );
- xDlgPropSet->setPropertyValue( aDlgSrcUrlPropName, aDialogSourceURL );
-
-- ::xmlscript::importDialogModel( xInput, xDialogModel, m_xContext );
-+ // #TODO we really need to detect the source of the Dialog, is it
-+ // located in the document or not. m_xModel need not be the location of
-+ // the dialog. E.g. if the dialog was created from basic ( then we just
-+ // can't tell where its from )
-+ // If we are happy to always substitute the form model for the awt
-+ // one then maybe the presence of a document model is enough to trigger
-+ // swapping out the models ( or perhaps we only want to do this
-+ // for vba mode ) there are a number of feasible and valid possibilities
-+ ::xmlscript::importDialogModel( xInput, xDialogModel, m_xContext, m_xModel );
- // Set resource property
- if( xStringResourceManager.is() )
- {
-@@ -403,6 +411,7 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
-
- if ( xISP.is() )
- xInput = xISP->createInputStream();
-+ msDialogLibName = sLibName;
- }
-
- // import dialog model
-@@ -520,7 +529,7 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
- const Reference< XControl >& rxControl,
- const Reference< XInterface >& rxHandler,
- const Reference< XIntrospectionAccess >& rxIntrospectionAccess,
-- bool bDialogProviderMode )
-+ bool bDialogProviderMode, const rtl::OUString& sDialogLibName )
- {
- if ( rxControl.is() )
- {
-@@ -544,7 +553,7 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
-
- Reference< XScriptEventsAttacher > xScriptEventsAttacher = new DialogEventsAttacherImpl
- ( m_xContext, m_xModel, rxControl, rxHandler, rxIntrospectionAccess,
-- bDialogProviderMode, ( m_BasicInfo.get() ? m_BasicInfo->mxBasicRTLListener : NULL ) );
-+ bDialogProviderMode, ( m_BasicInfo.get() ? m_BasicInfo->mxBasicRTLListener : NULL ), msDialogLibName );
-
- Any aHelper;
- xScriptEventsAttacher->attachEvents( aObjects, Reference< XScriptListener >(), aHelper );
-@@ -649,7 +658,10 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
- aArguments[0] >>= m_xModel;
- m_BasicInfo.reset( new BasicRTLParams() );
- m_BasicInfo->mxInput.set( aArguments[ 1 ], UNO_QUERY_THROW );
-- m_BasicInfo->mxDlgLib.set( aArguments[ 2 ], UNO_QUERY_THROW );
-+ // allow null mxDlgLib, a document dialog instantiated from
-+ // from application basic is unable to provide ( or find ) it's
-+ // Library
-+ aArguments[ 2 ] >>= m_BasicInfo->mxDlgLib;
- // leave the possibility to optionally allow the old dialog creation
- // to use the new XScriptListener ( which converts the old style macro
- // to a SF url )
-@@ -733,7 +745,7 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
- {
- //xDialog = Reference< XDialog >( xCtrl, UNO_QUERY );
- Reference< XIntrospectionAccess > xIntrospectionAccess = inspectHandler( xHandler );
-- attachControlEvents( xCtrl, xHandler, xIntrospectionAccess, bDialogProviderMode );
-+ attachControlEvents( xCtrl, xHandler, xIntrospectionAccess, bDialogProviderMode, msDialogLibName );
- }
- }
-
-diff --git scripting/source/dlgprov/dlgprov.hxx scripting/source/dlgprov/dlgprov.hxx
-index 098e1d9..3c8f73c 100644
---- scripting/source/dlgprov/dlgprov.hxx
-+++ scripting/source/dlgprov/dlgprov.hxx
-@@ -81,9 +81,9 @@ namespace dlgprov
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xModel;
-
--
-+ rtl::OUString msDialogLibName;
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > createDialogModel( const ::rtl::OUString& sURL );
--
-+
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > createDialogControl(
- const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxDialogModel,
- const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& xParent );
-@@ -91,7 +91,7 @@ namespace dlgprov
- void attachControlEvents( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& rxControlContainer,
- const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxHandler,
- const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XIntrospectionAccess >& rxIntrospectionAccess,
-- bool bDialogProviderMode );
-+ bool bDialogProviderMode, const rtl::OUString& );
- ::com::sun::star::uno::Reference< ::com::sun::star::beans::XIntrospectionAccess > inspectHandler(
- const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxHandler );
- // helper methods
-diff --git scripting/source/vbaevents/eventhelper.cxx scripting/source/vbaevents/eventhelper.cxx
-index 6975fba..703357d 100644
---- scripting/source/vbaevents/eventhelper.cxx
-+++ scripting/source/vbaevents/eventhelper.cxx
-@@ -46,12 +46,17 @@
- #include <com/sun/star/lang/XServiceInfo.hpp>
- #include <com/sun/star/lang/XInitialization.hpp>
-
-+#include <com/sun/star/util/XCloseListener.hpp>
-+#include <com/sun/star/util/XCloseBroadcaster.hpp>
-+
- #include <com/sun/star/frame/XModel.hpp>
-
- #include <com/sun/star/script/XLibraryContainer.hpp>
- #include <com/sun/star/script/ScriptEventDescriptor.hpp>
- #include <com/sun/star/script/provider/XScriptProviderSupplier.hpp>
-
-+#include <com/sun/star/container/XNamed.hpp>
-+
- #include <com/sun/star/drawing/XControlShape.hpp>
-
- #include <com/sun/star/awt/XControl.hpp>
-@@ -62,8 +67,9 @@
- #include <com/sun/star/awt/XTextComponent.hpp> //liuchen 2009-6-5
- #include <com/sun/star/awt/XComboBox.hpp> //liuchen 2009-6-18
- #include <com/sun/star/awt/XRadioButton.hpp> //liuchen 2009-7-30
-+#include <com/sun/star/awt/XListBox.hpp>
-
--#include <msforms/ReturnInteger.hpp>
-+#include "vbamsformreturntypes.hxx"
-
- #include <sfx2/objsh.hxx>
- #include <basic/sbstar.hxx>
-@@ -71,6 +77,7 @@
- #include <basic/sbmeth.hxx>
- #include <basic/sbmod.hxx>
- #include <basic/sbx.hxx>
-+#include <filter/msfilter/msvbahelper.hxx>
-
-
-
-@@ -82,12 +89,21 @@
- #include <com/sun/star/lang/XMultiComponentFactory.hpp>
- #include <com/sun/star/script/XScriptListener.hpp>
- #include <cppuhelper/implbase1.hxx>
-+#include <cppuhelper/implbase3.hxx>
- #include <cppuhelper/implbase2.hxx>
- #include <comphelper/evtmethodhelper.hxx>
-
- #include <set>
- #include <list>
- #include <hash_map>
-+#define ASYNC 0
-+
-+// primitive support for asynchronous handling of
-+// events from controls ( all event will be processed asynchronously
-+// in the application thread )
-+#if ASYNC
-+#include <vcl/svapp.hxx>
-+#endif
-
- using namespace ::com::sun::star;
- using namespace ::com::sun::star::script;
-@@ -189,6 +205,14 @@ bool isMouseEventOk( awt::MouseEvent& evt, const Sequence< Any >& params )
- return true;
- }
-
-+bool isFocusEventOk( awt::FocusEvent& evt, const Sequence< Any >& params )
-+{
-+ if ( !( params.getLength() > 0 ) ||
-+ !( params[ 0 ] >>= evt ) )
-+ return false;
-+ return true;
-+}
-+
- Sequence< Any > ooMouseEvtToVBADblClick( const Sequence< Any >& params )
- {
- Sequence< Any > translatedParams;
-@@ -232,9 +256,14 @@ Sequence< Any > ooKeyPressedToVBAKeyPressed( const Sequence< Any >& params )
-
- translatedParams.realloc(1);
-
-- msforms::ReturnInteger keyCode;
-- keyCode.Value = evt.KeyCode;
-- translatedParams[0] <<= keyCode;
-+ //The VBA events such as ComboBox_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) may cause an error because
-+ //the original input parameter data structure -- msforms::ReturnInteger -- is a struct, it cannot support default value.
-+ //So the newly defined VbaReturnIntege class is used here to support default value.
-+ VbaReturnInteger* pKeyCode = new VbaReturnInteger();
-+ pKeyCode->Value = evt.KeyChar;
-+ ::uno::Reference< msforms::XReturnInteger > xInteger =
-+ static_cast< ::uno::Reference< msforms::XReturnInteger > > (pKeyCode);
-+ translatedParams[0] <<= xInteger;
- return translatedParams;
- }
-
-@@ -248,16 +277,38 @@ Sequence< Any > ooKeyPressedToVBAKeyUpDown( const Sequence< Any >& params )
-
- translatedParams.realloc(2);
-
-- msforms::ReturnInteger keyCode;
-- sal_Int8 shift = sal::static_int_cast<sal_Int8>( evt.Modifiers );
--
-- // #TODO check whether values from OOO conform to values generated from vba
-- keyCode.Value = evt.KeyCode;
-- translatedParams[0] <<= keyCode;
-+ //The VBA events such as ComboBox_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) may cause an error because
-+ //the original input parameter data structure -- msforms::ReturnInteger -- is a struct, it cannot support default value.
-+ //So the newly defined VbaReturnIntege class is used here to support default value.
-+ VbaReturnInteger* pKeyCode = new VbaReturnInteger();
-+ sal_Int8 shift = evt.Modifiers;
-+
-+ pKeyCode->Value = evt.KeyChar;
-+ ::uno::Reference< msforms::XReturnInteger > xInteger = static_cast< ::uno::Reference< msforms::XReturnInteger > > (pKeyCode);
-+ translatedParams[0] <<= xInteger;
- translatedParams[1] <<= shift;
- return translatedParams;
- }
-
-+Sequence< Any > ooFocusLostToVBAExit( const Sequence< Any >& params )
-+{
-+ Sequence< Any > translatedParams;
-+ awt::FocusEvent evt;
-+
-+ if ( !isFocusEventOk( evt, params ) )
-+ return Sequence< Any >();
-+
-+ translatedParams.realloc(1);
-+
-+ VbaReturnBoolean* pCancel = new VbaReturnBoolean();
-+
-+ ::uno::Reference< msforms::XReturnBoolean > xBoolean=
-+ static_cast< ::uno::Reference< msforms::XReturnBoolean > > (pCancel);
-+ translatedParams[0] <<= xBoolean;
-+ return translatedParams;
-+}
-+
-+
- typedef Sequence< Any > (*Translator)(const Sequence< Any >&);
-
- //liuchen 2009-6-23
-@@ -287,6 +338,7 @@ bool ApproveAll(const ScriptEvent& evt, void* pPara); //allow all types of contr
- bool ApproveType(const ScriptEvent& evt, void* pPara); //certain types of controls should execute the event, those types are given by pPara
- bool DenyType(const ScriptEvent& evt, void* pPara); //certain types of controls should not execute the event, those types are given by pPara
- bool DenyMouseDrag(const ScriptEvent& evt, void* pPara); //used for VBA MouseMove event when "Shift" key is pressed
-+bool DenyKeys(const ScriptEvent& evt, void* pPara); //For some keys, press them will cause Symphony keyPressed event, but will not cause any events in Excel, so deny these key events
-
- struct TypeList
- {
-@@ -294,28 +346,30 @@ struct TypeList
- int nListLength;
- };
-
--Type typeXFixedText = GET_TYPE(awt::XFixedText)
--Type typeXTextComponent = GET_TYPE(awt::XTextComponent)
--Type typeXComboBox = GET_TYPE(awt::XComboBox)
--Type typeXRadioButton = GET_TYPE(awt::XRadioButton)
-+Type typeXFixedText = GET_TYPE(awt::XFixedText);
-+Type typeXTextComponent = GET_TYPE(awt::XTextComponent);
-+Type typeXComboBox = GET_TYPE(awt::XComboBox);
-+Type typeXRadioButton = GET_TYPE(awt::XRadioButton);
-+Type typeXListBox = GET_TYPE(awt::XListBox);
-
-
- TypeList fixedTextList = {&typeXFixedText, 1};
- TypeList textCompList = {&typeXTextComponent, 1};
- TypeList radioButtonList = {&typeXRadioButton, 1};
- TypeList comboBoxList = {&typeXComboBox, 1};
-+TypeList listBoxList = {&typeXListBox, 1};
-
- //this array stores the OO event to VBA event translation info
- static TranslatePropMap aTranslatePropMap_Impl[] =
- {
-+ { MAP_CHAR_LEN("actionPerformed"), { MAP_CHAR_LEN("_Change"), NULL, DenyType, (void*)(&radioButtonList) } }, //liuchen 2009-7-30, OptionalButton_Change event is not the same as OptionalButton_Click event
- // actionPerformed ooo event
- { MAP_CHAR_LEN("actionPerformed"), { MAP_CHAR_LEN("_Click"), NULL, ApproveAll, NULL } },
-- { MAP_CHAR_LEN("actionPerformed"), { MAP_CHAR_LEN("_Change"), NULL, DenyType, (void*)(&radioButtonList) } }, //liuchen 2009-7-30, OptionalButton_Change event is not the same as OptionalButton_Click event
--
-+ { MAP_CHAR_LEN("itemStateChanged"), { MAP_CHAR_LEN("_Change"), NULL, ApproveType, (void*)(&radioButtonList) } }, //liuchen 2009-7-30, OptionalButton_Change event should be triggered when the button state is changed
- // itemStateChanged ooo event
- { MAP_CHAR_LEN("itemStateChanged"), { MAP_CHAR_LEN("_Click"), NULL, ApproveType, (void*)(&comboBoxList) } }, //liuchen, add to support VBA ComboBox_Click event
-- { MAP_CHAR_LEN("itemStateChanged"), { MAP_CHAR_LEN("_Change"), NULL, ApproveType, (void*)(&radioButtonList) } }, //liuchen 2009-7-30, OptionalButton_Change event should be triggered when the button state is changed
-
-+ { MAP_CHAR_LEN("itemStateChanged"), { MAP_CHAR_LEN("_Click"), NULL, ApproveType, (void*)(&listBoxList) } },
- // changed ooo event
- { MAP_CHAR_LEN("changed"), { MAP_CHAR_LEN("_Change"), NULL, ApproveAll, NULL } },
-
-@@ -324,7 +378,7 @@ static TranslatePropMap aTranslatePropMap_Impl[] =
-
- // focusLost ooo event
- { MAP_CHAR_LEN("focusLost"), { MAP_CHAR_LEN("_LostFocus"), NULL, ApproveAll, NULL } },
-- { MAP_CHAR_LEN("focusLost"), { MAP_CHAR_LEN("_Exit"), NULL, ApproveType, (void*)(&textCompList) } }, //liuchen, add to support VBA TextBox_Exit event
-+ { MAP_CHAR_LEN("focusLost"), { MAP_CHAR_LEN("_Exit"), ooFocusLostToVBAExit, ApproveType, (void*)(&textCompList) } }, //liuchen, add to support VBA TextBox_Exit event
-
- // adjustmentValueChanged ooo event
- { MAP_CHAR_LEN("adjustmentValueChanged"), { MAP_CHAR_LEN("_Scroll"), NULL, ApproveAll, NULL } },
-@@ -349,8 +403,8 @@ static TranslatePropMap aTranslatePropMap_Impl[] =
- { MAP_CHAR_LEN("mouseDragged"), { MAP_CHAR_LEN("_MouseMove"), ooMouseEvtToVBAMouseEvt, DenyMouseDrag, NULL } }, //liuchen, add to support VBA MouseMove event when the "Shift" key is pressed
-
- // keyPressed ooo event
-- { MAP_CHAR_LEN("keyPressed"), { MAP_CHAR_LEN("_KeyDown"), ooKeyPressedToVBAKeyPressed, ApproveAll, NULL } },
-- { MAP_CHAR_LEN("keyPressed"), { MAP_CHAR_LEN("_KeyPress"), ooKeyPressedToVBAKeyPressed, ApproveAll, NULL } }
-+ { MAP_CHAR_LEN("keyPressed"), { MAP_CHAR_LEN("_KeyDown"), ooKeyPressedToVBAKeyUpDown, ApproveAll, NULL } },
-+ { MAP_CHAR_LEN("keyPressed"), { MAP_CHAR_LEN("_KeyPress"), ooKeyPressedToVBAKeyUpDown, DenyKeys, NULL } }
- };
-
- EventInfoHash& getEventTransInfo()
-@@ -632,7 +686,7 @@ private:
- Reference< container::XNameContainer > m_xNameContainer;
- };
-
--typedef ::cppu::WeakImplHelper2< XScriptListener, lang::XInitialization > EventListener_BASE;
-+typedef ::cppu::WeakImplHelper3< XScriptListener, util::XCloseListener, lang::XInitialization > EventListener_BASE;
-
- #define EVENTLSTNR_PROPERTY_ID_MODEL 1
- #define EVENTLSTNR_PROPERTY_MODEL ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Model" ) )
-@@ -653,6 +707,9 @@ public:
- // XScriptListener
- virtual void SAL_CALL firing(const ScriptEvent& evt) throw(RuntimeException);
- virtual Any SAL_CALL approveFiring(const ScriptEvent& evt) throw(reflection::InvocationTargetException, RuntimeException);
-+ // XCloseListener
-+ virtual void SAL_CALL queryClosing( const lang::EventObject& Source, ::sal_Bool GetsOwnership ) throw (util::CloseVetoException, uno::RuntimeException);
-+ virtual void SAL_CALL notifyClosing( const lang::EventObject& Source ) throw (uno::RuntimeException);
- // XPropertySet
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException);
- // XInitialization
-@@ -664,6 +721,25 @@ public:
- DECLARE_XTYPEPROVIDER()
- virtual void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
- {
-+ if ( nHandle == EVENTLSTNR_PROPERTY_ID_MODEL )
-+ {
-+ uno::Reference< frame::XModel > xModel( rValue, uno::UNO_QUERY );
-+ if( xModel != m_xModel)
-+ {
-+ // Remove the listener from the old XCloseBroadcaster.
-+ uno::Reference< util::XCloseBroadcaster > xCloseBroadcaster( m_xModel, uno::UNO_QUERY );
-+ if (xCloseBroadcaster.is())
-+ {
-+ xCloseBroadcaster->removeCloseListener( this );
-+ }
-+ // Add the listener into the new XCloseBroadcaster.
-+ xCloseBroadcaster = uno::Reference< util::XCloseBroadcaster >( xModel, uno::UNO_QUERY );
-+ if (xCloseBroadcaster.is())
-+ {
-+ xCloseBroadcaster->addCloseListener( this );
-+ }
-+ }
-+ }
- OPropertyContainer::setFastPropertyValue( nHandle, rValue );
- if ( nHandle == EVENTLSTNR_PROPERTY_ID_MODEL )
- setShellFromModel();
-@@ -677,17 +753,21 @@ protected:
- virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
-
- private:
-+#if ASYNC
-+ DECL_LINK( OnAsyncScriptEvent, ScriptEvent* );
-+#endif
- void setShellFromModel();
- void firing_Impl( const ScriptEvent& evt, Any *pSyncRet=NULL ) throw( RuntimeException );
-
- Reference< XComponentContext > m_xContext;
- Reference< frame::XModel > m_xModel;
- SfxObjectShell* mpShell;
-+ sal_Bool m_bDocClosed;
-
- };
-
- EventListener::EventListener( const Reference< XComponentContext >& rxContext ) :
--OPropertyContainer(GetBroadcastHelper()), m_xContext( rxContext ), mpShell( 0 )
-+OPropertyContainer(GetBroadcastHelper()), m_xContext( rxContext ), m_bDocClosed(sal_False), mpShell( 0 )
- {
- registerProperty( EVENTLSTNR_PROPERTY_MODEL, EVENTLSTNR_PROPERTY_ID_MODEL,
- beans::PropertyAttribute::TRANSIENT, &m_xModel, ::getCppuType( &m_xModel ) );
-@@ -722,9 +802,39 @@ EventListener::disposing(const lang::EventObject&) throw( RuntimeException )
- void SAL_CALL
- EventListener::firing(const ScriptEvent& evt) throw(RuntimeException)
- {
-+#if ASYNC
-+ // needs some logic to check if the event handler is oneway or not
-+ // if not oneway then firing_Impl otherwise... as below
-+ acquire();
-+ Application::PostUserEvent( LINK( this, EventListener, OnAsyncScriptEvent ), new ScriptEvent( evt ) );
-+#else
- firing_Impl( evt );
-+#endif
- }
-
-+#if ASYNC
-+IMPL_LINK( EventListener, OnAsyncScriptEvent, ScriptEvent*, _pEvent )
-+{
-+ if ( !_pEvent )
-+ return 1L;
-+
-+ {
-+ // #FIXME if we enable ASYNC we probably need something like
-+ // below
-+ //::osl::ClearableMutexGuard aGuard( m_aMutex );
-+
-+ //if ( !impl_isDisposed_nothrow() )
-+ // impl_doFireScriptEvent_nothrow( aGuard, *_pEvent, NULL );
-+ firing_Impl( *_pEvent, NULL );
-+ }
-+
-+ delete _pEvent;
-+ // we acquired ourself immediately before posting the event
-+ release();
-+ return 0L;
-+ }
-+#endif
-+
- Any SAL_CALL
- EventListener::approveFiring(const ScriptEvent& evt) throw(reflection::InvocationTargetException, RuntimeException)
- {
-@@ -733,6 +843,24 @@ EventListener::approveFiring(const ScriptEvent& evt) throw(reflection::Invocatio
- return ret;
- }
-
-+// XCloseListener
-+void SAL_CALL
-+EventListener::queryClosing( const lang::EventObject& Source, ::sal_Bool GetsOwnership ) throw (util::CloseVetoException, uno::RuntimeException)
-+{
-+ //Nothing to do
-+}
-+
-+void SAL_CALL
-+EventListener::notifyClosing( const lang::EventObject& Source ) throw (uno::RuntimeException)
-+{
-+ m_bDocClosed = sal_True;
-+ uno::Reference< util::XCloseBroadcaster > xCloseBroadcaster( m_xModel, uno::UNO_QUERY );
-+ if (xCloseBroadcaster.is())
-+ {
-+ xCloseBroadcaster->removeCloseListener( this );
-+ }
-+}
-+
- // XInitialization
- void SAL_CALL
- EventListener::initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException)
-@@ -835,13 +963,28 @@ bool DenyMouseDrag(const ScriptEvent& evt, void* )
- }
- }
-
-+//For some keys, press them will cause Symphony keyPressed event, but will not cause any events in Excel, so deny these key events
-+bool DenyKeys(const ScriptEvent& evt, void* /*pPara*/)
-+{
-+ awt::KeyEvent aEvent;
-+ evt.Arguments[ 0 ] >>= aEvent;
-+ if (aEvent.KeyChar == 0 || aEvent.KeyChar == 8)
-+ {
-+ return false;
-+ }
-+ else
-+ {
-+ return true;
-+ }
-+}
-+
-
-
- //liuchen 2009-6-23
- // EventListener
-
- void
--EventListener::firing_Impl(const ScriptEvent& evt, Any* /*pRet*/ ) throw(RuntimeException)
-+EventListener::firing_Impl(const ScriptEvent& evt, Any* pRet ) throw(RuntimeException)
- {
- OSL_TRACE("EventListener::firing_Impl( FAKE VBA_EVENTS )");
- static const ::rtl::OUString vbaInterOp =
-@@ -852,18 +995,46 @@ EventListener::firing_Impl(const ScriptEvent& evt, Any* /*pRet*/ ) throw(Runtime
- return;
- lang::EventObject aEvent;
- evt.Arguments[ 0 ] >>= aEvent;
-+ OSL_TRACE("evt.MethodName is %s", rtl::OUStringToOString( evt.MethodName, RTL_TEXTENCODING_UTF8 ).getStr() );
- OSL_TRACE("Argument[0] is %s", rtl::OUStringToOString( comphelper::anyToString( evt.Arguments[0] ), RTL_TEXTENCODING_UTF8 ).getStr() );
- OSL_TRACE("Getting Control");
-- uno::Reference< awt::XControl > xControl( aEvent.Source, uno::UNO_QUERY_THROW );
-- OSL_TRACE("Getting properties");
-- uno::Reference< beans::XPropertySet > xProps( xControl->getModel(), uno::UNO_QUERY_THROW );
--
- rtl::OUString sName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UserForm") );
- OSL_TRACE("Getting Name");
-
- uno::Reference< awt::XDialog > xDlg( aEvent.Source, uno::UNO_QUERY );
- if ( !xDlg.is() )
-- xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ) ) >>= sName;
-+ {
-+ OSL_TRACE("Getting Control");
-+ // evt.Source is
-+ // a) Dialog
-+ // b) xShapeControl ( from api (sheet control) )
-+ // c) eventmanager ( I guess )
-+ // d) vba control ( from api also )
-+ uno::Reference< drawing::XControlShape > xCntrlShape( evt.Source, uno::UNO_QUERY );
-+ uno::Reference< awt::XControl > xControl( aEvent.Source, uno::UNO_QUERY );
-+ if ( xCntrlShape.is() )
-+ {
-+ // for sheet controls ( that fire from the api ) we don't
-+ // have the real control ( thats only available from the view )
-+ // api code creates just a control instance that is transferred
-+ // via aEvent.Arguments[ 0 ] that control though has no
-+ // info like name etc.
-+ uno::Reference< drawing::XControlShape > xCntrlShape( evt.Source, UNO_QUERY_THROW );
-+ OSL_TRACE("Got control shape");
-+ uno::Reference< container::XNamed > xName( xCntrlShape->getControl(), uno::UNO_QUERY_THROW );
-+ OSL_TRACE("Got xnamed ");
-+ sName = xName->getName();
-+ }
-+ else
-+ {
-+ // Userform control ( fired from the api or from event manager )
-+ uno::Reference< beans::XPropertySet > xProps;
-+ OSL_TRACE("Getting properties");
-+ xProps.set( xControl->getModel(), uno::UNO_QUERY_THROW );
-+ xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ) ) >>= sName;
-+ }
-+
-+ }
- //dumpEvent( evt );
- EventInfoHash& infos = getEventTransInfo();
- EventInfoHash::const_iterator eventInfo_it = infos.find( evt.MethodName );
-@@ -885,20 +1056,49 @@ EventListener::firing_Impl(const ScriptEvent& evt, Any* /*pRet*/ ) throw(Runtime
- std::list< TranslateInfo >::const_iterator txInfo =
- eventInfo_it->second.begin();
- std::list< TranslateInfo >::const_iterator txInfo_end = eventInfo_it->second.end();
-- rtl::OUString sMacroLoc = rtl::OUString::createFromAscii("Standard.").concat( evt.ScriptCode ).concat( rtl::OUString::createFromAscii(".") );
-
- StarBASIC* pBasic = mpShell->GetBasic();
-- SbModule* pModule = pBasic->FindModule( evt.ScriptCode );
-- for ( ; pModule && txInfo != txInfo_end; ++txInfo )
-+ BasicManager* pBasicManager = mpShell->GetBasicManager();
-+ rtl::OUString sProject;
-+ rtl::OUString sScriptCode( evt.ScriptCode );
-+ // dialogs pass their own library, presence of Dot determines that
-+ if ( sScriptCode.indexOf( '.' ) == -1 )
-+ {
-+ //'Project' is a better default but I want to force failures
-+ //rtl::OUString sMacroLoc = rtl::OUString::createFromAscii("Project");
-+ sProject = rtl::OUString::createFromAscii("Standard");
-+
-+ if ( pBasicManager->GetName().Len() > 0 )
-+ sProject = pBasicManager->GetName();
-+ }
-+ else
-+ {
-+ sal_Int32 nIndex = sScriptCode.indexOf( '.' );
-+ sProject = sScriptCode.copy( 0, nIndex );
-+ sScriptCode = sScriptCode.copy( nIndex + 1 );
-+ }
-+ rtl::OUString sMacroLoc = sProject;
-+ sMacroLoc = sMacroLoc.concat( rtl::OUString::createFromAscii(".") );
-+ sMacroLoc = sMacroLoc.concat( sScriptCode ).concat( rtl::OUString::createFromAscii(".") );
-+
-+ OSL_TRACE("sMacroLoc is %s", rtl::OUStringToOString( sMacroLoc, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ for ( ; txInfo != txInfo_end; ++txInfo )
- {
-+ // If the document is closed, we should not execute macro.
-+ if (m_bDocClosed)
-+ {
-+ break;
-+ }
-+
-+ rtl::OUString sTemp = sName.concat( (*txInfo).sVBAName );
- // see if we have a match for the handlerextension
- // where ScriptCode is methodname_handlerextension
-- rtl::OUString sTemp = sName.concat( (*txInfo).sVBAName );
-+ rtl::OUString sToResolve = sMacroLoc.concat( sTemp );
-
- OSL_TRACE("*** trying to invoke %s ",
-- rtl::OUStringToOString( sTemp, RTL_TEXTENCODING_UTF8 ).getStr() );
-- SbMethod* pMeth = static_cast< SbMethod* >( pModule->Find( sTemp, SbxCLASS_METHOD ) );
-- if ( pMeth )
-+ rtl::OUStringToOString( sToResolve, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ ooo::vba::VBAMacroResolvedInfo aMacroResolvedInfo = ooo::vba::resolveVBAMacro( mpShell, sToResolve );
-+ if ( aMacroResolvedInfo.IsResolved() )
- {
- //liuchen 2009-6-8
- if (! txInfo->ApproveRule(evt, txInfo->pPara) )
-@@ -916,24 +1116,21 @@ EventListener::firing_Impl(const ScriptEvent& evt, Any* /*pRet*/ ) throw(Runtime
- {
- // call basic event handlers for event
-
-- static rtl::OUString part1 = rtl::OUString::createFromAscii( "vnd.sun.star.script:");
-- static rtl::OUString part2 = rtl::OUString::createFromAscii("?language=Basic&location=document");
--
- // create script url
-- rtl::OUString url = part1 + sMacroLoc + sTemp + part2;
-+ rtl::OUString url = aMacroResolvedInfo.ResolvedMacro();
-
-- OSL_TRACE("script url = %s",
-+ OSL_TRACE("resolved script = %s",
- rtl::OUStringToOString( url,
- RTL_TEXTENCODING_UTF8 ).getStr() );
-- Sequence< sal_Int16 > aOutArgsIndex;
-- Sequence< Any > aOutArgs;
- try
- {
-- if ( mpShell )
-+ uno::Any aDummyCaller = uno::makeAny( rtl::OUString::createFromAscii("Error") );
-+ if ( pRet )
-+ ooo::vba::executeMacro( mpShell, url, aArguments, *pRet, aDummyCaller );
-+ else
- {
- uno::Any aRet;
-- mpShell->CallXScript( url,
-- aArguments, aRet, aOutArgsIndex, aOutArgs, false );
-+ ooo::vba::executeMacro( mpShell, url, aArguments, aRet, aDummyCaller );
- }
- }
- catch ( uno::Exception& e )
-diff --git scripting/source/vbaevents/makefile.mk scripting/source/vbaevents/makefile.mk
-index 1946c61..a367898 100644
---- scripting/source/vbaevents/makefile.mk
-+++ scripting/source/vbaevents/makefile.mk
-@@ -69,6 +69,7 @@ SHL1STDLIBS= \
- $(BASICLIB) \
- $(COMPHELPERLIB) \
- $(SFXLIB) \
-+ $(MSFILTERLIB) \
- $(CPPULIB) \
- $(TOOLSLIB) \
- $(SALLIB)
-diff --git scripting/source/vbaevents/vbaevents.map scripting/source/vbaevents/vbaevents.map
-new file mode 100644
-index 0000000..832e82c
---- /dev/null
-+++ scripting/source/vbaevents/vbaevents.map
-@@ -0,0 +1,9 @@
-+OOO_1.1 {
-+ global:
-+ component_getImplementationEnvironment;
-+ component_getFactory;
-+ component_writeInfo;
-+
-+ local:
-+ *;
-+};
-diff --git scripting/source/vbaevents/vbamsformreturntypes.hxx scripting/source/vbaevents/vbamsformreturntypes.hxx
-new file mode 100644
-index 0000000..d67b5f5
---- /dev/null
-+++ scripting/source/vbaevents/vbamsformreturntypes.hxx
-@@ -0,0 +1,73 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009, 2010.
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef VBA_MSFORM_RETURNTYPES_HXX
-+#define VBA_MSFORM_RETURNTYPES_HXX
-+
-+#include <cppuhelper/implbase1.hxx>
-+#include <msforms/XReturnBoolean.hpp>
-+#include <msforms/XReturnInteger.hpp>
-+
-+
-+typedef ::cppu::WeakImplHelper1<msforms::XReturnBoolean> ReturnBoolean_BASE;
-+
-+class SAL_DLLPUBLIC_EXPORT VbaReturnBoolean : public ReturnBoolean_BASE
-+{
-+public:
-+ sal_Bool Value;
-+
-+public:
-+ VbaReturnBoolean() : Value(false) {} ;
-+
-+ // XReturnBoolean
-+ virtual ::sal_Bool SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException) { return Value; }
-+ virtual void SAL_CALL setValue( ::sal_Bool _value ) throw (::com::sun::star::uno::RuntimeException) { Value = _value; }
-+
-+ // XDefaultProperty
-+ ::rtl::OUString SAL_CALL getDefaultPropertyName() throw (com::sun::star::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
-+};
-+
-+
-+typedef ::cppu::WeakImplHelper1<msforms::XReturnInteger> ReturnInteger_BASE;
-+
-+class SAL_DLLPUBLIC_EXPORT VbaReturnInteger : public ReturnInteger_BASE
-+{
-+public:
-+ sal_Int32 Value;
-+
-+public:
-+ VbaReturnInteger() : Value(0) {} ;
-+
-+ // XReturnInteger
-+ virtual ::sal_Int32 SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException) { return Value; }
-+ virtual void SAL_CALL setValue( ::sal_Int32 _value ) throw (::com::sun::star::uno::RuntimeException) { Value = _value; }
-+
-+ // XDefaultProperty
-+ ::rtl::OUString SAL_CALL getDefaultPropertyName() throw (com::sun::star::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
-+};
-+#endif
-diff --git sfx2/inc/sfx2/objsh.hxx sfx2/inc/sfx2/objsh.hxx
-index 4202177..c55eea5 100644
---- sfx2/inc/sfx2/objsh.hxx
-+++ sfx2/inc/sfx2/objsh.hxx
-@@ -295,6 +295,7 @@ public:
- //<!--Added by PengYunQuan for Validity Cell Range Picker
- virtual sal_Bool AcceptStateUpdate() const;
- //-->Added by PengYunQuan for Validity Cell Range Picker
-+ sal_Bool IsInPrepareClose() const;
- sal_Bool HasModalViews() const;
- sal_Bool IsHelpDocument() const;
-
-@@ -399,8 +400,8 @@ public:
- ::com::sun::star::uno::Any& aRet,
- ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam,
-- bool bRaiseError = true
-- );
-+ bool bRaiseError = true,
-+ const ::com::sun::star::uno::Any* aCaller = 0 );
-
- static ErrCode CallXScript(
- const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxScriptContext,
-@@ -409,7 +410,8 @@ public:
- ::com::sun::star::uno::Any& aRet,
- ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam,
-- bool bRaiseError = true
-+ bool bRaiseError = true,
-+ const ::com::sun::star::uno::Any* aCaller = 0
- );
-
- /** adjusts the internal macro mode, according to the current security settings
-diff --git sfx2/inc/sfx2/sfx.hrc sfx2/inc/sfx2/sfx.hrc
-index 0c9e962..c70ac37 100644
---- sfx2/inc/sfx2/sfx.hrc
-+++ sfx2/inc/sfx2/sfx.hrc
-@@ -394,8 +394,10 @@
- #define MID_DOCINFO_ENCRYPTED 0x2c
- #define MID_DOCINFO_STATISTIC 0x33
- #define MID_DOCINFO_CHARLOCALE 0x34
--
--#define MID_LAST_USED_PROPID MID_DOCINFO_CHARLOCALE
-+#define MID_CATEGORY 0x35
-+#define MID_COMPANY 0x36
-+#define MID_MANAGER 0x37
-+#define MID_LAST_USED_PROPID MID_MANAGER
-
- // Config-Ids -----------------------------------------------------------
-
-diff --git sfx2/inc/sfx2/sfxbasemodel.hxx sfx2/inc/sfx2/sfxbasemodel.hxx
-index 52fe2c1..8fe1468 100644
---- sfx2/inc/sfx2/sfxbasemodel.hxx
-+++ sfx2/inc/sfx2/sfxbasemodel.hxx
-@@ -1505,6 +1505,7 @@ protected:
- /* returns true if the document signatures are valid, otherwise false */
- sal_Bool hasValidSignatures() const;
-
-+ void setDocumentProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentProperties >& );
- //________________________________________________________________________________________________________
- // private methods
- //________________________________________________________________________________________________________
-diff --git sfx2/inc/sfx2/sfxsids.hrc sfx2/inc/sfx2/sfxsids.hrc
-index 69e8e4b..69efc8e 100644
---- sfx2/inc/sfx2/sfxsids.hrc
-+++ sfx2/inc/sfx2/sfxsids.hrc
-@@ -75,6 +75,7 @@
-
- #define SID_VERSION_VISIBLE (SID_SFX_START + 313)
- #define SID_PASTE_UNFORMATTED (SID_SFX_START + 314)
-+#define SID_DIALOG_RETURN (SID_SFX_START + 318)
- #define SID_PRINTER_NOTFOUND_WARN (SID_SFX_START + 320)
- #define SID_PRINTER_USETHREAD (SID_SFX_START + 321)
- #define SID_PRINTER_NAME (SID_SFX_START + 322)
-diff --git sfx2/source/appl/app.cxx sfx2/source/appl/app.cxx
-index ca8062b..5c8c768 100644
---- sfx2/source/appl/app.cxx
-+++ sfx2/source/appl/app.cxx
-@@ -749,7 +749,7 @@ IMPL_LINK( SfxApplication, GlobalBasicErrorHdl_Impl, StarBASIC*, pStarBasic )
- basicide_handle_basic_error pSymbol = (basicide_handle_basic_error) osl_getFunctionSymbol( handleMod, aSymbol.pData );
-
- // call basicide_handle_basic_error in basctl
-- long nRet = pSymbol( pStarBasic );
-+ long nRet = pSymbol ? pSymbol( pStarBasic ) : 0;
-
- return nRet;
- }
-diff --git sfx2/source/appl/appuno.cxx sfx2/source/appl/appuno.cxx
-index f08cd7d..1bbe235 100644
---- sfx2/source/appl/appuno.cxx
-+++ sfx2/source/appl/appuno.cxx
-@@ -2268,6 +2268,16 @@ SFX2_DLLPUBLIC sal_Bool SAL_CALL component_writeInfo(
- xNewKey = xKey->createKey( aTempStr );
- xNewKey->createKey( ::rtl::OUString::createFromAscii("com.sun.star.document.DocumentProperties") );
-
-+
-+ // writer compatable document properties
-+ aImpl = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/"));
-+ aImpl += comp_CompatWriterDocProps::_getImplementationName();
-+
-+ aTempStr = aImpl;
-+ aTempStr += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES"));
-+ xNewKey = xKey->createKey( aTempStr );
-+ xNewKey->createKey( ::rtl::OUString::createFromAscii("com.sun.star.writer.DocumentProperties") );
-+
- return sal_True;
- }
-
-@@ -2327,6 +2337,16 @@ SFX2_DLLPUBLIC void* SAL_CALL component_getFactory(
- ::comp_SfxDocumentMetaData::_getImplementationName(),
- ::comp_SfxDocumentMetaData::_getSupportedServiceNames());
- }
-+ if ( ::comp_CompatWriterDocProps::_getImplementationName().equals(
-+ ::rtl::OUString::createFromAscii( pImplementationName ) ) )
-+ {
-+ xFactory = ::cppu::createSingleComponentFactory(
-+ ::comp_CompatWriterDocProps::_create,
-+ ::comp_CompatWriterDocProps::_getImplementationName(),
-+ ::comp_CompatWriterDocProps::_getSupportedServiceNames());
-+ }
-+
-+ // Factory is valid - service was found.
-
- // Factory is valid - service was found.
- if ( xFactory.is() )
-diff --git sfx2/source/control/unoctitm.cxx sfx2/source/control/unoctitm.cxx
-index 8159fc8..103ca13 100644
---- sfx2/source/control/unoctitm.cxx
-+++ sfx2/source/control/unoctitm.cxx
-@@ -702,6 +702,7 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util
- // Filter arguments which shouldn't be part of the sequence property value
- sal_Bool bTemp = sal_Bool();
- sal_uInt16 nModifier(0);
-+ sal_Bool bVBARequest = sal_False;
- std::vector< ::com::sun::star::beans::PropertyValue > aAddArgs;
- for( sal_Int32 n=0; n<nCount; n++ )
- {
-@@ -718,6 +719,10 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util
- }
- else if( rProp.Name.equalsAsciiL("KeyModifier",11))
- rProp.Value >>= nModifier;
-+ else if( rProp.Name.equalsAsciiL("VBADialogResultRequest",22) )
-+ {
-+ rProp.Value >>= bVBARequest;
-+ }
- else
- aAddArgs.push_back( aArgs[n] );
- }
-@@ -801,6 +806,14 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util
- pItem = aReq.GetReturnValue();
- bSuccess = aReq.IsDone() || pItem != NULL;
- bFailure = aReq.IsCancelled();
-+ if ( bVBARequest )
-+ {
-+ SFX_REQUEST_ARG( aReq, pItem, SfxBoolItem, SID_DIALOG_RETURN, FALSE );
-+ if ( pItem )
-+ {
-+ bSuccess = pItem->GetValue();
-+ }
-+ }
- }
- }
- #ifdef DBG_UTIL
-diff --git sfx2/source/doc/SfxDocumentMetaData.cxx sfx2/source/doc/SfxDocumentMetaData.cxx
-index 95fe000..9975858 100644
---- sfx2/source/doc/SfxDocumentMetaData.cxx
-+++ sfx2/source/doc/SfxDocumentMetaData.cxx
-@@ -87,6 +87,10 @@
- #include <cstring>
- #include <limits>
-
-+
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/document/XCompatWriterDocProperties.hpp>
-+
- /**
- * This file contains the implementation of the service
- * com.sun.star.document.DocumentProperties.
-@@ -292,12 +296,12 @@ public:
- const css::uno::Sequence< css::beans::StringPair >& i_rNamespaces)
- throw (css::uno::RuntimeException, css::xml::sax::SAXException);
-
--private:
-+protected:
- SfxDocumentMetaData(SfxDocumentMetaData &); // not defined
- SfxDocumentMetaData& operator =(SfxDocumentMetaData &); // not defined
-
- virtual ~SfxDocumentMetaData() {}
--
-+ virtual SfxDocumentMetaData* createMe( css::uno::Reference< css::uno::XComponentContext > const & context ) { return new SfxDocumentMetaData( context ); };
- const css::uno::Reference< css::uno::XComponentContext > m_xContext;
-
- /// for notification
-@@ -372,6 +376,54 @@ private:
- void createUserDefined();
- };
-
-+typedef ::cppu::ImplInheritanceHelper1< SfxDocumentMetaData, css::document::XCompatWriterDocProperties > CompatWriterDocPropsImpl_BASE;
-+
-+class CompatWriterDocPropsImpl : public CompatWriterDocPropsImpl_BASE
-+{
-+ rtl::OUString msManager;
-+ rtl::OUString msCategory;
-+ rtl::OUString msCompany;
-+protected:
-+ virtual SfxDocumentMetaData* createMe( css::uno::Reference< css::uno::XComponentContext > const & context ) { return new CompatWriterDocPropsImpl( context ); };
-+public:
-+ CompatWriterDocPropsImpl( css::uno::Reference< css::uno::XComponentContext > const & context) : CompatWriterDocPropsImpl_BASE( context ) {}
-+// XCompatWriterDocPropsImpl
-+ virtual ::rtl::OUString SAL_CALL getManager() throw (::com::sun::star::uno::RuntimeException) { return msManager; }
-+ virtual void SAL_CALL setManager( const ::rtl::OUString& _manager ) throw (::com::sun::star::uno::RuntimeException) { msManager = _manager; }
-+ virtual ::rtl::OUString SAL_CALL getCategory() throw (::com::sun::star::uno::RuntimeException){ return msCategory; }
-+ virtual void SAL_CALL setCategory( const ::rtl::OUString& _category ) throw (::com::sun::star::uno::RuntimeException){ msCategory = _category; }
-+ virtual ::rtl::OUString SAL_CALL getCompany() throw (::com::sun::star::uno::RuntimeException){ return msCompany; }
-+ virtual void SAL_CALL setCompany( const ::rtl::OUString& _company ) throw (::com::sun::star::uno::RuntimeException){ msCompany = _company; }
-+
-+// XServiceInfo
-+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException)
-+ {
-+ return comp_CompatWriterDocProps::_getImplementationName();
-+ }
-+
-+ virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException)
-+ {
-+ css::uno::Sequence< rtl::OUString > sServiceNames= getSupportedServiceNames();
-+ sal_Int32 nLen = sServiceNames.getLength();
-+ rtl::OUString* pIt = sServiceNames.getArray();
-+ rtl::OUString* pEnd = ( pIt + nLen );
-+ sal_Bool bRes = sal_False;
-+ for ( ; pIt != pEnd; ++pIt )
-+ {
-+ if ( pIt->equals( ServiceName ) )
-+ {
-+ bRes = sal_True;
-+ break;
-+ }
-+ }
-+ return bRes;
-+ }
-+
-+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException)
-+ {
-+ return comp_CompatWriterDocProps::_getSupportedServiceNames();
-+ }
-+};
- ////////////////////////////////////////////////////////////////////////////
-
- bool operator== (const css::util::DateTime &i_rLeft,
-@@ -2156,7 +2208,7 @@ SfxDocumentMetaData::createClone()
- ::osl::MutexGuard g(m_aMutex);
- checkInit();
-
-- SfxDocumentMetaData *pNew = new SfxDocumentMetaData(m_xContext);
-+ SfxDocumentMetaData *pNew = createMe(m_xContext);
-
- // NB: do not copy the modification listeners, only DOM
- css::uno::Reference<css::xml::dom::XDocument> xDoc = createDOM();
-@@ -2334,6 +2386,32 @@ void SfxDocumentMetaData::createUserDefined()
-
-
- // component helper namespace
-+namespace comp_CompatWriterDocProps {
-+
-+ ::rtl::OUString SAL_CALL _getImplementationName() {
-+ return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
-+ "CompatWriterDocPropsImpl"));
-+}
-+
-+ css::uno::Sequence< ::rtl::OUString > SAL_CALL _getSupportedServiceNames()
-+ {
-+ static css::uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.writer.DocumentProperties" ) );
-+ }
-+ return aServiceNames;
-+ }
-+ css::uno::Reference< css::uno::XInterface > SAL_CALL _create(
-+ const css::uno::Reference< css::uno::XComponentContext > & context)
-+ SAL_THROW((css::uno::Exception))
-+ {
-+ return static_cast< ::cppu::OWeakObject * >
-+ (new CompatWriterDocPropsImpl(context));
-+ }
-+
-+}
- namespace comp_SfxDocumentMetaData {
-
- ::rtl::OUString SAL_CALL _getImplementationName() {
-diff --git sfx2/source/doc/docinf.cxx sfx2/source/doc/docinf.cxx
-index 15f2317..94e92ee 100644
---- sfx2/source/doc/docinf.cxx
-+++ sfx2/source/doc/docinf.cxx
-@@ -34,6 +34,7 @@
- #include <com/sun/star/beans/XPropertySet.hpp>
- #include <com/sun/star/beans/XPropertyContainer.hpp>
- #include <com/sun/star/document/XDocumentProperties.hpp>
-+#include <com/sun/star/document/XCompatWriterDocProperties.hpp>
- #include <com/sun/star/uno/Exception.hpp>
-
- #include <rtl/ustring.hxx>
-@@ -43,7 +44,6 @@
- #include <vcl/gdimtf.hxx>
-
- #include "oleprops.hxx"
--
- // ============================================================================
-
- // stream names
-@@ -172,6 +172,28 @@ sal_uInt32 SFX2_DLLPUBLIC LoadOlePropertySet(
- }
- }
-
-+ uno::Reference< document::XCompatWriterDocProperties > xWriterProps( i_xDocProps, uno::UNO_QUERY );
-+ if ( xWriterProps.is() )
-+ {
-+ SfxOleSectionRef xBuiltin = aDocSet.GetSection( SECTION_BUILTIN );
-+ if ( xBuiltin.get() )
-+ {
-+ try
-+ {
-+ String aStrValue;
-+ if ( xBuiltin->GetStringValue( aStrValue, PROPID_MANAGER ) )
-+ xWriterProps->setManager( aStrValue );
-+ if ( xBuiltin->GetStringValue( aStrValue, PROPID_CATEGORY ) )
-+ xWriterProps->setCategory( aStrValue );
-+ if ( xBuiltin->GetStringValue( aStrValue, PROPID_COMPANY ) )
-+ xWriterProps->setCompany( aStrValue );
-+ }
-+ catch ( uno::Exception& )
-+ {
-+ }
-+ }
-+ }
-+
- // return code
- return (nGlobError != ERRCODE_NONE) ? nGlobError : nDocError;
- }
-diff --git sfx2/source/doc/docmacromode.cxx sfx2/source/doc/docmacromode.cxx
-index 613d90c..a8695d3 100644
---- sfx2/source/doc/docmacromode.cxx
-+++ sfx2/source/doc/docmacromode.cxx
-@@ -38,6 +38,8 @@
- #include <com/sun/star/task/DocumentMacroConfirmationRequest.hpp>
- #include <com/sun/star/task/InteractionClassification.hpp>
- #include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
-+#include <com/sun/star/script/XLibraryQueryExecutable.hpp>
-+#include <com/sun/star/script/XVBACompat.hpp>
- /** === end UNO includes === **/
-
- #include <comphelper/componentcontext.hxx>
-@@ -73,8 +75,11 @@ namespace sfx2
- using ::com::sun::star::document::XEmbeddedScripts;
- using ::com::sun::star::uno::UNO_SET_THROW;
- using ::com::sun::star::script::XLibraryContainer;
-+ using ::com::sun::star::script::XLibraryQueryExecutable;
-+ using ::com::sun::star::script::XVBACompat;
- using ::com::sun::star::container::XNameAccess;
- using ::com::sun::star::uno::UNO_QUERY_THROW;
-+ using ::com::sun::star::uno::UNO_QUERY;
- /** === end UNO using === **/
- namespace MacroExecMode = ::com::sun::star::document::MacroExecMode;
-
-@@ -336,6 +341,8 @@ namespace sfx2
- if ( xScripts.is() )
- xContainer.set( xScripts->getBasicLibraries(), UNO_QUERY_THROW );
-
-+ Reference< XVBACompat > xDocVBAMode( xContainer, UNO_QUERY );
-+ sal_Bool bIsVBAMode = ( xDocVBAMode.is() && xDocVBAMode->getVBACompatModeOn() );
- if ( xContainer.is() )
- {
- // a library container exists; check if it's empty
-@@ -350,23 +357,46 @@ namespace sfx2
- Sequence< ::rtl::OUString > aElements = xContainer->getElementNames();
- if ( aElements.getLength() )
- {
-- if ( aElements.getLength() > 1 || !aElements[0].equals( aStdLibName ) )
-+ // old check, if more than 1 library or the first library isn't the expected 'Standard'
-+ // trigger the security 'nag' dialog
-+ if ( !bIsVBAMode && ( aElements.getLength() > 1 || !aElements[0].equals( aStdLibName ) ) )
- bHasMacroLib = sal_True;
-- else
-+ else
- {
-- // usually a "Standard" library is always present (design)
-- // for this reason we must check if it's empty
-- //
-- // Note: Since #i73229#, this is not true anymore. There's no default
-- // "Standard" lib anymore. Wouldn't it be time to get completely
-- // rid of the "Standard" thingie - this shouldn't be necessary
-- // anymore, should it?
-- // 2007-01-25 / frank.schoenheit@sun.com
-- Reference < XNameAccess > xLib;
-- Any aAny = xContainer->getByName( aStdLibName );
-- aAny >>= xLib;
-+ // other wise just check all libraries for executeable code
-+ Reference< XLibraryQueryExecutable > xLib( xContainer, UNO_QUERY );
- if ( xLib.is() )
-- bHasMacroLib = xLib->hasElements();
-+ {
-+ Sequence< ::rtl::OUString > aElements = xContainer->getElementNames();
-+ sal_Int32 nElementCount = aElements.getLength();
-+ const ::rtl::OUString* pElementName = aElements.getConstArray();
-+ for ( sal_Int32 index = 0; index < nElementCount; index++ )
-+ {
-+ bHasMacroLib = xLib->HasExecutableCode( pElementName[index] );
-+ if ( bHasMacroLib )
-+ break;
-+ }
-+ }
-+ }
-+ }
-+ }
-+ }
-+ if ( bIsVBAMode && !bHasMacroLib && xScripts.is() )
-+ {
-+ Reference< XLibraryContainer > xDlgContainer( xScripts->getDialogLibraries(), UNO_QUERY );
-+ if ( xDlgContainer.is() && xDlgContainer->hasElements() )
-+ {
-+ Sequence< ::rtl::OUString > aElements = xDlgContainer->getElementNames();
-+ sal_Int32 nElementCount = aElements.getLength();
-+ const ::rtl::OUString* pElementName = aElements.getConstArray();
-+ for ( sal_Int32 index = 0; index < nElementCount; index++ )
-+ {
-+ Reference< XNameAccess > xNameAccess;
-+ xDlgContainer->getByName( pElementName[index] ) >>= xNameAccess;
-+ if ( xNameAccess.is() && xNameAccess->hasElements() )
-+ {
-+ bHasMacroLib = sal_True;
-+ break;
- }
- }
- }
-diff --git sfx2/source/doc/objmisc.cxx sfx2/source/doc/objmisc.cxx
-index af93a12..e2cd3ce 100755
---- sfx2/source/doc/objmisc.cxx
-+++ sfx2/source/doc/objmisc.cxx
-@@ -1681,7 +1681,7 @@ namespace
- }
-
- ErrCode SfxObjectShell::CallXScript( const Reference< XInterface >& _rxScriptContext, const ::rtl::OUString& _rScriptURL,
-- const Sequence< Any >& aParams, Any& aRet, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam, bool bRaiseError )
-+ const Sequence< Any >& aParams, Any& aRet, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam, bool bRaiseError, const ::com::sun::star::uno::Any* pCaller )
- {
- OSL_TRACE( "in CallXScript" );
- ErrCode nErr = ERRCODE_NONE;
-@@ -1712,7 +1712,16 @@ ErrCode SfxObjectShell::CallXScript( const Reference< XInterface >& _rxScriptCon
-
- // obtain the script, and execute it
- Reference< provider::XScript > xScript( xScriptProvider->getScript( _rScriptURL ), UNO_QUERY_THROW );
--
-+ if ( pCaller && pCaller->hasValue() )
-+ {
-+ Reference< beans::XPropertySet > xProps( xScript, uno::UNO_QUERY );
-+ if ( xProps.is() )
-+ {
-+ Sequence< uno::Any > aArgs( 1 );
-+ aArgs[ 0 ] = *pCaller;
-+ xProps->setPropertyValue( rtl::OUString::createFromAscii("Caller"), uno::makeAny( aArgs ) );
-+ }
-+ }
- aRet = xScript->invoke( aParams, aOutParamIndex, aOutParam );
- }
- catch ( const uno::Exception& )
-@@ -1745,10 +1754,10 @@ ErrCode SfxObjectShell::CallXScript( const String& rScriptURL,
- aParams,
- ::com::sun::star::uno::Any& aRet,
- ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
-- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam
-- , bool bRaiseError )
-+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >&
-+ aOutParam, bool bRaiseError, const ::com::sun::star::uno::Any* pCaller )
- {
-- return CallXScript( GetModel(), rScriptURL, aParams, aRet, aOutParamIndex, aOutParam, bRaiseError );
-+ return CallXScript( GetModel(), rScriptURL, aParams, aRet, aOutParamIndex, aOutParam, bRaiseError, pCaller );
- }
-
- //-------------------------------------------------------------------------
-diff --git sfx2/source/doc/objserv.cxx sfx2/source/doc/objserv.cxx
-index 795f5a2..3dd5597 100644
---- sfx2/source/doc/objserv.cxx
-+++ sfx2/source/doc/objserv.cxx
-@@ -100,6 +100,7 @@
- #include <com/sun/star/embed/XTransactedObject.hpp>
- #include <com/sun/star/util/XCloneable.hpp>
- #include <com/sun/star/document/XDocumentProperties.hpp>
-+#include <com/sun/star/document/XDocumentEventCompatibleHelper.hpp>
-
- #include "helpid.hrc"
-
-@@ -489,6 +490,18 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
- case SID_SAVEASDOC:
- case SID_SAVEDOC:
- {
-+ if( nId == SID_SAVEDOC || nId == SID_SAVEASDOC )
-+ {
-+ uno::Reference< document::XDocumentEventCompatibleHelper > xVbaEventHelper( GetModel(), uno::UNO_QUERY );
-+ if( xVbaEventHelper.is() )
-+ {
-+ if( xVbaEventHelper->processCompatibleEvent( nId ) )
-+ {
-+ rReq.SetReturnValue( SfxBoolItem( 0, sal_True ) );
-+ return;
-+ }
-+ }
-+ }
- //!! detaillierte Auswertung eines Fehlercodes
- SfxObjectShellRef xLock( this );
-
-diff --git sfx2/source/doc/objuno.cxx sfx2/source/doc/objuno.cxx
-index ac45ef5..ef49f5d 100644
---- sfx2/source/doc/objuno.cxx
-+++ sfx2/source/doc/objuno.cxx
-@@ -45,6 +45,7 @@
- #include <com/sun/star/lang/Locale.hpp>
- #include <com/sun/star/util/XModifiable.hpp>
- #include <com/sun/star/document/XDocumentProperties.hpp>
-+#include <com/sun/star/document/XCompatWriterDocProperties.hpp>
-
- #include <unotools/configmgr.hxx>
- #include <tools/inetdef.hxx>
-@@ -104,6 +105,9 @@ const SfxItemPropertyMapEntry* lcl_GetDocInfoPropertyMap()
- { "AutoloadEnabled" , 15, MID_DOCINFO_AUTOLOADENABLED, &::getBooleanCppuType(), PROPERTY_UNBOUND, 0 },
- { "AutoloadSecs" , 12, MID_DOCINFO_AUTOLOADSECS, &::getCppuType((const sal_Int32*)0), PROPERTY_UNBOUND, 0 },
- { "AutoloadURL" , 11, MID_DOCINFO_AUTOLOADURL, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
-+ { "Category" , 8 , MID_CATEGORY, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
-+ { "Company" , 7 , MID_COMPANY, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
-+ { "Manager" , 7 , MID_MANAGER, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
- { "CreationDate" , 12, WID_DATE_CREATED, &::getCppuType((const ::com::sun::star::util::DateTime*)0),PROPERTY_MAYBEVOID, 0 },
- { "DefaultTarget" , 13, MID_DOCINFO_DEFAULTTARGET, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
- { "Description" , 11, MID_DOCINFO_DESCRIPTION, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
-@@ -807,6 +811,22 @@ void SAL_CALL SfxDocumentInfoObject::setFastPropertyValue(sal_Int32 nHandle, co
- _pImp->m_xDocProps->setDefaultTarget(sTemp);
- break;
- // case WID_CONTENT_TYPE : // this is readonly!
-+ case MID_CATEGORY:
-+ case MID_MANAGER:
-+ case MID_COMPANY:
-+ {
-+ uno::Reference< document::XCompatWriterDocProperties > xWriterProps( _pImp->m_xDocProps, uno::UNO_QUERY );
-+ if ( xWriterProps.is() )
-+ {
-+ if ( nHandle == MID_CATEGORY )
-+ xWriterProps->setCategory( sTemp );
-+ else if ( nHandle == MID_MANAGER )
-+ xWriterProps->setManager( sTemp );
-+ else
-+ xWriterProps->setCompany( sTemp );
-+ break;
-+ }
-+ }
- default:
- break;
- }
-@@ -1024,6 +1044,23 @@ void SAL_CALL SfxDocumentInfoObject::setFastPropertyValue(sal_Int32 nHandle, co
- case MID_DOCINFO_CHARLOCALE:
- aValue <<= _pImp->m_xDocProps->getLanguage();
- break;
-+ case MID_CATEGORY:
-+ case MID_MANAGER:
-+ case MID_COMPANY:
-+ {
-+ uno::Reference< document::XCompatWriterDocProperties > xWriterProps( _pImp->m_xDocProps, uno::UNO_QUERY );
-+ if ( xWriterProps.is() )
-+ {
-+ if ( nHandle == MID_CATEGORY )
-+ aValue <<= xWriterProps->getCategory();
-+ else if ( nHandle == MID_MANAGER )
-+ aValue <<= xWriterProps->getManager();
-+ else
-+ aValue <<= xWriterProps->getCompany();
-+ break;
-+ }
-+ }
-+
- default:
- aValue <<= ::rtl::OUString();
- break;
-diff --git sfx2/source/doc/objxtor.cxx sfx2/source/doc/objxtor.cxx
-index 2298b93..856db2a 100644
---- sfx2/source/doc/objxtor.cxx
-+++ sfx2/source/doc/objxtor.cxx
-@@ -134,6 +134,40 @@ DBG_NAME(SfxObjectShell)
-
- static WeakReference< XInterface > s_xCurrentComponent;
-
-+void lcl_UpdateAppBasicDocVars( const Reference< XInterface >& _rxComponent, bool bClear = false )
-+{
-+ BasicManager* pAppMgr = SFX_APP()->GetBasicManager();
-+ if ( pAppMgr )
-+ {
-+ uno::Reference< beans::XPropertySet > xProps( _rxComponent, uno::UNO_QUERY );
-+ if ( xProps.is() )
-+ {
-+ try
-+ {
-+ // ThisVBADocObj contains a PropertyValue
-+ // Name is ( the name of the VBA global to insert )
-+ // Value is the Object to insert.
-+ // ( note: at the moment the Value is actually the model so
-+ // it strictly is not necessary, however we do intend to store
-+ // not the model in basic but a custom object, so we keep this
-+ // level of indirection for future proofing )
-+ beans::PropertyValue aProp;
-+ xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ThisVBADocObj") ) ) >>= aProp;
-+ rtl::OString sTmp( rtl::OUStringToOString( aProp.Name, RTL_TEXTENCODING_UTF8 ) );
-+ const char* pAscii = sTmp.getStr();
-+ if ( bClear )
-+ pAppMgr->SetGlobalUNOConstant( pAscii, uno::makeAny( uno::Reference< uno::XInterface >() ) );
-+ else
-+ pAppMgr->SetGlobalUNOConstant( pAscii, aProp.Value );
-+
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ }
-+ }
-+ }
-+}
-+
- //=========================================================================
-
-
-@@ -168,6 +202,7 @@ void SAL_CALL SfxModelListener_Impl::disposing( const com::sun::star::lang::Even
- ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
- if ( SfxObjectShell::GetCurrentComponent() == _rEvent.Source )
- {
-+ lcl_UpdateAppBasicDocVars( SfxObjectShell::GetCurrentComponent(), true );
- // remove ThisComponent reference from AppBasic
- SfxObjectShell::SetCurrentComponent( Reference< XInterface >() );
- }
-@@ -524,6 +559,13 @@ SfxObjectShell* SfxObjectShell::Current()
- return pFrame ? pFrame->GetObjectShell() : 0;
- }
-
-+//-------------------------------------------------------------------------
-+
-+sal_Bool SfxObjectShell::IsInPrepareClose() const
-+{
-+ return pImp->bInPrepareClose;
-+}
-+
- //------------------------------------------------------------------------
-
- struct BoolEnv_Impl
-@@ -910,7 +952,10 @@ void SfxObjectShell::SetCurrentComponent( const Reference< XInterface >& _rxComp
- BasicManager* pAppMgr = SFX_APP()->GetBasicManager();
- s_xCurrentComponent = _rxComponent;
- if ( pAppMgr )
-+ {
-+ lcl_UpdateAppBasicDocVars( _rxComponent );
- pAppMgr->SetGlobalUNOConstant( "ThisComponent", makeAny( _rxComponent ) );
-+ }
-
- #if OSL_DEBUG_LEVEL > 0
- const char* pComponentImplName = _rxComponent.get() ? typeid( *_rxComponent.get() ).name() : "void";
-diff --git sfx2/source/doc/oleprops.hxx sfx2/source/doc/oleprops.hxx
-index 0fddd50..c277ec5 100755
---- sfx2/source/doc/oleprops.hxx
-+++ sfx2/source/doc/oleprops.hxx
-@@ -80,6 +80,10 @@ const sal_Int32 PROPID_CREATED = 12;
- const sal_Int32 PROPID_LASTSAVED = 13;
- const sal_Int32 PROPID_THUMBNAIL = 17;
-
-+// some Builtin properties
-+const sal_Int32 PROPID_CATEGORY = 0x2;
-+const sal_Int32 PROPID_COMPANY = 0xf;
-+const sal_Int32 PROPID_MANAGER = 0xe;
- // predefined codepages
- const sal_uInt16 CODEPAGE_UNKNOWN = 0;
- const sal_uInt16 CODEPAGE_UNICODE = 1200;
-diff --git sfx2/source/doc/sfxbasemodel.cxx sfx2/source/doc/sfxbasemodel.cxx
-index 7a5f630..b43886d 100644
---- sfx2/source/doc/sfxbasemodel.cxx
-+++ sfx2/source/doc/sfxbasemodel.cxx
-@@ -881,7 +881,15 @@ uno::Reference< document::XDocumentInfo > SAL_CALL SfxBaseModel::getDocumentInfo
-
- return m_pData->m_xDocumentInfo;
- }
--
-+void
-+SfxBaseModel::setDocumentProperties( const uno::Reference< document::XDocumentProperties >& rxNewDocProps )
-+{
-+ // object already disposed?
-+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
-+ if ( impl_isDisposed() )
-+ throw lang::DisposedException();
-+ m_pData->m_xDocumentProperties.set(rxNewDocProps, uno::UNO_QUERY_THROW);
-+}
- // document::XDocumentPropertiesSupplier:
- uno::Reference< document::XDocumentProperties > SAL_CALL
- SfxBaseModel::getDocumentProperties()
-@@ -3517,15 +3525,23 @@ void SAL_CALL SfxBaseModel::switchToStorage( const uno::Reference< XSTORAGE >& x
- throw IOEXCEPTION(); // TODO:
-
- // the persistence should be switched only if the storage is different
-- if ( xStorage != m_pData->m_pObjectShell->GetStorage()
-- && !m_pData->m_pObjectShell->SwitchPersistance( xStorage ) )
-- {
-- sal_uInt32 nError = m_pData->m_pObjectShell->GetErrorCode();
-- throw task::ErrorCodeIOException( ::rtl::OUString(),
-- uno::Reference< uno::XInterface >(),
-- nError ? nError : ERRCODE_IO_GENERAL );
-- }
--
-+ if ( xStorage != m_pData->m_pObjectShell->GetStorage() )
-+ {
-+ if ( !m_pData->m_pObjectShell->SwitchPersistance( xStorage ) )
-+ {
-+ sal_uInt32 nError = m_pData->m_pObjectShell->GetErrorCode();
-+ throw task::ErrorCodeIOException( ::rtl::OUString(),
-+ uno::Reference< uno::XInterface >(),
-+ nError ? nError : ERRCODE_IO_GENERAL );
-+ }
-+ else
-+ {
-+ // UICfgMgr has a reference to the old storage, update it
-+ uno::Reference< ui::XUIConfigurationStorage > xUICfgMgrStorage( getUIConfigurationManager(), uno::UNO_QUERY );
-+ if ( xUICfgMgrStorage.is() )
-+ xUICfgMgrStorage->setStorage( xStorage );
-+ }
-+ }
- m_pData->m_pObjectShell->Get_Impl()->bOwnsStorage = FALSE;
- }
-
-diff --git sfx2/source/inc/SfxDocumentMetaData.hxx sfx2/source/inc/SfxDocumentMetaData.hxx
-index 871ed19..6114339 100644
---- sfx2/source/inc/SfxDocumentMetaData.hxx
-+++ sfx2/source/inc/SfxDocumentMetaData.hxx
-@@ -45,5 +45,16 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL _create(
-
- } // closing component helper namespace
-
-+namespace comp_CompatWriterDocProps {
-+
-+namespace css = ::com::sun::star;
-+
-+// component and service helper functions:
-+::rtl::OUString SAL_CALL _getImplementationName();
-+css::uno::Sequence< ::rtl::OUString > SAL_CALL _getSupportedServiceNames();
-+css::uno::Reference< css::uno::XInterface > SAL_CALL _create(
-+ css::uno::Reference< css::uno::XComponentContext > const & context );
-+
-+}
- #endif
-
-diff --git sfx2/source/view/viewprn.cxx sfx2/source/view/viewprn.cxx
-index b4e6b05..7923d9a 100644
---- sfx2/source/view/viewprn.cxx
-+++ sfx2/source/view/viewprn.cxx
-@@ -29,6 +29,7 @@
- #include "precompiled_sfx2.hxx"
-
- #include <com/sun/star/document/XDocumentProperties.hpp>
-+#include <com/sun/star/document/XDocumentEventCompatibleHelper.hpp>
- #include <com/sun/star/view/PrintableState.hpp>
- #include "com/sun/star/view/XRenderable.hpp"
-
-@@ -697,6 +698,15 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
- case SID_PRINTDOCDIRECT:
- {
- SfxObjectShell* pDoc = GetObjectShell();
-+ uno::Reference< document::XDocumentEventCompatibleHelper > xVbaEventHelper( pDoc->GetModel(), uno::UNO_QUERY );
-+ if( xVbaEventHelper.is() )
-+ {
-+ if( xVbaEventHelper->processCompatibleEvent( nId ) )
-+ {
-+ rReq.SetReturnValue(SfxBoolItem(0,FALSE));
-+ return;
-+ }
-+ }
- bool bDetectHidden = ( !bSilent && pDoc );
- if ( bDetectHidden && pDoc->QueryHiddenInformation( WhenPrinting, NULL ) != RET_YES )
- break;
-@@ -758,6 +768,23 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
- case SID_SETUPPRINTER :
- case SID_PRINTER_NAME : // only for recorded macros
- {
-+ if( nId == SID_PRINTDOC )
-+ {
-+ SfxObjectShell* pDoc = GetObjectShell();
-+ if( pDoc )
-+ {
-+ uno::Reference< document::XDocumentEventCompatibleHelper > xVbaEventHelper( pDoc->GetModel(), uno::UNO_QUERY );
-+ if( xVbaEventHelper.is() )
-+ {
-+ if( xVbaEventHelper->processCompatibleEvent( nId ) )
-+ {
-+ rReq.SetReturnValue(SfxBoolItem(0,FALSE));
-+ return;
-+ }
-+ }
-+ }
-+ }
-+
- // get printer and printer settings from the document
- SfxPrinter *pDocPrinter = GetPrinter(TRUE);
-
-@@ -863,6 +890,10 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
- aReq.AppendItem( SfxStringItem( SID_PRINTER_NAME, pDlgPrinter->GetName() ) );
- aReq.Done();
- }
-+ if ( nId == SID_SETUPPRINTER )
-+ {
-+ rReq.AppendItem( SfxBoolItem( SID_DIALOG_RETURN, TRUE ) );
-+ }
-
- // take the changes made in the dialog
- pPrinter = SetPrinter_Impl( pDlgPrinter );
-@@ -883,6 +914,10 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
- rReq.Ignore();
- if ( SID_PRINTDOC == nId )
- rReq.SetReturnValue(SfxBoolItem(0,FALSE));
-+ if ( nId == SID_SETUPPRINTER )
-+ {
-+ rReq.AppendItem( SfxBoolItem( SID_DIALOG_RETURN, FALSE ) );
-+ }
- }
- }
- }
-diff --git svtools/inc/bindablecontrolhelper.hxx svtools/inc/bindablecontrolhelper.hxx
-new file mode 100644
-index 0000000..e9cd3e6
---- /dev/null
-+++ svtools/inc/bindablecontrolhelper.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: imageresourceaccess.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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef SVTOOLS_INC_BINDABLECONTROL_HXX
-+#define SVTOOLS_INC_BINDABLECONTROL_HXX
-+
-+#include "svtools/svtdllapi.h"
-+
-+#include <com/sun/star/frame/XModel.hpp>
-+//........................................................................
-+namespace svt
-+{
-+//........................................................................
-+
-+ //====================================================================
-+ //= GraphicAccess
-+ //====================================================================
-+ /** helper class for obtaining streams (which also can be used with the ImageProducer)
-+ from a resource
-+ */
-+ class BindableControlHelper
-+ {
-+ private:
-+ BindableControlHelper(); // never implemented
-+
-+ public:
-+ SVT_DLLPUBLIC static void ApplyListSourceAndBindableData( const com::sun::star::uno::Reference< com::sun::star::frame::XModel >& xModel, const com::sun::star::uno::Reference< com::sun::star::uno::XInterface >& rObj, const rtl::OUString& rsCtrlSource, const rtl::OUString& rsRowSource );
-+ };
-+
-+//........................................................................
-+} // namespace svt
-+//........................................................................
-+
-+#endif // DBA14_SVTOOLS_INC_IMAGERESOURCEACCESS_HXX
-+
-diff --git svtools/inc/filterutils.hxx svtools/inc/filterutils.hxx
-new file mode 100644
-index 0000000..a05025f
---- /dev/null
-+++ svtools/inc/filterutils.hxx
-@@ -0,0 +1,22 @@
-+#ifndef SVTOOLS_INC_FILTERUTILS_HXX
-+#define SVTOOLS_INC_FILTERUTILS_HXX
-+
-+#include "svtools/svtdllapi.h"
-+#include <com/sun/star/uno/RuntimeException.hpp>
-+namespace svt
-+{
-+ class BinFilterUtils
-+ {
-+ private:
-+ BinFilterUtils(); // never implemented
-+
-+ public:
-+ SVT_DLLPUBLIC static rtl::OUString CreateOUStringFromUniStringArray( const char* pcCharArr, sal_uInt32 nBufSize );
-+ SVT_DLLPUBLIC static rtl::OUString CreateOUStringFromStringArray( const char* pcCharArr, sal_uInt32 nBufSize );
-+ };
-+
-+//........................................................................
-+} // namespace svt
-+//........................................................................
-+
-+#endif
-diff --git svtools/source/misc/bindablecontrolhelper.cxx svtools/source/misc/bindablecontrolhelper.cxx
-new file mode 100644
-index 0000000..ba842f0
---- /dev/null
-+++ svtools/source/misc/bindablecontrolhelper.cxx
-@@ -0,0 +1,162 @@
-+/*************************************************************************
-+ *
-+ * 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: imageresourceaccess.cxx,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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_svtools.hxx"
-+#include "bindablecontrolhelper.hxx"
-+#include <com/sun/star/form/binding/XBindableValue.hpp>
-+#include <com/sun/star/form/binding/XValueBinding.hpp>
-+#include <com/sun/star/form/binding/XListEntrySink.hpp>
-+#include <com/sun/star/form/binding/XListEntrySource.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <com/sun/star/container/XNameAccess.hpp>
-+#include <com/sun/star/table/CellRangeAddress.hpp>
-+#include <com/sun/star/sheet/XCellRangeReferrer.hpp>
-+#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
-+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-+#include <com/sun/star/table/CellAddress.hpp>
-+#include <com/sun/star/beans/NamedValue.hpp>
-+
-+//........................................................................
-+namespace svt
-+{
-+//........................................................................
-+
-+#ifndef C2U
-+#define C2U(cChar) rtl::OUString::createFromAscii(cChar)
-+#endif
-+
-+ using namespace ::com::sun::star;
-+
-+bool lcl_isNamedRange( const rtl::OUString& sAddress, const uno::Reference< frame::XModel >& xModel, table::CellRangeAddress& aAddress )
-+{
-+ bool bRes = false;
-+ const static rtl::OUString sNamedRanges( RTL_CONSTASCII_USTRINGPARAM("NamedRanges"));
-+ uno::Reference< sheet::XCellRangeReferrer > xReferrer;
-+ try
-+ {
-+ uno::Reference< beans::XPropertySet > xPropSet( xModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XNameAccess > xNamed( xPropSet->getPropertyValue( sNamedRanges ), uno::UNO_QUERY_THROW );
-+ xReferrer.set ( xNamed->getByName( sAddress ), uno::UNO_QUERY );
-+ }
-+ catch( uno::Exception& /*e*/ )
-+ {
-+ // do nothing
-+ }
-+ if ( xReferrer.is() )
-+ {
-+ uno::Reference< sheet::XCellRangeAddressable > xRangeAddressable( xReferrer->getReferredCells(), uno::UNO_QUERY );
-+ if ( xRangeAddressable.is() )
-+ {
-+ aAddress = xRangeAddressable->getRangeAddress();
-+ bRes = true;
-+ }
-+ }
-+ return bRes;
-+}
-+
-+
-+void
-+BindableControlHelper::ApplyListSourceAndBindableData( const com::sun::star::uno::Reference< com::sun::star::frame::XModel >& xModel, const com::sun::star::uno::Reference< com::sun::star::uno::XInterface >& rObj, const rtl::OUString& rsCtrlSource, const rtl::OUString& rsRowSource )
-+{
-+// XBindable etc.
-+ uno::Reference< lang::XMultiServiceFactory > xFac;
-+ if ( xModel.is() )
-+ xFac.set( xModel, uno::UNO_QUERY );
-+ uno::Reference< form::binding::XBindableValue > xBindable( rObj, uno::UNO_QUERY );
-+ if ( xFac.is() && rsCtrlSource.getLength() && xBindable.is() )
-+ {
-+
-+ // OOo address structures
-+ // RefCell - convert from XL
-+ // pretend we converted the imported string address into the
-+ // appropriate address structure
-+ uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( C2U( "com.sun.star.table.CellAddressConversion" )), uno::UNO_QUERY );
-+ table::CellAddress aAddress;
-+ if ( xConvertor.is() )
-+ {
-+ // we need this service to properly convert XL notation also
-+ // Should be easy to extend
-+ xConvertor->setPropertyValue( C2U( "XL_A1_Representation" ), uno::makeAny( rsCtrlSource ) );
-+ xConvertor->getPropertyValue( C2U( "Address" ) ) >>= aAddress;
-+ }
-+
-+ beans::NamedValue aArg1;
-+ aArg1.Name = C2U("BoundCell");
-+ aArg1.Value <<= aAddress;
-+
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[ 0 ] <<= aArg1;
-+
-+ uno::Reference< form::binding::XValueBinding > xBinding( xFac->createInstanceWithArguments( C2U("com.sun.star.table.CellValueBinding" ), aArgs ), uno::UNO_QUERY );
-+ xBindable->setValueBinding( xBinding );
-+ }
-+ else if ( xBindable.is() ) // reset it
-+ xBindable->setValueBinding( uno::Reference< form::binding::XValueBinding >() );
-+ uno::Reference< form::binding::XListEntrySink > xListEntrySink( rObj, uno::UNO_QUERY );
-+ if ( xFac.is() && rsRowSource.getLength() && xListEntrySink.is() )
-+ {
-+
-+ // OOo address structures
-+ // RefCell - convert from XL
-+ // pretend we converted the imported string address into the
-+ // appropriate address structure
-+ uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( C2U( "com.sun.star.table.CellRangeAddressConversion" )), uno::UNO_QUERY );
-+ table::CellRangeAddress aAddress;
-+ if ( xConvertor.is() )
-+ {
-+ if ( !lcl_isNamedRange( rsRowSource, xModel, aAddress ) )
-+ {
-+ // we need this service to properly convert XL notation also
-+ // Should be easy to extend
-+ xConvertor->setPropertyValue( C2U( "XL_A1_Representation" ), uno::makeAny( rsRowSource ) );
-+ xConvertor->getPropertyValue( C2U( "Address" ) ) >>= aAddress;
-+ }
-+ }
-+
-+ beans::NamedValue aArg1;
-+ aArg1.Name = C2U("CellRange");
-+ aArg1.Value <<= aAddress;
-+
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[ 0 ] <<= aArg1;
-+
-+ uno::Reference< form::binding::XListEntrySource > xSource( xFac->createInstanceWithArguments( C2U("com.sun.star.table.CellRangeListSource" ), aArgs ), uno::UNO_QUERY );
-+ xListEntrySink->setListEntrySource( xSource );
-+ }
-+ else if ( xListEntrySink.is() ) // reset
-+ xListEntrySink->setListEntrySource( uno::Reference< form::binding::XListEntrySource >() );
-+
-+}
-+
-+//........................................................................
-+} // namespace svt
-+//........................................................................
-+
-diff --git svtools/source/misc/filterutils.cxx svtools/source/misc/filterutils.cxx
-new file mode 100644
-index 0000000..91a6ca4
---- /dev/null
-+++ svtools/source/misc/filterutils.cxx
-@@ -0,0 +1,56 @@
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_svtools.hxx"
-+#include "filterutils.hxx"
-+#include <rtl/ustrbuf.hxx>
-+
-+namespace svt
-+{
-+//........................................................................
-+
-+ using namespace ::com::sun::star;
-+
-+ rtl::OUString lcl_createStringFromArray( const char* pcCharArr, sal_uInt32 nBufSize, bool bIsCompressed )
-+ {
-+ rtl::OUStringBuffer aBuffer;
-+ if( bIsCompressed )
-+ {
-+ // buffer contains compressed Unicode, not encoded bytestring
-+ sal_Int32 nStrLen = static_cast< sal_Int32 >( nBufSize );
-+ aBuffer.setLength( nStrLen );
-+ const char* pcCurrChar = pcCharArr;
-+ for( sal_Int32 nChar = 0; nChar < nStrLen; ++nChar, ++pcCurrChar )
-+ /* *pcCurrChar may contain negative values and therefore MUST be
-+ casted to unsigned char, before assigned to a sal_Unicode. */
-+ aBuffer.setCharAt( nChar, static_cast< unsigned char >( *pcCurrChar ) );
-+ }
-+ else
-+ {
-+ // buffer contains Little-Endian Unicode
-+ sal_Int32 nStrLen = static_cast< sal_Int32 >( nBufSize ) / 2;
-+ aBuffer.setLength( nStrLen );
-+ const char* pcCurrChar = pcCharArr;
-+ for( sal_Int32 nChar = 0; nChar < nStrLen; ++nChar )
-+ {
-+ /* *pcCurrChar may contain negative values and therefore MUST be
-+ casted to unsigned char, before assigned to a sal_Unicode. */
-+ sal_Unicode cChar = static_cast< unsigned char >( *pcCurrChar++ );
-+ cChar |= (static_cast< unsigned char >( *pcCurrChar++ ) << 8);
-+ aBuffer.setCharAt( nChar, cChar );
-+ }
-+ }
-+ return aBuffer.makeStringAndClear();
-+ }
-+
-+ rtl::OUString BinFilterUtils::CreateOUStringFromUniStringArray( const char* pcCharArr, sal_uInt32 nBufSize )
-+ {
-+ return lcl_createStringFromArray( pcCharArr, nBufSize, false );
-+ }
-+
-+ rtl::OUString BinFilterUtils::CreateOUStringFromStringArray( const char* pcCharArr, sal_uInt32 nBufSize )
-+ {
-+ return lcl_createStringFromArray( pcCharArr, nBufSize, true );
-+ }
-+//........................................................................
-+} // namespace svt
-+//........................................................................
-+
-diff --git svtools/source/misc/makefile.mk svtools/source/misc/makefile.mk
-index 65e4374..4bbd815 100644
---- svtools/source/misc/makefile.mk
-+++ svtools/source/misc/makefile.mk
-@@ -75,6 +75,8 @@ SLOFILES=\
- $(SLO)$/transfer.obj \
- $(SLO)$/transfer2.obj \
- $(SLO)$/unitconv.obj \
-+ $(SLO)$/bindablecontrolhelper.obj \
-+ $(SLO)$/filterutils.obj \
- $(SLO)$/wallitem.obj
-
- # --- Targets -------------------------------------------------------
-diff --git svx/source/form/fmscriptingenv.cxx svx/source/form/fmscriptingenv.cxx
-index 74d9585..c14d2f1 100644
---- svx/source/form/fmscriptingenv.cxx
-+++ svx/source/form/fmscriptingenv.cxx
-@@ -36,6 +36,8 @@
- #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
- #include <com/sun/star/reflection/XInterfaceMethodTypeDescription.hpp>
- #include <com/sun/star/lang/DisposedException.hpp>
-+#include <com/sun/star/lang/EventObject.hpp>
-+#include <com/sun/star/awt/XControl.hpp>
- /** === end UNO includes === **/
- #include <tools/diagnose_ex.h>
- #include <cppuhelper/implbase1.hxx>
-@@ -71,6 +73,9 @@ namespace svxform
- using ::com::sun::star::uno::Exception;
- using ::com::sun::star::uno::Sequence;
- using ::com::sun::star::uno::XInterface;
-+ using ::com::sun::star::lang::EventObject;
-+ using ::com::sun::star::awt::XControl;
-+ using ::com::sun::star::beans::XPropertySet;
- /** === end UNO using === **/
-
- class FormScriptingEnvironment;
-@@ -413,8 +418,19 @@ namespace svxform
- {
- Sequence< sal_Int16 > aOutArgsIndex;
- Sequence< Any > aOutArgs;
--
-- m_rObjectShell.CallXScript( m_sScriptCode, _rArguments, _rSynchronousResult, aOutArgsIndex, aOutArgs );
-+ EventObject aEvent;
-+ Any aCaller;
-+ if ( ( _rArguments.getLength() > 0 ) && ( _rArguments[ 0 ] >>= aEvent ) )
-+ {
-+ try
-+ {
-+ Reference< XControl > xControl( aEvent.Source, UNO_QUERY_THROW );
-+ Reference< XPropertySet > xProps( xControl->getModel(), UNO_QUERY_THROW );
-+ aCaller = xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ) );
-+ }
-+ catch( Exception& ) {}
-+ }
-+ m_rObjectShell.CallXScript( m_sScriptCode, _rArguments, _rSynchronousResult, aOutArgsIndex, aOutArgs, true, aCaller.hasValue() ? &aCaller : 0 );
- }
-
- //................................................................
-diff --git svx/source/form/makefile.mk svx/source/form/makefile.mk
-index d6dc1bd..276df21 100644
---- svx/source/form/makefile.mk
-+++ svx/source/form/makefile.mk
-@@ -41,6 +41,10 @@ ENABLE_EXCEPTIONS=TRUE
- # --- Files --------------------------------------------------------
-
- .IF "$(ENABLE_VBA)"=="YES"
-+ CDEFS+=-DENABLE_VBA
-+.ENDIF
-+
-+.IF "$(ENABLE_VBA)"=="YES"
- CDEFS+=-DENABLE_VBA
- .ENDIF
-
-diff --git sw/inc/doc.hxx sw/inc/doc.hxx
-index ab413e1..42cc627 100644
---- sw/inc/doc.hxx
-+++ sw/inc/doc.hxx
-@@ -79,6 +79,7 @@ class SwList;
- #include "comphelper/implementationreference.hxx"
- #include <com/sun/star/chart2/data/XDataProvider.hpp>
- #include <com/sun/star/linguistic2/XProofreadingIterator.hpp>
-+#include <com/sun/star/document/XVbaEventsHelper.hpp>
-
- #include <hash_map>
- #include <stringhash.hxx>
-@@ -405,6 +406,8 @@ class SW_DLLPUBLIC SwDoc :
-
- // table of forbidden characters of this document
- vos::ORef<SvxForbiddenCharactersTable> xForbiddenCharsTable;
-+ com::sun::star::uno::Reference<com::sun::star::container::XNameContainer> m_xTemplateToProjectCache;
-+ com::sun::star::uno::Reference< com::sun::star::document::XVbaEventsHelper > mxVbaEventsHelper;
-
- // --> OD 2007-10-26 #i83479#
- public:
-@@ -2128,6 +2131,9 @@ public:
- {
- return n32DummyCompatabilityOptions2;
- }
-+ void SetVBATemplateToProjectCache( com::sun::star::uno::Reference< com::sun::star::container::XNameContainer >& xCache ) { m_xTemplateToProjectCache = xCache; };
-+ com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > GetVBATemplateToProjectCache() { return m_xTemplateToProjectCache; };
-+ com::sun::star::uno::Reference< com::sun::star::document::XVbaEventsHelper > GetVbaEventsHelper();
-
- ::sfx2::IXmlIdRegistry& GetXmlIdRegistry();
- ::sw::MetaFieldManager & GetMetaFieldManager();
-diff --git sw/inc/docsh.hxx sw/inc/docsh.hxx
-index 0f1a15b..733baef 100755
---- sw/inc/docsh.hxx
-+++ sw/inc/docsh.hxx
-@@ -82,6 +82,7 @@ class SW_DLLPUBLIC SwDocShell: public SfxObjectShell, public SfxListener
- comphelper::EmbeddedObjectContainer* pOLEChildList;
- sal_Int16 nUpdateDocMode; // contains the com::sun::star::document::UpdateDocMode
- bool bInUpdateFontList; //prevent nested calls of UpdateFontList
-+ bool bIsATemplate; //prevent nested calls of UpdateFontList
- // Methoden fuer den Zugriff aufs Doc
- SW_DLLPRIVATE void AddLink();
- SW_DLLPRIVATE void RemoveLink();
-@@ -300,6 +301,8 @@ public:
- GetController();
-
- SfxInPlaceClient* GetIPClient( const ::svt::EmbeddedObjectRef& xObjRef );
-+ SW_DLLPRIVATE sal_Bool IsTemplate() { return bIsATemplate; }
-+ SW_DLLPRIVATE void SetIsTemplate( bool bValue ) { bIsATemplate = bValue; }
-
- virtual const ::sfx2::IXmlIdRegistry* GetXmlIdRegistry() const;
- };
-diff --git sw/inc/unocoll.hxx sw/inc/unocoll.hxx
-index bf6ba28..805b68c 100644
---- sw/inc/unocoll.hxx
-+++ sw/inc/unocoll.hxx
-@@ -195,8 +195,12 @@ class SwUnoCollection
- #define SW_SERVICE_TYPE_FIELDMARK 107
- #define SW_SERVICE_TYPE_FORMFIELDMARK 108
- #define SW_SERVICE_TYPE_META 109
-+#define SW_SERVICE_VBAOBJECTPROVIDER 110
-+#define SW_SERVICE_VBACODENAMEPROVIDER 111
-+#define SW_SERVICE_VBAPROJECTNAMEPROVIDER 112
-+#define SW_SERVICE_VBAGLOBALS 113
-
--#define SW_SERVICE_LAST SW_SERVICE_TYPE_META
-+#define SW_SERVICE_LAST SW_SERVICE_VBAGLOBALS
-
- #define SW_SERVICE_INVALID USHRT_MAX
-
-diff --git sw/inc/unoprnms.hxx sw/inc/unoprnms.hxx
-index 374753b..2dfc961 100644
---- sw/inc/unoprnms.hxx
-+++ sw/inc/unoprnms.hxx
-@@ -805,8 +805,10 @@ enum SwPropNameIds
- /* 0737 */ UNO_NAME_DESCRIPTION,
- // <--
- /* 0738 */ UNO_NAME_META, // #i91565#
--/* 0739 */ UNO_NAME_NESTED_TEXT_CONTENT, // #i109601#
--/* 0740 */ SW_PROPNAME_END
-+/* 0739 */ UNO_NAME_IS_TEMPLATE,
-+/* 0740 */ UNO_NAME_VBA_DOCOBJ,
-+/* 0741 */ UNO_NAME_NESTED_TEXT_CONTENT, // #i109601#
-+/* 0742 */ SW_PROPNAME_END
- };
-
-
-diff --git sw/inc/unotbl.hxx sw/inc/unotbl.hxx
-index ab6f6c6..7aa83d8 100644
---- sw/inc/unotbl.hxx
-+++ sw/inc/unotbl.hxx
-@@ -337,7 +337,7 @@ public:
- SwXTextTable(SwFrmFmt& rFrmFmt);
-
-
-- static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
-+ SW_DLLPUBLIC static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
-
- //XUnoTunnel
- virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
-diff --git sw/source/core/doc/doc.cxx sw/source/core/doc/doc.cxx
-index d25e4bd..9d970aa 100755
---- sw/source/core/doc/doc.cxx
-+++ sw/source/core/doc/doc.cxx
-@@ -119,6 +119,7 @@
-
- #include <osl/diagnose.h>
- #include <osl/interlck.h>
-+#include <vbahelper/vbaaccesshelper.hxx>
-
- /* @@@MAINTAINABILITY-HORROR@@@
- Probably unwanted dependency on SwDocShell
-@@ -2721,6 +2722,28 @@ void SwDoc::ChkCondColls()
- }
- }
-
-+uno::Reference< document::XVbaEventsHelper >
-+SwDoc::GetVbaEventsHelper()
-+{
-+ if( !mxVbaEventsHelper.is() && GetDocShell() && ooo::vba::isAlienWordDoc( *GetDocShell() ) )
-+ {
-+ try
-+ {
-+ uno::Reference< lang::XMultiServiceFactory > xSF( comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
-+ uno::Reference< frame::XModel > xModel( pDocShell ? pDocShell->GetModel() : NULL, uno::UNO_QUERY );
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] = uno::Any( xModel );
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper( xSF->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocumentVbaEventsHelper" ) ), aArgs ), uno::UNO_QUERY );
-+ // helper will always be created successfully.
-+ mxVbaEventsHelper.set( xVbaEventsHelper, uno::UNO_QUERY );
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ }
-+ }
-+ return mxVbaEventsHelper;
-+}
-+
- void SwDoc::setExternalData(::sw::tExternalDataType eType,
- ::sw::tExternalDataPointer pPayload)
- {
-diff --git sw/source/core/unocore/unocoll.cxx sw/source/core/unocore/unocoll.cxx
-index 03df3e1..9e71620 100644
---- sw/source/core/unocore/unocoll.cxx
-+++ sw/source/core/unocore/unocoll.cxx
-@@ -79,7 +79,16 @@
- #include <unorefmark.hxx>
- #include <unometa.hxx>
- #include "docsh.hxx"
--
-+#include <com/sun/star/document/XCodeNameQuery.hpp>
-+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
-+#include <com/sun/star/form/XFormsSupplier.hpp>
-+#include <com/sun/star/script/ModuleInfo.hpp>
-+#include <com/sun/star/script/ModuleType.hpp>
-+#include <com/sun/star/script/ScriptEventDescriptor.hpp>
-+#include <com/sun/star/script/XVBAModuleInfo.hpp>
-+#include <vbahelper/vbaaccesshelper.hxx>
-+#include <basic/basmgr.hxx>
-+#include <comphelper/processfactory.hxx>
-
- using ::rtl::OUString;
- using namespace ::com::sun::star;
-@@ -89,6 +98,184 @@ using namespace ::com::sun::star::text;
- using namespace ::com::sun::star::container;
- using namespace ::com::sun::star::lang;
-
-+class SwVbaCodeNameProvider : public ::cppu::WeakImplHelper1< document::XCodeNameQuery >
-+{
-+ SwDocShell* mpDocShell;
-+ rtl::OUString msThisDocumentCodeName;
-+public:
-+ SwVbaCodeNameProvider( SwDocShell* pDocShell ) : mpDocShell( pDocShell ) {}
-+ // XCodeNameQuery
-+ rtl::OUString SAL_CALL getCodeNameForObject( const uno::Reference< uno::XInterface >& xIf ) throw( uno::RuntimeException )
-+ {
-+ // Initialise the code name
-+ if ( msThisDocumentCodeName.getLength() == 0 )
-+ {
-+ try
-+ {
-+ uno::Reference< beans::XPropertySet > xProps( mpDocShell->GetModel(), uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XNameAccess > xLibContainer( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BasicLibraries") ) ), uno::UNO_QUERY_THROW );
-+ rtl::OUString sProjectName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Standard") ) );
-+ if ( mpDocShell->GetBasicManager()->GetName().Len() )
-+ sProjectName = mpDocShell->GetBasicManager()->GetName();
-+
-+ uno::Reference< container::XNameAccess > xLib( xLibContainer->getByName( sProjectName ), uno::UNO_QUERY_THROW );
-+ uno::Sequence< rtl::OUString > sModuleNames = xLib->getElementNames();
-+ uno::Reference< script::XVBAModuleInfo > xVBAModuleInfo( xLib, uno::UNO_QUERY );
-+
-+ for ( sal_Int32 i=0; i < sModuleNames.getLength(); ++i )
-+ {
-+ script::ModuleInfo mInfo;
-+
-+ if ( xVBAModuleInfo->hasModuleInfo( sModuleNames[ i ] ) && xVBAModuleInfo->getModuleInfo( sModuleNames[ i ] ).ModuleType == script::ModuleType::DOCUMENT )
-+ {
-+ msThisDocumentCodeName = sModuleNames[ i ];
-+ break;
-+ }
-+ }
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+ }
-+ rtl::OUString sCodeName;
-+ if ( mpDocShell )
-+ {
-+ OSL_TRACE( "*** In ScVbaCodeNameProvider::getCodeNameForObject");
-+ // need to find the page ( and index ) for this control
-+ uno::Reference< drawing::XDrawPageSupplier > xSupplier( mpDocShell->GetModel(), uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xIndex( xSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
-+ sal_Int32 nLen = xIndex->getCount();
-+ bool bMatched = false;
-+ uno::Sequence< script::ScriptEventDescriptor > aFakeEvents;
-+ try
-+ {
-+ uno::Reference< form::XFormsSupplier > xFormSupplier( xIndex, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xFormIndex( xFormSupplier->getForms(), uno::UNO_QUERY_THROW );
-+ // get the www-standard container
-+ uno::Reference< container::XIndexAccess > xFormControls( xFormIndex->getByIndex(0), uno::UNO_QUERY_THROW );
-+ sal_Int32 nCntrls = xFormControls->getCount();
-+ for( sal_Int32 cIndex = 0; cIndex < nCntrls; ++cIndex )
-+ {
-+ uno::Reference< uno::XInterface > xControl( xFormControls->getByIndex( cIndex ), uno::UNO_QUERY_THROW );
-+ bMatched = ( xControl == xIf );
-+ if ( bMatched )
-+ {
-+ sCodeName = msThisDocumentCodeName;
-+ break;
-+ }
-+ }
-+ }
-+ catch( uno::Exception& ) {}
-+ }
-+ // Probably should throw here ( if !bMatched )
-+ return sCodeName;
-+ }
-+};
-+
-+typedef std::hash_map< rtl::OUString, rtl::OUString, rtl::OUStringHash > StringHashMap;
-+class SwVbaProjectNameProvider : public ::cppu::WeakImplHelper1< container::XNameContainer >
-+{
-+ SwDocShell* mpDocShell;
-+ StringHashMap mTemplateToProject;
-+public:
-+ SwVbaProjectNameProvider( SwDocShell* pDocShell ) : mpDocShell( pDocShell )
-+ {
-+ }
-+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException )
-+ {
-+ return ( mTemplateToProject.find( aName ) != mTemplateToProject.end() );
-+ }
-+ virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
-+ {
-+ if ( !hasByName( aName ) )
-+ throw container::NoSuchElementException();
-+ return uno::makeAny( mTemplateToProject.find( aName )->second );
-+ }
-+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (::com::sun::star::uno::RuntimeException)
-+ {
-+ uno::Sequence< rtl::OUString > aElements( mTemplateToProject.size() );
-+ StringHashMap::iterator it_end = mTemplateToProject.end();
-+ sal_Int32 index = 0;
-+ for ( StringHashMap::iterator it = mTemplateToProject.begin(); it != it_end; ++it, ++index )
-+ aElements[ index ] = it->first;
-+ return aElements;
-+ }
-+
-+ virtual void SAL_CALL insertByName( const rtl::OUString& aName, const uno::Any& aElement ) throw ( com::sun::star::lang::IllegalArgumentException, com::sun::star::container::ElementExistException, com::sun::star::lang::WrappedTargetException )
-+ {
-+
-+ rtl::OUString sProjectName;
-+ aElement >>= sProjectName;
-+ OSL_TRACE("** Template cache inserting template name %s with project %s"
-+ , rtl::OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr()
-+ , rtl::OUStringToOString( sProjectName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ mTemplateToProject[ aName ] = sProjectName;
-+ }
-+
-+ virtual void SAL_CALL removeByName( const rtl::OUString& Name ) throw ( com::sun::star::container::NoSuchElementException, com::sun::star::lang::WrappedTargetException )
-+ {
-+ if ( !hasByName( Name ) )
-+ throw container::NoSuchElementException();
-+ mTemplateToProject.erase( Name );
-+ }
-+ virtual void SAL_CALL replaceByName( const rtl::OUString& aName, const uno::Any& aElement ) throw ( com::sun::star::lang::IllegalArgumentException, com::sun::star::container::NoSuchElementException, com::sun::star::lang::WrappedTargetException )
-+ {
-+ if ( !hasByName( aName ) )
-+ throw container::NoSuchElementException();
-+ insertByName( aName, aElement ); // insert will overwrite
-+ }
-+ // XElemenAccess
-+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException)
-+ {
-+ return ::getCppuType((const rtl::OUString*)0);
-+ }
-+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException )
-+ {
-+
-+ return ( mTemplateToProject.size() > 0 );
-+ }
-+
-+};
-+
-+class SwVbaObjectForCodeNameProvider : public ::cppu::WeakImplHelper1< container::XNameAccess >
-+{
-+ SwDocShell* mpDocShell;
-+public:
-+ SwVbaObjectForCodeNameProvider( SwDocShell* pDocShell ) : mpDocShell( pDocShell )
-+ {
-+ // #FIXME #TODO is the code name for ThisDocument read anywhere?
-+ }
-+
-+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException )
-+ {
-+ // #FIXME #TODO we really need to be checking against the codename for
-+ // ThisDocument
-+ if ( aName.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ThisDocument" ) ) ) )
-+ return sal_True;
-+ return sal_False;
-+ }
-+ ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
-+ {
-+ if ( !hasByName( aName ) )
-+ throw container::NoSuchElementException();
-+ uno::Sequence< uno::Any > aArgs( 2 );
-+ aArgs[0] = uno::Any( uno::Reference< uno::XInterface >() );
-+ aArgs[1] = uno::Any( mpDocShell->GetModel() );
-+ uno::Reference< uno::XInterface > xDocObj = ooo::vba::createVBAUnoAPIServiceWithArgs( mpDocShell, "ooo.vba.word.Document" , aArgs );
-+ OSL_TRACE("Creating Object ( ooo.vba.word.Document ) 0x%x", xDocObj.get() );
-+ return uno::makeAny( xDocObj );
-+ }
-+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (::com::sun::star::uno::RuntimeException)
-+ {
-+ uno::Sequence< rtl::OUString > aNames;
-+ return aNames;
-+ }
-+ // XElemenAccess
-+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException){ return uno::Type(); }
-+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException ) { return sal_True; }
-+
-+};
-+
- /******************************************************************************
- *
- ******************************************************************************/
-@@ -211,6 +398,10 @@ const ProvNamesId_Type __FAR_DATA aProvNamesId[] =
- { "com.sun.star.text.Fieldmark", SW_SERVICE_TYPE_FIELDMARK },
- { "com.sun.star.text.FormFieldmark", SW_SERVICE_TYPE_FORMFIELDMARK },
- { "com.sun.star.text.InContentMetadata", SW_SERVICE_TYPE_META },
-+ { "ooo.vba.VBAObjectModuleObjectProvider", SW_SERVICE_VBAOBJECTPROVIDER },
-+ { "ooo.vba.VBACodeNameProvider", SW_SERVICE_VBACODENAMEPROVIDER },
-+ { "ooo.vba.VBAProjectNameProvider", SW_SERVICE_VBAPROJECTNAMEPROVIDER },
-+ { "ooo.vba.VBAGlobals", SW_SERVICE_VBAGLOBALS },
-
- // case-correct versions of the service names (see #i67811)
- { CSS_TEXT_TEXTFIELD_DATE_TIME, SW_SERVICE_FIELDTYPE_DATETIME },
-@@ -391,6 +582,50 @@ uno::Reference< uno::XInterface > SwXServiceProvider::MakeInstance(sal_uInt16
- xRet = (cppu::OWeakObject*)pFieldmark;
- }
- break;
-+ case SW_SERVICE_VBAOBJECTPROVIDER :
-+ {
-+ SwVbaObjectForCodeNameProvider* pObjProv = new SwVbaObjectForCodeNameProvider( pDoc->GetDocShell() );
-+ xRet = (cppu::OWeakObject*)pObjProv;
-+ }
-+ break;
-+ case SW_SERVICE_VBACODENAMEPROVIDER :
-+ {
-+ if ( pDoc->GetDocShell() && ooo::vba::isAlienWordDoc( *pDoc->GetDocShell() ) )
-+ {
-+ SwVbaCodeNameProvider* pObjProv = new SwVbaCodeNameProvider( pDoc->GetDocShell() );
-+ xRet = (cppu::OWeakObject*)pObjProv;
-+ }
-+ }
-+ break;
-+ case SW_SERVICE_VBAPROJECTNAMEPROVIDER :
-+ {
-+ uno::Reference< container::XNameContainer > xProjProv = pDoc->GetVBATemplateToProjectCache();
-+ if ( !xProjProv.is() && pDoc->GetDocShell() && ooo::vba::isAlienWordDoc( *pDoc->GetDocShell() ) )
-+ {
-+ xProjProv = new SwVbaProjectNameProvider( pDoc->GetDocShell() );
-+ pDoc->SetVBATemplateToProjectCache( xProjProv );
-+ }
-+ //xRet = (cppu::OWeakObject*)xProjProv;
-+ xRet = xProjProv;
-+ }
-+ break;
-+ case SW_SERVICE_VBAGLOBALS :
-+ {
-+ if ( pDoc )
-+ {
-+ uno::Any aGlobs;
-+ if ( !pDoc->GetDocShell()->GetBasicManager()->GetGlobalUNOConstant( "VBAGlobals", aGlobs ) )
-+ {
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[ 0 ] <<= pDoc->GetDocShell()->GetModel();
-+ aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( ::rtl::OUString::createFromAscii( "ooo.vba.word.Globals"), aArgs );
-+ pDoc->GetDocShell()->GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
-+ }
-+ aGlobs >>= xRet;
-+ }
-+ }
-+ break;
-+
- case SW_SERVICE_TYPE_FOOTNOTE :
- xRet = (cppu::OWeakObject*)new SwXFootnote(sal_False);
- break;
-diff --git sw/source/core/unocore/unomap.cxx sw/source/core/unocore/unomap.cxx
-index f5aee26..f4df212 100644
---- sw/source/core/unocore/unomap.cxx
-+++ sw/source/core/unocore/unomap.cxx
-@@ -1580,11 +1580,13 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
- { SW_PROP_NMID(UNO_NAME_CHAR_LOCALE), RES_CHRATR_LANGUAGE , CPPU_E2T(CPPUTYPE_LOCALE), PropertyAttribute::MAYBEVOID, MID_LANG_LOCALE },
- { SW_PROP_NMID(UNO_NAME_CHARACTER_COUNT), WID_DOC_CHAR_COUNT, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::READONLY, 0},
- { SW_PROP_NMID(UNO_NAME_DIALOG_LIBRARIES), WID_DOC_DIALOG_LIBRARIES, CPPU_E2T(CPPUTYPE_REFLIBCONTAINER), PropertyAttribute::READONLY, 0},
-+ { SW_PROP_NMID(UNO_NAME_VBA_DOCOBJ), WID_DOC_VBA_DOCOBJ, CPPU_E2T(CPPUTYPE_PROPERTYVALUE), PropertyAttribute::READONLY, 0},
- { SW_PROP_NMID(UNO_NAME_INDEX_AUTO_MARK_FILE_U_R_L), WID_DOC_AUTO_MARK_URL, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
- { SW_PROP_NMID(UNO_NAME_PARAGRAPH_COUNT), WID_DOC_PARA_COUNT, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::READONLY, 0},
- { SW_PROP_NMID(UNO_NAME_RECORD_CHANGES), WID_DOC_CHANGES_RECORD, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
- { SW_PROP_NMID(UNO_NAME_SHOW_CHANGES), WID_DOC_CHANGES_SHOW, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
- { SW_PROP_NMID(UNO_NAME_WORD_COUNT), WID_DOC_WORD_COUNT, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::READONLY, 0},
-+ { SW_PROP_NMID(UNO_NAME_IS_TEMPLATE), WID_DOC_ISTEMPLATEID, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::READONLY, 0},
- { SW_PROP_NMID(UNO_NAME_WORD_SEPARATOR), WID_DOC_WORD_SEPARATOR, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
- { SW_PROP_NMID(UNO_NAME_HIDE_FIELD_TIPS), WID_DOC_HIDE_TIPS, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
- { SW_PROP_NMID(UNO_NAME_REDLINE_DISPLAY_TYPE), WID_DOC_REDLINE_DISPLAY, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
-diff --git sw/source/core/unocore/unoprnms.cxx sw/source/core/unocore/unoprnms.cxx
-index 228b489..6a98b97 100644
---- sw/source/core/unocore/unoprnms.cxx
-+++ sw/source/core/unocore/unoprnms.cxx
-@@ -778,7 +778,10 @@ const SwPropNameTab aPropNameTab = {
- /* 0736 UNO_NAME_OUTLINE_LEVEL */ {MAP_CHAR_LEN("OutlineLevel")},//#outline level,add<-zhaojianwei Outlinelevel
- /* 0737 UNO_NAME_DESCRIPTION */ {MAP_CHAR_LEN("Description")},
- /* 0738 UNO_NAME_META */ {MAP_CHAR_LEN("InContentMetadata")},
--/* 0739 UNO_NAME_NESTED_TEXT_CONTENT */ {MAP_CHAR_LEN("NestedTextContent")},
-+/* 0739 UNO_NAME_IS_TEMPLATE */ {MAP_CHAR_LEN("IsTemplate")},
-+/* 0740 UNO_NAME_VBA_DOCOBJ */ {MAP_CHAR_LEN("ThisVBADocObj")},
-+
-+/* 0741 UNO_NAME_NESTED_TEXT_CONTENT */ {MAP_CHAR_LEN("NestedTextContent")},
- };
-
- const SwPropNameLen& SwGetPropName( USHORT nId )
-diff --git sw/source/filter/ww8/makefile.mk sw/source/filter/ww8/makefile.mk
-index b25887e..c30c10b 100644
---- sw/source/filter/ww8/makefile.mk
-+++ sw/source/filter/ww8/makefile.mk
-@@ -67,6 +67,7 @@ EXCEPTIONSFILES = \
- $(SLO)$/WW8TableInfo.obj \
- $(SLO)$/WW8FFData.obj \
- $(SLO)$/WW8Sttbf.obj \
-+ $(SLO)$/ww8toolbar.obj \
- $(SLO)$/WW8FibData.obj
-
-
-@@ -96,6 +97,7 @@ SLOFILES = \
- $(SLO)$/WW8TableInfo.obj \
- $(SLO)$/WW8FFData.obj \
- $(SLO)$/WW8Sttbf.obj \
-+ $(SLO)$/ww8toolbar.obj \
- $(SLO)$/WW8FibData.obj
-
-
-diff --git sw/source/filter/ww8/ww8par.cxx sw/source/filter/ww8/ww8par.cxx
-index 2945cde..2fe9bd1 100644
---- sw/source/filter/ww8/ww8par.cxx
-+++ sw/source/filter/ww8/ww8par.cxx
-@@ -128,11 +128,19 @@
- #include <svl/itemiter.hxx> //SfxItemIter
-
- #include <stdio.h>
-+#include <comphelper/processfactory.hxx>
-+#include <basic/basmgr.hxx>
-+
-+#include "ww8toolbar.hxx"
-+#include <osl/file.hxx>
-+#include <com/sun/star/document/XDocumentInfoSupplier.hpp>
-
- #ifdef DEBUG
- #include <iostream>
- #include <dbgoutsw.hxx>
- #endif
-+#include <unotools/localfilehelper.hxx>
-+#include <comphelper/configurationhelper.hxx>
-
- #include "WW8Sttbf.hxx"
- #include "WW8FibData.hxx"
-@@ -144,6 +152,87 @@ using namespace sw::util;
- using namespace sw::types;
- using namespace nsHdFtFlags;
-
-+#include <com/sun/star/document/XEventsSupplier.hpp>
-+#include <com/sun/star/container/XNameReplace.hpp>
-+#include <com/sun/star/frame/XModel.hpp>
-+#include <filter/msfilter/msvbahelper.hxx>
-+#include <unotools/pathoptions.hxx>
-+#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
-+
-+class Sttb : TBBase
-+{
-+struct SBBItem
-+{
-+ sal_uInt16 cchData;
-+ rtl::OUString data;
-+ SBBItem() : cchData(0){}
-+};
-+ sal_uInt16 fExtend;
-+ sal_uInt16 cData;
-+ sal_uInt16 cbExtra;
-+
-+ std::vector< SBBItem > dataItems;
-+
-+ Sttb(const Sttb&);
-+ Sttb& operator = ( const Sttb&);
-+public:
-+ Sttb();
-+ ~Sttb();
-+ bool Read(SvStream *pS);
-+ void Print( FILE* fp );
-+ rtl::OUString getStringAtIndex( sal_uInt32 );
-+};
-+
-+Sttb::Sttb() : fExtend( 0 )
-+,cData( 0 )
-+,cbExtra( 0 )
-+{
-+}
-+
-+Sttb::~Sttb()
-+{
-+}
-+
-+bool Sttb::Read( SvStream* pS )
-+{
-+ OSL_TRACE("Sttb::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> fExtend >> cData >> cbExtra;
-+ if ( cData )
-+ {
-+ for ( sal_Int32 index = 0; index < cData; ++index )
-+ {
-+ SBBItem aItem;
-+ *pS >> aItem.cchData;
-+ aItem.data = readUnicodeString( pS, aItem.cchData );
-+ dataItems.push_back( aItem );
-+ }
-+ }
-+ return true;
-+}
-+
-+void Sttb::Print( FILE* fp )
-+{
-+ fprintf( fp, "[ 0x%x ] Sttb - dump\n", nOffSet);
-+ fprintf( fp, " fExtend 0x%x [expected 0xFFFF ]\n", fExtend );
-+ fprintf( fp, " cData no. or string data items %d (0x%x)\n", cData, cData );
-+
-+ if ( cData )
-+ {
-+ for ( sal_Int32 index = 0; index < cData; ++index )
-+ fprintf(fp," string dataItem[ %d(0x%x) ] has name %s\n", static_cast< int >( index ), static_cast< unsigned int >( index ), rtl::OUStringToOString( dataItems[ index ].data, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ }
-+
-+}
-+
-+rtl::OUString
-+Sttb::getStringAtIndex( sal_uInt32 index )
-+{
-+ rtl::OUString aRet;
-+ if ( index < dataItems.size() )
-+ aRet = dataItems[ index ].data;
-+ return aRet;
-+}
-
- SwMSDffManager::SwMSDffManager( SwWW8ImplReader& rRdr )
- : SvxMSDffManager(*rRdr.pTableStream, rRdr.GetBaseURL(), rRdr.pWwFib->fcDggInfo,
-@@ -3778,11 +3867,168 @@ void SwWW8ImplReader::ReadDocInfo()
- DBG_ASSERT(xDocProps.is(), "DocumentProperties is null");
-
- if (xDocProps.is()) {
-+ if ( pWwFib->fDot )
-+ {
-+ rtl::OUString sTemplateURL;
-+ SfxMedium* pMedium = mpDocShell->GetMedium();
-+ if ( pMedium )
-+ {
-+ rtl::OUString aName = pMedium->GetName();
-+ INetURLObject aURL( aName );
-+ sTemplateURL = aURL.GetMainURL(INetURLObject::DECODE_TO_IURI);
-+ if ( sTemplateURL.getLength() > 0 )
-+ xDocProps->setTemplateURL( sTemplateURL );
-+ }
-+ }
-+ else // not a template
-+ {
-+ long nCur = pTableStream->Tell();
-+ Sttb aSttb;
-+ pTableStream->Seek( pWwFib->fcSttbfAssoc ); // point at tgc record
-+ if (!aSttb.Read( pTableStream ) )
-+ OSL_TRACE("** Read of SttbAssoc data failed!!!! ");
-+ pTableStream->Seek( nCur ); // return to previous position, is that necessary?
-+#if DEBUG
-+ aSttb.Print( stderr );
-+#endif
-+ String sPath = aSttb.getStringAtIndex( 0x1 );
-+ String aURL;
-+ // attempt to convert to url ( won't work for obvious reasons on linux
-+ if ( sPath.Len() )
-+ ::utl::LocalFileHelper::ConvertPhysicalNameToURL( sPath, aURL );
-+ if ( aURL.Len() )
-+ xDocProps->setTemplateURL( aURL );
-+ else
-+ xDocProps->setTemplateURL( sPath );
-+
-+ }
- sfx2::LoadOlePropertySet(xDocProps, pStg);
- }
- }
- }
-
-+void lcl_createTemplateToProjectEntry( const uno::Reference< container::XNameContainer >& xPrjNameCache, const rtl::OUString& sTemplatePathOrURL, const rtl::OUString& sVBAProjName )
-+{
-+ if ( xPrjNameCache.is() )
-+ {
-+ INetURLObject aObj;
-+ aObj.SetURL( sTemplatePathOrURL );
-+ bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
-+ rtl::OUString aURL;
-+ if ( bIsURL )
-+ aURL = sTemplatePathOrURL;
-+ else
-+ {
-+ osl::FileBase::getFileURLFromSystemPath( sTemplatePathOrURL, aURL );
-+ aObj.SetURL( aURL );
-+ }
-+ try
-+ {
-+ rtl::OUString templateNameWithExt = aObj.GetLastName();
-+ rtl::OUString templateName;
-+ sal_Int32 nIndex = templateNameWithExt.lastIndexOf( '.' );
-+ //xPrjNameCache->insertByName( templateNameWithExt, uno::makeAny( sVBAProjName ) );
-+ if ( nIndex != -1 )
-+ {
-+ templateName = templateNameWithExt.copy( 0, nIndex );
-+ xPrjNameCache->insertByName( templateName, uno::makeAny( sVBAProjName ) );
-+ }
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+ }
-+}
-+
-+class WW8Customizations
-+{
-+ SvStream* mpTableStream;
-+ WW8Fib mWw8Fib;
-+public:
-+ WW8Customizations( SvStream*, WW8Fib& );
-+ bool Import( SwDocShell* pShell );
-+};
-+
-+WW8Customizations::WW8Customizations( SvStream* pTableStream, WW8Fib& rFib ) : mpTableStream(pTableStream), mWw8Fib( rFib )
-+{
-+}
-+
-+bool WW8Customizations::Import( SwDocShell* pShell )
-+{
-+ if ( mWw8Fib.lcbCmds == 0 )
-+ return false;
-+ Tcg aTCG;
-+ long nCur = mpTableStream->Tell();
-+ mpTableStream->Seek( mWw8Fib.fcCmds ); // point at tgc record
-+ bool bReadResult = aTCG.Read( mpTableStream );
-+ mpTableStream->Seek( nCur ); // return to previous position, is that necessary?
-+ if ( !bReadResult )
-+ {
-+ OSL_TRACE("** Read of Customization data failed!!!! ");
-+ return false;
-+ }
-+#if DEBUG
-+ aTCG.Print( stderr );
-+#endif
-+ return aTCG.ImportCustomToolBar( *pShell );
-+}
-+
-+bool SwWW8ImplReader::ReadGlobalTemplateSettings( const rtl::OUString& sCreatedFrom, const uno::Reference< container::XNameContainer >& xPrjNameCache )
-+{
-+ SvtPathOptions aPathOpt;
-+ String aAddinPath = aPathOpt.GetAddinPath();
-+ uno::Sequence< rtl::OUString > sGlobalTemplates;
-+
-+ // first get the autoload addins in the directory STARTUP
-+ uno::Reference< ucb::XSimpleFileAccess > xSFA( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ), uno::UNO_QUERY_THROW );
-+
-+ if( xSFA->isFolder( aAddinPath ) )
-+ sGlobalTemplates = xSFA->getFolderContents( aAddinPath, sal_False );
-+
-+ sal_Int32 nEntries = sGlobalTemplates.getLength();
-+ bool bRes = true;
-+ const SvtFilterOptions* pVBAFlags = SvtFilterOptions::Get();
-+ for ( sal_Int32 i=0; i<nEntries; ++i )
-+ {
-+ INetURLObject aObj;
-+ aObj.SetURL( sGlobalTemplates[ i ] );
-+ bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
-+ rtl::OUString aURL;
-+ if ( bIsURL )
-+ aURL = sGlobalTemplates[ i ];
-+ else
-+ osl::FileBase::getFileURLFromSystemPath( sGlobalTemplates[ i ], aURL );
-+ if ( !aURL.endsWithIgnoreAsciiCaseAsciiL( ".dot", 4 ) || ( sCreatedFrom.getLength() && sCreatedFrom.equals( aURL ) ) )
-+ continue; // don't try and read the same document as ourselves
-+
-+ SotStorageRef rRoot = new SotStorage( aURL, STREAM_STD_READWRITE, STORAGE_TRANSACTED );
-+
-+ // Read Macro Projects
-+ SvxImportMSVBasic aVBasic(*mpDocShell, *rRoot,
-+ pVBAFlags->IsLoadWordBasicCode(),
-+ pVBAFlags->IsLoadWordBasicStorage() );
-+
-+
-+ String s1(CREATE_CONST_ASC("Macros"));
-+ String s2(CREATE_CONST_ASC("VBA"));
-+ aVBasic.Import( s1, s2, !pVBAFlags->IsLoadWordBasicExecutable() );
-+ lcl_createTemplateToProjectEntry( xPrjNameCache, aURL, aVBasic.GetVBAProjectName() );
-+ // Read toolbars & menus
-+ SvStorageStreamRef refMainStream = rRoot->OpenSotStream( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WordDocument") ) );
-+ refMainStream->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN);
-+ WW8Fib aWwFib( *refMainStream, 8 );
-+ SvStorageStreamRef xTableStream = rRoot->OpenSotStream(String::CreateFromAscii( aWwFib.fWhichTblStm ? SL::a1Table : SL::a0Table), STREAM_STD_READ);
-+
-+ if (xTableStream.Is() && SVSTREAM_OK == xTableStream->GetError())
-+ {
-+ xTableStream->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN);
-+ WW8Customizations aGblCustomisations( xTableStream, aWwFib );
-+ aGblCustomisations.Import( mpDocShell );
-+ }
-+ }
-+ return bRes;
-+}
-+
- ULONG SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
- {
- ULONG nErrRet = 0;
-@@ -4066,7 +4312,59 @@ ULONG SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
- }
- else //ordinary case
- {
-+ if (mbNewDoc && pStg && !pGloss) /*meaningless for a glossary, cmc*/
-+ {
-+ mpDocShell->SetIsTemplate( pWwFib->fDot ); // point at tgc record
-+ const SvtFilterOptions* pVBAFlags = SvtFilterOptions::Get();
-+ maTracer.EnterEnvironment(sw::log::eMacros);
-+// dissable below for 3.1 at the moment, 'cause it's kinda immature
-+// similarly the project reference in svx/source/msvba
-+#if 1
-+ uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( mpDocShell->GetModel(), uno::UNO_QUERY_THROW );
-+ uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW );
-+ uno::Reference< document::XDocumentProperties > xDocProps( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW );
-+
-+ rtl::OUString sCreatedFrom = xDocProps->getTemplateURL();
-+ uno::Reference< container::XNameContainer > xPrjNameCache;
-+ uno::Reference< lang::XMultiServiceFactory> xSF(mpDocShell->GetModel(), uno::UNO_QUERY);
-+ if ( xSF.is() )
-+ xPrjNameCache.set( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAProjectNameProvider" ) ) ), uno::UNO_QUERY );
-+
-+ // Read Global templates
-+ ReadGlobalTemplateSettings( sCreatedFrom, xPrjNameCache );
-+#endif
-+ // Create and insert Word vba Globals
-+ uno::Any aGlobs;
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[ 0 ] <<= mpDocShell->GetModel();
-+ aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( ::rtl::OUString::createFromAscii( "ooo.vba.word.Globals"), aArgs );
-+ mpDocShell->GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
-+
-+ SvxImportMSVBasic aVBasic(*mpDocShell, *pStg,
-+ pVBAFlags->IsLoadWordBasicCode(),
-+ pVBAFlags->IsLoadWordBasicStorage() );
-+ String s1(CREATE_CONST_ASC("Macros"));
-+ String s2(CREATE_CONST_ASC("VBA"));
-+ int nRet = aVBasic.Import( s1, s2, !pVBAFlags->IsLoadWordBasicExecutable() );
-+// dissable below for 3.1 at the moment, 'cause it's kinda immature
-+// similarly the project reference in svx/source/msvba
-+#if 1
-+ lcl_createTemplateToProjectEntry( xPrjNameCache, sCreatedFrom, aVBasic.GetVBAProjectName() );
-+ WW8Customizations aCustomisations( pTableStream, *pWwFib );
-+ aCustomisations.Import( mpDocShell );
-+#endif
-+ if( 2 & nRet )
-+ {
-+ maTracer.Log(sw::log::eContainsVisualBasic);
-+ rDoc.SetContainsMSVBasic(true);
-+ }
-+
-+ StoreMacroCmds();
-+
-+ maTracer.LeaveEnvironment(sw::log::eMacros);
-+ }
- ReadText(0, pWwFib->ccpText, MAN_MAINTEXT);
-+
- }
-
- ::SetProgressState(nProgress, mpDocShell); // Update
-@@ -4140,26 +4438,6 @@ ULONG SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
- eMode |= nsRedlineMode_t::REDLINE_ON;
- if( pWDop->fRMView )
- eMode |= nsRedlineMode_t::REDLINE_SHOW_DELETE;
-- if (pStg && !pGloss) /*meaningless for a glossary, cmc*/
-- {
-- const SvtFilterOptions* pVBAFlags = SvtFilterOptions::Get();
-- maTracer.EnterEnvironment(sw::log::eMacros);
-- SvxImportMSVBasic aVBasic(*mpDocShell, *pStg,
-- pVBAFlags->IsLoadWordBasicCode(),
-- pVBAFlags->IsLoadWordBasicStorage() );
-- String s1(CREATE_CONST_ASC("Macros"));
-- String s2(CREATE_CONST_ASC("VBA"));
-- int nRet = aVBasic.Import( s1, s2 );
-- if( 2 & nRet )
-- {
-- maTracer.Log(sw::log::eContainsVisualBasic);
-- rDoc.SetContainsMSVBasic(true);
-- }
--
-- StoreMacroCmds();
--
-- maTracer.LeaveEnvironment(sw::log::eMacros);
-- }
- }
-
- maInsertedTables.DelAndMakeTblFrms();
-diff --git sw/source/filter/ww8/ww8par.hxx sw/source/filter/ww8/ww8par.hxx
-index 8af5c62..181b818 100644
---- sw/source/filter/ww8/ww8par.hxx
-+++ sw/source/filter/ww8/ww8par.hxx
-@@ -1416,7 +1416,7 @@ private:
- // determine object attribute "Layout in Table Cell"
- bool IsObjectLayoutInTableCell( const UINT32 nLayoutInTableCell ) const;
- // <--
--
-+ bool ReadGlobalTemplateSettings( const rtl::OUString& sCreatedFrom, const com::sun::star::uno::Reference< com::sun::star::container::XNameContainer >& xPrjNameMap );
- //No copying
- SwWW8ImplReader(const SwWW8ImplReader &);
- SwWW8ImplReader& operator=(const SwWW8ImplReader&);
-diff --git sw/source/filter/ww8/ww8toolbar.cxx sw/source/filter/ww8/ww8toolbar.cxx
-new file mode 100644
-index 0000000..e9fb6a3
---- /dev/null
-+++ sw/source/filter/ww8/ww8toolbar.cxx
-@@ -0,0 +1,1302 @@
-+#include "ww8toolbar.hxx"
-+#include <rtl/ustrbuf.hxx>
-+#include <stdarg.h>
-+#include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
-+#include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
-+#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
-+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-+#include <com/sun/star/lang/XSingleComponentFactory.hpp>
-+#include <com/sun/star/lang/XMultiComponentFactory.hpp>
-+#include <com/sun/star/ui/XImageManager.hpp>
-+#include <com/sun/star/ui/ItemType.hpp>
-+#include <fstream>
-+#include <comphelper/processfactory.hxx>
-+#include <vcl/graph.hxx>
-+#include <map>
-+using namespace com::sun::star;
-+
-+// no. of visual data elements in a CTB ( fixed )
-+const short nVisualData = 5;
-+
-+typedef std::map< sal_Int16, rtl::OUString > IdToString;
-+
-+class MSOWordCommandConvertor : public MSOCommandConvertor
-+{
-+ IdToString msoToOOcmd;
-+ IdToString tcidToOOcmd;
-+public:
-+ MSOWordCommandConvertor();
-+ virtual rtl::OUString MSOCommandToOOCommand( sal_Int16 msoCmd );
-+ virtual rtl::OUString MSOTCIDToOOCommand( sal_Int16 key );
-+};
-+
-+MSOWordCommandConvertor::MSOWordCommandConvertor()
-+{
-+ // mso command id to ooo command string
-+ // #FIXME and *HUNDREDS* of id's to added here
-+ msoToOOcmd[ 0x20b ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".uno:CloseDoc") );
-+ msoToOOcmd[ 0x50 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".uno:Open") );
-+
-+ // mso tcid to ooo command string
-+ // #FIXME and *HUNDREDS* of id's to added here
-+ tcidToOOcmd[ 0x9d9 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".uno:Print") );
-+}
-+
-+rtl::OUString MSOWordCommandConvertor::MSOCommandToOOCommand( sal_Int16 key )
-+{
-+ rtl::OUString sResult;
-+ IdToString::iterator it = msoToOOcmd.find( key );
-+ if ( it != msoToOOcmd.end() )
-+ sResult = it->second;
-+ return sResult;
-+}
-+
-+rtl::OUString MSOWordCommandConvertor::MSOTCIDToOOCommand( sal_Int16 key )
-+{
-+ rtl::OUString sResult;
-+ IdToString::iterator it = tcidToOOcmd.find( key );
-+ if ( it != tcidToOOcmd.end() )
-+ sResult = it->second;
-+ return sResult;
-+}
-+
-+
-+CTBWrapper::CTBWrapper( bool bReadId ) : Tcg255SubStruct( bReadId )
-+,reserved2(0)
-+,reserved3(0)
-+,reserved4(0)
-+,reserved5(0)
-+,cbTBD(0)
-+,cCust(0)
-+,cbDTBC(0)
-+,rtbdc(0)
-+{
-+}
-+
-+CTBWrapper::~CTBWrapper()
-+{
-+}
-+
-+Customization* CTBWrapper::GetCustomizaton( sal_Int16 index )
-+{
-+ if ( index < 0 || index >= static_cast<sal_Int16>( rCustomizations.size() ) )
-+ return NULL;
-+ return &rCustomizations[ index ];
-+}
-+
-+CTB* CTBWrapper::GetCustomizationData( const rtl::OUString& sTBName )
-+{
-+ CTB* pCTB = NULL;
-+ for ( std::vector< Customization >::iterator it = rCustomizations.begin(); it != rCustomizations.end(); ++it )
-+ {
-+ if ( it->GetCustomizationData() && it->GetCustomizationData()->GetName().equals( sTBName ) )
-+ {
-+ pCTB = it->GetCustomizationData();
-+ break;
-+ }
-+ }
-+ return pCTB;
-+}
-+
-+bool CTBWrapper::Read( SvStream* pS )
-+{
-+ OSL_TRACE("CTBWrapper::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ Tcg255SubStruct::Read( pS );
-+ *pS >> reserved2 >> reserved3 >> reserved4 >> reserved5;
-+ *pS >> cbTBD >> cCust >> cbDTBC;
-+ long nExpectedPos = pS->Tell() + cbDTBC;
-+ if ( cbDTBC )
-+ {
-+ // cbDTBC is the size in bytes of the TBC array
-+ // but the size of a TBC element is dynamic ( and this relates to TBDelta's
-+ int nStart = pS->Tell();
-+
-+ int bytesRead = 0;
-+ int bytesToRead = cbDTBC - bytesRead;
-+ // cbDTBC specifies the size ( in bytes ) taken by an array ( of unspecified size )
-+ // of TBC records ( TBC records have dynamic length, so we need to check our position
-+ // after each read )
-+ do
-+ {
-+ TBC aTBC;
-+ if ( !aTBC.Read( pS ) )
-+ return false;
-+ rtbdc.push_back( aTBC );
-+ bytesToRead = cbDTBC - ( pS->Tell() - nStart );
-+ } while ( bytesToRead > 0 );
-+ }
-+ if ( static_cast< long >( pS->Tell() ) != nExpectedPos )
-+ {
-+ // Strange error condition, shouldn't happen ( but does in at least
-+ // one test document ) In the case where it happens the TBC &
-+ // TBCHeader records seem blank??? ( and incorrect )
-+ OSL_ENSURE( pS->Tell() == nExpectedPos, "### Error: Expected pos not equal to actual pos after reading rtbdc");
-+ OSL_TRACE("\tPos now is 0x%x should be 0x%x", pS->Tell(), nExpectedPos );
-+ // seek to correct position after rtbdc
-+ pS->Seek( nExpectedPos );
-+ }
-+ if ( cCust )
-+ {
-+ for ( sal_Int32 index = 0; index < cCust; ++index )
-+ {
-+ Customization aCust( this );
-+ if ( !aCust.Read( pS ) )
-+ return false;
-+ rCustomizations.push_back( aCust );
-+ }
-+ }
-+ std::vector< sal_Int16 >::iterator it_end = dropDownMenuIndices.end();
-+ for ( std::vector< sal_Int16 >::iterator it = dropDownMenuIndices.begin(); it != it_end; ++it )
-+ {
-+ rCustomizations[ *it ].bIsDroppedMenuTB = true;
-+ }
-+ return true;
-+}
-+
-+TBC* CTBWrapper::GetTBCAtOffset( sal_uInt32 nStreamOffset )
-+{
-+ for ( std::vector< TBC >::iterator it = rtbdc.begin(); it != rtbdc.end(); ++it )
-+ {
-+ if ( (*it).GetOffset() == nStreamOffset )
-+ return &(*it);
-+ }
-+ return NULL;
-+}
-+
-+void CTBWrapper::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf(fp,"[ 0x%x ] CTBWrapper - dump\n", nOffSet );
-+ bool bRes = ( ch == 0x12 && reserved2 == 0x0 && reserved3 == 0x7 && reserved4 == 0x6 && reserved5 == 0xC );
-+ if ( bRes )
-+ indent_printf(fp," sanity check ( first 8 bytes conform )\n");
-+ else
-+ {
-+ indent_printf(fp," reserved1(0x%x)\n",ch);
-+ indent_printf(fp," reserved2(0x%x)\n",reserved2);
-+ indent_printf(fp," reserved3(0x%x)\n",reserved3);
-+ indent_printf(fp," reserved4(0x%x)\n",reserved4);
-+ indent_printf(fp," reserved5(0x%x)\n",reserved5);
-+ indent_printf(fp,"Quiting dump");
-+ return;
-+ }
-+ indent_printf(fp," size of TBDelta structures 0x%x\n", cbTBD );
-+ indent_printf(fp," cCust: no. of cCust structures 0x%x\n",cCust);
-+ indent_printf(fp," cbDTBC: no. of bytes in rtbdc array 0x%x\n", static_cast< unsigned int >( cbDTBC ));
-+
-+ sal_Int32 index = 0;
-+
-+ for ( std::vector< TBC >::iterator it = rtbdc.begin(); it != rtbdc.end(); ++it, ++index )
-+ {
-+ indent_printf(fp," Dumping rtbdc[%d]\n", static_cast< int >( index ));
-+ Indent b;
-+ it->Print( fp );
-+ }
-+
-+ index = 0;
-+
-+ for ( std::vector< Customization >::iterator it = rCustomizations.begin(); it != rCustomizations.end(); ++it, ++index )
-+ {
-+ indent_printf(fp," Dumping custimization [%d]\n", static_cast< int >( index ));
-+ Indent c;
-+ it->Print(fp);
-+ }
-+}
-+
-+bool CTBWrapper::ImportCustomToolBar( SfxObjectShell& rDocSh )
-+{
-+ for ( std::vector< Customization >::iterator it = rCustomizations.begin(); it != rCustomizations.end(); ++it )
-+ {
-+ uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+ uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xAppCfgSupp( xMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.ModuleUIConfigurationManagerSupplier" ) ) ), uno::UNO_QUERY_THROW );
-+ CustomToolBarImportHelper helper( rDocSh, xAppCfgSupp->getUIConfigurationManager( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument" ) ) ) );
-+ helper.setMSOCommandMap( new MSOWordCommandConvertor() );
-+
-+ if ( !(*it).ImportCustomToolBar( *this, helper ) )
-+ return false;
-+ }
-+ return false;
-+}
-+
-+Customization::Customization( CTBWrapper* wrapper ) : tbidForTBD( 0 )
-+,reserved1( 0 )
-+, ctbds( 0 )
-+, pWrapper( wrapper )
-+, bIsDroppedMenuTB( false )
-+{
-+}
-+
-+Customization::~Customization()
-+{
-+}
-+
-+bool Customization::Read( SvStream *pS)
-+{
-+ OSL_TRACE("Custimization::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> tbidForTBD >> reserved1 >> ctbds;
-+ if ( tbidForTBD )
-+ {
-+ for ( sal_Int32 index = 0; index < ctbds; ++index )
-+ {
-+ TBDelta aTBDelta;
-+ if (!aTBDelta.Read( pS ) )
-+ return false;
-+ customizationDataTBDelta.push_back( aTBDelta );
-+ // Only set the drop down for menu's associated with standard toolbar
-+ if ( aTBDelta.ControlDropsToolBar() && tbidForTBD == 0x25 )
-+ pWrapper->InsertDropIndex( aTBDelta.CustomizationIndex() );
-+ }
-+ }
-+ else
-+ {
-+ customizationDataCTB.reset( new CTB() );
-+ if ( !customizationDataCTB->Read( pS ) )
-+ return false;
-+ }
-+ return true;
-+}
-+
-+void Customization::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf( fp,"[ 0x%x ] Customization -- dump \n", nOffSet );
-+ indent_printf( fp," tbidForTBD 0x%x ( should be 0 for CTBs )\n", static_cast< unsigned int >( tbidForTBD ));
-+ indent_printf( fp," reserved1 0x%x \n", reserved1);
-+ indent_printf( fp," ctbds - number of customisations %d(0x%x) \n", ctbds, ctbds );
-+ if ( !tbidForTBD && !ctbds )
-+ customizationDataCTB->Print( fp );
-+ else
-+ {
-+ const char* pToolBar = NULL;
-+ switch ( tbidForTBD )
-+ {
-+ case 0x9:
-+ pToolBar = "Standard";
-+ break;
-+ case 0x25:
-+ pToolBar = "Builtin-Menu";
-+ break;
-+ default:
-+ pToolBar = "Unknown toolbar";
-+ break;
-+ }
-+
-+ indent_printf( fp," TBDelta(s) are associated with %s toolbar.\n", pToolBar);
-+ std::vector< TBDelta >::iterator it = customizationDataTBDelta.begin();
-+ for ( sal_Int32 index = 0; index < ctbds; ++it,++index )
-+ it->Print( fp );
-+ }
-+
-+}
-+
-+bool Customization::ImportMenu( CTBWrapper& rWrapper, CustomToolBarImportHelper& helper )
-+{
-+ if ( tbidForTBD == 0x25 ) // we can handle in a limited way additions the built-in menu bar
-+ {
-+ for ( std::vector< TBDelta >::iterator it = customizationDataTBDelta.begin(); it != customizationDataTBDelta.end(); ++it )
-+ {
-+ // for each new menu ( control that drops a toolbar )
-+ // import a toolbar
-+ if ( it->ControlIsInserted() && it->ControlDropsToolBar() )
-+ {
-+ Customization* pCust = pWrapper->GetCustomizaton( it->CustomizationIndex() );
-+ if ( pCust )
-+ {
-+ // currently only support built-in menu
-+ rtl::OUString sMenuBar( RTL_CONSTASCII_USTRINGPARAM("private:resource/menubar/") );
-+
-+ sMenuBar = sMenuBar.concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("menubar") ) );
-+ // Get menu name
-+ TBC* pTBC = pWrapper->GetTBCAtOffset( it->TBCStreamOffset() );
-+ if ( !pTBC )
-+ return false;
-+ rtl::OUString sMenuName = pTBC->GetCustomText();
-+ sMenuName = sMenuName.replace('&','~');
-+
-+ // see if the document has already setting for the menubar
-+
-+ uno::Reference< container::XIndexContainer > xIndexContainer;
-+ bool bHasSettings = false;
-+ if ( helper.getCfgManager()->hasSettings( sMenuBar ) )
-+ {
-+ xIndexContainer.set( helper.getCfgManager()->getSettings( sMenuBar, sal_True ), uno::UNO_QUERY_THROW );
-+ bHasSettings = true;
-+ }
-+ else
-+ {
-+ if ( helper.getAppCfgManager()->hasSettings( sMenuBar ) )
-+ xIndexContainer.set( helper.getAppCfgManager()->getSettings( sMenuBar, sal_True ), uno::UNO_QUERY_THROW );
-+ else
-+ xIndexContainer.set( helper.getAppCfgManager()->createSettings(), uno::UNO_QUERY_THROW );
-+ }
-+
-+ uno::Reference< lang::XSingleComponentFactory > xSCF( xIndexContainer, uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+ uno::Reference< uno::XComponentContext > xContext( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
-+ // create the popup menu
-+ uno::Sequence< beans::PropertyValue > aPopupMenu( 4 );
-+ aPopupMenu[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CommandURL") );
-+ aPopupMenu[0].Value = uno::makeAny( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("vnd.openoffice.org:") ) + sMenuName );
-+ aPopupMenu[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Label") );
-+ aPopupMenu[1].Value <<= sMenuName;
-+ aPopupMenu[2].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Type" ) );
-+ aPopupMenu[2].Value <<= sal_Int32( 0 );
-+ aPopupMenu[3].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ItemDescriptorContainer") );
-+ uno::Reference< container::XIndexContainer > xMenuContainer( xSCF->createInstanceWithContext( xContext ), uno::UNO_QUERY_THROW );
-+ aPopupMenu[3].Value <<= xMenuContainer;
-+ if ( pCust->customizationDataCTB.get() && !pCust->customizationDataCTB->ImportMenuTB( rWrapper, xMenuContainer, helper ) )
-+ return false;
-+ OSL_TRACE("** there are %d menu items on the bar, inserting after that", xIndexContainer->getCount() );
-+ xIndexContainer->insertByIndex( xIndexContainer->getCount(), uno::makeAny( aPopupMenu ) );
-+
-+ if ( bHasSettings )
-+ helper.getCfgManager()->replaceSettings( sMenuBar, uno::Reference< container::XIndexAccess >( xIndexContainer, uno::UNO_QUERY_THROW ) );
-+ else
-+ helper.getCfgManager()->insertSettings( sMenuBar, uno::Reference< container::XIndexAccess >( xIndexContainer, uno::UNO_QUERY_THROW ) );
-+ uno::Reference< ui::XUIConfigurationPersistence > xPersistence( helper.getCfgManager(), uno::UNO_QUERY_THROW );
-+ xPersistence->store();
-+ }
-+ }
-+ }
-+ return true;
-+ }
-+ return true;
-+}
-+
-+bool Customization::ImportCustomToolBar( CTBWrapper& rWrapper, CustomToolBarImportHelper& helper )
-+{
-+ if ( GetTBIDForTB() == 0x25 )
-+ return ImportMenu( rWrapper, helper );
-+ if ( !customizationDataCTB.get() )
-+ return false;
-+ if ( !customizationDataCTB->IsMenuToolbar() )
-+ {
-+ if ( !customizationDataCTB->ImportCustomToolBar( rWrapper, helper ) )
-+ return false;
-+ }
-+ return true;
-+}
-+
-+TBDelta::TBDelta() : doprfatendFlags(0)
-+,ibts(0)
-+,cidNext(0)
-+,cid(0)
-+,fc(0)
-+,cbTBC(0)
-+{
-+}
-+
-+bool TBDelta::ControlIsModified()
-+{
-+ return ( ( doprfatendFlags & 0x3 ) == 0x2 );
-+}
-+
-+bool TBDelta::ControlIsInserted()
-+{
-+ return ( ( doprfatendFlags & 0x3 ) == 0x1 );
-+}
-+
-+bool TBDelta::ControlIsChanged()
-+{
-+ return ( ( doprfatendFlags & 0x3 ) == 0x1 );
-+}
-+
-+bool TBDelta::ControlDropsToolBar()
-+{
-+ return !( CiTBDE & 0x8000 );
-+}
-+
-+sal_Int32 TBDelta::TBCStreamOffset()
-+{
-+ return fc;
-+}
-+
-+sal_Int16 TBDelta::CustomizationIndex()
-+{
-+ sal_Int16 nIndex = CiTBDE;
-+ nIndex = nIndex >> 1;
-+ nIndex &= 0x1ff; // only 13 bits are relevant
-+ return nIndex;
-+}
-+
-+bool TBDelta::Read(SvStream *pS)
-+{
-+ OSL_TRACE("TBDelta::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> doprfatendFlags >> ibts >> cidNext >> cid >> fc ;
-+ *pS >> CiTBDE >> cbTBC;
-+ return true;
-+}
-+
-+void TBDelta::Print( FILE* fp )
-+{
-+ // Like most of the debug output, it's raw and little ( no )
-+ // interpretation of the data is output ( e.g. flag values etc. )
-+ indent_printf( fp, "[ 0x%x ] TBDelta -- dump\n", nOffSet );
-+ indent_printf( fp, " doprfatendFlags 0x%x\n",doprfatendFlags );
-+
-+ indent_printf( fp, " ibts 0x%x\n",ibts );
-+ indent_printf( fp, " cidNext 0x%x\n", static_cast< unsigned int >( cidNext ) );
-+ indent_printf( fp, " cid 0x%x\n", static_cast< unsigned int >( cid ) );
-+ indent_printf( fp, " fc 0x%x\n", static_cast< unsigned int >( fc ) );
-+ indent_printf( fp, " CiTBDE 0x%x\n",CiTBDE );
-+ indent_printf( fp, " cbTBC 0x%x\n", cbTBC );
-+ if ( ControlDropsToolBar() )
-+ {
-+ indent_printf( fp, " this delta is associated with a control that drops a menu toolbar\n", cbTBC );
-+ indent_printf( fp, " the menu toolbar drops the toolbar defined at index[%d] in the rCustomizations array of the CTBWRAPPER that contains this TBDelta\n", CustomizationIndex() );
-+ }
-+}
-+
-+CTB::CTB() : cbTBData( 0 )
-+,iWCTBl( 0 )
-+,reserved( 0 )
-+,unused( 0 )
-+,cCtls( 0 )
-+{
-+}
-+
-+CTB::~CTB()
-+{
-+}
-+
-+bool CTB::IsMenuToolbar()
-+{
-+ return tb.IsMenuToolbar();
-+}
-+
-+
-+bool CTB::Read( SvStream *pS)
-+{
-+ OSL_TRACE("CTB::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ if ( !name.Read( pS ) )
-+ return false;
-+ *pS >> cbTBData;
-+ if ( !tb.Read( pS ) )
-+ return false;
-+ for ( short index = 0; index < nVisualData; ++index )
-+ {
-+ TBVisualData aVisData;
-+ aVisData.Read( pS );
-+ rVisualData.push_back( aVisData );
-+ }
-+
-+ *pS >> iWCTBl >> reserved >> unused >> cCtls;
-+
-+ if ( cCtls )
-+ {
-+ for ( sal_Int32 index = 0; index < cCtls; ++index )
-+ {
-+ TBC aTBC;
-+ if ( !aTBC.Read( pS ) )
-+ return false;
-+ rTBC.push_back( aTBC );
-+ }
-+ }
-+ return true;
-+}
-+
-+void
-+CTB::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf(fp, "[ 0x%x ] CTB - dump\n", nOffSet );
-+ indent_printf(fp, " name %s\n", rtl::OUStringToOString( name.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ indent_printf(fp, " cbTBData size, in bytes, of this structure excluding the name, cCtls, and rTBC fields. %x\n", static_cast< unsigned int >( cbTBData ) );
-+
-+ tb.Print(fp);
-+ for ( short counter = 0; counter < nVisualData; ++counter )
-+ {
-+ indent_printf( fp, " TBVisualData [%d]\n", counter);
-+ Indent b;
-+ rVisualData[ counter ].Print( fp );
-+ }
-+ indent_printf(fp, " iWCTBl 0x%x reserved 0x%x unused 0x%x cCtls( toolbar controls ) 0x%x \n", static_cast< unsigned int >( iWCTBl ), reserved, unused, static_cast< unsigned int >( cCtls ) );
-+ if ( cCtls )
-+ {
-+ for ( sal_Int32 index = 0; index < cCtls; ++index )
-+ {
-+
-+ indent_printf(fp, " dumping toolbar control 0x%x\n", static_cast< unsigned int >( index ) );
-+ rTBC[ index ].Print( fp );
-+ }
-+ }
-+}
-+
-+bool CTB::ImportCustomToolBar( CTBWrapper& rWrapper, CustomToolBarImportHelper& helper )
-+{
-+ static rtl::OUString sToolbarPrefix( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/custom_" ) );
-+ bool bRes = false;
-+ try
-+ {
-+ if ( !tb.IsEnabled() )
-+ return true; // didn't fail, just ignoring
-+ // Create default setting
-+ uno::Reference< container::XIndexContainer > xIndexContainer( helper.getCfgManager()->createSettings(), uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xIndexAccess( xIndexContainer, uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xProps( xIndexContainer, uno::UNO_QUERY_THROW );
-+
-+ // set UI name for toolbar
-+ xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UIName") ), uno::makeAny( name.getString() ) );
-+
-+ rtl::OUString sToolBarName = sToolbarPrefix.concat( name.getString() );
-+ for ( std::vector< TBC >::iterator it = rTBC.begin(); it != rTBC.end(); ++it )
-+ {
-+ // createToolBar item for control
-+ if ( !it->ImportToolBarControl( rWrapper, xIndexContainer, helper, IsMenuToolbar() ) )
-+ return false;
-+ }
-+
-+ OSL_TRACE("Name of toolbar :-/ %s", rtl::OUStringToOString( sToolBarName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+
-+ helper.getCfgManager()->insertSettings( sToolBarName, xIndexAccess );
-+ helper.applyIcons();
-+#if 1 // don't think this is necessary
-+ uno::Reference< ui::XUIConfigurationPersistence > xPersistence( helper.getCfgManager()->getImageManager(), uno::UNO_QUERY_THROW );
-+ xPersistence->store();
-+
-+ xPersistence.set( helper.getCfgManager(), uno::UNO_QUERY_THROW );
-+ xPersistence->store();
-+#endif
-+ bRes = true;
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ OSL_TRACE("***** For some reason we have an exception %s", rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ bRes = false;
-+ }
-+ return bRes;
-+}
-+
-+bool CTB::ImportMenuTB( CTBWrapper& rWrapper, const css::uno::Reference< css::container::XIndexContainer >& xIndexContainer, CustomToolBarImportHelper& rHelper )
-+{
-+ for ( std::vector< TBC >::iterator it = rTBC.begin(); it != rTBC.end(); ++it )
-+ {
-+ // createToolBar item for control
-+ if ( !it->ImportToolBarControl( rWrapper, xIndexContainer, rHelper, true ) )
-+ return false;
-+ }
-+ return true;
-+}
-+
-+TBC::TBC()
-+{
-+}
-+
-+TBC::~TBC()
-+{
-+}
-+
-+bool TBC::Read( SvStream *pS )
-+{
-+ OSL_TRACE("TBC::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ if ( !tbch.Read( pS ) )
-+ return false;
-+ if ( tbch.getTcID() != 0x1 && tbch.getTcID() != 0x1051 )
-+ {
-+ cid.reset( new sal_uInt32 );
-+ *pS >> *cid;
-+ }
-+ // MUST exist if tbch.tct is not equal to 0x16
-+ if ( tbch.getTct() != 0x16 )
-+ {
-+ tbcd.reset( new TBCData( tbch ) );
-+ if ( !tbcd->Read( pS ) )
-+ return false;
-+ }
-+ return true;
-+}
-+
-+void TBC::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf(fp,"[ 0x%x ] TBC -- dump\n", nOffSet );
-+ indent_printf(fp," dumping header ( TBCHeader )\n");
-+ tbch.Print( fp );
-+ if ( cid.get() )
-+ indent_printf(fp," cid = 0x%x\n", static_cast< unsigned int >( *cid ) );
-+ if ( tbcd.get() )
-+ {
-+ indent_printf(fp," dumping toolbar data TBCData \n");
-+ tbcd->Print(fp);
-+ }
-+}
-+
-+bool
-+TBC::ImportToolBarControl( CTBWrapper& rWrapper, const css::uno::Reference< css::container::XIndexContainer >& toolbarcontainer, CustomToolBarImportHelper& helper, bool bIsMenuBar )
-+{
-+ // cmtFci 0x1 Command based on a built-in command. See CidFci.
-+ // cmtMacro 0x2 Macro command. See CidMacro.
-+ // cmtAllocated 0x3 Allocated command. See CidAllocated.
-+ // cmtNil 0x7 No command. See Cid.
-+ bool bBuiltin = false;
-+ sal_uInt16 cmdId = 0;
-+ if ( cid.get() )
-+ {
-+ sal_uInt16 arg2 = ( *( cid.get() ) & 0xFFFF );
-+
-+ sal_uInt8 cmt = ( arg2 & 0x7 );
-+ arg2 = ( arg2 >> 3 );
-+
-+ switch ( cmt )
-+ {
-+ case 1:
-+ OSL_TRACE("cmt is cmtFci builtin command 0x%x", arg2);
-+ bBuiltin = true;
-+ cmdId = arg2;
-+ break;
-+ case 2:
-+ OSL_TRACE("cmt is cmtMacro macro 0x%x", arg2);
-+ break;
-+ case 3:
-+ OSL_TRACE("cmt is cmtAllocated [???] 0x%x", arg2);
-+ break;
-+ case 7:
-+ OSL_TRACE("cmt is cmNill no-phing 0x%x", arg2);
-+ break;
-+ default:
-+ OSL_TRACE("illegal 0x%x", cmt);
-+ break;
-+ }
-+ }
-+
-+ if ( tbcd.get() )
-+ {
-+ std::vector< css::beans::PropertyValue > props;
-+ if ( bBuiltin )
-+ {
-+ rtl::OUString sCommand = helper.MSOCommandToOOCommand( cmdId );
-+ if ( sCommand.getLength() > 0 )
-+ {
-+ beans::PropertyValue aProp;
-+
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CommandURL") );
-+ aProp.Value <<= sCommand;
-+ props.push_back( aProp );
-+ }
-+ }
-+ bool bBeginGroup = false;
-+ if ( ! tbcd->ImportToolBarControl( helper, props, bBeginGroup, bIsMenuBar ) )
-+ return false;
-+
-+ TBCMenuSpecific* pMenu = tbcd->getMenuSpecific();
-+ if ( pMenu )
-+ {
-+ OSL_TRACE("** control has a menu, name of toolbar with menu items is %s", rtl::OUStringToOString( pMenu->Name(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ // search for CTB with the appropriate name ( it contains the
-+ // menu items, although we cannot import ( or create ) a menu on
-+ // a custom toolbar we can import the menu items in a separate
-+ // toolbar ( better than nothing )
-+ CTB* pCustTB = rWrapper.GetCustomizationData( pMenu->Name() );
-+ if ( pCustTB )
-+ {
-+ uno::Reference< container::XIndexContainer > xMenuDesc;
-+ uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+ xMenuDesc.set( xMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.IndexedPropertyValues" ) ) ), uno::UNO_QUERY_THROW );
-+ if ( !pCustTB->ImportMenuTB( rWrapper,xMenuDesc, helper ) )
-+ return false;
-+ if ( !bIsMenuBar )
-+ {
-+ if ( !helper.createMenu( pMenu->Name(), uno::Reference< container::XIndexAccess >( xMenuDesc, uno::UNO_QUERY ), true ) )
-+ return false;
-+ }
-+ else
-+ {
-+ beans::PropertyValue aProp;
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ItemDescriptorContainer") );
-+ aProp.Value <<= xMenuDesc;
-+ props.push_back( aProp );
-+ }
-+ }
-+ }
-+
-+ if ( bBeginGroup )
-+ {
-+ // insert spacer
-+ uno::Sequence< beans::PropertyValue > sProps( 1 );
-+ sProps[ 0 ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Type") );
-+ sProps[ 0 ].Value = uno::makeAny( ui::ItemType::SEPARATOR_LINE );
-+ toolbarcontainer->insertByIndex( toolbarcontainer->getCount(), uno::makeAny( sProps ) );
-+ }
-+
-+ uno::Sequence< beans::PropertyValue > sProps( props.size() );
-+ beans::PropertyValue* pProp = sProps.getArray();
-+
-+ for ( std::vector< css::beans::PropertyValue >::iterator it = props.begin(); it != props.end(); ++it, ++pProp )
-+ *pProp = *it;
-+
-+ toolbarcontainer->insertByIndex( toolbarcontainer->getCount(), uno::makeAny( sProps ) );
-+ }
-+ return true;
-+}
-+
-+rtl::OUString
-+TBC::GetCustomText()
-+{
-+ rtl::OUString sCustomText;
-+ if ( tbcd.get() )
-+ sCustomText = tbcd->getGeneralInfo().CustomText();
-+ return sCustomText;
-+
-+
-+}
-+
-+bool
-+Xst::Read( SvStream* pS )
-+{
-+ OSL_TRACE("Xst::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ sal_Int16 nChars = 0;
-+ *pS >> nChars;
-+ sString = readUnicodeString( pS, static_cast< sal_Int32 >( nChars ) );
-+ return true;
-+}
-+
-+void
-+Xst::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf( fp, "[ 0x%x ] Xst -- dump\n", nOffSet );
-+ indent_printf( fp, " %s", rtl::OUStringToOString( sString, RTL_TEXTENCODING_UTF8 ).getStr() );
-+}
-+
-+Tcg::Tcg() : nTcgVer( 255 )
-+{
-+}
-+
-+bool Tcg::Read(SvStream *pS)
-+{
-+ OSL_TRACE("Tcg::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> nTcgVer;
-+ if ( nTcgVer != (sal_Int8)255 )
-+ return false;
-+ tcg.reset( new Tcg255() );
-+ return tcg->Read( pS );
-+}
-+
-+void Tcg::Print( FILE* fp )
-+{
-+ Indent a(true);
-+ indent_printf(fp, "[ 0x%x ] Tcg - dump %d\n", nOffSet, nTcgVer);
-+ indent_printf(fp," nTcgVer %d\n", nTcgVer);
-+ if ( tcg.get() )
-+ tcg->Print( fp );
-+}
-+
-+bool Tcg::ImportCustomToolBar( SfxObjectShell& rDocSh )
-+{
-+ if ( tcg.get() )
-+ return tcg->ImportCustomToolBar( rDocSh );
-+ return false;
-+}
-+
-+Tcg255::Tcg255()
-+{
-+}
-+
-+Tcg255::~Tcg255()
-+{
-+ std::vector< Tcg255SubStruct* >::iterator it = rgtcgData.begin();
-+ for ( ; it != rgtcgData.end(); ++it )
-+ delete *it;
-+}
-+
-+bool Tcg255::processSubStruct( sal_uInt8 nId, SvStream *pS )
-+{
-+ Tcg255SubStruct* pSubStruct = NULL;
-+ switch ( nId )
-+ {
-+ case 0x1:
-+ {
-+ pSubStruct = new PlfMcd( false ); // don't read the id
-+ break;
-+ }
-+ case 0x2:
-+ {
-+ pSubStruct = new PlfAcd( false );
-+ break;
-+ }
-+ case 0x3:
-+ case 0x4:
-+ {
-+ pSubStruct = new PlfKme( false );
-+ break;
-+ }
-+ case 0x10:
-+ {
-+ pSubStruct = new TcgSttbf( false );
-+ break;
-+ }
-+ case 0x11:
-+ {
-+ pSubStruct = new MacroNames( false );
-+ break;
-+ }
-+ case 0x12:
-+ {
-+ pSubStruct = new CTBWrapper( false );
-+ break;
-+ }
-+ default:
-+ OSL_TRACE("Unknown id 0x%x",nId);
-+ return false;
-+ }
-+ pSubStruct->ch = nId;
-+ if ( !pSubStruct->Read( pS ) )
-+ return false;
-+ rgtcgData.push_back( pSubStruct );
-+ return true;
-+}
-+
-+bool Tcg255::ImportCustomToolBar( SfxObjectShell& rDocSh )
-+{
-+ // Find the CTBWrapper
-+ for ( std::vector< Tcg255SubStruct* >::const_iterator it = rgtcgData.begin(); it != rgtcgData.end(); ++it )
-+ {
-+ if ( (*it)->id() == 0x12 )
-+ {
-+ // not so great, shouldn't really have to do a horror casting
-+ CTBWrapper* pCTBWrapper = dynamic_cast< CTBWrapper* > ( *it );
-+ if ( pCTBWrapper )
-+ {
-+ if ( !pCTBWrapper->ImportCustomToolBar( rDocSh ) )
-+ return false;
-+ }
-+ }
-+ }
-+ return true;
-+}
-+
-+
-+bool Tcg255::Read(SvStream *pS)
-+{
-+ OSL_TRACE("Tcg255::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ sal_uInt8 nId = 0; //
-+ *pS >> nId;
-+ while ( nId != 0x40 )
-+ {
-+ if ( !processSubStruct( nId, pS ) )
-+ return false;
-+ *pS >> nId;
-+ }
-+ return true;
-+ // Peek at
-+}
-+
-+void Tcg255::Print( FILE* fp)
-+{
-+ Indent a;
-+ indent_printf(fp, "[ 0x%x ] Tcg255 - dump\n", nOffSet );
-+ indent_printf(fp, " contains %d sub records\n", rgtcgData.size() );
-+ std::vector< Tcg255SubStruct* >::iterator it = rgtcgData.begin();
-+ std::vector< Tcg255SubStruct* >::iterator it_end = rgtcgData.end();
-+
-+ for( sal_Int32 count = 1; it != it_end ; ++it, ++count )
-+ {
-+ Indent b;
-+ indent_printf(fp, " [%d] Tcg255SubStruct \n", static_cast< unsigned int >( count ) );
-+ (*it)->Print(fp);
-+ }
-+}
-+
-+
-+Tcg255SubStruct::Tcg255SubStruct( bool bReadId ) : mbReadId( bReadId ), ch(0)
-+{
-+}
-+
-+bool Tcg255SubStruct::Read(SvStream *pS)
-+{
-+ OSL_TRACE("Tcg255SubStruct::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ if ( mbReadId )
-+ *pS >> ch;
-+ return true;
-+}
-+
-+PlfMcd::PlfMcd( bool bReadId ): Tcg255SubStruct( bReadId ), rgmcd( NULL )
-+{
-+}
-+PlfMcd::~PlfMcd()
-+{
-+ if ( rgmcd )
-+ delete[] rgmcd;
-+}
-+
-+bool PlfMcd::Read(SvStream *pS)
-+{
-+ OSL_TRACE("PffMcd::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ Tcg255SubStruct::Read( pS );
-+ *pS >> iMac;
-+ if ( iMac )
-+ {
-+ rgmcd = new MCD[ iMac ];
-+ for ( sal_Int32 index = 0; index < iMac; ++index )
-+ {
-+ if ( !rgmcd[ index ].Read( pS ) )
-+ return false;
-+ }
-+ }
-+ return true;
-+}
-+
-+void PlfMcd::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf(fp, "[ 0x%x ] PlfMcd ( Tcg255SubStruct ) - dump\n", nOffSet );
-+ indent_printf(fp, " contains %d MCD records\n", static_cast<int>( iMac ) );
-+ for ( sal_Int32 count=0; count < iMac; ++count )
-+ {
-+ Indent b;
-+ indent_printf(fp, "[%d] MCD\n", static_cast< int >( count ) );
-+ rgmcd[ count ].Print( fp );
-+ }
-+
-+}
-+
-+PlfAcd::PlfAcd( bool bReadId ) : Tcg255SubStruct( bReadId )
-+,iMac(0)
-+,rgacd(NULL)
-+{
-+}
-+
-+
-+PlfAcd::~PlfAcd()
-+{
-+ if ( rgacd )
-+ delete[] rgacd;
-+}
-+
-+bool PlfAcd::Read( SvStream *pS)
-+{
-+ OSL_TRACE("PffAcd::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ Tcg255SubStruct::Read( pS );
-+ *pS >> iMac;
-+ if ( iMac )
-+ {
-+ rgacd = new Acd[ iMac ];
-+ for ( sal_Int32 index = 0; index < iMac; ++index )
-+ {
-+ if ( !rgacd[ index ].Read( pS ) )
-+ return false;
-+ }
-+ }
-+ return true;
-+}
-+void PlfAcd::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf(fp, "[ 0x%x ] PlfAcd ( Tcg255SubStruct ) - dump\n", nOffSet );
-+ indent_printf(fp, " contains %d ACD records\n", static_cast< int >( iMac ) );
-+ for ( sal_Int32 count=0; count < iMac; ++count )
-+ {
-+ Indent b;
-+ indent_printf(fp, "[%d] ACD\n", static_cast< int >( count ) );
-+ rgacd[ count ].Print( fp );
-+ }
-+
-+}
-+
-+PlfKme::PlfKme( bool bReadId ) : Tcg255SubStruct( bReadId )
-+,iMac( 0 )
-+,rgkme( NULL )
-+{
-+}
-+
-+PlfKme::~PlfKme()
-+{
-+ if ( rgkme )
-+ delete[] rgkme;
-+}
-+
-+bool PlfKme::Read(SvStream *pS)
-+{
-+ OSL_TRACE("PlfKme::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ Tcg255SubStruct::Read( pS );
-+ *pS >> iMac;
-+ if ( iMac )
-+ {
-+ rgkme = new Kme[ iMac ];
-+ for( sal_Int32 index=0; index<iMac; ++index )
-+ {
-+ if ( !rgkme[ index ].Read( pS ) )
-+ return false;
-+ }
-+ }
-+ return true;
-+}
-+
-+void PlfKme::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf(fp, "[ 0x%x ] PlfKme ( Tcg255SubStruct ) - dump\n", nOffSet );
-+ indent_printf(fp, " contains %d Kme records\n", static_cast< int >( iMac ) );
-+ for ( sal_Int32 count=0; count < iMac; ++count )
-+ {
-+ Indent b;
-+ indent_printf(fp, "[%d] Kme\n", static_cast< int >( count ) );
-+ rgkme[ count ].Print( fp );
-+ }
-+
-+}
-+
-+TcgSttbf::TcgSttbf( bool bReadId ) : Tcg255SubStruct( bReadId )
-+{
-+}
-+
-+bool TcgSttbf::Read( SvStream *pS)
-+{
-+ OSL_TRACE("TcgSttbf::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ Tcg255SubStruct::Read( pS );
-+ return sttbf.Read( pS );
-+}
-+
-+void TcgSttbf::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf(fp,"[ 0x%x ] TcgSttbf - dump\n", nOffSet );
-+ sttbf.Print( fp );
-+}
-+
-+TcgSttbfCore::TcgSttbfCore() : fExtend( 0 )
-+,cData( 0 )
-+,cbExtra( 0 )
-+,dataItems( NULL )
-+{
-+}
-+
-+TcgSttbfCore::~TcgSttbfCore()
-+{
-+ if ( dataItems )
-+ delete[] dataItems;
-+}
-+
-+bool TcgSttbfCore::Read( SvStream* pS )
-+{
-+ OSL_TRACE("TcgSttbfCore::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> fExtend >> cData >> cbExtra;
-+ if ( cData )
-+ {
-+ dataItems = new SBBItem[ cData ];
-+ for ( sal_Int32 index = 0; index < cData; ++index )
-+ {
-+ *pS >> dataItems[ index ].cchData;
-+ dataItems[ index ].data = readUnicodeString( pS, dataItems[ index ].cchData );
-+ *pS >> dataItems[ index ].extraData;
-+ }
-+ }
-+ return true;
-+}
-+
-+void TcgSttbfCore::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf( fp, "[ 0x%x ] TcgSttbfCore - dump\n");
-+ indent_printf( fp, " fExtend 0x%x [expected 0xFFFF ]\n", fExtend );
-+ indent_printf( fp, " cbExtra 0x%x [expected 0x02 ]\n", cbExtra );
-+ indent_printf( fp, " cData no. or string data items %d (0x%x)\n", cData, cData );
-+
-+ if ( cData )
-+ {
-+ for ( sal_Int32 index = 0; index < cData; ++index )
-+ indent_printf(fp," string dataItem[ %d(0x%x) ] has name %s and if referenced %d times.\n", static_cast< int >( index ), static_cast< unsigned int >( index ), rtl::OUStringToOString( dataItems[ index ].data, RTL_TEXTENCODING_UTF8 ).getStr(), dataItems[ index ].extraData );
-+ }
-+
-+}
-+MacroNames::MacroNames( bool bReadId ) : Tcg255SubStruct( bReadId )
-+,iMac( 0 )
-+,rgNames( NULL )
-+{
-+}
-+
-+MacroNames::~MacroNames()
-+{
-+ if ( rgNames )
-+ delete[] rgNames;
-+}
-+
-+bool MacroNames::Read( SvStream *pS)
-+{
-+ OSL_TRACE("MacroNames::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ Tcg255SubStruct::Read( pS );
-+ *pS >> iMac;
-+ if ( iMac )
-+ {
-+ rgNames = new MacroName[ iMac ];
-+ for ( sal_Int32 index = 0; index < iMac; ++index )
-+ {
-+ if ( !rgNames[ index ].Read( pS ) )
-+ return false;
-+ }
-+ }
-+ return true;
-+}
-+
-+void MacroNames::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf(fp, "[ 0x%x ] MacroNames ( Tcg255SubStruct ) - dump\n");
-+ indent_printf(fp, " contains %d MacroName records\n", iMac );
-+ for ( sal_Int32 count=0; count < iMac; ++count )
-+ {
-+ Indent b;
-+ indent_printf(fp, "[%d] MacroName\n", static_cast<int>( count ) );
-+ rgNames[ count ].Print( fp );
-+ }
-+
-+}
-+
-+MacroName::MacroName():ibst(0)
-+{
-+}
-+
-+
-+bool MacroName::Read(SvStream *pS)
-+{
-+ OSL_TRACE("MacroName::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> ibst;
-+ return xstz.Read( pS );
-+}
-+
-+void MacroName::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf( fp, "[ 0x%x ] MacroName - dump");
-+ indent_printf( fp," index - 0x%x has associated following record\n", ibst );
-+ xstz.Print( fp );
-+}
-+
-+
-+
-+Xstz::Xstz():chTerm(0)
-+{
-+}
-+
-+bool
-+Xstz::Read(SvStream *pS)
-+{
-+ OSL_TRACE("Xstz::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ if ( !xst.Read( pS ) )
-+ return false;
-+ *pS >> chTerm;
-+ if ( chTerm != 0 ) // should be an assert
-+ return false;
-+ return true;
-+}
-+
-+void Xstz::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf(fp,"[ 0x%x ] Xstz -- dump\n", nOffSet );
-+ indent_printf(fp," Xst\n");
-+ xst.Print( fp );
-+ indent_printf(fp," chterm 0x%x ( should be zero )\n", chTerm);
-+}
-+
-+Kme::Kme() : reserved1(0)
-+,reserved2(0)
-+,kcm1(0)
-+,kcm2(0)
-+,kt(0)
-+,param(0)
-+{
-+}
-+
-+Kme::~Kme()
-+{
-+}
-+
-+bool
-+Kme::Read(SvStream *pS)
-+{
-+ OSL_TRACE("Kme::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> reserved1 >> reserved2 >> kcm1 >> kcm2 >> kt >> param;
-+ return true;
-+}
-+
-+void Kme::Print( FILE* fp )
-+{
-+ Indent a;
-+
-+ indent_printf( fp, "[ 0x%x ] Kme - dump\n", nOffSet );
-+ indent_printf( fp, " reserved1 0x%x [expected 0x0 ]\n", reserved1 );
-+ indent_printf( fp, " reserved2 0x%x [expected 0x0 ]\n", reserved2 );
-+ indent_printf( fp, " kcm1 0x%x [shortcut key]\n", kcm1 );
-+ indent_printf( fp, " kcm2 0x%x [shortcut key]\n", kcm2 );
-+ indent_printf( fp, " kt 0x%x \n", kt );
-+ indent_printf( fp, " param 0x%x \n", static_cast< unsigned int >( param ) );
-+}
-+
-+Acd::Acd() : ibst( 0 )
-+, fciBasedOnABC( 0 )
-+{
-+}
-+
-+bool Acd::Read(SvStream *pS)
-+{
-+ OSL_TRACE("Acd::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> ibst >> fciBasedOnABC;
-+ return true;
-+}
-+
-+void Acd::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf( fp,"[ 0x%x ] ACD - dump\n", nOffSet );
-+ // #TODO flesh out interpretation of these values
-+ indent_printf( fp," ibst 0x%x\n", ibst);
-+ indent_printf( fp," fciBaseObABC 0x%x\n", fciBasedOnABC);
-+}
-+
-+MCD::MCD() : reserved1(0x56)
-+,reserved2( 0 )
-+,ibst( 0 )
-+,ibstName( 0 )
-+,reserved3( 0xFFFF )
-+,reserved4( 0 )
-+,reserved5( 0 )
-+,reserved6( 0 )
-+,reserved7( 0 )
-+{
-+}
-+
-+bool MCD::Read(SvStream *pS)
-+{
-+ OSL_TRACE("MCD::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> reserved1 >> reserved2 >> ibst >> ibstName >> reserved3;
-+ *pS >> reserved4 >> reserved5 >> reserved6 >> reserved7;
-+ return true;
-+}
-+
-+void MCD::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf( fp, "[ 0x%x ] MCD - dump\n", nOffSet );
-+ indent_printf( fp, " reserved1 0x%x [expected 0x56 ]\n", reserved1 );
-+ indent_printf( fp, " reserved2 0x%x [expected 0x0 ]\n", reserved2 );
-+ indent_printf( fp, " ibst 0x%x specifies macro with MacroName.xstz = 0x%x\n", ibst, ibst );
-+ indent_printf( fp, " ibstName 0x%x index into command string table ( TcgSttbf.sttbf )\n", ibstName );
-+
-+ indent_printf( fp, " reserved3 0x%x [expected 0xFFFF ]\n", reserved3 );
-+ indent_printf( fp, " reserved4 0x%x\n", static_cast< unsigned int >( reserved4 ) );
-+ indent_printf( fp, " reserved5 0x%x [expected 0x0 ]\n", static_cast< unsigned int >( reserved5 ) );
-+ indent_printf( fp, " reserved6 0x%x\n", static_cast< unsigned int >( reserved6 ) );
-+ indent_printf( fp, " reserved7 0x%x\n", static_cast< unsigned int >( reserved7 ) );
-+}
-+
-diff --git sw/source/filter/ww8/ww8toolbar.hxx sw/source/filter/ww8/ww8toolbar.hxx
-new file mode 100644
-index 0000000..a8b3342
---- /dev/null
-+++ sw/source/filter/ww8/ww8toolbar.hxx
-@@ -0,0 +1,347 @@
-+#ifndef _WW8TOOLBAR_HXX
-+#define _WW8TOOLBAR_HXX
-+
-+#include <filter/msfilter/mstoolbar.hxx>
-+
-+namespace css = ::com::sun::star;
-+
-+class Xst : public TBBase
-+{
-+ rtl::OUString sString;
-+public:
-+ Xst(){}
-+ bool Read(SvStream *pS);
-+ rtl::OUString getString() { return sString; }
-+ void Print( FILE* fp );
-+};
-+
-+class CTBWrapper;
-+class TBC : public TBBase
-+{
-+ TBCHeader tbch;
-+ boost::shared_ptr< sal_uInt32 > cid; // optional
-+ boost::shared_ptr<TBCData> tbcd;
-+public:
-+ TBC();
-+ ~TBC();
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+ bool ImportToolBarControl( CTBWrapper&, const css::uno::Reference< css::container::XIndexContainer >&, CustomToolBarImportHelper&, bool );
-+ rtl::OUString GetCustomText();
-+};
-+
-+class CTB : public TBBase
-+{
-+ Xst name;
-+ sal_Int32 cbTBData;
-+ TB tb;
-+ std::vector<TBVisualData> rVisualData;
-+ sal_Int32 iWCTBl;
-+ sal_uInt16 reserved;
-+ sal_uInt16 unused;
-+ sal_Int32 cCtls;
-+ std::vector< TBC > rTBC;
-+
-+ CTB(const CTB&);
-+ CTB& operator = ( const CTB&);
-+public:
-+ CTB();
-+ ~CTB();
-+ bool Read(SvStream *pS);
-+ void Print( FILE* fp );
-+ bool IsMenuToolbar();
-+ bool ImportCustomToolBar( CTBWrapper&, CustomToolBarImportHelper& );
-+ bool ImportMenuTB( CTBWrapper&, const css::uno::Reference< css::container::XIndexContainer >&, CustomToolBarImportHelper& );
-+ rtl::OUString GetName() { return tb.getName().getString(); }
-+};
-+
-+class TBDelta : public TBBase
-+{
-+ sal_uInt8 doprfatendFlags;
-+
-+ sal_uInt8 ibts;
-+ sal_Int32 cidNext;
-+ sal_Int32 cid;
-+ sal_Int32 fc;
-+ sal_uInt16 CiTBDE; // careful of this ( endian matters etc. )
-+ sal_uInt16 cbTBC;
-+public:
-+ TBDelta();
-+ ~TBDelta(){}
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+ bool ControlIsModified();
-+ bool ControlIsInserted();
-+ bool ControlIsChanged();
-+ bool ControlDropsToolBar();
-+ sal_Int32 TBCStreamOffset();
-+ sal_Int16 CustomizationIndex();
-+
-+};
-+
-+class Tcg255SubStruct : public TBBase
-+{
-+friend class Tcg255;
-+ bool mbReadId;
-+ Tcg255SubStruct(const Tcg255SubStruct&);
-+ Tcg255SubStruct& operator = ( const Tcg255SubStruct&);
-+protected:
-+ sal_uInt8 ch;
-+public:
-+ Tcg255SubStruct( bool bReadId );
-+ ~Tcg255SubStruct(){}
-+ virtual sal_uInt8 id() const { return ch; }
-+ bool Read(SvStream *pS);
-+};
-+
-+class CTBWrapper;
-+class Customization : public TBBase
-+{
-+friend class CTBWrapper;
-+ sal_Int32 tbidForTBD;
-+ sal_uInt16 reserved1;
-+ sal_Int16 ctbds;
-+ CTBWrapper* pWrapper;
-+ boost::shared_ptr< CTB > customizationDataCTB;
-+ std::vector< TBDelta > customizationDataTBDelta;
-+ bool bIsDroppedMenuTB;
-+ bool ImportMenu( CTBWrapper&, const css::uno::Reference< css::container::XIndexContainer >&, CustomToolBarImportHelper& );
-+public:
-+ Customization( CTBWrapper* rapper );
-+ ~Customization();
-+ bool Read(SvStream *pS);
-+ bool ImportCustomToolBar( CTBWrapper&, CustomToolBarImportHelper& );
-+ bool ImportMenu( CTBWrapper&, CustomToolBarImportHelper& );
-+ void Print( FILE* );
-+ sal_Int32 GetTBIDForTB(){ return tbidForTBD; }
-+ CTB* GetCustomizationData() { return customizationDataCTB.get(); };
-+};
-+
-+class SfxObjectShell;
-+
-+class CTBWrapper : public Tcg255SubStruct
-+{
-+ // reserved1 is the ch field of Tcg255SubStruct
-+ sal_uInt16 reserved2;
-+ sal_uInt8 reserved3;
-+ sal_uInt16 reserved4;
-+ sal_uInt16 reserved5;
-+
-+ sal_Int16 cbTBD;
-+ sal_Int16 cCust;
-+
-+ sal_Int32 cbDTBC;
-+
-+ std::vector< TBC > rtbdc; //
-+ std::vector< Customization > rCustomizations; // array of Customizations
-+ std::vector< sal_Int16 > dropDownMenuIndices; // array of indexes of Customization toolbars that are dropped by a menu
-+ CTBWrapper(const CTBWrapper&);
-+ CTBWrapper& operator = ( const CTBWrapper&);
-+public:
-+ CTBWrapper( bool bReadId = true );
-+ ~CTBWrapper();
-+ void InsertDropIndex( sal_Int32 aIndex ) { dropDownMenuIndices.push_back( aIndex ); }
-+ TBC* GetTBCAtOffset( sal_uInt32 nStreamOffset );
-+ bool Read(SvStream *pS);
-+ bool ImportCustomToolBar( SfxObjectShell& rDocSh );
-+
-+ Customization* GetCustomizaton( sal_Int16 index );
-+ CTB* GetCustomizationData( const rtl::OUString& name );
-+ void Print( FILE* );
-+};
-+
-+class MCD : public TBBase
-+{
-+ sal_Int8 reserved1; // A signed integer that MUST be 0x56.
-+ sal_uInt8 reserved2; // MUST be 0.
-+ sal_uInt16 ibst; // Unsigned integer that specifies the name of the macro. Macro name is specified by MacroName.xstz of the MacroName entry in the MacroNames such that MacroName.ibst equals ibst. MacroNames MUST contain such an entry.
-+ sal_uInt16 ibstName; // An unsigned integer that specifies the index into the Command String Table (TcgSttbf.sttbf) where the macro‘s name and arguments are specified.
-+ sal_uInt16 reserved3; // An unsigned integer that MUST be 0xFFFF.
-+ sal_uInt32 reserved4; //MUST be ignored.
-+ sal_uInt32 reserved5; //MUST be 0.
-+ sal_uInt32 reserved6; //MUST be ignored.
-+ sal_uInt32 reserved7; //MUST be ignored
-+
-+ MCD(const MCD&);
-+ MCD& operator = ( const MCD&);
-+public:
-+ MCD();
-+ ~MCD(){}
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+};
-+
-+class PlfMcd : public Tcg255SubStruct
-+{
-+ sal_Int32 iMac;
-+ MCD* rgmcd; // array of MCD's
-+ PlfMcd(const PlfMcd&);
-+ PlfMcd& operator = ( const PlfMcd&);
-+public:
-+ PlfMcd( bool bReadId = true );
-+ ~PlfMcd();
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+};
-+
-+class Acd : public TBBase
-+{
-+ sal_Int16 ibst;
-+ sal_uInt16 fciBasedOnABC; // fciBasedOn(13 bits) A(1bit)B(1bit)C(1Bit)
-+ Acd(const Acd&);
-+ Acd& operator = ( const Acd&);
-+public:
-+ Acd();
-+ ~Acd(){}
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+};
-+
-+class PlfAcd: public Tcg255SubStruct
-+{
-+ sal_Int32 iMac;
-+ Acd* rgacd;
-+ PlfAcd(const PlfAcd&);
-+ PlfAcd& operator = ( const PlfAcd&);
-+public:
-+ PlfAcd( bool bReadId = true );
-+ ~PlfAcd();
-+ bool Read(SvStream *pS);
-+ void Print(FILE*);
-+};
-+
-+class Kme : public TBBase
-+{
-+ sal_Int16 reserved1; //MUST be zero.
-+ sal_Int16 reserved2; //MUST be zero.
-+ sal_uInt16 kcm1; //A Kcm that specifies the primary shortcut key.
-+ sal_uInt16 kcm2; //A Kcm that specifies the secondary shortcut key, or 0x00FF if there is no secondary shortcut key.
-+ sal_uInt16 kt; //A Kt that specifies the type of action to be taken when the key combination is pressed.
-+ sal_uInt32 param; //The meaning of this field depends on the value of kt
-+
-+ Kme(const Kme&);
-+ Kme& operator = ( const Kme&);
-+public:
-+ Kme();
-+ ~Kme();
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+};
-+
-+class PlfKme : public Tcg255SubStruct
-+{
-+ sal_Int32 iMac;
-+ Kme* rgkme;
-+ PlfKme(const PlfKme&);
-+ PlfKme& operator = ( const PlfKme&);
-+public:
-+ PlfKme( bool bReadId = true );
-+ ~PlfKme();
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+};
-+
-+class TcgSttbfCore : public TBBase
-+{
-+struct SBBItem
-+{
-+ sal_uInt16 cchData;
-+ rtl::OUString data;
-+ sal_uInt16 extraData;
-+ SBBItem() : cchData(0), extraData(0){}
-+};
-+ sal_uInt16 fExtend;
-+ sal_uInt16 cData;
-+ sal_uInt16 cbExtra;
-+ SBBItem* dataItems;
-+ TcgSttbfCore(const TcgSttbfCore&);
-+ TcgSttbfCore& operator = ( const TcgSttbfCore&);
-+public:
-+ TcgSttbfCore();
-+ ~TcgSttbfCore();
-+ bool Read(SvStream *pS);
-+ void Print( FILE* fp );
-+};
-+
-+class TcgSttbf : public Tcg255SubStruct
-+{
-+ TcgSttbfCore sttbf;
-+ TcgSttbf(const TcgSttbf&);
-+ TcgSttbf& operator = ( const TcgSttbf&);
-+public:
-+ TcgSttbf( bool bReadId = true );
-+ ~TcgSttbf(){}
-+ bool Read(SvStream *pS);
-+ void Print( FILE* fp );
-+};
-+
-+class Xstz : public TBBase
-+{
-+ Xst xst; //An Xst specifying the string with its pre-pended length.
-+ sal_uInt16 chTerm;
-+
-+ Xstz(const Xstz&);
-+ Xstz& operator = ( const Xstz&);
-+public:
-+ Xstz();
-+ ~Xstz(){}
-+ bool Read(SvStream *pS);
-+ void Print( FILE* fp );
-+};
-+
-+class MacroName : public TBBase
-+{
-+ sal_uInt16 ibst; //An unsigned integer that specifies the index of the current entry in the macro name table. MUST NOT be the same as the index of any other entry.
-+ Xstz xstz;
-+ MacroName(const MacroName&);
-+ MacroName& operator = ( const MacroName&);
-+public:
-+ MacroName();
-+ ~MacroName(){}
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+};
-+
-+class MacroNames : public Tcg255SubStruct
-+{
-+ sal_uInt16 iMac; //An unsigned integer that specifies the number of MacroName structures in rgNames.
-+ MacroName* rgNames;
-+
-+ MacroNames(const MacroNames&);
-+ MacroNames& operator = ( const MacroNames&);
-+public:
-+ MacroNames( bool bReadId = true );
-+ ~MacroNames();
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+};
-+
-+class Tcg255 : public TBBase
-+{
-+ std::vector< Tcg255SubStruct* > rgtcgData; // array of sub structures
-+ Tcg255(const Tcg255&);
-+ Tcg255& operator = ( const Tcg255&);
-+ bool processSubStruct( sal_uInt8 nId, SvStream* );
-+public:
-+ Tcg255();
-+ ~Tcg255();
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+ bool ImportCustomToolBar( SfxObjectShell& rDocSh );
-+};
-+
-+class Tcg: public TBBase
-+{
-+ sal_Int8 nTcgVer;
-+ std::auto_ptr< Tcg255 > tcg;
-+ Tcg(const Tcg&);
-+ Tcg& operator = ( const Tcg&);
-+public:
-+ Tcg();
-+ ~Tcg(){}
-+ bool Read(SvStream *pS);
-+ bool ImportCustomToolBar( SfxObjectShell& rDocSh );
-+ void Print( FILE* );
-+};
-+
-+#endif
-diff --git sw/source/ui/app/docsh.cxx sw/source/ui/app/docsh.cxx
-index 22a8213..0bb4afe 100644
---- sw/source/ui/app/docsh.cxx
-+++ sw/source/ui/app/docsh.cxx
-@@ -490,16 +490,6 @@ sal_Bool SwDocShell::SaveAs( SfxMedium& rMedium )
- xDocSh->DoClose();
- }
-
-- if( pDoc->ContainsMSVBasic() )
-- {
-- //TODO/MBA: it looks as that this code can be removed!
-- //SvxImportMSVBasic aTmp( *this, pIo->GetStorage() );
-- //aTmp.SaveOrDelMSVBAStorage( FALSE, aEmptyStr );
-- if( SvtFilterOptions::Get()->IsLoadWordBasicStorage() )
-- nVBWarning = GetSaveWarningOfMSVBAStorage( (SfxObjectShell&) *this );
-- pDoc->SetContainsMSVBasic( FALSE );
-- }
--
- // TabellenBox Edit beenden!
- if( pWrtShell )
- pWrtShell->EndAllTblBoxEdit();
-diff --git sw/source/ui/app/docsh2.cxx sw/source/ui/app/docsh2.cxx
-index cea9d74..aa59379 100644
---- sw/source/ui/app/docsh2.cxx
-+++ sw/source/ui/app/docsh2.cxx
-@@ -119,6 +119,8 @@
- #include <com/sun/star/ui/dialogs/ListboxControlActions.hpp>
- #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp>
- #include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
-+#include <com/sun/star/document/XVbaEventsHelper.hpp>
-+#include <com/sun/star/document/VbaEventId.hpp>
-
- #include <editeng/acorrcfg.hxx>
- #include <SwStyleNameMapper.hxx>
-@@ -137,6 +139,7 @@ using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star;
- using ::rtl::OUString;
- using namespace ::sfx2;
-+using namespace com::sun::star::document::VbaEventId;
-
- extern BOOL FindPhyStyle( SwDoc& , const String& , SfxStyleFamily );
-
-@@ -188,6 +191,31 @@ void SwDocShell::DoFlushDocInfo()
- }
- }
-
-+void lcl_processCompatibleSfxHint( const uno::Reference< document::XVbaEventsHelper >& xVbaEventsHelper, const SfxHint& rHint )
-+{
-+ if ( rHint.ISA( SfxEventHint ) )
-+ {
-+ uno::Sequence< uno::Any > aArgs;
-+ ULONG nEventId = ((SfxEventHint&)rHint).GetEventId();
-+ switch( nEventId )
-+ {
-+ case SFX_EVENT_CREATEDOC:
-+ {
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_DOCUMENT_NEW, aArgs );
-+ break;
-+ }
-+ case SFX_EVENT_OPENDOC:
-+ {
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_DOCUMENT_OPEN, aArgs );
-+ break;
-+ }
-+ default:
-+ {
-+ //do nothing
-+ }
-+ }
-+ }
-+}
-
- /*--------------------------------------------------------------------
- Beschreibung: Benachrichtigung bei geaenderter DocInfo
-@@ -201,6 +229,9 @@ void SwDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
- // ASSERT( !this, "DocShell ist nicht richtig initialisiert!" );
- return ;
- }
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper = pDoc->GetVbaEventsHelper();
-+ if( xVbaEventsHelper.is() )
-+ lcl_processCompatibleSfxHint( xVbaEventsHelper, rHint );
-
- USHORT nAction = 0;
- if( rHint.ISA(SfxSimpleHint) )
-@@ -283,6 +314,16 @@ USHORT SwDocShell::PrepareClose( BOOL bUI, BOOL bForBrowsing )
- if( TRUE == nRet ) //Unbedingt auf TRUE abfragen! (RET_NEWTASK)
- EndListening( *this );
-
-+ if( pDoc && IsInPrepareClose() )
-+ {
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper = pDoc->GetVbaEventsHelper();
-+ if( xVbaEventsHelper.is() )
-+ {
-+ uno::Sequence< uno::Any > aArgs;
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_DOCUMENT_CLOSE, aArgs );
-+ }
-+ }
-+
- return nRet;
- }
-
-diff --git sw/source/ui/uno/unotxdoc.cxx sw/source/ui/uno/unotxdoc.cxx
-index e3f1322..94a850b 100644
---- sw/source/ui/uno/unotxdoc.cxx
-+++ sw/source/ui/uno/unotxdoc.cxx
-@@ -178,6 +178,7 @@ using ::osl::FileBase;
- #define SW_CREATE_MARKER_TABLE 0x06
- #define SW_CREATE_DRAW_DEFAULTS 0x07
-
-+#include <comphelper/processfactory.hxx>
-
- /******************************************************************************
- *
-@@ -256,6 +257,12 @@ sal_Int64 SAL_CALL SwXTextDocument::getSomething( const Sequence< sal_Int8 >& rI
- {
- return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this ));
- }
-+ if( rId.getLength() == 16
-+ && 0 == rtl_compareMemory( SfxObjectShell::getUnoTunnelId().getConstArray(),
-+ rId.getConstArray(), 16 ) )
-+ {
-+ return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(pDocShell ));
-+ }
-
- sal_Int64 nRet = SfxBaseModel::getSomething( rId );
- if ( nRet )
-@@ -404,6 +411,9 @@ SwXTextDocument::SwXTextDocument(SwDocShell* pShell) :
- m_pPrintUIOptions( NULL ),
- m_pRenderData( NULL )
- {
-+ uno::Reference< document::XDocumentProperties > xWriterProps( ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.writer.DocumentProperties") ), uno::UNO_QUERY_THROW);
-+
-+ SfxBaseModel::setDocumentProperties( xWriterProps );
- }
- /*-- 18.12.98 11:53:00---------------------------------------------------
-
-@@ -2173,6 +2183,9 @@ Any SwXTextDocument::getPropertyValue(const OUString& rPropertyName)
- Any aAny;
- switch(pEntry->nWID)
- {
-+ case WID_DOC_ISTEMPLATEID :
-+ aAny <<= pDocShell->IsTemplate();
-+ break;
- case WID_DOC_CHAR_COUNT :
- case WID_DOC_PARA_COUNT :
- case WID_DOC_WORD_COUNT :
-@@ -2281,6 +2294,14 @@ Any SwXTextDocument::getPropertyValue(const OUString& rPropertyName)
- case WID_DOC_DIALOG_LIBRARIES:
- aAny <<= pDocShell->GetDialogContainer();
- break;
-+ case WID_DOC_VBA_DOCOBJ:
-+ {
-+ beans::PropertyValue aProp;
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ThisWordDoc") );
-+ aProp.Value <<= pDocShell->GetModel();
-+ aAny <<= aProp;
-+ }
-+ break;
- case WID_DOC_RUNTIME_UID:
- aAny <<= getRuntimeUID();
- break;
-@@ -3189,6 +3210,7 @@ uno::Sequence< lang::Locale > SAL_CALL SwXTextDocument::getDocumentLanguages(
- {
- ::vos::OGuard aGuard(Application::GetSolarMutex());
-
-+
- // possible canonical values for nScriptTypes
- // any bit wise combination is allowed
- const sal_Int16 nLatin = 0x001;
-diff --git sw/source/ui/vba/makefile.mk sw/source/ui/vba/makefile.mk
-index c09f813..50335f3 100644
---- sw/source/ui/vba/makefile.mk
-+++ sw/source/ui/vba/makefile.mk
-@@ -82,6 +82,7 @@ SLOFILES= \
- $(SLO)$/vbaborders.obj \
- $(SLO)$/vbadocuments.obj \
- $(SLO)$/vbaheaderfooter.obj \
-+ $(SLO)$/vbaheadersfooters.obj \
- $(SLO)$/vbaheaderfooterhelper.obj \
- $(SLO)$/vbaaddin.obj \
- $(SLO)$/vbaaddins.obj \
-@@ -91,6 +92,30 @@ SLOFILES= \
- $(SLO)$/vbapagesetup.obj \
- $(SLO)$/vbasection.obj \
- $(SLO)$/vbasections.obj \
-+ $(SLO)$/vbarow.obj \
-+ $(SLO)$/vbarows.obj \
-+ $(SLO)$/vbacolumn.obj \
-+ $(SLO)$/vbacolumns.obj \
-+ $(SLO)$/vbatablehelper.obj \
-+ $(SLO)$/vbacell.obj \
-+ $(SLO)$/vbacells.obj \
-+ $(SLO)$/vbatabstop.obj \
-+ $(SLO)$/vbatabstops.obj \
-+ $(SLO)$/vbatableofcontents.obj \
-+ $(SLO)$/vbatablesofcontents.obj \
-+ $(SLO)$/vbalistgallery.obj \
-+ $(SLO)$/vbalistgalleries.obj \
-+ $(SLO)$/vbalisthelper.obj \
-+ $(SLO)$/vbalisttemplate.obj \
-+ $(SLO)$/vbalisttemplates.obj \
-+ $(SLO)$/vbalistlevel.obj \
-+ $(SLO)$/vbalistlevels.obj \
-+ $(SLO)$/vbalistformat.obj \
-+ $(SLO)$/vbarevision.obj \
-+ $(SLO)$/vbarevisions.obj \
-+ $(SLO)$/vbaframe.obj \
-+ $(SLO)$/vbaframes.obj \
-+ $(SLO)$/vbaeventshelper.obj \
-
- # --- Targets ------------------------------------------------------
-
-diff --git sw/source/ui/vba/service.cxx sw/source/ui/vba/service.cxx
-index fee2847..8b9915a 100644
---- sw/source/ui/vba/service.cxx
-+++ sw/source/ui/vba/service.cxx
-@@ -52,6 +52,11 @@ namespace wrapformat
- extern sdecl::ServiceDecl const serviceDecl;
- }
-
-+namespace vbaeventshelper
-+{
-+extern sdecl::ServiceDecl const serviceDecl;
-+}
-+
- extern "C"
- {
- void SAL_CALL component_getImplementationEnvironment(
-@@ -68,7 +73,7 @@ extern "C"
-
- // Component registration
- return component_writeInfoHelper( pServiceManager, pRegistryKey,
-- globals::serviceDecl, document::serviceDecl, wrapformat::serviceDecl );
-+ globals::serviceDecl, document::serviceDecl, wrapformat::serviceDecl, vbaeventshelper::serviceDecl );
- }
-
- void * SAL_CALL component_getFactory(
-@@ -77,7 +82,7 @@ extern "C"
- {
- OSL_TRACE("In component_getFactory for %s", pImplName );
- void* pRet = component_getFactoryHelper(
-- pImplName, pServiceManager, pRegistryKey, globals::serviceDecl, document::serviceDecl, wrapformat::serviceDecl );
-+ pImplName, pServiceManager, pRegistryKey, globals::serviceDecl, document::serviceDecl, wrapformat::serviceDecl, vbaeventshelper::serviceDecl );
- OSL_TRACE("Ret is 0x%x", pRet);
- return pRet;
- }
-diff --git sw/source/ui/vba/vbaapplication.cxx sw/source/ui/vba/vbaapplication.cxx
-index fd815b2..4ce05bc 100644
---- sw/source/ui/vba/vbaapplication.cxx
-+++ sw/source/ui/vba/vbaapplication.cxx
-@@ -40,6 +40,7 @@
- #include <editeng/acorrcfg.hxx>
- #include "wordvbahelper.hxx"
- #include <docsh.hxx>
-+#include "vbalistgalleries.hxx"
-
- using namespace ::ooo;
- using namespace ::ooo::vba;
-@@ -151,6 +152,16 @@ SwVbaApplication::Dialogs( const uno::Any& index ) throw (uno::RuntimeException)
- return uno::makeAny( xCol );
- }
-
-+uno::Any SAL_CALL
-+SwVbaApplication::ListGalleries( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< text::XTextDocument > xTextDoc( getCurrentDocument(), uno::UNO_QUERY_THROW );
-+ uno::Reference< XCollection > xCol( new SwVbaListGalleries( this, mxContext, xTextDoc ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
- sal_Bool SAL_CALL SwVbaApplication::getDisplayAutoCompleteTips() throw (css::uno::RuntimeException)
- {
- return SvxAutoCorrCfg::Get()->IsAutoTextTip();
-diff --git sw/source/ui/vba/vbaapplication.hxx sw/source/ui/vba/vbaapplication.hxx
-index 66f9bca..2f4d912 100644
---- sw/source/ui/vba/vbaapplication.hxx
-+++ sw/source/ui/vba/vbaapplication.hxx
-@@ -60,6 +60,7 @@ public:
- virtual css::uno::Any SAL_CALL Documents( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Addins( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Dialogs( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL ListGalleries( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getDisplayAutoCompleteTips() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setDisplayAutoCompleteTips( sal_Bool _displayAutoCompleteTips ) throw (css::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getEnableCancelKey() throw (css::uno::RuntimeException);
-diff --git sw/source/ui/vba/vbaautotextentry.cxx sw/source/ui/vba/vbaautotextentry.cxx
-index 5d098a2..8c92627 100644
---- sw/source/ui/vba/vbaautotextentry.cxx
-+++ sw/source/ui/vba/vbaautotextentry.cxx
-@@ -26,7 +26,9 @@
- ************************************************************************/
- #include "vbaautotextentry.hxx"
- #include <vbahelper/vbahelper.hxx>
-+#include <com/sun/star/text/XParagraphCursor.hpp>
- #include <tools/diagnose_ex.h>
-+#include "wordvbahelper.hxx"
- #include "vbarange.hxx"
-
- using namespace ::ooo::vba;
-@@ -41,7 +43,7 @@ SwVbaAutoTextEntry::~SwVbaAutoTextEntry()
- {
- }
-
--uno::Reference< word::XRange > SAL_CALL SwVbaAutoTextEntry::Insert( const uno::Reference< word::XRange >& _where, const uno::Any& /*_richtext*/ ) throw ( uno::RuntimeException )
-+uno::Reference< word::XRange > SAL_CALL SwVbaAutoTextEntry::Insert( const uno::Reference< word::XRange >& _where, const uno::Any& _richtext ) throw ( uno::RuntimeException )
- {
- SwVbaRange* pWhere = dynamic_cast<SwVbaRange*>( _where.get() );
- if( pWhere )
-@@ -55,8 +57,28 @@ uno::Reference< word::XRange > SAL_CALL SwVbaAutoTextEntry::Insert( const uno::R
- uno::Reference< text::XTextCursor > xTC = xText->createTextCursorByRange( xTextRange->getStart() );
- xTC->goRight( 1, sal_True );
- xTC->setString( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("") ) ); // remove marker
-+ // remove the blank paragraph if it is a rich text
-+ sal_Bool bRich = sal_False;
-+ _richtext >>= bRich;
-+ if( bRich )
-+ {
-+ // check if it is a blank paragraph
-+ uno::Reference< text::XParagraphCursor > xParaCursor( xTC, uno::UNO_QUERY_THROW );
-+ if( xParaCursor->isStartOfParagraph() && xParaCursor->isEndOfParagraph() )
-+ {
-+ //remove the blank paragraph
-+ uno::Reference< frame::XModel > xModel( getCurrentWordDoc( mxContext ), uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextViewCursor > xTVCursor = word::getXTextViewCursor( xModel );
-+ uno::Reference< text::XTextRange > xCurrentRange( xTC->getEnd(), uno::UNO_QUERY_THROW );
-+ xTVCursor->gotoRange( xCurrentRange, sal_False );
-+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Delete"));
-+ dispatchRequests( xModel,url );
-+ xTVCursor->gotoRange( xEndMarker->getEnd(), sal_False );
-+ }
-+ }
- xEndMarker->setString( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("") ) ); // remove marker
-- xTC->gotoRange( xEndMarker, sal_True );
-+ //xTC->gotoRange( xEndMarker, sal_True );
-+ xTC = xText->createTextCursorByRange( xEndMarker->getEnd() );
- pWhere->setXTextCursor( xTC );
- }
- return uno::Reference< word::XRange >( pWhere );
-@@ -95,8 +117,9 @@ SwVbaAutoTextEntries::getElementType() throw (uno::RuntimeException)
- uno::Reference< container::XEnumeration >
- SwVbaAutoTextEntries::createEnumeration() throw (uno::RuntimeException)
- {
-- uno::Reference< container::XEnumerationAccess > xEnumerationAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
-- return xEnumerationAccess->createEnumeration();
-+ //uno::Reference< container::XEnumerationAccess > xEnumerationAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
-+ //return xEnumerationAccess->createEnumeration();
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
- }
-
- uno::Any
-diff --git sw/source/ui/vba/vbabookmark.cxx sw/source/ui/vba/vbabookmark.cxx
-index bb67fac..f5ff0fe 100644
---- sw/source/ui/vba/vbabookmark.cxx
-+++ sw/source/ui/vba/vbabookmark.cxx
-@@ -29,9 +29,12 @@
- #include <tools/diagnose_ex.h>
- #include <com/sun/star/text/XTextDocument.hpp>
- #include <com/sun/star/text/XTextContent.hpp>
-+#include <com/sun/star/text/XTextRange.hpp>
- #include <com/sun/star/text/XTextViewCursor.hpp>
- #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
-+#include <com/sun/star/view/XSelectionSupplier.hpp>
- #include "vbarange.hxx"
-+#include "wordvbahelper.hxx"
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-@@ -65,8 +68,8 @@ void SAL_CALL SwVbaBookmark::Delete() throw ( uno::RuntimeException )
- void SAL_CALL SwVbaBookmark::Select() throw ( uno::RuntimeException )
- {
- checkVality();
-- uno::Reference< text::XTextViewCursorSupplier > xViewCursorSupplier( mxModel->getCurrentController(), uno::UNO_QUERY_THROW );
-- xViewCursorSupplier->getViewCursor()->gotoRange( mxBookmark->getAnchor(),sal_False );
-+ uno::Reference< view::XSelectionSupplier > xSelectSupp( mxModel->getCurrentController(), uno::UNO_QUERY_THROW );
-+ xSelectSupp->select( uno::makeAny( mxBookmark ) );
- }
-
- rtl::OUString SAL_CALL SwVbaBookmark::getName() throw ( uno::RuntimeException )
-diff --git sw/source/ui/vba/vbabookmarks.cxx sw/source/ui/vba/vbabookmarks.cxx
-index 17d1741..c82028f 100644
---- sw/source/ui/vba/vbabookmarks.cxx
-+++ sw/source/ui/vba/vbabookmarks.cxx
-@@ -41,15 +41,14 @@ using namespace ::com::sun::star;
- class BookmarksEnumeration : public EnumerationHelperImpl
- {
- uno::Reference< frame::XModel > mxModel;
-- uno::WeakReference< XHelperInterface > mxParent;
- public:
-- BookmarksEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration, const uno::Reference< frame::XModel >& xModel ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xContext, xEnumeration ), mxModel( xModel ), mxParent( xParent ) {}
-+ BookmarksEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration, const uno::Reference< frame::XModel >& xModel ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xParent, xContext, xEnumeration ), mxModel( xModel ) {}
-
- virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
- {
- uno::Reference< container::XNamed > xNamed( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
- rtl::OUString aName = xNamed->getName();
-- return uno::makeAny( uno::Reference< word::XBookmark > ( new SwVbaBookmark( mxParent, m_xContext, mxModel, aName ) ) );
-+ return uno::makeAny( uno::Reference< word::XBookmark > ( new SwVbaBookmark( m_xParent, m_xContext, mxModel, aName ) ) );
- }
-
- };
-@@ -120,7 +119,7 @@ SwVbaBookmarks::SwVbaBookmarks( const uno::Reference< XHelperInterface >& xParen
- uno::Reference< text::XTextDocument > xDocument( mxModel, uno::UNO_QUERY_THROW );
- // use view cursor to insert bookmark, or it will fail if insert bookmark in table
- // mxText = xDocument->getText();
-- mxText = word::getXTextViewCursor( mxModel )->getText();
-+ //mxText = word::getXTextViewCursor( mxModel )->getText();
- }
- // XEnumerationAccess
- uno::Type
-@@ -146,16 +145,16 @@ SwVbaBookmarks::createCollectionObject( const css::uno::Any& aSource )
- void SwVbaBookmarks::removeBookmarkByName( const rtl::OUString& rName ) throw (uno::RuntimeException)
- {
- uno::Reference< text::XTextContent > xBookmark( m_xNameAccess->getByName( rName ), uno::UNO_QUERY_THROW );
-- mxText->removeTextContent( xBookmark );
-+ word::getXTextViewCursor( mxModel )->getText()->removeTextContent( xBookmark );
- }
-
--void SwVbaBookmarks::addBookmarkByName( const rtl::OUString& rName, const uno::Reference< text::XTextRange >& rTextRange ) throw (uno::RuntimeException)
-+void SwVbaBookmarks::addBookmarkByName( const uno::Reference< frame::XModel >& xModel, const rtl::OUString& rName, const uno::Reference< text::XTextRange >& rTextRange ) throw (uno::RuntimeException)
- {
-- uno::Reference< lang::XMultiServiceFactory > xDocMSF( mxModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< lang::XMultiServiceFactory > xDocMSF( xModel, uno::UNO_QUERY_THROW );
- uno::Reference< text::XTextContent > xBookmark( xDocMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.Bookmark")) ), uno::UNO_QUERY_THROW );
- uno::Reference< container::XNamed > xNamed( xBookmark, uno::UNO_QUERY_THROW );
- xNamed->setName( rName );
-- mxText->insertTextContent( rTextRange, xBookmark, sal_False );
-+ rTextRange->getText()->insertTextContent( rTextRange, xBookmark, sal_False );
- }
-
- uno::Any SAL_CALL
-@@ -181,7 +180,7 @@ SwVbaBookmarks::Add( const rtl::OUString& rName, const uno::Any& rRange ) throw
- if( m_xNameAccess->hasByName( aName ) )
- removeBookmarkByName( aName );
-
-- addBookmarkByName( aName, xTextRange );
-+ addBookmarkByName( mxModel, aName, xTextRange );
-
- return uno::makeAny( uno::Reference< word::XBookmark >( new SwVbaBookmark( getParent(), mxContext, mxModel, aName ) ) );
- }
-diff --git sw/source/ui/vba/vbabookmarks.hxx sw/source/ui/vba/vbabookmarks.hxx
-index 5efef7a..29e26b9 100644
---- sw/source/ui/vba/vbabookmarks.hxx
-+++ sw/source/ui/vba/vbabookmarks.hxx
-@@ -47,12 +47,12 @@ private:
-
- private:
- void removeBookmarkByName( const rtl::OUString& rName ) throw (css::uno::RuntimeException);
-- void addBookmarkByName( const rtl::OUString& rName, const css::uno::Reference< css::text::XTextRange >& rTextRange ) throw (css::uno::RuntimeException);
-
- public:
- SwVbaBookmarks( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::container::XIndexAccess >& xBookmarks, const css::uno::Reference< css::frame::XModel >& xModel );
- virtual ~SwVbaBookmarks() {}
-
-+ static void addBookmarkByName( const css::uno::Reference< css::frame::XModel >& xModel, const rtl::OUString& rName, const css::uno::Reference< css::text::XTextRange >& rTextRange ) 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);
-diff --git sw/source/ui/vba/vbaborders.cxx sw/source/ui/vba/vbaborders.cxx
-index 634ab63..1cd2b0d 100644
---- sw/source/ui/vba/vbaborders.cxx
-+++ sw/source/ui/vba/vbaborders.cxx
-@@ -348,14 +348,19 @@ SwVbaBorders::getItemByIntIndex( const sal_Int32 nIndex ) throw (uno::RuntimeEx
-
- sal_Bool SAL_CALL SwVbaBorders::getShadow() throw (uno::RuntimeException)
- {
-+ /*
- table::ShadowFormat aShadowFormat;
- m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ShadowFormat") ) ) >>= aShadowFormat;
- return ( aShadowFormat.Location != table::ShadowLocation_NONE );
-+ */
-+ // always return False for table border in MS Word
-+ return sal_False;
- }
-
- void SAL_CALL SwVbaBorders::setShadow( sal_Bool /*_shadow*/ ) throw (uno::RuntimeException)
- {
-- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ // not support in Table border in Word
-+ // TODO:
- }
-
- rtl::OUString&
-diff --git sw/source/ui/vba/vbacell.cxx sw/source/ui/vba/vbacell.cxx
-new file mode 100644
-index 0000000..8b05bf7
---- /dev/null
-+++ sw/source/ui/vba/vbacell.cxx
-@@ -0,0 +1,120 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbacell.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include "vbatable.hxx"
-+#include <com/sun/star/table/XCellRange.hpp>
-+#include <com/sun/star/view/XSelectionSupplier.hpp>
-+#include <rtl/ustrbuf.hxx>
-+#include "wordvbahelper.hxx"
-+#include "vbatablehelper.hxx"
-+#include "vbarow.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaCell::SwVbaCell( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextTable >& xTextTable, sal_Int32 nColumn, sal_Int32 nRow ) throw ( uno::RuntimeException ) :
-+ SwVbaCell_BASE( rParent, rContext ), mxTextTable( xTextTable ), mnColumn( nColumn ), mnRow( nRow )
-+{
-+}
-+
-+SwVbaCell::~SwVbaCell()
-+{
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaCell::getWidth() throw (css::uno::RuntimeException)
-+{
-+ SwVbaTableHelper aTableHelper( mxTextTable );
-+ return aTableHelper.GetColWidth( mnColumn, mnRow, sal_True );
-+}
-+
-+void SAL_CALL SwVbaCell::setWidth( ::sal_Int32 _width ) throw (css::uno::RuntimeException)
-+{
-+ SwVbaTableHelper aTableHelper( mxTextTable );
-+ aTableHelper.SetColWidth( _width, mnColumn, mnRow, sal_True );
-+}
-+
-+uno::Any SAL_CALL SwVbaCell::getHeight() throw (css::uno::RuntimeException)
-+{
-+ uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnRow ) );
-+ return xRow->getHeight();
-+}
-+
-+void SAL_CALL SwVbaCell::setHeight( const uno::Any& _height ) throw (css::uno::RuntimeException)
-+{
-+ uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnRow ) );
-+ xRow->setHeight( _height );
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaCell::getHeightRule() throw (css::uno::RuntimeException)
-+{
-+ uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnRow ) );
-+ return xRow->getHeightRule();
-+}
-+
-+void SAL_CALL SwVbaCell::setHeightRule( ::sal_Int32 _heightrule ) throw (css::uno::RuntimeException)
-+{
-+ uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnRow ) );
-+ xRow->setHeightRule( _heightrule );
-+}
-+
-+void SAL_CALL SwVbaCell::SetWidth( float width, sal_Int32 /*rulestyle*/ ) throw (css::uno::RuntimeException)
-+{
-+ // FIXME: handle the argument: rulestyle
-+ setWidth( width );
-+}
-+
-+void SAL_CALL SwVbaCell::SetHeight( float height, sal_Int32 heightrule ) throw (css::uno::RuntimeException)
-+{
-+ // FIXME: handle the argument: heightrule
-+ setHeightRule( heightrule );
-+ setHeight( uno::makeAny( height ) );
-+}
-+
-+rtl::OUString&
-+SwVbaCell::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaCell") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaCell::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Cell" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbacell.hxx sw/source/ui/vba/vbacell.hxx
-new file mode 100644
-index 0000000..1350288
---- /dev/null
-+++ sw/source/ui/vba/vbacell.hxx
-@@ -0,0 +1,67 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_CELL_HXX
-+#define SW_VBA_CELL_HXX
-+
-+#include <ooo/vba/word/XCell.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/text/XTextTable.hpp>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XCell > SwVbaCell_BASE;
-+
-+class SwVbaCell : public SwVbaCell_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XTextTable > mxTextTable;
-+ sal_Int32 mnColumn;
-+ sal_Int32 mnRow;
-+
-+public:
-+ SwVbaCell( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextTable >& xTextTable, sal_Int32 nColumn, sal_Int32 nRow ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaCell();
-+
-+ // Attributes
-+ 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 getHeight() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setHeight( const css::uno::Any& _height ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getHeightRule() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setHeightRule( ::sal_Int32 _heightrule ) throw (css::uno::RuntimeException);
-+
-+ // Methods
-+ virtual void SAL_CALL SetWidth( float width, sal_Int32 rulestyle ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL SetHeight( float height, sal_Int32 heightrule ) throw (css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_CELL_HXX */
-diff --git sw/source/ui/vba/vbacells.cxx sw/source/ui/vba/vbacells.cxx
-new file mode 100644
-index 0000000..919306b
---- /dev/null
-+++ sw/source/ui/vba/vbacells.cxx
-@@ -0,0 +1,223 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbacells.hxx"
-+#include "vbacell.hxx"
-+#include "wordvbahelper.hxx"
-+#include "vbatablehelper.hxx"
-+#include "vbarow.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+typedef ::cppu::WeakImplHelper2< container::XIndexAccess, container::XEnumerationAccess > CellCollectionHelper_Base;
-+
-+class CellsEnumWrapper : public EnumerationHelper_BASE
-+{
-+ uno::Reference< container::XIndexAccess > mxIndexAccess;
-+ sal_Int32 nIndex;
-+
-+public:
-+ CellsEnumWrapper( const uno::Reference< container::XIndexAccess >& xIndexAccess ) : mxIndexAccess( xIndexAccess ), nIndex( 0 )
-+ {
-+ }
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( nIndex < mxIndexAccess->getCount() );
-+ }
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if( nIndex < mxIndexAccess->getCount() )
-+ {
-+ return mxIndexAccess->getByIndex( nIndex++ );
-+ }
-+ throw container::NoSuchElementException();
-+ }
-+};
-+
-+class CellCollectionHelper : public CellCollectionHelper_Base
-+{
-+private:
-+ uno::Reference< XHelperInterface > mxParent;
-+ uno::Reference< uno::XComponentContext > mxContext;
-+ uno::Reference< css::text::XTextTable > mxTextTable;
-+ sal_Int32 mnLeft;
-+ sal_Int32 mnTop;
-+ sal_Int32 mnRight;
-+ sal_Int32 mnBottom;
-+
-+public:
-+ CellCollectionHelper( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::text::XTextTable >& xTextTable, sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom ) throw ( css::uno::RuntimeException ): mxParent( xParent ), mxContext( xContext ), mxTextTable( xTextTable ), mnLeft( nLeft ), mnTop( nTop ), mnRight( nRight ), mnBottom( nBottom )
-+ {
-+ }
-+ virtual ~CellCollectionHelper() {}
-+
-+ virtual sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
-+ {
-+ return ( mnRight - mnLeft + 1 ) * ( mnBottom - mnTop + 1 );
-+ }
-+ virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( Index < 0 || Index >= getCount() )
-+ throw css::lang::IndexOutOfBoundsException();
-+
-+ for( sal_Int32 row = mnTop; row <= mnBottom; row++ )
-+ {
-+ for( sal_Int32 col = mnLeft; col <= mnRight; col++ )
-+ {
-+ if( Index == ( ( row - mnTop ) * ( mnRight - mnLeft + 1 ) + ( col - mnLeft ) ) )
-+ return uno::makeAny( uno::Reference< word::XCell >( new SwVbaCell( mxParent, mxContext, mxTextTable, col, row ) ) );
-+ }
-+ }
-+ throw css::lang::IndexOutOfBoundsException();
-+
-+ }
-+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
-+ {
-+ return word::XCell::static_type(0);
-+ }
-+ virtual sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
-+ {
-+ return sal_True;
-+ }
-+ // XEnumerationAccess
-+ virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
-+ {
-+ return new CellsEnumWrapper( this );
-+ }
-+};
-+
-+SwVbaCells::SwVbaCells( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextTable >& xTextTable, sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom ) throw (uno::RuntimeException) : SwVbaCells_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new CellCollectionHelper( xParent, xContext, xTextTable, nLeft, nTop, nRight, nBottom ) ) ), mxTextTable( xTextTable ), mnLeft( nLeft ), mnTop( nTop ), mnRight( nRight ), mnBottom( nBottom )
-+{
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaCells::getWidth() throw (css::uno::RuntimeException)
-+{
-+ uno::Reference< word::XCell > xCell( m_xIndexAccess->getByIndex( 0 ), uno::UNO_QUERY_THROW );
-+ return xCell->getWidth();
-+}
-+
-+void SAL_CALL SwVbaCells::setWidth( ::sal_Int32 _width ) throw (css::uno::RuntimeException)
-+{
-+ sal_Int32 nIndex = 0;
-+ while( nIndex < m_xIndexAccess->getCount() )
-+ {
-+ uno::Reference< word::XCell > xCell( m_xIndexAccess->getByIndex( nIndex++ ), uno::UNO_QUERY_THROW );
-+ xCell->setWidth( _width );
-+ }
-+}
-+
-+uno::Any SAL_CALL SwVbaCells::getHeight() throw (css::uno::RuntimeException)
-+{
-+ uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnTop ) );
-+ return xRow->getHeight();
-+}
-+
-+void SAL_CALL SwVbaCells::setHeight( const uno::Any& _height ) throw (css::uno::RuntimeException)
-+{
-+ for( sal_Int32 row = mnTop; row <= mnBottom; row++ )
-+ {
-+ uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, row ) );
-+ xRow->setHeight( _height );
-+ }
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaCells::getHeightRule() throw (css::uno::RuntimeException)
-+{
-+ uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnTop ) );
-+ return xRow->getHeightRule();
-+}
-+
-+void SAL_CALL SwVbaCells::setHeightRule( ::sal_Int32 _heightrule ) throw (css::uno::RuntimeException)
-+{
-+ for( sal_Int32 row = mnTop; row <= mnBottom; row++ )
-+ {
-+ uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, row ) );
-+ xRow->setHeightRule( _heightrule );
-+ }
-+}
-+
-+void SAL_CALL SwVbaCells::SetWidth( float width, sal_Int32 rulestyle ) throw (css::uno::RuntimeException)
-+{
-+ sal_Int32 nIndex = 0;
-+ while( nIndex < m_xIndexAccess->getCount() )
-+ {
-+ uno::Reference< word::XCell > xCell( m_xIndexAccess->getByIndex( nIndex++ ), uno::UNO_QUERY_THROW );
-+ xCell->SetWidth( width, rulestyle );
-+ }
-+}
-+
-+void SAL_CALL SwVbaCells::SetHeight( float height, sal_Int32 heightrule ) throw (css::uno::RuntimeException)
-+{
-+ for( sal_Int32 row = mnTop; row <= mnBottom; row++ )
-+ {
-+ uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, row ) );
-+ xRow->SetHeight( height, heightrule );
-+ }
-+}
-+
-+// XEnumerationAccess
-+uno::Type
-+SwVbaCells::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XCell::static_type(0);
-+}
-+
-+uno::Reference< container::XEnumeration >
-+SwVbaCells::createEnumeration() throw (uno::RuntimeException)
-+{
-+ uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
-+ return xEnumAccess->createEnumeration();
-+}
-+
-+uno::Any
-+SwVbaCells::createCollectionObject( const uno::Any& aSource )
-+{
-+ return aSource;
-+}
-+
-+rtl::OUString&
-+SwVbaCells::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaCells") );
-+ return sImplName;
-+}
-+
-+uno::Sequence<rtl::OUString>
-+SwVbaCells::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Cells") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbacells.hxx sw/source/ui/vba/vbacells.hxx
-new file mode 100644
-index 0000000..3468b29
---- /dev/null
-+++ sw/source/ui/vba/vbacells.hxx
-@@ -0,0 +1,75 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_CELLS_HXX
-+#define SW_VBA_CELLS_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XCells.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/text/XTextTable.hpp>
-+
-+typedef CollTestImplHelper< ooo::vba::word::XCells > SwVbaCells_BASE;
-+
-+class SwVbaCells : public SwVbaCells_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XTextTable > mxTextTable;
-+ sal_Int32 mnLeft;
-+ sal_Int32 mnTop;
-+ sal_Int32 mnRight;
-+ sal_Int32 mnBottom;
-+
-+public:
-+ SwVbaCells( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::text::XTextTable >& xTextTable, sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaCells() {}
-+
-+ // Attributes
-+ 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 getHeight() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setHeight( const css::uno::Any& _height ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getHeightRule() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setHeightRule( ::sal_Int32 _heightrule ) throw (css::uno::RuntimeException);
-+
-+ // Methods
-+ virtual void SAL_CALL SetWidth( float width, sal_Int32 rulestyle ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL SetHeight( float height, sal_Int32 heightrule ) 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);
-+
-+ // SwVbaCells_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* SW_VBA_CELLS_HXX */
-diff --git sw/source/ui/vba/vbacheckbox.cxx sw/source/ui/vba/vbacheckbox.cxx
-new file mode 100644
-index 0000000..307f7a2
---- /dev/null
-+++ sw/source/ui/vba/vbacheckbox.cxx
-@@ -0,0 +1,98 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbacheckbox.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include <com/sun/star/text/XTextContent.hpp>
-+#include <com/sun/star/text/XTextViewCursor.hpp>
-+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
-+#include <ecmaflds.hxx>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaCheckBox::SwVbaCheckBox( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< frame::XModel >& rModel, const uno::Reference< text::XFormField >& xFormField ) throw ( uno::RuntimeException ) : SwVbaCheckBox_BASE( rParent, rContext ), mxModel( rModel ), mxFormField( xFormField )
-+{
-+ rtl::OUString sType = mxFormField->getFieldType();
-+ if( !sType.equalsIgnoreAsciiCaseAscii( ECMA_FORMCHECKBOX ) )
-+ {
-+ throw uno::RuntimeException( rtl::OUString(
-+ RTL_CONSTASCII_USTRINGPARAM("It is not a CheckBox")), uno::Reference< uno::XInterface >() );
-+ }
-+}
-+
-+SwVbaCheckBox::~SwVbaCheckBox()
-+{
-+}
-+
-+sal_Bool SAL_CALL SwVbaCheckBox::getValue() throw ( uno::RuntimeException )
-+{
-+ sal_Bool bValue = sal_False;
-+ sal_Int32 nCount = mxFormField->getParamCount();
-+ for( sal_Int32 i = 0; i < nCount; i++ )
-+ {
-+ if( mxFormField->getParamName(i).equalsIgnoreAsciiCaseAscii( ECMA_FORMCHECKBOX_CHECKED ) )
-+ {
-+ if( mxFormField->getParamValue(i).equalsIgnoreAsciiCaseAscii("on") )
-+ bValue = sal_True;
-+ else
-+ bValue = sal_False;
-+ break;
-+ }
-+ }
-+ return bValue;
-+}
-+
-+void SAL_CALL SwVbaCheckBox::setValue( sal_Bool value ) throw ( uno::RuntimeException )
-+{
-+ rtl::OUString sValue = rtl::OUString::createFromAscii( value ? "on" : "off" );
-+ mxFormField->addParam( rtl::OUString::createFromAscii( ECMA_FORMCHECKBOX_CHECKED ), sValue, sal_True );
-+}
-+
-+rtl::OUString&
-+SwVbaCheckBox::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaCheckBox") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaCheckBox::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.CheckBox" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbacheckbox.hxx sw/source/ui/vba/vbacheckbox.hxx
-new file mode 100644
-index 0000000..7b12ed5
---- /dev/null
-+++ sw/source/ui/vba/vbacheckbox.hxx
-@@ -0,0 +1,58 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_CHECKBOX_HXX
-+#define SW_VBA_CHECKBOX_HXX
-+
-+#include <ooo/vba/word/XCheckBox.hpp>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/text/XFormField.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XCheckBox > SwVbaCheckBox_BASE;
-+
-+class SwVbaCheckBox : public SwVbaCheckBox_BASE
-+{
-+private:
-+ css::uno::Reference< css::frame::XModel > mxModel;
-+ css::uno::Reference< css::text::XFormField > mxFormField;
-+
-+public:
-+ SwVbaCheckBox( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& rModel, const css::uno::Reference< css::text::XFormField >& xFormField ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaCheckBox();
-+
-+ // Methods
-+ sal_Bool SAL_CALL getValue() throw ( css::uno::RuntimeException );
-+ void SAL_CALL setValue( sal_Bool value ) throw ( css::uno::RuntimeException );
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_CHECKBOX_HXX */
-diff --git sw/source/ui/vba/vbacolumn.cxx sw/source/ui/vba/vbacolumn.cxx
-new file mode 100644
-index 0000000..3dd4eb1
---- /dev/null
-+++ sw/source/ui/vba/vbacolumn.cxx
-@@ -0,0 +1,201 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbacolumn.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include "vbatable.hxx"
-+#include <com/sun/star/table/XCellRange.hpp>
-+#include <com/sun/star/view/XSelectionSupplier.hpp>
-+#include <rtl/ustrbuf.hxx>
-+#include "wordvbahelper.hxx"
-+#include "vbatablehelper.hxx"
-+
-+#define RELATIVE_TABLE_WIDTH 10000
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaColumn::SwVbaColumn( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextTable >& xTextTable, sal_Int32 nIndex ) throw ( uno::RuntimeException ) :
-+ SwVbaColumn_BASE( rParent, rContext ), mxTextTable( xTextTable ), mnIndex( nIndex )
-+{
-+ mxTableColumns = mxTextTable->getColumns();
-+}
-+
-+SwVbaColumn::~SwVbaColumn()
-+{
-+}
-+
-+void SwVbaColumn::calculateAbsoluteColumnWidth( sal_Int32 nTableWidth, const css::uno::Sequence< css::text::TableColumnSeparator >& aSeparators, double* pAbsWidth )
-+{
-+ const text::TableColumnSeparator* pArray = aSeparators.getConstArray();
-+ sal_Int32 nSepCount = aSeparators.getLength();
-+ for( sal_Int32 i = 0; i <= nSepCount; i++ )
-+ {
-+ sal_Int32 nRelColWidth = 0;
-+ if( i == 0 )
-+ {
-+ if( nSepCount != 0 )
-+ {
-+ nRelColWidth = pArray[0].Position;
-+ }
-+ else
-+ {
-+ nRelColWidth = RELATIVE_TABLE_WIDTH;
-+ }
-+ }
-+ else
-+ {
-+ if( i == nSepCount )
-+ {
-+ nRelColWidth = RELATIVE_TABLE_WIDTH - pArray[i-1].Position;
-+ }
-+ else
-+ {
-+ nRelColWidth = pArray[i].Position - pArray[i-1].Position;
-+ }
-+ }
-+ pAbsWidth[i] = ( (double)nRelColWidth / RELATIVE_TABLE_WIDTH ) * (double) nTableWidth;
-+ }
-+}
-+
-+void SwVbaColumn::calculateRelativeColumnWidth( const double* pAbsWidth, double* pRelWidth, sal_Int32 nCount )
-+{
-+ double tableWidth = 0.0;
-+ for( sal_Int32 i = 0; i < nCount; i++ )
-+ {
-+ tableWidth += pAbsWidth[i];
-+ }
-+
-+ pRelWidth[ nCount - 1 ] = tableWidth;
-+ for( sal_Int32 i = 0; i < nCount - 1; i++ )
-+ {
-+ if( i == 0 )
-+ {
-+ pRelWidth[i] = ( pAbsWidth[i] * RELATIVE_TABLE_WIDTH ) / tableWidth;
-+ }
-+ else
-+ {
-+ pRelWidth[i] = pRelWidth[i-1] + ( pAbsWidth[i] * RELATIVE_TABLE_WIDTH ) / tableWidth;
-+ }
-+ }
-+}
-+
-+sal_Int32 SAL_CALL
-+SwVbaColumn::getWidth( ) throw ( css::uno::RuntimeException )
-+{
-+ /* uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, uno::UNO_QUERY_THROW );
-+ uno::Sequence< text::TableColumnSeparator > aSeparators;
-+ xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TableColumnSeparators") ) ) >>= aSeparators;
-+ sal_Int32 nTableWidth = SwVbaTable::getTableWidth( xTableProps );
-+ sal_Int32 nColCont = aSeparators.getLength() + 1;
-+ double dAbsColWidth[ nColCont ];
-+ calculateAbsoluteColumnWidth( nTableWidth, aSeparators, dAbsColWidth );
-+ return Millimeter::getInPoints( (sal_Int32)( dAbsColWidth[ mnIndex ] ) );
-+ */
-+ SwVbaTableHelper aTableHelper( mxTextTable );
-+ return aTableHelper.GetColWidth( mnIndex );
-+}
-+
-+void SAL_CALL
-+SwVbaColumn::setWidth( sal_Int32 _width ) throw ( css::uno::RuntimeException )
-+{
-+/* uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, uno::UNO_QUERY_THROW );
-+ uno::Sequence< text::TableColumnSeparator > aSeparators;
-+ xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TableColumnSeparators") ) ) >>= aSeparators;
-+ sal_Int32 nTableWidth = SwVbaTable::getTableWidth( xTableProps );
-+ sal_Int32 nColCont = aSeparators.getLength() + 1;
-+ double dAbsColWidth[ nColCont ];
-+ calculateAbsoluteColumnWidth( nTableWidth, aSeparators, dAbsColWidth );
-+ dAbsColWidth[ mnIndex ] = Millimeter::getInHundredthsOfOneMillimeter( _width );
-+ double tableWidth = 0.0;
-+ for( sal_Int32 i = 0; i < nColCont; i++ )
-+ {
-+ tableWidth += dAbsColWidth[i];
-+ }
-+
-+ double dRelColWidth[ nColCont ];
-+ calculateRelativeColumnWidth( dAbsColWidth, dRelColWidth, nColCont);
-+
-+ text::TableColumnSeparator* pArray = aSeparators.getArray();
-+ for( sal_Int32 i = 0; i < nColCont - 1; i++ )
-+ {
-+ pArray[i].Position = (sal_Int16)(dRelColWidth[i]);
-+ }
-+
-+ xTableProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TableColumnSeparators") ), uno::makeAny( aSeparators ) );
-+ SwVbaTable::setTableWidth( xTableProps, (sal_Int32)( tableWidth ) );
-+ */
-+
-+ SwVbaTableHelper aTableHelper( mxTextTable );
-+ aTableHelper.SetColWidth( _width, mnIndex );
-+}
-+
-+void SAL_CALL
-+SwVbaColumn::Select( ) throw ( uno::RuntimeException )
-+{
-+ SelectColumn( getCurrentWordDoc(mxContext), mxTextTable, mnIndex, mnIndex );
-+}
-+
-+void SwVbaColumn::SelectColumn( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XTextTable >& xTextTable, sal_Int32 nStartColumn, sal_Int32 nEndColumn ) throw ( uno::RuntimeException )
-+{
-+ rtl::OUStringBuffer aRangeName;
-+ rtl::OUString sStartCol = SwVbaTableHelper::getColumnStr( nStartColumn );
-+ aRangeName.append(sStartCol).append(sal_Int32( 1 ) );
-+ rtl::OUString sEndCol = SwVbaTableHelper::getColumnStr( nEndColumn );
-+ sal_Int32 nRowCount = xTextTable->getRows()->getCount();
-+ aRangeName.appendAscii(":").append( sEndCol ).append( sal_Int32( nRowCount ) );
-+
-+ uno::Reference< table::XCellRange > xCellRange( xTextTable, uno::UNO_QUERY_THROW );
-+ rtl::OUString sSelRange = aRangeName.makeStringAndClear();
-+ uno::Reference< table::XCellRange > xSelRange = xCellRange->getCellRangeByName( sSelRange );
-+
-+ uno::Reference< view::XSelectionSupplier > xSelection( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
-+ xSelection->select( uno::makeAny( xSelRange ) );
-+}
-+
-+rtl::OUString&
-+SwVbaColumn::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaColumn") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaColumn::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Column" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbacolumn.hxx sw/source/ui/vba/vbacolumn.hxx
-new file mode 100644
-index 0000000..6d67bdd
---- /dev/null
-+++ sw/source/ui/vba/vbacolumn.hxx
-@@ -0,0 +1,68 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_COLUMN_HXX
-+#define SW_VBA_COLUMN_HXX
-+
-+#include <ooo/vba/word/XColumn.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/table/XTableColumns.hpp>
-+#include <com/sun/star/text/XTextTable.hpp>
-+#include <com/sun/star/text/TableColumnSeparator.hpp>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XColumn > SwVbaColumn_BASE;
-+
-+class SwVbaColumn : public SwVbaColumn_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XTextTable > mxTextTable;
-+ css::uno::Reference< css::table::XTableColumns > mxTableColumns;
-+ sal_Int32 mnIndex;
-+
-+private:
-+ void calculateAbsoluteColumnWidth( sal_Int32 nTableWidth, const css::uno::Sequence< css::text::TableColumnSeparator >& aSeparators, double* pAbsWidth );
-+ void calculateRelativeColumnWidth( const double* pAbsWidth, double* pRelWidth, sal_Int32 nCount );
-+
-+public:
-+ SwVbaColumn( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextTable >& xTextTable, sal_Int32 nIndex ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaColumn();
-+
-+ // Methods
-+ virtual sal_Int32 SAL_CALL getWidth() throw ( css::uno::RuntimeException );
-+ virtual void SAL_CALL setWidth( sal_Int32 _width ) throw ( css::uno::RuntimeException );
-+ virtual void SAL_CALL Select( ) throw (css::uno::RuntimeException);
-+
-+ static void SelectColumn( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XTextTable >& xTextTable, sal_Int32 nStartColumn, sal_Int32 nEndColumn ) throw (css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_COLUMN_HXX */
-diff --git sw/source/ui/vba/vbacolumns.cxx sw/source/ui/vba/vbacolumns.cxx
-new file mode 100644
-index 0000000..90cd7fb
---- /dev/null
-+++ sw/source/ui/vba/vbacolumns.cxx
-@@ -0,0 +1,160 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbacolumns.hxx"
-+#include "vbacolumn.hxx"
-+#include <com/sun/star/text/HoriOrientation.hpp>
-+#include <com/sun/star/table/XCellRange.hpp>
-+#include <ooo/vba/word/WdConstants.hpp>
-+#include <ooo/vba/word/WdRulerStyle.hpp>
-+#include "wordvbahelper.hxx"
-+#include "vbatablehelper.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+class ColumnsEnumWrapper : public EnumerationHelper_BASE
-+{
-+ uno::WeakReference< XHelperInterface > mxParent;
-+ uno::Reference< uno::XComponentContext > mxContext;
-+ uno::Reference< text::XTextTable > mxTextTable;
-+ uno::Reference< container::XIndexAccess > mxIndexAccess;
-+ sal_Int32 nIndex;
-+
-+public:
-+ ColumnsEnumWrapper( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< text::XTextTable >& xTextTable ) : mxParent( xParent ), mxContext( xContext ), mxTextTable( xTextTable ), nIndex( 0 )
-+ {
-+ mxIndexAccess.set( mxTextTable->getColumns(), uno::UNO_QUERY );
-+ }
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( nIndex < mxIndexAccess->getCount() );
-+ }
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if( nIndex < mxIndexAccess->getCount() )
-+ {
-+ return uno::makeAny( uno::Reference< word::XColumn > ( new SwVbaColumn( mxParent, mxContext, mxTextTable, nIndex++ ) ) );
-+ }
-+ throw container::NoSuchElementException();
-+ }
-+};
-+
-+SwVbaColumns::SwVbaColumns( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextTable >& xTextTable, const uno::Reference< table::XTableColumns >& xTableColumns ) throw (uno::RuntimeException) : SwVbaColumns_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( xTableColumns, uno::UNO_QUERY_THROW ) ), mxTextTable( xTextTable ), mxTableColumns( xTableColumns )
-+{
-+ mnStartColumnIndex = 0;
-+ SwVbaTableHelper aTableHelper( mxTextTable );
-+ mnEndColumnIndex = aTableHelper.getTabColumnsMaxCount( ) - 1;
-+}
-+
-+SwVbaColumns::SwVbaColumns( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextTable >& xTextTable, const uno::Reference< table::XTableColumns >& xTableColumns, sal_Int32 nStartCol, sal_Int32 nEndCol ) throw (uno::RuntimeException) : SwVbaColumns_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( xTableColumns, uno::UNO_QUERY_THROW ) ), mxTextTable( xTextTable ), mxTableColumns( xTableColumns ), mnStartColumnIndex( nStartCol ), mnEndColumnIndex( nEndCol )
-+{
-+ if( mnEndColumnIndex < mnStartColumnIndex )
-+ throw uno::RuntimeException();
-+}
-+
-+uno::Reference< word::XColumn > SwVbaColumns::getColumnAtIndex( sal_Int32 index ) throw (uno::RuntimeException)
-+{
-+ return uno::Reference< word::XColumn >( new SwVbaColumn( this, mxContext, mxTextTable, index ) );
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaColumns::getWidth() throw (uno::RuntimeException)
-+{
-+ return getColumnAtIndex( mnStartColumnIndex )->getWidth();
-+}
-+
-+void SAL_CALL SwVbaColumns::setWidth( ::sal_Int32 _width ) throw (uno::RuntimeException)
-+{
-+ for( sal_Int32 index = mnStartColumnIndex; index <= mnEndColumnIndex; index++ )
-+ {
-+ getColumnAtIndex( index )->setWidth( _width );
-+ }
-+}
-+
-+void SAL_CALL SwVbaColumns::Select( ) throw (uno::RuntimeException)
-+{
-+ SwVbaColumn::SelectColumn( getCurrentWordDoc(mxContext), mxTextTable, mnStartColumnIndex, mnEndColumnIndex );
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaColumns::getCount() throw (uno::RuntimeException)
-+{
-+ return ( mnEndColumnIndex - mnStartColumnIndex + 1 );
-+}
-+
-+uno::Any SAL_CALL SwVbaColumns::Item( const uno::Any& Index1, const uno::Any& /*not processed in this base class*/ ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nIndex = 0;
-+ if( ( Index1 >>= nIndex ) == sal_True )
-+ {
-+ if( nIndex <= 0 || nIndex > getCount() )
-+ {
-+ throw lang::IndexOutOfBoundsException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Index out of bounds") ), uno::Reference< uno::XInterface >() );
-+ }
-+ return uno::makeAny( uno::Reference< word::XColumn >( new SwVbaColumn( this, mxContext, mxTextTable, nIndex - 1 ) ) );
-+ }
-+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Index out of bounds") ), uno::Reference< uno::XInterface >() );
-+}
-+
-+// XEnumerationAccess
-+uno::Type
-+SwVbaColumns::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XColumn::static_type(0);
-+}
-+uno::Reference< container::XEnumeration >
-+SwVbaColumns::createEnumeration() throw (uno::RuntimeException)
-+{
-+ return new ColumnsEnumWrapper( this, mxContext, mxTextTable );
-+}
-+
-+uno::Any
-+SwVbaColumns::createCollectionObject( const uno::Any& aSource )
-+{
-+ return aSource;
-+}
-+
-+rtl::OUString&
-+SwVbaColumns::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaColumns") );
-+ return sImplName;
-+}
-+
-+uno::Sequence<rtl::OUString>
-+SwVbaColumns::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Columns") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbacolumns.hxx sw/source/ui/vba/vbacolumns.hxx
-new file mode 100644
-index 0000000..3fd2b4a
---- /dev/null
-+++ sw/source/ui/vba/vbacolumns.hxx
-@@ -0,0 +1,75 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_COLUMNS_HXX
-+#define SW_VBA_COLUMNS_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XColumns.hpp>
-+#include <ooo/vba/word/XColumn.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/table/XTableColumns.hpp>
-+#include <com/sun/star/text/XTextTable.hpp>
-+
-+typedef CollTestImplHelper< ooo::vba::word::XColumns > SwVbaColumns_BASE;
-+
-+class SwVbaColumns : public SwVbaColumns_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XTextTable > mxTextTable;
-+ css::uno::Reference< css::table::XTableColumns > mxTableColumns;
-+ sal_Int32 mnStartColumnIndex;
-+ sal_Int32 mnEndColumnIndex;
-+
-+private:
-+ css::uno::Reference< ooo::vba::word::XColumn > getColumnAtIndex( sal_Int32 index ) throw (css::uno::RuntimeException);
-+
-+public:
-+ SwVbaColumns( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::text::XTextTable >& xTextTable, const css::uno::Reference< css::table::XTableColumns >& xTableColumns ) throw ( css::uno::RuntimeException );
-+ SwVbaColumns( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::text::XTextTable >& xTextTable, const css::uno::Reference< css::table::XTableColumns >& xTableColumns, sal_Int32 nStartCol, sal_Int32 nEndCol ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaColumns() {}
-+
-+ virtual sal_Int32 SAL_CALL getWidth( ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setWidth( sal_Int32 _width ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL Select( ) throw (css::uno::RuntimeException);
-+
-+ //XCollection
-+ virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException);
-+ 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 );
-+ // 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);
-+
-+ // SwVbaColumns_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* SW_VBA_COLUMNS_HXX */
-diff --git sw/source/ui/vba/vbadocument.cxx sw/source/ui/vba/vbadocument.cxx
-index 98692d5..2de324b 100644
---- sw/source/ui/vba/vbadocument.cxx
-+++ sw/source/ui/vba/vbadocument.cxx
-@@ -38,7 +38,9 @@
- #include <com/sun/star/drawing/XControlShape.hpp>
- #include <com/sun/star/drawing/XControlShape.hpp>
- #include <com/sun/star/form/XFormsSupplier.hpp>
-+#include <com/sun/star/document/XRedlinesSupplier.hpp>
- #include <ooo/vba/XControlProvider.hpp>
-+#include <ooo/vba/word/WdProtectionType.hpp>
-
- #include <vbahelper/helperdecl.hxx>
- #include <wordvbahelper.hxx>
-@@ -50,7 +52,13 @@
- #include "vbafield.hxx"
- #include "vbapagesetup.hxx"
- #include "vbasections.hxx"
-+#include "vbatablesofcontents.hxx"
- #include <vbahelper/vbashapes.hxx>
-+#include <vbahelper/vbahelper.hxx>
-+#include "vbarevisions.hxx"
-+#include "vbaframes.hxx"
-+#include "vbaformfields.hxx"
-+#include <osl/file.hxx>
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-@@ -220,6 +228,31 @@ SwVbaDocument::Sections( const uno::Any& index ) throw (uno::RuntimeException)
- }
-
- uno::Any SAL_CALL
-+SwVbaDocument::TablesOfContents( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< XCollection > xCol( new SwVbaTablesOfContents( this, mxContext, mxTextDocument ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+#ifdef FIELDPATCH
-+uno::Any SAL_CALL
-+SwVbaDocument::FormFields( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< XCollection > xCol( new SwVbaFormFields( this, mxContext, getModel() ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+#else
-+uno::Any SAL_CALL
-+SwVbaDocument::FormFields( const uno::Any& /*index*/ ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< XCollection > xCol;
-+#endif
-+ return uno::makeAny( xCol );
-+}
-+
-+uno::Any SAL_CALL
- SwVbaDocument::PageSetup( ) throw (uno::RuntimeException)
- {
- uno::Reference< beans::XPropertySet > xPageProps( word::getCurrentPageStyle( mxModel ), uno::UNO_QUERY_THROW );
-@@ -239,16 +272,34 @@ SwVbaDocument::getAttachedTemplate() throw (uno::RuntimeException)
- uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( getModel(), uno::UNO_QUERY_THROW );
- uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW );
- uno::Reference< document::XDocumentProperties > xDocProps( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW );
-- rtl::OUString sTemplateName = xDocProps->getTemplateName();
-+ rtl::OUString sTemplateUrl = xDocProps->getTemplateURL();
-
-- xTemplate = new SwVbaTemplate( this, mxContext, getModel(), sTemplateName );
-+ xTemplate = new SwVbaTemplate( this, mxContext, getModel(), sTemplateUrl );
- return uno::makeAny( xTemplate );
- }
-
- void SAL_CALL
--SwVbaDocument::setAttachedTemplate( const css::uno::Any& /*_attachedtemplate*/ ) throw (uno::RuntimeException)
-+SwVbaDocument::setAttachedTemplate( const css::uno::Any& _attachedtemplate ) throw (uno::RuntimeException)
- {
-- throw uno::RuntimeException();
-+ rtl::OUString sTemplate;
-+ if( !( _attachedtemplate >>= sTemplate ) )
-+ {
-+ throw uno::RuntimeException();
-+ }
-+ rtl::OUString aURL;
-+ INetURLObject aObj;
-+ aObj.SetURL( sTemplate );
-+ bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
-+ if ( bIsURL )
-+ aURL = sTemplate;
-+ else
-+ osl::FileBase::getFileURLFromSystemPath( sTemplate, aURL );
-+
-+ uno::Reference< word::XTemplate > xTemplate;
-+ uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( getModel(), uno::UNO_QUERY_THROW );
-+ uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW );
-+ uno::Reference< document::XDocumentProperties > xDocProps( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW );
-+ xDocProps->setTemplateURL( aURL );
- }
-
- uno::Any SAL_CALL
-@@ -267,6 +318,116 @@ void SAL_CALL SwVbaDocument::Activate() throw (uno::RuntimeException)
- VbaDocumentBase::Activate();
- }
-
-+::sal_Int32 SAL_CALL SwVbaDocument::getProtectionType() throw (css::uno::RuntimeException)
-+{
-+ //TODO
-+ return word::WdProtectionType::wdNoProtection;
-+}
-+
-+void SAL_CALL SwVbaDocument::setProtectionType( ::sal_Int32 /*_protectiontype*/ ) throw (css::uno::RuntimeException)
-+{
-+ //TODO
-+}
-+
-+::sal_Bool SAL_CALL SwVbaDocument::getUpdateStylesOnOpen() throw (css::uno::RuntimeException)
-+{
-+ //TODO
-+ return sal_False;
-+}
-+
-+void SAL_CALL SwVbaDocument::setUpdateStylesOnOpen( ::sal_Bool /*_updatestylesonopen*/ ) throw (uno::RuntimeException)
-+{
-+ //TODO
-+}
-+
-+::sal_Bool SAL_CALL SwVbaDocument::getAutoHyphenation() throw (uno::RuntimeException)
-+{
-+ // check this property only in default paragraph style
-+ sal_Bool IsAutoHyphenation = sal_False;
-+ uno::Reference< beans::XPropertySet > xParaProps( word::getDefaultParagraphStyle( getModel() ), uno::UNO_QUERY_THROW );
-+ xParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaIsHyphenation")) ) >>= IsAutoHyphenation;
-+ return IsAutoHyphenation;
-+}
-+
-+void SAL_CALL SwVbaDocument::setAutoHyphenation( ::sal_Bool _autohyphenation ) throw (uno::RuntimeException)
-+{
-+ //TODO
-+ uno::Reference< beans::XPropertySet > xParaProps( word::getDefaultParagraphStyle( getModel() ), uno::UNO_QUERY_THROW );
-+ xParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaIsHyphenation")), uno::makeAny( _autohyphenation ) );
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaDocument::getHyphenationZone() throw (uno::RuntimeException)
-+{
-+ //TODO
-+ return 0;
-+}
-+
-+void SAL_CALL SwVbaDocument::setHyphenationZone( ::sal_Int32 /*_hyphenationzone*/ ) throw (uno::RuntimeException)
-+{
-+ //TODO
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaDocument::getConsecutiveHyphensLimit() throw (uno::RuntimeException)
-+{
-+ //TODO
-+ sal_Int16 nHyphensLimit = 0;
-+ uno::Reference< beans::XPropertySet > xParaProps( word::getDefaultParagraphStyle( getModel() ), uno::UNO_QUERY_THROW );
-+ xParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaHyphenationMaxHyphens")) ) >>= nHyphensLimit;
-+ return nHyphensLimit;
-+}
-+
-+void SAL_CALL SwVbaDocument::setConsecutiveHyphensLimit( ::sal_Int32 _consecutivehyphenslimit ) throw (uno::RuntimeException)
-+{
-+ sal_Int16 nHyphensLimit = static_cast< sal_Int16 >( _consecutivehyphenslimit );
-+ uno::Reference< beans::XPropertySet > xParaProps( word::getDefaultParagraphStyle( getModel() ), uno::UNO_QUERY_THROW );
-+ xParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaHyphenationMaxHyphens")), uno::makeAny( nHyphensLimit ) );
-+}
-+
-+void SAL_CALL SwVbaDocument::Protect( ::sal_Int32 /*Type*/, const uno::Any& /*NOReset*/, const uno::Any& /*Password*/, const uno::Any& /*UseIRM*/, const uno::Any& /*EnforceStyleLock*/ ) throw (uno::RuntimeException)
-+{
-+ // Seems not support in Writer
-+ // VbaDocumentBase::Protect( Password );
-+}
-+
-+void SAL_CALL SwVbaDocument::PrintOut( const uno::Any& /*Background*/, const uno::Any& /*Append*/, const uno::Any& /*Range*/, const uno::Any& /*OutputFileName*/, const uno::Any& /*From*/, const uno::Any& /*To*/, const uno::Any& /*Item*/, const uno::Any& /*Copies*/, const uno::Any& /*Pages*/, const uno::Any& /*PageType*/, const uno::Any& /*PrintToFile*/, const uno::Any& /*Collate*/, const uno::Any& /*FileName*/, const uno::Any& /*ActivePrinterMacGX*/, const uno::Any& /*ManualDuplexPrint*/, const uno::Any& /*PrintZoomColumn*/, const uno::Any& /*PrintZoomRow*/, const uno::Any& /*PrintZoomPaperWidth*/, const uno::Any& /*PrintZoomPaperHeight*/ ) throw (uno::RuntimeException)
-+{
-+ //TODO
-+}
-+
-+void SAL_CALL SwVbaDocument::PrintPreview( ) throw (uno::RuntimeException)
-+{
-+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:PrintPreview"));
-+ dispatchRequests( mxModel,url );
-+}
-+
-+void SAL_CALL SwVbaDocument::ClosePrintPreview( ) throw (uno::RuntimeException)
-+{
-+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ClosePreview"));
-+ dispatchRequests( mxModel,url );
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaDocument::Revisions( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< document::XRedlinesSupplier > xRedlinesSupp( mxTextDocument, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xRedlines( xRedlinesSupp->getRedlines(), uno::UNO_QUERY_THROW );
-+ uno::Reference< XCollection > xCol( new SwVbaRevisions( this, mxContext, getModel(), xRedlines ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaDocument::Frames( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< text::XTextFramesSupplier > xTextFramesSupp( mxTextDocument, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xFrames( xTextFramesSupp->getTextFrames(), uno::UNO_QUERY_THROW );
-+ uno::Reference< XCollection > xCol( new SwVbaFrames( this, mxContext, xFrames, getModel() ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
- uno::Any
- SwVbaDocument::getControlShape( const ::rtl::OUString& sName )
- {
-diff --git sw/source/ui/vba/vbadocument.hxx sw/source/ui/vba/vbadocument.hxx
-index 4602e9a..4ca6801 100644
---- sw/source/ui/vba/vbadocument.hxx
-+++ sw/source/ui/vba/vbadocument.hxx
-@@ -65,6 +65,25 @@ public:
- virtual css::uno::Any SAL_CALL Sections( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Activate() throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL PageSetup() throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL TablesOfContents( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL FormFields( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getProtectionType() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setProtectionType( ::sal_Int32 _protectiontype ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getUpdateStylesOnOpen() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setUpdateStylesOnOpen( ::sal_Bool _updatestylesonopen ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getAutoHyphenation() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setAutoHyphenation( ::sal_Bool _autohyphenation ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getHyphenationZone() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setHyphenationZone( ::sal_Int32 _hyphenationzone ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getConsecutiveHyphensLimit() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setConsecutiveHyphensLimit( ::sal_Int32 _consecutivehyphenslimit ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL Protect( ::sal_Int32 Type, const css::uno::Any& NOReset, const css::uno::Any& Password, const css::uno::Any& UseIRM, const css::uno::Any& EnforceStyleLock ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL PrintOut( const css::uno::Any& Background, const css::uno::Any& Append, const css::uno::Any& Range, const css::uno::Any& OutputFileName, const css::uno::Any& From, const css::uno::Any& To, const css::uno::Any& Item, const css::uno::Any& Copies, const css::uno::Any& Pages, const css::uno::Any& PageType, const css::uno::Any& PrintToFile, const css::uno::Any& Collate, const css::uno::Any& FileName, const css::uno::Any& ActivePrinterMacGX, const css::uno::Any& ManualDuplexPrint, const css::uno::Any& PrintZoomColumn, const css::uno::Any& PrintZoomRow, const css::uno::Any& PrintZoomPaperWidth, const css::uno::Any& PrintZoomPaperHeight ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL PrintPreview( ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL ClosePrintPreview( ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Revisions( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Frames( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+
- // XInvocation
- 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);
-diff --git sw/source/ui/vba/vbadocumentproperties.cxx sw/source/ui/vba/vbadocumentproperties.cxx
-index 475ca93..0a3270c 100644
---- sw/source/ui/vba/vbadocumentproperties.cxx
-+++ sw/source/ui/vba/vbadocumentproperties.cxx
-@@ -203,16 +203,16 @@ public:
-
- static DocPropInfo createDocPropInfo( const rtl::OUString& sDesc, const rtl::OUString& sPropName, boost::shared_ptr< PropertGetSetHelper >& rHelper )
- {
-- return createDocPropInfo( rtl::OUStringToOString( sDesc, RTL_TEXTENCODING_UTF8 ).getStr(), rtl::OUStringToOString( sPropName, RTL_TEXTENCODING_UTF8 ).getStr(), rHelper );
-+ DocPropInfo aItem;
-+ aItem.msMSODesc = sDesc;
-+ aItem.msOOOPropName = sPropName;
-+ aItem.mpPropGetSetHelper = rHelper;
-+ return aItem;
- }
-
- static DocPropInfo createDocPropInfo( const sal_Char* sDesc, const sal_Char* sPropName, boost::shared_ptr< PropertGetSetHelper >& rHelper )
- {
-- DocPropInfo aItem;
-- aItem.msMSODesc = rtl::OUString::createFromAscii( sDesc );
-- aItem.msOOOPropName = rtl::OUString::createFromAscii( sPropName );
-- aItem.mpPropGetSetHelper = rHelper;
-- return aItem;
-+ return createDocPropInfo( rtl::OUString::createFromAscii( sDesc ), rtl::OUString::createFromAscii( sPropName ), rHelper );
- }
- uno::Any getValue()
- {
-diff --git sw/source/ui/vba/vbadocuments.cxx sw/source/ui/vba/vbadocuments.cxx
-index dc8a592..116ade6 100644
---- sw/source/ui/vba/vbadocuments.cxx
-+++ sw/source/ui/vba/vbadocuments.cxx
-@@ -76,7 +76,7 @@ class DocumentEnumImpl : public EnumerationHelperImpl
- {
- uno::Any m_aApplication;
- public:
-- DocumentEnumImpl( 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 ) {}
-+ DocumentEnumImpl( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration, const uno::Any& aApplication ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xParent, xContext, xEnumeration ), m_aApplication( aApplication ) {}
-
- virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
- {
-@@ -102,7 +102,7 @@ SwVbaDocuments::createEnumeration() throw (uno::RuntimeException)
- // safer to create an enumeration based on this objects state
- // rather than one effectively based of the desktop component
- uno::Reference< container::XEnumerationAccess > xEnumerationAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
-- return new DocumentEnumImpl( mxContext, xEnumerationAccess->createEnumeration(), Application() );
-+ return new DocumentEnumImpl( mxParent, mxContext, xEnumerationAccess->createEnumeration(), Application() );
- }
-
- uno::Any
-diff --git sw/source/ui/vba/vbaeventshelper.cxx sw/source/ui/vba/vbaeventshelper.cxx
-new file mode 100644
-index 0000000..2c6f212
---- /dev/null
-+++ sw/source/ui/vba/vbaeventshelper.cxx
-@@ -0,0 +1,169 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: vbaeventshelper.cxx,v $
-+ *
-+ * $Revision: 1.0 $
-+ *
-+ * last change: $Author: vg $ $Date: 2007/12/07 10:42:26 $
-+ *
-+ * 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 "vbaeventshelper.hxx"
-+#include <vbahelper/helperdecl.hxx>
-+#include <sfx2/objsh.hxx>
-+#include <comphelper/processfactory.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <filter/msfilter/msvbahelper.hxx>
-+#include "wordvbahelper.hxx"
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+using namespace com::sun::star::document::VbaEventId;
-+
-+const static String sThisDocument( RTL_CONSTASCII_USTRINGPARAM("ThisDocument"));
-+
-+SwVbaEventsHelper::SwVbaEventsHelper( uno::Sequence< css::uno::Any > const& aArgs, uno::Reference< uno::XComponentContext > const& xContext ) : VbaEventsHelperBase( xContext )
-+{
-+ Initilize();
-+ uno::Reference< frame::XModel > xModel ( getXSomethingFromArgs< frame::XModel >( aArgs, 0 ), uno::UNO_QUERY );
-+ pDocShell = word::getDocShell( xModel );
-+}
-+
-+SwVbaEventsHelper::~SwVbaEventsHelper()
-+{
-+}
-+
-+void SwVbaEventsHelper::Initilize()
-+{
-+ insert( VBAEVENT_DOCUMENT_NEW, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Document_New") ) );
-+ insert( VBAEVENT_DOCUMENT_AUTONEW, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AutoNew") ) );
-+ insert( VBAEVENT_DOCUMENT_OPEN, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Document_Open") ) );
-+ insert( VBAEVENT_DOCUMENT_AUTOOPEN, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AutoOpen") ) );
-+ insert( VBAEVENT_DOCUMENT_CLOSE, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Document_Close") ) );
-+}
-+
-+rtl::OUString
-+SwVbaEventsHelper::getMacroPath( const sal_Int32 nEventId )
-+{
-+ String sMacroName = getEventName( nEventId );
-+ VBAMacroResolvedInfo sMacroResolvedInfo;
-+ switch( nEventId )
-+ {
-+ // Document events
-+ case VBAEVENT_DOCUMENT_NEW:
-+ case VBAEVENT_DOCUMENT_OPEN:
-+ case VBAEVENT_DOCUMENT_CLOSE:
-+ {
-+ sMacroName.Insert( '.', 0 ).Insert( sThisDocument, 0);
-+ sMacroResolvedInfo = resolveVBAMacro( pDocShell, sMacroName );
-+ break;
-+ }
-+ case VBAEVENT_DOCUMENT_AUTONEW:
-+ case VBAEVENT_DOCUMENT_AUTOOPEN:
-+ {
-+ sMacroResolvedInfo = resolveVBAMacro( pDocShell, sMacroName );
-+ break;
-+ }
-+ default:
-+ break;
-+ }
-+ return sMacroResolvedInfo.ResolvedMacro();
-+}
-+
-+sal_Bool SwVbaEventsHelper::processVbaEvent( const sal_Int32 nEventId, const uno::Sequence< uno::Any >& /*rArgs*/ )
-+{
-+ sal_Bool result = sal_False;
-+ uno::Sequence< uno::Any > aArgs;
-+ uno::Any aRet;
-+ uno::Any aDummyCaller;
-+
-+ // For most cases, there is no corresponsible event macro in the document.
-+ // It is better fo check if the event macro exists before process the arguments to improve performance.
-+ rtl::OUString sMacroPath = getMacroPath( nEventId );
-+ if( sMacroPath.getLength() )
-+ {
-+ // excute the macro
-+ result = executeMacro( pDocShell, sMacroPath, aArgs, aRet, aDummyCaller );
-+ }
-+
-+ return result;
-+}
-+
-+sal_Bool SAL_CALL
-+SwVbaEventsHelper::ProcessCompatibleVbaEvent( sal_Int32 nEventId, const uno::Sequence< uno::Any >& aArgs ) throw (uno::RuntimeException)
-+{
-+ if( !pDocShell || mbIgnoreEvents)
-+ return sal_False;
-+
-+ // In order to better support "withevents" in the future,
-+ // it is better to process a event at a time
-+ switch( nEventId )
-+ {
-+ case VBAEVENT_DOCUMENT_NEW:
-+ {
-+ processVbaEvent( VBAEVENT_DOCUMENT_AUTONEW, aArgs );
-+ processVbaEvent( nEventId, aArgs );
-+ break;
-+ }
-+ case VBAEVENT_DOCUMENT_OPEN:
-+ {
-+ processVbaEvent( VBAEVENT_DOCUMENT_AUTOOPEN, aArgs );
-+ processVbaEvent( nEventId, aArgs );
-+ break;
-+ }
-+ case VBAEVENT_DOCUMENT_CLOSE:
-+ {
-+ return processVbaEvent( nEventId, aArgs );
-+ }
-+ default:
-+ OSL_TRACE( "Invalid Event" );
-+ }
-+
-+ return sal_True;
-+}
-+
-+::sal_Bool SAL_CALL
-+SwVbaEventsHelper::getIgnoreEvents() throw (uno::RuntimeException)
-+{
-+ return VbaEventsHelperBase::getIgnoreEvents();
-+}
-+
-+void SAL_CALL
-+SwVbaEventsHelper::setIgnoreEvents( ::sal_Bool _ignoreevents ) throw (uno::RuntimeException)
-+{
-+ VbaEventsHelperBase::setIgnoreEvents( _ignoreevents );
-+}
-+
-+namespace vbaeventshelper
-+{
-+namespace sdecl = comphelper::service_decl;
-+sdecl::class_<SwVbaEventsHelper, sdecl::with_args<true> > serviceImpl;
-+extern sdecl::ServiceDecl const serviceDecl(
-+ serviceImpl,
-+ "SwVbaEventsHelper",
-+ "com.sun.star.text.TextDocumentVbaEventsHelper" );
-+}
-diff --git sw/source/ui/vba/vbaeventshelper.hxx sw/source/ui/vba/vbaeventshelper.hxx
-new file mode 100644
-index 0000000..02dd648
---- /dev/null
-+++ sw/source/ui/vba/vbaeventshelper.hxx
-@@ -0,0 +1,67 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: vbaeventshelper.hxx,v $
-+ *
-+ * $Revision: 1.0 $
-+ *
-+ * last change: $Author: vg $ $Date: 2007/12/07 10:42:26 $
-+ *
-+ * 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 SW_VBAEVENTS_HXX
-+#define SW_VBAEVENTS_HXX
-+
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/document/VbaEventId.hpp>
-+#include <com/sun/star/document/XVbaEventsHelper.hpp>
-+#include <vbahelper/vbaeventshelperbase.hxx>
-+#include <doc.hxx>
-+#include <docsh.hxx>
-+
-+typedef ::cppu::WeakImplHelper1< com::sun::star::document::XVbaEventsHelper > VBADocumentEvent_BASE;
-+
-+class SwVbaEventsHelper : public VBADocumentEvent_BASE, public VbaEventsHelperBase
-+{
-+private:
-+ SwDocShell* pDocShell;
-+
-+ rtl::OUString getMacroPath( const sal_Int32 nEventId );
-+ sal_Bool processVbaEvent( const sal_Int32 nEventId, const css::uno::Sequence< css::uno::Any >& rArgs );
-+ void Initilize();
-+
-+public:
-+ SwVbaEventsHelper( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext > const& xContext );
-+ ~SwVbaEventsHelper();
-+ // XVBAWorkbookEventHelper
-+ virtual sal_Bool SAL_CALL ProcessCompatibleVbaEvent( sal_Int32 nEventId, const css::uno::Sequence< css::uno::Any >& aArgs ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setIgnoreEvents( ::sal_Bool _ignoreevents ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getIgnoreEvents() throw (css::uno::RuntimeException);
-+};
-+
-+#endif
-+
-diff --git sw/source/ui/vba/vbafield.cxx sw/source/ui/vba/vbafield.cxx
-index 8e9661d..60042e8 100644
---- sw/source/ui/vba/vbafield.cxx
-+++ sw/source/ui/vba/vbafield.cxx
-@@ -33,6 +33,7 @@
- #include <ooo/vba/word/WdFieldType.hpp>
- #include <com/sun/star/text/FilenameDisplayFormat.hpp>
- #include <com/sun/star/util/XRefreshable.hpp>
-+#include <com/sun/star/util/XUpdatable.hpp>
- #include <swtypes.hxx>
-
- using namespace ::ooo::vba;
-@@ -45,6 +46,17 @@ SwVbaField::SwVbaField( const uno::Reference< ooo::vba::XHelperInterface >& rPa
- mxTextField.set( xTextField, uno::UNO_QUERY_THROW );
- }
-
-+sal_Bool SAL_CALL SwVbaField::Update() throw (uno::RuntimeException)
-+{
-+ uno::Reference< util::XUpdatable > xUpdatable( mxTextField, uno::UNO_QUERY );
-+ if( xUpdatable.is() )
-+ {
-+ xUpdatable->update();
-+ return sal_True;
-+ }
-+ return sal_False;
-+}
-+
- // XHelperInterface
- rtl::OUString&
- SwVbaField::getServiceImplName()
-@@ -368,6 +380,7 @@ SwVbaFields::Add( const css::uno::Reference< ::ooo::vba::word::XRange >& Range,
- {
- _ReadFieldParams aReadParam(sText);
- sFieldName = aReadParam.GetFieldName();
-+ OSL_TRACE("SwVbaFields::Add, the field name is %s ",rtl::OUStringToOString( sFieldName, RTL_TEXTENCODING_UTF8 ).getStr() );
- }
-
- uno::Reference< text::XTextContent > xTextField;
-@@ -375,6 +388,10 @@ SwVbaFields::Add( const css::uno::Reference< ::ooo::vba::word::XRange >& Range,
- {
- xTextField.set( Create_Field_FileName( sText ), uno::UNO_QUERY_THROW );
- }
-+ else if( nType == word::WdFieldType::wdFieldDocProperty || sFieldName.EqualsIgnoreCaseAscii("DOCPROPERTY") )
-+ {
-+ xTextField.set( Create_Field_DocProperty( sText ), uno::UNO_QUERY_THROW );
-+ }
- else
- {
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-@@ -419,6 +436,104 @@ uno::Reference< text::XTextField > SwVbaFields::Create_Field_FileName( const rtl
- return xTextField;
- }
-
-+struct DocPropertyTable
-+{
-+ const char* sDocPropertyName;
-+ const char* sFieldService;
-+};
-+
-+static const DocPropertyTable aDocPropertyTables[] =
-+{
-+ { "Author", "com.sun.star.text.textfield.docinfo.CreateAuthor" },
-+ { "Bytes", NULL },
-+ { "Category", NULL },
-+ { "Characters",NULL },
-+ { "CharactersWithSpaces", NULL },
-+ { "Comments", "com.sun.star.text.textfield.docinfo.Description" },
-+ { "Company", NULL },
-+ { "CreateTime", "com.sun.star.text.textfield.docinfo.CreateDateTime" },
-+ { "HyperlinkBase", NULL },
-+ { "Keywords", "com.sun.star.text.textfield.docinfo.Keywords" },
-+ { "LastPrinted", "com.sun.star.text.textfield.docinfo.PrintDateTime" },
-+ { "LastSavedBy", "com.sun.star.text.textfield.docinfo.ChangeAuthor" },
-+ { "LastSavedTime", "com.sun.star.text.textfield.docinfo.ChangeDateTime" },
-+ { "Lines", NULL },
-+ { "Manager", NULL },
-+ { "NameofApplication", NULL },
-+ { "ODMADocID", NULL },
-+ { "Pages", "com.sun.star.text.textfield.PageCount" },
-+ { "Paragraphs", "com.sun.star.text.textfield.ParagraphCount" },
-+ { "RevisionNumber", "com.sun.star.text.textfield.docinfo.Revision" },
-+ { "Security", NULL },
-+ { "Subject", "com.sun.star.text.textfield.docinfo.Subject" },
-+ { "Template", "com.sun.star.text.textfield.TemplateName" },
-+ { "Title", "com.sun.star.text.textfield.docinfo.Title" },
-+ { "TotalEditingTime", "com.sun.star.text.textfield.docinfo.EditTime" },
-+ { "Words", "com.sun.star.text.textfield.WordCount" },
-+ { NULL, NULL }
-+};
-+
-+uno::Reference< text::XTextField > SwVbaFields::Create_Field_DocProperty( const rtl::OUString _text ) throw (uno::RuntimeException)
-+{
-+ String aDocProperty;
-+ _ReadFieldParams aReadParam( _text );
-+ long nRet;
-+ while( -1 != ( nRet = aReadParam.SkipToNextToken() ))
-+ {
-+ switch( nRet )
-+ {
-+ case -2:
-+ if( !aDocProperty.Len() )
-+ aDocProperty = aReadParam.GetResult();
-+ break;
-+ case '*':
-+ //Skip over MERGEFORMAT
-+ aReadParam.SkipToNextToken();
-+ break;
-+ }
-+ }
-+ aDocProperty.EraseAllChars('"');
-+ OSL_TRACE("SwVbaFields::Create_Field_DocProperty, the document property name is %s ",rtl::OUStringToOString( aDocProperty, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ if( aDocProperty.Len() == 0 )
-+ {
-+ throw uno::RuntimeException();
-+ }
-+
-+ sal_Bool bCustom = sal_True;
-+ rtl::OUString sFieldService;
-+ // find the build in document properties
-+ for( const DocPropertyTable* pTable = aDocPropertyTables; pTable->sDocPropertyName != NULL; pTable++ )
-+ {
-+ if( aDocProperty.EqualsIgnoreCaseAscii( pTable->sDocPropertyName ) )
-+ {
-+ if( pTable->sFieldService != NULL )
-+ sFieldService = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( pTable->sFieldService ) );
-+ bCustom = sal_False;
-+ break;
-+ }
-+ }
-+
-+ if( bCustom )
-+ {
-+ sFieldService = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.textfield.docinfo.Custom" ) );
-+ }
-+ else if( sFieldService.getLength() == 0 )
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+
-+ uno::Reference< text::XTextField > xTextField( mxMSF->createInstance( sFieldService ), uno::UNO_QUERY_THROW );
-+
-+ if( bCustom )
-+ {
-+ uno::Reference< beans::XPropertySet > xProps( xTextField, uno::UNO_QUERY_THROW );
-+ rtl::OUString sDocPropertyName( aDocProperty );
-+ xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ), uno::makeAny( sDocPropertyName ) );
-+ }
-+
-+ return xTextField;
-+}
-+
- uno::Reference< container::XEnumeration > SAL_CALL
- SwVbaFields::createEnumeration() throw (uno::RuntimeException)
- {
-diff --git sw/source/ui/vba/vbafield.hxx sw/source/ui/vba/vbafield.hxx
-index f421179..99f9d7e 100644
---- sw/source/ui/vba/vbafield.hxx
-+++ sw/source/ui/vba/vbafield.hxx
-@@ -41,7 +41,8 @@ class SwVbaField : public SwVbaField_BASE
- css::uno::Reference< css::text::XTextField > mxTextField;
- public:
- SwVbaField( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rDocument, const css::uno::Reference< css::text::XTextField >& xTextField) throw ( css::uno::RuntimeException);
--
-+
-+ virtual sal_Bool SAL_CALL Update() throw ( css::uno::RuntimeException);
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-@@ -57,6 +58,7 @@ class SwVbaFields : public SwVbaFields_BASE
- css::uno::Reference< css::lang::XMultiServiceFactory > mxMSF;
- private:
- css::uno::Reference< css::text::XTextField > Create_Field_FileName( const rtl::OUString _text ) throw (css::uno::RuntimeException);
-+ css::uno::Reference< css::text::XTextField > Create_Field_DocProperty( const rtl::OUString _text ) throw (css::uno::RuntimeException);
-
- public:
- SwVbaFields( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel );
-diff --git sw/source/ui/vba/vbaformfield.cxx sw/source/ui/vba/vbaformfield.cxx
-new file mode 100644
-index 0000000..944ffbb
---- /dev/null
-+++ sw/source/ui/vba/vbaformfield.cxx
-@@ -0,0 +1,139 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbaformfield.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include <com/sun/star/text/XTextContent.hpp>
-+#include <com/sun/star/text/XTextViewCursor.hpp>
-+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
-+#include <ecmaflds.hxx>
-+#include "vbacheckbox.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaFormField::SwVbaFormField( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< frame::XModel >& rModel, const uno::Reference< text::XFormField >& xFormField ) throw ( uno::RuntimeException ) : SwVbaFormField_BASE( rParent, rContext ), mxModel( rModel ), mxFormField( xFormField )
-+{
-+}
-+
-+SwVbaFormField::~SwVbaFormField()
-+{
-+}
-+
-+rtl::OUString SAL_CALL SwVbaFormField::getResult() throw ( uno::RuntimeException )
-+{
-+ rtl::OUString sResult;
-+ rtl::OUString sType = mxFormField->getFieldType();
-+ if( sType.equalsIgnoreAsciiCaseAscii( ECMA_FORMTEXT ) )
-+ {
-+ uno::Reference< text::XTextContent > xTextContent( mxFormField, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextRange > xTextRange = xTextContent->getAnchor();
-+ sResult = xTextRange->getString();
-+ }
-+ else if( sType.equalsIgnoreAsciiCaseAscii( ECMA_FORMCHECKBOX ) )
-+ {
-+ sal_Int32 nValue = 0;
-+ sal_Int32 nCount = mxFormField->getParamCount();
-+ for( sal_Int32 i = 0; i < nCount; i++ )
-+ {
-+ if( mxFormField->getParamName(i).equalsIgnoreAsciiCaseAscii( ECMA_FORMCHECKBOX_CHECKED ) )
-+ {
-+ if( mxFormField->getParamValue(i).equalsIgnoreAsciiCaseAscii("on") )
-+ nValue = 1;
-+ else
-+ nValue = 0;
-+ break;
-+ }
-+
-+ }
-+ sResult = rtl::OUString::valueOf( nValue );
-+ }
-+ else
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+ return sResult;
-+}
-+
-+void SAL_CALL SwVbaFormField::setResult( const rtl::OUString& result ) throw ( uno::RuntimeException )
-+{
-+ rtl::OUString sType = mxFormField->getFieldType();
-+ if( sType.equalsIgnoreAsciiCaseAscii( ECMA_FORMTEXT ) )
-+ {
-+ uno::Reference< text::XTextContent > xTextContent( mxFormField, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextRange > xTextRange = xTextContent->getAnchor();
-+ xTextRange->setString( result );
-+ }
-+ else if( sType.equalsIgnoreAsciiCaseAscii( ECMA_FORMCHECKBOX ) )
-+ {
-+ // do nothing
-+ }
-+ else
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+}
-+
-+sal_Bool SAL_CALL SwVbaFormField::getEnabled() throw ( uno::RuntimeException )
-+{
-+ //allways return true
-+ return sal_True;
-+}
-+
-+void SAL_CALL SwVbaFormField::setEnabled( sal_Bool/* enabled */ ) throw ( uno::RuntimeException )
-+{
-+ // not support in Writer
-+}
-+
-+uno::Any SAL_CALL SwVbaFormField::CheckBox() throw ( uno::RuntimeException )
-+{
-+ return uno::makeAny( uno::Reference< word::XCheckBox >( new SwVbaCheckBox( this, mxContext, mxModel, mxFormField ) ) );
-+}
-+
-+rtl::OUString&
-+SwVbaFormField::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaFormField") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaFormField::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.FormField" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbaformfield.hxx sw/source/ui/vba/vbaformfield.hxx
-new file mode 100644
-index 0000000..e3a2d7f
---- /dev/null
-+++ sw/source/ui/vba/vbaformfield.hxx
-@@ -0,0 +1,61 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_FORMFIELD_HXX
-+#define SW_VBA_FORMFIELD_HXX
-+
-+#include <ooo/vba/word/XFormField.hpp>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/text/XFormField.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XFormField > SwVbaFormField_BASE;
-+
-+class SwVbaFormField : public SwVbaFormField_BASE
-+{
-+private:
-+ css::uno::Reference< css::frame::XModel > mxModel;
-+ css::uno::Reference< css::text::XFormField > mxFormField;
-+
-+public:
-+ SwVbaFormField( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& rModel, const css::uno::Reference< css::text::XFormField >& xFormField ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaFormField();
-+
-+ // Methods
-+ rtl::OUString SAL_CALL getResult() throw ( css::uno::RuntimeException );
-+ void SAL_CALL setResult( const rtl::OUString& result ) throw ( css::uno::RuntimeException );
-+ sal_Bool SAL_CALL getEnabled() throw ( css::uno::RuntimeException );
-+ void SAL_CALL setEnabled( sal_Bool enabled ) throw ( css::uno::RuntimeException );
-+ css::uno::Any SAL_CALL CheckBox() throw ( css::uno::RuntimeException );
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_FORMFIELD_HXX */
-diff --git sw/source/ui/vba/vbaformfields.cxx sw/source/ui/vba/vbaformfields.cxx
-new file mode 100644
-index 0000000..b56cff8
---- /dev/null
-+++ sw/source/ui/vba/vbaformfields.cxx
-@@ -0,0 +1,205 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbaformfields.hxx"
-+#include "vbaformfield.hxx"
-+#include <com/sun/star/container/XNamed.hpp>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include <com/sun/star/text/XTextViewCursor.hpp>
-+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
-+#include "wordvbahelper.hxx"
-+#include <cppuhelper/implbase3.hxx>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+typedef std::vector< uno::Reference< text::XFormField > > XFormFieldVec;
-+typedef ::cppu::WeakImplHelper1< container::XEnumeration > FormFiledEnumeration_BASE;
-+typedef ::cppu::WeakImplHelper3< container::XNameAccess, container::XIndexAccess, container::XEnumerationAccess > FormFieldCollectionHelper_BASE;
-+
-+rtl::OUString lcl_getFormFieldName( const uno::Reference< text::XFormField >& xFormField )
-+{
-+ rtl::OUString sName;
-+ sal_Int32 nCount = xFormField->getParamCount();
-+ for( sal_Int32 i = 0; i < nCount; i++ )
-+ {
-+ if( xFormField->getParamName(i).equalsIgnoreAsciiCaseAscii( "Name" ) )
-+ {
-+ sName = xFormField->getParamValue(i);
-+ OSL_TRACE("lcl_getFormFieldName: %s", rtl::OUStringToOString( sName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ break;
-+ }
-+ }
-+ return sName;
-+}
-+
-+class FormFieldsEnumeration : public FormFiledEnumeration_BASE
-+{
-+private:
-+ uno::Reference< XHelperInterface > mxParent;
-+ uno::Reference< uno::XComponentContext > mxContext;
-+ uno::Reference< frame::XModel > mxModel;
-+ XFormFieldVec mxFormFields;
-+ XFormFieldVec::iterator cachePos;
-+public:
-+ FormFieldsEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel, const XFormFieldVec& xFormFiels ) throw (uno::RuntimeException) : mxParent( xParent ), mxContext( xContext ), mxModel( xModel ), mxFormFields( xFormFiels ), cachePos( mxFormFields.begin() )
-+ {
-+ }
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( cachePos != mxFormFields.end() );
-+ }
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( !hasMoreElements() )
-+ throw container::NoSuchElementException();
-+ uno::Reference< text::XFormField > xFormField( *cachePos++ );
-+ return uno::makeAny( uno::Reference< word::XFormField > ( new SwVbaFormField( mxParent, mxContext, mxModel, xFormField ) ) );
-+ }
-+
-+};
-+
-+class FormFieldCollectionHelper : public FormFieldCollectionHelper_BASE
-+{
-+private:
-+ uno::Reference< XHelperInterface > mxParent;
-+ uno::Reference< uno::XComponentContext > mxContext;
-+ uno::Reference< frame::XModel > mxModel;
-+ XFormFieldVec mxFormFields;
-+ XFormFieldVec::iterator cachePos;
-+public:
-+ FormFieldCollectionHelper( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException) : mxParent( xParent ), mxContext( xContext ), mxModel( xModel )
-+ {
-+ uno::Reference< text::XBookmarksSupplier > xBookmarksSupplier( xModel,uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xIndexAccess( xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY_THROW );
-+ sal_Int32 nCount = xIndexAccess->getCount();
-+ for( sal_Int32 i = 0; i < nCount; i++ )
-+ {
-+ uno::Reference< text::XFormField > xFormField( xIndexAccess->getByIndex( i ), uno::UNO_QUERY );
-+ if( xFormField.is() )
-+ mxFormFields.push_back( xFormField );
-+ }
-+ cachePos = mxFormFields.begin();
-+ }
-+ // XElementAccess
-+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) { return word::XFormField::static_type(0); }
-+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) { return getCount() > 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();
-+ uno::Reference< text::XFormField > xFormField( *cachePos, uno::UNO_QUERY_THROW );
-+ return uno::makeAny( uno::Reference< word::XFormField >( new SwVbaFormField( mxParent, mxContext, mxModel, xFormField ) ) );
-+ }
-+ virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException)
-+ {
-+ uno::Sequence< rtl::OUString > sNames( mxFormFields.size() );
-+ rtl::OUString* pString = sNames.getArray();
-+ XFormFieldVec::iterator it = mxFormFields.begin();
-+ XFormFieldVec::iterator it_end = mxFormFields.end();
-+ for ( ; it != it_end; ++it, ++pString )
-+ {
-+ uno::Reference< text::XFormField > xFormField( *cachePos, uno::UNO_QUERY_THROW );
-+ *pString = lcl_getFormFieldName( xFormField );
-+ }
-+ return sNames;
-+ }
-+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
-+ {
-+ cachePos = mxFormFields.begin();
-+ XFormFieldVec::iterator it_end = mxFormFields.end();
-+ for ( ; cachePos != it_end; ++cachePos )
-+ {
-+ //uno::Reference< container::XNamed > xName( *cachePos, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XFormField > xFormField( *cachePos, uno::UNO_QUERY_THROW );
-+ if ( aName.equalsIgnoreAsciiCase( lcl_getFormFieldName( xFormField )) )
-+ break;
-+ }
-+ return ( cachePos != it_end );
-+ }
-+ // XIndexAccess
-+ virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
-+ {
-+ return mxFormFields.size();
-+ }
-+ virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
-+ {
-+ if ( Index < 0 || Index >= getCount() )
-+ throw lang::IndexOutOfBoundsException();
-+ return uno::makeAny( uno::Reference< word::XFormField >( new SwVbaFormField( mxParent, mxContext, mxModel, mxFormFields[ Index ] ) ) );
-+ }
-+ // XEnumerationAccess
-+ virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
-+ {
-+ return new FormFieldsEnumeration( mxParent, mxContext, mxModel, mxFormFields );
-+ }
-+};
-+
-+SwVbaFormFields::SwVbaFormFields( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel ): SwVbaFormFields_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new FormFieldCollectionHelper( xParent, xContext, xModel ) ) ), mxModel( xModel )
-+{
-+}
-+// XEnumerationAccess
-+uno::Type
-+SwVbaFormFields::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XFormField::static_type(0);
-+}
-+uno::Reference< container::XEnumeration >
-+SwVbaFormFields::createEnumeration() throw (uno::RuntimeException)
-+{
-+ uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
-+ return xEnumAccess->createEnumeration();
-+}
-+
-+uno::Any
-+SwVbaFormFields::createCollectionObject( const css::uno::Any& aSource )
-+{
-+ return aSource;
-+}
-+
-+rtl::OUString&
-+SwVbaFormFields::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaFormFields") );
-+ return sImplName;
-+}
-+
-+css::uno::Sequence<rtl::OUString>
-+SwVbaFormFields::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.FormFields") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbaformfields.hxx sw/source/ui/vba/vbaformfields.hxx
-new file mode 100644
-index 0000000..76ef6bb
---- /dev/null
-+++ sw/source/ui/vba/vbaformfields.hxx
-@@ -0,0 +1,60 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_FORMFIELDS_HXX
-+#define SW_VBA_FORMFIELDS_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XFormFields.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/text/XBookmarksSupplier.hpp>
-+#include <com/sun/star/text/XTextRange.hpp>
-+
-+typedef CollTestImplHelper< ooo::vba::word::XFormFields > SwVbaFormFields_BASE;
-+
-+class SwVbaFormFields : public SwVbaFormFields_BASE
-+{
-+private:
-+ css::uno::Reference< css::frame::XModel > mxModel;
-+
-+public:
-+ SwVbaFormFields( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel );
-+ virtual ~SwVbaFormFields() {}
-+
-+ // 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);
-+
-+ // SwVbaFormFields_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* SW_VBA_FORMFIELDS_HXX */
-diff --git sw/source/ui/vba/vbaframe.cxx sw/source/ui/vba/vbaframe.cxx
-new file mode 100644
-index 0000000..bec1aa6
---- /dev/null
-+++ sw/source/ui/vba/vbaframe.cxx
-@@ -0,0 +1,75 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbaframe.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include <com/sun/star/text/XTextContent.hpp>
-+#include <com/sun/star/text/XTextViewCursor.hpp>
-+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
-+#include <com/sun/star/view/XSelectionSupplier.hpp>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaFrame::SwVbaFrame( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const css::uno::Reference< frame::XModel >& rModel, const css::uno::Reference< text::XTextFrame >& xTextFrame ) throw ( css::uno::RuntimeException ) :
-+ SwVbaFrame_BASE( rParent, rContext ), mxModel( rModel ), mxTextFrame( xTextFrame )
-+{
-+}
-+
-+SwVbaFrame::~SwVbaFrame()
-+{
-+}
-+
-+void SAL_CALL SwVbaFrame::Select() throw ( uno::RuntimeException )
-+{
-+ uno::Reference< view::XSelectionSupplier > xSelectSupp( mxModel->getCurrentController(), uno::UNO_QUERY_THROW );
-+ xSelectSupp->select( uno::makeAny( mxTextFrame ) );
-+}
-+
-+rtl::OUString&
-+SwVbaFrame::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaFrame") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaFrame::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Frame" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbaframe.hxx sw/source/ui/vba/vbaframe.hxx
-new file mode 100644
-index 0000000..a36ebf8
---- /dev/null
-+++ sw/source/ui/vba/vbaframe.hxx
-@@ -0,0 +1,57 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_FRAME_HXX
-+#define SW_VBA_FRAME_HXX
-+
-+#include <ooo/vba/word/XFrame.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/text/XTextFrame.hpp>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XFrame > SwVbaFrame_BASE;
-+
-+class SwVbaFrame : public SwVbaFrame_BASE
-+{
-+private:
-+ css::uno::Reference< css::frame::XModel > mxModel;
-+ css::uno::Reference< css::text::XTextFrame > mxTextFrame;
-+
-+public:
-+ SwVbaFrame( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& rModel, const css::uno::Reference< css::text::XTextFrame >& xTextFrame ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaFrame();
-+
-+ // Methods
-+ virtual void SAL_CALL Select() throw ( css::uno::RuntimeException );
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_FRAME_HXX */
-diff --git sw/source/ui/vba/vbaframes.cxx sw/source/ui/vba/vbaframes.cxx
-new file mode 100644
-index 0000000..2c9fa92
---- /dev/null
-+++ sw/source/ui/vba/vbaframes.cxx
-@@ -0,0 +1,109 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbaframes.hxx"
-+#include "vbaframe.hxx"
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include <com/sun/star/text/XTextViewCursor.hpp>
-+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
-+#include "wordvbahelper.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+typedef ::cppu::WeakImplHelper1< container::XEnumeration > FramesEnumeration_Base;
-+class FramesEnumeration : public FramesEnumeration_Base
-+{
-+private:
-+ uno::Reference< XHelperInterface > mxParent;
-+ uno::Reference< uno::XComponentContext > mxContext;
-+ uno::Reference< container::XIndexAccess> mxIndexAccess;
-+ uno::Reference< frame::XModel > mxModel;
-+ sal_Int32 nCurrentPos;
-+public:
-+ FramesEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess, const uno::Reference< frame::XModel >& xModel ) throw ( uno::RuntimeException ) : mxParent( xParent ), mxContext( xContext), mxIndexAccess( xIndexAccess ), mxModel( xModel ), nCurrentPos(0)
-+ {
-+ }
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( nCurrentPos < mxIndexAccess->getCount() );
-+ }
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( !hasMoreElements() )
-+ throw container::NoSuchElementException();
-+ uno::Reference< text::XTextFrame > xTextFrame( mxIndexAccess->getByIndex( nCurrentPos++ ), uno::UNO_QUERY_THROW );
-+ return uno::makeAny( uno::Reference< word::XFrame > ( new SwVbaFrame( mxParent, mxContext, mxModel, xTextFrame ) ) );
-+ }
-+
-+};
-+
-+SwVbaFrames::SwVbaFrames( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< container::XIndexAccess >& xFrames, const uno::Reference< frame::XModel >& xModel ): SwVbaFrames_BASE( xParent, xContext, xFrames ), mxModel( xModel )
-+{
-+ mxFramesSupplier.set( mxModel, uno::UNO_QUERY_THROW );
-+}
-+// XEnumerationAccess
-+uno::Type
-+SwVbaFrames::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XFrame::static_type(0);
-+}
-+
-+uno::Reference< container::XEnumeration >
-+SwVbaFrames::createEnumeration() throw (uno::RuntimeException)
-+{
-+ return new FramesEnumeration( this, mxContext,m_xIndexAccess, mxModel );
-+}
-+
-+uno::Any
-+SwVbaFrames::createCollectionObject( const css::uno::Any& aSource )
-+{
-+ uno::Reference< text::XTextFrame > xTextFrame( aSource, uno::UNO_QUERY_THROW );
-+ return uno::makeAny( uno::Reference< word::XFrame > ( new SwVbaFrame( this, mxContext, mxModel, xTextFrame ) ) );
-+}
-+
-+rtl::OUString&
-+SwVbaFrames::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaFrames") );
-+ return sImplName;
-+}
-+
-+css::uno::Sequence<rtl::OUString>
-+SwVbaFrames::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Frames") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbaframes.hxx sw/source/ui/vba/vbaframes.hxx
-new file mode 100644
-index 0000000..0957820
---- /dev/null
-+++ sw/source/ui/vba/vbaframes.hxx
-@@ -0,0 +1,61 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_FRAMES_HXX
-+#define SW_VBA_FRAMES_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XFrames.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/text/XTextFramesSupplier.hpp>
-+
-+typedef CollTestImplHelper< ooo::vba::word::XFrames > SwVbaFrames_BASE;
-+
-+class SwVbaFrames : public SwVbaFrames_BASE
-+{
-+private:
-+ css::uno::Reference< css::frame::XModel > mxModel;
-+ css::uno::Reference< css::text::XTextFramesSupplier > mxFramesSupplier;
-+
-+public:
-+ SwVbaFrames( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::container::XIndexAccess >& xFrames, const css::uno::Reference< css::frame::XModel >& xModel );
-+ virtual ~SwVbaFrames() {}
-+
-+ // 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);
-+
-+ // SwVbaFrames_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+
-+};
-+
-+#endif /* SW_VBA_FRAMES_HXX */
-diff --git sw/source/ui/vba/vbaglobals.cxx sw/source/ui/vba/vbaglobals.cxx
-index 0770ea3..c801294 100644
---- sw/source/ui/vba/vbaglobals.cxx
-+++ sw/source/ui/vba/vbaglobals.cxx
-@@ -129,6 +129,12 @@ SwVbaGlobals::Dialogs( const uno::Any& index ) throw (uno::RuntimeException)
- return getApplication()->Dialogs( index );
- }
-
-+uno::Any SAL_CALL
-+SwVbaGlobals::ListGalleries( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ return getApplication()->ListGalleries( index );
-+}
-+
- uno::Reference<word::XSelection > SAL_CALL
- SwVbaGlobals::getSelection() throw (uno::RuntimeException)
- {
-diff --git sw/source/ui/vba/vbaglobals.hxx sw/source/ui/vba/vbaglobals.hxx
-index ad6ce95..1e7d587 100644
---- sw/source/ui/vba/vbaglobals.hxx
-+++ sw/source/ui/vba/vbaglobals.hxx
-@@ -69,6 +69,7 @@ public:
- virtual css::uno::Any SAL_CALL Documents( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Addins( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Dialogs( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL ListGalleries( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
- virtual float SAL_CALL CentimetersToPoints( float _Centimeters ) throw (css::uno::RuntimeException);
- // XMultiServiceFactory
- virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames( ) throw (css::uno::RuntimeException);
-diff --git sw/source/ui/vba/vbaheaderfooter.cxx sw/source/ui/vba/vbaheaderfooter.cxx
-index ec3b0ce..6cdbfcb 100644
---- sw/source/ui/vba/vbaheaderfooter.cxx
-+++ sw/source/ui/vba/vbaheaderfooter.cxx
-@@ -81,6 +81,7 @@ uno::Reference< word::XRange > SAL_CALL SwVbaHeaderFooter::getRange() throw (uno
- uno::Any SAL_CALL
- SwVbaHeaderFooter::Shapes( const uno::Any& index ) throw (uno::RuntimeException)
- {
-+ // #FIXME: only get the shapes in the current header/footer
- uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxModel, uno::UNO_QUERY_THROW );
- //uno::Reference< drawing::XShapes > xShapes( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
- uno::Reference< container::XIndexAccess > xIndexAccess( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
-diff --git sw/source/ui/vba/vbaheaderfooterhelper.cxx sw/source/ui/vba/vbaheaderfooterhelper.cxx
-index d91f37a..36a921b 100644
---- sw/source/ui/vba/vbaheaderfooterhelper.cxx
-+++ sw/source/ui/vba/vbaheaderfooterhelper.cxx
-@@ -29,8 +29,12 @@
- #include <comphelper/processfactory.hxx>
- #include <com/sun/star/frame/XController.hpp>
- #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
-+#include <com/sun/star/text/XTextRangeCompare.hpp>
-+#include <com/sun/star/text/XTextRange.hpp>
- #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
- #include <com/sun/star/container/XNameAccess.hpp>
-+#include <com/sun/star/lang/XServiceInfo.hpp>
-+#include <com/sun/star/lang/IllegalArgumentException.hpp>
-
- using namespace ::com::sun::star;
- using namespace ::ooo::vba;
-@@ -38,41 +42,61 @@ using namespace ::ooo::vba;
- #define FIRST_PAGE 1;
-
- // Class HeaderFooterHelper
-+sal_Bool HeaderFooterHelper::isHeaderFooter( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
-+{
-+ return isHeaderFooter( word::getCurrentXText( xModel ) );
-+}
-
--sal_Bool HeaderFooterHelper::isHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
-+sal_Bool HeaderFooterHelper::isHeaderFooter( const uno::Reference< text::XText >& xText ) throw (uno::RuntimeException)
- {
-- uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
-- uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW );
--
-- sal_Bool isOn = sal_False;
-- xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn"))) >>= isOn;
-- if( !isOn )
-- return sal_False;
-+ uno::Reference< lang::XServiceInfo > xServiceInfo( xText, uno::UNO_QUERY_THROW );
-+ rtl::OUString aImplName = xServiceInfo->getImplementationName();
-+ if( aImplName.equalsAscii("SwXHeadFootText") )
-+ return sal_True;
-+ return sal_False;
-+}
-
-- sal_Bool isShared = sal_False;
-- xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsShared"))) >>= isShared;
-+sal_Bool HeaderFooterHelper::isHeader( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
-+{
-+ const uno::Reference< text::XText > xCurrentText = word::getCurrentXText( xModel );
-+ if( !isHeaderFooter( xCurrentText ) )
-+ return sal_False;
-
-+ rtl::OUString aPropIsShared = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsShared") );
- rtl::OUString aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderText") );
-+ uno::Reference< style::XStyle > xPageStyle = word::getCurrentPageStyle( xModel );
-+ uno::Reference< beans::XPropertySet > xPageProps( xPageStyle, uno::UNO_QUERY_THROW );
-+ sal_Bool isShared = sal_True;
-+ xPageProps->getPropertyValue( aPropIsShared ) >>= isShared;
- if( !isShared )
- {
-+ uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
- if( 0 == xPageCursor->getPage() % 2 )
-- {
- aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderTextLeft") );
-- }
- else
-- {
- aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderTextRight") );
-- }
- }
--
-- uno::Reference< text::XText > xText( xStyleProps->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW );
-- //FIXME: can not compare in this way?
-- return ( xText == xCurrentText );
-+
-+ uno::Reference< text::XText > xHeaderText( xPageProps->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextRangeCompare > xTRC( xHeaderText, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextRange > xTR1( xCurrentText, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextRange > xTR2( xHeaderText, uno::UNO_QUERY_THROW );
-+ try
-+ {
-+ if( xTRC->compareRegionStarts( xTR1, xTR2 ) == 0 )
-+ return sal_True;
-+ }
-+ catch( lang::IllegalArgumentException& )
-+ {
-+ return sal_False;
-+ }
-+
-+ return sal_False;
- }
-
--sal_Bool HeaderFooterHelper::isFirstPageHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
-+sal_Bool HeaderFooterHelper::isFirstPageHeader( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
- {
-- if( isHeader( xModel, xCurrentText ) )
-+ if( isHeader( xModel ) )
- {
- uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
- // FIXME: getPage allways returns 1
-@@ -82,9 +106,9 @@ sal_Bool HeaderFooterHelper::isFirstPageHeader( const uno::Reference< frame::XMo
- return sal_False;
- }
-
--sal_Bool HeaderFooterHelper::isEvenPagesHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
-+sal_Bool HeaderFooterHelper::isEvenPagesHeader( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
- {
-- if( isHeader( xModel, xCurrentText ) )
-+ if( isHeader( xModel ) )
- {
- uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW );
- sal_Bool isShared = sal_False;
-@@ -98,40 +122,47 @@ sal_Bool HeaderFooterHelper::isEvenPagesHeader( const uno::Reference< frame::XMo
- return sal_False;
- }
-
--sal_Bool HeaderFooterHelper::isFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
-+sal_Bool HeaderFooterHelper::isFooter( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
- {
-- uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
-- uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW );
--
-- sal_Bool isOn = sal_False;
-- xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn"))) >>= isOn;
-- if( !isOn )
-+ const uno::Reference< text::XText > xCurrentText = word::getCurrentXText( xModel );
-+ if( !isHeaderFooter( xCurrentText ) )
- return sal_False;
-
-- sal_Bool isShared = sal_False;
-- xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsShared"))) >>= isShared;
--
-+ rtl::OUString aPropIsShared = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsShared") );
- rtl::OUString aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterText") );
-+ uno::Reference< style::XStyle > xPageStyle = word::getCurrentPageStyle( xModel );
-+ uno::Reference< beans::XPropertySet > xPageProps( xPageStyle, uno::UNO_QUERY_THROW );
-+ sal_Bool isShared = sal_True;
-+ xPageProps->getPropertyValue( aPropIsShared ) >>= isShared;
- if( !isShared )
- {
-+ uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
- if( 0 == xPageCursor->getPage() % 2 )
-- {
- aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterTextLeft") );
-- }
- else
-- {
- aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterTextRight") );
-- }
- }
--
-- uno::Reference< text::XText > xText( xStyleProps->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW );
-
-- return ( xText == xCurrentText );
-+ uno::Reference< text::XText > xFooterText( xPageProps->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextRangeCompare > xTRC( xFooterText, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextRange > xTR1( xCurrentText, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextRange > xTR2( xFooterText, uno::UNO_QUERY_THROW );
-+ try
-+ {
-+ if( xTRC->compareRegionStarts( xTR1, xTR2 ) == 0 )
-+ return sal_True;
-+ }
-+ catch( lang::IllegalArgumentException& )
-+ {
-+ return sal_False;
-+ }
-+
-+ return sal_False;
- }
-
--sal_Bool HeaderFooterHelper::isFirstPageFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
-+sal_Bool HeaderFooterHelper::isFirstPageFooter( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
- {
-- if( isFooter( xModel, xCurrentText ) )
-+ if( isFooter( xModel ) )
- {
- uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
- sal_Int32 nPage = xPageCursor->getPage();
-@@ -140,9 +171,9 @@ sal_Bool HeaderFooterHelper::isFirstPageFooter( const uno::Reference< frame::XMo
- return sal_False;
- }
-
--sal_Bool HeaderFooterHelper::isEvenPagesFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
-+sal_Bool HeaderFooterHelper::isEvenPagesFooter( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
- {
-- if( isFooter( xModel, xCurrentText ) )
-+ if( isFooter( xModel ) )
- {
- uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW );
- sal_Bool isShared = sal_False;
-@@ -158,18 +189,18 @@ sal_Bool HeaderFooterHelper::isEvenPagesFooter( const uno::Reference< frame::XMo
- #ifdef TOMORROW
- sal_Bool HeaderFooterHelper::isPrimaryHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
- {
-- if( isHeader( xModel, xCurrentText ) )
-+ if( isHeader( xModel ) )
- {
-- return( !( isFirstPageHeader( xModel, xCurrentText ) && isEvenPagesHeader( xModel, xCurrentText ) ) );
-+ return( !( isFirstPageHeader( xModel ) && isEvenPagesHeader( xModel ) ) );
- }
- return sal_False;
- }
-
--sal_Bool HeaderFooterHelper::isPrimaryFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
-+sal_Bool HeaderFooterHelper::isPrimaryFooter( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
- {
-- if( isHeader( xModel, xCurrentText ) )
-+ if( isHeader( xModel ) )
- {
-- return( !( isFirstPageFooter( xModel, xCurrentText ) && isEvenPagesFooter( xModel, xCurrentText ) ) );
-+ return( !( isFirstPageFooter( xModel ) && isEvenPagesFooter( xModel ) ) );
- }
- return sal_False;
- }
-diff --git sw/source/ui/vba/vbaheaderfooterhelper.hxx sw/source/ui/vba/vbaheaderfooterhelper.hxx
-index 0e5fd4c..dbcd53d 100644
---- sw/source/ui/vba/vbaheaderfooterhelper.hxx
-+++ sw/source/ui/vba/vbaheaderfooterhelper.hxx
-@@ -36,12 +36,16 @@
- class HeaderFooterHelper
- {
- public:
-- static sal_Bool isHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-- static sal_Bool isFirstPageHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-- static sal_Bool isEvenPagesHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-- static sal_Bool isFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-- static sal_Bool isFirstPageFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-- static sal_Bool isEvenPagesFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-+ static sal_Bool isHeaderFooter( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
-+ static sal_Bool isHeaderFooter( const css::uno::Reference< css::text::XText >& xText ) throw (css::uno::RuntimeException);
-+ static sal_Bool isHeader( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
-+ static sal_Bool isFirstPageHeader( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
-+ static sal_Bool isEvenPagesHeader( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
-+ static sal_Bool isFooter( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
-+ static sal_Bool isFirstPageFooter( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
-+ static sal_Bool isEvenPagesFooter( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
-+ static sal_Bool isPrimaryHeader( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
-+ static sal_Bool isPrimaryFooter( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
- #ifdef TOMORROW
- static sal_Bool isPrimaryHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
- static sal_Bool isPrimaryFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-diff --git sw/source/ui/vba/vbaheadersfooters.cxx sw/source/ui/vba/vbaheadersfooters.cxx
-new file mode 100644
-index 0000000..295314a
---- /dev/null
-+++ sw/source/ui/vba/vbaheadersfooters.cxx
-@@ -0,0 +1,150 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbaheadersfooters.hxx"
-+#include "vbaheaderfooter.hxx"
-+#include <ooo/vba/word/WdHeaderFooterIndex.hpp>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+// I assume there is only one headersfooters in Writer
-+typedef ::cppu::WeakImplHelper1<container::XIndexAccess > HeadersFootersIndexAccess_Base;
-+class HeadersFootersIndexAccess : public HeadersFootersIndexAccess_Base
-+{
-+private:
-+ uno::Reference< XHelperInterface > mxParent;
-+ uno::Reference< uno::XComponentContext > mxContext;
-+ uno::Reference< frame::XModel > mxModel;
-+ uno::Reference< beans::XPropertySet > mxPageStyleProps;
-+ sal_Bool mbHeader;
-+
-+public:
-+ HeadersFootersIndexAccess( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< beans::XPropertySet >& xPageStyleProps, sal_Bool bHeader ) : mxParent( xParent ), mxContext( xContext ), mxModel( xModel ), mxPageStyleProps( xPageStyleProps ), mbHeader( bHeader ) {}
-+ ~HeadersFootersIndexAccess(){}
-+
-+ // XIndexAccess
-+ virtual sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
-+ {
-+ // first page, evenpages and primary page
-+ return 3;
-+ }
-+ virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if( Index < 1 || Index > 3 )
-+ throw container::NoSuchElementException();
-+ return uno::makeAny( uno::Reference< word::XHeaderFooter >( new SwVbaHeaderFooter( mxParent, mxContext, mxModel, mxPageStyleProps, mbHeader, Index ) ) );
-+ }
-+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
-+ {
-+ return word::XHeaderFooter::static_type(0);
-+ }
-+ virtual sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
-+ {
-+ return sal_True;
-+ }
-+};
-+
-+class HeadersFootersEnumWrapper : public EnumerationHelper_BASE
-+{
-+ SwVbaHeadersFooters* pHeadersFooters;
-+ sal_Int32 nIndex;
-+public:
-+ HeadersFootersEnumWrapper( SwVbaHeadersFooters* _pHeadersFooters ) : pHeadersFooters( _pHeadersFooters ), nIndex( 0 ) {}
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( nIndex < pHeadersFooters->getCount() );
-+ }
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( nIndex < pHeadersFooters->getCount() )
-+ return pHeadersFooters->Item( uno::makeAny( ++nIndex ), uno::Any() );
-+ throw container::NoSuchElementException();
-+ }
-+};
-+
-+SwVbaHeadersFooters::SwVbaHeadersFooters( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< beans::XPropertySet >& xPageStyleProps, sal_Bool isHeader ): SwVbaHeadersFooters_BASE( xParent, xContext, new HeadersFootersIndexAccess( xParent, xContext, xModel, xPageStyleProps, isHeader ) ), mxModel( xModel ), mxPageStyleProps( xPageStyleProps ), mbHeader( isHeader )
-+{
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaHeadersFooters::getCount() throw (uno::RuntimeException)
-+{
-+ // wdHeaderFooterFirstPage, wdHeaderFooterPrimary and wdHeaderFooterEvenPages
-+ return 3;
-+}
-+
-+uno::Any SAL_CALL SwVbaHeadersFooters::Item( const uno::Any& Index1, const uno::Any& ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nIndex = 0;
-+ Index1 >>= nIndex;
-+ if( ( nIndex < 1 ) || ( nIndex > 3 ) )
-+ {
-+ throw container::NoSuchElementException();
-+ }
-+ return uno::makeAny( uno::Reference< word::XHeaderFooter >( new SwVbaHeaderFooter( this, mxContext, mxModel, mxPageStyleProps, mbHeader, nIndex ) ) );
-+}
-+
-+// XEnumerationAccess
-+uno::Type
-+SwVbaHeadersFooters::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XHeaderFooter::static_type(0);
-+}
-+uno::Reference< container::XEnumeration >
-+
-+SwVbaHeadersFooters::createEnumeration() throw (uno::RuntimeException)
-+{
-+ return new HeadersFootersEnumWrapper( this );
-+}
-+
-+uno::Any
-+SwVbaHeadersFooters::createCollectionObject( const uno::Any& aSource )
-+{
-+ return aSource;
-+}
-+
-+rtl::OUString&
-+SwVbaHeadersFooters::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaHeadersFooters") );
-+ return sImplName;
-+}
-+
-+uno::Sequence<rtl::OUString>
-+SwVbaHeadersFooters::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.HeadersFooters") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbaheadersfooters.hxx sw/source/ui/vba/vbaheadersfooters.hxx
-new file mode 100644
-index 0000000..9bd7683
---- /dev/null
-+++ sw/source/ui/vba/vbaheadersfooters.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:
-+ * $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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_HEADERSFOOTERS_HXX
-+#define SW_VBA_HEADERSFOOTERS_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XHeadersFooters.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+
-+typedef CollTestImplHelper< ooo::vba::word::XHeadersFooters > SwVbaHeadersFooters_BASE;
-+
-+class SwVbaHeadersFooters : public SwVbaHeadersFooters_BASE
-+{
-+private:
-+ css::uno::Reference< css::frame::XModel > mxModel;
-+ css::uno::Reference< css::beans::XPropertySet > mxPageStyleProps;
-+ sal_Bool mbHeader;
-+
-+public:
-+ SwVbaHeadersFooters( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::beans::XPropertySet >& xProps, sal_Bool isHeader );
-+ virtual ~SwVbaHeadersFooters() {}
-+
-+ virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index1, const css::uno::Any& )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);
-+
-+ // SwVbaHeadersFooters_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* SW_VBA_HEADERSFOOTERS_HXX */
-diff --git sw/source/ui/vba/vbalistformat.cxx sw/source/ui/vba/vbalistformat.cxx
-new file mode 100644
-index 0000000..05d9380
---- /dev/null
-+++ sw/source/ui/vba/vbalistformat.cxx
-@@ -0,0 +1,121 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbalistformat.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include <ooo/vba/word/WdListApplyTo.hpp>
-+#include <ooo/vba/word/WdDefaultListBehavior.hpp>
-+#include <com/sun/star/container/XEnumerationAccess.hpp>
-+#include <com/sun/star/container/XEnumeration.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include "vbalisttemplate.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaListFormat::SwVbaListFormat( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextRange >& xTextRange ) throw ( uno::RuntimeException ) : SwVbaListFormat_BASE( rParent, rContext ), mxTextRange( xTextRange )
-+{
-+}
-+
-+SwVbaListFormat::~SwVbaListFormat()
-+{
-+}
-+
-+void SAL_CALL SwVbaListFormat::ApplyListTemplate( const css::uno::Reference< word::XListTemplate >& ListTemplate, const css::uno::Any& ContinuePreviousList, const css::uno::Any& ApplyTo, const css::uno::Any& DefaultListBehavior ) throw (css::uno::RuntimeException)
-+{
-+ sal_Bool bContinuePreviousList = sal_True;
-+ if( ContinuePreviousList.hasValue() )
-+ ContinuePreviousList >>= bContinuePreviousList;
-+
-+ // "applyto" must be current selection
-+ sal_Int32 bApplyTo = word::WdListApplyTo::wdListApplyToSelection;
-+ if( ApplyTo.hasValue() )
-+ ApplyTo >>= bApplyTo;
-+ if( bApplyTo != word::WdListApplyTo::wdListApplyToSelection )
-+ throw uno::RuntimeException();
-+
-+ // default behaviour must be wdWord8ListBehavior
-+ sal_Int32 nDefaultListBehavior = word::WdDefaultListBehavior::wdWord8ListBehavior;
-+ if( DefaultListBehavior.hasValue() )
-+ DefaultListBehavior >>= nDefaultListBehavior;
-+ if( nDefaultListBehavior != word::WdDefaultListBehavior::wdWord8ListBehavior )
-+ throw uno::RuntimeException();
-+
-+ SwVbaListTemplate* pListTemplate = dynamic_cast< SwVbaListTemplate* >( ListTemplate.get() );
-+
-+ uno::Reference< container::XEnumerationAccess > xEnumAccess( mxTextRange, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XEnumeration > xEnum = xEnumAccess->createEnumeration();
-+ sal_Bool isFirstElement = sal_True;
-+ while( xEnum->hasMoreElements() )
-+ {
-+ uno::Reference< beans::XPropertySet > xProps( xEnum->nextElement(), uno::UNO_QUERY_THROW );
-+ if( isFirstElement )
-+ {
-+ sal_Bool isNumberingRestart = !bContinuePreviousList;
-+ xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaIsNumberingRestart") ), uno::makeAny( isNumberingRestart ) );
-+ if( isNumberingRestart )
-+ {
-+ sal_Int16 nStartValue = 1;
-+ xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingStartValue") ), uno::makeAny( nStartValue ) );
-+ }
-+ isFirstElement = sal_False;
-+ }
-+ else
-+ {
-+ xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaIsNumberingRestart") ), uno::makeAny( sal_False ) );
-+ }
-+ pListTemplate->applyListTemplate( xProps );
-+ }
-+}
-+
-+void SAL_CALL SwVbaListFormat::ConvertNumbersToText( ) throw (css::uno::RuntimeException)
-+{
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+}
-+
-+rtl::OUString&
-+SwVbaListFormat::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaListFormat") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaListFormat::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ListFormat" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbalistformat.hxx sw/source/ui/vba/vbalistformat.hxx
-new file mode 100644
-index 0000000..184312a
---- /dev/null
-+++ sw/source/ui/vba/vbalistformat.hxx
-@@ -0,0 +1,60 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_LISTFORMAT_HXX
-+#define SW_VBA_LISTFORMAT_HXX
-+
-+#include <ooo/vba/word/XListFormat.hpp>
-+#include <ooo/vba/word/XListTemplate.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/text/XTextRange.hpp>
-+#include "vbalisthelper.hxx"
-+
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XListFormat > SwVbaListFormat_BASE;
-+
-+class SwVbaListFormat : public SwVbaListFormat_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XTextRange > mxTextRange;
-+
-+public:
-+ SwVbaListFormat( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextRange >& xTextRange ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaListFormat();
-+
-+ // Methods
-+ virtual void SAL_CALL ApplyListTemplate( const css::uno::Reference< ::ooo::vba::word::XListTemplate >& ListTemplate, const css::uno::Any& ContinuePreviousList, const css::uno::Any& ApplyTo, const css::uno::Any& DefaultListBehavior ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL ConvertNumbersToText( ) throw (css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_LISTFORMAT_HXX */
-diff --git sw/source/ui/vba/vbalistgalleries.cxx sw/source/ui/vba/vbalistgalleries.cxx
-new file mode 100644
-index 0000000..ff09ae2
---- /dev/null
-+++ sw/source/ui/vba/vbalistgalleries.cxx
-@@ -0,0 +1,115 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbalistgalleries.hxx"
-+#include "vbalistgallery.hxx"
-+#include <ooo/vba/word/WdListGalleryType.hpp>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+class ListGalleriesEnumWrapper : public EnumerationHelper_BASE
-+{
-+ SwVbaListGalleries* pListGalleries;
-+ sal_Int32 nIndex;
-+public:
-+ ListGalleriesEnumWrapper( SwVbaListGalleries* pGalleries ) : pListGalleries( pGalleries ), nIndex( 1 ) {}
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( nIndex <= pListGalleries->getCount() );
-+ }
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( nIndex <= pListGalleries->getCount() )
-+ return pListGalleries->Item( uno::makeAny( nIndex++ ), uno::Any() );
-+ throw container::NoSuchElementException();
-+ }
-+};
-+
-+SwVbaListGalleries::SwVbaListGalleries( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextDocument >& xTextDoc ) throw (uno::RuntimeException) : SwVbaListGalleries_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >() ), mxTextDocument( xTextDoc )
-+{
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaListGalleries::getCount() throw (uno::RuntimeException)
-+{
-+ // 3 types of list( bullet, numbered and outline )
-+ return 3;
-+}
-+
-+uno::Any SAL_CALL SwVbaListGalleries::Item( const uno::Any& Index1, const uno::Any& /*not processed in this base class*/ ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nIndex = 0;
-+ if( ( Index1 >>= nIndex ) == sal_True )
-+ {
-+ if( nIndex == word::WdListGalleryType::wdBulletGallery
-+ || nIndex == word::WdListGalleryType::wdNumberGallery
-+ || nIndex == word::WdListGalleryType::wdOutlineNumberGallery )
-+ return uno::makeAny( uno::Reference< word::XListGallery >( new SwVbaListGallery( this, mxContext, mxTextDocument, nIndex ) ) );
-+ }
-+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Index out of bounds") ), uno::Reference< uno::XInterface >() );
-+}
-+
-+// XEnumerationAccess
-+uno::Type
-+SwVbaListGalleries::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XListGallery::static_type(0);
-+}
-+
-+uno::Reference< container::XEnumeration >
-+SwVbaListGalleries::createEnumeration() throw (uno::RuntimeException)
-+{
-+ return new ListGalleriesEnumWrapper( this );
-+}
-+
-+uno::Any
-+SwVbaListGalleries::createCollectionObject( const css::uno::Any& aSource )
-+{
-+ return aSource;
-+}
-+
-+rtl::OUString&
-+SwVbaListGalleries::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaListGalleries") );
-+ return sImplName;
-+}
-+
-+css::uno::Sequence<rtl::OUString>
-+SwVbaListGalleries::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ListGalleries") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbalistgalleries.hxx sw/source/ui/vba/vbalistgalleries.hxx
-new file mode 100644
-index 0000000..36cd0ba
---- /dev/null
-+++ sw/source/ui/vba/vbalistgalleries.hxx
-@@ -0,0 +1,61 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_LISTGALLERIES_HXX
-+#define SW_VBA_LISTGALLERIES_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XListGalleries.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+
-+typedef CollTestImplHelper< ooo::vba::word::XListGalleries > SwVbaListGalleries_BASE;
-+
-+class SwVbaListGalleries : public SwVbaListGalleries_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XTextDocument > mxTextDocument;
-+
-+public:
-+ SwVbaListGalleries( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::text::XTextDocument >& xTextDoc ) throw (css::uno::RuntimeException);
-+ virtual ~SwVbaListGalleries() {}
-+
-+ virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException);
-+ 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 );
-+ // 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);
-+
-+ // SwVbaListGalleries_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* SW_VBA_LISTGALLERIES_HXX */
-diff --git sw/source/ui/vba/vbalistgallery.cxx sw/source/ui/vba/vbalistgallery.cxx
-new file mode 100644
-index 0000000..6ac7e7c
---- /dev/null
-+++ sw/source/ui/vba/vbalistgallery.cxx
-@@ -0,0 +1,73 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbalistgallery.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include "vbalisttemplates.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaListGallery::SwVbaListGallery( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& xTextDoc, sal_Int32 nType ) throw ( uno::RuntimeException ) : SwVbaListGallery_BASE( rParent, rContext ), mxTextDocument( xTextDoc ), mnType( nType )
-+{
-+}
-+
-+SwVbaListGallery::~SwVbaListGallery()
-+{
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaListGallery::ListTemplates( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< XCollection > xCol( new SwVbaListTemplates( mxParent, mxContext, mxTextDocument, mnType ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+rtl::OUString&
-+SwVbaListGallery::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaListGallery") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaListGallery::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ListGallery" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbalistgallery.hxx sw/source/ui/vba/vbalistgallery.hxx
-new file mode 100644
-index 0000000..0ece178
---- /dev/null
-+++ sw/source/ui/vba/vbalistgallery.hxx
-@@ -0,0 +1,58 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_LISTGALLERY_HXX
-+#define SW_VBA_LISTGALLERY_HXX
-+
-+#include <ooo/vba/word/XListGallery.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XListGallery > SwVbaListGallery_BASE;
-+
-+class SwVbaListGallery : public SwVbaListGallery_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XTextDocument > mxTextDocument;
-+ sal_Int32 mnType;
-+
-+public:
-+ SwVbaListGallery( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& xTextDoc, sal_Int32 nType ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaListGallery();
-+
-+ // Methods
-+ virtual css::uno::Any SAL_CALL ListTemplates( const css::uno::Any& index ) throw ( css::uno::RuntimeException );
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_LISTGALLERY_HXX */
-diff --git sw/source/ui/vba/vbalisthelper.cxx sw/source/ui/vba/vbalisthelper.cxx
-new file mode 100644
-index 0000000..34cd6be
---- /dev/null
-+++ sw/source/ui/vba/vbalisthelper.cxx
-@@ -0,0 +1,707 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbalisthelper.hxx"
-+#include <tools/diagnose_ex.h>
-+#include <ooo/vba/word/WdListGalleryType.hpp>
-+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
-+#include <com/sun/star/style/NumberingType.hpp>
-+#include <com/sun/star/container/XIndexReplace.hpp>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+static const sal_Int32 LIST_LEVEL_COUNT = 9;
-+
-+static const char WORD_BULLET_GALLERY[] = "WdBullet";
-+static const char WORD_NUMBER_GALLERY[] = "WdNumber";
-+static const char WORD_OUTLINE_NUMBER_GALLERY[] = "WdOutlineNumber";
-+
-+static const char UNO_NAME_ADJUST[] = "Adjust";
-+static const char UNO_NAME_PARENT_NUMBERING[] = "ParentNumbering";
-+static const char UNO_NAME_PREFIX[] = "Prefix";
-+static const char UNO_NAME_SUFFIX[] = "Suffix";
-+static const char UNO_NAME_CHAR_STYLE_NAME[] = "CharStyleName";
-+static const char UNO_NAME_START_WITH[] = "StartWith";
-+static const char UNO_NAME_POSITION_AND_SPACE_MODE[] = "PositionAndSpaceMode";
-+static const char UNO_NAME_LABEL_FOLLOWED_BY[] = "LabelFollowedBy";
-+static const char UNO_NAME_LIST_TAB_STOP_POSITION[] = "ListtabStopPosition";
-+static const char UNO_NAME_FIRST_LINE_INDENT[] = "FirstLineIndent";
-+static const char UNO_NAME_INDENT_AT[] = "IndentAt";
-+static const char UNO_NAME_NUMBERING_TYPE[] = "NumberingType";
-+static const char UNO_NAME_BULLET_ID[] = "BulletId";
-+static const char UNO_NAME_BULLET_CHAR[] = "BulletChar";
-+static const char UNO_NAME_BULLET_FONT_NAME[] = "BulletFontName";
-+static const char UNO_NAME_BULLET_FONT[] = "BulletFont";
-+
-+static const sal_Int16 CHAR_CLOSED_DOT = 8226;
-+static const sal_Int16 CHAR_EMPTY_DOT = 111;
-+static const sal_Int16 CHAR_SQUARE = 9632;
-+static const sal_Int16 CHAR_STAR_SYMBOL = 10026;
-+static const sal_Int16 CHAR_FOUR_DIAMONDS = 10070;
-+static const sal_Int16 CHAR_DIAMOND = 10022;
-+static const sal_Int16 CHAR_ARROW = 10146;
-+static const sal_Int16 CHAR_CHECK_MARK = 10003;
-+
-+SwVbaListHelper::SwVbaListHelper( const css::uno::Reference< css::text::XTextDocument >& xTextDoc, sal_Int32 nGalleryType, sal_Int32 nTemplateType ) throw( css::uno::RuntimeException ) : mxTextDocument( xTextDoc ), mnGalleryType( nGalleryType ), mnTemplateType( nTemplateType )
-+{
-+ Init();
-+}
-+
-+void SwVbaListHelper::Init() throw( css::uno::RuntimeException )
-+{
-+ // set the numbering style name
-+ switch( mnGalleryType )
-+ {
-+ case word::WdListGalleryType::wdBulletGallery:
-+ {
-+ msStyleName = rtl::OUString::createFromAscii( WORD_BULLET_GALLERY );
-+ break;
-+ }
-+ case word::WdListGalleryType::wdNumberGallery:
-+ {
-+ msStyleName = rtl::OUString::createFromAscii( WORD_NUMBER_GALLERY );
-+ break;
-+ }
-+ case word::WdListGalleryType::wdOutlineNumberGallery:
-+ {
-+ msStyleName = rtl::OUString::createFromAscii( WORD_OUTLINE_NUMBER_GALLERY );
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException();
-+ }
-+ }
-+ msStyleName += rtl::OUString::valueOf( mnTemplateType );
-+
-+ // get the numbering style
-+ uno::Reference< style::XStyleFamiliesSupplier > xStyleSupplier( mxTextDocument, uno::UNO_QUERY_THROW );
-+ mxStyleFamily.set( xStyleSupplier->getStyleFamilies()->getByName(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingStyles") ) ), uno::UNO_QUERY_THROW );
-+ OSL_TRACE("SwVbaListHelper::Init: numbering style name: %s", rtl::OUStringToOString( msStyleName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ if( mxStyleFamily->hasByName( msStyleName ) )
-+ {
-+ mxStyleProps.set( mxStyleFamily->getByName( msStyleName ), uno::UNO_QUERY_THROW );
-+ mxNumberingRules.set( mxStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingRules") ) ), uno::UNO_QUERY_THROW );
-+ }
-+ else
-+ {
-+ // create new numbering style
-+ uno::Reference< lang::XMultiServiceFactory > xDocMSF( mxTextDocument, uno::UNO_QUERY_THROW );
-+ mxStyleProps.set( xDocMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.NumberingStyle") ) ), uno::UNO_QUERY_THROW );
-+ // insert this style into style family, or the property NumberingRules doesn't exist.
-+ mxStyleFamily->insertByName( msStyleName, uno::makeAny( mxStyleProps ) );
-+ mxStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingRules") ) ) >>= mxNumberingRules;
-+ //mxNumberingRules.set( xDocMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.NumberingRules") ) ), uno::UNO_QUERY_THROW );
-+
-+ CreateListTemplate();
-+
-+ mxStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingRules") ) , uno::makeAny( mxNumberingRules ) );
-+ }
-+}
-+
-+void SwVbaListHelper::CreateListTemplate() throw( css::uno::RuntimeException )
-+{
-+ switch( mnGalleryType )
-+ {
-+ case word::WdListGalleryType::wdBulletGallery:
-+ {
-+ CreateBulletListTemplate();
-+ break;
-+ }
-+ case word::WdListGalleryType::wdNumberGallery:
-+ {
-+ CreateNumberListTemplate();
-+ break;
-+ }
-+ case word::WdListGalleryType::wdOutlineNumberGallery:
-+ {
-+ CreateOutlineNumberListTemplate();
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException();
-+ }
-+ }
-+}
-+
-+void SwVbaListHelper::CreateBulletListTemplate() throw( css::uno::RuntimeException )
-+{
-+ // there is only 1 level for each bullet list in MSWord
-+ sal_Int32 nLevel = 0;
-+ uno::Sequence< beans::PropertyValue > aPropertyValues;
-+ mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
-+ rtl::OUString sCharStyleName( RTL_CONSTASCII_USTRINGPARAM("Bullet Symbols") );
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_CHAR_STYLE_NAME ), uno::makeAny( sCharStyleName ) );
-+ sal_Int16 nNumberingType = style::NumberingType::CHAR_SPECIAL;
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
-+
-+ rtl::OUString aBulletChar;
-+ switch( mnTemplateType )
-+ {
-+ case 1:
-+ {
-+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_CLOSED_DOT ) );
-+ break;
-+ }
-+ case 2:
-+ {
-+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_EMPTY_DOT ) );
-+ break;
-+ }
-+ case 3:
-+ {
-+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_SQUARE ) );
-+ break;
-+ }
-+ case 4:
-+ {
-+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_STAR_SYMBOL ) );
-+ break;
-+ }
-+ case 5:
-+ {
-+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_FOUR_DIAMONDS ) );
-+ break;
-+ }
-+ case 6:
-+ {
-+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_ARROW ) );
-+ break;
-+ }
-+ case 7:
-+ {
-+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_CHECK_MARK ) );
-+ break;
-+ }
-+ default:
-+ {
-+ // we only support 7 types template now
-+ throw css::uno::RuntimeException();
-+ }
-+ }
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_BULLET_CHAR ), uno::makeAny( aBulletChar ) );
-+
-+ mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
-+}
-+
-+void SwVbaListHelper::CreateNumberListTemplate() throw( css::uno::RuntimeException )
-+{
-+ // there is only 1 level for each bullet list in MSWord
-+ sal_Int32 nLevel = 0;
-+ uno::Sequence< beans::PropertyValue > aPropertyValues;
-+ mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
-+
-+ sal_Int16 nNumberingType = 0;
-+ rtl::OUString sSuffix;
-+ switch( mnTemplateType )
-+ {
-+ case 1:
-+ {
-+ nNumberingType = style::NumberingType::ARABIC;
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ case 2:
-+ {
-+ nNumberingType = style::NumberingType::ARABIC;
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 3:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_UPPER;
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ case 4:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_UPPER_LETTER;
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ case 5:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 6:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ case 7:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_LOWER;
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ default:
-+ {
-+ // we only support 7 types template now
-+ throw css::uno::RuntimeException();
-+ }
-+ }
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_SUFFIX ), uno::makeAny( sSuffix ) );
-+
-+ mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
-+}
-+
-+void SwVbaListHelper::CreateOutlineNumberListTemplate() throw( css::uno::RuntimeException )
-+{
-+ switch( mnTemplateType )
-+ {
-+ case 1:
-+ {
-+ CreateOutlineNumberForType1();
-+ break;
-+ }
-+ case 2:
-+ {
-+ CreateOutlineNumberForType2();
-+ break;
-+ }
-+ case 3:
-+ {
-+ CreateOutlineNumberForType3();
-+ break;
-+ }
-+ case 4:
-+ {
-+ CreateOutlineNumberForType4();
-+ break;
-+ }
-+ case 5:
-+ {
-+ CreateOutlineNumberForType5();
-+ break;
-+ }
-+ case 6:
-+ {
-+ CreateOutlineNumberForType6();
-+ break;
-+ }
-+ case 7:
-+ {
-+ CreateOutlineNumberForType7();
-+ break;
-+ }
-+ default:
-+ {
-+ // we only support 7 types template now
-+ throw css::uno::RuntimeException();
-+ }
-+ }
-+}
-+
-+void SwVbaListHelper::CreateOutlineNumberForType1() throw( css::uno::RuntimeException )
-+{
-+ sal_Int16 nNumberingType = 0;
-+ rtl::OUString sPrefix;
-+ rtl::OUString sSuffix;
-+ uno::Sequence< beans::PropertyValue > aPropertyValues;
-+
-+ for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
-+ {
-+ mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
-+ switch( nLevel )
-+ {
-+ case 0:
-+ case 1:
-+ {
-+ nNumberingType = style::NumberingType::ARABIC;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 2:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_LOWER;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 3:
-+ {
-+ nNumberingType = style::NumberingType::ARABIC;
-+ sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 4:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
-+ sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 5:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_LOWER;
-+ sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 6:
-+ {
-+ nNumberingType = style::NumberingType::ARABIC;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ case 7:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ case 8:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_LOWER;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException();
-+ }
-+ }
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_PREFIX ), uno::makeAny( sPrefix ) );
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_SUFFIX ), uno::makeAny( sSuffix ) );
-+ mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
-+ }
-+}
-+
-+void SwVbaListHelper::CreateOutlineNumberForType2() throw( css::uno::RuntimeException )
-+{
-+ sal_Int16 nNumberingType = style::NumberingType::ARABIC;
-+ sal_Int16 nParentNumbering = 0;
-+ rtl::OUString sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ uno::Sequence< beans::PropertyValue > aPropertyValues;
-+
-+ for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
-+ {
-+ mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_SUFFIX ), uno::makeAny( sSuffix ) );
-+ if( nLevel != 0 )
-+ {
-+ nParentNumbering = sal_Int16( nLevel - 1 );
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_PARENT_NUMBERING ), uno::makeAny( nParentNumbering ) );
-+ }
-+ mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
-+ }
-+}
-+
-+void SwVbaListHelper::CreateOutlineNumberForType3() throw( css::uno::RuntimeException )
-+{
-+ sal_Int16 nNumberingType = style::NumberingType::CHAR_SPECIAL;
-+ rtl::OUString sCharStyleName( RTL_CONSTASCII_USTRINGPARAM("Bullet Symbols") );
-+ rtl::OUString aBulletChar;
-+ uno::Sequence< beans::PropertyValue > aPropertyValues;
-+
-+ for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
-+ {
-+ mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_CHAR_STYLE_NAME ), uno::makeAny( sCharStyleName ) );
-+ switch( nLevel )
-+ {
-+ case 0:
-+ {
-+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_FOUR_DIAMONDS ) );
-+ break;
-+ }
-+ case 1:
-+ case 5:
-+ {
-+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_ARROW ) );
-+ break;
-+ }
-+ case 2:
-+ case 6:
-+ {
-+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_SQUARE ) );
-+ break;
-+ }
-+ case 3:
-+ case 7:
-+ {
-+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_CLOSED_DOT ) );
-+ break;
-+ }
-+ case 4:
-+ case 8:
-+ {
-+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_DIAMOND ) );
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException();
-+ }
-+ }
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_BULLET_CHAR ), uno::makeAny( aBulletChar ) );
-+ mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
-+ }
-+}
-+
-+void SwVbaListHelper::CreateOutlineNumberForType4() throw( css::uno::RuntimeException )
-+{
-+ sal_Int16 nNumberingType = 0;
-+ rtl::OUString sPrefix;
-+ rtl::OUString sSuffix;
-+ uno::Sequence< beans::PropertyValue > aPropertyValues;
-+
-+ for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
-+ {
-+ mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
-+ switch( nLevel )
-+ {
-+ case 0:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_UPPER;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ case 1:
-+ {
-+ nNumberingType = style::NumberingType::ARABIC;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ sal_Int16 nParentNumbering = 0;
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_PARENT_NUMBERING ), uno::makeAny( nParentNumbering ) );
-+ break;
-+ }
-+ case 2:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
-+ sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 3:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_LOWER;
-+ sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 4:
-+ {
-+ nNumberingType = style::NumberingType::ARABIC;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 5:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 6:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_LOWER;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 7:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ case 8:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_LOWER;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException();
-+ }
-+ }
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_PREFIX ), uno::makeAny( sPrefix ) );
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_SUFFIX ), uno::makeAny( sSuffix ) );
-+ mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
-+ }
-+}
-+
-+void SwVbaListHelper::CreateOutlineNumberForType5() throw( css::uno::RuntimeException )
-+{
-+ sal_Int16 nNumberingType = style::NumberingType::ARABIC;
-+ sal_Int16 nParentNumbering = 0;
-+ uno::Sequence< beans::PropertyValue > aPropertyValues;
-+
-+ for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
-+ {
-+ mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
-+ if( nLevel != 0 )
-+ {
-+ nParentNumbering = sal_Int16( nLevel - 1 );
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_PARENT_NUMBERING ), uno::makeAny( nParentNumbering ) );
-+ }
-+ mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
-+ }
-+}
-+
-+void SwVbaListHelper::CreateOutlineNumberForType6() throw( css::uno::RuntimeException )
-+{
-+ sal_Int16 nNumberingType = 0;
-+ rtl::OUString sPrefix;
-+ rtl::OUString sSuffix;
-+ uno::Sequence< beans::PropertyValue > aPropertyValues;
-+
-+ for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
-+ {
-+ mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
-+ switch( nLevel )
-+ {
-+ case 0:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_UPPER;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ case 1:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_UPPER_LETTER;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ case 2:
-+ {
-+ nNumberingType = style::NumberingType::ARABIC;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 3:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 4:
-+ {
-+ nNumberingType = style::NumberingType::ARABIC;
-+ sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 5:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
-+ sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 6:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_LOWER;
-+ sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 7:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
-+ sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ case 8:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_LOWER;
-+ sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException();
-+ }
-+ }
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_PREFIX ), uno::makeAny( sPrefix ) );
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_SUFFIX ), uno::makeAny( sSuffix ) );
-+ mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
-+ }
-+}
-+
-+void SwVbaListHelper::CreateOutlineNumberForType7() throw( css::uno::RuntimeException )
-+{
-+ sal_Int16 nNumberingType = style::NumberingType::ARABIC;
-+ uno::Sequence< beans::PropertyValue > aPropertyValues;
-+ rtl::OUString sPrefix = rtl::OUString::createFromAscii("Chapter ");
-+
-+ for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
-+ {
-+ mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_PREFIX ), uno::makeAny( sPrefix ) );
-+ mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
-+ }
-+}
-+
-+uno::Any SwVbaListHelper::getPropertyValueWithNameAndLevel( sal_Int32 nLevel, const rtl::OUString& sName ) throw( css::uno::RuntimeException )
-+{
-+ uno::Sequence< beans::PropertyValue > aPropertyValues;
-+ mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
-+ return getPropertyValue( aPropertyValues, sName );
-+}
-+
-+void SwVbaListHelper::setPropertyValueWithNameAndLevel( sal_Int32 nLevel, const rtl::OUString& sName, const css::uno::Any& aValue ) throw( css::uno::RuntimeException )
-+{
-+ uno::Sequence< beans::PropertyValue > aPropertyValues;
-+ mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
-+ setOrAppendPropertyValue( aPropertyValues, sName, aValue );
-+ mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
-+ mxStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingRules") ) , uno::makeAny( mxNumberingRules ) );
-+}
-+
-diff --git sw/source/ui/vba/vbalisthelper.hxx sw/source/ui/vba/vbalisthelper.hxx
-new file mode 100644
-index 0000000..0f5fa26
---- /dev/null
-+++ sw/source/ui/vba/vbalisthelper.hxx
-@@ -0,0 +1,82 @@
-+/*************************************************************************
-+ *
-+ * 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 SW_VBA_LISTHELPER_HXX
-+#define SW_VBA_LISTHELPER_HXX
-+
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/container/XIndexReplace.hpp>
-+#include <com/sun/star/container/XNameContainer.hpp>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include <boost/shared_ptr.hpp>
-+
-+
-+class SwVbaListHelper;
-+typedef ::boost::shared_ptr< SwVbaListHelper > SwVbaListHelperRef;
-+
-+class SwVbaListHelper
-+{
-+private:
-+ css::uno::Reference< css::text::XTextDocument > mxTextDocument;
-+ css::uno::Reference< css::container::XIndexReplace > mxNumberingRules;
-+ css::uno::Reference< css::container::XNameContainer > mxStyleFamily;
-+ css::uno::Reference< css::beans::XPropertySet > mxStyleProps;
-+ sal_Int32 mnGalleryType;
-+ sal_Int32 mnTemplateType;
-+ rtl::OUString msStyleName;
-+
-+ void Init() throw( css::uno::RuntimeException );
-+ void CreateListTemplate() throw( css::uno::RuntimeException );
-+ void CreateBulletListTemplate() throw( css::uno::RuntimeException );
-+ void CreateNumberListTemplate() throw( css::uno::RuntimeException );
-+ void CreateOutlineNumberListTemplate() throw( css::uno::RuntimeException );
-+ void CreateOutlineNumberForType1() throw( css::uno::RuntimeException );
-+ void CreateOutlineNumberForType2() throw( css::uno::RuntimeException );
-+ void CreateOutlineNumberForType3() throw( css::uno::RuntimeException );
-+ void CreateOutlineNumberForType4() throw( css::uno::RuntimeException );
-+ void CreateOutlineNumberForType5() throw( css::uno::RuntimeException );
-+ void CreateOutlineNumberForType6() throw( css::uno::RuntimeException );
-+ void CreateOutlineNumberForType7() throw( css::uno::RuntimeException );
-+
-+public:
-+ SwVbaListHelper( const css::uno::Reference< css::text::XTextDocument >& xTextDoc, sal_Int32 nGalleryType, sal_Int32 nTemplateType ) throw( css::uno::RuntimeException );
-+
-+ sal_Int32 getGalleryType() { return mnGalleryType; }
-+ css::uno::Reference< css::container::XIndexReplace > getNumberingRules() { return mxNumberingRules; }
-+ css::uno::Any getPropertyValueWithNameAndLevel( sal_Int32 nLevel, const rtl::OUString& sName ) throw( css::uno::RuntimeException );
-+ void setPropertyValueWithNameAndLevel( sal_Int32 nLevel, const rtl::OUString& sName, const css::uno::Any& aValue ) throw( css::uno::RuntimeException );
-+
-+};
-+
-+#endif//SW_VBA_LISTHELPER_HXX
-diff --git sw/source/ui/vba/vbalistlevel.cxx sw/source/ui/vba/vbalistlevel.cxx
-new file mode 100644
-index 0000000..7a769ac
---- /dev/null
-+++ sw/source/ui/vba/vbalistlevel.cxx
-@@ -0,0 +1,401 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbalistlevel.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include <com/sun/star/style/NumberingType.hpp>
-+#include <ooo/vba/word/WdListNumberStyle.hpp>
-+#include <ooo/vba/word/WdTrailingCharacter.hpp>
-+#include <com/sun/star/text/HoriOrientation.hpp>
-+#include <ooo/vba/word/WdListLevelAlignment.hpp>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaListLevel::SwVbaListLevel( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, SwVbaListHelperRef pHelper, sal_Int32 nLevel ) throw ( uno::RuntimeException ) : SwVbaListLevel_BASE( rParent, rContext ), pListHelper( pHelper ), mnLevel( nLevel )
-+{
-+}
-+
-+SwVbaListLevel::~SwVbaListLevel()
-+{
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaListLevel::getAlignment() throw (uno::RuntimeException)
-+{
-+ sal_Int16 nAlignment = 0;
-+ pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Adjust") ) ) >>= nAlignment;
-+ switch( nAlignment )
-+ {
-+ case text::HoriOrientation::LEFT:
-+ {
-+ nAlignment = word::WdListLevelAlignment::wdListLevelAlignLeft;
-+ break;
-+ }
-+ case text::HoriOrientation::RIGHT:
-+ {
-+ nAlignment = word::WdListLevelAlignment::wdListLevelAlignRight;
-+ break;
-+ }
-+ case text::HoriOrientation::CENTER:
-+ {
-+ nAlignment = word::WdListLevelAlignment::wdListLevelAlignCenter;
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException();
-+ }
-+ }
-+ return nAlignment;
-+}
-+
-+void SAL_CALL SwVbaListLevel::setAlignment( ::sal_Int32 _alignment ) throw (uno::RuntimeException)
-+{
-+ sal_Int16 nAlignment = text::HoriOrientation::LEFT;
-+ switch( _alignment )
-+ {
-+ case word::WdListLevelAlignment::wdListLevelAlignLeft:
-+ {
-+ nAlignment = text::HoriOrientation::LEFT;
-+ break;
-+ }
-+ case word::WdListLevelAlignment::wdListLevelAlignRight:
-+ {
-+ nAlignment = text::HoriOrientation::RIGHT;
-+ break;
-+ }
-+ case word::WdListLevelAlignment::wdListLevelAlignCenter:
-+ {
-+ nAlignment = text::HoriOrientation::CENTER;
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException();
-+ }
-+ }
-+ pListHelper->setPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Adjust") ), uno::makeAny( nAlignment ) );
-+}
-+
-+uno::Reference< ::ooo::vba::word::XFont > SAL_CALL SwVbaListLevel::getFont() throw (uno::RuntimeException)
-+{
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ return uno::Reference< word::XFont >();
-+}
-+
-+void SAL_CALL SwVbaListLevel::setFont( const uno::Reference< ::ooo::vba::word::XFont >& /*_font*/ ) throw (uno::RuntimeException)
-+{
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaListLevel::getIndex() throw (uno::RuntimeException)
-+{
-+ return mnLevel + 1;
-+}
-+
-+::rtl::OUString SAL_CALL SwVbaListLevel::getLinkedStyle() throw (uno::RuntimeException)
-+{
-+ // TODO:
-+ return rtl::OUString();
-+}
-+
-+void SAL_CALL SwVbaListLevel::setLinkedStyle( const ::rtl::OUString& /*_linkedstyle*/ ) throw (uno::RuntimeException)
-+{
-+ // TODO:
-+}
-+
-+::rtl::OUString SAL_CALL SwVbaListLevel::getNumberFormat() throw (uno::RuntimeException)
-+{
-+ // TODO::
-+ return rtl::OUString();
-+}
-+
-+void SAL_CALL SwVbaListLevel::setNumberFormat( const ::rtl::OUString& /*_numberformat*/ ) throw (uno::RuntimeException)
-+{
-+ // TODO::
-+}
-+
-+float SAL_CALL SwVbaListLevel::getNumberPosition() throw (uno::RuntimeException)
-+{
-+ // indentAt + firstlineindent
-+ sal_Int32 nIndentAt = 0;
-+ sal_Int32 nFirstLineIndent = 0;
-+ pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IndentAt") ) ) >>= nIndentAt;
-+ pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FirstLineIndent") ) ) >>= nFirstLineIndent;
-+
-+ sal_Int32 nResult = nIndentAt + nFirstLineIndent;
-+
-+ return static_cast< float >( Millimeter::getInPoints( nResult ) );
-+}
-+
-+void SAL_CALL SwVbaListLevel::setNumberPosition( float _numberposition ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nNumberPosition = Millimeter::getInHundredthsOfOneMillimeter( _numberposition );
-+
-+ sal_Int32 nIndentAt = 0;
-+ pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IndentAt") ) ) >>= nIndentAt;
-+
-+ sal_Int32 nFirstLineIndent = nNumberPosition - nIndentAt;
-+ pListHelper->setPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FirstLineIndent") ), uno::makeAny( nFirstLineIndent ) );
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaListLevel::getNumberStyle() throw (uno::RuntimeException)
-+{
-+ sal_Int16 nNumberingType = 0;
-+ pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingType") ) ) >>= nNumberingType;
-+ switch( nNumberingType )
-+ {
-+ case style::NumberingType::CHAR_SPECIAL:
-+ {
-+ nNumberingType = word::WdListNumberStyle::wdListNumberStyleBullet;
-+ break;
-+ }
-+ case style::NumberingType::CHARS_UPPER_LETTER:
-+ {
-+ nNumberingType = word::WdListNumberStyle::wdListNumberStyleUppercaseLetter;
-+ break;
-+ }
-+ case style::NumberingType::CHARS_LOWER_LETTER:
-+ {
-+ nNumberingType = word::WdListNumberStyle::wdListNumberStyleLowercaseLetter;
-+ break;
-+ }
-+ case style::NumberingType::ROMAN_UPPER:
-+ {
-+ nNumberingType = word::WdListNumberStyle::wdListNumberStyleUppercaseRoman;
-+ break;
-+ }
-+ case style::NumberingType::ROMAN_LOWER:
-+ {
-+ nNumberingType = word::WdListNumberStyle::wdListNumberStyleLowercaseRoman;
-+ break;
-+ }
-+ case style::NumberingType::ARABIC:
-+ {
-+ nNumberingType = word::WdListNumberStyle::wdListNumberStyleArabic;
-+ break;
-+ }
-+ case style::NumberingType::NUMBER_NONE:
-+ {
-+ nNumberingType = word::WdListNumberStyle::wdListNumberStyleNone;
-+ break;
-+ }
-+ case style::NumberingType::FULLWIDTH_ARABIC:
-+ {
-+ nNumberingType = word::WdListNumberStyle::wdListNumberStyleArabicFullWidth;
-+ break;
-+ }
-+ case style::NumberingType::CIRCLE_NUMBER:
-+ {
-+ nNumberingType = word::WdListNumberStyle::wdListNumberStyleNumberInCircle;
-+ break;
-+ }
-+ case style::NumberingType::CHARS_ARABIC:
-+ {
-+ nNumberingType = word::WdListNumberStyle::wdListNumberStyleCardinalText;
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+ }
-+ return nNumberingType;
-+}
-+
-+void SAL_CALL SwVbaListLevel::setNumberStyle( ::sal_Int32 _numberstyle ) throw (uno::RuntimeException)
-+{
-+ sal_Int16 nNumberingType = 0;
-+ switch( _numberstyle )
-+ {
-+ case word::WdListNumberStyle::wdListNumberStyleBullet:
-+ {
-+ nNumberingType = style::NumberingType::CHAR_SPECIAL;
-+ break;
-+ }
-+ case word::WdListNumberStyle::wdListNumberStyleUppercaseLetter:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_UPPER_LETTER_N;
-+ break;
-+ }
-+ case word::WdListNumberStyle::wdListNumberStyleLowercaseLetter:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER_N;
-+ break;
-+ }
-+ case word::WdListNumberStyle::wdListNumberStyleUppercaseRoman:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_UPPER;
-+ break;
-+ }
-+ case word::WdListNumberStyle::wdListNumberStyleLowercaseRoman:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_LOWER;
-+ break;
-+ }
-+ case word::WdListNumberStyle::wdListNumberStyleArabic:
-+ {
-+ nNumberingType = style::NumberingType::ARABIC;
-+ break;
-+ }
-+ case word::WdListNumberStyle::wdListNumberStyleNone:
-+ {
-+ nNumberingType = style::NumberingType::NUMBER_NONE;
-+ break;
-+ }
-+ case word::WdListNumberStyle::wdListNumberStyleArabicFullWidth:
-+ {
-+ nNumberingType = style::NumberingType::FULLWIDTH_ARABIC;
-+ break;
-+ }
-+ case word::WdListNumberStyle::wdListNumberStyleNumberInCircle:
-+ {
-+ nNumberingType = style::NumberingType::CIRCLE_NUMBER;
-+ break;
-+ }
-+ case word::WdListNumberStyle::wdListNumberStyleCardinalText:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_ARABIC;
-+ break;
-+ }
-+ case word::WdListNumberStyle::wdListNumberStyleOrdinal:
-+ case word::WdListNumberStyle::wdListNumberStyleOrdinalText:
-+ case word::WdListNumberStyle::wdListNumberStyleKanji:
-+ case word::WdListNumberStyle::wdListNumberStyleKanjiDigit:
-+ case word::WdListNumberStyle::wdListNumberStyleAiueoHalfWidth:
-+ case word::WdListNumberStyle::wdListNumberStyleIrohaHalfWidth:
-+ {
-+ nNumberingType = style::NumberingType::ARABIC;
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+ }
-+
-+ pListHelper->setPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingType") ), uno::makeAny( nNumberingType ) );
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaListLevel::getResetOnHigher() throw (uno::RuntimeException)
-+{
-+ //seems not support?
-+ return 0;
-+}
-+
-+void SAL_CALL SwVbaListLevel::setResetOnHigher( ::sal_Int32 /*_resetonhigher*/ ) throw (uno::RuntimeException)
-+{
-+ //seems not support?
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaListLevel::getStartAt() throw (uno::RuntimeException)
-+{
-+ sal_Int16 nStartWith = 0;
-+ pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StartWith") ) ) >>= nStartWith;
-+ return nStartWith;
-+}
-+
-+void SAL_CALL SwVbaListLevel::setStartAt( ::sal_Int32 _startat ) throw (uno::RuntimeException)
-+{
-+ sal_Int16 nStartWith = (sal_Int16)_startat;
-+ pListHelper->setPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StartWith") ), uno::makeAny( nStartWith ) );
-+}
-+
-+float SAL_CALL SwVbaListLevel::getTabPosition() throw (uno::RuntimeException)
-+{
-+ sal_Int32 nTabPosition = 0;
-+ pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ListtabStopPosition") ) ) >>= nTabPosition;
-+
-+ return static_cast< float >( Millimeter::getInPoints( nTabPosition ) );
-+}
-+
-+void SAL_CALL SwVbaListLevel::setTabPosition( float _tabposition ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nTabPosition = Millimeter::getInHundredthsOfOneMillimeter( _tabposition );
-+ pListHelper->setPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ListtabStopPosition") ), uno::makeAny( nTabPosition ) );
-+}
-+
-+float SAL_CALL SwVbaListLevel::getTextPosition() throw (uno::RuntimeException)
-+{
-+ // indentAt
-+ sal_Int32 nIndentAt = 0;
-+ pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IndentAt") ) ) >>= nIndentAt;
-+
-+ return static_cast< float >( Millimeter::getInPoints( nIndentAt ) );
-+}
-+
-+void SAL_CALL SwVbaListLevel::setTextPosition( float _textposition ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nIndentAt = 0;
-+ sal_Int32 nFirstLineIndent = 0;
-+ pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IndentAt") ) ) >>= nIndentAt;
-+ pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FirstLineIndent") ) ) >>= nFirstLineIndent;
-+
-+ sal_Int32 nAlignedAt = nIndentAt + nFirstLineIndent;
-+
-+ nIndentAt = Millimeter::getInHundredthsOfOneMillimeter( _textposition );
-+ nFirstLineIndent = nAlignedAt - nIndentAt;
-+ pListHelper->setPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IndentAt") ), uno::makeAny( nIndentAt ) );
-+ pListHelper->setPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FirstLineIndent") ), uno::makeAny( nFirstLineIndent ) );
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaListLevel::getTrailingCharacter() throw (uno::RuntimeException)
-+{
-+ sal_Int16 nLabelFollowedBy= 0;
-+ pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LabelFollowedBy") ) ) >>= nLabelFollowedBy;
-+
-+ return nLabelFollowedBy;
-+}
-+
-+void SAL_CALL SwVbaListLevel::setTrailingCharacter( ::sal_Int32 _trailingcharacter ) throw (uno::RuntimeException)
-+{
-+ sal_Int16 nLabelFollowedBy = (sal_Int16)_trailingcharacter;
-+ pListHelper->setPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LabelFollowedBy") ), uno::makeAny( nLabelFollowedBy ) );
-+}
-+
-+rtl::OUString&
-+SwVbaListLevel::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaListLevel") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaListLevel::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ListLevel" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbalistlevel.hxx sw/source/ui/vba/vbalistlevel.hxx
-new file mode 100644
-index 0000000..4bcb147
---- /dev/null
-+++ sw/source/ui/vba/vbalistlevel.hxx
-@@ -0,0 +1,81 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_LISTLEVEL_HXX
-+#define SW_VBA_LISTLEVEL_HXX
-+
-+#include <ooo/vba/word/XListLevel.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include "vbalisthelper.hxx"
-+
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XListLevel > SwVbaListLevel_BASE;
-+
-+class SwVbaListLevel : public SwVbaListLevel_BASE
-+{
-+private:
-+ SwVbaListHelperRef pListHelper;
-+ sal_Int32 mnLevel;
-+
-+public:
-+ SwVbaListLevel( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, SwVbaListHelperRef pHelper, sal_Int32 nLevel ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaListLevel();
-+
-+ // Attributes
-+ virtual ::sal_Int32 SAL_CALL getAlignment() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setAlignment( ::sal_Int32 _alignment ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Reference< ::ooo::vba::word::XFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setFont( const css::uno::Reference< ::ooo::vba::word::XFont >& _font ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getIndex() throw (css::uno::RuntimeException);
-+ virtual ::rtl::OUString SAL_CALL getLinkedStyle() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setLinkedStyle( const ::rtl::OUString& _linkedstyle ) throw (css::uno::RuntimeException);
-+ virtual ::rtl::OUString SAL_CALL getNumberFormat() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setNumberFormat( const ::rtl::OUString& _numberformat ) throw (css::uno::RuntimeException);
-+ virtual float SAL_CALL getNumberPosition() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setNumberPosition( float _numberposition ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getNumberStyle() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setNumberStyle( ::sal_Int32 _numberstyle ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getResetOnHigher() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setResetOnHigher( ::sal_Int32 _resetonhigher ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getStartAt() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setStartAt( ::sal_Int32 _startat ) throw (css::uno::RuntimeException);
-+ virtual float SAL_CALL getTabPosition() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setTabPosition( float _tabposition ) throw (css::uno::RuntimeException);
-+ virtual float SAL_CALL getTextPosition() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setTextPosition( float _textposition ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getTrailingCharacter() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setTrailingCharacter( ::sal_Int32 _trailingcharacter ) throw (css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_LISTLEVEL_HXX */
-diff --git sw/source/ui/vba/vbalistlevels.cxx sw/source/ui/vba/vbalistlevels.cxx
-new file mode 100644
-index 0000000..019b6f5
---- /dev/null
-+++ sw/source/ui/vba/vbalistlevels.cxx
-@@ -0,0 +1,118 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbalistlevels.hxx"
-+#include "vbalistlevel.hxx"
-+#include <ooo/vba/word/WdListGalleryType.hpp>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+class ListLevelsEnumWrapper : public EnumerationHelper_BASE
-+{
-+ SwVbaListLevels* pListLevels;
-+ sal_Int32 nIndex;
-+public:
-+ ListLevelsEnumWrapper( SwVbaListLevels* pLevels ) : pListLevels( pLevels ), nIndex( 1 ) {}
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( nIndex <= pListLevels->getCount() );
-+ }
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( nIndex <= pListLevels->getCount() )
-+ return pListLevels->Item( uno::makeAny( nIndex++ ), uno::Any() );
-+ throw container::NoSuchElementException();
-+ }
-+};
-+
-+SwVbaListLevels::SwVbaListLevels( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, SwVbaListHelperRef pHelper ) throw (uno::RuntimeException) : SwVbaListLevels_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >() ), pListHelper( pHelper )
-+{
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaListLevels::getCount() throw (uno::RuntimeException)
-+{
-+ sal_Int32 nGalleryType = pListHelper->getGalleryType();
-+ if( nGalleryType == word::WdListGalleryType::wdBulletGallery
-+ || nGalleryType == word::WdListGalleryType::wdNumberGallery )
-+ return 1;
-+ else if( nGalleryType == word::WdListGalleryType::wdOutlineNumberGallery )
-+ return 9;
-+ return 0;
-+}
-+
-+uno::Any SAL_CALL SwVbaListLevels::Item( const uno::Any& Index1, const uno::Any& /*not processed in this base class*/ ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nIndex = 0;
-+ if( ( Index1 >>= nIndex ) == sal_False )
-+ throw uno::RuntimeException();
-+ if( nIndex <=0 || nIndex > getCount() )
-+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Index out of bounds") ), uno::Reference< uno::XInterface >() );
-+
-+ return uno::makeAny( uno::Reference< word::XListLevel >( new SwVbaListLevel( this, mxContext, pListHelper, nIndex - 1 ) ) );
-+}
-+
-+// XEnumerationAccess
-+uno::Type
-+SwVbaListLevels::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XListLevel::static_type(0);
-+}
-+
-+uno::Reference< container::XEnumeration >
-+SwVbaListLevels::createEnumeration() throw (uno::RuntimeException)
-+{
-+ return new ListLevelsEnumWrapper( this );
-+}
-+
-+uno::Any
-+SwVbaListLevels::createCollectionObject( const css::uno::Any& aSource )
-+{
-+ return aSource;
-+}
-+
-+rtl::OUString&
-+SwVbaListLevels::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaListLevels") );
-+ return sImplName;
-+}
-+
-+css::uno::Sequence<rtl::OUString>
-+SwVbaListLevels::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ListLevels") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbalistlevels.hxx sw/source/ui/vba/vbalistlevels.hxx
-new file mode 100644
-index 0000000..c57da55
---- /dev/null
-+++ sw/source/ui/vba/vbalistlevels.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:
-+ * $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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_LISTLEVELS_HXX
-+#define SW_VBA_LISTLEVELS_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XListLevels.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include "vbalisthelper.hxx"
-+
-+
-+typedef CollTestImplHelper< ooo::vba::word::XListLevels > SwVbaListLevels_BASE;
-+
-+class SwVbaListLevels : public SwVbaListLevels_BASE
-+{
-+private:
-+ SwVbaListHelperRef pListHelper;
-+
-+public:
-+ SwVbaListLevels( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, SwVbaListHelperRef pHelper ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaListLevels() {}
-+
-+ virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException);
-+ 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 );
-+ // 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);
-+
-+ // SwVbaListLevels_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* SW_VBA_LISTLEVELS_HXX */
-diff --git sw/source/ui/vba/vbalisttemplate.cxx sw/source/ui/vba/vbalisttemplate.cxx
-new file mode 100644
-index 0000000..1ad091e
---- /dev/null
-+++ sw/source/ui/vba/vbalisttemplate.cxx
-@@ -0,0 +1,80 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbalisttemplate.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include "vbalistlevels.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaListTemplate::SwVbaListTemplate( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& xTextDoc, sal_Int32 nGalleryType, sal_Int32 nTemplateType ) throw ( uno::RuntimeException ) : SwVbaListTemplate_BASE( rParent, rContext )
-+{
-+ pListHelper.reset( new SwVbaListHelper( xTextDoc, nGalleryType, nTemplateType ) );
-+}
-+
-+SwVbaListTemplate::~SwVbaListTemplate()
-+{
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaListTemplate::ListLevels( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< XCollection > xCol( new SwVbaListLevels( mxParent, mxContext, pListHelper ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+void SwVbaListTemplate::applyListTemplate( uno::Reference< beans::XPropertySet >& xProps ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< container::XIndexReplace > xNumberingRules = pListHelper->getNumberingRules();
-+ xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingRules") ) , uno::makeAny( xNumberingRules ) );
-+}
-+
-+rtl::OUString&
-+SwVbaListTemplate::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaListTemplate") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaListTemplate::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ListTemplate" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbalisttemplate.hxx sw/source/ui/vba/vbalisttemplate.hxx
-new file mode 100644
-index 0000000..733ef76
---- /dev/null
-+++ sw/source/ui/vba/vbalisttemplate.hxx
-@@ -0,0 +1,60 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_LISTTEMPLATE_HXX
-+#define SW_VBA_LISTTEMPLATE_HXX
-+
-+#include <ooo/vba/word/XListTemplate.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include "vbalisthelper.hxx"
-+
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XListTemplate > SwVbaListTemplate_BASE;
-+
-+class SwVbaListTemplate : public SwVbaListTemplate_BASE
-+{
-+private:
-+ SwVbaListHelperRef pListHelper;
-+
-+public:
-+ SwVbaListTemplate( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& xTextDoc, sal_Int32 nGalleryType, sal_Int32 nTemplateType ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaListTemplate();
-+
-+ void applyListTemplate( css::uno::Reference< css::beans::XPropertySet >& xProps ) throw ( css::uno::RuntimeException );
-+
-+ // Methods
-+ virtual css::uno::Any SAL_CALL ListLevels( const css::uno::Any& index ) throw ( css::uno::RuntimeException );
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_LISTTEMPLATE_HXX */
-diff --git sw/source/ui/vba/vbalisttemplates.cxx sw/source/ui/vba/vbalisttemplates.cxx
-new file mode 100644
-index 0000000..ba560d3
---- /dev/null
-+++ sw/source/ui/vba/vbalisttemplates.cxx
-@@ -0,0 +1,112 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbalisttemplates.hxx"
-+#include "vbalisttemplate.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+class ListTemplatesEnumWrapper : public EnumerationHelper_BASE
-+{
-+ SwVbaListTemplates* pListTemplates;
-+ sal_Int32 nIndex;
-+public:
-+ ListTemplatesEnumWrapper( SwVbaListTemplates* pTemplates ) : pListTemplates( pTemplates ), nIndex( 1 ) {}
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( nIndex <= pListTemplates->getCount() );
-+ }
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( nIndex <= pListTemplates->getCount() )
-+ return pListTemplates->Item( uno::makeAny( nIndex++ ), uno::Any() );
-+ throw container::NoSuchElementException();
-+ }
-+};
-+
-+SwVbaListTemplates::SwVbaListTemplates( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextDocument >& xTextDoc, sal_Int32 nType ) throw (uno::RuntimeException) : SwVbaListTemplates_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >() ), mxTextDocument( xTextDoc ), mnGalleryType( nType )
-+{
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaListTemplates::getCount() throw (uno::RuntimeException)
-+{
-+ // 3 types of list( bullet, numbered and outline )
-+ return 7;
-+}
-+
-+uno::Any SAL_CALL SwVbaListTemplates::Item( const uno::Any& Index1, const uno::Any& /*not processed in this base class*/ ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nIndex = 0;
-+ if( ( Index1 >>= nIndex ) == sal_False )
-+ throw uno::RuntimeException();
-+ if( nIndex <=0 || nIndex > getCount() )
-+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Index out of bounds") ), uno::Reference< uno::XInterface >() );
-+
-+ return uno::makeAny( uno::Reference< word::XListTemplate >( new SwVbaListTemplate( this, mxContext, mxTextDocument, mnGalleryType, nIndex ) ) );
-+}
-+
-+// XEnumerationAccess
-+uno::Type
-+SwVbaListTemplates::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XListTemplate::static_type(0);
-+}
-+
-+uno::Reference< container::XEnumeration >
-+SwVbaListTemplates::createEnumeration() throw (uno::RuntimeException)
-+{
-+ return new ListTemplatesEnumWrapper( this );
-+}
-+
-+uno::Any
-+SwVbaListTemplates::createCollectionObject( const css::uno::Any& aSource )
-+{
-+ return aSource;
-+}
-+
-+rtl::OUString&
-+SwVbaListTemplates::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaListTemplates") );
-+ return sImplName;
-+}
-+
-+css::uno::Sequence<rtl::OUString>
-+SwVbaListTemplates::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ListTemplates") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbalisttemplates.hxx sw/source/ui/vba/vbalisttemplates.hxx
-new file mode 100644
-index 0000000..214d01b
---- /dev/null
-+++ sw/source/ui/vba/vbalisttemplates.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:
-+ * $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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_LISTTEMPLATES_HXX
-+#define SW_VBA_LISTTEMPLATES_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XListTemplates.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+
-+typedef CollTestImplHelper< ooo::vba::word::XListTemplates > SwVbaListTemplates_BASE;
-+
-+class SwVbaListTemplates : public SwVbaListTemplates_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XTextDocument > mxTextDocument;
-+ sal_Int32 mnGalleryType;
-+
-+public:
-+ SwVbaListTemplates( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::text::XTextDocument >& xTextDoc, sal_Int32 nType ) throw (css::uno::RuntimeException);
-+ virtual ~SwVbaListTemplates() {}
-+
-+ virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException);
-+ 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 );
-+ // 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);
-+
-+ // SwVbaListTemplates_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* SW_VBA_LISTTEMPLATES_HXX */
-diff --git sw/source/ui/vba/vbaparagraph.cxx sw/source/ui/vba/vbaparagraph.cxx
-index 075ea6f..4e088a6 100644
---- sw/source/ui/vba/vbaparagraph.cxx
-+++ sw/source/ui/vba/vbaparagraph.cxx
-@@ -48,6 +48,20 @@ SwVbaParagraph::getRange( ) throw ( uno::RuntimeException )
- return uno::Reference< word::XRange >( new SwVbaRange( this, mxContext, mxTextDocument, mxTextRange->getStart(), mxTextRange->getEnd(), mxTextRange->getText(), sal_True ) );
- }
-
-+uno::Any SAL_CALL
-+SwVbaParagraph::getStyle( ) throw ( uno::RuntimeException )
-+{
-+ uno::Reference< word::XRange > xRange = getRange();
-+ return xRange->getStyle();
-+}
-+
-+void SAL_CALL
-+SwVbaParagraph::setStyle( const uno::Any& style ) throw ( uno::RuntimeException )
-+{
-+ uno::Reference< word::XRange > xRange = getRange();
-+ xRange->setStyle( style );
-+}
-+
- rtl::OUString&
- SwVbaParagraph::getServiceImplName()
- {
-diff --git sw/source/ui/vba/vbaparagraph.hxx sw/source/ui/vba/vbaparagraph.hxx
-index 4c2cc44..ea994f9 100644
---- sw/source/ui/vba/vbaparagraph.hxx
-+++ sw/source/ui/vba/vbaparagraph.hxx
-@@ -50,6 +50,8 @@ public:
-
- // XParagraph
- virtual css::uno::Reference< ooo::vba::word::XRange > SAL_CALL getRange() throw ( css::uno::RuntimeException );
-+ virtual css::uno::Any SAL_CALL getStyle() throw ( css::uno::RuntimeException );
-+ virtual void SAL_CALL setStyle( const css::uno::Any& style ) throw ( css::uno::RuntimeException );
-
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
-diff --git sw/source/ui/vba/vbaparagraphformat.cxx sw/source/ui/vba/vbaparagraphformat.cxx
-index dbcadac..1285ca7 100644
---- sw/source/ui/vba/vbaparagraphformat.cxx
-+++ sw/source/ui/vba/vbaparagraphformat.cxx
-@@ -34,6 +34,7 @@
- #include <ooo/vba/word/WdOutlineLevel.hpp>
- #include <com/sun/star/style/ParagraphAdjust.hpp>
- #include <com/sun/star/style/BreakType.hpp>
-+#include "vbatabstops.hxx"
-
-
- using namespace ::ooo::vba;
-@@ -200,9 +201,12 @@ sal_Int32 SAL_CALL SwVbaParagraphFormat::getOutlineLevel() throw (uno::RuntimeEx
- return nLevel;
- }
-
--void SAL_CALL SwVbaParagraphFormat::setOutlineLevel( sal_Int32 /*_outlinelevel*/ ) throw (uno::RuntimeException)
-+void SAL_CALL SwVbaParagraphFormat::setOutlineLevel( sal_Int32 _outlinelevel ) throw (uno::RuntimeException)
- {
-- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ if( _outlinelevel != getOutlineLevel() )
-+ {
-+ // TODO: in my test in msword, there is no effect for this function.
-+ }
- }
-
- uno::Any SAL_CALL SwVbaParagraphFormat::getPageBreakBefore() throw (uno::RuntimeException)
-@@ -296,7 +300,7 @@ void SAL_CALL SwVbaParagraphFormat::setRightIndent( float _rightindent ) throw (
-
- uno::Any SAL_CALL SwVbaParagraphFormat::getTabStops() throw (uno::RuntimeException)
- {
-- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ return uno::makeAny( uno::Reference< word::XTabStops >( new SwVbaTabStops( this, mxContext, mxParaProps ) ) );
- }
-
- void SAL_CALL SwVbaParagraphFormat::setTabStops( const uno::Any& /*_tabstops*/ ) throw (uno::RuntimeException)
-diff --git sw/source/ui/vba/vbarange.cxx sw/source/ui/vba/vbarange.cxx
-index d6f719d..20c52ec 100644
---- sw/source/ui/vba/vbarange.cxx
-+++ sw/source/ui/vba/vbarange.cxx
-@@ -32,12 +32,21 @@
- #include <com/sun/star/style/BreakType.hpp>
- #include <com/sun/star/text/ControlCharacter.hpp>
- #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
--#include "wordvbahelper.hxx"
-+#include <com/sun/star/text/XTextRangeCompare.hpp>
-+#include <com/sun/star/text/XWordCursor.hpp>
-+#include <com/sun/star/text/XParagraphCursor.hpp>
-+#include <ooo/vba/word/WdUnits.hpp>
-+#include <ooo/vba/word/WdMovementType.hpp>
- #include "vbaparagraphformat.hxx"
- #include "vbastyle.hxx"
- #include "vbafont.hxx"
- #include "vbapalette.hxx"
- #include "vbapagesetup.hxx"
-+#include "vbalistformat.hxx"
-+#include "vbarevisions.hxx"
-+#include "vbabookmarks.hxx"
-+#include "vbasections.hxx"
-+#include "vbafield.hxx"
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-@@ -70,6 +79,8 @@ void SwVbaRange::initialize( const uno::Reference< text::XTextRange >& rStart, c
- }
-
- mxTextCursor = SwVbaRangeHelper::initCursor( rStart, mxText );
-+ if( !mxTextCursor.is() )
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Fails to create text cursor") ), uno::Reference< uno::XInterface >() );
- mxTextCursor->collapseToStart();
-
- if( rEnd.is() )
-@@ -90,6 +101,67 @@ void SwVbaRange::setXTextRange( const uno::Reference< text::XTextRange >& xRange
- mxTextCursor->gotoRange( xRange->getStart(), sal_False );
- mxTextCursor->gotoRange( xRange->getEnd(), sal_True );
- }
-+
-+void
-+SwVbaRange::Move( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend, word::E_DIRECTION eDirection ) throw ( uno::RuntimeException )
-+{
-+ sal_Int32 nUnit = word::WdUnits::wdCharacter;
-+ sal_Int32 nCount = 1;
-+ sal_Int32 nExtend = word::WdMovementType::wdMove;
-+
-+ if( _unit.hasValue() )
-+ _unit >>= nUnit;
-+ if( _count.hasValue() )
-+ _count >>= nCount;
-+ if( _extend.hasValue() )
-+ _extend >>= nExtend;
-+
-+ if( nCount == 0 )
-+ return;
-+
-+ sal_Bool bExpand = ( nExtend == word::WdMovementType::wdMove ) ? sal_False : sal_True;
-+
-+ switch( nUnit )
-+ {
-+ case word::WdUnits::wdParagraph:
-+ {
-+ if( eDirection == word::MOVE_LEFT || eDirection == word::MOVE_RIGHT )
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+ uno::Reference< text::XParagraphCursor > xParagraphCursor( mxTextCursor, uno::UNO_QUERY_THROW );
-+ for( sal_Int32 i=0; i<nCount; i++ )
-+ {
-+ if( ( eDirection == word::MOVE_UP ) && ( xParagraphCursor->gotoPreviousParagraph( bExpand ) == sal_False ) )
-+ break;
-+ else if( ( eDirection == word::MOVE_DOWN ) && ( xParagraphCursor->gotoNextParagraph( bExpand ) == sal_False ) )
-+ break;
-+ }
-+ break;
-+ }
-+ case word::WdUnits::wdWord:
-+ {
-+ if( eDirection == word::MOVE_UP || eDirection == word::MOVE_DOWN )
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+ uno::Reference< text::XWordCursor > xWordCursor( mxTextCursor, uno::UNO_QUERY_THROW );
-+ for( sal_Int32 i=0; i<nCount; i++ )
-+ {
-+ if( (eDirection == word::MOVE_LEFT ) && ( xWordCursor->gotoPreviousWord( bExpand ) == sal_False ) )
-+ break;
-+ else if( ( eDirection == word::MOVE_RIGHT ) && ( xWordCursor->gotoNextWord( bExpand ) == sal_False ) )
-+ break;
-+ }
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ break;
-+ }
-+ }
-+}
- #endif
- /**
- * The complexity in this method is because we need to workaround
-@@ -128,17 +200,46 @@ SwVbaRange::getText() throw ( uno::RuntimeException )
- void SAL_CALL
- SwVbaRange::setText( const rtl::OUString& rText ) throw ( uno::RuntimeException )
- {
-+ // Emulate the MSWord behavior, Don't delete the bookmark
-+ // which contains no text string in current inserting position,
-+ rtl::OUString sName;
-+ uno::Reference< text::XTextRange > xRange( mxTextCursor, uno::UNO_QUERY_THROW );
-+ try
-+ {
-+ uno::Reference< text::XTextContent > xBookmark = SwVbaRangeHelper::findBookmarkByPosition( mxTextDocument, xRange->getStart() );
-+ if( xBookmark.is() )
-+ {
-+ uno::Reference< container::XNamed > xNamed( xBookmark, uno::UNO_QUERY_THROW );
-+ sName = xNamed->getName();
-+ }
-+ }
-+ catch( uno::Exception& )
-+ {
-+ // do nothing
-+ }
-+
- if( rText.indexOf( '\n' ) != -1 )
- {
- mxTextCursor->setString( rtl::OUString() );
- // process CR in strings
-- uno::Reference< text::XTextRange > xRange( mxTextCursor, uno::UNO_QUERY_THROW );
- SwVbaRangeHelper::insertString( xRange, mxText, rText, sal_True );
- }
- else
- {
- mxTextCursor->setString( rText );
- }
-+
-+ // insert the bookmark if the bookmark is deleted during setting text string
-+ if( sName.getLength() )
-+ {
-+ uno::Reference< text::XBookmarksSupplier > xBookmarksSupplier( mxTextDocument, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XNameAccess > xNameAccess( xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY_THROW );
-+ if( !xNameAccess->hasByName( sName ) )
-+ {
-+ uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW );
-+ SwVbaBookmarks::addBookmarkByName( xModel, sName, xRange->getStart() );
-+ }
-+ }
- }
-
- // FIXME: test is not pass
-@@ -229,11 +330,8 @@ SwVbaRange::setParagraphFormat( const uno::Reference< word::XParagraphFormat >&
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
- }
-
--uno::Reference< word::XStyle > SAL_CALL
--SwVbaRange::getStyle() throw ( uno::RuntimeException )
-+void SwVbaRange::GetStyleInfo(rtl::OUString& aStyleName, rtl::OUString& aStyleType ) throw ( uno::RuntimeException )
- {
-- rtl::OUString aStyleName;
-- rtl::OUString aStyleType;
- uno::Reference< beans::XPropertySet > xProp( mxTextCursor, uno::UNO_QUERY_THROW );
- if( ( xProp->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CharStyleName") ) ) >>= aStyleName ) && aStyleName.getLength() )
- {
-@@ -247,14 +345,23 @@ SwVbaRange::getStyle() throw ( uno::RuntimeException )
- {
- DebugHelper::exception( SbERR_INTERNAL_ERROR, rtl::OUString() );
- }
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaRange::getStyle() throw ( uno::RuntimeException )
-+{
-+ rtl::OUString aStyleName;
-+ rtl::OUString aStyleType;
-+ GetStyleInfo( aStyleName, aStyleType );
- uno::Reference< style::XStyleFamiliesSupplier > xStyleSupplier( mxTextDocument, uno::UNO_QUERY_THROW);
- uno::Reference< container::XNameAccess > xStylesAccess( xStyleSupplier->getStyleFamilies()->getByName( aStyleType ), uno::UNO_QUERY_THROW );
- uno::Reference< beans::XPropertySet > xStyleProps( xStylesAccess->getByName( aStyleName ), uno::UNO_QUERY_THROW );
-- return uno::Reference< word::XStyle >( new SwVbaStyle( this, mxContext, xStyleProps ) );
-+ uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW );
-+ return uno::makeAny( uno::Reference< word::XStyle >( new SwVbaStyle( this, mxContext, xModel, xStyleProps ) ) );
- }
-
- void SAL_CALL
--SwVbaRange::setStyle( const uno::Reference< word::XStyle >& rStyle ) throw ( uno::RuntimeException )
-+SwVbaRange::setStyle( const uno::Any& rStyle ) throw ( uno::RuntimeException )
- {
- uno::Reference< beans::XPropertySet > xParaProps( mxTextCursor, uno::UNO_QUERY_THROW );
- SwVbaStyle::setStyle( xParaProps, rStyle );
-@@ -267,6 +374,12 @@ SwVbaRange::getFont() throw ( uno::RuntimeException )
- return new SwVbaFont( mxParent, mxContext, aColors.getPalette(), uno::Reference< beans::XPropertySet >( getXTextRange(), uno::UNO_QUERY_THROW ) );
- }
-
-+uno::Reference< word::XListFormat > SAL_CALL
-+SwVbaRange::getListFormat() throw ( uno::RuntimeException )
-+{
-+ return uno::Reference< word::XListFormat >( new SwVbaListFormat( this, mxContext, getXTextRange() ) );
-+}
-+
- ::sal_Int32 SAL_CALL SwVbaRange::getLanguageID() throw (uno::RuntimeException)
- {
- uno::Reference< beans::XPropertySet > xParaProps( mxTextCursor, uno::UNO_QUERY_THROW );
-@@ -324,6 +437,50 @@ void SAL_CALL SwVbaRange::setEnd( ::sal_Int32 _end ) throw (uno::RuntimeExceptio
- mxTextCursor->gotoRange( xEnd, sal_True );
- }
-
-+::sal_Bool SAL_CALL SwVbaRange::InRange( const uno::Reference< ::ooo::vba::word::XRange >& Range ) throw (uno::RuntimeException)
-+{
-+ SwVbaRange* pRange = dynamic_cast< SwVbaRange* >( Range.get() );
-+ if( !pRange )
-+ throw uno::RuntimeException();
-+ uno::Reference< text::XTextRange > xTextRange = pRange->getXTextRange();
-+ uno::Reference< text::XTextRangeCompare > xTRC( mxTextCursor->getText(), uno::UNO_QUERY_THROW );
-+ if( xTRC->compareRegionStarts( xTextRange, getXTextRange() ) >= 0 && xTRC->compareRegionEnds( xTextRange, getXTextRange() ) <= 0 )
-+ return sal_True;
-+ return sal_False;
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaRange::Revisions( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< text::XTextRange > xTextRange = getXTextRange();
-+ uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW );
-+ uno::Reference< XCollection > xCol( new SwVbaRevisions( mxParent, mxContext, xModel, xTextRange ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaRange::Sections( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< text::XTextRange > xTextRange = getXTextRange();
-+ uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW );
-+ uno::Reference< XCollection > xCol( new SwVbaSections( mxParent, mxContext, xModel, xTextRange ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaRange::Fields( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ //FIXME: should be get the field in current range
-+ uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW );
-+ uno::Reference< XCollection > xCol( new SwVbaFields( mxParent, mxContext, xModel ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
- rtl::OUString&
- SwVbaRange::getServiceImplName()
- {
-diff --git sw/source/ui/vba/vbarange.hxx sw/source/ui/vba/vbarange.hxx
-index ca3a4ea..a23bf2d 100644
---- sw/source/ui/vba/vbarange.hxx
-+++ sw/source/ui/vba/vbarange.hxx
-@@ -35,6 +35,8 @@
- #include <com/sun/star/text/XTextRange.hpp>
- #include <com/sun/star/text/XTextDocument.hpp>
- #include <ooo/vba/word/XStyle.hpp>
-+#include <ooo/vba/word/XListFormat.hpp>
-+#include "wordvbahelper.hxx"
-
- typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XRange > SwVbaRange_BASE;
-
-@@ -48,6 +50,7 @@ private:
-
- private:
- void initialize( const css::uno::Reference< css::text::XTextRange >& rStart, const css::uno::Reference< css::text::XTextRange >& rEnd ) throw (css::uno::RuntimeException);
-+ void GetStyleInfo(rtl::OUString& aStyleName, rtl::OUString& aStyleType ) throw ( css::uno::RuntimeException );
- public:
- SwVbaRange( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rTextDocument, const css::uno::Reference< css::text::XTextRange >& rStart, sal_Bool _bMaySpanEndOfDocument = sal_False ) throw (css::uno::RuntimeException);
- SwVbaRange( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rTextDocument, const css::uno::Reference< css::text::XTextRange >& rStart, const css::uno::Reference< css::text::XTextRange >& rEnd, sal_Bool _bMaySpanEndOfDocument = sal_False ) throw (css::uno::RuntimeException);
-@@ -61,16 +64,18 @@ public:
- #endif
- css::uno::Reference< css::text::XText > getXText() { return mxText; }
- void setXTextCursor( const css::uno::Reference< css::text::XTextCursor >& xTextCursor ) { mxTextCursor = xTextCursor; }
-+ void Move( const css::uno::Any& _unit, const css::uno::Any& _count, const css::uno::Any& _extend, ooo::vba::word::E_DIRECTION eDirection ) throw (css::uno::RuntimeException);
-
- // Attribute
- virtual rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setText( const rtl::OUString& rText ) throw (css::uno::RuntimeException);
- virtual css::uno::Reference< ooo::vba::word::XParagraphFormat > SAL_CALL getParagraphFormat() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setParagraphFormat( const css::uno::Reference< ooo::vba::word::XParagraphFormat >& rParagraphFormat ) throw (css::uno::RuntimeException);
-- virtual css::uno::Reference< ooo::vba::word::XStyle > SAL_CALL getStyle() throw (css::uno::RuntimeException);
-- virtual void SAL_CALL setStyle( const css::uno::Reference< ooo::vba::word::XStyle >& _xStyle ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL getStyle() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setStyle( const css::uno::Any& _xStyle ) throw (css::uno::RuntimeException);
-
- virtual css::uno::Reference< ooo::vba::word::XFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
-+ virtual css::uno::Reference< ooo::vba::word::XListFormat > SAL_CALL getListFormat() throw (css::uno::RuntimeException);
- // Methods
- virtual void SAL_CALL InsertBreak( const css::uno::Any& _breakType ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Select() throw (css::uno::RuntimeException);
-@@ -84,6 +89,10 @@ public:
- virtual void SAL_CALL setStart( ::sal_Int32 _start ) throw (css::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getEnd() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setEnd( ::sal_Int32 _end ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL InRange( const css::uno::Reference< ::ooo::vba::word::XRange >& Range ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Revisions( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Sections( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Fields( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
-diff --git sw/source/ui/vba/vbarangehelper.cxx sw/source/ui/vba/vbarangehelper.cxx
-index 337fd9d..1ec6d46 100644
---- sw/source/ui/vba/vbarangehelper.cxx
-+++ sw/source/ui/vba/vbarangehelper.cxx
-@@ -27,6 +27,7 @@
- #include "vbarangehelper.hxx"
- #include <com/sun/star/text/ControlCharacter.hpp>
- #include <com/sun/star/text/XTextRangeCompare.hpp>
-+#include <com/sun/star/text/XBookmarksSupplier.hpp>
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-@@ -111,7 +112,7 @@ uno::Reference< text::XTextCursor > SwVbaRangeHelper::initCursor( const uno::Ref
- DebugHelper::exception(e);
- }
-
-- if( !bGotTextCursor )
-+ if( !bGotTextCursor || !xTextCursor.is() )
- {
- try
- {
-@@ -125,7 +126,7 @@ uno::Reference< text::XTextCursor > SwVbaRangeHelper::initCursor( const uno::Ref
- }
- }
-
-- if( !bGotTextCursor )
-+ if( !bGotTextCursor || !xTextCursor.is() )
- {
- try
- {
-@@ -169,3 +170,29 @@ sal_Int32 SwVbaRangeHelper::getPosition( const uno::Reference< text::XText >& rT
-
- return nPosition;
- }
-+
-+uno::Reference< text::XTextContent > SwVbaRangeHelper::findBookmarkByPosition( const uno::Reference< text::XTextDocument >& xTextDoc, const uno::Reference< text::XTextRange >& xTextRange ) throw ( css::uno::RuntimeException )
-+{
-+ uno::Reference< text::XBookmarksSupplier > xBookmarksSupplier( xTextDoc, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xIndexAccess( xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY_THROW );
-+ for( sal_Int32 index = 0; index < xIndexAccess->getCount(); index++ )
-+ {
-+ uno::Reference< text::XTextContent > xBookmark( xIndexAccess->getByIndex( index ), uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextRange > xBkAnchor = xBookmark->getAnchor();
-+ uno::Reference< text::XTextRangeCompare > xCompare( xBkAnchor->getText(), uno::UNO_QUERY_THROW );
-+ if( xCompare->compareRegionStarts( xBkAnchor->getStart(), xBkAnchor->getEnd() ) == 0 )
-+ {
-+ try
-+ {
-+ if( xCompare->compareRegionStarts( xTextRange, xBkAnchor->getStart() ) == 0 )
-+ return xBookmark;
-+ }
-+ catch( uno::Exception& )
-+ {
-+ continue;
-+ }
-+ }
-+ }
-+ return uno::Reference< text::XTextContent >();
-+}
-+
-diff --git sw/source/ui/vba/vbarangehelper.hxx sw/source/ui/vba/vbarangehelper.hxx
-index 530c7e1..bf27480 100644
---- sw/source/ui/vba/vbarangehelper.hxx
-+++ sw/source/ui/vba/vbarangehelper.hxx
-@@ -30,6 +30,8 @@
- #include <vbahelper/vbahelperinterface.hxx>
- #include <com/sun/star/text/XTextViewCursor.hpp>
- #include <com/sun/star/text/XText.hpp>
-+#include <com/sun/star/text/XTextRange.hpp>
-+#include <com/sun/star/text/XTextDocument.hpp>
-
- class SwVbaRangeHelper
- {
-@@ -38,6 +40,7 @@ public:
- static void insertString( css::uno::Reference< css::text::XTextRange >& rTextRange, css::uno::Reference< css::text::XText >& rText, const rtl::OUString& rStr, sal_Bool _bAbsorb ) throw ( css::uno::RuntimeException );
- static css::uno::Reference< css::text::XTextCursor > initCursor( const css::uno::Reference< css::text::XTextRange >& rTextRange, const css::uno::Reference< css::text::XText >& rText ) throw ( css::uno::RuntimeException );
- static sal_Int32 getPosition( const css::uno::Reference< css::text::XText >& rText, const css::uno::Reference< css::text::XTextRange >& rTextRange ) throw ( css::uno::RuntimeException );
-+ static css::uno::Reference< css::text::XTextContent > findBookmarkByPosition( const css::uno::Reference< css::text::XTextDocument >& xTextDoc, const css::uno::Reference< css::text::XTextRange >& xTextRange ) throw ( css::uno::RuntimeException );
-
- };
- #endif /* SW_VBA_RANGEHELPER_HXX */
-diff --git sw/source/ui/vba/vbareplacement.cxx sw/source/ui/vba/vbareplacement.cxx
-index 2bd7dcf..097699b 100644
---- sw/source/ui/vba/vbareplacement.cxx
-+++ sw/source/ui/vba/vbareplacement.cxx
-@@ -50,6 +50,12 @@ void SAL_CALL SwVbaReplacement::setText( const ::rtl::OUString& _text ) throw (u
- mxPropertyReplace->setReplaceString( _text );
- }
-
-+void SAL_CALL SwVbaReplacement::ClearFormatting( ) throw (uno::RuntimeException)
-+{
-+ uno::Sequence< beans::PropertyValue > aPropValues;
-+ mxPropertyReplace->setReplaceAttributes( aPropValues );
-+}
-+
- rtl::OUString&
- SwVbaReplacement::getServiceImplName()
- {
-diff --git sw/source/ui/vba/vbareplacement.hxx sw/source/ui/vba/vbareplacement.hxx
-index c0f66af..62e1143 100644
---- sw/source/ui/vba/vbareplacement.hxx
-+++ sw/source/ui/vba/vbareplacement.hxx
-@@ -47,6 +47,9 @@ public:
- 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 ClearFormatting() throw (css::uno::RuntimeException);
-+
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-diff --git sw/source/ui/vba/vbarevision.cxx sw/source/ui/vba/vbarevision.cxx
-new file mode 100644
-index 0000000..0c48b1d
---- /dev/null
-+++ sw/source/ui/vba/vbarevision.cxx
-@@ -0,0 +1,105 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbarevision.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include <com/sun/star/document/XRedlinesSupplier.hpp>
-+#include "wordvbahelper.hxx"
-+#include <docsh.hxx>
-+#include <doc.hxx>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaRevision::SwVbaRevision( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< beans::XPropertySet >& xRedlineProps ) throw ( uno::RuntimeException ) : SwVbaRevision_BASE( rParent, rContext ), mxModel( xModel ), mxRedlineProps( xRedlineProps )
-+{
-+}
-+
-+SwVbaRevision::~SwVbaRevision()
-+{
-+}
-+
-+sal_Int32 SwVbaRevision::GetPosition() throw (css::uno::RuntimeException)
-+{
-+ sal_Int32 nPos = -1;
-+ uno::Reference< document::XRedlinesSupplier > xRedlinesSupp( mxModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xRedlines( xRedlinesSupp->getRedlines(), uno::UNO_QUERY_THROW );
-+ sal_Int32 nCount = xRedlines->getCount();
-+ for( sal_Int32 i = 0; i < nCount; i++ )
-+ {
-+ uno::Reference< beans::XPropertySet > xProps( xRedlines->getByIndex( i ), uno::UNO_QUERY_THROW );
-+ if( xProps == mxRedlineProps )
-+ {
-+ nPos = i;
-+ OSL_TRACE(" SwVbaRevision::SwVbaRevision, the redline position is %d, ", nPos );
-+ break;
-+ }
-+ }
-+ if( nPos == -1 )
-+ throw uno::RuntimeException();
-+
-+ return nPos;
-+}
-+
-+void SAL_CALL
-+SwVbaRevision::Accept() throw ( css::uno::RuntimeException )
-+{
-+ SwDoc* pDoc = word::getDocShell( mxModel )->GetDoc();
-+ if( pDoc )
-+ pDoc->AcceptRedline( GetPosition(), sal_True );
-+}
-+
-+void SAL_CALL
-+SwVbaRevision::Reject( ) throw ( css::uno::RuntimeException )
-+{
-+ SwDoc* pDoc = word::getDocShell( mxModel )->GetDoc();
-+ if( pDoc )
-+ pDoc->RejectRedline( GetPosition(), sal_True );
-+}
-+
-+rtl::OUString&
-+SwVbaRevision::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaRevision") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaRevision::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Revision" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbarevision.hxx sw/source/ui/vba/vbarevision.hxx
-new file mode 100644
-index 0000000..0384370
---- /dev/null
-+++ sw/source/ui/vba/vbarevision.hxx
-@@ -0,0 +1,60 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_REVISION_HXX
-+#define SW_VBA_REVISION_HXX
-+
-+#include <ooo/vba/word/XRevision.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XRevision > SwVbaRevision_BASE;
-+
-+class SwVbaRevision : public SwVbaRevision_BASE
-+{
-+private:
-+ css::uno::Reference< css::frame::XModel > mxModel;
-+ css::uno::Reference< css::beans::XPropertySet > mxRedlineProps;
-+
-+private:
-+ sal_Int32 GetPosition() throw (css::uno::RuntimeException);
-+
-+public:
-+ SwVbaRevision( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::beans::XPropertySet >& xRedlineProps ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaRevision();
-+
-+ // Methods
-+ virtual void SAL_CALL Accept( ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL Reject( ) throw (css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_REVISION_HXX */
-diff --git sw/source/ui/vba/vbarevisions.cxx sw/source/ui/vba/vbarevisions.cxx
-new file mode 100644
-index 0000000..eea1394
---- /dev/null
-+++ sw/source/ui/vba/vbarevisions.cxx
-@@ -0,0 +1,188 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbarevisions.hxx"
-+#include "vbarevision.hxx"
-+#include <cppuhelper/implbase2.hxx>
-+#include <com/sun/star/document/XRedlinesSupplier.hpp>
-+#include <com/sun/star/text/XTextRangeCompare.hpp>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+typedef ::cppu::WeakImplHelper1< container::XEnumeration > RevisionEnumeration_BASE;
-+typedef ::cppu::WeakImplHelper2< container::XIndexAccess, container::XEnumerationAccess > RevisionCollectionHelper_BASE;
-+typedef std::vector< uno::Reference< beans::XPropertySet > > RevisionMap;
-+
-+class RedlinesEnumeration : public RevisionEnumeration_BASE
-+{
-+ RevisionMap mRevisionMap;
-+ RevisionMap::iterator mIt;
-+public:
-+ RedlinesEnumeration( const RevisionMap& sMap ) : mRevisionMap( sMap ), mIt( mRevisionMap.begin() ) {}
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( mIt != mRevisionMap.end() );
-+ }
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( !hasMoreElements() )
-+ throw container::NoSuchElementException();
-+ uno::Reference< beans::XPropertySet > xRevision( *mIt++ );
-+ return uno::makeAny( xRevision ) ;
-+ }
-+};
-+
-+class RevisionCollectionHelper : public RevisionCollectionHelper_BASE
-+{
-+ RevisionMap mRevisionMap;
-+public:
-+RevisionCollectionHelper( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XTextRange >& xTextRange ) throw (uno::RuntimeException);
-+
-+ // XElementAccess
-+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) { return beans::XPropertySet::static_type(0); }
-+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) { return ( mRevisionMap.size() > 0 ); }
-+ // XIndexAccess
-+ virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException) { return mRevisionMap.size(); }
-+ virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
-+ {
-+ if ( Index < 0 || Index >= getCount() )
-+ throw lang::IndexOutOfBoundsException();
-+
-+ return uno::makeAny( mRevisionMap[ Index ] );
-+
-+ }
-+ // XEnumerationAccess
-+ virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
-+ {
-+ return new RedlinesEnumeration( mRevisionMap );
-+ }
-+};
-+
-+RevisionCollectionHelper::RevisionCollectionHelper( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XTextRange >& xTextRange ) throw (uno::RuntimeException)
-+ {
-+ uno::Reference< text::XTextRangeCompare > xTRC( xTextRange->getText(), uno::UNO_QUERY_THROW );
-+ uno::Reference< document::XRedlinesSupplier > xRedlinesSupp( xModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xRedlines( xRedlinesSupp->getRedlines(), uno::UNO_QUERY_THROW );
-+ sal_Int32 nCount = xRedlines->getCount();
-+ for( sal_Int32 index = 0; index < nCount; index++ )
-+ {
-+ uno::Reference< text::XTextRange > xRedlineRange( xRedlines->getByIndex( index ), uno::UNO_QUERY_THROW );
-+ if( xTRC->compareRegionStarts( xTextRange, xRedlineRange ) >= 0 && xTRC->compareRegionEnds( xTextRange, xRedlineRange ) <= 0 )
-+ {
-+ uno::Reference< beans::XPropertySet > xRedlineProps( xRedlineRange, uno::UNO_QUERY_THROW );
-+ mRevisionMap.push_back( xRedlineProps );
-+ }
-+ }
-+ }
-+class RevisionsEnumeration : public EnumerationHelperImpl
-+{
-+ uno::Reference< frame::XModel > m_xModel;
-+public:
-+ RevisionsEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration, const uno::Reference< frame::XModel >& xModel ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xParent, xContext, xEnumeration ), m_xModel( xModel ) {}
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ uno::Reference< beans::XPropertySet > xRevision( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
-+ return uno::makeAny( uno::Reference< word::XRevision > ( new SwVbaRevision( m_xParent, m_xContext, m_xModel, xRevision ) ) );
-+ }
-+
-+};
-+
-+SwVbaRevisions::SwVbaRevisions( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XTextRange >& xTextRange ): SwVbaRevisions_BASE( xParent, xContext, new RevisionCollectionHelper( xModel, xTextRange ) ), mxModel( xModel )
-+{
-+}
-+
-+SwVbaRevisions::SwVbaRevisions( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< container::XIndexAccess >& xIndexAccess ): SwVbaRevisions_BASE( xParent, xContext, xIndexAccess ), mxModel( xModel )
-+{
-+}
-+
-+// XEnumerationAccess
-+uno::Type
-+SwVbaRevisions::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XRevision::static_type(0);
-+}
-+uno::Reference< container::XEnumeration >
-+SwVbaRevisions::createEnumeration() throw (uno::RuntimeException)
-+{
-+ uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
-+ return new RevisionsEnumeration( this, mxContext, xEnumAccess->createEnumeration(), mxModel );
-+}
-+
-+uno::Any
-+SwVbaRevisions::createCollectionObject( const css::uno::Any& aSource )
-+{
-+ uno::Reference< beans::XPropertySet > xRevision( aSource, uno::UNO_QUERY_THROW );
-+ return uno::makeAny( uno::Reference< word::XRevision > ( new SwVbaRevision( this, mxContext, mxModel, xRevision ) ) );
-+}
-+
-+void SAL_CALL SwVbaRevisions::AcceptAll( ) throw (css::uno::RuntimeException)
-+{
-+ // First we need to put all the redline into a vector, because if the redline is accepted,
-+ // it will auto delete in the document.
-+ std::vector< uno::Reference< word::XRevision > > aRevisions;
-+ uno::Reference< container::XEnumeration > xEnumeration = createEnumeration();
-+ while( xEnumeration->hasMoreElements() )
-+ {
-+ uno::Reference< word::XRevision > xRevision( xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
-+ aRevisions.push_back( xRevision );
-+ }
-+
-+ std::vector< uno::Reference< word::XRevision > >::iterator it = aRevisions.begin();
-+ for( ; it != aRevisions.end(); it++ )
-+ {
-+ uno::Reference< word::XRevision > xRevision( *it );
-+ xRevision->Accept();
-+ }
-+}
-+
-+void SAL_CALL SwVbaRevisions::RejectAll( ) throw (css::uno::RuntimeException)
-+{
-+ throw uno::RuntimeException();
-+}
-+
-+rtl::OUString&
-+SwVbaRevisions::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaRevisions") );
-+ return sImplName;
-+}
-+
-+css::uno::Sequence<rtl::OUString>
-+SwVbaRevisions::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Revisions") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbarevisions.hxx sw/source/ui/vba/vbarevisions.hxx
-new file mode 100644
-index 0000000..88db794
---- /dev/null
-+++ sw/source/ui/vba/vbarevisions.hxx
-@@ -0,0 +1,66 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_PANES_HXX
-+#define SW_VBA_PANES_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XRevisions.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/text/XTextRange.hpp>
-+
-+
-+typedef CollTestImplHelper< ooo::vba::word::XRevisions > SwVbaRevisions_BASE;
-+
-+class SwVbaRevisions : public SwVbaRevisions_BASE
-+{
-+private:
-+ css::uno::Reference< css::frame::XModel > mxModel;
-+
-+public:
-+ SwVbaRevisions( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XTextRange >& xTextRange );
-+
-+ SwVbaRevisions( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess );
-+ virtual ~SwVbaRevisions() {}
-+
-+ // Methods
-+ virtual void SAL_CALL AcceptAll( ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL RejectAll( ) 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);
-+
-+ // SwVbaRevisions_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* SW_VBA_PANES_HXX */
-diff --git sw/source/ui/vba/vbarow.cxx sw/source/ui/vba/vbarow.cxx
-new file mode 100644
-index 0000000..2f4132b
---- /dev/null
-+++ sw/source/ui/vba/vbarow.cxx
-@@ -0,0 +1,136 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbarow.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include <com/sun/star/table/XCellRange.hpp>
-+#include <com/sun/star/view/XSelectionSupplier.hpp>
-+#include <ooo/vba/word/WdRowHeightRule.hpp>
-+#include <ooo/vba/word/WdConstants.hpp>
-+#include <rtl/ustrbuf.hxx>
-+#include "wordvbahelper.hxx"
-+#include "vbatablehelper.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaRow::SwVbaRow( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext,const uno::Reference< text::XTextTable >& xTextTable, sal_Int32 nIndex ) throw ( uno::RuntimeException ) :
-+ SwVbaRow_BASE( rParent, rContext ), mxTextTable( xTextTable ), mnIndex( nIndex )
-+{
-+ mxTableRows = mxTextTable->getRows();
-+ mxRowProps.set( mxTableRows->getByIndex( mnIndex ), uno::UNO_QUERY_THROW );
-+}
-+
-+SwVbaRow::~SwVbaRow()
-+{
-+}
-+
-+uno::Any SAL_CALL SwVbaRow::getHeight() throw (css::uno::RuntimeException)
-+{
-+ if( getHeightRule() == word::WdRowHeightRule::wdRowHeightAuto )
-+ return uno::makeAny( sal_Int32( word::WdConstants::wdUndefined ) );
-+
-+ sal_Int32 nHeight = 0;
-+ mxRowProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Height") ) ) >>= nHeight;
-+ return uno::makeAny( (float)Millimeter::getInPoints( nHeight ) );
-+}
-+
-+void SAL_CALL SwVbaRow::setHeight( const uno::Any& _height ) throw (css::uno::RuntimeException)
-+{
-+ float height = 0;
-+ _height >>= height;
-+
-+ sal_Int32 nHeight = Millimeter::getInHundredthsOfOneMillimeter( height );
-+ mxRowProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Height") ), uno::makeAny( nHeight ) );
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaRow::getHeightRule() throw (css::uno::RuntimeException)
-+{
-+ sal_Bool isAutoHeight = sal_False;
-+ mxRowProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsAutoHeight") ) ) >>= isAutoHeight;
-+ return isAutoHeight ? word::WdRowHeightRule::wdRowHeightAuto : word::WdRowHeightRule::wdRowHeightExactly;
-+}
-+
-+void SAL_CALL SwVbaRow::setHeightRule( ::sal_Int32 _heightrule ) throw (css::uno::RuntimeException)
-+{
-+ sal_Bool isAutoHeight = ( _heightrule == word::WdRowHeightRule::wdRowHeightAuto );
-+ mxRowProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsAutoHeight") ), uno::makeAny( isAutoHeight ) );
-+}
-+
-+void SAL_CALL
-+SwVbaRow::Select( ) throw ( uno::RuntimeException )
-+{
-+ SelectRow( getCurrentWordDoc(mxContext), mxTextTable, mnIndex, mnIndex );
-+}
-+
-+void SwVbaRow::SelectRow( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XTextTable >& xTextTable, sal_Int32 nStartRow, sal_Int32 nEndRow ) throw ( uno::RuntimeException )
-+{
-+ rtl::OUStringBuffer aRangeName;
-+ aRangeName.appendAscii("A").append(sal_Int32( nStartRow + 1 ) );
-+ SwVbaTableHelper aTableHelper( xTextTable );
-+ sal_Int32 nColCount = aTableHelper.getTabColumnsCount( nEndRow );
-+ // FIXME: the column count > 26
-+ //sal_Char cCol = 'A' + nColCount - 1;
-+ rtl::OUString sCol = aTableHelper.getColumnStr( nColCount - 1);
-+ aRangeName.appendAscii(":").append( sCol ).append( sal_Int32( nEndRow + 1 ) );
-+
-+ uno::Reference< table::XCellRange > xCellRange( xTextTable, uno::UNO_QUERY_THROW );
-+ rtl::OUString sSelRange = aRangeName.makeStringAndClear();
-+ uno::Reference< table::XCellRange > xSelRange = xCellRange->getCellRangeByName( sSelRange );
-+
-+ uno::Reference< view::XSelectionSupplier > xSelection( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
-+ xSelection->select( uno::makeAny( xSelRange ) );
-+}
-+
-+void SAL_CALL SwVbaRow::SetHeight( float height, sal_Int32 heightrule ) throw (css::uno::RuntimeException)
-+{
-+ setHeightRule( heightrule );
-+ setHeight( uno::makeAny( height ) );
-+}
-+
-+rtl::OUString&
-+SwVbaRow::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaRow") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaRow::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Row" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbarow.hxx sw/source/ui/vba/vbarow.hxx
-new file mode 100644
-index 0000000..cfbfb4d
---- /dev/null
-+++ sw/source/ui/vba/vbarow.hxx
-@@ -0,0 +1,69 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_ROW_HXX
-+#define SW_VBA_ROW_HXX
-+
-+#include <ooo/vba/word/XRow.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/table/XTableRows.hpp>
-+#include <com/sun/star/text/XTextTable.hpp>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XRow > SwVbaRow_BASE;
-+
-+class SwVbaRow : public SwVbaRow_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XTextTable > mxTextTable;
-+ css::uno::Reference< css::table::XTableRows > mxTableRows;
-+ css::uno::Reference< css::beans::XPropertySet > mxRowProps;
-+ sal_Int32 mnIndex;
-+
-+public:
-+ SwVbaRow( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextTable >& xTextTable, sal_Int32 nIndex ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaRow();
-+
-+ // Attributes
-+ virtual css::uno::Any SAL_CALL getHeight() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setHeight( const css::uno::Any& _height ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getHeightRule() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setHeightRule( ::sal_Int32 _heightrule ) throw (css::uno::RuntimeException);
-+
-+ // Methods
-+ virtual void SAL_CALL Select( ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL SetHeight( float height, sal_Int32 heightrule ) throw (css::uno::RuntimeException);
-+
-+ static void SelectRow( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XTextTable >& xTextTable, sal_Int32 nStartRow, sal_Int32 nEndRow ) throw (css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_ROW_HXX */
-diff --git sw/source/ui/vba/vbarows.cxx sw/source/ui/vba/vbarows.cxx
-new file mode 100644
-index 0000000..e2737a4
---- /dev/null
-+++ sw/source/ui/vba/vbarows.cxx
-@@ -0,0 +1,368 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbarows.hxx"
-+#include "vbarow.hxx"
-+#include <com/sun/star/text/HoriOrientation.hpp>
-+#include <com/sun/star/table/XCellRange.hpp>
-+#include <ooo/vba/word/WdRowAlignment.hpp>
-+#include <ooo/vba/word/WdConstants.hpp>
-+#include <ooo/vba/word/WdRulerStyle.hpp>
-+#include "wordvbahelper.hxx"
-+#include "vbacolumns.hxx"
-+#include "vbatablehelper.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+class RowsEnumWrapper : public EnumerationHelper_BASE
-+{
-+ uno::WeakReference< XHelperInterface > mxParent;
-+ uno::Reference< uno::XComponentContext > mxContext;
-+ uno::Reference< text::XTextTable > mxTextTable;
-+ uno::Reference< container::XIndexAccess > mxIndexAccess;
-+ sal_Int32 nIndex;
-+
-+public:
-+ RowsEnumWrapper( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< text::XTextTable >& xTextTable ) : mxParent( xParent ), mxContext( xContext ), mxTextTable( xTextTable ), nIndex( 0 )
-+ {
-+ mxIndexAccess.set( mxTextTable->getRows(), uno::UNO_QUERY );
-+ }
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( nIndex < mxIndexAccess->getCount() );
-+ }
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if( nIndex < mxIndexAccess->getCount() )
-+ {
-+ return uno::makeAny( uno::Reference< word::XRow > ( new SwVbaRow( mxParent, mxContext, mxTextTable, nIndex++ ) ) );
-+ }
-+ throw container::NoSuchElementException();
-+ }
-+};
-+
-+SwVbaRows::SwVbaRows( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextTable >& xTextTable, const uno::Reference< table::XTableRows >& xTableRows ) throw (uno::RuntimeException) : SwVbaRows_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( xTableRows, uno::UNO_QUERY_THROW ) ), mxTextTable( xTextTable ), mxTableRows( xTableRows )
-+{
-+ mnStartRowIndex = 0;
-+ mnEndRowIndex = m_xIndexAccess->getCount() - 1;
-+}
-+
-+SwVbaRows::SwVbaRows( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextTable >& xTextTable, const uno::Reference< table::XTableRows >& xTableRows, sal_Int32 nStarIndex, sal_Int32 nEndIndex ) throw (uno::RuntimeException) : SwVbaRows_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( xTableRows, uno::UNO_QUERY_THROW ) ), mxTextTable( xTextTable ), mxTableRows( xTableRows ), mnStartRowIndex( nStarIndex ), mnEndRowIndex( nEndIndex )
-+{
-+ if( mnEndRowIndex < mnStartRowIndex )
-+ throw uno::RuntimeException();
-+}
-+
-+/**
-+ * get the alignment of the rows: SO format com.sun.star.text.HoriOrientation
-+ * is mapped to WdRowAlignment in Word
-+ * @return the alignment
-+ */
-+::sal_Int32 SAL_CALL SwVbaRows::getAlignment() throw (uno::RuntimeException)
-+{
-+ sal_Int16 nAlignment = text::HoriOrientation::LEFT;
-+ uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, uno::UNO_QUERY_THROW );
-+ xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HoriOrient") ) ) >>= nAlignment;
-+ sal_Int32 nRet = 0;
-+ switch( nAlignment )
-+ {
-+ case text::HoriOrientation::CENTER:
-+ {
-+ nRet = word::WdRowAlignment::wdAlignRowCenter;
-+ break;
-+ }
-+ case text::HoriOrientation::RIGHT:
-+ {
-+ nRet = word::WdRowAlignment::wdAlignRowRight;
-+ break;
-+ }
-+ default:
-+ {
-+ nRet = word::WdRowAlignment::wdAlignRowLeft;
-+ }
-+ }
-+ return nRet;
-+}
-+
-+void SAL_CALL SwVbaRows::setAlignment( ::sal_Int32 _alignment ) throw (uno::RuntimeException)
-+{
-+ sal_Int16 nAlignment = text::HoriOrientation::LEFT;
-+ switch( _alignment )
-+ {
-+ case word::WdRowAlignment::wdAlignRowCenter:
-+ {
-+ nAlignment = text::HoriOrientation::CENTER;
-+ break;
-+ }
-+ case word::WdRowAlignment::wdAlignRowRight:
-+ {
-+ nAlignment = text::HoriOrientation::RIGHT;
-+ break;
-+ }
-+ default:
-+ {
-+ nAlignment = text::HoriOrientation::LEFT;
-+ }
-+ }
-+ uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, uno::UNO_QUERY_THROW );
-+ xTableProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HoriOrient") ), uno::makeAny( nAlignment ) );
-+}
-+
-+uno::Any SAL_CALL SwVbaRows::getAllowBreakAcrossPages() throw (uno::RuntimeException)
-+{
-+ sal_Bool bAllowBreak = sal_False;
-+ uno::Reference< container::XIndexAccess > xRowsAccess( mxTableRows, uno::UNO_QUERY_THROW );
-+ for( sal_Int32 index = mnStartRowIndex; index <= mnEndRowIndex; ++index )
-+ {
-+ uno::Reference< beans::XPropertySet > xRowProps( xRowsAccess->getByIndex( index ), uno::UNO_QUERY_THROW );
-+ sal_Bool bSplit = sal_False;
-+ xRowProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsSplitAllowed") ) ) >>= bSplit;
-+ if( index == 0 )
-+ {
-+ bAllowBreak = bSplit;
-+ }
-+ if( bSplit != bAllowBreak )
-+ {
-+ sal_Int32 nRet = word::WdConstants::wdUndefined;
-+ return uno::makeAny( nRet );
-+ }
-+ }
-+ return uno::makeAny( bAllowBreak );
-+}
-+
-+void SAL_CALL SwVbaRows::setAllowBreakAcrossPages( const uno::Any& _allowbreakacrosspages ) throw (uno::RuntimeException)
-+{
-+ sal_Bool bAllowBreak = sal_False;
-+ _allowbreakacrosspages >>= bAllowBreak;
-+ uno::Reference< container::XIndexAccess > xRowsAccess( mxTableRows, uno::UNO_QUERY_THROW );
-+ for( sal_Int32 index = mnStartRowIndex; index <= mnEndRowIndex; ++index )
-+ {
-+ uno::Reference< beans::XPropertySet > xRowProps( xRowsAccess->getByIndex( index ), uno::UNO_QUERY_THROW );
-+ xRowProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsSplitAllowed") ), uno::makeAny( bAllowBreak ) );
-+ }
-+}
-+
-+float SAL_CALL SwVbaRows::getSpaceBetweenColumns() throw (uno::RuntimeException)
-+{
-+ // just get the first spacing of the first cell
-+ uno::Reference< table::XCellRange > xCellRange( mxTextTable, uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xCellProps( xCellRange->getCellByPosition( 0, mnStartRowIndex ), uno::UNO_QUERY_THROW );
-+ sal_Int32 nLeftBorderDistance = 0;
-+ sal_Int32 nRightBorderDistance = 0;
-+ xCellProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftBorderDistance") ) ) >>= nLeftBorderDistance;
-+ xCellProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightBorderDistance") ) ) >>= nRightBorderDistance;
-+ return static_cast< float >( Millimeter::getInPoints( nLeftBorderDistance + nRightBorderDistance ) );
-+}
-+
-+void SAL_CALL SwVbaRows::setSpaceBetweenColumns( float _spacebetweencolumns ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nSpace = Millimeter::getInHundredthsOfOneMillimeter( _spacebetweencolumns ) / 2;
-+ uno::Reference< container::XIndexAccess > xColumnAccess( mxTextTable->getColumns(), uno::UNO_QUERY_THROW );
-+ uno::Reference< table::XCellRange > xCellRange( mxTextTable, uno::UNO_QUERY_THROW );
-+ SwVbaTableHelper aTableHelper( mxTextTable );
-+ for( sal_Int32 row = mnStartRowIndex; row <= mnEndRowIndex; ++row )
-+ {
-+ sal_Int32 nColumns = aTableHelper.getTabColumnsCount( row );
-+ for( sal_Int32 column = 0; column < nColumns; ++column )
-+ {
-+ uno::Reference< beans::XPropertySet > xCellProps( xCellRange->getCellByPosition( column, row ), uno::UNO_QUERY_THROW );
-+ xCellProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftBorderDistance") ), uno::makeAny( nSpace ) );
-+ xCellProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightBorderDistance") ), uno::makeAny( nSpace ) );
-+ }
-+ }
-+}
-+
-+void SAL_CALL SwVbaRows::Delete( ) throw (uno::RuntimeException)
-+{
-+ mxTableRows->removeByIndex( mnStartRowIndex, getCount() );
-+}
-+
-+void SAL_CALL SwVbaRows::SetLeftIndent( float LeftIndent, ::sal_Int32 RulerStyle ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< word::XColumns > xColumns( new SwVbaColumns( getParent(), mxContext, mxTextTable, mxTextTable->getColumns() ) );
-+ sal_Int32 nIndent = (sal_Int32)( LeftIndent );
-+ switch( RulerStyle )
-+ {
-+ case word::WdRulerStyle::wdAdjustFirstColumn:
-+ {
-+ setIndentWithAdjustFirstColumn( xColumns, nIndent );
-+ break;
-+ }
-+ case word::WdRulerStyle::wdAdjustNone:
-+ {
-+ setIndentWithAdjustNone( nIndent );
-+ break;
-+ }
-+ case word::WdRulerStyle::wdAdjustProportional:
-+ {
-+ setIndentWithAdjustProportional( xColumns, nIndent );
-+ break;
-+ }
-+ case word::WdRulerStyle::wdAdjustSameWidth:
-+ {
-+ setIndentWithAdjustSameWidth( xColumns, nIndent );
-+ break;
-+ }
-+ default:
-+ {
-+ DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
-+ }
-+ }
-+}
-+
-+void SwVbaRows::setIndentWithAdjustNone( sal_Int32 indent ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, uno::UNO_QUERY_THROW );
-+ sal_Int32 nMargin = 0;
-+ xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftMargin") ) ) >>= nMargin;
-+ nMargin += indent;
-+ xTableProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftMargin") ), uno::makeAny( nMargin ) );
-+}
-+
-+ void SwVbaRows::setIndentWithAdjustFirstColumn( const uno::Reference< word::XColumns >& xColumns, sal_Int32 indent ) throw (uno::RuntimeException)
-+ {
-+ sal_Int32 nIndex = 1;
-+ uno::Reference< XCollection > xCol( xColumns, uno::UNO_QUERY_THROW );
-+ uno::Reference< word::XColumn > xColumn( xCol->Item( uno::makeAny( nIndex ), uno::Any() ), uno::UNO_QUERY_THROW );
-+ sal_Int32 nWidth = xColumn->getWidth();
-+ nWidth -= indent;
-+ xColumn->setWidth( nWidth );
-+ setIndentWithAdjustNone( indent );
-+ }
-+
-+ void SwVbaRows::setIndentWithAdjustProportional( const uno::Reference< word::XColumns >& xColumns, sal_Int32 indent ) throw (uno::RuntimeException)
-+ {
-+ // calculate the new width and get the proportion between old and new
-+ uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, uno::UNO_QUERY_THROW );
-+ sal_Int32 nWidth = 0;
-+ xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ) ) >>= nWidth;
-+ sal_Int32 nNewWidth = nWidth - indent;
-+ double propFactor = (double)nNewWidth/(double)nWidth;
-+
-+ // get all columns, calculate and set the new width of the columns
-+ uno::Reference< XCollection > xCol( xColumns, uno::UNO_QUERY_THROW );
-+ sal_Int32 nColCount = xCol->getCount();
-+ for( sal_Int32 i = 0; i < nColCount; i++ )
-+ {
-+ uno::Reference< word::XColumn > xColumn( xCol->Item( uno::makeAny( i ), uno::Any() ), uno::UNO_QUERY_THROW );
-+ sal_Int32 nColWidth = xColumn->getWidth();
-+ sal_Int32 nNewColWidth = ( sal_Int32 )( propFactor * nColWidth );
-+ xColumn->setWidth( nNewColWidth );
-+ }
-+
-+ // set the width and position of the table
-+ setIndentWithAdjustNone( indent );
-+ xTableProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ), uno::makeAny( nNewWidth ) );
-+ }
-+
-+ void SwVbaRows::setIndentWithAdjustSameWidth( const uno::Reference< word::XColumns >& xColumns, sal_Int32 indent ) throw (uno::RuntimeException)
-+ {
-+ // calculate the new width and get the width of all columns
-+ uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, uno::UNO_QUERY_THROW );
-+ sal_Int32 nWidth = 0;
-+ xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ) ) >>= nWidth;
-+ sal_Int32 nNewWidth = nWidth - indent;
-+
-+ // get all columns, calculate and set the new width of the columns
-+ uno::Reference< XCollection > xCol( xColumns, uno::UNO_QUERY_THROW );
-+ sal_Int32 nColCount = xCol->getCount();
-+ sal_Int32 nNewColWidth = (sal_Int32)( double( nNewWidth )/nColCount );
-+ for( sal_Int32 i = 0; i < nColCount; i++ )
-+ {
-+ uno::Reference< word::XColumn > xColumn( xCol->Item( uno::makeAny( i ), uno::Any() ), uno::UNO_QUERY_THROW );
-+ xColumn->setWidth( nNewColWidth );
-+ }
-+
-+ // set the width and position of the table
-+ setIndentWithAdjustNone( indent );
-+ xTableProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ), uno::makeAny( nNewWidth ) );
-+ }
-+
-+void SAL_CALL SwVbaRows::Select( ) throw (uno::RuntimeException)
-+{
-+ SwVbaRow::SelectRow( getCurrentWordDoc(mxContext), mxTextTable, mnStartRowIndex, mnEndRowIndex );
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaRows::getCount() throw (uno::RuntimeException)
-+{
-+ return ( mnEndRowIndex - mnStartRowIndex + 1 );
-+}
-+
-+uno::Any SAL_CALL SwVbaRows::Item( const uno::Any& Index1, const uno::Any& /*not processed in this base class*/ ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nIndex = 0;
-+ if( ( Index1 >>= nIndex ) == sal_True )
-+ {
-+ if( nIndex <= 0 || nIndex > getCount() )
-+ {
-+ throw lang::IndexOutOfBoundsException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Index out of bounds") ), uno::Reference< uno::XInterface >() );
-+ }
-+ return uno::makeAny( uno::Reference< word::XRow >( new SwVbaRow( this, mxContext, mxTextTable, nIndex - 1 ) ) );
-+ }
-+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Index out of bounds") ), uno::Reference< uno::XInterface >() );
-+}
-+
-+// XEnumerationAccess
-+uno::Type
-+SwVbaRows::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XRow::static_type(0);
-+}
-+uno::Reference< container::XEnumeration >
-+SwVbaRows::createEnumeration() throw (uno::RuntimeException)
-+{
-+ return new RowsEnumWrapper( this, mxContext, mxTextTable );
-+}
-+
-+uno::Any
-+SwVbaRows::createCollectionObject( const uno::Any& aSource )
-+{
-+ return aSource;
-+}
-+
-+rtl::OUString&
-+SwVbaRows::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaRows") );
-+ return sImplName;
-+}
-+
-+uno::Sequence<rtl::OUString>
-+SwVbaRows::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Rows") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbarows.hxx sw/source/ui/vba/vbarows.hxx
-new file mode 100644
-index 0000000..ccff1ef
---- /dev/null
-+++ sw/source/ui/vba/vbarows.hxx
-@@ -0,0 +1,87 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_ROWS_HXX
-+#define SW_VBA_ROWS_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XRows.hpp>
-+#include <ooo/vba/word/XColumns.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/table/XTableRows.hpp>
-+#include <com/sun/star/text/XTextTable.hpp>
-+
-+typedef CollTestImplHelper< ooo::vba::word::XRows > SwVbaRows_BASE;
-+
-+class SwVbaRows : public SwVbaRows_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XTextTable > mxTextTable;
-+ css::uno::Reference< css::table::XTableRows > mxTableRows;
-+ sal_Int32 mnStartRowIndex;
-+ sal_Int32 mnEndRowIndex;
-+
-+private:
-+ void setIndentWithAdjustNone( sal_Int32 indent ) throw (css::uno::RuntimeException);
-+ void setIndentWithAdjustFirstColumn( const css::uno::Reference< ooo::vba::word::XColumns >& xColumns, sal_Int32 indent ) throw (css::uno::RuntimeException);
-+ void setIndentWithAdjustProportional( const css::uno::Reference< ooo::vba::word::XColumns >& xColumns, sal_Int32 indent ) throw (css::uno::RuntimeException);
-+ void setIndentWithAdjustSameWidth( const css::uno::Reference< ooo::vba::word::XColumns >& xColumns, sal_Int32 indent ) throw (css::uno::RuntimeException);
-+
-+public:
-+ SwVbaRows( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::text::XTextTable >& xTextTable, const css::uno::Reference< css::table::XTableRows >& xTableRows ) throw ( css::uno::RuntimeException );
-+ SwVbaRows( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::text::XTextTable >& xTextTable, const css::uno::Reference< css::table::XTableRows >& xTableRows, sal_Int32 nStarIndex, sal_Int32 nEndIndex ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaRows() {}
-+
-+ // Attributes
-+ virtual ::sal_Int32 SAL_CALL getAlignment() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setAlignment( ::sal_Int32 _alignment ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL getAllowBreakAcrossPages() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setAllowBreakAcrossPages( const css::uno::Any& _allowbreakacrosspages ) throw (css::uno::RuntimeException);
-+ virtual float SAL_CALL getSpaceBetweenColumns() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setSpaceBetweenColumns( float _spacebetweencolumns ) throw (css::uno::RuntimeException);
-+
-+ // Methods
-+ virtual void SAL_CALL Delete( ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL SetLeftIndent( float LeftIndent, ::sal_Int32 RulerStyle ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL Select( ) throw (css::uno::RuntimeException);
-+
-+ //XCollection
-+ virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException);
-+ 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 );
-+ // 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);
-+
-+ // SwVbaRows_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* SW_VBA_ROWS_HXX */
-diff --git sw/source/ui/vba/vbasection.cxx sw/source/ui/vba/vbasection.cxx
-index 4df6f0b..fd747b3 100644
---- sw/source/ui/vba/vbasection.cxx
-+++ sw/source/ui/vba/vbasection.cxx
-@@ -28,6 +28,7 @@
- #include <vbahelper/vbahelper.hxx>
- #include <tools/diagnose_ex.h>
- #include "vbapagesetup.hxx"
-+#include "vbaheadersfooters.hxx"
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-@@ -50,14 +51,20 @@ void SAL_CALL SwVbaSection::setProtectedForForms( ::sal_Bool /*_protectedforform
- {
- }
-
--uno::Any SAL_CALL SwVbaSection::Headers( ) throw (uno::RuntimeException)
-+uno::Any SAL_CALL SwVbaSection::Headers( const uno::Any& index ) throw (uno::RuntimeException)
- {
-- return uno::Any();
-+ uno::Reference< XCollection > xCol( new SwVbaHeadersFooters( this, mxContext, mxModel, mxPageProps, sal_True ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
- }
-
--uno::Any SAL_CALL SwVbaSection::Footers( ) throw (uno::RuntimeException)
-+uno::Any SAL_CALL SwVbaSection::Footers( const uno::Any& index ) throw (uno::RuntimeException)
- {
-- return uno::Any();
-+ uno::Reference< XCollection > xCol( new SwVbaHeadersFooters( this, mxContext, mxModel, mxPageProps, sal_False ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
- }
-
- uno::Any SAL_CALL
-diff --git sw/source/ui/vba/vbasection.hxx sw/source/ui/vba/vbasection.hxx
-index 9dd4058..dc1984f 100644
---- sw/source/ui/vba/vbasection.hxx
-+++ sw/source/ui/vba/vbasection.hxx
-@@ -48,8 +48,8 @@ public:
- virtual void SAL_CALL setProtectedForForms( ::sal_Bool _protectedforforms ) throw (css::uno::RuntimeException);
-
- // Methods
-- virtual css::uno::Any SAL_CALL Headers( ) throw (css::uno::RuntimeException);
-- virtual css::uno::Any SAL_CALL Footers( ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Headers( const css::uno::Any& index ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Footers( const css::uno::Any& index ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL PageSetup( ) throw (css::uno::RuntimeException);
-
- // XHelperInterface
-diff --git sw/source/ui/vba/vbasections.cxx sw/source/ui/vba/vbasections.cxx
-index 8e6cbee..dfd0eda 100644
---- sw/source/ui/vba/vbasections.cxx
-+++ sw/source/ui/vba/vbasections.cxx
-@@ -87,6 +87,15 @@ public:
- }
- }
-
-+ SectionCollectionHelper( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XTextRange >& xTextRange ) throw (uno::RuntimeException) : mxParent( xParent ), mxContext( xContext ), mxModel( xModel )
-+ {
-+ // Hacky implementation of Range.Sections, only support 1 secction
-+ uno::Reference< beans::XPropertySet > xRangeProps( xTextRange, uno::UNO_QUERY_THROW );
-+ uno::Reference< style::XStyle > xStyle = word::getCurrentPageStyle( mxModel, xRangeProps );
-+ uno::Reference< beans::XPropertySet > xPageProps( xStyle, uno::UNO_QUERY_THROW );
-+ mxSections.push_back( xPageProps );
-+ }
-+
- ~SectionCollectionHelper(){}
-
- // XIndexAccess
-@@ -120,14 +129,13 @@ public:
- class SectionsEnumWrapper : public EnumerationHelperImpl
- {
- uno::Reference< frame::XModel > mxModel;
-- uno::WeakReference< XHelperInterface > mxParent;
- public:
-- SectionsEnumWrapper( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration, const uno::Reference< frame::XModel >& xModel ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xContext, xEnumeration ), mxModel( xModel ), mxParent( xParent ) {}
-+ SectionsEnumWrapper( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration, const uno::Reference< frame::XModel >& xModel ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xParent, xContext, xEnumeration ), mxModel( xModel ){}
-
- virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
- {
- uno::Reference< beans::XPropertySet > xPageProps( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
-- return uno::makeAny( uno::Reference< word::XSection > ( new SwVbaSection( mxParent, m_xContext, mxModel, xPageProps ) ) );
-+ return uno::makeAny( uno::Reference< word::XSection > ( new SwVbaSection( m_xParent, m_xContext, mxModel, xPageProps ) ) );
- }
- };
-
-@@ -135,6 +143,10 @@ SwVbaSections::SwVbaSections( const uno::Reference< XHelperInterface >& xParent,
- {
- }
-
-+SwVbaSections::SwVbaSections( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XTextRange >& xTextRange ): SwVbaSections_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new SectionCollectionHelper( xParent, xContext, xModel, xTextRange ) ) ), mxModel( xModel )
-+{
-+}
-+
- uno::Any SAL_CALL
- SwVbaSections::PageSetup( ) throw (uno::RuntimeException)
- {
-diff --git sw/source/ui/vba/vbasections.hxx sw/source/ui/vba/vbasections.hxx
-index 9cb35cf..74812a3 100644
---- sw/source/ui/vba/vbasections.hxx
-+++ sw/source/ui/vba/vbasections.hxx
-@@ -31,6 +31,7 @@
- #include <ooo/vba/word/XSections.hpp>
- #include <com/sun/star/container/XEnumerationAccess.hpp>
- #include <com/sun/star/container/XIndexAccess.hpp>
-+#include <com/sun/star/text/XTextRange.hpp>
- #include <vbahelper/vbahelperinterface.hxx>
-
- typedef CollTestImplHelper< ooo::vba::word::XSections > SwVbaSections_BASE;
-@@ -42,6 +43,7 @@ private:
-
- public:
- SwVbaSections( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel );
-+ SwVbaSections( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XTextRange >& xTextRange );
- virtual ~SwVbaSections() {}
-
- // XEnumerationAccess
-diff --git sw/source/ui/vba/vbaselection.cxx sw/source/ui/vba/vbaselection.cxx
-index 17d4e2f..90c9e51 100644
---- sw/source/ui/vba/vbaselection.cxx
-+++ sw/source/ui/vba/vbaselection.cxx
-@@ -29,7 +29,6 @@
- #include <tools/diagnose_ex.h>
- #include "vbarange.hxx"
- #include "vbafind.hxx"
--#include "wordvbahelper.hxx"
- #include <com/sun/star/text/XTextRange.hpp>
- #include <com/sun/star/text/XTextTable.hpp>
- #include <com/sun/star/text/XTextTableCursor.hpp>
-@@ -41,14 +40,19 @@
- #include <ooo/vba/word/WdGoToDirection.hpp>
- #include <ooo/vba/word/XBookmark.hpp>
- #include <ooo/vba/word/XApplication.hpp>
-+#include <ooo/vba/word/WdCollapseDirection.hpp>
- #include <com/sun/star/text/XPageCursor.hpp>
- #include "unotbl.hxx"
- #include "unocoll.hxx"
- #include "vbatable.hxx"
- #include <com/sun/star/view/XSelectionSupplier.hpp>
- #include <com/sun/star/view/XViewCursor.hpp>
-+#include <com/sun/star/view/XLineCursor.hpp>
-+#include <com/sun/star/text/XWordCursor.hpp>
-+#include <com/sun/star/text/XParagraphCursor.hpp>
- #include <ooo/vba/word/WdInformation.hpp>
- #include <ooo/vba/word/WdHeaderFooterIndex.hpp>
-+#include <ooo/vba/word/WdSeekView.hpp>
- #include "vbainformationhelper.hxx"
- #include "vbafield.hxx"
- #include "vbaheaderfooter.hxx"
-@@ -56,6 +60,17 @@
- #include <vbahelper/vbashaperange.hxx>
- #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
- #include <com/sun/star/drawing/XDrawPage.hpp>
-+#include <com/sun/star/text/ControlCharacter.hpp>
-+#include "vbarows.hxx"
-+#include "vbacolumns.hxx"
-+#include "vbatablehelper.hxx"
-+#include "vbacells.hxx"
-+#include "vbaview.hxx"
-+#include "vbaparagraph.hxx"
-+#include "vbastyle.hxx"
-+#include <docsh.hxx>
-+#include <tblenum.hxx>
-+#include <fesh.hxx>
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-@@ -123,23 +138,25 @@ SwVbaSelection::HomeKey( const uno::Any& _unit, const uno::Any& _extend ) throw
- sal_Int32 nExtend = word::WdMovementType::wdMove;
- _unit >>= nUnit;
- _extend >>= nExtend;
-+ sal_Bool bExtend = ( nExtend == word::WdMovementType::wdExtend ) ? sal_True : sal_False;
-
- switch( nUnit )
- {
- case word::WdUnits::wdStory:
- {
-+ // go to the valid text first so that the current view cursor is valid to call gotoRange.
-+ word::gotoSelectedObjectAnchor(mxModel);
- // go to the begin of the document
-- rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToStartOfDoc"));
-- dispatchRequests( mxModel,url );
-- // If something is selected, it needs to go twice
-- dispatchRequests( mxModel,url );
-+ uno::Reference< text::XText > xCurrentText = word::getCurrentXText( mxModel );
-+ uno::Reference< text::XTextRange > xFirstRange = word::getFirstObjectPosition( xCurrentText );
-+ mxTextViewCursor->gotoRange( xFirstRange, bExtend );
- break;
- }
- case word::WdUnits::wdLine:
- {
- // go to the begin of the Line
-- rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToStartOfLine"));
-- dispatchRequests( mxModel,url );
-+ uno::Reference< view::XLineCursor > xLineCursor( mxTextViewCursor, uno::UNO_QUERY_THROW );
-+ xLineCursor->gotoStartOfLine( bExtend );
- break;
- }
- default:
-@@ -157,23 +174,25 @@ SwVbaSelection::EndKey( const uno::Any& _unit, const uno::Any& _extend ) throw (
- sal_Int32 nExtend = word::WdMovementType::wdMove;
- _unit >>= nUnit;
- _extend >>= nExtend;
-+ sal_Bool bExtend = ( nExtend == word::WdMovementType::wdExtend ) ? sal_True : sal_False;
-
- switch( nUnit )
- {
- case word::WdUnits::wdStory:
- {
-- // go to the end of the document
-- rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToEndOfDoc"));
-- dispatchRequests( mxModel,url );
-- // If something is selected, it needs to go twice
-- dispatchRequests( mxModel,url );
-+ // go to the valid text first so that the current view cursor is valid to call gotoRange.
-+ word::gotoSelectedObjectAnchor(mxModel);
-+ // go to the end of the document
-+ uno::Reference< text::XText > xCurrentText = word::getCurrentXText( mxModel );
-+ uno::Reference< text::XTextRange > xEnd = xCurrentText->getEnd();
-+ mxTextViewCursor->gotoRange( xEnd, bExtend );
- break;
- }
- case word::WdUnits::wdLine:
- {
- // go to the end of the Line
-- rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToEndOfLine"));
-- dispatchRequests( mxModel,url );
-+ uno::Reference< view::XLineCursor > xLineCursor( mxTextViewCursor, uno::UNO_QUERY_THROW );
-+ xLineCursor->gotoEndOfLine( bExtend );
- break;
- }
- default:
-@@ -185,14 +204,161 @@ SwVbaSelection::EndKey( const uno::Any& _unit, const uno::Any& _extend ) throw (
- }
-
- void SAL_CALL
--SwVbaSelection::Delete( const uno::Any& /*_unit*/, const uno::Any& /*_count*/ ) throw ( uno::RuntimeException )
-+SwVbaSelection::Delete( const uno::Any& _unit, const uno::Any& _count ) throw ( uno::RuntimeException )
- {
-- // FIXME: handle the arguments: _unit and _count
-+ sal_Int32 nUnit = word::WdUnits::wdLine;
-+ sal_Int32 nCount = 0;
-+ if( _count.hasValue() )
-+ _count >>= nCount;
-+ if( _unit.hasValue() && ( nCount > 0 ) )
-+ {
-+ _unit >>= nUnit;
-+ switch( nUnit )
-+ {
-+ case word::WdUnits::wdCharacter:
-+ {
-+ if( HasSelection() )
-+ nCount--;
-+ mxTextViewCursor->goRight( nCount, sal_True );
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+ }
-+ }
- rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Delete"));
- dispatchRequests( mxModel,url );
- }
-
--void SwVbaSelection::NextCell( sal_Int32 nCount, E_DIRECTION eDirection ) throw ( uno::RuntimeException )
-+void
-+SwVbaSelection::Move( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend, word::E_DIRECTION eDirection ) throw ( uno::RuntimeException )
-+{
-+ sal_Int32 nUnit = word::WdUnits::wdCharacter;
-+ sal_Int32 nCount = 1;
-+ sal_Int32 nExtend = word::WdMovementType::wdMove;
-+
-+ if( _unit.hasValue() )
-+ _unit >>= nUnit;
-+ if( _count.hasValue() )
-+ _count >>= nCount;
-+ if( _extend.hasValue() )
-+ _extend >>= nExtend;
-+
-+ if( nCount == 0 )
-+ return;
-+
-+ sal_Bool bExpand = ( nExtend == word::WdMovementType::wdMove ) ? sal_False : sal_True;
-+
-+ switch( nUnit )
-+ {
-+ case word::WdUnits::wdCell:
-+ {
-+ if( nExtend == word::WdMovementType::wdExtend )
-+ {
-+ DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
-+ return;
-+ }
-+ NextCell( nCount, eDirection );
-+ break;
-+ }
-+ case word::WdUnits::wdLine:
-+ {
-+ if( eDirection == word::MOVE_LEFT || eDirection == word::MOVE_RIGHT )
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+ uno::Reference< view::XViewCursor > xViewCursor( mxTextViewCursor, uno::UNO_QUERY_THROW );
-+ if( eDirection == word::MOVE_UP )
-+ xViewCursor->goUp( nCount, bExpand );
-+ else if( eDirection == word::MOVE_DOWN )
-+ xViewCursor->goDown( nCount, bExpand );
-+ break;
-+ }
-+ case word::WdUnits::wdCharacter:
-+ {
-+ if( eDirection == word::MOVE_UP || eDirection == word::MOVE_DOWN )
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+ if( word::gotoSelectedObjectAnchor( mxModel ) )
-+ {
-+ nCount--;
-+ }
-+ uno::Reference< view::XViewCursor > xViewCursor( mxTextViewCursor, uno::UNO_QUERY_THROW );
-+ if( eDirection == word::MOVE_LEFT )
-+ {
-+ // if current select is a cellrange or table,
-+ // the first count of move should move to the first selected cell.
-+ uno::Reference< text::XTextTableCursor > xTextTableCursor( mxModel->getCurrentSelection(), uno::UNO_QUERY );
-+ if ( xTextTableCursor.is() )
-+ {
-+ uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextTable > xTextTable;
-+ xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ) >>= xTextTable;
-+ if( xTextTable.is() )
-+ {
-+ uno::Reference< text::XTextRange > xRange( xTextTable->getCellByName( xTextTableCursor->getRangeName()), uno::UNO_QUERY_THROW );
-+ mxTextViewCursor->gotoRange( xRange->getStart(), bExpand );
-+ nCount--;
-+ }
-+ }
-+ xViewCursor->goLeft( nCount, bExpand );
-+ }
-+ else if( eDirection == word::MOVE_RIGHT )
-+ xViewCursor->goRight( nCount, bExpand );
-+ break;
-+ }
-+ case word::WdUnits::wdWord:
-+ case word::WdUnits::wdParagraph:
-+ {
-+ uno::Reference< text::XTextRange > xRange = GetSelectedRange();
-+ uno::Reference< text::XText > xText = xRange->getText();
-+ uno::Reference< text::XTextCursor > xTextCursor = xText->createTextCursorByRange( xRange );
-+ if( nUnit == word::WdUnits::wdParagraph )
-+ {
-+ if( eDirection == word::MOVE_LEFT || eDirection == word::MOVE_RIGHT )
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+ uno::Reference< text::XParagraphCursor > xParagraphCursor( xTextCursor, uno::UNO_QUERY_THROW );
-+ for( sal_Int32 i=0; i<nCount; i++ )
-+ {
-+ if( ( eDirection == word::MOVE_UP ) && ( xParagraphCursor->gotoPreviousParagraph( bExpand ) == sal_False ) )
-+ break;
-+ else if( ( eDirection == word::MOVE_DOWN ) && ( xParagraphCursor->gotoNextParagraph( bExpand ) == sal_False ) )
-+ break;
-+ }
-+ }
-+ else if( nUnit == word::WdUnits::wdWord )
-+ {
-+ if( eDirection == word::MOVE_UP || eDirection == word::MOVE_DOWN )
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+ uno::Reference< text::XWordCursor > xWordCursor( xTextCursor, uno::UNO_QUERY_THROW );
-+ for( sal_Int32 i=0; i<nCount; i++ )
-+ {
-+ if( (eDirection == word::MOVE_LEFT ) && ( xWordCursor->gotoPreviousWord( bExpand ) == sal_False ) )
-+ break;
-+ else if( ( eDirection == word::MOVE_RIGHT ) && ( xWordCursor->gotoNextWord( bExpand ) == sal_False ) )
-+ break;
-+ }
-+ }
-+ mxTextViewCursor->gotoRange( xTextCursor->getStart(), sal_False );
-+ mxTextViewCursor->gotoRange( xTextCursor->getEnd(), sal_True );
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ break;
-+ }
-+ }
-+}
-+
-+void SwVbaSelection::NextCell( sal_Int32 nCount, word::E_DIRECTION eDirection ) throw ( uno::RuntimeException )
- {
- uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
- uno::Reference< text::XTextTable > xTextTable;
-@@ -211,22 +377,22 @@ void SwVbaSelection::NextCell( sal_Int32 nCount, E_DIRECTION eDirection ) throw
- // move the table cursor
- switch( eDirection )
- {
-- case MOVE_LEFT:
-+ case word::MOVE_LEFT:
- {
- xTextTableCursor->goLeft( nCount, sal_False );
- break;
- }
-- case MOVE_RIGHT:
-+ case word::MOVE_RIGHT:
- {
- xTextTableCursor->goRight( nCount, sal_False );
- break;
- }
-- case MOVE_UP:
-+ case word::MOVE_UP:
- {
- xTextTableCursor->goUp( nCount, sal_False );
- break;
- }
-- case MOVE_DOWN:
-+ case word::MOVE_DOWN:
- {
- xTextTableCursor->goDown( nCount, sal_False );
- break;
-@@ -245,61 +411,29 @@ void SwVbaSelection::NextCell( sal_Int32 nCount, E_DIRECTION eDirection ) throw
- void SAL_CALL
- SwVbaSelection::MoveRight( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend ) throw ( uno::RuntimeException )
- {
-- sal_Int32 nUnit = word::WdUnits::wdCharacter;
- sal_Int32 nCount = 1;
-- sal_Int32 nExtend = word::WdMovementType::wdMove;
-
-- if( _unit.hasValue() )
-- _unit >>= nUnit;
- if( _count.hasValue() )
- _count >>= nCount;
-- if( _extend.hasValue() )
-- _extend >>= nExtend;
-
- if( nCount == 0 )
- return;
-
- if( nCount < 0 )
- {
-- // TODO: call MoveLeft;
- MoveLeft( _unit, uno::makeAny( -nCount ), _extend );
- return;
- }
--
-- switch( nUnit )
-- {
-- case word::WdUnits::wdCell:
-- {
-- if( nExtend == word::WdMovementType::wdExtend )
-- {
-- DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
-- return;
-- }
-- NextCell( nCount, MOVE_RIGHT );
-- break;
-- }
-- default:
-- {
-- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-- break;
-- }
-- }
-
-+ Move( _unit, _count, _extend, word::MOVE_RIGHT );
- }
-
- void SAL_CALL
- SwVbaSelection::MoveLeft( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend ) throw ( uno::RuntimeException )
- {
-- sal_Int32 nUnit = word::WdUnits::wdCharacter;
- sal_Int32 nCount = 1;
-- sal_Int32 nExtend = word::WdMovementType::wdMove;
--
-- if( _unit.hasValue() )
-- _unit >>= nUnit;
- if( _count.hasValue() )
- _count >>= nCount;
-- if( _extend.hasValue() )
-- _extend >>= nExtend;
-
- if( nCount == 0 )
- return;
-@@ -310,67 +444,47 @@ SwVbaSelection::MoveLeft( const uno::Any& _unit, const uno::Any& _count, const u
- return;
- }
-
-- switch( nUnit )
-- {
-- case word::WdUnits::wdCell:
-- {
-- if( nExtend == word::WdMovementType::wdExtend )
-- {
-- DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
-- return;
-- }
-- NextCell( nCount, MOVE_LEFT );
-- break;
-- }
-- default:
-- {
-- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-- break;
-- }
-- }
--
-+ Move( _unit, _count, _extend, word::MOVE_LEFT );
- }
-
- void SAL_CALL
- SwVbaSelection::MoveDown( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend ) throw ( uno::RuntimeException )
- {
-- sal_Int32 nUnit = word::WdUnits::wdCharacter;
- sal_Int32 nCount = 1;
-- sal_Int32 nExtend = word::WdMovementType::wdMove;
-
-- if( _unit.hasValue() )
-- _unit >>= nUnit;
- if( _count.hasValue() )
- _count >>= nCount;
-- if( _extend.hasValue() )
-- _extend >>= nExtend;
-
- if( nCount == 0 )
- return;
-
- if( nCount < 0 )
- {
-- // TODO: call MoveLeft;
-- //MoveUp( _unit, uno::makeAny( -nCount ), _extend );
-+ MoveUp( _unit, uno::makeAny( -nCount ), _extend );
- return;
- }
-
-- switch( nUnit )
-+ Move( _unit, _count, _extend, word::MOVE_DOWN );
-+}
-+
-+void SAL_CALL
-+SwVbaSelection::MoveUp( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend ) throw ( uno::RuntimeException )
-+{
-+ sal_Int32 nCount = 1;
-+
-+ if( _count.hasValue() )
-+ _count >>= nCount;
-+
-+ if( nCount == 0 )
-+ return;
-+
-+ if( nCount < 0 )
- {
-- case word::WdUnits::wdLine:
-- {
-- uno::Reference< view::XViewCursor > xViewCursor( mxTextViewCursor, uno::UNO_QUERY_THROW );
-- sal_Bool bExpand = ( nExtend == word::WdMovementType::wdMove ) ? sal_False : sal_True;
-- xViewCursor->goDown( nCount, bExpand );
-- break;
-- }
-- default:
-- {
-- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-- break;
-- }
-+ MoveDown( _unit, uno::makeAny( -nCount ), _extend );
-+ return;
- }
--
-+
-+ Move( _unit, _count, _extend, word::MOVE_UP );
- }
-
- void SAL_CALL
-@@ -422,16 +536,17 @@ SwVbaSelection::getFind() throw ( uno::RuntimeException )
- return uno::Reference< word::XFind >( new SwVbaFind( this, mxContext, mxModel, xTextRange ) );
- }
-
--uno::Reference< word::XStyle > SAL_CALL
-+uno::Any SAL_CALL
- SwVbaSelection::getStyle() throw ( uno::RuntimeException )
- {
- return getRange()->getStyle();
- }
-
- void SAL_CALL
--SwVbaSelection::setStyle( const uno::Reference< word::XStyle >& rStyle ) throw ( uno::RuntimeException )
-+SwVbaSelection::setStyle( const uno::Any& rStyle ) throw ( uno::RuntimeException )
- {
-- return getRange()->setStyle( rStyle );
-+ uno::Reference< beans::XPropertySet > xParaProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
-+ return SwVbaStyle::setStyle( xParaProps, rStyle );
- }
-
- uno::Reference< word::XFont > SAL_CALL
-@@ -474,39 +589,79 @@ uno::Reference< word::XRange > SAL_CALL SwVbaSelection::GoTo( const uno::Any& _w
- sal_Int32 nWhich = 0;
- if( _which.hasValue() )
- _which >>= nWhich;
-- sal_Int32 nPage = 0;
-- switch( nWhich )
-- {
-- case word::WdGoToDirection::wdGoToLast:
-- {
-- nPage = nLastPage;
-- break;
-- }
-- case word::WdGoToDirection::wdGoToNext:
-- {
-- nPage = nCurrPage + 1;
-- break;
-- }
-- case word::WdGoToDirection::wdGoToPrevious:
-- {
-- nPage = nCurrPage - 1;
-- break;
-- }
-- default:
-- {
-- nPage = nCount;
-- }
-- }
-- if( nPage <= 0 )
-- nPage = 1;
-- if( nPage > nLastPage )
-- nPage = nLastPage;
-- xPageCursor->jumpToPage( ( sal_Int16 )( nPage ) );
-- break;
-+ sal_Int32 nPage = 0;
-+ switch( nWhich )
-+ {
-+ case word::WdGoToDirection::wdGoToLast:
-+ {
-+ nPage = nLastPage;
-+ break;
-+ }
-+ case word::WdGoToDirection::wdGoToNext:
-+ {
-+ if( nCount !=0 )
-+ nPage = nCurrPage + nCount;
-+ else
-+ nPage = nCurrPage + 1;
-+ break;
-+ }
-+ case word::WdGoToDirection::wdGoToPrevious:
-+ {
-+ if( nCount !=0 )
-+ nPage = nCurrPage - nCount;
-+ else
-+ nPage = nCurrPage - 1;
-+ break;
-+ }
-+ default:
-+ {
-+ nPage = nCount;
-+ }
-+ }
-+ if( _name.hasValue() )
-+ {
-+ rtl::OUString sName;
-+ _name >>= sName;
-+ sal_Int32 nName = sName.toInt32();
-+ if( nName !=0 )
-+ nPage = nName;
-+ }
-+ if( nPage <= 0 )
-+ nPage = 1;
-+ if( nPage > nLastPage )
-+ nPage = nLastPage;
-+ xPageCursor->jumpToPage( ( sal_Int16 )( nPage ) );
-+ break;
- }
- case word::WdGoToItem::wdGoToSection:
- {
-- // TODO: implement Section object
-+ uno::Reference< text::XPageCursor > xPageCursor( mxTextViewCursor, uno::UNO_QUERY_THROW );
-+ sal_Int32 nCount = 0;
-+ if( _count.hasValue() )
-+ _count >>= nCount;
-+ sal_Int32 nWhich = 0;
-+ if( _which.hasValue() )
-+ _which >>= nWhich;
-+ sal_Int32 nPage = 0;
-+ switch( nWhich )
-+ {
-+ case word::WdGoToDirection::wdGoToAbsolute:
-+ {
-+ // currently only support this type
-+ if( nCount == 1 )
-+ nPage = 1;
-+ break;
-+ }
-+ default:
-+ {
-+ nPage = 0;
-+ }
-+ }
-+ if( nPage != 0 )
-+ xPageCursor->jumpToPage( ( sal_Int16 )( nPage ) );
-+ else
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ break;
- }
- default:
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-@@ -546,6 +701,82 @@ uno::Any SAL_CALL SwVbaSelection::Information( sal_Int32 _type ) throw (uno::Run
- result = uno::makeAny( SwVbaInformationHelper::handleWdVerticalPositionRelativeToPage( mxModel, mxTextViewCursor ) );
- break;
- }
-+ case word::WdInformation::wdWithInTable:
-+ {
-+ uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextTable > xTextTable;
-+ xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ) >>= xTextTable;
-+ if( xTextTable.is() )
-+ result = uno::makeAny( sal_True );
-+ else
-+ result = uno::makeAny( sal_False );
-+ break;
-+ }
-+ case word::WdInformation::wdHeaderFooterType:
-+ {
-+ uno::Reference< word::XView > xView( new SwVbaView( this, mxContext, mxModel ) );
-+ sal_Int32 nView = xView->getSeekView();
-+ sal_Int32 nHeaderFooterType = 0;
-+ switch( nView )
-+ {
-+ case word::WdSeekView::wdSeekMainDocument:
-+ {
-+ nHeaderFooterType = -1; // not in a header or footer
-+ break;
-+ }
-+ case word::WdSeekView::wdSeekEvenPagesHeader:
-+ {
-+ nHeaderFooterType = 0; // even page header
-+ break;
-+ }
-+ case word::WdSeekView::wdSeekPrimaryHeader:
-+ {
-+ nHeaderFooterType = 1; // odd page header
-+ break;
-+ }
-+ case word::WdSeekView::wdSeekEvenPagesFooter:
-+ {
-+ nHeaderFooterType = 2; // even page footer
-+ break;
-+ }
-+ case word::WdSeekView::wdSeekPrimaryFooter:
-+ {
-+ nHeaderFooterType = 3; // odd page footer
-+ break;
-+ }
-+ case word::WdSeekView::wdSeekFirstPageHeader:
-+ case word::WdSeekView::wdSeekFirstPageFooter:
-+ {
-+ uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
-+ rtl::OUString aPageStyleName;
-+ xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyleName"))) >>= aPageStyleName;
-+ sal_Bool bFirstPage = sal_False;
-+ if( aPageStyleName.equalsAscii( "First Page" ) )
-+ bFirstPage = sal_True;
-+ if( nView == word::WdSeekView::wdSeekFirstPageHeader )
-+ {
-+ if( bFirstPage )
-+ nHeaderFooterType = 4;
-+ else
-+ nHeaderFooterType = 1;
-+ }
-+ else
-+ {
-+ if( bFirstPage )
-+ nHeaderFooterType = 5;
-+ else
-+ nHeaderFooterType = 3;
-+ }
-+ break;
-+ }
-+ default:
-+ {
-+ nHeaderFooterType = -1;
-+ }
-+ }
-+ result = uno::makeAny( nHeaderFooterType );
-+ break;
-+ }
- default:
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
- }
-@@ -566,11 +797,6 @@ SwVbaSelection::Tables( const uno::Any& aIndex ) throw (uno::RuntimeException)
- // we can only support a selection that is a single table
- if ( !aIndex.hasValue() ) // currently we can't support multiple tables in a selection
- throw uno::RuntimeException();
-- // if the current selection is a XTextTableCursor and the index is 1 then we can service this request, otherwise we just have to throw
-- uno::Reference< text::XTextTableCursor > xTextTableCursor( mxModel->getCurrentSelection(), uno::UNO_QUERY );
--
-- if ( !xTextTableCursor.is() )
-- throw uno::RuntimeException();
-
- sal_Int32 nIndex = 0;
- aIndex >>= nIndex;
-@@ -579,6 +805,24 @@ SwVbaSelection::Tables( const uno::Any& aIndex ) throw (uno::RuntimeException)
-
- if ( nIndex != 1 )
- throw uno::RuntimeException();
-+
-+ uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextTable > xTextTable;
-+ xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ) >>= xTextTable;
-+ if( xTextTable.is() )
-+ {
-+ uno::Reference< css::text::XTextDocument > xTextDoc( mxModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< word::XTable > xVBATbl = new SwVbaTable( mxParent, mxContext, xTextDoc, xTextTable );
-+ aRet <<= xVBATbl;
-+ return aRet;
-+ }
-+
-+ // if the current selection is a XTextTableCursor and the index is 1 then we can service this request, otherwise we just have to throw
-+ uno::Reference< text::XTextTableCursor > xTextTableCursor( mxModel->getCurrentSelection(), uno::UNO_QUERY );
-+
-+ if ( !xTextTableCursor.is() )
-+ throw uno::RuntimeException();
-+
- SwXTextTableCursor* pTTCursor = dynamic_cast< SwXTextTableCursor* >( xTextTableCursor.get() );
- if ( pTTCursor )
- {
-@@ -608,15 +852,14 @@ SwVbaSelection::Fields( const uno::Any& index ) throw (uno::RuntimeException)
- uno::Reference< word::XHeaderFooter > SAL_CALL
- SwVbaSelection::getHeaderFooter() throw ( uno::RuntimeException )
- {
-- uno::Reference< text::XText > xCurrentText = word::getXTextViewCursor( mxModel )->getText();
-- if( HeaderFooterHelper::isHeader( mxModel, xCurrentText ) || HeaderFooterHelper::isFooter( mxModel, xCurrentText ) )
-+ if( HeaderFooterHelper::isHeaderFooter( mxModel ) )
- {
- uno::Reference< beans::XPropertySet > xPageStyleProps( word::getCurrentPageStyle( mxModel ), uno::UNO_QUERY_THROW );
- sal_Int32 nIndex = word::WdHeaderFooterIndex::wdHeaderFooterPrimary;
-- sal_Bool isHeader = HeaderFooterHelper::isHeader( mxModel, xCurrentText );
-- if( HeaderFooterHelper::isEvenPagesHeader( mxModel, xCurrentText ) || HeaderFooterHelper::isEvenPagesFooter( mxModel, xCurrentText ) )
-+ sal_Bool isHeader = HeaderFooterHelper::isHeader( mxModel );
-+ if( HeaderFooterHelper::isEvenPagesHeader( mxModel ) || HeaderFooterHelper::isEvenPagesFooter( mxModel ) )
- nIndex = word::WdHeaderFooterIndex::wdHeaderFooterEvenPages;
-- else if( HeaderFooterHelper::isFirstPageHeader( mxModel, xCurrentText ) || HeaderFooterHelper::isFirstPageFooter( mxModel, xCurrentText ) )
-+ else if( HeaderFooterHelper::isFirstPageHeader( mxModel ) || HeaderFooterHelper::isFirstPageFooter( mxModel ) )
- nIndex = word::WdHeaderFooterIndex::wdHeaderFooterFirstPage;
-
- return uno::Reference< word::XHeaderFooter >( new SwVbaHeaderFooter( this, mxContext, mxModel, xPageStyleProps, isHeader, nIndex ) );
-@@ -629,9 +872,13 @@ uno::Any SAL_CALL
- SwVbaSelection::ShapeRange( ) throw (uno::RuntimeException)
- {
- uno::Reference< drawing::XShapes > xShapes( mxModel->getCurrentSelection(), uno::UNO_QUERY );
--
- if ( !xShapes.is() )
-- throw uno::RuntimeException();
-+ {
-+ uno::Reference< drawing::XShape > xShape( mxModel->getCurrentSelection(), uno::UNO_QUERY_THROW );
-+ uno::Reference< lang::XMultiServiceFactory > xMSF( mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
-+ xShapes.set( xMSF->createInstance( rtl::OUString::createFromAscii( "com.sun.star.drawing.ShapeCollection" ) ), uno::UNO_QUERY_THROW );
-+ xShapes->add( xShape );
-+ }
-
- uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxModel, uno::UNO_QUERY_THROW );
- uno::Reference< drawing::XDrawPage > xDrawPage = xDrawPageSupplier->getDrawPage();
-@@ -658,6 +905,281 @@ void SAL_CALL SwVbaSelection::setEnd( ::sal_Int32 _end ) throw (uno::RuntimeExce
- getRange()->setEnd( _end );
- }
-
-+void SAL_CALL SwVbaSelection::SelectRow() throw (uno::RuntimeException)
-+{
-+ uno::Reference< word::XRows > xRows( Rows( uno::Any() ), uno::UNO_QUERY_THROW );
-+ xRows->Select();
-+}
-+
-+void SAL_CALL SwVbaSelection::SelectColumn() throw (uno::RuntimeException)
-+{
-+ uno::Reference< word::XColumns > xColumns( Columns( uno::Any() ), uno::UNO_QUERY_THROW );
-+ xColumns->Select();
-+}
-+
-+uno::Any SAL_CALL SwVbaSelection::Rows( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ rtl::OUString sTLName;
-+ rtl::OUString sBRName;
-+ GetSelectedCellRange( sTLName, sBRName );
-+
-+ sal_Int32 nStartRow = 0;
-+ sal_Int32 nEndRow = 0;
-+ uno::Reference< text::XTextTable > xTextTable = GetXTextTable();
-+ SwVbaTableHelper aTableHelper( xTextTable );
-+ nStartRow = aTableHelper.getTabRowIndex( sTLName );
-+ if( sBRName.getLength() > 0 )
-+ {
-+ nEndRow = aTableHelper.getTabRowIndex( sBRName );
-+ }
-+ else
-+ {
-+ nEndRow = nStartRow;
-+ }
-+
-+ uno::Reference< XCollection > xCol( new SwVbaRows( this, mxContext, xTextTable, xTextTable->getRows(), nStartRow, nEndRow ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+uno::Any SAL_CALL SwVbaSelection::Columns( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ rtl::OUString sTLName;
-+ rtl::OUString sBRName;
-+ GetSelectedCellRange( sTLName, sBRName );
-+ sal_Int32 nStartColumn = 0;
-+ sal_Int32 nEndColumn = 0;
-+
-+ uno::Reference< text::XTextTable > xTextTable = GetXTextTable();
-+ SwVbaTableHelper aTableHelper( xTextTable );
-+ nStartColumn = aTableHelper.getTabColIndex( sTLName );
-+ if( sBRName.getLength() > 0 )
-+ {
-+ nEndColumn = aTableHelper.getTabColIndex( sBRName );
-+ }
-+ else
-+ {
-+ nEndColumn = nStartColumn;
-+ }
-+
-+ uno::Reference< XCollection > xCol( new SwVbaColumns( this, mxContext, xTextTable, xTextTable->getColumns(), nStartColumn, nEndColumn ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+uno::Reference< text::XTextTable > SwVbaSelection::GetXTextTable() throw( uno::RuntimeException )
-+{
-+ uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextTable > xTextTable;
-+ xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ) >>= xTextTable;
-+ return xTextTable;
-+}
-+
-+sal_Bool SwVbaSelection::IsInTable() throw( uno::RuntimeException )
-+{
-+ uno::Reference< text::XTextTable > xTextTable = GetXTextTable();
-+ if( xTextTable.is() )
-+ return sal_True;
-+ return sal_False;
-+}
-+
-+sal_Bool SwVbaSelection::HasSelection() throw( uno::RuntimeException )
-+{
-+ uno::Reference< text::XTextRange > xStart = mxTextViewCursor->getStart();
-+ uno::Reference< text::XTextRange > xEnd = mxTextViewCursor->getEnd();
-+ uno::Reference< text::XTextRangeCompare > xTRC( mxTextViewCursor->getText(), uno::UNO_QUERY_THROW );
-+ if( xTRC->compareRegionStarts( xStart, xEnd ) == 0 && xTRC->compareRegionEnds( xStart, xEnd ) == 0 )
-+ return sal_False;
-+ return sal_True;
-+}
-+
-+void SwVbaSelection::GetSelectedCellRange( rtl::OUString& sTLName, rtl::OUString& sBRName ) throw( uno::RuntimeException )
-+{
-+ uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextTable > xTextTable;
-+ xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ) >>= xTextTable;
-+ if( !xTextTable.is() )
-+ throw uno::RuntimeException( );
-+
-+ uno::Reference< text::XTextTableCursor > xTextTableCursor( mxModel->getCurrentSelection(), uno::UNO_QUERY );
-+ if( xTextTableCursor.is() )
-+ {
-+ String sRange( xTextTableCursor->getRangeName() );
-+ if( sRange.GetTokenCount(':') > 0 )
-+ {
-+ sTLName = sRange.GetToken(0, ':');
-+ sBRName = sRange.GetToken(1, ':');
-+ }
-+ }
-+ if( !sTLName.getLength() )
-+ {
-+ uno::Reference< table::XCell > xCell;
-+ xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Cell") ) ) >>= xCell;
-+ if( !xCell.is() )
-+ {
-+ throw uno::RuntimeException( );
-+ }
-+ uno::Reference< beans::XPropertySet > xCellProps( xCell, uno::UNO_QUERY_THROW );
-+ xCellProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CellName") ) ) >>= sTLName;
-+ }
-+}
-+
-+uno::Any SAL_CALL SwVbaSelection::Cells( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ rtl::OUString sTLName;
-+ rtl::OUString sBRName;
-+ GetSelectedCellRange( sTLName, sBRName );
-+ sal_Int32 nLeft = 0;
-+ sal_Int32 nTop = 0;
-+ sal_Int32 nRight = 0;
-+ sal_Int32 nBottom = 0;
-+
-+ uno::Reference< text::XTextTable > xTextTable = GetXTextTable();
-+ SwVbaTableHelper aTableHelper( xTextTable );
-+ nLeft = aTableHelper.getTabColIndex( sTLName );
-+ nTop = aTableHelper.getTabRowIndex( sTLName );
-+ if( sBRName.getLength() > 0 )
-+ {
-+ nRight = aTableHelper.getTabColIndex( sBRName );
-+ nBottom = aTableHelper.getTabRowIndex( sBRName );
-+ }
-+ else
-+ {
-+ nRight = nLeft;
-+ nBottom = nTop;
-+ }
-+
-+ uno::Reference< XCollection > xCol( new SwVbaCells( this, mxContext, xTextTable, nLeft, nTop, nRight, nBottom ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+void SAL_CALL SwVbaSelection::Copy( ) throw (uno::RuntimeException)
-+{
-+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Copy"));
-+ dispatchRequests( mxModel,url );
-+}
-+
-+void SAL_CALL SwVbaSelection::CopyAsPicture( ) throw (uno::RuntimeException)
-+{
-+ // seems not support in Writer
-+ Copy();
-+}
-+
-+void SAL_CALL SwVbaSelection::Paste( ) throw (uno::RuntimeException)
-+{
-+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Paste"));
-+ dispatchRequests( mxModel,url );
-+}
-+
-+void SAL_CALL SwVbaSelection::Collapse( const uno::Any& Direction ) throw (uno::RuntimeException)
-+{
-+ if( word::gotoSelectedObjectAnchor( mxModel ) )
-+ return;
-+
-+ sal_Int32 nDirection = word::WdCollapseDirection::wdCollapseStart;
-+ if( Direction.hasValue() )
-+ Direction >>= nDirection;
-+
-+ uno::Reference< text::XTextViewCursor > xTextViewCursor = word::getXTextViewCursor( mxModel );
-+ if( nDirection == word::WdCollapseDirection::wdCollapseStart )
-+ {
-+ // it is inaccurate if current seleciton is multipul cells, so it needs to go to start
-+ uno::Reference< text::XTextRange > xTextRange = mxTextViewCursor->getStart();
-+ xTextViewCursor->gotoRange( xTextRange, sal_False );
-+ xTextViewCursor->collapseToStart();
-+ }
-+ else if( nDirection == word::WdCollapseDirection::wdCollapseEnd )
-+ {
-+ uno::Reference< text::XTextRange > xTextRange = mxTextViewCursor->getEnd();
-+ xTextViewCursor->gotoRange( xTextRange, sal_False );
-+ xTextViewCursor->collapseToEnd();
-+ }
-+ else
-+ {
-+ throw uno::RuntimeException();
-+ }
-+}
-+
-+void SAL_CALL SwVbaSelection::WholeStory( ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< text::XText > xText = word::getCurrentXText( mxModel );
-+ // FIXME: for i#7747,if the first line is a table, it fails to select all the contents in the story.
-+ // Temporary solution, insert an empty line before the table so that it could select all the contents.
-+ uno::Reference< container::XEnumerationAccess > xParaAccess( xText, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XEnumeration> xParaEnum = xParaAccess->createEnumeration();
-+ if( xParaEnum->hasMoreElements() )
-+ {
-+ uno::Reference< text::XTextTable > xTextTable( xParaEnum->nextElement(), uno::UNO_QUERY );
-+ if( xTextTable.is() )
-+ {
-+ // insert an empty line
-+ uno::Reference< text::XTextRange > xFirstCellRange = word::getFirstObjectPosition( xText );
-+ mxTextViewCursor->gotoRange( xFirstCellRange, sal_False );
-+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertPara"));
-+ dispatchRequests( mxModel,url );
-+ }
-+ }
-+ uno::Reference< text::XTextRange > xStart = xText->getStart();
-+ uno::Reference< text::XTextRange > xEnd = xText->getEnd();
-+ mxTextViewCursor->gotoRange( xStart, sal_False );
-+ mxTextViewCursor->gotoRange( xEnd, sal_True );
-+}
-+
-+::sal_Bool SAL_CALL SwVbaSelection::InRange( const uno::Reference< ::ooo::vba::word::XRange >& Range ) throw (uno::RuntimeException)
-+{
-+ return getRange()->InRange( Range );
-+}
-+
-+void SAL_CALL SwVbaSelection::SplitTable( ) throw (uno::RuntimeException)
-+{
-+ if( !IsInTable() )
-+ throw uno::RuntimeException();
-+
-+ SwDocShell* pDocShell = word::getDocShell( mxModel );
-+ if( pDocShell )
-+ {
-+ SwFEShell* pFEShell = pDocShell->GetFEShell();
-+ if( pFEShell )
-+ {
-+ pFEShell->SplitTable( HEADLINE_CNTNTCOPY );
-+ }
-+ }
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaSelection::Paragraphs( const uno::Any& aIndex ) throw (uno::RuntimeException)
-+{
-+ // Hacky implementation due to missing api ( and lack of knowledge )
-+ // we can only support a selection that is a single paragraph
-+ if ( !aIndex.hasValue() ) // currently we can't support multiple paragraphs in a selection
-+ throw uno::RuntimeException();
-+
-+ sal_Int32 nIndex = 0;
-+ aIndex >>= nIndex;
-+
-+ uno::Any aRet;
-+
-+ if ( nIndex != 1 )
-+ throw uno::RuntimeException();
-+
-+ uno::Reference< text::XTextRange > xTextRange = mxTextViewCursor->getStart();
-+ uno::Reference< text::XText > xText = xTextRange->getText();
-+ uno::Reference< text::XParagraphCursor > xParaCursor( xText->createTextCursor(), uno::UNO_QUERY_THROW );
-+ xParaCursor->gotoStartOfParagraph( sal_False );
-+ xParaCursor->gotoStartOfParagraph( sal_True );
-+
-+ uno::Reference< text::XTextDocument > xTextDoc( mxModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextRange > xParaRange( xParaCursor, uno::UNO_QUERY_THROW );
-+ uno::Reference< word::XParagraph > xParagraph = new SwVbaParagraph( mxParent, mxContext, xTextDoc, xParaRange );
-+
-+ aRet <<= xParagraph;
-+ return aRet;
-+}
-+
- rtl::OUString&
- SwVbaSelection::getServiceImplName()
- {
-diff --git sw/source/ui/vba/vbaselection.hxx sw/source/ui/vba/vbaselection.hxx
-index afbf79a..0b398cd 100644
---- sw/source/ui/vba/vbaselection.hxx
-+++ sw/source/ui/vba/vbaselection.hxx
-@@ -31,11 +31,13 @@
- #include <ooo/vba/word/XRange.hpp>
- #include <vbahelper/vbahelperinterface.hxx>
- #include <com/sun/star/text/XTextViewCursor.hpp>
-+#include <com/sun/star/text/XTextTable.hpp>
- #include <ooo/vba/word/XParagraphFormat.hpp>
- #include <ooo/vba/word/XFind.hpp>
- #include <ooo/vba/word/XStyle.hpp>
- #include <ooo/vba/word/XFont.hpp>
- #include <ooo/vba/word/XHeaderFooter.hpp>
-+#include "wordvbahelper.hxx"
-
- typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XSelection > SwVbaSelection_BASE;
-
-@@ -46,17 +48,14 @@ private:
- css::uno::Reference< css::text::XTextViewCursor > mxTextViewCursor;
- css::uno::Reference< ooo::vba::word::XRange > mxRange;
-
-- enum E_DIRECTION
-- {
-- MOVE_LEFT = 1,
-- MOVE_RIGHT,
-- MOVE_UP,
-- MOVE_DOWN
-- };
--
- private:
-- void NextCell( sal_Int32 nCount, E_DIRECTION eDirection ) throw ( css::uno::RuntimeException );
-+ void Move( const css::uno::Any& _unit, const css::uno::Any& _count, const css::uno::Any& _extend, ooo::vba::word::E_DIRECTION eDirection ) throw (css::uno::RuntimeException);
-+ void NextCell( sal_Int32 nCount, ooo::vba::word::E_DIRECTION eDirection ) throw ( css::uno::RuntimeException );
- css::uno::Reference< css::text::XTextRange > GetSelectedRange() throw ( css::uno::RuntimeException );
-+ void GetSelectedCellRange( rtl::OUString& sTLName, rtl::OUString& sBRName ) throw ( css::uno::RuntimeException );
-+ css::uno::Reference< css::text::XTextTable > GetXTextTable() throw ( css::uno::RuntimeException );
-+ sal_Bool IsInTable() throw ( css::uno::RuntimeException );
-+ sal_Bool HasSelection() throw ( css::uno::RuntimeException );
-
- public:
- SwVbaSelection( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& rModel ) throw ( css::uno::RuntimeException );
-@@ -73,6 +72,7 @@ public:
- virtual void SAL_CALL MoveRight( const css::uno::Any& _unit, const css::uno::Any& _count, const css::uno::Any& _extend ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL MoveLeft( const css::uno::Any& _unit, const css::uno::Any& _count, const css::uno::Any& _extend ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL MoveDown( const css::uno::Any& _unit, const css::uno::Any& _count, const css::uno::Any& _extend ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL MoveUp( const css::uno::Any& _unit, const css::uno::Any& _count, const css::uno::Any& _extend ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL TypeParagraph() throw (css::uno::RuntimeException);
- virtual void SAL_CALL InsertParagraph() throw (css::uno::RuntimeException);
- virtual void SAL_CALL InsertParagraphBefore() throw (css::uno::RuntimeException);
-@@ -80,8 +80,8 @@ public:
- virtual css::uno::Reference< ooo::vba::word::XParagraphFormat > SAL_CALL getParagraphFormat() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setParagraphFormat( const css::uno::Reference< ooo::vba::word::XParagraphFormat >& rParagraphFormat ) throw (css::uno::RuntimeException);
- virtual css::uno::Reference< ooo::vba::word::XFind > SAL_CALL getFind() throw (css::uno::RuntimeException);
-- virtual css::uno::Reference< ooo::vba::word::XStyle > SAL_CALL getStyle() throw (css::uno::RuntimeException);
-- virtual void SAL_CALL setStyle( const css::uno::Reference< ooo::vba::word::XStyle >& _xStyle ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL getStyle() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setStyle( const css::uno::Any& _xStyle ) throw (css::uno::RuntimeException);
- virtual css::uno::Reference< ooo::vba::word::XFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
- virtual void SAL_CALL TypeBackspace() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< ooo::vba::word::XRange > SAL_CALL GoTo( const css::uno::Any& _what, const css::uno::Any& _which, const css::uno::Any& _count, const css::uno::Any& _name ) throw (css::uno::RuntimeException);
-@@ -97,6 +97,19 @@ public:
- virtual void SAL_CALL setStart( ::sal_Int32 _start ) throw (css::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getEnd() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setEnd( ::sal_Int32 _end ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL SelectRow() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL SelectColumn() throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Rows( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Columns( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Cells( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL Copy( ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL CopyAsPicture( ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL Paste( ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL Collapse( const css::uno::Any& Direction ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL WholeStory( ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL InRange( const css::uno::Reference< ::ooo::vba::word::XRange >& Range ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL SplitTable( ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Paragraphs( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
-diff --git sw/source/ui/vba/vbastyle.cxx sw/source/ui/vba/vbastyle.cxx
-index a8bb6be..984dbae 100644
---- sw/source/ui/vba/vbastyle.cxx
-+++ sw/source/ui/vba/vbastyle.cxx
-@@ -28,15 +28,18 @@
- #include "vbastyle.hxx"
- #include <ooo/vba/word/WdStyleType.hpp>
- #include <com/sun/star/lang/Locale.hpp>
-+#include <com/sun/star/text/XTextDocument.hpp>
- #include <i18npool/mslangid.hxx>
- #include "vbafont.hxx"
- #include "vbapalette.hxx"
-+#include "vbaparagraphformat.hxx"
-+#include "vbastyles.hxx"
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-
-
--SwVbaStyle::SwVbaStyle( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< beans::XPropertySet >& _xPropertySet ) throw ( script::BasicErrorException, uno::RuntimeException ) : SwVbaStyle_BASE( xParent, xContext ) , mxStyleProps( _xPropertySet )
-+SwVbaStyle::SwVbaStyle( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel>& xModel, const uno::Reference< beans::XPropertySet >& _xPropertySet ) throw ( script::BasicErrorException, uno::RuntimeException ) : SwVbaStyle_BASE( xParent, xContext ) , mxModel( xModel ), mxStyleProps( _xPropertySet )
- {
- mxStyle.set( _xPropertySet, uno::UNO_QUERY_THROW );
- }
-@@ -84,7 +87,7 @@ void SAL_CALL SwVbaStyle::setLanguageID( ::sal_Int32 _languageid ) throw (uno::R
- nType = word::WdStyleType::wdStyleTypeParagraph;
- else if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.CharacterStyle") ) ) )
- nType = word::WdStyleType::wdStyleTypeCharacter;
-- else // if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.NumberingStyle") ) ) )
-+ else
- nType = word::WdStyleType::wdStyleTypeList;
- return nType;
- }
-@@ -96,10 +99,31 @@ SwVbaStyle::getFont() throw ( uno::RuntimeException )
- return new SwVbaFont( mxParent, mxContext, aColors.getPalette(), mxStyleProps );
- }
-
--void SwVbaStyle::setStyle( const uno::Reference< beans::XPropertySet >& xTCProps, const uno::Reference< ooo::vba::word::XStyle >& xStyle )throw (uno::RuntimeException)
-+
-+void SAL_CALL SwVbaStyle::LinkToListTemplate( const uno::Reference< word::XListTemplate >& /*ListTemplate*/, const uno::Any& /*ListLevelNumber*/ ) throw (uno::RuntimeException)
-+{
-+}
-+
-+void SwVbaStyle::setStyle( const uno::Reference< beans::XPropertySet >& xParaProps, const uno::Any& rStyle )throw (uno::RuntimeException)
- {
-- rtl::OUString aStyleType = getOOoStyleTypeFromMSWord( xStyle->getType() );
-- xTCProps->setPropertyValue( aStyleType, uno::makeAny( xStyle->getName() ) );
-+ rtl::OUString sStyle;
-+ uno::Reference< word::XStyle > xStyle;
-+ if( rStyle >>= xStyle )
-+ {
-+ sStyle = xStyle->getName();
-+ }
-+ else
-+ {
-+ rStyle >>= sStyle;
-+ }
-+
-+ if( sStyle.getLength() )
-+ {
-+ xParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaStyleName") ), uno::makeAny( sStyle ) );
-+ return;
-+ }
-+
-+ throw uno::RuntimeException();
- }
-
- rtl::OUString SwVbaStyle::getOOoStyleTypeFromMSWord( sal_Int32 _wdStyleType )
-@@ -129,6 +153,115 @@ rtl::OUString SwVbaStyle::getOOoStyleTypeFromMSWord( sal_Int32 _wdStyleType )
- return aStyleType;
- }
-
-+::rtl::OUString SAL_CALL SwVbaStyle::getNameLocal() throw (uno::RuntimeException)
-+{
-+ rtl::OUString sNameLocal;
-+ mxStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DisplayName") ) ) >>= sNameLocal;
-+ return sNameLocal;
-+}
-+
-+void SAL_CALL SwVbaStyle::setNameLocal( const ::rtl::OUString& _namelocal ) throw (uno::RuntimeException)
-+{
-+ mxStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DisplayName") ), uno::makeAny( _namelocal ) );
-+}
-+
-+uno::Reference< word::XParagraphFormat > SAL_CALL SwVbaStyle::getParagraphFormat() throw (uno::RuntimeException)
-+{
-+ if( word::WdStyleType::wdStyleTypeParagraph == getType() )
-+ {
-+ uno::Reference< text::XTextDocument > xTextDocument( mxModel, uno::UNO_QUERY_THROW );
-+ return uno::Reference< word::XParagraphFormat >( new SwVbaParagraphFormat( this, mxContext, xTextDocument, mxStyleProps ) );
-+ }
-+ else
-+ {
-+ throw uno::RuntimeException();
-+ }
-+ return uno::Reference< word::XParagraphFormat >();
-+}
-+
-+::sal_Bool SAL_CALL SwVbaStyle::getAutomaticallyUpdate() throw (uno::RuntimeException)
-+{
-+ sal_Bool isAutoUpdate = sal_False;
-+ mxStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsAutoUpdate") ) ) >>= isAutoUpdate;
-+ return isAutoUpdate;
-+}
-+
-+void SAL_CALL SwVbaStyle::setAutomaticallyUpdate( ::sal_Bool _automaticallyupdate ) throw (uno::RuntimeException)
-+{
-+ mxStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsAutoUpdate") ), uno::makeAny( _automaticallyupdate ) );
-+}
-+
-+uno::Any SAL_CALL SwVbaStyle::getBaseStyle() throw (uno::RuntimeException)
-+{
-+ // ParentStyle
-+ rtl::OUString sBaseStyle;
-+ mxStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParentStyle") ) ) >>= sBaseStyle;
-+ if( sBaseStyle.getLength() > 0 )
-+ {
-+ uno::Reference< XCollection > xCol( new SwVbaStyles( this, mxContext, mxModel ) );
-+ return xCol->Item( uno::makeAny( sBaseStyle ), uno::Any() );
-+ }
-+ else
-+ {
-+ throw uno::RuntimeException();
-+ }
-+ return uno::Any();
-+}
-+
-+void SAL_CALL SwVbaStyle::setBaseStyle( const uno::Any& _basestyle ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< word::XStyle > xStyle;
-+ _basestyle >>= xStyle;
-+ if( xStyle.is() )
-+ {
-+ rtl::OUString sBaseStyle = xStyle->getName();
-+ mxStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParentStyle") ), uno::makeAny( sBaseStyle ) );
-+ }
-+ else
-+ {
-+ throw uno::RuntimeException();
-+ }
-+}
-+
-+uno::Any SAL_CALL SwVbaStyle::getNextParagraphStyle() throw (uno::RuntimeException)
-+{
-+ //FollowStyle
-+ rtl::OUString sFollowStyle;
-+ mxStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FollowStyle") ) ) >>= sFollowStyle;
-+ if( sFollowStyle.getLength() > 0 )
-+ {
-+ uno::Reference< XCollection > xCol( new SwVbaStyles( this, mxContext, mxModel ) );
-+ return xCol->Item( uno::makeAny( sFollowStyle ), uno::Any() );
-+ }
-+ else
-+ {
-+ throw uno::RuntimeException();
-+ }
-+ return uno::Any();
-+}
-+
-+void SAL_CALL SwVbaStyle::setNextParagraphStyle( const uno::Any& _nextparagraphstyle ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< word::XStyle > xStyle;
-+ _nextparagraphstyle >>= xStyle;
-+ if( xStyle.is() )
-+ {
-+ rtl::OUString sFollowStyle = xStyle->getName();
-+ mxStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FollowStyle") ), uno::makeAny( sFollowStyle ) );
-+ }
-+ else
-+ {
-+ throw uno::RuntimeException();
-+ }
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaStyle::getListLevelNumber() throw (uno::RuntimeException)
-+{
-+ sal_Int16 nNumberingLevel = 0;
-+ mxStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingLevel") ) ) >>= nNumberingLevel;
-+ return nNumberingLevel;
-+}
-+
- rtl::OUString&
- SwVbaStyle::getServiceImplName()
- {
-diff --git sw/source/ui/vba/vbastyle.hxx sw/source/ui/vba/vbastyle.hxx
-index bfa12e0..fdff04f 100644
---- sw/source/ui/vba/vbastyle.hxx
-+++ sw/source/ui/vba/vbastyle.hxx
-@@ -33,6 +33,7 @@
- #include <com/sun/star/container/XNameContainer.hpp>
- #include <com/sun/star/style/XStyle.hpp>
- #include <ooo/vba/word/XFont.hpp>
-+#include <ooo/vba/word/XListTemplate.hpp>
-
-
- typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XStyle > SwVbaStyle_BASE;
-@@ -40,13 +41,14 @@ typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XStyle > SwVbaStyle_BASE;
- class SwVbaStyle : public SwVbaStyle_BASE
- {
- private:
-+ css::uno::Reference< css::frame::XModel > mxModel;
- css::uno::Reference< css::beans::XPropertySet > mxStyleProps;
- css::uno::Reference< css::style::XStyle > mxStyle;
- public:
-- SwVbaStyle( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::beans::XPropertySet >& _xPropertySet ) throw ( css::script::BasicErrorException, css::uno::RuntimeException );
-+ SwVbaStyle( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::beans::XPropertySet >& _xPropertySet ) throw ( css::script::BasicErrorException, css::uno::RuntimeException );
- virtual ~SwVbaStyle(){}
-
-- static void setStyle( const css::uno::Reference< css::beans::XPropertySet >& xTCProps, const css::uno::Reference< ooo::vba::word::XStyle >& xStyle ) throw (css::uno::RuntimeException);
-+ static void setStyle( const css::uno::Reference< css::beans::XPropertySet >& xParaProps, const css::uno::Any& xStyle ) throw (css::uno::RuntimeException);
- static rtl::OUString getOOoStyleTypeFromMSWord( sal_Int32 _wdStyleType );
- static sal_Int32 getLanguageID( const css::uno::Reference< css::beans::XPropertySet >& xTCProps ) throw (css::uno::RuntimeException);
- static void setLanguageID( const css::uno::Reference< css::beans::XPropertySet >& xTCProps, sal_Int32 _languageid ) throw (css::uno::RuntimeException);
-@@ -58,6 +60,20 @@ public:
- virtual void SAL_CALL setLanguageID( ::sal_Int32 _languageid ) throw (css::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< ooo::vba::word::XFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL LinkToListTemplate( const css::uno::Reference< ooo::vba::word::XListTemplate >& ListTemplate, const css::uno::Any& ListLevelNumber ) throw (css::uno::RuntimeException);
-+ virtual ::rtl::OUString SAL_CALL getNameLocal() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setNameLocal( const ::rtl::OUString& _namelocal ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Reference< ::ooo::vba::word::XParagraphFormat > SAL_CALL getParagraphFormat() throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getAutomaticallyUpdate() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setAutomaticallyUpdate( ::sal_Bool _automaticallyupdate ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL getBaseStyle() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setBaseStyle( const css::uno::Any& _basestyle ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL getNextParagraphStyle() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setNextParagraphStyle( const css::uno::Any& _nextparagraphstyle ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getListLevelNumber() throw (css::uno::RuntimeException);
-+
-+ //XDefaultProperty
-+ virtual ::rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return rtl::OUString::createFromAscii("Name"); }
-
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
-diff --git sw/source/ui/vba/vbastyles.cxx sw/source/ui/vba/vbastyles.cxx
-index 58a88e2..99b4ef4 100644
---- sw/source/ui/vba/vbastyles.cxx
-+++ sw/source/ui/vba/vbastyles.cxx
-@@ -44,7 +44,7 @@ struct BuiltinStyleTable
- sal_Int32 wdStyleType;
- };
-
--const BuiltinStyleTable aBuiltinStyleTable[] =
-+static const BuiltinStyleTable aBuiltinStyleTable[] =
- {
- { word::WdBuiltinStyle::wdStyleBlockQuotation, "", word::WdStyleType::wdStyleTypeParagraph },
- { word::WdBuiltinStyle::wdStyleBodyText, "Text body", word::WdStyleType::wdStyleTypeParagraph },
-@@ -152,7 +152,20 @@ const BuiltinStyleTable aBuiltinStyleTable[] =
- { 0, 0, 0 }
- };
-
-+struct MSOStyleNameTable
-+{
-+ const sal_Char* pMSOStyleName;
-+ const sal_Char* pOOoStyleName;
-+ const sal_Char* pOOoStyleType;
-+};
-+
-+static const MSOStyleNameTable aMSOStyleNameTable[] =
-+{
-+ { "Normal", "Default", "ParagraphStyles" },
-+ { 0, 0, 0 }
-+};
-
-+#ifdef FUTURE // seems this isn't used
- static uno::Sequence< rtl::OUString > getStyleTypes()
- {
- uno::Sequence< rtl::OUString > aRet(3);
-@@ -162,41 +175,25 @@ static uno::Sequence< rtl::OUString > getStyleTypes()
- pArray[2] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingStyles") );
- return aRet;
- }
-+#endif
-
- typedef ::cppu::WeakImplHelper1< container::XEnumeration > StyleEnumeration_BASE;
- typedef ::cppu::WeakImplHelper3< container::XNameAccess, container::XIndexAccess, container::XEnumerationAccess > StyleCollectionHelper_BASE;
--/*
--class StylesEnumeration : public StyleEnumeration_BASE
--{
--public:
-- StylesEnumeration( const SheetMap& sMap ) : mSheetMap( sMap ), mIt( mSheetMap.begin() ) {}
-- virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-- {
-- return ( mIt != mSheetMap.end() );
-- }
-- virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-- {
-- if ( !hasMoreElements() )
-- throw container::NoSuchElementException();
-- uno::Reference< sheet::XSpreadsheet > xSheet( *mIt++ );
-- return uno::makeAny( xSheet ) ;
-- }
--};
--*/
-+
- class StyleCollectionHelper : public StyleCollectionHelper_BASE
- {
- private:
- uno::Reference< frame::XModel > mxModel;
-- uno::Reference< container::XNameAccess > mxStyleFamilies;
-- uno::Reference< container::XNameContainer > mxCurrentStyleFamily;
-+ uno::Reference< container::XNameAccess > mxParaStyles;
- uno::Any cachePos;
- public:
- StyleCollectionHelper( const uno::Reference< frame::XModel >& _xModel ) : mxModel( _xModel )
- {
-+ // we only concern about the Paragraph styles
- uno::Reference< style::XStyleFamiliesSupplier > xStyleSupplier( _xModel, uno::UNO_QUERY_THROW);
-- mxStyleFamilies = xStyleSupplier->getStyleFamilies();
-+ uno::Reference< container::XNameAccess > xStyleFamilies = xStyleSupplier->getStyleFamilies();
-+ mxParaStyles.set( xStyleFamilies->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParagraphStyles") ) ), uno::UNO_QUERY_THROW );
- }
-- uno::Reference< container::XNameContainer > getCurrentStyleFamily(){ return mxCurrentStyleFamily; }
- // XElementAccess
- virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) { return style::XStyle::static_type(0); }
- virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) { return getCount() > 0; }
-@@ -209,32 +206,42 @@ public:
- }
- virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException)
- {
-- uno::Sequence< rtl::OUString > sNames( getCount() );
-- rtl::OUString* pString = sNames.getArray();
-- uno::Sequence< rtl::OUString > aStyleTypes = getStyleTypes();
-- sal_Int32 nCount = 0;
-- for( sal_Int32 i = 0; i < aStyleTypes.getLength(); i++ )
-+ return mxParaStyles->getElementNames();
-+ }
-+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
-+ {
-+ // search in the MSOStyleName table first
-+ for( const MSOStyleNameTable* pTable = aMSOStyleNameTable; pTable->pMSOStyleName != NULL; pTable++ )
- {
-- uno::Reference< container::XNameAccess > xNameAccess( mxStyleFamilies->getByName( aStyleTypes[i] ), uno::UNO_QUERY_THROW );
-- uno::Sequence< rtl::OUString > sElementNames = xNameAccess->getElementNames();
-- for( sal_Int32 j = 0; j < sElementNames.getLength(); j++ )
-+ if( aName.equalsIgnoreAsciiCaseAscii( pTable->pMSOStyleName ) )
- {
-- pString[nCount++] = sElementNames[j];
-+ //Found it
-+ rtl::OUString sStyleName = rtl::OUString::createFromAscii( pTable->pOOoStyleName );
-+ if( mxParaStyles->hasByName( sStyleName ) )
-+ {
-+ cachePos = mxParaStyles->getByName( sStyleName );
-+ return sal_True;
-+ }
-+ return sal_False;
- }
- }
-- return sNames;
-- }
-- virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
-- {
-- uno::Sequence< rtl::OUString > aStyleTypes = getStyleTypes();
-- for( sal_Int32 i = 0; i < aStyleTypes.getLength(); i++ )
-+
-+ if( mxParaStyles->hasByName( aName ) )
- {
-- uno::Reference< container::XNameAccess > xNameAccess( mxStyleFamilies->getByName( aStyleTypes[i] ), uno::UNO_QUERY_THROW );
-- if( xNameAccess->hasByName( aName ) )
-+ cachePos = mxParaStyles->getByName( aName );
-+ return sal_True;
-+ }
-+ else
-+ {
-+ uno::Sequence< rtl::OUString > sElementNames = mxParaStyles->getElementNames();
-+ for( sal_Int32 j = 0; j < sElementNames.getLength(); j++ )
- {
-- cachePos = xNameAccess->getByName( aName );
-- mxCurrentStyleFamily.set( xNameAccess, uno::UNO_QUERY_THROW );
-- return sal_True;
-+ rtl::OUString aStyleName = sElementNames[j];
-+ if( aStyleName.equalsIgnoreAsciiCase( aName ) )
-+ {
-+ cachePos = mxParaStyles->getByName( aStyleName );
-+ return sal_True;
-+ }
- }
- }
- return sal_False;
-@@ -243,41 +250,40 @@ public:
- // XIndexAccess
- virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
- {
-- uno::Sequence< rtl::OUString > aStyleTypes = getStyleTypes();
-- sal_Int32 nCount = 0;
-- for( sal_Int32 i = 0; i < aStyleTypes.getLength(); i++ )
-- {
-- uno::Reference< container::XIndexAccess > xIndexAccess( mxStyleFamilies->getByName( aStyleTypes[i] ), uno::UNO_QUERY_THROW );
-- nCount += xIndexAccess->getCount();
-- }
-- return nCount;
-+ uno::Reference< container::XIndexAccess > xIndexAccess( mxParaStyles, uno::UNO_QUERY_THROW );
-+ return xIndexAccess->getCount();
- }
- virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
- {
- if ( Index < 0 || Index >= getCount() )
- throw lang::IndexOutOfBoundsException();
-
-- // FIXME: need to make a alphabetically sorted list of style names
-- uno::Sequence< rtl::OUString > aStyleTypes = getStyleTypes();
-- for( sal_Int32 i = 0; i < aStyleTypes.getLength(); i++ )
-- {
-- uno::Reference< container::XIndexAccess > xIndexAccess( mxStyleFamilies->getByName( aStyleTypes[i] ), uno::UNO_QUERY_THROW );
-- sal_Int32 nCount = xIndexAccess->getCount();
-- if( Index >= nCount )
-- Index -= nCount;
-- else
-- {
-- mxCurrentStyleFamily.set( xIndexAccess, uno::UNO_QUERY_THROW );
-- return xIndexAccess->getByIndex( Index );
-- }
-- }
-- throw lang::IndexOutOfBoundsException();
-+ uno::Reference< container::XIndexAccess > xIndexAccess( mxParaStyles, uno::UNO_QUERY_THROW );
-+ return xIndexAccess->getByIndex( Index );
- }
- // XEnumerationAccess
- virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
- {
-- // FIXME:
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+};
-+
-+class StylesEnumWrapper : public EnumerationHelper_BASE
-+{
-+ SwVbaStyles* pStyles;
-+ sal_Int32 nIndex;
-+public:
-+ StylesEnumWrapper( SwVbaStyles* _pStyles ) : pStyles( _pStyles ), nIndex( 1 ) {}
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( nIndex <= pStyles->getCount() );
-+ }
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( nIndex <= pStyles->getCount() )
-+ return pStyles->Item( uno::makeAny( nIndex++ ), uno::Any() );
-+ throw container::NoSuchElementException();
- }
- };
-
-@@ -290,7 +296,7 @@ uno::Any
- SwVbaStyles::createCollectionObject(const uno::Any& aObject)
- {
- uno::Reference< beans::XPropertySet > xStyleProp( aObject, uno::UNO_QUERY_THROW );
-- return uno::makeAny( uno::Reference< word::XStyle >( new SwVbaStyle( this, mxContext, xStyleProp ) ) );
-+ return uno::makeAny( uno::Reference< word::XStyle >( new SwVbaStyle( this, mxContext, mxModel, xStyleProp ) ) );
- }
-
- uno::Type SAL_CALL
-@@ -302,7 +308,7 @@ SwVbaStyles::getElementType() throw (uno::RuntimeException)
- uno::Reference< container::XEnumeration > SAL_CALL
- SwVbaStyles::createEnumeration() throw (uno::RuntimeException)
- {
-- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ return new StylesEnumWrapper( this );
- }
-
- uno::Any SAL_CALL
-@@ -319,7 +325,8 @@ SwVbaStyles::Item( const uno::Any& Index1, const uno::Any& Index2 ) throw (uno::
- rtl::OUString aStyleName = rtl::OUString::createFromAscii( pTable->pOOoStyleName );
- if( aStyleName.getLength() > 0 )
- {
-- rtl::OUString aStyleType = SwVbaStyle::getOOoStyleTypeFromMSWord( pTable->wdStyleType );
-+ //rtl::OUString aStyleType = SwVbaStyle::getOOoStyleTypeFromMSWord( pTable->wdStyleType );
-+ rtl::OUString aStyleType;
- switch( pTable->wdStyleType )
- {
- case word::WdStyleType::wdStyleTypeParagraph:
-@@ -335,7 +342,8 @@ SwVbaStyles::Item( const uno::Any& Index1, const uno::Any& Index2 ) throw (uno::
- }
- case word::WdStyleType::wdStyleTypeList:
- {
-- aStyleType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingStyles") );
-+ // should use Paragraph style and set the property "NumberingStyleName"
-+ aStyleType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParagraphStyles") );
- break;
- }
- default:
-@@ -344,7 +352,12 @@ SwVbaStyles::Item( const uno::Any& Index1, const uno::Any& Index2 ) throw (uno::
- uno::Reference< style::XStyleFamiliesSupplier > xStyleSupplier( mxModel, uno::UNO_QUERY_THROW);
- uno::Reference< container::XNameAccess > xStylesAccess( xStyleSupplier->getStyleFamilies()->getByName( aStyleType ), uno::UNO_QUERY_THROW );
- uno::Reference< beans::XPropertySet > xStyleProps( xStylesAccess->getByName( aStyleName ), uno::UNO_QUERY_THROW );
-- return uno::makeAny( uno::Reference< word::XStyle >( new SwVbaStyle( this, mxContext, xStyleProps ) ) );
-+ // set the property "NumberingStyleName" if it is a listbullet
-+ if( pTable->wdStyleType == word::WdStyleType::wdStyleTypeList )
-+ {
-+ xStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingStyleName") ), uno::makeAny( aStyleName ) );
-+ }
-+ return uno::makeAny( uno::Reference< word::XStyle >( new SwVbaStyle( this, mxContext, mxModel, xStyleProps ) ) );
- }
- else
- {
-diff --git sw/source/ui/vba/vbasystem.cxx sw/source/ui/vba/vbasystem.cxx
-index 66e5d1f..ae42994 100644
---- sw/source/ui/vba/vbasystem.cxx
-+++ sw/source/ui/vba/vbasystem.cxx
-@@ -34,6 +34,13 @@
- #include <tools/urlobj.hxx>
- #include <tools/string.hxx>
-
-+#ifdef WNT
-+#include <tools/prewin.h>
-+#include <windows.h>
-+#include <tools/postwin.h>
-+#include <tchar.h>
-+#endif
-+
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-
-@@ -47,13 +54,79 @@ void PrivateProfileStringListener::Initialize( const rtl::OUString& rFileName, c
- maGroupName = rGroupName;
- maKey = rKey;
- }
-+#ifdef WNT
-+void lcl_getRegKeyInfo( const ByteString& sKeyInfo, HKEY& hBaseKey, ByteString& sSubKey )
-+{
-+ sal_Int32 nBaseKeyIndex = sKeyInfo.Search('\\');
-+ if( nBaseKeyIndex > 0 )
-+ {
-+ ByteString sBaseKey = sKeyInfo.Copy( 0, nBaseKeyIndex );
-+ sSubKey = sKeyInfo.Copy( nBaseKeyIndex + 1 );
-+ if( sBaseKey.Equals("HKEY_CURRENT_USER") )
-+ {
-+ hBaseKey = HKEY_CURRENT_USER;
-+ }
-+ else if( sBaseKey.Equals("HKEY_LOCAL_MACHINE") )
-+ {
-+ hBaseKey = HKEY_LOCAL_MACHINE;
-+ }
-+ else if( sBaseKey.Equals("HKEY_CLASSES_ROOT") )
-+ {
-+ hBaseKey = HKEY_CLASSES_ROOT;
-+ }
-+ else if( sBaseKey.Equals("HKEY_USERS") )
-+ {
-+ hBaseKey = HKEY_USERS;
-+ }
-+ else if( sBaseKey.Equals("HKEY_CURRENT_CONFIG") )
-+ {
-+ hBaseKey = HKEY_CURRENT_CONFIG;
-+ }
-+ }
-+}
-+#endif
-
- uno::Any PrivateProfileStringListener::getValueEvent()
- {
- // get the private profile string
-- Config aCfg( maFileName );
-- aCfg.SetGroup( maGroupName );
-- rtl::OUString sValue = String( aCfg.ReadKey( maKey ), RTL_TEXTENCODING_DONTKNOW );
-+ rtl::OUString sValue;
-+ if(maFileName.getLength())
-+ {
-+ // get key/value from a file
-+ Config aCfg( maFileName );
-+ aCfg.SetGroup( maGroupName );
-+ sValue = String( aCfg.ReadKey( maKey ), RTL_TEXTENCODING_DONTKNOW );
-+ }
-+ else
-+ {
-+ // get key/value from windows register
-+#ifdef WNT
-+ HKEY hBaseKey = NULL;
-+ ByteString sSubKey;
-+ sal_Int32 nBaseKeyIndex = maGroupName.Search('\\');
-+ lcl_getRegKeyInfo( maGroupName, hBaseKey, sSubKey );
-+ if( hBaseKey != NULL )
-+ {
-+ HKEY hKey = NULL;
-+ LONG lResult;
-+ LPCTSTR lpSubKey = TEXT( sSubKey.GetBuffer());
-+ TCHAR szBuffer[1024];
-+ DWORD cbData = sizeof( szBuffer );
-+ lResult = RegOpenKeyEx( hBaseKey, lpSubKey, 0, KEY_QUERY_VALUE, &hKey );
-+ if( ERROR_SUCCESS == lResult )
-+ {
-+ LPCTSTR lpValueName = TEXT(maKey.GetBuffer());
-+ lResult = RegQueryValueEx( hKey, lpValueName, NULL, NULL, (LPBYTE)szBuffer, &cbData );
-+ RegCloseKey( hKey );
-+ sValue = rtl::OUString::createFromAscii(szBuffer);
-+ }
-+ }
-+
-+ return uno::makeAny( sValue );
-+#endif
-+ throw uno::RuntimeException( rtl::OUString(
-+ RTL_CONSTASCII_USTRINGPARAM("Only support on Windows")), uno::Reference< uno::XInterface >() );
-+ }
-
- return uno::makeAny( sValue );
- }
-@@ -61,12 +134,44 @@ uno::Any PrivateProfileStringListener::getValueEvent()
- void PrivateProfileStringListener::setValueEvent( const css::uno::Any& value )
- {
- // set the private profile string
-- Config aCfg( maFileName );
-- aCfg.SetGroup( maGroupName );
--
- rtl::OUString aValue;
- value >>= aValue;
-- aCfg.WriteKey( maKey, ByteString( aValue.getStr(), RTL_TEXTENCODING_DONTKNOW ) );
-+ if(maFileName.getLength())
-+ {
-+ // set value into a file
-+ Config aCfg( maFileName );
-+ aCfg.SetGroup( maGroupName );
-+ aCfg.WriteKey( maKey, ByteString( aValue.getStr(), RTL_TEXTENCODING_DONTKNOW ) );
-+ }
-+ else
-+ {
-+ //set value into windows register
-+#ifdef WNT
-+ HKEY hBaseKey = NULL;
-+ ByteString sSubKey;
-+ sal_Int32 nBaseKeyIndex = maGroupName.Search('\\');
-+ lcl_getRegKeyInfo( maGroupName, hBaseKey, sSubKey );
-+ if( hBaseKey != NULL )
-+ {
-+ HKEY hKey = NULL;
-+ LONG lResult;
-+ LPCTSTR lpSubKey = TEXT( sSubKey.GetBuffer());
-+ lResult = RegCreateKeyEx( hBaseKey, lpSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, NULL );
-+ if( ERROR_SUCCESS == lResult )
-+ {
-+ LPCTSTR szValue = TEXT( rtl::OUStringToOString( aValue, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ DWORD cbData = sizeof(TCHAR) * (_tcslen(szValue) + 1);
-+ LPCTSTR lpValueName = TEXT(maKey.GetBuffer());
-+ lResult = RegSetValueEx( hKey, lpValueName, NULL, REG_SZ, (LPBYTE)szValue, cbData );
-+ RegCloseKey( hKey );
-+ }
-+ }
-+ return;
-+#endif
-+ throw uno::RuntimeException( rtl::OUString(
-+ RTL_CONSTASCII_USTRINGPARAM("Not implemented")), uno::Reference< uno::XInterface >() );
-+ }
-+
- }
-
- SwVbaSystem::SwVbaSystem( uno::Reference<uno::XComponentContext >& xContext ): SwVbaSystem_BASE( uno::Reference< XHelperInterface >(), xContext )
-@@ -146,19 +251,19 @@ SwVbaSystem::setCursor( sal_Int32 _cursor ) throw (uno::RuntimeException)
- uno::Any SAL_CALL
- SwVbaSystem::PrivateProfileString( const rtl::OUString& rFilename, const rtl::OUString& rSection, const rtl::OUString& rKey ) throw ( uno::RuntimeException )
- {
-- if( rFilename.getLength() == 0 )
-- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Failed to access document from shell" ) ), uno::Reference< uno::XInterface >() );
--
- // FIXME: need to detect whether it is a relative file path
- // we need to detect if this is a URL, if not then assume its a file path
- rtl::OUString sFileUrl;
-- INetURLObject aObj;
-- aObj.SetURL( rFilename );
-- bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
-- if ( bIsURL )
-- sFileUrl = rFilename;
-- else
-- osl::FileBase::getFileURLFromSystemPath( rFilename, sFileUrl);
-+ if( rFilename.getLength() )
-+ {
-+ INetURLObject aObj;
-+ aObj.SetURL( rFilename );
-+ bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
-+ if ( bIsURL )
-+ sFileUrl = rFilename;
-+ else
-+ osl::FileBase::getFileURLFromSystemPath( rFilename, sFileUrl);
-+ }
-
- ByteString aGroupName = ByteString( rSection.getStr(), RTL_TEXTENCODING_DONTKNOW);
- ByteString aKey = ByteString( rKey.getStr(), RTL_TEXTENCODING_DONTKNOW);
-diff --git sw/source/ui/vba/vbatable.cxx sw/source/ui/vba/vbatable.cxx
-index 7598dfc..1ff9294 100644
---- sw/source/ui/vba/vbatable.cxx
-+++ sw/source/ui/vba/vbatable.cxx
-@@ -9,11 +9,13 @@
- #include <com/sun/star/container/XNamed.hpp>
- #include "vbaborders.hxx"
- #include "vbapalette.hxx"
-+#include "vbarows.hxx"
-+#include "vbacolumns.hxx"
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-
--SwVbaTable::SwVbaTable( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rDocument, const uno::Reference< css::text::XTextTable >& xTextTable) throw ( uno::RuntimeException ) : SwVbaTable_BASE( rParent, rContext ), mxTextDocument( rDocument )
-+SwVbaTable::SwVbaTable( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& rDocument, const uno::Reference< text::XTextTable >& xTextTable) throw ( uno::RuntimeException ) : SwVbaTable_BASE( rParent, rContext ), mxTextDocument( rDocument )
- {
- mxTextTable.set( xTextTable, uno::UNO_QUERY_THROW );
- }
-@@ -75,6 +77,26 @@ SwVbaTable::Borders( const uno::Any& index ) throw (uno::RuntimeException)
- return uno::makeAny( xCol );
- }
-
-+uno::Any SAL_CALL
-+SwVbaTable::Rows( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< table::XTableRows > xTableRows( mxTextTable->getRows(), uno::UNO_QUERY_THROW );
-+ uno::Reference< XCollection > xCol( new SwVbaRows( this, mxContext, mxTextTable, xTableRows ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaTable::Columns( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< table::XTableColumns > xTableColumns( mxTextTable->getColumns(), uno::UNO_QUERY_THROW );
-+ uno::Reference< XCollection > xCol( new SwVbaColumns( this, mxContext, mxTextTable, xTableColumns ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
- // XHelperInterface
- rtl::OUString&
- SwVbaTable::getServiceImplName()
-diff --git sw/source/ui/vba/vbatable.hxx sw/source/ui/vba/vbatable.hxx
-index c28a3cd..1348c60 100644
---- sw/source/ui/vba/vbatable.hxx
-+++ sw/source/ui/vba/vbatable.hxx
-@@ -21,6 +21,9 @@ public:
- virtual css::uno::Reference< ::ooo::vba::word::XRange > SAL_CALL ConvertToText( const css::uno::Any& Separator, const css::uno::Any& NestedTables ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual rtl::OUString SAL_CALL getName( ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Borders( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Rows( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Columns( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-diff --git sw/source/ui/vba/vbatablehelper.cxx sw/source/ui/vba/vbatablehelper.cxx
-new file mode 100644
-index 0000000..c4c7413
---- /dev/null
-+++ sw/source/ui/vba/vbatablehelper.cxx
-@@ -0,0 +1,306 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbatablehelper.hxx"
-+#include <swtable.hxx>
-+#include <unotbl.hxx>
-+#include <docsh.hxx>
-+
-+using namespace ::com::sun::star;
-+using namespace ::ooo::vba;
-+
-+#define UNO_TABLE_COLUMN_SUM 10000
-+
-+SwVbaTableHelper::SwVbaTableHelper( const uno::Reference< text::XTextTable >& xTextTable ) throw (uno::RuntimeException) : mxTextTable( xTextTable ), pDoc( NULL )
-+{
-+ pTable = GetSwTable( mxTextTable );
-+}
-+
-+SwTable* SwVbaTableHelper::GetSwTable( const uno::Reference< text::XTextTable >& xTextTable ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< lang::XUnoTunnel > xTunnel( xTextTable, uno::UNO_QUERY_THROW );
-+ SwXTextTable* pXTextTable = reinterpret_cast< SwXTextTable * >( sal::static_int_cast< sal_IntPtr >(xTunnel->getSomething(SwXTextTable::getUnoTunnelId())));
-+ if( !pXTextTable )
-+ throw uno::RuntimeException();
-+
-+ SwFrmFmt* pFrmFmt = pXTextTable->GetFrmFmt();
-+ if( !pFrmFmt )
-+ throw uno::RuntimeException();
-+
-+ SwTable* pTable = SwTable::FindTable( pFrmFmt );
-+ return pTable;
-+}
-+
-+sal_Int32 SwVbaTableHelper::getTabColumnsCount( sal_Int32 nRowIndex ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nRet = 0;
-+ if(!pTable->IsTblComplex())
-+ {
-+ SwTableLines& rLines = pTable->GetTabLines();
-+ SwTableLine* pLine = rLines.GetObject( nRowIndex );
-+ nRet = pLine->GetTabBoxes().Count();
-+ }
-+ return nRet;
-+}
-+
-+sal_Int32 SwVbaTableHelper::getTabColumnsMaxCount( ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nRet = 0;
-+ //sal_Int32 nRowCount = mxTextTable->getRows()->getCount();
-+ sal_Int32 nRowCount = pTable->GetTabLines().Count();
-+ for( sal_Int32 index = 0; index < nRowCount; index++ )
-+ {
-+ sal_Int32 nColCount = getTabColumnsCount( index );
-+ if( nRet < nColCount )
-+ nRet = nColCount;
-+ }
-+ return nRet;
-+}
-+
-+sal_Int32 SwVbaTableHelper::getTabRowIndex( const rtl::OUString& CellName ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nRet = 0;
-+ String sCellName(CellName);
-+ SwTableBox* pBox = (SwTableBox*)pTable->GetTblBox( sCellName );
-+ if( !pBox )
-+ throw uno::RuntimeException();
-+
-+ const SwTableLine* pLine = pBox->GetUpper();
-+ const SwTableLines* pLines = pLine->GetUpper()
-+ ? &pLine->GetUpper()->GetTabLines() : &pTable->GetTabLines();
-+ nRet = pLines->GetPos( pLine );
-+ return nRet;
-+}
-+
-+sal_Int32 SwVbaTableHelper::getTabColIndex( const rtl::OUString& CellName ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nRet = 0;
-+ String sCellName(CellName);
-+ const SwTableBox* pBox = (SwTableBox*)pTable->GetTblBox( sCellName );
-+ if( !pBox )
-+ throw uno::RuntimeException();
-+ const SwTableBoxes* pBoxes = &pBox->GetUpper()->GetTabBoxes();
-+ nRet = pBoxes->GetPos( pBox );
-+ return nRet;
-+}
-+
-+rtl::OUString SwVbaTableHelper::getColumnStr( sal_Int32 nCol )
-+{
-+ const sal_Int32 coDiff = 52; // 'A'-'Z' 'a' - 'z'
-+ sal_Int32 nCalc = 0;
-+
-+ String sRet;
-+ do{
-+ nCalc = nCol % coDiff;
-+ if( nCalc >= 26 )
-+ sRet.Insert( sal_Unicode('a' - 26 + nCalc ), 0 );
-+ else
-+ sRet.Insert( sal_Unicode('A' + nCalc ), 0 );
-+
-+ if( 0 == ( nCol = nCol - nCalc ) )
-+ break;
-+ nCol /= coDiff;
-+ --nCol;
-+ }while(1);
-+ return sRet;
-+}
-+
-+sal_Int32 SwVbaTableHelper::getTableWidth( ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nWidth = 0;
-+ sal_Bool isWidthRelatvie = sal_False;
-+ uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, uno::UNO_QUERY_THROW );
-+ xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsWidthRelative") ) ) >>= isWidthRelatvie;
-+ if( isWidthRelatvie )
-+ {
-+ xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RelativeWidth") ) ) >>= nWidth;
-+ }
-+ else
-+ {
-+ xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ) ) >>= nWidth;
-+ }
-+ return nWidth;
-+}
-+
-+void SwVbaTableHelper::setTableWidth( sal_Int32 _width ) throw (uno::RuntimeException)
-+{
-+ sal_Bool isWidthRelatvie = sal_False;
-+ uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, uno::UNO_QUERY_THROW );
-+ xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsWidthRelative") ) ) >>= isWidthRelatvie;
-+ if( isWidthRelatvie )
-+ {
-+ xTableProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RelativeWidth") ), uno::makeAny( _width ));
-+ }
-+ else
-+ {
-+ xTableProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ), uno::makeAny( _width ) );
-+ }
-+}
-+
-+SwTableBox* SwVbaTableHelper::GetTabBox( sal_Int32 nCol, sal_Int32 nRow ) throw (css::uno::RuntimeException)
-+{
-+ SwTableLines& rLines = pTable->GetTabLines();
-+ sal_Int32 nRowCount = rLines.Count();
-+ if( nRowCount < nRow )
-+ throw uno::RuntimeException();
-+
-+ SwTableBox* pStart = NULL;
-+ SwTableLine* pLine = rLines.GetObject( nRow );
-+ if( pLine->GetTabBoxes().Count() < nCol )
-+ throw uno::RuntimeException();
-+
-+ pStart = pLine->GetTabBoxes()[ nCol ];
-+
-+ if( !pStart )
-+ throw uno::RuntimeException();
-+
-+ return pStart;
-+}
-+
-+void SwVbaTableHelper::InitTabCols( SwTabCols& rCols, const SwTableBox *pStart, BOOL /*bCurRowOnly*/ )
-+{
-+ rCols.SetLeftMin ( 0 );
-+ rCols.SetLeft ( 0 );
-+ rCols.SetRight ( UNO_TABLE_COLUMN_SUM );
-+ rCols.SetRightMax( UNO_TABLE_COLUMN_SUM );
-+
-+ //if( !pDoc )
-+ // {
-+ // pDoc = word::getDocShell( getCurrentDocument() )->GetDoc();
-+ // }
-+ pTable->GetTabCols( rCols, pStart, sal_False, sal_False );
-+}
-+
-+sal_Int32 SwVbaTableHelper::GetColCount( SwTabCols& rCols ) const
-+{
-+ sal_Int32 nCount = 0;
-+ for(sal_Int32 i = 0; i < rCols.Count(); i++ )
-+ if(rCols.IsHidden(i))
-+ nCount ++;
-+ return rCols.Count() - nCount;
-+}
-+
-+sal_Int32 SwVbaTableHelper::GetRightSeparator( SwTabCols& rCols, sal_Int32 nNum) const
-+{
-+ DBG_ASSERT( nNum < (sal_Int32)GetColCount( rCols ) ,"Index out of range");
-+ sal_Int32 i = 0;
-+ while( nNum >= 0 )
-+ {
-+ if( !rCols.IsHidden( static_cast< USHORT >(i)) )
-+ nNum--;
-+ i++;
-+ }
-+ return i - 1;
-+}
-+
-+sal_Int32 SwVbaTableHelper::GetColWidth( sal_Int32 nCol, sal_Int32 nRow, sal_Bool bCurRowOnly ) throw (uno::RuntimeException)
-+{
-+ SwTableBox* pStart = GetTabBox( nCol, nRow );
-+ SwTabCols aCols;
-+ InitTabCols( aCols, pStart, bCurRowOnly );
-+ sal_Int32 nWidth = GetColWidth( aCols, nCol );
-+
-+ sal_Int32 nTableWidth = getTableWidth( );
-+ double dAbsWidth = ( (double)nWidth / UNO_TABLE_COLUMN_SUM ) * (double) nTableWidth;
-+ return ( sal_Int32 )Millimeter::getInPoints( dAbsWidth );
-+}
-+
-+sal_Int32 SwVbaTableHelper::GetColWidth( SwTabCols& rCols, sal_Int32 nNum ) throw (uno::RuntimeException)
-+{
-+ SwTwips nWidth = 0;
-+
-+ if( rCols.Count() > 0 )
-+ {
-+ if(rCols.Count() == GetColCount( rCols ))
-+ {
-+ nWidth = (SwTwips)((nNum == rCols.Count()) ?
-+ rCols.GetRight() - rCols[nNum-1] :
-+ nNum == 0 ? rCols[nNum] - rCols.GetLeft() :
-+ rCols[nNum] - rCols[nNum-1]);
-+ }
-+ else
-+ {
-+ SwTwips nRValid = nNum < GetColCount( rCols ) ?
-+ rCols[(USHORT)GetRightSeparator( rCols, nNum)]:
-+ rCols.GetRight();
-+ SwTwips nLValid = nNum ?
-+ rCols[(USHORT)GetRightSeparator( rCols, nNum - 1)]:
-+ rCols.GetLeft();
-+ nWidth = nRValid - nLValid;
-+ }
-+ }
-+ else
-+ nWidth = rCols.GetRight();
-+
-+ return nWidth;
-+}
-+
-+void SwVbaTableHelper::SetColWidth( sal_Int32 _width, sal_Int32 nCol, sal_Int32 nRow, sal_Bool bCurRowOnly ) throw (css::uno::RuntimeException)
-+{
-+ double dAbsWidth = Millimeter::getInHundredthsOfOneMillimeter( _width );
-+ sal_Int32 nTableWidth = getTableWidth( );
-+ sal_Int32 nNewWidth = (sal_Int32)( dAbsWidth/nTableWidth * UNO_TABLE_COLUMN_SUM );
-+
-+ SwTableBox* pStart = GetTabBox( nCol, nRow );
-+ SwTabCols aOldCols;
-+ InitTabCols( aOldCols, pStart, bCurRowOnly );
-+
-+ //BOOL bCurRowOnly = FALSE;
-+ SwTwips nWidth = 0;
-+
-+ SwTabCols aCols( aOldCols );
-+ if ( aCols.Count() > 0 )
-+ {
-+ // if(aCols.Count() != GetColCount( aCols ))
-+ // bCurRowOnly = TRUE;
-+ nWidth = GetColWidth( aCols, nCol);
-+
-+ int nDiff = (int)(nNewWidth - nWidth);
-+ if( !nCol )
-+ aCols[ static_cast< USHORT >(GetRightSeparator(aCols, 0)) ] += nDiff;
-+ else if( nCol < GetColCount( aCols ) )
-+ {
-+ if(nDiff < GetColWidth( aCols, nCol + 1) - MINLAY)
-+ aCols[ static_cast< USHORT >(GetRightSeparator( aCols, nCol)) ] += nDiff;
-+ else
-+ {
-+ int nDiffLeft = nDiff - (int)GetColWidth( aCols, nCol + 1) + (int)MINLAY;
-+ aCols[ static_cast< USHORT >(GetRightSeparator( aCols, nCol)) ] += (nDiff - nDiffLeft);
-+ aCols[ static_cast< USHORT >(GetRightSeparator( aCols, nCol - 1)) ] -= nDiffLeft;
-+ }
-+ }
-+ else
-+ aCols[ static_cast< USHORT >(GetRightSeparator( aCols, nCol-1)) ] -= nDiff;
-+ }
-+ else
-+ aCols.SetRight( Min( (long)nNewWidth, aCols.GetRightMax()) );
-+
-+ //pDoc->SetTabCols(*pTable, aCols, aOldCols, pStartBox, bCurRowOnly );
-+ pTable->SetTabCols(aCols, aOldCols, pStart, bCurRowOnly );
-+}
-diff --git sw/source/ui/vba/vbatablehelper.hxx sw/source/ui/vba/vbatablehelper.hxx
-new file mode 100644
-index 0000000..73425d4
---- /dev/null
-+++ sw/source/ui/vba/vbatablehelper.hxx
-@@ -0,0 +1,70 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_WORD_VBA_TABLEHELPER_HXX
-+#define SW_WORD_VBA_TABLEHELPER_HXX
-+
-+#include <com/sun/star/text/XTextTable.hpp>
-+#include "wordvbahelper.hxx"
-+#include <swtable.hxx>
-+#include <tabcol.hxx>
-+#include <doc.hxx>
-+
-+class SwVbaTableHelper
-+{
-+private:
-+ css::uno::Reference< css::text::XTextTable > mxTextTable;
-+ SwTable* pTable;
-+ SwDoc* pDoc;
-+
-+private:
-+ SwTableBox* GetTabBox( sal_Int32 nCol, sal_Int32 nRow ) throw (css::uno::RuntimeException);
-+ void InitTabCols( SwTabCols& rCols, const SwTableBox *pStart, sal_Bool bCurRowOnly = FALSE );
-+ sal_Int32 GetRightSeparator( SwTabCols& rCols, sal_Int32 nNum) const;
-+ sal_Int32 GetColCount( SwTabCols& rCols ) const;
-+ sal_Int32 GetColWidth( SwTabCols& rCols, sal_Int32 nNum ) throw (css::uno::RuntimeException);
-+
-+public:
-+ SwVbaTableHelper( const css::uno::Reference< css::text::XTextTable >& xTextTable ) throw (css::uno::RuntimeException);
-+ ~SwVbaTableHelper() {}
-+ sal_Int32 getTabColumnsCount( sal_Int32 nRowIndex ) throw (css::uno::RuntimeException);
-+ sal_Int32 getTabColumnsMaxCount( ) throw (css::uno::RuntimeException);
-+ sal_Int32 getTabRowIndex( const rtl::OUString& sCellName ) throw (css::uno::RuntimeException);
-+ sal_Int32 getTabColIndex( const rtl::OUString& sCellName ) throw (css::uno::RuntimeException);
-+ sal_Int32 getTableWidth( ) throw (css::uno::RuntimeException);
-+ void setTableWidth( sal_Int32 _width ) throw (css::uno::RuntimeException);
-+
-+ sal_Int32 GetColWidth( sal_Int32 nCol, sal_Int32 nRow = 0, sal_Bool bCurRowOnly = FALSE ) throw (css::uno::RuntimeException);
-+ void SetColWidth( sal_Int32 _width, sal_Int32 nCol, sal_Int32 nRow = 0, sal_Bool bCurRowOnly = FALSE ) throw (css::uno::RuntimeException);
-+
-+ static SwTable* GetSwTable( const css::uno::Reference< css::text::XTextTable >& xTextTable ) throw (css::uno::RuntimeException);
-+ static rtl::OUString getColumnStr( sal_Int32 nCol );
-+};
-+
-+#endif
-diff --git sw/source/ui/vba/vbatableofcontents.cxx sw/source/ui/vba/vbatableofcontents.cxx
-new file mode 100644
-index 0000000..1c37e96
---- /dev/null
-+++ sw/source/ui/vba/vbatableofcontents.cxx
-@@ -0,0 +1,125 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbatableofcontents.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include <ooo/vba/word/WdTabLeader.hpp>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaTableOfContents::SwVbaTableOfContents( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& xDoc, const uno::Reference< text::XDocumentIndex >& xDocumentIndex ) throw ( uno::RuntimeException ) :
-+ SwVbaTableOfContents_BASE( rParent, rContext ), mxTextDocument( xDoc ), mxDocumentIndex( xDocumentIndex )
-+{
-+ mxTocProps.set( mxDocumentIndex, uno::UNO_QUERY_THROW );
-+}
-+
-+
-+SwVbaTableOfContents::~SwVbaTableOfContents()
-+{
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaTableOfContents::getLowerHeadingLevel() throw (uno::RuntimeException)
-+{
-+ sal_Int16 nLevel = 0;
-+ mxTocProps->getPropertyValue(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Level") ) ) >>= nLevel;
-+ return nLevel;
-+}
-+
-+void SAL_CALL SwVbaTableOfContents::setLowerHeadingLevel( ::sal_Int32 _lowerheadinglevel ) throw (uno::RuntimeException)
-+{
-+ mxTocProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Level") ), uno::makeAny( sal_Int8( _lowerheadinglevel ) ) );
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaTableOfContents::getTabLeader() throw (uno::RuntimeException)
-+{
-+ // not support in Writer
-+ return word::WdTabLeader::wdTabLeaderDots;
-+}
-+
-+void SAL_CALL SwVbaTableOfContents::setTabLeader( ::sal_Int32 /*_tableader*/ ) throw (uno::RuntimeException)
-+{
-+ // not support in Writer
-+}
-+
-+::sal_Bool SAL_CALL SwVbaTableOfContents::getUseFields() throw (css::uno::RuntimeException)
-+{
-+ sal_Bool bUseFields = sal_False;
-+ mxTocProps->getPropertyValue(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CreateFromMarks") ) ) >>= bUseFields;
-+ return bUseFields;
-+}
-+
-+void SAL_CALL SwVbaTableOfContents::setUseFields( ::sal_Bool _useFields ) throw (css::uno::RuntimeException)
-+{
-+ mxTocProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CreateFromMarks") ), uno::makeAny( _useFields ) );
-+}
-+
-+::sal_Bool SAL_CALL SwVbaTableOfContents::getUseOutlineLevels() throw (css::uno::RuntimeException)
-+{
-+ sal_Bool bUseOutlineLevels = sal_False;
-+ mxTocProps->getPropertyValue(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CreateFromOutline") ) ) >>= bUseOutlineLevels;
-+ return bUseOutlineLevels;
-+}
-+
-+void SAL_CALL SwVbaTableOfContents::setUseOutlineLevels( ::sal_Bool _useOutlineLevels ) throw (css::uno::RuntimeException)
-+{
-+ mxTocProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CreateFromOutline") ), uno::makeAny( _useOutlineLevels ) );
-+}
-+
-+void SAL_CALL SwVbaTableOfContents::Delete( ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< text::XTextContent > xTextContent( mxDocumentIndex, uno::UNO_QUERY_THROW );
-+ mxTextDocument->getText()->removeTextContent( xTextContent );
-+}
-+
-+void SAL_CALL SwVbaTableOfContents::Update( ) throw (uno::RuntimeException)
-+{
-+ mxDocumentIndex->update();
-+}
-+
-+rtl::OUString&
-+SwVbaTableOfContents::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaTableOfContents") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaTableOfContents::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.TableOfContents" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbatableofcontents.hxx sw/source/ui/vba/vbatableofcontents.hxx
-new file mode 100644
-index 0000000..8e9394a
---- /dev/null
-+++ sw/source/ui/vba/vbatableofcontents.hxx
-@@ -0,0 +1,70 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_TABLEOFCONTENTS_HXX
-+#define SW_VBA_TABLEOFCONTENTS_HXX
-+
-+#include <ooo/vba/word/XTableOfContents.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include <com/sun/star/text/XDocumentIndex.hpp>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XTableOfContents > SwVbaTableOfContents_BASE;
-+
-+class SwVbaTableOfContents : public SwVbaTableOfContents_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XTextDocument > mxTextDocument;
-+ css::uno::Reference< css::text::XDocumentIndex > mxDocumentIndex;
-+ css::uno::Reference< css::beans::XPropertySet > mxTocProps;
-+
-+public:
-+ SwVbaTableOfContents( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& xDoc, const css::uno::Reference< css::text::XDocumentIndex >& xDocumentIndex ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaTableOfContents();
-+
-+ // Attributes
-+ virtual ::sal_Int32 SAL_CALL getLowerHeadingLevel() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setLowerHeadingLevel( ::sal_Int32 _lowerheadinglevel ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getTabLeader() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setTabLeader( ::sal_Int32 _tableader ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getUseFields() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setUseFields( ::sal_Bool _useFields ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getUseOutlineLevels() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setUseOutlineLevels( ::sal_Bool _useOutlineLevels ) throw (css::uno::RuntimeException);
-+
-+ // Methods
-+ virtual void SAL_CALL Delete( ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL Update( ) throw (css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_TABLEOFCONTENTS_HXX */
-diff --git sw/source/ui/vba/vbatables.cxx sw/source/ui/vba/vbatables.cxx
-index 53178d1..7423216 100644
---- sw/source/ui/vba/vbatables.cxx
-+++ sw/source/ui/vba/vbatables.cxx
-@@ -4,6 +4,9 @@
- #include <com/sun/star/text/XTextTable.hpp>
- #include <com/sun/star/text/XTextTablesSupplier.hpp>
- #include <com/sun/star/text/XTextDocument.hpp>
-+#include <com/sun/star/lang/XServiceInfo.hpp>
-+#include <com/sun/star/text/XText.hpp>
-+#include <com/sun/star/table/XCellRange.hpp>
- #include <comphelper/componentcontext.hxx>
-
- using namespace ::ooo::vba;
-@@ -26,7 +29,89 @@ uno::Any lcl_createTable( const uno::Reference< XHelperInterface >& xParent, con
- return uno::makeAny( xTable );
- }
-
-+sal_Bool lcl_isInHeaderFooter( const uno::Reference< text::XTextTable >& xTable )
-+{
-+ uno::Reference< text::XTextContent > xTextContent( xTable, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XText > xText = xTextContent->getAnchor()->getText();
-+ uno::Reference< lang::XServiceInfo > xServiceInfo( xText, uno::UNO_QUERY_THROW );
-+ rtl::OUString aImplName = xServiceInfo->getImplementationName();
-+ if( aImplName.equalsAscii("SwXHeadFootText") )
-+ return sal_True;
-+ return sal_False;
-+}
-+
- typedef ::cppu::WeakImplHelper1< css::container::XEnumeration > EnumBase;
-+typedef ::cppu::WeakImplHelper2< container::XIndexAccess, container::XNameAccess > TableCollectionHelper_Base;
-+typedef std::vector< uno::Reference< text::XTextTable > > XTextTableVec;
-+
-+class TableCollectionHelper : public TableCollectionHelper_Base
-+{
-+ XTextTableVec mxTables;
-+ XTextTableVec::iterator cachePos;
-+
-+public:
-+ TableCollectionHelper( const uno::Reference< frame::XModel >& xDocument )
-+ {
-+ // only count the tables in the body text, not in the header/footer
-+ uno::Reference< container::XIndexAccess > xTables = lcl_getTables( xDocument );
-+ sal_Int32 nCount = xTables->getCount();
-+ for( sal_Int32 i = 0; i < nCount; i++ )
-+ {
-+ uno::Reference< text::XTextTable > xTable( xTables->getByIndex( i ) , uno::UNO_QUERY_THROW );
-+ if( !lcl_isInHeaderFooter( xTable ) )
-+ mxTables.push_back( xTable );
-+ }
-+ cachePos = mxTables.begin();
-+ }
-+ // XIndexAccess
-+ virtual sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
-+ {
-+ return mxTables.size();
-+ }
-+ virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( Index < 0 || Index >= getCount() )
-+ throw lang::IndexOutOfBoundsException();
-+ uno::Reference< text::XTextTable > xTable( mxTables[ Index ], uno::UNO_QUERY_THROW );
-+ return uno::makeAny( xTable );
-+ }
-+ // XElementAccess
-+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) { return text::XTextTable::static_type(0); }
-+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) { return getCount() > 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();
-+ uno::Reference< text::XTextTable > xTable( *cachePos, uno::UNO_QUERY_THROW );
-+ return uno::makeAny( xTable );
-+ }
-+ virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException)
-+ {
-+ uno::Sequence< rtl::OUString > sNames( mxTables.size() );
-+ rtl::OUString* pString = sNames.getArray();
-+ XTextTableVec::iterator it = mxTables.begin();
-+ XTextTableVec::iterator it_end = mxTables.end();
-+ for ( ; it != it_end; ++it, ++pString )
-+ {
-+ uno::Reference< container::XNamed > xName( *it, uno::UNO_QUERY_THROW );
-+ *pString = xName->getName();
-+ }
-+ return sNames;
-+ }
-+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
-+ {
-+ cachePos = mxTables.begin();
-+ XTextTableVec::iterator it_end = mxTables.end();
-+ for ( ; cachePos != it_end; ++cachePos )
-+ {
-+ uno::Reference< container::XNamed > xName( *cachePos, uno::UNO_QUERY_THROW );
-+ if ( aName.equalsIgnoreAsciiCase( xName->getName() ) )
-+ break;
-+ }
-+ return ( cachePos != it_end );
-+ }
-+};
-
- class TableEnumerationImpl : public EnumBase
- {
-@@ -52,7 +137,7 @@ public:
-
- };
-
--SwVbaTables::SwVbaTables( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xDocument ) : SwVbaTables_BASE( xParent, xContext , lcl_getTables( xDocument ) ), mxDocument( xDocument )
-+SwVbaTables::SwVbaTables( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xDocument ) : SwVbaTables_BASE( xParent, xContext , uno::Reference< container::XIndexAccess >( new TableCollectionHelper( xDocument ) ) ), mxDocument( xDocument )
- {
- }
-
-@@ -85,6 +170,12 @@ SwVbaTables::Add( const uno::Reference< word::XRange >& Range, const uno::Any& N
- uno::Reference< text::XTextContent > xContext( xTable, uno::UNO_QUERY_THROW );
-
- xText->insertTextContent( xTextRange, xContext, true );
-+
-+ // move the current cursor to the first table cell
-+ uno::Reference< table::XCellRange > xCellRange( xTable, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XText> xFirstCellText( xCellRange->getCellByPosition(0, 0), uno::UNO_QUERY_THROW );
-+ word::getXTextViewCursor( mxDocument )->gotoRange( xFirstCellText->getStart(), sal_False );
-+
- uno::Reference< word::XTable > xVBATable( new SwVbaTable( mxParent, mxContext, pVbaRange->getDocument(), xTable ) );
- return xVBATable;
- }
-diff --git sw/source/ui/vba/vbatablesofcontents.cxx sw/source/ui/vba/vbatablesofcontents.cxx
-new file mode 100644
-index 0000000..020f19c
---- /dev/null
-+++ sw/source/ui/vba/vbatablesofcontents.cxx
-@@ -0,0 +1,197 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbatablesofcontents.hxx"
-+#include "vbatableofcontents.hxx"
-+#include "vbarange.hxx"
-+#include <com/sun/star/text/XDocumentIndexesSupplier.hpp>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+typedef ::cppu::WeakImplHelper2< container::XIndexAccess, container::XEnumerationAccess > TableOfContentsCollectionHelper_Base;
-+typedef std::vector< uno::Reference< text::XDocumentIndex > > XTocVec;
-+
-+class TablesOfContentsEnumWrapper : public EnumerationHelper_BASE
-+{
-+ uno::Reference< container::XIndexAccess > mxIndexAccess;
-+ sal_Int32 nIndex;
-+
-+public:
-+ TablesOfContentsEnumWrapper( const uno::Reference< container::XIndexAccess >& xIndexAccess ) : mxIndexAccess( xIndexAccess ), nIndex( 0 )
-+ {
-+ }
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( nIndex < mxIndexAccess->getCount() );
-+ }
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if( nIndex < mxIndexAccess->getCount() )
-+ {
-+ return mxIndexAccess->getByIndex( nIndex++ );
-+ }
-+ throw container::NoSuchElementException();
-+ }
-+};
-+
-+class TableOfContentsCollectionHelper : public TableOfContentsCollectionHelper_Base
-+{
-+private:
-+ uno::Reference< XHelperInterface > mxParent;
-+ uno::Reference< uno::XComponentContext > mxContext;
-+ uno::Reference< text::XTextDocument > mxTextDocument;
-+ XTocVec maToc;
-+
-+public:
-+ TableOfContentsCollectionHelper( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextDocument >& xDoc ) throw ( uno::RuntimeException ): mxParent( xParent ), mxContext( xContext ), mxTextDocument( xDoc )
-+ {
-+ uno::Reference< text::XDocumentIndexesSupplier > xDocIndexSupp( mxTextDocument, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xDocIndexes = xDocIndexSupp->getDocumentIndexes();
-+ sal_Int32 nCount = xDocIndexes->getCount();
-+ for( sal_Int32 i = 0; i < nCount; i++ )
-+ {
-+ uno::Reference< text::XDocumentIndex > xToc( xDocIndexes->getByIndex(i), uno::UNO_QUERY_THROW );
-+ if( xToc->getServiceName().equalsAscii("com.sun.star.text.ContentIndex") )
-+ {
-+ maToc.push_back( xToc );
-+ }
-+ }
-+ }
-+
-+ virtual ~TableOfContentsCollectionHelper() {}
-+
-+ virtual sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
-+ {
-+ return maToc.size();
-+ }
-+ virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( Index < 0 || Index >= getCount() )
-+ throw lang::IndexOutOfBoundsException();
-+
-+ uno::Reference< text::XDocumentIndex > xToc( maToc[Index], uno::UNO_QUERY_THROW );
-+ return uno::makeAny( uno::Reference< word::XTableOfContents >( new SwVbaTableOfContents( mxParent, mxContext, mxTextDocument, xToc ) ) );
-+ }
-+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
-+ {
-+ return word::XTableOfContents::static_type(0);
-+ }
-+ virtual sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
-+ {
-+ return sal_True;
-+ }
-+ // XEnumerationAccess
-+ virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
-+ {
-+ return new TablesOfContentsEnumWrapper( this );
-+ }
-+};
-+
-+SwVbaTablesOfContents::SwVbaTablesOfContents( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextDocument >& xDoc ) throw (uno::RuntimeException) : SwVbaTablesOfContents_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new TableOfContentsCollectionHelper( xParent, xContext, xDoc ) ) ), mxTextDocument( xDoc )
-+{
-+}
-+
-+uno::Reference< word::XTableOfContents > SAL_CALL
-+SwVbaTablesOfContents::Add( const uno::Reference< word::XRange >& Range, const uno::Any& /*UseHeadingStyles*/, const uno::Any& /*UpperHeadingLevel*/, const uno::Any& LowerHeadingLevel, const uno::Any& UseFields, const uno::Any& /*TableID*/, const uno::Any& /*RightAlignPageNumbers*/, const uno::Any& /*IncludePageNumbers*/, const uno::Any& /*AddedStyles*/, const uno::Any& /*UseHyperlinks*/, const uno::Any& /*HidePageNumbersInWeb*/, const uno::Any& /*UseOutlineLevels*/ ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< lang::XMultiServiceFactory > xDocMSF( mxTextDocument, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XDocumentIndex > xDocumentIndex( xDocMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.ContentIndex")) ), uno::UNO_QUERY_THROW );
-+
-+ uno::Reference< beans::XPropertySet > xTocProps( xDocumentIndex, uno::UNO_QUERY_THROW );
-+ sal_Bool isProtected = sal_False;
-+ xTocProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsProtected") ), uno::makeAny( isProtected ) );
-+
-+ uno::Reference< word::XTableOfContents > xToc( new SwVbaTableOfContents( this, mxContext, mxTextDocument, xDocumentIndex ) );
-+
-+ sal_Int32 nLowerHeadingLevel = 9;
-+ if( LowerHeadingLevel.hasValue() )
-+ LowerHeadingLevel >>= nLowerHeadingLevel;
-+ xToc->setLowerHeadingLevel( nLowerHeadingLevel );
-+
-+ sal_Bool bUseFields = sal_False;
-+ if( UseFields.hasValue() )
-+ UseFields >>= bUseFields;
-+ xToc->setUseFields( bUseFields );
-+
-+ sal_Bool bUseOutlineLevels = sal_True;
-+ //if( UseOutlineLevels.hasValue() )
-+ // UseOutlineLevels >>= bUseOutlineLevels;
-+ xToc->setUseOutlineLevels( bUseOutlineLevels );
-+
-+ SwVbaRange* pVbaRange = dynamic_cast<SwVbaRange*>( Range.get() );
-+ if( !pVbaRange )
-+ throw uno::RuntimeException();
-+
-+ uno::Reference< text::XTextRange > xTextRange = pVbaRange->getXTextRange();
-+ uno::Reference< text::XText > xText = pVbaRange->getXText();
-+ uno::Reference< text::XTextContent > xTextContent( xDocumentIndex, uno::UNO_QUERY_THROW );
-+ xText->insertTextContent( xTextRange, xTextContent, sal_False );
-+ xToc->Update();
-+
-+ return xToc;
-+}
-+
-+// XEnumerationAccess
-+uno::Type
-+SwVbaTablesOfContents::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XTableOfContents::static_type(0);
-+}
-+uno::Reference< container::XEnumeration >
-+SwVbaTablesOfContents::createEnumeration() throw (uno::RuntimeException)
-+{
-+ return new TablesOfContentsEnumWrapper( m_xIndexAccess );
-+}
-+
-+uno::Any
-+SwVbaTablesOfContents::createCollectionObject( const uno::Any& aSource )
-+{
-+ return aSource;
-+}
-+
-+rtl::OUString&
-+SwVbaTablesOfContents::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaTablesOfContents") );
-+ return sImplName;
-+}
-+
-+uno::Sequence<rtl::OUString>
-+SwVbaTablesOfContents::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.TablesOfContents") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbatablesofcontents.hxx sw/source/ui/vba/vbatablesofcontents.hxx
-new file mode 100644
-index 0000000..e193df7
---- /dev/null
-+++ sw/source/ui/vba/vbatablesofcontents.hxx
-@@ -0,0 +1,64 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_TABLESOFCONTENTS_HXX
-+#define SW_VBA_TABLESOFCONTENTS_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XTablesOfContents.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include <ooo/vba/word/XTableOfContents.hpp>
-+#include <ooo/vba/word/XRange.hpp>
-+
-+typedef CollTestImplHelper< ooo::vba::word::XTablesOfContents > SwVbaTablesOfContents_BASE;
-+
-+class SwVbaTablesOfContents : public SwVbaTablesOfContents_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XTextDocument > mxTextDocument;
-+
-+public:
-+ SwVbaTablesOfContents( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::text::XTextDocument >& xDoc ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaTablesOfContents() {}
-+
-+ // Methods
-+ virtual css::uno::Reference< ::ooo::vba::word::XTableOfContents > SAL_CALL Add( const css::uno::Reference< ::ooo::vba::word::XRange >& Range, const css::uno::Any& UseHeadingStyles, const css::uno::Any& UpperHeadingLevel, const css::uno::Any& LowerHeadingLevel, const css::uno::Any& UseFields, const css::uno::Any& TableID, const css::uno::Any& RightAlignPageNumbers, const css::uno::Any& IncludePageNumbers, const css::uno::Any& AddedStyles, const css::uno::Any& UseHyperlinks, const css::uno::Any& HidePageNumbersInWeb, const css::uno::Any& UseOutlineLevels ) 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);
-+
-+ // SwVbaTablesOfContents_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* SW_VBA_TABLESOFCONTENTS_HXX */
-diff --git sw/source/ui/vba/vbatabstop.cxx sw/source/ui/vba/vbatabstop.cxx
-new file mode 100644
-index 0000000..259c508
---- /dev/null
-+++ sw/source/ui/vba/vbatabstop.cxx
-@@ -0,0 +1,63 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbatabstop.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaTabStop::SwVbaTabStop( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< beans::XPropertySet >& xParaProps, const style::TabStop& aTabStop ) throw ( uno::RuntimeException ) : SwVbaTabStop_BASE( rParent, rContext ), mxParaProps( xParaProps ), maTabStop( aTabStop )
-+{
-+}
-+
-+SwVbaTabStop::~SwVbaTabStop()
-+{
-+}
-+
-+rtl::OUString&
-+SwVbaTabStop::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaTabStop") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaTabStop::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.TabStop" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbatabstop.hxx sw/source/ui/vba/vbatabstop.hxx
-new file mode 100644
-index 0000000..77780c7
---- /dev/null
-+++ sw/source/ui/vba/vbatabstop.hxx
-@@ -0,0 +1,54 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_TABSTOP_HXX
-+#define SW_VBA_TABSTOP_HXX
-+
-+#include <ooo/vba/word/XTabStop.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/style/TabStop.hpp>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XTabStop > SwVbaTabStop_BASE;
-+
-+class SwVbaTabStop : public SwVbaTabStop_BASE
-+{
-+private:
-+ css::uno::Reference< css::beans::XPropertySet > mxParaProps;
-+ css::style::TabStop maTabStop;
-+
-+public:
-+ SwVbaTabStop( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::beans::XPropertySet >& xParaProps, const css::style::TabStop& aTabStop ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaTabStop();
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_TABSTOP_HXX */
-diff --git sw/source/ui/vba/vbatabstops.cxx sw/source/ui/vba/vbatabstops.cxx
-new file mode 100644
-index 0000000..8d19875
---- /dev/null
-+++ sw/source/ui/vba/vbatabstops.cxx
-@@ -0,0 +1,280 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbatabstops.hxx"
-+#include "vbatabstop.hxx"
-+#include <com/sun/star/style/TabAlign.hpp>
-+#include <ooo/vba/word/WdTabLeader.hpp>
-+#include <ooo/vba/word/WdTabAlignment.hpp>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+uno::Sequence< style::TabStop > lcl_getTabStops( const uno::Reference< beans::XPropertySet >& xParaProps ) throw (uno::RuntimeException)
-+{
-+ uno::Sequence< style::TabStop > aSeq;
-+ xParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaTabStops") ) ) >>= aSeq;
-+ return aSeq;
-+}
-+
-+void lcl_setTabStops( const uno::Reference< beans::XPropertySet >& xParaProps, const uno::Sequence< style::TabStop >& aSeq ) throw (uno::RuntimeException)
-+{
-+ xParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaTabStops") ), uno::makeAny( aSeq ) );
-+}
-+
-+typedef ::cppu::WeakImplHelper2< container::XIndexAccess, container::XEnumerationAccess > TabStopCollectionHelper_Base;
-+
-+class TabStopsEnumWrapper : public EnumerationHelper_BASE
-+{
-+ uno::Reference< container::XIndexAccess > mxIndexAccess;
-+ sal_Int32 nIndex;
-+
-+public:
-+ TabStopsEnumWrapper( const uno::Reference< container::XIndexAccess >& xIndexAccess ) : mxIndexAccess( xIndexAccess ), nIndex( 0 )
-+ {
-+ }
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( nIndex < mxIndexAccess->getCount() );
-+ }
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if( nIndex < mxIndexAccess->getCount() )
-+ {
-+ return mxIndexAccess->getByIndex( nIndex++ );
-+ }
-+ throw container::NoSuchElementException();
-+ }
-+};
-+
-+class TabStopCollectionHelper : public TabStopCollectionHelper_Base
-+{
-+private:
-+ uno::Reference< XHelperInterface > mxParent;
-+ uno::Reference< uno::XComponentContext > mxContext;
-+ uno::Reference< beans::XPropertySet > mxParaProps;
-+ uno::Sequence< style::TabStop > maTabStops;
-+
-+public:
-+ TabStopCollectionHelper( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::beans::XPropertySet >& xParaProps ) throw ( css::uno::RuntimeException ): mxParent( xParent ), mxContext( xContext ), mxParaProps( xParaProps )
-+ {
-+ maTabStops = lcl_getTabStops( xParaProps );
-+ }
-+
-+ virtual ~TabStopCollectionHelper() {}
-+
-+ virtual sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
-+ {
-+ return maTabStops.getLength();
-+ }
-+ virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( Index < 0 || Index >= getCount() )
-+ throw css::lang::IndexOutOfBoundsException();
-+
-+ const style::TabStop* pTabs = maTabStops.getConstArray();
-+ return uno::makeAny( uno::Reference< word::XTabStop >( new SwVbaTabStop( mxParent, mxContext, mxParaProps, pTabs[ Index ] ) ) );
-+ }
-+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
-+ {
-+ return word::XTabStop::static_type(0);
-+ }
-+ virtual sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
-+ {
-+ return sal_True;
-+ }
-+ // XEnumerationAccess
-+ virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
-+ {
-+ return new TabStopsEnumWrapper( this );
-+ }
-+};
-+
-+SwVbaTabStops::SwVbaTabStops( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< beans::XPropertySet >& xParaProps ) throw (uno::RuntimeException) : SwVbaTabStops_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new TabStopCollectionHelper( xParent, xContext, xParaProps ) ) ), mxParaProps( xParaProps )
-+{
-+}
-+
-+uno::Reference< word::XTabStop > SAL_CALL SwVbaTabStops::Add( float Position, const uno::Any& Alignment, const uno::Any& Leader ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nPosition = Millimeter::getInHundredthsOfOneMillimeter( Position );
-+
-+ style::TabAlign nAlign = style::TabAlign_LEFT;
-+ if( Alignment.hasValue() )
-+ {
-+ sal_Int32 wdAlign = word::WdTabAlignment::wdAlignTabLeft;
-+ Alignment >>= wdAlign;
-+ switch( wdAlign )
-+ {
-+ case word::WdTabAlignment::wdAlignTabLeft:
-+ {
-+ nAlign = style::TabAlign_LEFT;
-+ break;
-+ }
-+ case word::WdTabAlignment::wdAlignTabRight:
-+ {
-+ nAlign = style::TabAlign_RIGHT;
-+ break;
-+ }
-+ case word::WdTabAlignment::wdAlignTabCenter:
-+ {
-+ nAlign = style::TabAlign_CENTER;
-+ break;
-+ }
-+ case word::WdTabAlignment::wdAlignTabDecimal:
-+ {
-+ nAlign = style::TabAlign_DECIMAL;
-+ break;
-+ }
-+ case word::WdTabAlignment::wdAlignTabBar:
-+ case word::WdTabAlignment::wdAlignTabList:
-+ {
-+ DebugHelper::exception( SbERR_NOT_IMPLEMENTED, rtl::OUString() );
-+ break;
-+ }
-+ default:
-+ {
-+ //left
-+ }
-+ }
-+ }
-+
-+ sal_Char cLeader = ' '; // default is space
-+ if( Leader.hasValue() )
-+ {
-+ sal_Int32 wdLeader = word::WdTabLeader::wdTabLeaderSpaces;
-+ Leader >>= wdLeader;
-+ switch( wdLeader )
-+ {
-+ case word::WdTabLeader::wdTabLeaderSpaces:
-+ {
-+ cLeader = ' ';
-+ break;
-+ }
-+ case word::WdTabLeader::wdTabLeaderMiddleDot:
-+ {
-+ cLeader = 183;
-+ break;
-+ }
-+ case word::WdTabLeader::wdTabLeaderDots:
-+ {
-+ cLeader = '.';
-+ break;
-+ }
-+ case word::WdTabLeader::wdTabLeaderDashes:
-+ case word::WdTabLeader::wdTabLeaderHeavy:
-+ case word::WdTabLeader::wdTabLeaderLines:
-+ {
-+ cLeader = '_';
-+ break;
-+ }
-+ default:
-+ {
-+ //left
-+ }
-+ }
-+ }
-+
-+ sal_Char cDecimal = '.'; // default value
-+
-+ style::TabStop aTab;
-+ aTab.Position = nPosition;
-+ aTab.Alignment = nAlign;
-+ aTab.DecimalChar = cDecimal;
-+ aTab.FillChar = cLeader;
-+
-+ uno::Sequence< style::TabStop > aOldTabs = lcl_getTabStops( mxParaProps );
-+ sal_Bool bOverWriter = sal_False;
-+
-+ sal_Int32 nTabs = aOldTabs.getLength();
-+ uno::Sequence< style::TabStop > aNewTabs( nTabs + 1 );
-+
-+ style::TabStop* pOldTab = aOldTabs.getArray();
-+ style::TabStop* pNewTab = aNewTabs.getArray();
-+ pNewTab[0] = aTab;
-+ for( sal_Int32 nIndex = 0; nIndex < nTabs && !bOverWriter; nIndex++ )
-+ {
-+ if( pOldTab[nIndex].Position == nPosition )
-+ {
-+ bOverWriter = sal_True;
-+ pOldTab[nIndex] = aTab;
-+ break;
-+ }
-+ pNewTab[ nIndex+1 ] = pOldTab[ nIndex ];
-+ }
-+ if( bOverWriter )
-+ lcl_setTabStops( mxParaProps, aOldTabs );
-+ else
-+ lcl_setTabStops( mxParaProps, aNewTabs );
-+
-+ return uno::Reference< word::XTabStop >( new SwVbaTabStop( this, mxContext, mxParaProps, aTab ) );
-+}
-+
-+void SAL_CALL SwVbaTabStops::ClearAll() throw (uno::RuntimeException)
-+{
-+ uno::Sequence< style::TabStop > aSeq;
-+ lcl_setTabStops( mxParaProps, aSeq );
-+}
-+
-+// XEnumerationAccess
-+uno::Type
-+SwVbaTabStops::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XTabStop::static_type(0);
-+}
-+uno::Reference< container::XEnumeration >
-+SwVbaTabStops::createEnumeration() throw (uno::RuntimeException)
-+{
-+ return new TabStopsEnumWrapper( m_xIndexAccess );
-+}
-+
-+uno::Any
-+SwVbaTabStops::createCollectionObject( const css::uno::Any& aSource )
-+{
-+ return aSource;
-+}
-+
-+rtl::OUString&
-+SwVbaTabStops::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaTabStops") );
-+ return sImplName;
-+}
-+
-+css::uno::Sequence<rtl::OUString>
-+SwVbaTabStops::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.TabStops") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbatabstops.hxx sw/source/ui/vba/vbatabstops.hxx
-new file mode 100644
-index 0000000..913e12b
---- /dev/null
-+++ sw/source/ui/vba/vbatabstops.hxx
-@@ -0,0 +1,65 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_TABSTOPS_HXX
-+#define SW_VBA_TABSTOPS_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XTabStops.hpp>
-+#include <ooo/vba/word/XTabStop.hpp>
-+#include <com/sun/star/container/XEnumerationAccess.hpp>
-+#include <com/sun/star/container/XIndexAccess.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+
-+typedef CollTestImplHelper< ooo::vba::word::XTabStops > SwVbaTabStops_BASE;
-+
-+class SwVbaTabStops : public SwVbaTabStops_BASE
-+{
-+private:
-+ css::uno::Reference< css::beans::XPropertySet > mxParaProps;
-+
-+public:
-+ SwVbaTabStops( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::beans::XPropertySet >& xParaProps ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaTabStops() {}
-+
-+ // Methods
-+ virtual css::uno::Reference< ::ooo::vba::word::XTabStop > SAL_CALL Add( float Position, const css::uno::Any& Alignment, const css::uno::Any& Leader ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL ClearAll( ) 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);
-+
-+ // SwVbaTabStops_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* SW_VBA_TABSTOPS_HXX */
-diff --git sw/source/ui/vba/vbatemplate.cxx sw/source/ui/vba/vbatemplate.cxx
-index 71dc7ac..31b7ed7 100644
---- sw/source/ui/vba/vbatemplate.cxx
-+++ sw/source/ui/vba/vbatemplate.cxx
-@@ -30,12 +30,35 @@
- #include "vbaautotextentry.hxx"
- #include <comphelper/processfactory.hxx>
- #include <com/sun/star/text/XAutoTextContainer.hpp>
-+#include <tools/urlobj.hxx>
-+#include <osl/file.hxx>
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-
--SwVbaTemplate::SwVbaTemplate( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& rModel, const rtl::OUString& rName )
-- : SwVbaTemplate_BASE( rParent, rContext ), mxModel( rModel ), msName( rName )
-+String lcl_CheckGroupName( const String& rGroupName )
-+{
-+ String sRet;
-+ //group name should contain only A-Z and a-z and spaces
-+ for( xub_StrLen i = 0; i < rGroupName.Len(); i++ )
-+ {
-+ sal_Unicode cChar = rGroupName.GetChar(i);
-+ if( (cChar >= 'A' && cChar <= 'Z') ||
-+ (cChar >= 'a' && cChar <= 'z') ||
-+ (cChar >= '0' && cChar <= '9') ||
-+ cChar == '_' || cChar == 0x20 )
-+ {
-+ sRet += cChar;
-+ }
-+ }
-+ sRet.EraseLeadingChars();
-+ sRet.EraseTrailingChars();
-+ return sRet;
-+}
-+
-+
-+SwVbaTemplate::SwVbaTemplate( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& rModel, const rtl::OUString& rFullUrl )
-+ : SwVbaTemplate_BASE( rParent, rContext ), mxModel( rModel ), msFullUrl( rFullUrl )
- {
- }
-
-@@ -47,7 +70,27 @@ SwVbaTemplate::~SwVbaTemplate()
- rtl::OUString
- SwVbaTemplate::getName() throw ( css::uno::RuntimeException )
- {
-- return msName;
-+ rtl::OUString sName;
-+ if( msFullUrl.getLength() )
-+ {
-+ INetURLObject aURL( msFullUrl );
-+ ::osl::File::getSystemPathFromFileURL( aURL.GetLastName(), sName );
-+ }
-+ return sName;
-+}
-+
-+rtl::OUString
-+SwVbaTemplate::getPath() throw ( css::uno::RuntimeException )
-+{
-+ rtl::OUString sPath;
-+ if( msFullUrl.getLength() )
-+ {
-+ INetURLObject aURL( msFullUrl );
-+ rtl::OUString sURL( aURL.GetMainURL( INetURLObject::DECODE_TO_IURI ) );
-+ sURL = sURL.copy( 0, sURL.getLength() - aURL.GetLastName().getLength() - 1 );
-+ ::osl::File::getSystemPathFromFileURL( sURL, sPath );
-+ }
-+ return sPath;
- }
-
- uno::Any SAL_CALL
-@@ -58,17 +101,18 @@ SwVbaTemplate::AutoTextEntries( const uno::Any& index ) throw (uno::RuntimeExcep
-
- // the default template is "Normal.dot" in Word.
- rtl::OUString sGroup( RTL_CONSTASCII_USTRINGPARAM("Normal") );
-- sal_Int32 nIndex = msName.lastIndexOf( sal_Unicode('.') );
-+ rtl::OUString sName = getName();
-+ sal_Int32 nIndex = sName.lastIndexOf( sal_Unicode('.') );
- if( nIndex > 0 )
- {
-- sGroup = msName.copy( 0, msName.lastIndexOf( sal_Unicode('.') ) );
-- // OSL_TRACE("SwVbaTemplate::AutoTextEntries: %s", rtl::OUStringToOString( sGroup, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ sGroup = sName.copy( 0, sName.lastIndexOf( sal_Unicode('.') ) );
- }
--
-+ String sNewGroup = lcl_CheckGroupName( sGroup );
-+
- uno::Reference< container::XIndexAccess > xGroup;
-- if( xAutoTextContainer->hasByName( sGroup ) )
-+ if( xAutoTextContainer->hasByName( sNewGroup ) )
- {
-- xGroup.set( xAutoTextContainer->getByName( sGroup ), uno::UNO_QUERY_THROW );
-+ xGroup.set( xAutoTextContainer->getByName( sNewGroup ), uno::UNO_QUERY_THROW );
- }
- else
- {
-diff --git sw/source/ui/vba/vbatemplate.hxx sw/source/ui/vba/vbatemplate.hxx
-index 4e33599..0abbc36 100644
---- sw/source/ui/vba/vbatemplate.hxx
-+++ sw/source/ui/vba/vbatemplate.hxx
-@@ -36,7 +36,7 @@ class SwVbaTemplate : public SwVbaTemplate_BASE
- {
- private:
- css::uno::Reference< css::frame::XModel > mxModel;
-- rtl::OUString msName;
-+ rtl::OUString msFullUrl;
- public:
- SwVbaTemplate( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext,
- const css::uno::Reference< css::frame::XModel >& rModel, const rtl::OUString& );
-@@ -44,6 +44,7 @@ public:
-
- // XTemplate
- virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
-+ virtual rtl::OUString SAL_CALL getPath() throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL AutoTextEntries( const css::uno::Any& index ) throw (css::uno::RuntimeException);
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
-diff --git sw/source/ui/vba/vbaview.cxx sw/source/ui/vba/vbaview.cxx
-index 2cf6194..3dba711 100644
---- sw/source/ui/vba/vbaview.cxx
-+++ sw/source/ui/vba/vbaview.cxx
-@@ -92,20 +92,20 @@ SwVbaView::getSeekView() throw (css::uno::RuntimeException)
- }
- else if( aImplName.equalsAscii("SwXHeadFootText") )
- {
-- if( HeaderFooterHelper::isHeader( mxModel, xCurrentText ) )
-+ if( HeaderFooterHelper::isHeader( mxModel ) )
- {
-- if( HeaderFooterHelper::isFirstPageHeader( mxModel, xCurrentText ) )
-+ if( HeaderFooterHelper::isFirstPageHeader( mxModel ) )
- return word::WdSeekView::wdSeekFirstPageHeader;
-- else if( HeaderFooterHelper::isEvenPagesHeader( mxModel, xCurrentText ) )
-+ else if( HeaderFooterHelper::isEvenPagesHeader( mxModel ) )
- return word::WdSeekView::wdSeekEvenPagesHeader;
- else
- return word::WdSeekView::wdSeekPrimaryHeader;
- }
- else
- {
-- if( HeaderFooterHelper::isFirstPageFooter( mxModel, xCurrentText ) )
-+ if( HeaderFooterHelper::isFirstPageFooter( mxModel ) )
- return word::WdSeekView::wdSeekFirstPageFooter;
-- else if( HeaderFooterHelper::isEvenPagesFooter( mxModel, xCurrentText ) )
-+ else if( HeaderFooterHelper::isEvenPagesFooter( mxModel ) )
- return word::WdSeekView::wdSeekEvenPagesFooter;
- else
- return word::WdSeekView::wdSeekPrimaryFooter;
-@@ -132,6 +132,7 @@ SwVbaView::setSeekView( ::sal_Int32 _seekview ) throw (css::uno::RuntimeExceptio
- // if( _seekview == getSeekView() )
- // return;
-
-+ word::gotoSelectedObjectAnchor( mxModel );
- switch( _seekview )
- {
- case word::WdSeekView::wdSeekFirstPageFooter:
-@@ -181,7 +182,7 @@ SwVbaView::setSeekView( ::sal_Int32 _seekview ) throw (css::uno::RuntimeExceptio
- {
- uno::Reference< text::XTextDocument > xTextDocument( mxModel, uno::UNO_QUERY_THROW );
- uno::Reference< text::XText > xText = xTextDocument->getText();
-- mxViewCursor->gotoRange( getFirstObjectPosition( xText ), sal_False );
-+ mxViewCursor->gotoRange( word::getFirstObjectPosition( xText ), sal_False );
- break;
- }
- }
-@@ -376,28 +377,7 @@ uno::Reference< text::XTextRange > SwVbaView::getHFTextRange( sal_Int32 nType )
- {
- DebugHelper::exception( SbERR_INTERNAL_ERROR, rtl::OUString() );
- }
-- uno::Reference< text::XTextRange > xTextRange = getFirstObjectPosition( xText );
-- return xTextRange;
--}
--
--uno::Reference< text::XTextRange > SwVbaView::getFirstObjectPosition( const uno::Reference< text::XText >& xText ) throw (uno::RuntimeException)
--{
-- // if the first object is table, get the position of first cell
-- uno::Reference< text::XTextRange > xTextRange;
-- uno::Reference< container::XEnumerationAccess > xParaAccess( xText, uno::UNO_QUERY_THROW );
-- uno::Reference< container::XEnumeration> xParaEnum = xParaAccess->createEnumeration();
-- if( xParaEnum->hasMoreElements() )
-- {
-- uno::Reference< lang::XServiceInfo > xServiceInfo( xParaEnum->nextElement(), uno::UNO_QUERY_THROW );
-- if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextTable") ) ) )
-- {
-- uno::Reference< table::XCellRange > xCellRange( xServiceInfo, uno::UNO_QUERY_THROW );
-- uno::Reference< text::XText> xFirstCellText( xCellRange->getCellByPosition(0, 0), uno::UNO_QUERY_THROW );
-- xTextRange = xFirstCellText->getStart();
-- }
-- }
-- if( !xTextRange.is() )
-- xTextRange = xText->getStart();
-+ uno::Reference< text::XTextRange > xTextRange = word::getFirstObjectPosition( xText );
- return xTextRange;
- }
-
-diff --git sw/source/ui/vba/vbawindow.cxx sw/source/ui/vba/vbawindow.cxx
-index dc5913a..687868d 100644
---- sw/source/ui/vba/vbawindow.cxx
-+++ sw/source/ui/vba/vbawindow.cxx
-@@ -25,12 +25,21 @@
- *
- ************************************************************************/
- #include <vbahelper/helperdecl.hxx>
-+#include <ooo/vba/word/WdWindowState.hpp>
-+#include <vcl/wrkwin.hxx>
-+
- #include "vbawindow.hxx"
- #include "vbaglobals.hxx"
- #include "vbadocument.hxx"
- #include "vbaview.hxx"
- #include "vbapanes.hxx"
- #include "vbapane.hxx"
-+#include "wordvbahelper.hxx"
-+#include <view.hxx>
-+// #FIXME where has SfxTopViewFrame gone
-+#if 0
-+#include <sfx2/topfrm.hxx>
-+#endif
-
- using namespace ::com::sun::star;
- using namespace ::ooo::vba;
-@@ -73,6 +82,44 @@ void SAL_CALL SwVbaWindow::setView( const uno::Any& _view ) throw (uno::RuntimeE
- }
-
- uno::Any SAL_CALL
-+SwVbaWindow::getWindowState() throw (uno::RuntimeException)
-+{
-+ sal_Int32 nwindowState = word::WdWindowState::wdWindowStateNormal;
-+ SwView* pView = word::getView( m_xModel );
-+ SfxViewFrame* pViewFrame = pView -> GetViewFrame();
-+ WorkWindow* pWork = (WorkWindow*) pViewFrame->GetFrame().GetSystemWindow();
-+ if ( pWork )
-+ {
-+ if ( pWork -> IsMaximized())
-+ nwindowState = word::WdWindowState::wdWindowStateMaximize;
-+ else if (pWork -> IsMinimized())
-+ nwindowState = word::WdWindowState::wdWindowStateMinimize;
-+ }
-+ return uno::makeAny( nwindowState );
-+}
-+
-+void SAL_CALL
-+SwVbaWindow::setWindowState( const uno::Any& _windowstate ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nwindowState = word::WdWindowState::wdWindowStateMaximize;
-+ _windowstate >>= nwindowState;
-+ SwView* pView = word::getView( m_xModel );
-+ SfxViewFrame* pViewFrame = pView -> GetViewFrame();
-+ WorkWindow* pWork = (WorkWindow*) pViewFrame->GetFrame().GetSystemWindow();
-+ if ( pWork )
-+ {
-+ if ( nwindowState == word::WdWindowState::wdWindowStateMaximize )
-+ pWork -> Maximize();
-+ else if (nwindowState == word::WdWindowState::wdWindowStateMinimize)
-+ pWork -> Minimize();
-+ else if (nwindowState == word::WdWindowState::wdWindowStateNormal)
-+ pWork -> Restore();
-+ else
-+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Invalid Parameter" ) ), uno::Reference< uno::XInterface >() );
-+ }
-+}
-+
-+uno::Any SAL_CALL
- SwVbaWindow::Panes( const uno::Any& aIndex ) throw (uno::RuntimeException)
- {
- uno::Reference< XCollection > xPanes( new SwVbaPanes( this, mxContext, m_xModel ) );
-diff --git sw/source/ui/vba/vbawindow.hxx sw/source/ui/vba/vbawindow.hxx
-index 1ef1ff9..a5e03e9 100644
---- sw/source/ui/vba/vbawindow.hxx
-+++ sw/source/ui/vba/vbawindow.hxx
-@@ -44,6 +44,8 @@ public:
- // Attributes
- 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 css::uno::Any SAL_CALL getWindowState() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setWindowState( const css::uno::Any& _windowstate ) throw (css::uno::RuntimeException);
- // Methods
- virtual void SAL_CALL Activate( ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Close( const css::uno::Any& SaveChanges, const css::uno::Any& RouteDocument ) throw (css::uno::RuntimeException);
-diff --git sw/source/ui/vba/wordvbahelper.cxx sw/source/ui/vba/wordvbahelper.cxx
-index e489b0b..281eb70 100644
---- sw/source/ui/vba/wordvbahelper.cxx
-+++ sw/source/ui/vba/wordvbahelper.cxx
-@@ -29,11 +29,16 @@
- #include <comphelper/processfactory.hxx>
- #include <com/sun/star/frame/XController.hpp>
- #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
-+#include <com/sun/star/text/XTextTable.hpp>
-+#include <com/sun/star/table/XCellRange.hpp>
- #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
- #include <com/sun/star/container/XNameAccess.hpp>
-+#include <com/sun/star/container/XIndexAccess.hpp>
- #include <com/sun/star/lang/XUnoTunnel.hpp>
-+#include <com/sun/star/view/XSelectionSupplier.hpp>
- #include <unotxdoc.hxx>
- #include <doc.hxx>
-+#include <view.hxx>
-
- using namespace ::com::sun::star;
- using namespace ::ooo::vba;
-@@ -71,8 +76,13 @@ uno::Reference< text::XTextViewCursor > getXTextViewCursor( const uno::Reference
- uno::Reference< style::XStyle > getCurrentPageStyle( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
- {
- uno::Reference< beans::XPropertySet > xCursorProps( getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
-+ return getCurrentPageStyle( xModel, xCursorProps );
-+}
-+
-+uno::Reference< style::XStyle > getCurrentPageStyle( const uno::Reference< frame::XModel >& xModel, const uno::Reference< beans::XPropertySet >& xProps ) throw (uno::RuntimeException)
-+{
- rtl::OUString aPageStyleName;
-- xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyleName"))) >>= aPageStyleName;
-+ xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyleName"))) >>= aPageStyleName;
- uno::Reference< style::XStyleFamiliesSupplier > xSytleFamSupp( xModel, uno::UNO_QUERY_THROW );
- uno::Reference< container::XNameAccess > xSytleFamNames( xSytleFamSupp->getStyleFamilies(), uno::UNO_QUERY_THROW );
- uno::Reference< container::XNameAccess > xPageStyles( xSytleFamNames->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyles") ) ), uno::UNO_QUERY_THROW );
-@@ -87,6 +97,92 @@ sal_Int32 getPageCount( const uno::Reference< frame::XModel>& xModel ) throw (un
- return pDocShell ? pDocShell->GetDoc()->GetPageCount() : 0;
- }
-
-+uno::Reference< style::XStyle > getDefaultParagraphStyle( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< style::XStyleFamiliesSupplier > xSytleFamSupp( xModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XNameAccess > xSytleFamNames( xSytleFamSupp->getStyleFamilies(), uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XNameAccess > xParaStyles( xSytleFamNames->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParagraphStyles") ) ), uno::UNO_QUERY_THROW );
-+ uno::Reference< style::XStyle > xStyle( xParaStyles->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Standard") ) ), uno::UNO_QUERY_THROW );
-+
-+ return xStyle;
-+}
-+
-+uno::Reference< text::XTextRange > getFirstObjectPosition( const uno::Reference< text::XText >& xText ) throw (uno::RuntimeException)
-+{
-+ // if the first object is table, get the position of first cell
-+ uno::Reference< text::XTextRange > xTextRange;
-+ uno::Reference< container::XEnumerationAccess > xParaAccess( xText, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XEnumeration> xParaEnum = xParaAccess->createEnumeration();
-+ if( xParaEnum->hasMoreElements() )
-+ {
-+ uno::Reference< lang::XServiceInfo > xServiceInfo( xParaEnum->nextElement(), uno::UNO_QUERY_THROW );
-+ if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextTable") ) ) )
-+ {
-+ uno::Reference< table::XCellRange > xCellRange( xServiceInfo, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XText> xFirstCellText( xCellRange->getCellByPosition(0, 0), uno::UNO_QUERY_THROW );
-+ xTextRange = xFirstCellText->getStart();
-+ }
-+ }
-+ if( !xTextRange.is() )
-+ xTextRange = xText->getStart();
-+ return xTextRange;
-+}
-+
-+uno::Reference< text::XText > getCurrentXText( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< text::XTextRange > xTextRange;
-+ uno::Reference< text::XTextContent > xTextContent( xModel->getCurrentSelection(), uno::UNO_QUERY );
-+ if( !xTextContent.is() )
-+ {
-+ uno::Reference< container::XIndexAccess > xIndexAccess( xModel->getCurrentSelection(), uno::UNO_QUERY );
-+ if( xIndexAccess.is() )
-+ {
-+ xTextContent.set( xIndexAccess->getByIndex(0), uno::UNO_QUERY );
-+ }
-+ }
-+
-+ if( xTextContent.is() )
-+ xTextRange.set( xTextContent->getAnchor(), uno::UNO_QUERY );
-+
-+ if( !xTextRange.is() )
-+ xTextRange.set( getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
-+
-+ uno::Reference< text::XText > xText;
-+ try
-+ {
-+ xText.set( xTextRange->getText(), uno::UNO_QUERY );
-+ }
-+ catch( uno::RuntimeException& )
-+ {
-+ //catch exception "no text selection"
-+ }
-+ uno::Reference< beans::XPropertySet > xVCProps( xTextRange, uno::UNO_QUERY_THROW );
-+ while( xVCProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ) >>= xTextContent )
-+ {
-+ xText = xTextContent->getAnchor()->getText();
-+ xVCProps.set( xText->createTextCursor(), uno::UNO_QUERY_THROW );
-+ }
-+
-+ if( !xText.is() )
-+ throw uno::RuntimeException( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), uno::Reference< uno::XInterface >() );
-+
-+ return xText;
-+}
-+
-+sal_Bool gotoSelectedObjectAnchor( const uno::Reference< frame::XModel>& xModel ) throw (uno::RuntimeException)
-+{
-+ sal_Bool isObjectSelected = sal_False;
-+ uno::Reference< text::XTextContent > xTextContent( xModel->getCurrentSelection(), uno::UNO_QUERY );
-+ if( xTextContent.is() )
-+ {
-+ uno::Reference< text::XTextRange > xTextRange( xTextContent->getAnchor(), uno::UNO_QUERY_THROW );
-+ uno::Reference< view::XSelectionSupplier > xSelectSupp( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
-+ xSelectSupp->select( uno::makeAny( xTextRange ) );
-+ isObjectSelected = sal_True;
-+ }
-+ return isObjectSelected;
-+}
-+
- } // word
- } //
- } //
-diff --git sw/source/ui/vba/wordvbahelper.hxx sw/source/ui/vba/wordvbahelper.hxx
-index 489cf25..47d718e 100644
---- sw/source/ui/vba/wordvbahelper.hxx
-+++ sw/source/ui/vba/wordvbahelper.hxx
-@@ -32,6 +32,8 @@
- #include <com/sun/star/text/XTextViewCursor.hpp>
- #include <com/sun/star/text/XPageCursor.hpp>
- #include <com/sun/star/style/XStyle.hpp>
-+#include <com/sun/star/text/XTextTable.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-
- class SwDocShell;
- class SwView;
-@@ -46,7 +48,20 @@ namespace ooo
- SwView* getView( const css::uno::Reference< css::frame::XModel>& xModel );
- css::uno::Reference< css::text::XTextViewCursor > getXTextViewCursor( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
- css::uno::Reference< css::style::XStyle > getCurrentPageStyle( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
-+ css::uno::Reference< css::style::XStyle > getCurrentPageStyle( const css::uno::Reference< css::frame::XModel>& xModel, const css::uno::Reference< css::beans::XPropertySet >& xProps ) throw (css::uno::RuntimeException);
- sal_Int32 getPageCount( const css::uno::Reference< css::frame::XModel>& xModel ) throw (css::uno::RuntimeException);
-+ css::uno::Reference< css::style::XStyle > getDefaultParagraphStyle( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
-+ css::uno::Reference< css::text::XTextRange > getFirstObjectPosition( const css::uno::Reference< css::text::XText >& xText ) throw (css::uno::RuntimeException);
-+ css::uno::Reference< css::text::XText > getCurrentXText( const css::uno::Reference< css::frame::XModel>& xModel ) throw (css::uno::RuntimeException);
-+ sal_Bool gotoSelectedObjectAnchor( const css::uno::Reference< css::frame::XModel>& xModel ) throw (css::uno::RuntimeException);
-+
-+ enum E_DIRECTION
-+ {
-+ MOVE_LEFT = 1,
-+ MOVE_RIGHT,
-+ MOVE_UP,
-+ MOVE_DOWN
-+ };
-
- } // word
- } // vba
-diff --git sw/util/makefile.mk sw/util/makefile.mk
-index 2907264..0fe0b68 100644
---- sw/util/makefile.mk
-+++ sw/util/makefile.mk
-@@ -335,6 +335,7 @@ SHL4STDLIBS= \
- $(SALLIB) \
- $(ICUUCLIB) \
- $(BASICLIB) \
-+ $(MSFILTERLIB) \
- $(I18NUTILLIB)
-
- .IF "$(ENABLE_VBA)" == "YES"
-@@ -367,7 +368,11 @@ SHL5STDLIBS= \
- $(I18NISOLANGLIB) \
- $(EDITENGLIB) \
- $(SVXCORELIB) \
-- $(SVXMSFILTERLIB)
-+ $(MSFILTERLIB)
-+
-+.IF "$(GUI)"=="WNT"
-+SHL5STDLIBS+=$(SHELLLIB)
-+.ENDIF #WNT
-
- SHL5DEPN=$(SHL1TARGETN)
- SHL5LIBS=$(SLB)$/$(TARGET_VBA).lib
-diff --git toolkit/inc/toolkit/awt/vclxmenu.hxx toolkit/inc/toolkit/awt/vclxmenu.hxx
-index 9fefbe9..88be605 100644
---- toolkit/inc/toolkit/awt/vclxmenu.hxx
-+++ toolkit/inc/toolkit/awt/vclxmenu.hxx
-@@ -45,6 +45,7 @@
- class Menu;
- class MenuBar;
- class VclSimpleEvent;
-+class PopupMenu;
-
- DECLARE_LIST( PopupMenuRefList, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >* )
-
-@@ -181,6 +182,7 @@ class TOOLKIT_DLLPUBLIC VCLXPopupMenu : public VCLXMenu
- {
- public:
- VCLXPopupMenu();
-+ VCLXPopupMenu( PopupMenu* pPopMenu );
- };
-
- #endif // _TOOLKIT_AWT_VCLXMENU_HXX_
-diff --git toolkit/inc/toolkit/awt/vclxwindows.hxx toolkit/inc/toolkit/awt/vclxwindows.hxx
-index 999e761..d595981 100644
---- toolkit/inc/toolkit/awt/vclxwindows.hxx
-+++ toolkit/inc/toolkit/awt/vclxwindows.hxx
-@@ -96,6 +96,7 @@
- #include <vcl/imgcons.hxx>
- #include <vcl/image.hxx>
-
-+#include <com/sun/star/document/XVbaMethodParameter.hpp> //liuchen 2009-6-22, add the support of input/output parameters to VBA Dialog_QueryClose event
- class Button;
- class CheckBox;
- class RadioButton;
-@@ -391,6 +392,7 @@ public:
- // class VCLXDialog
- // ----------------------------------------------------
- class VCLXDialog : public ::com::sun::star::awt::XDialog2,
-+ public ::com::sun::star::document::XVbaMethodParameter, //liuchen 2009-6-22, add the support of input/output parameters to VBA UserForm_QueryClose event
- public VCLXTopWindow
- {
- public:
-@@ -428,6 +430,10 @@ public:
- // ::com::sun::star::awt::XVclWindowPeer
- void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
-
-+ //liuchen 2009-6-23, support Excel VBA UserForm_QueryClose event
-+ // ::com::sun::star::document::XVBAMethodParameter
-+ void SAL_CALL setVbaMethodParameter( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
-+ ::com::sun::star::uno::Any SAL_CALL getVbaMethodParameter( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
- };
-
- // ----------------------------------------------------
-diff --git toolkit/inc/toolkit/controls/dialogcontrol.hxx toolkit/inc/toolkit/controls/dialogcontrol.hxx
-index 7b8e025..a1725f2 100644
---- toolkit/inc/toolkit/controls/dialogcontrol.hxx
-+++ toolkit/inc/toolkit/controls/dialogcontrol.hxx
-@@ -48,6 +48,8 @@
- #include <cppuhelper/propshlp.hxx>
- #include <cppuhelper/basemutex.hxx>
- #include <list>
-+#include <map>
-+#include <com/sun/star/graphic/XGraphicObject.hpp>
-
- // ----------------------------------------------------
- // class UnoControlDialogModel
-@@ -88,7 +90,9 @@ private:
-
- AllGroups maGroups;
- sal_Bool mbGroupsUpToDate;
--
-+
-+ ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicObject > mxGrfObj;
-+ bool mbAdjustingGraphic;
- protected:
- ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
- ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
-@@ -175,10 +179,20 @@ public:
- protected:
- void startControlListening( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxChildModel );
- void stopControlListening( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxChildModel );
-+ // ::cppu::OPropertySetHelper
-+ void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception);
-
- void implNotifyTabModelChange( const ::rtl::OUString& _rAccessor );
-
- void implUpdateGroupStructure();
-+private:
-+ void AddRadioButtonToGroup (
-+ const ::com::sun::star::uno::Reference< XControlModel >& rControlModel,
-+ const ::rtl::OUString& rPropertyName,
-+ ::std::map< ::rtl::OUString, ModelGroup >& pNamedGroups,
-+ ModelGroup*& rpCurrentGroup );
-+ void AddRadioButtonGroup (
-+ ::std::map< ::rtl::OUString, ModelGroup >& pNamedGroups );
- };
-
- // ----------------------------------------------------
-diff --git toolkit/inc/toolkit/controls/unocontrols.hxx toolkit/inc/toolkit/controls/unocontrols.hxx
-index a7875c6..d6d63f0 100644
---- toolkit/inc/toolkit/controls/unocontrols.hxx
-+++ toolkit/inc/toolkit/controls/unocontrols.hxx
-@@ -228,7 +228,6 @@ private:
- bool mbAdjustingGraphic;
-
- ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicObject > mxGrfObj;
-- ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL );
- protected:
- ImageProducerControlModel() : mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ) { }
- ImageProducerControlModel( const ImageProducerControlModel& _rSource ) : com::sun::star::awt::XImageProducer(), UnoControlModel( _rSource ), mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ) { }
-@@ -673,6 +672,44 @@ public:
-
- };
-
-+class UnoMultiPageModel : public UnoControlModel
-+{
-+protected:
-+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
-+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
-+
-+public:
-+ UnoMultiPageModel();
-+ UnoMultiPageModel( const UnoMultiPageModel& rModel ) : UnoControlModel( rModel ) {;}
-+
-+ UnoControlModel* Clone() const { return new UnoMultiPageModel( *this ); }
-+
-+ // ::com::sun::star::io::XPersistObject
-+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
-+
-+ // ::com::sun::star::beans::XMultiPropertySet
-+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
-+
-+ // ::com::sun::star::lang::XServiceInfo
-+ DECLIMPL_SERVICEINFO_DERIVED( UnoMultiPageModel, UnoControlModel, szServiceName_UnoMultiPageModel )
-+
-+};
-+// ----------------------------------------------------
-+// class UnoGroupBoxControl
-+// ----------------------------------------------------
-+class UnoMultiPageControl : public UnoControlBase
-+{
-+public:
-+ UnoMultiPageControl();
-+ ::rtl::OUString GetComponentServiceName();
-+
-+ sal_Bool SAL_CALL isTransparent( ) throw(::com::sun::star::uno::RuntimeException);
-+
-+ // ::com::sun::star::lang::XServiceInfo
-+ DECLIMPL_SERVICEINFO_DERIVED( UnoMultiPageControl, UnoControlBase, szServiceName_UnoMultiPageControl )
-+
-+};
-+
- // ----------------------------------------------------
- // class UnoFixedTextControl
- // ----------------------------------------------------
-diff --git toolkit/inc/toolkit/helper/property.hxx toolkit/inc/toolkit/helper/property.hxx
-index d3a4f7d..a7c129d 100644
---- toolkit/inc/toolkit/helper/property.hxx
-+++ toolkit/inc/toolkit/helper/property.hxx
-@@ -195,6 +195,7 @@ namespace rtl {
- #define BASEPROPERTY_GRID_SELECTIONMODE 144
- #define BASEPROPERTY_ENABLEVISIBLE 145 // sal_Bool
- #define BASEPROPERTY_REFERENCE_DEVICE 146
-+
- #define BASEPROPERTY_HIGHCONTRASTMODE 147
- #define BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND 148
- #define BASEPROPERTY_GRID_HEADER_BACKGROUND 149
-@@ -202,6 +203,8 @@ namespace rtl {
- #define BASEPROPERTY_GRID_ROW_BACKGROUND 151
- #define BASEPROPERTY_MULTISELECTION_SIMPLEMODE 152
- #define BASEPROPERTY_ITEM_SEPARATOR_POS 153
-+#define BASEPROPERTY_GROUPNAME 154 // ::rtl::OUString
-+#define BASEPROPERTY_VBAFORM 155 // sal_Bool
-
-
- // Keine gebundenen Properties, werden immer aus der Property BASEPROPERTY_FONTDESCRIPTOR entnommen.
-diff --git toolkit/inc/toolkit/helper/servicenames.hxx toolkit/inc/toolkit/helper/servicenames.hxx
-index 955accd..b0abd38 100644
---- toolkit/inc/toolkit/helper/servicenames.hxx
-+++ toolkit/inc/toolkit/helper/servicenames.hxx
-@@ -37,6 +37,8 @@ extern const sal_Char __FAR_DATA szServiceName_PopupMenu[], szServiceName2_Popup
- extern const sal_Char __FAR_DATA szServiceName_MenuBar[], szServiceName2_MenuBar[];
- extern const sal_Char __FAR_DATA szServiceName_Pointer[], szServiceName2_Pointer[];
- extern const sal_Char __FAR_DATA szServiceName_UnoControlContainer[], szServiceName2_UnoControlContainer[];
-+extern const sal_Char __FAR_DATA szServiceName_UnoMultiPageControl[], szServiceName2_UnoMultiPageControl[];
-+extern const sal_Char __FAR_DATA szServiceName_UnoMultiPageModel[], szServiceName2_UnoMultiPageModel[];
- extern const sal_Char __FAR_DATA szServiceName_UnoControlContainerModel[], szServiceName2_UnoControlContainerModel[];
- extern const sal_Char __FAR_DATA szServiceName_TabController[], szServiceName2_TabController[];
- extern const sal_Char __FAR_DATA szServiceName_TabControllerModel[], szServiceName2_TabControllerModel[];
-diff --git toolkit/source/awt/vclxmenu.cxx toolkit/source/awt/vclxmenu.cxx
-index c6294c8..eb5cb3b 100644
---- toolkit/source/awt/vclxmenu.cxx
-+++ toolkit/source/awt/vclxmenu.cxx
-@@ -539,6 +539,14 @@ void VCLXMenu::setPopupMenu( sal_Int16 nItemId, const ::com::sun::star::uno::Ref
- break;
- }
- }
-+ // it seems the popup menu is not insert into maPopupMenueRefs
-+ // if the popup men is not created by stardiv.Toolkit.VCLXPopupMenu
-+ if( !aRef.is() )
-+ {
-+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > * pNewRef = new ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > ;
-+ *pNewRef = new VCLXPopupMenu( (PopupMenu*)pMenu );
-+ aRef = *pNewRef;
-+ }
- }
- return aRef;
- }
-@@ -1101,3 +1109,8 @@ VCLXPopupMenu::VCLXPopupMenu()
- DBG_CTOR( VCLXPopupMenu, 0 );
- ImplCreateMenu( TRUE );
- }
-+
-+VCLXPopupMenu::VCLXPopupMenu( PopupMenu* pPopMenu ) : VCLXMenu( (Menu *)pPopMenu )
-+{
-+ DBG_CTOR( VCLXPopupMenu, 0 );
-+}
-diff --git toolkit/source/awt/vclxwindows.cxx toolkit/source/awt/vclxwindows.cxx
-index 52af567..7a5b26b 100644
---- toolkit/source/awt/vclxwindows.cxx
-+++ toolkit/source/awt/vclxwindows.cxx
-@@ -1130,6 +1130,7 @@ void VCLXRadioButton::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
- BASEPROPERTY_WRITING_MODE,
- BASEPROPERTY_CONTEXT_WRITING_MODE,
- BASEPROPERTY_REFERENCE_DEVICE,
-+ BASEPROPERTY_GROUPNAME,
- 0);
- VCLXImageConsumer::ImplGetPropertyIds( rIds );
- }
-@@ -2334,6 +2335,7 @@ VCLXDialog::~VCLXDialog()
- ::com::sun::star::uno::Any VCLXDialog::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
- {
- ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
-+ SAL_STATIC_CAST( ::com::sun::star::document::XVbaMethodParameter*, this ), //liuchen 2009-6-23
- SAL_STATIC_CAST( ::com::sun::star::awt::XDialog2*, this ),
- SAL_STATIC_CAST( ::com::sun::star::awt::XDialog*, this ) );
- return (aRet.hasValue() ? aRet : VCLXTopWindow::queryInterface( rType ));
-@@ -2341,6 +2343,7 @@ VCLXDialog::~VCLXDialog()
-
- // ::com::sun::star::lang::XTypeProvider
- IMPL_XTYPEPROVIDER_START( VCLXDialog )
-+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::document::XVbaMethodParameter>* ) NULL ), //liuchen 2009-6-23
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDialog2>* ) NULL ),
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDialog>* ) NULL ),
- VCLXTopWindow::getTypes()
-@@ -2443,6 +2446,40 @@ void SAL_CALL VCLXDialog::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::s
- return aInfo;
- }
-
-+//liuchen 2009-7-22
-+// ::com::sun::star::document::XVbaMethodParameter
-+void SAL_CALL VCLXDialog::setVbaMethodParameter(
-+ const ::rtl::OUString& PropertyName,
-+ const ::com::sun::star::uno::Any& Value )
-+throw(::com::sun::star::uno::RuntimeException)
-+{
-+ if (rtl::OUString::createFromAscii( "Cancel" ) == PropertyName)
-+ {
-+ ::vos::OGuard aGuard( GetMutex() );
-+ if ( GetWindow() )
-+ {
-+ sal_Int8 nCancel;
-+ Value >>= nCancel;
-+
-+ Dialog* pDlg = (Dialog*) GetWindow();
-+ pDlg->SetCloseFlag(nCancel);
-+ }
-+ }
-+}
-+
-+::com::sun::star::uno::Any SAL_CALL VCLXDialog::getVbaMethodParameter(
-+ const ::rtl::OUString& PropertyName )
-+throw(::com::sun::star::uno::RuntimeException)
-+{
-+ ::vos::OGuard aGuard( GetMutex() );
-+
-+ ::com::sun::star::uno::Any aRet;
-+ return aRet;
-+}
-+//liuchen 2009-7-22
-+
-+
-+
-
- void SAL_CALL VCLXDialog::setProperty(
- const ::rtl::OUString& PropertyName,
-diff --git toolkit/source/controls/dialogcontrol.cxx toolkit/source/controls/dialogcontrol.cxx
-index 5f84d9f..df3214d 100644
---- toolkit/source/controls/dialogcontrol.cxx
-+++ toolkit/source/controls/dialogcontrol.cxx
-@@ -81,6 +81,7 @@ using namespace ::com::sun::star::lang;
- using namespace ::com::sun::star::container;
- using namespace ::com::sun::star::beans;
- using namespace ::com::sun::star::util;
-+using namespace ::com::sun::star::script;
- using namespace toolkit;
-
- #define PROPERTY_RESOURCERESOLVER ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ))
-@@ -91,6 +92,8 @@ using namespace toolkit;
- //HELPER
- ::rtl::OUString getPhysicalLocation( const ::com::sun::star::uno::Any& rbase, const ::com::sun::star::uno::Any& rUrl );
-
-+uno::Reference< graphic::XGraphic > getGraphicFromURL_nothrow( uno::Reference< graphic::XGraphicObject >& rxGrfObj, const ::rtl::OUString& _rURL );
-+
- struct LanguageDependentProp
- {
- const char* pPropName;
-@@ -116,7 +119,7 @@ namespace
- }
- return s_aLanguageDependentProperties;
- }
--
-+
- static uno::Reference< graphic::XGraphic > lcl_getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL )
- {
- uno::Reference< graphic::XGraphic > xGraphic;
-@@ -143,6 +146,18 @@ namespace
- return xGraphic;
- }
-
-+ static ::rtl::OUString lcl_GetStringProperty( const ::rtl::OUString& sProperty, const Reference< XPropertySet >& xSet )
-+ {
-+ ::rtl::OUString sValue;
-+ Reference< XPropertySetInfo > xPSI;
-+ if (xSet.is() && (xPSI = xSet->getPropertySetInfo()).is() &&
-+ xPSI->hasPropertyByName( sProperty ) )
-+ {
-+ xSet->getPropertyValue( sProperty ) >>= sValue;
-+ }
-+ return sValue;
-+ }
-+
- }
-
- // ----------------------------------------------------------------------------
-@@ -254,7 +269,7 @@ static const ::rtl::OUString& getStepPropertyName( )
- UnoControlDialogModel::UnoControlDialogModel()
- :maContainerListeners( *this )
- ,maChangeListeners ( GetMutex() )
-- ,mbGroupsUpToDate( sal_False )
-+ ,mbGroupsUpToDate( sal_False ), mbAdjustingGraphic( false )
- {
- ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
- // ImplRegisterProperty( BASEPROPERTY_BORDER );
-@@ -276,6 +291,8 @@ UnoControlDialogModel::UnoControlDialogModel()
- aBool <<= (sal_Bool) sal_True;
- ImplRegisterProperty( BASEPROPERTY_MOVEABLE, aBool );
- ImplRegisterProperty( BASEPROPERTY_CLOSEABLE, aBool );
-+ aBool <<= (sal_Bool) sal_False;
-+ ImplRegisterProperty( BASEPROPERTY_VBAFORM, aBool );
- }
-
- UnoControlDialogModel::UnoControlDialogModel( const UnoControlDialogModel& rModel )
-@@ -283,7 +300,7 @@ UnoControlDialogModel::UnoControlDialogModel( const UnoControlDialogModel& rMode
- , UnoControlDialogModel_Base( rModel )
- , maContainerListeners( *this )
- , maChangeListeners ( GetMutex() )
-- , mbGroupsUpToDate( sal_False )
-+ , mbGroupsUpToDate( sal_False ), mbAdjustingGraphic( false )
- {
- }
-
-@@ -314,6 +331,40 @@ Sequence< Type > UnoControlDialogModel::getTypes() throw(RuntimeException)
- return ::rtl::OUString::createFromAscii( szServiceName_UnoControlDialogModel );
- }
-
-+void SAL_CALL UnoControlDialogModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception)
-+{
-+ UnoControlModel::setFastPropertyValue_NoBroadcast( nHandle, rValue );
-+ try
-+ {
-+ switch ( nHandle )
-+ {
-+ case BASEPROPERTY_IMAGEURL:
-+ if ( !mbAdjustingGraphic && ImplHasProperty( BASEPROPERTY_GRAPHIC ) )
-+ {
-+ mbAdjustingGraphic = true;
-+ ::rtl::OUString sImageURL;
-+ OSL_VERIFY( rValue >>= sImageURL );
-+ setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( getGraphicFromURL_nothrow( mxGrfObj, sImageURL ) ) );
-+ mbAdjustingGraphic = false;
-+ }
-+ break;
-+
-+ case BASEPROPERTY_GRAPHIC:
-+ if ( !mbAdjustingGraphic && ImplHasProperty( BASEPROPERTY_IMAGEURL ) )
-+ {
-+ mbAdjustingGraphic = true;
-+ setPropertyValue( GetPropertyName( BASEPROPERTY_IMAGEURL ), uno::makeAny( ::rtl::OUString() ) );
-+ mbAdjustingGraphic = false;
-+ }
-+ break;
-+ }
-+ }
-+ catch( const ::com::sun::star::uno::Exception& )
-+ {
-+ OSL_ENSURE( sal_False, "UnoControlDialogModel::setFastPropertyValue_NoBroadcast: caught an exception while setting Graphic/ImageURL properties!" );
-+ }
-+}
-+
- Any UnoControlDialogModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
- {
- Any aAny;
-@@ -906,6 +957,63 @@ void UnoControlDialogModel::implNotifyTabModelChange( const ::rtl::OUString& _rA
- }
- }
-
-+// ----------------------------------------------------------------------------
-+void UnoControlDialogModel::AddRadioButtonGroup (
-+ ::std::map< ::rtl::OUString, ModelGroup >& rNamedGroups )
-+{
-+ if ( rNamedGroups.size() == 0 )
-+ return;
-+
-+ size_t nGroups = maGroups.size();
-+ maGroups.reserve( nGroups + rNamedGroups.size() );
-+ ::std::map< ::rtl::OUString, ModelGroup >::const_iterator i = rNamedGroups.begin(), e = rNamedGroups.end();
-+ for( ; i != e; ++i)
-+ {
-+ maGroups.push_back( i->second );
-+ }
-+
-+ rNamedGroups.clear();
-+}
-+
-+void UnoControlDialogModel::AddRadioButtonToGroup (
-+ const Reference< XControlModel >& rControlModel,
-+ const ::rtl::OUString& rPropertyName,
-+ ::std::map< ::rtl::OUString, ModelGroup >& rNamedGroups,
-+ ModelGroup*& rpCurrentGroup )
-+{
-+ Reference< XPropertySet > xCurProps( rControlModel, UNO_QUERY );
-+ ::rtl::OUString sGroup = lcl_GetStringProperty( rPropertyName, xCurProps );
-+ const sal_Int32 nControlModelStep = lcl_getDialogStep( rControlModel );
-+
-+ if ( sGroup.getLength() == 0 )
-+ {
-+ // Create a new group if:
-+ if ( maGroups.size() == 0 || // no groups
-+ rpCurrentGroup == NULL || // previous group was closed
-+ (nControlModelStep != 0 && // control step matches current group
-+ maGroups.back().size() > 0 && // (group 0 == display everywhere)
-+ nControlModelStep != lcl_getDialogStep( maGroups.back().back() ) ) )
-+ {
-+ size_t nGroups = maGroups.size();
-+ maGroups.resize( nGroups + 1 );
-+ }
-+ rpCurrentGroup = &maGroups.back();
-+ }
-+ else
-+ {
-+ // Different steps get different sets of named groups
-+ if ( rNamedGroups.size() > 0 &&
-+ rNamedGroups.begin()->second.size() > 0 )
-+ {
-+ const sal_Int32 nPrevStep = lcl_getDialogStep( rNamedGroups.begin()->second.front() );
-+ if ( nControlModelStep != nPrevStep )
-+ AddRadioButtonGroup( rNamedGroups );
-+ }
-+
-+ rpCurrentGroup = &rNamedGroups[ sGroup ];
-+ }
-+ rpCurrentGroup->push_back( rControlModel );
-+}
-
- // ----------------------------------------------------------------------------
- void UnoControlDialogModel::implUpdateGroupStructure()
-@@ -930,10 +1038,13 @@ void UnoControlDialogModel::implUpdateGroupStructure()
-
- GroupingMachineState eState = eLookingForGroup; // the current state of our machine
- Reference< XServiceInfo > xModelSI; // for checking for a radion button
-- AllGroups::iterator aCurrentGroup = maGroups.end(); // the group which we're currently building
-- sal_Int32 nCurrentGroupStep = -1; // the step which all controls of the current group belong to
-+ ModelGroup* aCurrentGroup = NULL; // the group which we're currently building
- sal_Bool bIsRadioButton; // is it a radio button?
-
-+ const ::rtl::OUString GROUP_NAME( RTL_CONSTASCII_USTRINGPARAM( "GroupName" ) );
-+
-+ ::std::map< ::rtl::OUString, ModelGroup > aNamedGroups;
-+
- #if OSL_DEBUG_LEVEL > 1
- ::std::vector< ::rtl::OUString > aCurrentGroupLabels;
- #endif
-@@ -954,14 +1065,8 @@ void UnoControlDialogModel::implUpdateGroupStructure()
- // the current model is a radio button
- // -> we found the beginning of a new group
- // create the place for this group
-- size_t nGroups = maGroups.size();
-- maGroups.resize( nGroups + 1 );
-- aCurrentGroup = maGroups.begin() + nGroups;
-- // and add the (only, til now) member
-- aCurrentGroup->push_back( *pControlModels );
--
-- // get the step which all controls of this group now have to belong to
-- nCurrentGroupStep = lcl_getDialogStep( *pControlModels );
-+ AddRadioButtonToGroup( *pControlModels, GROUP_NAME, aNamedGroups, aCurrentGroup );
-+
- // new state: looking for further members
- eState = eExpandingGroup;
-
-@@ -979,7 +1084,7 @@ void UnoControlDialogModel::implUpdateGroupStructure()
- {
- if ( !bIsRadioButton )
- { // no radio button -> the group is done
-- aCurrentGroup = maGroups.end();
-+ aCurrentGroup = NULL;
- eState = eLookingForGroup;
- #if OSL_DEBUG_LEVEL > 1
- aCurrentGroupLabels.clear();
-@@ -987,47 +1092,8 @@ void UnoControlDialogModel::implUpdateGroupStructure()
- continue;
- }
-
-- // it is a radio button - is it on the proper page?
-- const sal_Int32 nThisModelStep = lcl_getDialogStep( *pControlModels );
-- if ( ( nThisModelStep == nCurrentGroupStep ) // the current button is on the same dialog page
-- || ( 0 == nThisModelStep ) // the current button appears on all pages
-- )
-- {
-- // -> it belongs to the same group
-- aCurrentGroup->push_back( *pControlModels );
-- // state still is eExpandingGroup - we're looking for further elements
-- eState = eExpandingGroup;
--
--#if OSL_DEBUG_LEVEL > 1
-- Reference< XPropertySet > xModelProps( *pControlModels, UNO_QUERY );
-- ::rtl::OUString sLabel;
-- if ( xModelProps.is() && xModelProps->getPropertySetInfo().is() && xModelProps->getPropertySetInfo()->hasPropertyByName( ::rtl::OUString::createFromAscii( "Label" ) ) )
-- xModelProps->getPropertyValue( ::rtl::OUString::createFromAscii( "Label" ) ) >>= sLabel;
-- aCurrentGroupLabels.push_back( sLabel );
--#endif
-- continue;
-- }
--
-- // it's a radio button, but on a different page
-- // -> we open a new group for it
--
-- // close the old group
-- aCurrentGroup = maGroups.end();
--#if OSL_DEBUG_LEVEL > 1
-- aCurrentGroupLabels.clear();
--#endif
--
-- // open a new group
-- size_t nGroups = maGroups.size();
-- maGroups.resize( nGroups + 1 );
-- aCurrentGroup = maGroups.begin() + nGroups;
-- // and add the (only, til now) member
-- aCurrentGroup->push_back( *pControlModels );
--
-- nCurrentGroupStep = nThisModelStep;
-+ AddRadioButtonToGroup( *pControlModels, GROUP_NAME, aNamedGroups, aCurrentGroup );
-
-- // state is the same: we still are looking for further elements of the current group
-- eState = eExpandingGroup;
- #if OSL_DEBUG_LEVEL > 1
- Reference< XPropertySet > xModelProps( *pControlModels, UNO_QUERY );
- ::rtl::OUString sLabel;
-@@ -1040,6 +1106,7 @@ void UnoControlDialogModel::implUpdateGroupStructure()
- }
- }
-
-+ AddRadioButtonGroup( aNamedGroups );
- mbGroupsUpToDate = sal_True;
- }
-
-@@ -1420,17 +1487,32 @@ void UnoDialogControl::ImplSetPosSize( Reference< XControl >& rxCtrl )
- xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" ) ) ) >>= nWidth;
- xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) ) >>= nHeight;
-
-- // Currentley we are simply using MAP_APPFONT
-+ // Currentley we are simply using MAP_APPFONT ( for normal Dialogs )
-+ // and MAP_100TH_MM for imported Userforms
-+ MapMode aMode( MAP_APPFONT );
-+ sal_Bool bVBAForm = sal_False;
-+ Reference< XPropertySet > xDlgModelProps( getModel(), UNO_QUERY );
-+ if ( xDlgModelProps.is() )
-+ {
-+ try
-+ {
-+ xDlgModelProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAForm" ) ) ) >>= bVBAForm;
-+ }
-+ catch( Exception& )
-+ {
-+ }
-+ }
-+ if ( bVBAForm )
-+ aMode = MapMode( MAP_100TH_MM );
- OutputDevice*pOutDev = Application::GetDefaultDevice();
-- DBG_ASSERT( pOutDev, "Missing Default Device!" );
- if ( pOutDev )
- {
- ::Size aTmp( nX, nY );
-- aTmp = pOutDev->LogicToPixel( aTmp, MAP_APPFONT );
-+ aTmp = pOutDev->LogicToPixel( aTmp, aMode );
- nX = aTmp.Width();
- nY = aTmp.Height();
- aTmp = ::Size( nWidth, nHeight );
-- aTmp = pOutDev->LogicToPixel( aTmp, MAP_APPFONT );
-+ aTmp = pOutDev->LogicToPixel( aTmp, aMode );
- nWidth = aTmp.Width();
- nHeight = aTmp.Height();
- }
-@@ -1649,17 +1731,16 @@ void UnoDialogControl::PrepareWindowDescriptor( ::com::sun::star::awt::WindowDes
- // can lead to overwrites we have to set the graphic property
- // before the propertiesChangeEvents are sent!
- ::rtl::OUString aImageURL;
-- Reference< graphic::XGraphic > xGraphic;
- if (( ImplGetPropertyValue( PROPERTY_IMAGEURL ) >>= aImageURL ) &&
- ( aImageURL.getLength() > 0 ))
- {
-- ::rtl::OUString absoluteUrl =
-+ aImageURL =
- getPhysicalLocation( ImplGetPropertyValue( PROPERTY_DIALOGSOURCEURL ),
- ImplGetPropertyValue( PROPERTY_IMAGEURL ));
-
-- xGraphic = lcl_getGraphicFromURL_nothrow( absoluteUrl );
-- ImplSetPropertyValue( PROPERTY_GRAPHIC, uno::makeAny( xGraphic ), sal_True );
- }
-+ if ( aImageURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) != 0 )
-+ ImplSetPropertyValue( PROPERTY_IMAGEURL, uno::makeAny( aImageURL ), sal_True );
- }
-
- void UnoDialogControl::elementInserted( const ContainerEvent& Event ) throw(RuntimeException)
-@@ -1891,18 +1972,16 @@ void UnoDialogControl::ImplModelPropertiesChanged( const Sequence< PropertyChang
- if ( bOwnModel && rEvt.PropertyName.equalsAsciiL( "ImageURL", 8 ))
- {
- ::rtl::OUString aImageURL;
-- Reference< graphic::XGraphic > xGraphic;
- if (( ImplGetPropertyValue( PROPERTY_IMAGEURL ) >>= aImageURL ) &&
- ( aImageURL.getLength() > 0 ))
- {
-- ::rtl::OUString absoluteUrl =
-+ aImageURL =
- getPhysicalLocation( ImplGetPropertyValue( PROPERTY_DIALOGSOURCEURL ),
- ImplGetPropertyValue( PROPERTY_IMAGEURL ));
-
-- xGraphic = lcl_getGraphicFromURL_nothrow( absoluteUrl );
- }
-
-- ImplSetPropertyValue( PROPERTY_GRAPHIC, uno::makeAny( xGraphic ), sal_True );
-+ ImplSetPropertyValue( PROPERTY_IMAGEURL, uno::makeAny( aImageURL ), sal_True );
- break;
- }
- }
-@@ -2103,6 +2182,9 @@ throw (RuntimeException)
-
- ::rtl::OUString getPhysicalLocation( const ::com::sun::star::uno::Any& rbase, const ::com::sun::star::uno::Any& rUrl )
- {
-+
-+ ::rtl::OUString ret;
-+
- ::rtl::OUString baseLocation;
- ::rtl::OUString url;
-
-@@ -2112,9 +2194,16 @@ throw (RuntimeException)
- ::rtl::OUString absoluteURL( url );
- if ( url.getLength() > 0 )
- {
-- INetURLObject urlObj(baseLocation);
-- urlObj.removeSegment();
-- baseLocation = urlObj.GetMainURL( INetURLObject::NO_DECODE );
-+ // Don't adjust GraphicObject url(s)
-+ if ( url.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) != 0 )
-+ {
-+ INetURLObject urlObj(baseLocation);
-+ urlObj.removeSegment();
-+ baseLocation = urlObj.GetMainURL( INetURLObject::NO_DECODE );
-+ ::osl::FileBase::getAbsoluteFileURL( baseLocation, url, ret );
-+ }
-+ else
-+ ret = url;
-
- ::rtl::OUString testAbsoluteURL;
- if ( ::osl::FileBase::E_None == ::osl::FileBase::getAbsoluteFileURL( baseLocation, url, testAbsoluteURL ) )
-diff --git toolkit/source/controls/unocontrolmodel.cxx toolkit/source/controls/unocontrolmodel.cxx
-index 7e6346b..9335711 100644
---- toolkit/source/controls/unocontrolmodel.cxx
-+++ toolkit/source/controls/unocontrolmodel.cxx
-@@ -349,6 +349,7 @@ sal_Bool UnoControlModel::ImplHasProperty( sal_uInt16 nPropId ) const
- case BASEPROPERTY_ENABLEVISIBLE:
- case BASEPROPERTY_DECORATION: aDefault <<= (sal_Bool) sal_True; break;
-
-+ case BASEPROPERTY_GROUPNAME:
- case BASEPROPERTY_HELPTEXT:
- case BASEPROPERTY_HELPURL:
- case BASEPROPERTY_IMAGEURL:
-diff --git toolkit/source/controls/unocontrols.cxx toolkit/source/controls/unocontrols.cxx
-index 3b17488..30246ae 100644
---- toolkit/source/controls/unocontrols.cxx
-+++ toolkit/source/controls/unocontrols.cxx
-@@ -573,7 +573,7 @@ uno::Any ImageProducerControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) co
-
- return UnoControlModel::ImplGetDefaultValue( nPropId );
- }
-- uno::Reference< graphic::XGraphic > ImageProducerControlModel::getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL )
-+ uno::Reference< graphic::XGraphic > getGraphicFromURL_nothrow( uno::Reference< graphic::XGraphicObject >& rxGrfObj, const ::rtl::OUString& _rURL )
- {
- uno::Reference< graphic::XGraphic > xGraphic;
-
-@@ -583,10 +583,10 @@ uno::Any ImageProducerControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) co
- rtl::OUString sID = _rURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 );
- // get the DefaultContext
- ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
-- mxGrfObj = graphic::GraphicObject::createWithId( aContext.getUNOContext(), sID );
-+ rxGrfObj = graphic::GraphicObject::createWithId( aContext.getUNOContext(), sID );
- }
- else // linked
-- mxGrfObj = NULL; // release the GraphicObject
-+ rxGrfObj = NULL; // release the GraphicObject
-
- if ( !_rURL.getLength() )
- return xGraphic;
-@@ -627,7 +627,7 @@ void SAL_CALL ImageProducerControlModel::setFastPropertyValue_NoBroadcast( sal_I
- mbAdjustingGraphic = true;
- ::rtl::OUString sImageURL;
- OSL_VERIFY( rValue >>= sImageURL );
-- setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( getGraphicFromURL_nothrow( sImageURL ) ) );
-+ setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( getGraphicFromURL_nothrow( mxGrfObj, sImageURL ) ) );
- mbAdjustingGraphic = false;
- }
- break;
-@@ -1844,6 +1844,75 @@ sal_Bool UnoGroupBoxControl::isTransparent() throw(uno::RuntimeException)
- return sal_True;
- }
-
-+// MultiPage
-+
-+UnoMultiPageModel::UnoMultiPageModel()
-+{
-+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
-+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
-+ ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
-+ ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
-+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
-+ ImplRegisterProperty( BASEPROPERTY_LABEL );
-+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
-+ ImplRegisterProperty( BASEPROPERTY_PROGRESSVALUE );
-+ ImplRegisterProperty( BASEPROPERTY_PROGRESSVALUE_MAX );
-+}
-+
-+::rtl::OUString UnoMultiPageModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
-+{
-+ return ::rtl::OUString::createFromAscii( szServiceName_UnoMultiPageModel );
-+}
-+
-+uno::Any UnoMultiPageModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-+{
-+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
-+ {
-+ uno::Any aAny;
-+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlGroupBox );
-+ //aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoMultiPageControl );
-+ return aAny;
-+ }
-+ return UnoControlModel::ImplGetDefaultValue( nPropId );
-+}
-+
-+::cppu::IPropertyArrayHelper& UnoMultiPageModel::getInfoHelper()
-+{
-+ static UnoPropertyArrayHelper* pHelper = NULL;
-+ if ( !pHelper )
-+ {
-+ uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
-+ pHelper = new UnoPropertyArrayHelper( aIDs );
-+ }
-+ return *pHelper;
-+}
-+
-+// beans::XMultiPropertySet
-+uno::Reference< beans::XPropertySetInfo > UnoMultiPageModel::getPropertySetInfo( ) throw(uno::RuntimeException)
-+{
-+ static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
-+ return xInfo;
-+}
-+
-+// ----------------------------------------------------
-+// class MultiPageControl
-+// ----------------------------------------------------
-+UnoMultiPageControl::UnoMultiPageControl()
-+{
-+ maComponentInfos.nWidth = 100;
-+ maComponentInfos.nHeight = 100;
-+}
-+
-+::rtl::OUString UnoMultiPageControl::GetComponentServiceName()
-+{
-+ return ::rtl::OUString::createFromAscii( "multipage" );
-+}
-+
-+sal_Bool UnoMultiPageControl::isTransparent() throw(uno::RuntimeException)
-+{
-+ return sal_True;
-+}
-+
- // =====================================================================================================================
- // = UnoControlListBoxModel_Data
- // =====================================================================================================================
-diff --git toolkit/source/helper/property.cxx toolkit/source/helper/property.cxx
-index dfae24a..0c0edea 100644
---- toolkit/source/helper/property.cxx
-+++ toolkit/source/helper/property.cxx
-@@ -182,6 +182,7 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount )
- DECL_PROP_3 ( "FormatsSupplier", FORMATSSUPPLIER, Reference< ::com::sun::star::util::XNumberFormatsSupplier >, BOUND, MAYBEVOID, TRANSIENT ),
-
- DECL_PROP_2 ( "Graphic", GRAPHIC, Reference< ::com::sun::star::graphic::XGraphic >, BOUND, TRANSIENT ),
-+ DECL_PROP_2 ( "GroupName", GROUPNAME, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "HelpText", HELPTEXT, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "HelpURL", HELPURL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "HideInactiveSelection", HIDEINACTIVESELECTION, bool, BOUND, MAYBEDEFAULT ),
-@@ -284,6 +285,7 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount )
- DECL_PROP_3 ( "SelectionModel", GRID_SELECTIONMODE, ::com::sun::star::view::SelectionType, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_2 ( "EnableVisible", ENABLEVISIBLE, sal_Bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_3 ( "ReferenceDevice", REFERENCE_DEVICE, Reference< XDevice >,BOUND, MAYBEDEFAULT, TRANSIENT ),
-+ DECL_PROP_2 ( "VBAForm", VBAFORM, sal_Bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_3 ( "EvenRowBackgroundColor", GRID_EVEN_ROW_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_3 ( "HeaderBackgroundColor", GRID_HEADER_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_3 ( "LineColor", GRID_LINE_COLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
-diff --git toolkit/source/helper/registerservices.cxx toolkit/source/helper/registerservices.cxx
-index 424f9b2..bcaa925 100644
---- toolkit/source/helper/registerservices.cxx
-+++ toolkit/source/helper/registerservices.cxx
-@@ -165,6 +165,7 @@ IMPL_CREATEINSTANCE( UnoControlTimeFieldModel )
- IMPL_CREATEINSTANCE( UnoControlProgressBarModel )
- IMPL_CREATEINSTANCE( UnoControlScrollBarModel )
- IMPL_CREATEINSTANCE( UnoSpinButtonModel )
-+IMPL_CREATEINSTANCE( UnoMultiPageModel )
- IMPL_CREATEINSTANCE( UnoControlFixedLineModel )
- IMPL_CREATEINSTANCE( UnoCurrencyFieldControl )
- IMPL_CREATEINSTANCE( UnoDateFieldControl )
-@@ -184,6 +185,7 @@ IMPL_CREATEINSTANCE( UnoTimeFieldControl )
- IMPL_CREATEINSTANCE( UnoProgressBarControl )
- IMPL_CREATEINSTANCE( UnoScrollBarControl )
- IMPL_CREATEINSTANCE( UnoSpinButtonControl )
-+IMPL_CREATEINSTANCE( UnoMultiPageControl )
- IMPL_CREATEINSTANCE( UnoFixedLineControl )
- IMPL_CREATEINSTANCE( VCLXMenuBar )
- IMPL_CREATEINSTANCE( VCLXPointer )
-@@ -276,6 +278,8 @@ TOOLKIT_DLLPUBLIC sal_Bool SAL_CALL component_writeInfo( void* _pServiceManager,
- registerServices( xRegistryKey, "UnoControlScrollBarModel", szServiceName_UnoControlScrollBarModel, szServiceName2_UnoControlScrollBarModel );
- registerServices( xRegistryKey, "UnoSpinButtonModel", szServiceName_UnoSpinButtonModel );
- registerServices( xRegistryKey, "UnoSpinButtonControl", szServiceName_UnoSpinButtonControl );
-+ registerServices( xRegistryKey, "UnoMultiPageModel", szServiceName_UnoMultiPageModel );
-+ registerServices( xRegistryKey, "UnoMultiPageControl", szServiceName_UnoMultiPageControl );
- registerServices( xRegistryKey, "UnoFixedLineControl", szServiceName_UnoControlFixedLine, szServiceName2_UnoControlFixedLine );
- registerServices( xRegistryKey, "UnoControlFixedLineModel", szServiceName_UnoControlFixedLineModel, szServiceName2_UnoControlFixedLineModel );
- registerServices( xRegistryKey, "VCLXPrinterServer", szServiceName_PrinterServer, szServiceName2_PrinterServer );
-@@ -366,6 +370,8 @@ TOOLKIT_DLLPUBLIC void* SAL_CALL component_getFactory( const sal_Char* sImplemen
- CHECKANDCREATEFACTORY( VCLXPrinterServer, szServiceName_PrinterServer, szServiceName2_PrinterServer )
- CHECKANDCREATEFACTORY( UnoRoadmapControl, szServiceName_UnoControlRoadmap, szServiceName2_UnoControlRoadmap )
- CHECKANDCREATEFACTORY( UnoControlRoadmapModel, szServiceName_UnoControlRoadmapModel, szServiceName2_UnoControlRoadmapModel )
-+ CHECKANDCREATEFACTORY( UnoMultiPageModel, szServiceName_UnoMultiPageModel, NULL )
-+ CHECKANDCREATEFACTORY( UnoMultiPageControl, szServiceName_UnoMultiPageControl, NULL )
- CHECKANDCREATEFACTORY( UnoSpinButtonModel, szServiceName_UnoSpinButtonModel, NULL )
- CHECKANDCREATEFACTORY( UnoSpinButtonControl, szServiceName_UnoSpinButtonControl, NULL )
- CHECKANDCREATEFACTORY( TreeControl, szServiceName_TreeControl, NULL )
-diff --git toolkit/source/helper/servicenames.cxx toolkit/source/helper/servicenames.cxx
-index 6bd45b7..557389a 100644
---- toolkit/source/helper/servicenames.cxx
-+++ toolkit/source/helper/servicenames.cxx
-@@ -37,6 +37,8 @@ const sal_Char __FAR_DATA szServiceName_PopupMenu[] = "stardiv.vcl.PopupMenu", s
- const sal_Char __FAR_DATA szServiceName_MenuBar[] = "stardiv.vcl.MenuBar", szServiceName2_MenuBar[] = "com.sun.star.awt.MenuBar";
- const sal_Char __FAR_DATA szServiceName_Pointer[] = "stardiv.vcl.Pointer", szServiceName2_Pointer[] = "com.sun.star.awt.Pointer";
- const sal_Char __FAR_DATA szServiceName_UnoControlContainer[] = "stardiv.vcl.control.ControlContainer", szServiceName2_UnoControlContainer[] = "com.sun.star.awt.UnoControlContainer";
-+
-+
- const sal_Char __FAR_DATA szServiceName_UnoControlContainerModel[] = "stardiv.vcl.controlmodel.ControlContainer", szServiceName2_UnoControlContainerModel[] = "com.sun.star.awt.UnoControlContainerModel";
- const sal_Char __FAR_DATA szServiceName_TabController[] = "stardiv.vcl.control.TabController", szServiceName2_TabController[] = "com.sun.star.awt.TabController";
- const sal_Char __FAR_DATA szServiceName_TabControllerModel[] = "stardiv.vcl.controlmodel.TabController", szServiceName2_TabControllerModel[] = "com.sun.star.awt.TabControllerModel";
-@@ -89,6 +91,8 @@ const sal_Char __FAR_DATA szServiceName_UnoControlRoadmap[] = "stardiv.vcl.contr
- const sal_Char __FAR_DATA szServiceName_UnoControlRoadmapModel[] = "stardiv.vcl.controlmodel.Roadmap", szServiceName2_UnoControlRoadmapModel[] = "com.sun.star.awt.UnoControlRoadmapModel";
- const sal_Char __FAR_DATA szServiceName_UnoSpinButtonControl[] = "com.sun.star.awt.UnoControlSpinButton";
- const sal_Char __FAR_DATA szServiceName_UnoSpinButtonModel[] = "com.sun.star.awt.UnoControlSpinButtonModel";
-+const sal_Char __FAR_DATA szServiceName_UnoMultiPageControl[] = "com.sun.star.awt.UnoControlMultiPage";
-+const sal_Char __FAR_DATA szServiceName_UnoMultiPageModel[] = "com.sun.star.awt.UnoMultiPageModel";
- const sal_Char __FAR_DATA szServiceName_TreeControl[] = "com.sun.star.awt.tree.TreeControl";
- const sal_Char __FAR_DATA szServiceName_TreeControlModel[] = "com.sun.star.awt.tree.TreeControlModel";
- const sal_Char __FAR_DATA szServiceName_MutableTreeDataModel[] = "com.sun.star.awt.tree.MutableTreeDataModel";
-diff --git udkapi/com/sun/star/script/XAutomationInvocation.idl udkapi/com/sun/star/script/XAutomationInvocation.idl
-new file mode 100644
-index 0000000..9dcf61b
---- /dev/null
-+++ udkapi/com/sun/star/script/XAutomationInvocation.idl
-@@ -0,0 +1,51 @@
-+/*************************************************************************
-+ *
-+ * 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: XInvocation2.idl,v $
-+ * $Revision: 1.10 $
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __com_sun_star_script_XAutomationInvocation_idl__
-+#define __com_sun_star_script_XAutomationInvocation_idl__
-+
-+#ifndef __com_sun_star_script_XInvocation_idl__
-+#include <com/sun/star/script/XInvocation.idl>
-+#endif
-+
-+
-+ module com { module sun { module star { module script {
-+
-+interface XAutomationInvocation: com::sun::star::script::XInvocation
-+{
-+ any invokeGetProperty( [in] string aFunctionName, [in] sequence<any> aParams, [out] sequence<short> aOutParamIndex, [out] sequence<any> aOutParam ) raises( com::sun::star::lang::IllegalArgumentException, com::sun::star::script::CannotConvertException, com::sun::star::reflection::InvocationTargetException );
-+ any invokePutProperty( [in] string aFunctionName, [in] sequence<any> aParams, [out] sequence<short> aOutParamIndex, [out] sequence<any> aOutParam ) raises( com::sun::star::lang::IllegalArgumentException, com::sun::star::script::CannotConvertException, com::sun::star::reflection::InvocationTargetException );
-+
-+};
-+
-+//=============================================================================
-+
-+}; }; }; };
-+
-+#endif
-diff --git udkapi/com/sun/star/script/XErrorQuery.idl udkapi/com/sun/star/script/XErrorQuery.idl
-new file mode 100644
-index 0000000..9a1860e
---- /dev/null
-+++ udkapi/com/sun/star/script/XErrorQuery.idl
-@@ -0,0 +1,25 @@
-+#ifndef __com_sun_star_script_XErrorQuery_idl__
-+#define __com_sun_star_script_XErrorQuery_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+module com { module sun { module star { module script {
-+//==============================================================================
-+
-+interface XErrorQuery : ::com::sun::star::uno::XInterface
-+{
-+ //-----------------------------------------------------------------------
-+ /**
-+ Returns whether this object has an error
-+
-+ @return
-+ <atom>boolean</atom> indicating an error or not
-+ */
-+ boolean hasError();
-+
-+};
-+
-+}; }; }; };
-+#endif
-diff --git udkapi/com/sun/star/script/makefile.mk udkapi/com/sun/star/script/makefile.mk
-index 32aa58f..e6f49a9 100644
---- udkapi/com/sun/star/script/makefile.mk
-+++ udkapi/com/sun/star/script/makefile.mk
-@@ -81,6 +81,8 @@ IDLFILES=\
- XScriptEventsAttacher.idl\
- XDefaultMethod.idl\
- XDefaultProperty.idl\
-+ XAutomationInvocation.idl\
-+ XErrorQuery.idl\
-
- # ------------------------------------------------------------------
-
-diff --git unotools/inc/unotools/fltrcfg.hxx unotools/inc/unotools/fltrcfg.hxx
-index 26a1b22..2c948bc 100644
---- unotools/inc/unotools/fltrcfg.hxx
-+++ unotools/inc/unotools/fltrcfg.hxx
-@@ -48,6 +48,8 @@ public:
-
- void SetLoadWordBasicCode( sal_Bool bFlag );
- sal_Bool IsLoadWordBasicCode() const;
-+ void SetLoadWordBasicExecutable( sal_Bool bFlag );
-+ sal_Bool IsLoadWordBasicExecutable() const;
- void SetLoadWordBasicStorage( sal_Bool bFlag );
- sal_Bool IsLoadWordBasicStorage() const;
-
-diff --git unotools/source/config/fltrcfg.cxx unotools/source/config/fltrcfg.cxx
-index 4707b4a..8bf8307 100644
---- unotools/source/config/fltrcfg.cxx
-+++ unotools/source/config/fltrcfg.cxx
-@@ -61,6 +61,7 @@ using namespace com::sun::star::uno;
- #define FILTERCFG_ENABLE_EXCEL_PREVIEW 0x40000
- #define FILTERCFG_ENABLE_WORD_PREVIEW 0x80000
- #define FILTERCFG_USE_ENHANCED_FIELDS 0x100000
-+#define FILTERCFG_WORD_WBCTBL 0x200000
-
- static SvtFilterOptions* pOptions=0;
-
-@@ -150,6 +151,52 @@ void SvtAppFilterOptions_Impl::Load()
- }
-
- // -----------------------------------------------------------------------
-+class SvtWriterFilterOptions_Impl : public SvtAppFilterOptions_Impl
-+{
-+ sal_Bool bLoadExecutable;
-+public:
-+ SvtWriterFilterOptions_Impl(const OUString& rRoot) :
-+ SvtAppFilterOptions_Impl(rRoot),
-+ bLoadExecutable(sal_False)
-+ {}
-+ virtual void Commit();
-+ void Load();
-+
-+ sal_Bool IsLoadExecutable() const {return bLoadExecutable;}
-+ void SetLoadExecutable(sal_Bool bSet)
-+ {
-+ if(bSet != bLoadExecutable)
-+ SetModified();
-+ bLoadExecutable = bSet;
-+ }
-+};
-+
-+void SvtWriterFilterOptions_Impl::Commit()
-+{
-+ SvtAppFilterOptions_Impl::Commit();
-+
-+ Sequence<OUString> aNames(1);
-+ aNames[0] = C2U("Executable");
-+ Sequence<Any> aValues(1);
-+ aValues[0] <<= bLoadExecutable;
-+
-+ PutProperties(aNames, aValues);
-+}
-+
-+void SvtWriterFilterOptions_Impl::Load()
-+{
-+ SvtAppFilterOptions_Impl::Load();
-+
-+ Sequence<OUString> aNames(1);
-+ aNames[0] = C2U("Executable");
-+
-+ Sequence<Any> aValues = GetProperties(aNames);
-+ const Any* pValues = aValues.getConstArray();
-+ if(pValues[0].hasValue())
-+ bLoadExecutable = *(sal_Bool*)pValues[0].getValue();
-+}
-+
-+// -----------------------------------------------------------------------
- class SvtCalcFilterOptions_Impl : public SvtAppFilterOptions_Impl
- {
- sal_Bool bLoadExecutable;
-@@ -201,7 +248,7 @@ void SvtCalcFilterOptions_Impl::Load()
- struct SvtFilterOptions_Impl
- {
- ULONG nFlags;
-- SvtAppFilterOptions_Impl aWriterCfg;
-+ SvtWriterFilterOptions_Impl aWriterCfg;
- SvtCalcFilterOptions_Impl aCalcCfg;
- SvtAppFilterOptions_Impl aImpressCfg;
-
-@@ -246,6 +293,7 @@ void SvtFilterOptions_Impl::SetFlag( ULONG nFlag, BOOL bSet )
- {
- case FILTERCFG_WORD_CODE: aWriterCfg.SetLoad(bSet);break;
- case FILTERCFG_WORD_STORAGE: aWriterCfg.SetSave(bSet);break;
-+ case FILTERCFG_WORD_WBCTBL: aWriterCfg.SetLoadExecutable(bSet);break;
- case FILTERCFG_EXCEL_CODE: aCalcCfg.SetLoad(bSet);break;
- case FILTERCFG_EXCEL_STORAGE: aCalcCfg.SetSave(bSet);break;
- case FILTERCFG_EXCEL_EXECTBL: aCalcCfg.SetLoadExecutable(bSet);break;
-@@ -268,6 +316,7 @@ BOOL SvtFilterOptions_Impl::IsFlag( ULONG nFlag ) const
- {
- case FILTERCFG_WORD_CODE : bRet = aWriterCfg.IsLoad();break;
- case FILTERCFG_WORD_STORAGE : bRet = aWriterCfg.IsSave();break;
-+ case FILTERCFG_WORD_WBCTBL : bRet = aWriterCfg.IsLoadExecutable();break;
- case FILTERCFG_EXCEL_CODE : bRet = aCalcCfg.IsLoad();break;
- case FILTERCFG_EXCEL_STORAGE : bRet = aCalcCfg.IsSave();break;
- case FILTERCFG_EXCEL_EXECTBL : bRet = aCalcCfg.IsLoadExecutable();break;
-@@ -410,6 +459,17 @@ BOOL SvtFilterOptions::IsLoadWordBasicCode() const
- return pImp->IsFlag( FILTERCFG_WORD_CODE );
- }
-
-+void SvtFilterOptions::SetLoadWordBasicExecutable( BOOL bFlag )
-+{
-+ pImp->SetFlag( FILTERCFG_WORD_WBCTBL, bFlag );
-+ SetModified();
-+}
-+
-+BOOL SvtFilterOptions::IsLoadWordBasicExecutable() const
-+{
-+ return pImp->IsFlag( FILTERCFG_WORD_WBCTBL );
-+}
-+
- void SvtFilterOptions::SetLoadWordBasicStorage( BOOL bFlag )
- {
- pImp->SetFlag( FILTERCFG_WORD_STORAGE, bFlag );
-diff --git vbahelper/inc/vbahelper/vbaaccesshelper.hxx vbahelper/inc/vbahelper/vbaaccesshelper.hxx
-index cfbe9e7..29c90f2 100644
---- vbahelper/inc/vbahelper/vbaaccesshelper.hxx
-+++ vbahelper/inc/vbahelper/vbaaccesshelper.hxx
-@@ -71,7 +71,9 @@ namespace ooo
- return bRes;
- }
- VBAHELPER_DLLPUBLIC inline bool isAlienExcelDoc( SfxObjectShell& rDocShell ) { return isAlienDoc( rDocShell, "application/vnd.ms-excel" ); }
-- VBAHELPER_DLLPUBLIC inline bool isAlienWordDoc( SfxObjectShell& rDocShell ) { return isAlienDoc( rDocShell, "application/vnd.ms-word" ); }
-+ //VBAHELPER_DLLPUBLIC inline bool isAlienWordDoc( SfxObjectShell& rDocShell ) { return isAlienDoc( rDocShell, "application/vnd.ms-word" ); }
-+ // word seems to return an erroneous mime type :-/ "application/msword" not consistent with the excel one
-+ VBAHELPER_DLLPUBLIC inline bool isAlienWordDoc( SfxObjectShell& rDocShell ) { return isAlienDoc( rDocShell, "application/msword" ); }
-
- } // openoffice
- } // org
-diff --git vbahelper/inc/vbahelper/vbaapplicationbase.hxx vbahelper/inc/vbahelper/vbaapplicationbase.hxx
-index edcefa8..069c773 100644
---- vbahelper/inc/vbahelper/vbaapplicationbase.hxx
-+++ vbahelper/inc/vbahelper/vbaapplicationbase.hxx
-@@ -51,7 +51,7 @@ public:
- virtual void SAL_CALL setDisplayStatusBar(sal_Bool bDisplayStatusBar) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL CommandBars( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getVersion() throw (css::uno::RuntimeException);
-- virtual void SAL_CALL Run( const ::rtl::OUString& MacroName, const css::uno::Any& varg1, const css::uno::Any& varg2, const css::uno::Any& varg3, const css::uno::Any& varg4, const css::uno::Any& varg5, const css::uno::Any& varg6, const css::uno::Any& varg7, const css::uno::Any& varg8, const css::uno::Any& varg9, const css::uno::Any& varg10, const css::uno::Any& varg11, const css::uno::Any& varg12, const css::uno::Any& varg13, const css::uno::Any& varg14, const css::uno::Any& varg15, const css::uno::Any& varg16, const css::uno::Any& varg17, const css::uno::Any& varg18, const css::uno::Any& varg19, const css::uno::Any& varg20, const css::uno::Any& varg21, const css::uno::Any& varg22, const css::uno::Any& varg23, const css::uno::Any& varg24, const css::uno::Any& varg25, const css::uno::Any& varg26, const css::uno::Any& varg27, const css::uno::Any& varg28, const css::uno::Any& varg29, const css::uno::Any& varg30 ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Run( const ::rtl::OUString& MacroName, const css::uno::Any& varg1, const css::uno::Any& varg2, const css::uno::Any& varg3, const css::uno::Any& varg4, const css::uno::Any& varg5, const css::uno::Any& varg6, const css::uno::Any& varg7, const css::uno::Any& varg8, const css::uno::Any& varg9, const css::uno::Any& varg10, const css::uno::Any& varg11, const css::uno::Any& varg12, const css::uno::Any& varg13, const css::uno::Any& varg14, const css::uno::Any& varg15, const css::uno::Any& varg16, const css::uno::Any& varg17, const css::uno::Any& varg18, const css::uno::Any& varg19, const css::uno::Any& varg20, const css::uno::Any& varg21, const css::uno::Any& varg22, const css::uno::Any& varg23, const css::uno::Any& varg24, const css::uno::Any& varg25, const css::uno::Any& varg26, const css::uno::Any& varg27, const css::uno::Any& varg28, const css::uno::Any& varg29, const css::uno::Any& varg30 ) throw (css::uno::RuntimeException);
- virtual float SAL_CALL CentimetersToPoints( float _Centimeters ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Quit( ) throw (::com::sun::star::uno::RuntimeException);
- // XHelperInterface
-diff --git vbahelper/inc/vbahelper/vbacollectionimpl.hxx vbahelper/inc/vbahelper/vbacollectionimpl.hxx
-index 40b9202..e08fd51 100644
---- vbahelper/inc/vbahelper/vbacollectionimpl.hxx
-+++ vbahelper/inc/vbahelper/vbacollectionimpl.hxx
-@@ -49,11 +49,12 @@ typedef ::cppu::WeakImplHelper1< css::container::XEnumeration > EnumerationHelpe
- class VBAHELPER_DLLPUBLIC EnumerationHelperImpl : public EnumerationHelper_BASE
- {
- protected:
-+ css::uno::WeakReference< ov::XHelperInterface > m_xParent;
- 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 ) { }
-+ EnumerationHelperImpl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XEnumeration >& xEnumeration ) throw ( css::uno::RuntimeException ) : m_xParent( xParent ), m_xContext( xContext ), m_xEnumeration( xEnumeration ) { }
- virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (css::uno::RuntimeException) { return m_xEnumeration->hasMoreElements(); }
- };
-
-@@ -158,12 +159,25 @@ typedef InheritedHelperInterfaceImpl< Ifc1 > BaseColBase;
- protected:
- css::uno::Reference< css::container::XIndexAccess > m_xIndexAccess;
- css::uno::Reference< css::container::XNameAccess > m_xNameAccess;
-+ sal_Bool mbIgnoreCase;
-
- 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 >() );
-
-+ if( mbIgnoreCase )
-+ {
-+ css::uno::Sequence< rtl::OUString > sElementNames = m_xNameAccess->getElementNames();
-+ for( sal_Int32 i = 0; i < sElementNames.getLength(); i++ )
-+ {
-+ rtl::OUString aName = sElementNames[i];
-+ if( aName.equalsIgnoreAsciiCase( sIndex ) )
-+ {
-+ return createCollectionObject( m_xNameAccess->getByName( aName ) );
-+ }
-+ }
-+ }
- return createCollectionObject( m_xNameAccess->getByName( sIndex ) );
- }
-
-@@ -182,7 +196,7 @@ protected:
- 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); }
-+ ScVbaCollectionBase( 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 bIgnoreCase = sal_False ) : BaseColBase( xParent, xContext ), m_xIndexAccess( xIndexAccess ), mbIgnoreCase( bIgnoreCase ) { m_xNameAccess.set(m_xIndexAccess, css::uno::UNO_QUERY); }
- //XCollection
- virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException)
- {
-@@ -247,7 +261,7 @@ class VBAHELPER_DLLPUBLIC CollTestImplHelper : public ScVbaCollectionBase< ::cp
- 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 ) {}
-+ CollTestImplHelper( 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 bIgnoreCase = sal_False ) throw( css::uno::RuntimeException ) : ImplBase1( xParent, xContext, xIndexAccess, bIgnoreCase ) {}
- };
-
-
-diff --git vbahelper/inc/vbahelper/vbadialogbase.hxx vbahelper/inc/vbahelper/vbadialogbase.hxx
-index 70bd565..f7fc1ad 100644
---- vbahelper/inc/vbahelper/vbadialogbase.hxx
-+++ vbahelper/inc/vbahelper/vbadialogbase.hxx
-@@ -44,7 +44,7 @@ public:
- virtual ~VbaDialogBase() {}
-
- // Methods
-- virtual void SAL_CALL Show() throw (css::uno::RuntimeException);
-+ virtual sal_Bool SAL_CALL Show() throw (css::uno::RuntimeException);
- virtual rtl::OUString mapIndexToName( sal_Int32 nIndex ) = 0;
- };
-
-diff --git vbahelper/inc/vbahelper/vbadocumentbase.hxx vbahelper/inc/vbahelper/vbadocumentbase.hxx
-index 68703aa..57a06ef 100644
---- vbahelper/inc/vbahelper/vbadocumentbase.hxx
-+++ vbahelper/inc/vbahelper/vbadocumentbase.hxx
-@@ -57,7 +57,7 @@ public:
- 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 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);
-diff --git vbahelper/inc/vbahelper/vbaeventshelperbase.hxx vbahelper/inc/vbahelper/vbaeventshelperbase.hxx
-new file mode 100644
-index 0000000..461cfbc
---- /dev/null
-+++ vbahelper/inc/vbahelper/vbaeventshelperbase.hxx
-@@ -0,0 +1,54 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef VBAEVENTS_HELPER_BASE_HXX
-+#define VBAEVENTS_HELPER_BASE_HXX
-+
-+#include <com/sun/star/uno/XComponentContext.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <map>
-+
-+class VBAHELPER_DLLPUBLIC VbaEventsHelperBase
-+{
-+protected:
-+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
-+ sal_Bool mbIgnoreEvents;
-+ std::map< sal_Int32, rtl::OUString > m_aEventNameMap;
-+
-+protected:
-+ void insert( const sal_Int32 nId, const rtl::OUString& sEventName );
-+ rtl::OUString getEventName( const sal_Int32 nEventId );
-+
-+public:
-+ VbaEventsHelperBase( const css::uno::Reference< css::uno::XComponentContext >& xContext );
-+ virtual void SAL_CALL setIgnoreEvents( ::sal_Bool _ignoreevents ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getIgnoreEvents() throw (css::uno::RuntimeException);
-+};
-+
-+#endif /* VBAEVENTS_HELPER_BASE_HXX */
-diff --git vbahelper/inc/vbahelper/vbaglobalbase.hxx vbahelper/inc/vbahelper/vbaglobalbase.hxx
-index d2d0399..aac8088 100644
---- vbahelper/inc/vbahelper/vbaglobalbase.hxx
-+++ vbahelper/inc/vbahelper/vbaglobalbase.hxx
-@@ -35,13 +35,13 @@ class VBAHELPER_DLLPUBLIC VbaGlobalsBase : public Globals_BASE
-
- {
- protected:
--
-+ rtl::OUString msDocCtxName;
- bool hasServiceName( const rtl::OUString& serviceName );
- void init( const css::uno::Sequence< css::beans::PropertyValue >& aInitArgs );
-
- public:
- VbaGlobalsBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const rtl::OUString& sDocCtxName );
-- virtual ~VbaGlobalsBase(){};
-+ virtual ~VbaGlobalsBase();
- // XMultiServiceFactory
- virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( const ::rtl::OUString& aServiceSpecifier ) throw (css::uno::Exception, css::uno::RuntimeException);
- virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const css::uno::Sequence< css::uno::Any >& Arguments ) throw (css::uno::Exception, css::uno::RuntimeException);
-diff --git vbahelper/inc/vbahelper/vbahelper.hxx vbahelper/inc/vbahelper/vbahelper.hxx
-index dad98b9..35ecda7 100644
---- vbahelper/inc/vbahelper/vbahelper.hxx
-+++ vbahelper/inc/vbahelper/vbahelper.hxx
-@@ -35,6 +35,10 @@
- #include <com/sun/star/lang/IllegalArgumentException.hpp>
- #include <com/sun/star/awt/XControl.hpp>
- #include <com/sun/star/awt/XDevice.hpp>
-+#include <com/sun/star/frame/XDispatchResultListener.hpp>
-+#include <com/sun/star/frame/DispatchResultEvent.hpp>
-+#include <com/sun/star/frame/DispatchResultState.hpp>
-+#include <com/sun/star/lang/EventObject.hpp>
- #include <basic/basmgr.hxx>
- #include <basic/sberrors.hxx>
- #include <cppuhelper/implbase1.hxx>
-@@ -62,6 +66,7 @@ namespace ooo
- throw css::lang::IllegalArgumentException();
- return aSomething;
- }
-+ VBAHELPER_DLLPUBLIC css::uno::Reference< css::uno::XInterface > getUnoDocModule( const String& aModName, SfxObjectShell* pShell );
- VBAHELPER_DLLPUBLIC SfxObjectShell* getSfxObjShell( const css::uno::Reference< css::frame::XModel >& xModel ) throw ( css::uno::RuntimeException);
- VBAHELPER_DLLPUBLIC css::uno::Reference< css::uno::XInterface > createVBAUnoAPIService( SfxObjectShell* pShell, const sal_Char* _pAsciiName ) throw (css::uno::RuntimeException);
-
-@@ -75,7 +80,7 @@ namespace ooo
- VBAHELPER_DLLPUBLIC css::uno::Reference< css::script::XTypeConverter > getTypeConverter( const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException);
-
- VBAHELPER_DLLPUBLIC void dispatchRequests (css::uno::Reference< css::frame::XModel>& xModel,rtl::OUString & aUrl) ;
-- VBAHELPER_DLLPUBLIC void dispatchRequests (css::uno::Reference< css::frame::XModel>& xModel,rtl::OUString & aUrl, css::uno::Sequence< css::beans::PropertyValue >& sProps ) ;
-+ VBAHELPER_DLLPUBLIC void dispatchRequests (css::uno::Reference< css::frame::XModel>& xModel,rtl::OUString & aUrl, css::uno::Sequence< css::beans::PropertyValue >& sProps, const css::uno::Reference< css::frame::XDispatchResultListener >& rListener = css::uno::Reference< css::frame::XDispatchResultListener >(), const sal_Bool bSilent = sal_True );
- VBAHELPER_DLLPUBLIC void dispatchExecute(SfxViewShell* pView, USHORT nSlot, SfxCallMode nCall = SFX_CALLMODE_SYNCHRON );
- VBAHELPER_DLLPUBLIC sal_Int32 OORGBToXLRGB( sal_Int32 );
- VBAHELPER_DLLPUBLIC sal_Int32 XLRGBToOORGB( sal_Int32 );
-@@ -98,6 +103,7 @@ namespace ooo
- VBAHELPER_DLLPUBLIC void setDefaultPropByIntrospection( const css::uno::Any& aObj, const css::uno::Any& aValue ) throw ( css::uno::RuntimeException );
- VBAHELPER_DLLPUBLIC css::uno::Any getPropertyValue( const css::uno::Sequence< css::beans::PropertyValue >& aProp, const rtl::OUString& aName );
- VBAHELPER_DLLPUBLIC sal_Bool setPropertyValue( css::uno::Sequence< css::beans::PropertyValue >& aProp, const rtl::OUString& aName, const css::uno::Any& aValue );
-+ VBAHELPER_DLLPUBLIC void setOrAppendPropertyValue( css::uno::Sequence< css::beans::PropertyValue >& aProp, const rtl::OUString& aName, const css::uno::Any& aValue );
-
- class VBAHELPER_DLLPUBLIC Millimeter
- {
-@@ -216,6 +222,25 @@ public:
-
- static void exception( css::uno::Exception& ex ) throw( css::script::BasicErrorException );
- };
-+
-+class VBAHELPER_DLLPUBLIC VBADispatchListener : public cppu::WeakImplHelper1< css::frame::XDispatchResultListener >
-+{
-+private:
-+ css::uno::Any m_Result;
-+ sal_Bool m_State;
-+
-+public:
-+ VBADispatchListener();
-+ ~VBADispatchListener();
-+
-+ css::uno::Any getResult() { return m_Result; }
-+ sal_Bool getState() { return m_State; }
-+
-+ // XDispatchResultListener
-+ virtual void SAL_CALL dispatchFinished( const css::frame::DispatchResultEvent& aEvent ) throw ( css::uno::RuntimeException );
-+ virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw ( css::uno::RuntimeException );
-+};
-+
- } // openoffice
- } // org
-
-diff --git vbahelper/inc/vbahelper/vbashape.hxx vbahelper/inc/vbahelper/vbashape.hxx
-index 8fc2590..bb39d6b 100644
---- vbahelper/inc/vbahelper/vbashape.hxx
-+++ vbahelper/inc/vbahelper/vbashape.hxx
-@@ -109,6 +109,7 @@ public:
- // 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 );
-+ virtual void SAL_CALL Copy( ) throw (css::uno::RuntimeException);
- // XEventListener
- virtual void SAL_CALL disposing( const css::lang::EventObject& rEventObject ) throw( css::uno::RuntimeException );
- };
-diff --git vbahelper/inc/vbahelper/vbashaperange.hxx vbahelper/inc/vbahelper/vbashaperange.hxx
-index d1bc1e5..97d9f42 100644
---- vbahelper/inc/vbahelper/vbashaperange.hxx
-+++ vbahelper/inc/vbahelper/vbashaperange.hxx
-@@ -56,6 +56,8 @@ public:
- 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 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);
-@@ -76,6 +78,7 @@ public:
- virtual void SAL_CALL setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL SAL_CALL TextFrame( ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL SAL_CALL WrapFormat( ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL ZOrder( sal_Int32 ZOrderCmd ) 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);
-diff --git vbahelper/prj/d.lst vbahelper/prj/d.lst
-index d683e97..2d20ab1 100644
---- vbahelper/prj/d.lst
-+++ vbahelper/prj/d.lst
-@@ -26,3 +26,4 @@ mkdir: %_DEST%\inc%_EXT%\basic
- ..\inc\vbahelper\vbatextframe.hxx %_DEST%\inc%_EXT%\vbahelper\vbatextframe.hxx
- ..\inc\vbahelper\vbashaperange.hxx %_DEST%\inc%_EXT%\vbahelper\vbashaperange.hxx
- ..\inc\vbahelper\vbapagesetupbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbapagesetupbase.hxx
-+..\inc\vbahelper\vbaeventshelperbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbaeventshelperbase.hxx
-diff --git vbahelper/source/msforms/makefile.mk vbahelper/source/msforms/makefile.mk
-index 7c61e43..9f69b62 100644
---- vbahelper/source/msforms/makefile.mk
-+++ vbahelper/source/msforms/makefile.mk
-@@ -34,13 +34,10 @@ VISIBILITY_HIDDEN=TRUE
-
- # --- Settings -----------------------------------------------------
-
--.IF "$(ENABLE_VBA)" == "NO"
--dummy:
-- @echo "Nothing to build"
--.ENDIF
--
- .INCLUDE : settings.mk
-
-+CDEFS+=-DVBA_OOBUILD_HACK
-+
- SLOFILES=\
- $(SLO)$/vbacontrol.obj \
- $(SLO)$/vbacontrols.obj \
-diff --git vbahelper/source/msforms/vbacheckbox.cxx vbahelper/source/msforms/vbacheckbox.cxx
-index 15175f0..16f5d16 100644
---- vbahelper/source/msforms/vbacheckbox.cxx
-+++ vbahelper/source/msforms/vbacheckbox.cxx
-@@ -70,6 +70,8 @@ void SAL_CALL
- ScVbaCheckbox::setValue( const uno::Any& _value ) throw (css::uno::RuntimeException)
- {
- sal_Int16 nValue = 0;
-+ sal_Int16 nOldValue = 0;
-+ m_xProps->getPropertyValue( STATE ) >>= nOldValue;
- sal_Bool bValue = false;
- if( _value >>= nValue )
- {
-@@ -82,6 +84,8 @@ ScVbaCheckbox::setValue( const uno::Any& _value ) throw (css::uno::RuntimeExcept
- nValue = 1;
- }
- m_xProps->setPropertyValue( STATE, uno::makeAny( nValue ) );
-+ if ( nValue != nOldValue )
-+ fireClickEvent();
- }
- rtl::OUString&
- ScVbaCheckbox::getServiceImplName()
-diff --git vbahelper/source/msforms/vbacheckbox.hxx vbahelper/source/msforms/vbacheckbox.hxx
-index d3922d8..b99850b 100644
---- vbahelper/source/msforms/vbacheckbox.hxx
-+++ vbahelper/source/msforms/vbacheckbox.hxx
-@@ -27,12 +27,12 @@
- #ifndef SC_VBA_CHECKBOX_HXX
- #define SC_VBA_CHECKBOX_HXX
- #include <cppuhelper/implbase2.hxx>
--#include <ooo/vba/msforms/XRadioButton.hpp>
-+#include <ooo/vba/msforms/XCheckBox.hpp>
-
- #include "vbacontrol.hxx"
- #include <vbahelper/vbahelper.hxx>
-
--typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XRadioButton, css::script::XDefaultProperty > CheckBoxImpl_BASE;
-+typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XCheckBox, css::script::XDefaultProperty > CheckBoxImpl_BASE;
-
- class ScVbaCheckbox : public CheckBoxImpl_BASE
- {
-diff --git vbahelper/source/msforms/vbacombobox.cxx vbahelper/source/msforms/vbacombobox.cxx
-index 4dfbf29..5c05894 100644
---- vbahelper/source/msforms/vbacombobox.cxx
-+++ vbahelper/source/msforms/vbacombobox.cxx
-@@ -26,6 +26,9 @@
- ************************************************************************/
- #include "vbacombobox.hxx"
- #include <vector>
-+#include <filter/msfilter/msvbahelper.hxx>
-+#include <basic/sbstar.hxx>
-+#include <basic/sbmod.hxx>
-
- using namespace com::sun::star;
- using namespace ooo::vba;
-@@ -63,12 +66,18 @@ ScVbaComboBox::setListIndex( const uno::Any& _value ) throw (uno::RuntimeExcepti
- sal_Int16 nIndex = 0;
- if( _value >>= nIndex )
- {
-+ sal_Int32 nOldIndex = -1;
-+ getListIndex() >>= nOldIndex;
- uno::Sequence< rtl::OUString > sItems;
- m_xProps->getPropertyValue( ITEMS ) >>= sItems;
- if( ( nIndex >= 0 ) && ( sItems.getLength() > nIndex ) )
- {
- rtl::OUString sText = sItems[ nIndex ];
- m_xProps->setPropertyValue( TEXT, uno::makeAny( sText ) );
-+
-+ // fire the _Change event
-+ if( nOldIndex != nIndex )
-+ fireClickEvent();
- }
- }
- }
-@@ -103,7 +112,38 @@ ScVbaComboBox::getListIndex() throw (uno::RuntimeException)
- void SAL_CALL
- ScVbaComboBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
- {
-- m_xProps->setPropertyValue( sSourceName, _value );
-+ rtl::OUString sOldValue, sNewValue;
-+ getValue() >>= sOldValue;
-+
-+ uno::Any aConverted = _value;
-+ uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( mxContext );
-+ try
-+ {
-+ aConverted = xConverter.is() ? xConverter->convertTo( _value, getCppuType( static_cast< const rtl::OUString* >(0) ) ) : aConverted;
-+ }
-+ catch( const uno::Exception& /*ex*/ )
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Invalid value" ) ), uno::Reference< uno::XInterface >() );
-+ }
-+
-+ m_xProps->setPropertyValue( sSourceName, aConverted );
-+
-+ aConverted >>= sNewValue;
-+ if ( sNewValue != sOldValue )
-+ {
-+ // If the new value is in current list, we should fire click event, otherwise fire the change event.
-+ sal_Int32 nListIndex = -1;
-+ getListIndex() >>= nListIndex;
-+ sal_Bool bIsInList = ( nListIndex >= 0 );
-+ if ( bIsInList )
-+ {
-+ fireClickEvent();
-+ }
-+ else
-+ {
-+ fireChangeEvent();
-+ }
-+ }
- }
-
- // see Value
-diff --git vbahelper/source/msforms/vbacontrol.cxx vbahelper/source/msforms/vbacontrol.cxx
-index 077e762..994da25 100644
---- vbahelper/source/msforms/vbacontrol.cxx
-+++ vbahelper/source/msforms/vbacontrol.cxx
-@@ -28,6 +28,7 @@
- #include <com/sun/star/awt/XControlModel.hpp>
- #include <com/sun/star/awt/XControl.hpp>
- #include <com/sun/star/awt/XWindow2.hpp>
-+#include <com/sun/star/awt/XActionListener.hpp>
- #include <com/sun/star/lang/XEventListener.hpp>
- #include <com/sun/star/drawing/XShape.hpp>
- #include <com/sun/star/drawing/XControlShape.hpp>
-@@ -39,6 +40,9 @@
- #include <com/sun/star/form/binding/XListEntrySink.hpp>
- #include <com/sun/star/table/CellAddress.hpp>
- #include <com/sun/star/table/CellRangeAddress.hpp>
-+#include <com/sun/star/script/XScriptListener.hpp>
-+#include <com/sun/star/document/XCodeNameQuery.hpp>
-+#include <com/sun/star/form/XChangeListener.hpp>
- #include <ooo/vba/XControlProvider.hpp>
- #ifdef VBA_OOBUILD_HACK
- #include <svtools/bindablecontrolhelper.hxx>
-@@ -126,7 +130,7 @@ ScVbaControlListener::disposing( const lang::EventObject& ) throw( uno::RuntimeE
-
- //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 )
-+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 ), bIsDialog(false), m_xControl( xControl ), m_xModel( xModel )
- {
- //add listener
- m_xEventListener.set( new ScVbaControlListener( this ) );
-@@ -138,9 +142,18 @@ ScVbaControl::ScVbaControl( const uno::Reference< XHelperInterface >& xParent, c
- 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 );
-+ rtl::OUString sDefaultControl;
-+ m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DefaultControl") ) ) >>= sDefaultControl;
-+ uno::Reference< lang::XMultiComponentFactory > xMFac( mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
-+ m_xEmptyFormControl.set( xMFac->createInstanceWithContext( sDefaultControl, mxContext ), uno::UNO_QUERY_THROW );
-+ }
- else if ( xUserFormControl.is() ) // userform control
-+ {
- m_xProps.set( xUserFormControl->getModel(), uno::UNO_QUERY_THROW );
-+ bIsDialog = true;
-+ }
- }
-
- ScVbaControl::~ScVbaControl()
-@@ -368,6 +381,87 @@ ScVbaControl::setControlTipText( const rtl::OUString& rsToolTip ) throw (css::un
- m_xProps->setPropertyValue
- (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HelpText" ) ), uno::makeAny( rsToolTip ) );
- }
-+
-+::sal_Int32 SAL_CALL ScVbaControl::getForeColor() throw (::com::sun::star::uno::RuntimeException)
-+{
-+ sal_Int32 nForeColor = -1;
-+ m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextColor" ) ) ) >>= nForeColor;
-+ return OORGBToXLRGB( nForeColor );
-+}
-+
-+void SAL_CALL ScVbaControl::setForeColor( ::sal_Int32 _forecolor ) throw (::com::sun::star::uno::RuntimeException)
-+{
-+ m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextColor" ) ), uno::makeAny( XLRGBToOORGB( _forecolor ) ) );
-+}
-+
-+void ScVbaControl::fireEvent( script::ScriptEvent& evt )
-+{
-+ uno::Reference<lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
-+ uno::Reference< script::XScriptListener > xScriptListener( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.EventListener" ) ), mxContext ), uno::UNO_QUERY_THROW );
-+
-+ uno::Reference< beans::XPropertySet > xProps( xScriptListener, uno::UNO_QUERY_THROW );
-+ xProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Model" ) ), uno::makeAny( m_xModel ) );
-+
-+ // handling for sheet control
-+ uno::Reference< msforms::XControl > xThisControl( this );
-+ try
-+ {
-+ evt.Arguments.realloc( 1 );
-+ lang::EventObject aEvt;
-+
-+ uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY ) ;
-+ uno::Reference< awt::XControl > xControl( m_xControl, uno::UNO_QUERY ) ;
-+
-+ if ( xControlShape.is() )
-+ {
-+ evt.Source = xControlShape;
-+ aEvt.Source = m_xEmptyFormControl;
-+ // Set up proper scriptcode
-+ uno::Reference< lang::XMultiServiceFactory > xDocFac( m_xModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< document::XCodeNameQuery > xNameQuery( xDocFac->createInstance( rtl::OUString::createFromAscii( "ooo.vba.VBACodeNameProvider" ) ), uno::UNO_QUERY_THROW );
-+ uno::Reference< uno::XInterface > xIf( xControlShape->getControl(), uno::UNO_QUERY_THROW );
-+ evt.ScriptCode = xNameQuery->getCodeNameForObject( xIf );
-+ evt.Arguments[ 0 ] = uno::makeAny( aEvt );
-+ xScriptListener->firing( evt );
-+ }
-+ else
-+ {
-+ if ( xControl.is() ) // normal control ( from dialog/userform )
-+ {
-+ // #FIXME We should probably store a reference to the
-+ // parent dialog/userform here ( other wise the name of
-+ // dialog could be changed and we won't be aware of it.
-+ // ( OTOH this is probably an unlikely scenario )
-+ evt.Source = xThisControl;
-+ aEvt.Source = xControl;
-+ evt.ScriptCode = m_sLibraryAndCodeName;
-+ evt.Arguments[ 0 ] = uno::makeAny( aEvt );
-+ xScriptListener->firing( evt );
-+ }
-+ }
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ }
-+}
-+void ScVbaControl::fireChangeEvent()
-+{
-+ script::ScriptEvent evt;
-+ evt.ScriptType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VBAInterop") );
-+ evt.ListenerType = form::XChangeListener::static_type(0);
-+ evt.MethodName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("changed") );
-+ fireEvent( evt );
-+}
-+
-+void ScVbaControl::fireClickEvent()
-+{
-+ script::ScriptEvent evt;
-+ evt.ScriptType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VBAInterop") );
-+ evt.ListenerType = awt::XActionListener::static_type(0);
-+ evt.MethodName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("actionPerformed") );
-+ fireEvent( evt );
-+}
-+
- //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 )
-@@ -393,16 +487,25 @@ ScVbaControl* ScVbaControlFactory::createControl(const uno::Reference< drawing::
- 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 )
-+ sal_Bool bToggle = sal_False; //liuchen 2009-8-11,
-+ 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:
-+ //liuchen 2009-8-11
-+ xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Toggle") ) ) >>= bToggle;
-+ if ( bToggle )
-+ return new ScVbaToggleButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
-+ else
-+ return new ScVbaButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
-+ //liuchen 2009-8-11
-+ 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::CHECKBOX:
-+ return new ScVbaCheckbox( 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:
-diff --git vbahelper/source/msforms/vbacontrol.hxx vbahelper/source/msforms/vbacontrol.hxx
-index c9c3964..e2b537c 100644
---- vbahelper/source/msforms/vbacontrol.hxx
-+++ vbahelper/source/msforms/vbacontrol.hxx
-@@ -34,6 +34,7 @@
- #include <com/sun/star/drawing/XControlShape.hpp>
- #include <com/sun/star/awt/XControl.hpp>
- #include <com/sun/star/awt/XWindowPeer.hpp>
-+#include <com/sun/star/script/ScriptEvent.hpp>
- #include <ooo/vba/msforms/XControl.hpp>
-
- #include <vbahelper/vbahelper.hxx>
-@@ -47,13 +48,19 @@ class ScVbaControl : public ControlImpl_BASE
- {
- private:
- com::sun::star::uno::Reference< com::sun::star::lang::XEventListener > m_xEventListener;
-+ com::sun::star::uno::Reference< com::sun::star::awt::XControl > m_xEmptyFormControl;
- protected:
-+ bool bIsDialog;
-+ rtl::OUString m_sLibraryAndCodeName;
- 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);
-+ void fireChangeEvent();
-+ void fireClickEvent();
-+ void fireEvent( css::script::ScriptEvent& evt );
- 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 );
-@@ -61,6 +68,10 @@ public:
- // This class will own the helper, so make sure it is allocated from
- // the heap
- void setGeometryHelper( ov::AbstractGeometryAttributes* pHelper );
-+ // sets the name of the associated library ( used for UserForm controls )
-+ void setLibraryAndCodeName( const rtl::OUString& sLibCodeName ) { m_sLibraryAndCodeName = sLibCodeName; }
-+ rtl::OUString getLibraryAndCodeName() { return m_sLibraryAndCodeName; }
-+
- // XControl
- virtual sal_Bool SAL_CALL getEnabled() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setEnabled( sal_Bool _enabled ) throw (css::uno::RuntimeException);
-@@ -87,6 +98,8 @@ public:
- virtual void SAL_CALL setControlTipText( const rtl::OUString& ) 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 );
-+ virtual ::sal_Int32 SAL_CALL getForeColor() throw (::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL setForeColor( ::sal_Int32 _forecolor ) throw (::com::sun::star::uno::RuntimeException);
- //XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-diff --git vbahelper/source/msforms/vbaframe.cxx vbahelper/source/msforms/vbaframe.cxx
-index 3c202f1..79e0b00 100644
---- vbahelper/source/msforms/vbaframe.cxx
-+++ vbahelper/source/msforms/vbaframe.cxx
-@@ -64,6 +64,30 @@ ScVbaFrame::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::Run
- _value >>= sCaption;
- setCaption( sCaption );
- }
-+//liuchen 2009-7-6
-+::sal_Int32 SAL_CALL ScVbaFrame::getForeColor() throw (::com::sun::star::uno::RuntimeException)
-+{
-+ return 0;
-+}
-+
-+void SAL_CALL ScVbaFrame::setForeColor( ::sal_Int32 /*_forecolor*/ ) throw (::com::sun::star::uno::RuntimeException)
-+{
-+ return;
-+}
-+//liuchen 2009-7-6 end
-+
-+rtl::OUString SAL_CALL
-+ScVbaFrame::getAccelerator() throw (css::uno::RuntimeException)
-+{
-+ //FIXME: seems not support?
-+ return rtl::OUString();
-+}
-+
-+void SAL_CALL
-+ScVbaFrame::setAccelerator( const rtl::OUString& /*_accelerator*/ ) throw (::com::sun::star::uno::RuntimeException)
-+{
-+ //FIXME: seems not support?
-+}
-
- rtl::OUString&
- ScVbaFrame::getServiceImplName()
-diff --git vbahelper/source/msforms/vbaframe.hxx vbahelper/source/msforms/vbaframe.hxx
-index c55a41b..f5d49aa 100644
---- vbahelper/source/msforms/vbaframe.hxx
-+++ vbahelper/source/msforms/vbaframe.hxx
-@@ -43,6 +43,12 @@ public:
- 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);
-+ //liuchen 2009-7-6
-+ virtual ::sal_Int32 SAL_CALL getForeColor() throw (::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL setForeColor( ::sal_Int32 _forecolor ) throw (::com::sun::star::uno::RuntimeException);
-+ //liuchen 2009-7-6 end
-+ virtual rtl::OUString SAL_CALL getAccelerator() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setAccelerator( const rtl::OUString& _accelerator ) throw (css::uno::RuntimeException);
- //XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-diff --git vbahelper/source/msforms/vbalabel.cxx vbahelper/source/msforms/vbalabel.cxx
-index 5fb6ebe..d50f2e3 100644
---- vbahelper/source/msforms/vbalabel.cxx
-+++ vbahelper/source/msforms/vbalabel.cxx
-@@ -64,6 +64,18 @@ ScVbaLabel::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::Run
- setCaption( sCaption );
- }
-
-+rtl::OUString SAL_CALL
-+ScVbaLabel::getAccelerator() throw (css::uno::RuntimeException)
-+{
-+ //FIXME: seems not support?
-+ return rtl::OUString();
-+}
-+
-+void SAL_CALL
-+ScVbaLabel::setAccelerator( const rtl::OUString& /*_accelerator*/ ) throw (::com::sun::star::uno::RuntimeException)
-+{
-+ //FIXME: seems not support?
-+}
-
- rtl::OUString&
- ScVbaLabel::getServiceImplName()
-diff --git vbahelper/source/msforms/vbalabel.hxx vbahelper/source/msforms/vbalabel.hxx
-index fd6b1c1..ff7822f 100644
---- vbahelper/source/msforms/vbalabel.hxx
-+++ vbahelper/source/msforms/vbalabel.hxx
-@@ -44,6 +44,8 @@ public:
- 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);
-+ virtual rtl::OUString SAL_CALL getAccelerator() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setAccelerator( const rtl::OUString& _accelerator ) throw (css::uno::RuntimeException);
- //XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-diff --git vbahelper/source/msforms/vbalistbox.cxx vbahelper/source/msforms/vbalistbox.cxx
-index 8538fc2..437a95b 100644
---- vbahelper/source/msforms/vbalistbox.cxx
-+++ vbahelper/source/msforms/vbalistbox.cxx
-@@ -108,9 +108,13 @@ ScVbaListBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
- "Attribute use invalid." ), uno::Reference< uno::XInterface >() );
-
- uno::Sequence< sal_Int16 > nSelectedIndices(1);
-+ uno::Sequence< sal_Int16 > nOldSelectedIndices;
-+ m_xProps->getPropertyValue( SELECTEDITEMS ) >>= nOldSelectedIndices;
- nSelectedIndices[ 0 ] = nValue;
- m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nSelectedIndices ) );
-- m_xProps->setPropertyValue( TEXT, uno::makeAny( sValue ) );
-+ if ( nSelectedIndices != nOldSelectedIndices )
-+ fireClickEvent();
-+ //m_xProps->setPropertyValue( TEXT, uno::makeAny( sValue ) ); //liuchen 2009-8-12 solve the problem that ListBox.Text and ListBox.Value cannot be set
- }
-
- ::rtl::OUString SAL_CALL
-@@ -127,20 +131,22 @@ ScVbaListBox::setText( const ::rtl::OUString& _text ) throw (uno::RuntimeExcepti
- setValue( uno::makeAny( _text ) ); // seems the same
- }
-
--sal_Bool SAL_CALL
-+sal_Int32 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;
-+ return bMultiSelect ? 1 : 0 ;
- }
-
- void SAL_CALL
--ScVbaListBox::setMultiSelect( sal_Bool _multiselect ) throw (css::uno::RuntimeException)
-+ScVbaListBox::setMultiSelect( sal_Int32 _multiselect ) throw (css::uno::RuntimeException)
- {
-- m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiSelection" ) ), uno::makeAny( _multiselect ) );
-+ sal_Bool bMultiSelect = _multiselect == 1 ? 1 : 0;
-+ m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiSelection" ) ), uno::makeAny( bMultiSelect ) );
- }
-
-+
- css::uno::Any SAL_CALL
- ScVbaListBox::Selected( sal_Int32 index ) throw (css::uno::RuntimeException)
- {
-@@ -205,6 +211,7 @@ ScVbaListBox::setValueEvent( const uno::Any& value )
- }
- nList.realloc( nLength - 1 );
- //m_xProps->setPropertyValue( sSourceName, uno::makeAny( nList ) );
-+ fireClickEvent();
- m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nList ) );
- return;
- }
-@@ -223,6 +230,7 @@ ScVbaListBox::setValueEvent( const uno::Any& value )
- nList[0] = nIndex;
- }
- //m_xProps->setPropertyValue( sSourceName, uno::makeAny( nList ) );
-+ fireClickEvent();
- m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nList ) );
- }
- }
-diff --git vbahelper/source/msforms/vbalistbox.hxx vbahelper/source/msforms/vbalistbox.hxx
-index 01c53d1..d540102 100644
---- vbahelper/source/msforms/vbalistbox.hxx
-+++ vbahelper/source/msforms/vbalistbox.hxx
-@@ -58,8 +58,8 @@ public:
- 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 ::sal_Int32 SAL_CALL getMultiSelect() throw (css::uno::RuntimeException); //liuchen 2009-7-31
-+ virtual void SAL_CALL setMultiSelect( ::sal_Int32 _multiselect ) throw (css::uno::RuntimeException); //liuchen 2009-7-31
- virtual css::uno::Any SAL_CALL Selected( ::sal_Int32 index ) throw (css::uno::RuntimeException);
-
- // Methods
-diff --git vbahelper/source/msforms/vbalistcontrolhelper.cxx vbahelper/source/msforms/vbalistcontrolhelper.cxx
-index 36683ae..977fdde 100644
---- vbahelper/source/msforms/vbalistcontrolhelper.cxx
-+++ vbahelper/source/msforms/vbalistcontrolhelper.cxx
-@@ -1,11 +1,69 @@
- #include <vbalistcontrolhelper.hxx>
- #include <vector>
-+#include <vbahelper/vbapropvalue.hxx>
-
- using namespace com::sun::star;
- using namespace ooo::vba;
-
- const static rtl::OUString ITEMS( RTL_CONSTASCII_USTRINGPARAM("StringItemList") );
-
-+class ListPropListener : public PropListener
-+{
-+private:
-+ uno::Reference< beans::XPropertySet > m_xProps;
-+ uno::Any m_pvargIndex;
-+ uno::Any m_pvarColumn;
-+
-+public:
-+ ListPropListener( const uno::Reference< beans::XPropertySet >& xProps, const uno::Any& pvargIndex, const uno::Any& pvarColumn );
-+ virtual void setValueEvent( const css::uno::Any& value );
-+ virtual css::uno::Any getValueEvent();
-+};
-+
-+ListPropListener::ListPropListener( const uno::Reference< beans::XPropertySet >& xProps, const uno::Any& pvargIndex, const uno::Any& pvarColumn ) : m_xProps( xProps ), m_pvargIndex( pvargIndex ), m_pvarColumn( pvarColumn )
-+{
-+}
-+
-+void ListPropListener::setValueEvent( const uno::Any& value )
-+{
-+ if( m_pvargIndex.hasValue() || m_pvarColumn.hasValue() )
-+ throw uno::RuntimeException( rtl::OUString::createFromAscii(
-+ "Bad argument" ), uno::Reference< uno::XInterface >() );
-+
-+ m_xProps->setPropertyValue( ITEMS, value );
-+}
-+
-+uno::Any ListPropListener::getValueEvent()
-+{
-+ uno::Sequence< rtl::OUString > sList;
-+ m_xProps->getPropertyValue( ITEMS ) >>= sList;
-+ sal_Int16 nLength = static_cast< sal_Int16 >( sList.getLength() );
-+ uno::Any aRet;
-+ if ( m_pvargIndex.hasValue() )
-+ {
-+ sal_Int16 nIndex = -1;
-+ m_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 ( m_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;
-+}
-+
- void SAL_CALL
- ListControlHelper::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex ) throw (uno::RuntimeException)
- {
-@@ -116,31 +174,5 @@ ListControlHelper::getListCount() throw (uno::RuntimeException)
- 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;
-+ return uno::makeAny( uno::Reference< XPropValue > ( new ScVbaPropValue( new ListPropListener( m_xProps, pvargIndex, pvarColumn ) ) ) );
- }
-diff --git vbahelper/source/msforms/vbamultipage.cxx vbahelper/source/msforms/vbamultipage.cxx
-index 4cdf220..8b3592c 100644
---- vbahelper/source/msforms/vbamultipage.cxx
-+++ vbahelper/source/msforms/vbamultipage.cxx
-@@ -88,8 +88,12 @@ 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 )
-+ sal_Int32 nVal = _value; // will be _value + 1 when cws container_controls is integrated
-+ sal_Int32 nOldVal = getValue();
- m_xProps->setPropertyValue( SVALUE, uno::makeAny( _value ) );
- mxDialogProps->setPropertyValue( SSTEP, uno::makeAny( _value + 1) );
-+ if ( nVal != nOldVal )
-+ fireChangeEvent();
- }
-
-
-diff --git vbahelper/source/msforms/vbaradiobutton.cxx vbahelper/source/msforms/vbaradiobutton.cxx
-index 3853f38..f8d6e21 100644
---- vbahelper/source/msforms/vbaradiobutton.cxx
-+++ vbahelper/source/msforms/vbaradiobutton.cxx
-@@ -70,6 +70,9 @@ void SAL_CALL
- ScVbaRadioButton::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
- {
- sal_Int16 nValue = 0;
-+ sal_Int16 nOldValue = 0;
-+ m_xProps->getPropertyValue( STATE ) >>= nOldValue;
-+
- sal_Bool bValue = sal_False;
- if( _value >>= nValue )
- {
-@@ -82,6 +85,15 @@ ScVbaRadioButton::setValue( const uno::Any& _value ) throw (uno::RuntimeExceptio
- nValue = 1;
- }
- m_xProps->setPropertyValue( STATE, uno::makeAny( nValue ) );
-+ if ( nValue != nOldValue )
-+ {
-+ fireChangeEvent();
-+ // In Excel, only when the radio button is checked, the click event is fired.
-+ if ( nValue != 0 )
-+ {
-+ fireClickEvent();
-+ }
-+ }
- }
-
- rtl::OUString&
-diff --git vbahelper/source/msforms/vbatextbox.cxx vbahelper/source/msforms/vbatextbox.cxx
-index 730f24c..be6e348 100644
---- vbahelper/source/msforms/vbatextbox.cxx
-+++ vbahelper/source/msforms/vbatextbox.cxx
-@@ -67,13 +67,20 @@ ScVbaTextBox::getText() throw (css::uno::RuntimeException)
- void SAL_CALL
- ScVbaTextBox::setText( const rtl::OUString& _text ) throw (css::uno::RuntimeException)
- {
-+ rtl::OUString sOldText = getText();
-+
- if ( !mbDialog )
- {
-- uno::Reference< text::XTextRange > xTextRange( m_xProps, uno::UNO_QUERY_THROW );
-- xTextRange->setString( _text );
--}
-+ 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 ) );
-+
-+ if ( _text != sOldText )
-+ {
-+ fireChangeEvent();
-+ }
- }
-
- sal_Int32 SAL_CALL
-@@ -90,7 +97,8 @@ ScVbaTextBox::getMaxLength() throw (css::uno::RuntimeException)
- void SAL_CALL
- ScVbaTextBox::setMaxLength( sal_Int32 _maxlength ) throw (css::uno::RuntimeException)
- {
-- uno::Any aValue( _maxlength );
-+ sal_Int16 _maxlength16 = static_cast<sal_Int16> (_maxlength); //liuchen 2009-7-24, resolve the problem that MaxLength cannot be set correctly
-+ uno::Any aValue( _maxlength16 ); //liuchen 2009-7-24, resolve the problem that MaxLength cannot be set correctly
- m_xProps->setPropertyValue
- (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MaxTextLen" ) ), aValue);
- }
-diff --git vbahelper/source/msforms/vbatogglebutton.cxx vbahelper/source/msforms/vbatogglebutton.cxx
-index d16fab9..f5abb73 100644
---- vbahelper/source/msforms/vbatogglebutton.cxx
-+++ vbahelper/source/msforms/vbatogglebutton.cxx
-@@ -68,16 +68,33 @@ ScVbaToggleButton::getValue() throw (uno::RuntimeException)
- return uno::makeAny( nState ? sal_Int16( -1 ) : sal_Int16( 0 ) );
- }
-
-+//liuchen 2009-7-23, resolve the defect that ToggleButton.Value cannot be set correctly
- void SAL_CALL
- ScVbaToggleButton::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
- {
- sal_Int16 nState = 0;
-- _value >>= nState;
-+ if (_value.getValueTypeClass() == uno::TypeClass_BOOLEAN)
-+ {
-+ sal_Bool bValue;
-+ _value >>= bValue;
-+ nState = static_cast< sal_Int16 >(bValue);
-+ }
-+ else if (_value.getValueTypeClass() == uno::TypeClass_BYTE)
-+ {
-+ sal_Int8 nValue;
-+ _value >>= nValue;
-+ nState = ( nValue == 1) ? 1 : 0;
-+ }
-+ else
-+ {
-+ _value >>= nState;
- OSL_TRACE( "nState - %d", nState );
-- nState = ( nState == -1 ) ? 1 : 0;
-+ nState = ( nState == -1 ) ? 1 : 0;
- OSL_TRACE( "nState - %d", nState );
-+ }
- m_xProps->setPropertyValue( STATE, uno::makeAny( nState ) );
- }
-+//liuchen 2009-7-23
-
- rtl::OUString&
- ScVbaToggleButton::getServiceImplName()
-diff --git vbahelper/source/msforms/vbauserform.cxx vbahelper/source/msforms/vbauserform.cxx
-index 2c04ea6..eab951c 100644
---- vbahelper/source/msforms/vbauserform.cxx
-+++ vbahelper/source/msforms/vbauserform.cxx
-@@ -53,6 +53,8 @@ ScVbaUserForm::ScVbaUserForm( uno::Sequence< uno::Any > const& aArgs, uno::Refer
- uno::Reference< awt::XControl > xControl( m_xDialog, uno::UNO_QUERY_THROW );
- m_xProps.set( xControl->getModel(), uno::UNO_QUERY_THROW );
- setGeometryHelper( new UserFormGeometryHelper( xContext, xControl ) );
-+ if ( aArgs.getLength() >= 4 )
-+ aArgs[ 3 ] >>= m_sLibName;
- }
-
- ScVbaUserForm::~ScVbaUserForm()
-@@ -174,6 +176,8 @@ ScVbaUserForm::getValue( const ::rtl::OUString& aPropertyName ) throw (beans::Un
- uno::Reference< msforms::XControl > xVBAControl( aFac.createControl( xDialogControl->getModel() ) );
- ScVbaControl* pControl = dynamic_cast< ScVbaControl* >( xVBAControl.get() );
- pControl->setGeometryHelper( new UserFormGeometryHelper( mxContext, xControl ) );
-+ if ( m_sLibName.getLength() )
-+ pControl->setLibraryAndCodeName( m_sLibName.concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "." ) ) ).concat( getName() ) );
- return uno::makeAny( xVBAControl );
- }
-
-diff --git vbahelper/source/msforms/vbauserform.hxx vbahelper/source/msforms/vbauserform.hxx
-index 463a3cb..fc55bb3 100644
---- vbahelper/source/msforms/vbauserform.hxx
-+++ vbahelper/source/msforms/vbauserform.hxx
-@@ -43,6 +43,7 @@ class ScVbaUserForm : public ScVbaUserForm_BASE
- private:
- css::uno::Reference< css::awt::XDialog > m_xDialog;
- bool mbDispose;
-+ rtl::OUString m_sLibName;
- protected:
- public:
- ScVbaUserForm( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext ) throw ( css::lang::IllegalArgumentException );
-diff --git vbahelper/source/vbahelper/makefile.mk vbahelper/source/vbahelper/makefile.mk
-index b11b4ff..f21da73 100644
---- vbahelper/source/vbahelper/makefile.mk
-+++ vbahelper/source/vbahelper/makefile.mk
-@@ -33,11 +33,6 @@ ENABLE_EXCEPTIONS := TRUE
- VISIBILITY_HIDDEN=TRUE
- # --- Settings -----------------------------------------------------
-
--.IF "$(ENABLE_VBA)" == "NO"
--dummy:
-- @echo "Nothing to build"
--.ENDIF
--
- .INCLUDE : settings.mk
-
- SLOFILES=\
-@@ -65,6 +60,7 @@ SLOFILES=\
- $(SLO)$/vbashaperange.obj \
- $(SLO)$/vbatextframe.obj \
- $(SLO)$/vbapagesetupbase.obj \
-+ $(SLO)$/vbaeventshelperbase.obj \
-
- # --- Targets -------------------------------------------------------
-
-diff --git vbahelper/source/vbahelper/vbaapplicationbase.cxx vbahelper/source/vbahelper/vbaapplicationbase.cxx
-index d9db387..d84f400 100644
---- vbahelper/source/vbahelper/vbaapplicationbase.cxx
-+++ vbahelper/source/vbahelper/vbaapplicationbase.cxx
-@@ -68,6 +68,8 @@ void SAL_CALL
- VbaApplicationBase::setScreenUpdating(sal_Bool bUpdate) throw (uno::RuntimeException)
- {
- uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
-+ if( bUpdate != xModel->hasControllersLocked() )
-+ return;
- if (bUpdate)
- xModel->unlockControllers();
- else
-@@ -131,9 +133,10 @@ VbaApplicationBase::getVersion() throw (uno::RuntimeException)
- return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(OFFICEVERSION));
- }
-
--void SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, const uno::Any& varg1, const uno::Any& varg2, const uno::Any& varg3, const uno::Any& varg4, const uno::Any& varg5, const uno::Any& varg6, const uno::Any& varg7, const uno::Any& varg8, const uno::Any& varg9, const uno::Any& varg10, const uno::Any& varg11, const uno::Any& varg12, const uno::Any& varg13, const uno::Any& varg14, const uno::Any& varg15, const uno::Any& varg16, const uno::Any& varg17, const uno::Any& varg18, const uno::Any& varg19, const uno::Any& varg20, const uno::Any& varg21, const uno::Any& varg22, const uno::Any& varg23, const uno::Any& varg24, const uno::Any& varg25, const uno::Any& varg26, const uno::Any& varg27, const uno::Any& varg28, const uno::Any& varg29, const uno::Any& varg30 ) throw (uno::RuntimeException)
-+uno::Any SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, const uno::Any& varg1, const uno::Any& varg2, const uno::Any& varg3, const uno::Any& varg4, const uno::Any& varg5, const uno::Any& varg6, const uno::Any& varg7, const uno::Any& varg8, const uno::Any& varg9, const uno::Any& varg10, const uno::Any& varg11, const uno::Any& varg12, const uno::Any& varg13, const uno::Any& varg14, const uno::Any& varg15, const uno::Any& varg16, const uno::Any& varg17, const uno::Any& varg18, const uno::Any& varg19, const uno::Any& varg20, const uno::Any& varg21, const uno::Any& varg22, const uno::Any& varg23, const uno::Any& varg24, const uno::Any& varg25, const uno::Any& varg26, const uno::Any& varg27, const uno::Any& varg28, const uno::Any& varg29, const uno::Any& varg30 ) throw (uno::RuntimeException)
- {
-- VBAMacroResolvedInfo aMacroInfo = resolveVBAMacro( getSfxObjShell( getCurrentDocument() ), MacroName );
-+ // search the global tempalte
-+ VBAMacroResolvedInfo aMacroInfo = resolveVBAMacro( getSfxObjShell( getCurrentDocument() ), MacroName, sal_True );
- if( aMacroInfo.IsResolved() )
- {
- // handle the arguments
-@@ -161,6 +164,8 @@ void SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, const u
- uno::Any aRet;
- uno::Any aDummyCaller;
- executeMacro( aMacroInfo.MacroDocContext(), aMacroInfo.ResolvedMacro(), aArgs, aRet, aDummyCaller );
-+
-+ return aRet;
- }
- else
- {
-diff --git vbahelper/source/vbahelper/vbadialogbase.cxx vbahelper/source/vbahelper/vbadialogbase.cxx
-index ec7ecae..472b2b4 100644
---- vbahelper/source/vbahelper/vbadialogbase.cxx
-+++ vbahelper/source/vbahelper/vbadialogbase.cxx
-@@ -30,11 +30,10 @@
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-
--// fails silently
--void
--VbaDialogBase::Show() throw(uno::RuntimeException)
-+sal_Bool SAL_CALL VbaDialogBase::Show() throw ( uno::RuntimeException )
- {
- rtl::OUString aURL;
-+ sal_Bool bSuccess = sal_False;
- if ( m_xModel.is() )
- {
- aURL = mapIndexToName( mnIndex );
-@@ -42,7 +41,26 @@ VbaDialogBase::Show() throw(uno::RuntimeException)
- throw uno::RuntimeException(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " Unable to open the specified dialog " ) ),
- uno::Reference< XInterface > () );
-- dispatchRequests( m_xModel, aURL );
-- }
--}
-
-+ uno::Sequence< beans::PropertyValue > dispatchProps(0);
-+ if ( aURL.equalsAscii(".uno:PrinterSetup") )
-+ {
-+ dispatchProps.realloc(1);
-+ dispatchProps[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBADialogResultRequest" ) );
-+ dispatchProps[0].Value <<= (sal_Bool) sal_True;
-+ }
-+
-+ VBADispatchListener *pNotificationListener = new VBADispatchListener();
-+ uno::Reference< frame::XDispatchResultListener > rListener = pNotificationListener;
-+ dispatchRequests( m_xModel, aURL, dispatchProps, rListener, sal_False );
-+
-+ bSuccess = pNotificationListener->getState();
-+ uno::Any aResult = pNotificationListener->getResult();
-+ if ( bSuccess )
-+ {
-+ if ( aResult.getValueTypeClass() == uno::TypeClass_BOOLEAN )
-+ aResult >>= bSuccess;
-+ }
-+ }
-+ return bSuccess;
-+}
-diff --git vbahelper/source/vbahelper/vbadocumentbase.cxx vbahelper/source/vbahelper/vbadocumentbase.cxx
-index 848795a..2866053 100644
---- vbahelper/source/vbahelper/vbadocumentbase.cxx
-+++ vbahelper/source/vbahelper/vbadocumentbase.cxx
-@@ -33,6 +33,7 @@
- #include <com/sun/star/util/XCloseable.hpp>
- #include <com/sun/star/frame/XStorable.hpp>
- #include <com/sun/star/frame/XFrame.hpp>
-+#include <com/sun/star/frame/XTitle.hpp>
- #include <com/sun/star/beans/XPropertySet.hpp>
-
- #include <tools/urlobj.hxx>
-@@ -66,13 +67,8 @@ VbaDocumentBase::getName() throw (uno::RuntimeException)
- }
- 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);
-+ uno::Reference< frame::XTitle > xTitle( getModel(), uno::UNO_QUERY_THROW );
-+ sName = xTitle->getTitle();
- }
- return sName;
- }
-@@ -128,12 +124,20 @@ VbaDocumentBase::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg,
- 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);
-+ try{
-+ xCloseable->close(sal_True);
-+ }
-+ catch( util::CloseVetoException )
-+ {
-+ //close is cancelled, nothing to do
-+ }
-+ }
- // 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.
-@@ -141,7 +145,16 @@ VbaDocumentBase::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg,
- {
- uno::Reference< lang::XComponent > xDisposable ( getModel(), uno::UNO_QUERY );
- if ( xDisposable.is() )
-- xDisposable->dispose();
-+ {
-+ // To be on the safe side, catch possible veto exception anyway.
-+ try
-+ {
-+ xDisposable->dispose();
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+ }
- }
- }
-
-@@ -179,14 +192,14 @@ void
- VbaDocumentBase::setSaved( sal_Bool bSave ) throw (uno::RuntimeException)
- {
- uno::Reference< util::XModifiable > xModifiable( getModel(), uno::UNO_QUERY_THROW );
-- xModifiable->setModified( bSave );
-+ xModifiable->setModified( !bSave );
- }
-
- sal_Bool
- VbaDocumentBase::getSaved() throw (uno::RuntimeException)
- {
- uno::Reference< util::XModifiable > xModifiable( getModel(), uno::UNO_QUERY_THROW );
-- return xModifiable->isModified();
-+ return !xModifiable->isModified();
- }
-
- void
-diff --git vbahelper/source/vbahelper/vbadocumentsbase.cxx vbahelper/source/vbahelper/vbadocumentsbase.cxx
-index 61cdb52..d3eb535 100644
---- vbahelper/source/vbahelper/vbadocumentsbase.cxx
-+++ vbahelper/source/vbahelper/vbadocumentsbase.cxx
-@@ -34,6 +34,7 @@
- #include <com/sun/star/lang/XComponent.hpp>
- #include <com/sun/star/frame/XModel.hpp>
- #include <com/sun/star/frame/XFrame.hpp>
-+#include <com/sun/star/frame/XTitle.hpp>
- #include <com/sun/star/frame/FrameSearchFlag.hpp>
- #include <com/sun/star/util/XModifiable.hpp>
- #include <com/sun/star/frame/XStorable.hpp>
-@@ -143,8 +144,18 @@ public:
- {
- uno::Reference< frame::XModel > xModel( xServiceInfo, uno::UNO_QUERY_THROW ); // that the spreadsheetdocument is a xmodel is a given
- m_documents.push_back( xModel );
-- INetURLObject aURL( xModel->getURL() );
-- namesToIndices[ aURL.GetLastName() ] = nIndex++;
-+ rtl::OUString sName = xModel->getURL();
-+ if( sName.getLength() )
-+ {
-+ INetURLObject aURL( xModel->getURL() );
-+ namesToIndices[ aURL.GetLastName() ] = nIndex++;
-+ }
-+ else
-+ {
-+ uno::Reference< frame::XTitle > xTitle( xModel, uno::UNO_QUERY_THROW );
-+ sName = xTitle->getTitle();
-+ namesToIndices[ sName ] = nIndex++;
-+ }
- }
- }
-
-diff --git vbahelper/source/vbahelper/vbaeventshelperbase.cxx vbahelper/source/vbahelper/vbaeventshelperbase.cxx
-new file mode 100644
-index 0000000..52aba1f
---- /dev/null
-+++ vbahelper/source/vbahelper/vbaeventshelperbase.cxx
-@@ -0,0 +1,60 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include <vbahelper/vbaeventshelperbase.hxx>
-+
-+using namespace ::com::sun::star;
-+
-+VbaEventsHelperBase::VbaEventsHelperBase( const css::uno::Reference< css::uno::XComponentContext >& xContext ) : m_xContext( xContext ), mbIgnoreEvents( sal_False )
-+{
-+}
-+
-+void VbaEventsHelperBase::insert( const sal_Int32 nId, const rtl::OUString& sEventName )
-+{
-+ m_aEventNameMap.insert( std::make_pair( nId, sEventName ) );
-+}
-+
-+rtl::OUString VbaEventsHelperBase::getEventName( const sal_Int32 nId )
-+{
-+ std::map< sal_Int32, rtl::OUString >::iterator iter = m_aEventNameMap.find( nId );
-+ if( iter != m_aEventNameMap.end() )
-+ return iter->second;
-+ return rtl::OUString();
-+}
-+
-+void SAL_CALL VbaEventsHelperBase::setIgnoreEvents( ::sal_Bool _ignoreevents ) throw (css::uno::RuntimeException)
-+{
-+ mbIgnoreEvents = _ignoreevents;
-+}
-+
-+::sal_Bool SAL_CALL VbaEventsHelperBase::getIgnoreEvents() throw (css::uno::RuntimeException)
-+{
-+ return mbIgnoreEvents;
-+}
-+
-diff --git vbahelper/source/vbahelper/vbaglobalbase.cxx vbahelper/source/vbahelper/vbaglobalbase.cxx
-index adb0738..1b4fb81 100644
---- vbahelper/source/vbahelper/vbaglobalbase.cxx
-+++ vbahelper/source/vbahelper/vbaglobalbase.cxx
-@@ -35,22 +35,50 @@ using namespace ooo::vba;
-
- rtl::OUString sApplication( RTL_CONSTASCII_USTRINGPARAM("Application") );
-
-+// special key to return the Application
-+rtl::OUString sAppService( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.Application") );
-+
- VbaGlobalsBase::VbaGlobalsBase(
- const uno::Reference< ov::XHelperInterface >& xParent,
- const uno::Reference< uno::XComponentContext >& xContext, const rtl::OUString& sDocCtxName )
--: Globals_BASE( xParent, xContext )
-+: Globals_BASE( xParent, xContext ), msDocCtxName( sDocCtxName )
- {
- // overwrite context with custom one ( that contains the application )
-+ // wrap the service manager as we don't want the disposing context to tear down the 'normal' ServiceManager ( or at least thats what the code appears like it wants to do )
-+ uno::Any aSrvMgr;
-+ if ( xContext.is() && xContext->getServiceManager().is() )
-+ {
-+ aSrvMgr = uno::makeAny( xContext->getServiceManager()->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.stoc.OServiceManagerWrapper") ), xContext ) );
-+ }
-+
- ::cppu::ContextEntry_Init aHandlerContextInfo[] =
- {
- ::cppu::ContextEntry_Init( sApplication, uno::Any() ),
- ::cppu::ContextEntry_Init( sDocCtxName, uno::Any() ),
-+ ::cppu::ContextEntry_Init( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.lang.theServiceManager" ) ), aSrvMgr ),
- };
--
-- mxContext = ::cppu::createComponentContext( aHandlerContextInfo, sizeof( aHandlerContextInfo ) / sizeof( aHandlerContextInfo[0] ), xContext );
--
-+ // don't pass a delegate, this seems to introduce yet another cyclic dependency ( and
-+ // some strange behavior
-+ mxContext = ::cppu::createComponentContext( aHandlerContextInfo, sizeof( aHandlerContextInfo ) / sizeof( aHandlerContextInfo[0] ), NULL );
- }
-
-+VbaGlobalsBase::~VbaGlobalsBase()
-+{
-+ try
-+ {
-+ uno::Reference< container::XNameContainer > xNameContainer( mxContext, uno::UNO_QUERY );
-+ if ( xNameContainer.is() )
-+ {
-+ // release document reference ( we don't wan't the component context trying to dispose that )
-+ xNameContainer->removeByName( msDocCtxName );
-+ // release application reference, as it is holding onto the context
-+ xNameContainer->removeByName( sApplication );
-+ }
-+ }
-+ catch ( const uno::Exception& )
-+ {
-+ }
-+}
-
- void
- VbaGlobalsBase::init( const uno::Sequence< beans::PropertyValue >& aInitArgs )
-@@ -74,19 +102,30 @@ uno::Reference< uno::XInterface > SAL_CALL
- VbaGlobalsBase::createInstance( const ::rtl::OUString& aServiceSpecifier ) throw (uno::Exception, uno::RuntimeException)
- {
- uno::Reference< uno::XInterface > xReturn;
--
-- if ( hasServiceName( aServiceSpecifier ) )
-+ if ( aServiceSpecifier.equals( sAppService ) )
-+ {
-+ // try to extract the Application from the context
-+ uno::Reference< container::XNameContainer > xNameContainer( mxContext, uno::UNO_QUERY );
-+ xNameContainer->getByName( sApplication ) >>= xReturn;
-+ }
-+ else if ( hasServiceName( aServiceSpecifier ) )
- xReturn = mxContext->getServiceManager()->createInstanceWithContext( aServiceSpecifier, mxContext );
- return xReturn;
- }
-
- uno::Reference< uno::XInterface > SAL_CALL
--VbaGlobalsBase::createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const uno::Sequence< uno::Any >& Arguments ) throw (uno::Exception, uno::RuntimeException)
-+VbaGlobalsBase::createInstanceWithArguments( const ::rtl::OUString& aServiceSpecifier, const uno::Sequence< uno::Any >& Arguments ) throw (uno::Exception, uno::RuntimeException)
- {
-
- uno::Reference< uno::XInterface > xReturn;
-- if ( hasServiceName( ServiceSpecifier ) )
-- xReturn = mxContext->getServiceManager()->createInstanceWithArgumentsAndContext( ServiceSpecifier, Arguments, mxContext );
-+ if ( aServiceSpecifier.equals( sAppService ) )
-+ {
-+ // try to extract the Application from the context
-+ uno::Reference< container::XNameContainer > xNameContainer( mxContext, uno::UNO_QUERY );
-+ xNameContainer->getByName( sApplication ) >>= xReturn;
-+ }
-+ else if ( hasServiceName( aServiceSpecifier ) )
-+ xReturn = mxContext->getServiceManager()->createInstanceWithArgumentsAndContext( aServiceSpecifier, Arguments, mxContext );
- return xReturn;
- }
-
-diff --git vbahelper/source/vbahelper/vbahelper.cxx vbahelper/source/vbahelper/vbahelper.cxx
-index ed56394..89892d7 100644
---- vbahelper/source/vbahelper/vbahelper.cxx
-+++ vbahelper/source/vbahelper/vbahelper.cxx
-@@ -31,6 +31,7 @@
- #include <com/sun/star/frame/XFrame.hpp>
- #include <com/sun/star/frame/XDesktop.hpp>
- #include <com/sun/star/frame/XController.hpp>
-+#include <com/sun/star/frame/XNotifyingDispatch.hpp>
- #include <com/sun/star/script/XDefaultProperty.hpp>
- #include <com/sun/star/uno/XComponentContext.hpp>
- #include <com/sun/star/lang/XMultiComponentFactory.hpp>
-@@ -314,7 +315,7 @@ void dispatchExecute(SfxViewShell* pViewShell, USHORT nSlot, SfxCallMode nCall)
- }
-
- void
--dispatchRequests (uno::Reference< frame::XModel>& xModel,rtl::OUString & aUrl, uno::Sequence< beans::PropertyValue >& sProps )
-+dispatchRequests (uno::Reference< frame::XModel>& xModel,rtl::OUString & aUrl, uno::Sequence< beans::PropertyValue >& sProps, const uno::Reference< frame::XDispatchResultListener >& rListener, const sal_Bool bSilent )
- {
-
- util::URL url ;
-@@ -350,6 +351,7 @@ dispatchRequests (uno::Reference< frame::XModel>& xModel,rtl::OUString & aUrl, u
- }
-
- uno::Reference<frame::XDispatch> xDispatcher = xDispatchProvider->queryDispatch(url,emptyString,0);
-+ uno::Reference< frame::XNotifyingDispatch > xNotifyingDispatcher( xDispatcher, uno::UNO_QUERY );
-
- uno::Sequence<beans::PropertyValue> dispatchProps(1);
-
-@@ -365,11 +367,20 @@ dispatchRequests (uno::Reference< frame::XModel>& xModel,rtl::OUString & aUrl, u
- *pDest = *pSrc;
- }
-
-- (*pDest).Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Silent" ));
-- (*pDest).Value <<= (sal_Bool)sal_True;
-+ if ( bSilent )
-+ {
-+ (*pDest).Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Silent" ));
-+ (*pDest).Value <<= (sal_Bool)sal_True;
-+ }
-
-- if (xDispatcher.is())
-+ if ( !rListener.is() && xDispatcher.is() )
-+ {
- xDispatcher->dispatch( url, dispatchProps );
-+ }
-+ else if ( rListener.is() && xNotifyingDispatcher.is() )
-+ {
-+ xNotifyingDispatcher->dispatchWithNotification( url, dispatchProps, rListener );
-+ }
- }
-
- void
-@@ -962,6 +973,18 @@ sal_Bool setPropertyValue( uno::Sequence< beans::PropertyValue >& aProp, const r
- return sal_False;
- }
-
-+void setOrAppendPropertyValue( uno::Sequence< beans::PropertyValue >& aProp, const rtl::OUString& aName, const uno::Any& aValue )
-+{
-+ if( setPropertyValue( aProp, aName, aValue ) )
-+ return;
-+
-+ // append the property
-+ sal_Int32 nLength = aProp.getLength();
-+ aProp.realloc( nLength + 1 );
-+ aProp[ nLength ].Name = aName;
-+ aProp[ nLength ].Value = aValue;
-+}
-+
- #define VBA_LEFT "PositionX"
- #define VBA_TOP "PositionY"
- UserFormGeometryHelper::UserFormGeometryHelper( const uno::Reference< uno::XComponentContext >& /*xContext*/, const uno::Reference< awt::XControl >& xControl )
-@@ -1173,7 +1196,49 @@ UserFormGeometryHelper::UserFormGeometryHelper( const uno::Reference< uno::XComp
- double points = double( static_cast<double>(_hmm) / factor);
- return points;
- }
--
-+
-+ // Listener for XNotifyingDispatch
-+ VBADispatchListener::VBADispatchListener() : m_State( sal_False )
-+ {
-+ }
-+
-+ // Listener for XNotifyingDispatch
-+ VBADispatchListener::~VBADispatchListener()
-+ {
-+ }
-+
-+ // Listener for XNotifyingDispatch
-+ void SAL_CALL VBADispatchListener::dispatchFinished( const frame::DispatchResultEvent& aEvent ) throw ( uno::RuntimeException )
-+ {
-+ m_Result = aEvent.Result;
-+ m_State = ( aEvent.State == frame::DispatchResultState::SUCCESS ) ? sal_True : sal_False;
-+ }
-+
-+ // Listener for XNotifyingDispatch
-+ void SAL_CALL VBADispatchListener::disposing( const lang::EventObject& /*aEvent*/ ) throw( uno::RuntimeException )
-+ {
-+ }
-+
-+ uno::Reference< uno::XInterface > getUnoDocModule( const String& aModName, SfxObjectShell* pShell )
-+ {
-+ uno::Reference< uno::XInterface > xIf;
-+ if ( pShell )
-+ {
-+ rtl::OUString sProj( RTL_CONSTASCII_USTRINGPARAM("Standard") );
-+ BasicManager* pBasMgr = pShell->GetBasicManager();
-+ if ( pBasMgr && pBasMgr->GetName().Len() )
-+ sProj = pShell->GetBasicManager()->GetName();
-+ StarBASIC* pBasic = pShell->GetBasicManager()->GetLib( sProj );
-+ if ( pBasic )
-+ {
-+ SbModule* pMod = pBasic->FindModule( aModName );
-+ if ( pMod )
-+ xIf = pMod->GetUnoModule();
-+ }
-+ }
-+ return xIf;
-+ }
-+
- SfxObjectShell* getSfxObjShell( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
- {
- SfxObjectShell* pFoundShell = NULL;
-diff --git vbahelper/source/vbahelper/vbapictureformat.cxx vbahelper/source/vbahelper/vbapictureformat.cxx
-index bcdf83a..71fe406 100644
---- vbahelper/source/vbahelper/vbapictureformat.cxx
-+++ vbahelper/source/vbahelper/vbapictureformat.cxx
-@@ -112,13 +112,14 @@ ScVbaPictureFormat::IncrementContrast( double increment ) throw (uno::RuntimeExc
- {
- double nContrast = getContrast();
- nContrast += increment;
-- if( increment < 0 )
-+ //VBA, minz@cn.ibm.com.
-+ if( nContrast < 0 )
- {
-- increment = 0.0;
-+ nContrast = 0.0;
- }
-- if( increment > 1 )
-+ if( nContrast > 1 )
- {
-- increment = 1.0;
-+ nContrast = 1.0;
- }
- setContrast( nContrast );
- }
-diff --git vbahelper/source/vbahelper/vbashape.cxx vbahelper/source/vbahelper/vbashape.cxx
-index e0ec739..f95ede4 100644
---- vbahelper/source/vbahelper/vbashape.cxx
-+++ vbahelper/source/vbahelper/vbashape.cxx
-@@ -35,6 +35,7 @@
- #include <com/sun/star/lang/XServiceInfo.hpp>
- #include <com/sun/star/lang/XMultiServiceFactory.hpp>
- #include <com/sun/star/text/TextContentAnchorType.hpp>
-+#include <com/sun/star/text/RelOrientation.hpp>
- #include <ooo/vba/word/WdRelativeHorizontalPosition.hpp>
- #include <ooo/vba/word/WdRelativeVerticalPosition.hpp>
-
-@@ -219,25 +220,66 @@ ScVbaShape::setWidth( double _width ) throw (uno::RuntimeException)
- double SAL_CALL
- ScVbaShape::getLeft() throw (uno::RuntimeException)
- {
-- return m_pShapeHelper->getLeft();
-+ double left = 0;
-+ try
-+ {
-+ left = m_pShapeHelper->getLeft();
-+ }
-+ catch( uno::Exception& )
-+ {
-+ // fail to get position by using XShape::getPosition()
-+ sal_Int32 nLeft = 0;
-+ m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HoriOrientPosition") ) ) >>= nLeft;
-+ left = Millimeter::getInPoints( nLeft );
-+ }
-+ return left;
- }
-
- void SAL_CALL
- ScVbaShape::setLeft( double _left ) throw (uno::RuntimeException)
- {
-- m_pShapeHelper->setLeft( _left );
-+ try
-+ {
-+ m_pShapeHelper->setLeft( _left );
-+ }
-+ catch( uno::Exception& )
-+ {
-+ sal_Int32 nLeft = 0;
-+ nLeft = Millimeter::getInHundredthsOfOneMillimeter( _left );
-+ m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "HoriOrientPosition" ), uno::makeAny( nLeft ) );
-+ }
- }
-
- double SAL_CALL
- ScVbaShape::getTop() throw (uno::RuntimeException)
- {
-- return m_pShapeHelper->getTop();
-+ double top = 0;
-+ try
-+ {
-+ top = m_pShapeHelper->getTop();
-+ }
-+ catch( uno::Exception& )
-+ {
-+ sal_Int32 nTop = 0;
-+ m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VertOrientPosition") ) ) >>= nTop;
-+ top = Millimeter::getInPoints( nTop );
-+ }
-+ return top;
- }
-
- void SAL_CALL
- ScVbaShape::setTop( double _top ) throw (uno::RuntimeException)
- {
-- return m_pShapeHelper->setTop( _top );
-+ try
-+ {
-+ m_pShapeHelper->setTop( _top );
-+ }
-+ catch( uno::Exception& )
-+ {
-+ sal_Int32 nTop = 0;
-+ nTop = Millimeter::getInHundredthsOfOneMillimeter( _top );
-+ m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "VertOrientPosition" ), uno::makeAny( nTop ) );
-+ }
- }
-
- sal_Bool SAL_CALL
-@@ -474,6 +516,17 @@ ScVbaShape::ShapeRange( const uno::Any& index ) throw ( uno::RuntimeException )
- return uno::makeAny( xShapeRange );
- }
-
-+void SAL_CALL ScVbaShape::Copy() throw (uno::RuntimeException)
-+{
-+ if ( m_xModel.is() )
-+ {
-+ Select( uno::Any() );
-+ // Copy this Shape.
-+ rtl::OUString sUrl = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".uno:Copy") );
-+ dispatchRequests( m_xModel, sUrl );
-+ }
-+}
-+
- sal_Bool SAL_CALL
- ScVbaShape::getLockAspectRatio() throw (uno::RuntimeException)
- {
-@@ -504,35 +557,34 @@ sal_Int32 SAL_CALL
- ScVbaShape::getRelativeHorizontalPosition() throw (uno::RuntimeException)
- {
- sal_Int32 nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin;
-- text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH;
-- m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ) ) >>= eType;
-+ sal_Int16 nType = text::RelOrientation::PAGE_LEFT;
-+ m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HoriOrientRelation") ) ) >>= nType;
-
-- switch( eType )
-+ switch( nType )
- {
-- case text::TextContentAnchorType_AT_PARAGRAPH:
-+ case text::RelOrientation::FRAME:
- {
- nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionColumn;
- break;
- }
-- case text::TextContentAnchorType_AT_PAGE:
-+ case text::RelOrientation::PAGE_FRAME:
- {
- nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionPage;
- break;
- }
-- case text::TextContentAnchorType_AT_CHARACTER:
-+ case text::RelOrientation::CHAR:
- {
- nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionCharacter;
- break;
- }
-- case text::TextContentAnchorType_AT_FRAME:
-- case text::TextContentAnchorType_AS_CHARACTER:
-+ case text::RelOrientation::PAGE_PRINT_AREA:
- {
- nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin;
- break;
- }
- default:
- {
-- nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin;
-+ throw uno::RuntimeException( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Shape::RelativeHorizontalPosition: not implemented" ) ), uno::Reference< uno::XInterface >() );
- }
- }
- return nRelativeHorizontalPosition;
-@@ -541,23 +593,27 @@ ScVbaShape::getRelativeHorizontalPosition() throw (uno::RuntimeException)
- void SAL_CALL
- ScVbaShape::setRelativeHorizontalPosition( ::sal_Int32 _relativehorizontalposition ) throw (uno::RuntimeException)
- {
-- text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH;
-+ sal_Int16 nType = text::RelOrientation::PAGE_FRAME;
- switch( _relativehorizontalposition )
- {
- case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionCharacter:
- {
-- eType = text::TextContentAnchorType_AT_CHARACTER;
-+ nType = text::RelOrientation::CHAR;
- break;
- }
- case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionColumn:
-+ {
-+ nType = text::RelOrientation::PAGE_FRAME;
-+ break;
-+ }
- case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin:
- {
-- eType = text::TextContentAnchorType_AT_PARAGRAPH;
-+ nType = text::RelOrientation::PAGE_PRINT_AREA;
- break;
- }
- case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionPage:
- {
-- eType = text::TextContentAnchorType_AT_PAGE;
-+ nType = text::RelOrientation::PAGE_FRAME;
- break;
- }
- default:
-@@ -565,42 +621,41 @@ ScVbaShape::setRelativeHorizontalPosition( ::sal_Int32 _relativehorizontalpositi
- DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
- }
- }
-- m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ), uno::makeAny( eType ) );
-+ m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HoriOrientRelation") ), uno::makeAny( nType ) );
- }
-
- sal_Int32 SAL_CALL
- ScVbaShape::getRelativeVerticalPosition() throw (uno::RuntimeException)
- {
- sal_Int32 nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin;
-- text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH;
-- m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ) ) >>= eType;
-+ sal_Int16 nType = text::RelOrientation::PAGE_FRAME;
-+ m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VertOrientRelation") ) ) >>= nType;
-
-- switch( eType )
-+ switch( nType )
- {
-- case text::TextContentAnchorType_AT_PARAGRAPH:
-+ case text::RelOrientation::FRAME:
- {
- nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionParagraph;
- break;
- }
-- case text::TextContentAnchorType_AT_PAGE:
-+ case text::RelOrientation::PAGE_FRAME:
- {
- nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionPage;
- break;
- }
-- case text::TextContentAnchorType_AT_CHARACTER:
-+ case text::RelOrientation::TEXT_LINE:
- {
- nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionLine;
- break;
- }
-- case text::TextContentAnchorType_AT_FRAME:
-- case text::TextContentAnchorType_AS_CHARACTER:
-+ case text::RelOrientation::PAGE_PRINT_AREA:
- {
- nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin;
- break;
- }
- default:
- {
-- nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin;
-+ throw uno::RuntimeException( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Shape::RelativeVerticalPosition: not implemented" ) ), uno::Reference< uno::XInterface >() );
- }
- }
- return nRelativeVerticalPosition;
-@@ -609,23 +664,27 @@ ScVbaShape::getRelativeVerticalPosition() throw (uno::RuntimeException)
- void SAL_CALL
- ScVbaShape::setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition ) throw (uno::RuntimeException)
- {
-- text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH;
-+ sal_Int16 nType = text::RelOrientation::PAGE_FRAME;
- switch( _relativeverticalposition )
- {
- case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionLine:
- {
-- eType = text::TextContentAnchorType_AT_CHARACTER;
-+ nType = text::RelOrientation::TEXT_LINE;
- break;
- }
- case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionParagraph:
-+ {
-+ nType = text::RelOrientation::FRAME;
-+ break;
-+ }
- case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin:
- {
-- eType = text::TextContentAnchorType_AT_PARAGRAPH;
-+ nType = text::RelOrientation::PAGE_PRINT_AREA;
- break;
- }
- case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionPage:
- {
-- eType = text::TextContentAnchorType_AT_PAGE;
-+ nType = text::RelOrientation::PAGE_FRAME;
- break;
- }
- default:
-@@ -633,7 +692,7 @@ ScVbaShape::setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition )
- DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
- }
- }
-- m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ), uno::makeAny( eType ) );
-+ m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VertOrientRelation") ), uno::makeAny( nType ) );
- }
-
- uno::Any SAL_CALL
-diff --git vbahelper/source/vbahelper/vbashaperange.cxx vbahelper/source/vbahelper/vbashaperange.cxx
-index f6dc8ad..cfdf185 100644
---- vbahelper/source/vbahelper/vbashaperange.cxx
-+++ vbahelper/source/vbahelper/vbashaperange.cxx
-@@ -122,6 +122,27 @@ ScVbaShapeRange::IncrementTop( double Increment ) throw (uno::RuntimeException)
- {
- uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW );
- xShape->IncrementTop( Increment );
-+ }
-+}
-+
-+rtl::OUString SAL_CALL ScVbaShapeRange::getName() 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 );
-+ return xShape->getName( );
-+ }
-+ throw uno::RuntimeException();
-+}
-+
-+void SAL_CALL ScVbaShapeRange::setName( const rtl::OUString& _name ) 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->setName( _name );
- }
- }
-
-@@ -337,6 +358,16 @@ uno::Any SAL_CALL ScVbaShapeRange::WrapFormat( ) throw (css::uno::RuntimeExcept
- throw uno::RuntimeException();
- }
-
-+void SAL_CALL ScVbaShapeRange::ZOrder( sal_Int32 ZOrderCmd ) 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->ZOrder( ZOrderCmd );
-+ }
-+}
-+
- uno::Type SAL_CALL
- ScVbaShapeRange::getElementType() throw (uno::RuntimeException)
- {
-diff --git vbahelper/source/vbahelper/vbashapes.cxx vbahelper/source/vbahelper/vbashapes.cxx
-index f64b4aa..1b77ef8 100644
---- vbahelper/source/vbahelper/vbashapes.cxx
-+++ vbahelper/source/vbahelper/vbashapes.cxx
-@@ -86,7 +86,7 @@ void ScVbaShapes::initBaseCollection()
- 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, const uno::Reference< frame::XModel>& xModel ): ScVbaShapes_BASE( xParent, xContext, xShapes ), m_nNewShapeCount(0), m_xModel( xModel )
-+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, const uno::Reference< frame::XModel>& xModel ): ScVbaShapes_BASE( xParent, xContext, xShapes, sal_True ), m_nNewShapeCount(0), m_xModel( xModel )
- {
- m_xShapes.set( xShapes, uno::UNO_QUERY_THROW );
- m_xDrawPage.set( xShapes, uno::UNO_QUERY_THROW );
-diff --git vbahelper/util/makefile.mk vbahelper/util/makefile.mk
-index dda4be0..33c4900 100644
---- vbahelper/util/makefile.mk
-+++ vbahelper/util/makefile.mk
-@@ -95,6 +95,7 @@ SHL2STDLIBS= \
- $(VCLLIB) \
- $(TKLIB) \
- $(BASICLIB) \
-+ $(SVXMSFILTERLIB) \
-
- SHL2DEPN=$(SHL1TARGETN)
- SHL2LIBS=$(SLB)$/$(TARGET_MSFORMS).lib
-diff --git vcl/inc/vcl/bitmap.hxx vcl/inc/vcl/bitmap.hxx
-index 435e4c6..d3f2282 100644
---- vcl/inc/vcl/bitmap.hxx
-+++ vcl/inc/vcl/bitmap.hxx
-@@ -267,9 +267,9 @@ public:
- SAL_DLLPRIVATE void ImplSetImpBitmap( ImpBitmap* pImpBmp );
- SAL_DLLPRIVATE void ImplAssignWithSize( const Bitmap& rBitmap );
-
-- SAL_DLLPRIVATE static BOOL ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, ULONG nOffset );
-+ SAL_DLLPRIVATE static BOOL ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, ULONG nOffset, BOOL bMSOFormat=FALSE );
- SAL_DLLPRIVATE static BOOL ImplReadDIBFileHeader( SvStream& rIStm, ULONG& rOffset );
-- SAL_DLLPRIVATE static BOOL ImplReadDIBInfoHeader( SvStream& rIStm, DIBInfoHeader& rHeader, sal_Bool& bTopDown );
-+ SAL_DLLPRIVATE static BOOL ImplReadDIBInfoHeader( SvStream& rIStm, DIBInfoHeader& rHeader, sal_Bool& bTopDown, BOOL bMSOFormat = FALSE );
- SAL_DLLPRIVATE static BOOL ImplReadDIBPalette( SvStream& rIStm, BitmapWriteAccess& rAcc, BOOL bQuad );
- SAL_DLLPRIVATE static BOOL ImplReadDIBBits( SvStream& rIStm, DIBInfoHeader& rHeader, BitmapWriteAccess& rAcc, sal_Bool bTopDown );
- SAL_DLLPRIVATE BOOL ImplWriteDIB( SvStream& rOStm, BitmapReadAccess& rAcc, BOOL bCompressed ) const;
-@@ -764,7 +764,7 @@ public:
-
- public:
-
-- BOOL Read( SvStream& rIStm, BOOL bFileHeader = TRUE );
-+ BOOL Read( SvStream& rIStm, BOOL bFileHeader = TRUE, BOOL bMSOFormat = FALSE );
- BOOL Write( SvStream& rOStm, BOOL bCompressed = TRUE, BOOL bFileHeader = TRUE ) const;
-
- friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, Bitmap& rBitmap );
-diff --git vcl/inc/vcl/bitmapex.hxx vcl/inc/vcl/bitmapex.hxx
-index a7185da..29dfe13 100644
---- vcl/inc/vcl/bitmapex.hxx
-+++ vcl/inc/vcl/bitmapex.hxx
-@@ -395,6 +395,7 @@ public:
-
- friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const BitmapEx& rBitmapEx );
- friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, BitmapEx& rBitmapEx );
-+ static BitmapEx AutoScaleBitmap(BitmapEx & aBitmap, const long aStandardSize);
- };
-
- #endif // _SV_BITMAPEX_HXX
-diff --git vcl/inc/vcl/dialog.hxx vcl/inc/vcl/dialog.hxx
-index 1032908..f771333 100644
---- vcl/inc/vcl/dialog.hxx
-+++ vcl/inc/vcl/dialog.hxx
-@@ -53,6 +53,7 @@ private:
- BOOL mbOldSaveBack;
- BOOL mbInClose;
- BOOL mbModalMode;
-+ sal_Int8 mnCancelClose; //liuchen 2009-7-22, support Excel VBA UserForm_QueryClose event
-
- SAL_DLLPRIVATE void ImplInitDialogData();
- SAL_DLLPRIVATE void ImplInitSettings();
-@@ -91,6 +92,9 @@ public:
- virtual short Execute();
- BOOL IsInExecute() const { return mbInExecute; }
-
-+ sal_Int8 GetCloseFlag() const { return mnCancelClose; } //liuchen 2009-7-22, support Excel VBA UserForm_QueryClose event
-+ void SetCloseFlag( sal_Int8 nCancel ) { mnCancelClose = nCancel; } //liuchen 2009-7-22, support Excel VBA UserForm_QueryClose event
-+
- ////////////////////////////////////////
- // Dialog::Execute replacement API
- public:
-diff --git vcl/source/control/combobox.cxx vcl/source/control/combobox.cxx
-index 1c08487..01637b6 100644
---- vcl/source/control/combobox.cxx
-+++ vcl/source/control/combobox.cxx
-@@ -468,8 +468,11 @@ IMPL_LINK( ComboBox, ImplSelectHdl, void*, EMPTYARG )
- mpSubEdit->SetModifyFlag();
- mbSyntheticModify = TRUE;
- Modify();
-- mbSyntheticModify = FALSE;
-- Select();
-+ mbSyntheticModify = FALSE;
-+ if (ImplGetWindowImpl() != NULL) //liuchen 2009-7-28, resolve the problem that soffice get crashed if in ComboBox_Change event a Worksheets("SheetX").Activate sentence needs to be executed
-+ {
-+ Select();
-+ }
- }
-
- return 0;
-diff --git vcl/source/gdi/bitmap2.cxx vcl/source/gdi/bitmap2.cxx
-index d982d64..50c7bad 100644
---- vcl/source/gdi/bitmap2.cxx
-+++ vcl/source/gdi/bitmap2.cxx
-@@ -46,6 +46,8 @@
-
- #define DIBCOREHEADERSIZE ( 12UL )
- #define DIBINFOHEADERSIZE ( sizeof( DIBInfoHeader ) )
-+#define BITMAPINFOHEADER 0x28
-+
- #define SETPIXEL4( pBuf, nX, cChar )( (pBuf)[ (nX) >> 1 ] |= ( (nX) & 1 ) ? ( cChar ): (cChar) << 4 );
-
- // ----------------------
-@@ -129,7 +131,7 @@ SvStream& operator<<( SvStream& rOStm, const Bitmap& rBitmap )
-
- // ------------------------------------------------------------------
-
--BOOL Bitmap::Read( SvStream& rIStm, BOOL bFileHeader )
-+BOOL Bitmap::Read( SvStream& rIStm, BOOL bFileHeader, BOOL bIsMSOFormat )
- {
- const USHORT nOldFormat = rIStm.GetNumberFormatInt();
- const ULONG nOldPos = rIStm.Tell();
-@@ -144,7 +146,7 @@ BOOL Bitmap::Read( SvStream& rIStm, BOOL bFileHeader )
- bRet = ImplReadDIB( rIStm, *this, nOffset );
- }
- else
-- bRet = ImplReadDIB( rIStm, *this, nOffset );
-+ bRet = ImplReadDIB( rIStm, *this, nOffset, bIsMSOFormat );
-
- if( !bRet )
- {
-@@ -161,14 +163,14 @@ BOOL Bitmap::Read( SvStream& rIStm, BOOL bFileHeader )
-
- // ------------------------------------------------------------------
-
--BOOL Bitmap::ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, ULONG nOffset )
-+BOOL Bitmap::ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, ULONG nOffset, BOOL bIsMSOFormat )
- {
- DIBInfoHeader aHeader;
- const ULONG nStmPos = rIStm.Tell();
- BOOL bRet = FALSE;
- sal_Bool bTopDown = sal_False;
-
-- if( ImplReadDIBInfoHeader( rIStm, aHeader, bTopDown ) && aHeader.nWidth && aHeader.nHeight && aHeader.nBitCount )
-+ if( ImplReadDIBInfoHeader( rIStm, aHeader, bTopDown, bIsMSOFormat ) && aHeader.nWidth && aHeader.nHeight && aHeader.nBitCount )
- {
- const USHORT nBitCount( discretizeBitcount(aHeader.nBitCount) );
-
-@@ -299,20 +301,36 @@ BOOL Bitmap::ImplReadDIBFileHeader( SvStream& rIStm, ULONG& rOffset )
-
- // ------------------------------------------------------------------
-
--BOOL Bitmap::ImplReadDIBInfoHeader( SvStream& rIStm, DIBInfoHeader& rHeader, sal_Bool& bTopDown )
-+BOOL Bitmap::ImplReadDIBInfoHeader( SvStream& rIStm, DIBInfoHeader& rHeader, sal_Bool& bTopDown, sal_Bool bIsMSOFormat )
- {
- // BITMAPINFOHEADER or BITMAPCOREHEADER
- rIStm >> rHeader.nSize;
-
- // BITMAPCOREHEADER
-+ sal_Int16 nTmp16 = 0;
-+ sal_uInt8 nTmp8 = 0;
- if ( rHeader.nSize == DIBCOREHEADERSIZE )
- {
-- sal_Int16 nTmp16;
-
- rIStm >> nTmp16; rHeader.nWidth = nTmp16;
- rIStm >> nTmp16; rHeader.nHeight = nTmp16;
- rIStm >> rHeader.nPlanes;
- rIStm >> rHeader.nBitCount;
-+ }
-+ else if ( bIsMSOFormat && ( rHeader.nSize == BITMAPINFOHEADER ) )
-+ {
-+ rIStm >> nTmp16; rHeader.nWidth = nTmp16;
-+ rIStm >> nTmp16; rHeader.nHeight = nTmp16;
-+ rIStm >> nTmp8; rHeader.nPlanes = nTmp8;
-+ rIStm >> nTmp8; rHeader.nBitCount = nTmp8;
-+ rIStm >> nTmp16; rHeader.nSizeImage = nTmp16;
-+ rIStm >> nTmp16; rHeader.nCompression = nTmp16;
-+ if ( !rHeader.nSizeImage ) // uncompressed?
-+ rHeader.nSizeImage = ((rHeader.nWidth * rHeader.nBitCount + 31) & ~31) / 8 * rHeader.nHeight;
-+ rIStm >> rHeader.nXPelsPerMeter;
-+ rIStm >> rHeader.nYPelsPerMeter;
-+ rIStm >> rHeader.nColsUsed;
-+ rIStm >> rHeader.nColsImportant;
- }
- else
- {
-diff --git vcl/source/gdi/bitmapex.cxx vcl/source/gdi/bitmapex.cxx
-index cfa9e4c..1997455 100644
---- vcl/source/gdi/bitmapex.cxx
-+++ vcl/source/gdi/bitmapex.cxx
-@@ -45,6 +45,7 @@
- #endif
- #include <vcl/svapp.hxx>
- #include <vcl/bmpacc.hxx>
-+#include <vcl/virdev.hxx>
-
- // ------------
- // - BitmapEx -
-@@ -757,6 +758,61 @@ void BitmapEx::Draw( OutputDevice* pOutDev,
- pOutDev->DrawBitmapEx( rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel, *this );
- }
-
-+BitmapEx BitmapEx:: AutoScaleBitmap(BitmapEx & aBitmap, const long aStandardSize)
-+{
-+ Point aEmptyPoint(0,0);
-+ sal_Int32 imgNewWidth = 0;
-+ sal_Int32 imgNewHeight = 0;
-+ double imgposX = 0;
-+ double imgposY = 0;
-+ BitmapEx aRet = aBitmap;
-+ double imgOldWidth = aRet.GetSizePixel().Width();
-+ double imgOldHeight =aRet.GetSizePixel().Height();
-+
-+ Size aScaledSize;
-+ if (imgOldWidth >= aStandardSize || imgOldHeight >= aStandardSize)
-+ {
-+ if (imgOldWidth >= imgOldHeight)
-+ {
-+ imgNewWidth = aStandardSize;
-+ imgNewHeight = sal_Int32(imgOldHeight / (imgOldWidth / aStandardSize) + 0.5);
-+ imgposX = 0;
-+ imgposY = (aStandardSize - (imgOldHeight / (imgOldWidth / aStandardSize) + 0.5)) / 2 + 0.5;
-+ }
-+ else
-+ {
-+ imgNewHeight = aStandardSize;
-+ imgNewWidth = sal_Int32(imgOldWidth / (imgOldHeight / aStandardSize) + 0.5);
-+ imgposY = 0;
-+ imgposX = (aStandardSize - (imgOldWidth / (imgOldHeight / aStandardSize) + 0.5)) / 2 + 0.5;
-+ }
-+
-+ aScaledSize = Size( imgNewWidth, imgNewHeight );
-+ aRet.Scale( aScaledSize, BMP_SCALE_INTERPOLATE );
-+ }
-+ else
-+ {
-+ imgposX = (aStandardSize - imgOldWidth) / 2 + 0.5;
-+ imgposY = (aStandardSize - imgOldHeight) / 2 + 0.5;
-+ }
-+
-+ Size aBmpSize = aRet.GetSizePixel();
-+ Size aStdSize( aStandardSize, aStandardSize );
-+ Rectangle aRect(aEmptyPoint, aStdSize );
-+
-+ VirtualDevice aVirDevice( *Application::GetDefaultDevice(), 0, 1 );
-+ aVirDevice.SetOutputSizePixel( aStdSize );
-+ aVirDevice.SetFillColor( COL_TRANSPARENT );
-+ aVirDevice.SetLineColor( COL_TRANSPARENT );
-+
-+ //draw a rect into virDevice
-+ aVirDevice.DrawRect( aRect );
-+ Point aPointPixel( (long)imgposX, (long)imgposY );
-+ aVirDevice.DrawBitmapEx( aPointPixel, aRet );
-+ aRet = aVirDevice.GetBitmapEx( aEmptyPoint, aStdSize );
-+
-+ return aRet;
-+}
- // ------------------------------------------------------------------
-
- sal_uInt8 BitmapEx::GetTransparency(sal_Int32 nX, sal_Int32 nY) const
-diff --git vcl/source/window/dialog.cxx vcl/source/window/dialog.cxx
-index 86b7e85..1e493ce 100644
---- vcl/source/window/dialog.cxx
-+++ vcl/source/window/dialog.cxx
-@@ -559,7 +559,14 @@ BOOL Dialog::Close()
- {
- ImplDelData aDelData;
- ImplAddDel( &aDelData );
-- ImplCallEventListeners( VCLEVENT_WINDOW_CLOSE );
-+ //liuchen 2009-7-22, support Excel VBA UserForm_QueryClose event
-+ mnCancelClose = 0;
-+ ImplCallEventListeners( VCLEVENT_WINDOW_CLOSE );
-+ if (mnCancelClose == 1)
-+ {
-+ return FALSE;
-+ }
-+ //liuchen 2009-7-22
- if ( aDelData.IsDelete() )
- return FALSE;
- ImplRemoveDel( &aDelData );
-diff --git vcl/source/window/toolbox2.cxx vcl/source/window/toolbox2.cxx
-index 9f15df6..9fb1d55 100644
---- vcl/source/window/toolbox2.cxx
-+++ vcl/source/window/toolbox2.cxx
-@@ -56,6 +56,8 @@ using namespace rtl;
-
- #define TB_SEP_SIZE 8
-
-+ButtonType determineButtonType( ImplToolItem* pItem, ButtonType defaultType );
-+
- // -----------------------------------------------------------------------
-
- ImplToolBoxPrivateData::ImplToolBoxPrivateData() :
-diff --git xmloff/inc/xmlnmspe.hxx xmloff/inc/xmlnmspe.hxx
-index 1451cde..33de6ea 100644
---- xmloff/inc/xmlnmspe.hxx
-+++ xmloff/inc/xmlnmspe.hxx
-@@ -104,6 +104,7 @@ XML_OLD_NAMESPACE( META, 6U )
-
- // experimental namespaces
- XML_NAMESPACE( FIELD, 100U )
-+XML_NAMESPACE( FORMX, 101U ) // form interop extensions
-
-
- #endif // _XMLOFF_XMLNMSPE_HXX
-diff --git xmloff/inc/xmloff/shapeexport.hxx xmloff/inc/xmloff/shapeexport.hxx
-index 9f28c27..43cabbe 100644
---- xmloff/inc/xmloff/shapeexport.hxx
-+++ xmloff/inc/xmloff/shapeexport.hxx
-@@ -199,11 +199,6 @@ private:
- const rtl::OUString msStartShape;
- const rtl::OUString msEndShape;
- const rtl::OUString msOnClick;
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
-- const rtl::OUString msOnAction;
-- const rtl::OUString msAction;
-- const rtl::OUString msURL;
--#endif
- const rtl::OUString msEventType;
- const rtl::OUString msPresentation;
- const rtl::OUString msMacroName;
-diff --git xmloff/inc/xmloff/xmltoken.hxx xmloff/inc/xmloff/xmltoken.hxx
-index ce7946b..9bb12f7 100644
---- xmloff/inc/xmloff/xmltoken.hxx
-+++ xmloff/inc/xmloff/xmltoken.hxx
-@@ -145,9 +145,13 @@ namespace xmloff { namespace token {
- XML_NP_OFFICE_EXT,
- XML_N_OFFICE_EXT,
-
-+ // jonp: 2008-09-24 Excel Interop
-+ XML_NP_FORMX,
-+ XML_N_FORMX,
-+
- XML_NP_TABLE_EXT,
- XML_N_TABLE_EXT,
--
-+
- XML_NP_DRAW_EXT,
- XML_N_DRAW_EXT,
-
-diff --git xmloff/source/core/xmlexp.cxx xmloff/source/core/xmlexp.cxx
-index 9b1ddcb..e8a2c22 100644
---- xmloff/source/core/xmlexp.cxx
-+++ xmloff/source/core/xmlexp.cxx
-@@ -409,6 +409,7 @@ void SvXMLExport::_InitCtor()
- mpNamespaceMap->Add( GetXMLToken(XML_NP_XSD), GetXMLToken(XML_N_XSD), XML_NAMESPACE_XSD );
- mpNamespaceMap->Add( GetXMLToken(XML_NP_XSI), GetXMLToken(XML_N_XSI), XML_NAMESPACE_XSI );
- mpNamespaceMap->Add( GetXMLToken(XML_NP_FIELD), GetXMLToken(XML_N_FIELD), XML_NAMESPACE_FIELD );
-+ mpNamespaceMap->Add( GetXMLToken(XML_NP_FORMX), GetXMLToken(XML_N_FORMX), XML_NAMESPACE_FORMX );
- }
- // RDFa: needed for content and header/footer styles
- if( (getExportFlags() & (EXPORT_STYLES|EXPORT_AUTOSTYLES|EXPORT_MASTERSTYLES|EXPORT_CONTENT) ) != 0 )
-diff --git xmloff/source/core/xmlimp.cxx xmloff/source/core/xmlimp.cxx
-index ba559a0..e6105d8 100644
---- xmloff/source/core/xmlimp.cxx
-+++ xmloff/source/core/xmlimp.cxx
-@@ -115,6 +115,7 @@ sal_Char __READONLY_DATA sXML_np__script[] = "_script";
- sal_Char __READONLY_DATA sXML_np__config[] = "_config";
- sal_Char __READONLY_DATA sXML_np__db[] = "_db";
- sal_Char __READONLY_DATA sXML_np__xforms[] = "_xforms";
-+sal_Char __READONLY_DATA sXML_np__formx[] = "_formx";
- sal_Char __READONLY_DATA sXML_np__xsd[] = "_xsd";
- sal_Char __READONLY_DATA sXML_np__xsi[] = "_xsi";
- sal_Char __READONLY_DATA sXML_np__field[] = "_field";
-@@ -309,6 +310,9 @@ void SvXMLImport::_InitCtor()
- mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__xforms) ),
- GetXMLToken(XML_N_XFORMS_1_0),
- XML_NAMESPACE_XFORMS );
-+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__formx) ),
-+ GetXMLToken( XML_N_FORMX ),
-+ XML_NAMESPACE_FORMX );
- mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__xsd) ),
- GetXMLToken(XML_N_XSD),
- XML_NAMESPACE_XSD );
-diff --git xmloff/source/core/xmltoken.cxx xmloff/source/core/xmltoken.cxx
-index 5d21101..f9354a7 100644
---- xmloff/source/core/xmltoken.cxx
-+++ xmloff/source/core/xmltoken.cxx
-@@ -153,6 +153,9 @@ namespace xmloff { namespace token {
- TOKEN( "officeooo", XML_NP_OFFICE_EXT ),
- TOKEN( "http://openoffice.org/2009/office", XML_N_OFFICE_EXT ),
-
-+ // jonp: 2008-09-24 Excel Interop
-+ TOKEN( "formx", XML_NP_FORMX ),
-+ TOKEN( "urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0", XML_N_FORMX ),
- TOKEN( "tableooo", XML_NP_TABLE_EXT ),
- TOKEN( "http://openoffice.org/2009/table", XML_N_TABLE_EXT ),
-
-diff --git xmloff/source/draw/eventimp.cxx xmloff/source/draw/eventimp.cxx
-index dcc9ff4..732fc07 100644
---- xmloff/source/draw/eventimp.cxx
-+++ xmloff/source/draw/eventimp.cxx
-@@ -101,9 +101,6 @@ public:
-
- sal_Bool mbValid;
- sal_Bool mbScript;
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
-- sal_Bool mbActionEvent;
--#endif
- ClickAction meClickAction;
- XMLEffect meEffect;
- XMLEffectDirection meDirection;
-@@ -115,9 +112,6 @@ public:
- OUString msMacroName;
- OUString msBookmark;
- OUString msLanguage;
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
-- OUString msHyperURL;
--#endif
- };
-
- ///////////////////////////////////////////////////////////////////////
-@@ -176,18 +170,11 @@ TYPEINIT1( SdXMLEventContext, SvXMLImportContext );
-
- SdXMLEventContext::SdXMLEventContext( SvXMLImport& rImp, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, const Reference< XShape >& rxShape )
- : SvXMLImportContext(rImp, nPrfx, rLocalName),
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
-- mxShape( rxShape ), mbScript( sal_False ), mbActionEvent( sal_False ), meClickAction( ClickAction_NONE ),
--#else
- mxShape( rxShape ), mbScript( sal_False ), meClickAction( ClickAction_NONE ),
--#endif
- meEffect( EK_none ), meDirection( ED_none ), mnStartScale( 100 ),
- meSpeed( AnimationSpeed_MEDIUM ), mnVerb(0), mbPlayFull( sal_False )
- {
- static const OUString sXMLClickName( RTL_CONSTASCII_USTRINGPARAM( "click" ) );
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
-- static const OUString sXMLActionName( RTL_CONSTASCII_USTRINGPARAM( "action" ) );
--#endif
-
- if( nPrfx == XML_NAMESPACE_PRESENTATION && IsXMLToken( rLocalName, XML_EVENT_LISTENER ) )
- {
-@@ -258,12 +245,7 @@ SdXMLEventContext::SdXMLEventContext( SvXMLImport& rImp, sal_uInt16 nPrfx, cons
- sEventName = sValue;
- sal_uInt16 nScriptPrefix =
- GetImport().GetNamespaceMap().GetKeyByAttrName( sValue, &sEventName );
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
-- mbValid = XML_NAMESPACE_DOM == nScriptPrefix && ( sEventName == sXMLClickName || sEventName == sXMLActionName );
-- mbActionEvent = mbValid && (sEventName == sXMLActionName);
--#else
- mbValid = XML_NAMESPACE_DOM == nScriptPrefix && sEventName == sXMLClickName;
--#endif
- }
- else if( IsXMLToken( aAttrLocalName, XML_LANGUAGE ) )
- {
-@@ -292,12 +274,6 @@ SdXMLEventContext::SdXMLEventContext( SvXMLImport& rImp, sal_uInt16 nPrfx, cons
- {
- msMacroName = sValue;
- }
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
-- else if ( mbActionEvent )
-- {
-- msHyperURL = sValue;
-- }
--#endif
- else
- {
- const rtl::OUString &rTmp =
-@@ -343,26 +319,6 @@ void SdXMLEventContext::EndElement()
- OUString sAPIEventName;
- uno::Sequence< beans::PropertyValue > aProperties;
-
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
-- if( mbActionEvent )
-- {
-- sAPIEventName = OUString( RTL_CONSTASCII_USTRINGPARAM( "OnAction" ) );
-- aProperties.realloc( 2 );
-- beans::PropertyValue* pProperty = aProperties.getArray();
--
-- pProperty->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "EventType" ) );
-- pProperty->Handle = -1;
-- pProperty->Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "Action" ) );
-- pProperty->State = beans::PropertyState_DIRECT_VALUE;
-- ++pProperty;
-- pProperty->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
-- pProperty->Handle = -1;
-- pProperty->Value <<= msHyperURL;
-- pProperty->State = beans::PropertyState_DIRECT_VALUE;
-- }
-- else
--#endif
-- {
- sAPIEventName = OUString( RTL_CONSTASCII_USTRINGPARAM( "OnClick" ) );
-
- if( mbScript )
-@@ -547,8 +503,6 @@ void SdXMLEventContext::EndElement()
- break;
- }
- }
-- }
--
- xEvents->replaceByName( sAPIEventName, uno::Any( aProperties ) );
-
- } while(0);
-diff --git xmloff/source/draw/shapeexport.cxx xmloff/source/draw/shapeexport.cxx
-index 76353ba..7dc8ce6 100644
---- xmloff/source/draw/shapeexport.cxx
-+++ xmloff/source/draw/shapeexport.cxx
-@@ -90,11 +90,6 @@ XMLShapeExport::XMLShapeExport(SvXMLExport& rExp,
- msStartShape( RTL_CONSTASCII_USTRINGPARAM("StartShape") ),
- msEndShape( RTL_CONSTASCII_USTRINGPARAM("EndShape") ),
- msOnClick( RTL_CONSTASCII_USTRINGPARAM("OnClick") ),
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
-- msOnAction( RTL_CONSTASCII_USTRINGPARAM("OnAction") ),
-- msAction( RTL_CONSTASCII_USTRINGPARAM("Action") ),
-- msURL( RTL_CONSTASCII_USTRINGPARAM("URL") ),
--#endif
- msEventType( RTL_CONSTASCII_USTRINGPARAM("EventType") ),
- msPresentation( RTL_CONSTASCII_USTRINGPARAM("Presentation") ),
- msMacroName( RTL_CONSTASCII_USTRINGPARAM("MacroName") ),
-diff --git xmloff/source/draw/shapeexport2.cxx xmloff/source/draw/shapeexport2.cxx
-index be5d6e2..0ac32d3 100644
---- xmloff/source/draw/shapeexport2.cxx
-+++ xmloff/source/draw/shapeexport2.cxx
-@@ -293,9 +293,6 @@ const sal_Int32 FOUND_CLICKEVENTTYPE = 0x00000080;
- const sal_Int32 FOUND_MACRO = 0x00000100;
- const sal_Int32 FOUND_LIBRARY = 0x00000200;
- const sal_Int32 FOUND_ACTIONEVENTTYPE = 0x00000400;
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
--const sal_Int32 FOUND_URL = 0x00000800;
--#endif
-
- } // namespace
-
-@@ -385,33 +382,6 @@ void XMLShapeExport::ImpExportEvents( const uno::Reference< drawing::XShape >& x
- }
- }
-
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
-- // extract properties from "OnAction" event -------------------------------
--
-- OUString aActionEventType;
-- OUString aHyperURL;
--
-- uno::Sequence< beans::PropertyValue > aActionProperties;
-- if( xEvents->hasByName( msOnAction ) && (xEvents->getByName( msOnAction ) >>= aActionProperties) )
-- {
-- const beans::PropertyValue* pProperty = aActionProperties.getConstArray();
-- const beans::PropertyValue* pPropertyEnd = pProperty + aActionProperties.getLength();
-- for( ; pProperty != pPropertyEnd; ++pProperty )
-- {
-- if( ( ( nFound & FOUND_ACTIONEVENTTYPE ) == 0 ) && pProperty->Name == msEventType )
-- {
-- if( pProperty->Value >>= aActionEventType )
-- nFound |= FOUND_ACTIONEVENTTYPE;
-- }
-- else if( ( ( nFound & FOUND_URL ) == 0 ) && ( pProperty->Name == msURL ) )
-- {
-- if( pProperty->Value >>= aHyperURL )
-- nFound |= FOUND_URL;
-- }
-- }
-- }
--#endif
--
- // create the XML elements
-
- if( aClickEventType == msPresentation )
-@@ -563,15 +533,9 @@ void XMLShapeExport::ImpExportEvents( const uno::Reference< drawing::XShape >& x
- SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_SCRIPT, XML_EVENT_LISTENER, sal_True, sal_True);
- }
- }
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
-- else if( aClickEventType == msScript || aActionEventType == msAction )
-- {
-- if( nFound & ( FOUND_MACRO | FOUND_URL ) )
--#else
- else if( aClickEventType == msScript )
- {
- if( nFound & FOUND_MACRO )
--#endif
- {
- SvXMLElementExport aEventsElemt(mrExport, XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS, sal_True, sal_True);
- if ( nFound & FOUND_MACRO )
-@@ -586,18 +550,6 @@ void XMLShapeExport::ImpExportEvents( const uno::Reference< drawing::XShape >& x
-
- SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_SCRIPT, XML_EVENT_LISTENER, sal_True, sal_True);
- }
--#ifdef ISSUE66550_HLINK_FOR_SHAPES
-- if ( nFound & FOUND_URL )
-- {
-- OUString aEventQName(
-- mrExport.GetNamespaceMap().GetQNameByKey(
-- XML_NAMESPACE_DOM, OUString( RTL_CONSTASCII_USTRINGPARAM( "action" ) ) ) );
-- mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_EVENT_NAME, aEventQName );
-- mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, aHyperURL );
--
-- SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_PRESENTATION, XML_EVENT_LISTENER, sal_True, sal_True);
-- }
--#endif
- }
- }
- }
-diff --git xmloff/source/draw/ximpshap.cxx xmloff/source/draw/ximpshap.cxx
-index 82285ba..77f1bae 100644
---- xmloff/source/draw/ximpshap.cxx
-+++ xmloff/source/draw/ximpshap.cxx
-@@ -374,9 +374,15 @@ void SdXMLShapeContext::EndElement()
-
- if( msHyperlink.getLength() != 0 ) try
- {
-+ uno::Reference< beans::XPropertySet > xProp( mxShape, uno::UNO_QUERY );
-+
-+ rtl::OUString sLink( RTL_CONSTASCII_USTRINGPARAM( "Hyperlink" ) );
-+ if ( xProp.is() && xProp->getPropertySetInfo()->hasPropertyByName( sLink ) )
-+ xProp->setPropertyValue( sLink, uno::Any( msHyperlink ) );
-+ Reference< XEventsSupplier > xEventsSupplier( mxShape, UNO_QUERY_THROW );
-+ Reference< XNameReplace > xEvents( xEventsSupplier->getEvents(), UNO_QUERY_THROW );
- const OUString sBookmark( RTL_CONSTASCII_USTRINGPARAM( "Bookmark" ) );
-
-- Reference< XEventsSupplier > xEventsSupplier( mxShape, UNO_QUERY );
- if( xEventsSupplier.is() )
- {
- const OUString sEventType( RTL_CONSTASCII_USTRINGPARAM( "EventType" ) );
-@@ -3306,9 +3312,16 @@ SvXMLImportContext *SdXMLFrameShapeContext::CreateChildContext( USHORT nPrefix,
-
- if( !mxImplContext.Is() )
- {
-- pContext = GetImport().GetShapeImport()->CreateFrameChildContext(
-+
-+ SvXMLShapeContext* pShapeContext= GetImport().GetShapeImport()->CreateFrameChildContext(
- GetImport(), nPrefix, rLocalName, xAttrList, mxShapes, mxAttrList );
-
-+ pContext = pShapeContext;
-+
-+ // propagate the hyperlink to child context
-+ if ( msHyperlink.getLength() > 0 )
-+ pShapeContext->setHyperlink( msHyperlink );
-+
- mxImplContext = pContext;
- mbSupportsReplacement = IsXMLToken( rLocalName, XML_OBJECT ) ||
- IsXMLToken( rLocalName, XML_OBJECT_OLE );
-diff --git xmloff/source/forms/elementexport.cxx xmloff/source/forms/elementexport.cxx
-index d3f39ec..7814c30 100644
---- xmloff/source/forms/elementexport.cxx
-+++ xmloff/source/forms/elementexport.cxx
-@@ -1107,6 +1107,39 @@ namespace xmloff
- }
-
- // ----------------------------------
-+ // the string properties
-+ {
-+ static sal_Int32 nStringPropertyAttributeIds[] =
-+ { // attribute flags
-+ SCA_GROUP_NAME
-+ };
-+ static const ::rtl::OUString* pStringPropertyNames[] =
-+ { // property names
-+ &PROPERTY_GROUP_NAME
-+ };
-+
-+ sal_Int32 nIdCount = sizeof( nStringPropertyAttributeIds ) / sizeof( nStringPropertyAttributeIds[0] );
-+ #if OSL_DEBUG_LEVEL > 0
-+ sal_Int32 nNameCount = sizeof( pStringPropertyNames ) / sizeof( pStringPropertyNames[0] );
-+ OSL_ENSURE( ( nIdCount == nNameCount ),
-+ "OControlExport::exportSpecialAttributes: somebody tampered with the maps (2)!" );
-+ #endif
-+ for ( i = 0; i < nIdCount; ++i )
-+ if ( nStringPropertyAttributeIds[i] & m_nIncludeSpecial )
-+ {
-+ exportStringPropertyAttribute(
-+ OAttributeMetaData::getSpecialAttributeNamespace( nStringPropertyAttributeIds[i] ),
-+ OAttributeMetaData::getSpecialAttributeName( nStringPropertyAttributeIds[i] ),
-+ *( pStringPropertyNames[i] )
-+ );
-+ #if OSL_DEBUG_LEVEL > 0
-+ // reset the bit for later checking
-+ m_nIncludeSpecial = m_nIncludeSpecial & ~nStringPropertyAttributeIds[i];
-+ #endif
-+ }
-+ }
-+
-+ // ----------------------------------
- if ((SCA_MIN_VALUE | SCA_MAX_VALUE) & m_nIncludeSpecial)
- {
- // need to export the min value and the max value as attributes
-@@ -1564,6 +1597,8 @@ namespace xmloff
- }
- if ( m_xPropertyInfo->hasPropertyByName( PROPERTY_IMAGE_POSITION ) )
- m_nIncludeSpecial |= SCA_IMAGE_POSITION;
-+ if ( m_xPropertyInfo->hasPropertyByName( PROPERTY_GROUP_NAME ) )
-+ m_nIncludeSpecial |= SCA_GROUP_NAME;
- m_nIncludeDatabase = DA_DATA_FIELD | DA_INPUT_REQUIRED;
- m_nIncludeEvents = EA_CONTROL_EVENTS | EA_ON_CHANGE;
- break;
-diff --git xmloff/source/forms/formattributes.cxx xmloff/source/forms/formattributes.cxx
-index 430b257..de11567 100644
---- xmloff/source/forms/formattributes.cxx
-+++ xmloff/source/forms/formattributes.cxx
-@@ -192,6 +192,7 @@ namespace xmloff
- case SCA_MAX_VALUE: return "max-value";
- case SCA_MIN_VALUE: return "min-value";
- case SCA_VALIDATION: return "validation";
-+ case SCA_GROUP_NAME: return "group-name";
- case SCA_MULTI_LINE: return "multi-line";
- case SCA_AUTOMATIC_COMPLETION: return "auto-complete";
- case SCA_MULTIPLE: return "multiple";
-@@ -212,9 +213,12 @@ namespace xmloff
- }
-
- //---------------------------------------------------------------------
-- sal_uInt16 OAttributeMetaData::getSpecialAttributeNamespace(sal_Int32 /*_nId*/)
-+ sal_uInt16 OAttributeMetaData::getSpecialAttributeNamespace(sal_Int32 _nId)
- {
-- // nothing special here
-+ switch( _nId )
-+ {
-+ case SCA_GROUP_NAME: return XML_NAMESPACE_FORMX;
-+ }
- return XML_NAMESPACE_FORM;
- }
-
-diff --git xmloff/source/forms/formattributes.hxx xmloff/source/forms/formattributes.hxx
-index f2e7bb7..a406a6e 100644
---- xmloff/source/forms/formattributes.hxx
-+++ xmloff/source/forms/formattributes.hxx
-@@ -123,6 +123,7 @@ namespace xmloff
- #define SCA_MAX_VALUE 0x00000002
- #define SCA_MIN_VALUE 0x00000004
- #define SCA_VALIDATION 0x00000008
-+ #define SCA_GROUP_NAME 0x00000010
- #define SCA_MULTI_LINE 0x00000020
- #define SCA_AUTOMATIC_COMPLETION 0x00000080
- #define SCA_MULTIPLE 0x00000100
-diff --git xmloff/source/forms/layerimport.cxx xmloff/source/forms/layerimport.cxx
-index 5fe178f..3c29834 100644
---- xmloff/source/forms/layerimport.cxx
-+++ xmloff/source/forms/layerimport.cxx
-@@ -95,6 +95,8 @@ OFormLayerXMLImport_Impl::OFormLayerXMLImport_Impl(SvXMLImport& _rImporter)
- m_aAttributeMetaData.addStringProperty(
- OAttributeMetaData::getCommonControlAttributeName(CCA_NAME), PROPERTY_NAME);
- m_aAttributeMetaData.addStringProperty(
-+ OAttributeMetaData::getSpecialAttributeName(SCA_GROUP_NAME), PROPERTY_GROUP_NAME);
-+ m_aAttributeMetaData.addStringProperty(
- OAttributeMetaData::getCommonControlAttributeName(CCA_IMAGE_DATA), PROPERTY_IMAGEURL);
- m_aAttributeMetaData.addStringProperty(
- OAttributeMetaData::getCommonControlAttributeName(CCA_LABEL), PROPERTY_LABEL);
-diff --git xmloff/source/forms/strings.hxx xmloff/source/forms/strings.hxx
-index 83d4262..8b7b6ef 100644
---- xmloff/source/forms/strings.hxx
-+++ xmloff/source/forms/strings.hxx
-@@ -205,6 +205,7 @@ namespace xmloff
- XMLFORM_CONSTASCII_STRING( PROPERTY_IMAGE_POSITION, "ImagePosition");
- XMLFORM_CONSTASCII_STRING( PROPERTY_IMAGE_ALIGN, "ImageAlign");
- XMLFORM_CONSTASCII_STRING( PROPERTY_SCALE_IMAGE, "ScaleImage");
-+ XMLFORM_CONSTASCII_STRING( PROPERTY_GROUP_NAME, "GroupName");
-
- XMLFORM_CONSTASCII_STRING( PROPERTY_BOUND_CELL, "BoundCell");
- XMLFORM_CONSTASCII_STRING( PROPERTY_LIST_CELL_RANGE, "CellRange");
-diff --git xmlscript/inc/xmlscript/xmldlg_imexp.hxx xmlscript/inc/xmlscript/xmldlg_imexp.hxx
-index 2fe6f35..987a8c3 100644
---- xmlscript/inc/xmlscript/xmldlg_imexp.hxx
-+++ xmlscript/inc/xmlscript/xmldlg_imexp.hxx
-@@ -27,6 +27,8 @@
- #ifndef _XMLSCRIPT_XMLDLG_IMEXP_HXX_
- #define _XMLSCRIPT_XMLDLG_IMEXP_HXX_
-
-+#include <com/sun/star/frame/XModel.hpp>
-+
- #ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HXX_
- #include <com/sun/star/container/XNameContainer.hpp>
- #endif
-@@ -51,7 +53,9 @@ void SAL_CALL exportDialogModel(
- ::com::sun::star::uno::Reference<
- ::com::sun::star::xml::sax::XExtendedDocumentHandler > const & xOut,
- ::com::sun::star::uno::Reference<
-- ::com::sun::star::container::XNameContainer > const & xDialogModel )
-+ ::com::sun::star::container::XNameContainer > const & xDialogModel,
-+ ::com::sun::star::uno::Reference<
-+ ::com::sun::star::frame::XModel > const & xDocument )
- SAL_THROW( (::com::sun::star::uno::Exception) );
-
- //==============================================================================
-@@ -60,7 +64,9 @@ SAL_CALL importDialogModel(
- ::com::sun::star::uno::Reference<
- ::com::sun::star::container::XNameContainer > const & xDialogModel,
- ::com::sun::star::uno::Reference<
-- ::com::sun::star::uno::XComponentContext > const & xContext )
-+ ::com::sun::star::uno::XComponentContext > const & xContext,
-+ ::com::sun::star::uno::Reference<
-+ ::com::sun::star::frame::XModel > const & xDocument )
- SAL_THROW( (::com::sun::star::uno::Exception) );
-
- // additional functions for convenience
-@@ -71,7 +77,9 @@ SAL_CALL exportDialogModel(
- ::com::sun::star::uno::Reference<
- ::com::sun::star::container::XNameContainer > const & xDialogModel,
- ::com::sun::star::uno::Reference<
-- ::com::sun::star::uno::XComponentContext > const & xContext )
-+ ::com::sun::star::uno::XComponentContext > const & xContext,
-+ ::com::sun::star::uno::Reference<
-+ ::com::sun::star::frame::XModel > const & xDocument )
- SAL_THROW( (::com::sun::star::uno::Exception) );
-
- //==============================================================================
-@@ -81,7 +89,9 @@ void SAL_CALL importDialogModel(
- ::com::sun::star::uno::Reference<
- ::com::sun::star::container::XNameContainer > const & xDialogModel,
- ::com::sun::star::uno::Reference<
-- ::com::sun::star::uno::XComponentContext > const & xContext )
-+ ::com::sun::star::uno::XComponentContext > const & xContext,
-+ ::com::sun::star::uno::Reference<
-+ ::com::sun::star::frame::XModel > const & xDocument )
- SAL_THROW( (::com::sun::star::uno::Exception) );
-
- }
-diff --git xmlscript/source/xmldlg_imexp/exp_share.hxx xmlscript/source/xmldlg_imexp/exp_share.hxx
-index 9ea565f..d06ffee 100644
---- xmlscript/source/xmldlg_imexp/exp_share.hxx
-+++ xmlscript/source/xmldlg_imexp/exp_share.hxx
-@@ -171,15 +171,17 @@ public:
- //
- void readDialogModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
-+ void readMultiPageModel( StyleBag * all_styles )
-+ SAL_THROW( (css::uno::Exception) );
- void readButtonModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
- void readEditModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
- void readCheckBoxModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
-- void readRadioButtonModel( StyleBag * all_styles )
-+ void readRadioButtonModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
- SAL_THROW( (css::uno::Exception) );
-- void readComboBoxModel( StyleBag * all_styles )
-+ void readComboBoxModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
- SAL_THROW( (css::uno::Exception) );
- void readCurrencyFieldModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
-@@ -193,9 +195,9 @@ public:
- SAL_THROW( (css::uno::Exception) );
- void readGroupBoxModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
-- void readImageControlModel( StyleBag * all_styles )
-+ void readImageControlModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
- SAL_THROW( (css::uno::Exception) );
-- void readListBoxModel( StyleBag * all_styles )
-+ void readListBoxModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
- SAL_THROW( (css::uno::Exception) );
- void readNumericFieldModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
-@@ -209,7 +211,9 @@ public:
- SAL_THROW( (css::uno::Exception) );
- void readProgressBarModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
-- void readScrollBarModel( StyleBag * all_styles )
-+ void readScrollBarModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
-+ SAL_THROW( (css::uno::Exception) );
-+ void readSpinButtonModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
- SAL_THROW( (css::uno::Exception) );
- void readFixedHyperLinkModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
-diff --git xmlscript/source/xmldlg_imexp/imp_share.hxx xmlscript/source/xmldlg_imexp/imp_share.hxx
-index ce9e43f..0bc9756 100644
---- xmlscript/source/xmldlg_imexp/imp_share.hxx
-+++ xmlscript/source/xmldlg_imexp/imp_share.hxx
-@@ -42,6 +42,7 @@
- #include <com/sun/star/awt/FontEmphasisMark.hpp>
- #include <com/sun/star/awt/FontRelief.hpp>
- #include <com/sun/star/xml/input/XRoot.hpp>
-+#include <com/sun/star/script/XLibraryContainer.hpp>
- #include <vector>
-
-
-@@ -128,6 +129,8 @@ struct DialogImport
-
- css::uno::Reference< css::container::XNameContainer > _xDialogModel;
- css::uno::Reference< css::lang::XMultiServiceFactory > _xDialogModelFactory;
-+ css::uno::Reference< css::frame::XModel > _xDoc;
-+ css::uno::Reference< css::script::XLibraryContainer > _xScriptLibraryContainer;
-
- sal_Int32 XMLNS_DIALOGS_UID, XMLNS_SCRIPT_UID;
-
-@@ -161,16 +164,20 @@ public:
- inline DialogImport(
- css::uno::Reference<css::uno::XComponentContext> const & xContext,
- css::uno::Reference<css::container::XNameContainer>
-- const & xDialogModel )
-+ const & xDialogModel,
-+ css::uno::Reference<css::frame::XModel> const & xDoc )
- SAL_THROW( () )
- : _xContext( xContext )
- , _xDialogModel( xDialogModel )
-- , _xDialogModelFactory( xDialogModel, css::uno::UNO_QUERY_THROW )
-+ , _xDialogModelFactory( xDialogModel, css::uno::UNO_QUERY_THROW ), _xDoc( xDoc )
- { OSL_ASSERT( _xDialogModel.is() && _xDialogModelFactory.is() &&
- _xContext.is() ); }
- virtual ~DialogImport()
- SAL_THROW( () );
-
-+ inline css::uno::Reference< css::frame::XModel > getDocOwner() { return _xDoc; }
-+
-+ css::uno::Reference< css::script::XLibraryContainer > getScriptLibraryContainer();
- // XRoot
- virtual void SAL_CALL startDocument(
- css::uno::Reference< css::xml::input::XNamespaceMapping >
-@@ -996,6 +1003,49 @@ public:
- };
-
- //==============================================================================
-+class SpinButtonElement
-+ : public ControlElement
-+{
-+public:
-+ virtual css::uno::Reference< css::xml::input::XElement >
-+ SAL_CALL startChildElement(
-+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
-+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
-+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-+ virtual void SAL_CALL endElement()
-+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-+
-+ inline SpinButtonElement(
-+ ::rtl::OUString const & rLocalName,
-+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
-+ ElementBase * pParent, DialogImport * pImport )
-+ SAL_THROW( () )
-+ : ControlElement( rLocalName, xAttributes, pParent, pImport )
-+ {}
-+};
-+
-+//==============================================================================
-+class MultiPage
-+ : public ControlElement
-+{
-+public:
-+ virtual css::uno::Reference< css::xml::input::XElement >
-+ SAL_CALL startChildElement(
-+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
-+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
-+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-+ virtual void SAL_CALL endElement()
-+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-+
-+ inline MultiPage(
-+ ::rtl::OUString const & rLocalName,
-+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
-+ ElementBase * pParent, DialogImport * pImport )
-+ SAL_THROW( () )
-+ : ControlElement( rLocalName, xAttributes, pParent, pImport )
-+ {}
-+};
-+
- class ProgressBarElement
- : public ControlElement
- {
-diff --git xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx
-index 0a5d74a..abfa771 100644
---- xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx
-+++ xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx
-@@ -41,6 +41,7 @@
- using namespace ::rtl;
- using namespace ::com::sun::star;
- using namespace ::com::sun::star::uno;
-+using namespace ::com::sun::star::frame;
-
- namespace xmlscript
- {
-@@ -70,7 +71,8 @@ Reference< io::XInputStream > InputStreamProvider::createInputStream()
- //==================================================================================================
- Reference< io::XInputStreamProvider > SAL_CALL exportDialogModel(
- Reference< container::XNameContainer > const & xDialogModel,
-- Reference< XComponentContext > const & xContext )
-+ Reference< XComponentContext > const & xContext,
-+ Reference< XModel > const & xDocument )
- SAL_THROW( (Exception) )
- {
- Reference< lang::XMultiComponentFactory > xSMgr( xContext->getServiceManager() );
-@@ -95,7 +97,7 @@ Reference< io::XInputStreamProvider > SAL_CALL exportDialogModel(
-
- Reference< io::XActiveDataSource > xSource( xHandler, UNO_QUERY );
- xSource->setOutputStream( createOutputStream( &aBytes ) );
-- exportDialogModel( xHandler, xDialogModel );
-+ exportDialogModel( xHandler, xDialogModel, xDocument );
-
- return new InputStreamProvider( aBytes );
- }
-@@ -104,7 +106,8 @@ Reference< io::XInputStreamProvider > SAL_CALL exportDialogModel(
- void SAL_CALL importDialogModel(
- Reference< io::XInputStream > xInput,
- Reference< container::XNameContainer > const & xDialogModel,
-- Reference< XComponentContext > const & xContext )
-+ Reference< XComponentContext > const & xContext,
-+ Reference< XModel > const & xDocument )
- SAL_THROW( (Exception) )
- {
- Reference< lang::XMultiComponentFactory > xSMgr( xContext->getServiceManager() );
-@@ -126,7 +129,7 @@ void SAL_CALL importDialogModel(
- }
-
- // error handler, entity resolver omitted for this helper function
-- xParser->setDocumentHandler( importDialogModel( xDialogModel, xContext ) );
-+ xParser->setDocumentHandler( importDialogModel( xDialogModel, xContext, xDocument ) );
-
- xml::sax::InputSource source;
- source.aInputStream = xInput;
-diff --git xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
-index 2449c09..1c67f19 100644
---- xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
-+++ xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
-@@ -29,7 +29,16 @@
- #include "precompiled_xmlscript.hxx"
- #include "exp_share.hxx"
-
-+#include <com/sun/star/form/binding/XListEntrySink.hpp>
-+#include <com/sun/star/form/binding/XBindableValue.hpp>
-+#include <com/sun/star/form/binding/XValueBinding.hpp>
-+#include <com/sun/star/table/CellAddress.hpp>
-+#include <com/sun/star/table/CellRangeAddress.hpp>
- #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
-+#include <com/sun/star/document/XStorageBasedDocument.hpp>
-+#include <com/sun/star/document/XGraphicObjectResolver.hpp>
-+#include <comphelper/componentcontext.hxx>
-+#include <comphelper/processfactory.hxx>
-
-
- using namespace ::com::sun::star;
-@@ -39,6 +48,66 @@ using ::rtl::OUString;
- namespace xmlscript
- {
-
-+void lclExportBindableAndListSourceBits( Reference< frame::XModel > const & xDocument, const Reference< beans::XPropertySet >& _xProps, ElementDescriptor& rModel )
-+{
-+ Reference< lang::XMultiServiceFactory > xFac;
-+ if ( xDocument.is() )
-+ xFac.set( xDocument, uno::UNO_QUERY );
-+
-+ Reference< form::binding::XBindableValue > xBinding( _xProps, UNO_QUERY );
-+
-+ if ( xFac.is() && xBinding.is() )
-+ {
-+ try
-+ {
-+ Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellAddressConversion" )), uno::UNO_QUERY );
-+ Reference< beans::XPropertySet > xBindable( xBinding->getValueBinding(), UNO_QUERY );
-+ if ( xBindable.is() )
-+ {
-+ table::CellAddress aAddress;
-+ xBindable->getPropertyValue( OUSTR("BoundCell") ) >>= aAddress;
-+ xConvertor->setPropertyValue( OUSTR("Address"), makeAny( aAddress ) );
-+ rtl::OUString sAddress;
-+ xConvertor->getPropertyValue( OUSTR("PersistentRepresentation") ) >>= sAddress;
-+ if ( sAddress.getLength() > 0 )
-+ rModel.addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell"), sAddress );
-+
-+ OSL_TRACE( "*** Bindable value %s", rtl::OUStringToOString( sAddress, RTL_TEXTENCODING_UTF8 ).getStr() );
-+
-+ }
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+ }
-+ Reference< form::binding::XListEntrySink > xEntrySink( _xProps, UNO_QUERY );
-+ if ( xEntrySink.is() )
-+ {
-+ Reference< beans::XPropertySet > xListSource( xEntrySink->getListEntrySource(), UNO_QUERY );
-+ if ( xListSource.is() )
-+ {
-+ try
-+ {
-+ Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellRangeAddressConversion" )), uno::UNO_QUERY );
-+
-+ table::CellRangeAddress aAddress;
-+ xListSource->getPropertyValue( OUSTR( "CellRange" ) ) >>= aAddress;
-+
-+ rtl::OUString sAddress;
-+ xConvertor->setPropertyValue( OUSTR("Address"), makeAny( aAddress ) );
-+ xConvertor->getPropertyValue( OUSTR("PersistentRepresentation") ) >>= sAddress;
-+ OSL_TRACE("**** cell range source list %s",
-+ rtl::OUStringToOString( sAddress, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ if ( sAddress.getLength() > 0 );
-+ rModel.addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":source-cell-range"), sAddress );
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+ }
-+ }
-+
-+}
- static inline bool readBorderProps(
- ElementDescriptor * element, Style & style )
- {
-@@ -65,6 +134,42 @@ static inline bool readFontProps( ElementDescriptor * element, Style & style )
- }
-
- //__________________________________________________________________________________________________
-+void ElementDescriptor::readMultiPageModel( StyleBag * all_styles )
-+{
-+ // collect styles
-+ Style aStyle( 0x2 | 0x8 | 0x20 );
-+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
-+ aStyle._set |= 0x2;
-+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
-+ aStyle._set |= 0x20;
-+ if (readFontProps( this, aStyle ))
-+ aStyle._set |= 0x8;
-+ if (aStyle._set)
-+ {
-+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
-+ all_styles->getStyleId( aStyle ) );
-+ }
-+
-+ // collect elements
-+ readDefaults();
-+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
-+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) );
-+
-+ OUString aTitle;
-+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ) ) >>= aTitle)
-+ {
-+ ElementDescriptor * title = new ElementDescriptor(
-+ _xProps, _xPropState,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ) );
-+ title->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ),
-+ aTitle );
-+ addSubElement( title );
-+ }
-+
-+ readEvents();
-+}
- void ElementDescriptor::readButtonModel( StyleBag * all_styles )
- SAL_THROW( (Exception) )
- {
-@@ -206,7 +311,7 @@ void ElementDescriptor::readCheckBoxModel( StyleBag * all_styles )
- readEvents();
- }
- //__________________________________________________________________________________________________
--void ElementDescriptor::readComboBoxModel( StyleBag * all_styles )
-+void ElementDescriptor::readComboBoxModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
- SAL_THROW( (Exception) )
- {
- // collect styles
-@@ -247,7 +352,8 @@ void ElementDescriptor::readComboBoxModel( StyleBag * all_styles )
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxlength") ) );
- readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linecount") ) );
--
-+ // Cell Range, Ref Cell etc.
-+ lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
- // string item list
- Sequence< OUString > itemValues;
- if ((readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ) ) >>= itemValues) &&
-@@ -273,7 +379,7 @@ void ElementDescriptor::readComboBoxModel( StyleBag * all_styles )
- readEvents();
- }
- //__________________________________________________________________________________________________
--void ElementDescriptor::readListBoxModel( StyleBag * all_styles )
-+void ElementDescriptor::readListBoxModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
- SAL_THROW( (Exception) )
- {
- // collect styles
-@@ -308,7 +414,7 @@ void ElementDescriptor::readListBoxModel( StyleBag * all_styles )
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linecount") ) );
- readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
--
-+ lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
- // string item list
- Sequence< OUString > itemValues;
- if ((readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ) ) >>= itemValues) &&
-@@ -348,7 +454,7 @@ void ElementDescriptor::readListBoxModel( StyleBag * all_styles )
- readEvents();
- }
- //__________________________________________________________________________________________________
--void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles )
-+void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
- SAL_THROW( (Exception) )
- {
- // collect styles
-@@ -385,6 +491,8 @@ void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles )
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-position") ) );
- readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multiline") ) );
-+ readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("GroupName") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":group-name") ) );
-
- sal_Int16 nState = 0;
- if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ) ) >>= nState)
-@@ -404,6 +512,7 @@ void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles )
- break;
- }
- }
-+ lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
- readEvents();
- }
- //__________________________________________________________________________________________________
-@@ -576,7 +685,7 @@ void ElementDescriptor::readEditModel( StyleBag * all_styles )
- readEvents();
- }
- //__________________________________________________________________________________________________
--void ElementDescriptor::readImageControlModel( StyleBag * all_styles )
-+void ElementDescriptor::readImageControlModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
- SAL_THROW( (Exception) )
- {
- // collect styles
-@@ -595,8 +704,31 @@ void ElementDescriptor::readImageControlModel( StyleBag * all_styles )
- readDefaults();
- readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleImage") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":scale-image") ) );
-- readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":src") ) );
-+ rtl::OUString sURL;
-+ _xProps->getPropertyValue( OUSTR("ImageURL") ) >>= sURL;
-+
-+ if ( sURL.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.GraphicObject:" ) ) ) == 0 )
-+ {
-+ Reference< document::XStorageBasedDocument > xDocStorage( xDocument, UNO_QUERY );
-+
-+ if ( xDocStorage.is() )
-+ {
-+ uno::Sequence< Any > aArgs( 1 );
-+ aArgs[ 0 ] <<= xDocStorage->getDocumentStorage();
-+
-+ ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
-+ uno::Reference< document::XGraphicObjectResolver > xGraphicResolver;
-+ aContext.createComponentWithArguments( OUSTR( "com.sun.star.comp.Svx.GraphicExportHelper" ), aArgs, xGraphicResolver );
-+ if ( xGraphicResolver.is() )
-+ {
-+ sURL = xGraphicResolver->resolveGraphicObjectURL( sURL );
-+ }
-+ }
-+ }
-+ if ( sURL.getLength() > 0 )
-+ {
-+ addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":src"), sURL );
-+ }
- readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
- readEvents();
-@@ -1073,7 +1205,7 @@ void ElementDescriptor::readProgressBarModel( StyleBag * all_styles )
- readEvents();
- }
- //__________________________________________________________________________________________________
--void ElementDescriptor::readScrollBarModel( StyleBag * all_styles )
-+void ElementDescriptor::readScrollBarModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
- SAL_THROW( (Exception) )
- {
- // collect styles
-@@ -1111,6 +1243,47 @@ void ElementDescriptor::readScrollBarModel( StyleBag * all_styles )
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":live-scroll") ) );
- readHexLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":symbol-color") ) );
-+ // Cell Range, Ref Cell etc.
-+ lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
-+ readEvents();
-+}
-+//__________________________________________________________________________________________________
-+void ElementDescriptor::readSpinButtonModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
-+ SAL_THROW( (Exception) )
-+{
-+ // collect styles
-+ Style aStyle( 0x1 | 0x4 );
-+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
-+ aStyle._set |= 0x1;
-+ if (readBorderProps( this, aStyle ))
-+ aStyle._set |= 0x4;
-+ if (aStyle._set)
-+ {
-+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
-+ all_styles->getStyleId( aStyle ) );
-+ }
-+
-+ // collect elements
-+ readDefaults();
-+ readOrientationAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
-+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinIncrement") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":increment") ) );
-+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValue") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":curval") ) );
-+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValueMax") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxval") ) );
-+ readLongAttr( OUSTR("SpinValueMin"),
-+ OUSTR(XMLNS_DIALOGS_PREFIX ":minval") );
-+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Repeat") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":repeat") ) );
-+ readLongAttr( OUSTR("RepeatDelay"), OUSTR(XMLNS_DIALOGS_PREFIX ":repeat-delay") );
-+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
-+ readHexLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":symbol-color") ) );
-+ // Cell Range, Ref Cell etc.
-+ lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
- readEvents();
- }
- //__________________________________________________________________________________________________
-diff --git xmlscript/source/xmldlg_imexp/xmldlg_export.cxx xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
-index 2898ac1..47b1d2f 100644
---- xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
-+++ xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
-@@ -1325,7 +1325,8 @@ void StyleBag::dump( Reference< xml::sax::XExtendedDocumentHandler > const & xOu
- //==================================================================================================
- void SAL_CALL exportDialogModel(
- Reference< xml::sax::XExtendedDocumentHandler > const & xOut,
-- Reference< container::XNameContainer > const & xDialogModel )
-+ Reference< container::XNameContainer > const & xDialogModel,
-+ Reference< frame::XModel > const & xDocument )
- SAL_THROW( (Exception) )
- {
- StyleBag all_styles;
-@@ -1373,7 +1374,7 @@ void SAL_CALL exportDialogModel(
- xProps, xPropState,
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":radio") ) );
- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readRadioButtonModel( &all_styles );
-+ pElem->readRadioButtonModel( &all_styles, xDocument );
- pRadioGroup->addSubElement( xElem );
- }
- else // no radio
-@@ -1402,7 +1403,7 @@ void SAL_CALL exportDialogModel(
- xProps, xPropState,
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":combobox") ) );
- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readComboBoxModel( &all_styles );
-+ pElem->readComboBoxModel( &all_styles, xDocument );
- }
- else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) ) )
- {
-@@ -1410,7 +1411,7 @@ void SAL_CALL exportDialogModel(
- xProps, xPropState,
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menulist") ) );
- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readListBoxModel( &all_styles );
-+ pElem->readListBoxModel( &all_styles, xDocument );
- }
- else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) ) )
- {
-@@ -1420,6 +1421,14 @@ void SAL_CALL exportDialogModel(
- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
- pElem->readGroupBoxModel( &all_styles );
- }
-+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoMultiPageModel") ) ) )
-+ {
-+ pElem = new ElementDescriptor(
-+ xProps, xPropState,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multipage") ) );
-+ xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-+ pElem->readMultiPageModel( &all_styles );
-+ }
- else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedTextModel") ) ) )
- {
- pElem = new ElementDescriptor(
-@@ -1451,7 +1460,7 @@ void SAL_CALL exportDialogModel(
- xProps, xPropState,
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":img") ) );
- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readImageControlModel( &all_styles );
-+ pElem->readImageControlModel( &all_styles, xDocument );
- }
- else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFileControlModel") ) ) )
- {
-@@ -1531,7 +1540,15 @@ void SAL_CALL exportDialogModel(
- xProps, xPropState,
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":scrollbar") ) );
- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readScrollBarModel( &all_styles );
-+ pElem->readScrollBarModel( &all_styles, xDocument );
-+ }
-+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlSpinButtonModel") ) ) )
-+ {
-+ pElem = new ElementDescriptor(
-+ xProps, xPropState,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spinbutton") ) );
-+ xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-+ pElem->readSpinButtonModel( &all_styles, xDocument );
- }
- else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlProgressBarModel") ) ) )
- {
-diff --git xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
-index 1c43cc8..37a561f 100644
---- xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
-+++ xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
-@@ -28,17 +28,195 @@
- // MARKER(update_precomp.py): autogen include statement, do not remove
- #include "precompiled_xmlscript.hxx"
- #include "imp_share.hxx"
--
-+#include <com/sun/star/form/binding/XBindableValue.hpp>
-+#include <com/sun/star/form/binding/XValueBinding.hpp>
-+#include <com/sun/star/form/binding/XListEntrySink.hpp>
-+#include <com/sun/star/beans/NamedValue.hpp>
-+#include <com/sun/star/table/CellAddress.hpp>
-+#include <com/sun/star/table/CellRangeAddress.hpp>
- #include <com/sun/star/beans/XPropertySet.hpp>
- #include <com/sun/star/beans/XPropertyState.hpp>
-+#include <com/sun/star/document/XStorageBasedDocument.hpp>
-+#include <com/sun/star/document/XGraphicObjectResolver.hpp>
-+#include <com/sun/star/script/XVBACompat.hpp>
-
--
-+#include <comphelper/componentcontext.hxx>
-+#include <comphelper/processfactory.hxx>
- using namespace ::com::sun::star;
- using namespace ::com::sun::star::uno;
- using ::rtl::OUString;
-
- namespace xmlscript
- {
-+Reference< xml::input::XElement > MultiPage::startChildElement(
-+ sal_Int32 nUid, OUString const & rLocalName,
-+ Reference< xml::input::XAttributes > const & xAttributes )
-+ throw (xml::sax::SAXException, RuntimeException)
-+{
-+ // event
-+rtl::OUString _label = rtl::OUString::createFromAscii("foo");
-+ if (_pImport->isEventElement( nUid, rLocalName ))
-+ {
-+ return new EventElement(
-+ nUid, rLocalName, xAttributes, this, _pImport );
-+ }
-+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("title") ))
-+ {
-+ getStringAttr( &_label,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
-+ xAttributes,
-+ _pImport->XMLNS_DIALOGS_UID );
-+
-+ return new ElementBase(
-+ _pImport->XMLNS_DIALOGS_UID,
-+ rLocalName, xAttributes, this, _pImport );
-+ }
-+ else
-+ {
-+
-+ throw xml::sax::SAXException(
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
-+ Reference< XInterface >(), Any() );
-+ }
-+}
-+//__________________________________________________________________________________________________
-+
-+void MultiPage::endElement()
-+ throw (xml::sax::SAXException, RuntimeException)
-+{
-+ ControlImportContext ctx(
-+ _pImport, getControlId( _xAttributes ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoMultiPageModel") ) );
-+// OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) );
-+ Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
-+
-+ Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
-+ if (xStyle.is())
-+ {
-+ StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
-+ pStyle->importTextColorStyle( xControlModel );
-+ pStyle->importTextLineColorStyle( xControlModel );
-+ pStyle->importFontStyle( xControlModel );
-+ }
-+
-+ ctx.importDefaults( 0, 0, _xAttributes ); // inherited from BulletinBoardElement
-+ ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
-+ _xAttributes );
-+ ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ),
-+ _xAttributes );
-+ ctx.importEvents( _events );
-+ // avoid ring-reference:
-+ // vector< event elements > holding event elements holding this (via _pParent)
-+ _events.clear();
-+}
-+
-+// #FIXME cut'n'pasted from xmloff/source/core/xmlimp.cxx:1251
-+// of course we need to find a common home for this helper
-+
-+bool IsPackageURL( const ::rtl::OUString& rURL )
-+{
-+ // Some quick tests: Some may rely on the package structure!
-+ sal_Int32 nLen = rURL.getLength();
-+ if( (nLen > 0 && '/' == rURL[0]) )
-+ // RFC2396 net_path or abs_path
-+ return false;
-+ else if( nLen > 1 && '.' == rURL[0] )
-+ {
-+ if( '.' == rURL[1] )
-+ // ../: We are never going up one level, so we know
-+ // it's not an external URI
-+ return false;
-+ else if( '/' == rURL[1] )
-+ // we are remaining on a level, so it's an package URI
-+ return true;
-+ }
-+
-+ // Now check for a RFC2396 schema
-+ sal_Int32 nPos = 1;
-+ while( nPos < nLen )
-+ {
-+ switch( rURL[nPos] )
-+ {
-+ case '/':
-+ // a relative path segement
-+ return true;
-+ case ':':
-+ // a schema
-+ return false;
-+ default:
-+ break;
-+ // we don't care about any other characters
-+ }
-+ ++nPos;
-+ }
-+
-+ return true;
-+}
-+
-+void importBindableAndListRangeBits( DialogImport* _pImport, const rtl::OUString sLinkedCell, const rtl::OUString & sCellRange, ControlImportContext& ctx )
-+{
-+ Reference< lang::XMultiServiceFactory > xFac( _pImport->getDocOwner(), UNO_QUERY );
-+ if ( xFac.is() && ( sLinkedCell.getLength() || sCellRange.getLength() ) )
-+ {
-+ // Set up Celllink
-+ if ( sLinkedCell.getLength() )
-+ {
-+ Reference< form::binding::XBindableValue > xBindable( ctx.getControlModel(), uno::UNO_QUERY );
-+ Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellAddressConversion" )), uno::UNO_QUERY );
-+ if ( xBindable.is() && xConvertor.is() )
-+ {
-+ table::CellAddress aAddress;
-+ xConvertor->setPropertyValue( OUSTR( "PersistentRepresentation" ), uno::makeAny( sLinkedCell ) );
-+ xConvertor->getPropertyValue( OUSTR( "Address" ) ) >>= aAddress;
-+ beans::NamedValue aArg1;
-+ aArg1.Name = OUSTR("BoundCell");
-+ aArg1.Value <<= aAddress;
-+
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[ 0 ] <<= aArg1;
-+
-+ uno::Reference< form::binding::XValueBinding > xBinding( xFac->createInstanceWithArguments( OUSTR("com.sun.star.table.CellValueBinding" ), aArgs ), uno::UNO_QUERY );
-+ xBindable->setValueBinding( xBinding );
-+
-+ }
-+ }
-+ // Set up CelllRange
-+ if ( sCellRange.getLength() )
-+ {
-+ Reference< form::binding::XListEntrySink > xListEntrySink( ctx.getControlModel(), uno::UNO_QUERY );
-+ Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellRangeAddressConversion" )), uno::UNO_QUERY );
-+ if ( xListEntrySink.is() && xConvertor.is() )
-+ {
-+ table::CellRangeAddress aAddress;
-+ xConvertor->setPropertyValue( OUSTR( "PersistentRepresentation" ), uno::makeAny( sCellRange ) );
-+ xConvertor->getPropertyValue( OUSTR( "Address" ) ) >>= aAddress;
-+ beans::NamedValue aArg1;
-+ aArg1.Name = OUSTR("CellRange");
-+ aArg1.Value <<= aAddress;
-+
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[ 0 ] <<= aArg1;
-+
-+ uno::Reference< form::binding::XListEntrySource > xSource( xFac->createInstanceWithArguments( OUSTR("com.sun.star.table.CellRangeListSource" ), aArgs ), uno::UNO_QUERY );
-+ xListEntrySink->setListEntrySource( xSource );
-+
-+ }
-+ }
-+ }
-+}
-+
-+sal_Bool isVBACompatModeOn( DialogImport* _pImport )
-+{
-+ sal_Bool bVBAMode = sal_False;
-+ Reference< script::XVBACompat > xVBACompat( _pImport->getScriptLibraryContainer(), UNO_QUERY );
-+ if( xVBACompat.is() )
-+ {
-+ bVBAMode = xVBACompat->getVBACompatModeOn();
-+ }
-+ return bVBAMode;
-+}
-
- // progessmeter
- //__________________________________________________________________________________________________
-@@ -119,10 +297,24 @@ Reference< xml::input::XElement > ScrollBarElement::startChildElement(
- void ScrollBarElement::endElement()
- throw (xml::sax::SAXException, RuntimeException)
- {
-+ OUString sService( OUSTR("com.sun.star.awt.UnoControlScrollBarModel") );
-+ // we should probably limit this to vba mode also ( leave for now )
-+ if ( isVBACompatModeOn( _pImport ) )
-+ sService = OUSTR("com.sun.star.form.component.ScrollBar");
-+
-+ OUString sLinkedCell;
-+ try
-+ {
-+ sLinkedCell = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
-+ }
-+ catch( Exception& /*e*/ )
-+ {
-+ }
-+
- ControlImportContext ctx(
- _pImport, getControlId( _xAttributes ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlScrollBarModel") ) );
--
-+ sService );
-+
- Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
- if (xStyle.is())
- {
-@@ -165,6 +357,92 @@ void ScrollBarElement::endElement()
- OUString( RTL_CONSTASCII_USTRINGPARAM("symbol-color") ),
- _xAttributes );
-
-+ // import cell-link
-+ OUString sCellRange;
-+ importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
-+
-+ ctx.importEvents( _events );
-+ // avoid ring-reference:
-+ // vector< event elements > holding event elements holding this (via _pParent)
-+ _events.clear();
-+}
-+
-+//##################################################################################################
-+
-+// spinbutton
-+//__________________________________________________________________________________________________
-+Reference< xml::input::XElement > SpinButtonElement::startChildElement(
-+ sal_Int32 nUid, OUString const & rLocalName,
-+ Reference< xml::input::XAttributes > const & xAttributes )
-+ throw (xml::sax::SAXException, RuntimeException)
-+{
-+ // event
-+ if (_pImport->isEventElement( nUid, rLocalName ))
-+ {
-+ return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
-+ }
-+ else
-+ {
-+ throw xml::sax::SAXException(
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
-+ Reference< XInterface >(), Any() );
-+ }
-+}
-+//__________________________________________________________________________________________________
-+void SpinButtonElement::endElement()
-+ throw (xml::sax::SAXException, RuntimeException)
-+{
-+ OUString sLinkedCell;
-+ try
-+ {
-+ sLinkedCell = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
-+ }
-+ catch( Exception& /*e*/ )
-+ {
-+ }
-+
-+ ControlImportContext ctx(
-+ _pImport, getControlId( _xAttributes ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.SpinButton") ) );
-+
-+ Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
-+ if (xStyle.is())
-+ {
-+ StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
-+ Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
-+ pStyle->importBackgroundColorStyle( xControlModel );
-+ pStyle->importBorderStyle( xControlModel );
-+ }
-+
-+ ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
-+ ctx.importOrientationProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
-+ _xAttributes );
-+ ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinIncrement") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("increment") ),
-+ _xAttributes );
-+ ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValue") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("curval") ),
-+ _xAttributes );
-+ ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValueMax") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("maxval") ),
-+ _xAttributes );
-+ ctx.importLongProperty( OUSTR("SpinValueMin"), OUSTR("minval"),
-+ _xAttributes );
-+ ctx.importLongProperty( OUSTR("Repeat"), OUSTR("repeat"),
-+ _xAttributes );
-+ ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat-delay"),
-+ _xAttributes );
-+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
-+ _xAttributes );
-+ ctx.importHexLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("symbol-color") ),
-+ _xAttributes );
-+ // import cell-link
-+ OUString sCellRange;
-+ importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
-+
- ctx.importEvents( _events );
- // avoid ring-reference:
- // vector< event elements > holding event elements holding this (via _pParent)
-@@ -1003,9 +1281,37 @@ void ImageControlElement::endElement()
- ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleImage") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("scale-image") ),
- _xAttributes );
-- ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM("src") ),
-- _xAttributes );
-+ rtl::OUString sURL = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "src" ) );
-+ Reference< document::XStorageBasedDocument > xDocStorage( _pImport->getDocOwner(), UNO_QUERY );
-+
-+ if ( xDocStorage.is() && IsPackageURL( sURL ) )
-+ {
-+ uno::Sequence< Any > aArgs( 1 );
-+ aArgs[ 0 ] <<= xDocStorage->getDocumentStorage();
-+
-+ ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
-+ uno::Reference< document::XGraphicObjectResolver > xGraphicResolver;
-+ aContext.createComponentWithArguments( OUSTR( "com.sun.star.comp.Svx.GraphicImportHelper" ), aArgs, xGraphicResolver );
-+
-+ if ( xGraphicResolver.is() )
-+ {
-+ rtl::OUString aTmp( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.Package:" ) );
-+ aTmp += sURL;
-+ sURL = xGraphicResolver->resolveGraphicObjectURL( aTmp );
-+ Reference< beans::XPropertySet > xProps( ctx.getControlModel(), UNO_QUERY );
-+ // we must set the url while the graphic object ( held by the resolver is in scope )
-+ if ( xProps.is() )
-+ xProps->setPropertyValue( OUSTR("ImageURL"), makeAny( sURL ) );
-+ }
-+ }
-+
-+ else if ( sURL.getLength() > 0 )
-+ {
-+ Reference< beans::XPropertySet > xProps( ctx.getControlModel(), UNO_QUERY );
-+ if ( xProps.is() )
-+ xProps->setPropertyValue( OUSTR("ImageURL"), makeAny( sURL ) );
-+ }
-+
- ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
- _xAttributes );
-@@ -1338,10 +1644,24 @@ void TitledBoxElement::endElement()
- Reference< xml::input::XElement > xRadio( _radios[ nPos ] );
- Reference< xml::input::XAttributes > xAttributes(
- xRadio->getAttributes() );
-+ OUString sLinkedCell;
-+ OUString sCellRange;
-+ OUString sService( OUSTR("com.sun.star.awt.UnoControlRadioButtonModel") );
-+ try
-+ {
-+ sLinkedCell = xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
-+ // we should probably limit this to vba mode also ( leave for now )
-+ if ( isVBACompatModeOn( _pImport ) )
-+ sService = OUSTR("com.sun.star.form.component.RadioButton");
-+ }
-+ catch( Exception& /*e*/ )
-+ {
-+ }
-+
-
- ControlImportContext ctx(
- _pImport, getControlId( xAttributes ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) );
-+ sService );
- Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
-
- Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) );
-@@ -1377,6 +1697,9 @@ void TitledBoxElement::endElement()
- ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
- xAttributes );
-+ ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("GroupName") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("group-name") ),
-+ xAttributes );
-
- sal_Int16 nVal = 0;
- sal_Bool bChecked = sal_False;
-@@ -1390,7 +1713,7 @@ void TitledBoxElement::endElement()
- }
- xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
- makeAny( nVal ) );
--
-+ importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
- ::std::vector< Reference< xml::input::XElement > > * radioEvents =
- static_cast< RadioElement * >( xRadio.get() )->getEvents();
- ctx.importEvents( *radioEvents );
-@@ -1466,10 +1789,23 @@ void RadioGroupElement::endElement()
- Reference< xml::input::XElement > xRadio( _radios[ nPos ] );
- Reference< xml::input::XAttributes > xAttributes(
- xRadio->getAttributes() );
-+ OUString sLinkedCell;
-+ OUString sCellRange;
-+ OUString sService( OUSTR("com.sun.star.awt.UnoControlRadioButtonModel") );
-+ try
-+ {
-+ sLinkedCell = xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
-+ // we should probably limit this to vba mode also ( leave for now )
-+ if ( isVBACompatModeOn( _pImport ) )
-+ sService = OUSTR("com.sun.star.form.component.RadioButton");
-+ }
-+ catch( Exception& /*e*/ )
-+ {
-+ }
-
- ControlImportContext ctx(
- _pImport, getControlId( xAttributes ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) );
-+ sService );
- Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
-
- Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) );
-@@ -1505,6 +1841,9 @@ void RadioGroupElement::endElement()
- ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
- xAttributes );
-+ ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("GroupName") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("group-name") ),
-+ xAttributes );
- sal_Int16 nVal = 0;
- sal_Bool bChecked = sal_False;
- if (getBoolAttr( &bChecked,
-@@ -1518,6 +1857,7 @@ void RadioGroupElement::endElement()
- xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
- makeAny( nVal ) );
-
-+ importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
- ::std::vector< Reference< xml::input::XElement > > * radioEvents =
- static_cast< RadioElement * >( xRadio.get() )->getEvents();
- ctx.importEvents( *radioEvents );
-@@ -1638,9 +1978,26 @@ Reference< xml::input::XElement > MenuListElement::startChildElement(
- void MenuListElement::endElement()
- throw (xml::sax::SAXException, RuntimeException)
- {
-+ OUString sLinkedCell;
-+ OUString sCellRange;
-+ OUString sListBoxService( OUSTR("com.sun.star.awt.UnoControlListBoxModel") );
-+
-+ // we should probably limit this to vba mode also ( leave for now )
-+ if ( isVBACompatModeOn( _pImport ) )
-+ sListBoxService = OUSTR("com.sun.star.form.component.ListBox");
-+
-+ try
-+ {
-+ sLinkedCell = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
-+ sCellRange = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "source-cell-range" ) );
-+ }
-+ catch( Exception& /*e*/ )
-+ {
-+ }
- ControlImportContext ctx(
- _pImport, getControlId( _xAttributes ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) );
-+ //OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) );
-+ sListBoxService );
- Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
-
- Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
-@@ -1673,13 +2030,16 @@ void MenuListElement::endElement()
- ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
- _xAttributes );
--
-+ // import cell-link and cell source range
-+ importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
- if (_popup.is())
- {
- MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() );
-- xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ),
-+ if ( !sCellRange.getLength() )
-+ xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ),
- makeAny( p->getItemValues() ) );
-- xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") ),
-+ if ( !sLinkedCell.getLength() )
-+ xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") ),
- makeAny( p->getSelectedItems() ) );
- }
- ctx.importEvents( _events );
-@@ -1725,9 +2085,26 @@ Reference< xml::input::XElement > ComboBoxElement::startChildElement(
- void ComboBoxElement::endElement()
- throw (xml::sax::SAXException, RuntimeException)
- {
-+ OUString sService( OUSTR("com.sun.star.awt.UnoControlComboBoxModel") );
-+
-+ // we should probably limit this to vba mode also ( leave for now )
-+ if ( isVBACompatModeOn( _pImport ) )
-+ sService = OUSTR("com.sun.star.form.component.ComboBox");
-+
-+ OUString sLinkedCell;
-+ OUString sCellRange;
-+ try
-+ {
-+ sLinkedCell = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
-+ sCellRange = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "source-cell-range" ) );
-+ }
-+ catch( Exception& /*e*/ )
-+ {
-+ }
-+
- ControlImportContext ctx(
- _pImport, getControlId( _xAttributes ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ) );
-+ sService );
- Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
-
- Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
-@@ -1769,8 +2146,10 @@ void ComboBoxElement::endElement()
- ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
- _xAttributes );
-+ // import cell-link and cell source range
-+ importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
-
-- if (_popup.is())
-+ if (_popup.is() && !sCellRange.getLength() )
- {
- MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() );
- xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ),
-@@ -2096,10 +2475,19 @@ Reference< xml::input::XElement > BulletinBoardElement::startChildElement(
- {
- return new ScrollBarElement( rLocalName, xAttributes, this, _pImport );
- }
-+ // spinbutton
-+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("spinbutton") ) && isVBACompatModeOn( _pImport ) )
-+ {
-+ return new SpinButtonElement( rLocalName, xAttributes, this, _pImport );
-+ }
- // progressmeter
- else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("progressmeter") ))
- {
- return new ProgressBarElement( rLocalName, xAttributes, this, _pImport );
-+ }
-+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("multipage") ))
-+ {
-+ return new MultiPage( rLocalName, xAttributes, this, _pImport );
- }
- // bulletinboard
- else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bulletinboard") ))
-diff --git xmlscript/source/xmldlg_imexp/xmldlg_import.cxx xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
-index f3c0e55..0f03070 100644
---- xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
-+++ xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
-@@ -57,9 +57,13 @@
- #include <com/sun/star/script/ScriptEventDescriptor.hpp>
-
- #include <com/sun/star/view/SelectionType.hpp>
-+#include <com/sun/star/document/XStorageBasedDocument.hpp>
-+#include <com/sun/star/script/DocumentScriptLibraryContainer.hpp>
-+#include <com/sun/star/script/XVBACompat.hpp>
-
- using namespace ::com::sun::star;
- using namespace ::com::sun::star::uno;
-+using namespace ::com::sun::star::frame;
- using ::rtl::OUString;
-
- namespace xmlscript
-@@ -1888,18 +1892,42 @@ Reference< xml::input::XElement > DialogImport::getStyle(
- }
- return 0;
- }
-+//__________________________________________________________________________________________________
-+Reference< script::XLibraryContainer > DialogImport::getScriptLibraryContainer()
-+{
-+ if( !_xScriptLibraryContainer.is() )
-+ {
-+ try
-+ {
-+ Reference< beans::XPropertySet > xProps( _xDoc, UNO_QUERY );
-+ if( xProps.is() )
-+ _xScriptLibraryContainer.set( xProps->getPropertyValue( OUSTR("BasicLibraries") ), UNO_QUERY );
-+ }
-+ catch( const Exception& )
-+ {
-+ }
-+ }
-+
-+ return _xScriptLibraryContainer;
-+}
-
- //##################################################################################################
-
- //==================================================================================================
- Reference< xml::sax::XDocumentHandler > SAL_CALL importDialogModel(
- Reference< container::XNameContainer > const & xDialogModel,
-- Reference< XComponentContext > const & xContext )
-+ Reference< XComponentContext > const & xContext,
-+ Reference< XModel > const & xDocument )
- SAL_THROW( (Exception) )
- {
-+ DialogImport* pImport = new DialogImport( xContext, xDialogModel, xDocument );
-+ uno::Reference< script::XVBACompat > xVBAModeSource( pImport->getScriptLibraryContainer(), uno::UNO_QUERY );
-+
-+ uno::Reference< beans::XPropertySet > xDlgProps( xDialogModel, uno::UNO_QUERY );
-+ if ( xVBAModeSource.is() && xDlgProps.is() && xVBAModeSource->getVBACompatModeOn() )
-+ xDlgProps->setPropertyValue( OUSTR("VBAForm"), uno::makeAny( sal_True ) );
- return ::xmlscript::createDocumentHandler(
-- static_cast< xml::input::XRoot * >(
-- new DialogImport( xContext, xDialogModel ) ) );
-+ static_cast< xml::input::XRoot * >( pImport ) );
- }
-
- }
-diff --git xmlscript/util/makefile.mk xmlscript/util/makefile.mk
-index 3ccf63d..7a391cd 100644
---- xmlscript/util/makefile.mk
-+++ xmlscript/util/makefile.mk
-@@ -54,6 +54,7 @@ SHL1LIBS= \
- $(LIB1TARGET)
-
- SHL1STDLIBS= \
-+ $(COMPHELPERLIB) \
- $(CPPUHELPERLIB) \
- $(CPPULIB) \
- $(SALLIB)
diff --git a/patches/vba/enhanced-form-userform-controls.diff b/patches/vba/enhanced-form-userform-controls.diff
deleted file mode 100644
index 997afe9ce..000000000
--- a/patches/vba/enhanced-form-userform-controls.diff
+++ /dev/null
@@ -1,2031 +0,0 @@
---- basctl/source/basicide/baside3.cxx.old 2009-04-02 10:56:36.000000000 +0000
-+++ basctl/source/basicide/baside3.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -112,7 +112,7 @@ DialogWindow::DialogWindow( Window* pPar
- {
- InitSettings( TRUE, TRUE, TRUE );
-
-- pEditor = new DlgEditor();
-+ pEditor = new DlgEditor( rDocument.getDocument() );
- pEditor->SetWindow( this );
- pEditor->SetDialog( xDialogModel );
-
-@@ -724,7 +724,7 @@ BOOL DialogWindow::SaveDialog()
- Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
- OSL_ASSERT( xProps.is() );
- OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
-- Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext );
-+ Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, GetDocument().getDocument() );
- Reference< XInputStream > xInput( xISP->createInputStream() );
-
- Reference< XSimpleFileAccess > xSFI( xMSF->createInstance
-@@ -942,7 +942,7 @@ void DialogWindow::StoreData()
- Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
- OSL_ASSERT( xProps.is() );
- OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
-- Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext );
-+ Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, GetDocument().getDocument() );
- xLib->replaceByName( ::rtl::OUString( GetName() ), makeAny( xISP ) );
- }
- }
---- basctl/source/basicide/basides3.cxx.old 2009-04-02 10:56:36.000000000 +0000
-+++ basctl/source/basicide/basides3.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -98,7 +98,7 @@ DialogWindow* BasicIDEShell::CreateDlgWi
- Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
- OSL_ASSERT( xProps.is() );
- OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
-- ::xmlscript::importDialogModel( xInput, xDialogModel, xContext );
-+ ::xmlscript::importDialogModel( xInput, xDialogModel, xContext, rDocument.getDocument() );
- LocalizationMgr::setStringResourceAtDialog( rDocument, rLibName, aDlgName, xDialogModel );
-
- // new dialog window
---- basctl/source/basicide/moduldlg.cxx.old 2009-04-02 10:56:36.000000000 +0000
-+++ basctl/source/basicide/moduldlg.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -315,7 +315,7 @@ void BasicIDEShell::CopyDialogResources(
- Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
- OSL_ASSERT( xProps.is() );
- OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
-- ::xmlscript::importDialogModel( xInput, xDialogModel, xContext );
-+ ::xmlscript::importDialogModel( xInput, xDialogModel, xContext, rSourceDoc.getDocument() );
-
- if( xDialogModel.is() )
- {
-@@ -332,7 +332,7 @@ void BasicIDEShell::CopyDialogResources(
- {
- LocalizationMgr::setResourceIDsForDialog( xDialogModel, xDestMgr );
- }
-- io_xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext );
-+ io_xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, rDestDoc.getDocument() );
- }
- }
-
---- basctl/source/basicide/scriptdocument.cxx.old 2009-04-02 10:56:36.000000000 +0000
-+++ basctl/source/basicide/scriptdocument.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -661,7 +661,7 @@ namespace basctl
- if ( !_rxExistingDialogModel.is() )
- {
- Reference< XInputStream > xInput( xISP->createInputStream(), UNO_QUERY_THROW );
-- ::xmlscript::importDialogModel( xInput, xDialogModel, aContext.getUNOContext() );
-+ ::xmlscript::importDialogModel( xInput, xDialogModel, aContext.getUNOContext(), getDocument() );
- }
-
- // set new name as property
-@@ -669,7 +669,7 @@ namespace basctl
- xDlgPSet->setPropertyValue( DLGED_PROP_NAME, makeAny( _rNewName ) );
-
- // export dialog model
-- xISP = ::xmlscript::exportDialogModel( xDialogModel, aContext.getUNOContext() );
-+ xISP = ::xmlscript::exportDialogModel( xDialogModel, aContext.getUNOContext(), getDocument() );
- aElement <<= xISP;
- }
-
-@@ -772,7 +772,7 @@ namespace basctl
- xDlgPSet->setPropertyValue( DLGED_PROP_NAME, makeAny( _rDialogName ) );
-
- // export dialog model
-- _out_rDialogProvider = ::xmlscript::exportDialogModel( xDialogModel, aContext.getUNOContext() );
-+ _out_rDialogProvider = ::xmlscript::exportDialogModel( xDialogModel, aContext.getUNOContext(), getDocument() );
-
- // insert dialog into library
- xLib->insertByName( _rDialogName, makeAny( _out_rDialogProvider ) );
---- basctl/source/dlged/dlged.cxx.old 2009-04-02 10:56:34.000000000 +0000
-+++ basctl/source/dlged/dlged.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -208,7 +208,7 @@ BOOL DlgEditor::RemarkDialog()
-
- //----------------------------------------------------------------------------
-
--DlgEditor::DlgEditor()
-+DlgEditor::DlgEditor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel )
- :pHScroll(NULL)
- ,pVScroll(NULL)
- ,pDlgEdModel(NULL)
-@@ -230,6 +230,7 @@ DlgEditor::DlgEditor()
- ,bCreateOK(TRUE)
- ,bDialogModelChanged(FALSE)
- ,mnPaintGuard(0)
-+ ,m_xDocument( xModel )
- {
- pDlgEdModel = new DlgEdModel();
- pDlgEdModel->GetItemPool().FreezeIdRanges();
-@@ -838,7 +839,7 @@ void DlgEditor::Copy()
- Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
- OSL_ASSERT( xProps.is() );
- OSL_VERIFY( xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
-- Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xClipDialogModel, xContext );
-+ Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xClipDialogModel, xContext, m_xDocument );
- Reference< XInputStream > xStream( xISP->createInputStream() );
- Sequence< sal_Int8 > DialogModelBytes;
- implCopyStreamToByteSequence( xStream, DialogModelBytes );
-@@ -871,7 +872,7 @@ void DlgEditor::Copy()
- uno::Reference< resource::XStringResourceManager >
- xStringResourceManager( xStringResourcePersistence, uno::UNO_QUERY );
- LocalizationMgr::resetResourceForDialog( xClipDialogModel, xStringResourceManager );
-- Reference< XInputStreamProvider > xISP2 = ::xmlscript::exportDialogModel( xClipDialogModel, xContext );
-+ Reference< XInputStreamProvider > xISP2 = ::xmlscript::exportDialogModel( xClipDialogModel, xContext, m_xDocument );
- Reference< XInputStream > xStream2( xISP2->createInputStream() );
- Sequence< sal_Int8 > NoResourceDialogModelBytes;
- implCopyStreamToByteSequence( xStream2, NoResourceDialogModelBytes );
-@@ -1017,7 +1018,7 @@ void DlgEditor::Paste()
- Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
- OSL_ASSERT( xProps.is() );
- OSL_VERIFY( xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
-- ::xmlscript::importDialogModel( ::xmlscript::createInputStream( *((::rtl::ByteSequence*)(&DialogModelBytes)) ) , xClipDialogModel, xContext );
-+ ::xmlscript::importDialogModel( ::xmlscript::createInputStream( *((::rtl::ByteSequence*)(&DialogModelBytes)) ) , xClipDialogModel, xContext, m_xDocument );
- }
-
- // get control models from clipboard dialog model
---- basctl/source/inc/dlged.hxx.old 2009-04-02 10:56:36.000000000 +0000
-+++ basctl/source/inc/dlged.hxx 2009-04-06 16:41:59.000000000 +0000
-@@ -35,6 +35,7 @@
- #include <com/sun/star/awt/XControlContainer.hpp>
- #include <com/sun/star/datatransfer/DataFlavor.hpp>
- #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
-+#include <com/sun/star/frame/XModel.hpp>
- #include <tools/link.hxx>
- #include <tools/gen.hxx>
- #include <vcl/timer.hxx>
-@@ -129,9 +130,11 @@ protected:
- BOOL bDialogModelChanged;
- Timer aMarkTimer;
- long mnPaintGuard;
-+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xDocument;
-
-+ DlgEditor(); // not implemented
- public:
-- DlgEditor();
-+ DlgEditor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel );
- ~DlgEditor();
-
- void SetWindow( Window* pWindow );
---- basic/source/classes/eventatt.cxx.old 2009-04-02 10:49:17.000000000 +0000
-+++ basic/source/classes/eventatt.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -58,7 +58,10 @@
- #include <com/sun/star/awt/XDialogProvider.hpp>
-
- #include <com/sun/star/frame/XModel.hpp>
--
-+#include <com/sun/star/frame/XDesktop.hpp>
-+#include <com/sun/star/container/XEnumerationAccess.hpp>
-+#include <basic/basicmanagerrepository.hxx>
-+#include <basic/basmgr.hxx>
- //==================================================================================================
-
- #include <xmlscript/xmldlg_imexp.hxx>
-@@ -458,6 +461,43 @@ Any implFindDialogLibForDialog( const An
- return aRetDlgLibAny;
- }
-
-+Any implFindDialogLibForDialogBasic( const Any& aAnyISP, SbxObject* pBasic, StarBASIC*& pFoundBasic )
-+{
-+ Any aDlgLibAny;
-+ // Find dialog library for dialog, direct access is not possible here
-+ StarBASIC* pStartedBasic = (StarBASIC*)pBasic;
-+ SbxObject* pParentBasic = pStartedBasic ? pStartedBasic->GetParent() : NULL;
-+ SbxObject* pParentParentBasic = pParentBasic ? pParentBasic->GetParent() : NULL;
-+
-+ SbxObject* pSearchBasic1 = NULL;
-+ SbxObject* pSearchBasic2 = NULL;
-+ if( pParentParentBasic )
-+ {
-+ pSearchBasic1 = pParentBasic;
-+ pSearchBasic2 = pParentParentBasic;
-+ }
-+ else
-+ {
-+ pSearchBasic1 = pStartedBasic;
-+ pSearchBasic2 = pParentBasic;
-+ }
-+ if( pSearchBasic1 )
-+ {
-+ aDlgLibAny = implFindDialogLibForDialog( aAnyISP, pSearchBasic1 );
-+
-+ if ( aDlgLibAny.hasValue() )
-+ pFoundBasic = (StarBASIC*)pSearchBasic1;
-+
-+ else if( pSearchBasic2 )
-+ {
-+ aDlgLibAny = implFindDialogLibForDialog( aAnyISP, pSearchBasic2 );
-+ if ( aDlgLibAny.hasValue() )
-+ pFoundBasic = (StarBASIC*)pSearchBasic2;
-+ }
-+ }
-+ return aDlgLibAny;
-+}
-+
- static ::rtl::OUString aDecorationPropName =
- ::rtl::OUString::createFromAscii( "Decoration" );
- static ::rtl::OUString aTitlePropName =
-@@ -537,39 +577,51 @@ void RTL_Impl_CreateUnoDialog( StarBASIC
- {}
- }
-
-- // Find dialog library for dialog, direct access is not possible here
-- StarBASIC* pStartedBasic = pINST->GetBasic();
-- SbxObject* pParentBasic = pStartedBasic ? pStartedBasic->GetParent() : NULL;
-- SbxObject* pParentParentBasic = pParentBasic ? pParentBasic->GetParent() : NULL;
--
-- SbxObject* pSearchBasic1 = NULL;
-- SbxObject* pSearchBasic2 = NULL;
-- if( pParentParentBasic )
-- {
-- pSearchBasic1 = pParentBasic;
-- pSearchBasic2 = pParentParentBasic;
-- }
-- else
-- {
-- pSearchBasic1 = pStartedBasic;
-- pSearchBasic2 = pParentBasic;
-- }
--
- Any aDlgLibAny;
-- if( pSearchBasic1 )
-- {
-- aDlgLibAny = implFindDialogLibForDialog( aAnyISP, pSearchBasic1 );
-- if( pSearchBasic2 && aDlgLibAny.getValueType().getTypeClass() == TypeClass_VOID )
-- aDlgLibAny = implFindDialogLibForDialog( aAnyISP, pSearchBasic2 );
-- }
--
--
-+ bool bDocDialog = false;
-+ StarBASIC* pFoundBasic = NULL;
- OSL_TRACE("About to try get a hold of ThisComponent");
-- Reference< frame::XModel > xModel = getModelFromBasic( pStartedBasic ) ;
-- Reference< XScriptListener > xScriptListener = new BasicScriptListener_Impl( pStartedBasic, xModel );
-+ Reference< frame::XModel > xModel = getModelFromBasic( pINST->GetBasic() ) ;
-+ aDlgLibAny = implFindDialogLibForDialogBasic( aAnyISP, pINST->GetBasic(), pFoundBasic );
-+ // If we found the dialog then it belongs to the Search basic
-+ if ( !pFoundBasic )
-+ {
-+ Reference< frame::XDesktop > xDesktop( xMSF->createInstance
-+ ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ) ),
-+ UNO_QUERY );
-+ Reference< container::XEnumeration > xModels;
-+ if ( xDesktop.is() )
-+ {
-+ Reference< container::XEnumerationAccess > xComponents( xDesktop->getComponents(), UNO_QUERY );
-+ if ( xComponents.is() )
-+ xModels.set( xComponents->createEnumeration(), UNO_QUERY );
-+ if ( xModels.is() )
-+ {
-+ while ( xModels->hasMoreElements() )
-+ {
-+ Reference< frame::XModel > xNextModel( xModels->nextElement(), UNO_QUERY );
-+ if ( xNextModel.is() )
-+ {
-+ BasicManager* pMgr = basic::BasicManagerRepository::getDocumentBasicManager( xNextModel );
-+ if ( pMgr )
-+ aDlgLibAny = implFindDialogLibForDialogBasic( aAnyISP, pMgr->GetLib(0), pFoundBasic );
-+ if ( aDlgLibAny.hasValue() )
-+ {
-+ bDocDialog = true;
-+ xModel = xNextModel;
-+ break;
-+ }
-+ }
-+ }
-+ }
-+ }
-+ }
-+ if ( pFoundBasic )
-+ bDocDialog = pFoundBasic->IsDocBasic();
-+ Reference< XScriptListener > xScriptListener = new BasicScriptListener_Impl( pINST->GetBasic(), xModel );
-
- Sequence< Any > aArgs( 4 );
-- aArgs[ 0 ] <<= xModel;
-+ aArgs[ 0 ] <<= bDocDialog ? xModel : uno::Reference< uno::XInterface >();
- aArgs[ 1 ] <<= xInput;
- aArgs[ 2 ] = aDlgLibAny;
- aArgs[ 3 ] <<= xScriptListener;
---- basic/source/uno/dlgcont.cxx.old 2009-04-06 16:41:59.000000000 +0000
-+++ basic/source/uno/dlgcont.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -322,7 +322,7 @@ Any SAL_CALL SfxDialogLibraryContainer::
-
- try {
- // start parsing
-- xParser->setDocumentHandler( ::xmlscript::importDialogModel( xDialogModel, xContext ) );
-+ xParser->setDocumentHandler( ::xmlscript::importDialogModel( xDialogModel, xContext, mxOwnerDocument ) );
- xParser->parseStream( source );
- }
- catch( Exception& )
-@@ -336,7 +336,7 @@ Any SAL_CALL SfxDialogLibraryContainer::
-
- // Create InputStream, TODO: Implement own InputStreamProvider
- // to avoid creating the DialogModel here!
-- Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext );
-+ Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, mxOwnerDocument );
- aRetAny <<= xISP;
- return aRetAny;
- }
---- extensions/source/propctrlr/defaultforminspection.cxx.old 2009-04-02 10:51:17.000000000 +0000
-+++ extensions/source/propctrlr/defaultforminspection.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -154,7 +154,7 @@ namespace pcr
- { "com.sun.star.form.inspection.EventHandler", false },
-
- // a handler which introduces virtual properties for binding controls to spreadsheet cells
-- { "com.sun.star.form.inspection.CellBindingPropertyHandler", true },
-+ { "com.sun.star.form.inspection.CellBindingPropertyHandler", false },
-
- // properties related to binding to an XForms DOM node
- { "com.sun.star.form.inspection.XMLFormsPropertyHandler", true },
---- sc/inc/addruno.hxx.old 2009-04-02 10:45:43.000000000 +0000
-+++ sc/inc/addruno.hxx 2009-04-06 16:41:59.000000000 +0000
-@@ -50,7 +50,7 @@ private:
- sal_Int32 nRefSheet;
- sal_Bool bIsRange;
-
-- sal_Bool ParseUIString( const String& rUIString );
-+ sal_Bool ParseUIString( const String& rUIString, ::formula::FormulaGrammar::AddressConvention eConv = ::formula::FormulaGrammar::CONV_OOO );
-
- public:
-
---- sc/inc/unonames.hxx.old 2009-04-06 16:41:58.000000000 +0000
-+++ sc/inc/unonames.hxx 2009-04-06 16:41:59.000000000 +0000
-@@ -599,6 +599,7 @@
- #define SC_UNONAME_ADDRESS "Address"
- #define SC_UNONAME_UIREPR "UserInterfaceRepresentation"
- #define SC_UNONAME_PERSREPR "PersistentRepresentation"
-+#define SC_UNONAME_XL_A1_REPR "XL_A1_Representation"
- #define SC_UNONAME_REFSHEET "ReferenceSheet"
-
- // --> PB 2004-08-23 #i33095# Security Options
---- sc/source/ui/unoobj/addruno.cxx.old 2009-04-02 10:45:26.000000000 +0000
-+++ sc/source/ui/unoobj/addruno.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -72,7 +72,7 @@ void ScAddressConversionObj::Notify( Sfx
- }
- }
-
--sal_Bool ScAddressConversionObj::ParseUIString( const String& rUIString )
-+sal_Bool ScAddressConversionObj::ParseUIString( const String& rUIString, ::formula::FormulaGrammar::AddressConvention eConv )
- {
- if (!pDocShell)
- return sal_False;
-@@ -81,7 +81,7 @@ sal_Bool ScAddressConversionObj::ParseUI
- sal_Bool bSuccess = sal_False;
- if ( bIsRange )
- {
-- USHORT nResult = aRange.ParseAny( rUIString, pDoc );
-+ USHORT nResult = aRange.ParseAny( rUIString, pDoc, eConv );
- if ( nResult & SCA_VALID )
- {
- if ( ( nResult & SCA_TAB_3D ) == 0 )
-@@ -95,7 +95,7 @@ sal_Bool ScAddressConversionObj::ParseUI
- }
- else
- {
-- USHORT nResult = aRange.aStart.Parse( rUIString, pDoc );
-+ USHORT nResult = aRange.aStart.Parse( rUIString, pDoc, eConv );
- if ( nResult & SCA_VALID )
- {
- if ( ( nResult & SCA_TAB_3D ) == 0 )
-@@ -119,6 +119,7 @@ uno::Reference<beans::XPropertySetInfo>
- {
- {MAP_CHAR_LEN(SC_UNONAME_ADDRESS), 0, &getCppuType((table::CellRangeAddress*)0), 0, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_PERSREPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
-+ {MAP_CHAR_LEN(SC_UNONAME_XL_A1_REPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_REFSHEET), 0, &getCppuType((sal_Int32*)0), 0, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_UIREPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
- {0,0,0,0,0,0}
-@@ -132,6 +133,7 @@ uno::Reference<beans::XPropertySetInfo>
- {
- {MAP_CHAR_LEN(SC_UNONAME_ADDRESS), 0, &getCppuType((table::CellAddress*)0), 0, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_PERSREPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
-+ {MAP_CHAR_LEN(SC_UNONAME_XL_A1_REPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_REFSHEET), 0, &getCppuType((sal_Int32*)0), 0, 0 },
- {MAP_CHAR_LEN(SC_UNONAME_UIREPR), 0, &getCppuType((rtl::OUString*)0), 0, 0 },
- {0,0,0,0,0,0}
-@@ -193,8 +195,11 @@ void SAL_CALL ScAddressConversionObj::se
- bSuccess = ParseUIString( aUIString );
- }
- }
-- else if ( aNameStr.EqualsAscii( SC_UNONAME_PERSREPR ) )
-+ else if ( aNameStr.EqualsAscii( SC_UNONAME_PERSREPR ) || aNameStr.EqualsAscii( SC_UNONAME_XL_A1_REPR ) )
- {
-+ ::formula::FormulaGrammar::AddressConvention aConv = ::formula::FormulaGrammar::CONV_OOO;
-+ if ( aNameStr.EqualsAscii( SC_UNONAME_XL_A1_REPR ) )
-+ aConv = ::formula::FormulaGrammar::CONV_XL_A1;
- // parse the file format string
- rtl::OUString sRepresentation;
- if (aValue >>= sRepresentation)
-@@ -215,7 +220,7 @@ void SAL_CALL ScAddressConversionObj::se
- }
-
- // parse the rest like a UI string
-- bSuccess = ParseUIString( aUIString );
-+ bSuccess = ParseUIString( aUIString, aConv );
- }
- }
- else
-@@ -268,17 +273,24 @@ uno::Any SAL_CALL ScAddressConversionObj
- aRange.aStart.Format( aFormatStr, nFlags, pDoc );
- aRet <<= rtl::OUString( aFormatStr );
- }
-- else if ( aNameStr.EqualsAscii( SC_UNONAME_PERSREPR ) )
-+ else if ( aNameStr.EqualsAscii( SC_UNONAME_PERSREPR ) || aNameStr.EqualsAscii( SC_UNONAME_XL_A1_REPR ) )
- {
-+ ::formula::FormulaGrammar::AddressConvention aConv = ::formula::FormulaGrammar::CONV_OOO;
-+ if ( aNameStr.EqualsAscii( SC_UNONAME_XL_A1_REPR ) )
-+ aConv = ::formula::FormulaGrammar::CONV_XL_A1;
-+
- // generate file format string - always include sheet
- String aFormatStr;
-- aRange.aStart.Format( aFormatStr, SCA_VALID | SCA_TAB_3D, pDoc );
-+ aRange.aStart.Format( aFormatStr, SCA_VALID | SCA_TAB_3D, pDoc, aConv );
- if ( bIsRange )
- {
- // manually concatenate range so both parts always have the sheet name
- aFormatStr.Append( (sal_Unicode) ':' );
- String aSecond;
-- aRange.aEnd.Format( aSecond, SCA_VALID | SCA_TAB_3D, pDoc );
-+ USHORT nFlags = SCA_VALID;
-+ if( aConv != ::formula::FormulaGrammar::CONV_XL_A1 )
-+ nFlags |= SCA_TAB_3D;
-+ aRange.aEnd.Format( aSecond, SCA_VALID | SCA_TAB_3D, pDoc, aConv );
- aFormatStr.Append( aSecond );
- }
- aRet <<= rtl::OUString( aFormatStr );
---- scripting/source/dlgprov/dlgevtatt.cxx.old 2009-04-02 10:36:33.000000000 +0000
-+++ scripting/source/dlgprov/dlgevtatt.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -399,7 +399,7 @@ namespace dlgprov
-
- void DialogAllListenerImpl::firing( const AllEventObject& Event ) throw ( RuntimeException )
- {
-- ::osl::MutexGuard aGuard( getMutex() );
-+ //::osl::MutexGuard aGuard( getMutex() );
-
- firing_impl( Event, NULL );
- }
-@@ -409,7 +409,7 @@ namespace dlgprov
- Any DialogAllListenerImpl::approveFiring( const AllEventObject& Event )
- throw ( reflection::InvocationTargetException, RuntimeException )
- {
-- ::osl::MutexGuard aGuard( getMutex() );
-+ //::osl::MutexGuard aGuard( getMutex() );
-
- Any aReturn;
- firing_impl( Event, &aReturn );
-@@ -653,7 +653,7 @@ namespace dlgprov
-
- void DialogScriptListenerImpl::firing( const ScriptEvent& aScriptEvent ) throw ( RuntimeException )
- {
-- ::osl::MutexGuard aGuard( getMutex() );
-+ //::osl::MutexGuard aGuard( getMutex() );
-
- firing_impl( aScriptEvent, NULL );
- }
-@@ -663,7 +663,7 @@ namespace dlgprov
- Any DialogScriptListenerImpl::approveFiring( const ScriptEvent& aScriptEvent )
- throw ( reflection::InvocationTargetException, RuntimeException )
- {
-- ::osl::MutexGuard aGuard( getMutex() );
-+ //::osl::MutexGuard aGuard( getMutex() );
-
- Any aReturn;
- firing_impl( aScriptEvent, &aReturn );
---- scripting/source/dlgprov/dlgprov.cxx.old 2009-04-02 10:36:33.000000000 +0000
-+++ scripting/source/dlgprov/dlgprov.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -196,7 +196,15 @@ static ::rtl::OUString aResourceResolver
- Reference< beans::XPropertySet > xDlgPropSet( xDialogModel, UNO_QUERY );
- xDlgPropSet->setPropertyValue( aDlgSrcUrlPropName, aDialogSourceURL );
-
-- ::xmlscript::importDialogModel( xInput, xDialogModel, m_xContext );
-+ // #TODO we really need to detect the source of the Dialog, is it
-+ // located in the document or not. m_xModel need not be the location of
-+ // the dialog. E.g. if the dialog was created from basic ( then we just
-+ // can't tell where its from )
-+ // If we are happy to always substitute the form model for the awt
-+ // one then maybe the presence of a document model is enough to trigger
-+ // swapping out the models ( or perhaps we only want to do this
-+ // for vba mode ) there are a number of feasible and valid possibilities
-+ ::xmlscript::importDialogModel( xInput, xDialogModel, m_xContext, m_xModel );
- // Set resource property
- if( xStringResourceManager.is() )
- {
-@@ -656,7 +664,10 @@ static ::rtl::OUString aResourceResolver
- aArguments[0] >>= m_xModel;
- m_BasicInfo.reset( new BasicRTLParams() );
- m_BasicInfo->mxInput.set( aArguments[ 1 ], UNO_QUERY_THROW );
-- m_BasicInfo->mxDlgLib.set( aArguments[ 2 ], UNO_QUERY_THROW );
-+ // allow null mxDlgLib, a document dialog instantiated from
-+ // from application basic is unable to provide ( or find ) it's
-+ // Library
-+ aArguments[ 2 ] >>= m_BasicInfo->mxDlgLib;
- // leave the possibility to optionally allow the old dialog creation
- // to use the new XScriptListener ( which converts the old style macro
- // to a SF url )
---- svtools/inc/bindablecontrolhelper.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ svtools/inc/bindablecontrolhelper.hxx 2009-04-06 16:41:59.000000000 +0000
-@@ -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: imageresourceaccess.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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef SVTOOLS_INC_BINDABLECONTROL_HXX
-+#define SVTOOLS_INC_BINDABLECONTROL_HXX
-+
-+#include "svtools/svtdllapi.h"
-+
-+#include <com/sun/star/frame/XModel.hpp>
-+//........................................................................
-+namespace svt
-+{
-+//........................................................................
-+
-+ //====================================================================
-+ //= GraphicAccess
-+ //====================================================================
-+ /** helper class for obtaining streams (which also can be used with the ImageProducer)
-+ from a resource
-+ */
-+ class BindableControlHelper
-+ {
-+ private:
-+ BindableControlHelper(); // never implemented
-+
-+ public:
-+ SVT_DLLPUBLIC static void ApplyListSourceAndBindableData( const com::sun::star::uno::Reference< com::sun::star::frame::XModel >& xModel, const com::sun::star::uno::Reference< com::sun::star::uno::XInterface >& rObj, const rtl::OUString& rsCtrlSource, const rtl::OUString& rsRowSource );
-+ };
-+
-+//........................................................................
-+} // namespace svt
-+//........................................................................
-+
-+#endif // DBA14_SVTOOLS_INC_IMAGERESOURCEACCESS_HXX
-+
---- svtools/prj/d.lst.old 2009-04-02 11:06:22.000000000 +0000
-+++ svtools/prj/d.lst 2009-04-06 16:41:59.000000000 +0000
-@@ -172,6 +172,7 @@ mkdir: %_DEST%\inc%_EXT%\svtools
- ..\inc\svtools\logindlg.hxx %_DEST%\inc%_EXT%\svtools\logindlg.hxx
- ..\inc\svtools\httpcook.hxx %_DEST%\inc%_EXT%\svtools\httpcook.hxx
- ..\inc\imageresourceaccess.hxx %_DEST%\inc%_EXT%\svtools\imageresourceaccess.hxx
-+..\inc\bindablecontrolhelper.hxx %_DEST%\inc%_EXT%\svtools\bindablecontrolhelper.hxx
- ..\inc\svtools\itemprop.hxx %_DEST%\inc%_EXT%\svtools\itemprop.hxx
- ..\inc\addresstemplate.hxx %_DEST%\inc%_EXT%\svtools\addresstemplate.hxx
- ..\inc\svtools\genericunodialog.hxx %_DEST%\inc%_EXT%\svtools\genericunodialog.hxx
---- svtools/source/misc/bindablecontrolhelper.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ svtools/source/misc/bindablecontrolhelper.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -0,0 +1,162 @@
-+/*************************************************************************
-+ *
-+ * 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: imageresourceaccess.cxx,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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_svtools.hxx"
-+#include "bindablecontrolhelper.hxx"
-+#include <com/sun/star/form/binding/XBindableValue.hpp>
-+#include <com/sun/star/form/binding/XValueBinding.hpp>
-+#include <com/sun/star/form/binding/XListEntrySink.hpp>
-+#include <com/sun/star/form/binding/XListEntrySource.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <com/sun/star/container/XNameAccess.hpp>
-+#include <com/sun/star/table/CellRangeAddress.hpp>
-+#include <com/sun/star/sheet/XCellRangeReferrer.hpp>
-+#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
-+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-+#include <com/sun/star/table/CellAddress.hpp>
-+#include <com/sun/star/beans/NamedValue.hpp>
-+
-+//........................................................................
-+namespace svt
-+{
-+//........................................................................
-+
-+#ifndef C2U
-+#define C2U(cChar) rtl::OUString::createFromAscii(cChar)
-+#endif
-+
-+ using namespace ::com::sun::star;
-+
-+bool lcl_isNamedRange( const rtl::OUString& sAddress, const uno::Reference< frame::XModel >& xModel, table::CellRangeAddress& aAddress )
-+{
-+ bool bRes = false;
-+ const static rtl::OUString sNamedRanges( RTL_CONSTASCII_USTRINGPARAM("NamedRanges"));
-+ uno::Reference< sheet::XCellRangeReferrer > xReferrer;
-+ try
-+ {
-+ uno::Reference< beans::XPropertySet > xPropSet( xModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XNameAccess > xNamed( xPropSet->getPropertyValue( sNamedRanges ), uno::UNO_QUERY_THROW );
-+ xReferrer.set ( xNamed->getByName( sAddress ), uno::UNO_QUERY );
-+ }
-+ catch( uno::Exception& /*e*/ )
-+ {
-+ // do nothing
-+ }
-+ if ( xReferrer.is() )
-+ {
-+ uno::Reference< sheet::XCellRangeAddressable > xRangeAddressable( xReferrer->getReferredCells(), uno::UNO_QUERY );
-+ if ( xRangeAddressable.is() )
-+ {
-+ aAddress = xRangeAddressable->getRangeAddress();
-+ bRes = true;
-+ }
-+ }
-+ return bRes;
-+}
-+
-+
-+void
-+BindableControlHelper::ApplyListSourceAndBindableData( const com::sun::star::uno::Reference< com::sun::star::frame::XModel >& xModel, const com::sun::star::uno::Reference< com::sun::star::uno::XInterface >& rObj, const rtl::OUString& rsCtrlSource, const rtl::OUString& rsRowSource )
-+{
-+// XBindable etc.
-+ uno::Reference< lang::XMultiServiceFactory > xFac;
-+ if ( xModel.is() )
-+ xFac.set( xModel, uno::UNO_QUERY );
-+ uno::Reference< form::binding::XBindableValue > xBindable( rObj, uno::UNO_QUERY );
-+ if ( xFac.is() && rsCtrlSource.getLength() && xBindable.is() )
-+ {
-+
-+ // OOo address structures
-+ // RefCell - convert from XL
-+ // pretend we converted the imported string address into the
-+ // appropriate address structure
-+ uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( C2U( "com.sun.star.table.CellAddressConversion" )), uno::UNO_QUERY );
-+ table::CellAddress aAddress;
-+ if ( xConvertor.is() )
-+ {
-+ // we need this service to properly convert XL notation also
-+ // Should be easy to extend
-+ xConvertor->setPropertyValue( C2U( "XL_A1_Representation" ), uno::makeAny( rsCtrlSource ) );
-+ xConvertor->getPropertyValue( C2U( "Address" ) ) >>= aAddress;
-+ }
-+
-+ beans::NamedValue aArg1;
-+ aArg1.Name = C2U("BoundCell");
-+ aArg1.Value <<= aAddress;
-+
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[ 0 ] <<= aArg1;
-+
-+ uno::Reference< form::binding::XValueBinding > xBinding( xFac->createInstanceWithArguments( C2U("com.sun.star.table.CellValueBinding" ), aArgs ), uno::UNO_QUERY );
-+ xBindable->setValueBinding( xBinding );
-+ }
-+ else if ( xBindable.is() ) // reset it
-+ xBindable->setValueBinding( uno::Reference< form::binding::XValueBinding >() );
-+ uno::Reference< form::binding::XListEntrySink > xListEntrySink( rObj, uno::UNO_QUERY );
-+ if ( xFac.is() && rsRowSource.getLength() && xListEntrySink.is() )
-+ {
-+
-+ // OOo address structures
-+ // RefCell - convert from XL
-+ // pretend we converted the imported string address into the
-+ // appropriate address structure
-+ uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( C2U( "com.sun.star.table.CellRangeAddressConversion" )), uno::UNO_QUERY );
-+ table::CellRangeAddress aAddress;
-+ if ( xConvertor.is() )
-+ {
-+ if ( !lcl_isNamedRange( rsRowSource, xModel, aAddress ) )
-+ {
-+ // we need this service to properly convert XL notation also
-+ // Should be easy to extend
-+ xConvertor->setPropertyValue( C2U( "XL_A1_Representation" ), uno::makeAny( rsRowSource ) );
-+ xConvertor->getPropertyValue( C2U( "Address" ) ) >>= aAddress;
-+ }
-+ }
-+
-+ beans::NamedValue aArg1;
-+ aArg1.Name = C2U("CellRange");
-+ aArg1.Value <<= aAddress;
-+
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[ 0 ] <<= aArg1;
-+
-+ uno::Reference< form::binding::XListEntrySource > xSource( xFac->createInstanceWithArguments( C2U("com.sun.star.table.CellRangeListSource" ), aArgs ), uno::UNO_QUERY );
-+ xListEntrySink->setListEntrySource( xSource );
-+ }
-+ else if ( xListEntrySink.is() ) // reset
-+ xListEntrySink->setListEntrySource( uno::Reference< form::binding::XListEntrySource >() );
-+
-+}
-+
-+//........................................................................
-+} // namespace svt
-+//........................................................................
-+
---- svtools/source/misc/makefile.mk.old 2009-04-02 11:06:13.000000000 +0000
-+++ svtools/source/misc/makefile.mk 2009-04-06 16:41:59.000000000 +0000
-@@ -85,6 +85,7 @@ SLOFILES=\
- $(SLO)$/lockfilecommon.obj \
- $(SLO)$/sharecontrolfile.obj \
- $(SLO)$/documentlockfile.obj \
-+ $(SLO)$/bindablecontrolhelper.obj \
- $(SLO)$/langtab.obj
-
- # --- Targets -------------------------------------------------------
---- svx/inc/svx/msocximex.hxx.old 2009-04-06 16:41:59.000000000 +0000
-+++ svx/inc/svx/msocximex.hxx 2009-04-06 16:41:59.000000000 +0000
-@@ -405,6 +405,8 @@ public:
- sal_uInt32 nGroupNameLen;
- sal_uInt32 nUnknown10;
-
-+ rtl::OUString msCtrlSource;
-+ rtl::OUString msRowSource;
- char *pValue;
- char *pCaption;
- char *pGroupName;
-@@ -490,6 +492,8 @@ struct ContainerRecord
-
- ::rtl::OUString cName;
- ::rtl::OUString controlTip;
-+ ::rtl::OUString sCtrlSource;
-+ ::rtl::OUString sRowSource;
-
- sal_uInt32 nTop;
- sal_uInt32 nLeft;
-@@ -916,7 +920,8 @@ public:
- OCX_OptionButton() : OCX_ModernControl(rtl::OUString::createFromAscii("OptionButton"))
- {
- msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.RadioButton");
-- msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlRadioButtonModel");
-+ //msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlRadioButtonModel");
-+ msDialogType = rtl::OUString::createFromAscii("com.sun.star.form.component.RadioButton");
- mnBackColor = 0x80000005L;
- mnForeColor = 0x80000008L;
- aFontData.SetHasAlign(TRUE);
-@@ -1017,7 +1022,7 @@ class OCX_ComboBox : public OCX_ModernCo
- public:
- OCX_ComboBox() : OCX_ModernControl(rtl::OUString::createFromAscii("ComboBox")){
- msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.ComboBox");
-- msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlComboBoxModel");
-+ msDialogType = rtl::OUString::createFromAscii("com.sun.star.form.component.ComboBox");
- mnBackColor = 0x80000005;
- mnForeColor = 0x80000008;
- nBorderColor = 0x80000006;
-@@ -1042,7 +1047,8 @@ class OCX_ListBox : public OCX_ModernCon
- public:
- OCX_ListBox() : OCX_ModernControl(rtl::OUString::createFromAscii("ListBox")){
- msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.ListBox");
-- msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlListBoxModel");
-+ //msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlListBoxModel");
-+ msDialogType = rtl::OUString::createFromAscii("com.sun.star.form.component.ListBox");
- mnBackColor = 0x80000005;
- mnForeColor = 0x80000008;
- nBorderColor = 0x80000006;
---- svx/source/msfilter/msocximex.cxx.old 2009-04-06 16:41:59.000000000 +0000
-+++ svx/source/msfilter/msocximex.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -49,6 +49,10 @@
- #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
- #include <com/sun/star/form/XFormsSupplier.hpp>
- #include <com/sun/star/form/XForm.hpp>
-+#include <com/sun/star/form/binding/XBindableValue.hpp>
-+#include <com/sun/star/form/binding/XValueBinding.hpp>
-+#include <com/sun/star/form/binding/XListEntrySink.hpp>
-+#include <com/sun/star/form/binding/XListEntrySource.hpp>
- #include <com/sun/star/form/FormComponentType.hpp>
- #include <com/sun/star/awt/FontWeight.hpp>
- #include <com/sun/star/awt/FontSlant.hpp>
-@@ -86,6 +90,14 @@
- #include <comphelper/componentcontext.hxx>
- #include <unotools/streamwrap.hxx>
-
-+#include <com/sun/star/beans/NamedValue.hpp>
-+#include <com/sun/star/table/XCellRange.hpp>
-+#include <com/sun/star/table/CellRangeAddress.hpp>
-+#include <com/sun/star/table/CellAddress.hpp>
-+#include <com/sun/star/sheet/XSpreadsheetView.hpp>
-+#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
-+#include <com/sun/star/sheet/XCellRangeReferrer.hpp>
-+
- #ifndef C2S
- #define C2S(cChar) String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(cChar))
- #endif
-@@ -636,14 +648,22 @@ class ContainerRecReader
- if( nCtrlSrcBufSize > 0 )
- {
- ReadAlign( pS, pS->Tell() - nStartPos, 4 );
-- pS->SeekRel( nCtrlSrcBufSize );
-+ std::auto_ptr< sal_Char > pCtrlSrcName;
-+ pCtrlSrcName.reset( new sal_Char[ nCtrlSrcBufSize ] );
-+ pS->Read( pCtrlSrcName.get(), nCtrlSrcBufSize );
-+ rec.sCtrlSource = lclCreateOUString( pCtrlSrcName.get(), nCtrlSrcLen );
-+ OSL_TRACE("*** *** *** ControlSourceName -> %s ", rtl::OUStringToOString( rec.sCtrlSource, RTL_TEXTENCODING_UTF8 ).getStr() );
- }
- // row source name
- sal_uInt32 nRowSrcBufSize = lclGetBufferSize( nRowSrcLen );
- if( nRowSrcBufSize > 0 )
- {
- ReadAlign( pS, pS->Tell() - nStartPos, 4 );
-- pS->SeekRel( nRowSrcBufSize );
-+ std::auto_ptr< sal_Char > pRowSrcName;
-+ pRowSrcName.reset( new sal_Char[ nRowSrcBufSize ] );
-+ pS->Read( pRowSrcName.get(), nRowSrcBufSize );
-+ rec.sRowSource = lclCreateOUString( pRowSrcName.get(), nRowSrcLen );
-+ OSL_TRACE("*** *** *** RowSourceName -> %s ", rtl::OUStringToOString( rec.sRowSource, RTL_TEXTENCODING_UTF8 ).getStr() );
- }
-
- // seek to end of data
-@@ -1425,6 +1445,99 @@ sal_Bool OCX_ImageButton::Export(SvStora
- return WriteContents(xContents,rPropSet,rSize);
- }
-
-+bool lcl_isNamedRange( const rtl::OUString& sAddress, uno::Reference< frame::XModel >& xModel, table::CellRangeAddress& aAddress )
-+{
-+ bool bRes = false;
-+ const static rtl::OUString sNamedRanges( RTL_CONSTASCII_USTRINGPARAM("NamedRanges"));
-+ uno::Reference< sheet::XCellRangeReferrer > xReferrer;
-+ try
-+ {
-+ uno::Reference< beans::XPropertySet > xPropSet( xModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XNameAccess > xNamed( xPropSet->getPropertyValue( sNamedRanges ), uno::UNO_QUERY_THROW );
-+ xReferrer.set ( xNamed->getByName( sAddress ), uno::UNO_QUERY );
-+ }
-+ catch( uno::Exception& /*e*/ )
-+ {
-+ // do nothing
-+ }
-+ if ( xReferrer.is() )
-+ {
-+ uno::Reference< sheet::XCellRangeAddressable > xRangeAddressable( xReferrer->getReferredCells(), uno::UNO_QUERY );
-+ if ( xRangeAddressable.is() )
-+ {
-+ aAddress = xRangeAddressable->getRangeAddress();
-+ bRes = true;
-+ }
-+ }
-+ return bRes;
-+}
-+
-+void lcl_ApplyListSourceAndBindableStuff( uno::Reference< frame::XModel >& xModel, const uno::Reference< beans::XPropertySet >& rPropSet, const rtl::OUString& rsCtrlSource, const rtl::OUString& rsRowSource )
-+{
-+// XBindable etc.
-+ uno::Reference< lang::XMultiServiceFactory > xFac;
-+ if ( xModel.is() )
-+ xFac.set( xModel, uno::UNO_QUERY );
-+ uno::Reference< form::binding::XBindableValue > xBindable( rPropSet, uno::UNO_QUERY );
-+ if ( xFac.is() && rsCtrlSource.getLength() && xBindable.is() )
-+ {
-+
-+ // OOo address structures
-+ // RefCell - convert from XL
-+ // pretend we converted the imported string address into the
-+ // appropriate address structure
-+ uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( C2U( "com.sun.star.table.CellAddressConversion" )), uno::UNO_QUERY );
-+ table::CellAddress aAddress;
-+ if ( xConvertor.is() )
-+ {
-+ // we need this service to properly convert XL notation also
-+ // Should be easy to extend
-+ xConvertor->setPropertyValue( C2U( "XL_A1_Representation" ), uno::makeAny( rsCtrlSource ) );
-+ xConvertor->getPropertyValue( C2U( "Address" ) ) >>= aAddress;
-+ }
-+
-+ beans::NamedValue aArg1;
-+ aArg1.Name = C2U("BoundCell");
-+ aArg1.Value <<= aAddress;
-+
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[ 0 ] <<= aArg1;
-+
-+ uno::Reference< form::binding::XValueBinding > xBinding( xFac->createInstanceWithArguments( C2U("com.sun.star.table.CellValueBinding" ), aArgs ), uno::UNO_QUERY );
-+ xBindable->setValueBinding( xBinding );
-+ }
-+ uno::Reference< form::binding::XListEntrySink > xListEntrySink( rPropSet, uno::UNO_QUERY );
-+ if ( xFac.is() && rsRowSource.getLength() && xListEntrySink.is() )
-+ {
-+
-+ // OOo address structures
-+ // RefCell - convert from XL
-+ // pretend we converted the imported string address into the
-+ // appropriate address structure
-+ uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( C2U( "com.sun.star.table.CellRangeAddressConversion" )), uno::UNO_QUERY );
-+ table::CellRangeAddress aAddress;
-+ if ( xConvertor.is() )
-+ {
-+ if ( !lcl_isNamedRange( rsRowSource, xModel, aAddress ) )
-+ {
-+ // we need this service to properly convert XL notation also
-+ // Should be easy to extend
-+ xConvertor->setPropertyValue( C2U( "XL_A1_Representation" ), uno::makeAny( rsRowSource ) );
-+ xConvertor->getPropertyValue( C2U( "Address" ) ) >>= aAddress;
-+ }
-+ }
-+
-+ beans::NamedValue aArg1;
-+ aArg1.Name = C2U("CellRange");
-+ aArg1.Value <<= aAddress;
-+
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[ 0 ] <<= aArg1;
-+
-+ uno::Reference< form::binding::XListEntrySource > xSource( xFac->createInstanceWithArguments( C2U("com.sun.star.table.CellRangeListSource" ), aArgs ), uno::UNO_QUERY );
-+ xListEntrySink->setListEntrySource( xSource );
-+ }
-+}
-
- sal_Bool OCX_OptionButton::Import(com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet> &rPropSet)
-@@ -1457,11 +1570,20 @@ sal_Bool OCX_OptionButton::Import(com::s
- aTmp <<= ImportSpecEffect( nSpecialEffect );
- rPropSet->setPropertyValue( WW8_ASCII2STR("VisualEffect"), aTmp);
-
-- if (pValue && !bSetInDialog)
-+ if (pValue)
- {
- INT16 nTmp = pValue[0]-0x30;
- aTmp <<= nTmp;
-- rPropSet->setPropertyValue( WW8_ASCII2STR("DefaultState"), aTmp);
-+ if (!bSetInDialog)
-+ rPropSet->setPropertyValue( WW8_ASCII2STR("DefaultState"), aTmp);
-+ else
-+ {
-+ // dialog ( but we might be using the form model )
-+ if ( rPropSet->getPropertySetInfo()->hasPropertyByName( WW8_ASCII2STR("DefaultState") ) )
-+ rPropSet->setPropertyValue( WW8_ASCII2STR("DefaultState"), aTmp);
-+ else
-+ rPropSet->setPropertyValue( WW8_ASCII2STR("State"), aTmp);
-+ }
- }
- // If this is a dialog control then we need to set a groupname *always*
- rtl::OUString sGroupName = lclCreateOUString( pGroupName, nGroupNameLen );
-@@ -1509,11 +1631,14 @@ sal_Bool OCX_OptionButton::Import(com::s
- aTmp <<= lclCreateOUString( pGroupName, nGroupNameLen );
- rPropSet->setPropertyValue( WW8_ASCII2STR("GroupName"), aTmp);
- }
-+ uno::Reference< frame::XModel > xModel ( pDocSh ? pDocSh->GetModel() : NULL );
-+ lcl_ApplyListSourceAndBindableStuff( xModel, rPropSet, msCtrlSource, msRowSource );
- if ( sImageUrl.getLength() )
- {
- aTmp <<= sImageUrl;
- rPropSet->setPropertyValue( WW8_ASCII2STR("ImageURL"), aTmp);
- }
-+
- aFontData.Import(rPropSet);
- return sal_True;
- }
-@@ -2630,7 +2755,8 @@ sal_Bool OCX_ListBox::Import(com::sun::s
-
- aTmp <<= ImportColor( nBorderColor );
- rPropSet->setPropertyValue( WW8_ASCII2STR("BorderColor"), aTmp);
--
-+ uno::Reference< frame::XModel > xModel ( pDocSh ? pDocSh->GetModel() : NULL );
-+ lcl_ApplyListSourceAndBindableStuff( xModel, rPropSet, msCtrlSource, msRowSource );
- aFontData.Import(rPropSet);
- return sal_True;
- }
-@@ -3419,15 +3545,29 @@ void OCX_ContainerControl::ProcessContro
- {
- // A container control needs to read the f stream in
- // the folder ( substorage ) associated with this control
-- if ( rec.nTypeIdent == FRAME ||
-- rec.nTypeIdent == MULTIPAGE||
-- rec.nTypeIdent == PAGE )
-+ switch ( rec.nTypeIdent )
- {
-- OCX_ContainerControl* pContainer =
-- static_cast< OCX_ContainerControl* >( pControl );
-- oStream = pContainer->getContainerStream();
-+ case FRAME:
-+ case MULTIPAGE:
-+ case PAGE:
-+ {
-+ OCX_ContainerControl* pContainer =
-+ static_cast< OCX_ContainerControl* >( pControl );
-+ oStream = pContainer->getContainerStream();
-+ break;
-+ }
-+ case LISTBOX:
-+ case OPTIONBUTTON:
-+ case COMBOBOX:
-+ {
-+ OCX_ModernControl* pList = static_cast< OCX_ModernControl* >( pControl );
-+ if ( pList )
-+ {
-+ pList->msCtrlSource = rec.sCtrlSource;
-+ pList->msRowSource = rec.sRowSource;
-+ }
-+ }
- }
--
- pControl->sName = rec.cName;
- pControl->msToolTip = rec.controlTip;
- // Position of controls is relative to the container
-@@ -4062,7 +4202,7 @@ sal_Bool OCX_UserForm::Import(
- OCX_ContainerControl::Import( xPropSet );
-
- uno::Reference<io::XInputStreamProvider> xSource =
-- xmlscript::exportDialogModel(mxParent, mxCtx);
-+ xmlscript::exportDialogModel(mxParent, mxCtx, pDocSh->GetModel() );
- uno::Any aSourceAny(uno::makeAny(xSource));
- if (rLib->hasByName(sName))
- rLib->replaceByName(sName, aSourceAny);
-@@ -4605,11 +4745,14 @@ sal_Bool OCX_CheckBox::Import(com::sun::
- aTmp <<= ImportSpecEffect( nSpecialEffect );
- rPropSet->setPropertyValue( WW8_ASCII2STR("VisualEffect"), aTmp);
-
-- if (pValue && !bSetInDialog)
-+ if (pValue)
- {
- INT16 nTmp=pValue[0]-0x30;
- aTmp <<= nTmp;
-- rPropSet->setPropertyValue( WW8_ASCII2STR("DefaultState"), aTmp);
-+ if ( !bSetInDialog )
-+ rPropSet->setPropertyValue( WW8_ASCII2STR("DefaultState"), aTmp);
-+ else
-+ rPropSet->setPropertyValue( WW8_ASCII2STR("State"), aTmp);
- }
-
- if (pCaption)
---- toolkit/inc/toolkit/controls/dialogcontrol.hxx.old 2009-04-06 16:41:46.000000000 +0000
-+++ toolkit/inc/toolkit/controls/dialogcontrol.hxx 2009-04-06 16:41:59.000000000 +0000
-@@ -52,6 +52,7 @@
- #include <cppuhelper/basemutex.hxx>
- #include <list>
- #include <map>
-+#include <com/sun/star/graphic/XGraphicObject.hpp>
-
- // ----------------------------------------------------
- // class UnoControlDialogModel
-@@ -92,7 +93,9 @@ private:
-
- AllGroups maGroups;
- sal_Bool mbGroupsUpToDate;
--
-+
-+ ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicObject > mxGrfObj;
-+ bool mbAdjustingGraphic;
- protected:
- ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
- ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
-@@ -179,6 +182,8 @@ public:
- protected:
- void startControlListening( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxChildModel );
- void stopControlListening( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxChildModel );
-+ // ::cppu::OPropertySetHelper
-+ void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception);
-
- void implNotifyTabModelChange( const ::rtl::OUString& _rAccessor );
-
---- toolkit/inc/toolkit/controls/unocontrols.hxx.old 2009-04-02 10:49:37.000000000 +0000
-+++ toolkit/inc/toolkit/controls/unocontrols.hxx 2009-04-06 16:41:59.000000000 +0000
-@@ -225,7 +225,6 @@ private:
- bool mbAdjustingGraphic;
-
- ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicObject > mxGrfObj;
-- ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL );
- protected:
- ImageProducerControlModel() : mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ) { }
- ImageProducerControlModel( const ImageProducerControlModel& _rSource ) : com::sun::star::awt::XImageProducer(), UnoControlModel( _rSource ), mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ) { }
---- toolkit/source/controls/dialogcontrol.cxx.old 2009-04-06 16:41:46.000000000 +0000
-+++ toolkit/source/controls/dialogcontrol.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -90,6 +90,8 @@ using namespace toolkit;
- //HELPER
- ::rtl::OUString getPhysicalLocation( const ::com::sun::star::uno::Any& rbase, const ::com::sun::star::uno::Any& rUrl );
-
-+uno::Reference< graphic::XGraphic > getGraphicFromURL_nothrow( uno::Reference< graphic::XGraphicObject >& rxGrfObj, const ::rtl::OUString& _rURL );
-+
- struct LanguageDependentProp
- {
- const char* pPropName;
-@@ -115,7 +117,7 @@ namespace
- }
- return s_aLanguageDependentProperties;
- }
--
-+
- static uno::Reference< graphic::XGraphic > lcl_getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL )
- {
- uno::Reference< graphic::XGraphic > xGraphic;
-@@ -265,7 +267,7 @@ static const ::rtl::OUString& getStepPro
- UnoControlDialogModel::UnoControlDialogModel()
- :maContainerListeners( *this )
- ,maChangeListeners ( GetMutex() )
-- ,mbGroupsUpToDate( sal_False )
-+ ,mbGroupsUpToDate( sal_False ), mbAdjustingGraphic( false )
- {
- ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
- // ImplRegisterProperty( BASEPROPERTY_BORDER );
-@@ -294,7 +296,7 @@ UnoControlDialogModel::UnoControlDialogM
- , UnoControlDialogModel_Base( rModel )
- , maContainerListeners( *this )
- , maChangeListeners ( GetMutex() )
-- , mbGroupsUpToDate( sal_False )
-+ , mbGroupsUpToDate( sal_False ), mbAdjustingGraphic( false )
- {
- }
-
-@@ -325,6 +327,40 @@ Sequence< Type > UnoControlDialogModel::
- return ::rtl::OUString::createFromAscii( szServiceName_UnoControlDialogModel );
- }
-
-+void SAL_CALL UnoControlDialogModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception)
-+{
-+ UnoControlModel::setFastPropertyValue_NoBroadcast( nHandle, rValue );
-+ try
-+ {
-+ switch ( nHandle )
-+ {
-+ case BASEPROPERTY_IMAGEURL:
-+ if ( !mbAdjustingGraphic && ImplHasProperty( BASEPROPERTY_GRAPHIC ) )
-+ {
-+ mbAdjustingGraphic = true;
-+ ::rtl::OUString sImageURL;
-+ OSL_VERIFY( rValue >>= sImageURL );
-+ setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( getGraphicFromURL_nothrow( mxGrfObj, sImageURL ) ) );
-+ mbAdjustingGraphic = false;
-+ }
-+ break;
-+
-+ case BASEPROPERTY_GRAPHIC:
-+ if ( !mbAdjustingGraphic && ImplHasProperty( BASEPROPERTY_IMAGEURL ) )
-+ {
-+ mbAdjustingGraphic = true;
-+ setPropertyValue( GetPropertyName( BASEPROPERTY_IMAGEURL ), uno::makeAny( ::rtl::OUString() ) );
-+ mbAdjustingGraphic = false;
-+ }
-+ break;
-+ }
-+ }
-+ catch( const ::com::sun::star::uno::Exception& )
-+ {
-+ OSL_ENSURE( sal_False, "UnoControlDialogModel::setFastPropertyValue_NoBroadcast: caught an exception while setting Graphic/ImageURL properties!" );
-+ }
-+}
-+
- Any UnoControlDialogModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
- {
- Any aAny;
-@@ -1668,17 +1704,16 @@ void UnoDialogControl::PrepareWindowDesc
- // can lead to overwrites we have to set the graphic property
- // before the propertiesChangeEvents are sent!
- ::rtl::OUString aImageURL;
-- Reference< graphic::XGraphic > xGraphic;
- if (( ImplGetPropertyValue( PROPERTY_IMAGEURL ) >>= aImageURL ) &&
- ( aImageURL.getLength() > 0 ))
- {
-- ::rtl::OUString absoluteUrl =
-+ aImageURL =
- getPhysicalLocation( ImplGetPropertyValue( PROPERTY_DIALOGSOURCEURL ),
- ImplGetPropertyValue( PROPERTY_IMAGEURL ));
-
-- xGraphic = lcl_getGraphicFromURL_nothrow( absoluteUrl );
-- ImplSetPropertyValue( PROPERTY_GRAPHIC, uno::makeAny( xGraphic ), sal_True );
- }
-+ if ( aImageURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) != 0 )
-+ ImplSetPropertyValue( PROPERTY_IMAGEURL, uno::makeAny( aImageURL ), sal_True );
- }
-
- void UnoDialogControl::elementInserted( const ContainerEvent& Event ) throw(RuntimeException)
-@@ -1910,18 +1945,16 @@ void UnoDialogControl::ImplModelProperti
- if ( bOwnModel && rEvt.PropertyName.equalsAsciiL( "ImageURL", 8 ))
- {
- ::rtl::OUString aImageURL;
-- Reference< graphic::XGraphic > xGraphic;
- if (( ImplGetPropertyValue( PROPERTY_IMAGEURL ) >>= aImageURL ) &&
- ( aImageURL.getLength() > 0 ))
- {
-- ::rtl::OUString absoluteUrl =
-+ aImageURL =
- getPhysicalLocation( ImplGetPropertyValue( PROPERTY_DIALOGSOURCEURL ),
- ImplGetPropertyValue( PROPERTY_IMAGEURL ));
-
-- xGraphic = lcl_getGraphicFromURL_nothrow( absoluteUrl );
- }
-
-- ImplSetPropertyValue( PROPERTY_GRAPHIC, uno::makeAny( xGraphic ), sal_True );
-+ ImplSetPropertyValue( PROPERTY_IMAGEURL, uno::makeAny( aImageURL ), sal_True );
- break;
- }
- }
-@@ -2120,10 +2153,17 @@ throw (RuntimeException)
-
- if ( url.getLength() > 0 )
- {
-- INetURLObject urlObj(baseLocation);
-- urlObj.removeSegment();
-- baseLocation = urlObj.GetMainURL( INetURLObject::NO_DECODE );
-- ::osl::FileBase::getAbsoluteFileURL( baseLocation, url, ret );
-+ // Don't adjust GraphicObject url(s)
-+ if ( url.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) != 0 )
-+ {
-+ INetURLObject urlObj(baseLocation);
-+ urlObj.removeSegment();
-+ baseLocation = urlObj.GetMainURL( INetURLObject::NO_DECODE );
-+ ::osl::FileBase::getAbsoluteFileURL( baseLocation, url, ret );
-+ }
-+ else
-+ ret = url;
-+
- }
-
- return ret;
---- toolkit/source/controls/unocontrols.cxx.old 2009-04-02 10:49:35.000000000 +0000
-+++ toolkit/source/controls/unocontrols.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -580,7 +580,7 @@ uno::Any ImageProducerControlModel::Impl
-
- return UnoControlModel::ImplGetDefaultValue( nPropId );
- }
-- uno::Reference< graphic::XGraphic > ImageProducerControlModel::getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL )
-+ uno::Reference< graphic::XGraphic > getGraphicFromURL_nothrow( uno::Reference< graphic::XGraphicObject >& rxGrfObj, const ::rtl::OUString& _rURL )
- {
- uno::Reference< graphic::XGraphic > xGraphic;
-
-@@ -590,10 +590,10 @@ uno::Any ImageProducerControlModel::Impl
- rtl::OUString sID = _rURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 );
- // get the DefaultContext
- ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
-- mxGrfObj = graphic::GraphicObject::createWithId( aContext.getUNOContext(), sID );
-+ rxGrfObj = graphic::GraphicObject::createWithId( aContext.getUNOContext(), sID );
- }
- else // linked
-- mxGrfObj = NULL; // release the GraphicObject
-+ rxGrfObj = NULL; // release the GraphicObject
-
- if ( !_rURL.getLength() )
- return xGraphic;
-@@ -634,7 +634,7 @@ void SAL_CALL ImageProducerControlModel:
- mbAdjustingGraphic = true;
- ::rtl::OUString sImageURL;
- OSL_VERIFY( rValue >>= sImageURL );
-- setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( getGraphicFromURL_nothrow( sImageURL ) ) );
-+ setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( getGraphicFromURL_nothrow( mxGrfObj, sImageURL ) ) );
- mbAdjustingGraphic = false;
- }
- break;
---- xmlscript/inc/xmlscript/xmldlg_imexp.hxx.old 2009-04-02 10:57:46.000000000 +0000
-+++ xmlscript/inc/xmlscript/xmldlg_imexp.hxx 2009-04-06 16:41:59.000000000 +0000
-@@ -30,6 +30,8 @@
- #ifndef _XMLSCRIPT_XMLDLG_IMEXP_HXX_
- #define _XMLSCRIPT_XMLDLG_IMEXP_HXX_
-
-+#include <com/sun/star/frame/XModel.hpp>
-+
- #ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HXX_
- #include <com/sun/star/container/XNameContainer.hpp>
- #endif
-@@ -54,7 +56,9 @@ void SAL_CALL exportDialogModel(
- ::com::sun::star::uno::Reference<
- ::com::sun::star::xml::sax::XExtendedDocumentHandler > const & xOut,
- ::com::sun::star::uno::Reference<
-- ::com::sun::star::container::XNameContainer > const & xDialogModel )
-+ ::com::sun::star::container::XNameContainer > const & xDialogModel,
-+ ::com::sun::star::uno::Reference<
-+ ::com::sun::star::frame::XModel > const & xDocument )
- SAL_THROW( (::com::sun::star::uno::Exception) );
-
- //==============================================================================
-@@ -63,7 +67,9 @@ SAL_CALL importDialogModel(
- ::com::sun::star::uno::Reference<
- ::com::sun::star::container::XNameContainer > const & xDialogModel,
- ::com::sun::star::uno::Reference<
-- ::com::sun::star::uno::XComponentContext > const & xContext )
-+ ::com::sun::star::uno::XComponentContext > const & xContext,
-+ ::com::sun::star::uno::Reference<
-+ ::com::sun::star::frame::XModel > const & xDocument )
- SAL_THROW( (::com::sun::star::uno::Exception) );
-
- // additional functions for convenience
-@@ -74,7 +80,9 @@ SAL_CALL exportDialogModel(
- ::com::sun::star::uno::Reference<
- ::com::sun::star::container::XNameContainer > const & xDialogModel,
- ::com::sun::star::uno::Reference<
-- ::com::sun::star::uno::XComponentContext > const & xContext )
-+ ::com::sun::star::uno::XComponentContext > const & xContext,
-+ ::com::sun::star::uno::Reference<
-+ ::com::sun::star::frame::XModel > const & xDocument )
- SAL_THROW( (::com::sun::star::uno::Exception) );
-
- //==============================================================================
-@@ -84,7 +92,9 @@ void SAL_CALL importDialogModel(
- ::com::sun::star::uno::Reference<
- ::com::sun::star::container::XNameContainer > const & xDialogModel,
- ::com::sun::star::uno::Reference<
-- ::com::sun::star::uno::XComponentContext > const & xContext )
-+ ::com::sun::star::uno::XComponentContext > const & xContext,
-+ ::com::sun::star::uno::Reference<
-+ ::com::sun::star::frame::XModel > const & xDocument )
- SAL_THROW( (::com::sun::star::uno::Exception) );
-
- }
---- xmlscript/source/xmldlg_imexp/exp_share.hxx.old 2009-04-02 10:57:46.000000000 +0000
-+++ xmlscript/source/xmldlg_imexp/exp_share.hxx 2009-04-06 16:41:59.000000000 +0000
-@@ -180,9 +180,9 @@ public:
- SAL_THROW( (css::uno::Exception) );
- void readCheckBoxModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
-- void readRadioButtonModel( StyleBag * all_styles )
-+ void readRadioButtonModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
- SAL_THROW( (css::uno::Exception) );
-- void readComboBoxModel( StyleBag * all_styles )
-+ void readComboBoxModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
- SAL_THROW( (css::uno::Exception) );
- void readCurrencyFieldModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
-@@ -196,9 +196,9 @@ public:
- SAL_THROW( (css::uno::Exception) );
- void readGroupBoxModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
-- void readImageControlModel( StyleBag * all_styles )
-+ void readImageControlModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
- SAL_THROW( (css::uno::Exception) );
-- void readListBoxModel( StyleBag * all_styles )
-+ void readListBoxModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
- SAL_THROW( (css::uno::Exception) );
- void readNumericFieldModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
---- xmlscript/source/xmldlg_imexp/imp_share.hxx.old 2009-04-02 10:57:46.000000000 +0000
-+++ xmlscript/source/xmldlg_imexp/imp_share.hxx 2009-04-06 16:41:59.000000000 +0000
-@@ -131,6 +131,7 @@ struct DialogImport
-
- css::uno::Reference< css::container::XNameContainer > _xDialogModel;
- css::uno::Reference< css::lang::XMultiServiceFactory > _xDialogModelFactory;
-+ css::uno::Reference< css::frame::XModel > _xDoc;
-
- sal_Int32 XMLNS_DIALOGS_UID, XMLNS_SCRIPT_UID;
-
-@@ -164,16 +165,18 @@ public:
- inline DialogImport(
- css::uno::Reference<css::uno::XComponentContext> const & xContext,
- css::uno::Reference<css::container::XNameContainer>
-- const & xDialogModel )
-+ const & xDialogModel,
-+ css::uno::Reference<css::frame::XModel> const & xDoc )
- SAL_THROW( () )
- : _xContext( xContext )
- , _xDialogModel( xDialogModel )
-- , _xDialogModelFactory( xDialogModel, css::uno::UNO_QUERY_THROW )
-+ , _xDialogModelFactory( xDialogModel, css::uno::UNO_QUERY_THROW ), _xDoc( xDoc )
- { OSL_ASSERT( _xDialogModel.is() && _xDialogModelFactory.is() &&
- _xContext.is() ); }
- virtual ~DialogImport()
- SAL_THROW( () );
-
-+ inline css::uno::Reference< css::frame::XModel > getDocOwner() { return _xDoc; }
- // XRoot
- virtual void SAL_CALL startDocument(
- css::uno::Reference< css::xml::input::XNamespaceMapping >
---- xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx.old 2009-04-02 10:57:46.000000000 +0000
-+++ xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -44,6 +44,7 @@
- using namespace ::rtl;
- using namespace ::com::sun::star;
- using namespace ::com::sun::star::uno;
-+using namespace ::com::sun::star::frame;
-
- namespace xmlscript
- {
-@@ -73,7 +74,8 @@ Reference< io::XInputStream > InputStrea
- //==================================================================================================
- Reference< io::XInputStreamProvider > SAL_CALL exportDialogModel(
- Reference< container::XNameContainer > const & xDialogModel,
-- Reference< XComponentContext > const & xContext )
-+ Reference< XComponentContext > const & xContext,
-+ Reference< XModel > const & xDocument )
- SAL_THROW( (Exception) )
- {
- Reference< lang::XMultiComponentFactory > xSMgr( xContext->getServiceManager() );
-@@ -98,7 +100,7 @@ Reference< io::XInputStreamProvider > SA
-
- Reference< io::XActiveDataSource > xSource( xHandler, UNO_QUERY );
- xSource->setOutputStream( createOutputStream( &aBytes ) );
-- exportDialogModel( xHandler, xDialogModel );
-+ exportDialogModel( xHandler, xDialogModel, xDocument );
-
- return new InputStreamProvider( aBytes );
- }
-@@ -107,7 +109,8 @@ Reference< io::XInputStreamProvider > SA
- void SAL_CALL importDialogModel(
- Reference< io::XInputStream > xInput,
- Reference< container::XNameContainer > const & xDialogModel,
-- Reference< XComponentContext > const & xContext )
-+ Reference< XComponentContext > const & xContext,
-+ Reference< XModel > const & xDocument )
- SAL_THROW( (Exception) )
- {
- Reference< lang::XMultiComponentFactory > xSMgr( xContext->getServiceManager() );
-@@ -129,7 +132,7 @@ void SAL_CALL importDialogModel(
- }
-
- // error handler, entity resolver omitted for this helper function
-- xParser->setDocumentHandler( importDialogModel( xDialogModel, xContext ) );
-+ xParser->setDocumentHandler( importDialogModel( xDialogModel, xContext, xDocument ) );
-
- xml::sax::InputSource source;
- source.aInputStream = xInput;
---- xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx.old 2009-04-06 16:41:46.000000000 +0000
-+++ xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -32,7 +32,16 @@
- #include "precompiled_xmlscript.hxx"
- #include "exp_share.hxx"
-
-+#include <com/sun/star/form/binding/XListEntrySink.hpp>
-+#include <com/sun/star/form/binding/XBindableValue.hpp>
-+#include <com/sun/star/form/binding/XValueBinding.hpp>
-+#include <com/sun/star/table/CellAddress.hpp>
-+#include <com/sun/star/table/CellRangeAddress.hpp>
- #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
-+#include <com/sun/star/document/XStorageBasedDocument.hpp>
-+#include <com/sun/star/document/XGraphicObjectResolver.hpp>
-+#include <comphelper/componentcontext.hxx>
-+#include <comphelper/processfactory.hxx>
-
-
- using namespace ::com::sun::star;
-@@ -42,6 +51,66 @@ using ::rtl::OUString;
- namespace xmlscript
- {
-
-+void lclExportBindableAndListSourceBits( Reference< frame::XModel > const & xDocument, const Reference< beans::XPropertySet >& _xProps, ElementDescriptor& rModel )
-+{
-+ Reference< lang::XMultiServiceFactory > xFac;
-+ if ( xDocument.is() )
-+ xFac.set( xDocument, uno::UNO_QUERY );
-+
-+ Reference< form::binding::XBindableValue > xBinding( _xProps, UNO_QUERY );
-+
-+ if ( xFac.is() && xBinding.is() )
-+ {
-+ try
-+ {
-+ Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellAddressConversion" )), uno::UNO_QUERY );
-+ Reference< beans::XPropertySet > xBindable( xBinding->getValueBinding(), UNO_QUERY );
-+ if ( xBindable.is() )
-+ {
-+ table::CellAddress aAddress;
-+ xBindable->getPropertyValue( OUSTR("BoundCell") ) >>= aAddress;
-+ xConvertor->setPropertyValue( OUSTR("Address"), makeAny( aAddress ) );
-+ rtl::OUString sAddress;
-+ xConvertor->getPropertyValue( OUSTR("PersistentRepresentation") ) >>= sAddress;
-+ if ( sAddress.getLength() > 0 )
-+ rModel.addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell"), sAddress );
-+
-+ OSL_TRACE( "*** Bindable value %s", rtl::OUStringToOString( sAddress, RTL_TEXTENCODING_UTF8 ).getStr() );
-+
-+ }
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+ }
-+ Reference< form::binding::XListEntrySink > xEntrySink( _xProps, UNO_QUERY );
-+ if ( xEntrySink.is() )
-+ {
-+ Reference< beans::XPropertySet > xListSource( xEntrySink->getListEntrySource(), UNO_QUERY );
-+ if ( xListSource.is() )
-+ {
-+ try
-+ {
-+ Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellRangeAddressConversion" )), uno::UNO_QUERY );
-+
-+ table::CellRangeAddress aAddress;
-+ xListSource->getPropertyValue( OUSTR( "CellRange" ) ) >>= aAddress;
-+
-+ rtl::OUString sAddress;
-+ xConvertor->setPropertyValue( OUSTR("Address"), makeAny( aAddress ) );
-+ xConvertor->getPropertyValue( OUSTR("PersistentRepresentation") ) >>= sAddress;
-+ OSL_TRACE("**** cell range source list %s",
-+ rtl::OUStringToOString( sAddress, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ if ( sAddress.getLength() > 0 );
-+ rModel.addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":source-cell-range"), sAddress );
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+ }
-+ }
-+
-+}
- static inline bool readBorderProps(
- ElementDescriptor * element, Style & style )
- {
-@@ -209,7 +278,7 @@ void ElementDescriptor::readCheckBoxMode
- readEvents();
- }
- //__________________________________________________________________________________________________
--void ElementDescriptor::readComboBoxModel( StyleBag * all_styles )
-+void ElementDescriptor::readComboBoxModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
- SAL_THROW( (Exception) )
- {
- // collect styles
-@@ -250,7 +319,8 @@ void ElementDescriptor::readComboBoxMode
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxlength") ) );
- readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linecount") ) );
--
-+ // Cell Range, Ref Cell etc.
-+ lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
- // string item list
- Sequence< OUString > itemValues;
- if ((readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ) ) >>= itemValues) &&
-@@ -276,7 +346,7 @@ void ElementDescriptor::readComboBoxMode
- readEvents();
- }
- //__________________________________________________________________________________________________
--void ElementDescriptor::readListBoxModel( StyleBag * all_styles )
-+void ElementDescriptor::readListBoxModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
- SAL_THROW( (Exception) )
- {
- // collect styles
-@@ -311,7 +381,7 @@ void ElementDescriptor::readListBoxModel
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linecount") ) );
- readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
--
-+ lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
- // string item list
- Sequence< OUString > itemValues;
- if ((readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ) ) >>= itemValues) &&
-@@ -351,7 +421,7 @@ void ElementDescriptor::readListBoxModel
- readEvents();
- }
- //__________________________________________________________________________________________________
--void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles )
-+void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
- SAL_THROW( (Exception) )
- {
- // collect styles
-@@ -409,6 +479,7 @@ void ElementDescriptor::readRadioButtonM
- break;
- }
- }
-+ lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
- readEvents();
- }
- //__________________________________________________________________________________________________
-@@ -581,7 +652,7 @@ void ElementDescriptor::readEditModel( S
- readEvents();
- }
- //__________________________________________________________________________________________________
--void ElementDescriptor::readImageControlModel( StyleBag * all_styles )
-+void ElementDescriptor::readImageControlModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
- SAL_THROW( (Exception) )
- {
- // collect styles
-@@ -600,8 +671,31 @@ void ElementDescriptor::readImageControl
- readDefaults();
- readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleImage") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":scale-image") ) );
-- readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":src") ) );
-+ rtl::OUString sURL;
-+ _xProps->getPropertyValue( OUSTR("ImageURL") ) >>= sURL;
-+
-+ if ( sURL.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.GraphicObject:" ) ) ) == 0 )
-+ {
-+ Reference< document::XStorageBasedDocument > xDocStorage( xDocument, UNO_QUERY );
-+
-+ if ( xDocStorage.is() )
-+ {
-+ uno::Sequence< Any > aArgs( 1 );
-+ aArgs[ 0 ] <<= xDocStorage->getDocumentStorage();
-+
-+ ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
-+ uno::Reference< document::XGraphicObjectResolver > xGraphicResolver;
-+ aContext.createComponentWithArguments( OUSTR( "com.sun.star.comp.Svx.GraphicExportHelper" ), aArgs, xGraphicResolver );
-+ if ( xGraphicResolver.is() )
-+ {
-+ sURL = xGraphicResolver->resolveGraphicObjectURL( sURL );
-+ }
-+ }
-+ }
-+ if ( sURL.getLength() > 0 )
-+ {
-+ addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":src"), sURL );
-+ }
- readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
- readEvents();
---- xmlscript/source/xmldlg_imexp/xmldlg_export.cxx.old 2009-04-02 10:57:46.000000000 +0000
-+++ xmlscript/source/xmldlg_imexp/xmldlg_export.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -1309,7 +1309,8 @@ void StyleBag::dump( Reference< xml::sax
- //==================================================================================================
- void SAL_CALL exportDialogModel(
- Reference< xml::sax::XExtendedDocumentHandler > const & xOut,
-- Reference< container::XNameContainer > const & xDialogModel )
-+ Reference< container::XNameContainer > const & xDialogModel,
-+ Reference< frame::XModel > const & xDocument )
- SAL_THROW( (Exception) )
- {
- StyleBag all_styles;
-@@ -1357,7 +1358,7 @@ void SAL_CALL exportDialogModel(
- xProps, xPropState,
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":radio") ) );
- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readRadioButtonModel( &all_styles );
-+ pElem->readRadioButtonModel( &all_styles, xDocument );
- pRadioGroup->addSubElement( xElem );
- }
- else // no radio
-@@ -1386,7 +1387,7 @@ void SAL_CALL exportDialogModel(
- xProps, xPropState,
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":combobox") ) );
- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readComboBoxModel( &all_styles );
-+ pElem->readComboBoxModel( &all_styles, xDocument );
- }
- else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) ) )
- {
-@@ -1394,7 +1395,7 @@ void SAL_CALL exportDialogModel(
- xProps, xPropState,
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menulist") ) );
- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readListBoxModel( &all_styles );
-+ pElem->readListBoxModel( &all_styles, xDocument );
- }
- else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) ) )
- {
-@@ -1435,7 +1436,7 @@ void SAL_CALL exportDialogModel(
- xProps, xPropState,
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":img") ) );
- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readImageControlModel( &all_styles );
-+ pElem->readImageControlModel( &all_styles, xDocument );
- }
- else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFileControlModel") ) ) )
- {
---- xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx.old 2009-04-06 16:41:46.000000000 +0000
-+++ xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -31,11 +31,19 @@
- // MARKER(update_precomp.py): autogen include statement, do not remove
- #include "precompiled_xmlscript.hxx"
- #include "imp_share.hxx"
--
-+#include <com/sun/star/form/binding/XBindableValue.hpp>
-+#include <com/sun/star/form/binding/XValueBinding.hpp>
-+#include <com/sun/star/form/binding/XListEntrySink.hpp>
-+#include <com/sun/star/beans/NamedValue.hpp>
-+#include <com/sun/star/table/CellAddress.hpp>
-+#include <com/sun/star/table/CellRangeAddress.hpp>
- #include <com/sun/star/beans/XPropertySet.hpp>
- #include <com/sun/star/beans/XPropertyState.hpp>
-+#include <com/sun/star/document/XStorageBasedDocument.hpp>
-+#include <com/sun/star/document/XGraphicObjectResolver.hpp>
-
--
-+#include <comphelper/componentcontext.hxx>
-+#include <comphelper/processfactory.hxx>
- using namespace ::com::sun::star;
- using namespace ::com::sun::star::uno;
- using ::rtl::OUString;
-@@ -43,6 +51,100 @@ using ::rtl::OUString;
- namespace xmlscript
- {
-
-+// #FIXME cut'n'pasted from xmloff/source/core/xmlimp.cxx:1251
-+// of course we need to find a common home for this helper
-+
-+bool IsPackageURL( const ::rtl::OUString& rURL )
-+{
-+ // Some quick tests: Some may rely on the package structure!
-+ sal_Int32 nLen = rURL.getLength();
-+ if( (nLen > 0 && '/' == rURL[0]) )
-+ // RFC2396 net_path or abs_path
-+ return false;
-+ else if( nLen > 1 && '.' == rURL[0] )
-+ {
-+ if( '.' == rURL[1] )
-+ // ../: We are never going up one level, so we know
-+ // it's not an external URI
-+ return false;
-+ else if( '/' == rURL[1] )
-+ // we are remaining on a level, so it's an package URI
-+ return true;
-+ }
-+
-+ // Now check for a RFC2396 schema
-+ sal_Int32 nPos = 1;
-+ while( nPos < nLen )
-+ {
-+ switch( rURL[nPos] )
-+ {
-+ case '/':
-+ // a relative path segement
-+ return true;
-+ case ':':
-+ // a schema
-+ return false;
-+ default:
-+ break;
-+ // we don't care about any other characters
-+ }
-+ ++nPos;
-+ }
-+
-+ return true;
-+}
-+
-+void importBindableAndListRangeBits( DialogImport* _pImport, const rtl::OUString sLinkedCell, const rtl::OUString & sCellRange, ControlImportContext& ctx )
-+{
-+ Reference< lang::XMultiServiceFactory > xFac( _pImport->getDocOwner(), UNO_QUERY );;
-+ if ( xFac.is() && ( sLinkedCell.getLength() || sCellRange.getLength() ) )
-+ {
-+ // Set up Celllink
-+ if ( sLinkedCell.getLength() )
-+ {
-+ Reference< form::binding::XBindableValue > xBindable( ctx.getControlModel(), uno::UNO_QUERY );
-+ Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellAddressConversion" )), uno::UNO_QUERY );
-+ if ( xBindable.is() && xConvertor.is() )
-+ {
-+ table::CellAddress aAddress;
-+ xConvertor->setPropertyValue( OUSTR( "PersistentRepresentation" ), uno::makeAny( sLinkedCell ) );
-+ xConvertor->getPropertyValue( OUSTR( "Address" ) ) >>= aAddress;
-+ beans::NamedValue aArg1;
-+ aArg1.Name = OUSTR("BoundCell");
-+ aArg1.Value <<= aAddress;
-+
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[ 0 ] <<= aArg1;
-+
-+ uno::Reference< form::binding::XValueBinding > xBinding( xFac->createInstanceWithArguments( OUSTR("com.sun.star.table.CellValueBinding" ), aArgs ), uno::UNO_QUERY );
-+ xBindable->setValueBinding( xBinding );
-+
-+ }
-+ }
-+ // Set up CelllRange
-+ if ( sCellRange.getLength() )
-+ {
-+ Reference< form::binding::XListEntrySink > xListEntrySink( ctx.getControlModel(), uno::UNO_QUERY );
-+ Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellRangeAddressConversion" )), uno::UNO_QUERY );
-+ if ( xListEntrySink.is() && xConvertor.is() )
-+ {
-+ table::CellRangeAddress aAddress;
-+ xConvertor->setPropertyValue( OUSTR( "PersistentRepresentation" ), uno::makeAny( sCellRange ) );
-+ xConvertor->getPropertyValue( OUSTR( "Address" ) ) >>= aAddress;
-+ beans::NamedValue aArg1;
-+ aArg1.Name = OUSTR("CellRange");
-+ aArg1.Value <<= aAddress;
-+
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[ 0 ] <<= aArg1;
-+
-+ uno::Reference< form::binding::XListEntrySource > xSource( xFac->createInstanceWithArguments( OUSTR("com.sun.star.table.CellRangeListSource" ), aArgs ), uno::UNO_QUERY );
-+ xListEntrySink->setListEntrySource( xSource );
-+
-+ }
-+ }
-+ }
-+}
- // progessmeter
- //__________________________________________________________________________________________________
- Reference< xml::input::XElement > ProgressBarElement::startChildElement(
-@@ -1003,9 +1105,37 @@ void ImageControlElement::endElement()
- ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleImage") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("scale-image") ),
- _xAttributes );
-- ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM("src") ),
-- _xAttributes );
-+ rtl::OUString sURL = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "src" ) );
-+ Reference< document::XStorageBasedDocument > xDocStorage( _pImport->getDocOwner(), UNO_QUERY );
-+
-+ if ( xDocStorage.is() && IsPackageURL( sURL ) )
-+ {
-+ uno::Sequence< Any > aArgs( 1 );
-+ aArgs[ 0 ] <<= xDocStorage->getDocumentStorage();
-+
-+ ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
-+ uno::Reference< document::XGraphicObjectResolver > xGraphicResolver;
-+ aContext.createComponentWithArguments( OUSTR( "com.sun.star.comp.Svx.GraphicImportHelper" ), aArgs, xGraphicResolver );
-+
-+ if ( xGraphicResolver.is() )
-+ {
-+ rtl::OUString aTmp( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.Package:" ) );
-+ aTmp += sURL;
-+ sURL = xGraphicResolver->resolveGraphicObjectURL( aTmp );
-+ Reference< beans::XPropertySet > xProps( ctx.getControlModel(), UNO_QUERY );
-+ // we must set the url while the graphic object ( held by the resolver is in scope )
-+ if ( xProps.is() )
-+ xProps->setPropertyValue( OUSTR("ImageURL"), makeAny( sURL ) );
-+ }
-+ }
-+
-+ else if ( sURL.getLength() > 0 )
-+ {
-+ Reference< beans::XPropertySet > xProps( ctx.getControlModel(), UNO_QUERY );
-+ if ( xProps.is() )
-+ xProps->setPropertyValue( OUSTR("ImageURL"), makeAny( sURL ) );
-+ }
-+
- ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
- _xAttributes );
-@@ -1338,10 +1468,24 @@ void TitledBoxElement::endElement()
- Reference< xml::input::XElement > xRadio( _radios[ nPos ] );
- Reference< xml::input::XAttributes > xAttributes(
- xRadio->getAttributes() );
-+ OUString sLinkedCell;
-+ OUString sCellRange;
-+ OUString sService( OUSTR("com.sun.star.awt.UnoControlRadioButtonModel") );
-+ try
-+ {
-+ sLinkedCell = xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
-+ // we should probably limit this to vba mode also ( leave for now )
-+ if ( _pImport->getDocOwner().is() )
-+ sService = OUSTR("com.sun.star.form.component.RadioButton");
-+ }
-+ catch( Exception& /*e*/ )
-+ {
-+ }
-+
-
- ControlImportContext ctx(
- _pImport, getControlId( xAttributes ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) );
-+ sService );
- Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
-
- Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) );
-@@ -1393,7 +1537,7 @@ void TitledBoxElement::endElement()
- }
- xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
- makeAny( nVal ) );
--
-+ importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
- ::std::vector< Reference< xml::input::XElement > > * radioEvents =
- static_cast< RadioElement * >( xRadio.get() )->getEvents();
- ctx.importEvents( *radioEvents );
-@@ -1469,10 +1613,23 @@ void RadioGroupElement::endElement()
- Reference< xml::input::XElement > xRadio( _radios[ nPos ] );
- Reference< xml::input::XAttributes > xAttributes(
- xRadio->getAttributes() );
-+ OUString sLinkedCell;
-+ OUString sCellRange;
-+ OUString sService( OUSTR("com.sun.star.awt.UnoControlRadioButtonModel") );
-+ try
-+ {
-+ sLinkedCell = xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
-+ // we should probably limit this to vba mode also ( leave for now )
-+ if ( _pImport->getDocOwner().is() )
-+ sService = OUSTR("com.sun.star.form.component.RadioButton");
-+ }
-+ catch( Exception& /*e*/ )
-+ {
-+ }
-
- ControlImportContext ctx(
- _pImport, getControlId( xAttributes ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) );
-+ sService );
- Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
-
- Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) );
-@@ -1524,6 +1681,7 @@ void RadioGroupElement::endElement()
- xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
- makeAny( nVal ) );
-
-+ importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
- ::std::vector< Reference< xml::input::XElement > > * radioEvents =
- static_cast< RadioElement * >( xRadio.get() )->getEvents();
- ctx.importEvents( *radioEvents );
-@@ -1644,9 +1802,26 @@ Reference< xml::input::XElement > MenuLi
- void MenuListElement::endElement()
- throw (xml::sax::SAXException, RuntimeException)
- {
-+ OUString sLinkedCell;
-+ OUString sCellRange;
-+ OUString sListBoxService( OUSTR("com.sun.star.awt.UnoControlListBoxModel") );
-+
-+ // we should probably limit this to vba mode also ( leave for now )
-+ if ( _pImport->getDocOwner().is() )
-+ sListBoxService = OUSTR("com.sun.star.form.component.ListBox");
-+
-+ try
-+ {
-+ sLinkedCell = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
-+ sCellRange = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "source-cell-range" ) );
-+ }
-+ catch( Exception& /*e*/ )
-+ {
-+ }
- ControlImportContext ctx(
- _pImport, getControlId( _xAttributes ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) );
-+ //OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) );
-+ sListBoxService );
- Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
-
- Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
-@@ -1679,13 +1854,16 @@ void MenuListElement::endElement()
- ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
- _xAttributes );
--
-+ // import cell-link and cell source range
-+ importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
- if (_popup.is())
- {
- MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() );
-- xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ),
-+ if ( !sCellRange.getLength() )
-+ xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ),
- makeAny( p->getItemValues() ) );
-- xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") ),
-+ if ( !sLinkedCell.getLength() )
-+ xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") ),
- makeAny( p->getSelectedItems() ) );
- }
- ctx.importEvents( _events );
-@@ -1731,9 +1909,26 @@ Reference< xml::input::XElement > ComboB
- void ComboBoxElement::endElement()
- throw (xml::sax::SAXException, RuntimeException)
- {
-+ OUString sService( OUSTR("com.sun.star.awt.UnoControlComboBoxModel") );
-+
-+ // we should probably limit this to vba mode also ( leave for now )
-+ if ( _pImport->getDocOwner().is() )
-+ sService = OUSTR("com.sun.star.form.component.ComboBox");
-+
-+ OUString sLinkedCell;
-+ OUString sCellRange;
-+ try
-+ {
-+ sLinkedCell = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
-+ sCellRange = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "source-cell-range" ) );
-+ }
-+ catch( Exception& /*e*/ )
-+ {
-+ }
-+
- ControlImportContext ctx(
- _pImport, getControlId( _xAttributes ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ) );
-+ sService );
- Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
-
- Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
-@@ -1775,8 +1970,10 @@ void ComboBoxElement::endElement()
- ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
- _xAttributes );
-+ // import cell-link and cell source range
-+ importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
-
-- if (_popup.is())
-+ if (_popup.is() && !sCellRange.getLength() )
- {
- MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() );
- xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ),
---- xmlscript/source/xmldlg_imexp/xmldlg_import.cxx.old 2009-04-02 10:57:46.000000000 +0000
-+++ xmlscript/source/xmldlg_imexp/xmldlg_import.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -62,6 +62,7 @@
-
- using namespace ::com::sun::star;
- using namespace ::com::sun::star::uno;
-+using namespace ::com::sun::star::frame;
- using ::rtl::OUString;
-
- namespace xmlscript
-@@ -1879,12 +1880,13 @@ Reference< xml::input::XElement > Dialog
- //==================================================================================================
- Reference< xml::sax::XDocumentHandler > SAL_CALL importDialogModel(
- Reference< container::XNameContainer > const & xDialogModel,
-- Reference< XComponentContext > const & xContext )
-+ Reference< XComponentContext > const & xContext,
-+ Reference< XModel > const & xDocument )
- SAL_THROW( (Exception) )
- {
- return ::xmlscript::createDocumentHandler(
- static_cast< xml::input::XRoot * >(
-- new DialogImport( xContext, xDialogModel ) ) );
-+ new DialogImport( xContext, xDialogModel, xDocument ) ) );
- }
-
- }
diff --git a/patches/vba/eventhelper-closecrash-fix.diff b/patches/vba/eventhelper-closecrash-fix.diff
deleted file mode 100644
index 4020c1e71..000000000
--- a/patches/vba/eventhelper-closecrash-fix.diff
+++ /dev/null
@@ -1,135 +0,0 @@
-From fbf660cce474cefdf227992060cd3bcbc213f9aa Mon Sep 17 00:00:00 2001
-From: Jan Holesovsky <kendy@suse.cz>
-Date: Fri, 14 May 2010 17:00:02 +0200
-Subject: [PATCH 391/878] eventhelper-closecrash-fix.diff
-
----
- scripting/source/vbaevents/eventhelper.cxx | 58 ++++++++++++++++++++++++++--
- 1 files changed, 54 insertions(+), 4 deletions(-)
-
-diff --git a/scripting/source/vbaevents/eventhelper.cxx b/scripting/source/vbaevents/eventhelper.cxx
-index 6f50303..c696a35 100644
---- a/scripting/source/vbaevents/eventhelper.cxx
-+++ b/scripting/source/vbaevents/eventhelper.cxx
-@@ -14,6 +14,9 @@
- #include <com/sun/star/lang/XServiceInfo.hpp>
- #include <com/sun/star/lang/XInitialization.hpp>
-
-+#include <com/sun/star/util/XCloseListener.hpp>
-+#include <com/sun/star/util/XCloseBroadcaster.hpp>
-+
- #include <com/sun/star/frame/XModel.hpp>
-
- #include <com/sun/star/script/XLibraryContainer.hpp>
-@@ -47,7 +50,7 @@
- #include <com/sun/star/lang/XMultiComponentFactory.hpp>
- #include <com/sun/star/script/XScriptListener.hpp>
- #include <cppuhelper/implbase1.hxx>
--#include <cppuhelper/implbase2.hxx>
-+#include <cppuhelper/implbase3.hxx>
- #include <comphelper/evtmethodhelper.hxx>
-
- #include <set>
-@@ -610,7 +613,7 @@ private:
- Reference< container::XNameContainer > m_xNameContainer;
- };
-
--typedef ::cppu::WeakImplHelper2< XScriptListener, lang::XInitialization > EventListener_BASE;
-+typedef ::cppu::WeakImplHelper3< XScriptListener, util::XCloseListener, lang::XInitialization > EventListener_BASE;
-
- #define EVENTLSTNR_PROPERTY_ID_MODEL 1
- #define EVENTLSTNR_PROPERTY_MODEL ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Model" ) )
-@@ -630,6 +633,9 @@ public:
- // XScriptListener
- virtual void SAL_CALL firing(const ScriptEvent& evt) throw(RuntimeException);
- virtual Any SAL_CALL approveFiring(const ScriptEvent& evt) throw(reflection::InvocationTargetException, RuntimeException);
-+ // XCloseListener
-+ virtual void SAL_CALL queryClosing( const lang::EventObject& Source, ::sal_Bool GetsOwnership ) throw (util::CloseVetoException, uno::RuntimeException);
-+ virtual void SAL_CALL notifyClosing( const lang::EventObject& Source ) throw (uno::RuntimeException);
- // XPropertySet
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException);
- // XInitialization
-@@ -641,8 +647,27 @@ public:
- DECLARE_XTYPEPROVIDER()
- virtual void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
- {
-+ if ( nHandle == EVENTLSTNR_PROPERTY_ID_MODEL )
-+ {
-+ uno::Reference< frame::XModel > xModel( rValue, uno::UNO_QUERY );
-+ if( xModel != m_xModel)
-+ {
-+ // Remove the listener from the old XCloseBroadcaster.
-+ uno::Reference< util::XCloseBroadcaster > xCloseBroadcaster( m_xModel, uno::UNO_QUERY );
-+ if (xCloseBroadcaster.is())
-+ {
-+ xCloseBroadcaster->removeCloseListener( this );
-+ }
-+ // Add the listener into the new XCloseBroadcaster.
-+ xCloseBroadcaster = uno::Reference< util::XCloseBroadcaster >( xModel, uno::UNO_QUERY );
-+ if (xCloseBroadcaster.is())
-+ {
-+ xCloseBroadcaster->addCloseListener( this );
-+ }
-+ }
-+ }
- OPropertyContainer::setFastPropertyValue( nHandle, rValue );
-- if ( nHandle == EVENTLSTNR_PROPERTY_ID_MODEL )
-+ if ( nHandle == EVENTLSTNR_PROPERTY_ID_MODEL )
- setShellFromModel();
- }
-
-@@ -663,11 +688,12 @@ private:
- Reference< XComponentContext > m_xContext;
- Reference< frame::XModel > m_xModel;
- SfxObjectShell* mpShell;
-+ sal_Bool m_bDocClosed;
-
- };
-
- EventListener::EventListener( const Reference< XComponentContext >& rxContext ) :
--OPropertyContainer(GetBroadcastHelper()), m_xContext( rxContext ), mpShell( 0 )
-+OPropertyContainer(GetBroadcastHelper()), m_xContext( rxContext ), m_bDocClosed(sal_False), mpShell( 0 )
- {
- registerProperty( EVENTLSTNR_PROPERTY_MODEL, EVENTLSTNR_PROPERTY_ID_MODEL,
- beans::PropertyAttribute::TRANSIENT, &m_xModel, ::getCppuType( &m_xModel ) );
-@@ -743,6 +769,24 @@ EventListener::approveFiring(const ScriptEvent& evt) throw(reflection::Invocatio
- return ret;
- }
-
-+// XCloseListener
-+void SAL_CALL
-+EventListener::queryClosing( const lang::EventObject& Source, ::sal_Bool GetsOwnership ) throw (util::CloseVetoException, uno::RuntimeException)
-+{
-+ //Nothing to do
-+}
-+
-+void SAL_CALL
-+EventListener::notifyClosing( const lang::EventObject& Source ) throw (uno::RuntimeException)
-+{
-+ m_bDocClosed = sal_True;
-+ uno::Reference< util::XCloseBroadcaster > xCloseBroadcaster( m_xModel, uno::UNO_QUERY );
-+ if (xCloseBroadcaster.is())
-+ {
-+ xCloseBroadcaster->removeCloseListener( this );
-+ }
-+}
-+
- // XInitialization
- void SAL_CALL
- EventListener::initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException)
-@@ -924,6 +968,12 @@ EventListener::firing_Impl(const ScriptEvent& evt, Any* pRet ) throw(RuntimeExce
- OSL_TRACE("sMacroLoc is %s", rtl::OUStringToOString( sMacroLoc, RTL_TEXTENCODING_UTF8 ).getStr() );
- for ( ; txInfo != txInfo_end; ++txInfo )
- {
-+ // If the document is closed, we should not execute macro.
-+ if (m_bDocClosed)
-+ {
-+ break;
-+ }
-+
- rtl::OUString sTemp = sName.concat( (*txInfo).sVBAName );
- // see if we have a match for the handlerextension
- // where ScriptCode is methodname_handlerextension
---
-1.7.0.1
-
diff --git a/patches/vba/fix-containercontrols-wizardresize.diff b/patches/vba/fix-containercontrols-wizardresize.diff
deleted file mode 100644
index 527036a59..000000000
--- a/patches/vba/fix-containercontrols-wizardresize.diff
+++ /dev/null
@@ -1,82 +0,0 @@
-From 9e61ebda4bacd91c4c70bed1b6eaff2ce0858170 Mon Sep 17 00:00:00 2001
-From: Jan Holesovsky <kendy@suse.cz>
-Date: Fri, 14 May 2010 17:00:25 +0200
-Subject: [PATCH 407/878] fix-containercontrols-wizardresize.diff
-
----
- toolkit/inc/toolkit/controls/dialogcontrol.hxx | 4 ++--
- toolkit/source/controls/dialogcontrol.cxx | 12 +++++++-----
- 2 files changed, 9 insertions(+), 7 deletions(-)
-
-diff --git a/toolkit/inc/toolkit/controls/dialogcontrol.hxx b/toolkit/inc/toolkit/controls/dialogcontrol.hxx
-index 7ead237..fbb4e74 100644
---- a/toolkit/inc/toolkit/controls/dialogcontrol.hxx
-+++ b/toolkit/inc/toolkit/controls/dialogcontrol.hxx
-@@ -230,6 +230,8 @@ typedef ::cppu::ImplHelper2 < ::com::sun::star::container::XContainerListener
- class UnoDialogContainerControl : public UnoControlContainer, public UnoDialogContainerControl_IBase
- {
- protected:
-+ bool mbSizeModified;
-+ bool mbPosModified;
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > mxTabController;
- void ImplInsertControl( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxModel, const ::rtl::OUString& rName );
- void ImplRemoveControl( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxModel );
-@@ -280,8 +282,6 @@ private:
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar > mxMenuBar;
- TopWindowListenerMultiplexer maTopWindowListeners;
- bool mbWindowListener;
-- bool mbSizeModified;
-- bool mbPosModified;
- ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicObject > mxGrfObj;
- ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > mxListener;
-
-diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx
-index 2447dcf..c0541c5 100644
---- a/toolkit/source/controls/dialogcontrol.cxx
-+++ b/toolkit/source/controls/dialogcontrol.cxx
-@@ -2178,7 +2178,9 @@ uno::Reference< beans::XPropertySetInfo > UnoFrameModel::getPropertySetInfo( )
- // ----------------------------------------------------
- // class DialogContainerControl
- // ----------------------------------------------------
--UnoDialogContainerControl::UnoDialogContainerControl()
-+UnoDialogContainerControl::UnoDialogContainerControl() :
-+ mbSizeModified(false),
-+ mbPosModified(false)
- {
- maComponentInfos.nWidth = 280;
- maComponentInfos.nHeight = 400;
-@@ -2251,7 +2253,6 @@ void UnoDialogContainerControl::ImplSetPosSize( Reference< XControl >& rxCtrl )
- xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PositionY" ) ) ) >>= nY;
- xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" ) ) ) >>= nWidth;
- xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) ) >>= nHeight;
--
- MapMode aMode( MAP_APPFONT );
- sal_Bool bVBAForm = sal_False;
- Reference< XPropertySet > xDlgModelProps( getModel(), UNO_QUERY );
-@@ -2481,9 +2482,12 @@ void UnoDialogContainerControl::ImplModelPropertiesChanged( const Sequence< Prop
- {
- if ( bOwnModel )
- {
-+ if ( !mbPosModified && !mbSizeModified )
-+ {
- // Don't set new pos/size if we get new values from window listener
- Reference< XControl > xThis( (XAggregation*)(::cppu::OWeakAggObject*)this, UNO_QUERY );
- ImplSetPosSize( xThis );
-+ }
- }
- else
- {
-@@ -2551,9 +2555,7 @@ void SAL_CALL UnoDialogContainerControl::changesOccurred( const ChangesEvent& )
-
- UnoDialogControl::UnoDialogControl() :
- maTopWindowListeners( *this ),
-- mbWindowListener(false),
-- mbSizeModified(false),
-- mbPosModified(false)
-+ mbWindowListener(false)
- {
- maComponentInfos.nWidth = 300;
- maComponentInfos.nHeight = 450;
---
-1.7.0.1
-
diff --git a/patches/vba/fix-doc-exit-basic-error-core.diff b/patches/vba/fix-doc-exit-basic-error-core.diff
deleted file mode 100644
index 48de34fcd..000000000
--- a/patches/vba/fix-doc-exit-basic-error-core.diff
+++ /dev/null
@@ -1,13 +0,0 @@
-Index: sfx2/source/appl/app.cxx
-===================================================================
---- sfx2/source/appl/app.cxx (revision 268722)
-+++ sfx2/source/appl/app.cxx (working copy)
-@@ -753,7 +753,7 @@
- basicide_handle_basic_error pSymbol = (basicide_handle_basic_error) osl_getFunctionSymbol( handleMod, aSymbol.pData );
-
- // call basicide_handle_basic_error in basctl
-- long nRet = pSymbol( pStarBasic );
-+ long nRet = pSymbol ? pSymbol( pStarBasic ) : 0;
-
- return nRet;
- }
diff --git a/patches/vba/fix-name-range-separator.diff b/patches/vba/fix-name-range-separator.diff
deleted file mode 100644
index 0990d06ad..000000000
--- a/patches/vba/fix-name-range-separator.diff
+++ /dev/null
@@ -1,46 +0,0 @@
- sc/source/ui/vba/vbarange.cxx | 8 +++++---
- 1 files changed, 5 insertions(+), 3 deletions(-)
-
-diff --git sc/source/ui/vba/vbarange.cxx sc/source/ui/vba/vbarange.cxx
-index d9cc4ea..2e6eae1 100644
---- sc/source/ui/vba/vbarange.cxx
-+++ sc/source/ui/vba/vbarange.cxx
-@@ -1044,7 +1044,7 @@ public:
- };
-
- bool
--getCellRangesForAddress( USHORT& rResFlags, const rtl::OUString& sAddress, ScDocShell* pDocSh, ScRangeList& rCellRanges, formula::FormulaGrammar::AddressConvention& eConv )
-+getCellRangesForAddress( USHORT& rResFlags, const rtl::OUString& sAddress, ScDocShell* pDocSh, ScRangeList& rCellRanges, formula::FormulaGrammar::AddressConvention& eConv, char cDelimiter = 0 )
- {
-
- ScDocument* pDoc = NULL;
-@@ -1054,7 +1054,7 @@ getCellRangesForAddress( USHORT& rResFlags, const rtl::OUString& sAddress, ScDoc
- pDoc = pDocSh->GetDocument();
- String aString(sAddress);
- USHORT nMask = SCA_VALID;
-- rResFlags = rCellRanges.Parse( sAddress, pDoc, nMask, eConv, 0 );
-+ rResFlags = rCellRanges.Parse( sAddress, pDoc, nMask, eConv, cDelimiter );
- if ( rResFlags & SCA_VALID )
- {
- return true;
-@@ -1107,6 +1107,7 @@ bool getScRangeListForAddress( const rtl::OUString& sName, ScDocShell* pDocSh, S
- }
- }
- }
-+ char aChar = 0;
- if ( xNameAccess->hasByName( sAddress ) )
- {
- uno::Reference< sheet::XNamedRange > xNamed( xNameAccess->getByName( sAddress ), uno::UNO_QUERY_THROW );
-@@ -1114,10 +1115,11 @@ bool getScRangeListForAddress( const rtl::OUString& sName, ScDocShell* pDocSh, S
- // As the address comes from OOO, the addressing
- // style is may not be XL_A1
- eConv = pDocSh->GetDocument()->GetAddressConvention();
-+ aChar = ';';
- }
-
- USHORT nFlags = 0;
-- if ( !getCellRangesForAddress( nFlags, sAddress, pDocSh, aCellRanges, eConv ) )
-+ if ( !getCellRangesForAddress( nFlags, sAddress, pDocSh, aCellRanges, eConv, aChar ) )
- return false;
-
- bool bTabFromReferrer = !( nFlags & SCA_TAB_3D );
diff --git a/patches/vba/fix-read-disabled-toolbarimport.diff b/patches/vba/fix-read-disabled-toolbarimport.diff
deleted file mode 100644
index 8d40a4bc9..000000000
--- a/patches/vba/fix-read-disabled-toolbarimport.diff
+++ /dev/null
@@ -1,62 +0,0 @@
-diff --git sw/source/filter/ww8/ww8toolbar.cxx sw/source/filter/ww8/ww8toolbar.cxx
-index d63fd77..dfcaa17 100644
---- sw/source/filter/ww8/ww8toolbar.cxx
-+++ sw/source/filter/ww8/ww8toolbar.cxx
-@@ -273,7 +273,7 @@ bool Customization::ImportCustomToolBar( CustomToolBarImportHelper& helper )
- {
- if ( bIsDroppedMenuTB )
- return true; // ignore ( will be processed by the ImportMenu )
-- if ( tbidForTBD == 0x25 && customizationDataTBDelta.size() ) // we can handle in a limited way additions the built-in menu bar
-+ if ( tbidForTBD == 0x25 ) // we can handle in a limited way additions the built-in menu bar
- {
- for ( std::vector< TBDelta >::iterator it = customizationDataTBDelta.begin(); it != customizationDataTBDelta.end(); ++it )
- {
-@@ -481,7 +481,8 @@ CTB::Print( FILE* fp )
- bool CTB::ImportCustomToolBar( CustomToolBarImportHelper& helper )
- {
- static rtl::OUString sToolbarPrefix( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/custom_" ) );
--
-+ if ( !tb.IsEnabled() )
-+ return true; // didn't fail, just ignoring
- // Create default setting
- uno::Reference< container::XIndexContainer > xIndexContainer( helper.getCfgManager()->createSettings(), uno::UNO_QUERY_THROW );
- uno::Reference< container::XIndexAccess > xIndexAccess( xIndexContainer, uno::UNO_QUERY_THROW );
-@@ -491,7 +492,6 @@ bool CTB::ImportCustomToolBar( CustomToolBarImportHelper& helper )
- xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UIName") ), uno::makeAny( name.getString() ) );
-
- rtl::OUString sToolBarName = sToolbarPrefix.concat( name.getString() );
--
- for ( std::vector< TBC >::iterator it = rTBC.begin(); it != rTBC.end(); ++it )
- {
- // createToolBar item for control
-@@ -542,12 +542,17 @@ bool TB::Read( SvStream* pS )
- return name.Read( pS );
- }
-
-+bool TB::IsEnabled()
-+{
-+ return ( bFlags & 0x10 ) != 0x10;
-+}
-+
- void TB::Print( FILE* fp )
- {
- Indent a;
- indent_printf( fp, "[ 0x%x ] TB -- dump\n", nOffSet );
- indent_printf( fp, " bSignature (0x%x), bVersion(0x%x), cCL(0x%x), ltbid(0x%x), cRowsDefault (0x%x), ltbtr(0x%x), bFlags(0x%x)\n", bSignature, bVersion, cCL, static_cast< unsigned int >( ltbid ), static_cast< unsigned int >( ltbtr ), cRowsDefault, bFlags );
-- indent_printf( fp, " name %s\n", rtl::OUStringToOString( name.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ indent_printf( fp, " name %s state - %s\n", rtl::OUStringToOString( name.getString(), RTL_TEXTENCODING_UTF8 ).getStr(), IsEnabled() ? "true" : "false" );
-
- }
-
-diff --git sw/source/filter/ww8/ww8toolbar.hxx sw/source/filter/ww8/ww8toolbar.hxx
-index c3e57ed..ae23835 100644
---- sw/source/filter/ww8/ww8toolbar.hxx
-+++ sw/source/filter/ww8/ww8toolbar.hxx
-@@ -46,6 +46,7 @@ public:
- ~TB(){}
- bool Read(SvStream *pS);
- void Print( FILE* );
-+ bool IsEnabled();
- };
-
- class CTB : public TBBase
diff --git a/patches/vba/fix-sheet-control-valueset.diff b/patches/vba/fix-sheet-control-valueset.diff
deleted file mode 100644
index 7a1c875ce..000000000
--- a/patches/vba/fix-sheet-control-valueset.diff
+++ /dev/null
@@ -1,72 +0,0 @@
-diff --git sc/source/ui/vba/vbaworksheet.cxx sc/source/ui/vba/vbaworksheet.cxx
-index 310f81e..166abfe 100644
---- sc/source/ui/vba/vbaworksheet.cxx
-+++ sc/source/ui/vba/vbaworksheet.cxx
-@@ -32,6 +32,7 @@
-
- #include <com/sun/star/beans/XPropertySet.hpp>
- #include <com/sun/star/beans/XIntrospectionAccess.hpp>
-+#include <com/sun/star/beans/XIntrospection.hpp>
- #include <com/sun/star/container/XNamed.hpp>
- #include <com/sun/star/util/XProtectable.hpp>
- #include <com/sun/star/table/XCellRange.hpp>
-@@ -764,9 +765,9 @@ 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)
-diff --git vbahelper/inc/vbahelper/vbahelper.hxx vbahelper/inc/vbahelper/vbahelper.hxx
-index 5749839..3fc1a62 100644
---- vbahelper/inc/vbahelper/vbahelper.hxx
-+++ vbahelper/inc/vbahelper/vbahelper.hxx
-@@ -91,6 +91,7 @@ namespace ooo
- VBAHELPER_DLLPUBLIC double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical);
- VBAHELPER_DLLPUBLIC sal_Int32 getPointerStyle( const css::uno::Reference< css::frame::XModel >& );
- VBAHELPER_DLLPUBLIC void setCursorHelper( const css::uno::Reference< css::frame::XModel >& xModel, const Pointer& rPointer, sal_Bool bOverWrite );
-+ VBAHELPER_DLLPUBLIC void setDefaultPropByIntrospection( const css::uno::Any& aObj, const css::uno::Any& aValue ) throw ( css::uno::RuntimeException );
-
- class VBAHELPER_DLLPUBLIC Millimeter
- {
-diff --git vbahelper/source/vbahelper/vbahelper.cxx vbahelper/source/vbahelper/vbahelper.cxx
-index b95ccf1..acdfb9e 100644
---- vbahelper/source/vbahelper/vbahelper.cxx
-+++ vbahelper/source/vbahelper/vbahelper.cxx
-@@ -34,6 +34,7 @@
- #include <com/sun/star/frame/XFrame.hpp>
- #include <com/sun/star/frame/XDesktop.hpp>
- #include <com/sun/star/frame/XController.hpp>
-+#include <com/sun/star/script/XDefaultProperty.hpp>
- #include <com/sun/star/uno/XComponentContext.hpp>
- #include <com/sun/star/lang/XMultiComponentFactory.hpp>
- #include <com/sun/star/beans/XPropertySet.hpp>
-@@ -952,6 +953,23 @@ String docMacroExists( SfxObjectShell* pShell, const String& sMod, const String&
- return sFullName;
- }
-
-+void setDefaultPropByIntrospection( const uno::Any& aObj, const uno::Any& aValue ) throw ( uno::RuntimeException )
-+{
-+ uno::Reference< beans::XIntrospectionAccess > xUnoAccess( getIntrospectionAccess( aObj ) );
-+
-+ // #MAYBE #FIXME sort of a bit of a hack,
-+ uno::Reference< script::XDefaultProperty > xDflt( aObj, uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xPropSet;
-+
-+ if ( xUnoAccess.is() )
-+ xPropSet.set( xUnoAccess->queryAdapter( ::getCppuType( (const uno::Reference< beans::XPropertySet > *)0 ) ), uno::UNO_QUERY);
-+
-+ if ( xPropSet.is() )
-+ xPropSet->setPropertyValue( xDflt->getDefaultPropertyName(), aValue );
-+ else
-+ throw uno::RuntimeException();
-+}
-+
- #define VBA_LEFT "PositionX"
- #define VBA_TOP "PositionY"
- UserFormGeometryHelper::UserFormGeometryHelper( const uno::Reference< uno::XComponentContext >& /*xContext*/, const uno::Reference< awt::XControl >& xControl )
diff --git a/patches/vba/fix-vba-NOT-trigger-update.diff b/patches/vba/fix-vba-NOT-trigger-update.diff
deleted file mode 100644
index 63fe5e122..000000000
--- a/patches/vba/fix-vba-NOT-trigger-update.diff
+++ /dev/null
@@ -1,87 +0,0 @@
-diff --git basic/source/runtime/runtime.cxx basic/source/runtime/runtime.cxx
-index 5cec3e2..69c75b3 100644
---- basic/source/runtime/runtime.cxx
-+++ basic/source/runtime/runtime.cxx
-@@ -48,6 +48,8 @@
- #include "sbunoobj.hxx"
- #include "errobject.hxx"
-
-+SbxVariable* getDefaultProp( SbxVariable* pRef );
-+
- bool SbiRuntime::isVBAEnabled()
- {
- bool result = false;
-@@ -961,7 +963,25 @@ SbxVariable* SbiRuntime::GetTOS( short n
- void SbiRuntime::TOSMakeTemp()
- {
- SbxVariable* p = refExprStk->Get( nExprLvl - 1 );
-- if( p->GetRefCount() != 1 )
-+ if ( p->GetType() == SbxEMPTY )
-+ p->Broadcast( SBX_HINT_DATAWANTED );
-+
-+ SbxVariable* pDflt = NULL;
-+ if ( bVBAEnabled && ( p->GetType() == SbxOBJECT || p->GetType() == SbxVARIANT ) && ( pDflt = getDefaultProp( p ) ) )
-+ {
-+ pDflt->Broadcast( SBX_HINT_DATAWANTED );
-+ // replacing new p on stack causes object pointed by
-+ // pDft->pParent to be deleted, when p2->Compute() is
-+ // called below pParent is accessed ( but its deleted )
-+ // so set it to NULL now
-+ pDflt->SetParent( NULL );
-+ p = new SbxVariable( *pDflt );
-+ p->SetFlag( SBX_READWRITE );
-+ refExprStk->Put( p, nExprLvl - 1 );
-+// return;
-+ }
-+
-+ else if( p->GetRefCount() != 1 )
- {
- SbxVariable* pNew = new SbxVariable( *p );
- pNew->SetFlag( SBX_READWRITE );
-@@ -970,7 +990,6 @@ void SbiRuntime::TOSMakeTemp()
- }
-
- // Der GOSUB-Stack nimmt Returnadressen fuer GOSUBs auf
--
- void SbiRuntime::PushGosub( const BYTE* pc )
- {
- if( ++nGosubLvl > MAXRECURSION )
-diff --git basic/source/runtime/step0.cxx basic/source/runtime/step0.cxx
-index cbd2fad..0666725 100644
---- basic/source/runtime/step0.cxx
-+++ basic/source/runtime/step0.cxx
-@@ -59,34 +59,6 @@ void SbiRuntime::StepArith( SbxOperator
- TOSMakeTemp();
- SbxVariable* p2 = GetTOS();
-
--
-- // This could & should be moved to the MakeTempTOS() method in runtime.cxx
-- // In the code which this is cut'npaste from there is a check for a ref
-- // count != 1 based on which the copy of the SbxVariable is done.
-- // see orig code in MakeTempTOS ( and I'm not sure what the significance,
-- // of that is )
-- // here we alway seem to have a refcount of 1. Also it seems that
-- // MakeTempTOS is called for other operation, so I hold off for now
-- // until I have a better idea
-- if ( bVBAEnabled
-- && ( p2->GetType() == SbxOBJECT || p2->GetType() == SbxVARIANT )
-- )
-- {
-- SbxVariable* pDflt = getDefaultProp( p2 );
-- if ( pDflt )
-- {
-- pDflt->Broadcast( SBX_HINT_DATAWANTED );
-- // replacing new p2 on stack causes object pointed by
-- // pDft->pParent to be deleted, when p2->Compute() is
-- // called below pParent is accessed ( but its deleted )
-- // so set it to NULL now
-- pDflt->SetParent( NULL );
-- p2 = new SbxVariable( *pDflt );
-- p2->SetFlag( SBX_READWRITE );
-- refExprStk->Put( p2, nExprLvl - 1 );
-- }
-- }
--
- p2->ResetFlag( SBX_FIXED );
- p2->Compute( eOp, *p1 );
-
diff --git a/patches/vba/fix-vba-late-docevent-crash.diff b/patches/vba/fix-vba-late-docevent-crash.diff
deleted file mode 100644
index 930924be4..000000000
--- a/patches/vba/fix-vba-late-docevent-crash.diff
+++ /dev/null
@@ -1,203 +0,0 @@
-diff --git sc/source/ui/docshell/docsh.cxx sc/source/ui/docshell/docsh.cxx
-index d500001..2cd4321 100644
---- sc/source/ui/docshell/docsh.cxx
-+++ sc/source/ui/docshell/docsh.cxx
-@@ -392,10 +392,12 @@ void ScDocShell::AfterXMLLoading(sal_Bool bRet)
- BasicManager* pAppMgr = SFX_APP()->GetBasicManager();
- if ( pAppMgr )
- pAppMgr->SetGlobalUNOConstant( "ThisExcelDoc", aArgs[ 0 ] );
-+#if 0 // this should be controlled by a compatibility mode
- // suppress VBA events when loading the xml
- uno::Reference< document::XVbaEventsHelper > xEvt( aDocument.GetVbaEventsHelper() );
- if ( xEvt.is() )
- xEvt->setIgnoreEvents( sal_False );
-+#endif
- aDocument.SetImportingXML( FALSE );
- aDocument.EnableExecuteLink( true );
- aDocument.EnableUndo( TRUE );
-diff --git sc/source/ui/vba/vbaeventshelper.cxx sc/source/ui/vba/vbaeventshelper.cxx
-index e3a6e85..a22702d 100644
---- sc/source/ui/vba/vbaeventshelper.cxx
-+++ sc/source/ui/vba/vbaeventshelper.cxx
-@@ -253,15 +253,19 @@ VbaEventsListener::startEventsLinstener()
- xCloseBroadcaster->addCloseListener( this );
- }
- // add Border resize listener
-- uno::Reference< frame::XController > xController( m_xModel->getCurrentController(), uno::UNO_QUERY );
-- if( xController.is() )
-+ try
- {
-- uno::Reference< frame::XControllerBorder > xControllerBorder( xController, uno::UNO_QUERY );
-- if( xControllerBorder.is() )
-+ uno::Reference< frame::XController > xController( m_xModel->getCurrentController(), uno::UNO_QUERY );
-+ if( xController.is() )
- {
-- xControllerBorder->addBorderResizeListener( this );
-+ uno::Reference< frame::XControllerBorder > xControllerBorder( xController, uno::UNO_QUERY );
-+ if( xControllerBorder.is() )
-+ {
-+ xControllerBorder->addBorderResizeListener( this );
-+ }
- }
- }
-+ catch( uno::Exception& e) {} // Disposed already most likely
- }
- }
- void
-@@ -280,17 +284,21 @@ VbaEventsListener::stopEventsLinstener()
- {
- xCloseBroadcaster->removeCloseListener( this );
- }
-- uno::Reference< frame::XController > xController( m_xModel->getCurrentController(), uno::UNO_QUERY );
-- if( xController.is() )
-+ try
- {
-- uno::Reference< frame::XControllerBorder > xControllerBorder( xController, uno::UNO_QUERY );
-- if( xControllerBorder.is() )
-+ uno::Reference< frame::XController > xController( m_xModel->getCurrentController(), uno::UNO_QUERY );
-+ if( xController.is() )
- {
-- xControllerBorder->removeBorderResizeListener( this );
-+ uno::Reference< frame::XControllerBorder > xControllerBorder( xController, uno::UNO_QUERY );
-+ if( xControllerBorder.is() )
-+ {
-+ xControllerBorder->removeBorderResizeListener( this );
-+ }
- }
- }
-- pVbaEventsHelper = NULL;
-+ catch ( uno::Exception& e ){}
- }
-+ pVbaEventsHelper = NULL;
- }
-
- void
-@@ -375,7 +383,7 @@ VbaEventsListener::borderWidthsChanged( const uno::Reference< uno::XInterface >&
- }
- }
-
--ScVbaEventsHelper::ScVbaEventsHelper( uno::Sequence< css::uno::Any > const& aArgs, uno::Reference< uno::XComponentContext > const& xContext ) : VbaEventsHelperBase( xContext ), mbOpened( sal_False )
-+ScVbaEventsHelper::ScVbaEventsHelper( uno::Sequence< css::uno::Any > const& aArgs, uno::Reference< uno::XComponentContext > const& xContext ) : VbaEventsHelperBase( xContext ), mbOpened( sal_False ), mbDocDisposed( false )
- {
- Initilize();
- uno::Reference< frame::XModel > xModel ( getXSomethingFromArgs< frame::XModel >( aArgs, 0 ), uno::UNO_QUERY );
-@@ -385,10 +393,46 @@ ScVbaEventsHelper::ScVbaEventsHelper( uno::Sequence< css::uno::Any > const& aArg
- uno::Reference< util::XChangesNotifier > xChangesNotifier( xModel, uno::UNO_QUERY );
- if( xChangesNotifier.is() )
- xChangesNotifier->addChangesListener( uno::Reference< util::XChangesListener >( new WorksheetChangeListener( this ) ) );
-+ if ( xModel.is() )
-+ {
-+ uno::Reference< lang::XComponent > xComponent( xModel, uno::UNO_QUERY );
-+ if ( xComponent.is() )
-+ {
-+ xComponent->addEventListener( this );
-+ }
-+ }
- }
-
- ScVbaEventsHelper::~ScVbaEventsHelper()
- {
-+ stopListening();
-+}
-+
-+void ScVbaEventsHelper::stopListening()
-+{
-+ if ( mbDocDisposed )
-+ return;
-+ uno::Reference< frame::XModel > xModel( getDocument()->GetDocumentShell()->GetModel(), uno::UNO_QUERY );
-+ if ( xModel.is() )
-+ {
-+ uno::Reference< lang::XComponent > xComponent( xModel, uno::UNO_QUERY );
-+ if ( xComponent.is() )
-+ {
-+ try
-+ {
-+ xComponent->removeEventListener( this );
-+ }
-+ catch( uno::Exception& e ) {}
-+ }
-+ }
-+ if ( xModel.is() )
-+ {
-+ uno::Reference< lang::XComponent > xComponent( xModel, uno::UNO_QUERY );
-+ if ( xComponent.is() )
-+ {
-+ xComponent->addEventListener( this );
-+ }
-+ }
- }
-
- #define CREATEOUSTRING(asciistr) rtl::OUString::createFromAscii(asciistr)
-@@ -788,11 +832,19 @@ SCTAB ScVbaEventsHelper::getTabFromArgs( const uno::Sequence< uno::Any > aArgs,
- return nTab;
- }
-
-+void
-+ScVbaEventsHelper::disposing(const com::sun::star::lang::EventObject& aSource ) throw (com::sun::star::uno::RuntimeException)
-+{
-+ OSL_TRACE("ScVbaEventsHelper::disposing");
-+ stopListening();
-+ mbDocDisposed = true;
-+}
-+
- sal_Bool SAL_CALL
- ScVbaEventsHelper::ProcessCompatibleVbaEvent( sal_Int32 nEventId, const uno::Sequence< uno::Any >& aArgs ) throw (uno::RuntimeException)
- {
- SfxObjectShell* pShell = pDoc->GetDocumentShell();
-- if( !pShell || mbIgnoreEvents)
-+ if( !pShell || mbIgnoreEvents || mbDocDisposed )
- return sal_False;
-
- // In order to better support "withevents" in the future,
-diff --git sc/source/ui/vba/vbaeventshelper.hxx sc/source/ui/vba/vbaeventshelper.hxx
-index 20a2cef..28b141e 100644
---- sc/source/ui/vba/vbaeventshelper.hxx
-+++ sc/source/ui/vba/vbaeventshelper.hxx
-@@ -38,25 +38,29 @@
-
- #include "document.hxx"
- #include <cppuhelper/implbase1.hxx>
-+#include <cppuhelper/implbase2.hxx>
- #include <com/sun/star/document/VbaEventId.hpp>
- #include <com/sun/star/document/XVbaEventsHelper.hpp>
-+#include <com/sun/star/lang/XEventListener.hpp>
- #include <com/sun/star/awt/XWindowListener.hpp>
- #include "excelvbahelper.hxx"
- #include <vbahelper/vbaeventshelperbase.hxx>
-
- #define INVALID_TAB -1
-
--typedef ::cppu::WeakImplHelper1< com::sun::star::document::XVbaEventsHelper > VBAWorkbookEvent_BASE;
-+typedef ::cppu::WeakImplHelper2< com::sun::star::document::XVbaEventsHelper, com::sun::star::lang::XEventListener > VBAWorkbookEvent_BASE;
-
- class VbaEventsListener;
- class ScDocShell;
- class ScVbaEventsHelper : public VBAWorkbookEvent_BASE, public VbaEventsHelperBase
- {
-+friend class VbaEventsListener;
- private:
- ScDocument* pDoc;
- ScDocShell* pDocShell;
- css::uno::Reference< css::awt::XWindowListener > m_xVbaEventsListener;
- sal_Bool mbOpened;
-+ sal_Bool mbDocDisposed;
-
- String getSheetModuleName( SCTAB nTab );
- css::uno::Any createWorkSheet( SfxObjectShell* pShell, SCTAB nTab );
-@@ -67,13 +71,15 @@ private:
- rtl::OUString getMacroPath( const sal_Int32 nEventId, const SCTAB nTab = INVALID_TAB );
- sal_Bool processVbaEvent( const sal_Int32 nEventId, const css::uno::Sequence< css::uno::Any >& rArgs, const SCTAB nTab = INVALID_TAB );
- void Initilize();
--
-+ void stopListening();
- public:
- //ScVbaEventsHelper( ScDocument* pDocument ):pDoc( pDocument ), mbOpened( sal_False ){};
- ScVbaEventsHelper( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext > const& xContext );
- ~ScVbaEventsHelper();
- ScDocument* getDocument() { return pDoc; };
- ScDocShell* getDocumentShell() { return pDocShell; };
-+ // XEventListener
-+ virtual void SAL_CALL disposing(const css::lang::EventObject& aSource) throw(css::uno::RuntimeException);
- // XVBAWorkbookEventHelper
- virtual sal_Bool SAL_CALL ProcessCompatibleVbaEvent( sal_Int32 nEventId, const css::uno::Sequence< css::uno::Any >& aArgs ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL setIgnoreEvents( ::sal_Bool _ignoreevents ) throw (css::uno::RuntimeException);
diff --git a/patches/vba/ibm-misc-fixes-1.diff b/patches/vba/ibm-misc-fixes-1.diff
deleted file mode 100644
index 3c21fb1e5..000000000
--- a/patches/vba/ibm-misc-fixes-1.diff
+++ /dev/null
@@ -1,1367 +0,0 @@
-diff --git basic/inc/basic/sbobjmod.hxx basic/inc/basic/sbobjmod.hxx
-index 96cbe9b..5a9be63 100644
---- basic/inc/basic/sbobjmod.hxx
-+++ basic/inc/basic/sbobjmod.hxx
-@@ -79,6 +79,7 @@ public:
- void Unload();
- void load();
- void triggerMethod( const String& );
-+ void triggerMethod( const String&, css::uno::Sequence< css::uno::Any >& );
- void triggerActivateEvent();
- void triggerDeActivateEvent();
- void triggerInitializeEvent();
-diff --git basic/source/classes/sbxmod.cxx basic/source/classes/sbxmod.cxx
-index acb153a..29bb3c5 100644
---- basic/source/classes/sbxmod.cxx
-+++ basic/source/classes/sbxmod.cxx
-@@ -80,6 +80,9 @@
- #include <com/sun/star/awt/XControl.hpp>
- #include <cppuhelper/implbase1.hxx>
- #include <comphelper/anytostring.hxx>
-+#include <com/sun/star/document/XVbaMethodParameter.hpp> //liuchen 2009-7-21
-+extern void unoToSbxValue( SbxVariable* pVar, const ::com::sun::star::uno::Any& aValue ); //liuchen 2009-7-21
-+extern ::com::sun::star::uno::Any sbxToUnoValue( SbxVariable* pVar ); //liuchen 2009-7-21
-
- #include <com/sun/star/frame/XDesktop.hpp>
- #include <vcl/svapp.hxx>
-@@ -1750,7 +1753,40 @@ public:
- }
- }
- }
-- virtual void SAL_CALL windowClosing( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException) {}
-+
-+ //liuchen 2009-7-21, support Excel VBA Form_QueryClose event
-+ virtual void SAL_CALL windowClosing( const lang::EventObject& e ) throw (uno::RuntimeException)
-+ {
-+ uno::Reference< awt::XDialog > xDialog( e.Source, uno::UNO_QUERY );
-+ if ( xDialog.is() )
-+ {
-+ uno::Reference< awt::XControl > xControl( xDialog, uno::UNO_QUERY );
-+ if ( xControl->getPeer().is() )
-+ {
-+ uno::Reference< document::XVbaMethodParameter > xVbaMethodParameter( xControl->getPeer(), uno::UNO_QUERY );
-+ if ( xVbaMethodParameter.is() )
-+ {
-+ sal_Int8 nCancel = 0;
-+ sal_Int8 nCloseMode = 0;
-+
-+ Sequence< Any > aParams;
-+ aParams.realloc(2);
-+ aParams[0] <<= nCancel;
-+ aParams[1] <<= nCloseMode;
-+
-+ mpUserForm->triggerMethod( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Userform_QueryClose") ),
-+ aParams);
-+ xVbaMethodParameter->setVbaMethodParameter( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Cancel")), aParams[0]);
-+ return;
-+
-+ }
-+ }
-+ }
-+
-+ mpUserForm->triggerMethod( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Userform_QueryClose") ) );
-+ }
-+ //liuchen 2009-7-21
-+
- virtual void SAL_CALL windowClosed( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException) { mbOpened = sal_False; mbShowing = sal_False; }
- virtual void SAL_CALL windowMinimized( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException) {}
- virtual void SAL_CALL windowNormalized( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException){}
-@@ -1804,13 +1840,49 @@ void SbUserFormModule::ResetApiObj()
-
- void SbUserFormModule::triggerMethod( const String& aMethodToRun )
- {
-+ Sequence< Any > aArguments;
-+ triggerMethod( aMethodToRun, aArguments );
-+}
-+void SbUserFormModule::triggerMethod( const String& aMethodToRun, Sequence< Any >& aArguments)
-+{
- OSL_TRACE("*** trigger %s ***", rtl::OUStringToOString( aMethodToRun, RTL_TEXTENCODING_UTF8 ).getStr() );
- // Search method
- SbxVariable* pMeth = SbObjModule::Find( aMethodToRun, SbxCLASS_METHOD );
- if( pMeth )
-- {
-- SbxValues aVals;
-- pMeth->Get( aVals );
-+ {
-+ //liuchen 2009-7-21, support Excel VBA UserForm_QueryClose event with parameters
-+ if ( aArguments.getLength() > 0 ) // Setup parameters
-+ {
-+ SbxArrayRef xArray = new SbxArray;
-+ xArray->Put( pMeth, 0 ); // Method as parameter 0
-+
-+ for ( sal_Int32 i = 0; i < aArguments.getLength(); ++i )
-+ {
-+ SbxVariableRef xSbxVar = new SbxVariable( SbxVARIANT );
-+ unoToSbxValue( static_cast< SbxVariable* >( xSbxVar ), aArguments[i] );
-+ xArray->Put( xSbxVar, static_cast< USHORT >( i ) + 1 );
-+
-+ // Enable passing by ref
-+ if ( xSbxVar->GetType() != SbxVARIANT )
-+ xSbxVar->SetFlag( SBX_FIXED );
-+ }
-+ pMeth->SetParameters( xArray );
-+
-+ SbxValues aVals;
-+ pMeth->Get( aVals );
-+
-+ for ( sal_Int32 i = 0; i < aArguments.getLength(); ++i )
-+ {
-+ aArguments[i] = sbxToUnoValue( xArray->Get( static_cast< USHORT >(i) + 1) );
-+ }
-+ pMeth->SetParameters( NULL );
-+ }
-+ else
-+//liuchen 2009-7-21
-+ {
-+ SbxValues aVals;
-+ pMeth->Get( aVals );
-+ }
- }
- }
-
-@@ -1853,12 +1925,31 @@ void SbUserFormModule::load()
- if ( !pDocObject )
- InitObject();
- }
-+
-+//liuchen 2009-7-21 change to accmordate VBA's beheavior
- void SbUserFormModule::Unload()
- {
- OSL_TRACE("** Unload() ");
-+
-+ sal_Int8 nCancel = 0;
-+ sal_Int8 nCloseMode = 1;
-+
-+ Sequence< Any > aParams;
-+ aParams.realloc(2);
-+ aParams[0] <<= nCancel;
-+ aParams[1] <<= nCloseMode;
-+
-+ triggerMethod( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Userform_QueryClose") ), aParams);
-+
-+ aParams[0] >>= nCancel;
-+ if (nCancel == 1)
-+ {
-+ return;
-+ }
-+
- if ( m_xDialog.is() )
- {
-- triggerTerminateEvent();
-+ triggerTerminateEvent();
- }
- // Search method
- SbxVariable* pMeth = SbObjModule::Find( String( RTL_CONSTASCII_USTRINGPARAM( "UnloadObject" ) ), SbxCLASS_METHOD );
-@@ -1883,6 +1974,7 @@ void SbUserFormModule::Unload()
- OSL_TRACE("UnloadObject completed ( we hope )");
- }
- }
-+//liuchen
-
- void SbUserFormModule::InitObject()
- {
-diff --git offapi/com/sun/star/document/XVbaMethodParameter.idl offapi/com/sun/star/document/XVbaMethodParameter.idl
-new file mode 100644
-index 0000000..96ca108
---- /dev/null
-+++ offapi/com/sun/star/document/XVbaMethodParameter.idl
-@@ -0,0 +1,68 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright IBM Corporation 2009
-+ * Copyright 2009 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: XVbaMethodParameter,v $
-+ * $Revision: 1.13 $
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef __org_openoffice_vba_XVbaMethodParameter_idl__
-+#define __org_openoffice_vba_XVbaMethodParameter_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+//=============================================================================
-+
-+module com { module sun { module star { module document {
-+
-+//=============================================================================
-+//gives access to vba method input/output parameters
-+//
-+//some OO objects need to implement this interface to support the passing of input/output parameters
-+//for certain VBA events
-+
-+interface XVbaMethodParameter : com::sun::star::uno::XInterface
-+{
-+ //-------------------------------------------------------------------------
-+
-+ /** sets the value of the parameter with the specified name.
-+ */
-+ void setVbaMethodParameter( [in] string PropertyName,
-+ [in] any Value );
-+
-+ //-------------------------------------------------------------------------
-+
-+ /** returns the value of the parameter with the specified name.
-+ */
-+ any getVbaMethodParameter( [in] string PropertyName );
-+};
-+
-+//=============================================================================
-+
-+}; }; }; };
-+#endif
-diff --git offapi/com/sun/star/document/makefile.mk offapi/com/sun/star/document/makefile.mk
-index 9ab674c..9cbffa7 100644
---- offapi/com/sun/star/document/makefile.mk
-+++ offapi/com/sun/star/document/makefile.mk
-@@ -119,6 +119,7 @@ IDLFILES=\
- XCodeNameQuery.idl \
- XDocumentEventCompatibleHelper.idl \
- XCompatWriterDocProperties.idl \
-+ XVbaMethodParameter.idl \
- VbaEventId.idl \
- XVbaEventsHelper.idl \
- VbaEventsHelper.idl \
-diff --git oovbaapi/ooo/vba/msforms/XLabel.idl oovbaapi/ooo/vba/msforms/XLabel.idl
-index 376802d..d2938d5 100644
---- oovbaapi/ooo/vba/msforms/XLabel.idl
-+++ oovbaapi/ooo/vba/msforms/XLabel.idl
-@@ -42,6 +42,7 @@ interface XLabel: com::sun::star::uno::XInterface
- {
- [attribute] string Caption;
- [attribute] any Value;
-+ [attribute] long ForeColor; //liuchen 2009-7-3
- };
-
- //=============================================================================
-diff --git oovbaapi/ooo/vba/msforms/XListBox.idl oovbaapi/ooo/vba/msforms/XListBox.idl
-index c68b258..6aedf42 100644
---- oovbaapi/ooo/vba/msforms/XListBox.idl
-+++ oovbaapi/ooo/vba/msforms/XListBox.idl
-@@ -43,7 +43,7 @@ interface XListBox: com::sun::star::uno::XInterface
- {
- [attribute] any Value;
- [attribute] string Text;
-- [attribute] boolean MultiSelect;
-+ [attribute] long MultiSelect; //liuchen 2009-7-31 MultiSelect property in Excel VBA is type long
- [attribute] any ListIndex;
- [attribute, readonly ] long ListCount;
- void AddItem( [in] any pvargItem, [in] any pvargIndex );
-diff --git sc/source/ui/vba/vbacomment.cxx sc/source/ui/vba/vbacomment.cxx
-index e8ca951..7e8a4c1 100644
---- sc/source/ui/vba/vbacomment.cxx
-+++ sc/source/ui/vba/vbacomment.cxx
-@@ -34,6 +34,7 @@
- #include <com/sun/star/sheet/XSheetAnnotationAnchor.hpp>
- #include <com/sun/star/sheet/XSheetAnnotationsSupplier.hpp>
- #include <com/sun/star/sheet/XSheetCellRange.hpp>
-+#include <com/sun/star/sheet/XCellAddressable.hpp>
- #include <com/sun/star/table/CellAddress.hpp>
- #include <com/sun/star/table/XCell.hpp>
- #include <com/sun/star/text/XText.hpp>
-@@ -161,8 +162,7 @@ ScVbaComment::Text( const uno::Any& aText, const uno::Any& aStart, const uno::An
- aText >>= sText;
-
- uno::Reference< text::XSimpleText > xAnnoText( getAnnotation(), uno::UNO_QUERY_THROW );
-- rtl::OUString sAnnoText = xAnnoText->getString();
--
-+
- if ( aStart.hasValue() )
- {
- sal_Int16 nStart = 0;
-@@ -194,8 +194,13 @@ ScVbaComment::Text( const uno::Any& aText, const uno::Any& aStart, const uno::An
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ScVbaComment::Text - bad Start value " ) ), uno::Reference< uno::XInterface >() );
- }
- else if ( aText.hasValue() )
-- xAnnoText->setString( sText );
-+ {
-+ uno::Reference< sheet::XCellAddressable > xCellAddr(mxRange->getCellByPosition(0, 0), uno::UNO_QUERY_THROW );
-+ table::CellAddress aAddress = xCellAddr->getCellAddress();
-+ getAnnotations()->insertNew( aAddress, sText );
-+ }
-
-+ rtl::OUString sAnnoText = xAnnoText->getString();
- return sAnnoText;
- }
-
-diff --git sc/source/ui/vba/vbadialog.cxx sc/source/ui/vba/vbadialog.cxx
-index 4adfc4c..9ff110b 100644
---- sc/source/ui/vba/vbadialog.cxx
-+++ sc/source/ui/vba/vbadialog.cxx
-@@ -32,42 +32,58 @@
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-
--static const rtl::OUString aStringList[]=
-+//liuchen 2009-7-27
-+//solve the problem that "Application.Dialogs.Item(***).Show" and "Application.Dialogs.Count" cannot get the correct result
-+struct DialogMatch
- {
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Open" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormatCellDialog" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertCell" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Print" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:PasteSpecial" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ToolProtectionDocument" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ColumnWidth" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DefineName" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ConfigureDialog" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:HyperlinkDialog" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertGraphic" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertObject" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:PageFormatDialog" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DataSort" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:RowHeight" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:AutoCorrectDlg" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ConditionalFormatDialog" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DataConsolidate" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CreateNames" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillSeries" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Validation") ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DefineLabelRange" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DataFilterAutoFilter" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DataFilterSpecialFilter" ) ),
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:AutoFormat" ) )
-+ sal_Int32 nVbaDlgIndex;
-+ rtl::OUString aOODlgName;
- };
-
--const sal_Int32 nDialogSize = sizeof( aStringList ) / sizeof( aStringList[ 0 ] );
-+static const DialogMatch aDialogMatchList[] =
-+{
-+ { 1, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Open" ) ) }, // xlDialogOpen -> .uno:Open
-+ { -1, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormatCellDialog" ) ) }, // ??? -> .uno:FormatCellDialog
-+ { 55, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertCell" ) ) }, // xlDialogInsert -> .uno:InsertCell
-+ { 8, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Print" ) ) }, // xlDialogPrint -> .uno:Print
-+ { 9, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:PrinterSetup" ) ) }, // xlDialogPrinterSetup -> .uno:PrinterSetup
-+ { 53, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:PasteSpecial" ) ) }, // xlDialogPasteSpecial -> .uno:PasteSpecial
-+ { 28, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ToolProtectionDocument" ) ) }, // xlDialogProtectDocument -> uno:ToolProtectionDocument
-+ { 47, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ColumnWidth" ) ) }, // xlDialogColumnWidth -> .uno:ColumnWidth
-+ { 61, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DefineName" ) ) }, // xlDialogDefineName -> .uno:DefineName
-+ { -1, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ConfigureDialog" ) ) }, // ??? -> .uno:ConfigureDialog
-+ { 596, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:HyperlinkDialog" ) ) }, // xlDialogInsertHyperlink -> .uno:HyperlinkDialog
-+ { 342, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertGraphic" ) ) }, // xlDialogInsertPicture -> .uno:InsertGraphic
-+ { 259, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertObject" ) ) }, // xlDialogInsertObject -> .uno:InsertObject
-+ { 7, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:PageFormatDialog" ) ) }, // xlDialogPageSetup -> .uno:PageFormatDialog
-+ { 39, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DataSort" ) ) }, // xlDialogSort -> .uno:DataSort
-+ { 127, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:RowHeight" ) ) }, // xlDialogRowHeight -> .uno:RowHeight
-+ { 485, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:AutoCorrectDlg" ) ) }, // xlDialogAutoCorrect -> .uno:AutoCorrectDlg
-+ { 583, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ConditionalFormatDialog" ) ) }, // xlDialogCondiationalFormatting -> .uno:ConditionalFormatDialog
-+ { 191, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DataConsolidate" ) ) }, // xlDialogConsolidate -> .uno:DataConsolidate
-+ { 62, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CreateNames" ) ) }, // xlDialogCreateNames -> .uno:CreateNames
-+ { -1, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillSeries" ) ) }, // ??? -> .uno:FillSeries
-+ { -1, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Validation" ) ) }, // ??? -> .uno:Validation"
-+ { -1, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DefineLabelRange" ) ) }, // ??? -> .uno:DefineLabelRange
-+ { -1, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DataFilterAutoFilter" ) ) }, // ??? -> .uno:DataFilterAutoFilter
-+ { -1, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DataFilterSpecialFilter" ) ) }, // ??? -> .uno:DataFilterSpecialFilter
-+ { 269, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:AutoFormat" ) ) } // xlDialogFormatAuto -> .uno:AutoFormat
-+};
-
-+const sal_Int32 nDialogSize = sizeof( aDialogMatchList ) / sizeof( aDialogMatchList[ 0 ] );
-+
-+//liuchen modified 2009-2-27
- rtl::OUString
- ScVbaDialog::mapIndexToName( sal_Int32 nIndex )
- {
-- if( nIndex < nDialogSize )
-- return aStringList[ nIndex ];
-+ for (int i = 0; i < nDialogSize; i++)
-+ {
-+ if ( aDialogMatchList[i].nVbaDlgIndex == nIndex )
-+ {
-+ return aDialogMatchList[i].aOODlgName;
-+ }
-+ }
-+
- return rtl::OUString();
- }
-
-@@ -89,3 +105,9 @@ ScVbaDialog::getServiceNames()
- }
- return aServiceNames;
- }
-+
-+//liuchen add 2009-7-27
-+sal_Int32 ScVbaDialog::GetSupportedDialogCount()
-+{
-+ return nDialogSize;
-+}
-\ No newline at end of file
-diff --git sc/source/ui/vba/vbadialog.hxx sc/source/ui/vba/vbadialog.hxx
-index 648f038..1315303 100644
---- sc/source/ui/vba/vbadialog.hxx
-+++ sc/source/ui/vba/vbadialog.hxx
-@@ -48,6 +48,9 @@ public:
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+
-+ //liuchen 2009-7-27
-+ static sal_Int32 GetSupportedDialogCount();
- };
-
- #endif /* SC_VBA_DIALOG_HXX */
-diff --git sc/source/ui/vba/vbadialogs.cxx sc/source/ui/vba/vbadialogs.cxx
-index 6f90e4b..ccd36ca 100644
---- sc/source/ui/vba/vbadialogs.cxx
-+++ sc/source/ui/vba/vbadialogs.cxx
-@@ -67,5 +67,13 @@ ScVbaDialogs::getServiceNames()
- return aServiceNames;
- }
-
-+//liuchen 2009-7-27
-+::sal_Int32
-+ScVbaDialogs::getCount() throw (uno::RuntimeException)
-+{
-+ return ScVbaDialog::GetSupportedDialogCount();
-+}
-+
-+
-
-
-diff --git sc/source/ui/vba/vbadialogs.hxx sc/source/ui/vba/vbadialogs.hxx
-index c902b7a..c314178 100644
---- sc/source/ui/vba/vbadialogs.hxx
-+++ sc/source/ui/vba/vbadialogs.hxx
-@@ -47,6 +47,7 @@ public:
-
- // XCollection
- virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException); //liuchen 2009-7-27
-
- // XDialogs
- virtual void SAL_CALL Dummy() throw (css::uno::RuntimeException);
-diff --git sc/source/ui/vba/vbapagebreaks.cxx sc/source/ui/vba/vbapagebreaks.cxx
-index 51eaffb..21fc9d7 100644
---- sc/source/ui/vba/vbapagebreaks.cxx
-+++ sc/source/ui/vba/vbapagebreaks.cxx
-@@ -118,10 +118,13 @@ sal_Int32 SAL_CALL RangePageBreaks::getCount( ) throw (uno::RuntimeException)
- for( sal_Int32 i=0; i<nLength; i++ )
- {
- sal_Int32 nPos = aTablePageBreakData[i].Position;
-- if( nPos > nUsedEnd )
-- return nCount;
-- if( nPos >= nUsedStart )
-- nCount++;
-+
-+ // VBA. minz@cn.ibm.com. All page breaks before the used range should be counted.
-+ // And the page break at the end of the used range also should be counted.
-+ if( nPos <= nUsedEnd + 1 )
-+ nCount++;
-+ else
-+ return nCount;
- }
-
- return nCount;
-@@ -156,17 +159,9 @@ sheet::TablePageBreakData RangePageBreaks::getTablePageBreakData( sal_Int32 nAPI
- uno::Sequence<sheet::TablePageBreakData> aTablePageBreakDataList = getAllPageBreaks();
-
- sal_Int32 nLength = aTablePageBreakDataList.getLength();
-- for( sal_Int32 i=0; i<nLength; i++ )
-- {
-- aTablePageBreakData = aTablePageBreakDataList[i];
-- sal_Int32 nPos = aTablePageBreakData.Position;
-- if( nPos >= nUsedStart )
-- index++;
-- if( nPos > nUsedEnd )
-- DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
-- if( index == nAPIItemIndex )
-- return aTablePageBreakData;
-- }
-+ //VBA. minz@cn.ibm.com. No need to filter the page break. All page breaks before the used range are counted.
-+ if ( nAPIItemIndex < nLength && nAPIItemIndex>=0 )
-+ aTablePageBreakData = aTablePageBreakDataList[nAPIItemIndex];
-
- return aTablePageBreakData;
- }
-diff --git sc/source/ui/vba/vbarange.cxx sc/source/ui/vba/vbarange.cxx
-index 61d2f35..d55101b 100644
---- sc/source/ui/vba/vbarange.cxx
-+++ sc/source/ui/vba/vbarange.cxx
-@@ -91,6 +91,8 @@
- #include <com/sun/star/sheet/XSubTotalDescriptor.hpp>
- #include <com/sun/star/sheet/GeneralFunction.hdl>
-
-+#include <com/sun/star/sheet/XSheetAnnotationsSupplier.hpp>
-+#include <com/sun/star/sheet/XSheetAnnotations.hpp>
- #include <ooo/vba/excel/XlPasteSpecialOperation.hpp>
- #include <ooo/vba/excel/XlPasteType.hpp>
- #include <ooo/vba/excel/Constants.hpp>
-@@ -1737,7 +1739,16 @@ ScVbaRange::getFormulaArray() throw (uno::RuntimeException)
- uno::Reference< sheet::XCellRangeFormula> xCellRangeFormula( mxRange, uno::UNO_QUERY_THROW );
- uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( mxContext );
- uno::Any aMatrix;
-- aMatrix = xConverter->convertTo( uno::makeAny( xCellRangeFormula->getFormulaArray() ) , getCppuType((uno::Sequence< uno::Sequence< uno::Any > >*)0) ) ;
-+
-+ //VBA, minz@cn.ibm.com
-+ uno::Sequence< uno::Sequence<rtl::OUString> > aFmArray = xCellRangeFormula->getFormulaArray();
-+ if( aFmArray.getLength() )
-+ {
-+ if( aFmArray.getLength() == 1 && aFmArray[0].getLength() == 1 )
-+ aMatrix <<= aFmArray[0][0];
-+ else
-+ aMatrix = xConverter->convertTo( uno::makeAny( xCellRangeFormula->getFormulaArray() ) , getCppuType((uno::Sequence< uno::Sequence< uno::Any > >*)0) ) ;
-+ }
- return aMatrix;
- }
-
-@@ -2240,7 +2251,8 @@ ScVbaRange::Cut(const ::uno::Any& Destination) throw (uno::RuntimeException)
- uno::Reference< sheet::XCellRangeAddressable > xSource( mxRange, uno::UNO_QUERY);
- xMover->moveRange( xDestination->getCellAddress(), xSource->getRangeAddress() );
- }
-- {
-+ //VBA, minz@cn.ibm.com.
-+ else {
- uno::Reference< frame::XModel > xModel = getModelFromRange( mxRange );
- Select();
- excel::implnCut( xModel );
-@@ -2628,11 +2640,12 @@ ScVbaRange::AddComment( const uno::Any& Text ) throw (uno::RuntimeException)
- {
-
- uno::Reference< excel::XComment > xComment( new ScVbaComment( this, mxContext, mxRange ) );
-- // if you don't pass a valid text or if there is already a comment
-- // associated with the range then return NULL
-- if ( !xComment->Text( Text, uno::Any(), uno::Any() ).getLength()
-- || xComment->Text( uno::Any(), uno::Any(), uno::Any() ).getLength() )
-- return NULL;
-+ // if there is existing text then error
-+ if ( Text.hasValue() && xComment->Text( uno::Any(), uno::Any(), uno::Any() ).getLength() )
-+ throw uno::RuntimeException();
-+ // failed to write text? ( can this happen ?? )
-+ if ( !xComment->Text( Text, uno::Any(), uno::Any() ).getLength() )
-+ return NULL;
- return xComment;
- }
-
-diff --git sc/source/ui/vba/vbaworksheet.cxx sc/source/ui/vba/vbaworksheet.cxx
-index ff09315..f474c4b 100644
---- sc/source/ui/vba/vbaworksheet.cxx
-+++ sc/source/ui/vba/vbaworksheet.cxx
-@@ -77,7 +77,9 @@
-
- #include "cellsuno.hxx"
- #include "drwlayer.hxx"
--
-+#ifdef CWSSCSHEETPROTECTION
-+#include "tabprotection.hxx"
-+#endif
- #include "scextopt.hxx"
- #include "vbaoutline.hxx"
- #include "vbarange.hxx"
-@@ -332,6 +334,22 @@ ScVbaWorksheet::getProtectContents()thro
- sal_Bool
- ScVbaWorksheet::getProtectDrawingObjects() throw (uno::RuntimeException)
- {
-+#ifdef CWSSCSHEETPROTECTION
-+ SCTAB nTab = 0;
-+ rtl::OUString aSheetName = getName();
-+ uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( getModel(), uno::UNO_QUERY_THROW );
-+ 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);
-+ if ( pProtect )
-+ return pProtect->getOption( ScTableProtection::OBJECTS );
-+ }
-+#else
-+ return getProtectContents(); // fallback
-+#endif
- return false;
- }
-
-@@ -557,13 +560,25 @@ ScVbaWorksheet::getSheetAtOffset(SCTAB offset) throw (uno::RuntimeException)
- uno::Reference< excel::XWorksheet >
- ScVbaWorksheet::getNext() throw (uno::RuntimeException)
- {
-- return getSheetAtOffset(static_cast<SCTAB>(1));
-+ //VBA, minz@cn.ibm.com. catch the exception for index out of bound
-+ try{
-+ return getSheetAtOffset(static_cast<SCTAB>(1));
-+ }catch( lang::IndexOutOfBoundsException& /*e*/ )
-+ {
-+ return NULL;
-+ }
- }
-
- uno::Reference< excel::XWorksheet >
- ScVbaWorksheet::getPrevious() throw (uno::RuntimeException)
- {
-- return getSheetAtOffset(-1);
-+ //VBA, minz@cn.ibm.com. catch the exception for index out of bound
-+ try{
-+ return getSheetAtOffset(-1);
-+ }catch( lang::IndexOutOfBoundsException& /*e*/ )
-+ {
-+ return NULL;
-+ }
- }
-
-
-@@ -647,7 +662,7 @@ ScVbaWorksheet::ChartObjects( const uno::Any& Index ) throw (uno::RuntimeExcepti
- uno::Reference< table::XTableChartsSupplier > xChartSupplier( getSheet(), uno::UNO_QUERY_THROW );
- uno::Reference< table::XTableCharts > xTableCharts = xChartSupplier->getCharts();
-
-- uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxSheet, uno::UNO_QUERY_THROW );
-+ uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( getSheet(), uno::UNO_QUERY_THROW ); //VBA, minz@cn.ibm.com.
- mxCharts = new ScVbaChartObjects( this, mxContext, xTableCharts, xDrawPageSupplier );
- }
- if ( Index.hasValue() )
-@@ -936,7 +951,7 @@ ScVbaWorksheet::setCodeName( const rtl::OUString& ) throw (css::uno::RuntimeExce
- sal_Int16
- ScVbaWorksheet::getSheetID() throw (uno::RuntimeException)
- {
-- uno::Reference< sheet::XCellRangeAddressable > xAddressable( mxSheet, uno::UNO_QUERY_THROW );
-+ uno::Reference< sheet::XCellRangeAddressable > xAddressable( getSheet(), uno::UNO_QUERY_THROW ); //VBA. minz@cn.ibm.com. if ActiveSheet, mxSheet is null.
- return xAddressable->getRangeAddress().Sheet;
- }
-
-diff --git scripting/source/vbaevents/eventhelper.cxx scripting/source/vbaevents/eventhelper.cxx
-index f85ac51..6928530 100644
---- scripting/source/vbaevents/eventhelper.cxx
-+++ scripting/source/vbaevents/eventhelper.cxx
-@@ -26,6 +26,10 @@
- #include <com/sun/star/awt/XDialog.hpp>
- #include <com/sun/star/awt/KeyEvent.hpp>
- #include <com/sun/star/awt/MouseEvent.hpp>
-+#include <com/sun/star/awt/XFixedText.hpp> //liuchen 2009-6-5
-+#include <com/sun/star/awt/XTextComponent.hpp> //liuchen 2009-6-5
-+#include <com/sun/star/awt/XComboBox.hpp> //liuchen 2009-6-18
-+#include <com/sun/star/awt/XRadioButton.hpp> //liuchen 2009-7-30
-
- #include <msforms/ReturnInteger.hpp>
-
-@@ -63,6 +67,8 @@ using namespace ::com::sun::star::script;
- using namespace ::com::sun::star::uno;
- using namespace ::ooo::vba;
-
-+#define MAP_CHAR_LEN(x) ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(x))//liuchen 2009-6-8
-+#define GET_TYPE(x) ::getCppuType((uno::Reference< x > *)0);
-
- // Some constants
- const static rtl::OUString DELIM = rtl::OUString::createFromAscii( "::" );
-@@ -227,10 +233,14 @@ Sequence< Any > ooKeyPressedToVBAKeyUpDown( const Sequence< Any >& params )
-
- typedef Sequence< Any > (*Translator)(const Sequence< Any >&);
-
-+//liuchen 2009-6-23
-+//expand the "TranslateInfo" struct to support more kinds of events
- struct TranslateInfo
- {
-- rtl::OUString sVBAName;
-- Translator toVBA;
-+ rtl::OUString sVBAName; //vba event name
-+ Translator toVBA; //the method to convert OO event parameters to VBA event parameters
-+ bool (*ApproveRule)(const ScriptEvent& evt, void* pPara); //this method is used to determine which types of controls should execute the event
-+ void *pPara; //Parameters for the above approve method
- };
-
-
-@@ -239,104 +249,116 @@ std::list< TranslateInfo >,
- ::rtl::OUStringHash,
- ::std::equal_to< ::rtl::OUString > > EventInfoHash;
-
-+//liuchen 2009-6-23
-+struct TranslatePropMap
-+{
-+ rtl::OUString sEventInfo; //OO event name
-+ TranslateInfo aTransInfo;
-+};
-+
-+bool ApproveAll(const ScriptEvent& evt, void* pPara); //allow all types of controls to execute the event
-+bool ApproveType(const ScriptEvent& evt, void* pPara); //certain types of controls should execute the event, those types are given by pPara
-+bool DenyType(const ScriptEvent& evt, void* pPara); //certain types of controls should not execute the event, those types are given by pPara
-+bool DenyMouseDrag(const ScriptEvent& evt, void* pPara); //used for VBA MouseMove event when "Shift" key is pressed
-+
-+struct TypeList
-+{
-+ uno::Type* pTypeList;
-+ int nListLength;
-+};
-+
-+Type typeXFixedText = GET_TYPE(awt::XFixedText);
-+Type typeXTextComponent = GET_TYPE(awt::XTextComponent);
-+Type typeXComboBox = GET_TYPE(awt::XComboBox);
-+Type typeXRadioButton = GET_TYPE(awt::XRadioButton);
-+
-+
-+TypeList fixedTextList = {&typeXFixedText, 1};
-+TypeList textCompList = {&typeXTextComponent, 1};
-+TypeList radioButtonList = {&typeXRadioButton, 1};
-+TypeList comboBoxList = {&typeXComboBox, 1};
-+
-+//this array stores the OO event to VBA event translation info
-+static TranslatePropMap aTranslatePropMap_Impl[] =
-+{
-+ // actionPerformed ooo event
-+ { MAP_CHAR_LEN("actionPerformed"), { MAP_CHAR_LEN("_Click"), NULL, ApproveAll, NULL } },
-+ { MAP_CHAR_LEN("actionPerformed"), { MAP_CHAR_LEN("_Change"), NULL, DenyType, (void*)(&radioButtonList) } }, //liuchen 2009-7-30, OptionalButton_Change event is not the same as OptionalButton_Click event
-+
-+ // itemStateChanged ooo event
-+ { MAP_CHAR_LEN("itemStateChanged"), { MAP_CHAR_LEN("_Click"), NULL, ApproveType, (void*)(&comboBoxList) } }, //liuchen, add to support VBA ComboBox_Click event
-+ { MAP_CHAR_LEN("itemStateChanged"), { MAP_CHAR_LEN("_Change"), NULL, ApproveType, (void*)(&radioButtonList) } }, //liuchen 2009-7-30, OptionalButton_Change event should be triggered when the button state is changed
-+
-+ // changed ooo event
-+ { MAP_CHAR_LEN("changed"), { MAP_CHAR_LEN("_Change"), NULL, ApproveAll, NULL } },
-+
-+ // focusGained ooo event
-+ { MAP_CHAR_LEN("focusGained"), { MAP_CHAR_LEN("_GotFocus"), NULL, ApproveAll, NULL } },
-+
-+ // focusLost ooo event
-+ { MAP_CHAR_LEN("focusLost"), { MAP_CHAR_LEN("_LostFocus"), NULL, ApproveAll, NULL } },
-+ { MAP_CHAR_LEN("focusLost"), { MAP_CHAR_LEN("_Exit"), NULL, ApproveType, (void*)(&textCompList) } }, //liuchen, add to support VBA TextBox_Exit event
-+
-+ // adjustmentValueChanged ooo event
-+ { MAP_CHAR_LEN("adjustmentValueChanged"), { MAP_CHAR_LEN("_Scroll"), NULL, ApproveAll, NULL } },
-+ { MAP_CHAR_LEN("adjustmentValueChanged"), { MAP_CHAR_LEN("_Change"), NULL, ApproveAll, NULL } },
-+
-+ // textChanged ooo event
-+ { MAP_CHAR_LEN("textChanged"), { MAP_CHAR_LEN("_Change"), NULL, ApproveAll, NULL } },
-+
-+ // keyReleased ooo event
-+ { MAP_CHAR_LEN("keyReleased"), { MAP_CHAR_LEN("_KeyUp"), ooKeyPressedToVBAKeyUpDown, ApproveAll, NULL } },
-+
-+ // mouseReleased ooo event
-+ { MAP_CHAR_LEN("mouseReleased"), { MAP_CHAR_LEN("_Click"), ooMouseEvtToVBAMouseEvt, ApproveType, (void*)(&fixedTextList) } }, //liuchen, add to support VBA Label_Click event
-+ { MAP_CHAR_LEN("mouseReleased"), { MAP_CHAR_LEN("_MouseUp"), ooMouseEvtToVBAMouseEvt, ApproveAll, NULL } },
-+
-+ // mousePressed ooo event
-+ { MAP_CHAR_LEN("mousePressed"), { MAP_CHAR_LEN("_MouseDown"), ooMouseEvtToVBAMouseEvt, ApproveAll, NULL } },
-+ { MAP_CHAR_LEN("mousePressed"), { MAP_CHAR_LEN("_DblClick"), ooMouseEvtToVBADblClick, ApproveAll, NULL } },
-+
-+ // mouseMoved ooo event
-+ { MAP_CHAR_LEN("mouseMoved"), { MAP_CHAR_LEN("_MouseMove"), ooMouseEvtToVBAMouseEvt, ApproveAll, NULL } },
-+ { MAP_CHAR_LEN("mouseDragged"), { MAP_CHAR_LEN("_MouseMove"), ooMouseEvtToVBAMouseEvt, DenyMouseDrag, NULL } }, //liuchen, add to support VBA MouseMove event when the "Shift" key is pressed
-+
-+ // keyPressed ooo event
-+ { MAP_CHAR_LEN("keyPressed"), { MAP_CHAR_LEN("_KeyDown"), ooKeyPressedToVBAKeyUpDown, ApproveAll, NULL } },
-+ { MAP_CHAR_LEN("keyPressed"), { MAP_CHAR_LEN("_KeyPress"), ooKeyPressedToVBAKeyUpDown, ApproveAll, NULL } }
-+};
-
- EventInfoHash& getEventTransInfo()
- {
- static bool initialised = false;
- static EventInfoHash eventTransInfo;
- if ( !initialised )
-- {
-- TranslateInfo info;
-- // actionPerformed ooo event
-- std::list< TranslateInfo > actionInfos;
-- info.sVBAName = rtl::OUString::createFromAscii("_Click");
-- info.toVBA = NULL;
-- actionInfos.push_back( info );
-- info.sVBAName = rtl::OUString::createFromAscii("_Change");
-- info.toVBA = NULL;
-- actionInfos.push_back( info );
-- eventTransInfo[ rtl::OUString::createFromAscii("actionPerformed") ] = actionInfos;
-- // itemStateChanged ooo event
-- std::list< TranslateInfo > stateChangedInfos;
-- info.sVBAName = rtl::OUString::createFromAscii("_Change");
-- info.toVBA = NULL;
-- stateChangedInfos.push_back( info );
-- eventTransInfo[ rtl::OUString::createFromAscii("itemStateChanged") ] = stateChangedInfos;
-- // changed ooo event
-- std::list< TranslateInfo > changeInfos;
-- info.sVBAName = rtl::OUString::createFromAscii("_Change");
-- info.toVBA = NULL;
-- changeInfos.push_back( info );
-- eventTransInfo[ rtl::OUString::createFromAscii("changed") ] = changeInfos;
-- // focusGained ooo event
-- std::list< TranslateInfo > focusGainedInfos;
-- info.sVBAName = rtl::OUString::createFromAscii("_GotFocus");
-- info.toVBA = NULL;
-- focusGainedInfos.push_back( info );
-- eventTransInfo[ rtl::OUString::createFromAscii("focusGained") ] = focusGainedInfos;
-- // focusLost ooo event
-- std::list< TranslateInfo > focusLostInfos;
-- info.sVBAName = rtl::OUString::createFromAscii("_LostFocus");
-- info.toVBA = NULL;
-- focusLostInfos.push_back( info );
-- eventTransInfo[ rtl::OUString::createFromAscii("focusGained") ] = focusLostInfos;
-- // adjustmentValueChanged ooo event
-- std::list< TranslateInfo > adjustInfos;
-- info.sVBAName = rtl::OUString::createFromAscii("_Scroll");
-- info.toVBA = NULL;
-- adjustInfos.push_back( info );
-- info.sVBAName = rtl::OUString::createFromAscii("_Change");
-- info.toVBA = NULL;
-- adjustInfos.push_back( info );
-- eventTransInfo[ rtl::OUString::createFromAscii("adjustmentValueChanged") ] = adjustInfos;
-- // textChanged ooo event
-- std::list< TranslateInfo > txtChangedInfos;
-- info.sVBAName = rtl::OUString::createFromAscii("_Change");
-- info.toVBA = NULL;
-- txtChangedInfos.push_back( info );
-- eventTransInfo[ rtl::OUString::createFromAscii("textChanged") ] = txtChangedInfos;
--
-- // keyReleased ooo event
-- std::list< TranslateInfo > keyReleasedInfos;
-- info.sVBAName = rtl::OUString::createFromAscii("_KeyUp");
-- info.toVBA = ooKeyPressedToVBAKeyUpDown;
-- keyReleasedInfos.push_back( info );
-- eventTransInfo[ rtl::OUString::createFromAscii("keyReleased") ] = keyReleasedInfos;
-- // mouseReleased ooo event
-- std::list< TranslateInfo > mouseReleasedInfos;
-- info.sVBAName = rtl::OUString::createFromAscii("_MouseUp");
-- info.toVBA = ooMouseEvtToVBAMouseEvt;
-- mouseReleasedInfos.push_back( info );
-- eventTransInfo[ rtl::OUString::createFromAscii("mouseReleased") ] = mouseReleasedInfos;
-- // mousePressed ooo event
-- std::list< TranslateInfo > mousePressedInfos;
-- info.sVBAName = rtl::OUString::createFromAscii("_MouseDown");
-- info.toVBA = ooMouseEvtToVBAMouseEvt;
-- mousePressedInfos.push_back( info );
-- info.sVBAName = rtl::OUString::createFromAscii("_DblClick");
-- // emulate double click event
-- info.toVBA = ooMouseEvtToVBADblClick;
-- mousePressedInfos.push_back( info );
-- eventTransInfo[ rtl::OUString::createFromAscii("mousePressed") ] = mousePressedInfos;
-- // mouseMoved ooo event
-- std::list< TranslateInfo > mouseMovedInfos;
-- info.sVBAName = rtl::OUString::createFromAscii("_MouseMove");
-- info.toVBA = ooMouseEvtToVBAMouseEvt;
-- mouseMovedInfos.push_back( info );
-- eventTransInfo[ rtl::OUString::createFromAscii("mouseMoved") ] = mouseMovedInfos;
-- // keyPressed ooo event
-- std::list< TranslateInfo > keyPressedInfos;
-- info.sVBAName = rtl::OUString::createFromAscii("_KeyDown");
-- info.toVBA = ooKeyPressedToVBAKeyUpDown;
-- keyPressedInfos.push_back( info );
-- info.sVBAName = rtl::OUString::createFromAscii("_KeyPress");
-- info.toVBA = ooKeyPressedToVBAKeyPressed;
-- keyPressedInfos.push_back( info );
-- eventTransInfo[ rtl::OUString::createFromAscii("keyPressed") ] = keyPressedInfos;
-+ {
-+ rtl::OUString sEventInfo = MAP_CHAR_LEN("");
-+ TranslatePropMap* pTransProp = aTranslatePropMap_Impl;
-+
-+ int nCount = sizeof(aTranslatePropMap_Impl) / sizeof(aTranslatePropMap_Impl[0]);
-+
-+ int i = 0;
-+ while (i < nCount)
-+ {
-+ if (sEventInfo != pTransProp->sEventInfo)
-+ {
-+ sEventInfo = pTransProp->sEventInfo;
-+ std::list< TranslateInfo > infoList;
-+ do
-+ {
-+ infoList.push_back( pTransProp->aTransInfo );
-+ i++;
-+ pTransProp++;
-+ }
-+ while( ( i < nCount ) && ( sEventInfo == pTransProp->sEventInfo ) );
-+ eventTransInfo[sEventInfo] = infoList;
-+ }
-+ }
- initialised = true;
- }
- return eventTransInfo;
- }
-+//liuchen 2009-6-23 end
-
- // Helper class
-
-@@ -764,7 +786,68 @@ EventListener::getPropertySetInfo( ) throw (RuntimeException)
- return xInfo;
- }
-
-+//liuchen 2009-6-23
-+//decide if the control should execute the event
-+bool ApproveAll(const ScriptEvent& evt, void* pPara)
-+{
-+ return true;
-+}
-+
-+//for the given control type in evt.Arguments[0], look for if it appears in the type list in pPara
-+bool FindControl(const ScriptEvent& evt, void* pPara)
-+{
-+ lang::EventObject aEvent;
-+ evt.Arguments[ 0 ] >>= aEvent;
-+ uno::Reference< uno::XInterface > xInterface( aEvent.Source, uno::UNO_QUERY );
-+
-+ TypeList* pTypeListInfo = static_cast<TypeList*>(pPara);
-+ Type* pType = pTypeListInfo->pTypeList;
-+ int nLen = pTypeListInfo->nListLength;
-+
-+ for (int i = 0; i < nLen; i++)
-+ {
-+ if ( xInterface->queryInterface( *pType ).hasValue() )
-+ {
-+ return true;
-+ }
-+ pType++;
-+ }
-+
-+ return false;
-+}
-+
-+//if the the given control type in evt.Arguments[0] appears in the type list in pPara, then approve the execution
-+bool ApproveType(const ScriptEvent& evt, void* pPara)
-+{
-+ return FindControl(evt, pPara);
-+}
-+
-+//if the the given control type in evt.Arguments[0] appears in the type list in pPara, then deny the execution
-+bool DenyType(const ScriptEvent& evt, void* pPara)
-+{
-+ return !FindControl(evt, pPara);
-+}
-+
-+//when mouse is moving, either the mouse button is pressed or some key is pressed can trigger the OO mouseDragged event,
-+//the former should be denyed, and the latter allowed, only by doing so can the VBA MouseMove event when the "Shift" key is
-+//pressed can be correctly triggered
-+bool DenyMouseDrag(const ScriptEvent& evt, void* pPara)
-+{
-+ awt::MouseEvent aEvent;
-+ evt.Arguments[ 0 ] >>= aEvent;
-+ if (aEvent.Buttons == 0 )
-+ {
-+ return true;
-+ }
-+ else
-+ {
-+ return false;
-+ }
-+}
-+
-+
-
-+//liuchen 2009-6-23
- // EventListener
-
- void
-@@ -850,6 +933,12 @@ EventListener::firing_Impl(const ScriptEvent& evt, Any* pRet ) throw(RuntimeExce
- ooo::vba::VBAMacroResolvedInfo aMacroResolvedInfo = ooo::vba::resolveVBAMacro( mpShell, sToResolve );
- if ( aMacroResolvedInfo.IsResolved() )
- {
-+ //liuchen 2009-6-8
-+ if (! txInfo->ApproveRule(evt, txInfo->pPara) )
-+ {
-+ continue;
-+ }
-+ //liuchen 2009-6-8
- // !! translate arguments & emulate events where necessary
- Sequence< Any > aArguments;
- if ( (*txInfo).toVBA )
-diff --git toolkit/inc/toolkit/awt/vclxwindows.hxx toolkit/inc/toolkit/awt/vclxwindows.hxx
-index a7ab2fc..a41fabc 100644
---- toolkit/inc/toolkit/awt/vclxwindows.hxx
-+++ toolkit/inc/toolkit/awt/vclxwindows.hxx
-@@ -96,6 +96,7 @@
- #include <vcl/imgcons.hxx>
- #include <vcl/image.hxx>
-
-+#include <com/sun/star/document/XVbaMethodParameter.hpp> //liuchen 2009-6-22, add the support of input/output parameters to VBA Dialog_QueryClose event
- class Button;
- class CheckBox;
- class RadioButton;
-@@ -391,6 +392,7 @@ public:
- // class VCLXDialog
- // ----------------------------------------------------
- class VCLXDialog : public ::com::sun::star::awt::XDialog,
-+ public ::com::sun::star::document::XVbaMethodParameter, //liuchen 2009-6-22, add the support of input/output parameters to VBA UserForm_QueryClose event
- public VCLXTopWindow
- {
- public:
-@@ -424,6 +426,10 @@ public:
- // ::com::sun::star::awt::XVclWindowPeer
- void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
-
-+ //liuchen 2009-6-23, support Excel VBA UserForm_QueryClose event
-+ // ::com::sun::star::document::XVBAMethodParameter
-+ void SAL_CALL setVbaMethodParameter( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
-+ ::com::sun::star::uno::Any SAL_CALL getVbaMethodParameter( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
- };
-
- // ----------------------------------------------------
-diff --git toolkit/source/awt/vclxwindows.cxx toolkit/source/awt/vclxwindows.cxx
-index bc673cf..3031d6f 100644
---- toolkit/source/awt/vclxwindows.cxx
-+++ toolkit/source/awt/vclxwindows.cxx
-@@ -2217,12 +2217,14 @@ VCLXDialog::~VCLXDialog()
- ::com::sun::star::uno::Any VCLXDialog::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
- {
- ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
-+ SAL_STATIC_CAST( ::com::sun::star::document::XVbaMethodParameter*, this ), //liuchen 2009-6-23
- SAL_STATIC_CAST( ::com::sun::star::awt::XDialog*, this ) );
- return (aRet.hasValue() ? aRet : VCLXTopWindow::queryInterface( rType ));
- }
-
- // ::com::sun::star::lang::XTypeProvider
- IMPL_XTYPEPROVIDER_START( VCLXDialog )
-+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::document::XVbaMethodParameter>* ) NULL ), //liuchen 2009-6-23
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDialog>* ) NULL ),
- VCLXTopWindow::getTypes()
- IMPL_XTYPEPROVIDER_END
-@@ -2310,6 +2312,40 @@ void SAL_CALL VCLXDialog::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::s
- return aInfo;
- }
-
-+//liuchen 2009-7-22
-+// ::com::sun::star::document::XVbaMethodParameter
-+void SAL_CALL VCLXDialog::setVbaMethodParameter(
-+ const ::rtl::OUString& PropertyName,
-+ const ::com::sun::star::uno::Any& Value )
-+throw(::com::sun::star::uno::RuntimeException)
-+{
-+ if (rtl::OUString::createFromAscii( "Cancel" ) == PropertyName)
-+ {
-+ ::vos::OGuard aGuard( GetMutex() );
-+ if ( GetWindow() )
-+ {
-+ sal_Int8 nCancel;
-+ Value >>= nCancel;
-+
-+ Dialog* pDlg = (Dialog*) GetWindow();
-+ pDlg->SetCloseFlag(nCancel);
-+ }
-+ }
-+}
-+
-+::com::sun::star::uno::Any SAL_CALL VCLXDialog::getVbaMethodParameter(
-+ const ::rtl::OUString& PropertyName )
-+throw(::com::sun::star::uno::RuntimeException)
-+{
-+ ::vos::OGuard aGuard( GetMutex() );
-+
-+ ::com::sun::star::uno::Any aRet;
-+ return aRet;
-+}
-+//liuchen 2009-7-22
-+
-+
-+
-
- void SAL_CALL VCLXDialog::setProperty(
- const ::rtl::OUString& PropertyName,
-diff --git vbahelper/source/msforms/vbacontrol.cxx vbahelper/source/msforms/vbacontrol.cxx
-index 0989548..9ff662a 100644
---- vbahelper/source/msforms/vbacontrol.cxx
-+++ vbahelper/source/msforms/vbacontrol.cxx
-@@ -397,13 +397,20 @@ ScVbaControl* ScVbaControlFactory::createControl(const uno::Reference< drawing::
- 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 )
-+ sal_Bool bToggle = sal_False; //liuchen 2009-8-11,
-+ 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:
-+ //liuchen 2009-8-11
-+ xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Toggle") ) ) >>= bToggle;
-+ if ( bToggle )
-+ return new ScVbaToggleButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
-+ else
-+ return new ScVbaButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
-+ //liuchen 2009-8-11
-+ 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 ) ) );
-diff --git vbahelper/source/msforms/vbaframe.cxx vbahelper/source/msforms/vbaframe.cxx
-index b2827d0..d765d9b 100644
---- vbahelper/source/msforms/vbaframe.cxx
-+++ vbahelper/source/msforms/vbaframe.cxx
-@@ -72,6 +72,17 @@ ScVbaFrame::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::Run
- _value >>= sCaption;
- setCaption( sCaption );
- }
-+//liuchen 2009-7-6
-+::sal_Int32 SAL_CALL ScVbaFrame::getForeColor() throw (::com::sun::star::uno::RuntimeException)
-+{
-+ return 0;
-+}
-+
-+void SAL_CALL ScVbaFrame::setForeColor( ::sal_Int32 /*_forecolor*/ ) throw (::com::sun::star::uno::RuntimeException)
-+{
-+ return;
-+}
-+//liuchen 2009-7-6 end
-
- rtl::OUString&
- ScVbaFrame::getServiceImplName()
-diff --git vbahelper/source/msforms/vbaframe.hxx vbahelper/source/msforms/vbaframe.hxx
-index 071b5b0..9b1b6bb 100644
---- vbahelper/source/msforms/vbaframe.hxx
-+++ vbahelper/source/msforms/vbaframe.hxx
-@@ -51,6 +51,10 @@ public:
- 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);
-+ //liuchen 2009-7-6
-+ virtual ::sal_Int32 SAL_CALL getForeColor() throw (::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL setForeColor( ::sal_Int32 _forecolor ) throw (::com::sun::star::uno::RuntimeException);
-+ //liuchen 2009-7-6 end
- //XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-diff --git vbahelper/source/msforms/vbalabel.cxx vbahelper/source/msforms/vbalabel.cxx
-index a5fa3c1..a9869f7 100644
---- vbahelper/source/msforms/vbalabel.cxx
-+++ vbahelper/source/msforms/vbalabel.cxx
-@@ -35,6 +35,7 @@ using namespace ooo::vba;
-
-
- const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
-+const static rtl::OUString FORECOLOR( RTL_CONSTASCII_USTRINGPARAM("TextColor") ); //liuchen 2009-7-6
- 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 )
- {
- }
-@@ -68,6 +69,20 @@ ScVbaLabel::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::Run
- }
-
-
-+//liuchen 2009-7-6
-+::sal_Int32 SAL_CALL ScVbaLabel::getForeColor() throw (::com::sun::star::uno::RuntimeException)
-+{
-+ sal_Int32 nForeColor;
-+ m_xProps->getPropertyValue( FORECOLOR ) >>= nForeColor;
-+ return OORGBToXLRGB( nForeColor );
-+}
-+
-+void SAL_CALL ScVbaLabel::setForeColor( ::sal_Int32 _forecolor ) throw (::com::sun::star::uno::RuntimeException)
-+{
-+ m_xProps->setPropertyValue( FORECOLOR, uno::makeAny( XLRGBToOORGB( _forecolor ) ) );
-+}
-+//liuchenn 2009-7-6
-+
- rtl::OUString&
- ScVbaLabel::getServiceImplName()
- {
-diff --git vbahelper/source/msforms/vbalabel.hxx vbahelper/source/msforms/vbalabel.hxx
-index 3afd652..9c8766d 100644
---- vbahelper/source/msforms/vbalabel.hxx
-+++ vbahelper/source/msforms/vbalabel.hxx
-@@ -47,6 +47,10 @@ public:
- 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);
-+ //liuchen 2009-7-6
-+ virtual ::sal_Int32 SAL_CALL getForeColor() throw (::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL setForeColor( ::sal_Int32 _forecolor ) throw (::com::sun::star::uno::RuntimeException);
-+ //liuchen 2009-7-6 end
- //XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-diff --git vbahelper/source/msforms/vbalistbox.cxx vbahelper/source/msforms/vbalistbox.cxx
-index 47f9847..175328f 100644
---- vbahelper/source/msforms/vbalistbox.cxx
-+++ vbahelper/source/msforms/vbalistbox.cxx
-@@ -113,7 +113,7 @@ ScVbaListBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
- uno::Sequence< sal_Int16 > nSelectedIndices(1);
- nSelectedIndices[ 0 ] = nValue;
- m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nSelectedIndices ) );
-- m_xProps->setPropertyValue( TEXT, uno::makeAny( sValue ) );
-+ //m_xProps->setPropertyValue( TEXT, uno::makeAny( sValue ) ); //liuchen 2009-8-12 solve the problem that ListBox.Text and ListBox.Value cannot be set
- }
-
- ::rtl::OUString SAL_CALL
-@@ -130,20 +130,22 @@ ScVbaListBox::setText( const ::rtl::OUString& _text ) throw (uno::RuntimeExcepti
- setValue( uno::makeAny( _text ) ); // seems the same
- }
-
--sal_Bool SAL_CALL
-+sal_Int32 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;
-+ return bMultiSelect ? 1 : 0 ;
- }
-
- void SAL_CALL
--ScVbaListBox::setMultiSelect( sal_Bool _multiselect ) throw (css::uno::RuntimeException)
-+ScVbaListBox::setMultiSelect( sal_Int32 _multiselect ) throw (css::uno::RuntimeException)
- {
-- m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiSelection" ) ), uno::makeAny( _multiselect ) );
-+ sal_Bool bMultiSelect = _multiselect == 1 ? 1 : 0;
-+ m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiSelection" ) ), uno::makeAny( bMultiSelect ) );
- }
-
-+
- css::uno::Any SAL_CALL
- ScVbaListBox::Selected( sal_Int32 index ) throw (css::uno::RuntimeException)
- {
-diff --git vbahelper/source/msforms/vbalistbox.hxx vbahelper/source/msforms/vbalistbox.hxx
-index 93e80a3..009ee4f 100644
---- vbahelper/source/msforms/vbalistbox.hxx
-+++ vbahelper/source/msforms/vbalistbox.hxx
-@@ -61,8 +61,8 @@ public:
- 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 ::sal_Int32 SAL_CALL getMultiSelect() throw (css::uno::RuntimeException); //liuchen 2009-7-31
-+ virtual void SAL_CALL setMultiSelect( ::sal_Int32 _multiselect ) throw (css::uno::RuntimeException); //liuchen 2009-7-31
- virtual css::uno::Any SAL_CALL Selected( ::sal_Int32 index ) throw (css::uno::RuntimeException);
-
- // Methods
-diff --git vbahelper/source/msforms/vbatextbox.cxx vbahelper/source/msforms/vbatextbox.cxx
-index d246970..eb1b393 100644
---- vbahelper/source/msforms/vbatextbox.cxx
-+++ vbahelper/source/msforms/vbatextbox.cxx
-@@ -93,7 +93,8 @@ ScVbaTextBox::getMaxLength() throw (css::uno::RuntimeException)
- void SAL_CALL
- ScVbaTextBox::setMaxLength( sal_Int32 _maxlength ) throw (css::uno::RuntimeException)
- {
-- uno::Any aValue( _maxlength );
-+ sal_Int16 _maxlength16 = static_cast<sal_Int16> (_maxlength); //liuchen 2009-7-24, resolve the problem that MaxLength cannot be set correctly
-+ uno::Any aValue( _maxlength16 ); //liuchen 2009-7-24, resolve the problem that MaxLength cannot be set correctly
- m_xProps->setPropertyValue
- (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MaxTextLen" ) ), aValue);
- }
-diff --git vbahelper/source/msforms/vbatogglebutton.cxx vbahelper/source/msforms/vbatogglebutton.cxx
-index f938ad1..0d7cfaf 100644
---- vbahelper/source/msforms/vbatogglebutton.cxx
-+++ vbahelper/source/msforms/vbatogglebutton.cxx
-@@ -76,16 +76,33 @@ ScVbaToggleButton::getValue() throw (uno::RuntimeException)
- return uno::makeAny( nState ? sal_Int16( -1 ) : sal_Int16( 0 ) );
- }
-
-+//liuchen 2009-7-23, resolve the defect that ToggleButton.Value cannot be set correctly
- void SAL_CALL
- ScVbaToggleButton::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
- {
- sal_Int16 nState = 0;
-- _value >>= nState;
-+ if (_value.getValueTypeClass() == typelib_TypeClass_BOOLEAN)
-+ {
-+ sal_Bool bValue;
-+ _value >>= bValue;
-+ nState = static_cast< sal_Int16 >(bValue);
-+ }
-+ else if (_value.getValueTypeClass() == typelib_TypeClass_BYTE)
-+ {
-+ sal_Int8 nValue;
-+ _value >>= nValue;
-+ nState = ( nValue == 1) ? 1 : 0;
-+ }
-+ else
-+ {
-+ _value >>= nState;
- OSL_TRACE( "nState - %d", nState );
-- nState = ( nState == -1 ) ? 1 : 0;
-+ nState = ( nState == -1 ) ? 1 : 0;
- OSL_TRACE( "nState - %d", nState );
-+ }
- m_xProps->setPropertyValue( STATE, uno::makeAny( nState ) );
- }
-+//liuchen 2009-7-23
-
- rtl::OUString&
- ScVbaToggleButton::getServiceImplName()
-diff --git vbahelper/source/vbahelper/vbapictureformat.cxx vbahelper/source/vbahelper/vbapictureformat.cxx
-index 2663682..3f4793a 100644
---- vbahelper/source/vbahelper/vbapictureformat.cxx
-+++ vbahelper/source/vbahelper/vbapictureformat.cxx
-@@ -115,13 +115,14 @@ ScVbaPictureFormat::IncrementContrast( double increment ) throw (uno::RuntimeExc
- {
- double nContrast = getContrast();
- nContrast += increment;
-- if( increment < 0 )
-+ //VBA, minz@cn.ibm.com.
-+ if( nContrast < 0 )
- {
-- increment = 0.0;
-+ nContrast = 0.0;
- }
-- if( increment > 1 )
-+ if( nContrast > 1 )
- {
-- increment = 1.0;
-+ nContrast = 1.0;
- }
- setContrast( nContrast );
- }
-diff --git vcl/inc/vcl/dialog.hxx vcl/inc/vcl/dialog.hxx
-index c765b2e..417093d 100644
---- vcl/inc/vcl/dialog.hxx
-+++ vcl/inc/vcl/dialog.hxx
-@@ -56,6 +56,7 @@ private:
- BOOL mbOldSaveBack;
- BOOL mbInClose;
- BOOL mbModalMode;
-+ sal_Int8 mnCancelClose; //liuchen 2009-7-22, support Excel VBA UserForm_QueryClose event
-
- SAL_DLLPRIVATE void ImplInitDialogData();
- SAL_DLLPRIVATE void ImplInitSettings();
-@@ -93,6 +94,9 @@ public:
- virtual short Execute();
- BOOL IsInExecute() const { return mbInExecute; }
-
-+ sal_Int8 GetCloseFlag() const { return mnCancelClose; } //liuchen 2009-7-22, support Excel VBA UserForm_QueryClose event
-+ void SetCloseFlag( sal_Int8 nCancel ) { mnCancelClose = nCancel; } //liuchen 2009-7-22, support Excel VBA UserForm_QueryClose event
-+
- ////////////////////////////////////////
- // Dialog::Execute replacement API
- public:
-diff --git vcl/source/control/combobox.cxx vcl/source/control/combobox.cxx
-index f95887e..3fe2d5a 100644
---- vcl/source/control/combobox.cxx
-+++ vcl/source/control/combobox.cxx
-@@ -474,8 +474,11 @@ IMPL_LINK( ComboBox, ImplSelectHdl, void*, EMPTYARG )
- mpSubEdit->SetModifyFlag();
- mbSyntheticModify = TRUE;
- Modify();
-- mbSyntheticModify = FALSE;
-- Select();
-+ mbSyntheticModify = FALSE;
-+ if (ImplGetWindowImpl() != NULL) //liuchen 2009-7-28, resolve the problem that soffice get crashed if in ComboBox_Change event a Worksheets("SheetX").Activate sentence needs to be executed
-+ {
-+ Select();
-+ }
- }
-
- return 0;
-diff --git vcl/source/window/dialog.cxx vcl/source/window/dialog.cxx
-index f5395a9..f641adf 100644
---- vcl/source/window/dialog.cxx
-+++ vcl/source/window/dialog.cxx
-@@ -550,7 +550,14 @@ BOOL Dialog::Close()
- {
- ImplDelData aDelData;
- ImplAddDel( &aDelData );
-- ImplCallEventListeners( VCLEVENT_WINDOW_CLOSE );
-+ //liuchen 2009-7-22, support Excel VBA UserForm_QueryClose event
-+ mnCancelClose = 0;
-+ ImplCallEventListeners( VCLEVENT_WINDOW_CLOSE );
-+ if (mnCancelClose == 1)
-+ {
-+ return FALSE;
-+ }
-+ //liuchen 2009-7-22
- if ( aDelData.IsDelete() )
- return FALSE;
- ImplRemoveDel( &aDelData );
diff --git a/patches/vba/native-export/ObjectModule.diff b/patches/vba/native-export/ObjectModule.diff
deleted file mode 100644
index cb1e244a7..000000000
--- a/patches/vba/native-export/ObjectModule.diff
+++ /dev/null
@@ -1,2330 +0,0 @@
-diff --git basctl/source/basicide/basides1.cxx basctl/source/basicide/basides1.cxx
-index aed5958..3d79067 100644
---- basctl/source/basicide/basides1.cxx
-+++ basctl/source/basicide/basides1.cxx
-@@ -1201,10 +1201,16 @@ IDEBaseWindow* BasicIDEShell::FindWindow
- // return any non-suspended window
- return pWin;
- }
-- else if ( pWin->IsDocument( rDocument ) && pWin->GetLibName() == rLibName && pWin->GetName() == rName &&
-+ else if ( pWin->IsDocument( rDocument ) )
-+ {
-+ OSL_TRACE("FindWindow pWin->GetLibName() %s rLibName %s",
-+ rtl::OUStringToOString( pWin->GetLibName(), RTL_TEXTENCODING_UTF8 ).getStr(),
-+ rtl::OUStringToOString( rLibName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ OSL_TRACE("pWin->pWin->IsA( TYPE( ModulWindow ) %d && nType %d = BASICIDE_TYPE_MODULE %d", pWin->IsA( TYPE( ModulWindow ) ), nType, BASICIDE_TYPE_MODULE );
-+ OSL_TRACE("pWin->pWin->IsA( TYPE( DialogWindow ) %d && nType %d = BASICIDE_TYPE_DIALOG %d", pWin->IsA( TYPE( DialogWindow ) ), nType, BASICIDE_TYPE_DIALOG );
-+ if ( pWin->GetLibName() == rLibName && pWin->GetName() == rName &&
- ( ( pWin->IsA( TYPE( ModulWindow ) ) && nType == BASICIDE_TYPE_MODULE ) ||
- ( pWin->IsA( TYPE( DialogWindow ) ) && nType == BASICIDE_TYPE_DIALOG ) ) )
-- {
- return pWin;
- }
- }
-diff --git basctl/source/basicide/basides2.cxx basctl/source/basicide/basides2.cxx
-index 76dcea0..90cec19 100644
---- basctl/source/basicide/basides2.cxx
-+++ basctl/source/basicide/basides2.cxx
-@@ -251,9 +251,12 @@ ModulWindow* BasicIDEShell::CreateBasWin
-
- if ( bSuccess )
- {
-- // new module window
-- pWin = new ModulWindow( pModulLayout, rDocument, aLibName, aModName, aModule );
-- nKey = InsertWindowInTable( pWin );
-+ pWin = FindBasWin( rDocument, aLibName, aModName, FALSE, TRUE );
-+ if( !pWin )
-+ { // new module window
-+ pWin = new ModulWindow( pModulLayout, rDocument, aLibName, aModName, aModule );
-+ nKey = InsertWindowInTable( pWin );
-+ }
- }
- }
- else
-@@ -268,7 +271,8 @@ ModulWindow* BasicIDEShell::CreateBasWin
- }
- DBG_ASSERT( nKey, "CreateBasWin: Kein Key- Fenster nicht gefunden!" );
- }
-- pTabBar->InsertPage( (USHORT)nKey, aModName );
-+ if( nKey )
-+ pTabBar->InsertPage( (USHORT)nKey, aModName );
- pTabBar->Sort();
- pWin->GrabScrollBars( &aHScrollBar, &aVScrollBar );
- if ( !pCurWin )
-diff --git basctl/source/basicide/basidesh.cxx basctl/source/basicide/basidesh.cxx
-index 03459cc..d921d99 100644
---- basctl/source/basicide/basidesh.cxx
-+++ basctl/source/basicide/basidesh.cxx
-@@ -80,6 +80,9 @@
- #include <com/sun/star/script/XLibraryContainer.hpp>
- #include <com/sun/star/script/XLibraryContainerPassword.hpp>
- #include <com/sun/star/container/XNameContainer.hpp>
-+#include <com/sun/star/container/XContainer.hpp>
-+#include <com/sun/star/container/XContainerListener.hpp>
-+#include <com/sun/star/script/XLibraryContainer.hpp>
-
- #include <svx/xmlsecctrl.hxx>
-
-@@ -87,6 +90,71 @@ using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star;
- using ::rtl::OUString;
-
-+static const rtl::OUString sStandardLibName( rtl::OUString::createFromAscii("Standard") );
-+
-+typedef ::cppu::WeakImplHelper1< container::XContainerListener > ContainerListenerBASE;
-+
-+class ContainerListenerImpl : public ContainerListenerBASE
-+{
-+ BasicIDEShell* mpShell;
-+public:
-+
-+ ContainerListenerImpl( BasicIDEShell* pShell ) : mpShell( pShell ) {}
-+
-+ ~ContainerListenerImpl()
-+ {
-+ }
-+
-+ void addContainerListener( const ScriptDocument& rScriptDocument )
-+ {
-+ uno::Reference< container::XContainer > xContainer( rScriptDocument.getLibrary( E_SCRIPTS, sStandardLibName, FALSE ), uno::UNO_QUERY );
-+ if ( rScriptDocument.isDocument() && xContainer.is() )
-+ {
-+ uno::Reference< container::XContainerListener > xContainerListener( this );
-+ try
-+ {
-+ xContainer->addContainerListener( xContainerListener );
-+ }
-+ catch( uno::Exception& ) {}
-+ }
-+ }
-+ void removeContainerListener( const ScriptDocument& rScriptDocument )
-+ {
-+ uno::Reference< container::XContainer > xContainer( rScriptDocument.getLibrary( E_SCRIPTS, sStandardLibName, FALSE ), uno::UNO_QUERY );
-+ if ( rScriptDocument.isDocument(), xContainer.is() )
-+ {
-+ uno::Reference< container::XContainerListener > xContainerListener( this );
-+ try
-+ {
-+ xContainer->removeContainerListener( xContainerListener );
-+ }
-+ catch( uno::Exception& ) {}
-+ }
-+ }
-+
-+ // XEventListener
-+ virtual void SAL_CALL disposing( const lang::EventObject& ) throw( uno::RuntimeException ) {}
-+
-+ // XContainerListener
-+ virtual void SAL_CALL elementInserted( const container::ContainerEvent& Event ) throw( uno::RuntimeException )
-+ {
-+ rtl::OUString sModuleName;
-+ if( mpShell && ( Event.Accessor >>= sModuleName ) )
-+ mpShell->FindBasWin( mpShell->m_aCurDocument, sStandardLibName, sModuleName, TRUE, FALSE );
-+ }
-+ virtual void SAL_CALL elementReplaced( const container::ContainerEvent& ) throw( com::sun::star::uno::RuntimeException ) { }
-+ virtual void SAL_CALL elementRemoved( const container::ContainerEvent& Event ) throw( com::sun::star::uno::RuntimeException )
-+ {
-+ rtl::OUString sModuleName;
-+ if( mpShell && ( Event.Accessor >>= sModuleName ) )
-+ {
-+ IDEBaseWindow* pWin = mpShell->FindWindow( mpShell->m_aCurDocument, sStandardLibName, sModuleName, BASICIDE_TYPE_MODULE, TRUE );
-+ if( pWin )
-+ mpShell->RemoveWindow( pWin, FALSE, TRUE );
-+ }
-+ }
-+
-+};
-
- TYPEINIT1( BasicIDEShell, SfxViewShell );
-
-@@ -124,6 +192,7 @@ BasicIDEShell::BasicIDEShell( SfxViewFra
- m_bAppBasicModified( FALSE ),
- m_aNotifier( *this )
- {
-+ m_xLibListener = new ContainerListenerImpl( this );
- Init();
- GnBasicIDEShellCount++;
- }
-@@ -215,6 +284,12 @@ __EXPORT BasicIDEShell::~BasicIDEShell()
- delete pTabBar;
- delete pObjectCatalog;
- DestroyModulWindowLayout();
-+
-+ ContainerListenerImpl* pListener = dynamic_cast< ContainerListenerImpl* >( m_xLibListener.get() );
-+ // Destroy all ContainerListeners for Basic Container.
-+ if ( pListener )
-+ pListener->removeContainerListener( m_aCurDocument );
-+
- // MI: Das gab einen GPF im SDT beim Schliessen da dann der ViewFrame die
- // ObjSh loslaesst. Es wusste auch keiner mehr wozu das gut war.
- // GetViewFrame()->GetObjectShell()->Broadcast( SfxSimpleHint( SFX_HINT_DYING ) );
-@@ -935,7 +1010,15 @@ void BasicIDEShell::SetCurLib( const Scr
- {
- if ( !bCheck || ( rDocument != m_aCurDocument || aLibName != m_aCurLibName ) )
- {
-+ ContainerListenerImpl* pListener = dynamic_cast< ContainerListenerImpl* >( m_xLibListener.get() );
-+ if ( pListener )
-+ pListener->removeContainerListener( m_aCurDocument );
-+
- m_aCurDocument = rDocument;
-+
-+ if ( pListener )
-+ pListener->addContainerListener( m_aCurDocument );
-+
- m_aCurLibName = aLibName;
- if ( bUpdateWindows )
- UpdateWindows();
-diff --git basctl/source/inc/basidesh.hxx basctl/source/inc/basidesh.hxx
-index 6b3690c..3919bd9 100644
---- basctl/source/inc/basidesh.hxx
-+++ basctl/source/inc/basidesh.hxx
-@@ -49,6 +49,7 @@
- #include <com/sun/star/io/XInputStreamProvider.hpp>
- #endif
-
-+#include <com/sun/star/container/XContainerListener.hpp>
-
- //----------------------------------------------------------------------------
-
-@@ -107,6 +108,8 @@ friend bool BasicIDE::RemoveDialog( cons
- BOOL m_bAppBasicModified;
- ::basctl::DocumentEventNotifier
- m_aNotifier;
-+friend class ContainerListenerImpl;
-+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener > m_xLibListener;
-
- #if _SOLAR__PRIVATE
- void Init();
-diff --git basic/inc/basic/sbmod.hxx basic/inc/basic/sbmod.hxx
-index 122a664..e676a49 100644
---- basic/inc/basic/sbmod.hxx
-+++ basic/inc/basic/sbmod.hxx
-@@ -37,7 +37,7 @@
- #ifndef _RTL_USTRING_HXX
- #include <rtl/ustring.hxx>
- #endif
--
-+#include <com/sun/star/script/ModuleType.hpp>
- class SbMethod;
- class SbProperty;
- class SbiRuntime;
-@@ -67,6 +67,9 @@ protected:
- SbiBreakpoints* pBreaks; // Breakpoints
- SbClassData* pClassData;
- bool mbVBACompat;
-+ INT32 mnType;
-+ SbxObjectRef pDocObject; // an impl object ( used by Document Modules )
-+ bool bIsProxyModule;
-
- void StartDefinitions();
- SbMethod* GetMethod( const String&, SbxDataType );
-@@ -91,7 +94,7 @@ protected:
- public:
- SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_BASICMOD,2);
- TYPEINFO();
-- SbModule( const String& );
-+ SbModule( const String&, bool bCompat = false );
- virtual void SetParent( SbxObject* );
- virtual void Clear();
-
-@@ -127,8 +130,12 @@ public:
- BOOL LoadBinaryData( SvStream& );
- BOOL ExceedsLegacyModuleSize();
- void fixUpMethodStart( bool bCvtToLegacy, SbiImage* pImg = NULL ) const;
-- bool IsVBACompat() { return mbVBACompat; }
- bool HasExeCode();
-+ bool IsVBACompat();
-+ void SetVBACompat( bool bCompat );
-+ INT32 GetModuleType() { return mnType; }
-+ void SetModuleType( INT32 nType ) { mnType = nType; }
-+ bool GetIsProxyModule() { return bIsProxyModule; }
- };
-
- #ifndef __SB_SBMODULEREF_HXX
-diff --git basic/inc/basic/sbobjmod.hxx basic/inc/basic/sbobjmod.hxx
-new file mode 100644
-index 0000000..cb581c1
---- /dev/null
-+++ basic/inc/basic/sbobjmod.hxx
-@@ -0,0 +1,66 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: sbobjmod.hxx,v $
-+ *
-+ * $Revision: 1.4 $
-+ *
-+ * last change: $Author: $ $Date: 2007/08/27 16:31:39 $
-+ *
-+ * 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 _SB_OBJMOD_HXX
-+#define _SB_OBJMOD_HXX
-+
-+#include <basic/sbmod.hxx>
-+#include <basic/sbstar.hxx>
-+#include <com/sun/star/script/ModuleInfo.hpp>
-+#include <com/sun/star/lang/XEventListener.hpp>
-+#include <com/sun/star/awt/XDialog.hpp>
-+
-+namespace css = ::com::sun::star;
-+
-+// Basic-Module for excel object.
-+
-+class SbObjModule : public SbModule
-+{
-+public:
-+ TYPEINFO();
-+ SbObjModule( const com::sun::star::script::ModuleInfo& mInfo, bool bIsVbaCompatible );
-+ virtual SbxVariable* Find( const XubString& rName, SbxClassType t );
-+ SbxVariable* GetObject();
-+ void SetUnoObject( const com::sun::star::uno::Any& aObj )throw ( com::sun::star::uno::RuntimeException ) ;
-+};
-+
-+#ifndef __SB_SBOBJMODULEREF_HXX
-+#define __SB_SBOBJMODULEREF_HXX
-+
-+SV_DECL_IMPL_REF(SbObjModule);
-+
-+#endif
-+#endif
-+
-diff --git basic/inc/basic/sbstar.hxx basic/inc/basic/sbstar.hxx
-index ebd10ae..1f20e9d 100644
---- basic/inc/basic/sbstar.hxx
-+++ basic/inc/basic/sbstar.hxx
-@@ -40,6 +40,7 @@
-
- #include <basic/sbdef.hxx>
- #include <basic/sberrors.hxx>
-+#include <com/sun/star/script/ModuleInfo.hpp>
-
- class SbModule; // fertiges Modul
- class SbiInstance; // Laufzeit-Instanz
-@@ -71,6 +72,7 @@ class StarBASIC : public SbxObject
- BOOL bNoRtl; // TRUE: RTL nicht durchsuchen
- BOOL bBreak; // TRUE: Break, sonst Step
- BOOL bDocBasic;
-+ BOOL bVBAEnabled;
- BasicLibInfo* pLibInfo; // Infoblock fuer Basic-Manager
- SbLanguageMode eLanguageMode; // LanguageMode des Basic-Objekts
- protected:
-@@ -113,7 +115,8 @@ public:
-
- // Compiler-Interface
- SbModule* MakeModule( const String& rName, const String& rSrc );
-- SbModule* MakeModule32( const String& rName, const ::rtl::OUString& rSrc );
-+ SbModule* MakeModule32( const String& rName, const ::rtl::OUString& rSrc );
-+ SbModule* MakeModule32( const com::sun::star::script::ModuleInfo& mInfo, const ::rtl::OUString& rSrc );
- BOOL Compile( SbModule* );
- BOOL Disassemble( SbModule*, String& rText );
- static void Stop();
-@@ -185,6 +188,8 @@ public:
- ( const String& rName, USHORT& rStatus );
- static SbMethod* GetActiveMethod( USHORT nLevel = 0 );
- static SbModule* GetActiveModule();
-+ void SetVBAEnabled( BOOL bEnabled );
-+ BOOL isVBAEnabled();
-
- // #60175 TRUE: SFX-Resource wird bei Basic-Fehlern nicht angezogen
- static void StaticSuppressSfxResource( BOOL bSuppress );
-diff --git basic/source/basmgr/basmgr.cxx basic/source/basmgr/basmgr.cxx
-index 73eb4cb..864a941 100644
---- basic/source/basmgr/basmgr.cxx
-+++ basic/source/basmgr/basmgr.cxx
-@@ -44,6 +44,7 @@
- #include <tools/debug.hxx>
- #include <tools/diagnose_ex.h>
- #include <basic/sbmod.hxx>
-+#include <basic/sbobjmod.hxx>
-
- #include <basic/sbuno.hxx>
- #include <basic/basmgr.hxx>
-@@ -67,6 +68,9 @@
- #include <com/sun/star/script/XStarBasicDialogInfo.hpp>
- #include <com/sun/star/script/XStarBasicLibraryInfo.hpp>
- #include <com/sun/star/script/XLibraryContainerPassword.hpp>
-+#include <com/sun/star/script/ModuleInfo.hpp>
-+#include <com/sun/star/script/ModuleType.hpp>
-+#include <com/sun/star/script/XBasicLibraryInfo.hpp>
-
- #include <cppuhelper/implbase1.hxx>
-
-@@ -236,6 +240,11 @@ void BasMgrContainerListenerImpl::addLib
-
- StarBASIC* pLib = pMgr->GetLib( aLibName );
- DBG_ASSERT( pLib, "BasMgrContainerListenerImpl::addLibraryModulesImpl: Unknown lib!");
-+ Reference< XBasicLibraryInfo > xLibInfo( xLibNameAccess, UNO_QUERY );
-+ if ( xLibInfo.is() && xLibInfo->getVBACompatMode() )
-+ pLib->SetVBAEnabled( true );
-+
-+ OSL_TRACE("addLibraryModulesImpl libname %s, xLibInfo %d", rtl::OUStringToOString( aLibName, RTL_TEXTENCODING_UTF8 ).getStr(), xLibInfo.is() );
- if( pLib )
- {
- const ::rtl::OUString* pNames = aModuleNames.getConstArray();
-@@ -245,7 +254,15 @@ void BasMgrContainerListenerImpl::addLib
- Any aElement = xLibNameAccess->getByName( aModuleName );
- ::rtl::OUString aMod;
- aElement >>= aMod;
-- pLib->MakeModule32( aModuleName, aMod );
-+
-+ if ( xLibInfo.is() && xLibInfo->getVBACompatMode() )
-+ {
-+ ModuleInfo mInfo = xLibInfo->getModuleInfo( pNames[ j ] );
-+ OSL_TRACE("#addLibraryModulesImpl - aMod");
-+ pLib->MakeModule32( mInfo, aMod );
-+ }
-+ else
-+ pLib->MakeModule32( aModuleName, aMod );
- }
- }
-
-@@ -274,6 +291,7 @@ void SAL_CALL BasMgrContainerListenerImp
- Event.Accessor >>= aName;
-
- mpMgr->mpImpl->mbModifiedByLibraryContainer = sal_True;
-+ Reference< XBasicLibraryInfo > xLibInfo( Event.Source, UNO_QUERY );
-
- if( bLibContainer )
- {
-@@ -282,8 +300,6 @@ void SAL_CALL BasMgrContainerListenerImp
- }
- else
- {
-- ::rtl::OUString aMod;
-- Event.Element >>= aMod;
-
- StarBASIC* pLib = mpMgr->GetLib( maLibName );
- DBG_ASSERT( pLib, "BasMgrContainerListenerImpl::elementInserted: Unknown lib!");
-@@ -292,7 +308,17 @@ void SAL_CALL BasMgrContainerListenerImp
- SbModule* pMod = pLib->FindModule( aName );
- if( !pMod )
- {
-- pLib->MakeModule32( aName, aMod );
-+ ::rtl::OUString aMod;
-+ Event.Element >>= aMod;
-+ if ( xLibInfo.is() && xLibInfo->getVBACompatMode() )
-+ {
-+ ModuleInfo mInfo = xLibInfo->getModuleInfo( aName );
-+ pLib->MakeModule32( mInfo, aMod );
-+ }
-+ else
-+ {
-+ pLib->MakeModule32( aName, aMod );
-+ }
- pLib->SetModified( FALSE );
- }
- }
-@@ -316,15 +342,26 @@ void SAL_CALL BasMgrContainerListenerImp
- DBG_ASSERT( !bLibContainer, "library container fired elementReplaced()");
-
- StarBASIC* pLib = mpMgr->GetLib( maLibName );
-+
- if( pLib )
- {
-- SbModule* pMod = pLib->FindModule( aName );
-+ SbModule* pMod = pLib->FindModule( aName );
- ::rtl::OUString aMod;
-- Event.Element >>= aMod;
-+ Event.Element >>= aMod;
-+
- if( pMod )
- pMod->SetSource32( aMod );
-- else
-- pLib->MakeModule32( aName, aMod );
-+ else
-+ {
-+ Reference< XBasicLibraryInfo > xLibInfo( Event.Source, UNO_QUERY );
-+ if ( xLibInfo.is() && xLibInfo->getVBACompatMode() )
-+ {
-+ ModuleInfo mInfo = xLibInfo->getModuleInfo( aName );
-+ pLib->MakeModule32( mInfo, aMod );
-+ }
-+ else
-+ pLib->MakeModule32( aName, aMod );
-+ }
-
- pLib->SetModified( FALSE );
- }
-diff --git basic/source/classes/sb.cxx basic/source/classes/sb.cxx
-index f65c6ca..ac067de 100644
---- basic/source/classes/sb.cxx
-+++ basic/source/classes/sb.cxx
-@@ -52,12 +52,17 @@
- #include "disas.hxx"
- #include "runtime.hxx"
- #include <basic/sbuno.hxx>
-+#include <basic/sbobjmod.hxx>
- #include "stdobj.hxx"
- #include "filefmt.hxx"
- #include "sb.hrc"
- #include <basrid.hxx>
- #include <vos/mutex.hxx>
-
-+#include <com/sun/star/script/ModuleType.hpp>
-+#include <com/sun/star/script/ModuleInfo.hpp>
-+using namespace ::com::sun::star::script;
-+
- // #pragma SW_SEGMENT_CLASS( SBASIC, SBASIC_CODE )
-
- SV_IMPL_VARARR(SbTextPortions,SbTextPortion)
-@@ -249,6 +254,8 @@ SbxObject* SbiFactory::CreateObject( con
- else
- if( rClass.EqualsIgnoreCaseAscii( "Collection" ) )
- {
-+ // Only variables qualified by the Module Name e.g. Sheet1.foo
-+ // should work for Documant && Class type Modules
- String aCollectionName( RTL_CONSTASCII_USTRINGPARAM("Collection") );
- return new BasicCollection( aCollectionName );
- }
-@@ -446,6 +453,7 @@ SbClassModuleObject::SbClassModuleObject
- }
- }
- }
-+ SetModuleType( com::sun::star::script::ModuleType::Class );
- }
-
- SbClassModuleObject::~SbClassModuleObject()
-@@ -581,6 +589,7 @@ StarBASIC::StarBASIC( StarBASIC* p, BOOL
- SetParent( p );
- pLibInfo = NULL;
- bNoRtl = bBreak = FALSE;
-+ bVBAEnabled = FALSE;
- pModules = new SbxArray;
-
- if( !GetSbData()->nInst++ )
-@@ -683,12 +692,37 @@ SbModule* StarBASIC::MakeModule( const S
-
- SbModule* StarBASIC::MakeModule32( const String& rName, const ::rtl::OUString& rSrc )
- {
-- SbModule* p = new SbModule( rName );
-+ ModuleInfo mInfo;
-+ mInfo.ModuleType = ModuleType::Normal;
-+ mInfo.ModuleName = rName;
-+ return MakeModule32( mInfo, rSrc );
-+}
-+SbModule* StarBASIC::MakeModule32( const ModuleInfo& mInfo, const ::rtl::OUString& rSrc )
-+{
-+
-+ OSL_TRACE("create module %s type mInfo %d", rtl::OUStringToOString( mInfo.ModuleName, RTL_TEXTENCODING_UTF8 ).getStr(), mInfo.ModuleType );
-+ SbModule* p = NULL;
-+ switch ( mInfo.ModuleType )
-+ {
-+ case ModuleType::Document:
-+ // In theory we should be able to create Object modules
-+ // in ordinary basic ( in vba mode thought these are create
-+ // by the application/basic and not by the user )
-+ p = new SbObjModule( mInfo, isVBAEnabled() );
-+ break;
-+ case ModuleType::Class:
-+ p = new SbModule( mInfo.ModuleName, isVBAEnabled() );
-+ p->SetModuleType( com::sun::star::script::ModuleType::Class );
-+ break;
-+ default:
-+ p = new SbModule( mInfo.ModuleName, isVBAEnabled() );
-+
-+ }
- p->SetSource32( rSrc );
- p->SetParent( this );
- pModules->Insert( p, pModules->Count() );
- SetModified( TRUE );
-- return p;
-+ return p;
- }
-
- void StarBASIC::Insert( SbxVariable* pVar )
-@@ -862,6 +896,12 @@ SbxVariable* StarBASIC::Find( const Stri
- }
- pNamed = p;
- }
-+ // Only variables qualified by the Module Name e.g. Sheet1.foo
-+ // should work for Documant && Class type Modules
-+ INT32 nType = p->GetModuleType();
-+ //if ( nType == com::sun::star::script::ModuleType::Class || nType == com::sun::star::script::ModuleType::Document )
-+ if ( nType == com::sun::star::script::ModuleType::Document )
-+ continue;
- // Sonst testen, ob das Element vorhanden ist
- // GBLSEARCH-Flag rausnehmen (wg. Rekursion)
- USHORT nGblFlag = p->GetFlags() & SBX_GBLSEARCH;
-diff --git basic/source/classes/sbxmod.cxx basic/source/classes/sbxmod.cxx
-index 42c4536..8ea4b64 100644
---- basic/source/classes/sbxmod.cxx
-+++ basic/source/classes/sbxmod.cxx
-@@ -51,6 +51,8 @@
- #include <basic/hilight.hxx>
- #include <basic/basrdll.hxx>
- #include <vos/mutex.hxx>
-+#include <basic/sbobjmod.hxx>
-+#include <com/sun/star/lang/XServiceInfo.hpp>
-
- // for the bsearch
- #ifdef WNT
-@@ -65,6 +67,17 @@
-
- #include <stdio.h>
-
-+#include <comphelper/processfactory.hxx>
-+#include <com/sun/star/script/XLibraryContainer.hpp>
-+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-+#include <com/sun/star/awt/XDialogProvider.hpp>
-+#include <com/sun/star/awt/XTopWindow.hpp>
-+#include <com/sun/star/awt/XControl.hpp>
-+#include <com/sun/star/frame/XModel.hpp>
-+#include <cppuhelper/implbase1.hxx>
-+#include <comphelper/anytostring.hxx>
-+
-+using namespace ::com::sun::star;
-
- TYPEINIT1(SbModule,SbxObject)
- TYPEINIT1(SbMethod,SbxMethod)
-@@ -72,6 +85,7 @@ TYPEINIT1(SbProperty,SbxProperty)
- TYPEINIT1(SbProcedureProperty,SbxProperty)
- TYPEINIT1(SbJScriptModule,SbModule)
- TYPEINIT1(SbJScriptMethod,SbMethod)
-+TYPEINIT1(SbObjModule,SbModule)
-
- SV_DECL_VARARR(SbiBreakpoints,USHORT,4,4)
- SV_IMPL_VARARR(SbiBreakpoints,USHORT)
-@@ -221,12 +235,13 @@ extern "C" int CDECL compare_strings( co
- // Ein BASIC-Modul hat EXTSEARCH gesetzt, damit die im Modul enthaltenen
- // Elemente von anderen Modulen aus gefunden werden koennen.
-
--SbModule::SbModule( const String& rName )
-+SbModule::SbModule( const String& rName, bool bVBACompat )
- : SbxObject( String( RTL_CONSTASCII_USTRINGPARAM("StarBASICModule") ) ),
-- pImage( NULL ), pBreaks( NULL ), pClassData( NULL ), mbVBACompat( false )
-+ pImage( NULL ), pBreaks( NULL ), pClassData( NULL ), mbVBACompat( bVBACompat ), pDocObject( NULL ), bIsProxyModule( false )
- {
- SetName( rName );
- SetFlag( SBX_EXTSEARCH | SBX_GBLSEARCH );
-+ SetModuleType( com::sun::star::script::ModuleType::Normal );
- }
-
- SbModule::~SbModule()
-@@ -401,7 +416,10 @@ void SbModule::Clear()
-
- SbxVariable* SbModule::Find( const XubString& rName, SbxClassType t )
- {
-+ // make sure a search in an uninstatiated class module will fail
- SbxVariable* pRes = SbxObject::Find( rName, t );
-+ if ( bIsProxyModule )
-+ return NULL;
- if( !pRes && pImage )
- {
- SbiInstance* pInst = pINST;
-@@ -561,6 +579,7 @@ void SbModule::SetSource32( const ::rtl:
- aOUSource = r;
- StartDefinitions();
- SbiTokenizer aTok( r );
-+ aTok.SetCompatible( IsVBACompat() );
- while( !aTok.IsEof() )
- {
- SbiToken eEndTok = NIL;
-@@ -585,14 +604,6 @@ void SbModule::SetSource32( const ::rtl:
- {
- eEndTok = ENDPROPERTY; break;
- }
-- if( eCurTok == OPTION )
-- {
-- eCurTok = aTok.Next();
-- mbVBACompat = ( eCurTok == VBASUPPORT ) && ( aTok.Next() == NUMBER ) && ( aTok.GetDbl()== 1 );
-- if( eCurTok == COMPATIBLE
-- || mbVBACompat )
-- aTok.SetCompatible( true );
-- }
- }
- eLastTok = eCurTok;
- }
-@@ -731,10 +742,19 @@ void ClearUnoObjectsInRTL_Impl( StarBASI
- if( ((StarBASIC*)p) != pBasic )
- ClearUnoObjectsInRTL_Impl_Rek( (StarBASIC*)p );
- }
-+bool SbModule::IsVBACompat()
-+{
-+ return mbVBACompat;
-+}
-
-+void SbModule::SetVBACompat( bool bCompat )
-+{
-+ mbVBACompat = bCompat;
-+}
- // Ausfuehren eines BASIC-Unterprogramms
- USHORT SbModule::Run( SbMethod* pMeth )
- {
-+ OSL_TRACE("About to run %s, vba compatmode is %d", rtl::OUStringToOString( pMeth->GetName(), RTL_TEXTENCODING_UTF8 ).getStr(), mbVBACompat );
- static USHORT nMaxCallLevel = 0;
- static String aMSOMacroRuntimeLibName = String::CreateFromAscii( "Launcher" );
- static String aMSOMacroRuntimeAppSymbol = String::CreateFromAscii( "Application" );
-@@ -826,10 +846,10 @@ USHORT SbModule::Run( SbMethod* pMeth )
- if( pRt->pNext )
- pRt->pNext->block();
- pINST->pRun = pRt;
-- if ( SbiRuntime ::isVBAEnabled() )
-+ if ( mbVBACompat )
- {
- pINST->EnableCompatibility( TRUE );
-- pRt->SetVBAEnabled( true );
-+ //pRt->SetVBAEnabled( true ); // can we get rid of this
- }
- while( pRt->Step() ) {}
- if( pRt->pNext )
-@@ -1404,7 +1424,6 @@ BOOL SbModule::LoadBinaryData( SvStream&
- return bRet;
- }
-
--
- BOOL SbModule::LoadCompleted()
- {
- SbxArray* p = GetMethods();
-@@ -2207,6 +2226,53 @@ SbJScriptMethod::~SbJScriptMethod()
-
-
- /////////////////////////////////////////////////////////////////////////
-+SbObjModule::SbObjModule( const com::sun::star::script::ModuleInfo& mInfo, bool bIsVbaCompatible )
-+ : SbModule( mInfo.ModuleName, bIsVbaCompatible )
-+{
-+ SetModuleType( mInfo.ModuleType );
-+ if ( mInfo.ModuleType == script::ModuleType::Form )
-+ {
-+ SetClassName( rtl::OUString::createFromAscii( "Form" ) );
-+ }
-+ else if ( mInfo.ModuleObject.is() )
-+ SetUnoObject( uno::makeAny( mInfo.ModuleObject ) );
-+}
-+void
-+SbObjModule::SetUnoObject( const uno::Any& aObj ) throw ( uno::RuntimeException )
-+{
-+ SbUnoObject* pUnoObj = PTR_CAST(SbUnoObject,(SbxVariable*)pDocObject);
-+ if ( pUnoObj && pUnoObj->getUnoAny() == aObj ) // object is equal, nothing to do
-+ return;
-+ pDocObject = new SbUnoObject( GetName(), uno::makeAny( aObj ) );
-+
-+ com::sun::star::uno::Reference< com::sun::star::lang::XServiceInfo > xServiceInfo( aObj, com::sun::star::uno::UNO_QUERY_THROW );
-+ if( xServiceInfo->supportsService( rtl::OUString::createFromAscii( "org.openoffice.excel.Worksheet" ) ) )
-+ {
-+ SetClassName( rtl::OUString::createFromAscii( "Worksheet" ) );
-+ }
-+ else if( xServiceInfo->supportsService( rtl::OUString::createFromAscii( "org.openoffice.excel.Workbook" ) ) )
-+ {
-+ SetClassName( rtl::OUString::createFromAscii( "Workbook" ) );
-+ }
-+}
-+
-+SbxVariable*
-+SbObjModule::GetObject()
-+{
-+ return pDocObject;
-+}
-+SbxVariable*
-+SbObjModule::Find( const XubString& rName, SbxClassType t )
-+{
-+ //OSL_TRACE("SbObjectModule find for %s", rtl::OUStringToOString( rName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ SbxVariable* pVar = NULL;
-+ if ( !pVar && pDocObject)
-+ pVar = pDocObject->Find( rName, t );
-+ if ( !pVar )
-+ pVar = SbModule::Find( rName, t );
-+ return pVar;
-+}
-+/////////////////////////////////////////////////////////////////////////
-
- SbProperty::SbProperty( const String& r, SbxDataType t, SbModule* p )
- : SbxProperty( r, t ), pMod( p )
-diff --git basic/source/comp/codegen.cxx basic/source/comp/codegen.cxx
-index 9f88fb6..4674134 100644
---- basic/source/comp/codegen.cxx
-+++ basic/source/comp/codegen.cxx
-@@ -130,12 +130,12 @@ void SbiCodeGen::Save()
- // OPTION EXPLICIT-Flag uebernehmen
- if( pParser->bExplicit )
- p->SetFlag( SBIMG_EXPLICIT );
-- if( pParser->IsVBASupportOn() )
-- p->SetFlag( SBIMG_VBASUPPORT );
-
- int nIfaceCount = 0;
-- if( pParser->bClassModule )
-+ if( rMod.mnType == com::sun::star::script::ModuleType::Class )
- {
-+ OSL_TRACE("COdeGen::save() classmodule processing");
-+ rMod.bIsProxyModule = true;
- p->SetFlag( SBIMG_CLASSMODULE );
- pCLASSFAC->AddClassModule( &rMod );
-
-@@ -158,6 +158,10 @@ void SbiCodeGen::Save()
- else
- {
- pCLASSFAC->RemoveClassModule( &rMod );
-+ // Only a ClassModule can revert to Normal
-+ if ( rMod.mnType == com::sun::star::script::ModuleType::Class )
-+ rMod.mnType = com::sun::star::script::ModuleType::Normal;
-+ rMod.bIsProxyModule = false;
- }
- if( pParser->bText )
- p->SetFlag( SBIMG_COMPARETEXT );
-@@ -240,6 +244,8 @@ void SbiCodeGen::Save()
- if( nPass == 1 )
- aPropName = aPropName.Copy( aIfaceName.Len() + 1 );
- SbProcedureProperty* pProcedureProperty = NULL;
-+ OSL_TRACE("*** getProcedureProperty for thing %s",
-+ rtl::OUStringToOString( aPropName,RTL_TEXTENCODING_UTF8 ).getStr() );
- pProcedureProperty = rMod.GetProcedureProperty( aPropName, ePropType );
- }
- if( nPass == 1 )
-diff --git basic/source/comp/parser.cxx basic/source/comp/parser.cxx
-index 3259f77..1a4dc06 100644
---- basic/source/comp/parser.cxx
-+++ basic/source/comp/parser.cxx
-@@ -145,7 +145,8 @@ SbiParser::SbiParser( StarBASIC* pb, SbM
- bNewGblDefs =
- bSingleLineIf =
- bExplicit = FALSE;
-- bClassModule = FALSE;
-+ bClassModule = ( pm->GetModuleType() == com::sun::star::script::ModuleType::Class );
-+ OSL_TRACE("Parser - %s, bClassModule %d", rtl::OUStringToOString( pm->GetName(), RTL_TEXTENCODING_UTF8 ).getStr(), bClassModule );
- pPool = &aPublics;
- for( short i = 0; i < 26; i++ )
- eDefTypes[ i ] = SbxVARIANT; // Kein expliziter Defaulttyp
-@@ -158,6 +159,10 @@ SbiParser::SbiParser( StarBASIC* pb, SbM
-
- rTypeArray = new SbxArray; // Array fuer Benutzerdefinierte Typen
- rEnumArray = new SbxArray; // Array for Enum types
-+ bVBASupportOn = pm->IsVBACompat();
-+ if ( bVBASupportOn )
-+ EnableCompatibility();
-+
- }
-
-
-@@ -778,8 +783,9 @@ void SbiParser::Option()
-
- case CLASSMODULE:
- bClassModule = TRUE;
-+ aGen.GetModule().SetModuleType( com::sun::star::script::ModuleType::Class );
- break;
-- case VBASUPPORT:
-+ case VBASUPPORT: // Option VBASupport used to override the module mode ( in fact this must reset the mode
- if( Next() == NUMBER )
- {
- if ( nVal == 1 || nVal == 0 )
-@@ -787,6 +793,10 @@ void SbiParser::Option()
- bVBASupportOn = ( nVal == 1 );
- if ( bVBASupportOn )
- EnableCompatibility();
-+ // if the module setting is different
-+ // reset it to what the Option tells us
-+ if ( bVBASupportOn != aGen.GetModule().IsVBACompat() )
-+ aGen.GetModule().SetVBACompat( bVBASupportOn );
- break;
- }
- }
-diff --git basic/source/inc/codegen.hxx basic/source/inc/codegen.hxx
-index ad11d02..a054af7 100644
---- basic/source/inc/codegen.hxx
-+++ basic/source/inc/codegen.hxx
-@@ -56,6 +56,7 @@ public:
- void GenStmnt(); // evtl. Statement-Opcode erzeugen
- UINT32 GetPC();
- UINT32 GetOffset() { return GetPC() + 1; }
-+ SbModule& GetModule() { return rMod; }
- void Save();
-
- // #29955 for-Schleifen-Ebene pflegen
-diff --git basic/source/inc/image.hxx basic/source/inc/image.hxx
-index 8a454cf..c371a85 100644
---- basic/source/inc/image.hxx
-+++ basic/source/inc/image.hxx
-@@ -109,6 +109,5 @@ public:
- #define SBIMG_COMPARETEXT 0x0002 // OPTION COMPARE TEXT ist aktiv
- #define SBIMG_INITCODE 0x0004 // Init-Code vorhanden
- #define SBIMG_CLASSMODULE 0x0008 // OPTION ClassModule is active
--#define SBIMG_VBASUPPORT 0x0020 // OPTION VBASupport is 1
-
- #endif
-diff --git basic/source/inc/namecont.hxx basic/source/inc/namecont.hxx
-index 24778f7..f2760b8 100644
---- basic/source/inc/namecont.hxx
-+++ basic/source/inc/namecont.hxx
-@@ -39,6 +39,7 @@
- #include <com/sun/star/script/XLibraryContainerPassword.hpp>
- #include <com/sun/star/script/XLibraryContainerExport.hpp>
- #include <com/sun/star/script/XLibraryQueryExecutable.hpp>
-+#include <com/sun/star/script/ModuleInfo.hpp>
- #include <com/sun/star/container/XNameContainer.hpp>
- #include <com/sun/star/container/XContainer.hpp>
- #include <com/sun/star/ucb/XSimpleFileAccess.hpp>
-@@ -573,6 +574,8 @@ private:
- protected:
- inline sal_Bool implIsModified() const { return mbIsModified; }
- void implSetModified( sal_Bool _bIsModified );
-+typedef std::hash_map< rtl::OUString, com::sun::star::script::ModuleInfo, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > NameToInfoHash;
-+ NameToInfoHash hBasicInfo;
-
- private:
- /** checks whether the lib is readonly, or a readonly link, throws an IllegalArgumentException if so
-diff --git basic/source/inc/scriptcont.hxx basic/source/inc/scriptcont.hxx
-index 1679b30..9a7bb87 100644
---- basic/source/inc/scriptcont.hxx
-+++ basic/source/inc/scriptcont.hxx
-@@ -33,6 +33,9 @@
-
- #include "namecont.hxx"
- #include <basic/basmgr.hxx>
-+#include <com/sun/star/script/XBasicLibraryInfo.hpp>
-+#include <cppuhelper/implbase1.hxx>
-+#include <comphelper/uno3.hxx>
-
- class BasicManager;
-
-@@ -139,13 +142,17 @@ public:
- };
-
- //============================================================================
-+typedef std::hash_map< rtl::OUString, com::sun::star::script::ModuleInfo, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > NameToInfoHash;
-
-+typedef ::cppu::ImplHelper1 < ::com::sun::star::script::XBasicLibraryInfo > SfxScriptLibrary_BASE;
- class SfxScriptLibrary : public SfxLibrary
-+ , public SfxScriptLibrary_BASE
- {
- friend class SfxScriptLibraryContainer;
-
- sal_Bool mbLoadedSource;
- sal_Bool mbLoadedBinary;
-+ sal_Bool mbVBA;
-
- // Provide modify state including resources
- virtual sal_Bool isModified( void );
-@@ -171,9 +178,36 @@ public:
- const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xSFI,
- const ::rtl::OUString& aLibInfoFileURL, const ::rtl::OUString& aStorageURL, sal_Bool ReadOnly
- );
--
-+ // XNameReplace
-+ virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement )
-+ throw(::com::sun::star::lang::IllegalArgumentException,
-+ ::com::sun::star::container::NoSuchElementException,
-+ ::com::sun::star::lang::WrappedTargetException,
-+ ::com::sun::star::uno::RuntimeException);
-+
-+ // Methods XNameContainer
-+ virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement )
-+ throw(::com::sun::star::lang::IllegalArgumentException,
-+ ::com::sun::star::container::ElementExistException,
-+ ::com::sun::star::lang::WrappedTargetException,
-+ ::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL removeByName( const ::rtl::OUString& Name )
-+ throw(::com::sun::star::container::NoSuchElementException,
-+ ::com::sun::star::lang::WrappedTargetException,
-+ ::com::sun::star::uno::RuntimeException);
- static bool containsValidModule( const ::com::sun::star::uno::Any& _rElement );
-+ DECLARE_XINTERFACE()
-+ DECLARE_XTYPEPROVIDER()
-+
-+ // XBasicLibraryInfo
-+
-+ // Attributes
-+ virtual ::sal_Bool SAL_CALL getVBACompatMode() throw (::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL setVBACompatMode( ::sal_Bool _vbacompatmodeon ) throw (::com::sun::star::uno::RuntimeException);
-
-+ // Methods
-+ virtual ::com::sun::star::script::ModuleInfo SAL_CALL getModuleInfo( const ::rtl::OUString& ModuleName ) throw (::com::sun::star::uno::RuntimeException);
-+
- protected:
- virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const;
- };
-diff --git basic/source/runtime/methods1.cxx basic/source/runtime/methods1.cxx
-index e72f78b..bb24705 100644
---- basic/source/runtime/methods1.cxx
-+++ basic/source/runtime/methods1.cxx
-@@ -44,6 +44,7 @@
- #ifndef _SBX_HXX
- #include <basic/sbx.hxx>
- #endif
-+#include <basic/sbstar.hxx>
- #include <svtools/zforlist.hxx>
- #include <tools/fsys.hxx>
- #include <tools/urlobj.hxx>
-@@ -64,6 +65,7 @@
- #endif
-
- #include <vcl/jobset.hxx>
-+#include <basic/sbobjmod.hxx>
-
- #include "sbintern.hxx"
- #include "runtime.hxx"
-@@ -2594,14 +2596,14 @@ RTLFUNC(Me)
-
- SbModule* pActiveModule = pINST->GetActiveModule();
- SbClassModuleObject* pClassModuleObject = PTR_CAST(SbClassModuleObject,pActiveModule);
-+ SbxVariableRef refVar = rPar.Get(0);
- if( pClassModuleObject == NULL )
- {
-- StarBASIC::Error( SbERR_INVALID_USAGE_OBJECT );
-+ SbObjModule* pMod = PTR_CAST(SbObjModule,pActiveModule);
-+ if ( pMod )
-+ refVar->PutObject( pMod );
- }
- else
-- {
-- SbxVariableRef refVar = rPar.Get(0);
- refVar->PutObject( pClassModuleObject );
-- }
- }
-
-diff --git basic/source/runtime/runtime.cxx basic/source/runtime/runtime.cxx
-index 07f70a6..69c75b3 100644
---- basic/source/runtime/runtime.cxx
-+++ basic/source/runtime/runtime.cxx
-@@ -55,7 +55,8 @@ bool SbiRuntime::isVBAEnabled()
- bool result = false;
- SbiInstance* pInst = pINST;
- if ( pInst && pINST->pRun )
-- result = pInst->pRun->GetImageFlag( SBIMG_VBASUPPORT );
-+ //result = pInst->pRun->GetImageFlag( SBIMG_VBASUPPORT );
-+ result = pInst->pRun->bVBAEnabled;
- return result;
- }
-
-@@ -66,6 +67,24 @@ void StarBASIC::StaticEnableReschedule(
- {
- bStaticGlobalEnableReschedule = bReschedule;
- }
-+void StarBASIC::SetVBAEnabled( BOOL bEnabled )
-+{
-+ if ( bDocBasic )
-+ {
-+ bVBAEnabled = bEnabled;
-+ }
-+}
-+
-+BOOL StarBASIC::isVBAEnabled()
-+{
-+ if ( bDocBasic )
-+ {
-+ if( SbiRuntime::isVBAEnabled() )
-+ return TRUE;
-+ return bVBAEnabled;
-+ }
-+ return FALSE;
-+}
-
-
- struct SbiArgvStack { // Argv stack:
-@@ -522,6 +541,7 @@ SbiRuntime::SbiRuntime( SbModule* pm, Sb
- nForLvl = 0;
- nOps = 0;
- refExprStk = new SbxArray;
-+ SetVBAEnabled( pMod->IsVBACompat() );
- #if defined GCC
- SetParameters( pe ? pe->GetParameters() : (class SbxArray *)NULL );
- #else
-@@ -529,7 +549,6 @@ SbiRuntime::SbiRuntime( SbModule* pm, Sb
- #endif
- pRefSaveList = NULL;
- pItemStoreList = NULL;
-- bVBAEnabled = isVBAEnabled();
- }
-
- SbiRuntime::~SbiRuntime()
-diff --git basic/source/uno/namecont.cxx basic/source/uno/namecont.cxx
-index 7af486f..a777d23 100644
---- basic/source/uno/namecont.cxx
-+++ basic/source/uno/namecont.cxx
-@@ -75,7 +75,8 @@
- #endif
- #include <cppuhelper/exc_hlp.hxx>
- #include <basic/sbmod.hxx>
--
-+#include "sbunoobj.hxx"
-+#include <com/sun/star/script/XBasicLibraryInfo.hpp>
-
- namespace basic
- {
-@@ -1721,10 +1722,17 @@ void SfxLibraryContainer::implImportLibD
- {
- sal_Int32 nElementCount = rLib.aElementNames.getLength();
- const OUString* pElementNames = rLib.aElementNames.getConstArray();
-+ Reference< XNameContainer > xLib( pLib );
-+ Reference< XBasicLibraryInfo > xLibInfo( xLib, UNO_QUERY );
- Any aDummyElement = createEmptyLibraryElement();
- for( sal_Int32 i = 0 ; i < nElementCount ; i++ )
- {
-+ // default the module type
-+ com::sun::star::script::ModuleInfo mInfo;
-+ mInfo.ModuleType = ModuleType::Normal;
-+
- pLib->maNameContainer.insertByName( pElementNames[i], aDummyElement );
-+ pLib->hBasicInfo[ pElementNames[i] ] = mInfo;
- }
- pLib->mbPasswordProtected = rLib.bPasswordProtected;
- pLib->mbReadOnly = rLib.bReadOnly;
-@@ -2069,11 +2077,11 @@ Reference< XNameContainer > SAL_CALL Sfx
- {
- LibraryContainerMethodGuard aGuard( *this );
- SfxLibrary* pNewLib = implCreateLibrary( Name );
-+ Reference< XNameAccess > xNameAccess = static_cast< XNameAccess* >( pNewLib );
- pNewLib->maLibElementFileExtension = maLibElementFileExtension;
-
- createVariableURL( pNewLib->maUnexpandedStorageURL, Name, maInfoFileName, true );
-
-- Reference< XNameAccess > xNameAccess = static_cast< XNameAccess* >( pNewLib );
- Any aElement;
- aElement <<= xNameAccess;
- maNameContainer.insertByName( Name, aElement );
-@@ -2099,6 +2107,7 @@ Reference< XNameAccess > SAL_CALL SfxLib
-
-
- SfxLibrary* pNewLib = implCreateLibraryLink( Name, aLibInfoFileURL, aLibDirURL, ReadOnly );
-+ Reference< XNameAccess > xRet = static_cast< XNameAccess* >( pNewLib );
- pNewLib->maLibElementFileExtension = maLibElementFileExtension;
- pNewLib->maUnexpandedStorageURL = aUnexpandedStorageURL;
-
-@@ -2108,7 +2117,6 @@ Reference< XNameAccess > SAL_CALL SfxLib
- /*sal_Bool bReadIndexFile = */implLoadLibraryIndexFile( pNewLib, aLibDesc, xDummyStor, aInitFileName );
- implImportLibDescriptor( pNewLib, aLibDesc );
-
-- Reference< XNameAccess > xRet = static_cast< XNameAccess* >( pNewLib );
- Any aElement;
- aElement <<= xRet;
- maNameContainer.insertByName( Name, aElement );
-diff --git basic/source/uno/scriptcont.cxx basic/source/uno/scriptcont.cxx
-index f47dc64..e64041a 100644
---- basic/source/uno/scriptcont.cxx
-+++ basic/source/uno/scriptcont.cxx
-@@ -57,7 +57,7 @@
- // For password functionality
- #include <tools/urlobj.hxx>
-
--
-+#include <com/sun/star/script/ModuleSourceInfo.hpp>
- #include <svtools/pathoptions.hxx>
- #include <svtools/sfxecode.hxx>
- #include <svtools/ehdl.hxx>
-@@ -214,6 +214,7 @@ void SAL_CALL SfxScriptLibraryContainer:
- xmlscript::ModuleDescriptor aMod;
- aMod.aName = aElementName;
- aMod.aLanguage = maScriptLanguage;
-+ // make sure we export source
- aElement >>= aMod.aCode;
- xmlscript::exportScriptModule( xHandler, aMod );
- }
-@@ -1120,6 +1121,7 @@ SfxScriptLibrary::SfxScriptLibrary( Modi
- : SfxLibrary( _rModifiable, getCppuType( (const OUString *)0 ), xMSF, xSFI )
- , mbLoadedSource( sal_False )
- , mbLoadedBinary( sal_False )
-+ , mbVBA( sal_False )
- {
- }
-
-@@ -1133,9 +1135,86 @@ SfxScriptLibrary::SfxScriptLibrary( Modi
- aLibInfoFileURL, aStorageURL, ReadOnly)
- , mbLoadedSource( sal_False )
- , mbLoadedBinary( sal_False )
-+ , mbVBA( sal_False )
-+{
-+}
-+
-+IMPLEMENT_FORWARD_XINTERFACE2( SfxScriptLibrary, SfxLibrary, SfxScriptLibrary_BASE );
-+IMPLEMENT_FORWARD_XTYPEPROVIDER2( SfxScriptLibrary, SfxLibrary, SfxScriptLibrary_BASE );
-+
-+::sal_Bool SAL_CALL
-+SfxScriptLibrary::getVBACompatMode() throw (RuntimeException)
-+{
-+ return mbVBA;
-+}
-+
-+void SAL_CALL
-+SfxScriptLibrary::setVBACompatMode( ::sal_Bool _vbacompatmodeon ) throw (RuntimeException)
-+{
-+ mbVBA = _vbacompatmodeon;
-+}
-+
-+// Methods
-+::com::sun::star::script::ModuleInfo SAL_CALL
-+SfxScriptLibrary::getModuleInfo( const ::rtl::OUString& ModuleName ) throw (RuntimeException)
-+{
-+ ::com::sun::star::script::ModuleInfo mInfo;
-+ NameToInfoHash::iterator it_end = hBasicInfo.end();
-+ NameToInfoHash::iterator it = hBasicInfo.find( ModuleName );
-+ if ( it != it_end )
-+ mInfo = it->second;
-+
-+ return mInfo;
-+}
-+
-+void SAL_CALL
-+SfxScriptLibrary::replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement )
-+ throw(::com::sun::star::lang::IllegalArgumentException,
-+ ::com::sun::star::container::NoSuchElementException,
-+ ::com::sun::star::lang::WrappedTargetException,
-+ ::com::sun::star::uno::RuntimeException)
- {
-+ SfxLibrary::replaceByName( aName, aElement );
- }
-
-+// Methods XNameContainer
-+void SAL_CALL
-+SfxScriptLibrary::insertByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement )
-+ throw(::com::sun::star::lang::IllegalArgumentException,
-+ ::com::sun::star::container::ElementExistException,
-+ ::com::sun::star::lang::WrappedTargetException,
-+ ::com::sun::star::uno::RuntimeException)
-+{
-+ OSL_TRACE("***** insertByName module %s", rtl::OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+
-+ NameToInfoHash::iterator it_end = hBasicInfo.end();
-+ NameToInfoHash::iterator it = hBasicInfo.find( aName );
-+
-+ if ( it != it_end )
-+ throw ElementExistException(); // more detail please
-+
-+ ModuleSourceInfo mInfo;
-+ if ( aElement >>= mInfo )
-+ {
-+ hBasicInfo[ aName ] = mInfo;
-+ uno::Any aTmpElement( mInfo.ModuleSource );
-+ SfxLibrary::insertByName( aName, aTmpElement );
-+ }
-+ else
-+ SfxLibrary::insertByName( aName, aElement );
-+}
-+
-+void SAL_CALL
-+SfxScriptLibrary::removeByName( const ::rtl::OUString& Name )
-+ throw(::com::sun::star::container::NoSuchElementException,
-+ ::com::sun::star::lang::WrappedTargetException,
-+ ::com::sun::star::uno::RuntimeException)
-+{
-+ SfxLibrary::removeByName( Name );
-+}
-+
-+
-+
- // Provide modify state including resources
- sal_Bool SfxScriptLibrary::isModified( void )
- {
-diff --git offapi/com/sun/star/script/XBasicLibraryInfo.idl offapi/com/sun/star/script/XBasicLibraryInfo.idl
-new file mode 100644
-index 0000000..0086a1b
---- /dev/null
-+++ offapi/com/sun/star/script/XBasicLibraryInfo.idl
-@@ -0,0 +1,19 @@
-+#ifndef __com_sun_star_script_XBasicLibraryInfo_idl__
-+#define __com_sun_star_script_XBasicLibraryInfo_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+#include <com/sun/star/script/ModuleInfo.idl>
-+#endif
-+module com { module sun { module star { module script {
-+
-+interface XBasicLibraryInfo: com::sun::star::uno::XInterface
-+{
-+
-+//=============================================================================
-+ [attribute ] boolean VBACompatMode;
-+ ModuleInfo getModuleInfo( [in] string ModuleName );
-+
-+}; }; }; };
-+};
-diff --git sc/inc/servuno.hxx sc/inc/servuno.hxx
-index a0e7f94..11bbabc 100644
---- sc/inc/servuno.hxx
-+++ sc/inc/servuno.hxx
-@@ -93,8 +93,8 @@ class ScDocShell;
-
- #define SC_SERVICE_FORMULAPARS 38
- #define SC_SERVICE_OPCODEMAPPER 39
--
--#define SC_SERVICE_COUNT 40
-+#define SC_SERVICE_VBAOBJECTPROVIDER 40
-+#define SC_SERVICE_COUNT 41
- #define SC_SERVICE_INVALID USHRT_MAX
-
-
-diff --git sc/source/filter/excel/excimp8.cxx sc/source/filter/excel/excimp8.cxx
-index 0df678a..aff8877 100644
---- sc/source/filter/excel/excimp8.cxx
-+++ sc/source/filter/excel/excimp8.cxx
-@@ -103,6 +103,7 @@
-
- #include <com/sun/star/document/XDocumentProperties.hpp>
- #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
-+#include <com/sun/star/script/ModuleInfo.hpp>
-
-
- using namespace com::sun::star;
-@@ -110,8 +111,8 @@ using namespace com::sun::star;
-
- #define INVALID_POS 0xFFFFFFFF
-
--
--
-+// defined in docfunc.cxx ( really this needs a new name )
-+script::ModuleInfo lcl_InitModuleInfo( SfxObjectShell& rDocSh, String& sModule );
-
- ImportExcel8::ImportExcel8( XclImpRootData& rImpData, SvStream& rStrm ) :
- ImportExcel( rImpData, rStrm ), mnTab(0)
-@@ -273,6 +274,7 @@ bool lcl_hasVBAEnabled()
-
- void ImportExcel8::ReadBasic( void )
- {
-+ //bHasBasic = TRUE;
- bHasBasic = TRUE;
-
- SfxObjectShell* pShell = GetDocShell();
-@@ -302,6 +304,10 @@ void ImportExcel8::EndSheet( void )
-
- void ImportExcel8::PostDocLoad( void )
- {
-+ // delay reading basic until sheet object ( codenames etc. ) are read
-+
-+ if ( bHasBasic )
-+ ReadBasic();
- // #i11776# filtered ranges before outlines and hidden rows
- if( pExcRoot->pAutoFilterBuffer )
- pExcRoot->pAutoFilterBuffer->Apply();
-diff --git sc/source/filter/excel/read.cxx sc/source/filter/excel/read.cxx
-index 0fef232..a868e17 100644
---- sc/source/filter/excel/read.cxx
-+++ sc/source/filter/excel/read.cxx
-@@ -947,7 +947,8 @@ FltError ImportExcel8::Read( void )
- case 0x22: Rec1904(); break; // 1904 [ 2345 ]
- case 0x56: Builtinfmtcnt(); break; // BUILTINFMTCNT[ 34 ]
- case 0x8D: Hideobj(); break; // HIDEOBJ [ 345 ]
-- case 0xD3: ReadBasic(); break;
-+ case 0xD3: /*ReadBasic()*/bHasBasic = true; break;
-+// case 0xD3: ReadBasic(); break;
- case 0xDE: Olesize(); break;
- case 0x01BA: Codename( TRUE ); break;
-
-diff --git sc/source/filter/excel/xiescher.cxx sc/source/filter/excel/xiescher.cxx
-index 9c687ed..c8339df 100644
---- sc/source/filter/excel/xiescher.cxx
-+++ sc/source/filter/excel/xiescher.cxx
-@@ -834,7 +834,7 @@ bool XclImpTbxControlObj::FillMacroDescr
- {
- // set the macro name
- rEvent.ScriptType = XclControlObjHelper::GetTbxScriptType();
-- rEvent.ScriptCode = XclControlObjHelper::GetScMacroName( GetMacroName() );
-+ rEvent.ScriptCode = XclControlObjHelper::GetScMacroName( GetMacroName(), GetDocShell() );
- return true;
- }
- }
-@@ -1728,7 +1728,7 @@ SdrObject* XclImpDffManager::ProcessObj(
- if( ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( xSdrObj.get(), TRUE ) )
- {
- if ( rMacro.Len() > 0 )
-- pInfo->SetMacro( XclControlObjHelper::GetScMacroName( rMacro ) );
-+ pInfo->SetMacro( XclControlObjHelper::GetScMacroName( rMacro, GetDocShell() ) );
- if ( aHlink.getLength() > 0 )
- pInfo->SetHlink( aHlink );
- }
-diff --git sc/source/filter/excel/xlescher.cxx sc/source/filter/excel/xlescher.cxx
-index 8e8e694..693a323 100644
---- sc/source/filter/excel/xlescher.cxx
-+++ sc/source/filter/excel/xlescher.cxx
-@@ -37,7 +37,10 @@
- #include "xistream.hxx"
- #include "xestream.hxx"
- #include "globstr.hrc"
--
-+#include <sfx2/objsh.hxx>
-+#include <basic/sbstar.hxx>
-+#include <basic/sbmod.hxx>
-+#include <basic/sbmeth.hxx>
- using ::rtl::OUString;
- using ::com::sun::star::uno::Reference;
- using ::com::sun::star::uno::UNO_QUERY;
-@@ -405,9 +408,16 @@ OUString XclControlObjHelper::GetTbxScri
- #define EXC_TBX_MACRONAME_PRE "vnd.sun.star.script:Standard."
- #define EXC_TBX_MACRONAME_SUF "?language=Basic&location=document"
-
--OUString XclControlObjHelper::GetScMacroName( const String& rXclMacroName )
-+OUString XclControlObjHelper::GetScMacroName( const String& rXclMacroName, SfxObjectShell* pDocShell )
- {
-- return CREATE_OUSTRING( EXC_TBX_MACRONAME_PRE ) + rXclMacroName + CREATE_OUSTRING( EXC_TBX_MACRONAME_SUF );
-+ String sTmp( rXclMacroName );
-+ if ( ( sTmp.Search( '.' ) == STRING_NOTFOUND) && pDocShell )
-+ if( StarBASIC* pBasic = pDocShell->GetBasic() )
-+ if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pBasic->Find( sTmp, SbxCLASS_METHOD ) ) )
-+ if( SbModule* pModule = pMethod->GetModule() )
-+ sTmp.Insert( '.', 0 ).Insert( pModule->GetName(), 0 );
-+
-+ return CREATE_OUSTRING( EXC_TBX_MACRONAME_PRE ) + sTmp + CREATE_OUSTRING( EXC_TBX_MACRONAME_SUF );
- }
-
- String XclControlObjHelper::GetXclMacroName( const OUString& rScMacroName )
-diff --git sc/source/filter/inc/xlescher.hxx sc/source/filter/inc/xlescher.hxx
-index e28b1c4..9263024 100644
---- sc/source/filter/inc/xlescher.hxx
-+++ sc/source/filter/inc/xlescher.hxx
-@@ -278,7 +278,7 @@ public:
- static ::rtl::OUString GetTbxScriptType();
-
- /** Returns the Calc macro name from an Excel macro name. */
-- static ::rtl::OUString GetScMacroName( const String& rXclMacroName );
-+ static ::rtl::OUString GetScMacroName( const String& rXclMacroName, SfxObjectShell* pShell = NULL );
- /** Returns the Excel macro name from a Calc macro name. */
- static String GetXclMacroName( const ::rtl::OUString& rScMacroName );
- };
-diff --git sc/source/ui/docshell/docfunc.cxx sc/source/ui/docshell/docfunc.cxx
-index d178786..dcedaf3 100644
---- sc/source/ui/docshell/docfunc.cxx
-+++ sc/source/ui/docshell/docfunc.cxx
-@@ -51,6 +51,12 @@
- #include <svtools/zforlist.hxx>
- #include <svtools/PasswordHelper.hxx>
-
-+#include <basic/sbstar.hxx>
-+#include <com/sun/star/container/XNameContainer.hpp>
-+#include <com/sun/star/script/XLibraryContainer.hpp>
-+#include <com/sun/star/script/ModuleSourceInfo.hpp>
-+#include <com/sun/star/script/ModuleType.hpp>
-+
- #include <list>
-
- #include "docfunc.hxx"
-@@ -99,6 +105,7 @@
- using namespace com::sun::star;
- using ::com::sun::star::uno::Sequence;
-
-+
- // STATIC DATA -----------------------------------------------------------
-
- //========================================================================
-@@ -2021,6 +2028,92 @@ BOOL ScDocFunc::MoveBlock( const ScRange
- }
-
- //------------------------------------------------------------------------
-+uno::Reference< uno::XInterface > GetDocModuleObject( SfxObjectShell& rDocSh, String& sCodeName )
-+{
-+ uno::Reference< lang::XMultiServiceFactory> xSF(rDocSh.GetModel(), uno::UNO_QUERY);
-+ uno::Reference< container::XNameAccess > xVBACodeNamedObjectAccess;
-+ uno::Reference< uno::XInterface > xDocModuleApiObject;
-+ if ( xSF.is() )
-+ {
-+ xVBACodeNamedObjectAccess.set( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.vba.VBAObjectModuleObjectProvider"))), uno::UNO_QUERY );
-+ xDocModuleApiObject.set( xVBACodeNamedObjectAccess->getByName( sCodeName ), uno::UNO_QUERY );
-+ }
-+ return xDocModuleApiObject;
-+
-+}
-+
-+script::ModuleSourceInfo lcl_InitModuleInfo( SfxObjectShell& rDocSh, String& sModule, String& sSource )
-+{
-+ ::rtl::OUString aModName( sModule );
-+ ::rtl::OUString sVbaOption( RTL_CONSTASCII_USTRINGPARAM( "Rem Attribute VBA_ModuleType=VBADocumentModule\nOption VBASupport 1\n" ));
-+ script::ModuleSourceInfo sModuleInfo;
-+ sModuleInfo.ModuleName = aModName;
-+ if ( sSource.Len() > 0 )
-+ sModuleInfo.ModuleSource = sSource;
-+ else
-+ sModuleInfo.ModuleSource = sVbaOption;
-+ sModuleInfo.ModuleType = script::ModuleType::Document;
-+ sModuleInfo.ModuleObject = GetDocModuleObject( rDocSh, sModule );
-+ return sModuleInfo;
-+}
-+
-+void lcl_InsertModule( ScDocShell& rDocSh, SCTAB nTab, String& sModuleName, String& sSource )
-+{
-+ SFX_APP()->EnterBasicCall();
-+ script::ModuleSourceInfo sModuleInfo = lcl_InitModuleInfo( rDocSh, sModuleName, sSource );
-+ uno::Reference< script::XLibraryContainer > xLibContainer = rDocSh.GetBasicContainer();
-+ DBG_ASSERT( xLibContainer.is(), "No BasicContainer!" );
-+
-+ uno::Reference< container::XNameContainer > xLib;
-+ if( xLibContainer.is() )
-+ {
-+ String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
-+ uno::Any aLibAny = xLibContainer->getByName( aLibName );
-+ aLibAny >>= xLib;
-+ }
-+ if( xLib.is() )
-+ {
-+ // if the Module with codename exists then find a new name
-+ sal_Int32 nNum = 1;
-+ sModuleInfo.ModuleName = sModuleName;
-+ while( xLib->hasByName( sModuleInfo.ModuleName ) )
-+ {
-+ sModuleInfo.ModuleName = rtl::OUString::createFromAscii( "Sheet" ) + rtl::OUString::valueOf( nNum );
-+ nNum += 1;
-+ }
-+ uno::Any aSourceAny;
-+ aSourceAny <<= sModuleInfo;
-+ xLib->insertByName( sModuleInfo.ModuleName, aSourceAny );
-+ ScDocument* pDoc = rDocSh.GetDocument();
-+ String sCodeName( sModuleInfo.ModuleName );
-+ pDoc->SetCodeName( nTab, sCodeName );
-+ }
-+ SFX_APP()->LeaveBasicCall();
-+}
-+
-+void lcl_DeleteModule( ScDocShell& rDocSh, String& sModuleName )
-+{
-+ SFX_APP()->EnterBasicCall();
-+ uno::Reference< script::XLibraryContainer > xLibContainer = rDocSh.GetBasicContainer();
-+ DBG_ASSERT( xLibContainer.is(), "No BasicContainer!" );
-+
-+ uno::Reference< container::XNameContainer > xLib;
-+ if( xLibContainer.is() )
-+ {
-+ String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
-+ uno::Any aLibAny = xLibContainer->getByName( aLibName );
-+ aLibAny >>= xLib;
-+ }
-+ if( xLib.is() )
-+ {
-+ if( xLib->hasByName( sModuleName ) )
-+ {
-+ xLib->removeByName( sModuleName );
-+ }
-+ }
-+ SFX_APP()->LeaveBasicCall();
-+}
-+
-
- BOOL ScDocFunc::InsertTable( SCTAB nTab, const String& rName, BOOL bRecord, BOOL bApi )
- {
-@@ -2030,8 +2123,18 @@ BOOL ScDocFunc::InsertTable( SCTAB nTab,
- ScDocShellModificator aModificator( rDocShell );
-
- ScDocument* pDoc = rDocShell.GetDocument();
-- if (bRecord && !pDoc->IsUndoEnabled())
-+ // Strange loop, also basic is loaded too early ( InsertTable )
-+ // is called via the xml import for sheets in described in odf
-+ BOOL bInsertDocModule = false;
-+
-+ if( !rDocShell.GetDocument()->IsImportingXML() )
-+ {
-+ StarBASIC* pStarBASIC = rDocShell.GetBasic();
-+ bInsertDocModule = pStarBASIC ? pStarBASIC->isVBAEnabled() : false;
-+ }
-+ if ( bInsertDocModule || ( bRecord && !pDoc->IsUndoEnabled() ) )
- bRecord = FALSE;
-+
- if (bRecord)
- pDoc->BeginDrawUndo(); // InsertTab erzeugt ein SdrUndoNewPage
-
-@@ -2042,10 +2145,19 @@ BOOL ScDocFunc::InsertTable( SCTAB nTab,
-
- if (pDoc->InsertTab( nTab, rName ))
- {
-+ String sCodeName;
- if (bRecord)
- rDocShell.GetUndoManager()->AddUndoAction(
- new ScUndoInsertTab( &rDocShell, nTab, bAppend, rName));
- // Views updaten:
-+ // Only insert vba modules if vba mode ( and not currently importing XML )
-+ if( bInsertDocModule )
-+ {
-+ if ( sCodeName.Len() == 0 )
-+ sCodeName = rName;
-+ String sSource;
-+ lcl_InsertModule( rDocShell, nTab, sCodeName, sSource );
-+ }
- rDocShell.Broadcast( ScTablesHint( SC_TAB_INSERTED, nTab ) );
-
- rDocShell.PostPaintExtras();
-@@ -2067,8 +2179,12 @@ BOOL ScDocFunc::DeleteTable( SCTAB nTab,
-
- BOOL bSuccess = FALSE;
- ScDocument* pDoc = rDocShell.GetDocument();
-+ StarBASIC* pStarBASIC = rDocShell.GetBasic();
-+ BOOL bVbaEnabled = pStarBASIC->isVBAEnabled();
- if (bRecord && !pDoc->IsUndoEnabled())
- bRecord = FALSE;
-+ if ( bVbaEnabled )
-+ bRecord = FALSE;
- BOOL bWasLinked = pDoc->IsLinked(nTab);
- ScDocument* pUndoDoc = NULL;
- ScRefUndoData* pUndoData = NULL;
-@@ -2109,6 +2225,8 @@ BOOL ScDocFunc::DeleteTable( SCTAB nTab,
- pUndoData = new ScRefUndoData( pDoc );
- }
-
-+ String sCodeName;
-+ BOOL bHasCodeName = pDoc->GetCodeName( nTab, sCodeName );
- if (pDoc->DeleteTab( nTab, pUndoDoc ))
- {
- if (bRecord)
-@@ -2119,6 +2237,13 @@ BOOL ScDocFunc::DeleteTable( SCTAB nTab,
- new ScUndoDeleteTab( &rDocShell, theTabs, pUndoDoc, pUndoData ));
- }
- // Views updaten:
-+ if( bVbaEnabled )
-+ {
-+ if( bHasCodeName )
-+ {
-+ lcl_DeleteModule( rDocShell, sCodeName );
-+ }
-+ }
- rDocShell.Broadcast( ScTablesHint( SC_TAB_DELETED, nTab ) );
-
- if (bWasLinked)
-diff --git sc/source/ui/docshell/docsh5.cxx sc/source/ui/docshell/docsh5.cxx
-index bbfe6e3..6623a4b 100644
---- sc/source/ui/docshell/docsh5.cxx
-+++ sc/source/ui/docshell/docsh5.cxx
-@@ -68,6 +68,11 @@
- #include "sc.hrc"
- #include "waitoff.hxx"
- #include "sizedev.hxx"
-+#include <basic/sbstar.hxx>
-+#include <com/sun/star/script/ModuleSourceInfo.hpp>
-+
-+// defined in docfunc.cxx
-+void lcl_InsertModule( ScDocShell& rDocSh, SCTAB nTab, String& sModuleName, String& sModuleSource );
-
- // ---------------------------------------------------------------------------
-
-@@ -834,6 +839,33 @@ BOOL ScDocShell::MoveTable( SCTAB nSrcTa
- GetUndoManager()->AddUndoAction(
- new ScUndoCopyTab( this, aSrcList, aDestList ) );
- }
-+
-+ StarBASIC* pStarBASIC = GetBasic();
-+ BOOL bVbaEnabled = pStarBASIC ? pStarBASIC->isVBAEnabled() : FALSE;
-+ if ( bVbaEnabled )
-+ {
-+ String sCodeName;
-+ String sSource;
-+ aDocument.GetCodeName( nDestTab, sCodeName );
-+ com::sun::star::uno::Reference< com::sun::star::script::XLibraryContainer > xLibContainer = GetBasicContainer();
-+ com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > xLib;
-+ if( xLibContainer.is() )
-+ {
-+ String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
-+ com::sun::star::uno::Any aLibAny = xLibContainer->getByName( aLibName );
-+ aLibAny >>= xLib;
-+ }
-+ if( xLib.is() )
-+ {
-+ String sSrcCodeName;
-+ aDocument.GetCodeName( nSrcTab, sSrcCodeName );
-+ rtl::OUString sModName = sSrcCodeName;
-+ com::sun::star::script::ModuleSourceInfo sModuleInfo;
-+ xLib->getByName( sModName ) >>= sModuleInfo;
-+ sSource = sModuleInfo.ModuleSource;
-+ }
-+ lcl_InsertModule( *this, nDestTab, sCodeName, sSource );
-+ }
- }
-
- Broadcast( ScTablesHint( SC_TAB_COPIED, nSrcTab, nDestTab ) );
-diff --git sc/source/ui/unoobj/servuno.cxx sc/source/ui/unoobj/servuno.cxx
-index bff687b..013c716 100644
---- sc/source/ui/unoobj/servuno.cxx
-+++ sc/source/ui/unoobj/servuno.cxx
-@@ -38,6 +38,7 @@
- #include <svx/unofill.hxx>
- #include <svx/unonrule.hxx>
- #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
-+#include <com/sun/star/container/XNameAccess.hpp>
-
- #include "servuno.hxx"
- #include "unonames.hxx"
-@@ -61,8 +62,103 @@
- #include <svx/xmleohlp.hxx>
- #include <svx/xmlgrhlp.hxx>
-
-+#include <comphelper/processfactory.hxx>
-+
- using namespace ::com::sun::star;
-
-+class ScVbaObjectForCodeNameProvider : public ::cppu::WeakImplHelper1< container::XNameAccess >
-+{
-+ uno::Any maWorkbook;
-+ uno::Any maCachedObject;
-+ uno::Reference<lang::XMultiServiceFactory> mxSF;
-+ ScDocShell* mpDocShell;
-+public:
-+ ScVbaObjectForCodeNameProvider( ScDocShell* pDocShell ) : mpDocShell( pDocShell )
-+ {
-+ mxSF.set(comphelper::getProcessServiceFactory());
-+ uno::Reference<beans::XPropertySet> xProps(mxSF, uno::UNO_QUERY);
-+ if( xProps.is() )
-+ {
-+ ScDocument* pDoc = mpDocShell->GetDocument();
-+ if ( !pDoc )
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("")), uno::Reference< uno::XInterface >() );
-+
-+ uno::Sequence< uno::Any > aArgs(2);
-+ aArgs[0] = uno::Any( uno::Reference< uno::XInterface >() );
-+ aArgs[1] = uno::Any( mpDocShell->GetModel() );
-+ maWorkbook <<= mxSF->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Workbook") ), aArgs );
-+ }
-+ }
-+
-+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException )
-+ {
-+ maCachedObject = uno::Any(); // clear cached object
-+ String sName = aName;
-+ ScDocument* pDoc = mpDocShell->GetDocument();
-+ if ( !pDoc )
-+ throw uno::RuntimeException();
-+ if ( sName == pDoc->GetCodeName() )
-+ maCachedObject = maWorkbook;
-+ else
-+ {
-+ String sCodeName;
-+ SCTAB nCount = pDoc->GetTableCount();
-+ for( SCTAB i = 0; i < nCount; i++ )
-+ {
-+ pDoc->GetCodeName( i, sCodeName );
-+ if( sCodeName == sName )
-+ {
-+ String sSheetName;
-+ if( pDoc->GetName( i, sSheetName ) )
-+ {
-+ uno::Reference< frame::XModel > xModel( mpDocShell->GetModel() );
-+ uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( xModel, uno::UNO_QUERY_THROW );
-+ uno::Reference<sheet::XSpreadsheets > xSheets( xSpreadDoc->getSheets(), uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xIndexAccess( xSheets, uno::UNO_QUERY_THROW );
-+ uno::Reference< sheet::XSpreadsheet > xSheet( xIndexAccess->getByIndex( i ), uno::UNO_QUERY_THROW );
-+ uno::Sequence< uno::Any > aArgs(3);
-+ aArgs[0] = maWorkbook;
-+ aArgs[1] = uno::Any( xModel );
-+ aArgs[2] = uno::Any( rtl::OUString( sSheetName ) );
-+ maCachedObject <<= mxSF->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.Worksheet") ), aArgs );
-+ break;
-+ }
-+ }
-+ }
-+ }
-+ return maCachedObject.hasValue();
-+
-+ }
-+ ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
-+ {
-+ OSL_TRACE("ScVbaObjectForCodeNameProvider::getByName( %s )",
-+ rtl::OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ if ( !hasByName( aName ) )
-+ throw ::com::sun::star::container::NoSuchElementException();
-+ return maCachedObject;
-+ }
-+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (::com::sun::star::uno::RuntimeException)
-+ {
-+ ScDocument* pDoc = mpDocShell->GetDocument();
-+ if ( !pDoc )
-+ throw uno::RuntimeException();
-+ SCTAB nCount = pDoc->GetTableCount();
-+ uno::Sequence< rtl::OUString > aNames( nCount + 1 );
-+ SCTAB index = 0;
-+ String sCodeName;
-+ for( ; index < nCount; ++index )
-+ {
-+ pDoc->GetCodeName( index, sCodeName );
-+ aNames[ index ] = sCodeName;
-+ }
-+ aNames[ index ] = pDoc->GetCodeName();
-+ return aNames;
-+ }
-+ // XElemenAccess
-+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException){ return uno::Type(); }
-+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException ) { return sal_True; }
-+
-+};
-
- //------------------------------------------------------------------------
-
-@@ -112,7 +208,8 @@ static const sal_Char* __FAR_DATA aProvN
-
- SC_SERVICENAME_CHDATAPROV, // SC_SERVICE_CHDATAPROV
- SC_SERVICENAME_FORMULAPARS, // SC_SERVICE_FORMULAPARS
-- SC_SERVICENAME_OPCODEMAPPER // SC_SERVICE_OPCODEMAPPER
-+ SC_SERVICENAME_OPCODEMAPPER, // SC_SERVICE_OPCODEMAPPER
-+"org.openoffice.vba.VBAObjectModuleObjectProvider",// SC_SERVICE_VBAOBJECTPROVIDER
- };
-
- //
-@@ -164,7 +261,8 @@ static const sal_Char* __FAR_DATA aOldNa
- "", // SC_SERVICE_SHEETDOCSET
- "", // SC_SERVICE_CHDATAPROV
- "", // SC_SERVICE_FORMULAPARS
-- "" // SC_SERVICE_OPCODEMAPPER
-+ "", // SC_SERVICE_OPCODEMAPPER
-+ "", // SC_SERVICE_VBAOBJECTPROVIDER
- };
-
-
-@@ -350,6 +448,9 @@ uno::Reference<uno::XInterface> ScServic
- case SC_SERVICE_OPCODEMAPPER:
- xRet.set(static_cast<sheet::XFormulaOpCodeMapper*>(new ScFormulaOpCodeMapperObj));
- break;
-+ case SC_SERVICE_VBAOBJECTPROVIDER:
-+ xRet.set(static_cast<container::XNameAccess*>(new ScVbaObjectForCodeNameProvider( pDocShell )));
-+ break;
- }
- return xRet;
- }
-diff --git sc/source/ui/view/viewfun2.cxx sc/source/ui/view/viewfun2.cxx
-index 1ff1ec6..eace21b 100644
---- sc/source/ui/view/viewfun2.cxx
-+++ sc/source/ui/view/viewfun2.cxx
-@@ -57,6 +57,11 @@
- #include <vcl/sound.hxx>
- #include <vcl/waitobj.hxx>
-
-+#include <basic/sbstar.hxx>
-+#include <com/sun/star/container/XNameContainer.hpp>
-+#include <com/sun/star/script/XLibraryContainer.hpp>
-+using namespace com::sun::star;
-+
- #include "viewfunc.hxx"
-
- #include "sc.hrc"
-@@ -2062,15 +2067,42 @@ BOOL ScViewFunc::DeleteTable( SCTAB nTab
- return bSuccess;
- }
-
-+void lcl_DeleteModule( ScDocShell* rDocSh, String& sModuleName )
-+{
-+ SFX_APP()->EnterBasicCall();
-+ uno::Reference< script::XLibraryContainer > xLibContainer = rDocSh->GetBasicContainer();
-+ DBG_ASSERT( xLibContainer.is(), "No BasicContainer!" );
-+
-+ uno::Reference< container::XNameContainer > xLib;
-+ if( xLibContainer.is() )
-+ {
-+ String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
-+ uno::Any aLibAny = xLibContainer->getByName( aLibName );
-+ aLibAny >>= xLib;
-+ }
-+ if( xLib.is() )
-+ {
-+ if( xLib->hasByName( sModuleName ) )
-+ {
-+ xLib->removeByName( sModuleName );
-+ }
-+ }
-+ SFX_APP()->LeaveBasicCall();
-+}
-+
- BOOL ScViewFunc::DeleteTables(const SvShorts &TheTabs, BOOL bRecord )
- {
- ScDocShell* pDocSh = GetViewData()->GetDocShell();
- ScDocument* pDoc = pDocSh->GetDocument();
-+ StarBASIC* pStarBASIC = pDocSh->GetBasic();
-+ BOOL bVbaEnabled = pStarBASIC->isVBAEnabled();
- SCTAB nNewTab = TheTabs[0];
- int i;
- WaitObject aWait( GetFrameWin() );
- if (bRecord && !pDoc->IsUndoEnabled())
- bRecord = FALSE;
-+ if ( bVbaEnabled )
-+ bRecord = FALSE;
-
- while ( nNewTab > 0 && !pDoc->IsVisible( nNewTab ) )
- --nNewTab;
-@@ -2137,9 +2169,18 @@ BOOL ScViewFunc::DeleteTables(const SvSh
-
- for(i=TheTabs.Count()-1;i>=0;i--)
- {
-+ String sCodeName;
-+ BOOL bHasCodeName = pDoc->GetCodeName( TheTabs[sal::static_int_cast<USHORT>(i)], sCodeName );
- if (pDoc->DeleteTab( TheTabs[sal::static_int_cast<USHORT>(i)], pUndoDoc ))
- {
- bDelDone = TRUE;
-+ if( bVbaEnabled )
-+ {
-+ if( bHasCodeName )
-+ {
-+ lcl_DeleteModule( pDocSh, sCodeName );
-+ }
-+ }
- pDocSh->Broadcast( ScTablesHint( SC_TAB_DELETED, TheTabs[sal::static_int_cast<USHORT>(i)] ) );
- }
- }
-@@ -2167,6 +2208,7 @@ BOOL ScViewFunc::DeleteTables(const SvSh
- pDocSh->PostPaintExtras();
- pDocSh->SetDocumentModified();
-
-+
- SfxApplication* pSfxApp = SFX_APP(); // Navigator
- pSfxApp->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) );
- pSfxApp->Broadcast( SfxSimpleHint( SC_HINT_DBAREAS_CHANGED ) );
-diff --git svx/source/msfilter/msvbasic.cxx svx/source/msfilter/msvbasic.cxx
-index 2e4f500..2eff354 100644
---- svx/source/msfilter/msvbasic.cxx
-+++ svx/source/msfilter/msvbasic.cxx
-@@ -41,6 +41,8 @@
- #include <rtl/tencinfo.h> //rtl_getTextEncodingFromWindowsCodePage
- #include "msvbasic.hxx"
-
-+using namespace ::com::sun::star::script;
-+
- /*
- A few urls which may in the future be of some use
- http://www.virusbtn.com/vb2000/Programme/papers/bontchev.pdf
-@@ -432,7 +434,7 @@ int VBA_Impl::ReadVBAProject(const SvSto
- *
- */
-
--ModuleType VBA_Impl::GetModuleType( const UniString& rModuleName )
-+ModType VBA_Impl::GetModuleType( const UniString& rModuleName )
- {
- ModuleTypeHash::iterator iter = mhModHash.find( rModuleName );
- ModuleTypeHash::iterator iterEnd = mhModHash.end();
-@@ -440,7 +442,7 @@ ModuleType VBA_Impl::GetModuleType( cons
- {
- return iter->second;
- }
-- return Unknown;
-+ return ModuleType::Unknown;
- }
-
- bool VBA_Impl::Open( const String &rToplevel, const String &rSublevel )
-@@ -483,7 +485,7 @@ bool VBA_Impl::Open( const String &rTopl
- static const String sClass( RTL_CONSTASCII_USTRINGPARAM( "Class" ) );
- static const String sBaseClass( RTL_CONSTASCII_USTRINGPARAM( "BaseClass" ) );
- static const String sDocument( RTL_CONSTASCII_USTRINGPARAM( "Document" ) );
-- mhModHash[ sThisDoc ] = Class;
-+ mhModHash[ sThisDoc ] = ModuleType::Class;
- while ( pStp->ReadByteStringLine( tmp, meCharSet ) )
- {
- xub_StrLen index = tmp.Search( '=' );
-@@ -493,14 +495,14 @@ bool VBA_Impl::Open( const String &rTopl
- String value = tmp.Copy( index + 1 );
- if ( key == sClass )
- {
-- mhModHash[ value ] = Class;
-+ mhModHash[ value ] = ModuleType::Class;
- OSL_TRACE("Module %s is of type Class",
- ::rtl::OUStringToOString( value ,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- }
- else if ( key == sBaseClass )
- {
-- mhModHash[ value ] = Form;
-+ mhModHash[ value ] = ModuleType::Form;
- OSL_TRACE("Module %s is of type Form",
- ::rtl::OUStringToOString( value ,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-@@ -513,14 +515,14 @@ bool VBA_Impl::Open( const String &rTopl
- // value is of form <name>/&H<identifier>, strip the identifier
- value.Erase( value.Search( '/' ) );
-
-- mhModHash[ value ] = Document;
-+ mhModHash[ value ] = ModuleType::Document;
- OSL_TRACE("Module %s is of type Document VBA",
- ::rtl::OUStringToOString( value ,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- }
- else if ( key == sModule )
- {
-- mhModHash[ value ] = Normal;
-+ mhModHash[ value ] = ModuleType::Normal;
- OSL_TRACE("Module %s is of type Normal VBA",
- ::rtl::OUStringToOString( value ,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-diff --git svx/source/msfilter/msvbasic.hxx svx/source/msfilter/msvbasic.hxx
-index 8492062..a0536ae 100644
---- svx/source/msfilter/msvbasic.hxx
-+++ svx/source/msfilter/msvbasic.hxx
-@@ -45,6 +45,8 @@
- #include <vector>
- #endif
- #include<map>
-+#include <com/sun/star/script/ModuleType.hpp>
-+using namespace ::com::sun::star::script::ModuleType;
-
- /* class VBA:
- * The VBA class provides a set of methods to handle Visual Basic For
-@@ -68,13 +70,12 @@ DECLARE_DYNARRAY(StringArray,String *)
- // #117718# define internal types to distinguish between
- // module types, form, class & normal
- // #i37965# DR 2004-12-03: add "Document", used in Excel for macros attached to sheet
--enum ModuleType { Unknown = 0, Normal, Class, Form, Document };
-
- // #117718# define map to hold types of module
- //
--
-+typedef sal_Int32 ModType;
- typedef ::std::map< UniString,
-- ModuleType > ModuleTypeHash;
-+ ModType > ModuleTypeHash;
-
- class VBA_Impl
- {
-@@ -95,7 +96,7 @@ public:
- void Output(int len, const sal_uInt8 *data);
- //
- // #117718# member map of module names to types of module
-- ModuleType GetModuleType( const UniString& rModuleName );
-+ ModType GetModuleType( const UniString& rModuleName );
-
- std::vector<String> maReferences;
- private:
-diff --git svx/source/msfilter/svxmsbas.cxx svx/source/msfilter/svxmsbas.cxx
-index d5878ad..df541c2 100644
---- svx/source/msfilter/svxmsbas.cxx
-+++ svx/source/msfilter/svxmsbas.cxx
-@@ -53,6 +53,9 @@ using namespace com::sun::star::awt;
-
- #include <com/sun/star/container/XNameContainer.hpp>
- #include <com/sun/star/script/XLibraryContainer.hpp>
-+#include <com/sun/star/script/ModuleSourceInfo.hpp>
-+#include <com/sun/star/script/XBasicLibraryInfo.hpp>
-+
- using namespace com::sun::star::container;
- using namespace com::sun::star::script;
- using namespace com::sun::star::uno;
-@@ -266,8 +269,26 @@ BOOL SvxImportMSVBasic::ImportCode_Impl(
- Any aLibAny = xLibContainer->getByName( aLibName );
- aLibAny >>= xLib;
- }
-- if( xLib.is() )
-+ if( xLib.is() )
- {
-+ Reference< container::XNameAccess > xVBAObjectForCodeName;
-+ if ( !bAsComment )
-+ {
-+ Reference< XBasicLibraryInfo > xInfo( xLib, UNO_QUERY );
-+ if( xInfo.is() )
-+ xInfo->setVBACompatMode( sal_True );
-+ else
-+ rDocSh.GetBasic()->SetVBAEnabled( true );
-+ Reference< XMultiServiceFactory> xSF(rDocSh.GetModel(), UNO_QUERY);
-+ if ( xSF.is() )
-+ {
-+ try
-+ {
-+ xVBAObjectForCodeName.set( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.vba.VBAObjectModuleObjectProvider"))), UNO_QUERY );
-+ }
-+ catch( Exception& ) { }
-+ }
-+ }
- for( UINT16 i=0; i<nStreamCount;i++)
- {
- StringArray aDecompressed = aVBA.Decompress(i);
-@@ -301,7 +322,7 @@ BOOL SvxImportMSVBasic::ImportCode_Impl(
- // is the same as the encoding for the names
- // that are keys in the map used by GetModuleType method
- const String &sOrigVBAModName = aVBA.GetStreamName( i );
-- ModuleType mType = aVBA.GetModuleType( sOrigVBAModName );
-+ ModType mType = aVBA.GetModuleType( sOrigVBAModName );
-
- rtl::OUString sClassRem( RTL_CONSTASCII_USTRINGPARAM( "Rem Attribute VBA_ModuleType=" ) );
-
-@@ -309,23 +330,23 @@ BOOL SvxImportMSVBasic::ImportCode_Impl(
-
- switch( mType )
- {
-- case Class:
-+ case ModuleType::Class:
- modeTypeComment = sClassRem +
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAClassModule\n" ) );
- break;
-- case Form:
-+ case ModuleType::Form:
- modeTypeComment = sClassRem +
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAFormModule\n" ) );
- break;
-- case Document:
-+ case ModuleType::Document:
- modeTypeComment = sClassRem +
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBADocumentModule\n" ) );
- break;
-- case Normal:
-+ case ModuleType::Normal:
- modeTypeComment = sClassRem +
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAModule\n" ) );
- break;
-- case Unknown:
-+ case ModuleType::Unknown:
- modeTypeComment = sClassRem +
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAUnknown\n" ) );
- break;
-@@ -335,10 +356,10 @@ BOOL SvxImportMSVBasic::ImportCode_Impl(
- }
- static ::rtl::OUString sVBAOption( RTL_CONSTASCII_USTRINGPARAM( "Option VBASupport 1\n" ) );
- static ::rtl::OUString sClassOption( RTL_CONSTASCII_USTRINGPARAM( "Option ClassModule\n" ) );
-- if ( !bAsComment )
-+ if ( !bAsComment /*&& !rDocSh.GetBasic()->isVBAEnabled() */)
- {
- modeTypeComment = modeTypeComment + sVBAOption;
-- if ( mType == Class )
-+ if ( mType == ModuleType::Class )
- modeTypeComment = modeTypeComment + sClassOption;
-
- }
-@@ -405,12 +426,41 @@ BOOL SvxImportMSVBasic::ImportCode_Impl(
- aSource += rtl::OUString::createFromAscii("\nEnd Sub");
- }
- ::rtl::OUString aModName( sModule );
-- if ( aSource.getLength() )
- {
- aSource = modeTypeComment + aSource;
-
- Any aSourceAny;
-- aSourceAny <<= aSource;
-+ OSL_TRACE("erm %d", mType );
-+ if ( !bAsComment )
-+ {
-+ OSL_TRACE("vba processing %d", mType );
-+ script::ModuleSourceInfo sModuleInfo;
-+ sModuleInfo.ModuleName = aModName;
-+ sModuleInfo.ModuleSource = aSource;
-+ sModuleInfo.ModuleType = mType;
-+ if ( mType == ModuleType::Form )
-+ // hack, the module ( imo document basic should...
-+ // know the XModel... ) but it doesn't
-+ sModuleInfo.ModuleObject.set( rDocSh.GetModel(), UNO_QUERY );
-+ // document modules, we should be able to access
-+ // the api objects at this time
-+ else if ( mType == ModuleType::Document )
-+ {
-+ uno::Reference< lang::XMultiServiceFactory> xSF( rDocSh.GetModel(), uno::UNO_QUERY);
-+ uno::Reference< container::XNameAccess > xVBACodeNamedObjectAccess;
-+ if ( xSF.is() )
-+ xVBACodeNamedObjectAccess.set( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.vba.VBAObjectModuleObjectProvider"))), uno::UNO_QUERY );
-+ // get the api object for the codename
-+ if ( xVBACodeNamedObjectAccess.is() )
-+ {
-+ sModuleInfo.ModuleObject.set( xVBACodeNamedObjectAccess->getByName( sModuleInfo.ModuleName ), uno::UNO_QUERY );
-+ OSL_TRACE("** Straight up creation of Module");
-+ }
-+ }
-+ aSourceAny <<= sModuleInfo;
-+ }
-+ else
-+ aSourceAny <<= aSource;
- if( xLib->hasByName( aModName ) )
- xLib->replaceByName( aModName, aSourceAny );
- else
-@@ -420,6 +470,7 @@ BOOL SvxImportMSVBasic::ImportCode_Impl(
- bRet = true;
- }
- }
-+ if( bRet )
- SFX_APP()->LeaveBasicCall();
- }
- return bRet;
-diff --git udkapi/com/sun/star/script/ModuleInfo.idl udkapi/com/sun/star/script/ModuleInfo.idl
-new file mode 100644
-index 0000000..d670ec6
---- /dev/null
-+++ udkapi/com/sun/star/script/ModuleInfo.idl
-@@ -0,0 +1,56 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: ModuleInfo.idl,v $
-+ *
-+ * $Revision: 1.2 $
-+ *
-+ * last change: $Author: rt $ $Date: 2006/05/05 10:14:46 $
-+ *
-+ * 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 __com_sun_star_script_ModuleInfo_idl__
-+#define __com_sun_star_script_ModuleInfo_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+//=============================================================================
-+module com { module sun { module star { module script {
-+struct ModuleInfo
-+{
-+ string ModuleName;
-+ com::sun::star::uno::XInterface ModuleObject;
-+ short ModuleType; // string?
-+};
-+
-+//=============================================================================
-+
-+}; }; }; };
-+
-+#endif
-diff --git udkapi/com/sun/star/script/ModuleSourceInfo.idl udkapi/com/sun/star/script/ModuleSourceInfo.idl
-new file mode 100644
-index 0000000..feef569
---- /dev/null
-+++ udkapi/com/sun/star/script/ModuleSourceInfo.idl
-@@ -0,0 +1,57 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: ModuleInfo.idl,v $
-+ *
-+ * $Revision: 1.2 $
-+ *
-+ * last change: $Author: rt $ $Date: 2006/05/05 10:14:46 $
-+ *
-+ * 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 __com_sun_star_script_ModuleSourceInfo_idl__
-+#define __com_sun_star_script_ModuleSourceInfo_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+#ifndef __com_sun_star_script_ModuleInfo_idl__
-+#include <com/sun/star/script/ModuleInfo.idl>
-+#endif
-+
-+//=============================================================================
-+module com { module sun { module star { module script {
-+struct ModuleSourceInfo : ModuleInfo
-+{
-+ string ModuleSource;
-+};
-+
-+//=============================================================================
-+
-+}; }; }; };
-+
-+#endif
-diff --git udkapi/com/sun/star/script/ModuleType.idl udkapi/com/sun/star/script/ModuleType.idl
-new file mode 100644
-index 0000000..3295c52
---- /dev/null
-+++ udkapi/com/sun/star/script/ModuleType.idl
-@@ -0,0 +1,58 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: ModuleType.idl,v $
-+ *
-+ * $Revision: 1.2 $
-+ *
-+ * last change: $Author: rt $ $Date: 2006/05/05 10:14:46 $
-+ *
-+ * 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 __com_sun_star_script_ModuleType_idl__
-+#define __com_sun_star_script_ModuleType_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+//=============================================================================
-+module com { module sun { module star { module script {
-+published constants ModuleType
-+{
-+ const long Unknown = 0;
-+ const long Normal = 1;
-+ const long Class = 2;
-+ const long Form = 3;
-+ const long Document = 4;
-+};
-+
-+//=============================================================================
-+
-+}; }; }; };
-+
-+#endif
-diff --git udkapi/com/sun/star/script/makefile.mk udkapi/com/sun/star/script/makefile.mk
-index 745df3e..d36f19d 100644
---- udkapi/com/sun/star/script/makefile.mk
-+++ udkapi/com/sun/star/script/makefile.mk
-@@ -85,6 +85,9 @@ IDLFILES=\
- XScriptEventsAttacher.idl\
- XDefaultMethod.idl\
- XDefaultProperty.idl\
-+ ModuleInfo.idl\
-+ ModuleType.idl\
-+ ModuleSourceInfo.idl\
-
- # ------------------------------------------------------------------
-
diff --git a/patches/vba/native-export/basic-ide-module-object-name-combile.diff b/patches/vba/native-export/basic-ide-module-object-name-combile.diff
deleted file mode 100644
index 7145c8f22..000000000
--- a/patches/vba/native-export/basic-ide-module-object-name-combile.diff
+++ /dev/null
@@ -1,110 +0,0 @@
-diff --git basctl/source/basicide/basides2.cxx basctl/source/basicide/basides2.cxx
-index 90cec19..bdc087c 100644
---- basctl/source/basicide/basides2.cxx
-+++ basctl/source/basicide/basides2.cxx
-@@ -55,11 +55,39 @@
- #include <tools/diagnose_ex.h>
- #include <sfx2/sfxdefs.hxx>
- #include <sfx2/signaturestate.hxx>
-+#include <com/sun/star/script/XBasicLibraryInfo.hpp>
-+#include <com/sun/star/container/XNameContainer.hpp>
-+#include <com/sun/star/container/XNamed.hpp>
-+#include <com/sun/star/lang/XServiceInfo.hpp>
-
- using namespace ::com::sun::star;
- using namespace ::com::sun::star::uno;
- namespace css = ::com::sun::star;
-
-+void lcl_getObjectName( const uno::Reference< container::XNameContainer >& rLib, const String& rModName, String& rObjName )
-+{
-+ try
-+ {
-+ uno::Any aElement( rLib->getByName( rModName ) );
-+ script::ModuleInfo aModuleInfo;
-+ Reference< script::XBasicLibraryInfo > xLibInfo( rLib, UNO_QUERY );
-+ if ( xLibInfo.is() && xLibInfo->getVBACompatMode() )
-+ {
-+ script::ModuleInfo aModuleInfo = xLibInfo->getModuleInfo( rModName );
-+ uno::Reference< lang::XServiceInfo > xServiceInfo( aModuleInfo.ModuleObject, uno::UNO_QUERY );
-+
-+ if( xServiceInfo.is() && xServiceInfo->supportsService( rtl::OUString::createFromAscii( "org.openoffice.excel.Worksheet" ) ) )
-+ {
-+ uno::Reference< container::XNamed > xNamed( aModuleInfo.ModuleObject, uno::UNO_QUERY );
-+ if( xNamed.is() )
-+ rObjName = xNamed->getName();
-+ }
-+ }
-+ }catch( uno::Exception& )
-+ {
-+ }
-+}
-+
- IMPL_LINK_INLINE_START( BasicIDEShell, ObjectDialogCancelHdl, ObjectCatalog *, EMPTYARG )
- {
- ShowObjectDialog( FALSE, TRUE );
-@@ -232,7 +260,7 @@ ModulWindow* BasicIDEShell::CreateBasWin( const ScriptDocument& rDocument, const
- if ( !aLibName.Len() )
- aLibName = String::CreateFromAscii( "Standard" );
-
-- rDocument.getOrCreateLibrary( E_SCRIPTS, aLibName );
-+ uno::Reference< container::XNameContainer > xLib = rDocument.getOrCreateLibrary( E_SCRIPTS, aLibName );
-
- if ( !aModName.Len() )
- aModName = rDocument.createObjectName( E_SCRIPTS, aLibName );
-@@ -272,7 +300,20 @@ ModulWindow* BasicIDEShell::CreateBasWin( const ScriptDocument& rDocument, const
- DBG_ASSERT( nKey, "CreateBasWin: Kein Key- Fenster nicht gefunden!" );
- }
- if( nKey )
-+ {
-+ if( xLib.is() )
-+ {
-+ // display a nice friendly name in the ObjectModule tab,
-+ // combining the objectname and module name, e.g. Sheet1 ( Financials )
-+ String sObjName;
-+ lcl_getObjectName( xLib, rModName, sObjName );
-+ if( sObjName.Len() )
-+ {
-+ aModName.AppendAscii(" (").Append(sObjName).AppendAscii(")");
-+ }
-+ }
- pTabBar->InsertPage( (USHORT)nKey, aModName );
-+ }
- pTabBar->Sort();
- pWin->GrabScrollBars( &aHScrollBar, &aVScrollBar );
- if ( !pCurWin )
-diff --git oovbaapi/org/openoffice/excel/XWorksheet.idl oovbaapi/org/openoffice/excel/XWorksheet.idl
-index 3a9ad3e..3b39f1e 100644
---- oovbaapi/org/openoffice/excel/XWorksheet.idl
-+++ oovbaapi/org/openoffice/excel/XWorksheet.idl
-@@ -42,6 +42,9 @@
- #include <com/sun/star/script/XInvocation.idl>
- #endif
-
-+#ifndef __com_sun_star_container_XNamed_idl__
-+#include <com/sun/star/container/XNamed.idl>
-+#endif
- //=============================================================================
-
- module org { module openoffice { module excel {
-@@ -57,8 +60,8 @@ interface XWorksheet
- {
- interface ::org::openoffice::vba::XHelperInterface;
- interface ::com::sun::star::script::XInvocation;
-+ interface ::com::sun::star::container::XNamed;
-
-- [attribute] string Name;
- [attribute] boolean Visible;
- [attribute, readonly] long StandardHeight;
- [attribute, readonly] long StandardWidth;
-diff --git sc/source/ui/vba/vbaworksheet.hxx sc/source/ui/vba/vbaworksheet.hxx
-index 991d46c..9670820 100644
---- sc/source/ui/vba/vbaworksheet.hxx
-+++ sc/source/ui/vba/vbaworksheet.hxx
-@@ -45,6 +45,7 @@
- #include <org/openoffice/excel/XPageSetup.hpp>
- #include <org/openoffice/excel/XHPageBreaks.hpp>
- #include <org/openoffice/excel/XChartObjects.hpp>
-+#include <com/sun/star/container/XNamed.hpp>
-
- #include "vbahelperinterface.hxx"
-
diff --git a/patches/vba/native-export/vba-basic-macrochoose-dialog.diff b/patches/vba/native-export/vba-basic-macrochoose-dialog.diff
deleted file mode 100644
index 2e83018b2..000000000
--- a/patches/vba/native-export/vba-basic-macrochoose-dialog.diff
+++ /dev/null
@@ -1,913 +0,0 @@
-diff --git basctl/inc/basidesh.hrc basctl/inc/basidesh.hrc
-index a4e944b..0064b1f 100644
---- basctl/inc/basidesh.hrc
-+++ basctl/inc/basidesh.hrc
-@@ -175,6 +175,10 @@
- #define RID_STR_EXPORTPACKAGE ( RID_BASICIDE_START + 100 )
- #define RID_STR_EXPORTBASIC ( RID_BASICIDE_START + 101 )
- #define RID_STR_PACKAGE_BUNDLE ( RID_BASICIDE_START + 102 )
-+#define RID_STR_DOCUMENT_OBJECTS ( RID_BASICIDE_START + 110 )
-+#define RID_STR_USERFORMS ( RID_BASICIDE_START + 111 )
-+#define RID_STR_NORMAL_MODULES ( RID_BASICIDE_START + 112 )
-+#define RID_STR_CLASS_MODULES ( RID_BASICIDE_START + 113 )
-
- #endif // _SVX_NOIDERESIDS
-
-diff --git basctl/source/basicide/baside2.cxx basctl/source/basicide/baside2.cxx
-index a1e47ed..5a3fdba 100644
---- basctl/source/basicide/baside2.cxx
-+++ basctl/source/basicide/baside2.cxx
-@@ -49,6 +49,8 @@
- #include <com/sun/star/script/XLibraryContainer2.hpp>
- #endif
- #include <com/sun/star/document/MacroExecMode.hpp>
-+#include <com/sun/star/script/ModuleType.hpp>
-+#include <com/sun/star/script/XBasicLibraryInfo.hpp>
- #include <toolkit/helper/vclunohelper.hxx>
- #include <sfx2/docfile.hxx>
- #include <basic/basrdll.hxx>
-@@ -110,6 +112,8 @@ DBG_NAME( ModulWindow )
-
- TYPEINIT1( ModulWindow , IDEBaseWindow );
-
-+void lcl_getObjectName( const uno::Reference< container::XNameContainer >& rLib, const String& rModName, String& rObjName );
-+
- void lcl_PrintHeader( Printer* pPrinter, USHORT nPages, USHORT nCurPage, const String& rTitle )
- {
- short nLeftMargin = LMARGPRN;
-@@ -1347,7 +1351,39 @@ BasicEntryDescriptor ModulWindow::CreateEntryDescriptor()
- ScriptDocument aDocument( GetDocument() );
- String aLibName( GetLibName() );
- LibraryLocation eLocation = aDocument.getLibraryLocation( aLibName );
-- return BasicEntryDescriptor( aDocument, eLocation, aLibName, GetName(), OBJ_TYPE_MODULE );
-+ String aModName( GetName() );
-+ String aLibSubName;
-+ if( xModule.Is() && aDocument.isVBAEnabled( E_SCRIPTS, aLibName ) )
-+ {
-+ switch( xModule->GetModuleType() )
-+ {
-+ case script::ModuleType::Document:
-+ {
-+ aLibSubName = String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) );
-+ uno::Reference< container::XNameContainer > xLib = aDocument.getLibrary( E_SCRIPTS, aLibName, TRUE );
-+ if( xLib.is() )
-+ {
-+ String sObjName;
-+ lcl_getObjectName( xLib, aModName, sObjName );
-+ if( sObjName.Len() )
-+ {
-+ aModName.AppendAscii(" (").Append(sObjName).AppendAscii(")");
-+ }
-+ }
-+ break;
-+ }
-+ case script::ModuleType::Form:
-+ aLibSubName = String( IDEResId( RID_STR_USERFORMS ) );
-+ break;
-+ case script::ModuleType::Normal:
-+ aLibSubName = String( IDEResId( RID_STR_NORMAL_MODULES ) );
-+ break;
-+ case script::ModuleType::Class:
-+ aLibSubName = String( IDEResId( RID_STR_CLASS_MODULES ) );
-+ break;
-+ }
-+ }
-+ return BasicEntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, aModName, OBJ_TYPE_MODULE );
- }
-
- void ModulWindow::SetReadOnly( BOOL b )
-diff --git basctl/source/basicide/baside3.cxx basctl/source/basicide/baside3.cxx
-index 63ea754..a0e9f1b 100644
---- basctl/source/basicide/baside3.cxx
-+++ basctl/source/basicide/baside3.cxx
-@@ -912,8 +912,9 @@ BasicEntryDescriptor DialogWindow::CreateEntryDescriptor()
- {
- ScriptDocument aDocument( GetDocument() );
- String aLibName( GetLibName() );
-+ String aLibSubName;
- LibraryLocation eLocation = aDocument.getLibraryLocation( aLibName );
-- return BasicEntryDescriptor( aDocument, eLocation, aLibName, GetName(), OBJ_TYPE_DIALOG );
-+ return BasicEntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, GetName(), OBJ_TYPE_DIALOG );
- }
-
- void DialogWindow::SetReadOnly( BOOL b )
-diff --git basctl/source/basicide/basidesh.src basctl/source/basicide/basidesh.src
-index f02f914..9ee8434 100644
---- basctl/source/basicide/basidesh.src
-+++ basctl/source/basicide/basidesh.src
-@@ -639,6 +639,22 @@ String RID_STR_TRANSLATION_DEFAULT
- {
- Text [ en-US ] = "[Default Language]" ;
- };
-+String RID_STR_DOCUMENT_OBJECTS
-+{
-+ Text [ en-US ] = "Document Objects" ;
-+};
-+String RID_STR_USERFORMS
-+{
-+ Text [ en-US ] = "Forms" ;
-+};
-+String RID_STR_NORMAL_MODULES
-+{
-+ Text [ en-US ] = "Modules" ;
-+};
-+String RID_STR_CLASS_MODULES
-+{
-+ Text [ en-US ] = "Class Modules" ;
-+};
-
- #define MN_EDIT 20
- #define MN_VIEW 21
-diff --git basctl/source/basicide/bastype2.cxx basctl/source/basicide/bastype2.cxx
-index 7754d71..ace0a3f 100644
---- basctl/source/basicide/bastype2.cxx
-+++ basctl/source/basicide/bastype2.cxx
-@@ -53,10 +53,27 @@
- #include <com/sun/star/frame/XModuleManager.hpp>
- #include <comphelper/processfactory.hxx>
- #include <comphelper/componentcontext.hxx>
-+#include <map>
-+#include <com/sun/star/script/ModuleType.hpp>
-+#include <com/sun/star/script/XBasicLibraryInfo.hpp>
-+#include <com/sun/star/container/XNameContainer.hpp>
-
- using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star;
-
-+void lcl_getObjectName( const uno::Reference< container::XNameContainer >& rLib, const String& rModName, String& rObjName );
-+
-+sal_Int32 lcl_getModuleType( const uno::Reference< container::XNameContainer >& rLib, const String& rModName )
-+{
-+ sal_Int32 nType = com::sun::star::script::ModuleType::Normal;
-+ Reference< script::XBasicLibraryInfo > xLibInfo( rLib, UNO_QUERY );
-+ if ( xLibInfo.is() && xLibInfo->getVBACompatMode() )
-+ {
-+ script::ModuleInfo aModuleInfo = xLibInfo->getModuleInfo( rModName );
-+ nType = aModuleInfo.ModuleType;
-+ }
-+ return nType;
-+}
-
- BasicEntry::~BasicEntry()
- {
-@@ -91,20 +108,22 @@ BasicEntryDescriptor::BasicEntryDescriptor()
- {
- }
-
--BasicEntryDescriptor::BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rName, BasicEntryType eType )
-+BasicEntryDescriptor::BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rLibSubName, const String& rName, BasicEntryType eType )
- :m_aDocument( rDocument )
- ,m_eLocation( eLocation )
- ,m_aLibName( rLibName )
-+ ,m_aLibSubName( rLibSubName )
- ,m_aName( rName )
- ,m_eType( eType )
- {
- OSL_ENSURE( m_aDocument.isValid(), "BasicEntryDescriptor::BasicEntryDescriptor: invalid document!" );
- }
-
--BasicEntryDescriptor::BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rName, const String& rMethodName, BasicEntryType eType )
-+BasicEntryDescriptor::BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rLibSubName, const String& rName, const String& rMethodName, BasicEntryType eType )
- :m_aDocument( rDocument )
- ,m_eLocation( eLocation )
- ,m_aLibName( rLibName )
-+ ,m_aLibSubName( rLibSubName )
- ,m_aName( rName )
- ,m_aMethodName( rMethodName )
- ,m_eType( eType )
-@@ -120,6 +139,7 @@ BasicEntryDescriptor::BasicEntryDescriptor( const BasicEntryDescriptor& rDesc )
- :m_aDocument( rDesc.m_aDocument )
- ,m_eLocation( rDesc.m_eLocation )
- ,m_aLibName( rDesc.m_aLibName )
-+ ,m_aLibSubName( rDesc.m_aLibSubName )
- ,m_aName( rDesc.m_aName )
- ,m_aMethodName( rDesc.m_aMethodName )
- ,m_eType( rDesc.m_eType )
-@@ -131,6 +151,7 @@ BasicEntryDescriptor& BasicEntryDescriptor::operator=( const BasicEntryDescripto
- m_aDocument = rDesc.m_aDocument;
- m_eLocation = rDesc.m_eLocation;
- m_aLibName = rDesc.m_aLibName;
-+ m_aLibSubName = rDesc.m_aLibSubName;
- m_aName = rDesc.m_aName;
- m_aMethodName = rDesc.m_aMethodName;
- m_eType = rDesc.m_eType;
-@@ -143,6 +164,7 @@ bool BasicEntryDescriptor::operator==( const BasicEntryDescriptor& rDesc ) const
- return m_aDocument == rDesc.m_aDocument &&
- m_eLocation == rDesc.m_eLocation &&
- m_aLibName == rDesc.m_aLibName &&
-+ m_aLibSubName == rDesc.m_aLibSubName &&
- m_aName == rDesc.m_aName &&
- m_aMethodName == rDesc.m_aMethodName &&
- m_eType == rDesc.m_eType;
-@@ -286,50 +308,55 @@ void BasicTreeListBox::ImpCreateLibSubEntries( SvLBoxEntry* pLibRootEntry, const
- if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryLoaded( aOULibName ) )
- {
- try
-- {
-- // get a sorted list of module names
-- Sequence< ::rtl::OUString > aModNames = rDocument.getObjectNames( E_SCRIPTS, rLibName );
-- sal_Int32 nModCount = aModNames.getLength();
-- const ::rtl::OUString* pModNames = aModNames.getConstArray();
--
-- for ( sal_Int32 i = 0 ; i < nModCount ; i++ )
-- {
-- String aModName = pModNames[ i ];
-- SvLBoxEntry* pModuleEntry = FindEntry( pLibRootEntry, aModName, OBJ_TYPE_MODULE );
-- if ( !pModuleEntry )
-- pModuleEntry = AddEntry(
-- aModName,
-- Image( IDEResId( RID_IMG_MODULE ) ),
-- Image( IDEResId( RID_IMG_MODULE_HC ) ),
-- pLibRootEntry, false,
-- std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_MODULE ) ) );
--
-- // methods
-- if ( nMode & BROWSEMODE_SUBS )
-- {
-- Sequence< ::rtl::OUString > aNames = BasicIDE::GetMethodNames( rDocument, rLibName, aModName );
-- sal_Int32 nCount = aNames.getLength();
-- const ::rtl::OUString* pNames = aNames.getConstArray();
--
-- for ( sal_Int32 j = 0 ; j < nCount ; j++ )
-- {
-- String aName = pNames[ j ];
-- SvLBoxEntry* pEntry = FindEntry( pModuleEntry, aName, OBJ_TYPE_METHOD );
-- if ( !pEntry )
-- pEntry = AddEntry(
-- aName,
-- Image( IDEResId( RID_IMG_MACRO ) ),
-- Image( IDEResId( RID_IMG_MACRO_HC ) ),
-- pModuleEntry, false,
-- std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_METHOD ) ) );
-- }
-- }
-- }
-+ {
-+ if( rDocument.isVBAEnabled( E_SCRIPTS, aOULibName) )
-+ ImpCreateLibSubEntriesInVBAMode( pLibRootEntry, rDocument, rLibName );
-+ else
-+ {
-+ // get a sorted list of module names
-+ Sequence< ::rtl::OUString > aModNames = rDocument.getObjectNames( E_SCRIPTS, rLibName );
-+ sal_Int32 nModCount = aModNames.getLength();
-+ const ::rtl::OUString* pModNames = aModNames.getConstArray();
-+
-+ for ( sal_Int32 i = 0 ; i < nModCount ; i++ )
-+ {
-+ String aModName = pModNames[ i ];
-+ SvLBoxEntry* pModuleEntry = FindEntry( pLibRootEntry, aModName, OBJ_TYPE_MODULE );
-+ if ( !pModuleEntry )
-+ pModuleEntry = AddEntry(
-+ aModName,
-+ Image( IDEResId( RID_IMG_MODULE ) ),
-+ Image( IDEResId( RID_IMG_MODULE_HC ) ),
-+ pLibRootEntry, false,
-+ std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_MODULE ) ) );
-+
-+ // methods
-+ if ( nMode & BROWSEMODE_SUBS )
-+ {
-+ Sequence< ::rtl::OUString > aNames = BasicIDE::GetMethodNames( rDocument, rLibName, aModName );
-+ sal_Int32 nCount = aNames.getLength();
-+ const ::rtl::OUString* pNames = aNames.getConstArray();
-+
-+ for ( sal_Int32 j = 0 ; j < nCount ; j++ )
-+ {
-+ String aName = pNames[ j ];
-+ SvLBoxEntry* pEntry = FindEntry( pModuleEntry, aName, OBJ_TYPE_METHOD );
-+ if ( !pEntry )
-+ pEntry = AddEntry(
-+ aName,
-+ Image( IDEResId( RID_IMG_MACRO ) ),
-+ Image( IDEResId( RID_IMG_MACRO_HC ) ),
-+ pModuleEntry, false,
-+ std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_METHOD ) ) );
-+ }
-+ }
-+ }
-+ }
- }
-- catch ( const container::NoSuchElementException& )
-- {
-+ catch ( const container::NoSuchElementException& )
-+ {
- DBG_UNHANDLED_EXCEPTION();
-- }
-+ }
- }
- }
-
-@@ -368,6 +395,139 @@ void BasicTreeListBox::ImpCreateLibSubEntries( SvLBoxEntry* pLibRootEntry, const
- }
- }
-
-+void BasicTreeListBox::ImpCreateLibSubEntriesInVBAMode( SvLBoxEntry* pLibRootEntry, const ScriptDocument& rDocument, const String& rLibName )
-+{
-+ ::std::map< BasicEntryType, ::rtl::OUString > aEntryMap;
-+ aEntryMap.insert( ::std::make_pair( OBJ_TYPE_DOCUMENT_OBJECTS, String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) );
-+ aEntryMap.insert( ::std::make_pair( OBJ_TYPE_USERFORMS, String( IDEResId( RID_STR_USERFORMS ) ) ) );
-+ aEntryMap.insert( ::std::make_pair( OBJ_TYPE_NORMAL_MODULES, String( IDEResId( RID_STR_NORMAL_MODULES ) ) ) );
-+ aEntryMap.insert( ::std::make_pair( OBJ_TYPE_CLASS_MODULES, String( IDEResId( RID_STR_CLASS_MODULES ) ) ) );
-+
-+ ::std::map< BasicEntryType, ::rtl::OUString >::iterator iter;
-+ for( iter = aEntryMap.begin(); iter != aEntryMap.end(); ++iter )
-+ {
-+ BasicEntryType eType = iter->first;
-+ ::rtl::OUString aEntryName = iter->second;
-+ SvLBoxEntry* pLibSubRootEntry = FindEntry( pLibRootEntry, aEntryName, eType );
-+ if( pLibSubRootEntry )
-+ {
-+ SetEntryBitmaps( pLibSubRootEntry, Image( IDEResId( RID_IMG_MODLIB ) ), Image( IDEResId( RID_IMG_MODLIB_HC ) ) );
-+ if ( IsExpanded( pLibSubRootEntry ) )
-+ ImpCreateLibSubSubEntriesInVBAMode( pLibSubRootEntry, rDocument, rLibName );
-+ }
-+ else
-+ {
-+ pLibSubRootEntry = AddEntry(
-+ aEntryName,
-+ Image( IDEResId( RID_IMG_MODLIB ) ),
-+ Image( IDEResId( RID_IMG_MODLIB_HC ) ),
-+ pLibRootEntry, true,
-+ std::auto_ptr< BasicEntry >( new BasicEntry( eType ) ) );
-+ }
-+ }
-+}
-+
-+void BasicTreeListBox::ImpCreateLibSubSubEntriesInVBAMode( SvLBoxEntry* pLibSubRootEntry, const ScriptDocument& rDocument, const String& rLibName )
-+{
-+ uno::Reference< container::XNameContainer > xLib = rDocument.getOrCreateLibrary( E_SCRIPTS, rLibName );
-+ if( !xLib.is() )
-+ return;
-+
-+ try
-+ {
-+ // get a sorted list of module names
-+ Sequence< ::rtl::OUString > aModNames = rDocument.getObjectNames( E_SCRIPTS, rLibName );
-+ sal_Int32 nModCount = aModNames.getLength();
-+ const ::rtl::OUString* pModNames = aModNames.getConstArray();
-+
-+ BasicEntryDescriptor aDesc( GetEntryDescriptor( pLibSubRootEntry ) );
-+ BasicEntryType eCurrentType( aDesc.GetType() );
-+
-+ for ( sal_Int32 i = 0 ; i < nModCount ; i++ )
-+ {
-+ String aModName = pModNames[ i ];
-+ BasicEntryType eType = OBJ_TYPE_UNKNOWN;
-+ switch( lcl_getModuleType( xLib, aModName ) )
-+ {
-+ case script::ModuleType::Document:
-+ eType = OBJ_TYPE_DOCUMENT_OBJECTS;
-+ break;
-+ case script::ModuleType::Form:
-+ eType = OBJ_TYPE_USERFORMS;
-+ break;
-+ case script::ModuleType::Normal:
-+ eType = OBJ_TYPE_NORMAL_MODULES;
-+ break;
-+ case script::ModuleType::Class:
-+ eType = OBJ_TYPE_CLASS_MODULES;
-+ break;
-+ }
-+ if( eType != eCurrentType )
-+ continue;
-+
-+ // display a nice friendly name in the ObjectModule tab,
-+ // combining the objectname and module name, e.g. Sheet1 ( Financials )
-+ String aEntryName( aModName );
-+ if( eType == OBJ_TYPE_DOCUMENT_OBJECTS )
-+ {
-+ String sObjName;
-+ lcl_getObjectName( xLib, aModName, sObjName );
-+ if( sObjName.Len() )
-+ {
-+ aEntryName.AppendAscii(" (").Append(sObjName).AppendAscii(")");
-+ }
-+ }
-+ SvLBoxEntry* pModuleEntry = FindEntry( pLibSubRootEntry, aEntryName, OBJ_TYPE_MODULE );
-+ if ( !pModuleEntry )
-+ pModuleEntry = AddEntry(
-+ aEntryName,
-+ Image( IDEResId( RID_IMG_MODULE ) ),
-+ Image( IDEResId( RID_IMG_MODULE_HC ) ),
-+ pLibSubRootEntry, false,
-+ std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_MODULE ) ) );
-+
-+ // methods
-+ if ( nMode & BROWSEMODE_SUBS )
-+ {
-+ Sequence< ::rtl::OUString > aNames = BasicIDE::GetMethodNames( rDocument, rLibName, aModName );
-+ sal_Int32 nCount = aNames.getLength();
-+ const ::rtl::OUString* pNames = aNames.getConstArray();
-+
-+ for ( sal_Int32 j = 0 ; j < nCount ; j++ )
-+ {
-+ String aName = pNames[ j ];
-+ SvLBoxEntry* pEntry = FindEntry( pModuleEntry, aName, OBJ_TYPE_METHOD );
-+ if ( !pEntry )
-+ pEntry = AddEntry(
-+ aName,
-+ Image( IDEResId( RID_IMG_MACRO ) ),
-+ Image( IDEResId( RID_IMG_MACRO_HC ) ),
-+ pModuleEntry, false,
-+ std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_METHOD ) ) );
-+ }
-+ }
-+ }
-+ }
-+ catch ( const container::NoSuchElementException& )
-+ {
-+ DBG_UNHANDLED_EXCEPTION();
-+ }
-+}
-+
-+SvLBoxEntry* BasicTreeListBox::ImpFindEntry( SvLBoxEntry* pParent, const String& rText )
-+{
-+ ULONG nRootPos = 0;
-+ SvLBoxEntry* pEntry = pParent ? FirstChild( pParent ) : GetEntry( nRootPos );
-+ while ( pEntry )
-+ {
-+ if ( GetEntryText( pEntry ) == rText )
-+ return pEntry;
-+
-+ pEntry = pParent ? NextSibling( pEntry ) : GetEntry( ++nRootPos );
-+ }
-+ return 0;
-+}
-+
- void BasicTreeListBox::onDocumentCreated( const ScriptDocument& /*_rDocument*/ )
- {
- UpdateEntries();
-@@ -480,10 +640,11 @@ long BasicTreeListBox::ExpandingHdl()
- if ( aDocument.isAlive() )
- {
- String aLibName( aDesc.GetLibName() );
-+ String aLibSubName( aDesc.GetLibSubName() );
- String aName( aDesc.GetName() );
- String aMethodName( aDesc.GetMethodName() );
-
-- if ( aLibName.Len() && !aName.Len() && !aMethodName.Len() )
-+ if ( aLibName.Len() && !aLibSubName.Len() && !aName.Len() && !aMethodName.Len() )
- {
- // check password, if library is password protected and not verified
- ::rtl::OUString aOULibName( aLibName );
-@@ -636,7 +797,7 @@ void BasicTreeListBox::SetCurrentEntry( BasicEntryDescriptor& rDesc )
- aDesc = BasicEntryDescriptor(
- ScriptDocument::getApplicationScriptDocument(),
- LIBRARY_LOCATION_USER, String::CreateFromAscii( "Standard" ),
-- String::CreateFromAscii( "." ), OBJ_TYPE_UNKNOWN );
-+ String(), String::CreateFromAscii( "." ), OBJ_TYPE_UNKNOWN );
- }
- ScriptDocument aDocument( aDesc.GetDocument() );
- OSL_ENSURE( aDocument.isValid(), "BasicTreeListBox::SetCurrentEntry: invalid document!" );
-@@ -653,14 +814,24 @@ void BasicTreeListBox::SetCurrentEntry( BasicEntryDescriptor& rDesc )
- if ( pLibEntry )
- {
- pCurEntry = pLibEntry;
-+ String aLibSubName( aDesc.GetLibSubName() );
-+ if( aLibSubName.Len() )
-+ {
-+ Expand( pLibEntry );
-+ SvLBoxEntry* pLibSubEntry = ImpFindEntry( pLibEntry, aLibSubName );
-+ if( pLibSubEntry )
-+ {
-+ pCurEntry = pLibSubEntry;
-+ }
-+ }
- String aName( aDesc.GetName() );
- if ( aName.Len() )
- {
-- Expand( pLibEntry );
-+ Expand( pCurEntry );
- BasicEntryType eType = OBJ_TYPE_MODULE;
- if ( aDesc.GetType() == OBJ_TYPE_DIALOG )
- eType = OBJ_TYPE_DIALOG;
-- SvLBoxEntry* pEntry = FindEntry( pLibEntry, aName, eType );
-+ SvLBoxEntry* pEntry = FindEntry( pCurEntry, aName, eType );
- if ( pEntry )
- {
- pCurEntry = pEntry;
-diff --git basctl/source/basicide/bastype2.hxx basctl/source/basicide/bastype2.hxx
-index d93fbfd..81683d5 100644
---- basctl/source/basicide/bastype2.hxx
-+++ basctl/source/basicide/bastype2.hxx
-@@ -42,7 +42,7 @@
- #include <sbxitem.hxx>
- #include "basobj.hxx"
-
--enum BasicEntryType { OBJ_TYPE_UNKNOWN, OBJ_TYPE_DOCUMENT, OBJ_TYPE_LIBRARY, OBJ_TYPE_MODULE, OBJ_TYPE_DIALOG, OBJ_TYPE_METHOD };
-+enum BasicEntryType { OBJ_TYPE_UNKNOWN, OBJ_TYPE_DOCUMENT, OBJ_TYPE_LIBRARY, OBJ_TYPE_MODULE, OBJ_TYPE_DIALOG, OBJ_TYPE_METHOD, OBJ_TYPE_DOCUMENT_OBJECTS, OBJ_TYPE_USERFORMS, OBJ_TYPE_NORMAL_MODULES, OBJ_TYPE_CLASS_MODULES };
-
- #define BROWSEMODE_MODULES 0x01
- #define BROWSEMODE_SUBS 0x02
-@@ -101,14 +101,15 @@ class BasicEntryDescriptor
- ScriptDocument m_aDocument;
- LibraryLocation m_eLocation;
- String m_aLibName;
-+ String m_aLibSubName; // for vba entry: Document Objects, Class Modules, Forms and Normal Modules
- String m_aName;
- String m_aMethodName;
- BasicEntryType m_eType;
-
- public:
- BasicEntryDescriptor();
-- BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rName, BasicEntryType eType );
-- BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rName, const String& rMethodName, BasicEntryType eType );
-+ BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rLibSubName, const String& rName, BasicEntryType eType );
-+ BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rLibSubName, const String& rName, const String& rMethodName, BasicEntryType eType );
- virtual ~BasicEntryDescriptor();
-
- BasicEntryDescriptor( const BasicEntryDescriptor& rDesc );
-@@ -125,6 +126,9 @@ public:
- const String& GetLibName() const { return m_aLibName; }
- void SetLibName( const String& aLibName ) { m_aLibName = aLibName; }
-
-+ const String& GetLibSubName() const { return m_aLibSubName; }
-+ void SetLibSubName( const String& aLibSubName ) { m_aLibSubName = aLibSubName; }
-+
- const String& GetName() const { return m_aName; }
- void SetName( const String& aName ) { m_aName = aName; }
-
-@@ -164,6 +168,9 @@ protected:
-
- void ImpCreateLibEntries( SvLBoxEntry* pShellRootEntry, const ScriptDocument& rDocument, LibraryLocation eLocation );
- void ImpCreateLibSubEntries( SvLBoxEntry* pLibRootEntry, const ScriptDocument& rDocument, const String& rLibName );
-+ void ImpCreateLibSubEntriesInVBAMode( SvLBoxEntry* pLibRootEntry, const ScriptDocument& rDocument, const String& rLibName );
-+ void ImpCreateLibSubSubEntriesInVBAMode( SvLBoxEntry* pLibSubRootEntry, const ScriptDocument& rDocument, const String& rLibName );
-+ SvLBoxEntry* ImpFindEntry( SvLBoxEntry* pParent, const String& rText );
-
- // DocumentEventListener
- virtual void onDocumentCreated( const ScriptDocument& _rDocument );
-diff --git basctl/source/basicide/bastype3.cxx basctl/source/basicide/bastype3.cxx
-index c282f5d..accbce2 100644
---- basctl/source/basicide/bastype3.cxx
-+++ basctl/source/basicide/bastype3.cxx
-@@ -134,6 +134,14 @@ void __EXPORT BasicTreeListBox::RequestingChilds( SvLBoxEntry* pEntry )
- }
- }
- }
-+ else if ( eType == OBJ_TYPE_DOCUMENT_OBJECTS
-+ || eType == OBJ_TYPE_USERFORMS
-+ || eType == OBJ_TYPE_NORMAL_MODULES
-+ || eType == OBJ_TYPE_CLASS_MODULES )
-+ {
-+ String aLibName( aDesc.GetLibName() );
-+ ImpCreateLibSubSubEntriesInVBAMode( pEntry, aDocument, aLibName );
-+ }
- else {
- DBG_ERROR( "BasicTreeListBox::RequestingChilds: Unknown Type!" );
- }
-@@ -204,6 +212,7 @@ SbxVariable* BasicTreeListBox::FindVariable( SvLBoxEntry* pEntry )
- }
-
- SbxVariable* pVar = 0;
-+ bool bDocumentObjects = false;
- if ( aEntries.Count() )
- {
- for ( USHORT n = 0; n < aEntries.Count(); n++ )
-@@ -226,6 +235,12 @@ SbxVariable* BasicTreeListBox::FindVariable( SvLBoxEntry* pEntry )
- case OBJ_TYPE_MODULE:
- {
- DBG_ASSERT( pVar && pVar->IsA( TYPE(StarBASIC) ), "FindVariable: Ungueltiges Basic" );
-+ // extract the module name from the string like "Sheet1 (Example1)"
-+ if( bDocumentObjects )
-+ {
-+ sal_uInt16 nIndex = 0;
-+ aName = aName.GetToken( 0, ' ', nIndex );
-+ }
- pVar = ((StarBASIC*)pVar)->FindModule( aName );
- }
- break;
-@@ -240,6 +255,15 @@ SbxVariable* BasicTreeListBox::FindVariable( SvLBoxEntry* pEntry )
- // sbx dialogs removed
- }
- break;
-+ case OBJ_TYPE_DOCUMENT_OBJECTS:
-+ bDocumentObjects = true;
-+ case OBJ_TYPE_USERFORMS:
-+ case OBJ_TYPE_NORMAL_MODULES:
-+ case OBJ_TYPE_CLASS_MODULES:
-+ {
-+ // skip, to find the child entry.
-+ continue;
-+ }
- default:
- {
- DBG_ERROR( "FindVariable: Unbekannter Typ!" );
-@@ -260,12 +284,13 @@ BasicEntryDescriptor BasicTreeListBox::GetEntryDescriptor( SvLBoxEntry* pEntry )
- ScriptDocument aDocument( ScriptDocument::getApplicationScriptDocument() );
- LibraryLocation eLocation = LIBRARY_LOCATION_UNKNOWN;
- String aLibName;
-+ String aLibSubName;
- String aName;
- String aMethodName;
- BasicEntryType eType = OBJ_TYPE_UNKNOWN;
-
- if ( !pEntry )
-- return BasicEntryDescriptor( aDocument, eLocation, aLibName, aName, aMethodName, eType );
-+ return BasicEntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, aName, aMethodName, eType );
-
- EntryArray aEntries;
-
-@@ -332,6 +357,15 @@ BasicEntryDescriptor BasicTreeListBox::GetEntryDescriptor( SvLBoxEntry* pEntry )
- eType = pBE->GetType();
- }
- break;
-+ case OBJ_TYPE_DOCUMENT_OBJECTS:
-+ case OBJ_TYPE_USERFORMS:
-+ case OBJ_TYPE_NORMAL_MODULES:
-+ case OBJ_TYPE_CLASS_MODULES:
-+ {
-+ aLibSubName = GetEntryText( pLE );
-+ eType = pBE->GetType();
-+ }
-+ break;
- default:
- {
- DBG_ERROR( "GetEntryDescriptor: Unbekannter Typ!" );
-@@ -345,7 +379,7 @@ BasicEntryDescriptor BasicTreeListBox::GetEntryDescriptor( SvLBoxEntry* pEntry )
- }
- }
-
-- return BasicEntryDescriptor( aDocument, eLocation, aLibName, aName, aMethodName, eType );
-+ return BasicEntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, aName, aMethodName, eType );
- }
-
- USHORT BasicTreeListBox::ConvertType( BasicEntryType eType )
-@@ -427,6 +461,14 @@ bool BasicTreeListBox::IsValidEntry( SvLBoxEntry* pEntry )
- bIsValid = BasicIDE::HasMethod( aDocument, aLibName, aName, aMethodName );
- }
- break;
-+ case OBJ_TYPE_DOCUMENT_OBJECTS:
-+ case OBJ_TYPE_USERFORMS:
-+ case OBJ_TYPE_NORMAL_MODULES:
-+ case OBJ_TYPE_CLASS_MODULES:
-+ {
-+ bIsValid = true;
-+ }
-+ break;
- default: ;
- }
-
-diff --git basctl/source/basicide/macrodlg.cxx basctl/source/basicide/macrodlg.cxx
-index 229d999..a6013cf 100644
---- basctl/source/basicide/macrodlg.cxx
-+++ basctl/source/basicide/macrodlg.cxx
-@@ -385,7 +385,15 @@ SbMethod* MacroChooser::CreateMacro()
- SbModule* pModule = 0;
- String aModName( aDesc.GetName() );
- if ( aModName.Len() )
-+ {
-+ // extract the module name from the string like "Sheet1 (Example1)"
-+ if( aDesc.GetLibSubName().Equals( String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) )
-+ {
-+ sal_uInt16 nIndex = 0;
-+ aModName = aModName.GetToken( 0, ' ', nIndex );
-+ }
- pModule = pBasic->FindModule( aModName );
-+ }
- else if ( pBasic->GetModules()->Count() )
- pModule = (SbModule*)pBasic->GetModules()->Get( 0 );
-
-@@ -713,6 +721,12 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton )
- BasicManager* pBasMgr = aDocument.getBasicManager();
- String aLib( aDesc.GetLibName() );
- String aMod( aDesc.GetName() );
-+ // extract the module name from the string like "Sheet1 (Example1)"
-+ if( aDesc.GetLibSubName().Equals( String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) )
-+ {
-+ sal_uInt16 nIndex = 0;
-+ aMod = aMod.GetToken( 0, ' ', nIndex );
-+ }
- String aSub( aDesc.GetMethodName() );
- SfxMacroInfoItem aInfoItem( SID_BASICIDE_ARG_MACROINFO, pBasMgr, aLib, aMod, aSub, String() );
- if ( pButton == &aEditButton )
-diff --git basctl/source/basicide/moduldlg.cxx basctl/source/basicide/moduldlg.cxx
-index cd2c032..6a5e331 100644
---- basctl/source/basicide/moduldlg.cxx
-+++ basctl/source/basicide/moduldlg.cxx
-@@ -56,6 +56,7 @@
- #include <com/sun/star/script/XLibraryContainerPassword.hpp>
- #include <com/sun/star/resource/XStringResourceManager.hpp>
- #include <com/sun/star/lang/XMultiServiceFactory.hpp>
-+#include <com/sun/star/script/XBasicLibraryInfo.hpp>
- #include <comphelper/processfactory.hxx>
- #include <xmlscript/xmldlg_imexp.hxx>
-
-@@ -87,7 +88,7 @@ BOOL __EXPORT ExtBasicTreeListBox::EditingEntry( SvLBoxEntry* pEntry, Selection&
- if ( pEntry )
- {
- USHORT nDepth = GetModel()->GetDepth( pEntry );
-- if ( nDepth == 2 )
-+ if ( nDepth >= 2 )
- {
- BasicEntryDescriptor aDesc( GetEntryDescriptor( pEntry ) );
- ScriptDocument aDocument( aDesc.GetDocument() );
-@@ -165,7 +166,7 @@ DragDropMode __EXPORT ExtBasicTreeListBox::NotifyStartDrag( TransferDataContaine
- if ( pEntry )
- {
- USHORT nDepth = GetModel()->GetDepth( pEntry );
-- if ( nDepth == 2 )
-+ if ( nDepth >= 2 )
- {
- nMode_ = SV_DRAGDROP_CTRL_COPY;
- BasicEntryDescriptor aDesc( GetEntryDescriptor( pEntry ) );
-@@ -213,7 +214,7 @@ BOOL __EXPORT ExtBasicTreeListBox::NotifyAcceptDrop( SvLBoxEntry* pEntry )
-
- // don't drop on a library, which is not loaded, readonly or password protected
- // or which already has a module/dialog with this name
-- if ( bValid && ( nDepth == 1 || nDepth == 2 ) )
-+ if ( bValid && ( nDepth > 0 ) )
- {
- // get source module/dialog name
- BasicEntryDescriptor aSourceDesc( GetEntryDescriptor( pSelected ) );
-@@ -351,7 +352,7 @@ BOOL __EXPORT ExtBasicTreeListBox::NotifyCopyingMoving( SvLBoxEntry* pTarget, Sv
- rpNewParent = pTarget;
- rNewChildPos = 0;
- }
-- else if ( nDepth == 2 )
-+ else if ( nDepth >= 2 )
- {
- // Target = Modul/Dialog => Modul/Dialog unter das uebergeordnete Basic haengen...
- rpNewParent = GetParent( pTarget );
-@@ -626,20 +627,29 @@ void ObjectPage::CheckButtons()
- {
- // enable/disable edit button
- SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry();
-+ BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) );
-+ ScriptDocument aDocument( aDesc.GetDocument() );
-+ ::rtl::OUString aOULibName( aDesc.GetLibName() );
-+ String aLibSubName( aDesc.GetLibSubName() );
-+ bool bVBAEnabled = aDocument.isVBAEnabled( E_SCRIPTS, aOULibName );
-+ USHORT nMode = aBasicBox.GetMode();
-+
- USHORT nDepth = pCurEntry ? aBasicBox.GetModel()->GetDepth( pCurEntry ) : 0;
-- if ( nDepth == 2 )
-- aEditButton.Enable();
-+ if ( nDepth >= 2 )
-+ {
-+ if( bVBAEnabled && ( nMode & BROWSEMODE_MODULES ) && ( nDepth == 2 ) )
-+ aEditButton.Disable();
-+ else
-+ aEditButton.Enable();
-+ }
- else
- aEditButton.Disable();
-
- // enable/disable new module/dialog buttons
-- BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) );
- LibraryLocation eLocation( aDesc.GetLocation() );
- BOOL bReadOnly = FALSE;
-- if ( nDepth == 1 || nDepth == 2 )
-+ if ( nDepth > 0 )
- {
-- ScriptDocument aDocument( aDesc.GetDocument() );
-- ::rtl::OUString aOULibName( aDesc.GetLibName() );
- Reference< script::XLibraryContainer2 > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
- Reference< script::XLibraryContainer2 > xDlgLibContainer( aDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY );
- if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryReadOnly( aOULibName ) ) ||
-@@ -660,9 +670,14 @@ void ObjectPage::CheckButtons()
- }
-
- // enable/disable delete button
-- if ( nDepth == 2 && !bReadOnly && eLocation != LIBRARY_LOCATION_SHARE )
-- aDelButton.Enable();
-- else
-+ if ( nDepth >= 2 && !bReadOnly && eLocation != LIBRARY_LOCATION_SHARE )
-+ {
-+ if( bVBAEnabled && ( nMode & BROWSEMODE_MODULES ) && ( ( nDepth == 2 ) || aLibSubName.Equals( String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) ) )
-+ aDelButton.Disable();
-+ else
-+ aDelButton.Enable();
-+ }
-+ else
- aDelButton.Disable();
- }
-
-@@ -688,13 +703,20 @@ IMPL_LINK( ObjectPage, ButtonHdl, Button *, pButton )
- SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
- SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry();
- DBG_ASSERT( pCurEntry, "Entry?!" );
-- if ( aBasicBox.GetModel()->GetDepth( pCurEntry ) == 2 )
-+ if ( aBasicBox.GetModel()->GetDepth( pCurEntry ) >= 2 )
- {
- BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) );
- if ( pDispatcher )
- {
-+ String aModName( aDesc.GetName() );
-+ // extract the module name from the string like "Sheet1 (Example1)"
-+ if( aDesc.GetLibSubName().Equals( String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) )
-+ {
-+ sal_uInt16 nIndex = 0;
-+ aModName = aModName.GetToken( 0, ' ', nIndex );
-+ }
- SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, aDesc.GetDocument(), aDesc.GetLibName(),
-- aDesc.GetName(), aBasicBox.ConvertType( aDesc.GetType() ) );
-+ aModName, aBasicBox.ConvertType( aDesc.GetType() ) );
- pDispatcher->Execute( SID_BASICIDE_SHOWSBX, SFX_CALLMODE_SYNCHRON, &aSbxItem, 0L );
- }
- }
-@@ -976,14 +998,14 @@ SbModule* createModImpl( Window* pWin, const ScriptDocument& rDocument,
- try
- {
- ::rtl::OUString sModuleCode;
-+ // the module has existed
-+ if( rDocument.hasModule( aLibName, aModName ) )
-+ return NULL;
- rDocument.createModule( aLibName, aModName, bMain, sModuleCode );
- BasicManager* pBasMgr = rDocument.getBasicManager();
-- if ( pBasMgr )
-- {
-- StarBASIC* pBasic = pBasMgr->GetLib( aLibName );
-- if ( pBasic )
-- pModule = pBasic->FindModule( aModName );
-- }
-+ StarBASIC* pBasic = pBasMgr? pBasMgr->GetLib( aLibName ) : 0;
-+ if ( pBasic )
-+ pModule = pBasic->FindModule( aModName );
- SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, rDocument, aLibName, aModName, BASICIDE_TYPE_MODULE );
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
-@@ -1005,14 +1027,27 @@ SbModule* createModImpl( Window* pWin, const ScriptDocument& rDocument,
- {
- if ( !rBasicBox.IsExpanded( pLibEntry ) )
- rBasicBox.Expand( pLibEntry );
-- SvLBoxEntry* pEntry = rBasicBox.FindEntry( pLibEntry, aModName, OBJ_TYPE_MODULE );
-+ SvLBoxEntry* pSubRootEntry = pLibEntry;
-+ if( rDocument.isVBAEnabled( E_SCRIPTS, aLibName ) )
-+ {
-+ // add the new module in the "Modules" entry
-+ SvLBoxEntry* pLibSubEntry = rBasicBox.FindEntry( pLibEntry, String( IDEResId( RID_STR_NORMAL_MODULES ) ) , OBJ_TYPE_NORMAL_MODULES );
-+ if( pLibSubEntry )
-+ {
-+ if( !rBasicBox.IsExpanded( pLibSubEntry ) )
-+ rBasicBox.Expand( pLibSubEntry );
-+ pSubRootEntry = pLibSubEntry;
-+ }
-+ }
-+
-+ SvLBoxEntry* pEntry = rBasicBox.FindEntry( pSubRootEntry, aModName, OBJ_TYPE_MODULE );
- if ( !pEntry )
- {
- pEntry = rBasicBox.AddEntry(
- aModName,
- Image( IDEResId( RID_IMG_MODULE ) ),
- Image( IDEResId( RID_IMG_MODULE_HC ) ),
-- pLibEntry, false,
-+ pSubRootEntry, false,
- std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_MODULE ) ) );
- DBG_ASSERT( pEntry, "InsertEntry fehlgeschlagen!" );
- }
-diff --git basctl/source/basicide/scriptdocument.cxx basctl/source/basicide/scriptdocument.cxx
-index fbe3f67..ebd3c06 100644
---- basctl/source/basicide/scriptdocument.cxx
-+++ basctl/source/basicide/scriptdocument.cxx
-@@ -56,6 +56,7 @@
- #include <com/sun/star/frame/XModel2.hpp>
- #include <com/sun/star/awt/XWindow2.hpp>
- #include <com/sun/star/document/XEmbeddedScripts.hpp>
-+#include <com/sun/star/script/XBasicLibraryInfo.hpp>
- /** === end UNO includes === **/
-
- #include <sfx2/objsh.hxx>
-@@ -142,6 +143,7 @@ namespace basctl
- using ::com::sun::star::uno::RuntimeException;
- using ::com::sun::star::document::XEventBroadcaster;
- using ::com::sun::star::document::XEmbeddedScripts;
-+ using ::com::sun::star::script::XBasicLibraryInfo;
- /** === end UNO using === **/
- namespace MacroExecMode = ::com::sun::star::document::MacroExecMode;
- namespace FrameSearchFlag = ::com::sun::star::frame::FrameSearchFlag;
-@@ -1591,6 +1593,18 @@ namespace basctl
- return m_pImpl->allowMacros();
- }
-
-+ //--------------------------------------------------------------------
-+ bool ScriptDocument::isVBAEnabled( LibraryContainerType _eType, const ::rtl::OUString& _rLibName ) const
-+ {
-+ bool bVBAEnabled = false;
-+ if( hasLibrary( _eType, _rLibName ) )
-+ {
-+ Reference< XBasicLibraryInfo > xVBAInfo( getLibrary( _eType, _rLibName, TRUE ), UNO_QUERY );
-+ bVBAEnabled = xVBAInfo.is() ? xVBAInfo->getVBACompatMode() : false;
-+ }
-+ return bVBAEnabled;
-+ }
-+
- //........................................................................
- } // namespace basctl
- //........................................................................
-diff --git basctl/source/inc/scriptdocument.hxx basctl/source/inc/scriptdocument.hxx
-index e1730ac..c676ec3 100644
---- basctl/source/inc/scriptdocument.hxx
-+++ basctl/source/inc/scriptdocument.hxx
-@@ -513,6 +513,10 @@ namespace basctl
- only to be called for real documents (->isDocument)
- */
- bool allowMacros() const;
-+
-+ /** determines whether the VBA mode is enabled for a library of the given type, with the given name
-+ */
-+ bool isVBAEnabled( LibraryContainerType _eType, const ::rtl::OUString& _rLibName ) const;
- };
-
- //........................................................................
diff --git a/patches/vba/native-export/vba-compatible-mode-uno.diff b/patches/vba/native-export/vba-compatible-mode-uno.diff
deleted file mode 100644
index 1285341d6..000000000
--- a/patches/vba/native-export/vba-compatible-mode-uno.diff
+++ /dev/null
@@ -1,127 +0,0 @@
-diff --git xmlscript/source/xmldlg_imexp/imp_share.hxx xmlscript/source/xmldlg_imexp/imp_share.hxx
-index e5263ad..814bb21 100644
---- xmlscript/source/xmldlg_imexp/imp_share.hxx
-+++ xmlscript/source/xmldlg_imexp/imp_share.hxx
-@@ -45,6 +45,7 @@
- #include <com/sun/star/awt/FontEmphasisMark.hpp>
- #include <com/sun/star/awt/FontRelief.hpp>
- #include <com/sun/star/xml/input/XRoot.hpp>
-+#include <com/sun/star/script/XBasicLibraryInfo.hpp>
- #include <vector>
-
-
-@@ -177,6 +178,8 @@ public:
- SAL_THROW( () );
-
- inline css::uno::Reference< css::frame::XModel > getDocOwner() { return _xDoc; }
-+ css::uno::Reference< css::script::XBasicLibraryInfo > getScriptLibraryInfo();
-+
- // XRoot
- virtual void SAL_CALL startDocument(
- css::uno::Reference< css::xml::input::XNamespaceMapping >
-diff --git xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
-index 310b3a6..9885fc4 100644
---- xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
-+++ xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
-@@ -41,6 +41,7 @@
- #include <com/sun/star/beans/XPropertyState.hpp>
- #include <com/sun/star/document/XStorageBasedDocument.hpp>
- #include <com/sun/star/document/XGraphicObjectResolver.hpp>
-+#include <com/sun/star/script/XBasicLibraryInfo.hpp>
-
- #include <comphelper/componentcontext.hxx>
- #include <comphelper/processfactory.hxx>
-@@ -145,6 +146,16 @@ void importBindableAndListRangeBits( Dia
- }
- }
- }
-+
-+sal_Bool isVBACompatModeOn( DialogImport* _pImport )
-+{
-+ sal_Bool bVBAMode = sal_False;
-+ Reference< script::XBasicLibraryInfo > xVBAInfo( _pImport->getScriptLibraryInfo(), UNO_QUERY );
-+ if ( xVBAInfo.is() )
-+ bVBAMode = xVBAInfo->getVBACompatMode();
-+ return bVBAMode;
-+}
-+
- // progessmeter
- //__________________________________________________________________________________________________
- Reference< xml::input::XElement > ProgressBarElement::startChildElement(
-@@ -1475,7 +1486,7 @@ void TitledBoxElement::endElement()
- {
- sLinkedCell = xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
- // we should probably limit this to vba mode also ( leave for now )
-- if ( _pImport->getDocOwner().is() )
-+ if ( isVBACompatModeOn( _pImport ) )
- sService = OUSTR("com.sun.star.form.component.RadioButton");
- }
- catch( Exception& /*e*/ )
-@@ -1620,7 +1631,7 @@ void RadioGroupElement::endElement()
- {
- sLinkedCell = xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
- // we should probably limit this to vba mode also ( leave for now )
-- if ( _pImport->getDocOwner().is() )
-+ if ( isVBACompatModeOn( _pImport ) )
- sService = OUSTR("com.sun.star.form.component.RadioButton");
- }
- catch( Exception& /*e*/ )
-@@ -1807,7 +1818,7 @@ void MenuListElement::endElement()
- OUString sListBoxService( OUSTR("com.sun.star.awt.UnoControlListBoxModel") );
-
- // we should probably limit this to vba mode also ( leave for now )
-- if ( _pImport->getDocOwner().is() )
-+ if ( isVBACompatModeOn( _pImport ) )
- sListBoxService = OUSTR("com.sun.star.form.component.ListBox");
-
- try
-diff --git xmlscript/source/xmldlg_imexp/xmldlg_import.cxx xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
-index 99064cc..e4f6647 100644
---- xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
-+++ xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
-@@ -59,6 +59,9 @@
- #include <com/sun/star/script/ScriptEventDescriptor.hpp>
-
- #include <com/sun/star/view/SelectionType.hpp>
-+#include <com/sun/star/document/XStorageBasedDocument.hpp>
-+#include <com/sun/star/script/XBasicLibraryInfo.hpp>
-+
-
- using namespace ::com::sun::star;
- using namespace ::com::sun::star::uno;
-@@ -1875,6 +1878,35 @@ Reference< xml::input::XElement > Dialog
- return 0;
- }
-
-+//__________________________________________________________________________________________________
-+Reference< script::XBasicLibraryInfo > DialogImport::getScriptLibraryInfo()
-+{
-+ // #FIXME this is a hack, we should know about the library that
-+ // 'owns' the dialog ( in order to determine it's vba mode )
-+ Reference< script::XBasicLibraryInfo > xLib;
-+ if ( _xDoc.is() )
-+ {
-+ Reference< beans::XPropertySet > xProps( _xDoc, UNO_QUERY );
-+ if ( xProps.is() )
-+ {
-+ try
-+ {
-+ Reference< container::XNameAccess > xLibContainer;
-+ xProps->getPropertyValue( OUSTR("BasicLibraries") ) >>= xLibContainer;
-+ if ( xLibContainer.is() )
-+ {
-+ xLibContainer->getByName( OUSTR("Standard") ) >>= xLib;
-+ }
-+
-+ }
-+ catch( Exception& )
-+ {
-+ }
-+ }
-+ }
-+ return xLib;
-+}
-+
- //##################################################################################################
-
- //==================================================================================================
diff --git a/patches/vba/native-export/vba-ui-option.diff b/patches/vba/native-export/vba-ui-option.diff
deleted file mode 100644
index 5ac700035..000000000
--- a/patches/vba/native-export/vba-ui-option.diff
+++ /dev/null
@@ -1,175 +0,0 @@
-diff --git basctl/sdi/baside.sdi basctl/sdi/baside.sdi
-index fbdef2d..aa52897 100644
---- basctl/sdi/baside.sdi
-+++ basctl/sdi/baside.sdi
-@@ -126,6 +126,12 @@ shell BasicIDEShell
- StateMethod = GetState;
- ]
-
-+ SID_BASICIDE_VBAENABLED
-+ [
-+ ExecMethod = ExecuteCurrent;
-+ StateMethod = GetState;
-+ ]
-+
- // ========================================================
- // Global: Egal, welches Fenster gerade aktiv ist:
- // ========================================================
-diff --git basctl/source/basicide/basides1.cxx basctl/source/basicide/basides1.cxx
-index 3d79067..d1c759a 100644
---- basctl/source/basicide/basides1.cxx
-+++ basctl/source/basicide/basides1.cxx
-@@ -74,6 +74,8 @@
- #include <com/sun/star/script/XLibraryContainerPassword.hpp>
- #include <com/sun/star/frame/XDispatchProvider.hpp>
- #include <com/sun/star/frame/XLayoutManager.hpp>
-+#include <com/sun/star/script/XBasicLibraryInfo.hpp>
-+#include <com/sun/star/lang/XServiceInfo.hpp>
-
- #include <algorithm>
- #include <memory>
-@@ -260,6 +262,28 @@ void __EXPORT BasicIDEShell::ExecuteCurrent( SfxRequest& rReq )
- }
- }
- break;
-+ case SID_BASICIDE_VBAENABLED:
-+ {
-+ if( pCurWin )
-+ {
-+ ScriptDocument aDocument( pCurWin->GetDocument() );
-+ if( aDocument.isDocument() )
-+ {
-+ Reference< script::XLibraryContainer > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ) );
-+ if( xModLibContainer.is() && xModLibContainer->hasByName( m_aCurLibName ) )
-+ {
-+ Reference< script::XBasicLibraryInfo > xLib;
-+ xModLibContainer->getByName( m_aCurLibName ) >>= xLib;
-+ if( xLib.is() )
-+ {
-+ sal_Bool bVBAEnabled = xLib->getVBACompatMode();
-+ xLib->setVBACompatMode( !bVBAEnabled );
-+ }
-+ }
-+ }
-+ }
-+ }
-+ break;
- default:
- {
- pCurWin->ExecuteCommand( rReq );
-@@ -1011,6 +1035,37 @@ void __EXPORT BasicIDEShell::GetState(SfxItemSet &rSet)
- rSet.DisableItem( nWh );
- }
- break;
-+ case SID_BASICIDE_VBAENABLED:
-+ {
-+ BOOL bDisable = TRUE;
-+ //Reference< XModel > xModel( GetCurrentDocument(), UNO_QUERY );
-+ Reference< lang::XServiceInfo > xServiceInfo( GetCurrentDocument(), UNO_QUERY );
-+ if( xServiceInfo.is() )
-+ {
-+ sal_Bool bSupports = xServiceInfo->supportsService( ::rtl::OUString::createFromAscii("com.sun.star.sheet.SpreadsheetDocument") );
-+ bDisable = !bSupports;
-+ }
-+
-+ if( bDisable )
-+ {
-+ rSet.DisableItem( nWh );
-+ }
-+ else
-+ {
-+ ScriptDocument aDocument( pCurWin->GetDocument() );
-+ Reference< script::XLibraryContainer > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ) );
-+ if( xModLibContainer.is() && xModLibContainer->hasByName( m_aCurLibName ) )
-+ {
-+ Reference< script::XBasicLibraryInfo > xLib;
-+ xModLibContainer->getByName( m_aCurLibName ) >>= xLib;
-+ if( xLib.is() )
-+ {
-+ rSet.Put( SfxBoolItem( nWh, xLib->getVBACompatMode() ) );
-+ }
-+ }
-+ }
-+ }
-+ break;
- }
- }
- if ( pCurWin )
-diff --git basctl/uiconfig/basicide/menubar/menubar.xml basctl/uiconfig/basicide/menubar/menubar.xml
-index 8093ae4..d634dc1 100644
---- basctl/uiconfig/basicide/menubar/menubar.xml
-+++ basctl/uiconfig/basicide/menubar/menubar.xml
-@@ -59,6 +59,7 @@
- <menu:menuitem menu:id=".uno:MacroRecorder"/>
- <menu:menuitem menu:id=".uno:RunMacro"/>
- <menu:menu menu:id=".uno:ScriptOrganizer"/>
-+ <menu:menuitem menu:id=".uno:VBAEnabled"/>
- <menu:menuseparator/>
- <menu:menuitem menu:id=".uno:MacroOrganizer?TabId:short=1"/>
- </menu:menupopup>
-diff --git officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
-index ff2fa98..6d796ab 100644
---- officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
-+++ officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
-@@ -4198,6 +4198,11 @@
- <value xml:lang="en-US">R~un Macro...</value>
- </prop>
- </node>
-+ <node oor:name=".uno:VBAEnabled" oor:op="replace">
-+ <prop oor:name="Label" oor:type="xs:string">
-+ <value xml:lang="en-US">VBA Enabled</value>
-+ </prop>
-+ </node>
- <node oor:name=".uno:Gallery" oor:op="replace">
- <prop oor:name="Label" oor:type="xs:string">
- <value xml:lang="en-US">~Gallery</value>
-diff --git sfx2/inc/sfx2/sfxsids.hrc sfx2/inc/sfx2/sfxsids.hrc
-index 0b61bb6..672a667 100644
---- sfx2/inc/sfx2/sfxsids.hrc
-+++ sfx2/inc/sfx2/sfxsids.hrc
-@@ -1197,6 +1197,7 @@
- #define SID_BASICIDE_ARG_DOCUMENT_MODEL ( SID_BASICIDE_START + 51 )
- #define SID_BASICIDE_MANAGE_LANG ( SID_BASICIDE_START + 52 )
- #define SID_BASICIDE_CURRENT_LANG ( SID_BASICIDE_START + 53 )
-+#define SID_BASICIDE_VBAENABLED ( SID_BASICIDE_START + 54 )
-
- // SlotIds f"ur Apps --------------------------------------------------------
- #define FN_PARAM (SID_SW_START + 1100)
-diff --git sfx2/sdi/sfx.sdi sfx2/sdi/sfx.sdi
-index e5c5be8..55fe3fb 100644
---- sfx2/sdi/sfx.sdi
-+++ sfx2/sdi/sfx.sdi
-@@ -1036,6 +1036,33 @@ SfxStringItem ChooseMacro SID_BASICIDE_CHOOSEMACRO
- ]
-
- //--------------------------------------------------------------------------
-+SfxBoolItem VBAEnabled SID_BASICIDE_VBAENABLED
-+
-+[
-+ /* flags: */
-+ AutoUpdate = TRUE,
-+ Cachable = Cachable,
-+ FastCall = FALSE,
-+ HasCoreId = FALSE,
-+ HasDialog = FALSE,
-+ ReadOnlyDoc = TRUE,
-+ Toggle = FALSE,
-+ Container = TRUE,
-+ RecordAbsolute = FALSE,
-+ NoRecord;
-+ Synchron;
-+
-+ Readonly = FALSE,
-+
-+ /* config: */
-+ AccelConfig = TRUE,
-+ MenuConfig = TRUE,
-+ StatusBarConfig = FALSE,
-+ ToolBoxConfig = TRUE,
-+ GroupId = GID_MACRO;
-+]
-+
-+//--------------------------------------------------------------------------
- SfxVoidItem ClearHistory SID_CLEARHISTORY
- ()
- [
diff --git a/patches/vba/native-export/vba-userform-geometry-tweak.diff b/patches/vba/native-export/vba-userform-geometry-tweak.diff
deleted file mode 100644
index b8db99334..000000000
--- a/patches/vba/native-export/vba-userform-geometry-tweak.diff
+++ /dev/null
@@ -1,415 +0,0 @@
-diff --git basctl/source/basicide/baside3.cxx basctl/source/basicide/baside3.cxx
-index e89c22f..a0e9f1b 100644
---- basctl/source/basicide/baside3.cxx
-+++ basctl/source/basicide/baside3.cxx
-@@ -82,6 +82,7 @@
- #include <com/sun/star/resource/XStringResourceResolver.hpp>
- #include <com/sun/star/resource/StringResourceWithLocation.hpp>
- #include <com/sun/star/task/XInteractionHandler.hpp>
-+#include <com/sun/star/script/XBasicLibraryInfo.hpp>
-
- using namespace comphelper;
- using namespace ::com::sun::star;
-@@ -114,6 +115,23 @@ DialogWindow::DialogWindow( Window* pPar
-
- pEditor = new DlgEditor( rDocument.getDocument() );
- pEditor->SetWindow( this );
-+ // set vba mode on DialogModel ( allows it to work in 100thmm instead of MAP_APPFONT )
-+ if ( rDocument.getDocument().is() )
-+ {
-+ uno::Reference< script::XBasicLibraryInfo > xLibInfo( rDocument.getLibraryContainer( E_SCRIPTS ), uno::UNO_QUERY );
-+ if ( xLibInfo.is() && xLibInfo->getVBACompatMode() )
-+ {
-+ try
-+ {
-+ Reference< beans::XPropertySet > xDlgProps( xDialogModel, UNO_QUERY_THROW );
-+ xDlgProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VBAForm") ), makeAny( sal_True ) );
-+ }
-+ catch( Exception& )
-+ {
-+ }
-+
-+ }
-+ }
- pEditor->SetDialog( xDialogModel );
-
- // Undo einrichten
-diff --git basctl/source/dlged/dlgedobj.cxx basctl/source/dlged/dlgedobj.cxx
-index bed7bc3..ae7df5c 100644
---- basctl/source/dlged/dlgedobj.cxx
-+++ basctl/source/dlged/dlgedobj.cxx
-@@ -56,6 +56,7 @@
- #include <com/sun/star/beans/XPropertySet.hpp>
- #include <com/sun/star/beans/PropertyAttribute.hpp>
- #include <com/sun/star/script/XScriptEventsSupplier.hpp>
-+#include <com/sun/star/script/XBasicLibraryInfo.hpp>
- #include <com/sun/star/container/XContainer.hpp>
- #include <com/sun/star/lang/XServiceInfo.hpp>
- #include <comphelper/processfactory.hxx>
-@@ -77,6 +78,22 @@ TYPEINIT1(DlgEdObj, SdrUnoObj);
- DBG_NAME(DlgEdObj);
-
- //----------------------------------------------------------------------------
-+MapMode lcl_getMapModeForForm( DlgEdForm* pForm )
-+{
-+ MapMode aMode( MAP_APPFONT ); //Default
-+ try
-+ {
-+ uno::Reference< beans::XPropertySet > xProps( pForm ? pForm->GetUnoControlModel() : NULL, uno::UNO_QUERY_THROW );
-+ sal_Bool bVBAForm = sal_False;
-+ xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VBAForm") ) ) >>= bVBAForm;
-+ if ( bVBAForm )
-+ aMode = MapMode( MAP_100TH_MM );
-+ }
-+ catch ( Exception& )
-+ {
-+ }
-+ return aMode;
-+}
-
- DlgEdObj::DlgEdObj()
- :SdrUnoObj(String(), sal_False)
-@@ -207,8 +224,9 @@ bool DlgEdObj::TransformSdrToControlCoor
- }
-
- // convert pixel to logic units
-- aPos = pDevice->PixelToLogic( aPos, MapMode( MAP_APPFONT ) );
-- aSize = pDevice->PixelToLogic( aSize, MapMode( MAP_APPFONT ) );
-+ MapMode aConvMode = lcl_getMapModeForForm( pForm );
-+ aPos = pDevice->PixelToLogic( aPos, aConvMode );
-+ aSize = pDevice->PixelToLogic( aSize, aConvMode );
-
- // set out parameters
- nXOut = aPos.Width();
-@@ -255,10 +273,10 @@ bool DlgEdObj::TransformSdrToFormCoordin
- aSize.Width() -= aDeviceInfo.LeftInset + aDeviceInfo.RightInset;
- aSize.Height() -= aDeviceInfo.TopInset + aDeviceInfo.BottomInset;
- }
--
-+ MapMode aConvMode = lcl_getMapModeForForm( pForm );
- // convert pixel to logic units
-- aPos = pDevice->PixelToLogic( aPos, MapMode( MAP_APPFONT ) );
-- aSize = pDevice->PixelToLogic( aSize, MapMode( MAP_APPFONT ) );
-+ aPos = pDevice->PixelToLogic( aPos, aConvMode );
-+ aSize = pDevice->PixelToLogic( aSize, aConvMode );
-
- // set out parameters
- nXOut = aPos.Width();
-@@ -300,9 +318,10 @@ bool DlgEdObj::TransformControlToSdrCoor
- DBG_ASSERT( pDevice, "DlgEdObj::TransformControlToSdrCoordinates: missing default device!" );
- if ( !pDevice )
- return false;
-- aPos = pDevice->LogicToPixel( aPos, MapMode( MAP_APPFONT ) );
-- aSize = pDevice->LogicToPixel( aSize, MapMode( MAP_APPFONT ) );
-- aFormPos = pDevice->LogicToPixel( aFormPos, MapMode( MAP_APPFONT ) );
-+ MapMode aConvMode = lcl_getMapModeForForm( pForm );
-+ aPos = pDevice->LogicToPixel( aPos, aConvMode );
-+ aSize = pDevice->LogicToPixel( aSize, aConvMode );
-+ aFormPos = pDevice->LogicToPixel( aFormPos, aConvMode );
-
- // add form position
- aPos.Width() += aFormPos.Width();
-@@ -346,14 +365,16 @@ bool DlgEdObj::TransformFormToSdrCoordin
- DBG_ASSERT( pDevice, "DlgEdObj::TransformFormToSdrCoordinates: missing default device!" );
- if ( !pDevice )
- return false;
-- aPos = pDevice->LogicToPixel( aPos, MapMode( MAP_APPFONT ) );
-- aSize = pDevice->LogicToPixel( aSize, MapMode( MAP_APPFONT ) );
-
- // take window borders into account
- DlgEdForm* pForm = NULL;
- if ( !lcl_getDlgEdForm( this, pForm ) )
- return false;
-
-+ MapMode aConvMode = lcl_getMapModeForForm( pForm );
-+ aPos = pDevice->LogicToPixel( aPos, aConvMode );
-+ aSize = pDevice->LogicToPixel( aSize, aConvMode );
-+
- // take window borders into account
- Reference< beans::XPropertySet > xPSetForm( pForm->GetUnoControlModel(), UNO_QUERY );
- DBG_ASSERT( xPSetForm.is(), "DlgEdObj::TransformFormToSdrCoordinates: no form property set!" );
-diff --git svx/inc/svxmsbas.hxx svx/inc/svxmsbas.hxx
-index f99247b..5e87fe6 100644
---- svx/inc/svxmsbas.hxx
-+++ svx/inc/svxmsbas.hxx
-@@ -99,7 +99,7 @@ private:
- const String &rSubStorageName,
- BOOL bAsComment, BOOL bStripped );
- SVX_DLLPRIVATE bool ImportForms_Impl(const String& rStorageName,
-- const String &rSubStorageName);
-+ const String &rSubStorageName, BOOL bVBAMode );
- SVX_DLLPRIVATE BOOL CopyStorage_Impl( const String& rStorageName,
- const String &rSubStorageName);
- };
-diff --git svx/source/msfilter/msocximex.cxx svx/source/msfilter/msocximex.cxx
-index 1075424..46986eb 100644
---- svx/source/msfilter/msocximex.cxx
-+++ svx/source/msfilter/msocximex.cxx
-@@ -1075,6 +1075,9 @@ sal_Bool OCX_Control::Import(
- sal_Bool OCX_Control::Import(uno::Reference<container::XNameContainer> &rDialog
- )
- {
-+ uno::Reference<beans::XPropertySet > xDlgProps( rDialog, uno::UNO_QUERY);
-+
-+
- uno::Reference<lang::XMultiServiceFactory>
- xFactory(rDialog, uno::UNO_QUERY);
-
-@@ -1087,11 +1090,15 @@ sal_Bool OCX_Control::Import(uno::Refere
- if (!xModel.is())
- return sal_False;
-
-+ sal_Bool bVBA = sal_False;
- /* #147900# sometimes insertion of a control fails due to existing name,
- do not break entire form import then... */
- try
- {
- rDialog->insertByName(sName, uno::makeAny(xModel));
-+ if ( xDlgProps.is() )
-+ xDlgProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("VBAForm") ) ) >>= bVBA;
-+
- }
- catch( uno::Exception& )
- {
-@@ -1107,16 +1114,32 @@ sal_Bool OCX_Control::Import(uno::Refere
-
- if (!Import(xPropSet))
- return sal_False;
--
-+
- uno::Any aTmp;
-- aTmp <<= sal_Int32((mnLeft * 2) / 100);
-- xPropSet->setPropertyValue(WW8_ASCII2STR("PositionX"), aTmp);
-- aTmp <<= sal_Int32((mnTop * 2) / 100);
-- xPropSet->setPropertyValue(WW8_ASCII2STR("PositionY"), aTmp);
-- aTmp <<= sal_Int32((nWidth * 2) / 100);
-- xPropSet->setPropertyValue(WW8_ASCII2STR("Width"), aTmp);
-- aTmp <<= sal_Int32((nHeight * 2) / 100);
-- xPropSet->setPropertyValue(WW8_ASCII2STR("Height"), aTmp);
-+ sal_Int32 nFactor = 3528;
-+
-+ if ( !bVBA )
-+ {
-+ aTmp <<= sal_Int32((mnLeft * 2) / 100);
-+ xPropSet->setPropertyValue(WW8_ASCII2STR("PositionX"), aTmp);
-+ aTmp <<= sal_Int32((mnTop * 2) / 100);
-+ xPropSet->setPropertyValue(WW8_ASCII2STR("PositionY"), aTmp);
-+ aTmp <<= sal_Int32((nWidth * 2) / 100);
-+ xPropSet->setPropertyValue(WW8_ASCII2STR("Width"), aTmp);
-+ aTmp <<= sal_Int32((nHeight * 2) / 100);
-+ xPropSet->setPropertyValue(WW8_ASCII2STR("Height"), aTmp);
-+ }
-+ else
-+ {
-+ aTmp <<= sal_Int32(mnLeft); // 100thmm
-+ xPropSet->setPropertyValue(WW8_ASCII2STR("PositionX"), aTmp);
-+ aTmp <<= sal_Int32(mnTop); //100th mm
-+ xPropSet->setPropertyValue(WW8_ASCII2STR("PositionY"), aTmp);
-+ aTmp <<= sal_Int32(nWidth); // 100thmm
-+ xPropSet->setPropertyValue(WW8_ASCII2STR("Width"), aTmp);
-+ aTmp <<= sal_Int32(nHeight); //100th mm
-+ xPropSet->setPropertyValue(WW8_ASCII2STR("Height"), aTmp);
-+ }
- if ( msToolTip.Len() > 0 )
- {
- uno::Any aTmp(&msToolTip,getCppuType((OUString *)0));
-@@ -4321,6 +4344,8 @@ sal_Bool OCX_UserForm::Import(
- {
- uno::Reference<beans::XPropertySet>
- xDialogPropSet(mxParent, uno::UNO_QUERY);
-+ if ( !xDialogPropSet.is() )
-+ return sal_False;
- uno::Any aTmp(&sName,getCppuType((OUString *)0));
- xDialogPropSet->setPropertyValue(
- OUString(RTL_CONSTASCII_USTRINGPARAM("Name")), aTmp);
-@@ -4328,11 +4353,32 @@ sal_Bool OCX_UserForm::Import(
- OUString(RTL_CONSTASCII_USTRINGPARAM("Title")), aTmp);
- aTmp <<= ImportColor(mnBackColor);
- xDialogPropSet->setPropertyValue( WW8_ASCII2STR("BackgroundColor"), aTmp);
-+ sal_Bool bVBA = sal_False;
-+ // Ok we are importing xls but maybe we aren't in VBA mode
-+ // if we are not in VBA mode then we should import sizes etc. ( as before )
-+ try
-+ {
-+ xDialogPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("VBAForm") ) ) >>= bVBA;
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ }
-+ sal_Int32 nFactor( 3528 );
-+ if ( !bVBA )
-+ {
-+ aTmp <<= sal_Int32((nWidth * 2) / 100);
-+ xDialogPropSet->setPropertyValue(WW8_ASCII2STR("Width"), aTmp);
-+ aTmp <<= sal_Int32((nHeight * 2) / 100);
-+ xDialogPropSet->setPropertyValue(WW8_ASCII2STR("Height"), aTmp);
-+ }
-+ else
-+ {
-+ aTmp <<= sal_Int32( nWidth + 160 ); // 100thmm
-+ xDialogPropSet->setPropertyValue(WW8_ASCII2STR("Width"), aTmp);
-+ aTmp <<= sal_Int32(nHeight + 662 - 714); //100th mm
-+ xDialogPropSet->setPropertyValue(WW8_ASCII2STR("Height"), aTmp);
-+ }
-
-- aTmp <<= sal_Int32((nWidth * 2) / 100);
-- xDialogPropSet->setPropertyValue(WW8_ASCII2STR("Width"), aTmp);
-- aTmp <<= sal_Int32((nHeight * 2) / 100);
-- xDialogPropSet->setPropertyValue(WW8_ASCII2STR("Height"), aTmp);
-
- uno::Reference<beans::XPropertySet> xPropSet( mxParent, uno::UNO_QUERY );
- OCX_ContainerControl::Import( xPropSet );
-diff --git svx/source/msfilter/svxmsbas.cxx svx/source/msfilter/svxmsbas.cxx
-index df541c2..a1b9869 100644
---- svx/source/msfilter/svxmsbas.cxx
-+++ svx/source/msfilter/svxmsbas.cxx
-@@ -91,7 +91,7 @@ int SvxImportMSVBasic::Import( const Str
- nRet |= 1;
-
- if (bImport)
-- ImportForms_Impl(rStorageName, rSubStorageName);
-+ ImportForms_Impl(rStorageName, rSubStorageName, !bAsComment);
-
- if( bCopy && CopyStorage_Impl( rStorageName, rSubStorageName ))
- nRet |= 2;
-@@ -100,7 +100,7 @@ int SvxImportMSVBasic::Import( const Str
- }
-
- bool SvxImportMSVBasic::ImportForms_Impl(const String& rStorageName,
-- const String& rSubStorageName)
-+ const String& rSubStorageName, BOOL bVBAMode )
- {
- SvStorageRef xVBAStg(xRoot->OpenSotStorage(rStorageName,
- STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYALL));
-@@ -184,7 +184,17 @@ bool SvxImportMSVBasic::ImportForms_Impl
- xSF->createInstance(
- OUString(RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.awt.UnoControlDialogModel"))), uno::UNO_QUERY);
--
-+ // #FIXME HACK - mark the Model with the VBA mode
-+ // In vba mode the imported userform uses 100th mm as units
-+ // or geometry
-+ // In non vba mode MAP_APPFONT is used ( same as normal basic
-+ // dialogs
-+ if ( bVBAMode )
-+ {
-+ Reference<XPropertySet> xDlgProps(xDialog, UNO_QUERY);
-+ if ( xDlgProps.is() )
-+ xDlgProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VBAForm") ), uno::makeAny( sal_True ) );
-+ }
- OCX_UserForm aForm(xVBAStg, *aIter, *aIter, xDialog, xSF );
- aForm.pDocSh = &rDocSh;
- sal_Bool bOk = aForm.Read(xTypes);
-diff --git toolkit/inc/toolkit/helper/property.hxx toolkit/inc/toolkit/helper/property.hxx
-index db61c94..1abcda6 100644
---- toolkit/inc/toolkit/helper/property.hxx
-+++ toolkit/inc/toolkit/helper/property.hxx
-@@ -190,6 +190,7 @@ namespace rtl {
- #define BASEPROPERTY_CUSTOMUNITTEXT 136 // ::rtl::OUString
- #define BASEPROPERTY_ENABLEVISIBLE 137 // sal_Bool
- #define BASEPROPERTY_GROUPNAME 138 // ::rtl::OUString
-+#define BASEPROPERTY_VBAFORM 139 // sal_Bool
-
- // Keine gebundenen Properties, werden immer aus der Property BASEPROPERTY_FONTDESCRIPTOR entnommen.
- #define BASEPROPERTY_FONTDESCRIPTORPART_START 1000
-diff --git toolkit/source/controls/dialogcontrol.cxx toolkit/source/controls/dialogcontrol.cxx
-index be06bbb..f976562 100644
---- toolkit/source/controls/dialogcontrol.cxx
-+++ toolkit/source/controls/dialogcontrol.cxx
-@@ -80,6 +80,7 @@ using namespace ::com::sun::star::lang;
- using namespace ::com::sun::star::container;
- using namespace ::com::sun::star::beans;
- using namespace ::com::sun::star::util;
-+using namespace ::com::sun::star::script;
- using namespace toolkit;
-
- #define PROPERTY_RESOURCERESOLVER ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ))
-@@ -289,6 +290,8 @@ UnoControlDialogModel::UnoControlDialogM
- aBool <<= (sal_Bool) sal_True;
- ImplRegisterProperty( BASEPROPERTY_MOVEABLE, aBool );
- ImplRegisterProperty( BASEPROPERTY_CLOSEABLE, aBool );
-+ aBool <<= (sal_Bool) sal_False;
-+ ImplRegisterProperty( BASEPROPERTY_VBAFORM, aBool );
- }
-
- UnoControlDialogModel::UnoControlDialogModel( const UnoControlDialogModel& rModel )
-@@ -1475,17 +1478,32 @@ void UnoDialogControl::ImplSetPosSize( R
- xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" ) ) ) >>= nWidth;
- xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) ) >>= nHeight;
-
-- // Currentley we are simply using MAP_APPFONT
-+ // Currentley we are simply using MAP_APPFONT ( for normal Dialogs )
-+ // and MAP_100TH_MM for imported Userforms
-+ MapMode aMode( MAP_APPFONT );
-+ sal_Bool bVBAForm = sal_False;
-+ Reference< XPropertySet > xDlgModelProps( getModel(), UNO_QUERY );
-+ if ( xDlgModelProps.is() )
-+ {
-+ try
-+ {
-+ xDlgModelProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAForm" ) ) ) >>= bVBAForm;
-+ }
-+ catch( Exception& )
-+ {
-+ }
-+ }
-+ if ( bVBAForm )
-+ aMode = MapMode( MAP_100TH_MM );
- OutputDevice*pOutDev = Application::GetDefaultDevice();
-- DBG_ASSERT( pOutDev, "Missing Default Device!" );
- if ( pOutDev )
- {
- ::Size aTmp( nX, nY );
-- aTmp = pOutDev->LogicToPixel( aTmp, MAP_APPFONT );
-+ aTmp = pOutDev->LogicToPixel( aTmp, aMode );
- nX = aTmp.Width();
- nY = aTmp.Height();
- aTmp = ::Size( nWidth, nHeight );
-- aTmp = pOutDev->LogicToPixel( aTmp, MAP_APPFONT );
-+ aTmp = pOutDev->LogicToPixel( aTmp, aMode );
- nWidth = aTmp.Width();
- nHeight = aTmp.Height();
- }
-diff --git toolkit/source/helper/property.cxx toolkit/source/helper/property.cxx
-index a7fc25b..8d1ee74 100644
---- toolkit/source/helper/property.cxx
-+++ toolkit/source/helper/property.cxx
-@@ -271,7 +271,8 @@ ImplPropertyInfo* ImplGetPropertyInfos(
- DECL_PROP_2 ( "InvokesStopNodeEditing", TREE_INVOKESSTOPNODEEDITING, sal_Bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "DialogSourceURL", DIALOGSOURCEURL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "URL", URL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
-- DECL_PROP_2 ( "EnableVisible", ENABLEVISIBLE, sal_Bool, BOUND, MAYBEDEFAULT )
-+ DECL_PROP_2 ( "EnableVisible", ENABLEVISIBLE, sal_Bool, BOUND, MAYBEDEFAULT ),
-+ DECL_PROP_2 ( "VBAForm", VBAFORM, sal_Bool, BOUND, MAYBEDEFAULT ),
- };
- pPropertyInfos = aImplPropertyInfos;
- nElements = sizeof( aImplPropertyInfos ) / sizeof( ImplPropertyInfo );
-diff --git xmlscript/source/xmldlg_imexp/xmldlg_import.cxx xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
-index e4f6647..64131f7 100644
---- xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
-+++ xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
-@@ -1916,9 +1916,22 @@ Reference< xml::sax::XDocumentHandler >
- Reference< XModel > const & xDocument )
- SAL_THROW( (Exception) )
- {
-+ DialogImport* pImport = new DialogImport( xContext, xDialogModel, xDocument );
-+ uno::Reference< script::XBasicLibraryInfo > xVBAModeSource( pImport->getScriptLibraryInfo(), uno::UNO_QUERY );
-+ uno::Reference< beans::XPropertySet > xDlgProps( xDialogModel, uno::UNO_QUERY );
-+ OSL_TRACE("importDialogModel xVBAModeSource %d, xDialogModel %d", xVBAModeSource.is(), xDlgProps.is() );
-+ if ( xVBAModeSource.is() && xVBAModeSource->getVBACompatMode() && xDlgProps.is() )
-+ {
-+ try
-+ {
-+ xDlgProps->setPropertyValue( OUSTR("VBAForm"), uno::makeAny( sal_True ) );
-+ }
-+ catch( Exception& )
-+ {
-+ }
-+ }
- return ::xmlscript::createDocumentHandler(
-- static_cast< xml::input::XRoot * >(
-- new DialogImport( xContext, xDialogModel, xDocument ) ) );
-+ static_cast< xml::input::XRoot * >( pImport ) );
- }
-
- }
diff --git a/patches/vba/native-export/vbainfo-import-export-support-alternative-unkownstatus.diff b/patches/vba/native-export/vbainfo-import-export-support-alternative-unkownstatus.diff
deleted file mode 100644
index 87ef732a9..000000000
--- a/patches/vba/native-export/vbainfo-import-export-support-alternative-unkownstatus.diff
+++ /dev/null
@@ -1,2150 +0,0 @@
-diff --git basctl/source/basicide/baside3.cxx basctl/source/basicide/baside3.cxx
-index 8d11a16..a0e9f1b 100644
---- basctl/source/basicide/baside3.cxx
-+++ basctl/source/basicide/baside3.cxx
-@@ -82,7 +82,7 @@
- #include <com/sun/star/resource/XStringResourceResolver.hpp>
- #include <com/sun/star/resource/StringResourceWithLocation.hpp>
- #include <com/sun/star/task/XInteractionHandler.hpp>
--#include <com/sun/star/script/XVBACompat.hpp>
-+#include <com/sun/star/script/XBasicLibraryInfo.hpp>
-
- using namespace comphelper;
- using namespace ::com::sun::star;
-@@ -118,10 +118,19 @@ DialogWindow::DialogWindow( Window* pPar
- // set vba mode on DialogModel ( allows it to work in 100thmm instead of MAP_APPFONT )
- if ( rDocument.getDocument().is() )
- {
-- uno::Reference< script::XVBACompat > xDocVBAMode( rDocument.getLibraryContainer( E_SCRIPTS ), uno::UNO_QUERY );
-- uno::Reference< script::XVBACompat > xDialogModelVBAMode( xDialogModel, uno::UNO_QUERY );
-- if ( xDocVBAMode.is() && xDialogModelVBAMode.is() )
-- xDialogModelVBAMode->setVBACompatModeOn( xDocVBAMode->getVBACompatModeOn() );
-+ uno::Reference< script::XBasicLibraryInfo > xLibInfo( rDocument.getLibraryContainer( E_SCRIPTS ), uno::UNO_QUERY );
-+ if ( xLibInfo.is() && xLibInfo->getVBACompatMode() )
-+ {
-+ try
-+ {
-+ Reference< beans::XPropertySet > xDlgProps( xDialogModel, UNO_QUERY_THROW );
-+ xDlgProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VBAForm") ), makeAny( sal_True ) );
-+ }
-+ catch( Exception& )
-+ {
-+ }
-+
-+ }
- }
- pEditor->SetDialog( xDialogModel );
-
-diff --git basctl/source/basicide/basides2.cxx basctl/source/basicide/basides2.cxx
-index 981de5b..3956971 100644
---- basctl/source/basicide/basides2.cxx
-+++ basctl/source/basicide/basides2.cxx
-@@ -55,7 +55,7 @@
- #include <tools/diagnose_ex.h>
- #include <sfx2/sfxdefs.hxx>
- #include <sfx2/signaturestate.hxx>
--#include <com/sun/star/script/ModuleInfo.hpp>
-+#include <com/sun/star/script/XBasicLibraryInfo.hpp>
- #include <com/sun/star/container/XNameContainer.hpp>
- #include <com/sun/star/container/XNamed.hpp>
- #include <com/sun/star/lang/XServiceInfo.hpp>
-@@ -66,15 +66,14 @@ namespace css = ::com::sun::star;
-
- void lcl_getObjectName( const uno::Reference< container::XNameContainer >& rLib, const String& rModName, String& rObjName )
- {
-- uno::Any aElement( rLib->getByName( rModName ) );
-- script::ModuleInfo aModuleInfo;
-- if( aElement >>= aModuleInfo )
-+ Reference< script::XBasicLibraryInfo > xLibInfo( rLib, UNO_QUERY );
-+ if ( xLibInfo.is() && xLibInfo->getVBACompatMode() )
- {
-- uno::Any aObject( aModuleInfo.ModuleObject );
-- uno::Reference< lang::XServiceInfo > xServiceInfo( aObject, uno::UNO_QUERY );
-+ script::ModuleInfo aModuleInfo = xLibInfo->getModuleInfo( rModName );
-+ uno::Reference< lang::XServiceInfo > xServiceInfo( aModuleInfo.ModuleObject, uno::UNO_QUERY );
- if( xServiceInfo.is() && xServiceInfo->supportsService( rtl::OUString::createFromAscii( "org.openoffice.excel.Worksheet" ) ) )
- {
-- uno::Reference< container::XNamed > xNamed( aObject, uno::UNO_QUERY );
-+ uno::Reference< container::XNamed > xNamed( aModuleInfo.ModuleObject, uno::UNO_QUERY );
- if( xNamed.is() )
- rObjName = xNamed->getName();
- }
-diff --git basctl/source/basicide/bastype2.cxx basctl/source/basicide/bastype2.cxx
-index faa53e3..94a981c 100644
---- basctl/source/basicide/bastype2.cxx
-+++ basctl/source/basicide/bastype2.cxx
-@@ -55,7 +55,7 @@
- #include <comphelper/componentcontext.hxx>
- #include <map>
- #include <com/sun/star/script/ModuleType.hpp>
--#include <com/sun/star/script/ModuleInfo.hpp>
-+#include <com/sun/star/script/XBasicLibraryInfo.hpp>
- #include <com/sun/star/container/XNameContainer.hpp>
-
- using namespace ::com::sun::star::uno;
-@@ -66,10 +66,12 @@ void lcl_getObjectName( const uno::Refer
- sal_Int32 lcl_getModuleType( const uno::Reference< container::XNameContainer >& rLib, const String& rModName )
- {
- sal_Int32 nType = com::sun::star::script::ModuleType::Unknown;
-- uno::Any aElement( rLib->getByName( rModName ) );
-- script::ModuleInfo aModuleInfo;
-- if( aElement >>= aModuleInfo )
-+ Reference< script::XBasicLibraryInfo > xLibInfo( rLib, UNO_QUERY );
-+ if ( xLibInfo.is() && xLibInfo->getVBACompatMode() )
-+ {
-+ script::ModuleInfo aModuleInfo = xLibInfo->getModuleInfo( rModName );
- nType = aModuleInfo.ModuleType;
-+ }
- return nType;
- }
-
-diff --git basctl/source/basicide/scriptdocument.cxx basctl/source/basicide/scriptdocument.cxx
-index 7e48d82..0d867b8 100644
---- basctl/source/basicide/scriptdocument.cxx
-+++ basctl/source/basicide/scriptdocument.cxx
-@@ -56,7 +56,7 @@
- #include <com/sun/star/frame/XModel2.hpp>
- #include <com/sun/star/awt/XWindow2.hpp>
- #include <com/sun/star/document/XEmbeddedScripts.hpp>
--#include <com/sun/star/script/ModuleInfo.hpp>
-+#include <com/sun/star/script/XBasicLibraryInfo.hpp>
- /** === end UNO includes === **/
-
- #include <sfx2/objsh.hxx>
-@@ -144,6 +144,7 @@ namespace basctl
- using ::com::sun::star::document::XEventBroadcaster;
- using ::com::sun::star::document::XEmbeddedScripts;
- using ::com::sun::star::script::ModuleInfo;
-+ using ::com::sun::star::script::XBasicLibraryInfo;
- /** === end UNO using === **/
- namespace MacroExecMode = ::com::sun::star::document::MacroExecMode;
- namespace FrameSearchFlag = ::com::sun::star::frame::FrameSearchFlag;
-@@ -639,7 +640,10 @@ namespace basctl
- try
- {
- Reference< XNameContainer > xLib( getLibrary( _eType, _rLibName, TRUE ), UNO_QUERY_THROW );
--
-+ Reference< XBasicLibraryInfo > xLibInfo( xLib, UNO_QUERY );
-+ ModuleInfo sModuleInfo = xLibInfo->getModuleInfo( _rOldName );
-+ if ( xLibInfo.is() && xLibInfo->getVBACompatMode() )
-+ sModuleInfo = xLibInfo->getModuleInfo( _rOldName ); // grap old module info
- // get element
- Any aElement( xLib->getByName( _rOldName ) );
-
-@@ -678,10 +682,12 @@ namespace basctl
- // insert element by new name in container
- if ( _eType == E_SCRIPTS )
- {
-- ModuleInfo sModuleInfo;
-- if ( aElement >>= sModuleInfo )
-+ if ( xLibInfo.is() && xLibInfo->getVBACompatMode() )
- {
-+ rtl::OUString aMod;
-+ aElement >>= aMod; // grab the source
- sModuleInfo.ModuleName = _rNewName;
-+ sModuleInfo.ModuleSource = aMod;
- aElement <<= sModuleInfo;
- }
- }
-@@ -749,15 +755,9 @@ namespace basctl
- Reference< XNameContainer > xLib( getOrCreateLibrary( E_SCRIPTS, _rLibName ), UNO_QUERY_THROW );
- if ( !xLib->hasByName( _rModName ) )
- return false;
-- ModuleInfo mInfo;
- Any aMod;
-- if ( xLib->getByName( _rModName ) >>= mInfo )
-- {
-- mInfo.ModuleSource = _rModuleCode;
-- aMod <<= mInfo;
-- }
-- else
-- aMod <<= _rModuleCode;
-+ aMod <<= _rModuleCode;
-+OSL_TRACE("**** about to do a replace by name %s size of source %d", rtl::OUStringToOString( _rModName, RTL_TEXTENCODING_UTF8 ).getStr(), _rModuleCode.getLength() );
- xLib->replaceByName( _rModName, aMod );
- return true;
- }
-@@ -1411,15 +1411,7 @@ namespace basctl
- Any aCode;
- if ( !m_pImpl->getModuleOrDialog( E_SCRIPTS, _rLibName, _rModName, aCode ) )
- return false;
-- ModuleInfo sModuleInfo;
-- if ( aCode >>= sModuleInfo )
-- {
-- _out_rModuleSource = sModuleInfo.ModuleSource;
-- }
-- else
-- {
-- OSL_VERIFY( aCode >>= _out_rModuleSource );
-- }
-+ OSL_VERIFY( aCode >>= _out_rModuleSource );
- return true;
- }
-
-diff --git basctl/source/dlged/dlgedobj.cxx basctl/source/dlged/dlgedobj.cxx
-index 9a521a3..ae7df5c 100644
---- basctl/source/dlged/dlgedobj.cxx
-+++ basctl/source/dlged/dlgedobj.cxx
-@@ -56,7 +56,7 @@
- #include <com/sun/star/beans/XPropertySet.hpp>
- #include <com/sun/star/beans/PropertyAttribute.hpp>
- #include <com/sun/star/script/XScriptEventsSupplier.hpp>
--#include <com/sun/star/script/XVBACompat.hpp>
-+#include <com/sun/star/script/XBasicLibraryInfo.hpp>
- #include <com/sun/star/container/XContainer.hpp>
- #include <com/sun/star/lang/XServiceInfo.hpp>
- #include <comphelper/processfactory.hxx>
-@@ -81,9 +81,17 @@ DBG_NAME(DlgEdObj);
- MapMode lcl_getMapModeForForm( DlgEdForm* pForm )
- {
- MapMode aMode( MAP_APPFONT ); //Default
-- uno::Reference< script::XVBACompat > xVBA( pForm ? pForm->GetUnoControlModel() : NULL, uno::UNO_QUERY );
-- if ( xVBA.is() && xVBA->getVBACompatModeOn() )
-- aMode = MapMode( MAP_100TH_MM );
-+ try
-+ {
-+ uno::Reference< beans::XPropertySet > xProps( pForm ? pForm->GetUnoControlModel() : NULL, uno::UNO_QUERY_THROW );
-+ sal_Bool bVBAForm = sal_False;
-+ xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VBAForm") ) ) >>= bVBAForm;
-+ if ( bVBAForm )
-+ aMode = MapMode( MAP_100TH_MM );
-+ }
-+ catch ( Exception& )
-+ {
-+ }
- return aMode;
- }
-
-diff --git basctl/source/inc/dlged.hxx basctl/source/inc/dlged.hxx
-index 3db132a..2561fc3 100644
---- basctl/source/inc/dlged.hxx
-+++ basctl/source/inc/dlged.hxx
-@@ -136,7 +136,7 @@ protected:
- public:
- DlgEditor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel );
- ~DlgEditor();
--
-+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > getDocModel() { return m_xDocument; }
- void SetWindow( Window* pWindow );
- Window* GetWindow() const { return pWindow; }
-
-diff --git basic/inc/basic/basmgr.hxx basic/inc/basic/basmgr.hxx
-index 2674c59..3c4f364 100644
---- basic/inc/basic/basmgr.hxx
-+++ basic/inc/basic/basmgr.hxx
-@@ -113,9 +113,10 @@ struct LibraryContainerInfo
- ::com::sun::star::uno::Reference< com::sun::star::script::XPersistentLibraryContainer > mxScriptCont;
- ::com::sun::star::uno::Reference< com::sun::star::script::XPersistentLibraryContainer > mxDialogCont;
- OldBasicPassword* mpOldBasicPassword;
-+ bool mbVBACompatOn;
-
- LibraryContainerInfo()
-- :mpOldBasicPassword( NULL )
-+ :mpOldBasicPassword( NULL ), mbVBACompatOn( false )
- {
- }
-
-@@ -127,7 +128,7 @@ struct LibraryContainerInfo
- )
- : mxScriptCont( xScriptCont )
- , mxDialogCont( xDialogCont )
-- , mpOldBasicPassword( pOldBasicPassword )
-+ , mpOldBasicPassword( pOldBasicPassword ), mbVBACompatOn( false )
- {}
- };
-
-diff --git basic/source/basmgr/basmgr.cxx basic/source/basmgr/basmgr.cxx
-index 1c8962c..f595e39 100644
---- basic/source/basmgr/basmgr.cxx
-+++ basic/source/basmgr/basmgr.cxx
-@@ -70,7 +70,7 @@
- #include <com/sun/star/script/XLibraryContainerPassword.hpp>
- #include <com/sun/star/script/ModuleInfo.hpp>
- #include <com/sun/star/script/ModuleType.hpp>
--
-+#include <com/sun/star/script/XBasicLibraryInfo.hpp>
- #include <cppuhelper/implbase1.hxx>
-
- using com::sun::star::uno::Reference;
-@@ -239,6 +239,12 @@ void BasMgrContainerListenerImpl::addLib
-
- StarBASIC* pLib = pMgr->GetLib( aLibName );
- DBG_ASSERT( pLib, "BasMgrContainerListenerImpl::addLibraryModulesImpl: Unknown lib!");
-+ Reference< XBasicLibraryInfo > xLibInfo( xLibNameAccess, UNO_QUERY );
-+ if ( xLibInfo.is() && xLibInfo->getVBACompatMode() )
-+ pLib->SetVBAEnabled( true );
-+
-+ OSL_TRACE("addLibraryModulesImpl libname %s, xLibInfo %d", rtl::OUStringToOString( aLibName, RTL_TEXTENCODING_UTF8 ).getStr(), xLibInfo.is() );
-+
- if( pLib )
- {
- const ::rtl::OUString* pNames = aModuleNames.getConstArray();
-@@ -246,16 +252,18 @@ void BasMgrContainerListenerImpl::addLib
- {
- ::rtl::OUString aModuleName = pNames[ j ];
- Any aElement = xLibNameAccess->getByName( aModuleName );
-- ModuleInfo mInfo;
-- if ( aElement >>= mInfo )
-- {
-- OSL_TRACE("#addLibraryModulesImpl - aMod");
-+ ::rtl::OUString aMod;
-+ aElement >>= aMod;
-+
-+ if ( xLibInfo.is() && xLibInfo->getVBACompatMode() )
-+ {
-+ ModuleInfo mInfo = xLibInfo->getModuleInfo( pNames[ j ] );
-+ mInfo.ModuleSource = aMod;
-+ OSL_TRACE("#addLibraryModulesImpl - aMod - source size is %d", mInfo.ModuleSource.getLength());
- pLib->MakeModule32( mInfo );
- }
- else
- {
-- ::rtl::OUString aMod;
-- aElement >>= aMod;
- pLib->MakeModule32( aModuleName, aMod );
- }
- }
-@@ -284,8 +292,10 @@ void SAL_CALL BasMgrContainerListenerImp
- sal_Bool bLibContainer = ( maLibName.getLength() == 0 );
- ::rtl::OUString aName;
- Event.Accessor >>= aName;
-+ OSL_TRACE("ElementInserted %s ", rtl::OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr() );
-
- mpMgr->mpImpl->mbModifiedByLibraryContainer = sal_True;
-+ Reference< XBasicLibraryInfo > xLibInfo( Event.Source, UNO_QUERY );
-
- if( bLibContainer )
- {
-@@ -302,11 +312,11 @@ void SAL_CALL BasMgrContainerListenerImp
- SbModule* pMod = pLib->FindModule( aName );
- if( !pMod )
- {
-- ModuleInfo mInfo;
-- if( Event.Element >>= mInfo )
-+ if ( xLibInfo.is() && xLibInfo->getVBACompatMode() )
- {
-+ ModuleInfo mInfo = xLibInfo->getModuleInfo( aName );
- pLib->MakeModule32( mInfo );
-- }
-+ }
- else
- {
- ::rtl::OUString aMod;
-@@ -327,6 +337,7 @@ void SAL_CALL BasMgrContainerListenerImp
- ::rtl::OUString aName;
- Event.Accessor >>= aName;
-
-+ OSL_TRACE("ElementReplaced for Librarylelement %s ", rtl::OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr() );
- mpMgr->mpImpl->mbModifiedByLibraryContainer = sal_True;
-
- // Replace not possible for library container
-@@ -339,33 +350,24 @@ void SAL_CALL BasMgrContainerListenerImp
-
- if( pLib )
- {
-- SbModule* pMod = pLib->FindModule( aName );
-+ SbModule* pMod = pLib->FindModule( aName );
- ::rtl::OUString aMod;
-- ModuleInfo mInfo;
-- if( Event.Element >>= mInfo )
-- aMod = mInfo.ModuleSource;
-- else
-- Event.Element >>= aMod;
-+ Event.Element >>= aMod;
- if( pMod )
-- {
- pMod->SetSource32( aMod );
-- if ( mInfo.ModuleType == ModuleType::Document )
-+ else
-+ {
-+
-+ Reference< XBasicLibraryInfo > xLibInfo( Event.Source, UNO_QUERY );
-+ if ( xLibInfo.is() && xLibInfo->getVBACompatMode() )
- {
-- SbObjModule* pObjModule = dynamic_cast< SbObjModule* >( pMod );
-- if ( pObjModule )
-- pObjModule->SetUnoObject( makeAny( mInfo.ModuleObject ) );
-+ ModuleInfo mInfo = xLibInfo->getModuleInfo( aName );
-+ mInfo.ModuleSource = aMod;
-+ pLib->MakeModule32( mInfo );
- }
-- }
-- else
-- // Probably we should have an assert for
-- // unknow module type, e.g. either we are using
-- // the ModuleInfo structure ( vba ) for *all* modules
-- // or not ( normal )
-- if ( mInfo.ModuleType == ModuleType::Unknown )
-- pLib->MakeModule32( aName, aMod );
- else
-- pLib->MakeModule32( mInfo );
--
-+ pLib->MakeModule32( aName, aMod );
-+ }
- pLib->SetModified( FALSE );
- }
- }
-@@ -831,6 +833,12 @@ void BasicManager::SetLibraryContainerIn
-
- Reference< XLibraryContainer > xScriptCont( mpImpl->maContainerInfo.mxScriptCont.get() );
- StarBASIC* pStdLib = GetStdLib();
-+ Reference< XBasicLibraryInfo > xLibInfo( GetScriptLibraryContainer(), UNO_QUERY );
-+ if ( xLibInfo.is() )
-+ mpImpl->maContainerInfo.mbVBACompatOn = xLibInfo->getVBACompatMode();
-+ // Std is created regardless of any persisted Libraries, so.. we need
-+ // to make sure we set its compat mode here
-+ pStdLib->SetVBAEnabled( mpImpl->maContainerInfo.mbVBACompatOn );
- String aLibName = pStdLib->GetName();
- if( xScriptCont.is() )
- {
-diff --git basic/source/inc/namecont.hxx basic/source/inc/namecont.hxx
-index c099b01..b1c8409 100644
---- basic/source/inc/namecont.hxx
-+++ basic/source/inc/namecont.hxx
-@@ -65,21 +65,20 @@
- #include <cppuhelper/compbase7.hxx>
- #include <cppuhelper/compbase8.hxx>
- #include <cppuhelper/interfacecontainer.hxx>
--#include <com/sun/star/script/XVBACompat.hpp>
-+#include <com/sun/star/script/ModuleInfo.hpp>
-
- class BasicManager;
-
- namespace basic
- {
-
--typedef ::cppu::WeakComponentImplHelper8<
-+typedef ::cppu::WeakComponentImplHelper7<
- ::com::sun::star::lang::XInitialization,
- ::com::sun::star::script::XStorageBasedLibraryContainer,
- ::com::sun::star::script::XLibraryContainerPassword,
- ::com::sun::star::script::XLibraryContainerExport,
- ::com::sun::star::container::XContainer,
- ::com::sun::star::script::XLibraryQueryExecutable,
-- ::com::sun::star::script::XVBACompat,
- ::com::sun::star::lang::XServiceInfo > LibraryContainerHelper;
-
- typedef ::cppu::WeakImplHelper2< ::com::sun::star::container::XNameContainer,
-@@ -113,6 +112,11 @@ NameContainerNameMap;
-
-
- //============================================================================
-+class ItemConvertor
-+{
-+public:
-+ virtual bool convert(com::sun::star::uno::Any& item ) = 0;
-+};
-
- class NameContainer : public ::cppu::BaseMutex, public NameContainerHelper
- {
-@@ -136,7 +140,7 @@ public:
-
- void setEventSource( ::com::sun::star::uno::XInterface* pxEventSource )
- { mpxEventSource = pxEventSource; }
--
-+ virtual bool convertContainer( const ::com::sun::star::uno::Type& rNewType, ItemConvertor& aConvertor );
- // Methods XElementAccess
- virtual ::com::sun::star::uno::Type SAL_CALL getElementType( )
- throw(::com::sun::star::uno::RuntimeException);
-@@ -222,6 +226,8 @@ public:
- }
- };
-
-+typedef std::hash_map< rtl::OUString, com::sun::star::script::ModuleInfo, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > NameToInfoHash;
-+
- class SfxLibraryContainer :public LibraryContainerHelper
- ,public ::utl::OEventListenerAdapter
- {
-@@ -251,7 +257,7 @@ protected:
- sal_Bool mbOwnBasMgr;
-
- InitMode meInitMode;
--
-+ bool mbVBACompatModeOn;
- void implStoreLibrary( SfxLibrary* pLib,
- const ::rtl::OUString& aName,
- const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
-@@ -334,7 +340,7 @@ protected:
- virtual const sal_Char* SAL_CALL getOldInfoFileName() const = 0;
- virtual const sal_Char* SAL_CALL getLibElementFileExtension() const = 0;
- virtual const sal_Char* SAL_CALL getLibrariesDir() const = 0;
--
-+ virtual void convertLibraryEntries() { /*default bogus implementation*/}
- // Handle maLibInfoFileURL and maStorageURL correctly
- void checkStorageURL
- (
-@@ -503,9 +509,6 @@ public:
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
- throw (::com::sun::star::uno::RuntimeException) = 0;
-
-- // Methods XVBACompat
-- virtual ::sal_Bool SAL_CALL getVBACompatModeOn() throw (::com::sun::star::uno::RuntimeException);
-- virtual void SAL_CALL setVBACompatModeOn( ::sal_Bool _vbacompatmodeon ) throw (::com::sun::star::uno::RuntimeException);
- };
-
- class LibraryContainerMethodGuard
-@@ -581,6 +584,9 @@ protected:
- inline sal_Bool implIsModified() const { return mbIsModified; }
- void implSetModified( sal_Bool _bIsModified );
-
-+ ::xmlscript::ObjectModuleDescHash mhCodeNameToObjDesc;
-+ NameToInfoHash hBasicInfo;
-+
- private:
- /** checks whether the lib is readonly, or a readonly link, throws an IllegalArgumentException if so
- */
-@@ -660,6 +666,7 @@ public:
- virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference<
- ::com::sun::star::container::XContainerListener >& xListener )
- throw (::com::sun::star::uno::RuntimeException);
-+ virtual bool convertContainer( const ::com::sun::star::uno::Type& rNewType, ItemConvertor& aConvertor );
-
- protected:
- virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const = 0;
-diff --git basic/source/inc/scriptcont.hxx basic/source/inc/scriptcont.hxx
-index 1679b30..4f220bb 100644
---- basic/source/inc/scriptcont.hxx
-+++ basic/source/inc/scriptcont.hxx
-@@ -33,6 +33,9 @@
-
- #include "namecont.hxx"
- #include <basic/basmgr.hxx>
-+#include <com/sun/star/script/XBasicLibraryInfo.hpp>
-+#include <cppuhelper/implbase1.hxx>
-+#include <comphelper/uno3.hxx>
-
- class BasicManager;
-
-@@ -97,6 +100,7 @@ class SfxScriptLibraryContainer : public
- virtual const sal_Char* SAL_CALL getOldInfoFileName() const;
- virtual const sal_Char* SAL_CALL getLibElementFileExtension() const;
- virtual const sal_Char* SAL_CALL getLibrariesDir() const;
-+ virtual void convertLibraryEntries();
-
- public:
- SfxScriptLibraryContainer( void );
-@@ -140,12 +144,17 @@ public:
-
- //============================================================================
-
-+typedef std::hash_map< rtl::OUString, com::sun::star::script::ModuleInfo, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > NameToInfoHash;
-+
-+typedef ::cppu::ImplHelper1 < ::com::sun::star::script::XBasicLibraryInfo > SfxScriptLibrary_BASE;
- class SfxScriptLibrary : public SfxLibrary
-+ , public SfxScriptLibrary_BASE
- {
- friend class SfxScriptLibraryContainer;
-
- sal_Bool mbLoadedSource;
- sal_Bool mbLoadedBinary;
-+ sal_Bool mbVBA;
-
- // Provide modify state including resources
- virtual sal_Bool isModified( void );
-@@ -171,9 +180,36 @@ public:
- const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xSFI,
- const ::rtl::OUString& aLibInfoFileURL, const ::rtl::OUString& aStorageURL, sal_Bool ReadOnly
- );
--
-+ // XNameReplace
-+ virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement )
-+ throw(::com::sun::star::lang::IllegalArgumentException,
-+ ::com::sun::star::container::NoSuchElementException,
-+ ::com::sun::star::lang::WrappedTargetException,
-+ ::com::sun::star::uno::RuntimeException);
-+
-+ // Methods XNameContainer
-+ virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement )
-+ throw(::com::sun::star::lang::IllegalArgumentException,
-+ ::com::sun::star::container::ElementExistException,
-+ ::com::sun::star::lang::WrappedTargetException,
-+ ::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL removeByName( const ::rtl::OUString& Name )
-+ throw(::com::sun::star::container::NoSuchElementException,
-+ ::com::sun::star::lang::WrappedTargetException,
-+ ::com::sun::star::uno::RuntimeException);
- static bool containsValidModule( const ::com::sun::star::uno::Any& _rElement );
-+ DECLARE_XINTERFACE()
-+ DECLARE_XTYPEPROVIDER()
-+
-+ // XBasicLibraryInfo
-
-+ // Attributes
-+ virtual ::sal_Bool SAL_CALL getVBACompatMode() throw (::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL setVBACompatMode( ::sal_Bool _vbacompatmodeon ) throw (::com::sun::star::uno::RuntimeException);
-+
-+ // Methods
-+ virtual ::com::sun::star::script::ModuleInfo SAL_CALL getModuleInfo( const ::rtl::OUString& ModuleName ) throw (::com::sun::star::uno::RuntimeException);
-+
- protected:
- virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const;
- };
-diff --git basic/source/runtime/step2.cxx basic/source/runtime/step2.cxx
-index 1f659e1..7382974 100644
---- basic/source/runtime/step2.cxx
-+++ basic/source/runtime/step2.cxx
-@@ -39,6 +39,7 @@
- #include "sbintern.hxx"
- #include "sbunoobj.hxx"
- #include "opcodes.hxx"
-+#include "basic/sbobjmod.hxx"
-
- #include <com/sun/star/container/XIndexAccess.hpp>
- #include <com/sun/star/script/XDefaultMethod.hpp>
-@@ -708,7 +709,6 @@ void SbiRuntime::StepELEM( UINT32 nOp1,
- // #74254 Jetzt per Liste
- if( pObj )
- SaveRef( (SbxVariable*)pObj );
--
- PushVar( FindElement( pObj, nOp1, nOp2, SbERR_NO_METHOD, FALSE ) );
- }
-
-diff --git basic/source/uno/namecont.cxx basic/source/uno/namecont.cxx
-index ac96039..1941b88 100644
---- basic/source/uno/namecont.cxx
-+++ basic/source/uno/namecont.cxx
-@@ -75,11 +75,11 @@
- #endif
- #include <cppuhelper/exc_hlp.hxx>
- #include <basic/sbmod.hxx>
-+#include "sbunoobj.hxx"
-
--#ifndef _COM_SUN_STAR_SCRIPT_MODULEINFO_HPP_
- #include <com/sun/star/script/ModuleInfo.hpp>
--#endif
--
-+// temp include
-+#include <com/sun/star/script/XBasicLibraryInfo.hpp>
- namespace basic
- {
-
-@@ -104,12 +104,85 @@ using namespace osl;
-
- using com::sun::star::uno::Reference;
-
-+// #TODO move this to SfxLibrary ? probably we need to to gaurantee
-+// consistency
-+::xmlscript::ObjectModuleDescHash lcl_getObjModDescHash( SfxLibrary& rLib )
-+{
-+ uno::Sequence< ::rtl::OUString > sModuleNames = rLib.getElementNames();
-+ sal_Int32 nElem = sModuleNames.getLength();
-+ ::xmlscript::ObjectModuleDescHash hResult;
-+ for ( sal_Int32 i = 0; i < nElem; ++i )
-+ {
-+ ModuleInfo mInfo;
-+ rtl::OUString sCodeName( sModuleNames[ i ] );
-+ if ( rLib.getByName( sCodeName ) >>= mInfo )
-+ {
-+ ::xmlscript::ObjectModuleDesc aDesc;
-+ aDesc.mnModuleType = mInfo.ModuleType;
-+ switch ( mInfo.ModuleType )
-+ {
-+ case ModuleType::Form:
-+ aDesc.msObjectName = sCodeName;
-+ hResult[ sCodeName ] = aDesc;
-+ break;
-+ case ModuleType::Document:
-+ {
-+ Reference< XServiceInfo > xSI( mInfo.ModuleObject, UNO_QUERY );
-+ if ( xSI.is() && xSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.excel.Workbook" ) ) ) )
-+ aDesc.msObjectName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ThisWorkbook" ) );
-+ else
-+ {
-+ SbUnoObjectRef pSbUnoObject = new SbUnoObject( String(), uno::makeAny( mInfo.ModuleObject ) );
-+ SbxVariable* pVar = pSbUnoObject->Find( String( RTL_CONSTASCII_USTRINGPARAM("Name") ), SbxCLASS_DONTCARE );
-+ if ( pVar )
-+ {
-+ pVar->Broadcast( SBX_HINT_DATAWANTED );
-+ if ( pVar->SbxValue::GetType() == SbxSTRING )
-+ {
-+ aDesc.msObjectName = pVar->GetString();
-+ hResult[ sCodeName ] = aDesc;
-+ }
-+ }
-+ }
-+ }
-+ case ModuleType::Class:
-+ case ModuleType::Normal:
-+ break; // no codenames for these
-+ default:
-+ break; // shouldn't get here ( #TODO assertion or whatever )
-+ }
-+ }
-+ }
-+ return hResult;
-+}
-+
- // #i34411: Flag for error handling during migration
- static bool GbMigrationSuppressErrors = false;
-
- //============================================================================
- // Implementation class NameContainer
-
-+bool
-+NameContainer::convertContainer(const ::com::sun::star::uno::Type& rNewType, ItemConvertor& aConvertor )
-+{
-+ bool bRes = true;
-+ uno::Sequence< uno::Any > mCopyValues( mValues );
-+ for ( sal_Int32 i = 0; bRes && i < mCopyValues.getLength(); ++i )
-+ {
-+ if ( !aConvertor.convert( mCopyValues[ i ] ) )
-+ {
-+ bRes = false;
-+ break;
-+ }
-+ }
-+ if ( bRes )
-+ {
-+ mValues = mCopyValues;
-+ mType = rNewType;
-+ }
-+ return bRes;
-+}
-+
- // Methods XElementAccess
- Type NameContainer::getElementType()
- throw(RuntimeException)
-@@ -158,7 +231,7 @@ void NameContainer::replaceByName( const
- throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
- {
- Type aAnyType = aElement.getValueType();
-- if( mType != aAnyType && aAnyType != getCppuType( static_cast< ModuleInfo* >( NULL ) ) )
-+ if( mType != aAnyType )
- throw IllegalArgumentException();
-
- NameContainerNameMap::iterator aIt = mHashMap.find( aName );
-@@ -200,7 +273,7 @@ void NameContainer::insertByName( const
- throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
- {
- Type aAnyType = aElement.getValueType();
-- if( mType != aAnyType && aAnyType != getCppuType( static_cast< ModuleInfo* >( NULL ) ) )
-+ if( mType != aAnyType )
- throw IllegalArgumentException();
-
- NameContainerNameMap::iterator aIt = mHashMap.find( aName );
-@@ -339,6 +412,7 @@ SfxLibraryContainer::SfxLibraryContainer
- , mbOasis2OOoFormat( sal_False )
- , mpBasMgr( NULL )
- , mbOwnBasMgr( sal_False )
-+ , mbVBACompatModeOn( sal_False )
- {
- DBG_CTOR( SfxLibraryContainer, NULL );
-
-@@ -798,12 +872,10 @@ sal_Bool SfxLibraryContainer::init_Impl(
- OSL_ENSURE( 0, OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
- return sal_False;
- }
--
- sal_Int32 nLibCount = pLibArray->mnLibCount;
- for( sal_Int32 i = 0 ; i < nLibCount ; i++ )
- {
- ::xmlscript::LibDescriptor& rLib = pLibArray->mpLibs[i];
--
- // Check storage URL
- OUString aStorageURL = rLib.aStorageURL;
- if( !bStorage && !aStorageURL.getLength() && nPass == 0 )
-@@ -860,6 +932,23 @@ sal_Bool SfxLibraryContainer::init_Impl(
- else
- {
- Reference< XNameContainer > xLib = createLibrary( aLibName );
-+ // mbVBACompatMode needs to be setup before createLibrary is called
-+ // ( and this is called before the library desc. is read )
-+ // this implies we need an xml property at the script-lc.xml
-+ //
-+
-+ if ( rLib.aName.equalsAscii("Standard") )
-+ {
-+ OSL_TRACE("*** iteration %d have got Standard Library**** VBA MODE is %d", i, rLib.bVBAMode );
-+ // can't use the api here ( because setVBACompat will try to
-+ // convert the Libraries )
-+ Reference< XBasicLibraryInfo > xLibInfo( xLib, UNO_QUERY );
-+ if ( xLibInfo.is() )
-+ xLibInfo->setVBACompatMode( rLib.bVBAMode );
-+
-+ }
-+
-+
- pImplLib = static_cast< SfxLibrary* >( xLib.get() );
- pImplLib->mbLoaded = sal_False;
- pImplLib->mbReadOnly = rLib.bReadOnly;
-@@ -897,7 +986,9 @@ sal_Bool SfxLibraryContainer::init_Impl(
- if( !pImplLib->mbInitialised && (!bStorage || xLibraryStor.is()) )
- {
- OUString aIndexFileName;
-+
- sal_Bool bLoaded = implLoadLibraryIndexFile( pImplLib, rLib, xLibraryStor, aIndexFileName );
-+ OSL_TRACE("** Loaded %s", rtl::OUStringToOString( rLib.aName, RTL_TEXTENCODING_UTF8 ).getStr() );
- if( bLoaded && aLibName != rLib.aName )
- {
- OSL_ENSURE( 0, "Different library names in library"
-@@ -1135,6 +1226,7 @@ sal_Bool SfxLibraryContainer::init_Impl(
- Reference< XNameContainer > xLib = createLibrary( aLibName );
- SfxLibrary* pNewLib = static_cast< SfxLibrary* >( xLib.get() );
- pNewLib->mbLoaded = false;
-+
- pNewLib->implSetModified( sal_False );
- checkStorageURL( aLibFolder, pNewLib->maLibInfoFileURL,
- pNewLib->maStorageURL, pNewLib->maUnexpandedStorageURL );
-@@ -1724,21 +1816,59 @@ void SfxLibraryContainer::implImportLibD
- {
- sal_Int32 nElementCount = rLib.aElementNames.getLength();
- const OUString* pElementNames = rLib.aElementNames.getConstArray();
-- Any aDummyElement = createEmptyLibraryElement();
-+ Any aDummyElement = createEmptyLibraryElement();
-+ ::xmlscript::ObjectModuleDescHash::iterator it_end = rLib.hModuleTypeDesc.end();
-+ Reference< XNameContainer > xLib( pLib );
-+ Reference< XBasicLibraryInfo > xLibInfo( xLib, UNO_QUERY );
- for( sal_Int32 i = 0 ; i < nElementCount ; i++ )
- {
-+ com::sun::star::script::ModuleInfo mInfo;
-+ if ( xLibInfo.is() && xLibInfo->getVBACompatMode() )
-+ {
-+ ::xmlscript::ObjectModuleDescHash::iterator it = rLib.hModuleTypeDesc.find( pElementNames[i] );
-+
-+ mInfo.ModuleType = ModuleType::Normal;
-+ mInfo.ModuleName = pElementNames[i];
-+ if ( it != it_end )
-+ {
-+ mInfo.ModuleType = it->second.mnModuleType;
-+ // hack for userform, needs to know about the document
-+ // well really it needs the dialog library
-+ if ( mInfo.ModuleType == ModuleType::Form )
-+ mInfo.ModuleObject = mxOwnerDocument;
-+ else
-+ {
-+ try
-+ {
-+ Reference< XMultiServiceFactory> xSF( mxOwnerDocument.get(), uno::UNO_QUERY);
-+ uno::Reference< container::XNameAccess > xVBACodeNamedObjectAccess;
-+ if ( xSF.is() )
-+ xVBACodeNamedObjectAccess.set( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.vba.VBAObjectModuleObjectProvider"))), uno::UNO_QUERY );
-+ // get the api object for the codename
-+ if ( xVBACodeNamedObjectAccess.is() )
-+ mInfo.ModuleObject.set( xVBACodeNamedObjectAccess->getByName( mInfo.ModuleName ), uno::UNO_QUERY );
-+ }
-+ catch( Exception& e )
-+ {
-+ DBG_UNHANDLED_EXCEPTION();
-+ }
-+
-+ }
-+ }
-+ }
- pLib->maNameContainer.insertByName( pElementNames[i], aDummyElement );
-- }
-+ pLib->hBasicInfo[ pElementNames[i] ] = mInfo;
-+ }
- pLib->mbPasswordProtected = rLib.bPasswordProtected;
- pLib->mbReadOnly = rLib.bReadOnly;
- pLib->mbPreload = rLib.bPreload;
- pLib->implSetModified( sal_False );
-
- pLib->mbInitialised = sal_True;
-+ pLib->mhCodeNameToObjDesc = rLib.hModuleTypeDesc;
- }
- }
-
--
- // Methods of new XLibraryStorage interface?
- void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XStorage >& xStorage, sal_Bool bComplete )
- {
-@@ -1851,7 +1981,21 @@ void SfxLibraryContainer::storeLibraries
- rLib.bPreload = pImplLib->mbPreload;
- rLib.bPasswordProtected = pImplLib->mbPasswordProtected;
- rLib.aElementNames = pImplLib->getElementNames();
--
-+ // #FIXME the codenames probably should be in the LibDescriptor
-+ // ok there should be a special code name for the document ( e.g. ThisWorkbook, ThisDocument etc.) this probably should exist in LibDescriptorArray
-+ // hmm there possibly could be a problem distinguising that on
-+ // excel import ( because it is just another Document Module )
-+ // Hmm but also vba mode should only really be relevant for Standand
-+ // Library ( and I would say no other libraries should even exist )
-+ // so, leaving for the moment
-+ if ( pName->equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Standard") ) ) )
-+ {
-+ Reference< XNameContainer > xNameContainer( pImplLib );
-+ Reference< XBasicLibraryInfo > xLibInfo( xNameContainer, UNO_QUERY );
-+ rLib.bVBAMode = xLibInfo.is() ? xLibInfo->getVBACompatMode() : sal_False;
-+
-+ rLib.hModuleTypeDesc = lcl_getObjModDescHash( *pImplLib );
-+ }
- if( pImplLib->implIsModified() || bComplete )
- {
- // Can we copy the storage?
-@@ -2072,11 +2216,11 @@ Reference< XNameContainer > SAL_CALL Sfx
- {
- LibraryContainerMethodGuard aGuard( *this );
- SfxLibrary* pNewLib = implCreateLibrary( Name );
-+ Reference< XNameAccess > xNameAccess = static_cast< XNameAccess* >( pNewLib );
- pNewLib->maLibElementFileExtension = maLibElementFileExtension;
-
- createVariableURL( pNewLib->maUnexpandedStorageURL, Name, maInfoFileName, true );
-
-- Reference< XNameAccess > xNameAccess = static_cast< XNameAccess* >( pNewLib );
- Any aElement;
- aElement <<= xNameAccess;
- maNameContainer.insertByName( Name, aElement );
-@@ -2102,6 +2246,7 @@ Reference< XNameAccess > SAL_CALL SfxLib
-
-
- SfxLibrary* pNewLib = implCreateLibraryLink( Name, aLibInfoFileURL, aLibDirURL, ReadOnly );
-+ Reference< XNameAccess > xRet = static_cast< XNameAccess* >( pNewLib );
- pNewLib->maLibElementFileExtension = maLibElementFileExtension;
- pNewLib->maUnexpandedStorageURL = aUnexpandedStorageURL;
-
-@@ -2111,7 +2256,6 @@ Reference< XNameAccess > SAL_CALL SfxLib
- /*sal_Bool bReadIndexFile = */implLoadLibraryIndexFile( pNewLib, aLibDesc, xDummyStor, aInitFileName );
- implImportLibDescriptor( pNewLib, aLibDesc );
-
-- Reference< XNameAccess > xRet = static_cast< XNameAccess* >( pNewLib );
- Any aElement;
- aElement <<= xRet;
- maNameContainer.insertByName( Name, aElement );
-@@ -2319,13 +2463,33 @@ void SAL_CALL SfxLibraryContainer::loadL
- }
-
- Any aAny = importLibraryElement( aFile, xInStream );
-+
-+// com::sun::star::script::ModuleInfo mInfo;
- if( pImplLib->hasByName( aElementName ) )
- {
-+/*
-+ if ( getVBACompatModeOn() )
-+ {
-+ pImplLib->maNameContainer.getByName( aElementName ) >>= mInfo;
-+ aAny >>= mInfo.ModuleSource;
-+ aAny <<= mInfo;
-+ }
-+*/
- if( aAny.hasValue() )
-+ {
- pImplLib->maNameContainer.replaceByName( aElementName, aAny );
-+ }
- }
- else
- {
-+/*
-+ if ( getVBACompatModeOn() )
-+ {
-+ mInfo.ModuleType = ModuleType::Normal;
-+ aAny >>= mInfo.ModuleSource;
-+ aAny <<= mInfo;
-+ }
-+*/
- pImplLib->maNameContainer.insertByName( aElementName, aAny );
- }
- }
-@@ -2723,35 +2887,6 @@ OUString SfxLibraryContainer::expand_url
- }
- }
-
--::sal_Bool SAL_CALL SfxLibraryContainer::getVBACompatModeOn() throw (RuntimeException)
--{
-- sal_Bool bVBACompat = sal_False;
-- BasicManager* pBasMgr = getBasicManager();
-- if( pBasMgr )
-- {
-- // get the standard library
-- String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
-- StarBASIC* pBasic = pBasMgr->GetLib( aLibName );
-- if( pBasic )
-- bVBACompat = pBasic->isVBAEnabled();
-- }
--
-- return bVBACompat;
--}
--
--void SAL_CALL SfxLibraryContainer::setVBACompatModeOn( ::sal_Bool _vbacompatmodeon ) throw (RuntimeException)
--{
-- BasicManager* pBasMgr = getBasicManager();
-- if( pBasMgr )
-- {
-- // get the standard library
-- String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
-- StarBASIC* pBasic = pBasMgr->GetLib( aLibName );
-- if( pBasic )
-- pBasic->SetVBAEnabled( _vbacompatmodeon );
-- }
--}
--
- // Methods XServiceInfo
- ::sal_Bool SAL_CALL SfxLibraryContainer::supportsService( const ::rtl::OUString& _rServiceName )
- throw (RuntimeException)
-@@ -2765,6 +2900,12 @@ void SAL_CALL SfxLibraryContainer::setVB
- return sal_False;
- }
-
-+bool SfxLibrary::convertContainer(const ::com::sun::star::uno::Type& rNewType, ItemConvertor& aConvertor )
-+{
-+ return maNameContainer.convertContainer( rNewType, aConvertor );
-+}
-+
-+
- //============================================================================
-
- // Implementation class SfxLibrary
-diff --git basic/source/uno/sbservices.cxx basic/source/uno/sbservices.cxx
-index a2a4ded..aa076ea 100644
---- basic/source/uno/sbservices.cxx
-+++ basic/source/uno/sbservices.cxx
-@@ -43,6 +43,7 @@ namespace basic
- //--------------------------------------------------------------------
- extern void createRegistryInfo_SfxDialogLibraryContainer();
- extern void createRegistryInfo_SfxScriptLibraryContainer();
-+ extern void createRegistryInfo_PersistedReadOnlyCodeNames();
-
- static void initializeModule()
- {
-@@ -54,6 +55,7 @@ namespace basic
- {
- createRegistryInfo_SfxDialogLibraryContainer();
- createRegistryInfo_SfxScriptLibraryContainer();
-+ createRegistryInfo_PersistedReadOnlyCodeNames();
- }
- }
- }
-diff --git basic/source/uno/scriptcont.cxx basic/source/uno/scriptcont.cxx
-index 4a46e98..9a45db6 100644
---- basic/source/uno/scriptcont.cxx
-+++ basic/source/uno/scriptcont.cxx
-@@ -1068,6 +1068,11 @@ SfxScriptLibraryContainer:: HasExecutabl
-
- //============================================================================
- // Service
-+class PersistedReadOnlyCodeNames;
-+void createRegistryInfo_PersistedReadOnlyCodeNames()
-+{
-+ static OAutoRegistration< PersistedReadOnlyCodeNames > aAutoRegistration;
-+}
- void createRegistryInfo_SfxScriptLibraryContainer()
- {
- static OAutoRegistration< SfxScriptLibraryContainer > aAutoRegistration;
-@@ -1125,6 +1130,7 @@ SfxScriptLibrary::SfxScriptLibrary( Modi
- : SfxLibrary( _rModifiable, getCppuType( (const OUString *)0 ), xMSF, xSFI )
- , mbLoadedSource( sal_False )
- , mbLoadedBinary( sal_False )
-+ , mbVBA( sal_False )
- {
- }
-
-@@ -1138,9 +1144,85 @@ SfxScriptLibrary::SfxScriptLibrary( Modi
- aLibInfoFileURL, aStorageURL, ReadOnly)
- , mbLoadedSource( sal_False )
- , mbLoadedBinary( sal_False )
-+ , mbVBA( sal_False )
-+{
-+}
-+
-+IMPLEMENT_FORWARD_XINTERFACE2( SfxScriptLibrary, SfxLibrary, SfxScriptLibrary_BASE );
-+IMPLEMENT_FORWARD_XTYPEPROVIDER2( SfxScriptLibrary, SfxLibrary, SfxScriptLibrary_BASE );
-+
-+::sal_Bool SAL_CALL
-+SfxScriptLibrary::getVBACompatMode() throw (RuntimeException)
-+{
-+ return mbVBA;
-+}
-+
-+void SAL_CALL
-+SfxScriptLibrary::setVBACompatMode( ::sal_Bool _vbacompatmodeon ) throw (RuntimeException)
-+{
-+ mbVBA = _vbacompatmodeon;
-+}
-+
-+// Methods
-+::com::sun::star::script::ModuleInfo SAL_CALL
-+SfxScriptLibrary::getModuleInfo( const ::rtl::OUString& ModuleName ) throw (RuntimeException)
-+{
-+ ::com::sun::star::script::ModuleInfo mInfo;
-+ NameToInfoHash::iterator it_end = hBasicInfo.end();
-+ NameToInfoHash::iterator it = hBasicInfo.find( ModuleName );
-+ if ( it != it_end )
-+ mInfo = it->second;
-+
-+ return mInfo;
-+}
-+
-+void SAL_CALL
-+SfxScriptLibrary::replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement )
-+ throw(::com::sun::star::lang::IllegalArgumentException,
-+ ::com::sun::star::container::NoSuchElementException,
-+ ::com::sun::star::lang::WrappedTargetException,
-+ ::com::sun::star::uno::RuntimeException)
- {
-+ SfxLibrary::replaceByName( aName, aElement );
- }
-
-+// Methods XNameContainer
-+void SAL_CALL
-+SfxScriptLibrary::insertByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement )
-+ throw(::com::sun::star::lang::IllegalArgumentException,
-+ ::com::sun::star::container::ElementExistException,
-+ ::com::sun::star::lang::WrappedTargetException,
-+ ::com::sun::star::uno::RuntimeException)
-+{
-+ OSL_TRACE("***** insertByName module %s", rtl::OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+
-+ NameToInfoHash::iterator it_end = hBasicInfo.end();
-+ NameToInfoHash::iterator it = hBasicInfo.find( aName );
-+
-+ if ( it != it_end )
-+ throw ElementExistException(); // more detail please
-+
-+ ModuleInfo mInfo;
-+ if ( aElement >>= mInfo )
-+ {
-+ hBasicInfo[ aName ] = mInfo;
-+ uno::Any aTmpElement( mInfo.ModuleSource );
-+ SfxLibrary::insertByName( aName, aTmpElement );
-+ }
-+ else
-+ SfxLibrary::insertByName( aName, aElement );
-+}
-+
-+void SAL_CALL
-+SfxScriptLibrary::removeByName( const ::rtl::OUString& Name )
-+ throw(::com::sun::star::container::NoSuchElementException,
-+ ::com::sun::star::lang::WrappedTargetException,
-+ ::com::sun::star::uno::RuntimeException)
-+{
-+ SfxLibrary::removeByName( Name );
-+}
-+
-+
- // Provide modify state including resources
- sal_Bool SfxScriptLibrary::isModified( void )
- {
-@@ -1188,7 +1270,195 @@ bool SAL_CALL SfxScriptLibrary::isLibrar
- {
- return SfxScriptLibrary::containsValidModule( aElement );
- }
-+typedef ::cppu::WeakImplHelper3< container::XNameAccess, lang::XInitialization, lang::XServiceInfo > ReadOnlyCodeNames_BASE;
-
-+// XNameAccess, codename to/from objectnames
-+class PersistedReadOnlyCodeNames : ReadOnlyCodeNames_BASE
-+{
-+typedef std::hash_map< rtl::OUString, rtl::OUString, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > CodeNameHash;
-+
-+ CodeNameHash mCodeNameToObjectNames;
-+public:
-+ PersistedReadOnlyCodeNames()
-+ {
-+ }
-+ // Methods - XInitialise
-+ virtual void SAL_CALL initialize( const uno::Sequence< uno::Any >& aArguments ) throw (uno::Exception, uno::RuntimeException)
-+ {
-+ if ( !aArguments.getLength() )
-+ throw RuntimeException();
-+ Reference< document::XStorageBasedDocument > xDocument( aArguments[ 0 ], uno::UNO_QUERY_THROW );
-+ Reference< embed::XStorage > xDocStorage;
-+ try
-+ {
-+ Reference< XMultiServiceFactory > xMSF = comphelper::getProcessServiceFactory();
-+ Reference< XServiceInfo > xSI( xDocument, UNO_QUERY_THROW );
-+ if ( xSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.OfficeDocument" ) ) ) )
-+ xDocStorage.set( xDocument->getDocumentStorage(), UNO_QUERY_THROW );
-+ if ( xDocStorage.is() ) // not a 'real' document
-+ {
-+ rtl::OUString codeNameDir( RTL_CONSTASCII_USTRINGPARAM("Basic") );
-+ rtl::OUString standardDir( RTL_CONSTASCII_USTRINGPARAM("Standard") );
-+ rtl::OUString codeNameFile( RTL_CONSTASCII_USTRINGPARAM("script-lb.xml") );
-+
-+ uno::Reference< embed::XStorage > xLibrariesStor( xDocStorage->openStorageElement( codeNameDir, embed::ElementModes::READ ), UNO_QUERY_THROW );
-+ uno::Reference< embed::XStorage > xStandardStor( xLibrariesStor->openStorageElement( standardDir, embed::ElementModes::READ ), UNO_QUERY_THROW );
-+ uno::Reference< io::XStream > xStream( xStandardStor->openStreamElement( codeNameFile, embed::ElementModes::READ ), UNO_QUERY_THROW );
-+ uno::Reference< io::XInputStream > xInput( xStream->getInputStream(), UNO_QUERY_THROW );
-+ ::xmlscript::LibDescriptor aLib;
-+ InputSource source;
-+ source.aInputStream = xInput;
-+
-+ Reference< XParser > xParser( xMSF->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser") ) ), UNO_QUERY_THROW );
-+ xParser->setDocumentHandler( ::xmlscript::importLibraryCodeNames( aLib ) );
-+ xParser->parseStream( source );
-+
-+ ::xmlscript::ObjectModuleDescHash::iterator it_end = aLib.hModuleTypeDesc.end();
-+ for ( ::xmlscript::ObjectModuleDescHash::iterator it = aLib.hModuleTypeDesc.begin(); it != it_end; ++it )
-+ {
-+ if ( it->second.msObjectName.getLength() > 0 )
-+ mCodeNameToObjectNames[ it->second.msObjectName ] = it->first;
-+ }
-+ }
-+ }
-+ catch ( Exception& e )
-+ {
-+ OSL_TRACE("Urk, should never get here, help!!");
-+ }
-+ }
-+ // Methods - XNameAccess
-+ virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ ::xmlscript::CodeNameHash::iterator it = mCodeNameToObjectNames.find( aName );
-+ if ( it == mCodeNameToObjectNames.end() )
-+ throw container::NoSuchElementException();
-+ return uno::makeAny( it->second );
-+ }
-+ virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException)
-+ {
-+ uno::Sequence< ::rtl::OUString > sNames( mCodeNameToObjectNames.size() );
-+ ::rtl::OUString* pStr = sNames.getArray();
-+ ::xmlscript::CodeNameHash::iterator it = mCodeNameToObjectNames.begin();
-+ ::xmlscript::CodeNameHash::iterator it_end = mCodeNameToObjectNames.end();
-+ for ( ; it != it_end ; ++it, ++pStr )
-+ *pStr = it->first;
-+ return sNames;
-+ }
-+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
-+ {
-+ return ( mCodeNameToObjectNames.find( aName ) != mCodeNameToObjectNames.end() );
-+ }
-+ // Methods - XElementAccess
-+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
-+ {
-+ return ::getCppuType( (const rtl::OUString *)0 );
-+ }
-+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( mCodeNameToObjectNames.size() > 0 );
-+ }
-+ // Methods XServiceInfo
-+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException)
-+ {
-+ return getImplementationName_static();
-+ }
-+ virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException)
-+ {
-+ uno::Sequence< rtl::OUString > sNames( getSupportedServiceNames() );
-+ rtl::OUString* pStr = sNames.getArray();
-+ rtl::OUString* pEnd = ( sNames.getArray() + sNames.getLength() );
-+ for ( ; pStr != pEnd ; ++pStr )
-+ {
-+ if ( (*pStr).equals( ServiceName ) )
-+ return sal_True;
-+ }
-+ return sal_False;
-+ }
-+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException)
-+ {
-+ return getSupportedServiceNames_static();
-+ }
-+ // Service
-+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static()
-+ {
-+ uno::Sequence< rtl::OUString > sServiceNames(1);
-+ sServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.vba.PersistedCodeNames"));
-+ return sServiceNames;
-+ }
-+ static ::rtl::OUString getImplementationName_static()
-+ {
-+ static OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("PersistedReadOnlyCodeNames") );
-+ return sImplName;
-+ }
-+
-+ static Reference< XInterface > SAL_CALL Create ( const Reference< XComponentContext >& xServiceManager ) throw( Exception )
-+ {
-+ Reference< XInterface > xRet =
-+ static_cast< XInterface* >( static_cast< OWeakObject* >( new PersistedReadOnlyCodeNames() ));
-+ return xRet;
-+ }
-+};
-+class ConvertEntryToVbaEntry : public ItemConvertor
-+{
-+ virtual bool convert( Any& item )
-+ {
-+ // All entries are converted to 'Normal' modules
-+ // Document Modules need to be created externall ( e.g. these are under the control
-+ // of the document itself )
-+ rtl::OUString sSource;
-+ bool bRes = false;
-+
-+ if ( item >>= sSource )
-+ {
-+ script::ModuleInfo mInfo;
-+ mInfo.ModuleSource = sSource;
-+ mInfo.ModuleType = script::ModuleType::Normal;
-+ item <<= mInfo;
-+ bRes = true;
-+ }
-+ return bRes;
-+ }
-+};
-+
-+class ConvertEntryFromVbaEntry : public ItemConvertor
-+{
-+ bool convert( Any& item )
-+ {
-+ bool bRes = false;
-+ script::ModuleInfo mInfo;
-+ if ( item >>= mInfo )
-+ {
-+ item <<= mInfo.ModuleSource;
-+ bRes = true;
-+ }
-+ return bRes;
-+ }
-+};
-+
-+void SfxScriptLibraryContainer::convertLibraryEntries()
-+{
-+/*
-+ if ( getVBACompatModeOn() )
-+ {
-+ // going from non-vba to vba
-+ SfxLibrary* pImplLib = getImplLib( String( RTL_CONSTASCII_USTRINGPARAM("Standard") ) );
-+
-+ ConvertEntryToVbaEntry converter;
-+ bool bRes = pImplLib ? pImplLib->convertContainer( getCppuType( ( const script::ModuleInfo* ) NULL ), converter ) : false;
-+ }
-+ else
-+ {
-+ // going from vba to non-vba
-+ // we must delete all Document modules
-+ // what we also must do is warn the user that this is going to happen ( see. Excel )
-+ // needs interaction handler love ( perhaps that needs to be passed into the setVBACompat )
-+ // or perhaps we can access the documents InteractionHandler ?
-+ SfxLibrary* pImplLib = getImplLib( String( RTL_CONSTASCII_USTRINGPARAM("Standard") ) );
-+ ConvertEntryFromVbaEntry convertor;
-+ bool bRes = pImplLib ? pImplLib->convertContainer( getCppuType( ( const rtl::OUString*) NULL ), convertor ) : false;
-+ }
-+*/
-+}
- //============================================================================
-
- } // namespace basic
-diff --git offapi/com/sun/star/script/XVBACompat.idl offapi/com/sun/star/script/XBasicLibraryInfo.idl
-similarity index 87%
-rename from offapi/com/sun/star/script/XVBACompat.idl
-rename to offapi/com/sun/star/script/XBasicLibraryInfo.idl
-index e1b2d28..647d530 100644
---- offapi/com/sun/star/script/XVBACompat.idl
-+++ offapi/com/sun/star/script/XBasicLibraryInfo.idl
-@@ -27,22 +27,26 @@
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
--#ifndef __com_sun_star_script_XVBACompat_idl__
--#define __com_sun_star_script_XVBACompat_idl__
-+#ifndef __com_sun_star_script_XBasicLibraryInfo_idl__
-+#define __com_sun_star_script_XBasicLibraryInfo_idl__
-
- #ifndef __com_sun_star_uno_XInterface_idl__
- #include <com/sun/star/uno/XInterface.idl>
- #endif
-+#ifndef __com_sun_star_script_ModuleInfo_idl__
-+#include <com/sun/star/script/ModuleInfo.idl>
-+#endif
-
- //=============================================================================
-
- module com { module sun { module star { module script {
-
--interface XVBACompat: com::sun::star::uno::XInterface
-+interface XBasicLibraryInfo: com::sun::star::uno::XInterface
- {
-
- //=============================================================================
-- [attribute ] boolean VBACompatModeOn;
-+ [attribute ] boolean VBACompatMode;
-+ ModuleInfo getModuleInfo( [in] string ModuleName );
-
- }; }; }; };
- };
-diff --git offapi/com/sun/star/script/makefile.mk offapi/com/sun/star/script/makefile.mk
-index 9837104..4004c07 100644
---- offapi/com/sun/star/script/makefile.mk
-+++ offapi/com/sun/star/script/makefile.mk
-@@ -52,7 +52,7 @@ IDLFILES=\
- XPersistentLibraryContainer.idl\
- XStorageBasedLibraryContainer.idl\
- XLibraryQueryExecutable.idl \
-- XVBACompat.idl\
-+ XBasicLibraryInfo.idl\
- ModuleSizeExceededRequest.idl\
-
- # ------------------------------------------------------------------
-diff --git sc/inc/document.hxx sc/inc/document.hxx
-index 35fd858..8b608f1 100644
---- sc/inc/document.hxx
-+++ sc/inc/document.hxx
-@@ -34,6 +34,7 @@
-
- #include <vcl/prntypes.hxx>
- #include <vcl/timer.hxx>
-+#include <com/sun/star/container/XNameAccess.hpp>
- #include <com/sun/star/uno/Reference.hxx>
- #include <vos/ref.hxx>
- #include "scdllapi.h"
-@@ -319,7 +320,7 @@ private:
- Timer aTrackTimer;
-
- com::sun::star::uno::Reference< com::sun::star::document::XVbaEventsHelper > mxVbaEventsHelper;
--
-+ com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > mxCodeNames;
- public:
- ScTabOpList aTableOpList; // list of ScInterpreterTableOpParams currently in use
- ScInterpreterTableOpParams aLastTableOpParams; // remember last params
-@@ -439,6 +440,7 @@ public:
- SfxObjectShell* pDocShell = NULL );
- ~ScDocument();
-
-+ com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > GetPersistedCodeNames() throw( com::sun::star::uno::RuntimeException );
- inline ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
- GetServiceManager() const { return xServiceManager; }
-
-diff --git sc/source/core/data/documen2.cxx sc/source/core/data/documen2.cxx
-index aa0bafd..e867e99 100644
---- sc/source/core/data/documen2.cxx
-+++ sc/source/core/data/documen2.cxx
-@@ -263,6 +263,7 @@ ScDocument::ScDocument( ScDocumentMode e
-
- aTrackTimer.SetTimeoutHdl( LINK( this, ScDocument, TrackTimeHdl ) );
- aTrackTimer.SetTimeout( 100 );
-+ aDocCodeName = String( RTL_CONSTASCII_USTRINGPARAM("ThisWorkbook") );
- }
-
-
-diff --git sc/source/core/data/document.cxx sc/source/core/data/document.cxx
-index a94a264..fee5545 100644
---- sc/source/core/data/document.cxx
-+++ sc/source/core/data/document.cxx
-@@ -92,6 +92,9 @@
- #include "postit.hxx"
- #include "tabprotection.hxx"
- #include "externalrefmgr.hxx"
-+#include <comphelper/processfactory.hxx>
-+
-+using namespace ::com::sun::star;
-
- struct ScDefaultAttr
- {
-@@ -4485,5 +4488,30 @@ BOOL ScDocument::NeedPageResetAfterTab(
- return FALSE; // sonst nicht
- }
-
-+uno::Reference< container::XNameAccess >
-+ScDocument::GetPersistedCodeNames() throw( uno::RuntimeException )
-+{
-+ SfxObjectShell* pObjShell = GetDocumentShell();
-+ if ( pShell && !mxCodeNames.is() )
-+ {
-+ uno::Sequence< uno::Any > aArgs( 1 );
-+ aArgs[ 0 ] = uno::makeAny( pObjShell->GetModel() );
-+ mxCodeNames.set( ::comphelper::getProcessServiceFactory()->createInstanceWithArguments(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.vba.PersistedCodeNames")), aArgs), uno::UNO_QUERY );
-+ if ( mxCodeNames.is() )
-+ {
-+ rtl::OUString sWorkbook( RTL_CONSTASCII_USTRINGPARAM("ThisWorkbook") );
-+ if ( mxCodeNames->hasByName( sWorkbook ) )
-+ {
-+
-+ rtl::OUString sCodeName;
-+ mxCodeNames->getByName( sWorkbook ) >>= sCodeName;
-+ SetCodeName( sCodeName );
-+ }
-+ }
-+ }
-+ return mxCodeNames;
-+}
-+
-+
-
-
-diff --git sc/source/filter/xml/xmlsubti.cxx sc/source/filter/xml/xmlsubti.cxx
-index c56f867..a7b3c40 100644
---- sc/source/filter/xml/xmlsubti.cxx
-+++ sc/source/filter/xml/xmlsubti.cxx
-@@ -220,6 +220,7 @@ void ScMyTables::NewSheet(const rtl::OUS
- uno::Reference <container::XIndexAccess> xIndex( xSheets, uno::UNO_QUERY );
- if ( xIndex.is() )
- {
-+
- xCurrentSheet.set(xIndex->getByIndex(nCurrentSheet), uno::UNO_QUERY);
- if ( xCurrentSheet.is() )
- {
-@@ -246,6 +247,27 @@ void ScMyTables::NewSheet(const rtl::OUS
- }
- }
- }
-+
-+ ScDocument *pDoc = ScXMLConverter::GetScDocument(rImport.GetModel());
-+ // Codenames need to be set as sheets are created and read
-+ if ( pDoc )
-+ {
-+ String sName;
-+ pDoc->GetName( nCurrentSheet, sName );
-+ OSL_TRACE("** import processing %s", rtl::OUStringToOString( sName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ rtl::OUString sOUName( sName );
-+ uno::Reference< container::XNameAccess > xCodeNames( pDoc->GetPersistedCodeNames() );
-+ if( xCodeNames.is() && xCodeNames->hasByName( sName ) )
-+ {
-+ rtl::OUString sOUSCodeName;
-+ xCodeNames->getByName( sName ) >>= sOUSCodeName;
-+ OSL_TRACE("** import processing setting codename %s for %s", rtl::OUStringToOString( sOUSCodeName, RTL_TEXTENCODING_UTF8 ).getStr(), rtl::OUStringToOString( sName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ rImport.LockSolarMutex();
-+ String sCodeName( sOUSCodeName );
-+ pDoc->SetCodeName( nCurrentSheet, sCodeName );
-+ rImport.UnlockSolarMutex();
-+ }
-+ }
- rImport.SetTableStyle(sStyleName);
-
- if ( sStyleName.getLength() )
-diff --git sc/source/ui/docshell/docsh.cxx sc/source/ui/docshell/docsh.cxx
-index 073a68d..31e9003 100644
---- sc/source/ui/docshell/docsh.cxx
-+++ sc/source/ui/docshell/docsh.cxx
-@@ -131,6 +131,7 @@
- #include "cellsuno.hxx"
- #include <com/sun/star/document/XVbaEventsHelper.hpp>
- #include <com/sun/star/document/VbaEventId.hpp>
-+#include <com/sun/star/script/ModuleInfo.hpp>
-
- using namespace com::sun::star;
- using namespace com::sun::star::document::VbaEventId;
-@@ -299,6 +300,14 @@ void ScDocShell::BeforeXMLLoading()
- ScColumn::bDoubleAlloc = sal_True;
- }
-
-+rtl::OUString GetCodeName( ScDocument& aDocument, String& sObjectName )
-+{
-+ uno::Reference< container::XNameAccess > xCodeNames( aDocument.GetPersistedCodeNames() );
-+ rtl::OUString sOUSCodeName;
-+ xCodeNames->getByName( sObjectName ) >>= sOUSCodeName;
-+ return sOUSCodeName;
-+}
-+
- void ScDocShell::AfterXMLLoading(sal_Bool bRet)
- {
- if (GetCreateMode() != SFX_CREATE_MODE_ORGANIZER)
-@@ -372,8 +381,32 @@ void ScDocShell::AfterXMLLoading(sal_Boo
-
- // suppress VBA events when loading the xml
- uno::Reference< document::XVbaEventsHelper > xEvt( aDocument.GetVbaEventsHelper() );
-+ OSL_TRACE("About to enable events again");
- if ( xEvt.is() )
- xEvt->setIgnoreEvents( sal_False );
-+/*
-+ // SetCodenames for each tab ( and set up the vba DOC Modules )
-+ SCTAB nTabCount = aDocument.GetTableCount();
-+ for (SCTAB i = 0; i < nTabCount; ++i)
-+ {
-+ String sObjectName;
-+ String sCodeName;
-+ try
-+ {
-+ if ( i == 0 )
-+ {
-+ sObjectName = String( RTL_CONSTASCII_USTRINGPARAM("ThisWorkbook") );
-+ sCodeName = GetCodeName( aDocument, sObjectName );
-+ }
-+ aDocument.GetName( i, sObjectName );
-+ sCodeName = GetCodeName( aDocument, sObjectName );
-+ SetDocModuleForCodeName( aDocument, sCodeName );
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+ }
-+ */
- aDocument.SetImportingXML( FALSE );
- aDocument.EnableUndo( TRUE );
- bIsEmpty = FALSE;
-diff --git sc/source/ui/vba/vbaeventshelper.cxx sc/source/ui/vba/vbaeventshelper.cxx
-index a315af0..b4d0bd9 100644
---- sc/source/ui/vba/vbaeventshelper.cxx
-+++ sc/source/ui/vba/vbaeventshelper.cxx
-@@ -620,7 +620,7 @@ String ScVbaEventsHelper::getSheetModule
- {
- ScExtDocOptions* pExtOptions = pDoc->GetExtDocOptions();
- String aCodeName;
-- pDoc->GetName( nTab, aCodeName);
-+ pDoc->GetCodeName( nTab, aCodeName);
- // Use code name if that exists
- if ( pExtOptions )
- aCodeName = pExtOptions->GetCodeName( nTab );
-diff --git svx/source/msfilter/svxmsbas.cxx svx/source/msfilter/svxmsbas.cxx
-index b00e19c..cde45f7 100644
---- svx/source/msfilter/svxmsbas.cxx
-+++ svx/source/msfilter/svxmsbas.cxx
-@@ -54,6 +54,8 @@ using namespace com::sun::star::awt;
- #include <com/sun/star/container/XNameContainer.hpp>
- #include <com/sun/star/script/XLibraryContainer.hpp>
- #include <com/sun/star/script/ModuleInfo.hpp>
-+#include <com/sun/star/script/XBasicLibraryInfo.hpp>
-+
- using namespace com::sun::star::container;
- using namespace com::sun::star::script;
- using namespace com::sun::star::uno;
-@@ -272,7 +274,11 @@ BOOL SvxImportMSVBasic::ImportCode_Impl(
- Reference< container::XNameAccess > xVBAObjectForCodeName;
- if ( !bAsComment )
- {
-- rDocSh.GetBasic()->SetVBAEnabled( true );
-+ Reference< XBasicLibraryInfo > xInfo( xLib, UNO_QUERY );
-+ if( xInfo.is() )
-+ xInfo->setVBACompatMode( sal_True );
-+ else
-+ rDocSh.GetBasic()->SetVBAEnabled( true );
- Reference< XMultiServiceFactory> xSF(rDocSh.GetModel(), UNO_QUERY);
- if ( xSF.is() )
- {
-diff --git toolkit/inc/toolkit/controls/dialogcontrol.hxx toolkit/inc/toolkit/controls/dialogcontrol.hxx
-index 0180ddd..e8f0005 100644
---- toolkit/inc/toolkit/controls/dialogcontrol.hxx
-+++ toolkit/inc/toolkit/controls/dialogcontrol.hxx
-@@ -41,8 +41,6 @@
- #include <com/sun/star/beans/XPropertyChangeListener.hpp>
- #include <com/sun/star/awt/XDialog.hpp>
- #include <com/sun/star/resource/XStringResourceResolver.hpp>
--#include <com/sun/star/script/XVBACompat.hpp>
--#include <cppuhelper/implbase7.hxx>
- #include <cppuhelper/implbase6.hxx>
- #include <cppuhelper/implbase5.hxx>
- #include <toolkit/helper/listenermultiplexer.hxx>
-@@ -60,13 +58,12 @@
- // class UnoControlDialogModel
- // ----------------------------------------------------
- typedef UnoControlModel UnoControlDialogModel_Base;
--typedef ::cppu::ImplHelper7 < ::com::sun::star::lang::XMultiServiceFactory
-+typedef ::cppu::ImplHelper6 < ::com::sun::star::lang::XMultiServiceFactory
- , ::com::sun::star::container::XContainer
- , ::com::sun::star::container::XNameContainer
- , ::com::sun::star::awt::XTabControllerModel
- , ::com::sun::star::util::XChangesNotifier
- , ::com::sun::star::beans::XPropertyChangeListener
-- , ::com::sun::star::script::XVBACompat
- > UnoControlDialogModel_IBase;
-
- class UnoControlDialogModel : public UnoControlDialogModel_IBase
-@@ -179,10 +176,6 @@ public:
- using cppu::OPropertySetHelper::disposing;
- virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& evt ) throw (::com::sun::star::uno::RuntimeException);
-
-- // XVBACompat
-- virtual ::sal_Bool SAL_CALL getVBACompatModeOn() throw (::com::sun::star::uno::RuntimeException);
-- virtual void SAL_CALL setVBACompatModeOn( ::sal_Bool _vbacompatmodeon ) throw (::com::sun::star::uno::RuntimeException);
--
- // XServiceInfo
- DECLIMPL_SERVICEINFO_DERIVED( UnoControlDialogModel,UnoControlDialogModel_Base, szServiceName2_UnoControlDialogModel )
-
-@@ -203,7 +196,6 @@ private:
- ModelGroup*& rpCurrentGroup );
- void AddRadioButtonGroup (
- ::std::map< ::rtl::OUString, ModelGroup >& pNamedGroups );
-- sal_Bool mbVBAMode;
- };
-
- // ----------------------------------------------------
-diff --git toolkit/inc/toolkit/helper/property.hxx toolkit/inc/toolkit/helper/property.hxx
-index db61c94..1abcda6 100644
---- toolkit/inc/toolkit/helper/property.hxx
-+++ toolkit/inc/toolkit/helper/property.hxx
-@@ -190,6 +190,7 @@ namespace rtl {
- #define BASEPROPERTY_CUSTOMUNITTEXT 136 // ::rtl::OUString
- #define BASEPROPERTY_ENABLEVISIBLE 137 // sal_Bool
- #define BASEPROPERTY_GROUPNAME 138 // ::rtl::OUString
-+#define BASEPROPERTY_VBAFORM 139 // sal_Bool
-
- // Keine gebundenen Properties, werden immer aus der Property BASEPROPERTY_FONTDESCRIPTOR entnommen.
- #define BASEPROPERTY_FONTDESCRIPTORPART_START 1000
-diff --git toolkit/source/controls/dialogcontrol.cxx toolkit/source/controls/dialogcontrol.cxx
-index a8a5c19..f976562 100644
---- toolkit/source/controls/dialogcontrol.cxx
-+++ toolkit/source/controls/dialogcontrol.cxx
-@@ -268,7 +268,7 @@ static const ::rtl::OUString& getStepPro
- UnoControlDialogModel::UnoControlDialogModel()
- :maContainerListeners( *this )
- ,maChangeListeners ( GetMutex() )
-- ,mbGroupsUpToDate( sal_False ), mbAdjustingGraphic( false ), mbVBAMode( sal_False )
-+ ,mbGroupsUpToDate( sal_False ), mbAdjustingGraphic( false )
- {
- ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
- // ImplRegisterProperty( BASEPROPERTY_BORDER );
-@@ -290,6 +290,8 @@ UnoControlDialogModel::UnoControlDialogM
- aBool <<= (sal_Bool) sal_True;
- ImplRegisterProperty( BASEPROPERTY_MOVEABLE, aBool );
- ImplRegisterProperty( BASEPROPERTY_CLOSEABLE, aBool );
-+ aBool <<= (sal_Bool) sal_False;
-+ ImplRegisterProperty( BASEPROPERTY_VBAFORM, aBool );
- }
-
- UnoControlDialogModel::UnoControlDialogModel( const UnoControlDialogModel& rModel )
-@@ -297,7 +299,7 @@ UnoControlDialogModel::UnoControlDialogM
- , UnoControlDialogModel_Base( rModel )
- , maContainerListeners( *this )
- , maChangeListeners ( GetMutex() )
-- , mbGroupsUpToDate( sal_False ), mbAdjustingGraphic( false ), mbVBAMode( rModel.mbVBAMode )
-+ , mbGroupsUpToDate( sal_False ), mbAdjustingGraphic( false )
- {
- }
-
-@@ -313,18 +315,6 @@ Any UnoControlDialogModel::queryAggregat
- return (aRet.hasValue() ? aRet : UnoControlDialogModel_Base::queryAggregation( rType ));
- }
-
--::sal_Bool SAL_CALL
--UnoControlDialogModel::getVBACompatModeOn() throw (RuntimeException)
--{
-- return mbVBAMode;
--}
--
--void SAL_CALL
--UnoControlDialogModel::setVBACompatModeOn( ::sal_Bool _vbacompatmodeon ) throw (RuntimeException)
--{
-- mbVBAMode = _vbacompatmodeon;
--}
--
- // XTypeProvider
- IMPL_IMPLEMENTATION_ID( UnoControlDialogModel )
- Sequence< Type > UnoControlDialogModel::getTypes() throw(RuntimeException)
-@@ -1491,8 +1481,19 @@ void UnoDialogControl::ImplSetPosSize( R
- // Currentley we are simply using MAP_APPFONT ( for normal Dialogs )
- // and MAP_100TH_MM for imported Userforms
- MapMode aMode( MAP_APPFONT );
-- Reference< script::XVBACompat > xVBA( getModel(), UNO_QUERY );
-- if ( xVBA.is() && xVBA->getVBACompatModeOn() )
-+ sal_Bool bVBAForm = sal_False;
-+ Reference< XPropertySet > xDlgModelProps( getModel(), UNO_QUERY );
-+ if ( xDlgModelProps.is() )
-+ {
-+ try
-+ {
-+ xDlgModelProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAForm" ) ) ) >>= bVBAForm;
-+ }
-+ catch( Exception& )
-+ {
-+ }
-+ }
-+ if ( bVBAForm )
- aMode = MapMode( MAP_100TH_MM );
- OutputDevice*pOutDev = Application::GetDefaultDevice();
- if ( pOutDev )
-diff --git toolkit/source/helper/property.cxx toolkit/source/helper/property.cxx
-index a7fc25b..8d1ee74 100644
---- toolkit/source/helper/property.cxx
-+++ toolkit/source/helper/property.cxx
-@@ -271,7 +271,8 @@ ImplPropertyInfo* ImplGetPropertyInfos(
- DECL_PROP_2 ( "InvokesStopNodeEditing", TREE_INVOKESSTOPNODEEDITING, sal_Bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "DialogSourceURL", DIALOGSOURCEURL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "URL", URL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
-- DECL_PROP_2 ( "EnableVisible", ENABLEVISIBLE, sal_Bool, BOUND, MAYBEDEFAULT )
-+ DECL_PROP_2 ( "EnableVisible", ENABLEVISIBLE, sal_Bool, BOUND, MAYBEDEFAULT ),
-+ DECL_PROP_2 ( "VBAForm", VBAFORM, sal_Bool, BOUND, MAYBEDEFAULT ),
- };
- pPropertyInfos = aImplPropertyInfos;
- nElements = sizeof( aImplPropertyInfos ) / sizeof( ImplPropertyInfo );
-diff --git xmlscript/inc/xmlscript/xmllib_imexp.hxx xmlscript/inc/xmlscript/xmllib_imexp.hxx
-index 9a3048f..93826a9 100644
---- xmlscript/inc/xmlscript/xmllib_imexp.hxx
-+++ xmlscript/inc/xmlscript/xmllib_imexp.hxx
-@@ -34,11 +34,21 @@
- #include <com/sun/star/uno/Sequence.hxx>
-
- #include "xmlscript/xmlns.h"
--
-+#include <hash_map>
-+#include <com/sun/star/script/ModuleType.hpp>
-
- namespace xmlscript
- {
-+struct ObjectModuleDesc
-+{
-+ rtl::OUString msObjectName;
-+ sal_Int32 mnModuleType;
-+ObjectModuleDesc() : mnModuleType( ::com::sun::star::script::ModuleType::Normal ) {}
-+};
-
-+typedef std::hash_map< rtl::OUString,
-+ObjectModuleDesc, ::rtl::OUStringHash,
-+::std::equal_to< ::rtl::OUString > > ObjectModuleDescHash;
- //==============================================================================
- // Library container export
- // HACK C++ struct to transport info. Later the container
-@@ -51,10 +61,15 @@ struct LibDescriptor
- sal_Bool bLink;
- sal_Bool bReadOnly;
- sal_Bool bPasswordProtected;
-+ sal_Bool bVBAMode;
- ::com::sun::star::uno::Sequence< ::rtl::OUString > aElementNames;
- sal_Bool bPreload;
-+ ObjectModuleDescHash hModuleTypeDesc;
-+ LibDescriptor();
- };
-
-+typedef std::hash_map< rtl::OUString, rtl::OUString, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > CodeNameHash;
-+
- struct LibDescriptorArray
- {
- LibDescriptor* mpLibs;
-@@ -79,6 +94,11 @@ SAL_CALL exportLibraryContainer(
- SAL_CALL importLibraryContainer( LibDescriptorArray* pLibArray )
- SAL_THROW( (::com::sun::star::uno::Exception) );
-
-+::com::sun::star::uno::Reference<
-+ ::com::sun::star::xml::sax::XDocumentHandler >
-+SAL_CALL importLibraryCodeNames( LibDescriptor& rLib )
-+ SAL_THROW( (::com::sun::star::uno::Exception) );
-+
-
- void
- SAL_CALL exportLibrary(
-diff --git xmlscript/source/xmldlg_imexp/imp_share.hxx xmlscript/source/xmldlg_imexp/imp_share.hxx
-index bf3ea5f..cda47ef 100644
---- xmlscript/source/xmldlg_imexp/imp_share.hxx
-+++ xmlscript/source/xmldlg_imexp/imp_share.hxx
-@@ -45,7 +45,7 @@
- #include <com/sun/star/awt/FontEmphasisMark.hpp>
- #include <com/sun/star/awt/FontRelief.hpp>
- #include <com/sun/star/xml/input/XRoot.hpp>
--#include <com/sun/star/script/XLibraryContainer.hpp>
-+#include <com/sun/star/script/XBasicLibraryInfo.hpp>
- #include <vector>
-
-
-@@ -133,7 +133,6 @@ struct DialogImport
- css::uno::Reference< css::container::XNameContainer > _xDialogModel;
- css::uno::Reference< css::lang::XMultiServiceFactory > _xDialogModelFactory;
- css::uno::Reference< css::frame::XModel > _xDoc;
-- css::uno::Reference< css::script::XLibraryContainer > _xScriptLibraryContainer;
-
- sal_Int32 XMLNS_DIALOGS_UID, XMLNS_SCRIPT_UID;
-
-@@ -180,7 +179,7 @@ public:
-
- inline css::uno::Reference< css::frame::XModel > getDocOwner() { return _xDoc; }
-
-- css::uno::Reference< css::script::XLibraryContainer > getScriptLibraryContainer();
-+ css::uno::Reference< css::script::XBasicLibraryInfo > getScriptLibraryInfo();
- // XRoot
- virtual void SAL_CALL startDocument(
- css::uno::Reference< css::xml::input::XNamespaceMapping >
-diff --git xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
-index 92c1a09..f513ecf 100644
---- xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
-+++ xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
-@@ -41,7 +41,7 @@
- #include <com/sun/star/beans/XPropertyState.hpp>
- #include <com/sun/star/document/XStorageBasedDocument.hpp>
- #include <com/sun/star/document/XGraphicObjectResolver.hpp>
--#include <com/sun/star/script/XVBACompat.hpp>
-+#include <com/sun/star/script/XBasicLibraryInfo.hpp>
-
- #include <comphelper/componentcontext.hxx>
- #include <comphelper/processfactory.hxx>
-@@ -150,10 +150,10 @@ void importBindableAndListRangeBits( Dia
- sal_Bool isVBACompatModeOn( DialogImport* _pImport )
- {
- sal_Bool bVBAMode = sal_False;
-- Reference< script::XVBACompat > xVBACompat( _pImport->getScriptLibraryContainer(), UNO_QUERY );
-- if( xVBACompat.is() )
-+ Reference< script::XBasicLibraryInfo > xVBAInfo( _pImport->getScriptLibraryInfo(), UNO_QUERY );
-+ if( xVBAInfo.is() )
- {
-- bVBAMode = xVBACompat->getVBACompatModeOn();
-+ bVBAMode = xVBAInfo->getVBACompatMode();
- }
- return bVBAMode;
- }
-diff --git xmlscript/source/xmldlg_imexp/xmldlg_import.cxx xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
-index 5548016..97e852a 100644
---- xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
-+++ xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
-@@ -61,7 +61,7 @@
- #include <com/sun/star/view/SelectionType.hpp>
- #include <com/sun/star/document/XStorageBasedDocument.hpp>
- #include <com/sun/star/script/DocumentScriptLibraryContainer.hpp>
--#include <com/sun/star/script/XVBACompat.hpp>
-+#include <com/sun/star/script/XBasicLibraryInfo.hpp>
-
- using namespace ::com::sun::star;
- using namespace ::com::sun::star::uno;
-@@ -1878,24 +1878,32 @@ Reference< xml::input::XElement > Dialog
- return 0;
- }
- //__________________________________________________________________________________________________
--Reference< script::XLibraryContainer > DialogImport::getScriptLibraryContainer()
-+Reference< script::XBasicLibraryInfo > DialogImport::getScriptLibraryInfo()
- {
-- if( !_xScriptLibraryContainer.is() )
-- {
-- try
-- {
-- Reference< document::XStorageBasedDocument > xStorageDoc( _xDoc, UNO_QUERY );
-- if( xStorageDoc.is() )
-- _xScriptLibraryContainer.set(
-- script::DocumentScriptLibraryContainer::create( comphelper_getProcessComponentContext(), xStorageDoc ),
-- UNO_QUERY );
-- }
-- catch( const Exception& )
-- {
-- }
-- }
--
-- return _xScriptLibraryContainer;
-+ // #FIXME this is a hack, we should know about the library that
-+ // 'owns' the dialog ( in order to determine it's vba mode )
-+ Reference< script::XBasicLibraryInfo > xLib;
-+ if ( _xDoc.is() )
-+ {
-+ Reference< beans::XPropertySet > xProps( _xDoc, UNO_QUERY );
-+ if ( xProps.is() )
-+ {
-+ try
-+ {
-+ Reference< container::XNameAccess > xLibContainer;
-+ xProps->getPropertyValue( OUSTR("BasicLibraries") ) >>= xLibContainer;
-+ if ( xLibContainer.is() )
-+ {
-+ xLibContainer->getByName( OUSTR("Standard") ) >>= xLib;
-+ }
-+
-+ }
-+ catch( Exception& )
-+ {
-+ }
-+ }
-+ }
-+ return xLib;
- }
-
- //##################################################################################################
-@@ -1908,11 +1916,19 @@ Reference< xml::sax::XDocumentHandler >
- SAL_THROW( (Exception) )
- {
- DialogImport* pImport = new DialogImport( xContext, xDialogModel, xDocument );
-- uno::Reference< script::XVBACompat > xVBAModeSource( pImport->getScriptLibraryContainer(), uno::UNO_QUERY );
--
-- uno::Reference< script::XVBACompat > xVBAModeDest( xDialogModel, uno::UNO_QUERY );
-- if ( xVBAModeSource.is() && xVBAModeDest.is() )
-- xVBAModeDest->setVBACompatModeOn( xVBAModeSource->getVBACompatModeOn() );
-+ uno::Reference< script::XBasicLibraryInfo > xVBAModeSource( pImport->getScriptLibraryInfo(), uno::UNO_QUERY );
-+ uno::Reference< beans::XPropertySet > xDlgProps( xDialogModel, uno::UNO_QUERY );
-+ OSL_TRACE("importDialogModel xVBAModeSource %d, xDialogModel %d", xVBAModeSource.is(), xDlgProps.is() );
-+ if ( xVBAModeSource.is() && xVBAModeSource->getVBACompatMode() && xDlgProps.is() )
-+ {
-+ try
-+ {
-+ xDlgProps->setPropertyValue( OUSTR("VBAForm"), uno::makeAny( sal_True ) );
-+ }
-+ catch( Exception& )
-+ {
-+ }
-+ }
- return ::xmlscript::createDocumentHandler(
- static_cast< xml::input::XRoot * >( pImport ) );
- }
-diff --git xmlscript/source/xmllib_imexp/imp_share.hxx xmlscript/source/xmllib_imexp/imp_share.hxx
-index d602103..fdc0536 100644
---- xmlscript/source/xmllib_imexp/imp_share.hxx
-+++ xmlscript/source/xmllib_imexp/imp_share.hxx
-@@ -220,7 +220,6 @@ class LibrariesElement : public LibEleme
-
- protected:
- vector< LibDescriptor > mLibDescriptors;
--
- public:
- virtual Reference< xml::input::XElement > SAL_CALL startChildElement(
- sal_Int32 nUid, OUString const & rLocalName,
-@@ -244,7 +243,7 @@ class LibraryElement : public LibElement
- {
- protected:
- vector< OUString > mElements;
--
-+ ObjectModuleDescHash mObjectDescs;
- public:
-
- virtual Reference< xml::input::XElement > SAL_CALL startChildElement(
-diff --git xmlscript/source/xmllib_imexp/xmllib_export.cxx xmlscript/source/xmllib_imexp/xmllib_export.cxx
-index 4f6de54..1ee7c50 100644
---- xmlscript/source/xmllib_imexp/xmllib_export.cxx
-+++ xmlscript/source/xmllib_imexp/xmllib_export.cxx
-@@ -44,6 +44,28 @@ namespace xmlscript
- static OUString aTrueStr ( RTL_CONSTASCII_USTRINGPARAM("true") );
- static OUString aFalseStr( RTL_CONSTASCII_USTRINGPARAM("false") );
-
-+rtl::OUString lcl_getModuleTypeStringForType( sal_Int32 nModuleType )
-+{
-+ rtl::OUString sType;
-+ switch( nModuleType )
-+ {
-+ case script::ModuleType::Document:
-+ sType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Document" ) );
-+ break;
-+ case script::ModuleType::Class:
-+ sType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Class" ) );
-+ break;
-+ case script::ModuleType::Form:
-+ sType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Form" ) );
-+ break;
-+ case script::ModuleType::Normal: // no need to set a module type
-+ case script::ModuleType::Unknown:
-+ default:
-+ break;
-+ }
-+ return sType;
-+}
-+
- //##################################################################################################
-
-
-@@ -73,11 +95,10 @@ SAL_CALL exportLibraryContainer(
- pLibsElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM("xmlns:" XMLNS_XLINK_PREFIX) ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_XLINK_URI) ) );
-
--
-- xOut->ignorableWhitespace( OUString() );
-+ int nLibCount = pLibArray->mnLibCount;
- xOut->startElement( aLibrariesName, xAttributes );
-+ xOut->ignorableWhitespace( OUString() );
-
-- int nLibCount = pLibArray->mnLibCount;
- for( sal_Int32 i = 0 ; i < nLibCount ; i++ )
- {
- LibDescriptor& rLib = pLibArray->mpLibs[i];
-@@ -108,6 +129,9 @@ SAL_CALL exportLibraryContainer(
- rLib.bReadOnly ? aTrueStr : aFalseStr );
- }
-
-+ if( rLib.bVBAMode )
-+ pLibElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_LIBRARY_PREFIX ":vbaenabled") ), aTrueStr );
-+
- pLibElement->dump( xOut.get() );
- }
-
-@@ -153,10 +177,14 @@ SAL_CALL exportLibrary(
- if( rLib.bPreload )
- pLibElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_LIBRARY_PREFIX ":preload") ), aTrueStr );
-
-+/* if( rLib.bVBAMode )
-+ pLibElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_LIBRARY_PREFIX ":vbaenabled") ), aTrueStr );
-+*/
- sal_Int32 nElementCount = rLib.aElementNames.getLength();
- if( nElementCount )
- {
- const OUString* pElementNames = rLib.aElementNames.getConstArray();
-+
- for( sal_Int32 i = 0 ; i < nElementCount ; i++ )
- {
- XMLElement* pElement = new XMLElement( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_LIBRARY_PREFIX ":element" ) ) );
-@@ -165,7 +193,16 @@ SAL_CALL exportLibrary(
-
- pElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_LIBRARY_PREFIX ":name") ),
- pElementNames[i] );
--
-+ ObjectModuleDescHash::const_iterator it = rLib.hModuleTypeDesc.find( pElementNames[i] );
-+ if ( it != rLib.hModuleTypeDesc.end() )
-+ {
-+ rtl::OUString sType = lcl_getModuleTypeStringForType( it->second.mnModuleType );
-+ if ( sType.getLength() )
-+ {
-+ pElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_LIBRARY_PREFIX ":moduletype") ), sType );
-+ pElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_LIBRARY_PREFIX ":objectname") ), it->second.msObjectName );
-+ }
-+ }
- pLibElement->addSubElement( pElement );
- }
- }
-diff --git xmlscript/source/xmllib_imexp/xmllib_import.cxx xmlscript/source/xmllib_imexp/xmllib_import.cxx
-index b533d37..24b2834 100644
---- xmlscript/source/xmllib_imexp/xmllib_import.cxx
-+++ xmlscript/source/xmllib_imexp/xmllib_import.cxx
-@@ -44,7 +44,20 @@ namespace xmlscript
- {
-
- //##################################################################################################
--
-+sal_Int32 lcl_getModuleTypeForStringType( const rtl::OUString& rsType )
-+{
-+ // default to normal unknown
-+ sal_Int32 nType = com::sun::star::script::ModuleType::Unknown;
-+ if ( rsType.equalsIgnoreAsciiCase( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("class") ) ) )
-+ nType = com::sun::star::script::ModuleType::Class;
-+ else if ( rsType.equalsIgnoreAsciiCase( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("form") ) ) )
-+ nType = com::sun::star::script::ModuleType::Form;
-+ else if ( rsType.equalsIgnoreAsciiCase( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("document") ) ) )
-+ nType = com::sun::star::script::ModuleType::Document;
-+ else if ( rsType.equalsIgnoreAsciiCase( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("normal") ) ) )
-+ nType = com::sun::star::script::ModuleType::Normal;
-+ return nType;
-+}
- //__________________________________________________________________________________________________
- Reference< xml::input::XElement > LibElementBase::getParent()
- throw (RuntimeException)
-@@ -206,7 +219,11 @@ Reference< xml::input::XElement > Librar
- &aDesc.bPreload,
- OUString( RTL_CONSTASCII_USTRINGPARAM("preload") ),
- xAttributes, XMLNS_LIBRARY_UID );
--
-+/* getBoolAttr(
-+ &aDesc.bVBAMode,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("vbaenabled") ),
-+ xAttributes, XMLNS_LIBRARY_UID );
-+*/
- return new LibraryElement( rLocalName, xAttributes, 0, this );
- }
- else
-@@ -265,7 +282,10 @@ Reference< xml::input::XElement > Librar
- &aDesc.bPasswordProtected,
- OUString( RTL_CONSTASCII_USTRINGPARAM("passwordprotected") ),
- xAttributes, _pImport->XMLNS_LIBRARY_UID );
--
-+ getBoolAttr(
-+ &aDesc.bVBAMode,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("vbaenabled") ),
-+ xAttributes, _pImport->XMLNS_LIBRARY_UID );
- mLibDescriptors.push_back( aDesc );
- return new LibraryElement( rLocalName, xAttributes, this, _pImport );
- }
-@@ -312,6 +332,17 @@ Reference< xml::input::XElement > Librar
- if (aValue.getLength())
- mElements.push_back( aValue );
-
-+ ObjectModuleDesc aDesc;
-+
-+ aDesc.mnModuleType = lcl_getModuleTypeForStringType(
-+ xAttributes->getValueByUidName(
-+ _pImport->XMLNS_LIBRARY_UID,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("moduletype") ) ) );
-+ aDesc.msObjectName = xAttributes->getValueByUidName(
-+ _pImport->XMLNS_LIBRARY_UID,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("objectname") ) );
-+ if ( aValue.getLength() && aDesc.mnModuleType != ::com::sun::star::script::ModuleType::Unknown )
-+ mObjectDescs[ aValue ] = aDesc;
- return new LibElementBase( rLocalName, xAttributes, this, _pImport );
- }
- else
-@@ -335,6 +366,7 @@ void LibraryElement::endElement()
- if( !pLib )
- pLib = &static_cast< LibrariesElement* >( _pParent )->mLibDescriptors.back();
- pLib->aElementNames = aElementNames;
-+ pLib->hModuleTypeDesc = mObjectDescs;
- }
-
-
-@@ -348,6 +380,15 @@ SAL_CALL importLibraryContainer( LibDesc
- static_cast< xml::input::XRoot * >( new LibraryImport( pLibArray ) ) );
- }
-
-+
-+Reference< ::com::sun::star::xml::sax::XDocumentHandler >
-+SAL_CALL importLibraryCodeNames( LibDescriptor& rLib)
-+ SAL_THROW( (Exception) )
-+{
-+ return importLibrary( rLib );
-+}
-+
-+
- //##################################################################################################
-
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler >
-@@ -360,6 +401,13 @@ SAL_CALL importLibrary( LibDescriptor& r
-
-
- //##################################################################################################
-+LibDescriptor::LibDescriptor()
-+{
-+ bLink = sal_False;
-+ bReadOnly = sal_False;
-+ bPasswordProtected = sal_False;
-+ bVBAMode = sal_False;
-+}
-
- LibDescriptorArray::LibDescriptorArray( sal_Int32 nLibCount )
- {
diff --git a/patches/vba/native-export/vbainfo-import-export-support.diff b/patches/vba/native-export/vbainfo-import-export-support.diff
deleted file mode 100644
index 6bf7c5bdf..000000000
--- a/patches/vba/native-export/vbainfo-import-export-support.diff
+++ /dev/null
@@ -1,966 +0,0 @@
-diff --git basic/source/basmgr/basmgr.cxx basic/source/basmgr/basmgr.cxx
-index 864a941..158c894 100644
---- basic/source/basmgr/basmgr.cxx
-+++ basic/source/basmgr/basmgr.cxx
-@@ -71,6 +71,7 @@
- #include <com/sun/star/script/ModuleInfo.hpp>
- #include <com/sun/star/script/ModuleType.hpp>
- #include <com/sun/star/script/XBasicLibraryInfo.hpp>
-+#include <com/sun/star/script/XVBALibraryListener.hpp>
-
- #include <cppuhelper/implbase1.hxx>
-
-@@ -194,6 +195,54 @@ public:
- throw(::com::sun::star::uno::RuntimeException);
- };
-
-+//typedef cppu::ImplInheritanceHelper1< BasMgrContainerListenerImpl, XVBALibraryListener > LibListenerBase;
-+
-+typedef ::cppu::WeakImplHelper1< XVBALibraryListener > LibListenerBase;
-+
-+class LibraryListener : public LibListenerBase
-+{
-+ BasicManager* mpMgr;
-+ ::rtl::OUString maLibName;
-+ std::auto_ptr< BasMgrContainerListenerImpl > mpListener;
-+public:
-+
-+LibraryListener( BasicManager* pMgr, ::rtl::OUString aLibName ) : mpMgr( pMgr ), maLibName( aLibName )
-+{
-+ mpListener.reset( new BasMgrContainerListenerImpl( pMgr, aLibName ) );
-+}
-+// XEventListener
-+virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException)
-+{
-+ if ( mpListener.get() )
-+ mpListener->disposing( Source );
-+}
-+
-+// XVBALibraryListener
-+virtual void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException)
-+{
-+ if ( mpListener.get() )
-+ mpListener->elementInserted( Event );
-+}
-+
-+virtual void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException)
-+{
-+ if ( mpListener.get() )
-+ mpListener->elementReplaced( Event );
-+}
-+virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException)
-+{
-+ if ( mpListener.get() )
-+ mpListener->elementRemoved( Event );
-+}
-+
-+void modeChanged( sal_Bool mode ) throw( RuntimeException )
-+{
-+ OSL_TRACE("**** vba mode changed %d", mode );
-+ StarBASIC* pLib = mpMgr->GetLib( maLibName );
-+ if ( pLib )
-+ pLib->SetVBAEnabled( mode );
-+}
-+};
-
- //============================================================================
- // BasMgrContainerListenerImpl
-@@ -219,9 +268,12 @@ void BasMgrContainerListenerImpl::insert
- if( xLibContainer.is() )
- {
- // Register listener for library
-+// Reference< XContainerListener > xLibraryListener
-+// = static_cast< XContainerListener* >
-+// ( new BasMgrContainerListenerImpl( pMgr, aLibName ) );
- Reference< XContainerListener > xLibraryListener
- = static_cast< XContainerListener* >
-- ( new BasMgrContainerListenerImpl( pMgr, aLibName ) );
-+ ( new LibraryListener( pMgr, aLibName ) );
- xLibContainer->addContainerListener( xLibraryListener );
- }
-
-@@ -399,7 +451,6 @@ void SAL_CALL BasMgrContainerListenerImp
- }
- }
-
--
- //=====================================================================
-
- class BasicErrorManager
-diff --git basic/source/inc/namecont.hxx basic/source/inc/namecont.hxx
-index f2760b8..fec20e6 100644
---- basic/source/inc/namecont.hxx
-+++ basic/source/inc/namecont.hxx
-@@ -176,6 +176,7 @@ public:
- virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference<
- ::com::sun::star::container::XContainerListener >& xListener )
- throw (::com::sun::star::uno::RuntimeException);
-+ ::cppu::OInterfaceContainerHelper& getListeners() { return maListenerContainer; }
- };
-
- //============================================================================
-@@ -576,7 +577,7 @@ protected:
- void implSetModified( sal_Bool _bIsModified );
- typedef std::hash_map< rtl::OUString, com::sun::star::script::ModuleInfo, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > NameToInfoHash;
- NameToInfoHash hBasicInfo;
--
-+ ::cppu::OInterfaceContainerHelper& getListeners() { return maNameContainer.getListeners(); }
- private:
- /** checks whether the lib is readonly, or a readonly link, throws an IllegalArgumentException if so
- */
-diff --git basic/source/inc/scriptcont.hxx basic/source/inc/scriptcont.hxx
-index 9a7bb87..9afd182 100644
---- basic/source/inc/scriptcont.hxx
-+++ basic/source/inc/scriptcont.hxx
-@@ -153,7 +153,6 @@ class SfxScriptLibrary : public SfxLibra
- sal_Bool mbLoadedSource;
- sal_Bool mbLoadedBinary;
- sal_Bool mbVBA;
--
- // Provide modify state including resources
- virtual sal_Bool isModified( void );
- virtual void storeResources( void );
-@@ -195,6 +194,7 @@ public:
- throw(::com::sun::star::container::NoSuchElementException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
-+ // Methods XContainer
- static bool containsValidModule( const ::com::sun::star::uno::Any& _rElement );
- DECLARE_XINTERFACE()
- DECLARE_XTYPEPROVIDER()
-diff --git basic/source/uno/namecont.cxx basic/source/uno/namecont.cxx
-index a777d23..2ba2ca5 100644
---- basic/source/uno/namecont.cxx
-+++ basic/source/uno/namecont.cxx
-@@ -102,6 +102,58 @@ using namespace osl;
-
- using com::sun::star::uno::Reference;
-
-+// #TODO move this to SfxLibrary ? probably we need to to gaurantee
-+// consistency
-+::xmlscript::ObjectModuleDescHash lcl_getObjModDescHash( SfxLibrary& rLib )
-+{
-+ Reference< XNameContainer > xNameContainer( &rLib );
-+ Reference< XBasicLibraryInfo > xLibInfo( xNameContainer, UNO_QUERY );
-+ uno::Sequence< ::rtl::OUString > sModuleNames = rLib.getElementNames();
-+ sal_Int32 nElem = sModuleNames.getLength();
-+ ::xmlscript::ObjectModuleDescHash hResult;
-+ for ( sal_Int32 i = 0; xLibInfo.is() && i < nElem; ++i )
-+ {
-+ rtl::OUString sCodeName( sModuleNames[ i ] );
-+ ModuleInfo mInfo = xLibInfo->getModuleInfo( sCodeName );
-+ ::xmlscript::ObjectModuleDesc aDesc;
-+ aDesc.mnModuleType = mInfo.ModuleType;
-+ switch ( mInfo.ModuleType )
-+ {
-+ case ModuleType::Form:
-+ aDesc.msObjectName = sCodeName;
-+ hResult[ sCodeName ] = aDesc;
-+ break;
-+ case ModuleType::Document:
-+ {
-+ Reference< XServiceInfo > xSI( mInfo.ModuleObject, UNO_QUERY );
-+ if ( xSI.is() && xSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.excel.Workbook" ) ) ) )
-+ aDesc.msObjectName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ThisWorkbook" ) );
-+ else
-+ {
-+ SbUnoObjectRef pSbUnoObject = new SbUnoObject( String(), uno::makeAny( mInfo.ModuleObject ) );
-+ SbxVariable* pVar = pSbUnoObject->Find( String( RTL_CONSTASCII_USTRINGPARAM("Name") ), SbxCLASS_DONTCARE );
-+ if ( pVar )
-+ {
-+ pVar->Broadcast( SBX_HINT_DATAWANTED );
-+ if ( pVar->SbxValue::GetType() == SbxSTRING )
-+ {
-+ aDesc.msObjectName = pVar->GetString();
-+ }
-+ }
-+ }
-+ hResult[ sCodeName ] = aDesc;
-+ }
-+ case ModuleType::Class:
-+ case ModuleType::Normal:
-+ break; // no codenames for these
-+ default:
-+ break; // shouldn't get here ( #TODO assertion or whatever )
-+ }
-+ }
-+ return hResult;
-+}
-+
-+
- // #i34411: Flag for error handling during migration
- static bool GbMigrationSuppressErrors = false;
-
-@@ -896,6 +948,19 @@ sal_Bool SfxLibraryContainer::init_Impl(
- {
- OUString aIndexFileName;
- sal_Bool bLoaded = implLoadLibraryIndexFile( pImplLib, rLib, xLibraryStor, aIndexFileName );
-+
-+ if ( rLib.aName.equalsAscii("Standard") )
-+ {
-+ OSL_TRACE("*** iteration %d have got Standard Library**** VBA MODE is %d", i, rLib.bVBAMode );
-+ // can't use the api here ( because setVBACompat will try to
-+ // convert the Libraries )
-+ Reference< XNameContainer > xLib( pImplLib );
-+ Reference< XBasicLibraryInfo > xLibInfo( xLib, UNO_QUERY );
-+ if ( xLibInfo.is() )
-+ xLibInfo->setVBACompatMode( rLib.bVBAMode );
-+
-+ }
-+
- if( bLoaded && aLibName != rLib.aName )
- {
- OSL_ENSURE( 0, "Different library names in library"
-@@ -1142,6 +1207,14 @@ sal_Bool SfxLibraryContainer::init_Impl(
- /*sal_Bool bReadIndexFile =*/ implLoadLibraryIndexFile
- ( pNewLib, aLibDesc, xDummyStor, pNewLib->maLibInfoFileURL );
- implImportLibDescriptor( pNewLib, aLibDesc );
-+ if( aLibName == aStandardStr )
-+ {
-+ // can't use the api here ( because setVBACompat will try to
-+ // convert the Libraries )
-+ Reference< XBasicLibraryInfo > xLibInfo( xLib, UNO_QUERY );
-+ if ( xLibInfo.is() )
-+ xLibInfo->setVBACompatMode( aLibDesc.bVBAMode );
-+ }
- }
- }
- mxSFI->kill( aPrevFolder );
-@@ -1724,15 +1797,47 @@ void SfxLibraryContainer::implImportLibD
- const OUString* pElementNames = rLib.aElementNames.getConstArray();
- Reference< XNameContainer > xLib( pLib );
- Reference< XBasicLibraryInfo > xLibInfo( xLib, UNO_QUERY );
-+ ::xmlscript::ObjectModuleDescHash::iterator it_end = rLib.hModuleTypeDesc.end();
- Any aDummyElement = createEmptyLibraryElement();
- for( sal_Int32 i = 0 ; i < nElementCount ; i++ )
- {
- // default the module type
- com::sun::star::script::ModuleInfo mInfo;
- mInfo.ModuleType = ModuleType::Normal;
-+ if ( xLibInfo.is() && xLibInfo->getVBACompatMode() )
-+ {
-+ ::xmlscript::ObjectModuleDescHash::iterator it = rLib.hModuleTypeDesc.find( pElementNames[i] );
-+
-+ mInfo.ModuleName = pElementNames[i];
-+ if ( it != it_end )
-+ {
-+ mInfo.ModuleType = it->second.mnModuleType;
-+ // hack for userform, needs to know about the document
-+ // well really it needs the dialog library
-+ if ( mInfo.ModuleType == ModuleType::Form )
-+ mInfo.ModuleObject = mxOwnerDocument;
-+ else
-+ {
-+ try
-+ {
-+ Reference< XMultiServiceFactory> xSF( mxOwnerDocument.get(), uno::UNO_QUERY);
-+ uno::Reference< container::XNameAccess > xVBACodeNamedObjectAccess;
-+ if ( xSF.is() )
-+ xVBACodeNamedObjectAccess.set( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.vba.VBAObjectModuleObjectProvider"))), uno::UNO_QUERY );
-+ // get the api object for the codename
-+ if ( xVBACodeNamedObjectAccess.is() )
-+ mInfo.ModuleObject.set( xVBACodeNamedObjectAccess->getByName( mInfo.ModuleName ), uno::UNO_QUERY );
-+ }
-+ catch( Exception& e )
-+ {
-+ DBG_UNHANDLED_EXCEPTION();
-+ }
-
-- pLib->maNameContainer.insertByName( pElementNames[i], aDummyElement );
-+ }
-+ }
-+ }
- pLib->hBasicInfo[ pElementNames[i] ] = mInfo;
-+ pLib->maNameContainer.insertByName( pElementNames[i], aDummyElement );
- }
- pLib->mbPasswordProtected = rLib.bPasswordProtected;
- pLib->mbReadOnly = rLib.bReadOnly;
-@@ -1856,6 +1961,33 @@ void SfxLibraryContainer::storeLibraries
- rLib.bPreload = pImplLib->mbPreload;
- rLib.bPasswordProtected = pImplLib->mbPasswordProtected;
- rLib.aElementNames = pImplLib->getElementNames();
-+ // #FIXME the codenames probably should be in the LibDescriptor
-+ // ok there should be a special code name for the document ( e.g. ThisWorkbook, ThisDocument etc.) this probably should exist in LibDescriptorArray
-+ // hmm there possibly could be a problem distinguising that on
-+ // excel import ( because it is just another Document Module )
-+ // Hmm but also vba mode should only really be relevant for Standand
-+ // Library ( and I would say no other libraries should even exist )
-+ // so, leaving for the moment
-+ if ( pName->equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Standard") ) ) )
-+ {
-+#if 0
-+// until we by default remove supporting the Option VBASupport thingy in the
-+// source we can't trust xLibInfo because it is intended that the mode
-+// is set only via the api ( and not internally )
-+ Reference< XNameContainer > xNameContainer( pImplLib );
-+ Reference< XBasicLibraryInfo > xLibInfo( xNameContainer, UNO_QUERY );
-+ rLib.bVBAMode = xLibInfo.is() ? xLibInfo->getVBACompatMode() : sal_False;
-+#else
-+ BasicManager* pBasicMgr = getBasicManager();
-+ StarBASIC* pBasicLib = pBasicMgr ? pBasicMgr->GetLib( String( RTL_CONSTASCII_USTRINGPARAM("Standard") ) ) : NULL;
-+ Reference< XModel > xDocument( mxOwnerDocument.get(), UNO_QUERY );
-+ rLib.bVBAMode = xDocument.is() && pBasicLib ? pBasicLib->isVBAEnabled() : sal_False;
-+#endif
-+ if ( !rLib.bVBAMode )
-+ rLib.hModuleTypeDesc = ::xmlscript::ObjectModuleDescHash();
-+ else
-+ rLib.hModuleTypeDesc = lcl_getObjModDescHash( *pImplLib );
-+ }
-
- if( pImplLib->implIsModified() || bComplete )
- {
-diff --git basic/source/uno/sbservices.cxx basic/source/uno/sbservices.cxx
-index a2a4ded..aa076ea 100644
---- basic/source/uno/sbservices.cxx
-+++ basic/source/uno/sbservices.cxx
-@@ -43,6 +43,7 @@ namespace basic
- //--------------------------------------------------------------------
- extern void createRegistryInfo_SfxDialogLibraryContainer();
- extern void createRegistryInfo_SfxScriptLibraryContainer();
-+ extern void createRegistryInfo_PersistedReadOnlyCodeNames();
-
- static void initializeModule()
- {
-@@ -54,6 +55,7 @@ namespace basic
- {
- createRegistryInfo_SfxDialogLibraryContainer();
- createRegistryInfo_SfxScriptLibraryContainer();
-+ createRegistryInfo_PersistedReadOnlyCodeNames();
- }
- }
- }
-diff --git basic/source/uno/scriptcont.cxx basic/source/uno/scriptcont.cxx
-index e64041a..0d16c46 100644
---- basic/source/uno/scriptcont.cxx
-+++ basic/source/uno/scriptcont.cxx
-@@ -58,6 +58,7 @@
- #include <tools/urlobj.hxx>
-
- #include <com/sun/star/script/ModuleSourceInfo.hpp>
-+#include <com/sun/star/script/XVBALibraryListener.hpp>
- #include <svtools/pathoptions.hxx>
- #include <svtools/sfxecode.hxx>
- #include <svtools/ehdl.hxx>
-@@ -1064,6 +1065,11 @@ SfxScriptLibraryContainer:: HasExecutabl
-
- //============================================================================
- // Service
-+class PersistedReadOnlyCodeNames;
-+void createRegistryInfo_PersistedReadOnlyCodeNames()
-+{
-+ static OAutoRegistration< PersistedReadOnlyCodeNames > aAutoRegistration;
-+}
- void createRegistryInfo_SfxScriptLibraryContainer()
- {
- static OAutoRegistration< SfxScriptLibraryContainer > aAutoRegistration;
-@@ -1136,6 +1142,7 @@ SfxScriptLibrary::SfxScriptLibrary( Modi
- , mbLoadedSource( sal_False )
- , mbLoadedBinary( sal_False )
- , mbVBA( sal_False )
-+
- {
- }
-
-@@ -1151,7 +1158,28 @@ SfxScriptLibrary::getVBACompatMode() thr
- void SAL_CALL
- SfxScriptLibrary::setVBACompatMode( ::sal_Bool _vbacompatmodeon ) throw (RuntimeException)
- {
-+ bool triggerModeChange = ( mbVBA != _vbacompatmodeon );
- mbVBA = _vbacompatmodeon;
-+ if ( triggerModeChange )
-+ {
-+ implSetModified( true );
-+ OInterfaceIteratorHelper aIterator( getListeners() );
-+ while( aIterator.hasMoreElements() )
-+ {
-+ Reference< XInterface > xIface = aIterator.next();
-+ Reference< XVBALibraryListener > xListener( xIface, UNO_QUERY );
-+ if ( xListener.is() )
-+ {
-+ try
-+ {
-+ xListener->modeChanged( mbVBA );
-+ }
-+ catch( Exception& )
-+ {
-+ }
-+ }
-+ }
-+ }
- }
-
- // Methods
-@@ -1258,7 +1286,134 @@ bool SAL_CALL SfxScriptLibrary::isLibrar
- {
- return SfxScriptLibrary::containsValidModule( aElement );
- }
-+typedef ::cppu::WeakImplHelper3< container::XNameAccess, lang::XInitialization, lang::XServiceInfo > ReadOnlyCodeNames_BASE;
-
-+// XNameAccess, codename to/from objectnames
-+class PersistedReadOnlyCodeNames : ReadOnlyCodeNames_BASE
-+{
-+typedef std::hash_map< rtl::OUString, rtl::OUString, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > CodeNameHash;
-+
-+ CodeNameHash mCodeNameToObjectNames;
-+public:
-+ PersistedReadOnlyCodeNames()
-+ {
-+ }
-+ // Methods - XInitialise
-+ virtual void SAL_CALL initialize( const uno::Sequence< uno::Any >& aArguments ) throw (uno::Exception, uno::RuntimeException)
-+ {
-+ if ( !aArguments.getLength() )
-+ throw RuntimeException();
-+ Reference< document::XStorageBasedDocument > xDocument( aArguments[ 0 ], uno::UNO_QUERY_THROW );
-+ Reference< embed::XStorage > xDocStorage;
-+ try
-+ {
-+ Reference< XMultiServiceFactory > xMSF = comphelper::getProcessServiceFactory();
-+ Reference< XServiceInfo > xSI( xDocument, UNO_QUERY_THROW );
-+ if ( xSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.OfficeDocument" ) ) ) )
-+ xDocStorage.set( xDocument->getDocumentStorage(), UNO_QUERY_THROW );
-+ if ( xDocStorage.is() ) // not a 'real' document
-+ {
-+ rtl::OUString codeNameDir( RTL_CONSTASCII_USTRINGPARAM("Basic") );
-+ rtl::OUString standardDir( RTL_CONSTASCII_USTRINGPARAM("Standard") );
-+ rtl::OUString codeNameFile( RTL_CONSTASCII_USTRINGPARAM("script-lb.xml") );
-+
-+ uno::Reference< embed::XStorage > xLibrariesStor( xDocStorage->openStorageElement( codeNameDir, embed::ElementModes::READ ), UNO_QUERY_THROW );
-+ uno::Reference< embed::XStorage > xStandardStor( xLibrariesStor->openStorageElement( standardDir, embed::ElementModes::READ ), UNO_QUERY_THROW );
-+ uno::Reference< io::XStream > xStream( xStandardStor->openStreamElement( codeNameFile, embed::ElementModes::READ ), UNO_QUERY_THROW );
-+ uno::Reference< io::XInputStream > xInput( xStream->getInputStream(), UNO_QUERY_THROW );
-+ ::xmlscript::LibDescriptor aLib;
-+ InputSource source;
-+ source.aInputStream = xInput;
-+
-+ Reference< XParser > xParser( xMSF->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser") ) ), UNO_QUERY_THROW );
-+ xParser->setDocumentHandler( ::xmlscript::importLibraryCodeNames( aLib ) );
-+ xParser->parseStream( source );
-+
-+ ::xmlscript::ObjectModuleDescHash::iterator it_end = aLib.hModuleTypeDesc.end();
-+ for ( ::xmlscript::ObjectModuleDescHash::iterator it = aLib.hModuleTypeDesc.begin(); it != it_end; ++it )
-+ {
-+ if ( it->second.msObjectName.getLength() > 0 )
-+ mCodeNameToObjectNames[ it->second.msObjectName ] = it->first;
-+ }
-+ }
-+ }
-+ catch ( Exception& e )
-+ {
-+ OSL_TRACE("Urk, should never get here, help!!");
-+ }
-+ }
-+ // Methods - XNameAccess
-+ virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ ::xmlscript::CodeNameHash::iterator it = mCodeNameToObjectNames.find( aName );
-+ if ( it == mCodeNameToObjectNames.end() )
-+ throw container::NoSuchElementException();
-+ return uno::makeAny( it->second );
-+ }
-+ virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException)
-+ {
-+ uno::Sequence< ::rtl::OUString > sNames( mCodeNameToObjectNames.size() );
-+ ::rtl::OUString* pStr = sNames.getArray();
-+ ::xmlscript::CodeNameHash::iterator it = mCodeNameToObjectNames.begin();
-+ ::xmlscript::CodeNameHash::iterator it_end = mCodeNameToObjectNames.end();
-+ for ( ; it != it_end ; ++it, ++pStr )
-+ *pStr = it->first;
-+ return sNames;
-+ }
-+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
-+ {
-+ return ( mCodeNameToObjectNames.find( aName ) != mCodeNameToObjectNames.end() );
-+ }
-+ // Methods - XElementAccess
-+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
-+ {
-+ return ::getCppuType( (const rtl::OUString *)0 );
-+ }
-+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( mCodeNameToObjectNames.size() > 0 );
-+ }
-+ // Methods XServiceInfo
-+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException)
-+ {
-+ return getImplementationName_static();
-+ }
-+ virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException)
-+ {
-+ uno::Sequence< rtl::OUString > sNames( getSupportedServiceNames() );
-+ rtl::OUString* pStr = sNames.getArray();
-+ rtl::OUString* pEnd = ( sNames.getArray() + sNames.getLength() );
-+ for ( ; pStr != pEnd ; ++pStr )
-+ {
-+ if ( (*pStr).equals( ServiceName ) )
-+ return sal_True;
-+ }
-+ return sal_False;
-+ }
-+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException)
-+ {
-+ return getSupportedServiceNames_static();
-+ }
-+ // Service
-+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static()
-+ {
-+ uno::Sequence< rtl::OUString > sServiceNames(1);
-+ sServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.vba.PersistedCodeNames"));
-+ return sServiceNames;
-+ }
-+ static ::rtl::OUString getImplementationName_static()
-+ {
-+ static OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("PersistedReadOnlyCodeNames") );
-+ return sImplName;
-+ }
-+
-+ static Reference< XInterface > SAL_CALL Create ( const Reference< XComponentContext >& xServiceManager ) throw( Exception )
-+ {
-+ Reference< XInterface > xRet =
-+ static_cast< XInterface* >( static_cast< OWeakObject* >( new PersistedReadOnlyCodeNames() ));
-+ return xRet;
-+ }
-+};
- //============================================================================
-
- } // namespace basic
-diff --git offapi/com/sun/star/script/XVBALibraryListener.idl offapi/com/sun/star/script/XVBALibraryListener.idl
-new file mode 100644
-index 0000000..0c9a637
---- /dev/null
-+++ offapi/com/sun/star/script/XVBALibraryListener.idl
-@@ -0,0 +1,16 @@
-+#ifndef __com_sun_star_script_XVBALibraryListener_idl__
-+#define __com_sun_star_script_XVBALibraryListener_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+#include <com/sun/star/container/XContainerListener.idl>
-+#endif
-+module com { module sun { module star { module script {
-+
-+interface XVBALibraryListener: ::com::sun::star::container::XContainerListener
-+{
-+ void modeChanged( [in] boolean mode );
-+
-+}; }; }; };
-+};
-diff --git offapi/com/sun/star/script/makefile.mk offapi/com/sun/star/script/makefile.mk
-index ea9bbd1..cfdf281 100644
---- offapi/com/sun/star/script/makefile.mk
-+++ offapi/com/sun/star/script/makefile.mk
-@@ -52,6 +52,8 @@ IDLFILES=\
- XPersistentLibraryContainer.idl\
- XStorageBasedLibraryContainer.idl\
- XLibraryQueryExecutable.idl \
-+ XBasicLibraryInfo.idl \
-+ XVBALibraryListener.idl \
- ModuleSizeExceededRequest.idl\
-
- # ------------------------------------------------------------------
-diff --git sc/inc/document.hxx sc/inc/document.hxx
-index 35fd858..8b608f1 100644
---- sc/inc/document.hxx
-+++ sc/inc/document.hxx
-@@ -34,6 +34,7 @@
-
- #include <vcl/prntypes.hxx>
- #include <vcl/timer.hxx>
-+#include <com/sun/star/container/XNameAccess.hpp>
- #include <com/sun/star/uno/Reference.hxx>
- #include <vos/ref.hxx>
- #include "scdllapi.h"
-@@ -319,7 +320,7 @@ private:
- Timer aTrackTimer;
-
- com::sun::star::uno::Reference< com::sun::star::document::XVbaEventsHelper > mxVbaEventsHelper;
--
-+ com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > mxCodeNames;
- public:
- ScTabOpList aTableOpList; // list of ScInterpreterTableOpParams currently in use
- ScInterpreterTableOpParams aLastTableOpParams; // remember last params
-@@ -439,6 +440,7 @@ public:
- SfxObjectShell* pDocShell = NULL );
- ~ScDocument();
-
-+ com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > GetPersistedCodeNames() throw( com::sun::star::uno::RuntimeException );
- inline ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
- GetServiceManager() const { return xServiceManager; }
-
-diff --git sc/source/core/data/documen2.cxx sc/source/core/data/documen2.cxx
-index aa0bafd..e867e99 100644
---- sc/source/core/data/documen2.cxx
-+++ sc/source/core/data/documen2.cxx
-@@ -263,6 +263,7 @@ ScDocument::ScDocument( ScDocumentMode e
-
- aTrackTimer.SetTimeoutHdl( LINK( this, ScDocument, TrackTimeHdl ) );
- aTrackTimer.SetTimeout( 100 );
-+ aDocCodeName = String( RTL_CONSTASCII_USTRINGPARAM("ThisWorkbook") );
- }
-
-
-diff --git sc/source/core/data/document.cxx sc/source/core/data/document.cxx
-index a94a264..e94e4f7 100644
---- sc/source/core/data/document.cxx
-+++ sc/source/core/data/document.cxx
-@@ -52,6 +52,7 @@
- #include <unotools/charclass.hxx>
- #include <unotools/transliterationwrapper.hxx>
- #include <tools/tenccvt.hxx>
-+#include <comphelper/processfactory.hxx>
-
- #include "document.hxx"
- #include "table.hxx"
-@@ -4485,5 +4486,32 @@ BOOL ScDocument::NeedPageResetAfterTab(
- return FALSE; // sonst nicht
- }
-
-+using namespace ::com::sun::star;
-+
-+uno::Reference< container::XNameAccess >
-+ScDocument::GetPersistedCodeNames() throw( uno::RuntimeException )
-+{
-+ SfxObjectShell* pObjShell = GetDocumentShell();
-+ if ( pShell && !mxCodeNames.is() )
-+ {
-+ uno::Sequence< uno::Any > aArgs( 1 );
-+ aArgs[ 0 ] = uno::makeAny( pObjShell->GetModel() );
-+ mxCodeNames.set( ::comphelper::getProcessServiceFactory()->createInstanceWithArguments(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.vba.PersistedCodeNames")), aArgs), uno::UNO_QUERY );
-+ if ( mxCodeNames.is() )
-+ {
-+ rtl::OUString sWorkbook( RTL_CONSTASCII_USTRINGPARAM("ThisWorkbook") );
-+ if ( mxCodeNames->hasByName( sWorkbook ) )
-+ {
-+
-+ rtl::OUString sCodeName;
-+ mxCodeNames->getByName( sWorkbook ) >>= sCodeName;
-+ SetCodeName( sCodeName );
-+ }
-+ }
-+ }
-+ return mxCodeNames;
-+}
-+
-+
-
-
-diff --git sc/source/filter/xml/xmlsubti.cxx sc/source/filter/xml/xmlsubti.cxx
-index c56f867..34bcce3 100644
---- sc/source/filter/xml/xmlsubti.cxx
-+++ sc/source/filter/xml/xmlsubti.cxx
-@@ -246,6 +246,27 @@ void ScMyTables::NewSheet(const rtl::OUS
- }
- }
- }
-+
-+ ScDocument *pDoc = ScXMLConverter::GetScDocument(rImport.GetModel());
-+ // Codenames need to be set as sheets are created and read
-+ if ( pDoc )
-+ {
-+ String sName;
-+ pDoc->GetName( nCurrentSheet, sName );
-+ OSL_TRACE("** import processing %s", rtl::OUStringToOString( sName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ rtl::OUString sOUName( sName );
-+ uno::Reference< container::XNameAccess > xCodeNames( pDoc->GetPersistedCodeNames() );
-+ if( xCodeNames.is() && xCodeNames->hasByName( sName ) )
-+ {
-+ rtl::OUString sOUSCodeName;
-+ xCodeNames->getByName( sName ) >>= sOUSCodeName;
-+ OSL_TRACE("** import processing setting codename %s for %s", rtl::OUStringToOString( sOUSCodeName, RTL_TEXTENCODING_UTF8 ).getStr(), rtl::OUStringToOString( sName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ rImport.LockSolarMutex();
-+ String sCodeName( sOUSCodeName );
-+ pDoc->SetCodeName( nCurrentSheet, sCodeName );
-+ rImport.UnlockSolarMutex();
-+ }
-+ }
- rImport.SetTableStyle(sStyleName);
-
- if ( sStyleName.getLength() )
-diff --git sc/source/ui/vba/vbaeventshelper.cxx sc/source/ui/vba/vbaeventshelper.cxx
-index a315af0..b4d0bd9 100644
---- sc/source/ui/vba/vbaeventshelper.cxx
-+++ sc/source/ui/vba/vbaeventshelper.cxx
-@@ -620,7 +620,7 @@ String ScVbaEventsHelper::getSheetModule
- {
- ScExtDocOptions* pExtOptions = pDoc->GetExtDocOptions();
- String aCodeName;
-- pDoc->GetName( nTab, aCodeName);
-+ pDoc->GetCodeName( nTab, aCodeName);
- // Use code name if that exists
- if ( pExtOptions )
- aCodeName = pExtOptions->GetCodeName( nTab );
-diff --git xmlscript/inc/xmlscript/xmllib_imexp.hxx xmlscript/inc/xmlscript/xmllib_imexp.hxx
-index 9a3048f..93826a9 100644
---- xmlscript/inc/xmlscript/xmllib_imexp.hxx
-+++ xmlscript/inc/xmlscript/xmllib_imexp.hxx
-@@ -34,11 +34,21 @@
- #include <com/sun/star/uno/Sequence.hxx>
-
- #include "xmlscript/xmlns.h"
--
-+#include <hash_map>
-+#include <com/sun/star/script/ModuleType.hpp>
-
- namespace xmlscript
- {
-+struct ObjectModuleDesc
-+{
-+ rtl::OUString msObjectName;
-+ sal_Int32 mnModuleType;
-+ObjectModuleDesc() : mnModuleType( ::com::sun::star::script::ModuleType::Normal ) {}
-+};
-
-+typedef std::hash_map< rtl::OUString,
-+ObjectModuleDesc, ::rtl::OUStringHash,
-+::std::equal_to< ::rtl::OUString > > ObjectModuleDescHash;
- //==============================================================================
- // Library container export
- // HACK C++ struct to transport info. Later the container
-@@ -51,10 +61,15 @@ struct LibDescriptor
- sal_Bool bLink;
- sal_Bool bReadOnly;
- sal_Bool bPasswordProtected;
-+ sal_Bool bVBAMode;
- ::com::sun::star::uno::Sequence< ::rtl::OUString > aElementNames;
- sal_Bool bPreload;
-+ ObjectModuleDescHash hModuleTypeDesc;
-+ LibDescriptor();
- };
-
-+typedef std::hash_map< rtl::OUString, rtl::OUString, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > CodeNameHash;
-+
- struct LibDescriptorArray
- {
- LibDescriptor* mpLibs;
-@@ -79,6 +94,11 @@ SAL_CALL exportLibraryContainer(
- SAL_CALL importLibraryContainer( LibDescriptorArray* pLibArray )
- SAL_THROW( (::com::sun::star::uno::Exception) );
-
-+::com::sun::star::uno::Reference<
-+ ::com::sun::star::xml::sax::XDocumentHandler >
-+SAL_CALL importLibraryCodeNames( LibDescriptor& rLib )
-+ SAL_THROW( (::com::sun::star::uno::Exception) );
-+
-
- void
- SAL_CALL exportLibrary(
-diff --git xmlscript/source/xmllib_imexp/imp_share.hxx xmlscript/source/xmllib_imexp/imp_share.hxx
-index d602103..fdc0536 100644
---- xmlscript/source/xmllib_imexp/imp_share.hxx
-+++ xmlscript/source/xmllib_imexp/imp_share.hxx
-@@ -220,7 +220,6 @@ class LibrariesElement : public LibEleme
-
- protected:
- vector< LibDescriptor > mLibDescriptors;
--
- public:
- virtual Reference< xml::input::XElement > SAL_CALL startChildElement(
- sal_Int32 nUid, OUString const & rLocalName,
-@@ -244,7 +243,7 @@ class LibraryElement : public LibElement
- {
- protected:
- vector< OUString > mElements;
--
-+ ObjectModuleDescHash mObjectDescs;
- public:
-
- virtual Reference< xml::input::XElement > SAL_CALL startChildElement(
-diff --git xmlscript/source/xmllib_imexp/xmllib_export.cxx xmlscript/source/xmllib_imexp/xmllib_export.cxx
-index 4f6de54..2ab8182 100644
---- xmlscript/source/xmllib_imexp/xmllib_export.cxx
-+++ xmlscript/source/xmllib_imexp/xmllib_export.cxx
-@@ -44,6 +44,28 @@ namespace xmlscript
- static OUString aTrueStr ( RTL_CONSTASCII_USTRINGPARAM("true") );
- static OUString aFalseStr( RTL_CONSTASCII_USTRINGPARAM("false") );
-
-+rtl::OUString lcl_getModuleTypeStringForType( sal_Int32 nModuleType )
-+{
-+ rtl::OUString sType;
-+ switch( nModuleType )
-+ {
-+ case script::ModuleType::Document:
-+ sType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Document" ) );
-+ break;
-+ case script::ModuleType::Class:
-+ sType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Class" ) );
-+ break;
-+ case script::ModuleType::Form:
-+ sType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Form" ) );
-+ break;
-+ case script::ModuleType::Normal: // no need to set a module type
-+ case script::ModuleType::Unknown:
-+ default:
-+ break;
-+ }
-+ return sType;
-+}
-+
- //##################################################################################################
-
-
-@@ -73,11 +95,10 @@ SAL_CALL exportLibraryContainer(
- pLibsElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM("xmlns:" XMLNS_XLINK_PREFIX) ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_XLINK_URI) ) );
-
--
-- xOut->ignorableWhitespace( OUString() );
-+ int nLibCount = pLibArray->mnLibCount;
- xOut->startElement( aLibrariesName, xAttributes );
-+ xOut->ignorableWhitespace( OUString() );
-
-- int nLibCount = pLibArray->mnLibCount;
- for( sal_Int32 i = 0 ; i < nLibCount ; i++ )
- {
- LibDescriptor& rLib = pLibArray->mpLibs[i];
-@@ -107,7 +128,6 @@ SAL_CALL exportLibraryContainer(
- pLibElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_LIBRARY_PREFIX ":readonly") ),
- rLib.bReadOnly ? aTrueStr : aFalseStr );
- }
--
- pLibElement->dump( xOut.get() );
- }
-
-@@ -152,11 +172,15 @@ SAL_CALL exportLibrary(
-
- if( rLib.bPreload )
- pLibElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_LIBRARY_PREFIX ":preload") ), aTrueStr );
-+// Basic/Library/script-xx.xml
-+ if( rLib.bVBAMode )
-+ pLibElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_LIBRARY_PREFIX ":vbaenabled") ), aTrueStr );
-
- sal_Int32 nElementCount = rLib.aElementNames.getLength();
- if( nElementCount )
- {
- const OUString* pElementNames = rLib.aElementNames.getConstArray();
-+
- for( sal_Int32 i = 0 ; i < nElementCount ; i++ )
- {
- XMLElement* pElement = new XMLElement( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_LIBRARY_PREFIX ":element" ) ) );
-@@ -165,7 +189,16 @@ SAL_CALL exportLibrary(
-
- pElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_LIBRARY_PREFIX ":name") ),
- pElementNames[i] );
--
-+ ObjectModuleDescHash::const_iterator it = rLib.hModuleTypeDesc.find( pElementNames[i] );
-+ if ( it != rLib.hModuleTypeDesc.end() )
-+ {
-+ rtl::OUString sType = lcl_getModuleTypeStringForType( it->second.mnModuleType );
-+ if ( sType.getLength() )
-+ {
-+ pElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_LIBRARY_PREFIX ":moduletype") ), sType );
-+ pElement->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_LIBRARY_PREFIX ":objectname") ), it->second.msObjectName );
-+ }
-+ }
- pLibElement->addSubElement( pElement );
- }
- }
-diff --git xmlscript/source/xmllib_imexp/xmllib_import.cxx xmlscript/source/xmllib_imexp/xmllib_import.cxx
-index b533d37..d1aa54d 100644
---- xmlscript/source/xmllib_imexp/xmllib_import.cxx
-+++ xmlscript/source/xmllib_imexp/xmllib_import.cxx
-@@ -44,7 +44,20 @@ namespace xmlscript
- {
-
- //##################################################################################################
--
-+sal_Int32 lcl_getModuleTypeForStringType( const rtl::OUString& rsType )
-+{
-+ // default to normal unknown
-+ sal_Int32 nType = com::sun::star::script::ModuleType::Unknown;
-+ if ( rsType.equalsIgnoreAsciiCase( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("class") ) ) )
-+ nType = com::sun::star::script::ModuleType::Class;
-+ else if ( rsType.equalsIgnoreAsciiCase( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("form") ) ) )
-+ nType = com::sun::star::script::ModuleType::Form;
-+ else if ( rsType.equalsIgnoreAsciiCase( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("document") ) ) )
-+ nType = com::sun::star::script::ModuleType::Document;
-+ else if ( rsType.equalsIgnoreAsciiCase( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("normal") ) ) )
-+ nType = com::sun::star::script::ModuleType::Normal;
-+ return nType;
-+}
- //__________________________________________________________________________________________________
- Reference< xml::input::XElement > LibElementBase::getParent()
- throw (RuntimeException)
-@@ -206,7 +219,10 @@ Reference< xml::input::XElement > Librar
- &aDesc.bPreload,
- OUString( RTL_CONSTASCII_USTRINGPARAM("preload") ),
- xAttributes, XMLNS_LIBRARY_UID );
--
-+ getBoolAttr(
-+ &aDesc.bVBAMode,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("vbaenabled") ),
-+ xAttributes, XMLNS_LIBRARY_UID );
- return new LibraryElement( rLocalName, xAttributes, 0, this );
- }
- else
-@@ -265,7 +281,12 @@ Reference< xml::input::XElement > Librar
- &aDesc.bPasswordProtected,
- OUString( RTL_CONSTASCII_USTRINGPARAM("passwordprotected") ),
- xAttributes, _pImport->XMLNS_LIBRARY_UID );
--
-+/*
-+ getBoolAttr(
-+ &aDesc.bVBAMode,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("vbaenabled") ),
-+ xAttributes, _pImport->XMLNS_LIBRARY_UID );
-+*/
- mLibDescriptors.push_back( aDesc );
- return new LibraryElement( rLocalName, xAttributes, this, _pImport );
- }
-@@ -312,6 +333,17 @@ Reference< xml::input::XElement > Librar
- if (aValue.getLength())
- mElements.push_back( aValue );
-
-+ ObjectModuleDesc aDesc;
-+
-+ aDesc.mnModuleType = lcl_getModuleTypeForStringType(
-+ xAttributes->getValueByUidName(
-+ _pImport->XMLNS_LIBRARY_UID,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("moduletype") ) ) );
-+ aDesc.msObjectName = xAttributes->getValueByUidName(
-+ _pImport->XMLNS_LIBRARY_UID,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("objectname") ) );
-+ if ( aValue.getLength() && aDesc.mnModuleType != ::com::sun::star::script::ModuleType::Unknown )
-+ mObjectDescs[ aValue ] = aDesc;
- return new LibElementBase( rLocalName, xAttributes, this, _pImport );
- }
- else
-@@ -335,6 +367,7 @@ void LibraryElement::endElement()
- if( !pLib )
- pLib = &static_cast< LibrariesElement* >( _pParent )->mLibDescriptors.back();
- pLib->aElementNames = aElementNames;
-+ pLib->hModuleTypeDesc = mObjectDescs;
- }
-
-
-@@ -348,6 +381,15 @@ SAL_CALL importLibraryContainer( LibDesc
- static_cast< xml::input::XRoot * >( new LibraryImport( pLibArray ) ) );
- }
-
-+
-+Reference< ::com::sun::star::xml::sax::XDocumentHandler >
-+SAL_CALL importLibraryCodeNames( LibDescriptor& rLib)
-+ SAL_THROW( (Exception) )
-+{
-+ return importLibrary( rLib );
-+}
-+
-+
- //##################################################################################################
-
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler >
-@@ -360,6 +402,13 @@ SAL_CALL importLibrary( LibDescriptor& r
-
-
- //##################################################################################################
-+LibDescriptor::LibDescriptor()
-+{
-+ bLink = sal_False;
-+ bReadOnly = sal_False;
-+ bPasswordProtected = sal_False;
-+ bVBAMode = sal_False;
-+}
-
- LibDescriptorArray::LibDescriptorArray( sal_Int32 nLibCount )
- {
diff --git a/patches/vba/oovbaapi-disable-vba.diff b/patches/vba/oovbaapi-disable-vba.diff
deleted file mode 100644
index 3818b8014..000000000
--- a/patches/vba/oovbaapi-disable-vba.diff
+++ /dev/null
@@ -1,90 +0,0 @@
---- oovbaapi/genconstidl/makefile.mk 2007-08-30 19:26:17.000000000 +0200
-+++ oovbaapi/genconstidl/makefile.mk 2007-08-30 19:32:11.000000000 +0200
-@@ -40,11 +40,6 @@ PRJNAME=oovbaapi
-
- .INCLUDE : settings.mk
-
--.IF "$(ENABLE_VBA)"!="YES"
--dummy:
-- @echo "not building vba..."
--.ENDIF
--
- # symbol files of Microsoft API
- MYSYMFILES = access.api vba.api adodb.api msforms.api word.api dao.api powerpoint.api excel.api stdole.api
-
---- oovbaapi/ooo/vba/constants/makefile.mk 2007-08-30 19:30:00.000000000 +0200
-+++ oovbaapi/ooo/vba/constants/makefile.mk 2007-08-30 19:31:48.000000000 +0200
-@@ -42,11 +42,6 @@ PACKAGE=ooo$/vba$/constants
- # --- Settings -----------------------------------------------------
- .INCLUDE : $(PRJ)$/util$/makefile.pmk
-
--.IF "$(ENABLE_VBA)"!="YES"
--dummy:
-- @echo "not building vba..."
--.ELSE
--
- # ------------------------------------------------------------------------
-
- # I tried to use the IDLFILES target but it failed dismally
-@@ -64,5 +64,3 @@ $(MY_GEN_UCR_PATH)$/%.urd: $(MY_GEN_IDL_
- $(MYDBTARGET) : $(MYURDFILES) $(MYIDLFILES)
- $(REGMERGE) $(OUT)$/ucr/constants.db /UCR @$(mktmp $(MYURDFILES))
-
--.ENDIF
--
---- oovbaapi/ooo/vba/excel/makefile.mk 2007-09-01 11:42:58.000000000 +0200
-+++ oovbaapi/ooo/vba/excel/makefile.mk 2007-09-01 11:55:50.000000000 +0200
-@@ -42,11 +42,6 @@ PACKAGE=ooo$/vba$/Excel
- # --- Settings -----------------------------------------------------
- .INCLUDE : $(PRJ)$/util$/makefile.pmk
-
--.IF "$(ENABLE_VBA)"!="YES"
--dummy:
-- @echo "not building vba..."
--.ENDIF
--
- # ------------------------------------------------------------------------
-
-
---- oovbaapi/ooo/vba/msforms/makefile.mk 2007-08-30 19:30:20.000000000 +0200
-+++ oovbaapi/ooo/vba/msforms/makefile.mk 2007-08-30 19:31:31.000000000 +0200
-@@ -42,11 +42,6 @@ PACKAGE=ooo$/vba$/msforms
- # --- Settings -----------------------------------------------------
- .INCLUDE : $(PRJ)$/util$/makefile.pmk
-
--.IF "$(ENABLE_VBA)"!="YES"
--dummy:
-- @echo "not building vba..."
--.ENDIF
--
- # ------------------------------------------------------------------------
-
- IDLFILES=\
---- oovbaapi/ooo/vba/makefile.mk 2007-08-30 19:30:25.000000000 +0200
-+++ oovbaapi/ooo/vba/makefile.mk 2007-08-30 19:31:38.000000000 +0200
-@@ -42,11 +42,6 @@ PACKAGE=ooo$/vba
- # --- Settings -----------------------------------------------------
- .INCLUDE : $(PRJ)$/util$/makefile.pmk
-
--.IF "$(ENABLE_VBA)"!="YES"
--dummy:
-- @echo "not building vba..."
--.ENDIF
--
- # ------------------------------------------------------------------------
-
- IDLFILES=\
---- oovbaapi/util/makefile.mk 2007-08-30 17:32:39.000000000 +0200
-+++ oovbaapi/util/makefile.mk 2007-08-30 19:32:03.000000000 +0200
-@@ -44,11 +44,6 @@ TARGET=oovbaapi_db
-
- .INCLUDE : makefile.pmk
-
--.IF "$(ENABLE_VBA)"!="YES"
--dummy:
-- @echo "not building vba..."
--.ENDIF
--
- # ------------------------------------------------------------------
- UNOIDLDBFILES= \
- $(UCR)$/vba.db \
diff --git a/patches/vba/oox-insert-module-bug.diff b/patches/vba/oox-insert-module-bug.diff
deleted file mode 100644
index 71b5a896e..000000000
--- a/patches/vba/oox-insert-module-bug.diff
+++ /dev/null
@@ -1,17 +0,0 @@
-diff --git oox/source/ole/vbamodule.cxx oox/source/ole/vbamodule.cxx
-index 2ce7c3e..c49ac1e 100755
---- oox/source/ole/vbamodule.cxx
-+++ oox/source/ole/vbamodule.cxx
-@@ -332,7 +332,11 @@ void VbaModule::importSourceCode( StorageBase& rVbaStrg,
- // insert the module into the passed Basic library
- try
- {
-- rxBasicLib->insertByName( maName, Any( aSourceCode.makeStringAndClear() ) );
-+ // sheet modules are 'pre-created'
-+ if ( rxBasicLib->hasByName( maName ) )
-+ rxBasicLib->replaceByName( maName, Any( aSourceCode.makeStringAndClear() ) );
-+ else
-+ rxBasicLib->insertByName( maName, Any( aSourceCode.makeStringAndClear() ) );
- }
- catch( Exception& )
- {
diff --git a/patches/vba/oox-projectname-oobuild-specifix.diff b/patches/vba/oox-projectname-oobuild-specifix.diff
deleted file mode 100644
index bf852f6e5..000000000
--- a/patches/vba/oox-projectname-oobuild-specifix.diff
+++ /dev/null
@@ -1,110 +0,0 @@
-diff --git sc/source/core/tool/interpr4.cxx sc/source/core/tool/interpr4.cxx
-index 35177aa..ca045f0 100644
---- sc/source/core/tool/interpr4.cxx
-+++ sc/source/core/tool/interpr4.cxx
-@@ -50,6 +50,7 @@
-
- #include <com/sun/star/table/XCellRange.hpp>
- #include <com/sun/star/sheet/XSheetCellRange.hpp>
-+#include <com/sun/star/script/vba/XVBACompatibility.hpp>
- #include <comphelper/processfactory.hxx>
-
- #include "interpre.hxx"
-@@ -2706,8 +2707,14 @@ uno::Any lcl_getSheetModule( const uno::Reference<table::XCellRange>& xCellRange
- if ( pBasMgr && pBasMgr->GetName().Len() )
- {
- String sProj = String( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
-- if ( pDok->GetDocumentShell()->GetBasicManager()->GetName().Len() )
-- sProj = pDok->GetDocumentShell()->GetBasicManager()->GetName();
-+ try
-+ {
-+ uno::Reference< beans::XPropertySet > xProps( pDok->GetDocumentShell()->GetModel(), uno::UNO_QUERY_THROW );
-+ uno::Reference< script::vba::XVBACompatibility > xVBAMode( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BasicLibraries") ) ), uno::UNO_QUERY_THROW );
-+ sProj = xVBAMode->getProjectName();
-+ }
-+ catch( uno::Exception& ){}
-+
- StarBASIC* pBasic = pDok->GetDocumentShell()->GetBasicManager()->GetLib( sProj );
- if ( pBasic )
- {
-diff --git sc/source/ui/docshell/macromgr.cxx sc/source/ui/docshell/macromgr.cxx
-index 97623f3..5eb823a 100644
---- sc/source/ui/docshell/macromgr.cxx
-+++ sc/source/ui/docshell/macromgr.cxx
-@@ -41,6 +41,7 @@
- #include "sfx2/objsh.hxx"
- #include "cell.hxx"
- #include <com/sun/star/container/XContainer.hpp>
-+#include <com/sun/star/script/vba/XVBACompatibility.hpp>
-
- #include <list>
-
-@@ -154,8 +155,16 @@ void ScMacroManager::InitUserFuncData()
-
- Reference< container::XContainer > xModuleContainer;
- SfxObjectShell* pShell = mpDoc->GetDocumentShell();
-- if ( pShell && pShell->GetBasicManager()->GetName().Len() > 0 )
-- sProjectName = pShell->GetBasicManager()->GetName();
-+ if ( pShell )
-+ {
-+ try
-+ {
-+ uno::Reference< beans::XPropertySet > xProps( pShell->GetModel(), uno::UNO_QUERY_THROW );
-+ uno::Reference< script::vba::XVBACompatibility > xVBAMode( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BasicLibraries") ) ), uno::UNO_QUERY_THROW );
-+ sProjectName = xVBAMode->getProjectName();
-+ }
-+ catch( uno::Exception& ) {}
-+ }
- try
- {
- Reference< script::XLibraryContainer > xLibraries( pShell->GetBasicContainer(), uno::UNO_QUERY_THROW );
-diff --git sw/source/core/unocore/unocoll.cxx sw/source/core/unocore/unocoll.cxx
-index 07cb0f6..ae19ad0 100644
---- sw/source/core/unocore/unocoll.cxx
-+++ sw/source/core/unocore/unocoll.cxx
-@@ -86,6 +86,7 @@
- #include <com/sun/star/script/ModuleType.hpp>
- #include <com/sun/star/script/ScriptEventDescriptor.hpp>
- #include <com/sun/star/script/vba/XVBAModuleInfo.hpp>
-+#include <com/sun/star/script/vba/XVBACompatibility.hpp>
- #include <vbahelper/vbaaccesshelper.hxx>
- #include <basic/basmgr.hxx>
- #include <comphelper/processfactory.hxx>
-@@ -115,8 +116,9 @@ public:
- uno::Reference< beans::XPropertySet > xProps( mpDocShell->GetModel(), uno::UNO_QUERY_THROW );
- uno::Reference< container::XNameAccess > xLibContainer( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BasicLibraries") ) ), uno::UNO_QUERY_THROW );
- rtl::OUString sProjectName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Standard") ) );
-- if ( mpDocShell->GetBasicManager()->GetName().Len() )
-- sProjectName = mpDocShell->GetBasicManager()->GetName();
-+ uno::Reference< script::vba::XVBACompatibility > xVBAMode( xLibContainer, uno::UNO_QUERY );
-+ if ( xVBAMode.is() )
-+ sProjectName = xVBAMode->getProjectName();
-
- uno::Reference< container::XNameAccess > xLib( xLibContainer->getByName( sProjectName ), uno::UNO_QUERY_THROW );
- uno::Sequence< rtl::OUString > sModuleNames = xLib->getElementNames();
-diff --git vbahelper/source/vbahelper/vbahelper.cxx vbahelper/source/vbahelper/vbahelper.cxx
-index c02569d..e9c6f23 100644
---- vbahelper/source/vbahelper/vbahelper.cxx
-+++ vbahelper/source/vbahelper/vbahelper.cxx
-@@ -33,6 +33,7 @@
- #include <com/sun/star/frame/XModel2.hpp>
- #include <com/sun/star/frame/XNotifyingDispatch.hpp>
- #include <com/sun/star/script/XDefaultProperty.hpp>
-+#include <com/sun/star/script/vba/XVBACompatibility.hpp>
- #include <com/sun/star/uno/XComponentContext.hpp>
- #include <com/sun/star/lang/XMultiComponentFactory.hpp>
- #include <com/sun/star/lang/XUnoTunnel.hpp>
-@@ -1271,6 +1272,13 @@ UserFormGeometryHelper::UserFormGeometryHelper( const uno::Reference< uno::XComp
- if ( pShell )
- {
- rtl::OUString sProj( RTL_CONSTASCII_USTRINGPARAM("Standard") );
-+ try
-+ {
-+ uno::Reference< beans::XPropertySet > xProps( pShell->GetModel(), uno::UNO_QUERY_THROW );
-+ uno::Reference< script::vba::XVBACompatibility > xVBAMode( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BasicLibraries") ) ), uno::UNO_QUERY_THROW );
-+ sProj = xVBAMode->getProjectName();
-+ }
-+ catch( uno::Exception& ){}
- BasicManager* pBasMgr = pShell->GetBasicManager();
- if ( pBasMgr && pBasMgr->GetName().Len() )
- sProj = pShell->GetBasicManager()->GetName();
diff --git a/patches/vba/range-defaultmethod-i98476.diff b/patches/vba/range-defaultmethod-i98476.diff
deleted file mode 100644
index 119492d5a..000000000
--- a/patches/vba/range-defaultmethod-i98476.diff
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git sc/source/ui/vba/vbarange.cxx sc/source/ui/vba/vbarange.cxx
-index 95f312c..cd25749 100644
---- sc/source/ui/vba/vbarange.cxx
-+++ sc/source/ui/vba/vbarange.cxx
-@@ -3388,7 +3391,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;
- }
-
diff --git a/patches/vba/range-listBox-compare.diff b/patches/vba/range-listBox-compare.diff
deleted file mode 100644
index 4d260cb76..000000000
--- a/patches/vba/range-listBox-compare.diff
+++ /dev/null
@@ -1,35 +0,0 @@
-diff --git basic/source/runtime/step0.cxx basic/source/runtime/step0.cxx
-index 25adf15..cbd2fad 100644
---- basic/source/runtime/step0.cxx
-+++ basic/source/runtime/step0.cxx
-@@ -109,19 +109,24 @@ void SbiRuntime::StepCompare( SbxOperato
- // values ( and type ) set as appropriate
- SbxDataType p1Type = p1->GetType();
- SbxDataType p2Type = p2->GetType();
-+ if ( p1Type == SbxEMPTY )
-+ {
-+ p1->Broadcast( SBX_HINT_DATAWANTED );
-+ p1Type = p1->GetType();
-+ }
-+ if ( p2Type == SbxEMPTY )
-+ {
-+ p2->Broadcast( SBX_HINT_DATAWANTED );
-+ p2Type = p2->GetType();
-+ }
- if ( p1Type == p2Type )
- {
-- if ( p1Type == SbxEMPTY )
-- {
-- p1->Broadcast( SBX_HINT_DATAWANTED );
-- p2->Broadcast( SBX_HINT_DATAWANTED );
-- }
- // if both sides are an object and have default props
- // then we need to use the default props
- // we don't need to worry if only one side ( lhs, rhs ) is an
- // object ( object side will get coerced to correct type in
- // Compare )
-- else if ( p1Type == SbxOBJECT )
-+ if ( p1Type == SbxOBJECT )
- {
- SbxVariable* pDflt = getDefaultProp( p1 );
- if ( pDflt )
diff --git a/patches/vba/read-vba-dir-stream-fix.diff b/patches/vba/read-vba-dir-stream-fix.diff
deleted file mode 100644
index 2a99b6322..000000000
--- a/patches/vba/read-vba-dir-stream-fix.diff
+++ /dev/null
@@ -1,885 +0,0 @@
-diff --git svtools/inc/filterutils.hxx svtools/inc/filterutils.hxx
-new file mode 100644
-index 0000000..a05025f
---- /dev/null
-+++ svtools/inc/filterutils.hxx
-@@ -0,0 +1,22 @@
-+#ifndef SVTOOLS_INC_FILTERUTILS_HXX
-+#define SVTOOLS_INC_FILTERUTILS_HXX
-+
-+#include "svtools/svtdllapi.h"
-+#include <com/sun/star/uno/RuntimeException.hpp>
-+namespace svt
-+{
-+ class BinFilterUtils
-+ {
-+ private:
-+ BinFilterUtils(); // never implemented
-+
-+ public:
-+ SVT_DLLPUBLIC static rtl::OUString CreateOUStringFromUniStringArray( const char* pcCharArr, sal_uInt32 nBufSize );
-+ SVT_DLLPUBLIC static rtl::OUString CreateOUStringFromStringArray( const char* pcCharArr, sal_uInt32 nBufSize );
-+ };
-+
-+//........................................................................
-+} // namespace svt
-+//........................................................................
-+
-+#endif
-diff --git svtools/prj/d.lst svtools/prj/d.lst
-index d0a7a98..7757b38 100644
---- svtools/prj/d.lst
-+++ svtools/prj/d.lst
-@@ -173,6 +173,7 @@ mkdir: %_DEST%\inc%_EXT%\svtools
- ..\inc\svtools\httpcook.hxx %_DEST%\inc%_EXT%\svtools\httpcook.hxx
- ..\inc\imageresourceaccess.hxx %_DEST%\inc%_EXT%\svtools\imageresourceaccess.hxx
- ..\inc\bindablecontrolhelper.hxx %_DEST%\inc%_EXT%\svtools\bindablecontrolhelper.hxx
-+..\inc\filterutils.hxx %_DEST%\inc%_EXT%\svtools\filterutils.hxx
- ..\inc\svtools\itemprop.hxx %_DEST%\inc%_EXT%\svtools\itemprop.hxx
- ..\inc\addresstemplate.hxx %_DEST%\inc%_EXT%\svtools\addresstemplate.hxx
- ..\inc\svtools\genericunodialog.hxx %_DEST%\inc%_EXT%\svtools\genericunodialog.hxx
-diff --git svtools/source/misc/filterutils.cxx svtools/source/misc/filterutils.cxx
-new file mode 100644
-index 0000000..91a6ca4
---- /dev/null
-+++ svtools/source/misc/filterutils.cxx
-@@ -0,0 +1,56 @@
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_svtools.hxx"
-+#include "filterutils.hxx"
-+#include <rtl/ustrbuf.hxx>
-+
-+namespace svt
-+{
-+//........................................................................
-+
-+ using namespace ::com::sun::star;
-+
-+ rtl::OUString lcl_createStringFromArray( const char* pcCharArr, sal_uInt32 nBufSize, bool bIsCompressed )
-+ {
-+ rtl::OUStringBuffer aBuffer;
-+ if( bIsCompressed )
-+ {
-+ // buffer contains compressed Unicode, not encoded bytestring
-+ sal_Int32 nStrLen = static_cast< sal_Int32 >( nBufSize );
-+ aBuffer.setLength( nStrLen );
-+ const char* pcCurrChar = pcCharArr;
-+ for( sal_Int32 nChar = 0; nChar < nStrLen; ++nChar, ++pcCurrChar )
-+ /* *pcCurrChar may contain negative values and therefore MUST be
-+ casted to unsigned char, before assigned to a sal_Unicode. */
-+ aBuffer.setCharAt( nChar, static_cast< unsigned char >( *pcCurrChar ) );
-+ }
-+ else
-+ {
-+ // buffer contains Little-Endian Unicode
-+ sal_Int32 nStrLen = static_cast< sal_Int32 >( nBufSize ) / 2;
-+ aBuffer.setLength( nStrLen );
-+ const char* pcCurrChar = pcCharArr;
-+ for( sal_Int32 nChar = 0; nChar < nStrLen; ++nChar )
-+ {
-+ /* *pcCurrChar may contain negative values and therefore MUST be
-+ casted to unsigned char, before assigned to a sal_Unicode. */
-+ sal_Unicode cChar = static_cast< unsigned char >( *pcCurrChar++ );
-+ cChar |= (static_cast< unsigned char >( *pcCurrChar++ ) << 8);
-+ aBuffer.setCharAt( nChar, cChar );
-+ }
-+ }
-+ return aBuffer.makeStringAndClear();
-+ }
-+
-+ rtl::OUString BinFilterUtils::CreateOUStringFromUniStringArray( const char* pcCharArr, sal_uInt32 nBufSize )
-+ {
-+ return lcl_createStringFromArray( pcCharArr, nBufSize, false );
-+ }
-+
-+ rtl::OUString BinFilterUtils::CreateOUStringFromStringArray( const char* pcCharArr, sal_uInt32 nBufSize )
-+ {
-+ return lcl_createStringFromArray( pcCharArr, nBufSize, true );
-+ }
-+//........................................................................
-+} // namespace svt
-+//........................................................................
-+
-diff --git svtools/source/misc/makefile.mk svtools/source/misc/makefile.mk
-index 58943ad..e78ee40 100644
---- svtools/source/misc/makefile.mk
-+++ svtools/source/misc/makefile.mk
-@@ -86,6 +86,7 @@ SLOFILES=\
- $(SLO)$/sharecontrolfile.obj \
- $(SLO)$/documentlockfile.obj \
- $(SLO)$/bindablecontrolhelper.obj \
-+ $(SLO)$/filterutils.obj \
- $(SLO)$/langtab.obj
-
- # --- Targets -------------------------------------------------------
-diff --git svx/source/msfilter/msocximex.cxx svx/source/msfilter/msocximex.cxx
-index c4f61b3..598e0ea 100644
---- svx/source/msfilter/msocximex.cxx
-+++ svx/source/msfilter/msocximex.cxx
-@@ -97,6 +97,7 @@
- #include <com/sun/star/sheet/XSpreadsheetView.hpp>
- #include <com/sun/star/sheet/XCellRangeAddressable.hpp>
- #include <com/sun/star/sheet/XCellRangeReferrer.hpp>
-+#include <svtools/filterutils.hxx>
-
- #ifndef C2S
- #define C2S(cChar) String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(cChar))
-@@ -354,35 +355,11 @@ void lclReadCharArray( SvStorageStream& rStrm, char*& rpcCharArr, sal_uInt32 nLe
- */
- OUString lclCreateOUString( const char* pcCharArr, sal_uInt32 nLenFld )
- {
-- OUStringBuffer aBuffer;
- sal_uInt32 nBufSize = lclGetBufferSize( nLenFld );
- if( lclIsCompressed( nLenFld ) )
-- {
-- // buffer contains compressed Unicode, not encoded bytestring
-- sal_Int32 nStrLen = static_cast< sal_Int32 >( nBufSize );
-- aBuffer.setLength( nStrLen );
-- const char* pcCurrChar = pcCharArr;
-- for( sal_Int32 nChar = 0; nChar < nStrLen; ++nChar, ++pcCurrChar )
-- /* *pcCurrChar may contain negative values and therefore MUST be
-- casted to unsigned char, before assigned to a sal_Unicode. */
-- aBuffer.setCharAt( nChar, static_cast< unsigned char >( *pcCurrChar ) );
-- }
-- else
-- {
-- // buffer contains Little-Endian Unicode
-- sal_Int32 nStrLen = static_cast< sal_Int32 >( nBufSize ) / 2;
-- aBuffer.setLength( nStrLen );
-- const char* pcCurrChar = pcCharArr;
-- for( sal_Int32 nChar = 0; nChar < nStrLen; ++nChar )
-- {
-- /* *pcCurrChar may contain negative values and therefore MUST be
-- casted to unsigned char, before assigned to a sal_Unicode. */
-- sal_Unicode cChar = static_cast< unsigned char >( *pcCurrChar++ );
-- cChar |= (static_cast< unsigned char >( *pcCurrChar++ ) << 8);
-- aBuffer.setCharAt( nChar, cChar );
-- }
-- }
-- return aBuffer.makeStringAndClear();
-+ return svt::BinFilterUtils::CreateOUStringFromStringArray( pcCharArr, nBufSize );
-+
-+ return svt::BinFilterUtils::CreateOUStringFromUniStringArray( pcCharArr, nBufSize );
- }
-
- // export ---------------------------------------------------------------------
-diff --git svx/source/msfilter/mstoolbar.cxx svx/source/msfilter/mstoolbar.cxx
-index 6e1dec0..2647c58 100644
---- svx/source/msfilter/mstoolbar.cxx
-+++ svx/source/msfilter/mstoolbar.cxx
-@@ -10,6 +10,8 @@
- #include <map>
- #include <sfx2/objsh.hxx>
- #include <basic/basmgr.hxx>
-+#include <svtools/filterutils.hxx>
-+#include <boost/scoped_array.hpp>
-
- int TBBase::nIndent = 0;
-
-@@ -26,7 +28,10 @@ void CustomToolBarImportHelper::applyIcons()
- uno::Reference< ui::XImageManager > xImageManager( getCfgManager()->getImageManager(), uno::UNO_QUERY_THROW );
- // 1 seems to work best for MSO images, otherwise they don't get displayed ( I guess the default size
- // in ooo is different )
-- xImageManager->insertImages( 1, commands, images );
-+ //xImageManager->insertImages( 1, commands, images ); // #FIXME and scale images based on default icon size
-+ xImageManager->replaceImages( 1, commands, images );
-+ xImageManager->replaceImages( 2, commands, images );
-+ xImageManager->replaceImages( 3, commands, images );
- }
- }
-
-@@ -107,15 +112,10 @@ TBBase::indent_printf( FILE* fp, const char* format, ... )
-
- rtl::OUString TBBase::readUnicodeString( SvStream* pS, sal_Int32 nChars )
- {
-- rtl::OUStringBuffer buf(40);
-- for ( sal_Int32 index = 0; index < nChars; ++index )
-- {
-- sal_uInt16 ch = 0;
-- *pS >> ch;
-- sal_Unicode uni = static_cast< sal_Unicode >( ch );
-- buf.append( &uni, 1 );
-- }
-- return buf.makeStringAndClear();
-+ sal_Int32 nBufSize = nChars * 2;
-+ boost::scoped_array< sal_uInt8 > pArray( new sal_uInt8[ nBufSize ] );
-+ pS->Read( pArray.get(), nBufSize );
-+ return svt::BinFilterUtils::CreateOUStringFromUniStringArray( reinterpret_cast< const char* >( pArray.get() ), nBufSize );
- }
-
- TBCHeader::TBCHeader() : bSignature( 0x3 )
-diff --git svx/source/msfilter/msvbasic.cxx svx/source/msfilter/msvbasic.cxx
-index a8aac8a..e040862 100644
---- svx/source/msfilter/msvbasic.cxx
-+++ svx/source/msfilter/msvbasic.cxx
-@@ -43,79 +43,13 @@
- #include <fstream>
- #include <memory>
- #include <rtl/ustrbuf.hxx>
-+#include <boost/shared_ptr.hpp>
-+#include <boost/scoped_array.hpp>
-+#include <boost/shared_array.hpp>
-+#include <svtools/filterutils.hxx>
-
- using namespace ::com::sun::star::script;
-
--// #FIXME this routine is stolen from msocximex ( needs to be somewhere central )
--
--const sal_uInt32 SVX_MSOCX_SIZEMASK = 0x7FFFFFFF; /// Mask for character buffer size.
--const sal_uInt32 SVX_MSOCX_COMPRESSED = 0x80000000;
--
--inline bool lclIsCompressed( sal_uInt32 nLenFld )
--{
-- return (nLenFld & SVX_MSOCX_COMPRESSED) != 0;
--}
--
--
--/** Extracts and returns the memory size of the character buffer.
-- @return Character buffer size (may differ from resulting string length!).
-- */
--inline sal_uInt32 lclGetBufferSize( sal_uInt32 nLenFld )
--{
-- return nLenFld & SVX_MSOCX_SIZEMASK;
--}
--/** Creates an OUString from a character array created with lclReadCharArray().
--
-- The passed parameters must match, that means the length field must be the
-- same used to create the passed character array.
--
-- @param pcCharArr
-- The character array returned by lclReadCharArray(). May be compressed
-- or uncompressed, next parameter nLenFld will specify this.
--
-- @param nLenFld
-- MUST be the same string length field that has been passed to
-- lclReadCharArray() to create the character array in previous parameter
-- pcCharArr.
--
-- @return
-- An OUString containing the decoded string data. Will be empty if
-- pcCharArr is 0.
-- */
--rtl::OUString lclCreateOUString( const char* pcCharArr, sal_uInt32 nLenFld )
--{
-- rtl::OUStringBuffer aBuffer;
-- sal_uInt32 nBufSize = lclGetBufferSize( nLenFld );
-- if( lclIsCompressed( nLenFld ) )
-- {
-- // buffer contains compressed Unicode, not encoded bytestring
-- sal_Int32 nStrLen = static_cast< sal_Int32 >( nBufSize );
-- aBuffer.setLength( nStrLen );
-- const char* pcCurrChar = pcCharArr;
-- for( sal_Int32 nChar = 0; nChar < nStrLen; ++nChar, ++pcCurrChar )
-- /* *pcCurrChar may contain negative values and therefore MUST be
-- casted to unsigned char, before assigned to a sal_Unicode. */
-- aBuffer.setCharAt( nChar, static_cast< unsigned char >( *pcCurrChar ) );
-- }
-- else
-- {
-- // buffer contains Little-Endian Unicode
-- sal_Int32 nStrLen = static_cast< sal_Int32 >( nBufSize ) / 2;
-- aBuffer.setLength( nStrLen );
-- const char* pcCurrChar = pcCharArr;
-- for( sal_Int32 nChar = 0; nChar < nStrLen; ++nChar )
-- {
-- /* *pcCurrChar may contain negative values and therefore MUST be
-- casted to unsigned char, before assigned to a sal_Unicode. */
-- sal_Unicode cChar = static_cast< unsigned char >( *pcCurrChar++ );
-- cChar |= (static_cast< unsigned char >( *pcCurrChar++ ) << 8);
-- aBuffer.setCharAt( nChar, cChar );
-- }
-- }
-- return aBuffer.makeStringAndClear();
--}
--
--
- namespace MSLZSS {
-
- static unsigned int getShift( sal_uInt32 nPos )
-@@ -238,23 +172,21 @@ sal_Int16 Reserved1;
- sal_Int16 Version;
- sal_Int8 Reserved2;
- sal_Int16 Reserved3;
--sal_uInt8* PerformanceCache;
-+boost::scoped_array< sal_uInt8 > PerformanceCache;
- sal_Int32 PerformanceCacheSize;
--_VBA_PROJECT_VDPI(): Reserved1( 0x61CC), Version( 0xFFFF ), Reserved2(0x0), Reserved3(0x0), PerformanceCache(0), PerformanceCacheSize(0) {}
-+_VBA_PROJECT_VDPI(): Reserved1( 0x61CC), Version( 0xFFFF ), Reserved2(0x0), Reserved3(0x0), PerformanceCacheSize(0) {}
- ~_VBA_PROJECT_VDPI()
- {
-- if ( PerformanceCache )
-- delete [] PerformanceCache;
-- PerformanceCache = 0;
- PerformanceCacheSize = 0;
- }
- void read(){}
- void write( SvStream* pStream )
- {
- *pStream << Reserved1 << Version << Reserved2 << Reserved3;
-- for( sal_Int32 i = 0; PerformanceCache && i < PerformanceCacheSize; ++i )
-+ if ( PerformanceCacheSize )
- {
-- *pStream >> PerformanceCache[ i ];
-+ PerformanceCache.reset( new sal_uInt8[ PerformanceCacheSize ] );
-+ pStream->Read( PerformanceCache.get(), PerformanceCacheSize );
- }
- }
- };
-@@ -320,27 +252,22 @@ class ProjectNameRecord
- public:
- sal_Int16 Id;
- sal_Int32 SizeOfProjectName;
--sal_uInt8* ProjectName;
--rtl::OUString msProjectName;
--ProjectNameRecord() : Id( 0x04 ), SizeOfProjectName( 0x0 ), ProjectName(0) {}
-+rtl::OUString ProjectName;
-+ProjectNameRecord() : Id( 0x04 ), SizeOfProjectName( 0x0 ){}
- ~ProjectNameRecord()
- {
-- delete [] ProjectName;
-- ProjectName = 0;
- }
- void read( SvStream* pStream )
- {
- OSL_TRACE("ProjectNameRecord [0x%x]", pStream->Tell() );
- *pStream >> Id >> SizeOfProjectName;
-- if ( ProjectName )
-- delete [] ProjectName;
-
- if ( SizeOfProjectName )
- {
-- ProjectName = new sal_uInt8[ SizeOfProjectName ];
-+ boost::scoped_array< sal_uInt8 > pProjectName( new sal_uInt8[ SizeOfProjectName ] );
- OSL_TRACE("ProjectNameRecord about to read name from [0x%x], size %d", pStream->Tell(), SizeOfProjectName );
-- pStream->Read( ProjectName, SizeOfProjectName );
-- msProjectName = lclCreateOUString( reinterpret_cast< const char* >( ProjectName ), ( SVX_MSOCX_COMPRESSED | SizeOfProjectName ) );
-+ pStream->Read( pProjectName.get(), SizeOfProjectName );
-+ ProjectName = svt::BinFilterUtils::CreateOUStringFromStringArray( reinterpret_cast< const char* >( pProjectName.get() ), SizeOfProjectName );
- }
- }
- };
-@@ -350,42 +277,34 @@ class ProjectDocStringRecord
- public:
- sal_Int16 Id;
- sal_Int32 SizeOfDocString;
--sal_uInt8* DocString;
- sal_Int16 Reserved;
- sal_Int32 SizeOfDocStringUnicode;
--sal_uInt8* DocStringUnicode;
-+rtl::OUString DocString;
-+rtl::OUString DocStringUnicode;
-
--ProjectDocStringRecord() : Id( 0x5 ), SizeOfDocString( 0x0 ), DocString( 0 ), Reserved( 0x0 ), SizeOfDocStringUnicode( 0 ), DocStringUnicode( 0 ) {}
-+ProjectDocStringRecord() : Id( 0x5 ), SizeOfDocString( 0x0 ), Reserved( 0x0 ), SizeOfDocStringUnicode( 0 ){}
-
- ~ProjectDocStringRecord()
- {
-- delete [] DocString;
-- delete [] DocStringUnicode;
-- DocString = 0;
-- DocStringUnicode = 0;
- }
- void read( SvStream* pStream )
- {
- OSL_TRACE("ProjectDocStringRecord [0x%x]", pStream->Tell() );
- *pStream >> Id >> SizeOfDocString;
-
-- if ( DocString )
-- delete [] DocString;
-
-- DocString = new sal_uInt8[ SizeOfDocString ];
-- pStream->Read( DocString, SizeOfDocString );
--
-- if ( SizeOfDocStringUnicode )
-- delete [] DocStringUnicode;
-+ boost::scoped_array< sal_uInt8 > pDocString( new sal_uInt8[ SizeOfDocString ] );
-+ pStream->Read( pDocString.get(), SizeOfDocString );
-+
-+ DocString = svt::BinFilterUtils::CreateOUStringFromStringArray( reinterpret_cast< const char* >( pDocString.get() ), SizeOfDocString );
-
- *pStream >> Reserved >> SizeOfDocStringUnicode;
-
-- if ( DocStringUnicode )
-- delete [] DocStringUnicode;
-+ boost::scoped_array< sal_uInt8 > pDocStringUnicode( new sal_uInt8[ SizeOfDocStringUnicode ] );
-
-- DocStringUnicode = new sal_uInt8[ SizeOfDocStringUnicode ];
-+ pStream->Read( pDocStringUnicode.get(), SizeOfDocStringUnicode );
-+ DocStringUnicode = svt::BinFilterUtils::CreateOUStringFromUniStringArray( reinterpret_cast< const char* >( pDocStringUnicode.get() ), SizeOfDocString );
-
-- pStream->Read( DocStringUnicode, SizeOfDocStringUnicode );
- }
-
- };
-@@ -395,39 +314,28 @@ class ProjectHelpFilePath
- public:
- sal_Int16 Id;
- sal_Int32 SizeOfHelpFile1;
--sal_uInt8* HelpFile1;
-+boost::scoped_array< sal_uInt8 > HelpFile1;
- sal_Int16 Reserved;
- sal_Int32 SizeOfHelpFile2;
--sal_uInt8* HelpFile2;
-+boost::scoped_array< sal_uInt8 > HelpFile2;
-
--ProjectHelpFilePath() : Id( 0x06 ), SizeOfHelpFile1(0), HelpFile1(0), Reserved(0x0), SizeOfHelpFile2(0), HelpFile2(0) {}
-+ProjectHelpFilePath() : Id( 0x06 ), SizeOfHelpFile1(0), Reserved(0x0), SizeOfHelpFile2(0) {}
- ~ProjectHelpFilePath()
- {
-- if ( HelpFile1 )
-- delete [] HelpFile1;
-- if ( HelpFile2 )
-- delete [] HelpFile2;
-- HelpFile1 = 0;
-- HelpFile2 = 0;
- }
-+
- void read( SvStream* pStream )
- {
- OSL_TRACE("ProjectHelpFilePath [0x%x]", pStream->Tell() );
- *pStream >> Id >> SizeOfHelpFile1;
-
-- if ( HelpFile1 )
-- delete HelpFile1;
--
-- HelpFile1 = new sal_uInt8[ SizeOfHelpFile1 ];
-- pStream->Read( HelpFile1, SizeOfHelpFile1 );
-+ HelpFile1.reset( new sal_uInt8[ SizeOfHelpFile1 ] );
-+ pStream->Read( HelpFile1.get(), SizeOfHelpFile1 );
-
- *pStream >> Reserved >> SizeOfHelpFile2;
-
-- if ( HelpFile2 )
-- delete HelpFile2;
--
-- HelpFile2 = new sal_uInt8[ SizeOfHelpFile2 ];
-- pStream->Read( HelpFile2, SizeOfHelpFile2 );
-+ HelpFile2.reset( new sal_uInt8[ SizeOfHelpFile2 ] );
-+ pStream->Read( HelpFile2.get(), SizeOfHelpFile2 );
-
- }
- };
-@@ -483,40 +391,31 @@ class ProjectConstantsRecord
- {
- sal_Int16 Id;
- sal_Int32 SizeOfConstants;
--sal_uInt8* Constants;
-+boost::scoped_array< sal_uInt8 > Constants;
- sal_Int16 Reserved;
- sal_Int32 SizeOfConstantsUnicode;
--sal_uInt8* ConstantsUnicode;
-+boost::scoped_array< sal_uInt8 > ConstantsUnicode;
- public:
- ProjectConstantsRecord() : Id( 0xC ), SizeOfConstants( 0 ), Constants( 0 ), Reserved( 0x3C ), SizeOfConstantsUnicode( 0 ), ConstantsUnicode(0) {}
-
- ~ProjectConstantsRecord()
- {
-- delete [] Constants;
-- Constants = 0;
-- delete [] ConstantsUnicode;
-- ConstantsUnicode = 0;
- }
-
- void read( SvStream* pStream )
- {
- OSL_TRACE("ProjectConstantsRecord [0x%x]", pStream->Tell() );
- *pStream >> Id >> SizeOfConstants;
-- if ( Constants )
-- delete [] Constants;
-- Constants = new sal_uInt8[ SizeOfConstants ];
-+ Constants.reset( new sal_uInt8[ SizeOfConstants ] );
-
-- pStream->Read( Constants, SizeOfConstants );
-+ pStream->Read( Constants.get(), SizeOfConstants );
-
- *pStream >> Reserved;
-
-- if ( ConstantsUnicode )
-- delete [] ConstantsUnicode;
--
- *pStream >> SizeOfConstantsUnicode;
-
-- ConstantsUnicode = new sal_uInt8[ SizeOfConstantsUnicode ];
-- pStream->Read( ConstantsUnicode, SizeOfConstantsUnicode );
-+ ConstantsUnicode.reset( new sal_uInt8[ SizeOfConstantsUnicode ] );
-+ pStream->Read( ConstantsUnicode.get(), SizeOfConstantsUnicode );
- }
-
- };
-@@ -526,18 +425,14 @@ class ReferenceNameRecord
- public:
- sal_Int16 Id;
- sal_Int32 SizeOfName;
--sal_uInt8* Name;
-+rtl::OUString Name;
- sal_Int16 Reserved;
- sal_Int32 SizeOfNameUnicode;
--sal_uInt8* NameUnicode;
-+rtl::OUString NameUnicode;
-
--ReferenceNameRecord() : Id( 0x16 ), SizeOfName( 0 ), Name( 0 ), Reserved( 0x3E ), SizeOfNameUnicode( 0 ), NameUnicode( 0 ) {}
-+ReferenceNameRecord() : Id( 0x16 ), SizeOfName( 0 ), Reserved( 0x3E ), SizeOfNameUnicode( 0 ){}
- ~ReferenceNameRecord()
- {
-- delete [] Name;
-- Name = 0;
-- delete [] NameUnicode;
-- NameUnicode = 0;
- }
-
- void read( SvStream* pStream )
-@@ -545,20 +440,16 @@ void read( SvStream* pStream )
- OSL_TRACE("NameRecord [0x%x]", pStream->Tell() );
- *pStream >> Id >> SizeOfName;
-
-- if ( Name )
-- delete [] Name;
-+ boost::scoped_array< sal_uInt8 > pName( new sal_uInt8[ SizeOfName ] );
-
-- Name = new sal_uInt8[ SizeOfName ];
--
-- pStream->Read( Name, SizeOfName );
-+ pStream->Read( pName.get(), SizeOfName );
-+ Name = svt::BinFilterUtils::CreateOUStringFromStringArray( reinterpret_cast< const char* >( pName.get() ), SizeOfName );
-
- *pStream >> Reserved >> SizeOfNameUnicode;
-
-- if ( NameUnicode )
-- delete [] Name;
--
-- NameUnicode = new sal_uInt8[ SizeOfNameUnicode ];
-- pStream->Read( NameUnicode, SizeOfNameUnicode );
-+ boost::scoped_array< sal_uInt8 > pNameUnicode( new sal_uInt8[ SizeOfNameUnicode ] );
-+ pStream->Read( pNameUnicode.get(), SizeOfNameUnicode );
-+ NameUnicode = svt::BinFilterUtils::CreateOUStringFromUniStringArray( reinterpret_cast< const char* >( pNameUnicode.get() ), SizeOfName );
- }
-
- };
-@@ -581,13 +472,11 @@ public:
- sal_uInt16 Id;
- sal_uInt32 Size;
- sal_uInt32 SizeOfLibidAbsolute;
-- sal_uInt8* pLibidAbsolute;
- sal_uInt32 SizeOfLibidRelative;
-- sal_uInt8* pLibidRelative;
- sal_uInt32 MajorVersion;
- sal_uInt16 MinorVersion;
-- rtl::OUString msAbsoluteLibid;
-- rtl::OUString msRelativeLibid;
-+ rtl::OUString AbsoluteLibid;
-+ rtl::OUString RelativeLibid;
-
- virtual bool read( SvStream* pStream );
- virtual void import( VBA_Impl& rDir );
-@@ -595,16 +484,12 @@ public:
- ~ReferenceProjectRecord();
- };
-
--ReferenceProjectRecord::ReferenceProjectRecord() : Id( 0x000E ), Size( 0 ), SizeOfLibidAbsolute( 0 ), pLibidAbsolute( NULL ), SizeOfLibidRelative( 0 ), pLibidRelative( 0 ), MajorVersion( 0 ), MinorVersion( 0 )
-+ReferenceProjectRecord::ReferenceProjectRecord() : Id( 0x000E ), Size( 0 ), SizeOfLibidAbsolute( 0 ), SizeOfLibidRelative( 0 ), MajorVersion( 0 ), MinorVersion( 0 )
- {
- }
-
- ReferenceProjectRecord::~ReferenceProjectRecord()
- {
-- if ( pLibidAbsolute )
-- delete[] pLibidAbsolute;
-- if ( pLibidRelative )
-- delete[] pLibidRelative;
- }
-
- bool ReferenceProjectRecord::read( SvStream* pStream )
-@@ -612,21 +497,15 @@ bool ReferenceProjectRecord::read( SvStream* pStream )
- OSL_TRACE("ReferenceProjectRecord [0x%x]", pStream->Tell() );
- *pStream >> Id >> Size >> SizeOfLibidAbsolute;
-
-- if ( SizeOfLibidAbsolute )
-- {
-- pLibidAbsolute = new sal_uInt8[ SizeOfLibidAbsolute ];
-- OSL_TRACE("ReferenceProjectRecord about to read LibidAbsolute at [0x%x]", pStream->Tell() );
-- pStream->Read( pLibidAbsolute, SizeOfLibidAbsolute );
-- }
-+ boost::scoped_array< sal_uInt8 > pLibidAbsolute( new sal_uInt8[ SizeOfLibidAbsolute ] );
-+ OSL_TRACE("ReferenceProjectRecord about to read LibidAbsolute at [0x%x]", pStream->Tell() );
-+ pStream->Read( pLibidAbsolute.get(), SizeOfLibidAbsolute );
-
- *pStream >> SizeOfLibidRelative;
-
-- if ( SizeOfLibidRelative )
-- {
-- pLibidRelative = new sal_uInt8[ SizeOfLibidRelative ];
-- OSL_TRACE("ReferenceProjectRecord about to read LibidRelative at [0x%x]", pStream->Tell() );
-- pStream->Read( pLibidRelative, SizeOfLibidRelative );
-- }
-+ boost::scoped_array< sal_uInt8 > pLibidRelative( new sal_uInt8[ SizeOfLibidRelative ] );
-+ OSL_TRACE("ReferenceProjectRecord about to read LibidRelative at [0x%x]", pStream->Tell() );
-+ pStream->Read( pLibidRelative.get(), SizeOfLibidRelative );
-
- *pStream >> MajorVersion >> MinorVersion;
-
-@@ -634,17 +513,17 @@ bool ReferenceProjectRecord::read( SvStream* pStream )
- // 16 bit unicode )
- // the offset of 3 is needed to skip the ProjectReference "*\" and project kind ( 0x4[1-4] ) info.
-
-- msAbsoluteLibid = lclCreateOUString( reinterpret_cast< const char* >( pLibidAbsolute + 3 ), ( SVX_MSOCX_COMPRESSED | (SizeOfLibidAbsolute - 3 )));
-- msRelativeLibid = lclCreateOUString( reinterpret_cast< const char* >( pLibidRelative + 3 ), ( SVX_MSOCX_COMPRESSED | ( SizeOfLibidRelative -3 )));
-+ AbsoluteLibid = svt::BinFilterUtils::CreateOUStringFromStringArray( reinterpret_cast< const char* >( pLibidAbsolute.get() + 3 ), (SizeOfLibidAbsolute - 3 ) );
-+ RelativeLibid = svt::BinFilterUtils::CreateOUStringFromStringArray( reinterpret_cast< const char* >( pLibidRelative.get() + 3 ), ( SizeOfLibidRelative -3 ) );
-
-- OSL_TRACE("ReferenceProjectRecord - absolute path %s", rtl::OUStringToOString( msAbsoluteLibid, RTL_TEXTENCODING_UTF8 ).getStr() );
-- OSL_TRACE("ReferenceProjectRecord - relative path %s", rtl::OUStringToOString( msRelativeLibid, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ OSL_TRACE("ReferenceProjectRecord - absolute path %s", rtl::OUStringToOString( AbsoluteLibid, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ OSL_TRACE("ReferenceProjectRecord - relative path %s", rtl::OUStringToOString( RelativeLibid, RTL_TEXTENCODING_UTF8 ).getStr() );
- return true;
- }
-
- void ReferenceProjectRecord::import( VBA_Impl& rDir )
- {
-- rDir.AddProjectReference( msAbsoluteLibid );
-+ rDir.AddProjectReference( AbsoluteLibid );
- }
-
- class ReferenceRegisteredRecord : public BaseReferenceRecord
-@@ -653,7 +532,7 @@ public:
- sal_uInt16 Id;
- sal_uInt32 Size;
- sal_uInt32 SizeOfLibid;
-- sal_uInt8* pLibid;
-+ boost::scoped_array< sal_uInt8> pLibid;
- sal_Int32 Reserved1;
- sal_Int16 Reserved2;
-
-@@ -662,16 +541,12 @@ public:
- bool read( SvStream* pStream );
- };
-
--ReferenceRegisteredRecord::ReferenceRegisteredRecord() : Id( 0x000D ), Size( 0 ), SizeOfLibid( 0 ), pLibid( NULL ), Reserved1( 0 ), Reserved2( 0 )
-+ReferenceRegisteredRecord::ReferenceRegisteredRecord() : Id( 0x000D ), Size( 0 ), SizeOfLibid( 0 ), Reserved1( 0 ), Reserved2( 0 )
- {
- }
-
- ReferenceRegisteredRecord::~ReferenceRegisteredRecord()
- {
-- if ( pLibid )
-- {
-- delete[] pLibid;
-- }
- }
-
- bool
-@@ -681,9 +556,8 @@ ReferenceRegisteredRecord::read( SvStream* pStream )
- *pStream >> Id >> Size >> SizeOfLibid;
- if ( SizeOfLibid )
- {
-- pLibid = new sal_uInt8[ SizeOfLibid ];
-- OSL_TRACE("ReferenceRegisteredRecord about to read Libid [0x%x]", pStream->Tell() );
-- pStream->Read( pLibid, SizeOfLibid );
-+ pLibid.reset( new sal_uInt8[ SizeOfLibid] );
-+ pStream->Read( pLibid.get(), SizeOfLibid );
- }
- *pStream >> Reserved1 >> Reserved2;
- return true;
-@@ -694,17 +568,15 @@ class ReferenceOriginalRecord
- public:
- sal_uInt16 Id;
- sal_uInt32 SizeOfLibOriginal;
-- sal_uInt8* pLibidOriginal;
-+ boost::scoped_array< sal_uInt8 > pLibidOriginal;
-
-
--ReferenceOriginalRecord() : Id( 0x033 ), SizeOfLibOriginal( 0 ), pLibidOriginal( NULL )
-+ReferenceOriginalRecord() : Id( 0x033 ), SizeOfLibOriginal( 0 )
- {
- }
-
- ~ReferenceOriginalRecord()
- {
-- if ( pLibidOriginal )
-- delete[] pLibidOriginal;
- }
-
- void read( SvStream* pStream )
-@@ -712,8 +584,8 @@ void read( SvStream* pStream )
- *pStream >> Id >> SizeOfLibOriginal;
- if ( SizeOfLibOriginal )
- {
-- pLibidOriginal = new sal_uInt8[ SizeOfLibOriginal ];
-- pStream->Read( pLibidOriginal, SizeOfLibOriginal );
-+ pLibidOriginal.reset( new sal_uInt8[ SizeOfLibOriginal ] );
-+ pStream->Read( pLibidOriginal.get(), SizeOfLibOriginal );
- }
- }
-
-@@ -722,24 +594,24 @@ void read( SvStream* pStream )
- class ReferenceControlRecord : public BaseReferenceRecord
- {
- public:
--ReferenceOriginalRecord OriginalRecord;
-+std::auto_ptr< ReferenceOriginalRecord > OriginalRecord;
- sal_Int16 Id;
- sal_uInt32 SizeTwiddled;
- sal_uInt32 SizeOfLibidTwiddled;
--sal_uInt8* LibidTwiddled;
-+boost::shared_array< sal_uInt8 > LibidTwiddled;
- sal_uInt32 Reserved1;
- sal_uInt16 Reserved2;
--ReferenceNameRecord* NameRecordExtended;// Optional
-+std::auto_ptr< ReferenceNameRecord > NameRecordExtended;// Optional
- sal_uInt16 Reserved3;
- sal_uInt32 SizeExtended;
- sal_uInt32 SizeOfLibidExtended;
--sal_uInt8* LibidExtended;
-+boost::shared_array< sal_uInt8 > LibidExtended;
- sal_uInt32 Reserved4;
- sal_uInt16 Reserved5;
- sal_uInt8 OriginalTypeLib[ 16 ];
- sal_uInt32 Cookie;
-
--ReferenceControlRecord() : Id( 0x2F ), SizeTwiddled( 0 ), SizeOfLibidTwiddled( 0 ), LibidTwiddled( 0 ), Reserved1( 0 ), Reserved2( 0 ), NameRecordExtended( 0 ), Reserved3( 0x30 ), SizeExtended( 0 ), SizeOfLibidExtended( 0 ), LibidExtended( 0 ), Reserved4( 0 ), Reserved5( 0 ), Cookie( 0 )
-+ReferenceControlRecord() : Id( 0x2F ), SizeTwiddled( 0 ), SizeOfLibidTwiddled( 0 ), Reserved1( 0 ), Reserved2( 0 ), Reserved3( 0x30 ), SizeExtended( 0 ), SizeOfLibidExtended( 0 ), Reserved4( 0 ), Reserved5( 0 ), Cookie( 0 )
- {
- for( int i = 0; i < 16; ++i )
- OriginalTypeLib[ i ] = 0;
-@@ -747,29 +619,31 @@ ReferenceControlRecord() : Id( 0x2F ), SizeTwiddled( 0 ), SizeOfLibidTwiddled( 0
-
- ~ReferenceControlRecord()
- {
-- delete LibidTwiddled;
-- delete NameRecordExtended;
-- delete [] LibidExtended;
-- LibidTwiddled = 0;
-- NameRecordExtended = 0;
-- LibidExtended = 0;
- }
-
- bool read( SvStream* pStream )
- {
- OSL_TRACE("ReferenceControlRecord [0x%x]", pStream->Tell() );
-- OriginalRecord.read( pStream );
-+ long nPos = pStream->Tell();
-+
-+ *pStream >> Id;
-+ pStream->Seek( nPos ); // point before the peeked Id
-+ if ( Id == 0x33 ) // we have an OriginalRecord
-+ {
-+ OriginalRecord.reset( new ReferenceOriginalRecord() );
-+ OriginalRecord->read( pStream );
-+ }
- *pStream >> Id >> SizeTwiddled >> SizeOfLibidTwiddled;
-
- if ( SizeOfLibidTwiddled )
- {
-- LibidTwiddled = new sal_uInt8[ SizeOfLibidTwiddled ];
-- pStream->Read( LibidTwiddled, SizeOfLibidTwiddled );
-+ LibidTwiddled.reset( new sal_uInt8[ SizeOfLibidTwiddled ] );
-+ pStream->Read( LibidTwiddled.get(), SizeOfLibidTwiddled );
- }
-
- *pStream >> Reserved1 >> Reserved2;
-
-- long nPos = pStream->Tell();
-+ nPos = pStream->Tell();
- // peek at the id for optional NameRecord
- sal_Int16 nTmpId;
- *pStream >> nTmpId;
-@@ -780,7 +654,7 @@ bool read( SvStream* pStream )
- else
- {
- pStream->Seek( nPos );
-- NameRecordExtended = new ReferenceNameRecord();
-+ NameRecordExtended.reset( new ReferenceNameRecord() );
- NameRecordExtended->read( pStream );
- *pStream >> Reserved3;
- }
-@@ -788,8 +662,8 @@ bool read( SvStream* pStream )
-
- if ( SizeExtended )
- {
-- LibidExtended = new sal_uInt8[ SizeOfLibidExtended ];
-- pStream->Read( LibidExtended, SizeOfLibidExtended );
-+ LibidExtended.reset( new sal_uInt8[ SizeOfLibidExtended ] );
-+ pStream->Read( LibidExtended.get(), SizeOfLibidExtended );
- }
-
- *pStream >> Reserved4;
-@@ -806,15 +680,12 @@ class ReferenceRecord : public BaseReferenceRecord
- {
- public:
- // NameRecord is Optional
--ReferenceNameRecord* NameRecord;
--BaseReferenceRecord* aReferenceRecord;
--ReferenceRecord(): NameRecord(0), aReferenceRecord(0) {}
-+std::auto_ptr< ReferenceNameRecord > NameRecord;
-+std::auto_ptr< BaseReferenceRecord > aReferenceRecord;
-+
-+ReferenceRecord(){}
- ~ReferenceRecord()
- {
-- if ( NameRecord )
-- delete NameRecord;
-- if ( aReferenceRecord )
-- delete aReferenceRecord;
- }
-
- // false return would mean failed to read Record e.g. end of array encountered
-@@ -833,7 +704,7 @@ bool read( SvStream* pStream )
- pStream->Seek( nPos ); // place back before Id
- if ( Id == 0x16 ) // Optional NameRecord
- {
-- NameRecord = new ReferenceNameRecord();
-+ NameRecord.reset( new ReferenceNameRecord() );
- NameRecord->read( pStream );
- }
- else if ( Id == 0x0f )
-@@ -850,14 +721,14 @@ bool read( SvStream* pStream )
- switch( Id )
- {
- case 0x0D:
-- aReferenceRecord = new ReferenceRegisteredRecord();
-+ aReferenceRecord.reset( new ReferenceRegisteredRecord() );
- break;
- case 0x0E:
-- aReferenceRecord = new ReferenceProjectRecord();
-+ aReferenceRecord.reset( new ReferenceProjectRecord() );
- break;
- case 0x2F:
- case 0x33:
-- aReferenceRecord = new ReferenceControlRecord();
-+ aReferenceRecord.reset( new ReferenceControlRecord() );
- break;
- default:
- bRead = false;
-@@ -871,7 +742,7 @@ bool read( SvStream* pStream )
-
- void import( VBA_Impl& rVBA )
- {
-- if ( aReferenceRecord )
-+ if ( aReferenceRecord.get() )
- aReferenceRecord->import( rVBA );
- }
-
-@@ -904,6 +775,7 @@ DirDumper() {}
- void read( SvStream* pStream )
- {
- sal_Int32 nPos = pStream->Tell();
-+#ifdef DEBUG
- std::ofstream aDump("dir.dump");
- while ( !pStream->IsEof() )
- {
-@@ -912,6 +784,7 @@ void read( SvStream* pStream )
- aDump << aByte;
- }
- aDump.flush();
-+#endif
- pStream->Seek( nPos );
- readProjectInformation( pStream );
- readProjectReferenceInformation( pStream );
-@@ -957,7 +830,7 @@ void import( VBA_Impl& rVBA )
- // get project references
- for ( std::vector< ReferenceRecord* >::iterator it = ReferenceArray.begin(); it != ReferenceArray.end(); ++it )
- (*it)->import( rVBA );
-- rVBA.SetProjectName( mProjectNameRec.msProjectName );
-+ rVBA.SetProjectName( mProjectNameRec.ProjectName );
-
- }
- };
diff --git a/patches/vba/sc-hacky-handle-boolean.diff b/patches/vba/sc-hacky-handle-boolean.diff
deleted file mode 100644
index 3cbeb7acb..000000000
--- a/patches/vba/sc-hacky-handle-boolean.diff
+++ /dev/null
@@ -1,53 +0,0 @@
-Index: sc/inc/global.hxx
-===================================================================
-RCS file: /cvs/sc/sc/inc/global.hxx,v
-retrieving revision 1.43
-diff -u -p -r1.43 global.hxx
---- sc/inc/global.hxx 8 Sep 2005 17:41:44 -0000 1.43
-+++ sc/inc/global.hxx 9 Nov 2005 17:52:49 -0000
-@@ -234,6 +234,7 @@ const USHORT IDF_HARDATTR = 0x0020;
- const USHORT IDF_STYLES = 0x0040; /// Cell styles.
- const USHORT IDF_OBJECTS = 0x0080; /// Drawing objects.
- const USHORT IDF_EDITATTR = 0x0100; /// Rich-text attributes.
-+const USHORT IDF_SPECIAL_BOOLEAN = 0x1000;
- const USHORT IDF_ATTRIB = IDF_HARDATTR | IDF_STYLES;
- const USHORT IDF_CONTENTS = IDF_VALUE | IDF_DATETIME | IDF_STRING | IDF_NOTE | IDF_FORMULA;
- const USHORT IDF_ALL = IDF_CONTENTS | IDF_ATTRIB | IDF_OBJECTS;
-Index: sc/source/core/data/column3.cxx
-===================================================================
-RCS file: /cvs/sc/sc/source/core/data/column3.cxx,v
-retrieving revision 1.18
-diff -u -p -r1.18 column3.cxx
---- sc/source/core/data/column3.cxx 28 Sep 2005 11:29:59 -0000 1.18
-+++ sc/source/core/data/column3.cxx 9 Nov 2005 17:53:11 -0000
-@@ -781,8 +781,10 @@ ScBaseCell* ScColumn::CloneCell(SCSIZE n
- bool bCloneValue = (nFlags & IDF_VALUE) != 0;
- bool bCloneDateTime = (nFlags & IDF_DATETIME) != 0;
- bool bCloneString = (nFlags & IDF_STRING) != 0;
-+ bool bCloneSpecialBoolean = (nFlags & IDF_SPECIAL_BOOLEAN) != 0;
- bool bCloneFormula = (nFlags & IDF_FORMULA) != 0;
- bool bCloneNote = (nFlags & IDF_NOTE) != 0;
-+ bool bForceFormula = false;
-
- ScBaseCell* pNew = 0;
- ScBaseCell& rSource = *pItems[nIndex].pCell;
-@@ -806,7 +807,18 @@ ScBaseCell* ScColumn::CloneCell(SCSIZE n
- break;
-
- case CELLTYPE_FORMULA:
-- if (bCloneFormula)
-+ if ( bCloneSpecialBoolean )
-+ {
-+ ScFormulaCell& rForm = (ScFormulaCell&)rSource;
-+ rtl::OUStringBuffer aBuf;
-+ // #TODO #FIXME do we have a localisation issue here?
-+ rForm.GetFormula( aBuf );
-+ rtl::OUString aVal( aBuf.makeStringAndClear() );
-+ if ( aVal.equalsAscii( "=TRUE()" )
-+ || aVal.equalsAscii( "=FALSE()" ) )
-+ bForceFormula = true;
-+ }
-+ if (bForceFormula || bCloneFormula)
- {
- // note will be cloned below
- pNew = rSource.CloneWithoutNote( rDestDoc, rDestPos );
diff --git a/patches/vba/sc-source-ui-vba-makefile-mk.diff b/patches/vba/sc-source-ui-vba-makefile-mk.diff
deleted file mode 100644
index 498f593eb..000000000
--- a/patches/vba/sc-source-ui-vba-makefile-mk.diff
+++ /dev/null
@@ -1,14 +0,0 @@
---- sc/source/ui/vba/makefile.mk
-+++ sc/source/ui/vba/makefile.mk
-@@ -48,9 +48,9 @@ DLLPRE =
- dummy:
- @echo "not building vba..."
- .ENDIF
--
-+
- INCPRE=$(INCCOM)$/$(TARGET)
--
-+CDEFS+=-DVBA_OOBUILD_HACK
- # ------------------------------------------------------------------
-
- SLOFILES= \
diff --git a/patches/vba/sc-vba-autofill-support.diff b/patches/vba/sc-vba-autofill-support.diff
deleted file mode 100644
index 1de0aa294..000000000
--- a/patches/vba/sc-vba-autofill-support.diff
+++ /dev/null
@@ -1,38 +0,0 @@
---- sc.orig/source/ui/inc/docfunc.hxx 2007-01-04 12:29:30.000000000 +0000
-+++ sc/source/ui/inc/docfunc.hxx 2007-01-08 17:04:45.000000000 +0000
-@@ -159,6 +159,8 @@ public:
- double fStart, double fStep, double fMax,
- BOOL bRecord, BOOL bApi );
- // FillAuto: rRange wird von Source-Range auf Dest-Range angepasst
-+ SC_DLLPUBLIC BOOL FillAuto( ScRange& rRange, const ScMarkData* pTabMark, FillDir eDir, FillCmd eCmd, FillDateCmd eDateCmd, ULONG nCount, double fStep, double fMax, BOOL bRecord, BOOL bApi );
-+
- BOOL FillAuto( ScRange& rRange, const ScMarkData* pTabMark,
- FillDir eDir, ULONG nCount, BOOL bRecord, BOOL bApi );
-
---- sc.orig/source/ui/docshell/docfunc.cxx 2007-01-04 12:29:30.000000000 +0000
-+++ sc/source/ui/docshell/docfunc.cxx 2007-01-08 17:23:02.000000000 +0000
-@@ -3298,6 +3298,13 @@ BOOL ScDocFunc::FillSeries( const ScRang
- BOOL ScDocFunc::FillAuto( ScRange& rRange, const ScMarkData* pTabMark,
- FillDir eDir, ULONG nCount, BOOL bRecord, BOOL bApi )
- {
-+ double fStep = 1.0;
-+ double fMax = MAXDOUBLE;
-+ return FillAuto( rRange, pTabMark, eDir, FILL_AUTO, FILL_DAY, nCount, fStep, fMax, bRecord, bApi );
-+}
-+
-+BOOL ScDocFunc::FillAuto( ScRange& rRange, const ScMarkData* pTabMark, FillDir eDir, FillCmd eCmd, FillDateCmd eDateCmd, ULONG nCount, double fStep, double fMax, BOOL bRecord, BOOL bApi )
-+{
- ScDocShellModificator aModificator( rDocShell );
-
- ScDocument* pDoc = rDocShell.GetDocument();
-@@ -3323,10 +3330,6 @@ BOOL ScDocFunc::FillAuto( ScRange& rRang
- ScRange aSourceArea = rRange;
- ScRange aDestArea = rRange;
-
-- FillCmd eCmd = FILL_AUTO;
-- FillDateCmd eDateCmd = FILL_DAY;
-- double fStep = 1.0;
-- double fMax = MAXDOUBLE;
-
- switch (eDir)
- {
diff --git a/patches/vba/sc-vba-build-lst.diff b/patches/vba/sc-vba-build-lst.diff
deleted file mode 100644
index 9fe0133fc..000000000
--- a/patches/vba/sc-vba-build-lst.diff
+++ /dev/null
@@ -1,11 +0,0 @@
---- sc/prj/build.lst 2007-02-09 16:45:03.000000000 +0000
-+++ sc/prj/build.lst 2007-02-11 12:27:15.000000000 +0000
-@@ -33,7 +33,7 @@ sc sc\source\ui\undo nmake - all sc_
- sc sc\source\ui\unoobj nmake - all sc_unobj sc_sdi sc_inc NULL
- sc sc\source\ui\vba nmake - all sc_vba sc_sdi sc_inc NULL
- sc sc\source\ui\view nmake - all sc_view sc_sdi sc_inc NULL
--sc sc\source\filter\excel nmake - all sc_excel sc_sdi sc_inc NULL
-+sc sc\source\filter\excel nmake - all sc_excel sc_vba sc_sdi sc_inc NULL
- sc sc\source\filter\ftools nmake - all sc_ftools sc_sdi sc_inc NULL
- sc sc\source\filter\lotus nmake - all sc_lotus sc_sdi sc_inc NULL
- sc sc\source\filter\qpro nmake - all sc_qpro sc_sdi sc_inc NULL
diff --git a/patches/vba/sc-vbaimport-override-controlname.diff b/patches/vba/sc-vbaimport-override-controlname.diff
deleted file mode 100644
index c8acbfc57..000000000
--- a/patches/vba/sc-vbaimport-override-controlname.diff
+++ /dev/null
@@ -1,190 +0,0 @@
---- sc/source/filter/excel/excimp8.cxx.old 2009-04-06 16:41:49.000000000 +0000
-+++ sc/source/filter/excel/excimp8.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -275,11 +275,11 @@ void ImportExcel8::ReadBasic( void )
- SvxImportMSVBasic aBasicImport( *pShell, *xRootStrg, bLoadCode, bLoadStrg );
- bool bAsComment = !bLoadExecutable || !lcl_hasVBAEnabled();
- aBasicImport.Import( EXC_STORAGE_VBA_PROJECT, EXC_STORAGE_VBA, bAsComment );
-+ GetObjectManager().SetOleNameOverrideInfo( aBasicImport.ControlNameForObjectId() );
- }
- }
- }
-
--
- void ImportExcel8::EndSheet( void )
- {
- GetCondFormatManager().Apply();
---- sc/source/filter/excel/xiescher.cxx.old 2009-04-06 16:41:49.000000000 +0000
-+++ sc/source/filter/excel/xiescher.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -116,6 +116,8 @@
- #include "xipage.hxx"
- #include "xichart.hxx"
- #include "xicontent.hxx"
-+#include "scextopt.hxx"
-+
- #include "namebuff.hxx"
-
- using ::rtl::OUString;
-@@ -399,11 +401,16 @@ void XclImpDrawObjBase::SetAnchor( const
-
- String XclImpDrawObjBase::GetObjName() const
- {
-+ String sName( GetObjectManager().GetOleNameOverride( GetObjId() ) );
-+
-+
- /* #118053# #i51348# Always return a non-empty name. Create English
- default names depending on the object type. This is not implemented as
- virtual functions in derived classes, as class type and object type may
- not match. */
-- return (maObjName.Len() > 0) ? maObjName : GetObjectManager().GetDefaultObjName( *this );
-+ if ( sName.Len() == 0 )
-+ sName = ( (maObjName.Len() > 0) ? maObjName : GetObjectManager().GetDefaultObjName( *this ) );
-+ return sName;
- }
-
- bool XclImpDrawObjBase::IsValidSize( const Rectangle& rAnchorRect ) const
-@@ -3086,6 +3093,23 @@ XclImpDffManager::~XclImpDffManager()
- {
- }
-
-+String XclImpObjectManager::GetOleNameOverride( const XclObjId& nObjId )
-+{
-+ String sOleName;
-+ String sCodeName = GetExtDocOptions().GetCodeName( nObjId.mnScTab );
-+
-+ CodeNameToCntrlObjIdInfo::iterator it = maOleCtrlNameOverride.find( sCodeName );
-+ if ( it != maOleCtrlNameOverride.end() )
-+ {
-+ CntrlObjIdToName::iterator it_id = it->second.find( nObjId.mnObjId );
-+ if ( it_id != it->second.end() )
-+ {
-+ sOleName = it_id->second;
-+ }
-+ }
-+ return sOleName;
-+}
-+
- void XclImpDffManager::StartProgressBar( sal_Size nProgressSize )
- {
- mxProgress.reset( new ScfProgressBar( GetDocShell(), STR_PROGRESS_CALCULATING ) );
---- sc/source/filter/inc/xiescher.hxx.old 2009-04-06 16:41:46.000000000 +0000
-+++ sc/source/filter/inc/xiescher.hxx 2009-04-06 16:41:59.000000000 +0000
-@@ -33,6 +33,7 @@
-
- #include <vector>
- #include <map>
-+#include <hash_map>
- #include <svx/msdffimp.hxx>
- #include <svx/msocximex.hxx>
- #include <vcl/graph.hxx>
-@@ -1085,6 +1086,8 @@ private:
- /** Stores all drawing and OLE objects and additional data related to these objects. */
- class XclImpObjectManager : protected XclImpRoot
- {
-+typedef std::hash_map< sal_Int32, String > CntrlObjIdToName;
-+typedef std::map< String, CntrlObjIdToName > CodeNameToCntrlObjIdInfo;
- public:
- explicit XclImpObjectManager( const XclImpRoot& rRoot );
- virtual ~XclImpObjectManager();
-@@ -1130,9 +1133,13 @@ public:
- String GetDefaultObjName( const XclImpDrawObjBase& rDrawObj ) const;
- /** Returns the used area in the sheet with the passed index. */
- ScRange GetUsedArea( SCTAB nScTab ) const;
--
-+ void SetOleNameOverrideInfo( const CodeNameToCntrlObjIdInfo& rOverrideInfo ) { maOleCtrlNameOverride = rOverrideInfo; }
-+ String GetOleNameOverride( const XclObjId& nObjId );
- // ------------------------------------------------------------------------
- private:
-+
-+ CodeNameToCntrlObjIdInfo maOleCtrlNameOverride;
-+
- /** Reads and returns a bitmap from WMF/PICT format. */
- static void ReadWmf( Graphic& rGraphic, XclImpStream& rStrm );
- /** Reads and returns a bitmap from BMP format. */
---- svx/inc/svxmsbas.hxx.old 2009-04-02 11:03:40.000000000 +0000
-+++ svx/inc/svxmsbas.hxx 2009-04-06 16:41:59.000000000 +0000
-@@ -35,6 +35,8 @@
- #include "svx/svxdllapi.h"
-
- #include <sot/storage.hxx>
-+#include <map>
-+#include <hash_map>
-
- class SfxObjectShell;
-
-@@ -53,8 +55,15 @@ class SfxObjectShell;
- * probably what the user expects to see when viewing the code
- */
-
-+typedef std::hash_map< sal_Int32, String > ObjIdToName;
-+
-+typedef std::map< String, ObjIdToName > ControlAttributeInfo;
-+
- class SVX_DLLPUBLIC SvxImportMSVBasic
--{
-+{
-+ ControlAttributeInfo m_ModuleNameToObjIdHash;
-+ void extractAttribute( const String& rAttribute, const String& rModName );
-+
- public:
- SvxImportMSVBasic( SfxObjectShell &rDocS, SotStorage &rRoot,
- BOOL bImportCode = TRUE, BOOL bCopyStorage = TRUE )
-@@ -73,9 +82,10 @@ public:
- // - returns a warning code if a modified basic exist, in all other
- // cases return ERRCODE_NONE.
- ULONG SaveOrDelMSVBAStorage( BOOL bSaveInto, const String& rStorageName );
--
- // check if the MS-VBA-Storage exist in the RootStorage of the DocShell.
- // If it exist, then return the WarningId for loosing the information.
-+
-+ const ControlAttributeInfo& ControlNameForObjectId(){ return m_ModuleNameToObjIdHash; }
- static ULONG GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocS );
-
- static String GetMSBasicStorageName();
-@@ -87,7 +97,7 @@ private:
-
- SVX_DLLPRIVATE BOOL ImportCode_Impl( const String& rStorageName,
- const String &rSubStorageName,
-- BOOL bAsComment, BOOL bStripped);
-+ BOOL bAsComment, BOOL bStripped );
- SVX_DLLPRIVATE bool ImportForms_Impl(const String& rStorageName,
- const String &rSubStorageName);
- SVX_DLLPRIVATE BOOL CopyStorage_Impl( const String& rStorageName,
---- svx/source/msfilter/svxmsbas.cxx.old 2009-04-02 11:03:03.000000000 +0000
-+++ svx/source/msfilter/svxmsbas.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -61,6 +61,23 @@ using namespace com::sun::star;
-
- using rtl::OUString;
-
-+void SvxImportMSVBasic::extractAttribute( const String& rAttribute, const String& rModName )
-+{
-+ // format of the attribute we are interested in is
-+ // Attribute VB_Control = "ControlName", intString, MSForms, ControlTypeAsString
-+ // e.g.
-+ // Attribute VB_Control = "CommandButton1, 201, 19, MSForms, CommandButton"
-+ String sControlAttribute( RTL_CONSTASCII_USTRINGPARAM("Attribute VB_Control = \"") );
-+ if ( rAttribute.Search( sControlAttribute ) != STRING_NOTFOUND )
-+ {
-+ String sRest = rAttribute.Copy( sControlAttribute.Len() );
-+ xub_StrLen nPos = 0;
-+ String sCntrlName = sRest.GetToken( 0, ',', nPos );
-+
-+ sal_Int32 nCntrlId = sRest.GetToken( 0, ',', nPos).ToInt32();
-+ m_ModuleNameToObjIdHash[ rModName ][ nCntrlId ] = sCntrlName;
-+ }
-+}
- int SvxImportMSVBasic::Import( const String& rStorageName,
- const String &rSubStorageName,
- BOOL bAsComment, BOOL bStripped )
-@@ -369,7 +386,12 @@ BOOL SvxImportMSVBasic::ImportCode_Impl(
- if( nEnd == STRING_NOTFOUND )
- pStr->Erase();
- else
-+ {
-+ //OSL_TRACE("Erase %s", rtl::OUStringToOString(*pStr, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ String sAttr= pStr->Copy( nBegin, (nEnd-nBegin)+1);
-+ extractAttribute( sAttr, sModule );
- pStr->Erase(nBegin, (nEnd-nBegin)+1);
-+ }
- }
- }
- if( aDecompressed.Get(j)->Len() )
diff --git a/patches/vba/scp_vba_uno_service.diff b/patches/vba/scp_vba_uno_service.diff
deleted file mode 100644
index 35ab74484..000000000
--- a/patches/vba/scp_vba_uno_service.diff
+++ /dev/null
@@ -1,23 +0,0 @@
---- scp2/source/ooo/file_library_ooo.scp 2008-04-30 11:44:31.000000000 +0100
-+++ scp2/source/ooo/file_library_ooo.scp 2008-04-30 11:56:14.000000000 +0100
-@@ -67,6 +67,20 @@ File gid_File_Lib_Basprov
- #endif
- End
-
-+#ifdef ENABLE_VBA
-+File gid_File_Lib_Vbaevent
-+ TXT_FILE_BODY;
-+ Styles = (PACKED,UNO_COMPONENT);
-+ RegistryID = gid_Starregistry_Services_Rdb;
-+ Dir = gid_Dir_Program;
-+ #ifdef UNX
-+ Name = STRING(CONCAT4(vbaevents,DLLPOSTFIX,.uno,UNXSUFFIX));
-+ #else
-+ Name = STRING(CONCAT4(vbaevents,DLLPOSTFIX,.uno,.dll));
-+ #endif
-+End
-+#endif // ENABLE_VBA
-+
- STD_UNO_LIB_FILE( gid_File_Lib_Bib , bib)
-
- File gid_File_Lib_Cached1
diff --git a/patches/vba/spinbutton-import-valuechange.diff b/patches/vba/spinbutton-import-valuechange.diff
deleted file mode 100644
index 0b9622780..000000000
--- a/patches/vba/spinbutton-import-valuechange.diff
+++ /dev/null
@@ -1,13 +0,0 @@
---- svx/source/msfilter/msocximex.cxx 2008-09-17 17:40:38.000000000 +0100
-+++ svx/source/msfilter/msocximex.cxx 2008-09-17 18:15:08.000000000 +0100
-@@ -5611,8 +5611,8 @@ sal_Bool OCX_SpinButton::Read( SvStorage
- if( mnBlockFlags & 0x00000080 ) rStrm >> mnValue;
- if( mnBlockFlags & 0x00000100 ) rStrm.SeekRel( 4 ); // unknown
- if( mnBlockFlags & 0x00000200 ) rStrm.SeekRel( 4 ); // unknown
-- if( mnBlockFlags & 0x00000400 ) rStrm.SeekRel( 4 ); // unknown
-- if( mnBlockFlags & 0x00000800 ) rStrm >> mnSmallStep;
-+ if( mnBlockFlags & 0x00000400 ) rStrm >> mnSmallStep;
-+ if( mnBlockFlags & 0x00000800 ) rStrm.SeekRel( 4 ); // unknown
- if( mnBlockFlags & 0x00001000 ) rStrm >> mnPageStep;
- if( mnBlockFlags & 0x00002000 ) rStrm >> mnOrient;
- if( mnBlockFlags & 0x00004000 )
diff --git a/patches/vba/svx-source-form-fmscriptingenv-cxx.diff b/patches/vba/svx-source-form-fmscriptingenv-cxx.diff
deleted file mode 100644
index a3dfd3852..000000000
--- a/patches/vba/svx-source-form-fmscriptingenv-cxx.diff
+++ /dev/null
@@ -1,19 +0,0 @@
-Index: svx/source/form/fmscriptingenv.cxx
-===================================================================
-RCS file: /cvs/graphics/svx/source/form/fmscriptingenv.cxx,v
-retrieving revision 1.2
-diff -u -p -r1.2 fmscriptingenv.cxx
---- svx/source/form/fmscriptingenv.cxx 28 Aug 2006 15:01:24 -0000 1.2
-+++ svx/source/form/fmscriptingenv.cxx 26 Oct 2006 11:35:38 -0000
-@@ -280,6 +280,11 @@ namespace svxform
- void SAL_CALL FormScriptListener::firing( const ScriptEvent& _rEvent ) throw (RuntimeException)
- {
- ::osl::ClearableMutexGuard aGuard( m_aMutex );
-+ static const ::rtl::OUString vbaInterOp =
-+ ::rtl::OUString::createFromAscii("VBAInterop");
-+ if ( _rEvent.ScriptType.equals(vbaInterOp) )
-+ return; // not handled here
-+
- if ( impl_isDisposed_nothrow() )
- return;
-
diff --git a/patches/vba/svx-source-form-fmundo-cxx.diff b/patches/vba/svx-source-form-fmundo-cxx.diff
deleted file mode 100644
index 61f3db118..000000000
--- a/patches/vba/svx-source-form-fmundo-cxx.diff
+++ /dev/null
@@ -1,127 +0,0 @@
-diff --git svx/source/form/fmundo.cxx svx/source/form/fmundo.cxx
-index ee1d592..f3b5c3d 100644
---- svx/source/form/fmundo.cxx
-+++ svx/source/form/fmundo.cxx
-@@ -86,6 +86,90 @@ using namespace ::com::sun::star::reflection;
- using namespace ::com::sun::star::form::binding;
- using namespace ::svxform;
-
-+
-+#include <com/sun/star/script/XScriptListener.hdl>
-+#include <comphelper/processfactory.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+
-+typedef cppu::WeakImplHelper1< XScriptListener > ScriptEventListener_BASE;
-+class ScriptEventListenerWrapper : public ScriptEventListener_BASE
-+{
-+public:
-+ ScriptEventListenerWrapper( FmFormModel& _rModel) throw ( RuntimeException ) : pModel(&_rModel)
-+ {
-+ Reference < XPropertySet > xProps(
-+ ::comphelper::getProcessServiceFactory(), UNO_QUERY );
-+ if ( xProps.is() )
-+ {
-+ Reference< XComponentContext > xCtx( xProps->getPropertyValue(
-+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), UNO_QUERY );
-+ if ( xCtx.is() )
-+ {
-+ Reference< XMultiComponentFactory > xMFac(
-+ xCtx->getServiceManager(), UNO_QUERY );
-+ if ( xMFac.is() )
-+ {
-+ m_vbaListener.set( xMFac->createInstanceWithContext(
-+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
-+ "ooo.vba.EventListener" ) ), xCtx ),
-+ UNO_QUERY_THROW );
-+ }
-+ }
-+ }
-+ }
-+ // XEventListener
-+ virtual void SAL_CALL disposing(const EventObject& ) throw( RuntimeException ){}
-+
-+ // XScriptListener
-+ virtual void SAL_CALL firing(const ScriptEvent& evt) throw(RuntimeException)
-+ {
-+ setModel();
-+ if ( m_vbaListener.is() )
-+ {
-+ m_vbaListener->firing( evt );
-+ }
-+ }
-+
-+ virtual Any SAL_CALL approveFiring(const ScriptEvent& evt) throw( com::sun::star::reflection::InvocationTargetException, RuntimeException)
-+ {
-+ setModel();
-+ if ( m_vbaListener.is() )
-+ {
-+ return m_vbaListener->approveFiring( evt );
-+ }
-+ return Any();
-+ }
-+
-+private:
-+ void setModel()
-+ {
-+ Reference< XPropertySet > xProps( m_vbaListener, UNO_QUERY );
-+ if ( xProps.is() )
-+ {
-+ try
-+ {
-+ SfxObjectShellRef xObjSh = pModel->GetObjectShell();
-+ if ( xObjSh.Is() && m_vbaListener.is() )
-+ {
-+ Any aVal;
-+ aVal <<= xObjSh->GetModel();
-+ xProps->setPropertyValue(
-+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Model" ) ),
-+ aVal );
-+ }
-+ }
-+ catch( Exception& e )
-+ {
-+ //swallow any errors
-+ }
-+ }
-+ }
-+ FmFormModel* pModel;
-+ Reference< XScriptListener > m_vbaListener;
-+
-+
-+};
-+
- //------------------------------------------------------------------------------
- // some helper structs for caching property infos
- //------------------------------------------------------------------------------
-@@ -128,6 +212,13 @@ FmXUndoEnvironment::FmXUndoEnvironment(FmFormModel& _rModel)
- ,m_bDisposed( false )
- {
- DBG_CTOR(FmXUndoEnvironment,NULL);
-+ try
-+ {
-+ m_vbaListener = new ScriptEventListenerWrapper( _rModel );
-+ }
-+ catch( Exception& )
-+ {
-+ }
- }
-
- //------------------------------------------------------------------------------
-@@ -752,9 +843,17 @@ void FmXUndoEnvironment::switchListening( const Reference< XIndexContainer >& _r
- if ( xManager.is() )
- {
- if ( _bStartListening )
-+ {
- m_pScriptingEnv->registerEventAttacherManager( xManager );
-+ if ( m_vbaListener.is() )
-+ xManager->addScriptListener( m_vbaListener );
-+ }
- else
-+ {
- m_pScriptingEnv->revokeEventAttacherManager( xManager );
-+ if ( m_vbaListener.is() )
-+ xManager->removeScriptListener( m_vbaListener );
-+ }
- }
-
- // also handle all children of this element
diff --git a/patches/vba/svx-source-form-makefile.diff b/patches/vba/svx-source-form-makefile.diff
deleted file mode 100644
index aaa4f73c2..000000000
--- a/patches/vba/svx-source-form-makefile.diff
+++ /dev/null
@@ -1,18 +0,0 @@
-Index: svx/source/form/makefile.mk
-===================================================================
-RCS file: /cvs/graphics/svx/source/form/makefile.mk,v
-retrieving revision 1.25
-diff -u -r1.25 makefile.mk
---- svx/source/form/makefile.mk 5 Jan 2005 12:22:30 -0000 1.25
-+++ svx/source/form/makefile.mk 31 Aug 2005 08:39:31 -0000
-@@ -74,6 +74,10 @@
-
- # --- Files --------------------------------------------------------
-
-+.IF "$(ENABLE_VBA)"=="YES"
-+ CDEFS+=-DENABLE_VBA
-+.ENDIF
-+
- SRS1NAME=form
- SRC1FILES= \
- fmexpl.src \
diff --git a/patches/vba/svx-source-inc-fmundo-hxx.diff b/patches/vba/svx-source-inc-fmundo-hxx.diff
deleted file mode 100644
index 67c099de7..000000000
--- a/patches/vba/svx-source-inc-fmundo-hxx.diff
+++ /dev/null
@@ -1,16 +0,0 @@
-Index: svx/source/inc/fmundo.hxx
-===================================================================
-RCS file: /cvs/graphics/svx/source/inc/fmundo.hxx,v
-retrieving revision 1.10
-diff -u -r1.10 fmundo.hxx
---- svx/source/inc/fmundo.hxx 18 Mar 2005 18:43:50 -0000 1.10
-+++ svx/source/inc/fmundo.hxx 31 Aug 2005 08:40:26 -0000
-@@ -285,7 +285,7 @@
-
- void switchListening( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >& _rxContainer, bool _bStartListening ) SAL_THROW(());
- void switchListening( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxObject, bool _bStartListening ) SAL_THROW(());
--
-+ ::com::sun::star::uno::Reference< com::sun::star::script::XScriptListener > m_vbaListener;
- public:
- // Methoden zur Zuordnung von Controls zu Forms,
- // werden von der Seite und der UndoUmgebung genutzt
diff --git a/patches/vba/tool-menu-bar-improvements.diff b/patches/vba/tool-menu-bar-improvements.diff
deleted file mode 100644
index 1da7cbb61..000000000
--- a/patches/vba/tool-menu-bar-improvements.diff
+++ /dev/null
@@ -1,1014 +0,0 @@
-diff --git framework/source/uielement/toolbarmanager.cxx framework/source/uielement/toolbarmanager.cxx
-index a4de9c1..38d6324 100644
---- framework/source/uielement/toolbarmanager.cxx
-+++ framework/source/uielement/toolbarmanager.cxx
-@@ -122,6 +122,7 @@ namespace framework
-
- static const char ITEM_DESCRIPTOR_COMMANDURL[] = "CommandURL";
- static const char ITEM_DESCRIPTOR_HELPURL[] = "HelpURL";
-+static const char ITEM_DESCRIPTOR_TOOLTIP[] = "Tooltip";
- static const char ITEM_DESCRIPTOR_CONTAINER[] = "ItemDescriptorContainer";
- static const char ITEM_DESCRIPTOR_LABEL[] = "Label";
- static const char ITEM_DESCRIPTOR_TYPE[] = "Type";
-@@ -131,6 +132,7 @@ static const char ITEM_DESCRIPTOR_STYLE[] = "Style";
-
- static const sal_Int32 ITEM_DESCRIPTOR_COMMANDURL_LEN = 10;
- static const sal_Int32 ITEM_DESCRIPTOR_HELPURL_LEN = 7;
-+static const sal_Int32 ITEM_DESCRIPTOR_TOOLTIP_LEN = 7;
- static const sal_Int32 ITEM_DESCRIPTOR_CONTAINER_LEN = 23;
- static const sal_Int32 ITEM_DESCRIPTOR_LABEL_LEN = 5;
- static const sal_Int32 ITEM_DESCRIPTOR_TYPE_LEN = 4;
-@@ -1250,6 +1252,7 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine
- rtl::OUString aCommandURL;
- rtl::OUString aLabel;
- rtl::OUString aHelpURL;
-+ rtl::OUString aTooltip;
- sal_uInt16 nType( ::com::sun::star::ui::ItemType::DEFAULT );
- sal_uInt16 nWidth( 0 );
- sal_Bool bIsVisible( sal_True );
-@@ -1265,6 +1268,8 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine
- aProp[i].Value >>= aCommandURL;
- else if ( aProp[i].Name.equalsAsciiL( ITEM_DESCRIPTOR_HELPURL, ITEM_DESCRIPTOR_HELPURL_LEN ))
- aProp[i].Value >>= aHelpURL;
-+ else if ( aProp[i].Name.equalsAsciiL( ITEM_DESCRIPTOR_TOOLTIP, ITEM_DESCRIPTOR_TOOLTIP_LEN ))
-+ aProp[i].Value >>= aTooltip;
- else if ( aProp[i].Name.equalsAsciiL( ITEM_DESCRIPTOR_LABEL, ITEM_DESCRIPTOR_LABEL_LEN ))
- aProp[i].Value >>= aLabel;
- else if ( aProp[i].Name.equalsAsciiL( ITEM_DESCRIPTOR_TYPE, ITEM_DESCRIPTOR_TYPE_LEN ))
-@@ -1282,9 +1287,13 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine
- ::rtl::OUString aString( RetrieveLabelFromCommand( aCommandURL ));
-
- sal_uInt16 nItemBits = ConvertStyleToToolboxItemBits( nStyle );
-+ OSL_TRACE("** style for command url %s is 0x%x", rtl::OUStringToOString( aCommandURL, RTL_TEXTENCODING_UTF8 ).getStr(), nItemBits );
- m_pToolBar->InsertItem( nId, aString, nItemBits );
- m_pToolBar->SetItemCommand( nId, aCommandURL );
-- m_pToolBar->SetQuickHelpText( nId, aString );
-+ if ( aTooltip.getLength() )
-+ m_pToolBar->SetQuickHelpText( nId, aTooltip );
-+ else
-+ m_pToolBar->SetQuickHelpText( nId, aString );
- if ( aLabel.getLength() > 0 )
- m_pToolBar->SetItemText( nId, aLabel );
- else
-diff --git sc/source/filter/excel/excimp8.cxx sc/source/filter/excel/excimp8.cxx
-index 07394d8..e5eb48a 100644
---- sc/source/filter/excel/excimp8.cxx
-+++ sc/source/filter/excel/excimp8.cxx
-@@ -109,7 +109,7 @@
-
- #include <com/sun/star/container/XNameContainer.hpp>
- #include <sfx2/app.hxx>
--
-+#include "xltoolbar.hxx"
- using namespace com::sun::star;
-
-
-@@ -306,6 +306,21 @@ void ImportExcel8::ReadBasic( void )
- uno::Any aModel = uno::makeAny( pShell->GetModel() );
- pAppMgr->SetGlobalUNOConstant( "ThisExcelDoc", aModel );
- }
-+#if 0
-+ // see if we have the XCB stream
-+ SvStorageStreamRef xXCB = xRootStrg->OpenSotStream( String( RTL_CONSTASCII_USTRINGPARAM( "XCB" ) ), STREAM_STD_READ | STREAM_NOCREATE );
-+ if ( xXCB.Is()|| SVSTREAM_OK == xXCB->GetError() )
-+ {
-+ CTBWrapper wrapper;
-+ if ( wrapper.Read( xXCB ) )
-+ {
-+#if DEBUG
-+ wrapper.Print( stderr );
-+#endif
-+ wrapper.ImportCustomToolBar( *pShell );
-+ }
-+ }
-+#endif
-
- }
- }
-diff --git sc/source/filter/excel/makefile.mk sc/source/filter/excel/makefile.mk
-index 6ecc0ef..385b552 100644
---- sc/source/filter/excel/makefile.mk
-+++ sc/source/filter/excel/makefile.mk
-@@ -106,7 +106,8 @@ SLOFILES = \
- $(SLO)$/xlstyle.obj \
- $(SLO)$/xltools.obj \
- $(SLO)$/xltracer.obj \
-- $(SLO)$/xlview.obj
-+ $(SLO)$/xlview.obj \
-+ $(SLO)$/xltoolbar.obj \
-
- .IF "$(OS)$(COM)$(CPUNAME)"=="LINUXGCCSPARC"
- NOOPTFILES = \
-@@ -153,7 +154,8 @@ EXCEPTIONSFILES = \
- $(SLO)$/xlformula.obj \
- $(SLO)$/xlpivot.obj \
- $(SLO)$/xlstyle.obj \
-- $(SLO)$/xlview.obj
-+ $(SLO)$/xlview.obj \
-+ $(SLO)$/xltoolbar.obj \
-
- # --- Targets -------------------------------------------------------
-
-diff --git sc/source/filter/excel/xltoolbar.cxx sc/source/filter/excel/xltoolbar.cxx
-new file mode 100644
-index 0000000..6591539
---- /dev/null
-+++ sc/source/filter/excel/xltoolbar.cxx
-@@ -0,0 +1,365 @@
-+#include "xltoolbar.hxx"
-+#include <rtl/ustrbuf.hxx>
-+#include <stdarg.h>
-+#include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
-+#include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
-+#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
-+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-+#include <com/sun/star/lang/XSingleComponentFactory.hpp>
-+#include <com/sun/star/lang/XMultiComponentFactory.hpp>
-+#include <com/sun/star/ui/XImageManager.hpp>
-+#include <com/sun/star/ui/ItemType.hpp>
-+#include <fstream>
-+#include <comphelper/processfactory.hxx>
-+#include <vcl/graph.hxx>
-+#include <map>
-+using namespace com::sun::star;
-+
-+typedef std::map< sal_Int16, rtl::OUString > IdToString;
-+
-+class MSOExcelCommandConvertor : public MSOCommandConvertor
-+{
-+ IdToString msoToOOcmd;
-+ IdToString tcidToOOcmd;
-+public:
-+ MSOExcelCommandConvertor();
-+ virtual rtl::OUString MSOCommandToOOCommand( sal_Int16 msoCmd );
-+ virtual rtl::OUString MSOTCIDToOOCommand( sal_Int16 key );
-+};
-+
-+MSOExcelCommandConvertor::MSOExcelCommandConvertor()
-+{
-+/*
-+ // mso command id to ooo command string
-+ // #FIXME and *HUNDREDS* of id's to added here
-+ msoToOOcmd[ 0x20b ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".uno:CloseDoc") );
-+ msoToOOcmd[ 0x50 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".uno:Open") );
-+
-+ // mso tcid to ooo command string
-+ // #FIXME and *HUNDREDS* of id's to added here
-+ tcidToOOcmd[ 0x9d9 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".uno:Print") );
-+*/
-+}
-+
-+rtl::OUString MSOExcelCommandConvertor::MSOCommandToOOCommand( sal_Int16 key )
-+{
-+ rtl::OUString sResult;
-+ IdToString::iterator it = msoToOOcmd.find( key );
-+ if ( it != msoToOOcmd.end() )
-+ sResult = it->second;
-+ return sResult;
-+}
-+
-+rtl::OUString MSOExcelCommandConvertor::MSOTCIDToOOCommand( sal_Int16 key )
-+{
-+ rtl::OUString sResult;
-+ IdToString::iterator it = tcidToOOcmd.find( key );
-+ if ( it != tcidToOOcmd.end() )
-+ sResult = it->second;
-+ return sResult;
-+}
-+
-+
-+
-+CTBS::CTBS() : bSignature(0), bVersion(0), reserved1(0), reserved2(0), reserved3(0), ctb(0), ctbViews(0), ictbView(0)
-+{
-+}
-+
-+CTB::CTB() : nViews( 0 ), ectbid(0)
-+{
-+}
-+
-+CTB::CTB(sal_uInt16 nNum ) : nViews( nNum ), ectbid(0)
-+{
-+}
-+
-+bool CTB::Read( SvStream *pS )
-+{
-+ OSL_TRACE("CTB::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ tb.Read( pS );
-+ for ( sal_uInt16 index = 0; index < nViews; ++index )
-+ {
-+ TBVisualData aVisData;
-+ aVisData.Read( pS );
-+ rVisualData.push_back( aVisData );
-+ }
-+ *pS >> ectbid;
-+
-+ for ( sal_Int16 index = 0; index < tb.getcCL(); ++index )
-+ {
-+ TBC aTBC;
-+ aTBC.Read( pS );
-+ rTBC.push_back( aTBC );
-+ }
-+ return true;
-+}
-+
-+void CTB::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf( fp, "[ 0x%x ] CTB -- dump\n", nOffSet );
-+ indent_printf( fp, " nViews 0x%x\n", nViews);
-+ tb.Print( fp );
-+
-+ std::vector<TBVisualData>::iterator visData_end = rVisualData.end();
-+ sal_Int32 counter = 0;
-+ for ( std::vector<TBVisualData>::iterator it = rVisualData.begin(); it != visData_end; ++it )
-+ {
-+
-+ indent_printf( fp, " TBVisualData [%d]\n", counter++ );
-+ Indent b;
-+ it->Print( fp );
-+ }
-+ indent_printf( fp, " ectbid 0x%x\n", ectbid);
-+ std::vector<TBC>::iterator it_end = rTBC.end();
-+ counter = 0;
-+ for ( std::vector<TBC>::iterator it = rTBC.begin(); it != it_end; ++it )
-+ {
-+ indent_printf( fp, " TBC [%d]\n", counter++);
-+ Indent c;
-+ it->Print( fp );
-+ }
-+}
-+
-+bool CTB::ImportCustomToolBar( CustomToolBarImportHelper& helper )
-+{
-+ static rtl::OUString sToolbarPrefix( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/custom_" ) );
-+ bool bRes = false;
-+ try
-+ {
-+ // #Fixme same issue here as in word, some deleted data
-+ // seems to still exist
-+ if ( !tb.IsEnabled() )
-+ return true; // didn't fail, just ignoring
-+ // Create default setting
-+ uno::Reference< container::XIndexContainer > xIndexContainer( helper.getCfgManager()->createSettings(), uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xIndexAccess( xIndexContainer, uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xProps( xIndexContainer, uno::UNO_QUERY_THROW );
-+ WString& name = tb.getName();
-+ // set UI name for toolbar
-+ xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UIName") ), uno::makeAny( name.getString() ) );
-+
-+ rtl::OUString sToolBarName = sToolbarPrefix.concat( name.getString() );
-+ for ( std::vector< TBC >::iterator it = rTBC.begin(); it != rTBC.end(); ++it )
-+ {
-+ // createToolBar item for control
-+ if ( !it->ImportToolBarControl( xIndexContainer, helper ) )
-+ return false;
-+ }
-+
-+ OSL_TRACE("Name of toolbar :-/ %s", rtl::OUStringToOString( sToolBarName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+
-+ helper.getCfgManager()->insertSettings( sToolBarName, xIndexAccess );
-+ helper.applyIcons();
-+
-+ uno::Reference< ui::XUIConfigurationPersistence > xPersistence( helper.getCfgManager()->getImageManager(), uno::UNO_QUERY_THROW );
-+ xPersistence->store();
-+
-+ xPersistence.set( helper.getCfgManager(), uno::UNO_QUERY_THROW );
-+ xPersistence->store();
-+
-+ bRes = true;
-+ }
-+ catch( uno::Exception& )
-+ {
-+ bRes = false;
-+ }
-+ return bRes;
-+}
-+bool CTBS::Read( SvStream *pS )
-+{
-+ OSL_TRACE("CTBS::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> bSignature >> bVersion >> reserved1 >> reserved2 >> reserved3 >> ctb >> ctbViews >> ictbView;
-+ return true;
-+}
-+
-+void CTBS::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf( fp, "[ 0x%x ] CTBS -- dump\n", nOffSet );
-+
-+ indent_printf( fp, " bSignature 0x%x\n", bSignature);
-+ indent_printf( fp, " bVersion 0x%x\n", bVersion);
-+
-+ indent_printf( fp, " reserved1 0x%x\n", reserved1 );
-+ indent_printf( fp, " reserved2 0x%x\n", reserved2 );
-+ indent_printf( fp, " reserved3 0x%x\n", reserved3 );
-+
-+ indent_printf( fp, " ctb 0x%x\n", ctb );
-+ indent_printf( fp, " ctbViews 0x%x\n", ctbViews );
-+ indent_printf( fp, " ictbView 0x%x\n", ictbView );
-+}
-+
-+TBC::TBC()
-+{
-+}
-+
-+bool
-+TBC::Read(SvStream *pS)
-+{
-+ OSL_TRACE("TBC::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ if ( !tbch.Read( pS ) )
-+ return false;
-+ sal_uInt16 tcid = tbch.getTcID();
-+ sal_uInt8 tct = tbch.getTct();
-+ if ( ( tcid != 0x0001 && tcid != 0x06CC && tcid != 0x03D8 && tcid != 0x03EC && tcid != 0x1051 ) && ( ( tct > 0 && tct < 0x0B ) || ( ( tct > 0x0B && tct < 0x10 ) || tct == 0x15 ) ) )
-+ {
-+ tbcCmd.reset( new TBCCmd );
-+ if ( ! tbcCmd->Read( pS ) )
-+ return false;
-+ }
-+ if ( tct != 0x16 )
-+ {
-+ tbcd.reset( new TBCData( tbch ) );
-+ if ( !tbcd->Read( pS ) )
-+ return false;
-+ }
-+ return true;
-+}
-+
-+
-+void
-+TBC::Print(FILE* fp)
-+{
-+ Indent a;
-+ indent_printf( fp, "[ 0x%x ] TBC -- dump\n", nOffSet );
-+ tbch.Print( fp );
-+ if ( tbcCmd.get() )
-+ tbcCmd->Print( fp );
-+ if ( tbcd.get() )
-+ tbcd->Print( fp );
-+}
-+
-+bool TBC::ImportToolBarControl( const css::uno::Reference< css::container::XIndexContainer >& toolbarcontainer, CustomToolBarImportHelper& helper )
-+{
-+ // how to identify built-in-command ?
-+// bool bBuiltin = false;
-+ if ( tbcd.get() )
-+ {
-+ std::vector< css::beans::PropertyValue > props;
-+/*
-+ if ( bBuiltin )
-+ {
-+ rtl::OUString sCommand = helper.MSOCommandToOOCommand( cmdId );
-+ if ( sCommand.getLength() > 0 )
-+ {
-+ beans::PropertyValue aProp;
-+
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CommandURL") );
-+ aProp.Value <<= sCommand;
-+ props.push_back( aProp );
-+ }
-+
-+ }
-+*/
-+ bool bBeginGroup = false;
-+ if ( ! tbcd->ImportToolBarControl( toolbarcontainer, helper, props, bBeginGroup ) )
-+ return false;
-+
-+ if ( bBeginGroup )
-+ {
-+ // insert spacer
-+ uno::Sequence< beans::PropertyValue > sProps( 1 );
-+ sProps[ 0 ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Type") );
-+ sProps[ 0 ].Value = uno::makeAny( ui::ItemType::SEPARATOR_LINE );
-+ toolbarcontainer->insertByIndex( toolbarcontainer->getCount(), uno::makeAny( sProps ) );
-+ }
-+ uno::Sequence< beans::PropertyValue > sProps( props.size() );
-+ beans::PropertyValue* pProp = sProps.getArray();
-+
-+ for ( std::vector< css::beans::PropertyValue >::iterator it = props.begin(); it != props.end(); ++it, ++pProp )
-+ *pProp = *it;
-+
-+ toolbarcontainer->insertByIndex( toolbarcontainer->getCount(), uno::makeAny( sProps ) );
-+ }
-+ return true;
-+}
-+
-+void
-+TBCCmd::Print(FILE* fp)
-+{
-+ Indent a;
-+ indent_printf( fp, " TBCCmd -- dump\n" );
-+ indent_printf( fp, " cmdID 0x%x\n", cmdID );
-+ indent_printf( fp, " A ( fHideDrawing ) %s\n", A ? "true" : "false" );
-+ indent_printf( fp, " B ( reserved - ignored ) %s\n", A ? "true" : "false" );
-+ indent_printf( fp, " cmdType 0x%x\n", cmdType );
-+ indent_printf( fp, " C ( reserved - ignored ) %s\n", A ? "true" : "false" );
-+ indent_printf( fp, " reserved3 0x%x\n", reserved3 );
-+}
-+
-+bool TBCCmd::Read( SvStream *pS )
-+{
-+ OSL_TRACE("TBCCmd::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> cmdID;
-+ sal_uInt16 temp;
-+ *pS >> temp;
-+ OSL_TRACE("TBCmd temp = 0x%x", temp );
-+ A = (temp & 0x8000 ) == 0x8000;
-+ B = (temp & 0x4000) == 0x4000;
-+ cmdType = ( temp & 0x3E00 ) >> 9;
-+ C = ( temp & 0x100 ) == 0x100;
-+ reserved3 = ( temp & 0xFF );
-+ return true;
-+}
-+
-+CTBWrapper::CTBWrapper()
-+{
-+}
-+
-+CTBWrapper::~CTBWrapper()
-+{
-+}
-+
-+bool
-+CTBWrapper::Read( SvStream *pS)
-+{
-+ OSL_TRACE("CTBWrapper::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ if ( !ctbSet.Read( pS ) )
-+ return false;
-+ for ( sal_uInt16 index = 0; index < ctbSet.ctb; ++index )
-+ {
-+ CTB aCTB( ctbSet.ctbViews );
-+ if ( !aCTB.Read( pS ) )
-+ return false;
-+ rCTB.push_back( aCTB );
-+ }
-+ return true;
-+}
-+
-+void
-+CTBWrapper::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf( fp, "[ 0x%x ] CTBWrapper -- dump\n", nOffSet );
-+ ctbSet.Print( fp );
-+ std::vector<CTB>::iterator it_end = rCTB.end();
-+ for ( std::vector<CTB>::iterator it = rCTB.begin(); it != it_end; ++it )
-+ {
-+ Indent b;
-+ it->Print( fp );
-+ }
-+}
-+
-+bool CTBWrapper::ImportCustomToolBar( SfxObjectShell& rDocSh )
-+{
-+ std::vector<CTB>::iterator it_end = rCTB.end();
-+ for ( std::vector<CTB>::iterator it = rCTB.begin(); it != it_end; ++it )
-+ {
-+ // for each customtoolbar
-+ uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+ uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xAppCfgSupp( xMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.ModuleUIConfigurationManagerSupplier" ) ) ), uno::UNO_QUERY_THROW );
-+ CustomToolBarImportHelper helper( rDocSh, xAppCfgSupp->getUIConfigurationManager( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.SpreadsheetDocument" ) ) ) );
-+ helper.setMSOCommandMap( new MSOExcelCommandConvertor() );
-+ if ( !(*it).ImportCustomToolBar( helper ) )
-+ return false;
-+ }
-+ return true;
-+}
-+
-+
-diff --git sc/source/filter/excel/xltoolbar.hxx sc/source/filter/excel/xltoolbar.hxx
-new file mode 100644
-index 0000000..af986c7
---- /dev/null
-+++ sc/source/filter/excel/xltoolbar.hxx
-@@ -0,0 +1,87 @@
-+#ifndef _XLTOOLBAR_HXX
-+#define _XLTOOLBAR_HXX
-+
-+#include <svx/mstoolbar.hxx>
-+
-+namespace css = ::com::sun::star;
-+
-+// hmm I don't normally use these packed structures
-+// but.. hey always good to do something different
-+class TBCCmd : public TBBase
-+{
-+public:
-+ TBCCmd() : cmdID(0), A(0), B(0), cmdType(0), C(0), reserved3(0) {}
-+ sal_uInt16 cmdID;
-+ sal_uInt16 A:1;
-+ sal_uInt16 B:1;
-+ sal_uInt16 cmdType:5;
-+ sal_uInt16 C:1;
-+ sal_uInt16 reserved3:8;
-+ bool Read( SvStream* pS );
-+ void Print(FILE* fp);
-+};
-+
-+class TBC : public TBBase
-+{
-+ TBCHeader tbch;
-+ boost::shared_ptr<TBCCmd> tbcCmd; // optional
-+ boost::shared_ptr<TBCData> tbcd;
-+public:
-+ TBC();
-+ ~TBC(){}
-+ void Print( FILE* );
-+ bool Read(SvStream *pS);
-+ bool ImportToolBarControl( const com::sun::star::uno::Reference< com::sun::star::container::XIndexContainer >& toolbarcontainer, CustomToolBarImportHelper& helper );
-+};
-+
-+class CTB : public TBBase
-+{
-+ sal_uInt16 nViews;
-+ TB tb;
-+ std::vector<TBVisualData> rVisualData;
-+ sal_uInt32 ectbid;
-+ std::vector< TBC > rTBC;
-+public:
-+ CTB();
-+ CTB(sal_uInt16);
-+ ~CTB(){}
-+ void Print( FILE* );
-+ bool Read(SvStream *pS);
-+ bool ImportCustomToolBar( CustomToolBarImportHelper& );
-+};
-+
-+class CTBS : public TBBase
-+{
-+public:
-+ sal_uInt8 bSignature;
-+ sal_uInt8 bVersion;
-+ sal_uInt16 reserved1;
-+ sal_uInt16 reserved2;
-+ sal_uInt16 reserved3;
-+ sal_uInt16 ctb;
-+ sal_uInt16 ctbViews;
-+ sal_uInt16 ictbView;
-+ CTBS(const CTBS&);
-+ CTBS& operator = ( const CTBS&);
-+ CTBS();
-+ ~CTBS(){}
-+ void Print( FILE* );
-+ bool Read(SvStream *pS);
-+};
-+
-+class CTBWrapper : public TBBase
-+{
-+ CTBS ctbSet;
-+
-+ std::vector< CTB > rCTB;
-+
-+public:
-+ CTBWrapper();
-+ ~CTBWrapper();
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+ bool ImportCustomToolBar( SfxObjectShell& rDocSh );
-+};
-+
-+
-+#endif //_XLTOOLBAR_HXX
-diff --git svx/inc/svx/mstoolbar.hxx svx/inc/svx/mstoolbar.hxx
-index 5d76eaf..c102ade 100644
---- svx/inc/svx/mstoolbar.hxx
-+++ svx/inc/svx/mstoolbar.hxx
-@@ -250,6 +250,7 @@ public:
- sal_uInt8 getTct() const { return tct; }
- sal_uInt16 getTcID() const { return tcid; }
- bool isVisible() { return !( bFlagsTCR & 0x1 ); }
-+ bool isBeginGroup() { return ( bFlagsTCR & 0x2 ); }
- bool Read(SvStream *pS);
- void Print( FILE* );
- sal_uInt32 getTbct() { return tbct; };
-@@ -267,8 +268,57 @@ public:
- ~TBCData(){}
- bool Read(SvStream *pS);
- void Print( FILE* );
-- bool ImportToolBarControl( const css::uno::Reference< css::container::XIndexContainer >&, CustomToolBarImportHelper&, std::vector< css::beans::PropertyValue >& );
-+ bool ImportToolBarControl( const css::uno::Reference< css::container::XIndexContainer >&, CustomToolBarImportHelper&, std::vector< css::beans::PropertyValue >&, bool& bBeginGroup );
- TBCGeneralInfo& getGeneralInfo() { return controlGeneralInfo; }
- };
-
-+class SVX_DLLPUBLIC TB : public TBBase
-+{
-+ sal_uInt8 bSignature;// Signed integer that specifies the toolbar signature number. MUST be 0x02.
-+ sal_uInt8 bVersion; // Signed integer that specifies the toolbar version number. MUST be 0x01.
-+ sal_Int16 cCL; // Signed integer that SHOULD specify the number of toolbar controls contained in this toolbar.
-+ sal_Int32 ltbid;// Signed integer that specifies the toolbar ID. MUST be 0x0001 (custom toolbar ID).
-+ sal_uInt32 ltbtr;// Unsigned integer of type TBTRFlags that specifies the toolbar type and toolbar restrictions.
-+ sal_uInt16 cRowsDefault;// Unsigned integer that specifies the number of preferred rows for the toolbar when the toolbar is not docked. MUST be less than or equal to 255.
-+ sal_uInt16 bFlags; //Unsigned integer of type TBFlags.
-+ WString name; //Structure of type WString that specifies the toolbar name
-+public:
-+ TB();
-+ ~TB(){}
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+ sal_Int16 getcCL(){ return cCL; }
-+ WString& getName(){ return name; }
-+ bool IsEnabled();
-+ bool NeedsPositioning();
-+};
-+
-+class SVX_DLLPUBLIC SRECT : public TBBase
-+{
-+public:
-+ SRECT() : left(0), top(0), right(0), bottom(0) {}
-+ sal_Int16 left;
-+ sal_Int16 top;
-+ sal_Int16 right;
-+ sal_Int16 bottom;
-+ bool Read( SvStream* pS ) { *pS >> left >> top >> right >> bottom; return true; }
-+ void Print( FILE* fo );
-+};
-+
-+class SVX_DLLPUBLIC TBVisualData : public TBBase
-+{
-+ sal_Int8 tbds;
-+ sal_Int8 tbv;
-+ sal_Int8 tbdsDock;
-+ sal_Int8 iRow;
-+
-+ SRECT rcDock;
-+ SRECT rcFloat;
-+
-+public:
-+ TBVisualData();
-+ ~TBVisualData(){}
-+ bool Read(SvStream *pS);
-+ void Print( FILE* );
-+};
- #endif
-diff --git svx/source/msfilter/mstoolbar.cxx svx/source/msfilter/mstoolbar.cxx
-index fa66fe5..1d5c801 100644
---- svx/source/msfilter/mstoolbar.cxx
-+++ svx/source/msfilter/mstoolbar.cxx
-@@ -25,7 +25,7 @@ void CustomToolBarImportHelper::applyIcons()
- commands[ 0 ] = it->sCommand;
- uno::Sequence< uno::Reference< graphic::XGraphic > > images(1);
- images[ 0 ] = it->image;
--
-+ OSL_TRACE("About to applyIcons for command %s, have image ? %s", rtl::OUStringToOString( commands[ 0 ], RTL_TEXTENCODING_UTF8 ).getStr(), images[ 0 ].is() ? "yes" : "no" );
- uno::Reference< ui::XImageManager > xImageManager( getCfgManager()->getImageManager(), uno::UNO_QUERY_THROW );
- // 1 seems to work best for MSO images, otherwise they don't get displayed ( I guess the default size
- // in ooo is different )
-@@ -144,7 +144,7 @@ void TBCHeader::Print( FILE* fp )
- {
- Indent a;
- indent_printf(fp,"[ 0x%x ] TBCHeader -- dump\n", nOffSet );
-- indent_printf(fp," bSignature 0x%xn", bSignature );
-+ indent_printf(fp," bSignature 0x%x\n", bSignature );
- indent_printf(fp," bVersion 0x%x\n", bVersion );
- indent_printf(fp," bFlagsTCR 0x%x\n", bFlagsTCR );
- indent_printf(fp," tct 0x%x\n", tct );
-@@ -192,14 +192,13 @@ bool TBCData::Read(SvStream *pS)
- }
- if ( controlSpecificInfo.get() )
- return controlSpecificInfo->Read( pS );
-+ //#FIXME I need to be able to handle different controlSpecificInfo types.
- return true;
--
-- OSL_TRACE("#FIXME I need to be able to handle different controlSpecificInfo types.");
-- return false;
- }
-
--bool TBCData::ImportToolBarControl( const css::uno::Reference< css::container::XIndexContainer >& /*toolbarcontainer*/, CustomToolBarImportHelper& helper, std::vector< css::beans::PropertyValue >& props )
-+bool TBCData::ImportToolBarControl( const css::uno::Reference< css::container::XIndexContainer >& /*toolbarcontainer*/, CustomToolBarImportHelper& helper, std::vector< css::beans::PropertyValue >& props, bool& bBeginGroup )
- {
-+ bBeginGroup = rHeader.isBeginGroup();
- controlGeneralInfo.ImportToolBarControlData( helper, props );
- beans::PropertyValue aProp;
- aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Visible") ) ;
-@@ -222,16 +221,19 @@ bool TBCData::ImportToolBarControl( const css::uno::Reference< css::container::X
- }
- if ( TBCBitMap* pIcon = pSpecificInfo->getIcon() )
- {
--
-- BitmapEx aBitEx( pIcon->getBitMap() );
-- if ( pSpecificInfo->getIconMask() )
-- // according to the spec:
-- // "the iconMask is white in all the areas in which the icon is
-- // displayed as transparent and is black in all other areas."
-- aBitEx = BitmapEx( aBitEx.GetBitmap(), pSpecificInfo->getIconMask()->getBitMap().CreateMask( Color( COL_WHITE ) ) );
--
-- Graphic aGraphic( aBitEx );
-- helper.addIcon( aGraphic.GetXGraphic(), sCommand );
-+ // Without a command openoffice won't display the icon
-+ if ( sCommand.getLength() )
-+ {
-+ BitmapEx aBitEx( pIcon->getBitMap() );
-+ if ( pSpecificInfo->getIconMask() )
-+ // according to the spec:
-+ // "the iconMask is white in all the areas in which the icon is
-+ // displayed as transparent and is black in all other areas."
-+ aBitEx = BitmapEx( aBitEx.GetBitmap(), pSpecificInfo->getIconMask()->getBitMap().CreateMask( Color( COL_WHITE ) ) );
-+
-+ Graphic aGraphic( aBitEx );
-+ helper.addIcon( aGraphic.GetXGraphic(), sCommand );
-+ }
- }
- else if ( pSpecificInfo->getBtnFace() )
- {
-@@ -373,6 +375,8 @@ TBCGeneralInfo::ImportToolBarControlData( CustomToolBarImportHelper& helper, std
- ooo::vba::VBAMacroResolvedInfo aMacroInf = ooo::vba::resolveVBAMacro( &helper.GetDocShell(), extraInfo.getOnAction(), true );
- if ( aMacroInf.IsResolved() )
- aProp.Value = helper.createCommandFromMacro( aMacroInf.ResolvedMacro() );
-+ else
-+ aProp.Value <<= rtl::OUString::createFromAscii("UnResolvedMacro[").concat( extraInfo.getOnAction() ).concat( rtl::OUString::createFromAscii("]") );
- sControlData.push_back( aProp );
- }
-
-@@ -384,7 +388,7 @@ TBCGeneralInfo::ImportToolBarControlData( CustomToolBarImportHelper& helper, std
- aProp.Value = uno::makeAny( ui::ItemType::DEFAULT );
- sControlData.push_back( aProp );
-
-- aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HelpURL") );
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Tooltip") );
- aProp.Value = uno::makeAny( tooltip.getString() );
- sControlData.push_back( aProp );
-
-@@ -429,7 +433,7 @@ TBCMenuSpecific::Print( FILE* fp )
- indent_printf( fp, "[ 0x%x ] TBCMenuSpecific -- dump\n", nOffSet );
- indent_printf( fp, " tbid 0x%x\n", static_cast< unsigned int >( tbid ) );
- if ( tbid == 1 )
-- indent_printf( fp, " name %s", rtl::OUStringToOString( name->getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ indent_printf( fp, " name %s\n", rtl::OUStringToOString( name->getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-
- }
-
-@@ -611,3 +615,83 @@ void TBCBitMap::Print( FILE* fp )
- indent_printf(fp, "[ 0x%x ] TBCBitMap -- dump\n", nOffSet );
- indent_printf(fp, " TBCBitMap size of bitmap data 0x%x\n", static_cast< unsigned int > ( cbDIB ) );
- }
-+
-+TB::TB() : bSignature(0x2),
-+bVersion(0x1),
-+cCL(0),
-+ltbid( 0x1 ),
-+ltbtr(0),
-+cRowsDefault( 0 ),
-+bFlags( 0 )
-+{
-+}
-+
-+bool TB::Read(SvStream *pS)
-+{
-+ OSL_TRACE("TB::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> bSignature >> bVersion >> cCL >> ltbid >> ltbtr >> cRowsDefault >> bFlags;
-+ name.Read( pS );
-+ return true;
-+
-+}
-+
-+bool TB::IsEnabled()
-+{
-+ return ( bFlags & 0x01 ) != 0x01;
-+}
-+
-+bool TB::NeedsPositioning()
-+{
-+ return ( bFlags & 0x10 ) == 0x10;
-+}
-+
-+void TB::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf(fp,"[ 0x%x ] TB -- dump\n", nOffSet );
-+ indent_printf(fp," bSignature 0x%x\n", bSignature );
-+ indent_printf(fp," bVersion 0x%x\n", bVersion );
-+ indent_printf(fp," cCL 0x%x\n", cCL );
-+ indent_printf(fp," ltbid 0x%x\n", ltbid );
-+ indent_printf(fp," ltbtr 0x%x\n", ltbtr );
-+ indent_printf(fp," cRowsDefault 0x%x\n", cRowsDefault );
-+ indent_printf(fp," bFlags 0x%x\n", bFlags );
-+ indent_printf(fp, " name %s\n", rtl::OUStringToOString( name.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+}
-+
-+TBVisualData::TBVisualData() : tbds(0), tbv(0), tbdsDock(0), iRow(0)
-+{
-+}
-+
-+bool TBVisualData::Read( SvStream* pS )
-+{
-+ OSL_TRACE("TBVisualData::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> tbds >> tbv >> tbdsDock >> iRow;
-+ rcDock.Read( pS );
-+ rcFloat.Read( pS );
-+ return true;
-+}
-+
-+void SRECT::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf( fp, " left 0x%x\n", left);
-+ indent_printf( fp, " top 0x%x\n", top);
-+ indent_printf( fp, " right 0x%x\n", right);
-+ indent_printf( fp, " bottom 0x%x\n", bottom);
-+}
-+
-+void TBVisualData::Print( FILE* fp )
-+{
-+ Indent a;
-+ indent_printf( fp, "[ 0x%x ] TBVisualData -- dump\n", nOffSet );
-+ indent_printf( fp, " tbds 0x%x\n", tbds);
-+ indent_printf( fp, " tbv 0x%x\n", tbv);
-+ indent_printf( fp, " tbdsDoc 0x%x\n", tbdsDock);
-+ indent_printf( fp, " iRow 0x%x\n", iRow);
-+ rcDock.Print( fp );
-+ rcFloat.Print( fp );
-+}
-+
-diff --git sw/source/filter/ww8/ww8par.cxx sw/source/filter/ww8/ww8par.cxx
-index 21a8014..a8a1348 100644
---- sw/source/filter/ww8/ww8par.cxx
-+++ sw/source/filter/ww8/ww8par.cxx
-@@ -3890,7 +3890,7 @@ bool WW8Customizations::Import( SwDocShell* pShell )
- if (!aTCG.Read( mpTableStream ) )
- OSL_TRACE("** Read of Customization data failed!!!! ");
- mpTableStream->Seek( nCur ); // return to previous position, is that necessary?
--#if 1
-+#if DEBUG
- aTCG.Print( stderr );
- #endif
- return aTCG.ImportCustomToolBar( *pShell );
-diff --git sw/source/filter/ww8/ww8toolbar.cxx sw/source/filter/ww8/ww8toolbar.cxx
-index bb3fc2e..22581ea 100644
---- sw/source/filter/ww8/ww8toolbar.cxx
-+++ sw/source/filter/ww8/ww8toolbar.cxx
-@@ -482,36 +482,49 @@ CTB::Print( FILE* fp )
- bool CTB::ImportCustomToolBar( CustomToolBarImportHelper& helper )
- {
- static rtl::OUString sToolbarPrefix( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/custom_" ) );
-- if ( !tb.IsEnabled() )
-- return true; // didn't fail, just ignoring
-- // Create default setting
-- uno::Reference< container::XIndexContainer > xIndexContainer( helper.getCfgManager()->createSettings(), uno::UNO_QUERY_THROW );
-- uno::Reference< container::XIndexAccess > xIndexAccess( xIndexContainer, uno::UNO_QUERY_THROW );
-- uno::Reference< beans::XPropertySet > xProps( xIndexContainer, uno::UNO_QUERY_THROW );
--
-- // set UI name for toolbar
-- xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UIName") ), uno::makeAny( name.getString() ) );
--
-- rtl::OUString sToolBarName = sToolbarPrefix.concat( name.getString() );
-- for ( std::vector< TBC >::iterator it = rTBC.begin(); it != rTBC.end(); ++it )
-+ bool bRes = false;
-+ try
- {
-- // createToolBar item for control
-- if ( !it->ImportToolBarControl( xIndexContainer, helper ) )
-- return false;
-- }
--
-- OSL_TRACE("Name of toolbar :-/ %s", rtl::OUStringToOString( sToolBarName, RTL_TEXTENCODING_UTF8 ).getStr() );
--
-- helper.getCfgManager()->insertSettings( sToolBarName, xIndexAccess );
-- helper.applyIcons();
--
-- uno::Reference< ui::XUIConfigurationPersistence > xPersistence( helper.getCfgManager()->getImageManager(), uno::UNO_QUERY_THROW );
-- xPersistence->store();
--
-- xPersistence.set( helper.getCfgManager(), uno::UNO_QUERY_THROW );
-- xPersistence->store();
-+ // #FIXME this is a bogus check ( but is seems to work )
-+ // the fNeedsPositioning seems always to be set for toolbars that
-+ // have been deleted ( sofar I fail to find something else to indicate
-+ // not to read them ) - e.g. We can have CTB records which relate to
-+ // deleted items ( usually associated with popups )
-+ if ( !tb.IsEnabled() || tb.NeedsPositioning() )
-+ return true; // didn't fail, just ignoring
-+ // Create default setting
-+ uno::Reference< container::XIndexContainer > xIndexContainer( helper.getCfgManager()->createSettings(), uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xIndexAccess( xIndexContainer, uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xProps( xIndexContainer, uno::UNO_QUERY_THROW );
-+
-+ // set UI name for toolbar
-+ xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UIName") ), uno::makeAny( name.getString() ) );
-
-- return true;
-+ rtl::OUString sToolBarName = sToolbarPrefix.concat( name.getString() );
-+ for ( std::vector< TBC >::iterator it = rTBC.begin(); it != rTBC.end(); ++it )
-+ {
-+ // createToolBar item for control
-+ if ( !it->ImportToolBarControl( xIndexContainer, helper ) )
-+ return false;
-+ }
-+
-+ OSL_TRACE("Name of toolbar :-/ %s", rtl::OUStringToOString( sToolBarName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+
-+ helper.getCfgManager()->insertSettings( sToolBarName, xIndexAccess );
-+ helper.applyIcons();
-+
-+ uno::Reference< ui::XUIConfigurationPersistence > xPersistence( helper.getCfgManager()->getImageManager(), uno::UNO_QUERY_THROW );
-+ xPersistence->store();
-+
-+ xPersistence.set( helper.getCfgManager(), uno::UNO_QUERY_THROW );
-+ xPersistence->store();
-+ bRes = true;
-+ }
-+ catch( uno::Exception& )
-+ {
-+ bRes = false;
-+ }
-+ return bRes;
- }
-
- bool CTB::ImportMenu( const css::uno::Reference< css::container::XIndexContainer >& xIndexContainer, CustomToolBarImportHelper& rHelper )
-@@ -525,38 +538,6 @@ bool CTB::ImportMenu( const css::uno::Reference< css::container::XIndexContainer
- return true;
- }
-
--TB::TB() : bSignature( 0 )
--,bVersion( 0 )
--,cCL( 0 )
--,ltbid( 0 )
--,ltbtr( 0 )
--,cRowsDefault( 0 )
--,bFlags( 0 )
--{
--}
--
--bool TB::Read( SvStream* pS )
--{
-- OSL_TRACE("TB::Read() stream pos 0x%x", pS->Tell() );
-- nOffSet = pS->Tell();
-- *pS >> bSignature >> bVersion >> cCL >> ltbid >> ltbtr >> cRowsDefault >> bFlags;
-- return name.Read( pS );
--}
--
--bool TB::IsEnabled()
--{
-- return ( bFlags & 0x10 ) != 0x10;
--}
--
--void TB::Print( FILE* fp )
--{
-- Indent a;
-- indent_printf( fp, "[ 0x%x ] TB -- dump\n", nOffSet );
-- indent_printf( fp, " bSignature (0x%x), bVersion(0x%x), cCL(0x%x), ltbid(0x%x), cRowsDefault (0x%x), ltbtr(0x%x), bFlags(0x%x)\n", bSignature, bVersion, cCL, static_cast< unsigned int >( ltbid ), static_cast< unsigned int >( ltbtr ), cRowsDefault, bFlags );
-- indent_printf( fp, " name %s state - %s\n", rtl::OUStringToOString( name.getString(), RTL_TEXTENCODING_UTF8 ).getStr(), IsEnabled() ? "true" : "false" );
--
--}
--
- TBC::TBC()
- {
- }
-@@ -655,10 +636,19 @@ TBC::ImportToolBarControl( const css::uno::Reference< css::container::XIndexCont
- }
-
- }
-- if ( ! tbcd->ImportToolBarControl( toolbarcontainer, helper, props ) )
-+ bool bBeginGroup = false;
-+ if ( ! tbcd->ImportToolBarControl( toolbarcontainer, helper, props, bBeginGroup ) )
- return false;
-
--
-+ if ( bBeginGroup )
-+ {
-+ // insert spacer
-+ uno::Sequence< beans::PropertyValue > sProps( 1 );
-+ sProps[ 0 ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Type") );
-+ sProps[ 0 ].Value = uno::makeAny( ui::ItemType::SEPARATOR_LINE );
-+ toolbarcontainer->insertByIndex( toolbarcontainer->getCount(), uno::makeAny( sProps ) );
-+ }
-+
- uno::Sequence< beans::PropertyValue > sProps( props.size() );
- beans::PropertyValue* pProp = sProps.getArray();
-
-diff --git sw/source/filter/ww8/ww8toolbar.hxx sw/source/filter/ww8/ww8toolbar.hxx
-index ae23835..b533cbf 100644
---- sw/source/filter/ww8/ww8toolbar.hxx
-+++ sw/source/filter/ww8/ww8toolbar.hxx
-@@ -29,26 +29,6 @@ public:
- rtl::OUString GetCustomText();
- };
-
--class TB : public TBBase
--{
-- sal_Int8 bSignature; //Signed integer that specifies the toolbar signature number. MUST be 0x02.
-- sal_Int8 bVersion; //Signed integer that specifies the toolbar version number. MUST be 0x01.
-- sal_Int16 cCL; //Signed integer that SHOULD specify the number of toolbar controls contained in this toolbar.
-- sal_Int32 ltbid; //Signed integer that specifies the toolbar ID. MUST be 0x0001 (custom toolbar ID).
-- sal_uInt32 ltbtr; //Unsigned integer of type TBTRFlags that specifies the toolbar type and toolbar restrictions.
-- sal_uInt16 cRowsDefault; //Unsigned integer that specifies the number of preferred rows for the toolbar when the toolbar is not docked. MUST be less than or equal to 255.
-- sal_uInt16 bFlags; //Unsigned integer of type TBFlags.
-- WString name; //Structure of type WString that specifies the toolbar name.
-- TB(const TB&);
-- TB& operator = ( const TB&);
--public:
-- TB();
-- ~TB(){}
-- bool Read(SvStream *pS);
-- void Print( FILE* );
-- bool IsEnabled();
--};
--
- class CTB : public TBBase
- {
- Xst name;
diff --git a/patches/vba/uno-xmenu-getpopupMenu-fix.diff b/patches/vba/uno-xmenu-getpopupMenu-fix.diff
deleted file mode 100644
index fe6180f1a..000000000
--- a/patches/vba/uno-xmenu-getpopupMenu-fix.diff
+++ /dev/null
@@ -1,48 +0,0 @@
-diff --git toolkit/inc/toolkit/awt/vclxmenu.hxx toolkit/inc/toolkit/awt/vclxmenu.hxx
-index 2f2d6c6..84ca639 100644
---- toolkit/inc/toolkit/awt/vclxmenu.hxx
-+++ toolkit/inc/toolkit/awt/vclxmenu.hxx
-@@ -48,6 +48,7 @@
- class Menu;
- class MenuBar;
- class VclSimpleEvent;
-+class PopupMenu;
-
- DECLARE_LIST( PopupMenuRefList, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >* )
-
-@@ -184,6 +185,7 @@ class TOOLKIT_DLLPUBLIC VCLXPopupMenu : public VCLXMenu
- {
- public:
- VCLXPopupMenu();
-+ VCLXPopupMenu( PopupMenu* pPopMenu );
- };
-
- #endif // _TOOLKIT_AWT_VCLXMENU_HXX_
-diff --git toolkit/source/awt/vclxmenu.cxx toolkit/source/awt/vclxmenu.cxx
-index 192beab..7bbfa60 100644
---- toolkit/source/awt/vclxmenu.cxx
-+++ toolkit/source/awt/vclxmenu.cxx
-@@ -529,6 +529,14 @@ void VCLXMenu::setPopupMenu( sal_Int16 nItemId, const ::com::sun::star::uno::Ref
- break;
- }
- }
-+ // it seems the popup menu is not insert into maPopupMenueRefs
-+ // if the popup men is not created by stardiv.Toolkit.VCLXPopupMenu
-+ if( !aRef.is() )
-+ {
-+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > * pNewRef = new ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > ;
-+ *pNewRef = new VCLXPopupMenu( (PopupMenu*)pMenu );
-+ aRef = *pNewRef;
-+ }
- }
- return aRef;
- }
-@@ -1057,3 +1065,8 @@ VCLXPopupMenu::VCLXPopupMenu()
- DBG_CTOR( VCLXPopupMenu, 0 );
- ImplCreateMenu( TRUE );
- }
-+
-+VCLXPopupMenu::VCLXPopupMenu( PopupMenu* pPopMenu ) : VCLXMenu( (Menu *)pPopMenu )
-+{
-+ DBG_CTOR( VCLXPopupMenu, 0 );
-+}
diff --git a/patches/vba/userform-image-import-fix.diff b/patches/vba/userform-image-import-fix.diff
deleted file mode 100644
index 9ffdacfb2..000000000
--- a/patches/vba/userform-image-import-fix.diff
+++ /dev/null
@@ -1,48 +0,0 @@
-diff --git svx/source/msfilter/msocximex.cxx svx/source/msfilter/msocximex.cxx
-index 164073d..b4a46ce 100644
---- svx/source/msfilter/msocximex.cxx
-+++ svx/source/msfilter/msocximex.cxx
-@@ -4449,32 +4449,31 @@ sal_Bool OCX_UserForm::Read(SvStorageStream *pS)
- pS->Read(pIcon,nIconLen);
- }
-
-+ ReadAlign( pS, pS->Tell() - nStart, 4);
-+ if (pBlockFlags[2] & 0x10)
-+ {
-+ //Font Stuff..
-+ pS->SeekRel(0x1a);
-+ sal_uInt8 nFontLen;
-+ *pS >> nFontLen;
-+ pS->SeekRel(nFontLen);
-+ }
- if (nPicture)
- {
- pS->Read(pPictureHeader,20);
- *pS >> nPictureLen;
- long imagePos = pS->Tell();
-+ // great embedded object
- mxGrfObj = lcl_readGraphicObject( pS );
- if( mxGrfObj.is() )
- {
- sImageUrl = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( GRAPHOBJ_URLPREFIX ) );
- sImageUrl = sImageUrl + mxGrfObj->getUniqueID();
- }
-- // make sure the stream position should be pointing after the image
-+ // make sure the stream position should be pointing after the image.
- pS->Seek( imagePos + nPictureLen );
- }
-
-- ReadAlign( pS, pS->Tell() - nStart, 4);
--
-- if (pBlockFlags[2] & 0x10)
-- {
-- //Font Stuff..
-- pS->SeekRel(0x1a);
-- sal_uInt8 nFontLen;
-- *pS >> nFontLen;
-- pS->SeekRel(nFontLen);
-- }
--
- sal_Int16 numTrailingRecs = 0;
- *pS >> numTrailingRecs;
- // seems to be no. of trailing records,
diff --git a/patches/vba/vba-allow-arrays-in-usertypes.diff b/patches/vba/vba-allow-arrays-in-usertypes.diff
deleted file mode 100644
index 209dc3c7a..000000000
--- a/patches/vba/vba-allow-arrays-in-usertypes.diff
+++ /dev/null
@@ -1,112 +0,0 @@
-diff --git basic/source/classes/sb.cxx basic/source/classes/sb.cxx
-index 6cce61d..7a66707 100644
---- basic/source/classes/sb.cxx
-+++ basic/source/classes/sb.cxx
-@@ -340,6 +340,32 @@ SbxObject* SbTypeFactory::cloneTypeObjectImpl( const SbxObject& rTypeObj )
- if( pProp )
- {
- SbxProperty* pNewProp = new SbxProperty( *pProp );
-+ if( pVar->GetType() & SbxARRAY )
-+ {
-+ SbxBase* pParObj = pVar->GetObject();
-+ SbxDimArray* pSource = PTR_CAST(SbxDimArray,pParObj);
-+ SbxDimArray* pDest = new SbxDimArray( pVar->GetType() );
-+ INT32 lb = 0;
-+ INT32 ub = 0;
-+
-+ pDest->setHasFixedSize( pSource->hasFixedSize() );
-+ if ( pSource->GetDims() && pSource->hasFixedSize() )
-+ {
-+ for ( INT32 i=1; i <= pSource->GetDims(); ++i )
-+ {
-+ pSource->GetDim32( (INT32)i, lb, ub );
-+ pDest->AddDim32( lb, ub );
-+ }
-+ }
-+ else
-+ pDest->unoAddDim( 0, -1 ); // variant array
-+ USHORT nSavFlags = pVar->GetFlags();
-+ pNewProp->ResetFlag( SBX_FIXED );
-+ // need to reset the FIXED flag
-+ // when calling PutObject ( because the type will not match Object )
-+ pNewProp->PutObject( pDest );
-+ pNewProp->SetFlags( nSavFlags );
-+ }
- pProps->PutDirect( pNewProp, i );
- }
- }
-diff --git basic/source/comp/dim.cxx basic/source/comp/dim.cxx
-index 3e46579..b37ff96 100644
---- basic/source/comp/dim.cxx
-+++ basic/source/comp/dim.cxx
-@@ -579,13 +579,6 @@ void SbiParser::DefType( BOOL bPrivate )
- pElem = VarDecl(&pDim,FALSE,FALSE);
- if( !pElem )
- bDone = TRUE; // Error occured
-- if( pDim )
-- {
-- // HOT FIX, to be updated
-- delete pDim;
-- Error( SbERR_NO_STRINGS_ARRAYS );
-- }
--
- }
- if( pElem )
- {
-@@ -595,6 +588,44 @@ void SbiParser::DefType( BOOL bPrivate )
- else
- {
- SbxProperty *pTypeElem = new SbxProperty (pElem->GetName(),pElem->GetType());
-+ if( pDim )
-+ {
-+ SbxDimArray* pArray = new SbxDimArray( pElem->GetType() );
-+ if ( pDim->GetSize() )
-+ {
-+ // Dimension the target array
-+
-+ for ( int i=0; i<pDim->GetSize();++i )
-+ {
-+
-+ INT32 ub = -1;
-+ INT32 lb = nBase;
-+ SbiExprNode* pNode = pDim->Get(i)->GetExprNode();
-+ ub = pNode->GetNumber();
-+ if ( !pDim->Get( i )->IsBased() ) // each dim is low/up
-+ {
-+ if ( ++i >= pDim->GetSize() ) // trouble
-+ StarBASIC::FatalError( SbERR_INTERNAL_ERROR );
-+ pNode = pDim->Get(i)->GetExprNode();
-+ lb = ub;
-+ ub = pNode->GetNumber();
-+ }
-+ else if ( !bCompatible )
-+ ub += nBase;
-+ pArray->AddDim32( lb, ub );
-+ }
-+ pArray->setHasFixedSize( true );
-+ }
-+ else
-+ pArray->unoAddDim( 0, -1 ); // variant array
-+ USHORT nSavFlags = pTypeElem->GetFlags();
-+ // need to reset the FIXED flag
-+ // when calling PutObject ( because the type will not match Object )
-+ pTypeElem->ResetFlag( SBX_FIXED );
-+ pTypeElem->PutObject( pArray );
-+ pTypeElem->SetFlags( nSavFlags );
-+ }
-+ delete pDim;
- pTypeMembers->Insert( pTypeElem, pTypeMembers->Count() );
- }
- delete pElem;
-diff --git basic/source/inc/expr.hxx basic/source/inc/expr.hxx
-index d31e741..c87b2e5 100644
---- basic/source/inc/expr.hxx
-+++ basic/source/inc/expr.hxx
-@@ -144,6 +144,7 @@ public:
- SbiExprNode* GetRealNode(); // letzter Knoten in x.y.z
- short GetDepth(); // Tiefe eines Baumes berechnen
- const String& GetString() { return aStrVal; }
-+ short GetNumber() { return (short)nVal; }
- SbiExprList* GetParameters() { return aVar.pPar; }
- SbiExprListVector* GetMoreParameters() { return aVar.pvMorePar; }
-
diff --git a/patches/vba/vba-allow-forms-resetvalue-binding.diff b/patches/vba/vba-allow-forms-resetvalue-binding.diff
deleted file mode 100644
index b9dd5eae5..000000000
--- a/patches/vba/vba-allow-forms-resetvalue-binding.diff
+++ /dev/null
@@ -1,15 +0,0 @@
-diff --git forms/source/component/FormComponent.cxx forms/source/component/FormComponent.cxx
-index 2919abd..2b73ec6 100644
---- forms/source/component/FormComponent.cxx
-+++ forms/source/component/FormComponent.cxx
-@@ -2556,8 +2556,8 @@ void SAL_CALL OBoundControlModel::setVal
- OSL_PRECOND( m_bSupportsExternalBinding, "OBoundControlModel::setValueBinding: How did you reach this method?" );
- // the interface for this method should not have been exposed if we do not
- // support binding to external data
--
-- if ( !impl_approveValueBinding_nolock( _rxBinding ) )
-+ // allow reset
-+ if ( _rxBinding.is() && !impl_approveValueBinding_nolock( _rxBinding ) )
- {
- throw IncompatibleTypesException(
- FRM_RES_STRING( RID_STR_INCOMPATIBLE_TYPES ),
diff --git a/patches/vba/vba-allow-ranges-for-cell-functions.diff b/patches/vba/vba-allow-ranges-for-cell-functions.diff
deleted file mode 100644
index 39424f182..000000000
--- a/patches/vba/vba-allow-ranges-for-cell-functions.diff
+++ /dev/null
@@ -1,223 +0,0 @@
---- sc/source/core/tool/interpr4.cxx.old 2009-04-06 16:41:48.000000000 +0000
-+++ sc/source/core/tool/interpr4.cxx 2009-04-06 16:41:58.000000000 +0000
-@@ -36,10 +36,12 @@
- #include <sfx2/app.hxx>
- #include <sfx2/docfile.hxx>
- #include <sfx2/objsh.hxx>
-+#include <sfx2/docfilt.hxx>
- #include <basic/sbmeth.hxx>
- #include <basic/sbmod.hxx>
- #include <basic/sbstar.hxx>
- #include <basic/sbx.hxx>
-+#include <basic/sbuno.hxx>
- #include <svtools/zforlist.hxx>
- #include <tools/urlobj.hxx>
- #include <rtl/logfile.hxx>
-@@ -48,6 +50,7 @@
- #include <signal.h>
-
- #include <com/sun/star/table/XCellRange.hpp>
-+#include <comphelper/processfactory.hxx>
-
- #include "interpre.hxx"
- #include "global.hxx"
-@@ -2503,7 +2506,38 @@ void ScInterpreter::ScMissing()
- PushTempToken( new FormulaMissingToken );
- }
-
--
-+bool
-+lcl_setVBARange( ScRange& aRange, ScDocument* pDok, SbxVariable* pPar )
-+{
-+ bool bOk = false;
-+ try
-+ {
-+ uno::Reference< uno::XInterface > xVBARange;
-+ uno::Reference< lang::XMultiComponentFactory > xSMgr( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xProps( xSMgr, uno::UNO_QUERY_THROW );
-+ uno::Reference< uno::XComponentContext > xCtx( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
-+ uno::Reference<table::XCellRange> xCellRange = ScCellRangeObj::CreateRangeFromDoc( pDok, aRange );
-+ // hmm probably better not to have to include the vba generated headers
-+ // here, but... if they ever become always available certainly the
-+ // line below is more coder friendly
-+ //xRange = ooo::vba::excel::Range::createRangeFromXCellRange( xCtx , uno::Reference< ooo::vba::XHelperInterface >(), xCellRange );
-+ uno::Sequence< uno::Any > aArgs(2);
-+ aArgs[0] = uno::Any( uno::Reference< uno::XInterface >() ); // dummy parent
-+ aArgs[1] = uno::Any( xCellRange );
-+ xVBARange = xSMgr->createInstanceWithArgumentsAndContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Range") ), aArgs, xCtx );
-+ if ( xVBARange.is() )
-+ {
-+ String sDummy(RTL_CONSTASCII_USTRINGPARAM("A-Range") );
-+ SbxObjectRef aObj = GetSbUnoObject( sDummy, uno::Any( xVBARange ) );
-+ SetSbUnoObjectDfltPropName( aObj );
-+ bOk = pPar->PutObject( aObj );
-+ }
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+ return bOk;
-+}
- void ScInterpreter::ScMacro()
- {
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScMacro" );
-@@ -2542,6 +2576,7 @@ void ScInterpreter::ScMacro()
-
- SbMethod* pMethod = (SbMethod*)pVar;
- SbModule* pModule = pMethod->GetModule();
-+ bool bUseVBAObjects = pModule->IsVBACompat();
- SbxObject* pObject = pModule->GetParent();
- DBG_ASSERT(pObject->IsA(TYPE(StarBASIC)), "Kein Basic gefunden!");
- String aMacroStr = pObject->GetName();
-@@ -2551,7 +2586,13 @@ void ScInterpreter::ScMacro()
- aMacroStr += pMethod->GetName();
- String aBasicStr;
- if (pObject->GetParent())
-+ {
- aBasicStr = pObject->GetParent()->GetName(); // Dokumentenbasic
-+ const SfxFilter* pFilter = NULL;
-+ SfxMedium* pMedium = pDok->GetDocumentShell()->GetMedium();
-+ if ( pMedium )
-+ pFilter = pMedium->GetFilter();
-+ }
- else
- aBasicStr = SFX_APP()->GetName(); // Applikationsbasic
-
-@@ -2575,7 +2616,13 @@ void ScInterpreter::ScMacro()
- {
- ScAddress aAdr;
- PopSingleRef( aAdr );
-- bOk = SetSbxVariable( pPar, aAdr );
-+ if ( bUseVBAObjects )
-+ {
-+ ScRange aRange( aAdr );
-+ bOk = lcl_setVBARange( aRange, pDok, pPar );
-+ }
-+ else
-+ bOk = SetSbxVariable( pPar, aAdr );
- }
- break;
- case svDoubleRef:
-@@ -2594,24 +2641,32 @@ void ScInterpreter::ScMacro()
- }
- else
- {
-- SbxDimArrayRef refArray = new SbxDimArray;
-- refArray->AddDim32( 1, nRow2 - nRow1 + 1 );
-- refArray->AddDim32( 1, nCol2 - nCol1 + 1 );
-- ScAddress aAdr( nCol1, nRow1, nTab1 );
-- for( SCROW nRow = nRow1; bOk && nRow <= nRow2; nRow++ )
-- {
-- aAdr.SetRow( nRow );
-- INT32 nIdx[ 2 ];
-- nIdx[ 0 ] = nRow-nRow1+1;
-- for( SCCOL nCol = nCol1; bOk && nCol <= nCol2; nCol++ )
-- {
-- aAdr.SetCol( nCol );
-- nIdx[ 1 ] = nCol-nCol1+1;
-- SbxVariable* p = refArray->Get32( nIdx );
-- bOk = SetSbxVariable( p, aAdr );
-+ if ( bUseVBAObjects )
-+ {
-+ ScRange aRange( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
-+ bOk = lcl_setVBARange( aRange, pDok, pPar );
-+ }
-+ else
-+ {
-+ SbxDimArrayRef refArray = new SbxDimArray;
-+ refArray->AddDim32( 1, nRow2 - nRow1 + 1 );
-+ refArray->AddDim32( 1, nCol2 - nCol1 + 1 );
-+ ScAddress aAdr( nCol1, nRow1, nTab1 );
-+ for( SCROW nRow = nRow1; bOk && nRow <= nRow2; nRow++ )
-+ {
-+ aAdr.SetRow( nRow );
-+ INT32 nIdx[ 2 ];
-+ nIdx[ 0 ] = nRow-nRow1+1;
-+ for( SCCOL nCol = nCol1; bOk && nCol <= nCol2; nCol++ )
-+ {
-+ aAdr.SetCol( nCol );
-+ nIdx[ 1 ] = nCol-nCol1+1;
-+ SbxVariable* p = refArray->Get32( nIdx );
-+ bOk = SetSbxVariable( p, aAdr );
-+ }
- }
-+ pPar->PutObject( refArray );
- }
-- pPar->PutObject( refArray );
- }
- }
- break;
---- basic/inc/basic/sbmod.hxx.old 2009-04-02 10:49:18.000000000 +0000
-+++ basic/inc/basic/sbmod.hxx 2009-04-06 16:41:58.000000000 +0000
-@@ -66,6 +66,7 @@ protected:
- SbiImage* pImage; // das Image
- SbiBreakpoints* pBreaks; // Breakpoints
- SbClassData* pClassData;
-+ bool mbVBACompat;
-
- void StartDefinitions();
- SbMethod* GetMethod( const String&, SbxDataType );
-@@ -126,6 +127,7 @@ public:
- BOOL LoadBinaryData( SvStream& );
- BOOL ExceedsLegacyModuleSize();
- void fixUpMethodStart( bool bCvtToLegacy, SbiImage* pImg = NULL ) const;
-+ bool IsVBACompat() { return mbVBACompat; }
- };
-
- #ifndef __SB_SBMODULEREF_HXX
---- basic/source/classes/sbxmod.cxx.old 2009-04-02 10:49:17.000000000 +0000
-+++ basic/source/classes/sbxmod.cxx 2009-04-06 16:41:58.000000000 +0000
-@@ -92,7 +92,7 @@ SV_IMPL_VARARR(HighlightPortions, Highli
-
- SbModule::SbModule( const String& rName )
- : SbxObject( String( RTL_CONSTASCII_USTRINGPARAM("StarBASICModule") ) ),
-- pImage( NULL ), pBreaks( NULL ), pClassData( NULL )
-+ pImage( NULL ), pBreaks( NULL ), pClassData( NULL ), mbVBACompat( false )
- {
- SetName( rName );
- SetFlag( SBX_EXTSEARCH | SBX_GBLSEARCH );
-@@ -399,8 +399,9 @@ void SbModule::SetSource32( const ::rtl:
- if( eCurTok == OPTION )
- {
- eCurTok = aTok.Next();
-+ mbVBACompat = ( eCurTok == VBASUPPORT ) && ( aTok.Next() == NUMBER ) && ( aTok.GetDbl()== 1 );
- if( eCurTok == COMPATIBLE
-- || ( ( eCurTok == VBASUPPORT ) && ( aTok.Next() == NUMBER ) && ( aTok.GetDbl()== 1 ) ) )
-+ || mbVBACompat )
- aTok.SetCompatible( true );
- }
- }
---- basic/source/classes/sbunoobj.cxx.old 2009-04-02 10:49:17.000000000 +0000
-+++ basic/source/classes/sbunoobj.cxx 2009-04-06 16:41:58.000000000 +0000
-@@ -153,6 +153,21 @@ SbxVariable* getDefaultProp( SbxVariable
- return pDefaultProp;
- }
-
-+void SetSbUnoObjectDfltPropName( SbxObject* pObj )
-+{
-+ SbUnoObject* pUnoObj = PTR_CAST(SbUnoObject,(SbxObject*) pObj);
-+ if ( pUnoObj )
-+ {
-+ String sDfltPropName;
-+
-+ if ( SbUnoObject::getDefaultPropName( pUnoObj, sDfltPropName ) )
-+ {
-+ OSL_TRACE("SetSbUnoObjectDfltPropName setting dflt prop for %s", rtl::OUStringToOString( pObj->GetName(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ pUnoObj->SetDfltProperty( sDfltPropName );
-+ }
-+ }
-+}
-+
- Reference< XComponentContext > getComponentContext_Impl( void )
- {
- static Reference< XComponentContext > xContext;
---- basic/inc/basic/sbuno.hxx.old 2009-04-02 10:49:18.000000000 +0000
-+++ basic/inc/basic/sbuno.hxx 2009-04-06 16:41:58.000000000 +0000
-@@ -41,6 +41,7 @@ SbxObjectRef GetSbUnoObject( const Strin
-
- // Force creation of all properties for debugging
- void createAllObjectProperties( SbxObject* pObj );
-+void SetSbUnoObjectDfltPropName( SbxObject* pObj );
-
- ::com::sun::star::uno::Any sbxToUnoValue( SbxVariable* pVar );
-
diff --git a/patches/vba/vba-always-set-defaultprop.diff b/patches/vba/vba-always-set-defaultprop.diff
deleted file mode 100644
index de5389e0d..000000000
--- a/patches/vba/vba-always-set-defaultprop.diff
+++ /dev/null
@@ -1,15 +0,0 @@
---- basic/source/classes/sbunoobj.cxx 2008-04-30 14:45:37.000000000 +0100
-+++ basic/source/classes/sbunoobj.cxx 2008-05-08 16:10:05.000000000 +0100
-@@ -786,7 +786,11 @@ void unoToSbxValue( SbxVariable* pVar, c
- // SbUnoObject instanzieren
- String aName;
- SbUnoObject* pSbUnoObject = new SbUnoObject( aName, aValue );
-- if ( SbiRuntime::isVBAEnabled() )
-+// If this is called externally e.g. from the scripting
-+// framework then there is no 'active' runtime the default property will not be set up
-+// only a vba object will have XDefaultProp set anyway so... this
-+// test seems a bit of overkill
-+// if ( SbiRuntime::isVBAEnabled() )
- {
- String sDfltPropName;
-
diff --git a/patches/vba/vba-application-quit.diff b/patches/vba/vba-application-quit.diff
deleted file mode 100644
index 118d219b1..000000000
--- a/patches/vba/vba-application-quit.diff
+++ /dev/null
@@ -1,183 +0,0 @@
---- basic/inc/basic/sbstar.hxx
-+++ basic/inc/basic/sbstar.hxx
-@@ -75,6 +75,7 @@ class StarBASIC : public SbxObject
- BOOL bVBAEnabled;
- BasicLibInfo* pLibInfo; // Info block for basic manager
- SbLanguageMode eLanguageMode; // LanguageMode of the basic object
-+ BOOL bQuit;
-
- SbxObjectRef pVBAGlobals;
- SbxObject* getVBAGlobals( );
-@@ -205,6 +206,8 @@ public:
- BOOL IsDocBasic() { return bDocBasic; }
- SbxVariable* VBAFind( const String& rName, SbxClassType t );
- bool GetUNOConstant( const sal_Char* _pAsciiName, ::com::sun::star::uno::Any& aOut );
-+ void QuitAndExitApplication();
-+ BOOL IsQuitApplication() { return bQuit; };
- };
-
- #ifndef __SB_SBSTARBASICREF_HXX
-diff --git basic/source/classes/sb.cxx basic/source/classes/sb.cxx
-index de99045..6b96c4f 100644
---- basic/source/classes/sb.cxx
-+++ basic/source/classes/sb.cxx
-@@ -658,6 +658,7 @@ StarBASIC::StarBASIC( StarBASIC* p, BOOL bIsDocBasic )
- // Suche ueber StarBASIC ist immer global
- SetFlag( SBX_GBLSEARCH );
- pVBAGlobals = NULL;
-+ bQuit = FALSE;
- }
-
- // #51727 SetModified ueberladen, damit der Modified-
-@@ -1013,6 +1014,12 @@ SbxVariable* StarBASIC::FindVarInCurrentScopy
- return pVar;
- }
-
-+void StarBASIC::QuitAndExitApplication()
-+{
-+ Stop();
-+ bQuit = TRUE;
-+}
-+
- void StarBASIC::Stop()
- {
- SbiInstance* p = pINST;
-diff --git basic/source/classes/sbxmod.cxx basic/source/classes/sbxmod.cxx
-index d82b9d0..3646b7c 100644
---- basic/source/classes/sbxmod.cxx
-+++ basic/source/classes/sbxmod.cxx
-@@ -81,6 +81,8 @@
- #include <cppuhelper/implbase1.hxx>
- #include <comphelper/anytostring.hxx>
-
-+#include <com/sun/star/frame/XDesktop.hpp>
-+#include <vcl/svapp.hxx>
- using namespace ::com::sun::star;
-
- TYPEINIT1(SbModule,SbxObject)
-@@ -98,6 +100,36 @@ SV_IMPL_VARARR(SbiBreakpoints,USHORT)
-
- SV_IMPL_VARARR(HighlightPortions, HighlightPortion)
-
-+class AsyncQuitHandler
-+{
-+ AsyncQuitHandler() {}
-+ AsyncQuitHandler( const AsyncQuitHandler&);
-+public:
-+ static AsyncQuitHandler& instance()
-+ {
-+ static AsyncQuitHandler dInst;
-+ return dInst;
-+ }
-+
-+ void QuitApplication()
-+ {
-+ uno::Reference< lang::XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
-+ if ( xFactory.is() )
-+ {
-+ uno::Reference< frame::XDesktop > xDeskTop( xFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop") ) ), uno::UNO_QUERY );
-+ if ( xDeskTop.is() )
-+ xDeskTop->terminate();
-+ }
-+ }
-+ DECL_LINK( OnAsyncQuit, void* );
-+};
-+
-+IMPL_LINK( AsyncQuitHandler, OnAsyncQuit, void*, pNull )
-+{
-+ QuitApplication();
-+ return 0L;
-+}
-+
- bool UnlockControllerHack( StarBASIC* pBasic )
- {
- bool bRes = false;
-@@ -654,6 +686,8 @@ USHORT SbModule::Run( SbMethod* pMeth )
-
- USHORT nRes = 0;
- BOOL bDelInst = BOOL( pINST == NULL );
-+ bool bQuit = false;
-+{
- StarBASICRef xBasic;
- if( bDelInst )
- {
-@@ -821,6 +855,15 @@ USHORT SbModule::Run( SbMethod* pMeth )
- delete pINST;
- pINST = NULL;
- }
-+ if ( pBasic && pBasic->IsDocBasic() && pBasic->IsQuitApplication() && !pINST )
-+ bQuit = true;
-+}
-+ if ( bQuit )
-+ {
-+ //QuitApplicationHack();
-+ Application::PostUserEvent( LINK( &AsyncQuitHandler::instance(), AsyncQuitHandler, OnAsyncQuit ), NULL );
-+
-+ }
- return nRes;
- }
-
-diff --git oovbaapi/ooo/vba/XApplicationBase.idl oovbaapi/ooo/vba/XApplicationBase.idl
-index 38efadd..f6c6bf0 100644
---- oovbaapi/ooo/vba/XApplicationBase.idl
-+++ oovbaapi/ooo/vba/XApplicationBase.idl
-@@ -54,6 +54,8 @@ interface XApplicationBase
- [attribute] boolean DisplayStatusBar;
- [attribute, readonly] string Version;
-
-+ void Quit();
-+
- any CommandBars( [in] any aIndex );
- void Run([in] string MacroName, [in] /*Optional*/ any varg1, [in] /*Optional*/ any varg2, [in] /*Optional*/ any varg3, [in] /*Optional*/ any varg4, [in] /*Optional*/ any varg5, [in] /*Optional*/ any varg6, [in] /*Optional*/ any varg7, [in] /*Optional*/ any varg8, [in] /*Optional*/ any varg9, [in] /*Optional*/ any varg10, [in] /*Optional*/ any varg11, [in] /*Optional*/ any varg12, [in] /*Optional*/ any varg13, [in] /*Optional*/ any varg14, [in] /*Optional*/ any varg15, [in] /*Optional*/ any varg16, [in] /*Optional*/ any varg17, [in] /*Optional*/ any varg18, [in] /*Optional*/ any varg19, [in] /*Optional*/ any varg20, [in] /*Optional*/ any varg21, [in] /*Optional*/ any varg22, [in] /*Optional*/ any varg23, [in] /*Optional*/ any varg24, [in] /*Optional*/ any varg25, [in] /*Optional*/ any varg26, [in] /*Optional*/ any varg27, [in] /*Optional*/ any varg28, [in] /*Optional*/ any varg29, [in] /*Optional*/ any varg30);
- float CentimetersToPoints([in] float Centimeters );
-diff --git vbahelper/inc/vbahelper/vbaapplicationbase.hxx vbahelper/inc/vbahelper/vbaapplicationbase.hxx
-index e100387..eb292f3 100644
---- vbahelper/inc/vbahelper/vbaapplicationbase.hxx
-+++ vbahelper/inc/vbahelper/vbaapplicationbase.hxx
-@@ -56,7 +56,7 @@ public:
- virtual ::rtl::OUString SAL_CALL getVersion() throw (css::uno::RuntimeException);
- virtual void SAL_CALL Run( const ::rtl::OUString& MacroName, const css::uno::Any& varg1, const css::uno::Any& varg2, const css::uno::Any& varg3, const css::uno::Any& varg4, const css::uno::Any& varg5, const css::uno::Any& varg6, const css::uno::Any& varg7, const css::uno::Any& varg8, const css::uno::Any& varg9, const css::uno::Any& varg10, const css::uno::Any& varg11, const css::uno::Any& varg12, const css::uno::Any& varg13, const css::uno::Any& varg14, const css::uno::Any& varg15, const css::uno::Any& varg16, const css::uno::Any& varg17, const css::uno::Any& varg18, const css::uno::Any& varg19, const css::uno::Any& varg20, const css::uno::Any& varg21, const css::uno::Any& varg22, const css::uno::Any& varg23, const css::uno::Any& varg24, const css::uno::Any& varg25, const css::uno::Any& varg26, const css::uno::Any& varg27, const css::uno::Any& varg28, const css::uno::Any& varg29, const css::uno::Any& varg30 ) throw (css::uno::RuntimeException);
- virtual float SAL_CALL CentimetersToPoints( float _Centimeters ) throw (css::uno::RuntimeException);
--
-+ virtual void SAL_CALL Quit( ) throw (::com::sun::star::uno::RuntimeException);
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-diff --git vbahelper/source/vbahelper/vbaapplicationbase.cxx vbahelper/source/vbahelper/vbaapplicationbase.cxx
-index b73013f..73e7db2 100644
---- vbahelper/source/vbahelper/vbaapplicationbase.cxx
-+++ vbahelper/source/vbahelper/vbaapplicationbase.cxx
-@@ -44,6 +44,13 @@
- #include "vbacommandbars.hxx"
- #include <svx/msvbahelper.hxx>
-
-+// start basic includes
-+#include <basic/sbx.hxx>
-+#include <basic/sbstar.hxx>
-+#include <basic/sbuno.hxx>
-+#include <basic/sbmeth.hxx>
-+#include <basic/sbmod.hxx>
-+// end basic includes
- using namespace com::sun::star;
- using namespace ooo::vba;
-
-@@ -194,4 +201,18 @@ VbaApplicationBase::getServiceNames()
- return aServiceNames;
- }
-
--
-+void VbaApplicationBase::Quit() throw (uno::RuntimeException)
-+{
-+ // need to stop basic
-+ SbMethod* pMeth = StarBASIC::GetActiveMethod();
-+ if ( pMeth )
-+ {
-+ SbModule* pMod = dynamic_cast< SbModule* >( pMeth->GetParent() );
-+ if ( pMod )
-+ {
-+ StarBASIC* pBasic = dynamic_cast< StarBASIC* >( pMod->GetParent() );
-+ if ( pBasic )
-+ pBasic->QuitAndExitApplication();
-+ }
-+ }
-+}
diff --git a/patches/vba/vba-autofiltermode.diff b/patches/vba/vba-autofiltermode.diff
deleted file mode 100644
index b71e63864..000000000
--- a/patches/vba/vba-autofiltermode.diff
+++ /dev/null
@@ -1,275 +0,0 @@
-diff --git oovbaapi/ooo/vba/excel/XWorksheet.idl oovbaapi/ooo/vba/excel/XWorksheet.idl
-index 1f07f9f..4e037a5 100644
---- oovbaapi/ooo/vba/excel/XWorksheet.idl
-+++ oovbaapi/ooo/vba/excel/XWorksheet.idl
-@@ -64,6 +64,7 @@ interface XWorksheet
- interface ::com::sun::star::container::XNamed;
-
- [attribute] boolean Visible;
-+ [attribute] boolean AutoFilterMode;
- [attribute, readonly] long StandardHeight;
- [attribute, readonly] long StandardWidth;
- [attribute, readonly] boolean ProtectionMode;
-diff --git sc/source/ui/vba/excelvbahelper.cxx sc/source/ui/vba/excelvbahelper.cxx
-index 49d1e34..9cb844a 100644
---- sc/source/ui/vba/excelvbahelper.cxx
-+++ sc/source/ui/vba/excelvbahelper.cxx
-@@ -44,6 +44,55 @@ namespace vba
- {
- namespace excel
- {
-+
-+
-+uno::Reference< sheet::XDatabaseRanges >
-+GetDataBaseRanges( ScDocShell* pShell ) throw ( uno::RuntimeException )
-+{
-+ uno::Reference< frame::XModel > xModel;
-+ if ( pShell )
-+ xModel.set( pShell->GetModel(), uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xModelProps( xModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< sheet::XDatabaseRanges > xDBRanges( xModelProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DatabaseRanges") ) ), uno::UNO_QUERY_THROW );
-+ return xDBRanges;
-+}
-+
-+// returns the XDatabaseRange for the autofilter on sheet (nSheet)
-+// also populates sName with the name of range
-+uno::Reference< sheet::XDatabaseRange >
-+GetAutoFiltRange( ScDocShell* pShell, sal_Int16 nSheet, rtl::OUString& sName ) throw ( uno::RuntimeException )
-+{
-+ uno::Reference< container::XIndexAccess > xIndexAccess( GetDataBaseRanges( pShell ), uno::UNO_QUERY_THROW );
-+ uno::Reference< sheet::XDatabaseRange > xDataBaseRange;
-+ table::CellRangeAddress dbAddress;
-+ for ( sal_Int32 index=0; index < xIndexAccess->getCount(); ++index )
-+ {
-+ uno::Reference< sheet::XDatabaseRange > xDBRange( xIndexAccess->getByIndex( index ), uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XNamed > xNamed( xDBRange, uno::UNO_QUERY_THROW );
-+ // autofilters work weirdly with openoffice, unnamed is the default
-+ // named range which is used to create an autofilter, but
-+ // its also possible that another name could be used
-+ // this also causes problems when an autofilter is created on
-+ // another sheet
-+ // ( but.. you can use any named range )
-+ dbAddress = xDBRange->getDataArea();
-+ if ( dbAddress.Sheet == nSheet )
-+ {
-+ sal_Bool bHasAuto = sal_False;
-+ uno::Reference< beans::XPropertySet > xProps( xDBRange, uno::UNO_QUERY_THROW );
-+ xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AutoFilter") ) ) >>= bHasAuto;
-+ if ( bHasAuto )
-+ {
-+ sName = xNamed->getName();
-+ xDataBaseRange=xDBRange;
-+ break;
-+ }
-+ }
-+ }
-+ return xDataBaseRange;
-+}
-+
-+
- void implSetZoom( const uno::Reference< frame::XModel >& xModel, sal_Int16 nZoom, std::vector< SCTAB >& nTabs )
- {
- ScTabViewShell* pViewSh = excel::getBestViewShell( xModel );
-@@ -217,6 +266,7 @@ ScVbaCellRangeAccess::GetDataSet( ScCellRangeObj* pRangeObj )
- return pDataSet;
-
- }
-+
- } //excel
- } //vba
- } //ooo
-diff --git sc/source/ui/vba/excelvbahelper.hxx sc/source/ui/vba/excelvbahelper.hxx
-index 9c95501..d97721e 100644
---- sc/source/ui/vba/excelvbahelper.hxx
-+++ sc/source/ui/vba/excelvbahelper.hxx
-@@ -32,6 +32,8 @@
-
- #include<vbahelper/vbahelper.hxx>
- #include <docsh.hxx>
-+#include <com/sun/star/sheet/XDatabaseRanges.hpp>
-+#include <com/sun/star/sheet/XDatabaseRange.hpp>
-
- class ScCellRangeObj;
-
-@@ -51,6 +53,10 @@ namespace ooo
- 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 );
-+
-+ css::uno::Reference< css::sheet::XDatabaseRanges > GetDataBaseRanges( ScDocShell* pShell ) throw ( css::uno::RuntimeException );
-+
-+ css::uno::Reference< css::sheet::XDatabaseRange > GetAutoFiltRange( ScDocShell* pShell, sal_Int16 nSheet, rtl::OUString& sName ) throw ( css::uno::RuntimeException );
- class ScVbaCellRangeAccess
- {
- public:
-diff --git sc/source/ui/vba/vbarange.cxx sc/source/ui/vba/vbarange.cxx
-index 23c9598..4f68d10 100644
---- sc/source/ui/vba/vbarange.cxx
-+++ sc/source/ui/vba/vbarange.cxx
-@@ -3943,56 +3943,12 @@ ScVbaRange::ApplicationRange( const uno::Reference< uno::XComponentContext >& xC
- return pRange->Range( Cell1, Cell2, true );
- }
-
--uno::Reference< sheet::XDatabaseRanges >
--lcl_GetDataBaseRanges( ScDocShell* pShell ) throw ( uno::RuntimeException )
--{
-- uno::Reference< frame::XModel > xModel;
-- if ( pShell )
-- xModel.set( pShell->GetModel(), uno::UNO_QUERY_THROW );
-- uno::Reference< beans::XPropertySet > xModelProps( xModel, uno::UNO_QUERY_THROW );
-- uno::Reference< sheet::XDatabaseRanges > xDBRanges( xModelProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DatabaseRanges") ) ), uno::UNO_QUERY_THROW );
-- return xDBRanges;
--}
--// returns the XDatabaseRange for the autofilter on sheet (nSheet)
--// also populates sName with the name of range
--uno::Reference< sheet::XDatabaseRange >
--lcl_GetAutoFiltRange( ScDocShell* pShell, sal_Int16 nSheet, rtl::OUString& sName )
--{
-- uno::Reference< container::XIndexAccess > xIndexAccess( lcl_GetDataBaseRanges( pShell ), uno::UNO_QUERY_THROW );
-- uno::Reference< sheet::XDatabaseRange > xDataBaseRange;
-- table::CellRangeAddress dbAddress;
-- for ( sal_Int32 index=0; index < xIndexAccess->getCount(); ++index )
-- {
-- uno::Reference< sheet::XDatabaseRange > xDBRange( xIndexAccess->getByIndex( index ), uno::UNO_QUERY_THROW );
-- uno::Reference< container::XNamed > xNamed( xDBRange, uno::UNO_QUERY_THROW );
-- // autofilters work weirdly with openoffice, unnamed is the default
-- // named range which is used to create an autofilter, but
-- // its also possible that another name could be used
-- // this also causes problems when an autofilter is created on
-- // another sheet
-- // ( but.. you can use any named range )
-- dbAddress = xDBRange->getDataArea();
-- if ( dbAddress.Sheet == nSheet )
-- {
-- sal_Bool bHasAuto = sal_False;
-- uno::Reference< beans::XPropertySet > xProps( xDBRange, uno::UNO_QUERY_THROW );
-- xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AutoFilter") ) ) >>= bHasAuto;
-- if ( bHasAuto )
-- {
-- sName = xNamed->getName();
-- xDataBaseRange=xDBRange;
-- break;
-- }
-- }
-- }
-- return xDataBaseRange;
--}
-
- // Helper functions for AutoFilter
- ScDBData* lcl_GetDBData_Impl( ScDocShell* pDocShell, sal_Int16 nSheet )
- {
- rtl::OUString sName;
-- lcl_GetAutoFiltRange( pDocShell, nSheet, sName );
-+ excel::GetAutoFiltRange( pDocShell, nSheet, sName );
- OSL_TRACE("lcl_GetDBData_Impl got autofilter range %s for sheet %d",
- rtl::OUStringToOString( sName, RTL_TEXTENCODING_UTF8 ).getStr() , nSheet );
- ScDBData* pRet = NULL;
-@@ -4159,7 +4115,7 @@ ScVbaRange::AutoFilter( const uno::Any& Field, const uno::Any& Criteria1, const
- ScDocShell* pShell = getScDocShell();
- sal_Bool bHasAuto = sal_False;
- rtl::OUString sAutofiltRangeName;
-- uno::Reference< sheet::XDatabaseRange > xDataBaseRange = lcl_GetAutoFiltRange( pShell, nSheet, sAutofiltRangeName );
-+ uno::Reference< sheet::XDatabaseRange > xDataBaseRange = excel::GetAutoFiltRange( pShell, nSheet, sAutofiltRangeName );
- if ( xDataBaseRange.is() )
- bHasAuto = true;
-
-@@ -4192,7 +4148,7 @@ ScVbaRange::AutoFilter( const uno::Any& Field, const uno::Any& Criteria1, const
- autoFiltAddress = multiCellRange.getCellRangeAddressable()->getRangeAddress();
- }
-
-- uno::Reference< sheet::XDatabaseRanges > xDBRanges = lcl_GetDataBaseRanges( pShell );
-+ uno::Reference< sheet::XDatabaseRanges > xDBRanges = excel::GetDataBaseRanges( pShell );
- if ( xDBRanges.is() )
- {
- rtl::OUString sGenName( RTL_CONSTASCII_USTRINGPARAM("VBA_Autofilter_") );
-diff --git sc/source/ui/vba/vbawindow.cxx sc/source/ui/vba/vbawindow.cxx
-index c05b314..a612f59 100644
---- sc/source/ui/vba/vbawindow.cxx
-+++ sc/source/ui/vba/vbawindow.cxx
-@@ -59,7 +59,7 @@ using namespace ::ooo::vba;
- using namespace ::ooo::vba::excel::XlWindowState;
-
- // nameExists defined in vbaworksheet.cxx
--bool nameExists( uno::Reference <sheet::XSpreadsheetDocument>& xSpreadDoc, ::rtl::OUString & name, SCTAB& nTab ) throw ( lang::IllegalArgumentException );
-+bool nameExists( const uno::Reference <sheet::XSpreadsheetDocument>& xSpreadDoc, const ::rtl::OUString & name, SCTAB& nTab ) throw ( lang::IllegalArgumentException );
-
- typedef std::hash_map< rtl::OUString,
- SCTAB, ::rtl::OUStringHash,
-diff --git sc/source/ui/vba/vbaworksheet.cxx sc/source/ui/vba/vbaworksheet.cxx
-index 015e68f..3a38bd3 100644
---- sc/source/ui/vba/vbaworksheet.cxx
-+++ sc/source/ui/vba/vbaworksheet.cxx
-@@ -99,7 +99,7 @@
- using namespace com::sun::star;
- using namespace ooo::vba;
- bool
--nameExists( uno::Reference <sheet::XSpreadsheetDocument>& xSpreadDoc, ::rtl::OUString & name, SCTAB& nTab ) throw ( lang::IllegalArgumentException )
-+nameExists( const uno::Reference <sheet::XSpreadsheetDocument>& xSpreadDoc, const ::rtl::OUString & name, SCTAB& nTab ) throw ( lang::IllegalArgumentException )
- {
- if (!xSpreadDoc.is())
- throw lang::IllegalArgumentException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nameExists() xSpreadDoc is null" ) ), uno::Reference< uno::XInterface >(), 1 );
-@@ -993,6 +993,50 @@ ScVbaWorksheet::PrintOut( const uno::Any& From, const uno::Any& To, const uno::A
- PrintOutHelper( excel::getBestViewShell( xModel ), From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName, bSelection );
- }
-
-+uno::Reference< sheet::XDatabaseRange > lcl_getXDatabase( const uno::Reference< frame::XModel >& xModel, const rtl::OUString& aSheetName ) throw ( uno::RuntimeException)
-+
-+{
-+ uno::Reference< sheet::XDatabaseRange > xDBRange;
-+ uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( xModel, uno::UNO_QUERY_THROW );
-+ SCTAB nTab(0);
-+ bool bSheetExists = nameExists (xSpreadDoc, aSheetName, nTab);
-+ if ( bSheetExists )
-+ {
-+ rtl::OUString sAutofilterRngName;
-+ ScDocShell* pShell = excel::getDocShell( xModel );
-+
-+ xDBRange = excel::GetAutoFiltRange( pShell, static_cast< sal_Int16 >( nTab ), sAutofilterRngName );
-+
-+ }
-+ return xDBRange;
-+}
-+
-+::sal_Bool SAL_CALL
-+ScVbaWorksheet::getAutoFilterMode() throw (uno::RuntimeException)
-+{
-+ if ( lcl_getXDatabase( getModel(), getName() ).is() )
-+ return sal_True;
-+ return sal_False;
-+}
-+
-+void SAL_CALL
-+ScVbaWorksheet::setAutoFilterMode( ::sal_Bool _autofiltermode ) throw (uno::RuntimeException)
-+{
-+ if ( !_autofiltermode )
-+ {
-+ uno::Reference< sheet::XDatabaseRange >xAutoFilt = lcl_getXDatabase( getModel(), getName() );
-+
-+ if ( xAutoFilt.is() )
-+ {
-+ uno::Reference< beans::XPropertySet > xProps( xAutoFilt, uno::UNO_QUERY_THROW );
-+ xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AutoFilter") ), uno::makeAny( sal_False ) );
-+ }
-+ }
-+ // Not possible to set to true
-+ else
-+ throw uno::RuntimeException();
-+}
-+
- namespace worksheet
- {
- namespace sdecl = comphelper::service_decl;
-diff --git sc/source/ui/vba/vbaworksheet.hxx sc/source/ui/vba/vbaworksheet.hxx
-index cf696a3..3324753 100644
---- sc/source/ui/vba/vbaworksheet.hxx
-+++ sc/source/ui/vba/vbaworksheet.hxx
-@@ -82,6 +82,9 @@ public:
- { return mxSheet; }
-
- // Attributes
-+ virtual ::sal_Bool SAL_CALL getAutoFilterMode() throw (::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL setAutoFilterMode( ::sal_Bool _autofiltermode ) throw (::com::sun::star::uno::RuntimeException);
-+
- virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setName( const ::rtl::OUString &rName ) throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException);
diff --git a/patches/vba/vba-automation-defaultmember.diff b/patches/vba/vba-automation-defaultmember.diff
deleted file mode 100755
index cdbcd1738..000000000
--- a/patches/vba/vba-automation-defaultmember.diff
+++ /dev/null
@@ -1,175 +0,0 @@
-diff --git basic/source/runtime/step2.cxx basic/source/runtime/step2.cxx
-index 558eff7..adde4fa 100644
---- basic/source/runtime/step2.cxx
-+++ basic/source/runtime/step2.cxx
-@@ -264,10 +264,12 @@ SbxVariable* SbiRuntime::FindElement
- if( bSet )
- pElem->SetType( t2 );
- pElem = pNew;
-- }
-+ }
- // Index-Access bei UnoObjekten beruecksichtigen
-- /*
-- else if( pElem->ISA(SbUnoProperty) )
-+ // definitely we want this for VBA where properties are often
-+ // collections ( which need index access ), but lets only do
-+ // this if we actually have params following
-+ else if( bVBAEnabled && pElem->ISA(SbUnoProperty) && pElem->GetParameters() )
- {
- // pElem auf eine Ref zuweisen, um ggf. eine Temp-Var zu loeschen
- SbxVariableRef refTemp = pElem;
-@@ -277,7 +279,6 @@ SbxVariable* SbiRuntime::FindElement
- pElem->SetParameters( NULL ); // sonst bleibt Ref auf sich selbst
- pElem = pNew;
- }
-- */
- }
- return CheckArray( pElem );
- }
-diff --git extensions/source/ole/oleobjw.cxx extensions/source/ole/oleobjw.cxx
-index 7c6d6d6..0e6520d 100644
---- extensions/source/ole/oleobjw.cxx
-+++ extensions/source/ole/oleobjw.cxx
-@@ -72,6 +72,7 @@ using namespace boost;
- using namespace osl;
- using namespace rtl;
- using namespace cppu;
-+using namespace com::sun::star::script;
- using namespace com::sun::star::lang;
- using namespace com::sun::star::bridge;
- using namespace com::sun::star::bridge::oleautomation;
-@@ -111,7 +112,7 @@ IUnknownWrapper_Impl::IUnknownWrapper_Impl( Reference<XMultiServiceFactory>& xFa
- sal_uInt8 unoWrapperClass, sal_uInt8 comWrapperClass):
- UnoConversionUtilities<IUnknownWrapper_Impl>( xFactory, unoWrapperClass, comWrapperClass),
- m_pxIdlClass( NULL), m_eJScript( JScriptUndefined),
-- m_bComTlbIndexInit(false)
-+ m_bComTlbIndexInit(false), m_bHasDfltMethod(false), m_bHasDfltProperty(false)
- {
- }
-
-@@ -150,17 +151,15 @@ IUnknownWrapper_Impl::~IUnknownWrapper_Impl()
- Any IUnknownWrapper_Impl::queryInterface(const Type& t)
- throw (RuntimeException)
- {
-- if (t == getCppuType(static_cast<Reference<XInvocation>*>( 0)))
-- {
-- if (m_spDispatch)
-- return WeakImplHelper4<XInvocation, XBridgeSupplier2,
-- XInitialization, XAutomationObject>::queryInterface(t);
-- else
-- return Any();
-- }
--
-- return WeakImplHelper4<XInvocation, XBridgeSupplier2,
-- XInitialization, XAutomationObject>::queryInterface(t);
-+ if (t == getCppuType(static_cast<Reference<XDefaultMethod>*>( 0)) && !m_bHasDfltMethod )
-+ return Any();
-+ if (t == getCppuType(static_cast<Reference<XDefaultProperty>*>( 0)) && !m_bHasDfltProperty )
-+ return Any();
-+ if (t == getCppuType(static_cast<Reference<XInvocation>*>( 0)) && !m_spDispatch)
-+ return Any();
-+
-+ return WeakImplHelper6<XInvocation, XBridgeSupplier2,
-+ XInitialization, XAutomationObject, XDefaultProperty, XDefaultMethod>::queryInterface(t);
- }
-
- Reference<XIntrospectionAccess> SAL_CALL IUnknownWrapper_Impl::getIntrospection(void)
-@@ -1197,6 +1196,47 @@ void SAL_CALL IUnknownWrapper_Impl::initialize( const Sequence< Any >& aArgument
-
- aArguments[1] >>= m_bOriginalDispatch;
- aArguments[2] >>= m_seqTypes;
-+ try
-+ {
-+ ITypeInfo* pType= getTypeInfo();
-+ // Get Default member
-+ CComBSTR defaultMemberName;
-+ if ( SUCCEEDED( pType->GetDocumentation(0, &defaultMemberName, 0, 0, 0 ) ) )
-+ {
-+ OUString usName(reinterpret_cast<const sal_Unicode*>(LPCOLESTR(defaultMemberName)));
-+ FuncDesc aDescGet(pType);
-+ FuncDesc aDescPut(pType);
-+ VarDesc aVarDesc(pType);
-+ // see if this is a property first ( more likely to be a property then a method )
-+ getPropDesc( usName, & aDescGet, & aDescPut, & aVarDesc);
-+
-+ if ( !aDescGet && !aDescPut )
-+ {
-+ getFuncDesc( usName, &aDescGet );
-+ if ( !aDescGet )
-+ // we're knackered
-+ throw RuntimeException();
-+
-+ }
-+ // now for some funny heuristics to make basic understand what to do
-+ // a single aDescGet ( that doesn't take any params ) would be
-+ // a read only ( defaultmember ) property e.g. this object
-+ // should implement XDefaultProperty
-+ // a single aDescGet ( that *does* ) take params is basically a
-+ // default method e.g. implement XDefaultMethod
-+
-+ // a DescPut ( I guess we only really support a default param with '1' param ) as a setValue ( but I guess we can leave it through, the object will fail if we don't get it right anyway )
-+ if ( aDescPut || ( aDescGet && aDescGet->cParams == 0 ) )
-+ m_bHasDfltProperty = true;
-+ if ( aDescGet->cParams > 0 )
-+ m_bHasDfltMethod = true;
-+ if ( m_bHasDfltProperty || m_bHasDfltMethod )
-+ m_sDefaultMember = usName;
-+ }
-+ }
-+ catch( Exception& )
-+ {
-+ }
- }
-
- // UnoConversionUtilities --------------------------------------------------------------------------------
-diff --git extensions/source/ole/oleobjw.hxx extensions/source/ole/oleobjw.hxx
-index d10c9e7..00b6b6a 100644
---- extensions/source/ole/oleobjw.hxx
-+++ extensions/source/ole/oleobjw.hxx
-@@ -49,11 +49,14 @@
- #pragma warning (pop)
- #include <cppuhelper/implbase3.hxx>
- #include <cppuhelper/implbase4.hxx>
-+#include <cppuhelper/implbase6.hxx>
-
- #include <com/sun/star/lang/XInitialization.hpp>
- #include <com/sun/star/bridge/oleautomation/XAutomationObject.hpp>
- #include <rtl/ustring.hxx>
-
-+#include <com/sun/star/script/XDefaultProperty.hpp>
-+#include <com/sun/star/script/XDefaultMethod.hpp>
-
- #include <typelib/typedescription.hxx>
- #include "unoconversionutilities.hxx"
-@@ -77,7 +80,8 @@ typedef hash_multimap<OUString, unsigned int, hashOUString_Impl, equalOUString_I
- // This class wraps an IDispatch and maps XInvocation calls to IDispatch calls on the wrapped object.
- // If m_TypeDescription is set then this class represents an UNO interface implemented in a COM component.
- // The interface is not a real interface in terms of an abstract class but is realized through IDispatch.
--class IUnknownWrapper_Impl : public WeakImplHelper4<XInvocation, XBridgeSupplier2, XInitialization, XAutomationObject>,
-+class IUnknownWrapper_Impl : public WeakImplHelper6<XInvocation, XBridgeSupplier2, XInitialization, XAutomationObject, XDefaultProperty, XDefaultMethod>,
-+
- public UnoConversionUtilities<IUnknownWrapper_Impl>
-
- {
-@@ -125,8 +129,10 @@ public:
- // XInitialization
- virtual void SAL_CALL initialize( const Sequence< Any >& aArguments )
- throw(Exception, RuntimeException);
-+ virtual ::rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (::com::sun::star::uno::RuntimeException) { return m_sDefaultMember; }
- protected:
--
-+ virtual ::rtl::OUString SAL_CALL getDefaultMethodName( ) throw (::com::sun::star::uno::RuntimeException) { return m_sDefaultMember; }
-+
- // ----------------------------------------------------------------------------
- virtual Any invokeWithDispIdUnoTlb(const OUString& sFunctionName,
- const Sequence< Any >& Params,
-@@ -252,6 +258,9 @@ protected:
- bool m_bComTlbIndexInit;
- // Keeps the ITypeInfo obtained from IDispatch::GetTypeInfo
- CComPtr< ITypeInfo > m_spTypeInfo;
-+ rtl::OUString m_sDefaultMember;
-+ bool m_bHasDfltMethod;
-+ bool m_bHasDfltProperty;
- };
-
- } // end namespace
diff --git a/patches/vba/vba-automation-fix-named-paramaters.diff b/patches/vba/vba-automation-fix-named-paramaters.diff
deleted file mode 100644
index be58d2c92..000000000
--- a/patches/vba/vba-automation-fix-named-paramaters.diff
+++ /dev/null
@@ -1,28 +0,0 @@
-diff --git basic/source/runtime/step2.cxx basic/source/runtime/step2.cxx
-index 7975b65..ec9469f 100644
---- basic/source/runtime/step2.cxx
-+++ basic/source/runtime/step2.cxx
-@@ -381,7 +381,8 @@ void SbiRuntime::SetupArgs( SbxVariable* p, UINT32 nOp1 )
- bool bError_ = true;
-
- SbUnoMethod* pUnoMethod = PTR_CAST(SbUnoMethod,p);
-- if( pUnoMethod )
-+ SbUnoProperty* pUnoProperty = PTR_CAST(SbUnoProperty,p);
-+ if( pUnoMethod || pUnoProperty )
- {
- SbUnoObject* pParentUnoObj = PTR_CAST( SbUnoObject,p->GetParent() );
- if( pParentUnoObj )
-diff --git extensions/source/ole/oleobjw.cxx extensions/source/ole/oleobjw.cxx
-index 32f0ffd..7707ecf 100644
---- extensions/source/ole/oleobjw.cxx
-+++ extensions/source/ole/oleobjw.cxx
-@@ -1531,6 +1531,9 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc,
- arDispidNamedArgs.reset(new DISPID[nSizeAr]);
- HRESULT hr = getTypeInfo()->GetIDsOfNames(arNames, nSizeAr,
- arDispidNamedArgs.get());
-+ if ( hr == E_NOTIMPL )
-+ hr = m_spDispatch->GetIDsOfNames(IID_NULL, arNames, nSizeAr, LOCALE_USER_DEFAULT, arDispidNamedArgs.get() );
-+
- if (hr == S_OK)
- {
- // In a "property put" operation, the property value is a named param with the
diff --git a/patches/vba/vba-automation-put-get-property-improvements.diff b/patches/vba/vba-automation-put-get-property-improvements.diff
deleted file mode 100644
index a17d7d7f8..000000000
--- a/patches/vba/vba-automation-put-get-property-improvements.diff
+++ /dev/null
@@ -1,321 +0,0 @@
-diff --git basic/source/classes/sbunoobj.cxx basic/source/classes/sbunoobj.cxx
-index 09858a6..b1935c3 100644
---- basic/source/classes/sbunoobj.cxx
-+++ basic/source/classes/sbunoobj.cxx
-@@ -63,6 +63,7 @@
- #include <com/sun/star/script/XInvocationAdapterFactory.hpp>
- #include <com/sun/star/script/XTypeConverter.hpp>
- #include <com/sun/star/script/XDefaultProperty.hpp>
-+#include <com/sun/star/script/XDefaultMethod.hpp>
- #include <com/sun/star/container/XNameAccess.hpp>
- #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
- #include <com/sun/star/reflection/XIdlArray.hpp>
-@@ -73,7 +74,7 @@
- #include <com/sun/star/bridge/oleautomation/Date.hpp>
- #include <com/sun/star/bridge/oleautomation/Decimal.hpp>
- #include <com/sun/star/bridge/oleautomation/Currency.hpp>
--
-+#include <com/sun/star/script/XAutomationInvocation.hpp>
-
- using com::sun::star::uno::Reference;
- using namespace com::sun::star::uno;
-@@ -1502,6 +1503,103 @@ Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty
- return aRetVal;
- }
-
-+void processAutomationParams( SbxArray* pParams, Sequence< Any >& args, bool bOLEAutomation, UINT32 nParamCount )
-+{
-+ AutomationNamedArgsSbxArray* pArgNamesArray = NULL;
-+ if( bOLEAutomation )
-+ pArgNamesArray = PTR_CAST(AutomationNamedArgsSbxArray,pParams);
-+
-+ args.realloc( nParamCount );
-+ Any* pAnyArgs = args.getArray();
-+ bool bBlockConversionToSmallestType = pINST->IsCompatibility();
-+ UINT32 i = 0;
-+ if( pArgNamesArray )
-+ {
-+ Sequence< ::rtl::OUString >& rNameSeq = pArgNamesArray->getNames();
-+ ::rtl::OUString* pNames = rNameSeq.getArray();
-+ Any aValAny;
-+ for( i = 0 ; i < nParamCount ; i++ )
-+ {
-+ USHORT iSbx = (USHORT)(i+1);
-+
-+ // ACHTUNG: Bei den Sbx-Parametern den Offset nicht vergessen!
-+ aValAny = sbxToUnoValueImpl( pParams->Get( iSbx ),
-+ bBlockConversionToSmallestType );
-+
-+ ::rtl::OUString aParamName = pNames[iSbx];
-+ if( aParamName.getLength() )
-+ {
-+ oleautomation::NamedArgument aNamedArgument;
-+ aNamedArgument.Name = aParamName;
-+ aNamedArgument.Value = aValAny;
-+ pAnyArgs[i] <<= aNamedArgument;
-+ }
-+ else
-+ {
-+ pAnyArgs[i] = aValAny;
-+ }
-+ }
-+ }
-+ else
-+ {
-+ for( i = 0 ; i < nParamCount ; i++ )
-+ {
-+ // ACHTUNG: Bei den Sbx-Parametern den Offset nicht vergessen!
-+ pAnyArgs[i] = sbxToUnoValueImpl( pParams->Get( (USHORT)(i+1) ),
-+ bBlockConversionToSmallestType );
-+ }
-+ }
-+
-+}
-+enum INVOKETYPE
-+{
-+ GetProp = 0,
-+ SetProp,
-+ Func
-+};
-+Any invokeAutomationMethod( const String& Name, Sequence< Any >& args, SbxArray* pParams, UINT32 nParamCount, Reference< XInvocation >& rxInvocation, INVOKETYPE invokeType = Func )
-+{
-+ Sequence< INT16 > OutParamIndex;
-+ Sequence< Any > OutParam;
-+
-+ Any aRetAny;
-+ switch( invokeType )
-+ {
-+ case Func:
-+ aRetAny = rxInvocation->invoke( Name, args, OutParamIndex, OutParam );
-+ break;
-+ case GetProp:
-+ {
-+ Reference< XAutomationInvocation > xAutoInv( rxInvocation, UNO_QUERY_THROW );
-+ aRetAny = xAutoInv->invokeGetProperty( Name, args, OutParamIndex, OutParam );
-+ break;
-+ }
-+ case SetProp:
-+ {
-+ Reference< XAutomationInvocation > xAutoInv( rxInvocation, UNO_QUERY_THROW );
-+ aRetAny = xAutoInv->invokePutProperty( Name, args, OutParamIndex, OutParam );
-+ break;
-+ }
-+ default:
-+ break; // should introduce an error here
-+
-+ }
-+ const INT16* pIndices = OutParamIndex.getConstArray();
-+ UINT32 nLen = OutParamIndex.getLength();
-+ if( nLen )
-+ {
-+ const Any* pNewValues = OutParam.getConstArray();
-+ for( UINT32 j = 0 ; j < nLen ; j++ )
-+ {
-+ INT16 iTarget = pIndices[ j ];
-+ if( iTarget >= (INT16)nParamCount )
-+ break;
-+ unoToSbxValue( (SbxVariable*)pParams->Get( (USHORT)(j+1) ), pNewValues[ j ] );
-+ }
-+ }
-+ return aRetAny;
-+}
-+
- // Dbg-Hilfsmethode zum Auslesen der in einem Object implementierten Interfaces
- String Impl_GetInterfaceInfo( const Reference< XInterface >& x, const Reference< XIdlClass >& xClass, USHORT nRekLevel )
- {
-@@ -2002,11 +2100,26 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
- {
- try
- {
-- // Wert holen
-- Any aRetAny = mxInvocation->getValue( pProp->GetName() );
-+ UINT32 nParamCount = pParams ? ((UINT32)pParams->Count() - 1) : 0;
-+ sal_Bool bCanBeConsideredAMethod = mxInvocation->hasMethod( pProp->GetName() );
-+ Any aRetAny;
-+ if ( bCanBeConsideredAMethod && nParamCount )
-+ {
-+ // Automation properties have methods, so.. we need to invoke this through
-+ // XInvocation
-+ Sequence<Any> args;
-+ processAutomationParams( pParams, args, true, nParamCount );
-+ aRetAny = invokeAutomationMethod( pProp->GetName(), args, pParams, nParamCount, mxInvocation, GetProp );
-+ }
-+ else
-+ // Wert holen
-+ aRetAny = mxInvocation->getValue( pProp->GetName() );
-
- // Wert von Uno nach Sbx uebernehmen
- unoToSbxValue( pVar, aRetAny );
-+ if( pParams && bCanBeConsideredAMethod )
-+ pVar->SetParameters( NULL );
-+
- }
- catch( const Exception& )
- {
-@@ -2131,52 +2244,7 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
- else if( bInvocation && pParams && mxInvocation.is() )
- {
- bool bOLEAutomation = true;
-- // TODO: bOLEAutomation = xOLEAutomation.is()
--
-- AutomationNamedArgsSbxArray* pArgNamesArray = NULL;
-- if( bOLEAutomation )
-- pArgNamesArray = PTR_CAST(AutomationNamedArgsSbxArray,pParams);
--
-- args.realloc( nParamCount );
-- Any* pAnyArgs = args.getArray();
-- bool bBlockConversionToSmallestType = pINST->IsCompatibility();
-- if( pArgNamesArray )
-- {
-- Sequence< ::rtl::OUString >& rNameSeq = pArgNamesArray->getNames();
-- ::rtl::OUString* pNames = rNameSeq.getArray();
--
-- Any aValAny;
-- for( i = 0 ; i < nParamCount ; i++ )
-- {
-- USHORT iSbx = (USHORT)(i+1);
--
-- // ACHTUNG: Bei den Sbx-Parametern den Offset nicht vergessen!
-- aValAny = sbxToUnoValueImpl( pParams->Get( iSbx ),
-- bBlockConversionToSmallestType );
--
-- ::rtl::OUString aParamName = pNames[iSbx];
-- if( aParamName.getLength() )
-- {
-- oleautomation::NamedArgument aNamedArgument;
-- aNamedArgument.Name = aParamName;
-- aNamedArgument.Value = aValAny;
-- pAnyArgs[i] <<= aNamedArgument;
-- }
-- else
-- {
-- pAnyArgs[i] = aValAny;
-- }
-- }
-- }
-- else
-- {
-- for( i = 0 ; i < nParamCount ; i++ )
-- {
-- // ACHTUNG: Bei den Sbx-Parametern den Offset nicht vergessen!
-- pAnyArgs[i] = sbxToUnoValueImpl( pParams->Get( (USHORT)(i+1) ),
-- bBlockConversionToSmallestType );
-- }
-- }
-+ processAutomationParams( pParams, args, bOLEAutomation, nParamCount );
- }
-
- // Methode callen
-@@ -2211,26 +2279,8 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
- }
- else if( bInvocation && mxInvocation.is() )
- {
-- Sequence< INT16 > OutParamIndex;
-- Sequence< Any > OutParam;
-- Any aRetAny = mxInvocation->invoke( pMeth->GetName(), args, OutParamIndex, OutParam );
--
-- // Wert von Uno nach Sbx uebernehmen
-+ Any aRetAny = invokeAutomationMethod( pMeth->GetName(), args, pParams, nParamCount, mxInvocation );
- unoToSbxValue( pVar, aRetAny );
--
-- const INT16* pIndices = OutParamIndex.getConstArray();
-- UINT32 nLen = OutParamIndex.getLength();
-- if( nLen )
-- {
-- const Any* pNewValues = OutParam.getConstArray();
-- for( UINT32 j = 0 ; j < nLen ; j++ )
-- {
-- INT16 iTarget = pIndices[ j ];
-- if( iTarget >= (INT16)nParamCount )
-- break;
-- unoToSbxValue( (SbxVariable*)pParams->Get( (USHORT)(j+1) ), pNewValues[ j ] );
-- }
-- }
- }
-
- // #55460, Parameter hier weghauen, da das in unoToSbxValue()
-diff --git basic/source/comp/dim.cxx basic/source/comp/dim.cxx
-index b8b6a54..36cca2c 100644
---- basic/source/comp/dim.cxx
-+++ basic/source/comp/dim.cxx
-@@ -406,7 +406,10 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic )
- aExpr.Gen();
- SbiOpcode eOp_ = pDef->IsNew() ? _CREATE : _TCREATE;
- aGen.Gen( eOp_, pDef->GetId(), pDef->GetTypeId() );
-- aGen.Gen( _SET );
-+ if ( bVBASupportOn )
-+ aGen.Gen( _VBASET );
-+ else
-+ aGen.Gen( _SET );
- }
- }
- else
-diff --git udkapi/com/sun/star/script/XAutomationInvocation.idl udkapi/com/sun/star/script/XAutomationInvocation.idl
-new file mode 100644
-index 0000000..9dcf61b
---- /dev/null
-+++ udkapi/com/sun/star/script/XAutomationInvocation.idl
-@@ -0,0 +1,51 @@
-+/*************************************************************************
-+ *
-+ * 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: XInvocation2.idl,v $
-+ * $Revision: 1.10 $
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __com_sun_star_script_XAutomationInvocation_idl__
-+#define __com_sun_star_script_XAutomationInvocation_idl__
-+
-+#ifndef __com_sun_star_script_XInvocation_idl__
-+#include <com/sun/star/script/XInvocation.idl>
-+#endif
-+
-+
-+ module com { module sun { module star { module script {
-+
-+interface XAutomationInvocation: com::sun::star::script::XInvocation
-+{
-+ any invokeGetProperty( [in] string aFunctionName, [in] sequence<any> aParams, [out] sequence<short> aOutParamIndex, [out] sequence<any> aOutParam ) raises( com::sun::star::lang::IllegalArgumentException, com::sun::star::script::CannotConvertException, com::sun::star::reflection::InvocationTargetException );
-+ any invokePutProperty( [in] string aFunctionName, [in] sequence<any> aParams, [out] sequence<short> aOutParamIndex, [out] sequence<any> aOutParam ) raises( com::sun::star::lang::IllegalArgumentException, com::sun::star::script::CannotConvertException, com::sun::star::reflection::InvocationTargetException );
-+
-+};
-+
-+//=============================================================================
-+
-+}; }; }; };
-+
-+#endif
-diff --git udkapi/com/sun/star/script/makefile.mk udkapi/com/sun/star/script/makefile.mk
-index 52a3214..8b8f53a 100644
---- udkapi/com/sun/star/script/makefile.mk
-+++ udkapi/com/sun/star/script/makefile.mk
-@@ -85,6 +85,7 @@ IDLFILES=\
- XScriptEventsAttacher.idl\
- XDefaultMethod.idl\
- XDefaultProperty.idl\
-+ XAutomationInvocation.idl\
- ModuleInfo.idl\
- ModuleType.idl\
- XErrorQuery.idl\
diff --git a/patches/vba/vba-automation-set-fix.diff b/patches/vba/vba-automation-set-fix.diff
deleted file mode 100644
index 6e35a5f69..000000000
--- a/patches/vba/vba-automation-set-fix.diff
+++ /dev/null
@@ -1,85 +0,0 @@
---- basic/source/classes/sbunoobj.cxx 2009-06-23 05:13:01.671875000 +0100
-+++ basic/source/classes/sbunoobj.cxx 2009-07-16 22:12:04.187500000 +0100
-@@ -1616,6 +1616,23 @@ bool checkUnoObjectType( SbUnoObject* pU
- break;
- }
- ::rtl::OUString sClassName = xClass->getName();
-+ if ( sClassName.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.bridge.oleautomation.XAutomationObject" ) ) ) )
-+ {
-+ // there is a hack in the extensions/source/ole/oleobj.cxx to return the typename of the automation object, lets check if it
-+ // matches
-+ Reference< XInvocation > xInv( aToInspectObj, UNO_QUERY );
-+ if ( xInv.is() )
-+ {
-+ rtl::OUString sTypeName;
-+ xInv->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("$GetTypeName") ) ) >>= sTypeName;
-+ if ( sTypeName.getLength() == 0 || sTypeName.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IDispatch") ) ) )
-+ // can't check type, leave it pass
-+ result = true;
-+ else
-+ result = sTypeName.equals( aClass );
-+ }
-+ break; // finished checking automation object
-+ }
- OSL_TRACE("Checking if object implements %s",
- OUStringToOString( defaultNameSpace + aClass,
- RTL_TEXTENCODING_UTF8 ).getStr() );
---- extensions/source/ole/oleobjw.cxx 2008-11-11 10:00:41.000000000 +0000
-+++ extensions/source/ole/oleobjw.cxx 2009-07-16 21:37:49.890625000 +0100
-@@ -425,6 +425,46 @@ Any SAL_CALL IUnknownWrapper_Impl::getVa
- {
- o2u_attachCurrentThread();
- ITypeInfo * pInfo = getTypeInfo();
-+ // I was going to implement an XServiceInfo interface to allow the type
-+ // of the automation object to be exposed.. but it seems
-+ // from looking at comments in the code that it is possible for a
-+ // this object to actually wrap an UNO object ( I guess if automation is
-+ // used from MSO to create Openoffice objects ) Therefore, those objects
-+ // will more than likely already have an XServiceInfo interface.
-+ // Instead here I chose a name that should be illegal both in COM and
-+ // UNO ( from an IDL point of view ) therefore I think this is a safe
-+ // hack
-+ if ( aPropertyName.equals( rtl::OUString::createFromAscii("$GetTypeName") ))
-+ {
-+ if ( pInfo && m_sTypeName.getLength() == 0 )
-+ {
-+ m_sTypeName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IDispatch") );
-+ CComBSTR sName;
-+
-+ if ( SUCCEEDED( pInfo->GetDocumentation( -1, &sName, NULL, NULL, NULL ) ) )
-+ {
-+ rtl::OUString sTmp( reinterpret_cast<const sal_Unicode*>(LPCOLESTR(sName)));
-+ if ( sTmp.indexOf('_') == 0 )
-+ sTmp = sTmp.copy(1);
-+ // do we own the memory for pTypeLib, msdn doco is vague
-+ // I'll assume we do
-+ CComPtr< ITypeLib > pTypeLib;
-+ unsigned int index;
-+ if ( SUCCEEDED( pInfo->GetContainingTypeLib( &pTypeLib.p, &index )) )
-+ {
-+ if ( SUCCEEDED( pTypeLib->GetDocumentation( -1, &sName, NULL, NULL, NULL ) ) )
-+ {
-+ rtl::OUString sLibName( reinterpret_cast<const sal_Unicode*>(LPCOLESTR(sName)));
-+ m_sTypeName = sLibName.concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".") ) ).concat( sTmp );
-+
-+ }
-+ }
-+ }
-+
-+ }
-+ ret <<= m_sTypeName;
-+ return ret;
-+ }
- FuncDesc aDescGet(pInfo);
- FuncDesc aDescPut(pInfo);
- VarDesc aVarDesc(pInfo);
---- extensions/source/ole/oleobjw.hxx 2008-04-11 11:14:30.000000000 +0100
-+++ extensions/source/ole/oleobjw.hxx 2009-07-16 19:46:02.750000000 +0100
-@@ -233,6 +235,7 @@ protected:
- Sequence<Type> m_seqTypes;
- CComPtr<IUnknown> m_spUnknown;
- CComPtr<IDispatch> m_spDispatch;
-+ rtl::OUString m_sTypeName; // is "" ( not initialised ), "IDispatch" ( we have no idea ) or "SomeLibrary.SomeTypeName" if we managed to get a type
- /** This value is set dureing XInitialization::initialize. It indicates that the COM interface
- was transported as VT_DISPATCH in a VARIANT rather then a VT_UNKNOWN
- */
diff --git a/patches/vba/vba-basic-if-compare-fix.diff b/patches/vba/vba-basic-if-compare-fix.diff
deleted file mode 100644
index 830adc1f6..000000000
--- a/patches/vba/vba-basic-if-compare-fix.diff
+++ /dev/null
@@ -1,11 +0,0 @@
---- basic/source/comp/exprtree.cxx.orig 2009-04-02 08:36:25.476773500 -0700
-+++ basic/source/comp/exprtree.cxx 2009-04-02 08:36:49.703573500 -0700
-@@ -702,7 +702,7 @@ SbiExprNode* SbiExpression::Comp()
- nCount++;
- }
- // Mehrere Operatoren hintereinander gehen nicht
-- if( nCount > 1 )
-+ if( nCount > 1 && !pParser->IsVBASupportOn() )
- {
- pParser->Error( SbERR_SYNTAX );
- bError = TRUE;
diff --git a/patches/vba/vba-basic-macrochoose-dialog.diff b/patches/vba/vba-basic-macrochoose-dialog.diff
deleted file mode 100644
index b1a33eb23..000000000
--- a/patches/vba/vba-basic-macrochoose-dialog.diff
+++ /dev/null
@@ -1,831 +0,0 @@
-diff -urp '--exclude=unxlngi6.pro' basctl.bk/inc/basidesh.hrc basctl/inc/basidesh.hrc
---- basctl.bk/inc/basidesh.hrc 2008-10-10 09:48:33.000000000 +0800
-+++ basctl/inc/basidesh.hrc 2008-10-10 09:53:46.000000000 +0800
-@@ -175,6 +175,10 @@
- #define RID_STR_EXPORTPACKAGE ( RID_BASICIDE_START + 100 )
- #define RID_STR_EXPORTBASIC ( RID_BASICIDE_START + 101 )
- #define RID_STR_PACKAGE_BUNDLE ( RID_BASICIDE_START + 102 )
-+#define RID_STR_DOCUMENT_OBJECTS ( RID_BASICIDE_START + 110 )
-+#define RID_STR_USERFORMS ( RID_BASICIDE_START + 111 )
-+#define RID_STR_NORMAL_MODULES ( RID_BASICIDE_START + 112 )
-+#define RID_STR_CLASS_MODULES ( RID_BASICIDE_START + 113 )
-
- #endif // _SVX_NOIDERESIDS
-
-diff -urp '--exclude=unxlngi6.pro' basctl.bk/source/basicide/baside2.cxx basctl/source/basicide/baside2.cxx
---- basctl.bk/source/basicide/baside2.cxx 2008-10-10 09:48:33.000000000 +0800
-+++ basctl/source/basicide/baside2.cxx 2008-10-10 09:53:46.000000000 +0800
-@@ -49,6 +49,7 @@
- #include <com/sun/star/script/XLibraryContainer2.hpp>
- #endif
- #include <com/sun/star/document/MacroExecMode.hpp>
-+#include <com/sun/star/script/ModuleType.hpp>
- #include <toolkit/helper/vclunohelper.hxx>
- #include <sfx2/docfile.hxx>
- #include <basic/basrdll.hxx>
-@@ -110,6 +111,8 @@ DBG_NAME( ModulWindow )
-
- TYPEINIT1( ModulWindow , IDEBaseWindow );
-
-+void lcl_getObjectName( const uno::Reference< container::XNameContainer >& rLib, const String& rModName, String& rObjName );
-+
- void lcl_PrintHeader( Printer* pPrinter, USHORT nPages, USHORT nCurPage, const String& rTitle )
- {
- short nLeftMargin = LMARGPRN;
-@@ -1347,7 +1350,39 @@ BasicEntryDescriptor ModulWindow::Create
- ScriptDocument aDocument( GetDocument() );
- String aLibName( GetLibName() );
- LibraryLocation eLocation = aDocument.getLibraryLocation( aLibName );
-- return BasicEntryDescriptor( aDocument, eLocation, aLibName, GetName(), OBJ_TYPE_MODULE );
-+ String aModName( GetName() );
-+ String aLibSubName;
-+ if( xBasic.Is() && xBasic->isVBAEnabled() && xModule.Is() )
-+ {
-+ switch( xModule->GetModuleType() )
-+ {
-+ case script::ModuleType::Document:
-+ {
-+ aLibSubName = String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) );
-+ uno::Reference< container::XNameContainer > xLib = aDocument.getOrCreateLibrary( E_SCRIPTS, aLibName );
-+ if( xLib.is() )
-+ {
-+ String sObjName;
-+ lcl_getObjectName( xLib, aModName, sObjName );
-+ if( sObjName.Len() )
-+ {
-+ aModName.AppendAscii(" (").Append(sObjName).AppendAscii(")");
-+ }
-+ }
-+ break;
-+ }
-+ case script::ModuleType::Form:
-+ aLibSubName = String( IDEResId( RID_STR_USERFORMS ) );
-+ break;
-+ case script::ModuleType::Normal:
-+ aLibSubName = String( IDEResId( RID_STR_NORMAL_MODULES ) );
-+ break;
-+ case script::ModuleType::Class:
-+ aLibSubName = String( IDEResId( RID_STR_CLASS_MODULES ) );
-+ break;
-+ }
-+ }
-+ return BasicEntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, aModName, OBJ_TYPE_MODULE );
- }
-
- void ModulWindow::SetReadOnly( BOOL b )
-diff -urp '--exclude=unxlngi6.pro' basctl.bk/source/basicide/baside3.cxx basctl/source/basicide/baside3.cxx
---- basctl.bk/source/basicide/baside3.cxx 2008-10-10 09:48:33.000000000 +0800
-+++ basctl/source/basicide/baside3.cxx 2008-10-10 09:53:46.000000000 +0800
-@@ -903,8 +903,9 @@ BasicEntryDescriptor DialogWindow::Creat
- {
- ScriptDocument aDocument( GetDocument() );
- String aLibName( GetLibName() );
-+ String aLibSubName;
- LibraryLocation eLocation = aDocument.getLibraryLocation( aLibName );
-- return BasicEntryDescriptor( aDocument, eLocation, aLibName, GetName(), OBJ_TYPE_DIALOG );
-+ return BasicEntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, GetName(), OBJ_TYPE_DIALOG );
- }
-
- void DialogWindow::SetReadOnly( BOOL b )
-diff -urp '--exclude=unxlngi6.pro' basctl.bk/source/basicide/basidesh.src basctl/source/basicide/basidesh.src
---- basctl.bk/source/basicide/basidesh.src 2008-10-10 09:48:33.000000000 +0800
-+++ basctl/source/basicide/basidesh.src 2008-10-10 09:53:46.000000000 +0800
-@@ -639,6 +639,22 @@ String RID_STR_TRANSLATION_DEFAULT
- {
- Text [ en-US ] = "[Default Language]" ;
- };
-+String RID_STR_DOCUMENT_OBJECTS
-+{
-+ Text [ en-US ] = "Document Objects" ;
-+};
-+String RID_STR_USERFORMS
-+{
-+ Text [ en-US ] = "Forms" ;
-+};
-+String RID_STR_NORMAL_MODULES
-+{
-+ Text [ en-US ] = "Modules" ;
-+};
-+String RID_STR_CLASS_MODULES
-+{
-+ Text [ en-US ] = "Class Modules" ;
-+};
-
- #define MN_EDIT 20
- #define MN_VIEW 21
-diff -urp '--exclude=unxlngi6.pro' basctl.bk/source/basicide/bastype2.cxx basctl/source/basicide/bastype2.cxx
---- basctl.bk/source/basicide/bastype2.cxx 2008-10-10 09:48:34.000000000 +0800
-+++ basctl/source/basicide/bastype2.cxx 2008-10-10 09:53:46.000000000 +0800
-@@ -53,10 +53,25 @@
- #include <com/sun/star/frame/XModuleManager.hpp>
- #include <comphelper/processfactory.hxx>
- #include <comphelper/componentcontext.hxx>
-+#include <map>
-+#include <com/sun/star/script/ModuleType.hpp>
-+#include <com/sun/star/script/ModuleInfo.hpp>
-+#include <com/sun/star/container/XNameContainer.hpp>
-
- using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star;
-
-+void lcl_getObjectName( const uno::Reference< container::XNameContainer >& rLib, const String& rModName, String& rObjName );
-+
-+sal_Int32 lcl_getModuleType( const uno::Reference< container::XNameContainer >& rLib, const String& rModName )
-+{
-+ sal_Int32 nType = com::sun::star::script::ModuleType::Normal;
-+ uno::Any aElement( rLib->getByName( rModName ) );
-+ script::ModuleInfo aModuleInfo;
-+ if( aElement >>= aModuleInfo )
-+ nType = aModuleInfo.ModuleType;
-+ return nType;
-+}
-
- BasicEntry::~BasicEntry()
- {
-@@ -91,20 +106,22 @@ BasicEntryDescriptor::BasicEntryDescript
- {
- }
-
--BasicEntryDescriptor::BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rName, BasicEntryType eType )
-+BasicEntryDescriptor::BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rLibSubName, const String& rName, BasicEntryType eType )
- :m_aDocument( rDocument )
- ,m_eLocation( eLocation )
- ,m_aLibName( rLibName )
-+ ,m_aLibSubName( rLibSubName )
- ,m_aName( rName )
- ,m_eType( eType )
- {
- OSL_ENSURE( m_aDocument.isValid(), "BasicEntryDescriptor::BasicEntryDescriptor: invalid document!" );
- }
-
--BasicEntryDescriptor::BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rName, const String& rMethodName, BasicEntryType eType )
-+BasicEntryDescriptor::BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rLibSubName, const String& rName, const String& rMethodName, BasicEntryType eType )
- :m_aDocument( rDocument )
- ,m_eLocation( eLocation )
- ,m_aLibName( rLibName )
-+ ,m_aLibSubName( rLibSubName )
- ,m_aName( rName )
- ,m_aMethodName( rMethodName )
- ,m_eType( eType )
-@@ -120,6 +137,7 @@ BasicEntryDescriptor::BasicEntryDescript
- :m_aDocument( rDesc.m_aDocument )
- ,m_eLocation( rDesc.m_eLocation )
- ,m_aLibName( rDesc.m_aLibName )
-+ ,m_aLibSubName( rDesc.m_aLibSubName )
- ,m_aName( rDesc.m_aName )
- ,m_aMethodName( rDesc.m_aMethodName )
- ,m_eType( rDesc.m_eType )
-@@ -131,6 +149,7 @@ BasicEntryDescriptor& BasicEntryDescript
- m_aDocument = rDesc.m_aDocument;
- m_eLocation = rDesc.m_eLocation;
- m_aLibName = rDesc.m_aLibName;
-+ m_aLibSubName = rDesc.m_aLibSubName;
- m_aName = rDesc.m_aName;
- m_aMethodName = rDesc.m_aMethodName;
- m_eType = rDesc.m_eType;
-@@ -143,6 +162,7 @@ bool BasicEntryDescriptor::operator==( c
- return m_aDocument == rDesc.m_aDocument &&
- m_eLocation == rDesc.m_eLocation &&
- m_aLibName == rDesc.m_aLibName &&
-+ m_aLibSubName == rDesc.m_aLibSubName &&
- m_aName == rDesc.m_aName &&
- m_aMethodName == rDesc.m_aMethodName &&
- m_eType == rDesc.m_eType;
-@@ -286,50 +306,58 @@ void BasicTreeListBox::ImpCreateLibSubEn
- if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryLoaded( aOULibName ) )
- {
- try
-- {
-- // get a sorted list of module names
-- Sequence< ::rtl::OUString > aModNames = rDocument.getObjectNames( E_SCRIPTS, rLibName );
-- sal_Int32 nModCount = aModNames.getLength();
-- const ::rtl::OUString* pModNames = aModNames.getConstArray();
--
-- for ( sal_Int32 i = 0 ; i < nModCount ; i++ )
-- {
-- String aModName = pModNames[ i ];
-- SvLBoxEntry* pModuleEntry = FindEntry( pLibRootEntry, aModName, OBJ_TYPE_MODULE );
-- if ( !pModuleEntry )
-- pModuleEntry = AddEntry(
-- aModName,
-- Image( IDEResId( RID_IMG_MODULE ) ),
-- Image( IDEResId( RID_IMG_MODULE_HC ) ),
-- pLibRootEntry, false,
-- std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_MODULE ) ) );
--
-- // methods
-- if ( nMode & BROWSEMODE_SUBS )
-- {
-- Sequence< ::rtl::OUString > aNames = BasicIDE::GetMethodNames( rDocument, rLibName, aModName );
-- sal_Int32 nCount = aNames.getLength();
-- const ::rtl::OUString* pNames = aNames.getConstArray();
--
-- for ( sal_Int32 j = 0 ; j < nCount ; j++ )
-- {
-- String aName = pNames[ j ];
-- SvLBoxEntry* pEntry = FindEntry( pModuleEntry, aName, OBJ_TYPE_METHOD );
-- if ( !pEntry )
-- pEntry = AddEntry(
-- aName,
-- Image( IDEResId( RID_IMG_MACRO ) ),
-- Image( IDEResId( RID_IMG_MACRO_HC ) ),
-- pModuleEntry, false,
-- std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_METHOD ) ) );
-- }
-- }
-- }
-+ {
-+ BasicManager* pBasMgr = rDocument.getBasicManager();
-+ StarBASIC* pBasic = pBasMgr ? pBasMgr->GetLib( rLibName ) : 0;
-+ sal_Bool bVBAEnabled = pBasic ? pBasic->isVBAEnabled(): sal_False;
-+ if( bVBAEnabled )
-+ ImpCreateLibSubEntriesInVBAMode( pLibRootEntry, rDocument, rLibName );
-+ else
-+ {
-+ // get a sorted list of module names
-+ Sequence< ::rtl::OUString > aModNames = rDocument.getObjectNames( E_SCRIPTS, rLibName );
-+ sal_Int32 nModCount = aModNames.getLength();
-+ const ::rtl::OUString* pModNames = aModNames.getConstArray();
-+
-+ for ( sal_Int32 i = 0 ; i < nModCount ; i++ )
-+ {
-+ String aModName = pModNames[ i ];
-+ SvLBoxEntry* pModuleEntry = FindEntry( pLibRootEntry, aModName, OBJ_TYPE_MODULE );
-+ if ( !pModuleEntry )
-+ pModuleEntry = AddEntry(
-+ aModName,
-+ Image( IDEResId( RID_IMG_MODULE ) ),
-+ Image( IDEResId( RID_IMG_MODULE_HC ) ),
-+ pLibRootEntry, false,
-+ std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_MODULE ) ) );
-+
-+ // methods
-+ if ( nMode & BROWSEMODE_SUBS )
-+ {
-+ Sequence< ::rtl::OUString > aNames = BasicIDE::GetMethodNames( rDocument, rLibName, aModName );
-+ sal_Int32 nCount = aNames.getLength();
-+ const ::rtl::OUString* pNames = aNames.getConstArray();
-+
-+ for ( sal_Int32 j = 0 ; j < nCount ; j++ )
-+ {
-+ String aName = pNames[ j ];
-+ SvLBoxEntry* pEntry = FindEntry( pModuleEntry, aName, OBJ_TYPE_METHOD );
-+ if ( !pEntry )
-+ pEntry = AddEntry(
-+ aName,
-+ Image( IDEResId( RID_IMG_MACRO ) ),
-+ Image( IDEResId( RID_IMG_MACRO_HC ) ),
-+ pModuleEntry, false,
-+ std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_METHOD ) ) );
-+ }
-+ }
-+ }
-+ }
- }
-- catch ( const container::NoSuchElementException& )
-- {
-+ catch ( const container::NoSuchElementException& )
-+ {
- DBG_UNHANDLED_EXCEPTION();
-- }
-+ }
- }
- }
-
-@@ -368,6 +396,139 @@ void BasicTreeListBox::ImpCreateLibSubEn
- }
- }
-
-+void BasicTreeListBox::ImpCreateLibSubEntriesInVBAMode( SvLBoxEntry* pLibRootEntry, const ScriptDocument& rDocument, const String& rLibName )
-+{
-+ ::std::map< BasicEntryType, ::rtl::OUString > aEntryMap;
-+ aEntryMap.insert( ::std::make_pair( OBJ_TYPE_DOCUMENT_OBJECTS, String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) );
-+ aEntryMap.insert( ::std::make_pair( OBJ_TYPE_USERFORMS, String( IDEResId( RID_STR_USERFORMS ) ) ) );
-+ aEntryMap.insert( ::std::make_pair( OBJ_TYPE_NORMAL_MODULES, String( IDEResId( RID_STR_NORMAL_MODULES ) ) ) );
-+ aEntryMap.insert( ::std::make_pair( OBJ_TYPE_CLASS_MODULES, String( IDEResId( RID_STR_CLASS_MODULES ) ) ) );
-+
-+ ::std::map< BasicEntryType, ::rtl::OUString >::iterator iter;
-+ for( iter = aEntryMap.begin(); iter != aEntryMap.end(); ++iter )
-+ {
-+ BasicEntryType eType = iter->first;
-+ ::rtl::OUString aEntryName = iter->second;
-+ SvLBoxEntry* pLibSubRootEntry = FindEntry( pLibRootEntry, aEntryName, eType );
-+ if( pLibSubRootEntry )
-+ {
-+ SetEntryBitmaps( pLibSubRootEntry, Image( IDEResId( RID_IMG_MODLIB ) ), Image( IDEResId( RID_IMG_MODLIB_HC ) ) );
-+ if ( IsExpanded( pLibSubRootEntry ) )
-+ ImpCreateLibSubSubEntriesInVBAMode( pLibSubRootEntry, rDocument, rLibName );
-+ }
-+ else
-+ {
-+ pLibSubRootEntry = AddEntry(
-+ aEntryName,
-+ Image( IDEResId( RID_IMG_MODLIB ) ),
-+ Image( IDEResId( RID_IMG_MODLIB_HC ) ),
-+ pLibRootEntry, true,
-+ std::auto_ptr< BasicEntry >( new BasicEntry( eType ) ) );
-+ }
-+ }
-+}
-+
-+void BasicTreeListBox::ImpCreateLibSubSubEntriesInVBAMode( SvLBoxEntry* pLibSubRootEntry, const ScriptDocument& rDocument, const String& rLibName )
-+{
-+ uno::Reference< container::XNameContainer > xLib = rDocument.getOrCreateLibrary( E_SCRIPTS, rLibName );
-+ if( !xLib.is() )
-+ return;
-+
-+ try
-+ {
-+ // get a sorted list of module names
-+ Sequence< ::rtl::OUString > aModNames = rDocument.getObjectNames( E_SCRIPTS, rLibName );
-+ sal_Int32 nModCount = aModNames.getLength();
-+ const ::rtl::OUString* pModNames = aModNames.getConstArray();
-+
-+ BasicEntryDescriptor aDesc( GetEntryDescriptor( pLibSubRootEntry ) );
-+ BasicEntryType eCurrentType( aDesc.GetType() );
-+
-+ for ( sal_Int32 i = 0 ; i < nModCount ; i++ )
-+ {
-+ String aModName = pModNames[ i ];
-+ BasicEntryType eType = OBJ_TYPE_UNKNOWN;
-+ switch( lcl_getModuleType( xLib, aModName ) )
-+ {
-+ case script::ModuleType::Document:
-+ eType = OBJ_TYPE_DOCUMENT_OBJECTS;
-+ break;
-+ case script::ModuleType::Form:
-+ eType = OBJ_TYPE_USERFORMS;
-+ break;
-+ case script::ModuleType::Normal:
-+ eType = OBJ_TYPE_NORMAL_MODULES;
-+ break;
-+ case script::ModuleType::Class:
-+ eType = OBJ_TYPE_CLASS_MODULES;
-+ break;
-+ }
-+ if( eType != eCurrentType )
-+ continue;
-+
-+ // display a nice friendly name in the ObjectModule tab,
-+ // combining the objectname and module name, e.g. Sheet1 ( Financials )
-+ String aEntryName( aModName );
-+ if( eType == OBJ_TYPE_DOCUMENT_OBJECTS )
-+ {
-+ String sObjName;
-+ lcl_getObjectName( xLib, aModName, sObjName );
-+ if( sObjName.Len() )
-+ {
-+ aEntryName.AppendAscii(" (").Append(sObjName).AppendAscii(")");
-+ }
-+ }
-+ SvLBoxEntry* pModuleEntry = FindEntry( pLibSubRootEntry, aEntryName, OBJ_TYPE_MODULE );
-+ if ( !pModuleEntry )
-+ pModuleEntry = AddEntry(
-+ aEntryName,
-+ Image( IDEResId( RID_IMG_MODULE ) ),
-+ Image( IDEResId( RID_IMG_MODULE_HC ) ),
-+ pLibSubRootEntry, false,
-+ std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_MODULE ) ) );
-+
-+ // methods
-+ if ( nMode & BROWSEMODE_SUBS )
-+ {
-+ Sequence< ::rtl::OUString > aNames = BasicIDE::GetMethodNames( rDocument, rLibName, aModName );
-+ sal_Int32 nCount = aNames.getLength();
-+ const ::rtl::OUString* pNames = aNames.getConstArray();
-+
-+ for ( sal_Int32 j = 0 ; j < nCount ; j++ )
-+ {
-+ String aName = pNames[ j ];
-+ SvLBoxEntry* pEntry = FindEntry( pModuleEntry, aName, OBJ_TYPE_METHOD );
-+ if ( !pEntry )
-+ pEntry = AddEntry(
-+ aName,
-+ Image( IDEResId( RID_IMG_MACRO ) ),
-+ Image( IDEResId( RID_IMG_MACRO_HC ) ),
-+ pModuleEntry, false,
-+ std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_METHOD ) ) );
-+ }
-+ }
-+ }
-+ }
-+ catch ( const container::NoSuchElementException& )
-+ {
-+ DBG_UNHANDLED_EXCEPTION();
-+ }
-+}
-+
-+SvLBoxEntry* BasicTreeListBox::ImpFindEntry( SvLBoxEntry* pParent, const String& rText )
-+{
-+ ULONG nRootPos = 0;
-+ SvLBoxEntry* pEntry = pParent ? FirstChild( pParent ) : GetEntry( nRootPos );
-+ while ( pEntry )
-+ {
-+ if ( GetEntryText( pEntry ) == rText )
-+ return pEntry;
-+
-+ pEntry = pParent ? NextSibling( pEntry ) : GetEntry( ++nRootPos );
-+ }
-+ return 0;
-+}
-+
- void BasicTreeListBox::onDocumentCreated( const ScriptDocument& /*_rDocument*/ )
- {
- UpdateEntries();
-@@ -480,10 +641,11 @@ long BasicTreeListBox::ExpandingHdl()
- if ( aDocument.isAlive() )
- {
- String aLibName( aDesc.GetLibName() );
-+ String aLibSubName( aDesc.GetLibSubName() );
- String aName( aDesc.GetName() );
- String aMethodName( aDesc.GetMethodName() );
-
-- if ( aLibName.Len() && !aName.Len() && !aMethodName.Len() )
-+ if ( aLibName.Len() && !aLibSubName.Len() && !aName.Len() && !aMethodName.Len() )
- {
- // check password, if library is password protected and not verified
- ::rtl::OUString aOULibName( aLibName );
-@@ -636,7 +798,7 @@ void BasicTreeListBox::SetCurrentEntry(
- aDesc = BasicEntryDescriptor(
- ScriptDocument::getApplicationScriptDocument(),
- LIBRARY_LOCATION_USER, String::CreateFromAscii( "Standard" ),
-- String::CreateFromAscii( "." ), OBJ_TYPE_UNKNOWN );
-+ String(), String::CreateFromAscii( "." ), OBJ_TYPE_UNKNOWN );
- }
- ScriptDocument aDocument( aDesc.GetDocument() );
- OSL_ENSURE( aDocument.isValid(), "BasicTreeListBox::SetCurrentEntry: invalid document!" );
-@@ -653,14 +815,24 @@ void BasicTreeListBox::SetCurrentEntry(
- if ( pLibEntry )
- {
- pCurEntry = pLibEntry;
-+ String aLibSubName( aDesc.GetLibSubName() );
-+ if( aLibSubName.Len() )
-+ {
-+ Expand( pLibEntry );
-+ SvLBoxEntry* pLibSubEntry = ImpFindEntry( pLibEntry, aLibSubName );
-+ if( pLibSubEntry )
-+ {
-+ pCurEntry = pLibSubEntry;
-+ }
-+ }
- String aName( aDesc.GetName() );
- if ( aName.Len() )
- {
-- Expand( pLibEntry );
-+ Expand( pCurEntry );
- BasicEntryType eType = OBJ_TYPE_MODULE;
- if ( aDesc.GetType() == OBJ_TYPE_DIALOG )
- eType = OBJ_TYPE_DIALOG;
-- SvLBoxEntry* pEntry = FindEntry( pLibEntry, aName, eType );
-+ SvLBoxEntry* pEntry = FindEntry( pCurEntry, aName, eType );
- if ( pEntry )
- {
- pCurEntry = pEntry;
-diff -urp '--exclude=unxlngi6.pro' basctl.bk/source/basicide/bastype2.hxx basctl/source/basicide/bastype2.hxx
---- basctl.bk/source/basicide/bastype2.hxx 2008-10-10 09:48:34.000000000 +0800
-+++ basctl/source/basicide/bastype2.hxx 2008-10-10 09:53:46.000000000 +0800
-@@ -42,7 +42,7 @@
- #include <sbxitem.hxx>
- #include "basobj.hxx"
-
--enum BasicEntryType { OBJ_TYPE_UNKNOWN, OBJ_TYPE_DOCUMENT, OBJ_TYPE_LIBRARY, OBJ_TYPE_MODULE, OBJ_TYPE_DIALOG, OBJ_TYPE_METHOD };
-+enum BasicEntryType { OBJ_TYPE_UNKNOWN, OBJ_TYPE_DOCUMENT, OBJ_TYPE_LIBRARY, OBJ_TYPE_MODULE, OBJ_TYPE_DIALOG, OBJ_TYPE_METHOD, OBJ_TYPE_DOCUMENT_OBJECTS, OBJ_TYPE_USERFORMS, OBJ_TYPE_NORMAL_MODULES, OBJ_TYPE_CLASS_MODULES };
-
- #define BROWSEMODE_MODULES 0x01
- #define BROWSEMODE_SUBS 0x02
-@@ -101,14 +101,15 @@ class BasicEntryDescriptor
- ScriptDocument m_aDocument;
- LibraryLocation m_eLocation;
- String m_aLibName;
-+ String m_aLibSubName; // for vba entry: Document Objects, Class Modules, Forms and Normal Modules
- String m_aName;
- String m_aMethodName;
- BasicEntryType m_eType;
-
- public:
- BasicEntryDescriptor();
-- BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rName, BasicEntryType eType );
-- BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rName, const String& rMethodName, BasicEntryType eType );
-+ BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rLibSubName, const String& rName, BasicEntryType eType );
-+ BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rLibSubName, const String& rName, const String& rMethodName, BasicEntryType eType );
- virtual ~BasicEntryDescriptor();
-
- BasicEntryDescriptor( const BasicEntryDescriptor& rDesc );
-@@ -125,6 +126,9 @@ public:
- const String& GetLibName() const { return m_aLibName; }
- void SetLibName( const String& aLibName ) { m_aLibName = aLibName; }
-
-+ const String& GetLibSubName() const { return m_aLibSubName; }
-+ void SetLibSubName( const String& aLibSubName ) { m_aLibSubName = aLibSubName; }
-+
- const String& GetName() const { return m_aName; }
- void SetName( const String& aName ) { m_aName = aName; }
-
-@@ -164,6 +168,9 @@ protected:
-
- void ImpCreateLibEntries( SvLBoxEntry* pShellRootEntry, const ScriptDocument& rDocument, LibraryLocation eLocation );
- void ImpCreateLibSubEntries( SvLBoxEntry* pLibRootEntry, const ScriptDocument& rDocument, const String& rLibName );
-+ void ImpCreateLibSubEntriesInVBAMode( SvLBoxEntry* pLibRootEntry, const ScriptDocument& rDocument, const String& rLibName );
-+ void ImpCreateLibSubSubEntriesInVBAMode( SvLBoxEntry* pLibSubRootEntry, const ScriptDocument& rDocument, const String& rLibName );
-+ SvLBoxEntry* ImpFindEntry( SvLBoxEntry* pParent, const String& rText );
-
- // DocumentEventListener
- virtual void onDocumentCreated( const ScriptDocument& _rDocument );
-diff -urp '--exclude=unxlngi6.pro' basctl.bk/source/basicide/bastype3.cxx basctl/source/basicide/bastype3.cxx
---- basctl.bk/source/basicide/bastype3.cxx 2008-10-10 09:48:34.000000000 +0800
-+++ basctl/source/basicide/bastype3.cxx 2008-10-10 10:06:49.000000000 +0800
-@@ -134,6 +134,14 @@ void __EXPORT BasicTreeListBox::Requesti
- }
- }
- }
-+ else if ( eType == OBJ_TYPE_DOCUMENT_OBJECTS
-+ || eType == OBJ_TYPE_USERFORMS
-+ || eType == OBJ_TYPE_NORMAL_MODULES
-+ || eType == OBJ_TYPE_CLASS_MODULES )
-+ {
-+ String aLibName( aDesc.GetLibName() );
-+ ImpCreateLibSubSubEntriesInVBAMode( pEntry, aDocument, aLibName );
-+ }
- else {
- DBG_ERROR( "BasicTreeListBox::RequestingChilds: Unknown Type!" );
- }
-@@ -204,6 +212,7 @@ SbxVariable* BasicTreeListBox::FindVaria
- }
-
- SbxVariable* pVar = 0;
-+ bool bDocumentObjects = false;
- if ( aEntries.Count() )
- {
- for ( USHORT n = 0; n < aEntries.Count(); n++ )
-@@ -226,6 +235,12 @@ SbxVariable* BasicTreeListBox::FindVaria
- case OBJ_TYPE_MODULE:
- {
- DBG_ASSERT( pVar && pVar->IsA( TYPE(StarBASIC) ), "FindVariable: Ungueltiges Basic" );
-+ // extract the module name from the string like "Sheet1 (Example1)"
-+ if( bDocumentObjects )
-+ {
-+ sal_uInt16 nIndex = 0;
-+ aName = aName.GetToken( 0, ' ', nIndex );
-+ }
- pVar = ((StarBASIC*)pVar)->FindModule( aName );
- }
- break;
-@@ -240,6 +255,15 @@ SbxVariable* BasicTreeListBox::FindVaria
- // sbx dialogs removed
- }
- break;
-+ case OBJ_TYPE_DOCUMENT_OBJECTS:
-+ bDocumentObjects = true;
-+ case OBJ_TYPE_USERFORMS:
-+ case OBJ_TYPE_NORMAL_MODULES:
-+ case OBJ_TYPE_CLASS_MODULES:
-+ {
-+ // skip, to find the child entry.
-+ continue;
-+ }
- default:
- {
- DBG_ERROR( "FindVariable: Unbekannter Typ!" );
-@@ -260,12 +284,13 @@ BasicEntryDescriptor BasicTreeListBox::G
- ScriptDocument aDocument( ScriptDocument::getApplicationScriptDocument() );
- LibraryLocation eLocation = LIBRARY_LOCATION_UNKNOWN;
- String aLibName;
-+ String aLibSubName;
- String aName;
- String aMethodName;
- BasicEntryType eType = OBJ_TYPE_UNKNOWN;
-
- if ( !pEntry )
-- return BasicEntryDescriptor( aDocument, eLocation, aLibName, aName, aMethodName, eType );
-+ return BasicEntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, aName, aMethodName, eType );
-
- EntryArray aEntries;
-
-@@ -332,6 +357,15 @@ BasicEntryDescriptor BasicTreeListBox::G
- eType = pBE->GetType();
- }
- break;
-+ case OBJ_TYPE_DOCUMENT_OBJECTS:
-+ case OBJ_TYPE_USERFORMS:
-+ case OBJ_TYPE_NORMAL_MODULES:
-+ case OBJ_TYPE_CLASS_MODULES:
-+ {
-+ aLibSubName = GetEntryText( pLE );
-+ eType = pBE->GetType();
-+ }
-+ break;
- default:
- {
- DBG_ERROR( "GetEntryDescriptor: Unbekannter Typ!" );
-@@ -345,7 +379,7 @@ BasicEntryDescriptor BasicTreeListBox::G
- }
- }
-
-- return BasicEntryDescriptor( aDocument, eLocation, aLibName, aName, aMethodName, eType );
-+ return BasicEntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, aName, aMethodName, eType );
- }
-
- USHORT BasicTreeListBox::ConvertType( BasicEntryType eType )
-@@ -427,6 +461,14 @@ bool BasicTreeListBox::IsValidEntry( SvL
- bIsValid = BasicIDE::HasMethod( aDocument, aLibName, aName, aMethodName );
- }
- break;
-+ case OBJ_TYPE_DOCUMENT_OBJECTS:
-+ case OBJ_TYPE_USERFORMS:
-+ case OBJ_TYPE_NORMAL_MODULES:
-+ case OBJ_TYPE_CLASS_MODULES:
-+ {
-+ bIsValid = true;
-+ }
-+ break;
- default: ;
- }
-
-diff -urp '--exclude=unxlngi6.pro' basctl.bk/source/basicide/macrodlg.cxx basctl/source/basicide/macrodlg.cxx
---- basctl.bk/source/basicide/macrodlg.cxx 2008-10-10 09:48:33.000000000 +0800
-+++ basctl/source/basicide/macrodlg.cxx 2008-10-10 10:08:05.000000000 +0800
-@@ -385,7 +385,15 @@ SbMethod* MacroChooser::CreateMacro()
- SbModule* pModule = 0;
- String aModName( aDesc.GetName() );
- if ( aModName.Len() )
-+ {
-+ // extract the module name from the string like "Sheet1 (Example1)"
-+ if( aDesc.GetLibSubName().Equals( String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) )
-+ {
-+ sal_uInt16 nIndex = 0;
-+ aModName = aModName.GetToken( 0, ' ', nIndex );
-+ }
- pModule = pBasic->FindModule( aModName );
-+ }
- else if ( pBasic->GetModules()->Count() )
- pModule = (SbModule*)pBasic->GetModules()->Get( 0 );
-
-@@ -713,6 +721,12 @@ IMPL_LINK( MacroChooser, ButtonHdl, Butt
- BasicManager* pBasMgr = aDocument.getBasicManager();
- String aLib( aDesc.GetLibName() );
- String aMod( aDesc.GetName() );
-+ // extract the module name from the string like "Sheet1 (Example1)"
-+ if( aDesc.GetLibSubName().Equals( String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) )
-+ {
-+ sal_uInt16 nIndex = 0;
-+ aMod = aMod.GetToken( 0, ' ', nIndex );
-+ }
- String aSub( aDesc.GetMethodName() );
- SfxMacroInfoItem aInfoItem( SID_BASICIDE_ARG_MACROINFO, pBasMgr, aLib, aMod, aSub, String() );
- if ( pButton == &aEditButton )
-diff -urp '--exclude=unxlngi6.pro' basctl.bk/source/basicide/moduldlg.cxx basctl/source/basicide/moduldlg.cxx
---- basctl.bk/source/basicide/moduldlg.cxx 2008-10-10 09:48:33.000000000 +0800
-+++ basctl/source/basicide/moduldlg.cxx 2008-10-10 10:08:44.000000000 +0800
-@@ -87,7 +87,7 @@ BOOL __EXPORT ExtBasicTreeListBox::Editi
- if ( pEntry )
- {
- USHORT nDepth = GetModel()->GetDepth( pEntry );
-- if ( nDepth == 2 )
-+ if ( nDepth >= 2 )
- {
- BasicEntryDescriptor aDesc( GetEntryDescriptor( pEntry ) );
- ScriptDocument aDocument( aDesc.GetDocument() );
-@@ -165,7 +165,7 @@ DragDropMode __EXPORT ExtBasicTreeListBo
- if ( pEntry )
- {
- USHORT nDepth = GetModel()->GetDepth( pEntry );
-- if ( nDepth == 2 )
-+ if ( nDepth >= 2 )
- {
- nMode_ = SV_DRAGDROP_CTRL_COPY;
- BasicEntryDescriptor aDesc( GetEntryDescriptor( pEntry ) );
-@@ -213,7 +213,7 @@ BOOL __EXPORT ExtBasicTreeListBox::Notif
-
- // don't drop on a library, which is not loaded, readonly or password protected
- // or which already has a module/dialog with this name
-- if ( bValid && ( nDepth == 1 || nDepth == 2 ) )
-+ if ( bValid && ( nDepth > 0 ) )
- {
- // get source module/dialog name
- BasicEntryDescriptor aSourceDesc( GetEntryDescriptor( pSelected ) );
-@@ -351,7 +351,7 @@ BOOL __EXPORT ExtBasicTreeListBox::Notif
- rpNewParent = pTarget;
- rNewChildPos = 0;
- }
-- else if ( nDepth == 2 )
-+ else if ( nDepth >= 2 )
- {
- // Target = Modul/Dialog => Modul/Dialog unter das uebergeordnete Basic haengen...
- rpNewParent = GetParent( pTarget );
-@@ -626,20 +626,27 @@ void ObjectPage::CheckButtons()
- {
- // enable/disable edit button
- SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry();
-+ BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) );
-+ ScriptDocument aDocument( aDesc.GetDocument() );
-+ ::rtl::OUString aOULibName( aDesc.GetLibName() );
-+ String aLibSubName( aDesc.GetLibSubName() );
-+ BasicManager* pBasMgr = aDocument.getBasicManager();
-+ StarBASIC* pBasic = pBasMgr ? pBasMgr->GetLib( aOULibName ) : 0;
-+ sal_Bool bVBAEnabled = pBasic ? pBasic->isVBAEnabled(): sal_False;
-+ USHORT nMode = aBasicBox.GetMode();
-+
- USHORT nDepth = pCurEntry ? aBasicBox.GetModel()->GetDepth( pCurEntry ) : 0;
-- if ( nDepth == 2 )
-+ if ( ( !bVBAEnabled && ( nDepth == 2 ) )
-+ || ( bVBAEnabled && ( nMode & BROWSEMODE_MODULES ) && ( nDepth == 3 ) ) )
- aEditButton.Enable();
- else
- aEditButton.Disable();
-
- // enable/disable new module/dialog buttons
-- BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) );
- LibraryLocation eLocation( aDesc.GetLocation() );
- BOOL bReadOnly = FALSE;
-- if ( nDepth == 1 || nDepth == 2 )
-+ if ( nDepth > 0 )
- {
-- ScriptDocument aDocument( aDesc.GetDocument() );
-- ::rtl::OUString aOULibName( aDesc.GetLibName() );
- Reference< script::XLibraryContainer2 > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
- Reference< script::XLibraryContainer2 > xDlgLibContainer( aDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY );
- if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryReadOnly( aOULibName ) ) ||
-@@ -660,7 +667,8 @@ void ObjectPage::CheckButtons()
- }
-
- // enable/disable delete button
-- if ( nDepth == 2 && !bReadOnly && eLocation != LIBRARY_LOCATION_SHARE )
-+ if ( ( ( !bVBAEnabled && nDepth == 2 ) || ( bVBAEnabled && ( nDepth == 3 ) && !aLibSubName.Equals( String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) ) )
-+ && !bReadOnly && eLocation != LIBRARY_LOCATION_SHARE )
- aDelButton.Enable();
- else
- aDelButton.Disable();
-@@ -688,13 +696,20 @@ IMPL_LINK( ObjectPage, ButtonHdl, Button
- SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
- SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry();
- DBG_ASSERT( pCurEntry, "Entry?!" );
-- if ( aBasicBox.GetModel()->GetDepth( pCurEntry ) == 2 )
-+ if ( aBasicBox.GetModel()->GetDepth( pCurEntry ) >= 2 )
- {
- BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) );
- if ( pDispatcher )
- {
-+ String aModName( aDesc.GetName() );
-+ // extract the module name from the string like "Sheet1 (Example1)"
-+ if( aDesc.GetLibSubName().Equals( String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) )
-+ {
-+ sal_uInt16 nIndex = 0;
-+ aModName = aModName.GetToken( 0, ' ', nIndex );
-+ }
- SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, aDesc.GetDocument(), aDesc.GetLibName(),
-- aDesc.GetName(), aBasicBox.ConvertType( aDesc.GetType() ) );
-+ aModName, aBasicBox.ConvertType( aDesc.GetType() ) );
- pDispatcher->Execute( SID_BASICIDE_SHOWSBX, SFX_CALLMODE_SYNCHRON, &aSbxItem, 0L );
- }
- }
-@@ -976,14 +991,14 @@ SbModule* createModImpl( Window* pWin, c
- try
- {
- ::rtl::OUString sModuleCode;
-+ // the module has existed
-+ if( rDocument.hasModule( aLibName, aModName ) )
-+ return NULL;
- rDocument.createModule( aLibName, aModName, bMain, sModuleCode );
- BasicManager* pBasMgr = rDocument.getBasicManager();
-- if ( pBasMgr )
-- {
-- StarBASIC* pBasic = pBasMgr->GetLib( aLibName );
-- if ( pBasic )
-- pModule = pBasic->FindModule( aModName );
-- }
-+ StarBASIC* pBasic = pBasMgr? pBasMgr->GetLib( aLibName ) : 0;
-+ if ( pBasic )
-+ pModule = pBasic->FindModule( aModName );
- SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, rDocument, aLibName, aModName, BASICIDE_TYPE_MODULE );
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
-@@ -1005,14 +1020,27 @@ SbModule* createModImpl( Window* pWin, c
- {
- if ( !rBasicBox.IsExpanded( pLibEntry ) )
- rBasicBox.Expand( pLibEntry );
-- SvLBoxEntry* pEntry = rBasicBox.FindEntry( pLibEntry, aModName, OBJ_TYPE_MODULE );
-+ SvLBoxEntry* pSubRootEntry = pLibEntry;
-+ if( pBasic && pBasic->isVBAEnabled() )
-+ {
-+ // add the new module in the "Modules" entry
-+ SvLBoxEntry* pLibSubEntry = rBasicBox.FindEntry( pLibEntry, String( IDEResId( RID_STR_NORMAL_MODULES ) ) , OBJ_TYPE_NORMAL_MODULES );
-+ if( pLibSubEntry )
-+ {
-+ if( !rBasicBox.IsExpanded( pLibSubEntry ) )
-+ rBasicBox.Expand( pLibSubEntry );
-+ pSubRootEntry = pLibSubEntry;
-+ }
-+ }
-+
-+ SvLBoxEntry* pEntry = rBasicBox.FindEntry( pSubRootEntry, aModName, OBJ_TYPE_MODULE );
- if ( !pEntry )
- {
- pEntry = rBasicBox.AddEntry(
- aModName,
- Image( IDEResId( RID_IMG_MODULE ) ),
- Image( IDEResId( RID_IMG_MODULE_HC ) ),
-- pLibEntry, false,
-+ pSubRootEntry, false,
- std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_MODULE ) ) );
- DBG_ASSERT( pEntry, "InsertEntry fehlgeschlagen!" );
- }
diff --git a/patches/vba/vba-basic-not-fix.diff b/patches/vba/vba-basic-not-fix.diff
deleted file mode 100644
index 6b67ce974..000000000
--- a/patches/vba/vba-basic-not-fix.diff
+++ /dev/null
@@ -1,17 +0,0 @@
-diff --git basic/source/comp/exprtree.cxx basic/source/comp/exprtree.cxx
-index 1c9ad8f..e12496c 100644
---- basic/source/comp/exprtree.cxx
-+++ basic/source/comp/exprtree.cxx
-@@ -574,7 +574,11 @@ SbiExprNode* SbiExpression::Unary()
- eTok = NEG;
- case NOT:
- pParser->Next();
-- pNd = new SbiExprNode( pParser, Unary(), eTok, NULL );
-+ // process something like "Do While Not "foo"="" "
-+ if( pParser->IsVBASupportOn() )
-+ pNd = new SbiExprNode( pParser, Like(), eTok, NULL );
-+ else
-+ pNd = new SbiExprNode( pParser, Unary(), eTok, NULL );
- break;
- case PLUS:
- pParser->Next();
diff --git a/patches/vba/vba-basic-parallel-build.diff b/patches/vba/vba-basic-parallel-build.diff
deleted file mode 100644
index ddc4a6dc3..000000000
--- a/patches/vba/vba-basic-parallel-build.diff
+++ /dev/null
@@ -1,35 +0,0 @@
---- basic/source/classes/makefile.mk 2009-04-03 09:19:00.000000000 +0200
-+++ basic/source/classes/makefile.mk 2009-04-03 09:14:42.000000000 +0200
-@@ -41,17 +41,20 @@ ENABLE_EXCEPTIONS=TRUE
-
- .INCLUDE : settings.mk
-
--ALLTAR : \
-+ALLTAR .SEQUENTIAL : \
- $(MISC)$/$(TARGET).don \
-- $(SLOTARGET)
-+ $(MISC)$/$(TARGET).slo
-
- $(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb
- +$(CPPUMAKER) -O$(OUT)$/inc -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@
- echo $@
-
-+$(MISC)$/$(TARGET).slo : $(SLOTARGET)
-+ echo $@
-+
- # --- Allgemein -----------------------------------------------------------
-
--COMMON_SLOFILES= \
-+SLOFILES= \
- $(SLO)$/sb.obj \
- $(SLO)$/sbxmod.obj \
- $(SLO)$/image.obj \
-@@ -60,8 +63,6 @@ COMMON_SLOFILES= \
- $(SLO)$/propacc.obj \
- $(SLO)$/disas.obj \
- $(SLO)$/errobject.obj \
--
--SLOFILES= $(COMMON_SLOFILES) \
- $(SLO)$/eventatt.obj
-
- OBJFILES= \
diff --git a/patches/vba/vba-buildin-toolbar-fix.diff b/patches/vba/vba-buildin-toolbar-fix.diff
deleted file mode 100644
index 222fb2ba0..000000000
--- a/patches/vba/vba-buildin-toolbar-fix.diff
+++ /dev/null
@@ -1,81 +0,0 @@
-diff --git vbahelper/source/vbahelper/vbacommandbarhelper.cxx vbahelper/source/vbahelper/vbacommandbarhelper.cxx
-index 7c59107..b4515b6 100644
---- vbahelper/source/vbahelper/vbacommandbarhelper.cxx
-+++ vbahelper/source/vbahelper/vbacommandbarhelper.cxx
-@@ -44,10 +44,63 @@
- #include <comphelper/processfactory.hxx>
- #include <vbahelper/vbahelper.hxx>
- #include <time.h>
-+#include <map>
-
- using namespace com::sun::star;
- using namespace ooo::vba;
-
-+#define CREATEOUSTRING(asciistr) rtl::OUString::createFromAscii(asciistr)
-+
-+typedef std::map< rtl::OUString, rtl::OUString > MSO2OOCommandbarMap;
-+
-+class MSO2OOCommandbarHelper
-+{
-+private:
-+ static MSO2OOCommandbarHelper* pMSO2OOCommandbarHelper;
-+ MSO2OOCommandbarMap maBuildinToolbarMap;
-+
-+ MSO2OOCommandbarHelper()
-+ {
-+ // Buildin toolbars
-+ maBuildinToolbarMap.insert( std::make_pair( CREATEOUSTRING("Standard"),CREATEOUSTRING("private:resource/toolbar/standardbar") ) );
-+ maBuildinToolbarMap.insert( std::make_pair( CREATEOUSTRING("Formatting"),CREATEOUSTRING("private:resource/toolbar/formatobjectbar") ) );
-+ maBuildinToolbarMap.insert( std::make_pair( CREATEOUSTRING("Drawing"),CREATEOUSTRING("private:resource/toolbar/drawbar") ) );
-+ maBuildinToolbarMap.insert( std::make_pair( CREATEOUSTRING("Toolbar List"),CREATEOUSTRING("private:resource/toolbar/toolbar") ) );
-+ maBuildinToolbarMap.insert( std::make_pair( CREATEOUSTRING("Forms"),CREATEOUSTRING("private:resource/toolbar/formcontrols") ) );
-+ maBuildinToolbarMap.insert( std::make_pair( CREATEOUSTRING("Form Controls"),CREATEOUSTRING("private:resource/toolbar/formcontrols") ) );
-+ maBuildinToolbarMap.insert( std::make_pair( CREATEOUSTRING("Full Screen"),CREATEOUSTRING("private:resource/toolbar/fullscreenbar") ) );
-+ maBuildinToolbarMap.insert( std::make_pair( CREATEOUSTRING("Chart"),CREATEOUSTRING("private:resource/toolbar/flowchartshapes") ) );
-+ maBuildinToolbarMap.insert( std::make_pair( CREATEOUSTRING("Picture"),CREATEOUSTRING("private:resource/toolbar/graphicobjectbar") ) );
-+ maBuildinToolbarMap.insert( std::make_pair( CREATEOUSTRING("WordArt"),CREATEOUSTRING("private:resource/toolbar/fontworkobjectbar") ) );
-+ maBuildinToolbarMap.insert( std::make_pair( CREATEOUSTRING("3-D Settings"),CREATEOUSTRING("private:resource/toolbar/extrusionobjectbar") ) );
-+ }
-+
-+public:
-+ virtual ~MSO2OOCommandbarHelper() {};
-+ static MSO2OOCommandbarHelper* getMSO2OOCommandbarHelper()
-+ {
-+ if( pMSO2OOCommandbarHelper == NULL )
-+ {
-+ pMSO2OOCommandbarHelper = new MSO2OOCommandbarHelper();
-+ }
-+ return pMSO2OOCommandbarHelper;
-+ }
-+
-+ rtl::OUString findBuildinToolbar( const rtl::OUString& sToolbarName )
-+ {
-+ MSO2OOCommandbarMap::iterator it = maBuildinToolbarMap.begin();
-+ for(; it != maBuildinToolbarMap.end(); it++ )
-+ {
-+ rtl::OUString sName = it->first;
-+ if( sName.equalsIgnoreAsciiCase( sToolbarName ) )
-+ return it->second;
-+ }
-+ return rtl::OUString();
-+ }
-+};
-+
-+MSO2OOCommandbarHelper* MSO2OOCommandbarHelper::pMSO2OOCommandbarHelper = NULL;
-+
-
- VbaCommandBarHelper::VbaCommandBarHelper( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException) : mxContext( xContext ), mxModel( xModel )
- {
-@@ -113,6 +166,12 @@ rtl::OUString VbaCommandBarHelper::findToolbarByName( const css::uno::Reference<
- {
- rtl::OUString sUIName;
- rtl::OUString sResourceUrl;
-+
-+ // check if it is an buildin toolbar
-+ sResourceUrl = MSO2OOCommandbarHelper::getMSO2OOCommandbarHelper()->findBuildinToolbar( sName );
-+ if( sResourceUrl.getLength() > 0 )
-+ return sResourceUrl;
-+
- uno::Sequence< ::rtl::OUString > allNames = xNameAccess->getElementNames();
- for( sal_Int32 i = 0; i < allNames.getLength(); i++ )
- {
diff --git a/patches/vba/vba-check-for-macro.diff b/patches/vba/vba-check-for-macro.diff
deleted file mode 100644
index 2844bb3fe..000000000
--- a/patches/vba/vba-check-for-macro.diff
+++ /dev/null
@@ -1,311 +0,0 @@
---- basic/inc/basic/basmgr.hxx.old 2009-04-02 10:49:18.000000000 +0000
-+++ basic/inc/basic/basmgr.hxx 2009-04-06 16:41:59.000000000 +0000
-@@ -237,7 +237,7 @@ public:
- takes the names of modules whose size exceeds the legacy limit
- */
- bool LegacyPsswdBinaryLimitExceeded( ::com::sun::star::uno::Sequence< rtl::OUString >& _out_rModuleNames );
--
-+ bool HasExeCode( const String& );
- private:
- BOOL IsReference( USHORT nLib );
-
---- basic/inc/basic/sbmod.hxx.old 2009-04-06 16:41:58.000000000 +0000
-+++ basic/inc/basic/sbmod.hxx 2009-04-06 16:41:59.000000000 +0000
-@@ -128,6 +128,7 @@ public:
- BOOL ExceedsLegacyModuleSize();
- void fixUpMethodStart( bool bCvtToLegacy, SbiImage* pImg = NULL ) const;
- bool IsVBACompat() { return mbVBACompat; }
-+ bool HasExeCode();
- };
-
- #ifndef __SB_SBMODULEREF_HXX
---- basic/source/basmgr/basmgr.cxx.old 2009-04-02 10:49:15.000000000 +0000
-+++ basic/source/basmgr/basmgr.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -1127,6 +1127,25 @@ void BasicManager::LegacyDeleteBasicMana
- _rpManager = NULL;
- }
-
-+
-+bool BasicManager::HasExeCode( const String& sLib )
-+{
-+ StarBASIC* pLib = GetLib(sLib);
-+ if ( pLib )
-+ {
-+ SbxArray* pMods = pLib->GetModules();
-+ USHORT nMods = pMods ? pMods->Count() : 0;
-+ for( USHORT i = 0; i < nMods; i++ )
-+ {
-+ SbModule* p = (SbModule*) pMods->Get( i );
-+ if ( p )
-+ if ( p->HasExeCode() )
-+ return true;
-+ }
-+ }
-+ return false;
-+}
-+
- void BasicManager::Init()
- {
- DBG_CHKTHIS( BasicManager, 0 );
---- basic/source/classes/sbxmod.cxx.old 2009-04-06 16:41:58.000000000 +0000
-+++ basic/source/classes/sbxmod.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -1124,6 +1124,48 @@ BOOL SbModule::ExceedsLegacyModuleSize()
- return false;
- }
-
-+class ErrorHdlResetter
-+{
-+ Link mErrHandler;
-+ bool mbError;
-+ public:
-+ ErrorHdlResetter() : mbError( false )
-+ {
-+ // save error handler
-+ mErrHandler = StarBASIC::GetGlobalErrorHdl();
-+ // set new error handler
-+ StarBASIC::SetGlobalErrorHdl( LINK( this, ErrorHdlResetter, BasicErrorHdl ) );
-+ }
-+ ~ErrorHdlResetter()
-+ {
-+ // restore error handler
-+ StarBASIC::SetGlobalErrorHdl(mErrHandler);
-+ }
-+ DECL_LINK( BasicErrorHdl, StarBASIC * );
-+ bool HasError() { return mbError; }
-+};
-+IMPL_LINK( ErrorHdlResetter, BasicErrorHdl, StarBASIC *, /*pBasic*/)
-+{
-+ mbError = true;
-+ return 0;
-+}
-+
-+bool SbModule::HasExeCode()
-+{
-+
-+ ErrorHdlResetter aGblErrHdl;
-+ // And empty Image always has the Global Chain set up
-+ static const unsigned char pEmptyImage[] = { 0x45, 0x0 , 0x0, 0x0, 0x0 };
-+ // lets be stricter for the moment than VBA
-+
-+ bool bRes = false;
-+ if ( !IsCompiled() )
-+ Compile();
-+ if ( pImage && !( pImage->GetCodeSize() == 5 && ( memcmp( pImage->GetCode(), pEmptyImage, pImage->GetCodeSize() ) == 0 ) )
-+ || aGblErrHdl.HasError() )
-+ bRes = true;
-+ return bRes;
-+}
-
- // Store only image, no source
- BOOL SbModule::StoreBinaryData( SvStream& rStrm )
---- basic/source/inc/dlgcont.hxx.old 2009-04-02 10:49:15.000000000 +0000
-+++ basic/source/inc/dlgcont.hxx 2009-04-06 16:41:59.000000000 +0000
-@@ -96,7 +96,9 @@ public:
- throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
- throw (::com::sun::star::uno::RuntimeException);
--
-+ // XLibraryQueryExecutable
-+ virtual sal_Bool SAL_CALL HasExecutableCode(const rtl::OUString&)
-+ throw (::com::sun::star::uno::RuntimeException);
- // Service
- static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static();
- static ::rtl::OUString getImplementationName_static();
---- basic/source/inc/namecont.hxx.old 2009-04-02 10:49:15.000000000 +0000
-+++ basic/source/inc/namecont.hxx 2009-04-06 16:41:59.000000000 +0000
-@@ -38,6 +38,7 @@
- #include <com/sun/star/script/XStorageBasedLibraryContainer.hpp>
- #include <com/sun/star/script/XLibraryContainerPassword.hpp>
- #include <com/sun/star/script/XLibraryContainerExport.hpp>
-+#include <com/sun/star/script/XLibraryQueryExecutable.hpp>
- #include <com/sun/star/container/XNameContainer.hpp>
- #include <com/sun/star/container/XContainer.hpp>
- #include <com/sun/star/ucb/XSimpleFileAccess.hpp>
-@@ -61,6 +62,7 @@
-
- #include <cppuhelper/implbase2.hxx>
- #include <cppuhelper/compbase6.hxx>
-+#include <cppuhelper/compbase7.hxx>
- #include <cppuhelper/interfacecontainer.hxx>
-
- class BasicManager;
-@@ -68,12 +70,13 @@ class BasicManager;
- namespace basic
- {
-
--typedef ::cppu::WeakComponentImplHelper6<
-+typedef ::cppu::WeakComponentImplHelper7<
- ::com::sun::star::lang::XInitialization,
- ::com::sun::star::script::XStorageBasedLibraryContainer,
- ::com::sun::star::script::XLibraryContainerPassword,
- ::com::sun::star::script::XLibraryContainerExport,
- ::com::sun::star::container::XContainer,
-+ ::com::sun::star::script::XLibraryQueryExecutable,
- ::com::sun::star::lang::XServiceInfo > LibraryContainerHelper;
-
- typedef ::cppu::WeakImplHelper2< ::com::sun::star::container::XNameContainer,
---- basic/source/inc/scriptcont.hxx.old 2009-04-02 10:49:15.000000000 +0000
-+++ basic/source/inc/scriptcont.hxx 2009-04-06 16:41:59.000000000 +0000
-@@ -120,7 +120,9 @@ public:
- throw (::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::container::NoSuchElementException,
- ::com::sun::star::uno::RuntimeException);
--
-+ // XLibraryQueryExecutable
-+ virtual sal_Bool SAL_CALL HasExecutableCode(const rtl::OUString&)
-+ throw (::com::sun::star::uno::RuntimeException);
- // Methods XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName( )
- throw (::com::sun::star::uno::RuntimeException);
---- basic/source/uno/dlgcont.cxx.old 2009-04-02 10:49:15.000000000 +0000
-+++ basic/source/uno/dlgcont.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -484,7 +484,11 @@ void SfxDialogLibraryContainer::onNewRoo
- }
- }
-
--
-+sal_Bool SAL_CALL
-+SfxDialogLibraryContainer:: HasExecutableCode( const ::rtl::OUString& Library ) throw (uno::RuntimeException)
-+{
-+ return sal_False; // dialog library has no executable code
-+}
- //============================================================================
- // Service
-
---- basic/source/uno/scriptcont.cxx.old 2009-04-02 10:49:15.000000000 +0000
-+++ basic/source/uno/scriptcont.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -67,7 +67,8 @@
- #include <xmlscript/xmlmod_imexp.hxx>
- #include <cppuhelper/factory.hxx>
- #include <com/sun/star/util/VetoException.hpp>
--
-+#include <com/sun/star/script/XLibraryQueryExecutable.hpp>
-+#include <cppuhelper/implbase1.hxx>
- namespace basic
- {
-
-@@ -138,7 +139,6 @@ sal_Bool SfxScriptLibraryContainer::hasL
- return pImplLib->mbPasswordProtected;
- }
-
--
- // Ctor for service
- SfxScriptLibraryContainer::SfxScriptLibraryContainer( void )
- :maScriptLanguage( RTL_CONSTASCII_USTRINGPARAM( "StarBasic" ) )
-@@ -1050,6 +1050,17 @@ void SfxScriptLibraryContainer::onNewRoo
- {
- }
-
-+sal_Bool SAL_CALL
-+SfxScriptLibraryContainer:: HasExecutableCode( const ::rtl::OUString& Library ) throw (uno::RuntimeException)
-+{
-+ BasicManager* pBasicMgr = getBasicManager();
-+ OSL_ENSURE( pBasicMgr, "we need a basicmanager, really we do" );
-+ if ( pBasicMgr )
-+ return pBasicMgr->HasExeCode( Library ); // need to change this to take name
-+ // default to it has code if we can't decide
-+ return sal_True;
-+}
-+
- //============================================================================
- // Service
- void createRegistryInfo_SfxScriptLibraryContainer()
---- offapi/com/sun/star/script/XLibraryQueryExecutable.idl.old 1970-01-01 00:00:00.000000000 +0000
-+++ offapi/com/sun/star/script/XLibraryQueryExecutable.idl 2009-04-06 16:41:59.000000000 +0000
-@@ -0,0 +1,51 @@
-+/*************************************************************************
-+ *
-+ * 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: XLibraryContainer.idl,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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __com_sun_star_script_XLibraryQueryExecutable_idl__
-+#define __com_sun_star_script_XLibraryQueryExecutable_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+//=============================================================================
-+
-+module com { module sun { module star { module script {
-+
-+interface XLibraryQueryExecutable: com::sun::star::uno::XInterface
-+{
-+ boolean HasExecutableCode( [in] string name );
-+};
-+
-+//=============================================================================
-+
-+
-+}; }; }; };
-+
-+#endif
---- offapi/com/sun/star/script/makefile.mk.old 2009-04-02 10:51:40.000000000 +0000
-+++ offapi/com/sun/star/script/makefile.mk 2009-04-06 16:41:59.000000000 +0000
-@@ -51,6 +51,7 @@ IDLFILES=\
- XLibraryContainerExport.idl\
- XPersistentLibraryContainer.idl\
- XStorageBasedLibraryContainer.idl\
-+ XLibraryQueryExecutable.idl \
- ModuleSizeExceededRequest.idl\
-
- # ------------------------------------------------------------------
---- sfx2/source/doc/docmacromode.cxx.old 2009-04-02 10:43:58.000000000 +0000
-+++ sfx2/source/doc/docmacromode.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -40,6 +40,7 @@
- #include <com/sun/star/task/DocumentMacroConfirmationRequest.hpp>
- #include <com/sun/star/task/InteractionClassification.hpp>
- #include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
-+#include <com/sun/star/script/XLibraryQueryExecutable.hpp>
- /** === end UNO includes === **/
-
- #include <comphelper/componentcontext.hxx>
-@@ -75,8 +76,10 @@ namespace sfx2
- using ::com::sun::star::document::XEmbeddedScripts;
- using ::com::sun::star::uno::UNO_SET_THROW;
- using ::com::sun::star::script::XLibraryContainer;
-+ using ::com::sun::star::script::XLibraryQueryExecutable;
- using ::com::sun::star::container::XNameAccess;
- using ::com::sun::star::uno::UNO_QUERY_THROW;
-+ using ::com::sun::star::uno::UNO_QUERY;
- /** === end UNO using === **/
- namespace MacroExecMode = ::com::sun::star::document::MacroExecMode;
-
-@@ -438,11 +441,9 @@ namespace sfx2
- // rid of the "Standard" thingie - this shouldn't be necessary
- // anymore, should it?
- // 2007-01-25 / frank.schoenheit@sun.com
-- Reference < XNameAccess > xLib;
-- Any aAny = xContainer->getByName( aStdLibName );
-- aAny >>= xLib;
-+ Reference < XLibraryQueryExecutable > xLib( xContainer, UNO_QUERY );
- if ( xLib.is() )
-- bHasMacroLib = xLib->hasElements();
-+ bHasMacroLib = xLib->HasExecutableCode( aStdLibName );
- }
- }
- }
diff --git a/patches/vba/vba-combobox-listindex-fix.diff b/patches/vba/vba-combobox-listindex-fix.diff
deleted file mode 100644
index f8270a7cd..000000000
--- a/patches/vba/vba-combobox-listindex-fix.diff
+++ /dev/null
@@ -1,68 +0,0 @@
-diff --git vbahelper/source/msforms/vbacombobox.cxx vbahelper/source/msforms/vbacombobox.cxx
-index 7c27734..c4146f7 100644
---- vbahelper/source/msforms/vbacombobox.cxx
-+++ vbahelper/source/msforms/vbacombobox.cxx
-@@ -29,6 +29,9 @@
- ************************************************************************/
- #include "vbacombobox.hxx"
- #include <vector>
-+#include <svx/msvbahelper.hxx>
-+#include <basic/sbstar.hxx>
-+#include <basic/sbmod.hxx>
-
- using namespace com::sun::star;
- using namespace ooo::vba;
-@@ -66,12 +69,41 @@ ScVbaComboBox::setListIndex( const uno::Any& _value ) throw (uno::RuntimeExcepti
- sal_Int16 nIndex = 0;
- if( _value >>= nIndex )
- {
-+ sal_Int32 nOldIndex = -1;
-+ getListIndex() >>= nOldIndex;
- uno::Sequence< rtl::OUString > sItems;
- m_xProps->getPropertyValue( ITEMS ) >>= sItems;
- if( ( nIndex >= 0 ) && ( sItems.getLength() > nIndex ) )
- {
- rtl::OUString sText = sItems[ nIndex ];
- m_xProps->setPropertyValue( TEXT, uno::makeAny( sText ) );
-+
-+ // fire the _Change event
-+ if( nOldIndex != nIndex )
-+ {
-+ rtl::OUString sControlName = getName();
-+ // get active module
-+ SbModule* pModule = StarBASIC::GetActiveModule();
-+ StarBASIC* pLib = pModule ? dynamic_cast< StarBASIC* >( pModule->GetParent() ) : NULL;
-+ if( pModule && pLib )
-+ {
-+ rtl::OUString sMacroName = pModule->GetParent()->GetName();
-+ rtl::OUString sModuleName = pModule->GetName();
-+ sMacroName = sMacroName.concat( rtl::OUString::createFromAscii(".") ).concat( sModuleName ).concat( rtl::OUString::createFromAscii(".") ).concat( sControlName ).concat( rtl::OUString::createFromAscii("_Change") );
-+ OSL_TRACE("ScVbaComboBox::setListIndex, fire the event %s",
-+ rtl::OUStringToOString( sMacroName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ //static const rtl::OUString sThisComponent( RTL_CONSTASCII_USTRINGPARAM("ThisComponent" ) );
-+ //uno::Reference< frame::XModel > xModel = getCurrentDoc( sThisComponent );
-+ VBAMacroResolvedInfo aMacroInfo = resolveVBAMacro( getSfxObjShell( m_xModel ), sMacroName );
-+ if( aMacroInfo.IsResolved() )
-+ {
-+ uno::Sequence< uno::Any > aArgs;
-+ uno::Any aRet;
-+ uno::Any aDummyCaller;
-+ executeMacro( aMacroInfo.MacroDocContext(), aMacroInfo.ResolvedMacro(), aArgs, aRet, aDummyCaller );
-+ }
-+ }
-+ }
- }
- }
- }
-diff --git vbahelper/util/makefile.mk vbahelper/util/makefile.mk
-index 796af0a..9180676 100644
---- vbahelper/util/makefile.mk
-+++ vbahelper/util/makefile.mk
-@@ -95,6 +95,7 @@ SHL2STDLIBS= \
- $(VCLLIB) \
- $(TKLIB) \
- $(BASICLIB) \
-+ $(SVXMSFILTERLIB) \
-
- SHL2DEPN=$(SHL1TARGETN)
- SHL2LIBS=$(SLB)$/$(TARGET_MSFORMS).lib
diff --git a/patches/vba/vba-combobox-rowsource-fix.diff b/patches/vba/vba-combobox-rowsource-fix.diff
deleted file mode 100644
index 89ca3b063..000000000
--- a/patches/vba/vba-combobox-rowsource-fix.diff
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git svx/source/msfilter/msocximex.cxx svx/source/msfilter/msocximex.cxx
-index f1e9ff3..c7b1082 100644
---- svx/source/msfilter/msocximex.cxx
-+++ svx/source/msfilter/msocximex.cxx
-@@ -2677,6 +2677,8 @@ sal_Bool OCX_ComboBox::Import(com::sun::star::uno::Reference<
- rPropSet->setPropertyValue( WW8_ASCII2STR("MaxTextLen"), aTmp);
-
- aFontData.Import(rPropSet);
-+ uno::Reference< frame::XModel > xModel ( pDocSh ? pDocSh->GetModel() : NULL );
-+ lcl_ApplyListSourceAndBindableStuff( xModel, rPropSet, msCtrlSource, msRowSource );
- return sal_True;
- }
-
diff --git a/patches/vba/vba-commandbar-document-scope.diff b/patches/vba/vba-commandbar-document-scope.diff
deleted file mode 100644
index 5ed8e8789..000000000
--- a/patches/vba/vba-commandbar-document-scope.diff
+++ /dev/null
@@ -1,252 +0,0 @@
-diff --git vbahelper/source/vbahelper/vbacommandbar.cxx vbahelper/source/vbahelper/vbacommandbar.cxx
-index 8c10277..63af635 100644
---- vbahelper/source/vbahelper/vbacommandbar.cxx
-+++ vbahelper/source/vbahelper/vbacommandbar.cxx
-@@ -61,7 +61,7 @@ ScVbaCommandBar::getName() throw ( uno::RuntimeException )
- {
- if( m_bIsMenu )
- {
-- if( m_sResourceUrl.equals( VbaCommandBarHelper::getMenuBarUrl() ) )
-+ if( m_sResourceUrl.equalsAscii( ITEM_MENUBAR_URL ) )
- {
- if( pCBarHelper->getModuleId().equalsAscii("com.sun.star.sheet.SpreadsheetDocument") )
- sName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Worksheet Menu Bar") );
-@@ -87,18 +87,7 @@ ScVbaCommandBar::setName( const ::rtl::OUString& _name ) throw (uno::RuntimeExce
- uno::Reference< beans::XPropertySet > xPropertySet( m_xBarSettings, uno::UNO_QUERY_THROW );
- xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("UIName"), uno::makeAny( _name ) );
-
-- if( pCBarHelper->getAppCfgManager()->hasSettings( m_sResourceUrl ) )
-- {
-- pCBarHelper->getAppCfgManager()->replaceSettings( m_sResourceUrl, m_xBarSettings );
-- }
-- else
-- {
-- pCBarHelper->getAppCfgManager()->insertSettings( m_sResourceUrl, m_xBarSettings );
-- }
-- if( !m_bTemporary )
-- {
-- pCBarHelper->persistChanges();
-- }
-+ pCBarHelper->ApplyChange( m_sResourceUrl, m_xBarSettings );
- }
- ::sal_Bool SAL_CALL
- ScVbaCommandBar::getVisible() throw (uno::RuntimeException)
-@@ -163,20 +152,7 @@ ScVbaCommandBar::setEnabled( sal_Bool _enabled ) throw (uno::RuntimeException)
- void SAL_CALL
- ScVbaCommandBar::Delete( ) throw (script::BasicErrorException, uno::RuntimeException)
- {
-- if( pCBarHelper->getAppCfgManager()->hasSettings( m_sResourceUrl ) )
-- {
-- pCBarHelper->getAppCfgManager()->removeSettings(m_sResourceUrl);
-- // make it permanent
-- if( !m_bTemporary )
-- {
-- pCBarHelper->persistChanges();
-- }
-- }
-- else
-- {
-- // toolbar not found
-- // TODO throw Error
-- }
-+ pCBarHelper->removeSettings( m_sResourceUrl );
- uno::Reference< container::XNameContainer > xNameContainer( pCBarHelper->getPersistentWindowState(), uno::UNO_QUERY_THROW );
- if( xNameContainer->hasByName( m_sResourceUrl ) )
- {
-diff --git vbahelper/source/vbahelper/vbacommandbarcontrol.cxx vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
-index 050af79..f6eb381 100644
---- vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
-+++ vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
-@@ -53,9 +53,7 @@ void ScVbaCommandBarControl::ApplyChange() throw ( uno::RuntimeException )
- {
- uno::Reference< container::XIndexContainer > xIndexContainer( m_xCurrentSettings, uno::UNO_QUERY_THROW );
- xIndexContainer->replaceByIndex( m_nPosition, uno::makeAny( m_aPropertyValues ) );
-- pCBarHelper->getAppCfgManager()->replaceSettings( m_sResourceUrl, m_xBarSettings );
-- if( !m_bTemporary )
-- pCBarHelper->persistChanges();
-+ pCBarHelper->ApplyChange( m_sResourceUrl, m_xBarSettings );
- }
-
- ::rtl::OUString SAL_CALL
-@@ -159,19 +157,7 @@ ScVbaCommandBarControl::Delete( ) throw (script::BasicErrorException, uno::Runt
- uno::Reference< container::XIndexContainer > xIndexContainer( m_xCurrentSettings, uno::UNO_QUERY_THROW );
- xIndexContainer->removeByIndex( m_nPosition );
-
-- if( pCBarHelper->getAppCfgManager()->hasSettings( m_sResourceUrl ) )
-- {
-- pCBarHelper->getAppCfgManager()->replaceSettings( m_sResourceUrl, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
-- }
-- else
-- {
-- pCBarHelper->getAppCfgManager()->insertSettings( m_sResourceUrl, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
-- }
-- // make it permanent
-- if( !m_bTemporary )
-- {
-- pCBarHelper->persistChanges();
-- }
-+ pCBarHelper->ApplyChange( m_sResourceUrl, m_xBarSettings );
- }
- }
-
-diff --git vbahelper/source/vbahelper/vbacommandbarcontrols.cxx vbahelper/source/vbahelper/vbacommandbarcontrols.cxx
-index 488b56a..1aa7d7e 100644
---- vbahelper/source/vbahelper/vbacommandbarcontrols.cxx
-+++ vbahelper/source/vbahelper/vbacommandbarcontrols.cxx
-@@ -223,9 +223,7 @@ ScVbaCommandBarControls::Add( const uno::Any& Type, const uno::Any& Id, const un
- uno::Reference< container::XIndexContainer > xIndexContainer( m_xIndexAccess, uno::UNO_QUERY_THROW );
- xIndexContainer->insertByIndex( nPosition, uno::makeAny( aProps ) );
-
-- pCBarHelper->getAppCfgManager()->replaceSettings( m_sResourceUrl, m_xBarSettings );
-- if( !bTemporary )
-- pCBarHelper->persistChanges();
-+ pCBarHelper->ApplyChange( m_sResourceUrl, m_xBarSettings );
-
- // sometimes it would crash if passing m_xMenu instead of uno::Reference< awt::XMenu >() in Linux.
- ScVbaCommandBarControl* pNewCommandBarControl = NULL;
-diff --git vbahelper/source/vbahelper/vbacommandbarhelper.cxx vbahelper/source/vbahelper/vbacommandbarhelper.cxx
-index 034e506..3cf12f6 100644
---- vbahelper/source/vbahelper/vbacommandbarhelper.cxx
-+++ vbahelper/source/vbahelper/vbacommandbarhelper.cxx
-@@ -138,14 +138,48 @@ void VbaCommandBarHelper::Init( ) throw (css::uno::RuntimeException)
- m_xWindowState.set( xNameAccess->getByName( maModuleId ), uno::UNO_QUERY_THROW );
- }
-
--css::uno::Reference< css::container::XIndexAccess > VbaCommandBarHelper::getMenuBarSettings() throw (css::uno::RuntimeException)
-+css::uno::Reference< css::container::XIndexAccess > VbaCommandBarHelper::getSettings( const rtl::OUString& sResourceUrl ) throw (css::uno::RuntimeException)
- {
-- return m_xAppCfgMgr->getSettings( getMenuBarUrl(), sal_True );
-+ if( m_xDocCfgMgr->hasSettings( sResourceUrl ) )
-+ return m_xDocCfgMgr->getSettings( sResourceUrl, sal_True );
-+ else if( m_xAppCfgMgr->hasSettings( sResourceUrl ) )
-+ return m_xAppCfgMgr->getSettings( sResourceUrl, sal_True );
-+ else
-+ {
-+ css::uno::Reference< css::container::XIndexAccess > xSettings( m_xAppCfgMgr->createSettings( ), uno::UNO_QUERY_THROW );
-+ return xSettings;
-+ }
-+}
-+
-+void VbaCommandBarHelper::removeSettings( const rtl::OUString& sResourceUrl ) throw (css::uno::RuntimeException)
-+{
-+ if( m_xDocCfgMgr->hasSettings( sResourceUrl ) )
-+ m_xDocCfgMgr->removeSettings( sResourceUrl );
-+ else if( m_xAppCfgMgr->hasSettings( sResourceUrl ) )
-+ m_xAppCfgMgr->removeSettings( sResourceUrl );
-+
-+ // persistChanges();
-+}
-+
-+void VbaCommandBarHelper::ApplyChange( const rtl::OUString& sResourceUrl, const css::uno::Reference< css::container::XIndexAccess >& xSettings, sal_Bool bTemporary ) throw (css::uno::RuntimeException)
-+{
-+ if( m_xDocCfgMgr->hasSettings( sResourceUrl ) )
-+ {
-+ m_xDocCfgMgr->replaceSettings( sResourceUrl, xSettings );
-+ }
-+ else
-+ {
-+ m_xDocCfgMgr->insertSettings( sResourceUrl, xSettings );
-+ }
-+ if( !bTemporary )
-+ {
-+ persistChanges();
-+ }
- }
-
- sal_Bool VbaCommandBarHelper::persistChanges() throw (css::uno::RuntimeException)
- {
-- uno::Reference< css::ui::XUIConfigurationPersistence > xConfigPersistence( m_xAppCfgMgr, uno::UNO_QUERY_THROW );
-+ uno::Reference< css::ui::XUIConfigurationPersistence > xConfigPersistence( m_xDocCfgMgr, uno::UNO_QUERY_THROW );
- sal_Bool result = sal_False;
- if( xConfigPersistence->isModified() )
- {
-@@ -163,12 +197,6 @@ uno::Reference< frame::XLayoutManager > VbaCommandBarHelper::getLayoutManager()
- return xLayoutManager;
- }
-
--rtl::OUString VbaCommandBarHelper::getMenuBarUrl()
--{
-- static const rtl::OUString sMenuBarUrl( RTL_CONSTASCII_USTRINGPARAM( ITEM_MENUBAR_URL ) );
-- return sMenuBarUrl;
--}
--
- // return the resource url if found
- rtl::OUString VbaCommandBarHelper::findToolbarByName( const css::uno::Reference< css::container::XNameAccess >& xNameAccess, const rtl::OUString& sName ) throw (css::uno::RuntimeException)
- {
-@@ -187,9 +215,9 @@ rtl::OUString VbaCommandBarHelper::findToolbarByName( const css::uno::Reference<
- if(sResourceUrl.indexOf( rtl::OUString::createFromAscii( ITEM_TOOLBAR_URL ) ) == 0 )
- {
- //OSL_TRACE("VbaCommandBarHelper::findToolbarByName, toolbar resource url: %s", rtl::OUStringToOString( sResourceUrl, RTL_TEXTENCODING_UTF8 ).getStr() );
-- if( m_xAppCfgMgr->hasSettings( sResourceUrl ) )
-+ if( m_xDocCfgMgr->hasSettings( sResourceUrl ) )
- {
-- uno::Reference< beans::XPropertySet > xPropertySet( m_xAppCfgMgr->getSettings( sResourceUrl, sal_False ), uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xPropertySet( m_xDocCfgMgr->getSettings( sResourceUrl, sal_False ), uno::UNO_QUERY_THROW );
- xPropertySet->getPropertyValue( rtl::OUString::createFromAscii(ITEM_DESCRIPTOR_UINAME) ) >>= sUIName;
- // OSL_TRACE("VbaCommandBarHelper::findToolbarByName, toolbar ui name: %s", rtl::OUStringToOString( sUIName, RTL_TEXTENCODING_UTF8 ).getStr() );
- if( sName.equalsIgnoreAsciiCase( sUIName ) )
-diff --git vbahelper/source/vbahelper/vbacommandbarhelper.hxx vbahelper/source/vbahelper/vbacommandbarhelper.hxx
-index 64a808d..10ed441 100644
---- vbahelper/source/vbahelper/vbacommandbarhelper.hxx
-+++ vbahelper/source/vbahelper/vbacommandbarhelper.hxx
-@@ -89,17 +89,18 @@ public:
- {
- return m_xAppCfgMgr;
- }
-- css::uno::Reference< css::container::XIndexAccess > getMenuBarSettings() throw (css::uno::RuntimeException);
- css::uno::Reference< css::container::XNameAccess > getPersistentWindowState() throw (css::uno::RuntimeException)
- {
- return m_xWindowState;
- }
- sal_Bool persistChanges() throw (css::uno::RuntimeException);
-+ css::uno::Reference< css::container::XIndexAccess > getSettings( const rtl::OUString& sResourceUrl ) throw (css::uno::RuntimeException);
-+ void removeSettings( const rtl::OUString& sResourceUrl ) throw (css::uno::RuntimeException);
-+ void ApplyChange( const rtl::OUString& sResourceUrl, const css::uno::Reference< css::container::XIndexAccess >& xSettings, sal_Bool bTemporary = sal_True ) throw (css::uno::RuntimeException);
-
- css::uno::Reference< css::frame::XLayoutManager > getLayoutManager() throw (css::uno::RuntimeException);
-
- const rtl::OUString getModuleId(){ return maModuleId; }
-- static rtl::OUString getMenuBarUrl();
- rtl::OUString findToolbarByName( const css::uno::Reference< css::container::XNameAccess >& xNameAccess, const rtl::OUString& sName ) throw (css::uno::RuntimeException);
- static sal_Int32 findControlByName( const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess, const rtl::OUString& sName ) throw (css::uno::RuntimeException);
- static rtl::OUString generateCustomURL();
-diff --git vbahelper/source/vbahelper/vbacommandbars.cxx vbahelper/source/vbahelper/vbacommandbars.cxx
-index 0f7881e..e87e4a3 100644
---- vbahelper/source/vbahelper/vbacommandbars.cxx
-+++ vbahelper/source/vbahelper/vbacommandbars.cxx
-@@ -76,7 +76,7 @@ public:
- rtl::OUString sResourceUrl( m_sNames[ m_nCurrentPosition++ ] );
- if( sResourceUrl.indexOf( rtl::OUString::createFromAscii("private:resource/toolbar/") ) != -1 )
- {
-- uno::Reference< container::XIndexAccess > xCBarSetting = pCBarHelper->getAppCfgManager()->getSettings( sResourceUrl, sal_True );
-+ uno::Reference< container::XIndexAccess > xCBarSetting = pCBarHelper->getSettings( sResourceUrl );
- uno::Reference< XCommandBar > xCommandBar( new ScVbaCommandBar( m_xParent, m_xContext, pCBarHelper, xCBarSetting, sResourceUrl, sal_False, sal_False ) );
- }
- else
-@@ -125,7 +125,7 @@ ScVbaCommandBars::createCollectionObject( const uno::Any& aSource )
- || sBarName.equalsIgnoreAsciiCase( rtl::OUString::createFromAscii("Menu Bar") ) )
- {
- // menu bar
-- sResourceUrl = pCBarHelper->getMenuBarUrl();
-+ sResourceUrl = rtl::OUString::createFromAscii( ITEM_MENUBAR_URL );
- bMenu = sal_True;
- }
- else
-@@ -136,7 +136,7 @@ ScVbaCommandBars::createCollectionObject( const uno::Any& aSource )
- }
-
- if( sResourceUrl.getLength() )
-- xBarSettings = pCBarHelper->getAppCfgManager()->getSettings( sResourceUrl, sal_True );
-+ xBarSettings = pCBarHelper->getSettings( sResourceUrl );
- else
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Toolbar do not exist") ), uno::Reference< uno::XInterface >() );
-
-@@ -171,7 +171,7 @@ ScVbaCommandBars::Add( const css::uno::Any& Name, const css::uno::Any& /*Positio
- Temporary >>= bTemporary;
-
- sResourceUrl = VbaCommandBarHelper::generateCustomURL();
-- uno::Reference< container::XIndexAccess > xBarSettings( pCBarHelper->getAppCfgManager()->createSettings(), uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xBarSettings( pCBarHelper->getSettings( sResourceUrl ), uno::UNO_QUERY_THROW );
- uno::Reference< XCommandBar > xCBar( new ScVbaCommandBar( this, mxContext, pCBarHelper, xBarSettings, sResourceUrl, sal_False, bTemporary ) );
- xCBar->setName( sName );
- return xCBar;
diff --git a/patches/vba/vba-commandbar-enabled.diff b/patches/vba/vba-commandbar-enabled.diff
deleted file mode 100644
index 7eb582a17..000000000
--- a/patches/vba/vba-commandbar-enabled.diff
+++ /dev/null
@@ -1,52 +0,0 @@
-diff --git oovbaapi/ooo/vba/XCommandBar.idl oovbaapi/ooo/vba/XCommandBar.idl
-index 5e27c6b..13d54da 100644
---- oovbaapi/ooo/vba/XCommandBar.idl
-+++ oovbaapi/ooo/vba/XCommandBar.idl
-@@ -54,6 +54,7 @@ interface XCommandBar
-
- [attribute] string Name;
- [attribute] boolean Visible;
-+ [attribute] boolean Enabled;
-
- void Delete() raises ( com::sun::star::script::BasicErrorException );
- any Controls( [in] any Index ) raises ( com::sun::star::script::BasicErrorException );
-diff --git vbahelper/source/vbahelper/vbacommandbar.cxx vbahelper/source/vbahelper/vbacommandbar.cxx
-index 55ba7b6..ba9f49b 100644
---- vbahelper/source/vbahelper/vbacommandbar.cxx
-+++ vbahelper/source/vbahelper/vbacommandbar.cxx
-@@ -267,6 +267,22 @@ ScVbaCommandBar::setVisible( ::sal_Bool _visible ) throw (uno::RuntimeException)
- OSL_TRACE( "SetVisible get an exception\n" );
- }
- }
-+
-+::sal_Bool SAL_CALL
-+ScVbaCommandBar::getEnabled() throw (uno::RuntimeException)
-+{
-+ // #FIXME: seems tha main menu is alwayse enabled.
-+ // for the toolbar, need to investigate
-+ return sal_True;
-+}
-+
-+void SAL_CALL
-+ScVbaCommandBar::setEnabled( sal_Bool/* _enabled */ ) throw (uno::RuntimeException)
-+{
-+ // #FIXME: seems tha main menu is alwayse enabled.
-+ // for the toolbar, need to investigate
-+}
-+
- void SAL_CALL
- ScVbaCommandBar::Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
- {
-diff --git vbahelper/source/vbahelper/vbacommandbar.hxx vbahelper/source/vbahelper/vbacommandbar.hxx
-index 0b830b2..c53a5cd 100644
---- vbahelper/source/vbahelper/vbacommandbar.hxx
-+++ vbahelper/source/vbahelper/vbacommandbar.hxx
-@@ -93,6 +93,8 @@ public:
- 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);
-+ virtual ::sal_Bool SAL_CALL getEnabled() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setEnabled( ::sal_Bool _enabled ) throw (css::uno::RuntimeException);
-
- // Methods
- virtual void SAL_CALL Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
diff --git a/patches/vba/vba-commandbar-fix.diff b/patches/vba/vba-commandbar-fix.diff
deleted file mode 100644
index 3b4ade591..000000000
--- a/patches/vba/vba-commandbar-fix.diff
+++ /dev/null
@@ -1,654 +0,0 @@
---- oovbaapi/ooo/vba/XCommandBar.idl.old 2009-04-02 10:36:29.000000000 +0000
-+++ oovbaapi/ooo/vba/XCommandBar.idl 2009-04-06 16:42:00.000000000 +0000
-@@ -57,6 +57,8 @@ interface XCommandBar
-
- void Delete() raises ( com::sun::star::script::BasicErrorException );
- any Controls( [in] any Index ) raises ( com::sun::star::script::BasicErrorException );
-+ long Type() raises ( com::sun::star::script::BasicErrorException );
-+ any FindControl( [in] any Type, [in] any Id, [in] any Tag, [in] any Visible, [in] any Recursive ) raises ( com::sun::star::script::BasicErrorException );
- };
-
- }; };
---- oovbaapi/ooo/vba/XCommandBarButton.idl.old 1970-01-01 00:00:00.000000000 +0000
-+++ oovbaapi/ooo/vba/XCommandBarButton.idl 2009-04-06 16:42:00.000000000 +0000
-@@ -0,0 +1,52 @@
-+/*************************************************************************
-+ *
-+ * 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 __ooo_vba_XCommandBarButton_idl__
-+#define __ooo_vba_XCommandBarButton_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+//=============================================================================
-+
-+module ooo { module vba {
-+//=============================================================================
-+
-+interface XCommandBarButton: com::sun::star::uno::XInterface
-+{
-+};
-+
-+}; };
-+
-+#endif
---- oovbaapi/ooo/vba/XCommandBarPopup.idl.old 1970-01-01 00:00:00.000000000 +0000
-+++ oovbaapi/ooo/vba/XCommandBarPopup.idl 2009-04-06 16:42:00.000000000 +0000
-@@ -0,0 +1,52 @@
-+/*************************************************************************
-+ *
-+ * 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 __ooo_vba_XCommandBarPopup_idl__
-+#define __ooo_vba_XCommandBarPopup_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+//=============================================================================
-+
-+module ooo { module vba {
-+//=============================================================================
-+
-+interface XCommandBarPopup: com::sun::star::uno::XInterface
-+{
-+};
-+
-+}; };
-+
-+#endif
---- oovbaapi/ooo/vba/makefile.mk.old 2009-04-06 16:41:59.000000000 +0000
-+++ oovbaapi/ooo/vba/makefile.mk 2009-04-06 16:42:00.000000000 +0000
-@@ -52,6 +52,8 @@ IDLFILES=\
- XCommandBarControls.idl\
- XCommandBar.idl\
- XCommandBars.idl\
-+ XCommandBarPopup.idl\
-+ XCommandBarButton.idl\
- Globals.idl\
-
- # ------------------------------------------------------------------
---- sc/source/ui/vba/vbacommandbar.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbacommandbar.cxx 2009-04-06 16:42:00.000000000 +0000
-@@ -37,6 +37,7 @@
- #include <com/sun/star/frame/XDesktop.hpp>
- #include <com/sun/star/frame/XLayoutManager.hpp>
- #include <com/sun/star/beans/XPropertySet.hpp>
-+#include <ooo/vba/office/MsoBarType.hpp>
-
- #include "vbacommandbar.hxx"
- #include "vbacommandbarcontrols.hxx"
-@@ -99,7 +100,7 @@ ScVbaCommandBar::initCommandBar() throw
- m_bTemporary = sal_True;
- m_sToolBarName = rtl::OUString::createFromAscii("");
- m_sUIName = rtl::OUString::createFromAscii("");
-- m_sMenuModuleName = rtl::OUString::createFromAscii( "com.sun.star.sheet.SpreadsheetDocument" );
-+ m_sMenuModuleName = m_pScVbaCommandBars->GetModuleName();
- }
- void
- ScVbaCommandBar::getToolBarSettings( rtl::OUString sToolBarName ) throw( uno::RuntimeException )
-@@ -310,6 +311,23 @@ ScVbaCommandBar::Controls( const uno::An
- }
- return uno::makeAny( xCommandBarControls );
- }
-+
-+sal_Int32 SAL_CALL
-+ScVbaCommandBar::Type() throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ // #FIXME support msoBarTypePopup
-+ sal_Int32 nType = office::MsoBarType::msoBarTypePopup;
-+ nType = m_bIsMenu? office::MsoBarType::msoBarTypeNormal : office::MsoBarType::msoBarTypeMenuBar;
-+ return nType;
-+}
-+
-+uno::Any SAL_CALL
-+ScVbaCommandBar::FindControl( const uno::Any& /*aType*/, const uno::Any& /*aId*/, const uno::Any& /*aTag*/, const uno::Any& /*aVisible*/, const uno::Any& /*aRecursive*/ ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ // alwayse fail to find control
-+ return uno::makeAny( uno::Reference< XCommandBarControl > () );
-+}
-+
- rtl::OUString&
- ScVbaCommandBar::getServiceImplName()
- {
---- sc/source/ui/vba/vbacommandbar.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbacommandbar.hxx 2009-04-06 16:42:00.000000000 +0000
-@@ -97,6 +97,8 @@ public:
- // 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);
-+ virtual sal_Int32 SAL_CALL Type( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL FindControl( const css::uno::Any& aType, const css::uno::Any& aId, const css::uno::Any& aTag, const css::uno::Any& aVisible, const css::uno::Any& aRecursive ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
---- sc/source/ui/vba/vbacommandbarcontrol.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbacommandbarcontrol.cxx 2009-04-06 16:42:00.000000000 +0000
-@@ -33,6 +33,8 @@
- *
- ************************************************************************/
- #include "vbacommandbarcontrol.hxx"
-+#include <basic/sbstar.hxx>
-+#include <basic/sbmod.hxx>
-
- using namespace com::sun::star;
- using namespace ooo::vba;
-@@ -64,7 +66,7 @@ beans::PropertyValues lcl_repalcePropert
- 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 )
-+ScVbaCommandBarControl::ScVbaCommandBarControl( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition, sal_Int32 nType ) throw (uno::RuntimeException) : CommandBarControl_BASE( xParent, xContext ), m_sName( sName ), m_nPosition( nPosition ), m_nType( nType )
- {
- // exsiting CommandBarBarControl
- m_xParentHardRef.set( xParent, uno::UNO_QUERY_THROW );
-@@ -83,34 +85,6 @@ ScVbaCommandBarControl::ScVbaCommandBarC
- {
- 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 )
- {
-@@ -122,7 +96,7 @@ ScVbaCommandBarControl::ScVbaCommandBarC
- }
- 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 )
-+ScVbaCommandBarControl::ScVbaCommandBarControl( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition, sal_Bool bTemporary, sal_Int32 nType) throw (uno::RuntimeException) : CommandBarControl_BASE( xParent, xContext ), m_nPosition( nPosition ), m_bTemporary( bTemporary ), m_nType( nType )
- {
- m_xParentHardRef.set( xParent, uno::UNO_QUERY_THROW );
- initObjects();
-@@ -130,14 +104,7 @@ ScVbaCommandBarControl::ScVbaCommandBarC
- {
- m_sName = sName;
- }
-- if( sCommand.getLength() > 0 )
-- {
-- m_sCommand = sCommand;
-- }
-- else
-- {
-- m_sCommand = rtl::OUString::createFromAscii("vnd.openoffice.org:") + sName;
-- }
-+ m_sCommand = rtl::OUString::createFromAscii("vnd.openoffice.org:") + sName;
- if( m_bIsMenu )
- {
- m_sBarName = rtl::OUString::createFromAscii("private:resource/menubar/menubar");
-@@ -161,27 +128,32 @@ ScVbaCommandBarControl::initObjects() th
- 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);
-+ uno::Reference< lang::XSingleComponentFactory > xMenuMSF( m_xBarSettings, uno::UNO_QUERY_THROW );
-+
-+ uno::Sequence< beans::PropertyValue > aPropertys;
-+ if( m_nType == office::MsoControlType::msoControlPopup )
-+ aPropertys = uno::Sequence< beans::PropertyValue >( 4 );
-+ else
-+ aPropertys = uno::Sequence< beans::PropertyValue >( 3 );
-+
- 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");
-+ aPropertys[2].Value <<= sal_Int32(0);
-
-- 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;
-+ if( m_nType == office::MsoControlType::msoControlPopup )
-+ {
-+ aPropertys[3].Name = rtl::OUString::createFromAscii("ItemDescriptorContainer");
-+ aPropertys[3].Value <<= xMenuMSF->createInstanceWithContext( mxContext );
-+ }
-
-- uno::Reference< lang::XSingleComponentFactory > xMenuMSF( m_xBarSettings, uno::UNO_QUERY_THROW );
- if( m_pCommandBarControls->GetParentCommandBar() != NULL )
- {
- // create a new menu
-@@ -191,7 +163,6 @@ ScVbaCommandBarControl::createNewMenuBar
- 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;
-@@ -204,7 +175,7 @@ ScVbaCommandBarControl::createNewMenuBar
- 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 ) );
-+ m_xCurrentSettings->insertByIndex( m_nPosition, uno::makeAny( aPropertys ) );
- }
- if( m_xUICfgManager->hasSettings( m_sBarName ) )
- {
-@@ -229,7 +200,7 @@ ScVbaCommandBarControl::createNewToolBar
- 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[2].Value <<= sal_Int32(0);
- aPropertys[3].Name = rtl::OUString::createFromAscii("IsVisible");
- aPropertys[3].Value <<= sal_True;
-
-@@ -314,10 +285,25 @@ ScVbaCommandBarControl::setOnAction( con
- {
- if( m_xCurrentSettings.is() )
- {
-+ // convert the comand url into something like vnd.sun.star.script:Standard.testMacro.Macro1?language=Basic&location=document
-+ rtl::OUString aCommandURL;
-+ rtl::OUString sUrlPart = rtl::OUString::createFromAscii( "vnd.sun.star.script:Standard.");
-+ SbModule* pModule = StarBASIC::GetActiveModule();
-+ if( pModule && ( _onaction.indexOf( sUrlPart ) == -1 ) )
-+ {
-+ rtl::OUString sUrlPart1 = rtl::OUString::createFromAscii( "?language=Basic&location=document");
-+ aCommandURL = sUrlPart.concat( pModule->GetName() ).concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".") ) ).concat( _onaction ).concat( sUrlPart1 );
-+ }
-+ else
-+ {
-+ aCommandURL = _onaction;
-+ }
-+ OSL_TRACE(" ScVbaCommandBarControl::setOnAction: %s", rtl::OUStringToOString( aCommandURL, RTL_TEXTENCODING_UTF8 ).getStr() );
-+
- beans::PropertyValues aPropertyValues;
- m_xCurrentSettings->getByIndex( m_nPosition ) >>= aPropertyValues;
- beans::PropertyValues aNewPropertyValues;
-- aNewPropertyValues = lcl_repalcePropertyValue( aPropertyValues, rtl::OUString::createFromAscii("CommandURL"), uno::makeAny( _onaction ) );
-+ aNewPropertyValues = lcl_repalcePropertyValue( aPropertyValues, rtl::OUString::createFromAscii("CommandURL"), uno::makeAny( aCommandURL ) );
- m_xCurrentSettings->replaceByIndex( m_nPosition, uno::makeAny( aNewPropertyValues ) );
- if( m_xUICfgManager->hasSettings( m_sBarName ) )
- {
-@@ -401,3 +387,57 @@ ScVbaCommandBarControl::getServiceNames(
- }
- return aServiceNames;
- }
-+
-+//////////// ScVbaCommandBarPopup //////////////////////////////
-+ScVbaCommandBarPopup::ScVbaCommandBarPopup( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition ) throw (uno::RuntimeException) : CommandBarPopup_BASE( xParent, xContext, sName, nPosition, office::MsoControlType::msoControlPopup )
-+{
-+}
-+
-+ScVbaCommandBarPopup::ScVbaCommandBarPopup( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition, sal_Bool bTemporary ) throw (uno::RuntimeException) : CommandBarPopup_BASE( xParent, xContext, sName, nPosition, bTemporary, office::MsoControlType::msoControlPopup)
-+{
-+}
-+
-+rtl::OUString&
-+ScVbaCommandBarPopup::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBarPopup") );
-+ return sImplName;
-+}
-+uno::Sequence<rtl::OUString>
-+ScVbaCommandBarPopup::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.CommandBarPopup" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-+//////////// ScVbaCommandBarButton //////////////////////////////
-+ScVbaCommandBarButton::ScVbaCommandBarButton( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition ) throw (uno::RuntimeException) : CommandBarButton_BASE( xParent, xContext, sName, nPosition, office::MsoControlType::msoControlButton )
-+{
-+}
-+
-+ScVbaCommandBarButton::ScVbaCommandBarButton( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition, sal_Bool bTemporary ) throw (uno::RuntimeException) : CommandBarButton_BASE( xParent, xContext, sName, nPosition, bTemporary, office::MsoControlType::msoControlButton)
-+{
-+}
-+
-+rtl::OUString&
-+ScVbaCommandBarButton::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBarButton") );
-+ return sImplName;
-+}
-+uno::Sequence<rtl::OUString>
-+ScVbaCommandBarButton::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.CommandBarButton" ) );
-+ }
-+ return aServiceNames;
-+}
---- sc/source/ui/vba/vbacommandbarcontrol.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbacommandbarcontrol.hxx 2009-04-06 16:42:00.000000000 +0000
-@@ -36,6 +36,9 @@
- #define SC_VBA_COMMANDBARCONTROL_HXX
-
- #include <ooo/vba/XCommandBarControl.hpp>
-+#include <ooo/vba/XCommandBarPopup.hpp>
-+#include <ooo/vba/XCommandBarButton.hpp>
-+#include <ooo/vba/office/MsoControlType.hpp>
-
- #include "vbahelperinterface.hxx"
- #include "vbacommandbarcontrols.hxx"
-@@ -64,8 +67,12 @@ private:
- 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);
-+ ScVbaCommandBarControl( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition = 0, sal_Int32 nType = ov::office::MsoControlType::msoControlButton ) throw (css::uno::RuntimeException);
-+ ScVbaCommandBarControl( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition, sal_Bool bTemporary, sal_Int32 nType = ov::office::MsoControlType::msoControlButton ) 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; };
- sal_Int32 GetPosition() { return m_nPosition; };
- css::uno::Reference< css::container::XIndexContainer > GetCurrentSettings() { return m_xCurrentSettings; };
- css::beans::PropertyValues GetPropertyValues() { return m_aPropertyValues; };
-@@ -87,4 +94,27 @@ public:
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
- };
-+
-+typedef cppu::ImplInheritanceHelper1< ScVbaCommandBarControl, ov::XCommandBarPopup > CommandBarPopup_BASE;
-+class ScVbaCommandBarPopup : public CommandBarPopup_BASE
-+{
-+public:
-+ ScVbaCommandBarPopup( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition = 0 ) throw (css::uno::RuntimeException);
-+ ScVbaCommandBarPopup( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition, sal_Bool bTemporary ) throw (css::uno::RuntimeException);
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+typedef cppu::ImplInheritanceHelper1< ScVbaCommandBarControl, ov::XCommandBarButton > CommandBarButton_BASE;
-+class ScVbaCommandBarButton : public CommandBarButton_BASE
-+{
-+public:
-+ ScVbaCommandBarButton( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition = 0 ) throw (css::uno::RuntimeException);
-+ ScVbaCommandBarButton( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition, sal_Bool bTemporary ) throw (css::uno::RuntimeException);
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
- #endif//SC_VBA_COMMANDBARCONTROL_HXX
---- sc/source/ui/vba/vbacommandbarcontrols.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbacommandbarcontrols.cxx 2009-04-06 16:42:00.000000000 +0000
-@@ -38,6 +38,8 @@
- using namespace com::sun::star;
- using namespace ooo::vba;
-
-+uno::Any lcl_getPropertyValue( beans::PropertyValues aPropertyValues, rtl::OUString sPropertyName );
-+
- typedef ::cppu::WeakImplHelper1< container::XEnumeration > CommandBarControlEnumeration_BASE;
- class CommandBarControlEnumeration : public CommandBarControlEnumeration_BASE
- {
-@@ -88,6 +90,24 @@ ScVbaCommandBarControls::ScVbaCommandBar
- }
- else if( m_pCommandBarControl )
- {
-+ m_xUICfgManager.set( m_pCommandBarControl->GetUICfgManager(), uno::UNO_QUERY_THROW );
-+ m_xUICfgPers.set( m_pCommandBarControl->GetUICfgPers(), uno::UNO_QUERY_THROW );
-+ beans::PropertyValues aPropertyValues;
-+ m_pCommandBarControl->GetCurrentSettings()->getByIndex( m_pCommandBarControl->GetPosition() ) >>= aPropertyValues;
-+ m_pCommandBarControl->SetPropertyValues( aPropertyValues );
-+ m_xBarSettings.set( m_pCommandBarControl->GetCurrentSettings(), uno::UNO_QUERY_THROW );
-+
-+ uno::Any aValue = lcl_getPropertyValue( m_pCommandBarControl->GetPropertyValues(), rtl::OUString::createFromAscii("ItemDescriptorContainer") );
-+ if( aValue.hasValue() )
-+ {
-+ m_xCurrentSettings = m_pCommandBarControl->GetCurrentSettings();
-+ m_bHasElements = sal_True;
-+ }
-+ else
-+ {
-+ m_bHasElements = sal_False;
-+ }
-+ m_bIsMenu = m_pCommandBarControl->IsMenu();
- }
- else
- {
-@@ -170,7 +190,62 @@ ScVbaCommandBarControls::createCollectio
- // 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 ) ) );
-+ {
-+ uno::Reference< container::XIndexContainer > xCurrentSettings;
-+ beans::PropertyValues aPropertyValues;
-+ if( m_pCommandBarControl )
-+ {
-+ m_pCommandBarControl->GetCurrentSettings()->getByIndex( m_pCommandBarControl->GetPosition() ) >>= aPropertyValues;
-+ xCurrentSettings.set( lcl_getPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( "ItemDescriptorContainer" ) ), uno::UNO_QUERY );
-+ if( !xCurrentSettings.is() )
-+ {
-+ xCurrentSettings.set( m_xUICfgManager->getSettings( GetParentToolBarName(), sal_True ), uno::UNO_QUERY );
-+ }
-+ }
-+
-+ sal_Int32 nPosition = -1;
-+ for( sal_Int32 i = 0; i < xCurrentSettings->getCount(); i++ )
-+ {
-+ xCurrentSettings->getByIndex( i ) >>= aPropertyValues;
-+ // Label always empty in OOo
-+ rtl::OUString sLabel;
-+ lcl_getPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( "Label" ) ) >>= sLabel;
-+ if( sLabel.equalsIgnoreAsciiCase( sName ) )
-+ {
-+ nPosition = i;
-+ break;
-+ }
-+ // using CammandURL to find
-+ rtl::OUString sCommandURL;
-+ lcl_getPropertyValue( aPropertyValues, 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 ) )
-+ {
-+ nPosition = i;
-+ break;
-+ }
-+ }
-+
-+ if( nPosition != -1 )
-+ {
-+ uno::Reference< container::XIndexContainer > xSubMenu;
-+ lcl_getPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( "ItemDescriptorContainer" ) ) >>= xSubMenu;
-+ ScVbaCommandBarControl* pNewCommandBarControl = NULL;
-+ if( xSubMenu.is() )
-+ pNewCommandBarControl = new ScVbaCommandBarPopup( this, mxContext, sName, nPosition );
-+ else
-+ pNewCommandBarControl = new ScVbaCommandBarButton( this, mxContext, sName, nPosition );
-+
-+ return uno::makeAny( uno::Reference< XCommandBarControl > ( pNewCommandBarControl ) );
-+ }
-+ else
-+ throw uno::RuntimeException( rtl::OUString::createFromAscii("The CommandBarControl do not exist"), uno::Reference< uno::XInterface >() );
-+
-+ }
- return uno::Any();
- }
-
-@@ -213,16 +288,43 @@ ScVbaCommandBarControls::Add( const uno:
- // evalute the action of the new control
- }
- if( Before.hasValue() )
-- if( Before >>= nPosition )
-+ Before >>= nPosition;
-+ else
-+ {
-+ // if Before is ignore, the new control should be placed at the end of the commandbars;
-+ if( m_pCommandBar )
-+ nPosition = getCount();
-+ else if ( m_pCommandBarControl )
- {
-- // evalute the position of the new Control
-+ css::uno::Reference< css::container::XIndexContainer > xCurrentSettings;
-+ xCurrentSettings.set( lcl_getPropertyValue( m_pCommandBarControl->GetPropertyValues(), rtl::OUString::createFromAscii("ItemDescriptorContainer") ), uno::UNO_QUERY );
-+ if( xCurrentSettings.is() )
-+ {
-+ nPosition = xCurrentSettings->getCount();
-+ }
- }
-+ }
- 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 ) );
-+
-+ ScVbaCommandBarControl* pNewCommandBarControl = NULL;
-+ if( nType == office::MsoControlType::msoControlButton )
-+ {
-+ pNewCommandBarControl = new ScVbaCommandBarButton( this, mxContext, sCaption, nPosition, bTemporary );
-+ }
-+ else if ( nType == office::MsoControlType::msoControlPopup )
-+ {
-+ pNewCommandBarControl = new ScVbaCommandBarPopup( this, mxContext, sCaption, nPosition, bTemporary );
-+ }
-+ else
-+ {
-+ pNewCommandBarControl = new ScVbaCommandBarControl( this, mxContext, sCaption, nPosition, bTemporary );
-+ }
-+
-+ return uno::Reference< XCommandBarControl >( pNewCommandBarControl );
- }
-
- // XHelperInterface
---- sc/source/ui/vba/vbacommandbarcontrols.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbacommandbarcontrols.hxx 2009-04-06 16:42:00.000000000 +0000
-@@ -56,6 +56,7 @@ private:
- 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;
-
- 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 );
---- sc/source/ui/vba/vbacommandbars.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbacommandbars.cxx 2009-04-06 16:42:00.000000000 +0000
-@@ -201,6 +201,20 @@ ScVbaCommandBars::Item( const uno::Any&
- {
- return createCollectionObject( aIndex );
- }
-+
-+ // hardcode if "aIndex = 1" that would return "main menu".
-+ sal_Int16 nIndex = 0;
-+ aIndex >>= nIndex;
-+ if( nIndex == 1 )
-+ {
-+ uno::Any aSource;
-+ if( m_sModuleName.equalsIgnoreAsciiCase( sSpreadsheetDocumentUrl ) )
-+ aSource <<= rtl::OUString::createFromAscii( "Worksheet Menu Bar" );
-+ else if( m_sModuleName.equalsIgnoreAsciiCase( sTextDocumentUrl ) )
-+ aSource <<= rtl::OUString::createFromAscii( "Menu Bar" );
-+ if( aSource.hasValue() )
-+ return createCollectionObject( aSource );
-+ }
- return uno::Any();
- }
-
diff --git a/patches/vba/vba-commandbar-rework.diff b/patches/vba/vba-commandbar-rework.diff
deleted file mode 100644
index a038e0aee..000000000
--- a/patches/vba/vba-commandbar-rework.diff
+++ /dev/null
@@ -1,2079 +0,0 @@
-diff --git oovbaapi/ooo/vba/XCommandBarControl.idl oovbaapi/ooo/vba/XCommandBarControl.idl
-index ea0c612..167bce8 100644
---- oovbaapi/ooo/vba/XCommandBarControl.idl
-+++ oovbaapi/ooo/vba/XCommandBarControl.idl
-@@ -54,6 +54,7 @@ interface XCommandBarControl
- [attribute] string Caption;
- [attribute] string OnAction;
- [attribute] boolean Visible;
-+ [attribute, readonly] long Type;
-
- void Delete() raises ( com::sun::star::script::BasicErrorException );
- any Controls( [in] any Index ) raises ( com::sun::star::script::BasicErrorException );
-diff --git vbahelper/inc/vbahelper/vbahelper.hxx vbahelper/inc/vbahelper/vbahelper.hxx
-index d8e5a22..3773474 100644
---- vbahelper/inc/vbahelper/vbahelper.hxx
-+++ vbahelper/inc/vbahelper/vbahelper.hxx
-@@ -95,6 +95,8 @@ namespace ooo
- VBAHELPER_DLLPUBLIC sal_Int32 getPointerStyle( const css::uno::Reference< css::frame::XModel >& );
- VBAHELPER_DLLPUBLIC void setCursorHelper( const css::uno::Reference< css::frame::XModel >& xModel, const Pointer& rPointer, sal_Bool bOverWrite );
- VBAHELPER_DLLPUBLIC void setDefaultPropByIntrospection( const css::uno::Any& aObj, const css::uno::Any& aValue ) throw ( css::uno::RuntimeException );
-+ VBAHELPER_DLLPUBLIC css::uno::Any getPropertyValue( const css::uno::Sequence< css::beans::PropertyValue >& aProp, const rtl::OUString& aName );
-+ VBAHELPER_DLLPUBLIC sal_Bool setPropertyValue( css::uno::Sequence< css::beans::PropertyValue >& aProp, const rtl::OUString& aName, const css::uno::Any& aValue );
-
- class VBAHELPER_DLLPUBLIC Millimeter
- {
-diff --git vbahelper/source/vbahelper/makefile.mk vbahelper/source/vbahelper/makefile.mk
-index 61155e6..bd57415 100644
---- vbahelper/source/vbahelper/makefile.mk
-+++ vbahelper/source/vbahelper/makefile.mk
-@@ -46,6 +46,7 @@ SLOFILES=\
- $(SLO)$/vbacommandbar.obj \
- $(SLO)$/vbacommandbarcontrols.obj \
- $(SLO)$/vbacommandbarcontrol.obj \
-+ $(SLO)$/vbacommandbarhelper.obj \
- $(SLO)$/vbaapplicationbase.obj \
- $(SLO)$/vbawindowbase.obj \
- $(SLO)$/vbadocumentbase.obj \
-diff --git vbahelper/source/vbahelper/vbacommandbar.cxx vbahelper/source/vbahelper/vbacommandbar.cxx
-index a74ccd5..43abe41 100644
---- vbahelper/source/vbahelper/vbacommandbar.cxx
-+++ vbahelper/source/vbahelper/vbacommandbar.cxx
-@@ -32,6 +32,8 @@
- * MA 02111-1307 USA
- *
- ************************************************************************/
-+#include "vbacommandbar.hxx"
-+#include "vbacommandbarcontrols.hxx"
- #include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
- #include <com/sun/star/frame/XFrame.hpp>
- #include <com/sun/star/frame/XDesktop.hpp>
-@@ -40,141 +42,13 @@
- #include <com/sun/star/container/XNameContainer.hpp>
- #include <ooo/vba/office/MsoBarType.hpp>
-
--#include "vbacommandbar.hxx"
--#include "vbacommandbarcontrols.hxx"
--
- using namespace com::sun::star;
- using namespace ooo::vba;
-
--ScVbaCommandBar::ScVbaCommandBar( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< frame::XModel >& xModel, sal_Int32 nModuleType ) throw (uno::RuntimeException) : CommandBar_BASE( xParent, xContext ), m_xModel( xModel )
--{
-- // 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, const uno::Reference< frame::XModel >& xModel, rtl::OUString sToolBarName, sal_Bool bTemporary, sal_Bool bCreate ) throw (uno::RuntimeException) : CommandBar_BASE( xParent, xContext ), m_xModel( xModel )
-+ScVbaCommandBar::ScVbaCommandBar( const uno::Reference< ov::XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, VbaCommandBarHelperRef pHelper, const uno::Reference< container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Bool bIsMenu, sal_Bool bTemporary ) throw( uno::RuntimeException ) : CommandBar_BASE( xParent, xContext ), pCBarHelper( pHelper ), m_xBarSettings( xBarSettings ), m_sResourceUrl( sResourceUrl ), m_bIsMenu( bIsMenu ), m_bTemporary( bTemporary )
- {
-- // 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 = m_pScVbaCommandBars->GetModuleName();
--}
--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 )
- {
-@@ -183,25 +57,27 @@ ScVbaCommandBar::getName() throw ( uno::RuntimeException )
- uno::Any aName = xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("UIName") );
- rtl::OUString sName;
- aName >>= sName;
-- if( sName.getLength() < 1 && !m_bIsMenu )
-+ if( sName.getLength() < 1 )
- {
-- uno::Reference< container::XNameAccess > xNameAccess( m_pScVbaCommandBars->GetWindows(), uno::UNO_QUERY_THROW );
-- if( xNameAccess->hasByName( m_sToolBarName ) )
-+ if( m_bIsMenu )
- {
-- beans::PropertyValues aToolBar;
-- xNameAccess->getByName( m_sToolBarName ) >>= aToolBar;
-- sal_Int32 nCount = aToolBar.getLength();
-- beans::PropertyValue aPropertyValue;
-- for( sal_Int32 i = 0; i < nCount; i++ )
-+ if( m_sResourceUrl.equals( VbaCommandBarHelper::getMenuBarUrl() ) )
- {
-- aPropertyValue = aToolBar[i];
-- if( aPropertyValue.Name.equals( rtl::OUString::createFromAscii("UIName") ) )
-- {
-- aPropertyValue.Value >>= sName;
-- return sName;
-- }
-+ if( pCBarHelper->getModuleId().equalsAscii("com.sun.star.sheet.SpreadsheetDocument") )
-+ sName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Worksheet Menu Bar") );
-+ else if( pCBarHelper->getModuleId().equalsAscii("com.sun.star.text.TextDocument") )
-+ sName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Menu Bar") );
-+ return sName;
- }
- }
-+ // Toolbar name
-+ uno::Reference< container::XNameAccess > xNameAccess = pCBarHelper->getPersistentWindowState();
-+ if( xNameAccess->hasByName( m_sResourceUrl ) )
-+ {
-+ uno::Sequence< beans::PropertyValue > aToolBar;
-+ xNameAccess->getByName( m_sResourceUrl ) >>= aToolBar;
-+ getPropertyValue( aToolBar, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UIName") ) ) >>= sName;
-+ }
- }
- return sName;
- }
-@@ -210,33 +86,37 @@ ScVbaCommandBar::setName( const ::rtl::OUString& _name ) throw (uno::RuntimeExce
- {
- 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 ) )
-+ if( pCBarHelper->getAppCfgManager()->hasSettings( m_sResourceUrl ) )
- {
-- m_xUICfgManager->replaceSettings( m_sToolBarName, xIndexAccess );
-+ pCBarHelper->getAppCfgManager()->replaceSettings( m_sResourceUrl, m_xBarSettings );
- }
- else
- {
-- // toolbar not found
-+ pCBarHelper->getAppCfgManager()->insertSettings( m_sResourceUrl, m_xBarSettings );
- }
- if( !m_bTemporary )
- {
-- m_xUICfgPers->store();
-+ pCBarHelper->persistChanges();
- }
- }
- ::sal_Bool SAL_CALL
- ScVbaCommandBar::getVisible() throw (uno::RuntimeException)
- {
-+ // menu bar is allways visible in OOo
-+ if( m_bIsMenu )
-+ return sal_True;
-+
- sal_Bool bVisible = sal_False;
- try
- {
-- sal_Int32 i = 0;
-- while( !m_aToolBar[i].Name.equals( rtl::OUString::createFromAscii( "Visible" ) ) )
-+ uno::Reference< container::XNameAccess > xNameAccess = pCBarHelper->getPersistentWindowState();
-+ if( xNameAccess->hasByName( m_sResourceUrl ) )
- {
-- i++;
-+ uno::Sequence< beans::PropertyValue > aToolBar;
-+ xNameAccess->getByName( m_sResourceUrl ) >>= aToolBar;
-+ getPropertyValue( aToolBar, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Visible") ) ) >>= bVisible;
- }
-- m_aToolBar[i].Value >>= bVisible;
- }
- catch ( uno::Exception e )
- {
-@@ -248,18 +128,18 @@ ScVbaCommandBar::setVisible( ::sal_Bool _visible ) throw (uno::RuntimeException)
- {
- try
- {
-- uno::Reference< frame::XFrame > xFrame( m_xModel->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW );
-+ uno::Reference< frame::XFrame > xFrame( pCBarHelper->getModel()->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 );
-+ xLayoutManager->createElement( m_sResourceUrl );
-+ xLayoutManager->showElement( m_sResourceUrl );
- }
- else
- {
-- xLayoutManager->hideElement( m_sToolBarName );
-- xLayoutManager->destroyElement( m_sToolBarName );
-+ xLayoutManager->hideElement( m_sResourceUrl );
-+ xLayoutManager->destroyElement( m_sResourceUrl );
- }
- }
- catch( uno::Exception e )
-@@ -284,45 +164,35 @@ ScVbaCommandBar::setEnabled( sal_Bool/* _enabled */ ) throw (uno::RuntimeExcepti
- }
-
- void SAL_CALL
--ScVbaCommandBar::Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
-+ScVbaCommandBar::Delete( ) throw (script::BasicErrorException, uno::RuntimeException)
- {
-- if( m_bCustom )
-+ if( pCBarHelper->getAppCfgManager()->hasSettings( m_sResourceUrl ) )
- {
-- if( m_xUICfgManager->hasSettings( m_sToolBarName ) )
-- {
-- m_xUICfgManager->removeSettings(m_sToolBarName);
-- // make it permanent
-- if( !m_bTemporary )
-- {
-- m_xUICfgPers->store();
-- }
-- }
-- else
-+ pCBarHelper->getAppCfgManager()->removeSettings(m_sResourceUrl);
-+ // make it permanent
-+ if( !m_bTemporary )
- {
-- // 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 );
-+ pCBarHelper->persistChanges();
- }
- }
-+ else
-+ {
-+ // toolbar not found
-+ // TODO throw Error
-+ }
-+ uno::Reference< container::XNameContainer > xNameContainer( pCBarHelper->getPersistentWindowState(), uno::UNO_QUERY_THROW );
-+ if( xNameContainer->hasByName( m_sResourceUrl ) )
-+ {
-+ xNameContainer->removeByName( m_sResourceUrl );
-+ }
- }
- 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 >(), m_xModel ) );
-+ uno::Reference< XCommandBarControls > xCommandBarControls( new ScVbaCommandBarControls( this, mxContext, m_xBarSettings, pCBarHelper, m_xBarSettings, m_sResourceUrl ) );
- 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 xCommandBarControls->Item( aIndex, uno::Any() );
- }
- return uno::makeAny( xCommandBarControls );
- }
-diff --git vbahelper/source/vbahelper/vbacommandbar.hxx vbahelper/source/vbahelper/vbacommandbar.hxx
-index 52f63bc..5c9b13e 100644
---- vbahelper/source/vbahelper/vbacommandbar.hxx
-+++ vbahelper/source/vbahelper/vbacommandbar.hxx
-@@ -42,52 +42,25 @@
- #include <com/sun/star/beans/PropertyValues.hpp>
-
- #include <vbahelper/vbahelperinterface.hxx>
--#include "vbacommandbars.hxx"
-+#include "vbacommandbarhelper.hxx"
-
- #include <map>
--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();
-- css::uno::Reference< css::frame::XModel > m_xModel;
-+ VbaCommandBarHelperRef pCBarHelper;
-+ css::uno::Reference< css::container::XIndexAccess > m_xBarSettings;
-+ rtl::OUString m_sResourceUrl;
-+ sal_Bool m_bIsMenu;
-+ sal_Bool m_bTemporary;
-+
- public:
-- ScVbaCommandBar( 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 nModuleType ) throw( css::uno::RuntimeException );
-- ScVbaCommandBar( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, const css::uno::Reference< css::frame::XModel >& xModel, rtl::OUString sToolBarName, sal_Bool bTemporary, sal_Bool bCreate ) throw( css::uno::RuntimeException );
-+ ScVbaCommandBar( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Bool bIsMenu, sal_Bool bTemporary = sal_True ) 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; };
-+ sal_Bool IsMenu() { return m_bIsMenu; }
-
- // Attributes
- virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
-diff --git vbahelper/source/vbahelper/vbacommandbarcontrol.cxx vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
-index 1bea689..dd20256 100644
---- vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
-+++ vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
-@@ -33,198 +33,29 @@
- *
- ************************************************************************/
- #include "vbacommandbarcontrol.hxx"
--#include <basic/sbstar.hxx>
--#include <basic/sbmod.hxx>
--#include <basic/sbmeth.hxx>
-+#include "vbacommandbarcontrols.hxx"
- #include <vbahelper/vbahelper.hxx>
- #include <svx/msvbahelper.hxx>
-
- using namespace com::sun::star;
- using namespace ooo::vba;
-
--uno::Any lcl_getPropertyValue( beans::PropertyValues aPropertyValues, rtl::OUString sPropertyName )
-+ScVbaCommandBarControl::ScVbaCommandBarControl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl ) throw (css::uno::RuntimeException) : CommandBarControl_BASE( xParent, xContext ), pCBarHelper( pHelper ), m_sResourceUrl( sResourceUrl ), m_xCurrentSettings( xSettings ), m_xBarSettings( xBarSettings ), m_nPosition( 0 ), m_bTemporary( sal_True )
- {
-- 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, const rtl::OUString& sName, sal_Int32 nPosition, sal_Int32 nType ) throw (uno::RuntimeException) : CommandBarControl_BASE( xParent, xContext ), m_sName( sName ), m_nPosition( nPosition ), m_nType( nType )
--{
-- // 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 );
-- }
-- }
-- 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, const rtl::OUString& sName, sal_Int32 nPosition, sal_Bool bTemporary, sal_Int32 nType) throw (uno::RuntimeException) : CommandBarControl_BASE( xParent, xContext ), m_nPosition( nPosition ), m_bTemporary( bTemporary ), m_nType( nType )
--{
-- m_xParentHardRef.set( xParent, uno::UNO_QUERY_THROW );
-- initObjects();
-- if( sName.getLength() > 0 )
-- {
-- m_sName = sName;
-- }
-- 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)
-+ScVbaCommandBarControl::ScVbaCommandBarControl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Int32 nPosition, sal_Bool bTemporary ) throw (css::uno::RuntimeException) : CommandBarControl_BASE( xParent, xContext ), pCBarHelper( pHelper ), m_sResourceUrl( sResourceUrl ), m_xCurrentSettings( xSettings ), m_xBarSettings( xBarSettings ), m_nPosition( nPosition ), m_bTemporary( bTemporary )
- {
-- 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" );
--}
--
--void
--ScVbaCommandBarControl::createNewMenuBarControl()
--{
-- uno::Reference< lang::XSingleComponentFactory > xMenuMSF( m_xBarSettings, uno::UNO_QUERY_THROW );
--
-- uno::Sequence< beans::PropertyValue > aPropertys;
-- if( m_nType == office::MsoControlType::msoControlPopup )
-- aPropertys = uno::Sequence< beans::PropertyValue >( 4 );
-- else
-- aPropertys = uno::Sequence< beans::PropertyValue >( 3 );
--
-- 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 <<= sal_Int32(0);
--
-- if( m_nType == office::MsoControlType::msoControlPopup )
-- {
-- aPropertys[3].Name = rtl::OUString::createFromAscii("ItemDescriptorContainer");
-- aPropertys[3].Value <<= xMenuMSF->createInstanceWithContext( mxContext );
-- }
--
-- 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
-- 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( aPropertys ) );
-- }
-- 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();
-- }
-+ m_xCurrentSettings->getByIndex( nPosition ) >>= m_aPropertyValues;
- }
-
--void
--ScVbaCommandBarControl::createNewToolBarControl()
-+void ScVbaCommandBarControl::ApplyChange() throw ( uno::RuntimeException )
- {
-- 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 <<= sal_Int32(0);
-- 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 ) );
-- }
-+ uno::Reference< container::XIndexContainer > xIndexContainer( m_xCurrentSettings, uno::UNO_QUERY_THROW );
-+ xIndexContainer->replaceByIndex( m_nPosition, uno::makeAny( m_aPropertyValues ) );
-+ pCBarHelper->getAppCfgManager()->replaceSettings( m_sResourceUrl, m_xBarSettings );
- if( !m_bTemporary )
-- {
-- m_xUICfgPers->store();
-- }
-+ pCBarHelper->persistChanges();
- }
-
- ::rtl::OUString SAL_CALL
-@@ -232,145 +63,109 @@ 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;
-- }
-+ getPropertyValue( m_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 sCaption = _caption.replace('&','~');
-+ setPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("Label"), uno::makeAny( sCaption ) );
-+ ApplyChange();
- }
-+
- ::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();
-+ rtl::OUString sCommandURL;
-+ getPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("CommandURL") ) >>= sCommandURL;
-+ return sCommandURL;
- }
-+
- void SAL_CALL
- ScVbaCommandBarControl::setOnAction( const ::rtl::OUString& _onaction ) throw (uno::RuntimeException)
- {
-- if( m_xCurrentSettings.is() )
-+ // get the current model
-+ uno::Reference< frame::XModel > xModel( pCBarHelper->getModel() );
-+ VBAMacroResolvedInfo aResolvedMacro = ooo::vba::resolveVBAMacro( getSfxObjShell( xModel ), _onaction, true );
-+ if ( aResolvedMacro.IsResolved() )
- {
-- // get the current model
-- VBAMacroResolvedInfo aResolvedMacro = ooo::vba::resolveVBAMacro( getSfxObjShell( m_pCommandBarControls->GetModel() ), _onaction, true );
-- if ( aResolvedMacro.IsResolved() )
-- {
-- rtl::OUString aCommandURL = ooo::vba::makeMacroURL( aResolvedMacro.ResolvedMacro() );
-+ rtl::OUString aCommandURL = ooo::vba::makeMacroURL( aResolvedMacro.ResolvedMacro() );
- OSL_TRACE(" ScVbaCommandBarControl::setOnAction: %s", rtl::OUStringToOString( aCommandURL, RTL_TEXTENCODING_UTF8 ).getStr() );
-- beans::PropertyValues aPropertyValues;
-- m_xCurrentSettings->getByIndex( m_nPosition ) >>= aPropertyValues;
-- beans::PropertyValues aNewPropertyValues;
-- aNewPropertyValues = lcl_repalcePropertyValue( aPropertyValues, rtl::OUString::createFromAscii("CommandURL"), uno::makeAny( aCommandURL ) );
-- 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();
-- }
-- }
-+ setPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("CommandURL"), uno::makeAny( aCommandURL ) );
-+ ApplyChange();
- }
- }
-+
- ::sal_Bool SAL_CALL
- ScVbaCommandBarControl::getVisible() throw (uno::RuntimeException)
- {
-- // not possible in UNO?
-- return sal_True;
-+ sal_Bool bVisible = sal_True;
-+ uno::Any aValue = getPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("IsVisible") );
-+ if( aValue.hasValue() )
-+ aValue >>= bVisible;
-+ return bVisible;
- }
- void SAL_CALL
--ScVbaCommandBarControl::setVisible( ::sal_Bool /*_visible*/ ) throw (uno::RuntimeException)
-+ScVbaCommandBarControl::setVisible( ::sal_Bool _visible ) throw (uno::RuntimeException)
- {
-- // "IsVisilbe"
-+ uno::Any aValue = getPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("IsVisible") );
-+ if( aValue.hasValue() )
-+ {
-+ setPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("IsVisible"), uno::makeAny( _visible ) );
-+ ApplyChange();
-+ }
- }
-+
- void SAL_CALL
--ScVbaCommandBarControl::Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
-+ScVbaCommandBarControl::Delete( ) throw (script::BasicErrorException, uno::RuntimeException)
- {
- if( m_xCurrentSettings.is() )
- {
-- m_xCurrentSettings->removeByIndex( m_nPosition );
-+ uno::Reference< container::XIndexContainer > xIndexContainer( m_xCurrentSettings, uno::UNO_QUERY_THROW );
-+ xIndexContainer->removeByIndex( m_nPosition );
-
-- if( m_xUICfgManager->hasSettings( m_sBarName ) )
-+ if( pCBarHelper->getAppCfgManager()->hasSettings( m_sResourceUrl ) )
- {
-- m_xUICfgManager->replaceSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
-+ pCBarHelper->getAppCfgManager()->replaceSettings( m_sResourceUrl, 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 ) );
-+ pCBarHelper->getAppCfgManager()->insertSettings( m_sResourceUrl, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
- }
- // make it permanent
- if( !m_bTemporary )
- {
-- m_xUICfgPers->store();
-+ pCBarHelper->persistChanges();
- }
- }
- }
-+
- 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 >(), m_pCommandBarControls->GetModel() ) );
-+ // only Popup Menu has controls
-+ uno::Reference< container::XIndexAccess > xSubMenu;
-+ getPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_CONTAINER ) ) >>= xSubMenu;
-+ if( !xSubMenu.is() )
-+ throw uno::RuntimeException();
-+
-+ uno::Reference< XCommandBarControls > xCommandBarControls( new ScVbaCommandBarControls( this, mxContext, xSubMenu, pCBarHelper, m_xBarSettings, m_sResourceUrl ) );
- 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 xCommandBarControls->Item( aIndex, uno::Any() );
- }
- return uno::makeAny( xCommandBarControls );
- }
-+
- rtl::OUString&
- ScVbaCommandBarControl::getServiceImplName()
- {
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBarControl") );
- return sImplName;
- }
-+
- uno::Sequence<rtl::OUString>
- ScVbaCommandBarControl::getServiceNames()
- {
-@@ -384,12 +179,11 @@ ScVbaCommandBarControl::getServiceNames()
- }
-
- //////////// ScVbaCommandBarPopup //////////////////////////////
--ScVbaCommandBarPopup::ScVbaCommandBarPopup( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const rtl::OUString& sName, sal_Int32 nPosition ) throw (uno::RuntimeException) : CommandBarPopup_BASE( xParent, xContext, sName, nPosition, office::MsoControlType::msoControlPopup )
--{
--}
--
--ScVbaCommandBarPopup::ScVbaCommandBarPopup( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const rtl::OUString& sName, sal_Int32 nPosition, sal_Bool bTemporary ) throw (uno::RuntimeException) : CommandBarPopup_BASE( xParent, xContext, sName, nPosition, bTemporary, office::MsoControlType::msoControlPopup )
-+ScVbaCommandBarPopup::ScVbaCommandBarPopup( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Int32 nPosition, sal_Bool bTemporary ) throw (css::uno::RuntimeException) : CommandBarPopup_BASE( xParent, xContext, xSettings, pHelper, xBarSettings, sResourceUrl )
- {
-+ m_nPosition = nPosition;
-+ m_bTemporary = bTemporary;
-+ m_xCurrentSettings->getByIndex( m_nPosition ) >>= m_aPropertyValues;
- }
-
- rtl::OUString&
-@@ -411,12 +205,11 @@ ScVbaCommandBarPopup::getServiceNames()
- }
-
- //////////// ScVbaCommandBarButton //////////////////////////////
--ScVbaCommandBarButton::ScVbaCommandBarButton( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const rtl::OUString& sName, sal_Int32 nPosition ) throw (uno::RuntimeException) : CommandBarButton_BASE( xParent, xContext, sName, nPosition, office::MsoControlType::msoControlButton )
--{
--}
--
--ScVbaCommandBarButton::ScVbaCommandBarButton( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const rtl::OUString& sName, sal_Int32 nPosition, sal_Bool bTemporary ) throw (uno::RuntimeException) : CommandBarButton_BASE( xParent, xContext, sName, nPosition, bTemporary, office::MsoControlType::msoControlButton)
-+ScVbaCommandBarButton::ScVbaCommandBarButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Int32 nPosition, sal_Bool bTemporary ) throw (css::uno::RuntimeException) : CommandBarButton_BASE( xParent, xContext, xSettings, pHelper, xBarSettings, sResourceUrl )
- {
-+ m_nPosition = nPosition;
-+ m_bTemporary = bTemporary;
-+ m_xCurrentSettings->getByIndex( m_nPosition ) >>= m_aPropertyValues;
- }
-
- rtl::OUString&
-diff --git vbahelper/source/vbahelper/vbacommandbarcontrol.hxx vbahelper/source/vbahelper/vbacommandbarcontrol.hxx
-index c1a8b07..f40ad82 100644
---- vbahelper/source/vbahelper/vbacommandbarcontrol.hxx
-+++ vbahelper/source/vbahelper/vbacommandbarcontrol.hxx
-@@ -39,44 +39,30 @@
- #include <ooo/vba/XCommandBarPopup.hpp>
- #include <ooo/vba/XCommandBarButton.hpp>
- #include <ooo/vba/office/MsoControlType.hpp>
--
- #include <vbahelper/vbahelperinterface.hxx>
--#include "vbacommandbarcontrols.hxx"
-+#include "vbacommandbarhelper.hxx"
-+#include <cppuhelper/implbase1.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;
-+protected:
-+ VbaCommandBarHelperRef pCBarHelper;
-+ rtl::OUString m_sResourceUrl;
-+ css::uno::Reference< css::container::XIndexAccess > m_xCurrentSettings;
-+ css::uno::Reference< css::container::XIndexAccess > m_xBarSettings;
-+ css::uno::Sequence< css::beans::PropertyValue > m_aPropertyValues;
-+
- sal_Int32 m_nPosition;
- sal_Bool m_bTemporary;
-- sal_Int32 m_nType;
-- 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();
-+
-+private:
-+ void ApplyChange() throw (css::uno::RuntimeException);
-+
- public:
-- ScVbaCommandBarControl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const rtl::OUString& sName, sal_Int32 nPosition = 0, sal_Int32 nType = ov::office::MsoControlType::msoControlButton ) throw (css::uno::RuntimeException);
-- ScVbaCommandBarControl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const rtl::OUString& sName, sal_Int32 nPosition, sal_Bool bTemporary, sal_Int32 nType = ov::office::MsoControlType::msoControlButton ) 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; };
-- 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; };
-+ ScVbaCommandBarControl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl ) throw (css::uno::RuntimeException);
-+ ScVbaCommandBarControl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Int32 nPosition, sal_Bool bTemporary ) throw (css::uno::RuntimeException);
-
- // Attributes
- virtual ::rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
-@@ -85,6 +71,10 @@ public:
- 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);
-+ virtual sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException)
-+ {
-+ return ov::office::MsoControlType::msoControlButton;
-+ }
-
- // Methods
- virtual void SAL_CALL Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-@@ -99,8 +89,12 @@ typedef cppu::ImplInheritanceHelper1< ScVbaCommandBarControl, ov::XCommandBarPop
- class ScVbaCommandBarPopup : public CommandBarPopup_BASE
- {
- public:
-- ScVbaCommandBarPopup( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const rtl::OUString& sName, sal_Int32 nPosition = 0 ) throw (css::uno::RuntimeException);
-- ScVbaCommandBarPopup( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const rtl::OUString& sName, sal_Int32 nPosition, sal_Bool bTemporary ) throw (css::uno::RuntimeException);
-+ ScVbaCommandBarPopup( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Int32 nPosition, sal_Bool bTemporary ) throw (css::uno::RuntimeException);
-+
-+ virtual sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException)
-+ {
-+ return ov::office::MsoControlType::msoControlPopup;
-+ }
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-@@ -110,8 +104,12 @@ typedef cppu::ImplInheritanceHelper1< ScVbaCommandBarControl, ov::XCommandBarBut
- class ScVbaCommandBarButton : public CommandBarButton_BASE
- {
- public:
-- ScVbaCommandBarButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const rtl::OUString& sName, sal_Int32 nPosition = 0 ) throw (css::uno::RuntimeException);
-- ScVbaCommandBarButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const rtl::OUString& sName, sal_Int32 nPosition, sal_Bool bTemporary ) throw (css::uno::RuntimeException);
-+ ScVbaCommandBarButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Int32 nPosition, sal_Bool bTemporary ) throw (css::uno::RuntimeException);
-+
-+ virtual sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException)
-+ {
-+ return ov::office::MsoControlType::msoControlButton;
-+ }
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-diff --git vbahelper/source/vbahelper/vbacommandbarcontrols.cxx vbahelper/source/vbahelper/vbacommandbarcontrols.cxx
-index c6adbc2..ea56a09 100644
---- vbahelper/source/vbahelper/vbacommandbarcontrols.cxx
-+++ vbahelper/source/vbahelper/vbacommandbarcontrols.cxx
-@@ -38,8 +38,6 @@
- using namespace com::sun::star;
- using namespace ooo::vba;
-
--uno::Any lcl_getPropertyValue( beans::PropertyValues aPropertyValues, rtl::OUString sPropertyName );
--
- typedef ::cppu::WeakImplHelper1< container::XEnumeration > CommandBarControlEnumeration_BASE;
- class CommandBarControlEnumeration : public CommandBarControlEnumeration_BASE
- {
-@@ -58,272 +56,183 @@ public:
- {
- 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();
-+ return m_pCommandBarControls->createCollectionObject( uno::makeAny( m_nCurrentPosition++ ) );
- }
- else
- throw container::NoSuchElementException();
- }
- };
-
--ScVbaCommandBarControls::ScVbaCommandBarControls( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< container::XIndexAccess> xIndexAccess, const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException) : CommandBarControls_BASE( xParent, xContext, xIndexAccess ), m_xModel( xModel )
-+ScVbaCommandBarControls::ScVbaCommandBarControls( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess>& xIndexAccess, VbaCommandBarHelperRef pHelper, const uno::Reference< container::XIndexAccess>& xBarSettings, const rtl::OUString& sResourceUrl ) throw (uno::RuntimeException) : CommandBarControls_BASE( xParent, xContext, xIndexAccess ), pCBarHelper( pHelper ), m_xBarSettings( xBarSettings ), m_sResourceUrl( sResourceUrl )
- {
-- 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 )
-- {
-- m_xUICfgManager.set( m_pCommandBarControl->GetUICfgManager(), uno::UNO_QUERY_THROW );
-- m_xUICfgPers.set( m_pCommandBarControl->GetUICfgPers(), uno::UNO_QUERY_THROW );
-- beans::PropertyValues aPropertyValues;
-- m_pCommandBarControl->GetCurrentSettings()->getByIndex( m_pCommandBarControl->GetPosition() ) >>= aPropertyValues;
-- m_pCommandBarControl->SetPropertyValues( aPropertyValues );
-- m_xBarSettings.set( m_pCommandBarControl->GetCurrentSettings(), uno::UNO_QUERY_THROW );
--
-- uno::Any aValue = lcl_getPropertyValue( m_pCommandBarControl->GetPropertyValues(), rtl::OUString::createFromAscii("ItemDescriptorContainer") );
-- if( aValue.hasValue() )
-- {
-- m_xCurrentSettings = m_pCommandBarControl->GetCurrentSettings();
-- m_bHasElements = sal_True;
-- }
-- else
-- {
-- m_bHasElements = sal_False;
-- }
-- m_bIsMenu = m_pCommandBarControl->IsMenu();
-- }
-- else
-- {
-- throw uno::RuntimeException( rtl::OUString::createFromAscii("Parent needs to be a ScVbaCommandBar or a ScVbaCommandBarControl"), uno::Reference< uno::XInterface >() );
-- }
-+ m_bIsMenu = sResourceUrl.equalsAscii( ITEM_MENUBAR_URL ) ? sal_True : sal_False;
- }
--rtl::OUString
--ScVbaCommandBarControls::GetControlNameByIndex( const sal_Int32 nIndex ) throw ( uno::RuntimeException )
-+
-+uno::Sequence< beans::PropertyValue > ScVbaCommandBarControls::CreateMenuItemData( const rtl::OUString& sCommandURL, const rtl::OUString& sHelpURL, const rtl::OUString& sLabel, sal_uInt16 nType, const uno::Any& aSubMenu )
- {
-- 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();
-+ uno::Sequence< beans::PropertyValue > aProps(5);
-+
-+ aProps[0].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_COMMANDURL );
-+ aProps[0].Value <<= sCommandURL;
-+ aProps[1].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_HELPURL );
-+ aProps[1].Value <<= sHelpURL;
-+ aProps[2].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_LABEL );
-+ aProps[2].Value <<= sLabel;
-+ aProps[3].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_TYPE );
-+ aProps[3].Value <<= nType;
-+ aProps[4].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_CONTAINER );
-+ aProps[4].Value = aSubMenu;
-+
-+ return aProps;
- }
-
--// Attributes
--sal_Int32 SAL_CALL
--ScVbaCommandBarControls::getCount() throw (uno::RuntimeException)
-+uno::Sequence< beans::PropertyValue > ScVbaCommandBarControls::CreateToolbarItemData( const rtl::OUString& sCommandURL, const rtl::OUString& sHelpURL, const rtl::OUString& sLabel, sal_uInt16 nType, const uno::Any& aSubMenu, sal_Bool isVisible, sal_Int32 nStyle )
- {
-- 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;
-+ uno::Sequence< beans::PropertyValue > aProps(7);
-+
-+ aProps[0].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_COMMANDURL );
-+ aProps[0].Value <<= sCommandURL;
-+ aProps[1].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_HELPURL );
-+ aProps[1].Value <<= sHelpURL;
-+ aProps[2].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_LABEL );
-+ aProps[2].Value <<= sLabel;
-+ aProps[3].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_TYPE );
-+ aProps[3].Value <<= nType;
-+ aProps[4].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_CONTAINER );
-+ aProps[4].Value = aSubMenu;
-+ aProps[5].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_ISVISIBLE );
-+ aProps[5].Value <<= isVisible;
-+ aProps[6].Name = rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_STYLE );
-+ aProps[6].Value <<= nStyle;
-+
-+ return aProps;
- }
-+
- // XEnumerationAccess
- uno::Type SAL_CALL
- ScVbaCommandBarControls::getElementType() throw ( uno::RuntimeException )
- {
-- return XCommandBarControls::static_type( 0 );
-+ return XCommandBarControl::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 )
-- {
-- uno::Reference< container::XIndexContainer > xCurrentSettings;
-- beans::PropertyValues aPropertyValues;
-- if( m_pCommandBarControl )
-- {
-- m_pCommandBarControl->GetCurrentSettings()->getByIndex( m_pCommandBarControl->GetPosition() ) >>= aPropertyValues;
-- xCurrentSettings.set( lcl_getPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( "ItemDescriptorContainer" ) ), uno::UNO_QUERY );
-- if( !xCurrentSettings.is() )
-- {
-- xCurrentSettings.set( m_xUICfgManager->getSettings( GetParentToolBarName(), sal_True ), uno::UNO_QUERY );
-- }
-- }
--
-- sal_Int32 nPosition = -1;
-- for( sal_Int32 i = 0; i < xCurrentSettings->getCount(); i++ )
-- {
-- xCurrentSettings->getByIndex( i ) >>= aPropertyValues;
-- // Label always empty in OOo
-- rtl::OUString sLabel;
-- lcl_getPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( "Label" ) ) >>= sLabel;
-- if( sLabel.equalsIgnoreAsciiCase( sName ) )
-- {
-- nPosition = i;
-- break;
-- }
-- // using CammandURL to find
-- rtl::OUString sCommandURL;
-- lcl_getPropertyValue( aPropertyValues, 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 ) )
-- {
-- nPosition = i;
-- break;
-- }
-- }
--
-- if( nPosition != -1 )
-- {
-- uno::Reference< container::XIndexContainer > xSubMenu;
-- lcl_getPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( "ItemDescriptorContainer" ) ) >>= xSubMenu;
-- ScVbaCommandBarControl* pNewCommandBarControl = NULL;
-- if( xSubMenu.is() )
-- pNewCommandBarControl = new ScVbaCommandBarPopup( this, mxContext, sName, nPosition );
-- else
-- pNewCommandBarControl = new ScVbaCommandBarButton( this, mxContext, sName, nPosition );
-+ sal_Int32 nPosition = -1;
-+ aSource >>= nPosition;
-+ uno::Sequence< beans::PropertyValue > aProps;
-+ m_xIndexAccess->getByIndex( nPosition ) >>= aProps;
-+ uno::Reference< container::XIndexAccess > xSubMenu;
-+ getPropertyValue( aProps, rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_CONTAINER ) ) >>= xSubMenu;
-+ ScVbaCommandBarControl* pNewCommandBarControl = NULL;
-+ if( xSubMenu.is() )
-+ pNewCommandBarControl = new ScVbaCommandBarPopup( this, mxContext, m_xIndexAccess, pCBarHelper, m_xBarSettings, m_sResourceUrl, nPosition, sal_True );
-+ else
-+ pNewCommandBarControl = new ScVbaCommandBarButton( this, mxContext, m_xIndexAccess, pCBarHelper, m_xBarSettings, m_sResourceUrl, nPosition, sal_True );
-
-- return uno::makeAny( uno::Reference< XCommandBarControl > ( pNewCommandBarControl ) );
-- }
-- else
-- throw uno::RuntimeException( rtl::OUString::createFromAscii("The CommandBarControl do not exist"), uno::Reference< uno::XInterface >() );
--
-- }
-- return uno::Any();
-+ return uno::makeAny( uno::Reference< XCommandBarControl > ( pNewCommandBarControl ) );
- }
-
- // Methods
- uno::Any SAL_CALL
- ScVbaCommandBarControls::Item( const uno::Any& aIndex, const uno::Any& /*aIndex*/ ) throw (uno::RuntimeException)
- {
-+ sal_Int32 nPosition = -1;
- if( aIndex.getValueTypeClass() == uno::TypeClass_STRING )
- {
-- return createCollectionObject( aIndex );
-+ rtl::OUString sName;
-+ aIndex >>= sName;
-+ nPosition = VbaCommandBarHelper::findControlByName( m_xIndexAccess, sName );
- }
-- sal_Int32 nIndex = 0;
-- if( aIndex >>= nIndex )
-+ else
-+ {
-+ aIndex >>= nPosition;
-+ }
-+
-+ if( nPosition < 0 || nPosition >= getCount() )
- {
-- return createCollectionObject( uno::makeAny( GetControlNameByIndex( nIndex ) ) );
-+ throw uno::RuntimeException();
- }
-
-- return uno::Any();
-+ return createCollectionObject( uno::makeAny( nPosition ) );
- }
-+
- 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)
-+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;
-+ rtl::OUString sLabel( rtl::OUString::createFromAscii("Custom") );
-+ rtl::OUString sCommandUrl = rtl::OUString::createFromAscii( CUSTOM_MENU_STR ) + sLabel;
-+ sal_Int32 nType = office::MsoControlType::msoControlButton;
- 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
-- }
-+ {
-+ Type >>= nType;
-+ }
-+
-+ if( nType != office::MsoControlType::msoControlButton &&
-+ nType != office::MsoControlType::msoControlPopup )
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+
-+ if( Id.hasValue() || Parameter.hasValue( ) )
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+
- if( Before.hasValue() )
- Before >>= nPosition;
- else
-- {
-- // if Before is ignore, the new control should be placed at the end of the commandbars;
-- if( m_pCommandBar )
-- nPosition = getCount();
-- else if ( m_pCommandBarControl )
-- {
-- css::uno::Reference< css::container::XIndexContainer > xCurrentSettings;
-- xCurrentSettings.set( lcl_getPropertyValue( m_pCommandBarControl->GetPropertyValues(), rtl::OUString::createFromAscii("ItemDescriptorContainer") ), uno::UNO_QUERY );
-- if( xCurrentSettings.is() )
-- {
-- nPosition = xCurrentSettings->getCount();
-- }
-- }
-- }
-+ nPosition = m_xIndexAccess->getCount();
-+
- if( Temporary.hasValue() )
-- if( Temporary >>= bTemporary )
-- {
-- // evalute the temporary of the new Control
-- }
-+ Temporary >>= bTemporary;
-
-- ScVbaCommandBarControl* pNewCommandBarControl = NULL;
-- if( nType == office::MsoControlType::msoControlButton )
-+ uno::Any aSubMenu;
-+ if( nType == office::MsoControlType::msoControlPopup )
- {
-- pNewCommandBarControl = new ScVbaCommandBarButton( this, mxContext, sCaption, nPosition, bTemporary );
-+ // it is a Popmenu
-+ uno::Reference< lang::XSingleComponentFactory > xSCF( m_xBarSettings, uno::UNO_QUERY_THROW );
-+ aSubMenu <<= xSCF->createInstanceWithContext( mxContext );
- }
-- else if ( nType == office::MsoControlType::msoControlPopup )
-+
-+ // create control
-+ uno::Sequence< beans::PropertyValue > aProps;
-+ rtl::OUString sHelpUrl;
-+ sal_Int32 nItemType = 0;
-+ if( IsMenu() )
- {
-- pNewCommandBarControl = new ScVbaCommandBarPopup( this, mxContext, sCaption, nPosition, bTemporary );
-+ aProps = CreateMenuItemData( sCommandUrl, sHelpUrl, sLabel, nItemType, aSubMenu );
- }
- else
- {
-- pNewCommandBarControl = new ScVbaCommandBarControl( this, mxContext, sCaption, nPosition, bTemporary );
-+ sal_Bool isVisible = sal_True;
-+ sal_Int32 nStyle = 0;
-+ aProps = CreateToolbarItemData( sCommandUrl, sHelpUrl, sLabel, nItemType, aSubMenu, isVisible, nStyle );
- }
-
-+
-+ uno::Reference< container::XIndexContainer > xIndexContainer( m_xIndexAccess, uno::UNO_QUERY_THROW );
-+ xIndexContainer->insertByIndex( nPosition, uno::makeAny( aProps ) );
-+
-+ pCBarHelper->getAppCfgManager()->replaceSettings( m_sResourceUrl, m_xBarSettings );
-+ if( !bTemporary )
-+ pCBarHelper->persistChanges();
-+
-+ ScVbaCommandBarControl* pNewCommandBarControl = NULL;
-+ if( nType == office::MsoControlType::msoControlPopup )
-+ pNewCommandBarControl = new ScVbaCommandBarPopup( this, mxContext, m_xIndexAccess, pCBarHelper, m_xBarSettings, m_sResourceUrl, nPosition, bTemporary );
-+ else
-+ pNewCommandBarControl = new ScVbaCommandBarButton( this, mxContext, m_xIndexAccess, pCBarHelper, m_xBarSettings, m_sResourceUrl, nPosition, bTemporary );
-+
- return uno::Reference< XCommandBarControl >( pNewCommandBarControl );
- }
-
-diff --git vbahelper/source/vbahelper/vbacommandbarcontrols.hxx vbahelper/source/vbahelper/vbacommandbarcontrols.hxx
-index f9ebe25..fa37f10 100644
---- vbahelper/source/vbahelper/vbacommandbarcontrols.hxx
-+++ vbahelper/source/vbahelper/vbacommandbarcontrols.hxx
-@@ -36,47 +36,27 @@
- #define SC_VBA_COMMANDBARCONTROLS_HXX
-
- #include <ooo/vba/XCommandBarControls.hpp>
--
- #include <vbahelper/vbahelperinterface.hxx>
--#include "vbacommandbar.hxx"
- #include <vbahelper/vbacollectionimpl.hxx>
--
--class ScVbaCommandBarControl;
-+#include "vbacommandbarhelper.hxx"
-
- 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;
-- css::uno::Reference< css::container::XIndexContainer > m_xCurrentSettings;
-- css::uno::Reference< css::frame::XModel > m_xModel;
-+ VbaCommandBarHelperRef pCBarHelper;
-+ css::uno::Reference< css::container::XIndexAccess > m_xBarSettings;
-+ rtl::OUString m_sResourceUrl;
-+ sal_Bool m_bIsMenu;
-+
-+ css::uno::Sequence< css::beans::PropertyValue > CreateMenuItemData( const rtl::OUString& sCommandURL, const rtl::OUString& sHelpURL, const rtl::OUString& sLabel, sal_uInt16 nType, const css::uno::Any& aSubMenu );
-+ css::uno::Sequence< css::beans::PropertyValue > CreateToolbarItemData( const rtl::OUString& sCommandURL, const rtl::OUString& sHelpURL, const rtl::OUString& sLabel, sal_uInt16 nType, const css::uno::Any& aSubMenu, sal_Bool isVisible, sal_Int32 nStyle );
-
- 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, const css::uno::Reference< css::frame::XModel >& xModel ) 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 );
-+ ScVbaCommandBarControls( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl ) throw( css::uno::RuntimeException );
-+ sal_Bool IsMenu(){ return m_bIsMenu; }
-
-- css::uno::Reference< css::frame::XModel > GetModel() { return m_xModel; }
-- // 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);
-diff --git vbahelper/source/vbahelper/vbacommandbarhelper.cxx vbahelper/source/vbahelper/vbacommandbarhelper.cxx
-new file mode 100644
-index 0000000..7c59107
---- /dev/null
-+++ vbahelper/source/vbahelper/vbacommandbarhelper.cxx
-@@ -0,0 +1,175 @@
-+/*************************************************************************
-+ *
-+ * 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 "vbacommandbarhelper.hxx"
-+#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
-+#include <com/sun/star/ui/XUIConfigurationStorage.hpp>
-+#include <com/sun/star/ui/XModuleUIConfigurationManager.hpp>
-+#include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
-+#include <com/sun/star/ui/XUIElement.hpp>
-+#ifndef _COM_SUN_STAR_UI_UIElementType_HPP_
-+#include <com/sun/star/ui/UIElementType.hpp>
-+#endif
-+#include <comphelper/processfactory.hxx>
-+#include <vbahelper/vbahelper.hxx>
-+#include <time.h>
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+
-+
-+VbaCommandBarHelper::VbaCommandBarHelper( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException) : mxContext( xContext ), mxModel( xModel )
-+{
-+ Init();
-+}
-+
-+void VbaCommandBarHelper::Init( ) throw (css::uno::RuntimeException)
-+{
-+ uno::Reference< css::ui::XUIConfigurationManagerSupplier > xUICfgSupplier( mxModel, uno::UNO_QUERY_THROW );
-+ m_xDocCfgMgr = xUICfgSupplier->getUIConfigurationManager();
-+
-+ uno::Reference< lang::XServiceInfo > xServiceInfo( mxModel, uno::UNO_QUERY_THROW );
-+ if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.SpreadsheetDocument") ) ) )
-+ {
-+ maModuleId = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.SpreadsheetDocument") );
-+ }
-+ else if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument" ) ) ) )
-+ {
-+ maModuleId = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument") );
-+ }
-+
-+ if( maModuleId.getLength() == 0 )
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+
-+ uno::Reference< lang::XMultiServiceFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
-+
-+ css::uno::Reference< css::ui::XModuleUIConfigurationManagerSupplier > xUICfgMgrSupp( xServiceManager->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.ModuleUIConfigurationManagerSupplier" ))), uno::UNO_QUERY_THROW );
-+
-+ m_xAppCfgMgr.set( xUICfgMgrSupp->getUIConfigurationManager( maModuleId ), uno::UNO_QUERY_THROW );
-+
-+ css::uno::Reference< css::container::XNameAccess > xNameAccess( xServiceManager->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.WindowStateConfiguration" ))), uno::UNO_QUERY_THROW );
-+
-+ m_xWindowState.set( xNameAccess->getByName( maModuleId ), uno::UNO_QUERY_THROW );
-+}
-+
-+css::uno::Reference< css::container::XIndexAccess > VbaCommandBarHelper::getMenuBarSettings() throw (css::uno::RuntimeException)
-+{
-+ return m_xAppCfgMgr->getSettings( getMenuBarUrl(), sal_True );
-+}
-+
-+sal_Bool VbaCommandBarHelper::persistChanges() throw (css::uno::RuntimeException)
-+{
-+ uno::Reference< css::ui::XUIConfigurationPersistence > xConfigPersistence( m_xAppCfgMgr, uno::UNO_QUERY_THROW );
-+ sal_Bool result = sal_False;
-+ if( xConfigPersistence->isModified() )
-+ {
-+ xConfigPersistence->store();
-+ result = sal_True;
-+ }
-+ return result;
-+}
-+
-+rtl::OUString VbaCommandBarHelper::getMenuBarUrl()
-+{
-+ static const rtl::OUString sMenuBarUrl( RTL_CONSTASCII_USTRINGPARAM( ITEM_MENUBAR_URL ) );
-+ return sMenuBarUrl;
-+}
-+
-+// return the resource url if found
-+rtl::OUString VbaCommandBarHelper::findToolbarByName( const css::uno::Reference< css::container::XNameAccess >& xNameAccess, const rtl::OUString& sName ) throw (css::uno::RuntimeException)
-+{
-+ rtl::OUString sUIName;
-+ rtl::OUString sResourceUrl;
-+ uno::Sequence< ::rtl::OUString > allNames = xNameAccess->getElementNames();
-+ for( sal_Int32 i = 0; i < allNames.getLength(); i++ )
-+ {
-+ sResourceUrl = allNames[i];
-+ if(sResourceUrl.indexOf( rtl::OUString::createFromAscii( ITEM_TOOLBAR_URL ) ) == 0 )
-+ {
-+ //OSL_TRACE("VbaCommandBarHelper::findToolbarByName, toolbar resource url: %s", rtl::OUStringToOString( sResourceUrl, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ if( m_xAppCfgMgr->hasSettings( sResourceUrl ) )
-+ {
-+ uno::Reference< beans::XPropertySet > xPropertySet( m_xAppCfgMgr->getSettings( sResourceUrl, sal_False ), uno::UNO_QUERY_THROW );
-+ xPropertySet->getPropertyValue( rtl::OUString::createFromAscii(ITEM_DESCRIPTOR_UINAME) ) >>= sUIName;
-+ // OSL_TRACE("VbaCommandBarHelper::findToolbarByName, toolbar ui name: %s", rtl::OUStringToOString( sUIName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ if( sName.equalsIgnoreAsciiCase( sUIName ) )
-+ return sResourceUrl;
-+ }
-+ }
-+ }
-+ return rtl::OUString();
-+}
-+
-+// if found, return the position of the control. if not found, return -1
-+sal_Int32 VbaCommandBarHelper::findControlByName( const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess, const rtl::OUString& sName ) throw (css::uno::RuntimeException)
-+{
-+ sal_Int32 nCount = xIndexAccess->getCount();
-+ css::uno::Sequence< css::beans::PropertyValue > aProps;
-+ for( sal_Int32 i = 0; i < nCount; i++ )
-+ {
-+ rtl::OUString sLabel;
-+ xIndexAccess->getByIndex( i ) >>= aProps;
-+ getPropertyValue( aProps, rtl::OUString::createFromAscii(ITEM_DESCRIPTOR_LABEL) ) >>= sLabel;
-+ // handle the hotkey character '~'
-+ rtl::OUString sNewLabel;
-+ sal_Int32 index = sLabel.indexOf( sal_Unicode('~') );
-+ if( index < 0 )
-+ sNewLabel = sLabel;
-+ else if( index == 0 )
-+ sNewLabel = sLabel.copy( index + 1);
-+ else if( index == sNewLabel.getLength() - 1 )
-+ sNewLabel = sLabel.copy(0, index );
-+ else
-+ sNewLabel = sLabel.copy( 0, index ) + sLabel.copy( index + 1 );
-+ OSL_TRACE("VbaCommandBarHelper::findControlByName, control name: %s", rtl::OUStringToOString( sNewLabel, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ if( sName.equalsIgnoreAsciiCase( sNewLabel ) )
-+ return i;
-+ }
-+
-+ // not found
-+ return -1;
-+}
-+
-+rtl::OUString VbaCommandBarHelper::generateCustomURL()
-+{
-+ rtl::OUString url = rtl::OUString::createFromAscii( ITEM_TOOLBAR_URL );
-+ url += rtl::OUString::createFromAscii( CUSTOM_TOOLBAR_STR );
-+
-+ // use a random number to minimize possible clash with existing custom toolbars
-+ srand( unsigned( time( NULL ) ));
-+ url += rtl::OUString::valueOf( sal_Int64( rand() ), 16 );
-+ return url;
-+}
-diff --git vbahelper/source/vbahelper/vbacommandbarhelper.hxx vbahelper/source/vbahelper/vbacommandbarhelper.hxx
-new file mode 100644
-index 0000000..a6304bc
---- /dev/null
-+++ vbahelper/source/vbahelper/vbacommandbarhelper.hxx
-@@ -0,0 +1,105 @@
-+/*************************************************************************
-+ *
-+ * 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 VBA_COMMANDBARHELPER_HXX
-+#define VBA_COMMANDBARHELPER_HXX
-+
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/frame/XModel.hpp>
-+#include <com/sun/star/uno/XComponentContext.hpp>
-+#include <com/sun/star/ui/XUIConfigurationManager.hpp>
-+#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
-+#include <com/sun/star/container/XIndexAccess.hpp>
-+#include <com/sun/star/container/XNameAccess.hpp>
-+#include <boost/shared_ptr.hpp>
-+
-+
-+static const char ITEM_DESCRIPTOR_COMMANDURL[] = "CommandURL";
-+static const char ITEM_DESCRIPTOR_HELPURL[] = "HelpURL";
-+static const char ITEM_DESCRIPTOR_CONTAINER[] = "ItemDescriptorContainer";
-+static const char ITEM_DESCRIPTOR_LABEL[] = "Label";
-+static const char ITEM_DESCRIPTOR_TYPE[] = "Type";
-+static const char ITEM_DESCRIPTOR_STYLE[] = "Style";
-+static const char ITEM_DESCRIPTOR_ISVISIBLE[] = "IsVisible";
-+static const char ITEM_DESCRIPTOR_RESOURCEURL[] = "ResourceURL";
-+static const char ITEM_DESCRIPTOR_UINAME[] = "UIName";
-+
-+static const char ITEM_MENUBAR_URL[] = "private:resource/menubar/menubar";
-+static const char ITEM_TOOLBAR_URL[] = "private:resource/toolbar/";
-+
-+static const char CUSTOM_TOOLBAR_STR[] = "custom_toolbar_";
-+static const char CUSTOM_MENU_STR[] = "vnd.openoffice.org:CustomMenu";
-+
-+class VbaCommandBarHelper;
-+typedef ::boost::shared_ptr< VbaCommandBarHelper > VbaCommandBarHelperRef;
-+
-+class VbaCommandBarHelper
-+{
-+private:
-+ css::uno::Reference< css::uno::XComponentContext > mxContext;
-+ css::uno::Reference< css::frame::XModel > mxModel;
-+ css::uno::Reference< css::ui::XUIConfigurationManager > m_xDocCfgMgr; // current document
-+ css::uno::Reference< css::ui::XUIConfigurationManager > m_xAppCfgMgr;
-+ css::uno::Reference< css::container::XNameAccess > m_xWindowState;
-+ rtl::OUString maModuleId;
-+
-+ void Init() throw (css::uno::RuntimeException);
-+public:
-+ VbaCommandBarHelper( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::frame::XModel >& xModel ) throw( css::uno::RuntimeException );
-+
-+ css::uno::Reference< css::frame::XModel > getModel() { return mxModel; }
-+
-+ css::uno::Reference< css::ui::XUIConfigurationManager > getDocCfgManager() throw (css::uno::RuntimeException)
-+ {
-+ return m_xDocCfgMgr;
-+ }
-+ css::uno::Reference< css::ui::XUIConfigurationManager > getAppCfgManager() throw (css::uno::RuntimeException)
-+ {
-+ return m_xAppCfgMgr;
-+ }
-+ css::uno::Reference< css::container::XIndexAccess > getMenuBarSettings() throw (css::uno::RuntimeException);
-+ css::uno::Reference< css::container::XNameAccess > getPersistentWindowState() throw (css::uno::RuntimeException)
-+ {
-+ return m_xWindowState;
-+ }
-+ sal_Bool persistChanges() throw (css::uno::RuntimeException);
-+
-+ const rtl::OUString getModuleId(){ return maModuleId; }
-+ static rtl::OUString getMenuBarUrl();
-+ rtl::OUString findToolbarByName( const css::uno::Reference< css::container::XNameAccess >& xNameAccess, const rtl::OUString& sName ) throw (css::uno::RuntimeException);
-+ static sal_Int32 findControlByName( const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess, const rtl::OUString& sName ) throw (css::uno::RuntimeException);
-+ static rtl::OUString generateCustomURL();
-+};
-+
-+#endif//VBA_COMMANDBARHELPER_HXX
-diff --git vbahelper/source/vbahelper/vbacommandbars.cxx vbahelper/source/vbahelper/vbacommandbars.cxx
-index 3aae99b..0f7881e 100644
---- vbahelper/source/vbahelper/vbacommandbars.cxx
-+++ vbahelper/source/vbahelper/vbacommandbars.cxx
-@@ -35,6 +35,10 @@
- #include <com/sun/star/lang/XServiceInfo.hpp>
- #include <com/sun/star/frame/XDesktop.hpp>
- #include <com/sun/star/container/XNameAccess.hpp>
-+#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
-+#include <com/sun/star/ui/XUIConfigurationStorage.hpp>
-+#include <com/sun/star/ui/XModuleUIConfigurationManager.hpp>
-+#include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
-
- #include "vbacommandbars.hxx"
- #include "vbacommandbar.hxx"
-@@ -42,22 +46,21 @@
- 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" ) );
-+typedef ::cppu::WeakImplHelper1< container::XEnumeration > CommandBarEnumeration_BASE;
-
- class CommandBarEnumeration : public CommandBarEnumeration_BASE
- {
-+ uno::Reference< XHelperInterface > m_xParent;
- uno::Reference< uno::XComponentContext > m_xContext;
-- uno::Reference< XCommandBars > m_xCommandBars;
-+ VbaCommandBarHelperRef pCBarHelper;
- uno::Sequence< rtl::OUString > m_sNames;
- sal_Int32 m_nCurrentPosition;
-- uno::Reference< frame::XModel > m_xModel;
- public:
-- CommandBarEnumeration( const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< XCommandBars > xCommandBars, const uno::Sequence< rtl::OUString > sNames, const uno::Reference< frame::XModel >& xModel ) : m_xContext( xContext ), m_xCommandBars( xCommandBars ), m_sNames( sNames ), m_nCurrentPosition( 0 ), m_xModel( xModel )
-+ CommandBarEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, VbaCommandBarHelperRef pHelper) throw ( uno::RuntimeException ) : m_xParent( xParent ), m_xContext( xContext ), pCBarHelper( pHelper ) , m_nCurrentPosition( 0 )
- {
-+ uno::Reference< container::XNameAccess > xNameAccess = pCBarHelper->getPersistentWindowState();
-+ m_sNames = xNameAccess->getElementNames();
- }
- virtual sal_Bool SAL_CALL hasMoreElements() throw ( uno::RuntimeException )
- {
-@@ -67,28 +70,14 @@ public:
- }
- virtual uno::Any SAL_CALL nextElement() throw ( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
- {
-+ // FIXME: should be add menubar
- if( hasMoreElements() )
- {
-- rtl::OUString sName( m_sNames[ m_nCurrentPosition ] );
-- m_nCurrentPosition = m_nCurrentPosition + 1;
-- if( sName.indexOf( rtl::OUString::createFromAscii("private:resource/toolbar/") ) != -1 )
-+ rtl::OUString sResourceUrl( m_sNames[ m_nCurrentPosition++ ] );
-+ if( sResourceUrl.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, m_xModel, sName, sal_True, sal_False ) );
-- if( xCommandBar.is() )
-- return uno::makeAny( xCommandBar );
-- else
-- return nextElement();
-- }
-- else
-- return nextElement();
-- }
-+ uno::Reference< container::XIndexAccess > xCBarSetting = pCBarHelper->getAppCfgManager()->getSettings( sResourceUrl, sal_True );
-+ uno::Reference< XCommandBar > xCommandBar( new ScVbaCommandBar( m_xParent, m_xContext, pCBarHelper, xCBarSetting, sResourceUrl, sal_False, sal_False ) );
- }
- else
- return nextElement();
-@@ -99,90 +88,99 @@ public:
- }
- };
-
--
--ScVbaCommandBars::ScVbaCommandBars( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< container::XIndexAccess > xIndexAccess, const uno::Reference< frame::XModel >& xModel ) : CommandBars_BASE( xParent, xContext, xIndexAccess ), m_xModel( xModel )
-+ScVbaCommandBars::ScVbaCommandBars( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess, const uno::Reference< frame::XModel >& xModel ) throw ( uno::RuntimeException ) : CommandBars_BASE( xParent, xContext, xIndexAccess )
- {
-- retrieveObjects();
-+ pCBarHelper.reset( new VbaCommandBarHelper( mxContext, xModel ) );
-+ m_xNameAccess = pCBarHelper->getPersistentWindowState();
- }
--void
--ScVbaCommandBars::retrieveObjects() throw ( uno::RuntimeException )
-+
-+ScVbaCommandBars::~ScVbaCommandBars()
- {
-- uno::Reference< lang::XServiceInfo > xServiceInfo( m_xModel, 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 );
-+ return XCommandBar::static_type( 0 );
- }
-+
- uno::Reference< container::XEnumeration >
- ScVbaCommandBars::createEnumeration() throw ( uno::RuntimeException )
- {
-- return uno::Reference< container::XEnumeration >( new CommandBarEnumeration( mxContext, this, m_xNameAccess->getElementNames(), m_xModel ) );
-+ return uno::Reference< container::XEnumeration >( new CommandBarEnumeration( this, mxContext, pCBarHelper ) );
- }
-
- 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 )
-+ rtl::OUString sResourceUrl;
-+ uno::Reference< container::XIndexAccess > xBarSettings;
-+ rtl::OUString sBarName;
-+ sal_Bool bMenu = sal_False;
-+ if( aSource >>= sBarName )
- {
-- sToolBarName = sToolBarName.toAsciiLowerCase();
-- if( sToolBarName.equalsIgnoreAsciiCase( rtl::OUString::createFromAscii("Worksheet Menu Bar") ) )
-- {
-- return uno::makeAny( uno::Reference< XCommandBar > ( new ScVbaCommandBar( this, mxContext, m_xModel, 0 ) ) );
-- }
-- else if( sToolBarName.equalsIgnoreAsciiCase( rtl::OUString::createFromAscii("Menu Bar") ) )
-+ if( sBarName.equalsIgnoreAsciiCase( rtl::OUString::createFromAscii("Worksheet Menu Bar") )
-+ || sBarName.equalsIgnoreAsciiCase( rtl::OUString::createFromAscii("Menu Bar") ) )
- {
-- return uno::makeAny( uno::Reference< XCommandBar > ( new ScVbaCommandBar( this, mxContext, m_xModel, 1 ) ) );
-+ // menu bar
-+ sResourceUrl = pCBarHelper->getMenuBarUrl();
-+ bMenu = sal_True;
- }
-- else if( checkToolBarExist( sToolBarName ) )
-+ else
- {
-- return uno::makeAny( uno::Reference< XCommandBar > (new ScVbaCommandBar( this, mxContext, m_xModel, sToolBarName, sal_True, sal_False ) ) );
-+ sResourceUrl = pCBarHelper->findToolbarByName( m_xNameAccess, sBarName );
-+ bMenu = sal_False;
- }
- }
-- return uno::Any();
-+
-+ if( sResourceUrl.getLength() )
-+ xBarSettings = pCBarHelper->getAppCfgManager()->getSettings( sResourceUrl, sal_True );
-+ else
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Toolbar do not exist") ), uno::Reference< uno::XInterface >() );
-+
-+ return uno::Any( uno::Reference< XCommandBar >( new ScVbaCommandBar( this, mxContext, pCBarHelper, xBarSettings, sResourceUrl, bMenu, sal_False ) ) );
- }
-
- // 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)
- {
-+ // FIXME: only support to add Toolbar
- // Position - MsoBar MenuBar - sal_Bool
- // Currently only the Name is supported.
- rtl::OUString sName;
-- if( !( Name >>= sName ) )
-+ if( Name.hasValue() )
-+ Name >>= sName;
-+
-+ rtl::OUString sResourceUrl;
-+ if( sName.getLength() )
- {
-- sName = rtl::OUString::createFromAscii("Custom1");
-+ sResourceUrl = pCBarHelper->findToolbarByName( m_xNameAccess, sName );
-+ if( sResourceUrl.getLength() )
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Toolbar exists") ), uno::Reference< uno::XInterface >() );
- }
-- sal_Bool bTemporary = false;
-- if( !( Temporary >>= bTemporary ) )
-+ else
- {
-- bTemporary = sal_True;
-- }
-- return uno::Reference< XCommandBar >( new ScVbaCommandBar( this, mxContext, m_xModel, sName.toAsciiLowerCase(), bTemporary, sal_True ) );
-+ sName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Custom1") );
-+ }
-+
-+ sal_Bool bTemporary = sal_False;
-+ if( Temporary.hasValue() )
-+ Temporary >>= bTemporary;
-+
-+ sResourceUrl = VbaCommandBarHelper::generateCustomURL();
-+ uno::Reference< container::XIndexAccess > xBarSettings( pCBarHelper->getAppCfgManager()->createSettings(), uno::UNO_QUERY_THROW );
-+ uno::Reference< XCommandBar > xCBar( new ScVbaCommandBar( this, mxContext, pCBarHelper, xBarSettings, sResourceUrl, sal_False, bTemporary ) );
-+ xCBar->setName( sName );
-+ return xCBar;
- }
- sal_Int32 SAL_CALL
- ScVbaCommandBars::getCount() throw(css::uno::RuntimeException)
- {
- // Filter out all toolbars from the window collection
-- sal_Int32 nCount = 0;
-+ sal_Int32 nCount = 1; // there is a Menubar in OOo
- uno::Sequence< ::rtl::OUString > allNames = m_xNameAccess->getElementNames();
- for( sal_Int32 i = 0; i < allNames.getLength(); i++ )
- {
-@@ -209,9 +207,9 @@ ScVbaCommandBars::Item( const uno::Any& aIndex, const uno::Any& /*aIndex2*/ ) th
- if( nIndex == 1 )
- {
- uno::Any aSource;
-- if( m_sModuleName.equalsIgnoreAsciiCase( sSpreadsheetDocumentUrl ) )
-+ if( pCBarHelper->getModuleId().equalsAscii( "com.sun.star.sheet.SpreadsheetDocument" ) )
- aSource <<= rtl::OUString::createFromAscii( "Worksheet Menu Bar" );
-- else if( m_sModuleName.equalsIgnoreAsciiCase( sTextDocumentUrl ) )
-+ else if( pCBarHelper->getModuleId().equalsAscii("com.sun.star.text.TextDocument") )
- aSource <<= rtl::OUString::createFromAscii( "Menu Bar" );
- if( aSource.hasValue() )
- return createCollectionObject( aSource );
-@@ -219,28 +217,6 @@ ScVbaCommandBars::Item( const uno::Any& aIndex, const uno::Any& /*aIndex2*/ ) th
- 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()
-diff --git vbahelper/source/vbahelper/vbacommandbars.hxx vbahelper/source/vbahelper/vbacommandbars.hxx
-index d1ebf4b..2c0cc3f 100644
---- vbahelper/source/vbahelper/vbacommandbars.hxx
-+++ vbahelper/source/vbahelper/vbacommandbars.hxx
-@@ -38,32 +38,22 @@
- #include <ooo/vba/XCommandBar.hpp>
- #include <ooo/vba/XCommandBars.hpp>
- #include <com/sun/star/container/XNameAccess.hpp>
--
- #include <cppuhelper/implbase1.hxx>
--
- #include <vbahelper/vbahelperinterface.hxx>
- #include <vbahelper/vbacollectionimpl.hxx>
-+#include "vbacommandbarhelper.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 );
--protected:
-- css::uno::Reference< css::frame::XModel > m_xModel;
-+ VbaCommandBarHelperRef pCBarHelper;
-+
- 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, const css::uno::Reference< css::frame::XModel >& xModel );
-+ ScVbaCommandBars( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess, const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
-+ virtual ~ScVbaCommandBars();
-
-- 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
-diff --git vbahelper/source/vbahelper/vbahelper.cxx vbahelper/source/vbahelper/vbahelper.cxx
-index 2a51ee4..8290f66 100644
---- vbahelper/source/vbahelper/vbahelper.cxx
-+++ vbahelper/source/vbahelper/vbahelper.cxx
-@@ -917,6 +917,33 @@ void setDefaultPropByIntrospection( const uno::Any& aObj, const uno::Any& aValue
- throw uno::RuntimeException();
- }
-
-+uno::Any getPropertyValue( const uno::Sequence< beans::PropertyValue >& aProp, const rtl::OUString& aName )
-+{
-+ uno::Any result;
-+ for ( sal_Int32 i = 0; i < aProp.getLength(); i++ )
-+ {
-+ if ( aProp[i].Name.equals(aName) )
-+ {
-+ aProp[i].Value >>= result;
-+ return result;
-+ }
-+ }
-+ return result;
-+}
-+
-+sal_Bool setPropertyValue( uno::Sequence< beans::PropertyValue >& aProp, const rtl::OUString& aName, const uno::Any& aValue )
-+{
-+ for ( sal_Int32 i = 0; i < aProp.getLength(); i++ )
-+ {
-+ if ( aProp[i].Name.equals(aName) )
-+ {
-+ aProp[i].Value = aValue;
-+ return sal_True;
-+ }
-+ }
-+ return sal_False;
-+}
-+
- #define VBA_LEFT "PositionX"
- #define VBA_TOP "PositionY"
- UserFormGeometryHelper::UserFormGeometryHelper( const uno::Reference< uno::XComponentContext >& /*xContext*/, const uno::Reference< awt::XControl >& xControl )
diff --git a/patches/vba/vba-commandbar-toolbar-fix.diff b/patches/vba/vba-commandbar-toolbar-fix.diff
deleted file mode 100644
index 712905f28..000000000
--- a/patches/vba/vba-commandbar-toolbar-fix.diff
+++ /dev/null
@@ -1,67 +0,0 @@
-diff --git vbahelper/source/vbahelper/vbacommandbarhelper.cxx vbahelper/source/vbahelper/vbacommandbarhelper.cxx
-index cb87814..b82578d 100644
---- vbahelper/source/vbahelper/vbacommandbarhelper.cxx
-+++ vbahelper/source/vbahelper/vbacommandbarhelper.cxx
-@@ -197,10 +197,22 @@ uno::Reference< frame::XLayoutManager > VbaCommandBarHelper::getLayoutManager()
- return xLayoutManager;
- }
-
-+sal_Bool VbaCommandBarHelper::hasToolbar( const rtl::OUString& sResourceUrl, const rtl::OUString& sName ) throw (css::uno::RuntimeException)
-+{
-+ if( m_xDocCfgMgr->hasSettings( sResourceUrl ) )
-+ {
-+ rtl::OUString sUIName;
-+ uno::Reference< beans::XPropertySet > xPropertySet( m_xDocCfgMgr->getSettings( sResourceUrl, sal_False ), uno::UNO_QUERY_THROW );
-+ xPropertySet->getPropertyValue( rtl::OUString::createFromAscii(ITEM_DESCRIPTOR_UINAME) ) >>= sUIName;
-+ if( sName.equalsIgnoreAsciiCase( sUIName ) )
-+ return sal_True;
-+ }
-+ return sal_False;
-+}
-+
- // return the resource url if found
- rtl::OUString VbaCommandBarHelper::findToolbarByName( const css::uno::Reference< css::container::XNameAccess >& xNameAccess, const rtl::OUString& sName ) throw (css::uno::RuntimeException)
- {
-- rtl::OUString sUIName;
- rtl::OUString sResourceUrl;
-
- // check if it is an buildin toolbar
-@@ -214,17 +226,17 @@ rtl::OUString VbaCommandBarHelper::findToolbarByName( const css::uno::Reference<
- sResourceUrl = allNames[i];
- if(sResourceUrl.indexOf( rtl::OUString::createFromAscii( ITEM_TOOLBAR_URL ) ) == 0 )
- {
-- //OSL_TRACE("VbaCommandBarHelper::findToolbarByName, toolbar resource url: %s", rtl::OUStringToOString( sResourceUrl, RTL_TEXTENCODING_UTF8 ).getStr() );
-- if( m_xDocCfgMgr->hasSettings( sResourceUrl ) )
-- {
-- uno::Reference< beans::XPropertySet > xPropertySet( m_xDocCfgMgr->getSettings( sResourceUrl, sal_False ), uno::UNO_QUERY_THROW );
-- xPropertySet->getPropertyValue( rtl::OUString::createFromAscii(ITEM_DESCRIPTOR_UINAME) ) >>= sUIName;
-- // OSL_TRACE("VbaCommandBarHelper::findToolbarByName, toolbar ui name: %s", rtl::OUStringToOString( sUIName, RTL_TEXTENCODING_UTF8 ).getStr() );
-- if( sName.equalsIgnoreAsciiCase( sUIName ) )
-- return sResourceUrl;
-- }
-+ if( hasToolbar( sResourceUrl, sName ) )
-+ return sResourceUrl;
- }
- }
-+
-+ // the customize toolbars creating during importing, shoud found there.
-+ static rtl::OUString sToolbarPrefix( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/custom_" ) );
-+ sResourceUrl = sToolbarPrefix.concat( sName );
-+ if( hasToolbar( sResourceUrl, sName ) )
-+ return sResourceUrl;
-+
- return rtl::OUString();
- }
-
-diff --git vbahelper/source/vbahelper/vbacommandbarhelper.hxx vbahelper/source/vbahelper/vbacommandbarhelper.hxx
-index 22ea158..e6b0358 100644
---- vbahelper/source/vbahelper/vbacommandbarhelper.hxx
-+++ vbahelper/source/vbahelper/vbacommandbarhelper.hxx
-@@ -76,6 +76,7 @@ private:
- rtl::OUString maModuleId;
-
- void Init() throw (css::uno::RuntimeException);
-+ sal_Bool hasToolbar( const rtl::OUString& sResourceUrl, const rtl::OUString& sName ) throw (css::uno::RuntimeException);
- public:
- VbaCommandBarHelper( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::frame::XModel >& xModel ) throw( css::uno::RuntimeException );
-
diff --git a/patches/vba/vba-commandbarcontrol-enabled.diff b/patches/vba/vba-commandbarcontrol-enabled.diff
deleted file mode 100644
index d65a3d650..000000000
--- a/patches/vba/vba-commandbarcontrol-enabled.diff
+++ /dev/null
@@ -1,309 +0,0 @@
-diff --git oovbaapi/ooo/vba/XCommandBarControl.idl oovbaapi/ooo/vba/XCommandBarControl.idl
-index 167bce8..b10750e 100644
---- oovbaapi/ooo/vba/XCommandBarControl.idl
-+++ oovbaapi/ooo/vba/XCommandBarControl.idl
-@@ -55,6 +55,7 @@ interface XCommandBarControl
- [attribute] string OnAction;
- [attribute] boolean Visible;
- [attribute, readonly] long Type;
-+ [attribute] boolean Enabled;
-
- void Delete() raises ( com::sun::star::script::BasicErrorException );
- any Controls( [in] any Index ) raises ( com::sun::star::script::BasicErrorException );
-diff --git vbahelper/source/vbahelper/vbacommandbar.cxx vbahelper/source/vbahelper/vbacommandbar.cxx
-index 43abe41..8c10277 100644
---- vbahelper/source/vbahelper/vbacommandbar.cxx
-+++ vbahelper/source/vbahelper/vbacommandbar.cxx
-@@ -128,9 +128,7 @@ ScVbaCommandBar::setVisible( ::sal_Bool _visible ) throw (uno::RuntimeException)
- {
- try
- {
-- uno::Reference< frame::XFrame > xFrame( pCBarHelper->getModel()->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 );
-+ uno::Reference< frame::XLayoutManager > xLayoutManager = pCBarHelper->getLayoutManager();
- if( _visible )
- {
- xLayoutManager->createElement( m_sResourceUrl );
-@@ -151,16 +149,15 @@ ScVbaCommandBar::setVisible( ::sal_Bool _visible ) throw (uno::RuntimeException)
- ::sal_Bool SAL_CALL
- ScVbaCommandBar::getEnabled() throw (uno::RuntimeException)
- {
-- // #FIXME: seems tha main menu is alwayse enabled.
-- // for the toolbar, need to investigate
-- return sal_True;
-+ // emulated with Visible
-+ return getVisible();
- }
-
- void SAL_CALL
--ScVbaCommandBar::setEnabled( sal_Bool/* _enabled */ ) throw (uno::RuntimeException)
-+ScVbaCommandBar::setEnabled( sal_Bool _enabled ) throw (uno::RuntimeException)
- {
-- // #FIXME: seems tha main menu is alwayse enabled.
-- // for the toolbar, need to investigate
-+ // emulated with Visible
-+ setVisible( _enabled );
- }
-
- void SAL_CALL
-@@ -189,7 +186,14 @@ ScVbaCommandBar::Delete( ) throw (script::BasicErrorException, uno::RuntimeExce
- uno::Any SAL_CALL
- ScVbaCommandBar::Controls( const uno::Any& aIndex ) throw (script::BasicErrorException, uno::RuntimeException)
- {
-- uno::Reference< XCommandBarControls > xCommandBarControls( new ScVbaCommandBarControls( this, mxContext, m_xBarSettings, pCBarHelper, m_xBarSettings, m_sResourceUrl ) );
-+ uno::Reference< awt::XMenu > xMenu;
-+ if( m_bIsMenu )
-+ {
-+ uno::Reference< frame::XLayoutManager > xLayoutManager = pCBarHelper->getLayoutManager();
-+ uno::Reference< beans::XPropertySet > xPropertySet( xLayoutManager->getElement( m_sResourceUrl ), uno::UNO_QUERY_THROW );
-+ xMenu.set( xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("XMenuBar") ), uno::UNO_QUERY );
-+ }
-+ uno::Reference< XCommandBarControls > xCommandBarControls( new ScVbaCommandBarControls( this, mxContext, m_xBarSettings, pCBarHelper, m_xBarSettings, m_sResourceUrl, xMenu ) );
- if( aIndex.hasValue() )
- {
- return xCommandBarControls->Item( aIndex, uno::Any() );
-diff --git vbahelper/source/vbahelper/vbacommandbarcontrol.cxx vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
-index dd20256..050af79 100644
---- vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
-+++ vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
-@@ -118,6 +118,39 @@ ScVbaCommandBarControl::setVisible( ::sal_Bool _visible ) throw (uno::RuntimeExc
- }
- }
-
-+::sal_Bool SAL_CALL
-+ScVbaCommandBarControl::getEnabled() throw (uno::RuntimeException)
-+{
-+ sal_Bool bEnabled = sal_True;
-+ if( m_xParentMenu.is() )
-+ {
-+ // currently only the menu in the MenuBat support Enable/Disable
-+ // FIXME: how to support the menu item in Toolbar
-+ bEnabled = m_xParentMenu->isItemEnabled( m_xParentMenu->getItemId( m_nPosition ) );
-+ }
-+ else
-+ {
-+ // emulated with Visible
-+ bEnabled = getVisible();
-+ }
-+ return bEnabled;
-+}
-+
-+void SAL_CALL
-+ScVbaCommandBarControl::setEnabled( sal_Bool _enabled ) throw (uno::RuntimeException)
-+{
-+ if( m_xParentMenu.is() )
-+ {
-+ // currently only the menu in the MenuBat support Enable/Disable
-+ m_xParentMenu->enableItem( m_xParentMenu->getItemId( m_nPosition ), _enabled );
-+ }
-+ else
-+ {
-+ // emulated with Visible
-+ setVisible( _enabled );
-+ }
-+}
-+
- void SAL_CALL
- ScVbaCommandBarControl::Delete( ) throw (script::BasicErrorException, uno::RuntimeException)
- {
-@@ -150,8 +183,15 @@ ScVbaCommandBarControl::Controls( const uno::Any& aIndex ) throw (script::BasicE
- getPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_CONTAINER ) ) >>= xSubMenu;
- if( !xSubMenu.is() )
- throw uno::RuntimeException();
-+
-+ uno::Reference< awt::XMenu > xMenu;
-+ if( m_xParentMenu.is() )
-+ {
-+ sal_Int32 nItemId = m_xParentMenu->getItemId( m_nPosition );
-+ xMenu.set( m_xParentMenu->getPopupMenu( nItemId ), uno::UNO_QUERY );
-+ }
-
-- uno::Reference< XCommandBarControls > xCommandBarControls( new ScVbaCommandBarControls( this, mxContext, xSubMenu, pCBarHelper, m_xBarSettings, m_sResourceUrl ) );
-+ uno::Reference< XCommandBarControls > xCommandBarControls( new ScVbaCommandBarControls( this, mxContext, xSubMenu, pCBarHelper, m_xBarSettings, m_sResourceUrl, xMenu ) );
- if( aIndex.hasValue() )
- {
- return xCommandBarControls->Item( aIndex, uno::Any() );
-@@ -179,11 +219,12 @@ ScVbaCommandBarControl::getServiceNames()
- }
-
- //////////// ScVbaCommandBarPopup //////////////////////////////
--ScVbaCommandBarPopup::ScVbaCommandBarPopup( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Int32 nPosition, sal_Bool bTemporary ) throw (css::uno::RuntimeException) : CommandBarPopup_BASE( xParent, xContext, xSettings, pHelper, xBarSettings, sResourceUrl )
-+ScVbaCommandBarPopup::ScVbaCommandBarPopup( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Int32 nPosition, sal_Bool bTemporary, const css::uno::Reference< css::awt::XMenu >& xMenu ) throw (css::uno::RuntimeException) : CommandBarPopup_BASE( xParent, xContext, xSettings, pHelper, xBarSettings, sResourceUrl )
- {
- m_nPosition = nPosition;
- m_bTemporary = bTemporary;
- m_xCurrentSettings->getByIndex( m_nPosition ) >>= m_aPropertyValues;
-+ m_xParentMenu = xMenu;
- }
-
- rtl::OUString&
-@@ -205,11 +246,12 @@ ScVbaCommandBarPopup::getServiceNames()
- }
-
- //////////// ScVbaCommandBarButton //////////////////////////////
--ScVbaCommandBarButton::ScVbaCommandBarButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Int32 nPosition, sal_Bool bTemporary ) throw (css::uno::RuntimeException) : CommandBarButton_BASE( xParent, xContext, xSettings, pHelper, xBarSettings, sResourceUrl )
-+ScVbaCommandBarButton::ScVbaCommandBarButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Int32 nPosition, sal_Bool bTemporary, const css::uno::Reference< css::awt::XMenu >& xMenu ) throw (css::uno::RuntimeException) : CommandBarButton_BASE( xParent, xContext, xSettings, pHelper, xBarSettings, sResourceUrl )
- {
- m_nPosition = nPosition;
- m_bTemporary = bTemporary;
- m_xCurrentSettings->getByIndex( m_nPosition ) >>= m_aPropertyValues;
-+ m_xParentMenu = xMenu;
- }
-
- rtl::OUString&
-diff --git vbahelper/source/vbahelper/vbacommandbarcontrol.hxx vbahelper/source/vbahelper/vbacommandbarcontrol.hxx
-index f40ad82..0d2d30b 100644
---- vbahelper/source/vbahelper/vbacommandbarcontrol.hxx
-+++ vbahelper/source/vbahelper/vbacommandbarcontrol.hxx
-@@ -39,6 +39,7 @@
- #include <ooo/vba/XCommandBarPopup.hpp>
- #include <ooo/vba/XCommandBarButton.hpp>
- #include <ooo/vba/office/MsoControlType.hpp>
-+#include <com/sun/star/awt/XMenu.hpp>
- #include <vbahelper/vbahelperinterface.hxx>
- #include "vbacommandbarhelper.hxx"
- #include <cppuhelper/implbase1.hxx>
-@@ -53,6 +54,7 @@ protected:
- css::uno::Reference< css::container::XIndexAccess > m_xCurrentSettings;
- css::uno::Reference< css::container::XIndexAccess > m_xBarSettings;
- css::uno::Sequence< css::beans::PropertyValue > m_aPropertyValues;
-+ css::uno::Reference< css::awt::XMenu > m_xParentMenu;
-
- sal_Int32 m_nPosition;
- sal_Bool m_bTemporary;
-@@ -71,6 +73,8 @@ public:
- 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);
-+ virtual ::sal_Bool SAL_CALL getEnabled() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setEnabled( ::sal_Bool _enabled ) throw (css::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException)
- {
- return ov::office::MsoControlType::msoControlButton;
-@@ -89,7 +93,7 @@ typedef cppu::ImplInheritanceHelper1< ScVbaCommandBarControl, ov::XCommandBarPop
- class ScVbaCommandBarPopup : public CommandBarPopup_BASE
- {
- public:
-- ScVbaCommandBarPopup( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Int32 nPosition, sal_Bool bTemporary ) throw (css::uno::RuntimeException);
-+ ScVbaCommandBarPopup( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Int32 nPosition, sal_Bool bTemporary, const css::uno::Reference< css::awt::XMenu >& xMenu ) throw (css::uno::RuntimeException);
-
- virtual sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException)
- {
-@@ -104,7 +108,7 @@ typedef cppu::ImplInheritanceHelper1< ScVbaCommandBarControl, ov::XCommandBarBut
- class ScVbaCommandBarButton : public CommandBarButton_BASE
- {
- public:
-- ScVbaCommandBarButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Int32 nPosition, sal_Bool bTemporary ) throw (css::uno::RuntimeException);
-+ ScVbaCommandBarButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xSettings, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, sal_Int32 nPosition, sal_Bool bTemporary, const css::uno::Reference< css::awt::XMenu >& xMenu ) throw (css::uno::RuntimeException);
-
- virtual sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException)
- {
-diff --git vbahelper/source/vbahelper/vbacommandbarcontrols.cxx vbahelper/source/vbahelper/vbacommandbarcontrols.cxx
-index ea56a09..488b56a 100644
---- vbahelper/source/vbahelper/vbacommandbarcontrols.cxx
-+++ vbahelper/source/vbahelper/vbacommandbarcontrols.cxx
-@@ -63,7 +63,7 @@ public:
- }
- };
-
--ScVbaCommandBarControls::ScVbaCommandBarControls( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess>& xIndexAccess, VbaCommandBarHelperRef pHelper, const uno::Reference< container::XIndexAccess>& xBarSettings, const rtl::OUString& sResourceUrl ) throw (uno::RuntimeException) : CommandBarControls_BASE( xParent, xContext, xIndexAccess ), pCBarHelper( pHelper ), m_xBarSettings( xBarSettings ), m_sResourceUrl( sResourceUrl )
-+ScVbaCommandBarControls::ScVbaCommandBarControls( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess>& xIndexAccess, VbaCommandBarHelperRef pHelper, const uno::Reference< container::XIndexAccess>& xBarSettings, const rtl::OUString& sResourceUrl, const uno::Reference< awt::XMenu >& xMenu ) throw (uno::RuntimeException) : CommandBarControls_BASE( xParent, xContext, xIndexAccess ), pCBarHelper( pHelper ), m_xBarSettings( xBarSettings ), m_sResourceUrl( sResourceUrl ), m_xMenu( xMenu )
- {
- m_bIsMenu = sResourceUrl.equalsAscii( ITEM_MENUBAR_URL ) ? sal_True : sal_False;
- }
-@@ -132,9 +132,9 @@ ScVbaCommandBarControls::createCollectionObject( const uno::Any& aSource )
- getPropertyValue( aProps, rtl::OUString::createFromAscii( ITEM_DESCRIPTOR_CONTAINER ) ) >>= xSubMenu;
- ScVbaCommandBarControl* pNewCommandBarControl = NULL;
- if( xSubMenu.is() )
-- pNewCommandBarControl = new ScVbaCommandBarPopup( this, mxContext, m_xIndexAccess, pCBarHelper, m_xBarSettings, m_sResourceUrl, nPosition, sal_True );
-+ pNewCommandBarControl = new ScVbaCommandBarPopup( this, mxContext, m_xIndexAccess, pCBarHelper, m_xBarSettings, m_sResourceUrl, nPosition, sal_True, m_xMenu );
- else
-- pNewCommandBarControl = new ScVbaCommandBarButton( this, mxContext, m_xIndexAccess, pCBarHelper, m_xBarSettings, m_sResourceUrl, nPosition, sal_True );
-+ pNewCommandBarControl = new ScVbaCommandBarButton( this, mxContext, m_xIndexAccess, pCBarHelper, m_xBarSettings, m_sResourceUrl, nPosition, sal_True, m_xMenu );
-
- return uno::makeAny( uno::Reference< XCommandBarControl > ( pNewCommandBarControl ) );
- }
-@@ -227,11 +227,12 @@ ScVbaCommandBarControls::Add( const uno::Any& Type, const uno::Any& Id, const un
- if( !bTemporary )
- pCBarHelper->persistChanges();
-
-+ // sometimes it would crash if passing m_xMenu instead of uno::Reference< awt::XMenu >() in Linux.
- ScVbaCommandBarControl* pNewCommandBarControl = NULL;
- if( nType == office::MsoControlType::msoControlPopup )
-- pNewCommandBarControl = new ScVbaCommandBarPopup( this, mxContext, m_xIndexAccess, pCBarHelper, m_xBarSettings, m_sResourceUrl, nPosition, bTemporary );
-+ pNewCommandBarControl = new ScVbaCommandBarPopup( this, mxContext, m_xIndexAccess, pCBarHelper, m_xBarSettings, m_sResourceUrl, nPosition, bTemporary, uno::Reference< awt::XMenu >() );
- else
-- pNewCommandBarControl = new ScVbaCommandBarButton( this, mxContext, m_xIndexAccess, pCBarHelper, m_xBarSettings, m_sResourceUrl, nPosition, bTemporary );
-+ pNewCommandBarControl = new ScVbaCommandBarButton( this, mxContext, m_xIndexAccess, pCBarHelper, m_xBarSettings, m_sResourceUrl, nPosition, bTemporary, uno::Reference< awt::XMenu >() );
-
- return uno::Reference< XCommandBarControl >( pNewCommandBarControl );
- }
-diff --git vbahelper/source/vbahelper/vbacommandbarcontrols.hxx vbahelper/source/vbahelper/vbacommandbarcontrols.hxx
-index fa37f10..ce89794 100644
---- vbahelper/source/vbahelper/vbacommandbarcontrols.hxx
-+++ vbahelper/source/vbahelper/vbacommandbarcontrols.hxx
-@@ -36,6 +36,7 @@
- #define SC_VBA_COMMANDBARCONTROLS_HXX
-
- #include <ooo/vba/XCommandBarControls.hpp>
-+#include <com/sun/star/awt/XMenu.hpp>
- #include <vbahelper/vbahelperinterface.hxx>
- #include <vbahelper/vbacollectionimpl.hxx>
- #include "vbacommandbarhelper.hxx"
-@@ -48,13 +49,14 @@ private:
- VbaCommandBarHelperRef pCBarHelper;
- css::uno::Reference< css::container::XIndexAccess > m_xBarSettings;
- rtl::OUString m_sResourceUrl;
-+ css::uno::Reference< css::awt::XMenu > m_xMenu;
- sal_Bool m_bIsMenu;
-
- css::uno::Sequence< css::beans::PropertyValue > CreateMenuItemData( const rtl::OUString& sCommandURL, const rtl::OUString& sHelpURL, const rtl::OUString& sLabel, sal_uInt16 nType, const css::uno::Any& aSubMenu );
- css::uno::Sequence< css::beans::PropertyValue > CreateToolbarItemData( const rtl::OUString& sCommandURL, const rtl::OUString& sHelpURL, const rtl::OUString& sLabel, sal_uInt16 nType, const css::uno::Any& aSubMenu, sal_Bool isVisible, sal_Int32 nStyle );
-
- 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, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl ) throw( css::uno::RuntimeException );
-+ ScVbaCommandBarControls( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess, VbaCommandBarHelperRef pHelper, const css::uno::Reference< css::container::XIndexAccess >& xBarSettings, const rtl::OUString& sResourceUrl, const css::uno::Reference< css::awt::XMenu >& xMenu ) throw( css::uno::RuntimeException );
- sal_Bool IsMenu(){ return m_bIsMenu; }
-
- // XEnumerationAccess
-diff --git vbahelper/source/vbahelper/vbacommandbarhelper.cxx vbahelper/source/vbahelper/vbacommandbarhelper.cxx
-index b4515b6..034e506 100644
---- vbahelper/source/vbahelper/vbacommandbarhelper.cxx
-+++ vbahelper/source/vbahelper/vbacommandbarhelper.cxx
-@@ -155,6 +155,14 @@ sal_Bool VbaCommandBarHelper::persistChanges() throw (css::uno::RuntimeException
- return result;
- }
-
-+uno::Reference< frame::XLayoutManager > VbaCommandBarHelper::getLayoutManager() throw (uno::RuntimeException)
-+{
-+ uno::Reference< frame::XFrame > xFrame( getModel()->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 );
-+ return xLayoutManager;
-+}
-+
- rtl::OUString VbaCommandBarHelper::getMenuBarUrl()
- {
- static const rtl::OUString sMenuBarUrl( RTL_CONSTASCII_USTRINGPARAM( ITEM_MENUBAR_URL ) );
-diff --git vbahelper/source/vbahelper/vbacommandbarhelper.hxx vbahelper/source/vbahelper/vbacommandbarhelper.hxx
-index a6304bc..64a808d 100644
---- vbahelper/source/vbahelper/vbacommandbarhelper.hxx
-+++ vbahelper/source/vbahelper/vbacommandbarhelper.hxx
-@@ -42,6 +42,7 @@
- #include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
- #include <com/sun/star/container/XIndexAccess.hpp>
- #include <com/sun/star/container/XNameAccess.hpp>
-+#include <com/sun/star/frame/XLayoutManager.hpp>
- #include <boost/shared_ptr.hpp>
-
-
-@@ -95,6 +96,8 @@ public:
- }
- sal_Bool persistChanges() throw (css::uno::RuntimeException);
-
-+ css::uno::Reference< css::frame::XLayoutManager > getLayoutManager() throw (css::uno::RuntimeException);
-+
- const rtl::OUString getModuleId(){ return maModuleId; }
- static rtl::OUString getMenuBarUrl();
- rtl::OUString findToolbarByName( const css::uno::Reference< css::container::XNameAccess >& xNameAccess, const rtl::OUString& sName ) throw (css::uno::RuntimeException);
diff --git a/patches/vba/vba-compatible-mode-uno.diff b/patches/vba/vba-compatible-mode-uno.diff
deleted file mode 100644
index 7f659cdfb..000000000
--- a/patches/vba/vba-compatible-mode-uno.diff
+++ /dev/null
@@ -1,277 +0,0 @@
---- /dev/null 2008-06-07 03:39:59.000000000 +0800
-+++ offapi/com/sun/star/script/XVBACompat.idl 2008-09-01 15:40:32.000000000 +0800
-@@ -0,0 +1,49 @@
-+/*************************************************************************
-+ *
-+ * 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: XLibraryContainer.idl,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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __com_sun_star_script_XVBACompat_idl__
-+#define __com_sun_star_script_XVBACompat_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+//=============================================================================
-+
-+module com { module sun { module star { module script {
-+
-+interface XVBACompat: com::sun::star::uno::XInterface
-+{
-+
-+//=============================================================================
-+ [attribute ] boolean VBACompatModeOn;
-+
-+}; }; }; };
-+};
-+#endif
---- offapi/com/sun/star/script/makefile.mk.orig 2008-09-02 14:58:12.000000000 +0800
-+++ offapi/com/sun/star/script/makefile.mk 2008-09-01 15:40:32.000000000 +0800
-@@ -52,6 +52,7 @@ IDLFILES=\
- XPersistentLibraryContainer.idl\
- XStorageBasedLibraryContainer.idl\
- XLibraryQueryExecutable.idl \
-+ XVBACompat.idl\
- ModuleSizeExceededRequest.idl\
-
- # ------------------------------------------------------------------
---- basic/source/inc/namecont.hxx.orig 2008-09-02 14:40:13.000000000 +0800
-+++ basic/source/inc/namecont.hxx 2008-09-01 16:06:08.000000000 +0800
-@@ -63,20 +63,23 @@
- #include <cppuhelper/implbase2.hxx>
- #include <cppuhelper/compbase6.hxx>
- #include <cppuhelper/compbase7.hxx>
-+#include <cppuhelper/compbase8.hxx>
- #include <cppuhelper/interfacecontainer.hxx>
-+#include <com/sun/star/script/XVBACompat.hpp>
-
- class BasicManager;
-
- namespace basic
- {
-
--typedef ::cppu::WeakComponentImplHelper7<
-+typedef ::cppu::WeakComponentImplHelper8<
- ::com::sun::star::lang::XInitialization,
- ::com::sun::star::script::XStorageBasedLibraryContainer,
- ::com::sun::star::script::XLibraryContainerPassword,
- ::com::sun::star::script::XLibraryContainerExport,
- ::com::sun::star::container::XContainer,
- ::com::sun::star::script::XLibraryQueryExecutable,
-+ ::com::sun::star::script::XVBACompat,
- ::com::sun::star::lang::XServiceInfo > LibraryContainerHelper;
-
- typedef ::cppu::WeakImplHelper2< ::com::sun::star::container::XNameContainer,
-@@ -499,6 +502,10 @@ public:
- throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
- throw (::com::sun::star::uno::RuntimeException) = 0;
-+
-+ // Methods XVBACompat
-+ virtual ::sal_Bool SAL_CALL getVBACompatModeOn() throw (::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL setVBACompatModeOn( ::sal_Bool _vbacompatmodeon ) throw (::com::sun::star::uno::RuntimeException);
- };
-
- class LibraryContainerMethodGuard
---- basic/source/uno/namecont.cxx.orig 2008-09-03 14:13:47.000000000 +0800
-+++ basic/source/uno/namecont.cxx 2008-09-03 14:40:52.000000000 +0800
-@@ -2681,6 +2681,35 @@ OUString SfxLibraryContainer::expand_url
- }
- }
-
-+::sal_Bool SAL_CALL SfxLibraryContainer::getVBACompatModeOn() throw (RuntimeException)
-+{
-+ sal_Bool bVBACompat = sal_False;
-+ BasicManager* pBasMgr = getBasicManager();
-+ if( pBasMgr )
-+ {
-+ // get the standard library
-+ String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
-+ StarBASIC* pBasic = pBasMgr->GetLib( aLibName );
-+ if( pBasic )
-+ bVBACompat = pBasic->isVBAEnabled();
-+ }
-+
-+ return bVBACompat;
-+}
-+
-+void SAL_CALL SfxLibraryContainer::setVBACompatModeOn( ::sal_Bool _vbacompatmodeon ) throw (RuntimeException)
-+{
-+ BasicManager* pBasMgr = getBasicManager();
-+ if( pBasMgr )
-+ {
-+ // get the standard library
-+ String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
-+ StarBASIC* pBasic = pBasMgr->GetLib( aLibName );
-+ if( pBasic )
-+ pBasic->SetVBAEnabled( _vbacompatmodeon );
-+ }
-+}
-+
- // Methods XServiceInfo
- ::sal_Bool SAL_CALL SfxLibraryContainer::supportsService( const ::rtl::OUString& _rServiceName )
- throw (RuntimeException)
---- xmlscript/source/xmldlg_imexp/imp_share.hxx.orig 2008-09-05 15:24:41.000000000 +0800
-+++ xmlscript/source/xmldlg_imexp/imp_share.hxx 2008-09-05 15:25:18.000000000 +0800
-@@ -45,6 +45,7 @@
- #include <com/sun/star/awt/FontEmphasisMark.hpp>
- #include <com/sun/star/awt/FontRelief.hpp>
- #include <com/sun/star/xml/input/XRoot.hpp>
-+#include <com/sun/star/script/XLibraryContainer.hpp>
- #include <vector>
-
-
-@@ -132,6 +133,7 @@ struct DialogImport
- css::uno::Reference< css::container::XNameContainer > _xDialogModel;
- css::uno::Reference< css::lang::XMultiServiceFactory > _xDialogModelFactory;
- css::uno::Reference< css::frame::XModel > _xDoc;
-+ css::uno::Reference< css::script::XLibraryContainer > _xScriptLibraryContainer;
-
- sal_Int32 XMLNS_DIALOGS_UID, XMLNS_SCRIPT_UID;
-
-@@ -177,6 +179,8 @@ public:
- SAL_THROW( () );
-
- inline css::uno::Reference< css::frame::XModel > getDocOwner() { return _xDoc; }
-+
-+ css::uno::Reference< css::script::XLibraryContainer > getScriptLibraryContainer();
- // XRoot
- virtual void SAL_CALL startDocument(
- css::uno::Reference< css::xml::input::XNamespaceMapping >
---- xmlscript/source/xmldlg_imexp/xmldlg_import.cxx.orig 2008-09-05 15:24:30.000000000 +0800
-+++ xmlscript/source/xmldlg_imexp/xmldlg_import.cxx 2008-09-05 15:25:18.000000000 +0800
-@@ -59,6 +59,8 @@
- #include <com/sun/star/script/ScriptEventDescriptor.hpp>
-
- #include <com/sun/star/view/SelectionType.hpp>
-+#include <com/sun/star/document/XStorageBasedDocument.hpp>
-+#include <com/sun/star/script/DocumentScriptLibraryContainer.hpp>
-
- using namespace ::com::sun::star;
- using namespace ::com::sun::star::uno;
-@@ -1874,6 +1876,26 @@ Reference< xml::input::XElement > Dialog
- }
- return 0;
- }
-+//__________________________________________________________________________________________________
-+Reference< script::XLibraryContainer > DialogImport::getScriptLibraryContainer()
-+{
-+ if( !_xScriptLibraryContainer.is() )
-+ {
-+ try
-+ {
-+ Reference< document::XStorageBasedDocument > xStorageDoc( _xDoc, UNO_QUERY );
-+ if( xStorageDoc.is() )
-+ _xScriptLibraryContainer.set(
-+ script::DocumentScriptLibraryContainer::create( comphelper_getProcessComponentContext(), xStorageDoc ),
-+ UNO_QUERY );
-+ }
-+ catch( const Exception& )
-+ {
-+ }
-+ }
-+
-+ return _xScriptLibraryContainer;
-+}
-
- //##################################################################################################
-
---- xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx.orig 2008-09-05 15:24:41.000000000 +0800
-+++ xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx 2008-09-05 15:25:18.000000000 +0800
-@@ -41,6 +41,7 @@
- #include <com/sun/star/beans/XPropertyState.hpp>
- #include <com/sun/star/document/XStorageBasedDocument.hpp>
- #include <com/sun/star/document/XGraphicObjectResolver.hpp>
-+#include <com/sun/star/script/XVBACompat.hpp>
-
- #include <comphelper/componentcontext.hxx>
- #include <comphelper/processfactory.hxx>
-@@ -96,7 +97,7 @@ bool IsPackageURL( const ::rtl::OUString
-
- void importBindableAndListRangeBits( DialogImport* _pImport, const rtl::OUString sLinkedCell, const rtl::OUString & sCellRange, ControlImportContext& ctx )
- {
-- Reference< lang::XMultiServiceFactory > xFac( _pImport->getDocOwner(), UNO_QUERY );;
-+ Reference< lang::XMultiServiceFactory > xFac( _pImport->getDocOwner(), UNO_QUERY );
- if ( xFac.is() && ( sLinkedCell.getLength() || sCellRange.getLength() ) )
- {
- // Set up Celllink
-@@ -145,6 +146,18 @@ void importBindableAndListRangeBits( Dia
- }
- }
- }
-+
-+sal_Bool isVBACompatModeOn( DialogImport* _pImport )
-+{
-+ sal_Bool bVBAMode = sal_False;
-+ Reference< script::XVBACompat > xVBACompat( _pImport->getScriptLibraryContainer(), UNO_QUERY );
-+ if( xVBACompat.is() )
-+ {
-+ bVBAMode = xVBACompat->getVBACompatModeOn();
-+ }
-+ return bVBAMode;
-+}
-+
- // progessmeter
- //__________________________________________________________________________________________________
- Reference< xml::input::XElement > ProgressBarElement::startChildElement(
-@@ -1475,7 +1488,7 @@ void TitledBoxElement::endElement()
- {
- sLinkedCell = xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
- // we should probably limit this to vba mode also ( leave for now )
-- if ( _pImport->getDocOwner().is() )
-+ if ( isVBACompatModeOn( _pImport ) )
- sService = OUSTR("com.sun.star.form.component.RadioButton");
- }
- catch( Exception& /*e*/ )
-@@ -1620,7 +1633,7 @@ void RadioGroupElement::endElement()
- {
- sLinkedCell = xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
- // we should probably limit this to vba mode also ( leave for now )
-- if ( _pImport->getDocOwner().is() )
-+ if ( isVBACompatModeOn( _pImport ) )
- sService = OUSTR("com.sun.star.form.component.RadioButton");
- }
- catch( Exception& /*e*/ )
-@@ -1807,7 +1820,7 @@ void MenuListElement::endElement()
- OUString sListBoxService( OUSTR("com.sun.star.awt.UnoControlListBoxModel") );
-
- // we should probably limit this to vba mode also ( leave for now )
-- if ( _pImport->getDocOwner().is() )
-+ if ( isVBACompatModeOn( _pImport ) )
- sListBoxService = OUSTR("com.sun.star.form.component.ListBox");
-
- try
-@@ -1912,7 +1925,7 @@ void ComboBoxElement::endElement()
- OUString sService( OUSTR("com.sun.star.awt.UnoControlComboBoxModel") );
-
- // we should probably limit this to vba mode also ( leave for now )
-- if ( _pImport->getDocOwner().is() )
-+ if ( isVBACompatModeOn( _pImport ) )
- sService = OUSTR("com.sun.star.form.component.ComboBox");
-
- OUString sLinkedCell;
diff --git a/patches/vba/vba-container-controls.diff b/patches/vba/vba-container-controls.diff
deleted file mode 100644
index 928f06e2f..000000000
--- a/patches/vba/vba-container-controls.diff
+++ /dev/null
@@ -1,7681 +0,0 @@
-diff --git basic/source/classes/sbxmod.cxx basic/source/classes/sbxmod.cxx
-index 813db18..aee1e7e 100644
---- basic/source/classes/sbxmod.cxx
-+++ basic/source/classes/sbxmod.cxx
-@@ -2502,8 +2502,15 @@ void SbUserFormModule::InitObject()
- aArgs[ 0 ] <<= m_xModel;
- rtl::OUString sDialogUrl( RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.script:" ) );
- rtl::OUString sProjectName( RTL_CONSTASCII_USTRINGPARAM("Standard") );
-- if ( this->GetParent()->GetName().Len() )
-- sProjectName = this->GetParent()->GetName();
-+
-+ try
-+ {
-+ Reference< beans::XPropertySet > xProps( m_xModel, UNO_QUERY_THROW );
-+ uno::Reference< script::vba::XVBACompatibility > xVBAMode( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BasicLibraries") ) ), uno::UNO_QUERY_THROW );
-+ sProjectName = xVBAMode->getProjectName();
-+ }
-+ catch( Exception& /*e*/) {}
-+
- sDialogUrl = sDialogUrl.concat( sProjectName ).concat( rtl::OUString( '.') ).concat( GetName() ).concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("?location=document") ) );
-
- uno::Reference< awt::XDialogProvider > xProvider( xFactory->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.DialogProvider")), aArgs ), uno::UNO_QUERY_THROW );
-diff --git basic/source/inc/namecont.hxx basic/source/inc/namecont.hxx
-index 69ea926..208a608 100644
---- basic/source/inc/namecont.hxx
-+++ basic/source/inc/namecont.hxx
-@@ -224,6 +224,7 @@ class SfxLibraryContainer :public LibraryContainerHelper
- ,public ::utl::OEventListenerAdapter
- {
- sal_Bool mbVBACompat;
-+ rtl::OUString msProjectName;
- protected:
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
- ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > mxSFI;
-@@ -513,6 +514,8 @@ public:
- // Methods XVBACompatibility
- virtual ::sal_Bool SAL_CALL getVBACompatibilityMode() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setVBACompatibilityMode( ::sal_Bool _vbacompatmodeon ) throw (::com::sun::star::uno::RuntimeException);
-+ virtual ::rtl::OUString SAL_CALL getProjectName() throw (::com::sun::star::uno::RuntimeException) { return msProjectName; }
-+ virtual void SAL_CALL setProjectName( const ::rtl::OUString& _projectname ) throw (::com::sun::star::uno::RuntimeException);
- };
-
- class LibraryContainerMethodGuard
-diff --git basic/source/uno/dlgcont.cxx basic/source/uno/dlgcont.cxx
-index 9a7b33b..bd71ffd 100644
---- basic/source/uno/dlgcont.cxx
-+++ basic/source/uno/dlgcont.cxx
-@@ -41,6 +41,7 @@
- #include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
- #include "com/sun/star/resource/XStringResourceWithStorage.hpp"
- #include "com/sun/star/resource/XStringResourceWithLocation.hpp"
-+#include "com/sun/star/document/XGraphicObjectResolver.hpp"
- #include "dlgcont.hxx"
- #include "sbmodule.hxx"
- #include <comphelper/processfactory.hxx>
-@@ -74,6 +75,8 @@ using namespace osl;
-
- using com::sun::star::uno::Reference;
-
-+#define GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:"
-+
- //============================================================================
- // Implementation class SfxDialogLibraryContainer
-
-@@ -225,6 +228,35 @@ void SAL_CALL SfxDialogLibraryContainer::writeLibraryElement
- xInput->closeInput();
- }
-
-+void lcl_deepInspectForEmbeddedImages( const Reference< XInterface >& xIf, std::vector< rtl::OUString >& rvEmbedImgUrls )
-+{
-+ static rtl::OUString sImageURL= OUString(RTL_CONSTASCII_USTRINGPARAM( "ImageURL" ) );
-+ Reference< beans::XPropertySet > xProps( xIf, UNO_QUERY );
-+ if ( xProps.is() )
-+ {
-+
-+ if ( xProps->getPropertySetInfo()->hasPropertyByName( sImageURL ) )
-+ {
-+ rtl::OUString sURL;
-+ xProps->getPropertyValue( sImageURL ) >>= sURL;
-+ if ( sURL.getLength() && sURL.compareToAscii( GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( GRAPHOBJ_URLPREFIX ) ) == 0 )
-+ rvEmbedImgUrls.push_back( sURL );
-+ }
-+ }
-+ Reference< XNameContainer > xContainer( xIf, UNO_QUERY );
-+ if ( xContainer.is() )
-+ {
-+ Sequence< rtl::OUString > sNames = xContainer->getElementNames();
-+ sal_Int32 nContainees = sNames.getLength();
-+ for ( sal_Int32 index = 0; index < nContainees; ++index )
-+ {
-+ Reference< XInterface > xCtrl;
-+ xContainer->getByName( sNames[ index ] ) >>= xCtrl;
-+ lcl_deepInspectForEmbeddedImages( xCtrl, rvEmbedImgUrls );
-+ }
-+ }
-+}
-+
- void SfxDialogLibraryContainer::storeLibrariesToStorage( const uno::Reference< embed::XStorage >& xStorage ) throw ( RuntimeException )
- {
- LibraryContainerMethodGuard aGuard( *this );
-@@ -253,6 +285,54 @@ void SfxDialogLibraryContainer::storeLibrariesToStorage( const uno::Reference< e
-
- SfxLibraryContainer::storeLibrariesToStorage( xStorage );
-
-+ // we need to export out any embedded image object(s)
-+ // associated with any Dialogs. First, we need to actually gather any such urls
-+ // for each dialog in this container
-+ Sequence< OUString > sLibraries = getElementNames();
-+ for ( sal_Int32 i=0; i < sLibraries.getLength(); ++i )
-+ {
-+ // libraries will already be loaded from above
-+ Reference< XNameContainer > xLib;
-+ getByName( sLibraries[ i ] ) >>= xLib;
-+ if ( xLib.is() )
-+ {
-+ Sequence< OUString > sDialogs = xLib->getElementNames();
-+ sal_Int32 nDialogs( sDialogs.getLength() );
-+ for ( sal_Int32 j=0; j < nDialogs; ++j )
-+ {
-+ // Each Dialog has an associated xISP
-+ Reference< io::XInputStreamProvider > xISP;
-+ xLib->getByName( sDialogs[ j ] ) >>= xISP;
-+ if ( xISP.is() )
-+ {
-+ Reference< io::XInputStream > xInput( xISP->createInputStream() );
-+ Reference< XNameContainer > xDialogModel( mxMSF->createInstance
-+ ( OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ) ), UNO_QUERY );
-+ Reference< XComponentContext > xContext;
-+ Reference< beans::XPropertySet > xProps( mxMSF, UNO_QUERY );
-+ OSL_ASSERT( xProps.is() );
-+ OSL_VERIFY( xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
-+ ::xmlscript::importDialogModel( xInput, xDialogModel, xContext, mxOwnerDocument );
-+ std::vector< rtl::OUString > vEmbeddedImageURLs;
-+ lcl_deepInspectForEmbeddedImages( Reference< XInterface >( xDialogModel, UNO_QUERY ), vEmbeddedImageURLs );
-+ if ( vEmbeddedImageURLs.size() )
-+ {
-+ // Export the images to the storage
-+ Sequence< Any > aArgs( 1 );
-+ aArgs[ 0 ] <<= xStorage;
-+ Reference< document::XGraphicObjectResolver > xGraphicResolver( mxMSF->createInstanceWithArguments( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Svx.GraphicExportHelper" ) ), aArgs ), UNO_QUERY );
-+ std::vector< rtl::OUString >::iterator it = vEmbeddedImageURLs.begin();
-+ std::vector< rtl::OUString >::iterator it_end = vEmbeddedImageURLs.end();
-+ if ( xGraphicResolver.is() )
-+ {
-+ for ( sal_Int32 count = 0; it != it_end; ++it, ++count )
-+ xGraphicResolver->resolveGraphicObjectURL( *it );
-+ }
-+ }
-+ }
-+ }
-+ }
-+ }
- mbOasis2OOoFormat = sal_False;
- }
-
-diff --git basic/source/uno/namecont.cxx basic/source/uno/namecont.cxx
-index 6a00699..90298ae 100644
---- basic/source/uno/namecont.cxx
-+++ basic/source/uno/namecont.cxx
-@@ -2827,6 +2827,18 @@ void SAL_CALL SfxLibraryContainer::setVBACompatibilityMode( ::sal_Bool _vbacompa
- mbVBACompat = _vbacompatmodeon;
- }
-
-+void SAL_CALL SfxLibraryContainer::setProjectName( const ::rtl::OUString& _projectname ) throw (RuntimeException)
-+{
-+ msProjectName = _projectname;
-+ BasicManager* pBasMgr = getBasicManager();
-+ // Temporary HACK
-+ // Some parts of the VBA handling ( e.g. in core basic )
-+ // code expect the name of the VBA project to be set as the name of
-+ // the basic manager. Provide fail back here.
-+ if( pBasMgr )
-+ pBasMgr->SetName( msProjectName );
-+}
-+
- // Methods XServiceInfo
- ::sal_Bool SAL_CALL SfxLibraryContainer::supportsService( const ::rtl::OUString& _rServiceName )
- throw (RuntimeException)
-diff --git extensions/source/propctrlr/formcomponenthandler.cxx extensions/source/propctrlr/formcomponenthandler.cxx
-index 8f4353f..8f4ba8a 100644
---- extensions/source/propctrlr/formcomponenthandler.cxx
-+++ extensions/source/propctrlr/formcomponenthandler.cxx
-@@ -2784,8 +2784,9 @@ namespace pcr
-
- aFileDlg.SetTitle(aStrTrans);
- // non-linked images ( e.g. those located in the document
-- // stream ) cannot *currently* be handled by openoffice basic dialogs.
-- bool bHandleNonLink = ( m_eComponentClass == eFormControl );
-+ // stream ) only if document is available
-+ Reference< XModel > xModel( impl_getContextDocument_nothrow() );
-+ bool bHandleNonLink = xModel.is();
-
- Reference< XFilePickerControlAccess > xController(aFileDlg.GetFilePicker(), UNO_QUERY);
- DBG_ASSERT(xController.is(), "FormComponentPropertyHandler::impl_browseForImage_nothrow: missing the controller interface on the file picker!");
-diff --git filter/source/msfilter/msvbahelper.cxx filter/source/msfilter/msvbahelper.cxx
-index b1bdfe7..8bf36dd 100644
---- filter/source/msfilter/msvbahelper.cxx
-+++ filter/source/msfilter/msvbahelper.cxx
-@@ -37,6 +37,7 @@
- #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
- #include <com/sun/star/document/XDocumentProperties.hpp>
- #include <com/sun/star/document/XDocumentInfoSupplier.hpp>
-+#include <com/sun/star/script/vba/XVBACompatibility.hpp>
- #include <tools/urlobj.hxx>
- #include <osl/file.hxx>
- #include <unotools/pathoptions.hxx>
-@@ -287,15 +288,15 @@ VBAMacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const rtl::OUStrin
- {
- // Ok, if we have no Container specified then we need to search them in order, this document, template this document created from, global templates,
- // get the name of Project/Library for 'this' document
-- rtl::OUString sThisProject;
-- BasicManager* pBasicMgr = pShell-> GetBasicManager();
-- if ( pBasicMgr )
-+ rtl::OUString sThisProject = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Standard") );
-+ try
- {
-- if ( pBasicMgr->GetName().Len() )
-- sThisProject = pBasicMgr->GetName();
-- else // cater for the case where VBA is not enabled
-- sThisProject = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Standard") );
-+ uno::Reference< beans::XPropertySet > xProps( pShell->GetModel(), uno::UNO_QUERY_THROW );
-+ uno::Reference< script::vba::XVBACompatibility > xVBAMode( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BasicLibraries") ) ), uno::UNO_QUERY_THROW );
-+ sThisProject = xVBAMode->getProjectName();
- }
-+ catch( uno::Exception& /*e*/) {}
-+
- sSearchList.push_back( sThisProject ); // First Lib to search
- if ( xPrjNameCache.is() )
- {
-diff --git offapi/com/sun/star/script/vba/XVBACompatibility.idl offapi/com/sun/star/script/vba/XVBACompatibility.idl
-index 87cb36b..217032d 100644
---- offapi/com/sun/star/script/vba/XVBACompatibility.idl
-+++ offapi/com/sun/star/script/vba/XVBACompatibility.idl
-@@ -39,7 +39,7 @@ interface XVBACompatibility
- //-------------------------------------------------------------------------
-
- [attribute] boolean VBACompatibilityMode;
--
-+ [attribute ] string ProjectName;
- //-------------------------------------------------------------------------
- };
-
-diff --git oox/inc/oox/helper/propertyset.hxx oox/inc/oox/helper/propertyset.hxx
-index e4cb5a1..d8d51ca 100644
---- oox/inc/oox/helper/propertyset.hxx
-+++ oox/inc/oox/helper/propertyset.hxx
-@@ -30,6 +30,7 @@
-
- #include <com/sun/star/beans/XPropertySet.hpp>
- #include <com/sun/star/beans/XMultiPropertySet.hpp>
-+#include <com/sun/star/frame/XModel.hpp>
-
- namespace oox {
-
-@@ -162,6 +163,20 @@ inline void PropertySet::setProperty( sal_Int32 nPropId, const Type& rValue )
- setAnyProperty( nPropId, ::com::sun::star::uno::Any( rValue ) );
- }
-
-+class FormPropertySet : public PropertySet
-+{
-+public:
-+ inline explicit FormPropertySet() : PropertySet() {}
-+
-+ /** Constructs a property set wrapper with the passed UNO property set. */
-+ inline explicit FormPropertySet(
-+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rxPropSet ) : PropertySet( rxPropSet ) {}
-+
-+ /** Constructs a property set wrapper after querying the XPropertySet interface. */
-+ template< typename Type >
-+ inline explicit FormPropertySet( const Type& rObject ) : PropertySet( rObject ) {}
-+ void setDataAwareProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxDocModel, const PropertyMap& );
-+};
- // ============================================================================
-
- } // namespace oox
-diff --git oox/inc/oox/ole/simplevbaprojectfilter.hxx oox/inc/oox/ole/simplevbaprojectfilter.hxx
-new file mode 100644
-index 0000000..8639db1
---- /dev/null
-+++ oox/inc/oox/ole/simplevbaprojectfilter.hxx
-@@ -0,0 +1,34 @@
-+#ifndef OOX_OLE_SIMPLEVBAPROJFILTER_HXX
-+#define OOX_XLS_SIMPLEVBAPROJFILTER_HXX
-+
-+#include "oox/core/xmlfilterbase.hxx"
-+#include "oox/core/binaryfilterbase.hxx"
-+namespace oox {
-+namespace ole {
-+
-+class SimpleVBAProjFilter : public ::oox::core::BinaryFilterBase
-+{
-+ rtl::OUString msAppName;
-+ rtl::OUString msVBAStorageName;
-+public:
-+ explicit SimpleVBAProjFilter(
-+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxGlobalFactory,
-+ const rtl::OUString& rsAppName,
-+ const rtl::OUString& rsVBAStorageName );
-+ virtual ~SimpleVBAProjFilter();
-+
-+ virtual bool importDocument() throw();
-+ virtual bool exportDocument() throw();
-+};
-+
-+class SimpleWordVBAProjFilter : public SimpleVBAProjFilter
-+{
-+public:
-+ explicit SimpleWordVBAProjFilter(
-+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxGlobalFactory );
-+private:
-+ virtual ::rtl::OUString implGetImplementationName() const;
-+};
-+}
-+}
-+#endif
-diff --git oox/inc/oox/ole/vbacontrol.hxx oox/inc/oox/ole/vbacontrol.hxx
-index 730d46d..ddfabbf 100755
---- oox/inc/oox/ole/vbacontrol.hxx
-+++ oox/inc/oox/ole/vbacontrol.hxx
-@@ -54,13 +54,9 @@ public:
- void importProperty( sal_Int32 nPropId, const ::rtl::OUString& rValue );
- /** Imports the site model data from the passed input stream. */
- bool importBinaryModel( BinaryInputStream& rInStrm );
-- /** Moves the control relative to its current position by the passed distance. */
-- void moveRelative( const AxPairData& rDistance );
-
- /** Returns the programmatical name of the control. */
- inline const ::rtl::OUString& getName() const { return maName; }
-- /** Returns the position of the control in its parent. */
-- inline const AxPairData& getPosition() const { return maPos; }
- /** Returns the unique identifier of this control. */
- inline sal_Int32 getId() const { return mnId; }
- /** Returns true, if the control is visible. */
-@@ -83,12 +79,14 @@ public:
- ApiControlType eCtrlType,
- sal_Int32 nCtrlIndex ) const;
-
-+ void convertDataAwareProperties( PropertyMap& rPropMap );
-+
- protected:
- ::rtl::OUString maName; /// Name of the control.
- ::rtl::OUString maTag; /// User defined tag.
- ::rtl::OUString maToolTip; /// Tool tip for the control.
-- ::rtl::OUString maLinkedCell; /// Linked cell for the control value in a spreadsheet.
-- ::rtl::OUString maSourceRange; /// Source data for the control in a spreadsheet.
-+ ::rtl::OUString maControlSource; /// Linked cell for the control value in a spreadsheet.
-+ ::rtl::OUString maRowSource; /// Source data for the control in a spreadsheet.
- AxPairData maPos; /// Position in parent container.
- sal_Int32 mnId; /// Control identifier.
- sal_Int32 mnHelpContextId; /// Help context identifier.
-@@ -132,6 +130,7 @@ public:
- and converts all control properties. */
- void createAndConvert(
- sal_Int32 nCtrlIndex,
-+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxDocModel,
- const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxParentNC,
- const ControlConverter& rConv ) const;
-
-@@ -144,6 +143,7 @@ protected:
-
- /** Converts all control properties, and inserts and converts embedded controls. */
- bool convertProperties(
-+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxDocModel,
- const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxCtrlModel,
- const ControlConverter& rConv,
- sal_Int32 nCtrlIndex ) const;
-@@ -160,13 +160,7 @@ private:
- /** Imports the site models of all embedded controls from the 'f' stream. */
- bool importEmbeddedSiteModels( BinaryInputStream& rInStrm );
- /* Final processing of all embedded controls after import. */
-- void finalizeEmbeddedControls();
--
-- /** Moves the control relative to its current position by the passed distance. */
-- void moveRelative( const AxPairData& rDistance );
-- /** Moves all embedded controls from their relative position in this
-- control to an absolute position in the parent of this control. */
-- void moveEmbeddedToAbsoluteParent();
-+ void finalizeEmbeddedControls( StorageBase& rStrg );
-
- /** Functor for comparing controls by their tab index. */
- static bool compareByTabIndex( const VbaFormControlRef& rxLeft, const VbaFormControlRef& rxRight );
-diff --git oox/inc/oox/ole/vbahelper.hxx oox/inc/oox/ole/vbahelper.hxx
-index b0277f8..7777554 100644
---- oox/inc/oox/ole/vbahelper.hxx
-+++ oox/inc/oox/ole/vbahelper.hxx
-@@ -52,6 +52,7 @@ const sal_uInt16 VBA_ID_MODULESTREAMNAMEUNICODE = 0x0032;
- const sal_uInt16 VBA_ID_MODULETYPEDOCUMENT = 0x0022;
- const sal_uInt16 VBA_ID_MODULETYPEPROCEDURAL = 0x0021;
- const sal_uInt16 VBA_ID_PROJECTCODEPAGE = 0x0003;
-+const sal_uInt16 VBA_ID_PROJECTNAME = 0x0004;
- const sal_uInt16 VBA_ID_PROJECTEND = 0x0010;
- const sal_uInt16 VBA_ID_PROJECTMODULES = 0x000F;
- const sal_uInt16 VBA_ID_PROJECTVERSION = 0x0009;
-diff --git oox/inc/oox/ole/vbaproject.hxx oox/inc/oox/ole/vbaproject.hxx
-index 1d2fca2..09f4c74 100644
---- oox/inc/oox/ole/vbaproject.hxx
-+++ oox/inc/oox/ole/vbaproject.hxx
-@@ -127,7 +127,7 @@ private:
- mxBasicLib; /// The Basic library of the document used for import.
- ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
- mxDialogLib; /// The dialog library of the document used for import.
-- const ::rtl::OUString maLibName; /// Name for Basic and dialog library used for import.
-+ ::rtl::OUString maPrjName; /// Name of VBA project being imported
- };
-
- // ============================================================================
-diff --git oox/inc/oox/xls/excelfilter.hxx oox/inc/oox/xls/excelfilter.hxx
-index 49a0c85..55b0ca5 100644
---- oox/inc/oox/xls/excelfilter.hxx
-+++ oox/inc/oox/xls/excelfilter.hxx
-@@ -30,6 +30,8 @@
-
- #include "oox/core/xmlfilterbase.hxx"
- #include "oox/core/binaryfilterbase.hxx"
-+#include "oox/ole/vbaproject.hxx"
-+#include "oox/ole/simplevbaprojectfilter.hxx"
-
- namespace oox {
- namespace xls {
-@@ -94,6 +96,18 @@ private:
- virtual ::rtl::OUString implGetImplementationName() const;
- };
-
-+class SimpleExcelVBAProjFilter : public ExcelBiffFilter
-+{
-+public:
-+ explicit SimpleExcelVBAProjFilter(
-+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxGlobalFactory );
-+ virtual bool importDocument() throw();
-+
-+private:
-+ virtual GraphicHelper* implCreateGraphicHelper() const;
-+ virtual ::rtl::OUString implGetImplementationName() const;
-+};
-+
- // ============================================================================
-
- } // namespace xls
-diff --git oox/source/core/facreg.cxx oox/source/core/facreg.cxx
-index 7233692..b6a9803 100644
---- oox/source/core/facreg.cxx
-+++ oox/source/core/facreg.cxx
-@@ -61,6 +61,8 @@ namespace oox {
- namespace xls { SERVICE( BiffDetector ); }
- namespace xls { SERVICE( ExcelFilter ); }
- namespace xls { SERVICE( ExcelBiffFilter ); }
-+ namespace xls { SERVICE( SimpleExcelVBAProjFilter ); }
-+ namespace ole { SERVICE( SimpleWordVBAProjFilter ); }
- namespace shape { SERVICE( ShapeContextHandler ); }
- namespace shape { SERVICE( FastTokenHandlerService ); }
- namespace docprop { SERVICE2( OOXMLDocPropImportImpl ); }
-@@ -104,6 +106,8 @@ OOX_DLLPUBLIC sal_Bool SAL_CALL component_writeInfo( void * , void * pRegistryKe
- WRITEINFO( ::oox::xls::BiffDetector );
- WRITEINFO( ::oox::xls::ExcelFilter );
- WRITEINFO( ::oox::xls::ExcelBiffFilter );
-+ WRITEINFO( ::oox::xls::SimpleExcelVBAProjFilter );
-+ WRITEINFO( ::oox::ole::SimpleWordVBAProjFilter );
- WRITEINFO( ::oox::shape::ShapeContextHandler );
- WRITEINFO( ::oox::shape::FastTokenHandlerService );
- WRITEINFO( ::oox::docprop::OOXMLDocPropImportImpl );
-@@ -152,6 +156,8 @@ OOX_DLLPUBLIC void * SAL_CALL component_getFactory( const sal_Char * pImplName,
- else SINGLEFACTORY( ::oox::xls::BiffDetector )
- else SINGLEFACTORY( ::oox::xls::ExcelFilter )
- else SINGLEFACTORY( ::oox::xls::ExcelBiffFilter )
-+ else SINGLEFACTORY( ::oox::xls::SimpleExcelVBAProjFilter )
-+ else SINGLEFACTORY( ::oox::ole::SimpleWordVBAProjFilter )
- else SINGLEFACTORY( ::oox::shape::ShapeContextHandler)
- else SINGLEFACTORY( ::oox::shape::FastTokenHandlerService)
- else SINGLEFACTORY2( ::oox::docprop::OOXMLDocPropImportImpl )
-diff --git oox/source/helper/propertyset.cxx oox/source/helper/propertyset.cxx
-index a3c9ee0..d29bfcb 100644
---- oox/source/helper/propertyset.cxx
-+++ oox/source/helper/propertyset.cxx
-@@ -31,6 +31,21 @@
- #include <osl/diagnose.h>
- #include "oox/helper/propertymap.hxx"
-
-+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-+#include <com/sun/star/beans/NamedValue.hpp>
-+#include <com/sun/star/form/binding/XBindableValue.hpp>
-+#include <com/sun/star/form/binding/XListEntrySink.hpp>
-+#include <com/sun/star/form/binding/XListEntrySource.hpp>
-+#include <com/sun/star/form/binding/XValueBinding.hpp>
-+#include <com/sun/star/table/CellRangeAddress.hpp>
-+#include <com/sun/star/table/CellAddress.hpp>
-+#include <com/sun/star/sheet/XCellRangeReferrer.hpp>
-+#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
-+#include <com/sun/star/container/XNameAccess.hpp>
-+#include <oox/helper/helper.hxx>
-+
-+#include "properties.hxx"
-+
- using ::rtl::OUString;
- using ::rtl::OStringBuffer;
- using ::rtl::OUStringToOString;
-@@ -38,8 +53,22 @@ using ::com::sun::star::uno::Any;
- using ::com::sun::star::uno::Reference;
- using ::com::sun::star::uno::Sequence;
- using ::com::sun::star::uno::Exception;
-+using ::com::sun::star::uno::makeAny;
- using ::com::sun::star::uno::UNO_QUERY;
-+using ::com::sun::star::uno::UNO_QUERY_THROW;
-+using ::com::sun::star::lang::XMultiServiceFactory;
- using ::com::sun::star::beans::XPropertySet;
-+using ::com::sun::star::beans::NamedValue;
-+using ::com::sun::star::frame::XModel;
-+using ::com::sun::star::container::XNameAccess;
-+using ::com::sun::star::form::binding::XBindableValue;
-+using ::com::sun::star::form::binding::XListEntrySink;
-+using ::com::sun::star::form::binding::XListEntrySource;
-+using ::com::sun::star::form::binding::XValueBinding;
-+using ::com::sun::star::table::CellRangeAddress;
-+using ::com::sun::star::table::CellAddress;
-+using ::com::sun::star::sheet::XCellRangeReferrer;
-+using ::com::sun::star::sheet::XCellRangeAddressable;
-
- namespace oox {
-
-@@ -179,6 +208,109 @@ void PropertySet::dump()
- PropertyMap::dump( Reference< XPropertySet >( getXPropertySet(), UNO_QUERY ) );
- }
- #endif
-+bool lcl_isNamedRange( const rtl::OUString& sAddress, const Reference< XModel >& xModel, CellRangeAddress& aAddress )
-+{
-+ bool bRes = false;
-+ const static OUString sNamedRanges( RTL_CONSTASCII_USTRINGPARAM("NamedRanges"));
-+ Reference< XCellRangeReferrer > xReferrer;
-+ try
-+ {
-+ Reference< XPropertySet > xPropSet( xModel, UNO_QUERY_THROW );
-+ Reference< XNameAccess > xNamed( xPropSet->getPropertyValue( sNamedRanges ), UNO_QUERY_THROW );
-+ xReferrer.set ( xNamed->getByName( sAddress ), UNO_QUERY );
-+ }
-+ catch( Exception& /*e*/ )
-+ {
-+ // do nothing
-+ }
-+ if ( xReferrer.is() )
-+ {
-+ Reference< XCellRangeAddressable > xRangeAddressable( xReferrer->getReferredCells(), UNO_QUERY );
-+ if ( xRangeAddressable.is() )
-+ {
-+ aAddress = xRangeAddressable->getRangeAddress();
-+ bRes = true;
-+ }
-+ }
-+ return bRes;
-+}
-+
-+void lcl_ApplyListSourceAndBindableStuff( const Reference< XModel >& xModel, const Reference< XPropertySet >& rPropSet, const OUString& rsCtrlSource, const OUString& rsRowSource )
-+{
-+// XBindable etc.
-+ Reference< XMultiServiceFactory > xFac;
-+ if ( xModel.is() )
-+ xFac.set( xModel, UNO_QUERY );
-+ Reference< XBindableValue > xBindable( rPropSet, UNO_QUERY );
-+ if ( xFac.is() && rsCtrlSource.getLength() && xBindable.is() )
-+ {
-+
-+ // OOo address structures
-+ // RefCell - convert from XL
-+ // pretend we converted the imported string address into the
-+ // appropriate address structure
-+ Reference< XPropertySet > xConvertor( xFac->createInstance( CREATE_OUSTRING( "com.sun.star.table.CellAddressConversion" )), UNO_QUERY );
-+ CellAddress aAddress;
-+ if ( xConvertor.is() )
-+ {
-+ // we need this service to properly convert XL notation also
-+ // Should be easy to extend
-+ xConvertor->setPropertyValue( CREATE_OUSTRING( "XL_A1_Representation" ), makeAny( rsCtrlSource ) );
-+ xConvertor->getPropertyValue( CREATE_OUSTRING( "Address" ) ) >>= aAddress;
-+ }
-+
-+ NamedValue aArg1;
-+ aArg1.Name = CREATE_OUSTRING("BoundCell");
-+ aArg1.Value <<= aAddress;
-+
-+ Sequence< Any > aArgs(1);
-+ aArgs[ 0 ] <<= aArg1;
-+
-+ Reference< XValueBinding > xBinding( xFac->createInstanceWithArguments( CREATE_OUSTRING("com.sun.star.table.CellValueBinding" ), aArgs ), UNO_QUERY );
-+ xBindable->setValueBinding( xBinding );
-+ }
-+ Reference< XListEntrySink > xListEntrySink( rPropSet, UNO_QUERY );
-+ if ( xFac.is() && rsRowSource.getLength() && xListEntrySink.is() )
-+ {
-+
-+ // OOo address structures
-+ // RefCell - convert from XL
-+ // pretend we converted the imported string address into the
-+ // appropriate address structure
-+ Reference< XPropertySet > xConvertor( xFac->createInstance( CREATE_OUSTRING( "com.sun.star.table.CellRangeAddressConversion" )), UNO_QUERY );
-+ CellRangeAddress aAddress;
-+ if ( xConvertor.is() )
-+ {
-+ if ( !lcl_isNamedRange( rsRowSource, xModel, aAddress ) )
-+ {
-+ // we need this service to properly convert XL notation also
-+ // Should be easy to extend
-+ xConvertor->setPropertyValue( CREATE_OUSTRING( "XL_A1_Representation" ), makeAny( rsRowSource ) );
-+ xConvertor->getPropertyValue( CREATE_OUSTRING( "Address" ) ) >>= aAddress;
-+ }
-+ }
-+
-+ NamedValue aArg1;
-+ aArg1.Name = CREATE_OUSTRING("CellRange");
-+ aArg1.Value <<= aAddress;
-+
-+ Sequence< Any > aArgs(1);
-+ aArgs[ 0 ] <<= aArg1;
-+
-+ Reference< XListEntrySource > xSource( xFac->createInstanceWithArguments( CREATE_OUSTRING("com.sun.star.table.CellRangeListSource" ), aArgs ), UNO_QUERY );
-+ xListEntrySink->setListEntrySource( xSource );
-+ }
-+}
-+void FormPropertySet::setDataAwareProperties( const Reference< XModel >& rxDocModel, const PropertyMap& rMap )
-+{
-+ OUString sRowSource;
-+ OUString sControlSource;
-+ if ( rMap.hasProperty( PROP_ControlSource ) )
-+ *(rMap.getProperty( PROP_ControlSource )) >>= sControlSource;
-+ if ( rMap.hasProperty( PROP_RowSource ) )
-+ *(rMap.getProperty( PROP_RowSource )) >>= sRowSource;
-+ lcl_ApplyListSourceAndBindableStuff( rxDocModel, getXPropertySet(), sControlSource, sRowSource );
-+}
-
- // ============================================================================
-
-diff --git oox/source/ole/axcontrol.cxx oox/source/ole/axcontrol.cxx
-index e67724f..983acaa 100644
---- oox/source/ole/axcontrol.cxx
-+++ oox/source/ole/axcontrol.cxx
-@@ -432,14 +432,16 @@ OUString ControlModelBase::getServiceName() const
- case API_CONTROL_FIXEDTEXT: return CREATE_OUSTRING( "com.sun.star.awt.UnoControlFixedTextModel" );
- case API_CONTROL_IMAGE: return CREATE_OUSTRING( "com.sun.star.awt.UnoControlImageControlModel" );
- case API_CONTROL_CHECKBOX: return CREATE_OUSTRING( "com.sun.star.awt.UnoControlCheckBoxModel" );
-- case API_CONTROL_RADIOBUTTON: return CREATE_OUSTRING( "com.sun.star.awt.UnoControlRadioButtonModel" );
-+ case API_CONTROL_RADIOBUTTON: return CREATE_OUSTRING( "com.sun.star.form.component.RadioButton" );
- case API_CONTROL_EDIT: return CREATE_OUSTRING( "com.sun.star.awt.UnoControlEditModel" );
-- case API_CONTROL_LISTBOX: return CREATE_OUSTRING( "com.sun.star.awt.UnoControlListBoxModel" );
-- case API_CONTROL_COMBOBOX: return CREATE_OUSTRING( "com.sun.star.awt.UnoControlComboBoxModel" );
-- case API_CONTROL_SPINBUTTON: return CREATE_OUSTRING( "com.sun.star.awt.UnoControlSpinButtonModel" );
-- case API_CONTROL_SCROLLBAR: return CREATE_OUSTRING( "com.sun.star.awt.UnoControlScrollBarModel" );
-+ case API_CONTROL_LISTBOX: return CREATE_OUSTRING( "com.sun.star.form.component.ListBox" );
-+ case API_CONTROL_COMBOBOX: return CREATE_OUSTRING( "com.sun.star.form.component.ComboBox" );
-+ case API_CONTROL_SPINBUTTON: return CREATE_OUSTRING( "com.sun.star.form.component.SpinButton" );
-+ case API_CONTROL_SCROLLBAR: return CREATE_OUSTRING( "com.sun.star.form.component.ScrollBar" );
- case API_CONTROL_PROGRESSBAR: return CREATE_OUSTRING( "com.sun.star.awt.UnoControlProgressBarModel" );
-- case API_CONTROL_GROUPBOX: return CREATE_OUSTRING( "com.sun.star.awt.UnoControlGroupBoxModel" );
-+ case API_CONTROL_FRAME: return CREATE_OUSTRING( "com.sun.star.awt.UnoFrameModel" );
-+ case API_CONTROL_PAGE: return CREATE_OUSTRING( "com.sun.star.awt.UnoPageModel" );
-+ case API_CONTROL_MULTIPAGE: return CREATE_OUSTRING( "com.sun.star.awt.UnoMultiPageModel" );
- case API_CONTROL_DIALOG: return CREATE_OUSTRING( "com.sun.star.awt.UnoControlDialogModel" );
- default: OSL_ENSURE( false, "ControlModelBase::getServiceName - no AWT model service supported" );
- }
-@@ -1418,7 +1420,8 @@ ApiControlType AxTabStripModel::getControlType() const
- void AxTabStripModel::convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const
- {
- rPropMap.setProperty( PROP_Decoration, mnTabStyle != AX_TABSTRIP_NONE );
-- rPropMap.setProperty( PROP_MultiPageValue, mnSelectedTab );
-+ // adjust for openoffice
-+ rPropMap.setProperty( PROP_MultiPageValue, mnSelectedTab + 1 );
- rConv.convertColor( rPropMap, PROP_BackgroundColor, mnBackColor );
- AxFontDataModel::convertProperties( rPropMap, rConv );
- }
-@@ -1542,7 +1545,7 @@ AxFrameModel::AxFrameModel() :
-
- ApiControlType AxFrameModel::getControlType() const
- {
-- return API_CONTROL_GROUPBOX;
-+ return mbAwtModel ? API_CONTROL_FRAME : API_CONTROL_GROUPBOX;
- }
-
- void AxFrameModel::convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const
-diff --git oox/source/ole/makefile.mk oox/source/ole/makefile.mk
-index 4e01392..e94ab3e 100644
---- oox/source/ole/makefile.mk
-+++ oox/source/ole/makefile.mk
-@@ -51,7 +51,8 @@ SLOFILES = \
- $(SLO)$/vbahelper.obj \
- $(SLO)$/vbainputstream.obj \
- $(SLO)$/vbamodule.obj \
-- $(SLO)$/vbaproject.obj
-+ $(SLO)$/vbaproject.obj \
-+ $(SLO)$/simplevbaprojectfilter.obj \
-
- # --- Targets -------------------------------------------------------
-
-diff --git oox/source/ole/simplevbaprojectfilter.cxx oox/source/ole/simplevbaprojectfilter.cxx
-new file mode 100644
-index 0000000..85c1e70
---- /dev/null
-+++ oox/source/ole/simplevbaprojectfilter.cxx
-@@ -0,0 +1,75 @@
-+#include "oox/ole/simplevbaprojectfilter.hxx"
-+#include "oox/ole/vbaproject.hxx"
-+#include "oox/helper/binaryinputstream.hxx"
-+
-+using ::rtl::OUString;
-+using ::com::sun::star::uno::Any;
-+using ::com::sun::star::uno::Reference;
-+using ::com::sun::star::uno::Sequence;
-+using ::com::sun::star::uno::Exception;
-+using ::com::sun::star::uno::XInterface;
-+using ::com::sun::star::lang::XMultiServiceFactory;
-+using ::com::sun::star::xml::sax::XFastDocumentHandler;
-+using ::oox::core::BinaryFilterBase;
-+//using ::oox::core::FragmentHandlerRef;
-+using ::oox::core::Relation;
-+using ::oox::core::Relations;
-+using ::oox::core::XmlFilterBase;
-+
-+namespace oox {
-+namespace ole {
-+
-+OUString SAL_CALL SimpleWordVBAProjFilter_getImplementationName() throw()
-+{
-+ return CREATE_OUSTRING( "com.sun.star.comp.ole.SimpleWordVBAProjFilter" );
-+}
-+
-+Sequence< OUString > SAL_CALL SimpleWordVBAProjFilter_getSupportedServiceNames() throw()
-+{
-+ OUString aServiceName = CREATE_OUSTRING( "com.sun.star.comp.ole.SimpleWordVBAProjFilter" );
-+ Sequence< OUString > aSeq( &aServiceName, 1 );
-+ return aSeq;
-+}
-+
-+Reference< XInterface > SAL_CALL SimpleWordVBAProjFilter_createInstance(
-+ const Reference< XMultiServiceFactory >& rxGlobalFactory ) throw( Exception )
-+{
-+ return static_cast< ::cppu::OWeakObject* >( new SimpleWordVBAProjFilter( rxGlobalFactory ) );
-+}
-+
-+SimpleVBAProjFilter::SimpleVBAProjFilter( const Reference< XMultiServiceFactory >& rxGlobalFactory, const rtl::OUString& rsAppName, const rtl::OUString& rsVBAStorageName ) :
-+ BinaryFilterBase( rxGlobalFactory ), msAppName( rsAppName ), msVBAStorageName( rsVBAStorageName )
-+{
-+}
-+
-+SimpleVBAProjFilter::~SimpleVBAProjFilter()
-+{
-+}
-+
-+bool SimpleVBAProjFilter::importDocument() throw()
-+{
-+ StorageRef xVbaPrjStrg = openSubStorage( msVBAStorageName, false ) ;
-+ if( xVbaPrjStrg.get() && xVbaPrjStrg->isStorage() )
-+ {
-+ VbaProject aVbaProject( getGlobalFactory(), getModel(), msAppName );
-+ aVbaProject.importVbaProject( *xVbaPrjStrg, getGraphicHelper() );
-+ return true;
-+ }
-+ return false;
-+}
-+
-+bool SimpleVBAProjFilter::exportDocument() throw()
-+{
-+ return false;
-+}
-+
-+SimpleWordVBAProjFilter::SimpleWordVBAProjFilter( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxGlobalFactory ) : SimpleVBAProjFilter( rxGlobalFactory, CREATE_OUSTRING( "Writer" ), CREATE_OUSTRING( "Macros" ) )
-+{
-+}
-+
-+OUString SimpleWordVBAProjFilter::implGetImplementationName() const
-+{
-+ return SimpleWordVBAProjFilter_getImplementationName();
-+}
-+
-+} /*namespace ole*/ } /*namespace oox*/
-diff --git oox/source/ole/vbacontrol.cxx oox/source/ole/vbacontrol.cxx
-index 5b2057a..8a138f5 100755
---- oox/source/ole/vbacontrol.cxx
-+++ oox/source/ole/vbacontrol.cxx
-@@ -50,6 +50,7 @@ using ::rtl::OUString;
- using ::rtl::OUStringBuffer;
- using ::com::sun::star::awt::XControlModel;
- using ::com::sun::star::container::XNameContainer;
-+using ::com::sun::star::frame::XModel;
- using ::com::sun::star::io::XInputStreamProvider;
- using ::com::sun::star::lang::XMultiServiceFactory;
- using ::com::sun::star::uno::Any;
-@@ -222,17 +223,11 @@ bool VbaSiteModel::importBinaryModel( BinaryInputStream& rInStrm )
- aReader.skipUndefinedProperty();
- aReader.readStringProperty( maToolTip );
- aReader.skipStringProperty(); // license key
-- aReader.readStringProperty( maLinkedCell );
-- aReader.readStringProperty( maSourceRange );
-+ aReader.readStringProperty( maControlSource );
-+ aReader.readStringProperty( maRowSource );
- return aReader.finalizeImport();
- }
-
--void VbaSiteModel::moveRelative( const AxPairData& rDistance )
--{
-- maPos.first += rDistance.first;
-- maPos.second += rDistance.second;
--}
--
- bool VbaSiteModel::isVisible() const
- {
- return getFlag( mnFlags, VBA_SITE_VISIBLE );
-@@ -280,12 +275,12 @@ ControlModelRef VbaSiteModel::createControlModel( const AxClassTable& rClassTabl
- case VBA_SITE_TEXTBOX: xCtrlModel.reset( new AxTextBoxModel ); break;
- case VBA_SITE_LISTBOX: xCtrlModel.reset( new AxListBoxModel ); break;
- case VBA_SITE_COMBOBOX: xCtrlModel.reset( new AxComboBoxModel ); break;
-- case VBA_SITE_SPINBUTTON: /*xCtrlModel.reset( new AxSpinButtonModel );*/ break; // not supported (?)
-+ case VBA_SITE_SPINBUTTON: xCtrlModel.reset( new AxSpinButtonModel ); break;
- case VBA_SITE_SCROLLBAR: xCtrlModel.reset( new AxScrollBarModel ); break;
-- case VBA_SITE_TABSTRIP: break; // not supported
-+ case VBA_SITE_TABSTRIP: xCtrlModel.reset( new AxTabStripModel ); break;
- case VBA_SITE_FRAME: xCtrlModel.reset( new AxFrameModel ); break;
-- case VBA_SITE_MULTIPAGE: break; // not supported
-- case VBA_SITE_FORM: break; // not supported
-+ case VBA_SITE_MULTIPAGE: xCtrlModel.reset( new AxMultiPageModel ); break;
-+ case VBA_SITE_FORM: xCtrlModel.reset( new AxFormPageModel ); break;
- default: OSL_ENSURE( false, "VbaSiteModel::createControlModel - unknown type index" );
- }
- }
-@@ -319,6 +314,12 @@ ControlModelRef VbaSiteModel::createControlModel( const AxClassTable& rClassTabl
- return xCtrlModel;
- }
-
-+void VbaSiteModel::convertDataAwareProperties( PropertyMap& rPropMap )
-+{
-+ rPropMap.setProperty( PROP_ControlSource, maControlSource );
-+ rPropMap.setProperty( PROP_RowSource, maRowSource );
-+}
-+
- void VbaSiteModel::convertProperties( PropertyMap& rPropMap,
- const ControlConverter& rConv, ApiControlType eCtrlType, sal_Int32 nCtrlIndex ) const
- {
-@@ -380,6 +381,7 @@ sal_Int32 VbaFormControl::getControlId() const
- }
-
- void VbaFormControl::createAndConvert( sal_Int32 nCtrlIndex,
-+ const Reference< XModel >& rxDocModel,
- const Reference< XNameContainer >& rxParentNC, const ControlConverter& rConv ) const
- {
- if( rxParentNC.is() && mxSiteModel.get() && mxCtrlModel.get() ) try
-@@ -390,7 +392,7 @@ void VbaFormControl::createAndConvert( sal_Int32 nCtrlIndex,
- Reference< XControlModel > xCtrlModel( xModelFactory->createInstance( aServiceName ), UNO_QUERY_THROW );
-
- // convert all properties and embedded controls
-- if( convertProperties( xCtrlModel, rConv, nCtrlIndex ) )
-+ if( convertProperties( rxDocModel, xCtrlModel, rConv, nCtrlIndex ) )
- {
- // insert into parent container
- const OUString& rCtrlName = mxSiteModel->getName();
-@@ -445,16 +447,14 @@ void VbaFormControl::importStorage( StorageBase& rStrg, const AxClassTable& rCla
- maControls.forEachMem( &VbaFormControl::importModelOrStorage,
- ::boost::ref( aOStrm ), ::boost::ref( rStrg ), ::boost::cref( maClassTable ) );
-
-- /* Reorder the controls (sorts all option buttons of an option
-- group together), and move all children of all embedded frames
-- (group boxes) to this control (UNO group boxes cannot contain
-- other controls). */
-- finalizeEmbeddedControls();
-+ /** Final processing on the control and all embedded controls,
-+ depending on the type of this control. */
-+ finalizeEmbeddedControls( rStrg );
- }
- }
- }
-
--bool VbaFormControl::convertProperties( const Reference< XControlModel >& rxCtrlModel,
-+bool VbaFormControl::convertProperties( const Reference< XModel >& rxDocModel, const Reference< XControlModel >& rxCtrlModel,
- const ControlConverter& rConv, sal_Int32 nCtrlIndex ) const
- {
- if( rxCtrlModel.is() && mxSiteModel.get() && mxCtrlModel.get() )
-@@ -466,10 +466,13 @@ bool VbaFormControl::convertProperties( const Reference< XControlModel >& rxCtrl
- // convert all properties
- PropertyMap aPropMap;
- mxSiteModel->convertProperties( aPropMap, rConv, mxCtrlModel->getControlType(), nCtrlIndex );
-+ PropertyMap aDataPropMap;
-+ mxSiteModel->convertDataAwareProperties( aDataPropMap );
- mxCtrlModel->convertProperties( aPropMap, rConv );
- mxCtrlModel->convertSize( aPropMap, rConv );
-- PropertySet aPropSet( rxCtrlModel );
-+ FormPropertySet aPropSet( rxCtrlModel );
- aPropSet.setProperties( aPropMap );
-+ aPropSet.setDataAwareProperties( rxDocModel, aDataPropMap );
-
- // create and convert all embedded controls
- if( !maControls.empty() ) try
-@@ -478,7 +481,7 @@ bool VbaFormControl::convertProperties( const Reference< XControlModel >& rxCtrl
- /* Call conversion for all controls. Pass vector index as new
- tab order to make option button groups work correctly. */
- maControls.forEachMemWithIndex( &VbaFormControl::createAndConvert,
-- ::boost::cref( xCtrlModelNC ), ::boost::cref( rConv ) );
-+ ::boost::cref( rxDocModel ), ::boost::cref( xCtrlModelNC ), ::boost::cref( rConv ) );
- }
- catch( Exception& )
- {
-@@ -553,30 +556,110 @@ bool VbaFormControl::importEmbeddedSiteModels( BinaryInputStream& rInStrm )
- return bValid;
- }
-
--void VbaFormControl::finalizeEmbeddedControls()
-+void VbaFormControl::finalizeEmbeddedControls( StorageBase& rStrg )
- {
-- /* This function performs two tasks:
-+ /* Store all embedded controls in a temporary vector, so "exit on error"
-+ will leave this control empty. */
-+ VbaFormControlVector aControls;
-+ aControls.swap( maControls );
-
-- 1) Reorder the controls appropriately (sort all option buttons of an
-- option group together to make grouping work).
-- 2) Move all children of all embedded frames (group boxes) to this
-- control (UNO group boxes cannot contain other controls).
-- */
-+ /* If this is a multipage control, it stores additional data in the 'x'
-+ stream of its storage. It contains the control identifiers of the form
-+ page controls that contain the embedded controls of each page.
-+ Additionally, the order of these pages is stored there (they are not
-+ nessecarily in the order they are persisted in). */
-+ if( AxMultiPageModel* pMultiPageModel = dynamic_cast< AxMultiPageModel* >( mxCtrlModel.get() ) )
-+ {
-+ // read additional attributes from the 'x' stream
-+ BinaryXInputStream aXStrm( rStrg.openInputStream( CREATE_OUSTRING( "x" ) ), true );
-+ OSL_ENSURE( !aXStrm.isEof(), "VbaFormControl::finalizeEmbeddedControls - missing 'x' stream" );
-+ if( aXStrm.isEof() ) return;
-+
-+ // skip the page property structures related to all controls
-+ for( size_t nSiteIdx = 0, nSiteCount = aControls.size(); nSiteIdx < nSiteCount; ++nSiteIdx )
-+ {
-+ AxBinaryPropertyReader aReader( aXStrm );
-+ aReader.skipUndefinedProperty();
-+ aReader.skipIntProperty< sal_uInt32 >(); // transition effect
-+ aReader.skipIntProperty< sal_uInt32 >(); // transition period
-+ if( !aReader.finalizeImport() ) return;
-+ }
-+
-+ // read the multipage property structure containing a list of page IDs
-+ sal_Int32 nPageCount = 0;
-+ sal_Int32 nTabStripId = 0;
-+ AxBinaryPropertyReader aReader( aXStrm );
-+ aReader.skipUndefinedProperty();
-+ aReader.readIntProperty< sal_Int32 >( nPageCount );
-+ aReader.readIntProperty< sal_Int32 >( nTabStripId );
-+ if( !aReader.finalizeImport() ) return;
-+ // read the array containing all page identifiers in current order
-+ typedef ::std::vector< sal_Int32 > AxPageIdVector;
-+ AxPageIdVector aPageIds;
-+ for( sal_Int32 nPage = 0; !aXStrm.isEof() && (nPage < nPageCount); ++nPage )
-+ aPageIds.push_back( aXStrm.readInt32() );
-+ if( aXStrm.isEof() ) return;
-+
-+ // check the page count value
-+ bool bValidPageCount = (0 < nPageCount) && (static_cast< size_t >( nPageCount + 1 ) == aControls.size());
-+ OSL_ENSURE( bValidPageCount, "VbaFormControl::finalizeEmbeddedControls - invalid number of pages" );
-+ if( !bValidPageCount ) return;
-+
-+ /* Check that this multipage contains the expected controls:
-+ - a tabstrip control, specified by nTabStripId,
-+ - form page controls (containing the embedded controls of each page). */
-+
-+ // the controls may be in arbitrary order, first map them by ID
-+ RefMap< sal_Int32, VbaFormControl > aControlsById;
-+ for( VbaFormControlVector::iterator aIt = aControls.begin(), aEnd = aControls.end(); aIt != aEnd; ++aIt )
-+ {
-+ VbaFormControlRef xControl = *aIt;
-+ sal_Int32 nId = xControl->getControlId();
-+ OSL_ENSURE( (nId > 0) && !aControlsById.has( nId ), "VbaFormControl::finalizeEmbeddedControls - invalid control ID" );
-+ aControlsById[ nId ] = xControl;
-+ }
-+ // store tabstrip in the multipage, it will care about property conversion
-+ AxTabStripModelRef xTabStripModel;
-+ VbaFormControlRef xControl = aControlsById.get( nTabStripId );
-+ if( xControl.get() )
-+ xTabStripModel = ::boost::dynamic_pointer_cast< AxTabStripModel >( xControl->mxCtrlModel );
-+ OSL_ENSURE( xTabStripModel.get(), "VbaFormControl::finalizeEmbeddedControls - missing tabstrip control" );
-+ if( !xTabStripModel ) return;
-+ pMultiPageModel->setTabStripModel( xTabStripModel );
-+ aControlsById.erase( nTabStripId );
-+ // store all pages in maControls in the correct order specified by aPageIds
-+ sal_Int32 nTabIndex = 0;
-+ for( AxPageIdVector::iterator aIt = aPageIds.begin(), aEnd = aPageIds.end(); aIt != aEnd; ++aIt, ++nTabIndex )
-+ {
-+ VbaFormControlRef xControl = aControlsById.get( *aIt );
-+ AxFormPageModel* pFormPageModel = xControl.get() ? dynamic_cast< AxFormPageModel* >( xControl->mxCtrlModel.get() ) : 0;
-+ OSL_ENSURE( pFormPageModel, "VbaFormControl::finalizeEmbeddedControls - missing formpage control" );
-+ // do not exit on error but try to collect as much pages as possible
-+ if( pFormPageModel )
-+ {
-+ // get the tab caption from tabstrip control and set it at the formpage
-+ OUString aCaption = xTabStripModel->getCaption( nTabIndex );
-+ pFormPageModel->importProperty( XML_Caption, aCaption );
-+ // store the control in maControls
-+ maControls.push_back( xControl );
-+ aControlsById.erase( *aIt );
-+ }
-+ }
-+ }
-+ else
-+ {
-+ /* Reorder the controls appropriately (sort all option buttons of an
-+ option group together to make grouping work), and erase all plain
-+ tabstrip controls (currently not supported in UNO dialogs). */
-
- // first, sort all controls by original tab index
-- ::std::sort( maControls.begin(), maControls.end(), &compareByTabIndex );
-+ ::std::sort( aControls.begin(), aControls.end(), &compareByTabIndex );
-
- /* Collect the programmatical names of all embedded controls (needed to be
-- able to set unused names to new dummy controls created below). Also
-- collect the names of all children of embedded frames (group boxes).
-- Luckily, names of controls must be unique in the entire form, not just
-- in the current container. */
-+ able to set unused names to new dummy controls created below). */
- VbaControlNamesSet aControlNames;
- VbaControlNameInserter aInserter( aControlNames );
-- maControls.forEach( aInserter );
-- for( VbaFormControlVector::iterator aIt = maControls.begin(), aEnd = maControls.end(); aIt != aEnd; ++aIt )
-- if( (*aIt)->mxCtrlModel.get() && ((*aIt)->mxCtrlModel->getControlType() == API_CONTROL_GROUPBOX) )
-- (*aIt)->maControls.forEach( aInserter );
-+ aControls.forEach( aInserter );
-
- /* Reprocess the sorted list and collect all option button controls that
- are part of the same option group (determined by group name). All
-@@ -593,11 +676,12 @@ void VbaFormControl::finalizeEmbeddedControls()
-
- typedef VbaFormControlVectorMap::mapped_type VbaFormControlVectorRef;
- bool bLastWasOptionButton = false;
-- for( VbaFormControlVector::iterator aIt = maControls.begin(), aEnd = maControls.end(); aIt != aEnd; ++aIt )
-+ for( VbaFormControlVector::iterator aIt = aControls.begin(), aEnd = aControls.end(); aIt != aEnd; ++aIt )
- {
- VbaFormControlRef xControl = *aIt;
- const ControlModelBase* pCtrlModel = xControl->mxCtrlModel.get();
--
-+ if ( !pCtrlModel ) // skip unsupported controls
-+ continue;
- if( const AxOptionButtonModel* pOptButtonModel = dynamic_cast< const AxOptionButtonModel* >( pCtrlModel ) )
- {
- // check if a new option group needs to be created
-@@ -627,6 +711,10 @@ void VbaFormControl::finalizeEmbeddedControls()
- }
- else
- {
-+ // skip unsupported controls (tabstrips and page controls)
-+ ApiControlType eCtrlType = pCtrlModel->getControlType();
-+ if( (eCtrlType != API_CONTROL_TABSTRIP) && (eCtrlType != API_CONTROL_PAGE) )
-+ {
- // open a new control group, if the last group is an option group
- if( bLastWasOptionButton || aControlGroups.empty() )
- {
-@@ -637,55 +725,14 @@ void VbaFormControl::finalizeEmbeddedControls()
- VbaFormControlVector& rLastGroup = *aControlGroups.back();
- rLastGroup.push_back( xControl );
- bLastWasOptionButton = false;
--
-- // if control is a group box, move all its children to this control
-- if( pCtrlModel && (pCtrlModel->getControlType() == API_CONTROL_GROUPBOX) )
-- {
-- /* Move all embedded controls of the group box relative to the
-- position of the group box. */
-- xControl->moveEmbeddedToAbsoluteParent();
-- /* Insert all children of the group box into the last control
-- group (following the group box). */
-- rLastGroup.insert( rLastGroup.end(), xControl->maControls.begin(), xControl->maControls.end() );
-- xControl->maControls.clear();
-- // check if last control of the group box is an option button
-- bLastWasOptionButton = dynamic_cast< const AxOptionButtonModel* >( rLastGroup.back()->mxCtrlModel.get() ) != 0;
- }
- }
- }
-
- // flatten the vector of vectors of form controls to a single vector
-- maControls.clear();
- for( VbaFormControlVectorVector::iterator aIt = aControlGroups.begin(), aEnd = aControlGroups.end(); aIt != aEnd; ++aIt )
- maControls.insert( maControls.end(), (*aIt)->begin(), (*aIt)->end() );
- }
--
--void VbaFormControl::moveRelative( const AxPairData& rDistance )
--{
-- if( mxSiteModel.get() )
-- mxSiteModel->moveRelative( rDistance );
--}
--
--void VbaFormControl::moveEmbeddedToAbsoluteParent()
--{
-- if( mxSiteModel.get() && !maControls.empty() )
-- {
-- // distance to move is equal to position of this control in its parent
-- AxPairData aDistance = mxSiteModel->getPosition();
--
-- /* For group boxes: add half of the font height to Y position (VBA
-- positions relative to frame border line, not to 'top' of frame). */
-- const AxFontDataModel* pFontModel = dynamic_cast< const AxFontDataModel* >( mxCtrlModel.get() );
-- if( pFontModel && (pFontModel->getControlType() == API_CONTROL_GROUPBOX) )
-- {
-- // convert points to 1/100 mm (1 pt = 1/72 inch = 2.54/72 cm = 2540/72 1/100 mm)
-- sal_Int32 nFontHeight = static_cast< sal_Int32 >( pFontModel->getFontHeight() * 2540 / 72 );
-- aDistance.second += nFontHeight / 2;
-- }
--
-- // move the embedded controls
-- maControls.forEachMem( &VbaFormControl::moveRelative, ::boost::cref( aDistance ) );
-- }
- }
-
- /*static*/ bool VbaFormControl::compareByTabIndex( const VbaFormControlRef& rxLeft, const VbaFormControlRef& rxRight )
-@@ -826,7 +873,7 @@ void VbaUserForm::importForm( const Reference< XModel >& rxDocModel, const Refer
- Reference< XNameContainer > xDialogNC( xDialogModel, UNO_QUERY_THROW );
-
- // convert properties and embedded controls
-- if( convertProperties( xDialogModel, *this, 0 ) )
-+ if( convertProperties( rxDocModel, xDialogModel, *this, 0 ) )
- {
- // export the dialog to XML and insert it into the dialog library
- PropertySet aFactoryProps( mxGlobalFactory );
-diff --git oox/source/ole/vbaproject.cxx oox/source/ole/vbaproject.cxx
-index 5e6e0ff..add8f8e 100755
---- oox/source/ole/vbaproject.cxx
-+++ oox/source/ole/vbaproject.cxx
-@@ -130,11 +130,9 @@ VbaProject::VbaProject( const Reference< XMultiServiceFactory >& rxGlobalFactory
- VbaFilterConfig( rxGlobalFactory, rConfigCompName ),
- mxGlobalFactory( rxGlobalFactory ),
- mxDocModel( rxDocModel ),
-- maLibName( CREATE_OUSTRING( "Standard" ) )
-+ maPrjName( CREATE_OUSTRING( "Standard" ) )
- {
- OSL_ENSURE( mxDocModel.is(), "VbaProject::VbaProject - missing document model" );
-- mxBasicLib = openLibrary( PROP_BasicLibraries, false );
-- mxDialogLib = openLibrary( PROP_DialogLibraries, false );
- }
-
- VbaProject::~VbaProject()
-@@ -189,9 +187,9 @@ Reference< XNameContainer > VbaProject::openLibrary( sal_Int32 nPropId, bool bCr
- try
- {
- Reference< XLibraryContainer > xLibContainer( getLibraryContainer( nPropId ), UNO_SET_THROW );
-- if( bCreateMissing && !xLibContainer->hasByName( maLibName ) )
-- xLibContainer->createLibrary( maLibName );
-- xLibrary.set( xLibContainer->getByName( maLibName ), UNO_QUERY_THROW );
-+ if( bCreateMissing && !xLibContainer->hasByName( maPrjName ) )
-+ xLibContainer->createLibrary( maPrjName );
-+ xLibrary.set( xLibContainer->getByName( maPrjName ), UNO_QUERY_THROW );
- }
- catch( Exception& )
- {
-@@ -278,6 +276,12 @@ void VbaProject::importVba( StorageBase& rVbaPrjStrg, const GraphicHelper& rGrap
- aModulesByStrm[ rxModule->getStreamName() ] = rxModule;
- }
- break;
-+ case VBA_ID_PROJECTNAME:
-+ {
-+ maPrjName = aRecStrm.readCharArrayUC( nRecSize, eTextEnc );
-+ OSL_ENSURE( maPrjName.getLength() > 0, "VbaProject::importVba - invalid project name" );
-+ }
-+ break;
- #undef OOX_ENSURE_RECORDSIZE
- }
- }
-@@ -347,7 +351,7 @@ void VbaProject::importVba( StorageBase& rVbaPrjStrg, const GraphicHelper& rGrap
- }
-
- /* Now it is time to load the source code. All modules will be inserted
-- into the Basic library of the document specified by the 'maLibName'
-+ into the Basic library of the document specified by the 'maPrjName'
- member. Do not create the Basic library, if there are no modules
- specified. */
- if( !aModules.empty() ) try
-diff --git oox/source/token/properties.txt oox/source/token/properties.txt
-index 2a7960a..cb18e82 100644
---- oox/source/token/properties.txt
-+++ oox/source/token/properties.txt
-@@ -85,6 +85,7 @@ CompileEnglish
- ConditionalFormat
- ConnectBars
- ContainsHeader
-+ControlSource
- Coordinates
- CopyBack
- CopyFormulas
-@@ -352,6 +353,7 @@ RotationHorizontal
- RotationVertical
- RowGrand
- RowLabelRanges
-+RowSource
- ScaleMode
- ScaleToPages
- ScaleToPagesX
-diff --git oox/source/token/tokenmap.cxx oox/source/token/tokenmap.cxx
-index a3b80ee..8b368b1 100644
---- oox/source/token/tokenmap.cxx
-+++ oox/source/token/tokenmap.cxx
-@@ -33,8 +33,6 @@
- #include "tokens.hxx"
- #include "oox/helper/containerhelper.hxx"
-
--#include <string.h>
--
- using ::rtl::OString;
- using ::rtl::OUString;
- using ::com::sun::star::uno::Sequence;
-diff --git oox/source/xls/excelfilter.cxx oox/source/xls/excelfilter.cxx
-index b5b3dc6..c1a9b8d 100644
---- oox/source/xls/excelfilter.cxx
-+++ oox/source/xls/excelfilter.cxx
-@@ -200,6 +200,63 @@ OUString SAL_CALL ExcelBiffFilter_getImplementationName() throw()
- return CREATE_OUSTRING( "com.sun.star.comp.oox.ExcelBiffFilter" );
- }
-
-+OUString SAL_CALL SimpleExcelVBAProjFilter_getImplementationName() throw()
-+{
-+ return CREATE_OUSTRING( "com.sun.star.comp.xls.SimpleExcelVBAProjFilter" );
-+}
-+
-+Sequence< OUString > SAL_CALL SimpleExcelVBAProjFilter_getSupportedServiceNames() throw()
-+{
-+ OUString aServiceName = CREATE_OUSTRING( "com.sun.star.comp.ole.SimpleExcelVBAProjFilter" );
-+ Sequence< OUString > aSeq( &aServiceName, 1 );
-+ return aSeq;
-+}
-+
-+Reference< XInterface > SAL_CALL SimpleExcelVBAProjFilter_createInstance(
-+ const Reference< XMultiServiceFactory >& rxGlobalFactory ) throw( Exception )
-+{
-+ return static_cast< ::cppu::OWeakObject* >( new SimpleExcelVBAProjFilter( rxGlobalFactory ) );
-+}
-+
-+SimpleExcelVBAProjFilter::SimpleExcelVBAProjFilter( const Reference< XMultiServiceFactory >& rxGlobalFactory ) :
-+ ExcelBiffFilter( rxGlobalFactory )
-+//, oox::ole::SimpleVBAProjFilter( rxGlobalFactory, CREATE_OUSTRING( "Calc" ), CREATE_OUSTRING( "_VBA_PROJECT_CUR" ) )
-+{
-+}
-+
-+bool SimpleExcelVBAProjFilter::importDocument() throw()
-+{
-+ bool bRet = false;
-+
-+ // detect BIFF version and workbook stream name
-+ OUString aWorkbookName;
-+ BiffType eBiff = BiffDetector::detectStorageBiffVersion( aWorkbookName, getStorage() );
-+ OSL_ENSURE( eBiff != BIFF_UNKNOWN, "ExcelBiffFilter::ExcelBiffFilter - invalid file format" );
-+ if( eBiff != BIFF_UNKNOWN )
-+ {
-+ WorkbookHelperRoot aHelper( *this, eBiff );
-+ StorageRef xVbaPrjStrg = openSubStorage( CREATE_OUSTRING( "_VBA_PROJECT_CUR" ), false ) ;
-+ if( xVbaPrjStrg.get() && xVbaPrjStrg->isStorage() )
-+ {
-+ //VbaProject aVbaProject( getGlobalFactory(), aHelper.getDocument() );
-+ ole::VbaProject aVbaProject( getGlobalFactory(), Reference< com::sun::star::frame::XModel >( aHelper.getDocument(), UNO_QUERY ), CREATE_OUSTRING( "Calc" ) );
-+ aVbaProject.importVbaProject( *xVbaPrjStrg, getGraphicHelper() );
-+ bRet = true;
-+ }
-+ }
-+ return bRet;
-+}
-+
-+OUString SimpleExcelVBAProjFilter::implGetImplementationName() const
-+{
-+ return SimpleExcelVBAProjFilter_getImplementationName();
-+}
-+
-+GraphicHelper* SimpleExcelVBAProjFilter::implCreateGraphicHelper() const
-+{
-+ return new ExcelGraphicHelper( getWorkbookData() );
-+}
-+
- Sequence< OUString > SAL_CALL ExcelBiffFilter_getSupportedServiceNames() throw()
- {
- OUString aServiceName = CREATE_OUSTRING( "com.sun.star.comp.oox.ExcelBiffFilter" );
-diff --git sc/source/filter/excel/excimp8.cxx sc/source/filter/excel/excimp8.cxx
-index 18b36c4..049447a 100644
---- sc/source/filter/excel/excimp8.cxx
-+++ sc/source/filter/excel/excimp8.cxx
-@@ -107,9 +107,14 @@
- #include <com/sun/star/script/ModuleInfo.hpp>
- #include <cppuhelper/component_context.hxx>
- #include <sfx2/app.hxx>
-+#include <com/sun/star/document/XFilter.hpp>
-+#include <com/sun/star/document/XImporter.hpp>
-+#include <comphelper/mediadescriptor.hxx>
-+
- #include "xltoolbar.hxx"
-
- using namespace com::sun::star;
-+using namespace ::comphelper;
- using ::rtl::OUString;
-
- // defined in docfunc.cxx ( really this needs a new name )
-@@ -244,13 +244,41 @@
- bool bLoadCode = pFilterOpt->IsLoadExcelBasicCode();
- bool bLoadExecutable = pFilterOpt->IsLoadExcelBasicExecutable();
- bool bLoadStrg = pFilterOpt->IsLoadExcelBasicStorage();
-+ // #FIXME need to get rid of this, we can also do this from within oox
-+ // via the "ooo.vba.VBAGlobals" service
- if( bLoadCode || bLoadStrg )
- {
-- SvxImportMSVBasic aBasicImport( *pShell, *xRootStrg, bLoadCode, bLoadStrg );
- bool bAsComment = !bLoadExecutable;
-
- if ( !bAsComment )
- {
-+ try
-+ {
-+ uno::Reference< lang::XComponent > xComponent( pShell->GetModel(), uno::UNO_QUERY_THROW );
-+
-+ uno::Reference< document::XImporter > xImporter( ScfApiHelper::CreateInstance( CREATE_OUSTRING( "com.sun.star.comp.xls.SimpleExcelVBAProjFilter" ) ), uno::UNO_QUERY_THROW );
-+ xImporter->setTargetDocument( xComponent );
-+
-+ MediaDescriptor aMediaDesc;
-+ SfxMedium& rMedium = GetMedium();
-+ SfxItemSet* pItemSet = rMedium.GetItemSet();
-+ if( pItemSet )
-+ {
-+ if( const SfxStringItem* pItem = static_cast< const SfxStringItem* >( pItemSet->GetItem( SID_FILE_NAME ) ) )
-+ aMediaDesc[ MediaDescriptor::PROP_URL() ] <<= ::rtl::OUString( pItem->GetValue() );
-+ if( const SfxStringItem* pItem = static_cast< const SfxStringItem* >( pItemSet->GetItem( SID_PASSWORD ) ) )
-+ aMediaDesc[ MediaDescriptor::PROP_PASSWORD() ] <<= ::rtl::OUString( pItem->GetValue() );
-+ }
-+ aMediaDesc[ MediaDescriptor::PROP_INPUTSTREAM() ] <<= rMedium.GetInputStream();
-+ aMediaDesc[ MediaDescriptor::PROP_INTERACTIONHANDLER() ] <<= rMedium.GetInteractionHandler();
-+
-+ // call the filter
-+ uno::Reference< document::XFilter > xFilter( xImporter, uno::UNO_QUERY_THROW );
-+ xFilter->filter( aMediaDesc.getAsConstPropertyValueList() );
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
- #if 1
- // see if we have the XCB stream
- SvStorageStreamRef xXCB = xRootStrg->OpenSotStream( String( RTL_CONSTASCII_USTRINGPARAM( "XCB" ) ), STREAM_STD_READ | STREAM_NOCREATE );
-@@ -269,9 +301,11 @@ void ImportExcel8::ReadBasic( void )
- #endif
-
- }
-- aBasicImport.Import( EXC_STORAGE_VBA_PROJECT, EXC_STORAGE_VBA, bAsComment );
-+ // #FIXME how to get this info from oox
-+ #if FIXME
- if ( !bAsComment )
- GetObjectManager().SetOleNameOverrideInfo( aBasicImport.ControlNameForObjectId() );
-+ #endif
- }
- }
- }
-@@ -308,6 +342,7 @@ void ImportExcel8::PostDocLoad( void )
- aScenList.Apply( GetRoot() );
- }
-
-+
- // read doc info (no docshell while pasting from clipboard)
- LoadDocumentProperties();
-
-diff --git sc/source/ui/docshell/docsh5.cxx sc/source/ui/docshell/docsh5.cxx
-index 676c201..59c7e4b 100644
---- sc/source/ui/docshell/docsh5.cxx
-+++ sc/source/ui/docshell/docsh5.cxx
-@@ -43,6 +43,7 @@
- #include <svl/smplhint.hxx>
-
- #include <com/sun/star/sdbc/XResultSet.hpp>
-+#include <com/sun/star/script/vba/XVBACompatibility.hpp>
-
- // INCLUDE ---------------------------------------------------------------
-
-@@ -71,6 +72,12 @@
- // defined in docfunc.cxx
- void VBA_InsertModule( ScDocument& rDoc, SCTAB nTab, String& sModuleName, String& sModuleSource );
-
-+using com::sun::star::script::XLibraryContainer;
-+using com::sun::star::script::vba::XVBACompatibility;
-+using com::sun::star::container::XNameContainer;
-+using com::sun::star::uno::Reference;
-+using com::sun::star::uno::UNO_QUERY;
-+
- // ---------------------------------------------------------------------------
-
- //
-@@ -940,18 +947,21 @@ BOOL ScDocShell::MoveTable( SCTAB nSrcTab, SCTAB nDestTab, BOOL bCopy, BOOL bRec
- {
- StarBASIC* pStarBASIC = GetBasic();
- String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
-- if ( GetBasicManager()->GetName().Len() > 0 )
-+ Reference< XLibraryContainer > xLibContainer = GetBasicContainer();
-+ Reference< XVBACompatibility > xVBACompat( xLibContainer, UNO_QUERY );
-+
-+ if ( xVBACompat.is() )
- {
-- aLibName = GetBasicManager()->GetName();
-+ aLibName = xVBACompat->getProjectName();
- pStarBASIC = GetBasicManager()->GetLib( aLibName );
- }
-+
- SCTAB nTabToUse = nDestTab;
- if ( nDestTab == SC_TAB_APPEND )
- nTabToUse = aDocument.GetMaxTableNumber() - 1;
- String sCodeName;
- String sSource;
-- com::sun::star::uno::Reference< com::sun::star::script::XLibraryContainer > xLibContainer = GetBasicContainer();
-- com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > xLib;
-+ Reference< XNameContainer > xLib;
- if( xLibContainer.is() )
- {
- com::sun::star::uno::Any aLibAny = xLibContainer->getByName( aLibName );
-@@ -1018,7 +1028,7 @@ IMPL_LINK( ScDocShell, RefreshDBDataHdl, ScRefreshTimer*, pRefreshTimer )
- {
- ScRange aRange;
- pDBData->GetArea( aRange );
-- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> xResultSet;
-+ Reference< ::com::sun::star::sdbc::XResultSet> xResultSet;
- bContinue = aFunc.DoImport( aRange.aStart.Tab(), aImportParam, xResultSet, NULL, TRUE, FALSE ); //! Api-Flag as parameter
- // internal operations (sort, query, subtotal) only if no error
- if (bContinue)
-diff --git scripting/prj/build.lst scripting/prj/build.lst
-index 7d51621..28fcdbc 100755
---- scripting/prj/build.lst
-+++ scripting/prj/build.lst
-@@ -1,4 +1,4 @@
--tc scripting : oovbaapi vbahelper bridges rdbmaker vcl xmlscript basic sfx2 rhino BSH:beanshell javaunohelper NULL
-+tc scripting : filter oovbaapi vbahelper bridges rdbmaker vcl xmlscript basic sfx2 rhino BSH:beanshell javaunohelper NULL
- tc scripting usr1 - all tc1_mkout NULL
- tc scripting\inc nmake - all tc1_inc NULL
- tc scripting\source\provider nmake - all tc1_scriptingprovider tc1_inc NULL
-diff --git scripting/source/dlgprov/dlgevtatt.cxx scripting/source/dlgprov/dlgevtatt.cxx
-index 5be31fb..f454bed 100644
---- scripting/source/dlgprov/dlgevtatt.cxx
-+++ scripting/source/dlgprov/dlgevtatt.cxx
-@@ -38,6 +38,7 @@
- #include <tools/diagnose_ex.h>
-
- #include <com/sun/star/awt/XControl.hpp>
-+#include <com/sun/star/awt/XControlContainer.hpp>
- #include <com/sun/star/awt/XDialogEventHandler.hpp>
- #include <com/sun/star/awt/XContainerWindowEventHandler.hpp>
- #include <com/sun/star/beans/XPropertySet.hpp>
-@@ -232,6 +233,9 @@ namespace dlgprov
- Reference< container::XNameContainer > xEventCont = xEventsSupplier->getEvents();
-
- Reference< XControlModel > xControlModel = xControl->getModel();
-+ Reference< XPropertySet > xProps( xControlModel, uno::UNO_QUERY );
-+ rtl::OUString sName;
-+ xProps->getPropertyValue( rtl::OUString::createFromAscii("Name") ) >>= sName;
- if ( xEventCont.is() )
- {
- Sequence< ::rtl::OUString > aNames = xEventCont->getElementNames();
-@@ -288,6 +292,51 @@ namespace dlgprov
- }
- }
-
-+
-+ void DialogEventsAttacherImpl::nestedAttachEvents( const Sequence< Reference< XInterface > >& Objects, const Any& Helper, rtl::OUString& sDialogCodeName )
-+ {
-+ const Reference< XInterface >* pObjects = Objects.getConstArray();
-+ sal_Int32 nObjCount = Objects.getLength();
-+
-+ for ( sal_Int32 i = 0; i < nObjCount; ++i )
-+ {
-+ // We know that we have to do with instances of XControl.
-+ // Otherwise this is not the right implementation for
-+ // XScriptEventsAttacher and we have to give up.
-+ Reference< XControl > xControl( pObjects[ i ], UNO_QUERY );
-+ Reference< XControlContainer > xControlContainer( xControl, UNO_QUERY );
-+ Reference< XDialog > xDialog( xControl, UNO_QUERY );
-+ if ( !xControl.is() )
-+ throw IllegalArgumentException();
-+
-+ // get XEventsSupplier from control model
-+ Reference< XControlModel > xControlModel = xControl->getModel();
-+ Reference< XScriptEventsSupplier > xEventsSupplier( xControlModel, UNO_QUERY );
-+ attachEventsToControl( xControl, xEventsSupplier, Helper );
-+ if ( mbUseFakeVBAEvents )
-+ {
-+ xEventsSupplier.set( getFakeVbaEventsSupplier( xControl, sDialogCodeName ) );
-+ Any newHelper(xControl );
-+ attachEventsToControl( xControl, xEventsSupplier, newHelper );
-+ }
-+ if ( xControlContainer.is() && !xDialog.is() )
-+ {
-+ Sequence< Reference< XControl > > aControls = xControlContainer->getControls();
-+ sal_Int32 nControlCount = aControls.getLength();
-+
-+ Sequence< Reference< XInterface > > aObjects( nControlCount );
-+ Reference< XInterface >* pObjectsModify = aObjects.getArray();
-+ const Reference< XControl >* pControls = aControls.getConstArray();
-+
-+ for ( sal_Int32 j = 0; j < nControlCount; ++j )
-+ {
-+ pObjectsModify[j] = Reference< XInterface >( pControls[j], UNO_QUERY );
-+ }
-+ nestedAttachEvents( aObjects, Helper, sDialogCodeName );
-+ }
-+ }
-+ }
-+
- // -----------------------------------------------------------------------------
- // XScriptEventsAttacher
- // -----------------------------------------------------------------------------
-@@ -320,12 +369,9 @@ namespace dlgprov
-
- }
- }
--
-- // go over all objects
-- const Reference< XInterface >* pObjects = Objects.getConstArray();
-+ rtl::OUString sDialogCodeName;
- sal_Int32 nObjCount = Objects.getLength();
- Reference< awt::XControl > xDlgControl( Objects[ nObjCount - 1 ], uno::UNO_QUERY ); // last object is the dialog
-- rtl::OUString sDialogCodeName;
- if ( xDlgControl.is() )
- {
- Reference< XPropertySet > xProps( xDlgControl->getModel(), UNO_QUERY );
-@@ -335,26 +381,8 @@ namespace dlgprov
- }
- catch( Exception& ){}
- }
--
-- for ( sal_Int32 i = 0; i < nObjCount; ++i )
-- {
-- // We know that we have to do with instances of XControl.
-- // Otherwise this is not the right implementation for
-- // XScriptEventsAttacher and we have to give up.
-- Reference< XControl > xControl( pObjects[ i ], UNO_QUERY );
-- if ( !xControl.is() )
-- throw IllegalArgumentException();
--
-- // get XEventsSupplier from control model
-- Reference< XControlModel > xControlModel = xControl->getModel();
-- Reference< XScriptEventsSupplier > xEventsSupplier( xControlModel, UNO_QUERY );
-- attachEventsToControl( xControl, xEventsSupplier, Helper );
-- if ( mbUseFakeVBAEvents )
-- {
-- xEventsSupplier.set( getFakeVbaEventsSupplier( xControl, sDialogCodeName ) );
-- attachEventsToControl( xControl, xEventsSupplier, Helper );
-- }
-- }
-+ // go over all objects
-+ nestedAttachEvents( Objects, Helper, sDialogCodeName );
- }
-
-
-diff --git scripting/source/dlgprov/dlgevtatt.hxx scripting/source/dlgprov/dlgevtatt.hxx
-index 0868465..78d3b3a 100644
---- scripting/source/dlgprov/dlgevtatt.hxx
-+++ scripting/source/dlgprov/dlgevtatt.hxx
-@@ -68,6 +68,7 @@ namespace dlgprov
- ::com::sun::star::uno::Reference< ::com::sun::star::script::XEventAttacher > m_xEventAttacher;
- ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptListener > getScriptListenerForKey( const rtl::OUString& sScriptName ) throw ( ::com::sun::star::uno::RuntimeException );
- ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptEventsSupplier > getFakeVbaEventsSupplier( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl, rtl::OUString& sCodeName );
-+ void nestedAttachEvents( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >& Objects, const ::com::sun::star::uno::Any& Helper, rtl::OUString& sDialogCodeName );
- void SAL_CALL attachEventsToControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl, const ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptEventsSupplier >& events, const ::com::sun::star::uno::Any& Helper );
- public:
- DialogEventsAttacherImpl( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
-diff --git scripting/source/vbaevents/eventhelper.cxx scripting/source/vbaevents/eventhelper.cxx
-index 80c6edd..f39acd8 100644
---- scripting/source/vbaevents/eventhelper.cxx
-+++ scripting/source/vbaevents/eventhelper.cxx
-@@ -56,6 +56,7 @@
- #include <com/sun/star/script/XLibraryContainer.hpp>
- #include <com/sun/star/script/ScriptEventDescriptor.hpp>
- #include <com/sun/star/script/provider/XScriptProviderSupplier.hpp>
-+#include <com/sun/star/script/vba/XVBACompatibility.hpp>
-
- #include <com/sun/star/container/XNamed.hpp>
-
-@@ -765,7 +766,7 @@ private:
- Reference< frame::XModel > m_xModel;
- SfxObjectShell* mpShell;
- sal_Bool m_bDocClosed;
--
-+ rtl::OUString msProject;
- };
-
- EventListener::EventListener( const Reference< XComponentContext >& rxContext ) :
-@@ -773,7 +774,7 @@ OPropertyContainer(GetBroadcastHelper()), m_xContext( rxContext ), m_bDocClosed(
- {
- registerProperty( EVENTLSTNR_PROPERTY_MODEL, EVENTLSTNR_PROPERTY_ID_MODEL,
- beans::PropertyAttribute::TRANSIENT, &m_xModel, ::getCppuType( &m_xModel ) );
--
-+ msProject = rtl::OUString::createFromAscii("Standard");
- }
-
- void
-@@ -791,6 +792,14 @@ EventListener::setShellFromModel()
- }
- pShell = SfxObjectShell::GetNext( *pShell );
- }
-+ // set ProjectName from model
-+ try
-+ {
-+ Reference< beans::XPropertySet > xProps( m_xModel, UNO_QUERY_THROW );
-+ uno::Reference< script::vba::XVBACompatibility > xVBAMode( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BasicLibraries") ) ), uno::UNO_QUERY_THROW );
-+ msProject = xVBAMode->getProjectName();
-+ }
-+ catch ( uno::Exception& ) {}
- }
-
- //XEventListener
-@@ -1061,19 +1070,10 @@ EventListener::firing_Impl(const ScriptEvent& evt, Any* pRet ) throw(RuntimeExce
-
- StarBASIC* pBasic = mpShell->GetBasic();
- BasicManager* pBasicManager = mpShell->GetBasicManager();
-- rtl::OUString sProject;
-+ rtl::OUString sProject( msProject );
- rtl::OUString sScriptCode( evt.ScriptCode );
- // dialogs pass their own library, presence of Dot determines that
-- if ( sScriptCode.indexOf( '.' ) == -1 )
-- {
-- //'Project' is a better default but I want to force failures
-- //rtl::OUString sMacroLoc = rtl::OUString::createFromAscii("Project");
-- sProject = rtl::OUString::createFromAscii("Standard");
--
-- if ( pBasicManager->GetName().Len() > 0 )
-- sProject = pBasicManager->GetName();
-- }
-- else
-+ if ( sScriptCode.indexOf( '.' ) != -1 )
- {
- sal_Int32 nIndex = sScriptCode.indexOf( '.' );
- sProject = sScriptCode.copy( 0, nIndex );
-diff --git toolkit/inc/toolkit/awt/vclxwindows.hxx toolkit/inc/toolkit/awt/vclxwindows.hxx
-index 5533155..c7edaa3 100644
---- toolkit/inc/toolkit/awt/vclxwindows.hxx
-+++ toolkit/inc/toolkit/awt/vclxwindows.hxx
-@@ -81,6 +81,7 @@
- #include <com/sun/star/awt/XDateField.hpp>
- #include <com/sun/star/awt/XComboBox.hpp>
- #include <com/sun/star/awt/XCheckBox.hpp>
-+#include <com/sun/star/awt/XSimpleTabController.hpp>
- #include <com/sun/star/awt/XItemListListener.hpp>
- #include <cppuhelper/weak.hxx>
- #include <cppuhelper/implbase3.hxx>
-@@ -92,6 +93,7 @@
-
- #include <vcl/pointr.hxx>
- #include <vcl/image.hxx>
-+#include <vcl/tabctrl.hxx>
-
- #include <com/sun/star/document/XVbaMethodParameter.hpp> //liuchen 2009-6-22, add the support of input/output parameters to VBA Dialog_QueryClose event
- class Button;
-@@ -372,6 +374,40 @@ public:
- virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
- };
-
-+// ----------------------------------------------------
-+// class VCLXFrame
-+// ----------------------------------------------------
-+class VCLXFrame : public VCLXContainer
-+{
-+protected:
-+ void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
-+
-+public:
-+ VCLXFrame();
-+ ~VCLXFrame();
-+
-+ // ::com::sun::star::uno::XInterface
-+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
-+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
-+ void SAL_CALL release() throw() { OWeakObject::release(); }
-+
-+ // ::com::sun::star::lang::XTypeProvider
-+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
-+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
-+
-+ // ::com::sun::star::awt::XView
-+ void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException);
-+
-+ // ::com::sun::star::awt::XDevice,
-+ ::com::sun::star::awt::DeviceInfo SAL_CALL getInfo() throw(::com::sun::star::uno::RuntimeException);
-+
-+ // ::com::sun::star::awt::XVclWindowPeer
-+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
-+
-+ static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
-+ virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
-+};
-+
-
-
- // ----------------------------------------------------
-@@ -449,6 +485,59 @@ public:
- // ::com::sun::star::awt::XVclWindowPeer
- void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
-
-+ TabPage* getTabPage() const throw ( ::com::sun::star::uno::RuntimeException);
-+ static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
-+ virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
-+};
-+
-+class VCLXMultiPage : public ::com::sun::star::awt::XSimpleTabController, public VCLXContainer
-+{
-+ TabListenerMultiplexer maTabListeners;
-+ sal_Int32 mTabId;
-+protected:
-+ void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
-+public:
-+ VCLXMultiPage();
-+ ~VCLXMultiPage();
-+
-+ // ::com::sun::star::uno::XInterface
-+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
-+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
-+ void SAL_CALL release() throw() { OWeakObject::release(); }
-+
-+ // ::com::sun::star::lang::XTypeProvider
-+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
-+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
-+
-+ // ::com::sun::star::lang::XComponent
-+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
-+
-+ // ::com::sun::star::awt::XView
-+ void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException);
-+
-+ // ::com::sun::star::awt::XDevice,
-+ ::com::sun::star::awt::DeviceInfo SAL_CALL getInfo() throw(::com::sun::star::uno::RuntimeException);
-+
-+ // ::com::sun::star::awt::XVclWindowPeer
-+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
-+ ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
-+ // XSimpleTabController
-+ virtual ::sal_Int32 SAL_CALL insertTab() throw (::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL removeTab( ::sal_Int32 ID ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
-+
-+ virtual void SAL_CALL setTabProps( ::sal_Int32 ID, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& Properties ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
-+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > SAL_CALL getTabProps( ::sal_Int32 ID ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
-+
-+ virtual void SAL_CALL activateTab( ::sal_Int32 ID ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getActiveTabID() throw (::com::sun::star::uno::RuntimeException);
-+
-+ virtual void SAL_CALL addTabListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL removeTabListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
-+ // C++
-+ TabControl* getTabControl() const throw ( ::com::sun::star::uno::RuntimeException);
-+ USHORT insertTab( TabPage*, rtl::OUString& sTitle );
-+ static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
-+ virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
- };
-
- // ----------------------------------------------------
-diff --git toolkit/inc/toolkit/controls/dialogcontrol.hxx toolkit/inc/toolkit/controls/dialogcontrol.hxx
-index 32e7db6..2b83f01 100644
---- toolkit/inc/toolkit/controls/dialogcontrol.hxx
-+++ toolkit/inc/toolkit/controls/dialogcontrol.hxx
-@@ -35,12 +35,16 @@
- #include <com/sun/star/awt/XTopWindow.hpp>
- #include <com/sun/star/util/XChangesNotifier.hpp>
- #include <com/sun/star/util/XChangesListener.hpp>
-+#include <com/sun/star/awt/XTabListener.hpp>
-+#include <com/sun/star/awt/XSimpleTabController.hpp>
- #include <com/sun/star/util/XModifyListener.hpp>
- #include <com/sun/star/beans/XPropertyChangeListener.hpp>
- #include <com/sun/star/awt/XDialog2.hpp>
- #include <com/sun/star/resource/XStringResourceResolver.hpp>
-+#include <com/sun/star/graphic/XGraphicObject.hpp>
- #include <cppuhelper/implbase6.hxx>
- #include <cppuhelper/implbase5.hxx>
-+#include <cppuhelper/implbase2.hxx>
- #include <toolkit/helper/listenermultiplexer.hxx>
- #include <toolkit/controls/unocontrolmodel.hxx>
- #include "toolkit/helper/servicenames.hxx"
-@@ -68,11 +72,12 @@ class UnoControlDialogModel : public UnoControlDialogModel_IBase
- , public UnoControlDialogModel_Base
- {
- public:
-+ enum ChildOperation { Insert = 0, Remove };
- // would like to make this typedef private, too, but the Forte 7 compiler does have
- // problems with this .....
- typedef ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >, ::rtl::OUString >
- UnoControlModelHolder;
--private:
-+protected:
- typedef ::std::list< UnoControlModelHolder > UnoControlModelHolderList;
-
- // for grouping control models (XTabControllerModel::getGroupXXX)
-@@ -84,7 +89,7 @@ private:
- friend struct FindControlModel;
- friend struct CompareControlModel;
-
--private:
-+protected:
- ContainerListenerMultiplexer maContainerListeners;
- ::cppu::OInterfaceContainerHelper maChangeListeners;
- UnoControlModelHolderList maModels;
-@@ -95,13 +100,14 @@ private:
- ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicObject > mxGrfObj;
- bool mbAdjustingGraphic;
- protected:
-- ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
-+ virtual ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
- ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
-
- UnoControlModelHolderList::iterator ImplFindElement( const ::rtl::OUString& rName );
-+ void updateUserFormChildren( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& xAllChildren, const rtl::OUString& aName, ChildOperation Operation, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& xTarget ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) ;
-
- public:
-- UnoControlDialogModel();
-+ UnoControlDialogModel( bool bRegProps = true );
- UnoControlDialogModel( const UnoControlDialogModel& rModel );
- ~UnoControlDialogModel();
-
-@@ -124,13 +130,6 @@ public:
- ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
- sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
-
-- // ::com::sun::star::container::XIndexContainer, XIndexReplace, XIndexAcces
-- // void SAL_CALL replaceByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) = 0;
-- // sal_Int32 SAL_CALL getCount( ) throw(::com::sun::star::uno::RuntimeException) = 0;
-- // ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) = 0;
-- // void SAL_CALL insertByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) = 0;
-- // void SAL_CALL removeByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) = 0;
--
- // ::com::sun::star::container::XNameContainer, XNameReplace, XNameAccess
- void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
- ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-@@ -180,12 +179,12 @@ public:
- protected:
- void startControlListening( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxChildModel );
- void stopControlListening( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxChildModel );
-- // ::cppu::OPropertySetHelper
-- void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception);
-
- void implNotifyTabModelChange( const ::rtl::OUString& _rAccessor );
-
- void implUpdateGroupStructure();
-+ // ::cppu::OPropertySetHelper
-+ void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception);
- private:
- void AddRadioButtonToGroup (
- const ::com::sun::star::uno::Reference< XControlModel >& rControlModel,
-@@ -196,17 +195,6 @@ private:
- ::std::map< ::rtl::OUString, ModelGroup >& pNamedGroups );
- };
-
--// ----------------------------------------------------
--// class UnoDialogControl
--// ----------------------------------------------------
--typedef ::cppu::ImplHelper6 < ::com::sun::star::container::XContainerListener
-- , ::com::sun::star::awt::XTopWindow
-- , ::com::sun::star::awt::XDialog2
-- , ::com::sun::star::util::XChangesListener
-- , ::com::sun::star::util::XModifyListener
-- , ::com::sun::star::awt::XWindowListener
-- > UnoDialogControl_IBase;
--
- class ResourceListener :public ::com::sun::star::util::XModifyListener,
- public ::cppu::OWeakObject,
- public ::cppu::BaseMutex
-@@ -235,29 +223,78 @@ class ResourceListener :public ::com::sun::star::util::XModifyListener,
- bool m_bListening;
- };
-
--class UnoDialogControl :public UnoControlContainer
-- ,public UnoDialogControl_IBase
-+typedef ::cppu::ImplHelper2 < ::com::sun::star::container::XContainerListener
-+ , ::com::sun::star::util::XChangesListener
-+ > UnoDialogContainerControl_IBase;
-+
-+class UnoDialogContainerControl : public UnoControlContainer, public UnoDialogContainerControl_IBase
-+{
-+protected:
-+ bool mbSizeModified;
-+ bool mbPosModified;
-+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > mxTabController;
-+ void ImplInsertControl( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxModel, const ::rtl::OUString& rName );
-+ void ImplRemoveControl( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxModel );
-+ virtual void ImplSetPosSize( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& rxCtrl );
-+
-+public:
-+ UnoDialogContainerControl();
-+ ~UnoDialogContainerControl();
-+
-+ DECLIMPL_SERVICEINFO_DERIVED( UnoDialogContainerControl, UnoControlBase, "com.sun.star.awt.UnoDialogContainerControl" )
-+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlContainer::queryInterface(rType); }
-+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
-+ void SAL_CALL acquire() throw() { OWeakAggObject::acquire(); }
-+ void SAL_CALL release() throw() { OWeakAggObject::release(); }
-+
-+ void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
-+ void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
-+
-+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
-+
-+ // ::com::sun::star::container::XContainerListener
-+ void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
-+ void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
-+ void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
-+
-+ // ::com::sun::star::lang::XTypeProvider
-+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
-+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
-+
-+ // XChangesListener
-+ virtual void SAL_CALL changesOccurred( const ::com::sun::star::util::ChangesEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
-+
-+ // ::com::sun::star::awt::XControl
-+ sal_Bool SAL_CALL setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& Model ) throw(::com::sun::star::uno::RuntimeException);
-+ void SAL_CALL setDesignMode( sal_Bool bOn ) throw(::com::sun::star::uno::RuntimeException);
-+protected:
-+ virtual void ImplModelPropertiesChanged( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyChangeEvent >& rEvents ) throw(::com::sun::star::uno::RuntimeException);
-+ virtual void removingControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl );
-+ virtual void addingControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl );
-+};
-+
-+
-+
-+class UnoDialogControl :public UnoDialogContainerControl
-+ ,public ::com::sun::star::awt::XTopWindow, public ::com::sun::star::awt::XDialog2, public ::com::sun::star::awt::XWindowListener
- {
- private:
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar > mxMenuBar;
-- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > mxTabController;
-- ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > mxListener;
- TopWindowListenerMultiplexer maTopWindowListeners;
- bool mbWindowListener;
-- bool mbSizeModified;
-- bool mbPosModified;
-+ ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicObject > mxGrfObj;
-+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > mxListener;
-
- protected:
-
- void ImplInsertControl( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxModel, const ::rtl::OUString& rName );
-- void ImplRemoveControl( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxModel );
-- void ImplSetPosSize( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& rxCtrl );
- void ImplUpdateResourceResolver();
- void ImplStartListingForResourceEvents();
-
- public:
-
- UnoDialogControl();
-+ ~UnoDialogControl();
- ::rtl::OUString GetComponentServiceName();
-
- ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlContainer::queryInterface(rType); }
-@@ -282,11 +319,6 @@ public:
- virtual void SAL_CALL windowShown( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL windowHidden( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
-
-- // ::com::sun::star::container::XContainerListener
-- void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
-- void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
-- void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
--
- // ::com::sun::star::awt::XDialog2
- virtual void SAL_CALL endDialog( ::sal_Int32 Result ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setHelpId( ::sal_Int32 Id ) throw (::com::sun::star::uno::RuntimeException);
-@@ -303,10 +335,6 @@ public:
-
- // ::com::sun::star::awt::XControl
- sal_Bool SAL_CALL setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& Model ) throw(::com::sun::star::uno::RuntimeException);
-- void SAL_CALL setDesignMode( sal_Bool bOn ) throw(::com::sun::star::uno::RuntimeException);
--
-- // XChangesListener
-- virtual void SAL_CALL changesOccurred( const ::com::sun::star::util::ChangesEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
-
- // XModifyListener
- virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
-@@ -317,13 +345,153 @@ public:
- protected:
- virtual void ImplModelPropertiesChanged( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyChangeEvent >& rEvents ) throw(::com::sun::star::uno::RuntimeException);
- virtual void PrepareWindowDescriptor( ::com::sun::star::awt::WindowDescriptor& rDesc );
-+protected:
-+};
-+
-+class UnoMultiPageModel : public UnoControlDialogModel
-+{
-+public:
-+ UnoMultiPageModel();
-+ ~UnoMultiPageModel();
-+ UnoMultiPageModel( const UnoMultiPageModel& rModel );
-+
-+ UnoControlModel* Clone() const;
-+
-+ DECLIMPL_SERVICEINFO_DERIVED( UnoMultiPageModel, UnoControlDialogModel, szServiceName_UnoMultiPageModel )
-
-+ virtual ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
-+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw( ::com::sun::star::uno::RuntimeException);
-+ // XNamedContainer
-+ void SAL_CALL insertByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-+
-+ // Override the method of parent Class
-+ virtual sal_Bool SAL_CALL getGroupControl( ) throw (::com::sun::star::uno::RuntimeException);
- protected:
-- virtual void removingControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl );
-- virtual void addingControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl );
-+ virtual ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
-+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
-+
- };
-
-
-+
-+class UnoMultiPageControl : public UnoDialogContainerControl
-+ ,public ::com::sun::star::awt::XSimpleTabController
-+ ,public ::com::sun::star::awt::XTabListener
-+{
-+ TabListenerMultiplexer maTabListeners;
-+ void bindPage( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl );
-+public:
-+ UnoMultiPageControl();
-+ ~UnoMultiPageControl();
-+ ::rtl::OUString GetComponentServiceName();
-+
-+ // ::com::sun::star::lang::XServiceInfo
-+ DECLIMPL_SERVICEINFO_DERIVED( UnoMultiPageControl, UnoDialogContainerControl, szServiceName_UnoMultiPageControl )
-+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoDialogContainerControl::queryInterface(rType); }
-+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
-+ void SAL_CALL acquire() throw() { OWeakAggObject::acquire(); }
-+ void SAL_CALL release() throw() { OWeakAggObject::release(); }
-+ // ::com::sun::star::lang::XTypeProvider
-+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
-+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
-+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
-+ // com::sun::star::awt::XSimpleTabController
-+ virtual ::sal_Int32 SAL_CALL insertTab() throw (::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL removeTab( ::sal_Int32 ID ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
-+
-+ virtual void SAL_CALL setTabProps( ::sal_Int32 ID, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& Properties ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
-+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > SAL_CALL getTabProps( ::sal_Int32 ID ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
-+
-+ virtual void SAL_CALL activateTab( ::sal_Int32 ID ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getActiveTabID() throw (::com::sun::star::uno::RuntimeException);
-+
-+ virtual void SAL_CALL addTabListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL removeTabListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
-+ // XTabListener
-+ virtual void SAL_CALL inserted( ::sal_Int32 ID ) throw (::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL removed( ::sal_Int32 ID ) throw (::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL changed( ::sal_Int32 ID, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& Properties ) throw (::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL activated( ::sal_Int32 ID ) throw (::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL deactivated( ::sal_Int32 ID ) throw (::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& evt ) throw (::com::sun::star::uno::RuntimeException);
-+ // XComponent
-+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
-+
-+protected:
-+ virtual void impl_createControlPeerIfNecessary(
-+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl
-+ );
-+
-+};
-+
-+
-+class UnoPageModel : public UnoControlDialogModel
-+{
-+public:
-+ UnoPageModel();
-+ ~UnoPageModel();
-+ UnoPageModel( const UnoPageModel& rModel );
-+
-+ UnoControlModel* Clone() const;
-+
-+ DECLIMPL_SERVICEINFO_DERIVED( UnoPageModel, UnoControlDialogModel, szServiceName_UnoPageModel )
-+
-+ virtual ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
-+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw( ::com::sun::star::uno::RuntimeException);
-+
-+ // Override the method of parent Class
-+ virtual sal_Bool SAL_CALL getGroupControl( ) throw (::com::sun::star::uno::RuntimeException);
-+protected:
-+ virtual ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
-+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
-+
-+};
-+
-+
-+class UnoPageControl : public UnoDialogContainerControl
-+{
-+public:
-+ UnoPageControl();
-+ ~UnoPageControl();
-+ ::rtl::OUString GetComponentServiceName();
-+
-+
-+ // ::com::sun::star::lang::XServiceInfo
-+ DECLIMPL_SERVICEINFO_DERIVED( UnoPageControl, UnoDialogContainerControl, szServiceName_UnoPageControl )
-+};
-+
-+class UnoFrameModel : public UnoControlDialogModel
-+{
-+public:
-+ UnoFrameModel();
-+ ~UnoFrameModel();
-+ UnoFrameModel( const UnoFrameModel& rModel );
-+
-+ UnoControlModel* Clone() const;
-+
-+ DECLIMPL_SERVICEINFO_DERIVED( UnoFrameModel, UnoControlDialogModel, szServiceName_UnoFrameModel )
-+
-+ virtual ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
-+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw( ::com::sun::star::uno::RuntimeException);
-+
-+protected:
-+ virtual ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
-+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
-+};
-+
-+class UnoFrameControl : public UnoDialogContainerControl
-+{
-+protected:
-+ virtual void ImplSetPosSize( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& rxCtrl );
-+public:
-+ UnoFrameControl();
-+ ~UnoFrameControl();
-+ ::rtl::OUString GetComponentServiceName();
-+
-+ // ::com::sun::star::lang::XServiceInfo
-+ DECLIMPL_SERVICEINFO_DERIVED( UnoFrameControl, UnoDialogContainerControl, szServiceName_UnoPageControl )
-+};
-+
- #endif // TOOLKIT_DIALOG_CONTROL_HXX
-
- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
-diff --git toolkit/inc/toolkit/controls/unocontrolcontainer.hxx toolkit/inc/toolkit/controls/unocontrolcontainer.hxx
-index 3550bc1..1ae139b 100644
---- toolkit/inc/toolkit/controls/unocontrolcontainer.hxx
-+++ toolkit/inc/toolkit/controls/unocontrolcontainer.hxx
-@@ -120,6 +120,15 @@ protected:
- virtual void removingControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl );
- virtual void addingControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl );
-
-+ /** ensures that the given control has a peer, if necessary and possible
-+ @param _rxControl
-+ an ->XControl which has just been inserted into the container. Must not be <NULL/>.
-+ @precond
-+ our mutex is locked
-+ */
-+ virtual void impl_createControlPeerIfNecessary(
-+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl
-+ );
- private:
- /** adds the control to the container, does necessary notifications, and the like
- @param _rxControl
-@@ -150,15 +159,6 @@ private:
- const ::rtl::OUString* _pNameAccessor
- );
-
-- /** ensures that the given control has a peer, if necessary and possible
-- @param _rxControl
-- an ->XControl which has just been inserted into the container. Must not be <NULL/>.
-- @precond
-- our mutex is locked
-- */
-- void impl_createControlPeerIfNecessary(
-- const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl
-- );
- };
-
-
-diff --git toolkit/inc/toolkit/controls/unocontrols.hxx toolkit/inc/toolkit/controls/unocontrols.hxx
-index 993c798..2f6e185 100644
---- toolkit/inc/toolkit/controls/unocontrols.hxx
-+++ toolkit/inc/toolkit/controls/unocontrols.hxx
-@@ -72,6 +72,16 @@
- #define UNO_NAME_GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:"
- #define UNO_NAME_GRAPHOBJ_URLPKGPREFIX "vnd.sun.star.Package:"
-
-+class ImageHelper
-+{
-+public:
-+ // The routine will always attempt to return a valid XGraphic for the passed _rURL
-+ // additionallly xOutGraphicObject will container the associated XGraphicObject ( if url
-+ // is valid for that )
-+ // and is set appropriately ( e.g. NULL if non GraphicObject scheme ) or valid object
-+ // if the rURL points to a valid object
-+ static ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > getGraphicAndGraphicObjectFromURL_nothrow( ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicObject >& xOutGraphicObject, const ::rtl::OUString& _rURL );
-+};
-
- // ----------------------------------------------------
- // class UnoControlEditModel
-@@ -224,6 +234,7 @@ private:
- bool mbAdjustingGraphic;
-
- ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicObject > mxGrfObj;
-+ ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL );
-
- protected:
- GraphicControlModel() : mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ) { }
-@@ -637,44 +648,6 @@ public:
-
- };
-
--class UnoMultiPageModel : public UnoControlModel
--{
--protected:
-- ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
-- ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
--
--public:
-- UnoMultiPageModel();
-- UnoMultiPageModel( const UnoMultiPageModel& rModel ) : UnoControlModel( rModel ) {;}
--
-- UnoControlModel* Clone() const { return new UnoMultiPageModel( *this ); }
--
-- // ::com::sun::star::io::XPersistObject
-- ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
--
-- // ::com::sun::star::beans::XMultiPropertySet
-- ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
--
-- // ::com::sun::star::lang::XServiceInfo
-- DECLIMPL_SERVICEINFO_DERIVED( UnoMultiPageModel, UnoControlModel, szServiceName_UnoMultiPageModel )
--
--};
--// ----------------------------------------------------
--// class UnoGroupBoxControl
--// ----------------------------------------------------
--class UnoMultiPageControl : public UnoControlBase
--{
--public:
-- UnoMultiPageControl();
-- ::rtl::OUString GetComponentServiceName();
--
-- sal_Bool SAL_CALL isTransparent( ) throw(::com::sun::star::uno::RuntimeException);
--
-- // ::com::sun::star::lang::XServiceInfo
-- DECLIMPL_SERVICEINFO_DERIVED( UnoMultiPageControl, UnoControlBase, szServiceName_UnoMultiPageControl )
--
--};
--
- // ----------------------------------------------------
- // class UnoFixedTextControl
- // ----------------------------------------------------
-diff --git toolkit/inc/toolkit/helper/listenermultiplexer.hxx toolkit/inc/toolkit/helper/listenermultiplexer.hxx
-index f8d49ee..189571f 100644
---- toolkit/inc/toolkit/helper/listenermultiplexer.hxx
-+++ toolkit/inc/toolkit/helper/listenermultiplexer.hxx
-@@ -42,6 +42,7 @@
- #include <com/sun/star/awt/XTextListener.hpp>
- #include <com/sun/star/awt/XActionListener.hpp>
- #include <com/sun/star/awt/XItemListener.hpp>
-+#include <com/sun/star/awt/XTabListener.hpp>
- #include <com/sun/star/container/XContainerListener.hpp>
- #include <com/sun/star/awt/XSpinListener.hpp>
- #include <com/sun/star/awt/XAdjustmentListener.hpp>
-@@ -184,6 +185,17 @@ DECL_LISTENERMULTIPLEXER_START_DLLPUB( ItemListenerMultiplexer, ::com::sun::star
- DECL_LISTENERMULTIPLEXER_END
-
- // ----------------------------------------------------
-+// class TabListenerMultiplexer
-+// ----------------------------------------------------
-+DECL_LISTENERMULTIPLEXER_START_DLLPUB( TabListenerMultiplexer, ::com::sun::star::awt::XTabListener )
-+ void SAL_CALL inserted( ::sal_Int32 ID ) throw (::com::sun::star::uno::RuntimeException);
-+ void SAL_CALL removed( ::sal_Int32 ID ) throw (::com::sun::star::uno::RuntimeException);
-+ void SAL_CALL changed( ::sal_Int32 ID, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& Properties ) throw (::com::sun::star::uno::RuntimeException);
-+ void SAL_CALL activated( ::sal_Int32 ID ) throw (::com::sun::star::uno::RuntimeException);
-+ void SAL_CALL deactivated( ::sal_Int32 ID ) throw (::com::sun::star::uno::RuntimeException);
-+DECL_LISTENERMULTIPLEXER_END
-+
-+// ----------------------------------------------------
- // class ContainerListenerMultiplexer
- // ----------------------------------------------------
- DECL_LISTENERMULTIPLEXER_START( ContainerListenerMultiplexer, ::com::sun::star::container::XContainerListener )
-diff --git toolkit/inc/toolkit/helper/macros.hxx toolkit/inc/toolkit/helper/macros.hxx
-index 65c0cbf..4e5fa6b 100644
---- toolkit/inc/toolkit/helper/macros.hxx
-+++ toolkit/inc/toolkit/helper/macros.hxx
-@@ -190,6 +190,57 @@ void ClassName::disposing( const ::com::sun::star::lang::EventObject& ) throw(::
- #define DISPLAY_EXCEPTION( ClassName, MethodName, e )
- #endif
-
-+#define IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_2PARAM( ClassName, InterfaceName, MethodName, ParamType1, ParamType2 ) \
-+{ \
-+ ParamType1 aMulti( evt ); \
-+ ParamType2 aMulti2( evt2 ); \
-+ ::cppu::OInterfaceIteratorHelper aIt( *this ); \
-+ while( aIt.hasMoreElements() ) \
-+ { \
-+ ::com::sun::star::uno::Reference< InterfaceName > xListener( \
-+ static_cast< InterfaceName* >( aIt.next() ) ); \
-+ try \
-+ { \
-+ xListener->MethodName( aMulti, aMulti2 ); \
-+ } \
-+ catch( ::com::sun::star::lang::DisposedException e ) \
-+ { \
-+ OSL_ENSURE( e.Context.is(), "caught DisposedException with empty Context field" ); \
-+ if ( e.Context == xListener || !e.Context.is() ) \
-+ aIt.remove(); \
-+ } \
-+ catch( ::com::sun::star::uno::RuntimeException e ) \
-+ { \
-+ DISPLAY_EXCEPTION( ClassName, MethodName, e ) \
-+ } \
-+ } \
-+}
-+
-+#define IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_1PARAM( ClassName, InterfaceName, MethodName, ParamType1 ) \
-+{ \
-+ ParamType1 aMulti( evt ); \
-+ ::cppu::OInterfaceIteratorHelper aIt( *this ); \
-+ while( aIt.hasMoreElements() ) \
-+ { \
-+ ::com::sun::star::uno::Reference< InterfaceName > xListener( \
-+ static_cast< InterfaceName* >( aIt.next() ) ); \
-+ try \
-+ { \
-+ xListener->MethodName( aMulti ); \
-+ } \
-+ catch( ::com::sun::star::lang::DisposedException e ) \
-+ { \
-+ OSL_ENSURE( e.Context.is(), "caught DisposedException with empty Context field" ); \
-+ if ( e.Context == xListener || !e.Context.is() ) \
-+ aIt.remove(); \
-+ } \
-+ catch( ::com::sun::star::uno::RuntimeException e ) \
-+ { \
-+ DISPLAY_EXCEPTION( ClassName, MethodName, e ) \
-+ } \
-+ } \
-+}
-+
- #define IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_BODY( ClassName, InterfaceName, MethodName, EventType ) \
- { \
- EventType aMulti( evt ); \
-diff --git toolkit/inc/toolkit/helper/property.hxx toolkit/inc/toolkit/helper/property.hxx
-index 3ca2fdd..4b13758 100644
---- toolkit/inc/toolkit/helper/property.hxx
-+++ toolkit/inc/toolkit/helper/property.hxx
-@@ -205,6 +205,8 @@ namespace rtl {
- #define BASEPROPERTY_MULTISELECTION_SIMPLEMODE 152
- #define BASEPROPERTY_ITEM_SEPARATOR_POS 153
- #define BASEPROPERTY_GROUPNAME 154 // ::rtl::OUString
-+#define BASEPROPERTY_MULTIPAGEVALUE 155 // sal_Int32
-+#define BASEPROPERTY_USERFORMCONTAINEES 156 // css::container::XNameContainer
-
-
- // Keine gebundenen Properties, werden immer aus der Property BASEPROPERTY_FONTDESCRIPTOR entnommen.
-diff --git toolkit/inc/toolkit/helper/servicenames.hxx toolkit/inc/toolkit/helper/servicenames.hxx
-index 4067cd0..fd41577 100644
---- toolkit/inc/toolkit/helper/servicenames.hxx
-+++ toolkit/inc/toolkit/helper/servicenames.hxx
-@@ -41,6 +41,12 @@ extern const sal_Char __FAR_DATA szServiceName_UnoControlContainer[], szServiceN
- extern const sal_Char __FAR_DATA szServiceName_UnoMultiPageControl[], szServiceName2_UnoMultiPageControl[];
- extern const sal_Char __FAR_DATA szServiceName_UnoMultiPageModel[], szServiceName2_UnoMultiPageModel[];
- extern const sal_Char __FAR_DATA szServiceName_UnoControlContainerModel[], szServiceName2_UnoControlContainerModel[];
-+extern const sal_Char __FAR_DATA szServiceName_UnoMultiPageControl[], szServiceName2_UnoMultiPageControl[];
-+extern const sal_Char __FAR_DATA szServiceName_UnoMultiPageModel[], szServiceName2_UnoMultiPageModel[];
-+extern const sal_Char __FAR_DATA szServiceName_UnoPageControl[], szServiceName2_UnoPageControl[];
-+extern const sal_Char __FAR_DATA szServiceName_UnoPageModel[], szServiceName2_UnoPageModel[];
-+extern const sal_Char __FAR_DATA szServiceName_UnoFrameControl[], szServiceName2_UnoFrameControl[];
-+extern const sal_Char __FAR_DATA szServiceName_UnoFrameModel[], szServiceName2_UnoFrameModel[];
- extern const sal_Char __FAR_DATA szServiceName_TabController[], szServiceName2_TabController[];
- extern const sal_Char __FAR_DATA szServiceName_TabControllerModel[], szServiceName2_TabControllerModel[];
- extern const sal_Char __FAR_DATA szServiceName_UnoControlDialog[], szServiceName2_UnoControlDialog[];
-diff --git toolkit/source/awt/vclxtabcontrol.cxx toolkit/source/awt/vclxtabcontrol.cxx
-index 4d9f63a..3f81839 100644
---- toolkit/source/awt/vclxtabcontrol.cxx
-+++ toolkit/source/awt/vclxtabcontrol.cxx
-@@ -26,7 +26,7 @@
- *
- ************************************************************************/
-
--#include "vclxtabcontrol.hxx"
-+#include <vclxtabcontrol.hxx>
-
- #include <com/sun/star/awt/PosSize.hpp>
- #include <sal/macros.h>
-diff --git toolkit/source/awt/vclxtabcontrol.hxx toolkit/source/awt/vclxtabcontrol.hxx
-index c4b9002..84c7859 100644
---- toolkit/source/awt/vclxtabcontrol.hxx
-+++ toolkit/source/awt/vclxtabcontrol.hxx
-@@ -123,6 +123,8 @@ public:
- ChildProps( VCLXTabControl::ChildData *pData );
- };
-
-+ inline TabControl *getTabControl() const throw (::com::sun::star::uno::RuntimeException);
-+
- protected:
- ChildData *createChild( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild );
- ChildProps *createChildProps( Box_Base::ChildData* pData );
-@@ -133,7 +135,6 @@ protected:
- std::list< ::com::sun::star::uno::Reference
- < ::com::sun::star::awt::XTabListener > > mxTabListeners;
-
-- inline TabControl *getTabControl() const throw (::com::sun::star::uno::RuntimeException);
-
- private:
- VCLXTabControl( const VCLXTabControl& ); // never implemented
-diff --git toolkit/source/awt/vclxtabpage.cxx toolkit/source/awt/vclxtabpage.cxx
-index 231eced..71499bb 100644
---- toolkit/source/awt/vclxtabpage.cxx
-+++ toolkit/source/awt/vclxtabpage.cxx
-@@ -26,7 +26,8 @@
- *
- ************************************************************************/
-
--#include "vclxtabpage.hxx"
-+#include <vclxtabpage.hxx>
-+
- #include "forward.hxx"
-
- #include <com/sun/star/awt/PosSize.hpp>
-diff --git toolkit/source/awt/vclxtoolkit.cxx toolkit/source/awt/vclxtoolkit.cxx
-index 7282020..b437574 100644
---- toolkit/source/awt/vclxtoolkit.cxx
-+++ toolkit/source/awt/vclxtoolkit.cxx
-@@ -116,6 +116,7 @@
-
- #include <tools/debug.hxx>
- #include <comphelper/processfactory.hxx>
-+#include "awt/vclxtabcontrol.hxx"
-
- namespace css = ::com::sun::star;
-
-@@ -283,6 +284,7 @@ static ComponentInfo __FAR_DATA aComponentInfos [] =
- { "floatingwindow", WINDOW_FLOATINGWINDOW },
- { "framewindow", VCLWINDOW_FRAMEWINDOW },
- { "groupbox", WINDOW_GROUPBOX },
-+ { "frame", WINDOW_GROUPBOX },
- { "helpbutton", WINDOW_HELPBUTTON },
- { "imagebutton", WINDOW_IMAGEBUTTON },
- { "imageradiobutton", WINDOW_IMAGERADIOBUTTON },
-@@ -623,7 +625,14 @@ Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
-
- Window* pNewWindow = NULL;
- sal_uInt16 nType = ImplGetComponentType( aServiceName );
--
-+ bool bFrameControl = false;
-+ if ( aServiceName == String( RTL_CONSTASCII_USTRINGPARAM("frame") ) )
-+ bFrameControl = true;
-+ if ( aServiceName == String( RTL_CONSTASCII_USTRINGPARAM("tabcontrolnotabs") ) )
-+ {
-+ nWinBits |= WB_NOBORDER;
-+ nType = ImplGetComponentType( String( RTL_CONSTASCII_USTRINGPARAM("tabcontrol") ) );
-+ }
- if ( !pParent )
- {
- // Wenn die Component einen Parent braucht, dann NULL zurueckgeben,
-@@ -720,7 +729,17 @@ Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
- pNewWindow = new FloatingWindow( pParent, nWinBits );
- break;
- case WINDOW_GROUPBOX:
-+ {
- pNewWindow = new GroupBox( pParent, nWinBits );
-+ if ( bFrameControl )
-+ {
-+ GroupBox* pGroupBox = static_cast< GroupBox* >( pNewWindow );
-+ *ppNewComp = new VCLXFrame;
-+ // Frame control needs to recieve
-+ // Mouse events
-+ pGroupBox->SetMouseTransparent( FALSE );
-+ }
-+ }
- break;
- case WINDOW_HELPBUTTON:
- pNewWindow = new HelpButton( pParent, nWinBits );
-@@ -860,6 +879,7 @@ Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
- break;
- case WINDOW_TABCONTROL:
- pNewWindow = new TabControl( pParent, nWinBits );
-+ *ppNewComp = new VCLXMultiPage;
- break;
- case WINDOW_TABDIALOG:
- pNewWindow = new TabDialog( pParent, nWinBits );
-diff --git toolkit/source/awt/vclxwindows.cxx toolkit/source/awt/vclxwindows.cxx
-index 9332a0b..f367f7d 100644
---- toolkit/source/awt/vclxwindows.cxx
-+++ toolkit/source/awt/vclxwindows.cxx
-@@ -2290,6 +2290,7 @@ void VCLXDialog::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
-
- VCLXDialog::VCLXDialog()
- {
-+ OSL_TRACE("XDialog created");
- }
-
- VCLXDialog::~VCLXDialog()
-@@ -2503,6 +2504,292 @@ throw(::com::sun::star::uno::RuntimeException)
- }
- }
-
-+
-+// ----------------------------------------------------
-+// class VCLXTabPage
-+// ----------------------------------------------------
-+VCLXMultiPage::VCLXMultiPage() : maTabListeners( *this ), mTabId( 1 )
-+{
-+ OSL_TRACE("VCLXMultiPage::VCLXMultiPage()" );
-+}
-+
-+void VCLXMultiPage::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
-+{
-+ PushPropertyIds( rIds,
-+ BASEPROPERTY_BACKGROUNDCOLOR,
-+ BASEPROPERTY_DEFAULTCONTROL,
-+ BASEPROPERTY_ENABLED,
-+ BASEPROPERTY_MULTIPAGEVALUE,
-+ BASEPROPERTY_ENABLEVISIBLE,
-+ BASEPROPERTY_FONTDESCRIPTOR,
-+ BASEPROPERTY_GRAPHIC,
-+ BASEPROPERTY_HELPTEXT,
-+ BASEPROPERTY_HELPURL,
-+ BASEPROPERTY_IMAGEALIGN,
-+ BASEPROPERTY_IMAGEPOSITION,
-+ BASEPROPERTY_IMAGEURL,
-+ BASEPROPERTY_PRINTABLE,
-+ BASEPROPERTY_TABSTOP,
-+ BASEPROPERTY_FOCUSONCLICK,
-+ 0);
-+ VCLXContainer::ImplGetPropertyIds( rIds );
-+}
-+
-+VCLXMultiPage::~VCLXMultiPage()
-+{
-+}
-+void SAL_CALL VCLXMultiPage::dispose() throw(::com::sun::star::uno::RuntimeException)
-+{
-+ SolarMutexGuard aGuard;
-+
-+ ::com::sun::star::lang::EventObject aObj;
-+ aObj.Source = (::cppu::OWeakObject*)this;
-+ maTabListeners.disposeAndClear( aObj );
-+ VCLXContainer::dispose();
-+}
-+::com::sun::star::uno::Any SAL_CALL VCLXMultiPage::queryInterface(const ::com::sun::star::uno::Type & rType )
-+throw(::com::sun::star::uno::RuntimeException)
-+{
-+ uno::Any aRet = ::cppu::queryInterface( rType, static_cast< awt::XSimpleTabController*>( this ) );
-+
-+ return ( aRet.hasValue() ? aRet : VCLXContainer::queryInterface( rType ) );
-+}
-+
-+// ::com::sun::star::lang::XTypeProvider
-+IMPL_XTYPEPROVIDER_START( VCLXMultiPage )
-+ VCLXContainer::getTypes()
-+IMPL_XTYPEPROVIDER_END
-+
-+// ::com::sun::star::awt::XView
-+void SAL_CALL VCLXMultiPage::draw( sal_Int32 nX, sal_Int32 nY )
-+throw(::com::sun::star::uno::RuntimeException)
-+{
-+ SolarMutexGuard aGuard;
-+ Window* pWindow = GetWindow();
-+
-+ if ( pWindow )
-+ {
-+ OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() );
-+ if ( !pDev )
-+ pDev = pWindow->GetParent();
-+
-+ Size aSize = pDev->PixelToLogic( pWindow->GetSizePixel() );
-+ Point aPos = pDev->PixelToLogic( Point( nX, nY ) );
-+
-+ pWindow->Draw( pDev, aPos, aSize, WINDOW_DRAW_NOCONTROLS );
-+ }
-+}
-+
-+// ::com::sun::star::awt::XDevice,
-+::com::sun::star::awt::DeviceInfo SAL_CALL VCLXMultiPage::getInfo()
-+throw(::com::sun::star::uno::RuntimeException)
-+{
-+ ::com::sun::star::awt::DeviceInfo aInfo = VCLXDevice::getInfo();
-+ return aInfo;
-+}
-+
-+uno::Any SAL_CALL VCLXMultiPage::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
-+{
-+ SolarMutexGuard aGuard;
-+ OSL_TRACE(" **** VCLXMultiPage::getProperty( %s )",
-+ rtl::OUStringToOString( PropertyName,
-+ RTL_TEXTENCODING_UTF8 ).getStr() );
-+ ::com::sun::star::uno::Any aProp;
-+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
-+ switch ( nPropType )
-+ {
-+
-+ case BASEPROPERTY_MULTIPAGEVALUE:
-+ {
-+ aProp <<= getActiveTabID();
-+ }
-+ break;
-+ default:
-+ aProp <<= VCLXContainer::getProperty( PropertyName );
-+ }
-+ return aProp;
-+}
-+
-+void SAL_CALL VCLXMultiPage::setProperty(
-+ const ::rtl::OUString& PropertyName,
-+ const ::com::sun::star::uno::Any& Value )
-+throw(::com::sun::star::uno::RuntimeException)
-+{
-+ SolarMutexGuard aGuard;
-+ OSL_TRACE(" **** VCLXMultiPage::setProperty( %s )", rtl::OUStringToOString( PropertyName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+
-+ TabControl* pTabControl = (TabControl*)GetWindow();
-+ if ( pTabControl )
-+ {
-+ sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
-+
-+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
-+ switch ( nPropType )
-+ {
-+ case BASEPROPERTY_MULTIPAGEVALUE:
-+ {
-+ OSL_TRACE("***MULTIPAGE VALUE");
-+ sal_Int32 nId(0);
-+ Value >>= nId;
-+ // when the multipage is created we attempt to set the activepage
-+ // but no pages created
-+ if ( nId && nId <= getWindows().getLength() )
-+ activateTab( nId );
-+ }
-+ case BASEPROPERTY_GRAPHIC:
-+ {
-+ Reference< XGraphic > xGraphic;
-+ if (( Value >>= xGraphic ) && xGraphic.is() )
-+ {
-+ Image aImage( xGraphic );
-+
-+ Wallpaper aWallpaper( aImage.GetBitmapEx());
-+ aWallpaper.SetStyle( WALLPAPER_SCALE );
-+ pTabControl->SetBackground( aWallpaper );
-+ }
-+ else if ( bVoid || !xGraphic.is() )
-+ {
-+ Color aColor = pTabControl->GetControlBackground().GetColor();
-+ if ( aColor == COL_AUTO )
-+ aColor = pTabControl->GetSettings().GetStyleSettings().GetDialogColor();
-+
-+ Wallpaper aWallpaper( aColor );
-+ pTabControl->SetBackground( aWallpaper );
-+ }
-+ }
-+ break;
-+
-+ default:
-+ {
-+ VCLXContainer::setProperty( PropertyName, Value );
-+ }
-+ }
-+ }
-+}
-+
-+TabControl *VCLXMultiPage::getTabControl() const throw (uno::RuntimeException)
-+{
-+ TabControl *pTabControl = dynamic_cast< TabControl* >( GetWindow() );
-+ if ( pTabControl )
-+ return pTabControl;
-+ throw uno::RuntimeException();
-+}
-+sal_Int32 SAL_CALL VCLXMultiPage::insertTab() throw (uno::RuntimeException)
-+{
-+ TabControl *pTabControl = getTabControl();
-+ TabPage* pTab = new TabPage( pTabControl );
-+ rtl::OUString title (RTL_CONSTASCII_USTRINGPARAM( "" ) );
-+ return static_cast< sal_Int32 >( insertTab( pTab, title ) );
-+}
-+
-+USHORT VCLXMultiPage::insertTab( TabPage* pPage, rtl::OUString& sTitle )
-+{
-+ TabControl *pTabControl = getTabControl();
-+ USHORT id = sal::static_int_cast< USHORT >( mTabId++ );
-+ pTabControl->InsertPage( id, sTitle.getStr(), TAB_APPEND );
-+ pTabControl->SetTabPage( id, pPage );
-+ return id;
-+}
-+
-+void SAL_CALL VCLXMultiPage::removeTab( sal_Int32 ID ) throw (uno::RuntimeException, lang::IndexOutOfBoundsException)
-+{
-+ TabControl *pTabControl = getTabControl();
-+ if ( pTabControl->GetTabPage( sal::static_int_cast< USHORT >( ID ) ) == NULL )
-+ throw lang::IndexOutOfBoundsException();
-+ pTabControl->RemovePage( sal::static_int_cast< USHORT >( ID ) );
-+}
-+
-+void SAL_CALL VCLXMultiPage::activateTab( sal_Int32 ID ) throw (uno::RuntimeException, lang::IndexOutOfBoundsException)
-+{
-+ TabControl *pTabControl = getTabControl();
-+ OSL_TRACE("Attempting to activate tab %d, active tab is %d, numtabs is %d", ID, getActiveTabID(), getWindows().getLength() );
-+ if ( pTabControl->GetTabPage( sal::static_int_cast< USHORT >( ID ) ) == NULL )
-+ throw lang::IndexOutOfBoundsException();
-+ pTabControl->SelectTabPage( sal::static_int_cast< USHORT >( ID ) );
-+}
-+
-+sal_Int32 SAL_CALL VCLXMultiPage::getActiveTabID() throw (uno::RuntimeException)
-+{
-+ return getTabControl()->GetCurPageId( );
-+}
-+
-+void SAL_CALL VCLXMultiPage::addTabListener( const uno::Reference< awt::XTabListener >& xListener ) throw (uno::RuntimeException)
-+{
-+ SolarMutexGuard aGuard;
-+ maTabListeners.addInterface( xListener );
-+}
-+
-+void SAL_CALL VCLXMultiPage::removeTabListener( const uno::Reference< awt::XTabListener >& xListener ) throw (uno::RuntimeException)
-+{
-+ SolarMutexGuard aGuard;
-+ maTabListeners.addInterface( xListener );
-+}
-+
-+void SAL_CALL VCLXMultiPage::setTabProps( sal_Int32 ID, const uno::Sequence< beans::NamedValue >& Properties ) throw (uno::RuntimeException, lang::IndexOutOfBoundsException)
-+{
-+ SolarMutexGuard aGuard;
-+ TabControl *pTabControl = getTabControl();
-+ if ( pTabControl->GetTabPage( sal::static_int_cast< USHORT >( ID ) ) == NULL )
-+ throw lang::IndexOutOfBoundsException();
-+
-+ for ( int i = 0; i < Properties.getLength(); i++ )
-+ {
-+ const rtl::OUString &name = Properties[i].Name;
-+ const uno::Any &value = Properties[i].Value;
-+
-+ if ( name == rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ) )
-+ {
-+ rtl::OUString title = value.get<rtl::OUString>();
-+ pTabControl->SetPageText( sal::static_int_cast< USHORT >( ID ), title.getStr() );
-+ }
-+ }
-+}
-+
-+uno::Sequence< beans::NamedValue > SAL_CALL VCLXMultiPage::getTabProps( sal_Int32 ID )
-+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
-+{
-+ SolarMutexGuard aGuard;
-+ TabControl *pTabControl = getTabControl();
-+ if ( pTabControl->GetTabPage( sal::static_int_cast< USHORT >( ID ) ) == NULL )
-+ throw lang::IndexOutOfBoundsException();
-+
-+#define ADD_PROP( seq, i, name, val ) { \
-+ beans::NamedValue value; \
-+ value.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( name ) ); \
-+ value.Value = uno::makeAny( val ); \
-+ seq[i] = value; \
-+ }
-+
-+ uno::Sequence< beans::NamedValue > props( 2 );
-+ ADD_PROP( props, 0, "Title", rtl::OUString( pTabControl->GetPageText( sal::static_int_cast< USHORT >( ID ) ) ) );
-+ ADD_PROP( props, 1, "Position", pTabControl->GetPagePos( sal::static_int_cast< USHORT >( ID ) ) );
-+#undef ADD_PROP
-+ return props;
-+}
-+void VCLXMultiPage::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
-+{
-+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
-+ switch ( rVclWindowEvent.GetId() )
-+ {
-+ case VCLEVENT_TABPAGE_DEACTIVATE:
-+ {
-+ ULONG nPageID = (ULONG)( rVclWindowEvent.GetData() );
-+ maTabListeners.deactivated( nPageID );
-+ break;
-+
-+ }
-+ case VCLEVENT_TABPAGE_ACTIVATE:
-+ {
-+ ULONG nPageID = (ULONG)( rVclWindowEvent.GetData() );
-+ maTabListeners.activated( nPageID );
-+ break;
-+ }
-+ default:
-+ VCLXContainer::ProcessWindowEvent( rVclWindowEvent );
-+ break;
-+ };
-+}
-+
- // ----------------------------------------------------
- // class VCLXTabPage
- // ----------------------------------------------------
-@@ -2510,6 +2797,27 @@ VCLXTabPage::VCLXTabPage()
- {
- }
-
-+void VCLXTabPage::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
-+{
-+ PushPropertyIds( rIds,
-+ BASEPROPERTY_BACKGROUNDCOLOR,
-+ BASEPROPERTY_DEFAULTCONTROL,
-+ BASEPROPERTY_ENABLED,
-+ BASEPROPERTY_ENABLEVISIBLE,
-+ BASEPROPERTY_FONTDESCRIPTOR,
-+ BASEPROPERTY_GRAPHIC,
-+ BASEPROPERTY_HELPTEXT,
-+ BASEPROPERTY_HELPURL,
-+ BASEPROPERTY_IMAGEALIGN,
-+ BASEPROPERTY_IMAGEPOSITION,
-+ BASEPROPERTY_IMAGEURL,
-+ BASEPROPERTY_PRINTABLE,
-+ BASEPROPERTY_TABSTOP,
-+ BASEPROPERTY_FOCUSONCLICK,
-+ 0);
-+ VCLXContainer::ImplGetPropertyIds( rIds );
-+}
-+
- VCLXTabPage::~VCLXTabPage()
- {
- }
-@@ -2599,6 +2907,14 @@ throw(::com::sun::star::uno::RuntimeException)
- }
- }
-
-+TabPage *VCLXTabPage::getTabPage() const throw (uno::RuntimeException)
-+{
-+ TabPage *pTabPage = dynamic_cast< TabPage* >( GetWindow() );
-+ if ( pTabPage )
-+ return pTabPage;
-+ throw uno::RuntimeException();
-+}
-+
- // ----------------------------------------------------
- // class VCLXFixedHyperlink
- // ----------------------------------------------------
-@@ -6272,5 +6588,99 @@ VCLXToolBox::~VCLXToolBox()
- {
- return getAccessibleFactory().createAccessibleContext( this );
- }
-+// ----------------------------------------------------
-+// class VCLXFrame
-+// ----------------------------------------------------
-+VCLXFrame::VCLXFrame()
-+{
-+}
-+
-+void VCLXFrame::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
-+{
-+ PushPropertyIds( rIds,
-+ BASEPROPERTY_BACKGROUNDCOLOR,
-+ BASEPROPERTY_DEFAULTCONTROL,
-+ BASEPROPERTY_ENABLED,
-+ BASEPROPERTY_ENABLEVISIBLE,
-+ BASEPROPERTY_FONTDESCRIPTOR,
-+ BASEPROPERTY_GRAPHIC,
-+ BASEPROPERTY_HELPTEXT,
-+ BASEPROPERTY_HELPURL,
-+ BASEPROPERTY_PRINTABLE,
-+ BASEPROPERTY_LABEL,
-+ 0);
-+ VCLXContainer::ImplGetPropertyIds( rIds );
-+}
-+
-+VCLXFrame::~VCLXFrame()
-+{
-+}
-+
-+::com::sun::star::uno::Any SAL_CALL VCLXFrame::queryInterface(const ::com::sun::star::uno::Type & rType )
-+throw(::com::sun::star::uno::RuntimeException)
-+{
-+ return VCLXContainer::queryInterface( rType );
-+}
-+
-+// ::com::sun::star::lang::XTypeProvider
-+IMPL_XTYPEPROVIDER_START( VCLXFrame )
-+ VCLXContainer::getTypes()
-+IMPL_XTYPEPROVIDER_END
-+
-+// ::com::sun::star::awt::XView
-+void SAL_CALL VCLXFrame::draw( sal_Int32 nX, sal_Int32 nY )
-+throw(::com::sun::star::uno::RuntimeException)
-+{
-+ SolarMutexGuard aGuard;
-+ Window* pWindow = GetWindow();
-+
-+ if ( pWindow )
-+ {
-+ OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() );
-+ if ( !pDev )
-+ pDev = pWindow->GetParent();
-+
-+ Size aSize = pDev->PixelToLogic( pWindow->GetSizePixel() );
-+ Point aPos = pDev->PixelToLogic( Point( nX, nY ) );
-+
-+ pWindow->Draw( pDev, aPos, aSize, WINDOW_DRAW_NOCONTROLS );
-+ }
-+}
-+
-+// ::com::sun::star::awt::XDevice,
-+::com::sun::star::awt::DeviceInfo SAL_CALL VCLXFrame::getInfo()
-+throw(::com::sun::star::uno::RuntimeException)
-+{
-+ ::com::sun::star::awt::DeviceInfo aInfo = VCLXDevice::getInfo();
-+ return aInfo;
-+}
-+
-+void SAL_CALL VCLXFrame::setProperty(
-+ const ::rtl::OUString& PropertyName,
-+ const ::com::sun::star::uno::Any& Value )
-+throw(::com::sun::star::uno::RuntimeException)
-+{
-+ SolarMutexGuard aGuard;
-+
-+#if OSL_DEBUG_LEVEL > 0
-+ sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
-+ (void)bVoid;
-+#endif
-+
-+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
-+ switch ( nPropType )
-+ {
-+ default:
-+ {
-+ VCLXContainer::setProperty( PropertyName, Value );
-+ }
-+ }
-+}
-+
-+void VCLXFrame::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
-+{
-+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
-+ VCLXContainer::ProcessWindowEvent( rVclWindowEvent );
-+}
-
- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
-diff --git toolkit/source/controls/dialogcontrol.cxx toolkit/source/controls/dialogcontrol.cxx
-index fa6d50a..7d72e8b 100644
---- toolkit/source/controls/dialogcontrol.cxx
-+++ toolkit/source/controls/dialogcontrol.cxx
-@@ -68,10 +68,16 @@
- #include "grid/gridcontrol.hxx"
-
- #include <map>
-+#include <hash_map>
- #include <algorithm>
- #include <functional>
- #include "tools/urlobj.hxx"
- #include "osl/file.hxx"
-+#include <com/sun/star/awt/XSimpleTabController.hpp>
-+#include <vcl/tabctrl.hxx>
-+#include <vcl/tabpage.hxx>
-+#include <vcl/button.hxx>
-+#include <toolkit/awt/vclxwindows.hxx>
-
- using namespace ::com::sun::star;
- using namespace ::com::sun::star::uno;
-@@ -91,8 +97,6 @@ using namespace toolkit;
- //HELPER
- ::rtl::OUString getPhysicalLocation( const ::com::sun::star::uno::Any& rbase, const ::com::sun::star::uno::Any& rUrl );
-
--uno::Reference< graphic::XGraphic > getGraphicFromURL_nothrow( uno::Reference< graphic::XGraphicObject >& rxGrfObj, const ::rtl::OUString& _rURL );
--
- struct LanguageDependentProp
- {
- const char* pPropName;
-@@ -262,14 +240,91 @@ static const ::rtl::OUString& getStepPropertyName( )
- return s_sStepProperty;
- }
-
-+// we probably will need both a hash of control models and hash of controls
-+// => use some template magic
-+
-+typedef ::cppu::WeakImplHelper1< container::XNameContainer > SimpleNameContainer_BASE;
-+
-+template< typename T >
-+class SimpleNamedThingContainer : public SimpleNameContainer_BASE
-+{
-+ typedef std::hash_map< rtl::OUString, Reference< T >, ::rtl::OUStringHash,
-+ ::std::equal_to< ::rtl::OUString > > NamedThingsHash;
-+ NamedThingsHash things;
-+ ::osl::Mutex m_aMutex;
-+public:
-+ // ::com::sun::star::container::XNameContainer, XNameReplace, XNameAccess
-+ virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const Any& aElement ) throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ if ( !hasByName( aName ) )
-+ throw NoSuchElementException();
-+ Reference< T > xElement;
-+ if ( ! ( aElement >>= xElement ) )
-+ throw IllegalArgumentException();
-+ things[ aName ] = xElement;
-+ }
-+ virtual Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ if ( !hasByName( aName ) )
-+ throw NoSuchElementException();
-+ return uno::makeAny( things[ aName ] );
-+ }
-+ virtual Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw(RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ Sequence< ::rtl::OUString > aResult( things.size() );
-+ typename NamedThingsHash::iterator it = things.begin();
-+ typename NamedThingsHash::iterator it_end = things.end();
-+ rtl::OUString* pName = aResult.getArray();
-+ for (; it != it_end; ++it, ++pName )
-+ *pName = it->first;
-+ return aResult;
-+ }
-+ virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ return ( things.find( aName ) != things.end() );
-+ }
-+ virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const Any& aElement ) throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ if ( hasByName( aName ) )
-+ throw ElementExistException();
-+ Reference< T > xElement;
-+ if ( ! ( aElement >>= xElement ) )
-+ throw IllegalArgumentException();
-+ things[ aName ] = xElement;
-+ }
-+ virtual void SAL_CALL removeByName( const ::rtl::OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ if ( !hasByName( aName ) )
-+ throw NoSuchElementException();
-+ things.erase( things.find( aName ) );
-+ }
-+ virtual Type SAL_CALL getElementType( ) throw (RuntimeException)
-+ {
-+ return T::static_type( NULL );
-+ }
-+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ return ( things.size() > 0 );
-+ }
-+};
-+
- // ----------------------------------------------------
- // class UnoControlDialogModel
- // ----------------------------------------------------
--UnoControlDialogModel::UnoControlDialogModel()
-+UnoControlDialogModel::UnoControlDialogModel( bool regProps )
- :maContainerListeners( *this )
- ,maChangeListeners ( GetMutex() )
- ,mbGroupsUpToDate( sal_False ), mbAdjustingGraphic( false )
- {
-+ if ( regProps )
-+ {
- ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
- // ImplRegisterProperty( BASEPROPERTY_BORDER );
- ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
-@@ -290,6 +345,9 @@ UnoControlDialogModel::UnoControlDialogModel()
- aBool <<= (sal_Bool) sal_True;
- ImplRegisterProperty( BASEPROPERTY_MOVEABLE, aBool );
- ImplRegisterProperty( BASEPROPERTY_CLOSEABLE, aBool );
-+ uno::Reference< XNameContainer > xNameCont = new SimpleNamedThingContainer< XControlModel >();
-+ ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES, uno::makeAny( xNameCont ) );
-+ }
- }
-
- UnoControlDialogModel::UnoControlDialogModel( const UnoControlDialogModel& rModel )
-@@ -297,7 +355,7 @@ UnoControlDialogModel::UnoControlDialogModel( const UnoControlDialogModel& rMode
- , UnoControlDialogModel_Base( rModel )
- , maContainerListeners( *this )
- , maChangeListeners ( GetMutex() )
-- , mbGroupsUpToDate( sal_False ), mbAdjustingGraphic( false )
-+ , mbGroupsUpToDate( sal_False ), mxGrfObj( rModel.mxGrfObj ), mbAdjustingGraphic( false )
- {
- }
-
-@@ -330,7 +388,8 @@ Sequence< Type > UnoControlDialogModel::getTypes() throw(RuntimeException)
-
- void SAL_CALL UnoControlDialogModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception)
- {
-- UnoControlModel::setFastPropertyValue_NoBroadcast( nHandle, rValue );
-+ UnoControlDialogModel_Base::setFastPropertyValue_NoBroadcast( nHandle, rValue );
-+
- try
- {
- switch ( nHandle )
-@@ -341,7 +400,7 @@ void SAL_CALL UnoControlDialogModel::setFastPropertyValue_NoBroadcast( sal_Int32
- mbAdjustingGraphic = true;
- ::rtl::OUString sImageURL;
- OSL_VERIFY( rValue >>= sImageURL );
-- setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( getGraphicFromURL_nothrow( mxGrfObj, sImageURL ) ) );
-+ setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( ImageHelper::getGraphicAndGraphicObjectFromURL_nothrow( mxGrfObj, sImageURL ) ) );
- mbAdjustingGraphic = false;
- }
- break;
-@@ -504,6 +563,10 @@ Reference< XInterface > UnoControlDialogModel::createInstance( const ::rtl::OUSt
- pNewModel = new OGeometryControlModel< UnoTreeModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName_GridControlModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoGridModel >;
-+ else if ( aServiceSpecifier.compareToAscii( szServiceName_UnoMultiPageModel ) == 0 )
-+ pNewModel = new OGeometryControlModel< UnoMultiPageModel >;
-+ else if ( aServiceSpecifier.compareToAscii( szServiceName_UnoFrameModel ) == 0 )
-+ pNewModel = new OGeometryControlModel< UnoFrameModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoSimpleAnimationControlModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoSimpleAnimationControlModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoThrobberControlModel ) == 0 )
-@@ -547,7 +610,7 @@ Sequence< ::rtl::OUString > UnoControlDialogModel::getAvailableServiceNames() th
- static Sequence< ::rtl::OUString >* pNamesSeq = NULL;
- if ( !pNamesSeq )
- {
-- pNamesSeq = new Sequence< ::rtl::OUString >( 24 );
-+ pNamesSeq = new Sequence< ::rtl::OUString >( 25 );
- ::rtl::OUString* pNames = pNamesSeq->getArray();
- pNames[0] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlEditModel );
- pNames[1] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFormattedFieldModel );
-@@ -570,9 +633,11 @@ Sequence< ::rtl::OUString > UnoControlDialogModel::getAvailableServiceNames() th
- pNames[18] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFixedLineModel );
- pNames[19] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlRoadmapModel );
- pNames[20] = ::rtl::OUString::createFromAscii( szServiceName_TreeControlModel );
-+
- pNames[21] = ::rtl::OUString::createFromAscii( szServiceName_GridControlModel );
- pNames[22] = ::rtl::OUString::createFromAscii( szServiceName2_UnoSimpleAnimationControlModel );
- pNames[23] = ::rtl::OUString::createFromAscii( szServiceName2_UnoThrobberControlModel );
-+ pNames[24] = ::rtl::OUString::createFromAscii( szServiceName_UnoMultiPageModel );
- }
- return *pNamesSeq;
- }
-@@ -595,6 +660,55 @@ Type UnoControlDialogModel::getElementType() throw(RuntimeException)
- return aType;
- }
-
-+void UnoControlDialogModel::updateUserFormChildren( const Reference< XNameContainer >& xAllChildren, const rtl::OUString& aName, ChildOperation Operation, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& xTarget ) throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
-+{
-+ if ( Operation < Insert || Operation > Remove )
-+ throw IllegalArgumentException();
-+
-+ if ( xAllChildren.is() )
-+ {
-+ if ( Operation == Remove )
-+ {
-+ Reference< XControlModel > xOldModel( xAllChildren->getByName( aName ), UNO_QUERY );
-+ xAllChildren->removeByName( aName );
-+
-+ Reference< XNameContainer > xChildContainer( xOldModel, UNO_QUERY );
-+ if ( xChildContainer.is() )
-+ {
-+ Reference< XPropertySet > xProps( xChildContainer, UNO_QUERY );
-+ // container control is being removed from this container, reset the
-+ // global list of containees
-+ if ( xProps.is() )
-+ xProps->setPropertyValue( GetPropertyName( BASEPROPERTY_USERFORMCONTAINEES ), uno::makeAny( uno::Reference< XNameContainer >() ) );
-+ Sequence< rtl::OUString > aChildNames = xChildContainer->getElementNames();
-+ for ( sal_Int32 index=0; index< aChildNames.getLength(); ++index )
-+ updateUserFormChildren( xAllChildren, aChildNames[ index ], Operation, Reference< XControlModel > () );
-+ }
-+ }
-+ else if ( Operation == Insert )
-+ {
-+ xAllChildren->insertByName( aName, uno::makeAny( xTarget ) );
-+ Reference< XNameContainer > xChildContainer( xTarget, UNO_QUERY );
-+ if ( xChildContainer.is() )
-+ {
-+ // container control is being added from this container, reset the
-+ // global list of containees to point to the correct global list
-+ Reference< XPropertySet > xProps( xChildContainer, UNO_QUERY );
-+ if ( xProps.is() )
-+ xProps->setPropertyValue( GetPropertyName( BASEPROPERTY_USERFORMCONTAINEES ), uno::makeAny( xAllChildren ) );
-+ Sequence< rtl::OUString > aChildNames = xChildContainer->getElementNames();
-+ for ( sal_Int32 index=0; index< aChildNames.getLength(); ++index )
-+ {
-+ Reference< XControlModel > xChildTarget( xChildContainer->getByName( aChildNames[ index ] ), UNO_QUERY );
-+ updateUserFormChildren( xAllChildren, aChildNames[ index ], Operation, xChildTarget );
-+ }
-+ }
-+ }
-+ }
-+ else
-+ throw IllegalArgumentException();
-+}
-+
- sal_Bool UnoControlDialogModel::hasElements() throw(RuntimeException)
- {
- return !maModels.empty();
-@@ -614,6 +728,20 @@ void UnoControlDialogModel::replaceByName( const ::rtl::OUString& aName, const A
- if ( maModels.end() == aElementPos )
- lcl_throwNoSuchElementException();
-
-+ // Dialog behaviour is to have all containee names unique ( MSO Userform is the same )
-+ // With container controls you could have constructed an existing hierachy and are now
-+ // add this to an existing container, in this case a name nested in the containment
-+ // hierachy of the added control could contain a name clash, if we have access to the
-+ // list of global names then recursively check for previously existing names ( we need
-+ // to do this obviously before the 'this' objects container is updated
-+ Reference< XNameContainer > xAllChildren( getPropertyValue( GetPropertyName( BASEPROPERTY_USERFORMCONTAINEES ) ), UNO_QUERY );
-+ if ( xAllChildren.is() )
-+ {
-+ // remove old control ( and children ) from global list of containees
-+ updateUserFormChildren( xAllChildren, aName, Remove, uno::Reference< XControlModel >() );
-+ // Add new control ( and containees if they exist )
-+ updateUserFormChildren( xAllChildren, aName, Insert, xNewModel );
-+ }
- // stop listening at the old model
- stopControlListening( aElementPos->first );
- Reference< XControlModel > xReplaced( aElementPos->first );
-@@ -621,6 +749,7 @@ void UnoControlDialogModel::replaceByName( const ::rtl::OUString& aName, const A
- aElementPos->first = xNewModel;
- startControlListening( xNewModel );
-
-+
- ContainerEvent aEvent;
- aEvent.Source = *this;
- aEvent.Element = aElement;
-@@ -681,7 +810,13 @@ void UnoControlDialogModel::insertByName( const ::rtl::OUString& aName, const An
- {
- Any aUrl = xProps.get()->getPropertyValue( sImageSourceProperty );
-
-- ::rtl::OUString absoluteUrl =
-+ ::rtl::OUString absoluteUrl;
-+ aUrl >>= absoluteUrl;
-+ if ( absoluteUrl.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) == 0 )
-+ xProps.get()->setPropertyValue( sImageSourceProperty , aUrl );
-+ // Now we inherit from this class, no all containers have
-+ // DialogSourceURL
-+ else if ( getPropertySetInfo()->hasPropertyByName( GetPropertyName( BASEPROPERTY_DIALOGSOURCEURL ) ) )
- getPhysicalLocation( getPropertyValue( GetPropertyName( BASEPROPERTY_DIALOGSOURCEURL ) ), aUrl );
-
- aUrl <<= absoluteUrl;
-@@ -697,10 +832,25 @@ void UnoControlDialogModel::insertByName( const ::rtl::OUString& aName, const An
- lcl_throwIllegalArgumentException();
-
- UnoControlModelHolderList::iterator aElementPos = ImplFindElement( aName );
-+
- if ( maModels.end() != aElementPos )
- lcl_throwElementExistException();
-
-+ // Dialog behaviour is to have all containee names unique ( MSO Userform is the same )
-+ // With container controls you could have constructed an existing hierachy and are now
-+ // add this to an existing container, in this case a name nested in the containment
-+ // hierachy of the added control could contain a name clash, if we have access to the
-+ // list of global names then we need to recursively check for previously existing
-+ // names ( we need to do this obviously before the 'this' objects container is updated
-+ // remove old control ( and children ) from global list of containees
-+ Reference< XNameContainer > xAllChildren( getPropertyValue( GetPropertyName( BASEPROPERTY_USERFORMCONTAINEES ) ), UNO_QUERY );
-+
-+ if ( xAllChildren.is() )
-+ updateUserFormChildren( xAllChildren, aName, Insert, xM );
-+
- maModels.push_back( UnoControlModelHolder( xM, aName ) );
-+
-+
- mbGroupsUpToDate = sal_False;
- startControlListening( xM );
-
-@@ -722,6 +872,15 @@ void UnoControlDialogModel::removeByName( const ::rtl::OUString& aName ) throw(N
- if ( maModels.end() == aElementPos )
- lcl_throwNoSuchElementException();
-
-+ // Dialog behaviour is to have all containee names unique ( MSO Userform is the same )
-+ // With container controls you could have constructed an existing hierachy and are now
-+ // removing this control from an existing container, in this case all nested names in
-+ // the containment hierachy of the control to be removed need to be removed from the global
-+ // names cache ( we need to do this obviously before the 'this' objects container is updated )
-+ Reference< XNameContainer > xAllChildren( getPropertyValue( GetPropertyName( BASEPROPERTY_USERFORMCONTAINEES ) ), UNO_QUERY );
-+ if ( xAllChildren.is() )
-+ updateUserFormChildren( xAllChildren, aName, Remove, uno::Reference< XControlModel >() );
-+
- ContainerEvent aEvent;
- aEvent.Source = *this;
- aEvent.Element <<= aElementPos->first;
-@@ -731,6 +890,7 @@ void UnoControlDialogModel::removeByName( const ::rtl::OUString& aName ) throw(N
- stopControlListening( aElementPos->first );
- Reference< XPropertySet > xPS( aElementPos->first, UNO_QUERY );
- maModels.erase( aElementPos );
-+
- mbGroupsUpToDate = sal_False;
-
- if ( xPS.is() )
-@@ -1389,67 +1549,624 @@ throw ( RuntimeException )
- }
- }
-
--// ============================================================================
--// = class UnoDialogControl
--// ============================================================================
-+static ::Size ImplMapPixelToAppFont( OutputDevice* pOutDev, const ::Size& aSize )
-+{
-+ ::Size aTmp = pOutDev->PixelToLogic( aSize, MAP_APPFONT );
-+ return aTmp;
-+}
-
--UnoDialogControl::UnoDialogControl() :
-- maTopWindowListeners( *this ),
-- mbWindowListener(false),
-- mbSizeModified(false),
-- mbPosModified(false)
-+// ----------------------------------------------------
-+// class MultiPageControl
-+// ----------------------------------------------------
-+UnoMultiPageControl::UnoMultiPageControl() : maTabListeners( *this )
- {
-- maComponentInfos.nWidth = 300;
-- maComponentInfos.nHeight = 450;
-- mxListener = new ResourceListener( Reference< util::XModifyListener >(
-- static_cast< OWeakObject* >( this ), UNO_QUERY ));
-+ maComponentInfos.nWidth = 280;
-+ maComponentInfos.nHeight = 400;
- }
-
--::rtl::OUString UnoDialogControl::GetComponentServiceName()
-+UnoMultiPageControl::~UnoMultiPageControl()
-+{
-+}
-+// XTabListener
-+
-+void SAL_CALL UnoMultiPageControl::inserted( ::sal_Int32 /*ID*/ ) throw (RuntimeException)
-+{
-+}
-+void SAL_CALL UnoMultiPageControl::removed( ::sal_Int32 /*ID*/ ) throw (RuntimeException)
-+{
-+}
-+void SAL_CALL UnoMultiPageControl::changed( ::sal_Int32 /*ID*/, const Sequence< NamedValue >& /*Properties*/ ) throw (RuntimeException)
-+{
-+}
-+void SAL_CALL UnoMultiPageControl::activated( ::sal_Int32 ID ) throw (RuntimeException)
- {
-+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_MULTIPAGEVALUE ), uno::makeAny( ID ), sal_False );
-
-+}
-+void SAL_CALL UnoMultiPageControl::deactivated( ::sal_Int32 /*ID*/ ) throw (RuntimeException)
-+{
-+}
-+void SAL_CALL UnoMultiPageControl::disposing(const EventObject&) throw (RuntimeException)
-+{
-+}
-+
-+void SAL_CALL UnoMultiPageControl::dispose() throw (RuntimeException)
-+{
-+ lang::EventObject aEvt;
-+ aEvt.Source = (::cppu::OWeakObject*)this;
-+ maTabListeners.disposeAndClear( aEvt );
-+ UnoDialogContainerControl::dispose();
-+}
-+
-+// com::sun::star::awt::XSimpleTabController
-+::sal_Int32 SAL_CALL UnoMultiPageControl::insertTab() throw (RuntimeException)
-+{
-+ Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
-+ if ( !xMultiPage.is() )
-+ throw RuntimeException();
-+ return xMultiPage->insertTab();
-+}
-+
-+void SAL_CALL UnoMultiPageControl::removeTab( ::sal_Int32 ID ) throw (IndexOutOfBoundsException, RuntimeException)
-+{
-+ Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
-+ if ( !xMultiPage.is() )
-+ throw RuntimeException();
-+ xMultiPage->removeTab( ID );
-+}
-+
-+void SAL_CALL UnoMultiPageControl::setTabProps( ::sal_Int32 ID, const Sequence< NamedValue >& Properties ) throw (IndexOutOfBoundsException, RuntimeException)
-+{
-+ Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
-+ if ( !xMultiPage.is() )
-+ throw RuntimeException();
-+ xMultiPage->setTabProps( ID, Properties );
-+}
-+
-+Sequence< NamedValue > SAL_CALL UnoMultiPageControl::getTabProps( ::sal_Int32 ID ) throw (IndexOutOfBoundsException, RuntimeException)
-+{
-+ Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
-+ if ( !xMultiPage.is() )
-+ throw RuntimeException();
-+ return xMultiPage->getTabProps( ID );
-+}
-+
-+void SAL_CALL UnoMultiPageControl::activateTab( ::sal_Int32 ID ) throw (IndexOutOfBoundsException, RuntimeException)
-+{
-+ Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
-+ if ( !xMultiPage.is() )
-+ throw RuntimeException();
-+ xMultiPage->activateTab( ID );
-+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_MULTIPAGEVALUE ), uno::makeAny( ID ), sal_True );
-+
-+}
-+
-+::sal_Int32 SAL_CALL UnoMultiPageControl::getActiveTabID() throw (RuntimeException)
-+{
-+ Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
-+ if ( !xMultiPage.is() )
-+ throw RuntimeException();
-+ return xMultiPage->getActiveTabID();
-+}
-+
-+void SAL_CALL UnoMultiPageControl::addTabListener( const Reference< XTabListener >& Listener ) throw (RuntimeException)
-+{
-+ maTabListeners.addInterface( Listener );
-+ Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
-+ if ( xMultiPage.is() && maTabListeners.getLength() == 1 )
-+ xMultiPage->addTabListener( &maTabListeners );
-+}
-+
-+void SAL_CALL UnoMultiPageControl::removeTabListener( const Reference< XTabListener >& Listener ) throw (RuntimeException)
-+{
-+ Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
-+ if ( xMultiPage.is() && maTabListeners.getLength() == 1 )
-+ xMultiPage->removeTabListener( &maTabListeners );
-+ maTabListeners.removeInterface( Listener );
-+}
-+
-+
-+// lang::XTypeProvider
-+IMPL_XTYPEPROVIDER_START( UnoMultiPageControl )
-+ getCppuType( ( uno::Reference< awt::XSimpleTabController>* ) NULL ),
-+ getCppuType( ( uno::Reference< awt::XTabListener>* ) NULL ),
-+ UnoDialogContainerControl::getTypes()
-+IMPL_XTYPEPROVIDER_END
-+
-+// uno::XInterface
-+uno::Any UnoMultiPageControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
-+{
-+ uno::Any aRet = ::cppu::queryInterface( rType,
-+ SAL_STATIC_CAST( awt::XTabListener*, this ), SAL_STATIC_CAST( awt::XSimpleTabController*, this ) );
-+ return (aRet.hasValue() ? aRet : UnoDialogContainerControl::queryAggregation( rType ));
-+}
-+
-+::rtl::OUString UnoMultiPageControl::GetComponentServiceName()
-+{
- sal_Bool bDecoration( sal_True );
- ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_DECORATION )) >>= bDecoration;
- if ( bDecoration )
-- return ::rtl::OUString::createFromAscii( "Dialog" );
-+ return ::rtl::OUString::createFromAscii( "tabcontrol" );
-+ // Hopefully we can tweak the tabcontrol to display without tabs
-+ return ::rtl::OUString::createFromAscii( "tabcontrolnotabs" );
-+}
-+
-+void UnoMultiPageControl::bindPage( const uno::Reference< awt::XControl >& _rxControl )
-+{
-+ uno::Reference< awt::XWindowPeer > xPage( _rxControl->getPeer() );
-+ uno::Reference< awt::XSimpleTabController > xTabCntrl( getPeer(), uno::UNO_QUERY );
-+ uno::Reference< beans::XPropertySet > xProps( _rxControl->getModel(), uno::UNO_QUERY );
-+
-+ VCLXTabPage* pXPage = dynamic_cast< VCLXTabPage* >( xPage.get() );
-+ TabPage* pPage = pXPage ? pXPage->getTabPage() : NULL;
-+ if ( xTabCntrl.is() && pPage )
-+ {
-+ VCLXMultiPage* pXTab = dynamic_cast< VCLXMultiPage* >( xTabCntrl.get() );
-+ if ( pXTab )
-+ {
-+ rtl::OUString sTitle;
-+ xProps->getPropertyValue( GetPropertyName( BASEPROPERTY_TITLE ) ) >>= sTitle;
-+ pXTab->insertTab( pPage, sTitle);
-+ }
-+ }
-+
-+}
-+
-+void UnoMultiPageControl::createPeer( const Reference< XToolkit > & rxToolkit, const Reference< XWindowPeer > & rParentPeer ) throw(RuntimeException)
-+{
-+ SolarMutexGuard aSolarGuard;
-+ UnoControlContainer::createPeer( rxToolkit, rParentPeer );
-+
-+ uno::Sequence< uno::Reference< awt::XControl > > aCtrls = getControls();
-+ sal_uInt32 nCtrls = aCtrls.getLength();
-+ for( sal_uInt32 n = 0; n < nCtrls; n++ )
-+ bindPage( aCtrls[ n ] );
-+ sal_Int32 nActiveTab(0);
-+ Reference< XPropertySet > xMultiProps( getModel(), UNO_QUERY );
-+ xMultiProps->getPropertyValue( GetPropertyName( BASEPROPERTY_MULTIPAGEVALUE ) ) >>= nActiveTab;
-+
-+ uno::Reference< awt::XSimpleTabController > xTabCntrl( getPeer(), uno::UNO_QUERY );
-+ if ( xTabCntrl.is() )
-+ {
-+ xTabCntrl->addTabListener( this );
-+ if ( nActiveTab && nCtrls ) // Ensure peer is initialise with correct activated tab
-+ {
-+ xTabCntrl->activateTab( nActiveTab );
-+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_MULTIPAGEVALUE ), uno::makeAny( nActiveTab ), sal_True );
-+ }
-+ }
-+}
-+
-+void UnoMultiPageControl::impl_createControlPeerIfNecessary( const uno::Reference< awt::XControl >& _rxControl)
-+{
-+ OSL_PRECOND( _rxControl.is(), "UnoMultiPageControl::impl_createControlPeerIfNecessary: invalid control, this will crash!" );
-+
-+ // if the container already has a peer, then also create a peer for the control
-+ uno::Reference< awt::XWindowPeer > xMyPeer( getPeer() );
-+
-+ if( xMyPeer.is() )
-+ {
-+ _rxControl->createPeer( NULL, xMyPeer );
-+ bindPage( _rxControl );
-+ ImplActivateTabControllers();
-+ }
-+
-+}
-+
-+// ------------- UnoMultiPageModel -----------------
-+
-+UnoMultiPageModel::UnoMultiPageModel() : UnoControlDialogModel( false )
-+{
-+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
-+ ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
-+ ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
-+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
-+
-+ ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
-+ ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
-+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
-+ ImplRegisterProperty( BASEPROPERTY_SIZEABLE );
-+ //ImplRegisterProperty( BASEPROPERTY_DIALOGSOURCEURL );
-+ ImplRegisterProperty( BASEPROPERTY_MULTIPAGEVALUE );
-+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
-+ ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES );
-+
-+ Any aBool;
-+ aBool <<= (sal_Bool) sal_True;
-+ ImplRegisterProperty( BASEPROPERTY_MOVEABLE, aBool );
-+ ImplRegisterProperty( BASEPROPERTY_CLOSEABLE, aBool );
-+ ImplRegisterProperty( BASEPROPERTY_DECORATION, aBool );
-+ // MultiPage Control has the tab stop property. And the default value is True.
-+ ImplRegisterProperty( BASEPROPERTY_TABSTOP, aBool );
-+}
-+
-+UnoMultiPageModel::UnoMultiPageModel( const UnoMultiPageModel& rModel )
-+ : UnoControlDialogModel( rModel )
-+{
-+}
-+
-+UnoMultiPageModel::~UnoMultiPageModel()
-+{
-+}
-+
-+UnoControlModel*
-+UnoMultiPageModel::Clone() const
-+{
-+ // clone the container itself
-+ UnoMultiPageModel* pClone = new UnoMultiPageModel( *this );
-+
-+ // clone all children
-+ ::std::for_each(
-+ maModels.begin(), maModels.end(),
-+ CloneControlModel( pClone->maModels )
-+ );
-+
-+ return pClone;
-+}
-+
-+::rtl::OUString UnoMultiPageModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
-+{
-+ return ::rtl::OUString::createFromAscii( szServiceName_UnoMultiPageModel );
-+}
-+
-+uno::Any UnoMultiPageModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-+{
-+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
-+ {
-+ uno::Any aAny;
-+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoMultiPageControl );
-+ return aAny;
-+ }
-+ return UnoControlDialogModel::ImplGetDefaultValue( nPropId );
-+}
-+
-+::cppu::IPropertyArrayHelper& UnoMultiPageModel::getInfoHelper()
-+{
-+ static UnoPropertyArrayHelper* pHelper = NULL;
-+ if ( !pHelper )
-+ {
-+ uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
-+ pHelper = new UnoPropertyArrayHelper( aIDs );
-+ }
-+ return *pHelper;
-+}
-+
-+// beans::XMultiPropertySet
-+uno::Reference< beans::XPropertySetInfo > UnoMultiPageModel::getPropertySetInfo( ) throw(uno::RuntimeException)
-+{
-+ static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
-+ return xInfo;
-+}
-+
-+void UnoMultiPageModel::insertByName( const ::rtl::OUString& aName, const Any& aElement ) throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
-+{
-+ Reference< XServiceInfo > xInfo;
-+ aElement >>= xInfo;
-+
-+ if ( !xInfo.is() )
-+ throw IllegalArgumentException();
-+
-+ // Only a Page model can be inserted into the multipage
-+ if ( !xInfo->supportsService( rtl::OUString::createFromAscii( szServiceName_UnoPageModel ) ) )
-+ throw IllegalArgumentException();
-+
-+ return UnoControlDialogModel::insertByName( aName, aElement );
-+}
-+
-+// ----------------------------------------------------------------------------
-+sal_Bool SAL_CALL UnoMultiPageModel::getGroupControl( ) throw (RuntimeException)
-+{
-+ return sal_True;
-+}
-+
-+// ----------------------------------------------------
-+// class UnoPageControl
-+// ----------------------------------------------------
-+UnoPageControl::UnoPageControl()
-+{
-+ maComponentInfos.nWidth = 280;
-+ maComponentInfos.nHeight = 400;
-+}
-+
-+UnoPageControl::~UnoPageControl()
-+{
-+}
-+
-+::rtl::OUString UnoPageControl::GetComponentServiceName()
-+{
-+ return ::rtl::OUString::createFromAscii( "tabpage" );
-+}
-+
-+
-+// ------------- UnoPageModel -----------------
-+
-+UnoPageModel::UnoPageModel() : UnoControlDialogModel( false )
-+{
-+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
-+ ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
-+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
-+ ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
-+
-+ ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
-+ ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
-+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
-+ ImplRegisterProperty( BASEPROPERTY_TITLE );
-+ ImplRegisterProperty( BASEPROPERTY_SIZEABLE );
-+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
-+ ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES );
-+// ImplRegisterProperty( BASEPROPERTY_DIALOGSOURCEURL );
-+
-+ Any aBool;
-+ aBool <<= (sal_Bool) sal_True;
-+ ImplRegisterProperty( BASEPROPERTY_MOVEABLE, aBool );
-+ ImplRegisterProperty( BASEPROPERTY_CLOSEABLE, aBool );
-+ //ImplRegisterProperty( BASEPROPERTY_TABSTOP, aBool );
-+}
-+
-+UnoPageModel::UnoPageModel( const UnoPageModel& rModel )
-+ : UnoControlDialogModel( rModel )
-+{
-+}
-+
-+UnoPageModel::~UnoPageModel()
-+{
-+}
-+
-+UnoControlModel*
-+UnoPageModel::Clone() const
-+{
-+ // clone the container itself
-+ UnoPageModel* pClone = new UnoPageModel( *this );
-+
-+ // clone all children
-+ ::std::for_each(
-+ maModels.begin(), maModels.end(),
-+ CloneControlModel( pClone->maModels )
-+ );
-+
-+ return pClone;
-+}
-+
-+::rtl::OUString UnoPageModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
-+{
-+ return ::rtl::OUString::createFromAscii( szServiceName_UnoPageModel );
-+}
-+
-+uno::Any UnoPageModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-+{
-+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
-+ {
-+ uno::Any aAny;
-+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoPageControl );
-+ return aAny;
-+ }
-+ return UnoControlDialogModel::ImplGetDefaultValue( nPropId );
-+}
-+
-+::cppu::IPropertyArrayHelper& UnoPageModel::getInfoHelper()
-+{
-+ static UnoPropertyArrayHelper* pHelper = NULL;
-+ if ( !pHelper )
-+ {
-+ uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
-+ pHelper = new UnoPropertyArrayHelper( aIDs );
-+ }
-+ return *pHelper;
-+}
-+
-+// beans::XMultiPropertySet
-+uno::Reference< beans::XPropertySetInfo > UnoPageModel::getPropertySetInfo( ) throw(uno::RuntimeException)
-+{
-+ static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
-+ return xInfo;
-+}
-+
-+// ----------------------------------------------------------------------------
-+sal_Bool SAL_CALL UnoPageModel::getGroupControl( ) throw (RuntimeException)
-+{
-+ return sal_False;
-+}
-+
-+// Frame control
-+
-+// ----------------------------------------------------
-+// class UnoFrameControl
-+// ----------------------------------------------------
-+UnoFrameControl::UnoFrameControl()
-+{
-+ maComponentInfos.nWidth = 280;
-+ maComponentInfos.nHeight = 400;
-+}
-+
-+UnoFrameControl::~UnoFrameControl()
-+{
-+}
-+
-+::rtl::OUString UnoFrameControl::GetComponentServiceName()
-+{
-+ return ::rtl::OUString::createFromAscii( "frame" );
-+}
-+
-+void UnoFrameControl::ImplSetPosSize( Reference< XControl >& rxCtrl )
-+{
-+ bool bOwnCtrl = false;
-+ rtl::OUString sTitle;
-+ if ( rxCtrl.get() == Reference<XControl>( this ).get() )
-+ bOwnCtrl = true;
-+ Reference< XPropertySet > xProps( getModel(), UNO_QUERY );
-+ //xProps->getPropertyValue( GetPropertyName( BASEPROPERTY_TITLE ) ) >>= sTitle;
-+ xProps->getPropertyValue( GetPropertyName( BASEPROPERTY_LABEL ) ) >>= sTitle;
-+
-+ UnoDialogContainerControl::ImplSetPosSize( rxCtrl );
-+ Reference < XWindow > xW( rxCtrl, UNO_QUERY );
-+ if ( !bOwnCtrl && xW.is() && sTitle.getLength() )
-+ {
-+ awt::Rectangle aSizePos = xW->getPosSize();
-+
-+ sal_Int32 nX = aSizePos.X, nY = aSizePos.Y, nWidth = aSizePos.Width, nHeight = aSizePos.Height;
-+ // Retrieve the values set by the base class
-+ OutputDevice*pOutDev = Application::GetDefaultDevice();
-+ if ( pOutDev )
-+ {
-+ if ( !bOwnCtrl && sTitle.getLength() )
-+ {
-+ // Adjust Y based on height of Title
-+ ::Rectangle aRect = pOutDev->GetTextRect( aRect, sTitle );
-+ nY = nY + ( aRect.GetHeight() / 2 );
-+ }
-+ }
- else
-- return ::rtl::OUString::createFromAscii( "TabPage" );
-+ {
-+ Reference< XWindowPeer > xPeer = ImplGetCompatiblePeer( sal_True );
-+ Reference< XDevice > xD( xPeer, UNO_QUERY );
-+
-+ SimpleFontMetric aFM;
-+ FontDescriptor aFD;
-+ Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_FONTDESCRIPTOR ) );
-+ aVal >>= aFD;
-+ if ( aFD.StyleName.getLength() )
-+ {
-+ Reference< XFont > xFont = xD->getFont( aFD );
-+ aFM = xFont->getFontMetric();
-+ }
-+ else
-+ {
-+ Reference< XGraphics > xG = xD->createGraphics();
-+ aFM = xG->getFontMetric();
-+ }
-+
-+ sal_Int16 nH = aFM.Ascent + aFM.Descent;
-+ if ( !bOwnCtrl && sTitle.getLength() )
-+ // offset y based on height of font ( not sure if my guess at the correct calculation is correct here )
-+ nY = nY + ( nH / 8); // how do I test this
-+ }
-+ xW->setPosSize( nX, nY, nWidth, nHeight, PosSize::POSSIZE );
-+ }
-+}
-+
-+// ------------- UnoFrameModel -----------------
-+
-+UnoFrameModel::UnoFrameModel() : UnoControlDialogModel( false )
-+{
-+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
-+ ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
-+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
-+ ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
-+ ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
-+ ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
-+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
-+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
-+ ImplRegisterProperty( BASEPROPERTY_LABEL );
-+ ImplRegisterProperty( BASEPROPERTY_WRITING_MODE );
-+ ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE );
-+ ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES );
-+}
-+
-+UnoFrameModel::UnoFrameModel( const UnoFrameModel& rModel )
-+ : UnoControlDialogModel( rModel )
-+{
-+}
-+
-+UnoFrameModel::~UnoFrameModel()
-+{
-+}
-+
-+UnoControlModel*
-+UnoFrameModel::Clone() const
-+{
-+ // clone the container itself
-+ UnoFrameModel* pClone = new UnoFrameModel( *this );
-+
-+ // clone all children
-+ ::std::for_each(
-+ maModels.begin(), maModels.end(),
-+ CloneControlModel( pClone->maModels )
-+ );
-+
-+ return pClone;
-+}
-+
-+::rtl::OUString UnoFrameModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
-+{
-+ return ::rtl::OUString::createFromAscii( szServiceName_UnoFrameModel );
-+}
-+
-+uno::Any UnoFrameModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-+{
-+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
-+ {
-+ uno::Any aAny;
-+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoFrameControl );
-+ return aAny;
-+ }
-+ return UnoControlDialogModel::ImplGetDefaultValue( nPropId );
-+}
-+
-+::cppu::IPropertyArrayHelper& UnoFrameModel::getInfoHelper()
-+{
-+ static UnoPropertyArrayHelper* pHelper = NULL;
-+ if ( !pHelper )
-+ {
-+ uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
-+ pHelper = new UnoPropertyArrayHelper( aIDs );
-+ }
-+ return *pHelper;
-+}
-+
-+// beans::XMultiPropertySet
-+uno::Reference< beans::XPropertySetInfo > UnoFrameModel::getPropertySetInfo( ) throw(uno::RuntimeException)
-+{
-+ static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
-+ return xInfo;
-+}
-+
-+
-+//===============================================================
-+// ----------------------------------------------------
-+// class DialogContainerControl
-+// ----------------------------------------------------
-+UnoDialogContainerControl::UnoDialogContainerControl() :
-+ mbSizeModified(false),
-+ mbPosModified(false)
-+{
-+ maComponentInfos.nWidth = 280;
-+ maComponentInfos.nHeight = 400;
-+}
-+
-+UnoDialogContainerControl::~UnoDialogContainerControl()
-+{
- }
-
- // XInterface
--Any UnoDialogControl::queryAggregation( const Type & rType ) throw(RuntimeException)
-+Any UnoDialogContainerControl::queryAggregation( const Type & rType ) throw(RuntimeException)
- {
-- Any aRet( UnoDialogControl_IBase::queryInterface( rType ) );
-+ Any aRet( UnoDialogContainerControl_IBase::queryInterface( rType ) );
- return (aRet.hasValue() ? aRet : UnoControlContainer::queryAggregation( rType ));
- }
-
- // XTypeProvider
--IMPL_IMPLEMENTATION_ID( UnoDialogControl )
--Sequence< Type > UnoDialogControl::getTypes() throw(RuntimeException)
-+IMPL_IMPLEMENTATION_ID( UnoDialogContainerControl )
-+Sequence< Type >
-+UnoDialogContainerControl::getTypes() throw(RuntimeException)
- {
- return ::comphelper::concatSequences(
-- UnoDialogControl_IBase::getTypes(),
-+ UnoDialogContainerControl_IBase::getTypes(),
- UnoControlContainer::getTypes()
- );
- }
-
--void UnoDialogControl::ImplInsertControl( Reference< XControlModel >& rxModel, const ::rtl::OUString& rName )
-+void UnoDialogContainerControl::createPeer( const Reference< XToolkit > & rxToolkit, const Reference< XWindowPeer > & rParentPeer ) throw(RuntimeException)
-+{
-+ SolarMutexGuard aSolarGuard;
-+ UnoControlContainer::createPeer( rxToolkit, rParentPeer );
-+}
-+
-+void UnoDialogContainerControl::ImplInsertControl( Reference< XControlModel >& rxModel, const ::rtl::OUString& rName )
- {
- Reference< XPropertySet > xP( rxModel, UNO_QUERY );
-
- ::rtl::OUString aDefCtrl;
- xP->getPropertyValue( GetPropertyName( BASEPROPERTY_DEFAULTCONTROL ) ) >>= aDefCtrl;
--
-- // Add our own resource resolver to a newly created control
-- Reference< resource::XStringResourceResolver > xStringResourceResolver;
-- rtl::OUString aPropName( PROPERTY_RESOURCERESOLVER );
--
-- Any aAny;
-- ImplGetPropertyValue( aPropName ) >>= xStringResourceResolver;
--
-- aAny <<= xStringResourceResolver;
-- xP->setPropertyValue( aPropName, aAny );
--
- Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
- Reference < XControl > xCtrl( xMSF->createInstance( aDefCtrl ), UNO_QUERY );
-
-@@ -1466,7 +2183,7 @@ void UnoDialogControl::ImplInsertControl( Reference< XControlModel >& rxModel, c
- }
- }
-
--void UnoDialogControl::ImplRemoveControl( Reference< XControlModel >& rxModel )
-+void UnoDialogContainerControl::ImplRemoveControl( Reference< XControlModel >& rxModel )
- {
- Sequence< Reference< XControl > > aControls = getControls();
- Reference< XControl > xCtrl = StdTabController::FindControl( aControls, rxModel );
-@@ -1474,7 +2191,7 @@ void UnoDialogControl::ImplRemoveControl( Reference< XControlModel >& rxModel )
- removeControl( xCtrl );
- }
-
--void UnoDialogControl::ImplSetPosSize( Reference< XControl >& rxCtrl )
-+void UnoDialogContainerControl::ImplSetPosSize( Reference< XControl >& rxCtrl )
- {
- Reference< XPropertySet > xP( rxCtrl->getModel(), UNO_QUERY );
-
-@@ -1534,53 +2251,19 @@ void UnoDialogControl::ImplSetPosSize( Reference< XControl >& rxCtrl )
- xW->setPosSize( nX, nY, nWidth, nHeight, PosSize::POSSIZE );
- }
-
--void UnoDialogControl::dispose() throw(RuntimeException)
-+void UnoDialogContainerControl::dispose() throw(RuntimeException)
- {
-- SolarMutexGuard aSolarGuard;
--
-- EventObject aEvt;
-- aEvt.Source = static_cast< ::cppu::OWeakObject* >( this );
-- maTopWindowListeners.disposeAndClear( aEvt );
--
-- // Notify our listener helper about dispose
-- // --- SAFE ---
-- ::osl::ResettableGuard< ::osl::Mutex > aGuard( GetMutex() );
-- Reference< XEventListener > xListener( mxListener, UNO_QUERY );
-- mxListener.clear();
-- aGuard.clear();
-- // --- SAFE ---
--
-- if ( xListener.is() )
-- xListener->disposing( aEvt );
--
- UnoControlContainer::dispose();
- }
-
--void SAL_CALL UnoDialogControl::disposing(
-+void SAL_CALL UnoDialogContainerControl::disposing(
- const EventObject& Source )
- throw(RuntimeException)
- {
-- rtl::OUString aPropName( PROPERTY_RESOURCERESOLVER );
-- Reference< resource::XStringResourceResolver > xStringResourceResolver;
--
-- ImplGetPropertyValue( aPropName ) >>= xStringResourceResolver;
-- Reference< XInterface > xIfac( xStringResourceResolver, UNO_QUERY );
--
-- if ( Source.Source == xIfac )
-- {
-- Any aAny;
--
-- // Reset resource resolver reference
-- ImplSetPropertyValue( aPropName, aAny, sal_True );
-- ImplUpdateResourceResolver();
-- }
-- else
-- {
- UnoControlContainer::disposing( Source );
- }
--}
-
--sal_Bool UnoDialogControl::setModel( const Reference< XControlModel >& rxModel ) throw(RuntimeException)
-+sal_Bool UnoDialogContainerControl::setModel( const Reference< XControlModel >& rxModel ) throw(RuntimeException)
- {
- SolarMutexGuard aSolarGuard;
-
-@@ -1649,12 +2332,11 @@ sal_Bool UnoDialogControl::setModel( const Reference< XControlModel >& rxModel )
- mxTabController->setModel( xTabbing );
- addTabController( mxTabController );
- }
-- ImplStartListingForResourceEvents();
-+// ImplStartListingForResourceEvents();
-
- return bRet;
- }
--
--void UnoDialogControl::setDesignMode( sal_Bool bOn ) throw(RuntimeException)
-+void UnoDialogContainerControl::setDesignMode( sal_Bool bOn ) throw(RuntimeException)
- {
- SolarMutexGuard aSolarGuard;
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-@@ -1674,6 +2356,251 @@ void UnoDialogControl::setDesignMode( sal_Bool bOn ) throw(RuntimeException)
- mxTabController->activateTabOrder();
- }
-
-+void UnoDialogContainerControl::elementInserted( const ContainerEvent& Event ) throw(RuntimeException)
-+{
-+ SolarMutexGuard aSolarGuard;
-+
-+ Reference< XControlModel > xModel;
-+ ::rtl::OUString aName;
-+
-+ Event.Accessor >>= aName;
-+ Event.Element >>= xModel;
-+ ImplInsertControl( xModel, aName );
-+}
-+
-+void UnoDialogContainerControl::elementRemoved( const ContainerEvent& Event ) throw(RuntimeException)
-+{
-+ SolarMutexGuard aSolarGuard;
-+
-+ Reference< XControlModel > xModel;
-+ Event.Element >>= xModel;
-+ if ( xModel.is() )
-+ ImplRemoveControl( xModel );
-+}
-+
-+void UnoDialogContainerControl::elementReplaced( const ContainerEvent& Event ) throw(RuntimeException)
-+{
-+ SolarMutexGuard aSolarGuard;
-+
-+ Reference< XControlModel > xModel;
-+ Event.ReplacedElement >>= xModel;
-+ if ( xModel.is() )
-+ ImplRemoveControl( xModel );
-+
-+ ::rtl::OUString aName;
-+ Event.Accessor >>= aName;
-+ Event.Element >>= xModel;
-+ ImplInsertControl( xModel, aName );
-+}
-+
-+// XPropertiesChangeListener
-+void UnoDialogContainerControl::ImplModelPropertiesChanged( const Sequence< PropertyChangeEvent >& rEvents ) throw(RuntimeException)
-+{
-+ if( !isDesignMode() && !mbCreatingCompatiblePeer )
-+ {
-+ ::rtl::OUString s1( RTL_CONSTASCII_USTRINGPARAM( "PositionX" ) );
-+ ::rtl::OUString s2( RTL_CONSTASCII_USTRINGPARAM( "PositionY" ) );
-+ ::rtl::OUString s3( RTL_CONSTASCII_USTRINGPARAM( "Width" ) );
-+ ::rtl::OUString s4( RTL_CONSTASCII_USTRINGPARAM( "Height" ) );
-+
-+ sal_Int32 nLen = rEvents.getLength();
-+ for( sal_Int32 i = 0; i < nLen; i++ )
-+ {
-+ const PropertyChangeEvent& rEvt = rEvents.getConstArray()[i];
-+ Reference< XControlModel > xModel( rEvt.Source, UNO_QUERY );
-+ sal_Bool bOwnModel = (XControlModel*)xModel.get() == (XControlModel*)getModel().get();
-+ if ( ( rEvt.PropertyName == s1 ) ||
-+ ( rEvt.PropertyName == s2 ) ||
-+ ( rEvt.PropertyName == s3 ) ||
-+ ( rEvt.PropertyName == s4 ) )
-+ {
-+ if ( bOwnModel )
-+ {
-+ if ( !mbPosModified && !mbSizeModified )
-+ {
-+ // Don't set new pos/size if we get new values from window listener
-+ Reference< XControl > xThis( (XAggregation*)(::cppu::OWeakAggObject*)this, UNO_QUERY );
-+ ImplSetPosSize( xThis );
-+ }
-+ }
-+ else
-+ {
-+ Sequence<Reference<XControl> > aControlSequence(getControls());
-+ Reference<XControl> aControlRef( StdTabController::FindControl( aControlSequence, xModel ) );
-+ ImplSetPosSize( aControlRef );
-+ }
-+ break;
-+ }
-+ }
-+ }
-+ UnoControlContainer::ImplModelPropertiesChanged( rEvents );
-+}
-+
-+void UnoDialogContainerControl::addingControl( const Reference< XControl >& _rxControl )
-+{
-+ SolarMutexGuard aSolarGuard;
-+ UnoControlContainer::addingControl( _rxControl );
-+
-+ if ( _rxControl.is() )
-+ {
-+ Reference< XMultiPropertySet > xProps( _rxControl->getModel(), UNO_QUERY );
-+ if ( xProps.is() )
-+ {
-+ Sequence< ::rtl::OUString > aNames( 4 );
-+ ::rtl::OUString* pNames = aNames.getArray();
-+ *pNames++ = ::rtl::OUString::createFromAscii( "PositionX" );
-+ *pNames++ = ::rtl::OUString::createFromAscii( "PositionY" );
-+ *pNames++ = ::rtl::OUString::createFromAscii( "Width" );
-+ *pNames++ = ::rtl::OUString::createFromAscii( "Height" );
-+
-+ xProps->addPropertiesChangeListener( aNames, this );
-+ }
-+ }
-+}
-+
-+void UnoDialogContainerControl::removingControl( const Reference< XControl >& _rxControl )
-+{
-+ SolarMutexGuard aSolarGuard;
-+ UnoControlContainer::removingControl( _rxControl );
-+
-+ if ( _rxControl.is() )
-+ {
-+ Reference< XMultiPropertySet > xProps( _rxControl->getModel(), UNO_QUERY );
-+ if ( xProps.is() )
-+ xProps->removePropertiesChangeListener( this );
-+ }
-+
-+}
-+
-+void SAL_CALL UnoDialogContainerControl::changesOccurred( const ChangesEvent& ) throw (RuntimeException)
-+{
-+ SolarMutexGuard aSolarGuard;
-+ // a tab controller model may have changed
-+
-+ // #109067# in design mode don't notify the tab controller
-+ // about tab index changes
-+ if ( mxTabController.is() && !mbDesignMode )
-+ mxTabController->activateTabOrder();
-+}
-+
-+// ============================================================================
-+// = class UnoDialogControl
-+// ============================================================================
-+
-+UnoDialogControl::UnoDialogControl() :
-+ maTopWindowListeners( *this ),
-+ mbWindowListener(false)
-+{
-+ maComponentInfos.nWidth = 300;
-+ maComponentInfos.nHeight = 450;
-+ mxListener = new ResourceListener( Reference< util::XModifyListener >(
-+ static_cast< OWeakObject* >( this ), UNO_QUERY ));
-+}
-+
-+UnoDialogControl::~UnoDialogControl()
-+{
-+}
-+
-+::rtl::OUString UnoDialogControl::GetComponentServiceName()
-+{
-+
-+ sal_Bool bDecoration( sal_True );
-+ ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_DECORATION )) >>= bDecoration;
-+ if ( bDecoration )
-+ return ::rtl::OUString::createFromAscii( "Dialog" );
-+ else
-+ return ::rtl::OUString::createFromAscii( "TabPage" );
-+}
-+
-+// XInterface
-+Any UnoDialogControl::queryAggregation( const Type & rType ) throw(RuntimeException)
-+{
-+ uno::Any aRet = ::cppu::queryInterface( rType, SAL_STATIC_CAST( awt::XTopWindow*, this ) );
-+ if ( !aRet.hasValue() )
-+ aRet = ::cppu::queryInterface( rType, SAL_STATIC_CAST( awt::XDialog*, this ) );
-+ if ( !aRet.hasValue() )
-+ aRet = ::cppu::queryInterface( rType, SAL_STATIC_CAST( awt::XWindowListener*, this ) );
-+ return (aRet.hasValue() ? aRet : UnoDialogContainerControl::queryAggregation( rType ));
-+}
-+//lang::XTypeProvider
-+IMPL_XTYPEPROVIDER_START( UnoDialogControl)
-+ getCppuType( ( uno::Reference< awt::XTopWindow>* ) NULL ),
-+ getCppuType( ( uno::Reference< awt::XDialog>* ) NULL ),
-+ getCppuType( ( uno::Reference< awt::XWindowListener>* ) NULL ),
-+ UnoDialogContainerControl::getTypes()
-+IMPL_XTYPEPROVIDER_END
-+
-+void UnoDialogControl::ImplInsertControl( Reference< XControlModel >& rxModel, const ::rtl::OUString& rName )
-+{
-+ // maybe this should be in the UnoDialogContainerControl, lets see
-+ Reference< XPropertySet > xP( rxModel, UNO_QUERY );
-+
-+ // Add our own resource resolver to a newly created control
-+ Reference< resource::XStringResourceResolver > xStringResourceResolver;
-+ rtl::OUString aPropName( PROPERTY_RESOURCERESOLVER );
-+
-+ Any aAny;
-+ ImplGetPropertyValue( aPropName ) >>= xStringResourceResolver;
-+
-+ aAny <<= xStringResourceResolver;
-+ xP->setPropertyValue( aPropName, aAny );
-+ UnoDialogContainerControl::ImplInsertControl( rxModel, rName );
-+}
-+
-+void UnoDialogControl::dispose() throw(RuntimeException)
-+{
-+ SolarMutexGuard aSolarGuard;
-+
-+ EventObject aEvt;
-+ aEvt.Source = static_cast< ::cppu::OWeakObject* >( this );
-+ maTopWindowListeners.disposeAndClear( aEvt );
-+ // Notify our listener helper about dispose
-+ // --- SAFE ---
-+ ::osl::ResettableGuard< ::osl::Mutex > aGuard( GetMutex() );
-+ Reference< XEventListener > xListener( mxListener, UNO_QUERY );
-+ mxListener.clear();
-+ aGuard.clear();
-+ // --- SAFE ---
-+
-+ if ( xListener.is() )
-+ xListener->disposing( aEvt );
-+ UnoDialogContainerControl::dispose();
-+}
-+
-+void SAL_CALL UnoDialogControl::disposing(
-+ const EventObject& Source )
-+throw(RuntimeException)
-+{
-+ // #FIXME see what can be moved to UnoDialogControlContainer
-+ rtl::OUString aPropName( PROPERTY_RESOURCERESOLVER );
-+ Reference< resource::XStringResourceResolver > xStringResourceResolver;
-+
-+ ImplGetPropertyValue( aPropName ) >>= xStringResourceResolver;
-+ Reference< XInterface > xIfac( xStringResourceResolver, UNO_QUERY );
-+
-+ if ( Source.Source == xIfac )
-+ {
-+ Any aAny;
-+
-+ // Reset resource resolver reference
-+ ImplSetPropertyValue( aPropName, aAny, sal_True );
-+ ImplUpdateResourceResolver();
-+ }
-+ else
-+ {
-+ UnoDialogContainerControl::disposing( Source );
-+ }
-+}
-+
-+sal_Bool UnoDialogControl::setModel( const Reference< XControlModel >& rxModel ) throw(RuntimeException)
-+{
-+ // #Can we move all the Resource stuff to the UnoDialogContainerControl ?
-+ SolarMutexGuard aSolarGuard;
-+ sal_Bool bRet = UnoDialogContainerControl::setModel( rxModel );
-+ ImplStartListingForResourceEvents();
-+ return bRet;
-+}
-+
- void UnoDialogControl::createPeer( const Reference< XToolkit > & rxToolkit, const Reference< XWindowPeer > & rParentPeer ) throw(RuntimeException)
- {
- SolarMutexGuard aSolarGuard;
-@@ -1713,53 +2640,21 @@ void UnoDialogControl::PrepareWindowDescriptor( ::com::sun::star::awt::WindowDes
- // can lead to overwrites we have to set the graphic property
- // before the propertiesChangeEvents are sent!
- ::rtl::OUString aImageURL;
-+ Reference< graphic::XGraphic > xGraphic;
- if (( ImplGetPropertyValue( PROPERTY_IMAGEURL ) >>= aImageURL ) &&
- ( aImageURL.getLength() > 0 ))
- {
-- aImageURL =
-- getPhysicalLocation( ImplGetPropertyValue( PROPERTY_DIALOGSOURCEURL ),
-- ImplGetPropertyValue( PROPERTY_IMAGEURL ));
--
-- }
-+ ::rtl::OUString absoluteUrl = aImageURL;
- if ( aImageURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) != 0 )
-- ImplSetPropertyValue( PROPERTY_IMAGEURL, uno::makeAny( aImageURL ), sal_True );
--}
--
--void UnoDialogControl::elementInserted( const ContainerEvent& Event ) throw(RuntimeException)
- {
-- SolarMutexGuard aSolarGuard;
--
-- Reference< XControlModel > xModel;
-- ::rtl::OUString aName;
--
-- Event.Accessor >>= aName;
-- Event.Element >>= xModel;
-- ImplInsertControl( xModel, aName );
-+ absoluteUrl = getPhysicalLocation( ImplGetPropertyValue( PROPERTY_DIALOGSOURCEURL ),
-+ ImplGetPropertyValue( PROPERTY_IMAGEURL ));
- }
-+ // npower, not understanding the comment above, but it surely setting the URL is just as
-+ // effective ( and prevents ambiguity with embedded images )
-+ ImplSetPropertyValue( PROPERTY_IMAGEURL, uno::makeAny( absoluteUrl ), sal_True );
-
--void UnoDialogControl::elementRemoved( const ContainerEvent& Event ) throw(RuntimeException)
--{
-- SolarMutexGuard aSolarGuard;
--
-- Reference< XControlModel > xModel;
-- Event.Element >>= xModel;
-- if ( xModel.is() )
-- ImplRemoveControl( xModel );
- }
--
--void UnoDialogControl::elementReplaced( const ContainerEvent& Event ) throw(RuntimeException)
--{
-- SolarMutexGuard aSolarGuard;
--
-- Reference< XControlModel > xModel;
-- Event.ReplacedElement >>= xModel;
-- if ( xModel.is() )
-- ImplRemoveControl( xModel );
--
-- ::rtl::OUString aName;
-- Event.Accessor >>= aName;
-- Event.Element >>= xModel;
-- ImplInsertControl( xModel, aName );
- }
-
- void UnoDialogControl::addTopWindowListener( const Reference< XTopWindowListener >& rxListener ) throw (RuntimeException)
-@@ -1816,12 +2711,6 @@ void UnoDialogControl::setMenuBar( const Reference< XMenuBar >& rxMenuBar ) thro
- }
- }
-
--static ::Size ImplMapPixelToAppFont( OutputDevice* pOutDev, const ::Size& aSize )
--{
-- ::Size aTmp = pOutDev->PixelToLogic( aSize, MAP_APPFONT );
-- return aTmp;
--}
--
- // ::com::sun::star::awt::XWindowListener
- void SAL_CALL UnoDialogControl::windowResized( const ::com::sun::star::awt::WindowEvent& e )
- throw (::com::sun::star::uno::RuntimeException)
-@@ -1903,76 +2792,40 @@ throw (::com::sun::star::uno::RuntimeException)
- // XPropertiesChangeListener
- void UnoDialogControl::ImplModelPropertiesChanged( const Sequence< PropertyChangeEvent >& rEvents ) throw(RuntimeException)
- {
-- if( !isDesignMode() && !mbCreatingCompatiblePeer )
-- {
-- ::rtl::OUString s1( RTL_CONSTASCII_USTRINGPARAM( "PositionX" ) );
-- ::rtl::OUString s2( RTL_CONSTASCII_USTRINGPARAM( "PositionY" ) );
-- ::rtl::OUString s3( RTL_CONSTASCII_USTRINGPARAM( "Width" ) );
-- ::rtl::OUString s4( RTL_CONSTASCII_USTRINGPARAM( "Height" ) );
--
- sal_Int32 nLen = rEvents.getLength();
- for( sal_Int32 i = 0; i < nLen; i++ )
- {
- const PropertyChangeEvent& rEvt = rEvents.getConstArray()[i];
- Reference< XControlModel > xModel( rEvt.Source, UNO_QUERY );
- sal_Bool bOwnModel = (XControlModel*)xModel.get() == (XControlModel*)getModel().get();
-- if ( ( rEvt.PropertyName == s1 ) ||
-- ( rEvt.PropertyName == s2 ) ||
-- ( rEvt.PropertyName == s3 ) ||
-- ( rEvt.PropertyName == s4 ) )
-- {
-- if ( bOwnModel )
-- {
-- if ( !mbPosModified && !mbSizeModified )
-- {
-- // Don't set new pos/size if we get new values from window listener
-- Reference< XControl > xThis( (XAggregation*)(::cppu::OWeakAggObject*)this, UNO_QUERY );
-- ImplSetPosSize( xThis );
-- }
-- }
-- else
-- {
-- Sequence<Reference<XControl> > aControlSequence(getControls());
-- Reference<XControl> aControlRef( StdTabController::FindControl( aControlSequence, xModel ) );
-- ImplSetPosSize( aControlRef );
-- }
-- break;
-- }
-- else if ( bOwnModel && rEvt.PropertyName.equalsAsciiL( "ResourceResolver", 16 ))
-+ if( !isDesignMode() && !mbCreatingCompatiblePeer && bOwnModel )
- {
-+ if ( rEvt.PropertyName.equalsAsciiL( "ResourceResolver", 16 ) )
- ImplStartListingForResourceEvents();
- }
-- }
-- }
--
-- sal_Int32 nLen = rEvents.getLength();
-- for( sal_Int32 i = 0; i < nLen; i++ )
-- {
-- const PropertyChangeEvent& rEvt = rEvents.getConstArray()[i];
-- Reference< XControlModel > xModel( rEvt.Source, UNO_QUERY );
-- sal_Bool bOwnModel = (XControlModel*)xModel.get() == (XControlModel*)getModel().get();
-- if ( bOwnModel && rEvt.PropertyName.equalsAsciiL( "ImageURL", 8 ))
-+ else if ( bOwnModel && rEvt.PropertyName.equalsAsciiL( "ImageURL", 8 ))
- {
- ::rtl::OUString aImageURL;
-+ // Ignore GraphicObject urls
- if (( ImplGetPropertyValue( PROPERTY_IMAGEURL ) >>= aImageURL ) &&
- ( aImageURL.getLength() > 0 ))
- {
-- aImageURL =
-- getPhysicalLocation( ImplGetPropertyValue( PROPERTY_DIALOGSOURCEURL ),
-+ ::rtl::OUString absoluteUrl = aImageURL;
-+ if ( aImageURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) != 0 )
-+ {
-+ absoluteUrl = getPhysicalLocation( ImplGetPropertyValue( PROPERTY_DIALOGSOURCEURL ),
- ImplGetPropertyValue( PROPERTY_IMAGEURL ));
--
- }
--
-- ImplSetPropertyValue( PROPERTY_IMAGEURL, uno::makeAny( aImageURL ), sal_True );
-- break;
-+ ImplSetPropertyValue( PROPERTY_IMAGEURL, uno::makeAny( absoluteUrl ), sal_True );
- }
- }
--
-- UnoControlContainer::ImplModelPropertiesChanged( rEvents );
-+ }
-+ UnoDialogContainerControl::ImplModelPropertiesChanged( rEvents );
- }
-
- void UnoDialogControl::ImplStartListingForResourceEvents()
- {
-+ // #FIXME can we move this to base class
- Reference< resource::XStringResourceResolver > xStringResourceResolver;
-
- ImplGetPropertyValue( PROPERTY_RESOURCERESOLVER ) >>= xStringResourceResolver;
-@@ -1987,21 +2840,16 @@ void UnoDialogControl::ImplStartListingForResourceEvents()
- ImplUpdateResourceResolver();
- }
-
--void UnoDialogControl::ImplUpdateResourceResolver()
-+void lcl_ApplyResolverToNestedContainees( const Reference< resource::XStringResourceResolver >& xStringResourceResolver, const Reference< XControlContainer >& xContainer )
- {
- rtl::OUString aPropName( PROPERTY_RESOURCERESOLVER );
-- Reference< resource::XStringResourceResolver > xStringResourceResolver;
--
-- ImplGetPropertyValue( aPropName ) >>= xStringResourceResolver;
-- if ( !xStringResourceResolver.is() )
-- return;
-
- Any xNewStringResourceResolver; xNewStringResourceResolver <<= xStringResourceResolver;
-
- Sequence< rtl::OUString > aPropNames(1);
- aPropNames[0] = aPropName;
-
-- const Sequence< Reference< awt::XControl > > aSeq = getControls();
-+ const Sequence< Reference< awt::XControl > > aSeq = xContainer->getControls();
- for ( sal_Int32 i = 0; i < aSeq.getLength(); i++ )
- {
- Reference< XControl > xControl( aSeq[i] );
-@@ -2032,8 +2880,26 @@ void UnoDialogControl::ImplUpdateResourceResolver()
- catch ( const Exception& )
- {
- }
-+
-+ uno::Reference< XControlContainer > xNestedContainer( xControl, uno::UNO_QUERY );
-+ if ( xNestedContainer.is() )
-+ lcl_ApplyResolverToNestedContainees( xStringResourceResolver, xNestedContainer );
-+
- }
-
-+}
-+
-+void UnoDialogControl::ImplUpdateResourceResolver()
-+{
-+ rtl::OUString aPropName( PROPERTY_RESOURCERESOLVER );
-+ Reference< resource::XStringResourceResolver > xStringResourceResolver;
-+
-+ ImplGetPropertyValue( aPropName ) >>= xStringResourceResolver;
-+ if ( !xStringResourceResolver.is() )
-+ return;
-+
-+ lcl_ApplyResolverToNestedContainees( xStringResourceResolver, this );
-+
- // propagate resource resolver changes to language dependent props of the dialog
- Reference< XPropertySet > xPropertySet( getModel(), UNO_QUERY );
- if ( xPropertySet.is() )
-@@ -2103,53 +2969,6 @@ void UnoDialogControl::endExecute() throw(RuntimeException)
- }
- }
-
--void UnoDialogControl::addingControl( const Reference< XControl >& _rxControl )
--{
-- SolarMutexGuard aSolarGuard;
-- UnoControlContainer::addingControl( _rxControl );
--
-- if ( _rxControl.is() )
-- {
-- Reference< XMultiPropertySet > xProps( _rxControl->getModel(), UNO_QUERY );
-- if ( xProps.is() )
-- {
-- Sequence< ::rtl::OUString > aNames( 4 );
-- ::rtl::OUString* pNames = aNames.getArray();
-- *pNames++ = ::rtl::OUString::createFromAscii( "PositionX" );
-- *pNames++ = ::rtl::OUString::createFromAscii( "PositionY" );
-- *pNames++ = ::rtl::OUString::createFromAscii( "Width" );
-- *pNames++ = ::rtl::OUString::createFromAscii( "Height" );
--
-- xProps->addPropertiesChangeListener( aNames, this );
-- }
-- }
--}
--
--void UnoDialogControl::removingControl( const Reference< XControl >& _rxControl )
--{
-- SolarMutexGuard aSolarGuard;
-- UnoControlContainer::removingControl( _rxControl );
--
-- if ( _rxControl.is() )
-- {
-- Reference< XMultiPropertySet > xProps( _rxControl->getModel(), UNO_QUERY );
-- if ( xProps.is() )
-- xProps->removePropertiesChangeListener( this );
-- }
--
--}
--
--void SAL_CALL UnoDialogControl::changesOccurred( const ChangesEvent& ) throw (RuntimeException)
--{
-- SolarMutexGuard aSolarGuard;
-- // a tab controller model may have changed
--
-- // #109067# in design mode don't notify the tab controller
-- // about tab index changes
-- if ( mxTabController.is() && !mbDesignMode )
-- mxTabController->activateTabOrder();
--}
--
- // XModifyListener
- void SAL_CALL UnoDialogControl::modified(
- const lang::EventObject& /*rEvent*/ )
-@@ -2165,8 +2984,6 @@ throw (RuntimeException)
- ::rtl::OUString getPhysicalLocation( const ::com::sun::star::uno::Any& rbase, const ::com::sun::star::uno::Any& rUrl )
- {
-
-- ::rtl::OUString ret;
--
- ::rtl::OUString baseLocation;
- ::rtl::OUString url;
-
-@@ -2176,16 +2993,9 @@ throw (RuntimeException)
- ::rtl::OUString absoluteURL( url );
- if ( url.getLength() > 0 )
- {
-- // Don't adjust GraphicObject url(s)
-- if ( url.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) != 0 )
-- {
- INetURLObject urlObj(baseLocation);
- urlObj.removeSegment();
- baseLocation = urlObj.GetMainURL( INetURLObject::NO_DECODE );
-- ::osl::FileBase::getAbsoluteFileURL( baseLocation, url, ret );
-- }
-- else
-- ret = url;
-
- const INetURLObject protocolCheck( url );
- const INetProtocol protocol = protocolCheck.GetProtocol();
-diff --git toolkit/source/controls/unocontrolcontainer.cxx toolkit/source/controls/unocontrolcontainer.cxx
-index 4918f9e..773fd63 100644
---- toolkit/source/controls/unocontrolcontainer.cxx
-+++ toolkit/source/controls/unocontrolcontainer.cxx
-@@ -809,7 +809,7 @@ void UnoControlContainer::createPeer( const uno::Reference< awt::XToolkit >& rxT
- aCtrls.getArray()[n]->createPeer( rxToolkit, getPeer() );
-
- uno::Reference< awt::XVclContainerPeer > xC( getPeer(), uno::UNO_QUERY );
--
-+ if ( xC.is() )
- xC->enableDialogControl( sal_True );
- ImplActivateTabControllers();
- }
-diff --git toolkit/source/controls/unocontrols.cxx toolkit/source/controls/unocontrols.cxx
-index 90fcba2..e29347b 100644
---- toolkit/source/controls/unocontrols.cxx
-+++ toolkit/source/controls/unocontrols.cxx
-@@ -537,7 +537,7 @@ uno::Any GraphicControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-
- return UnoControlModel::ImplGetDefaultValue( nPropId );
- }
-- uno::Reference< graphic::XGraphic > getGraphicFromURL_nothrow( uno::Reference< graphic::XGraphicObject >& rxGrfObj, const ::rtl::OUString& _rURL )
-+ uno::Reference< graphic::XGraphic > ImageHelper::getGraphicAndGraphicObjectFromURL_nothrow( uno::Reference< graphic::XGraphicObject >& xOutGraphicObj, const ::rtl::OUString& _rURL )
- {
- uno::Reference< graphic::XGraphic > xGraphic;
-
-@@ -547,10 +547,10 @@ uno::Any GraphicControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
- rtl::OUString sID = _rURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 );
- // get the DefaultContext
- ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
-- rxGrfObj = graphic::GraphicObject::createWithId( aContext.getUNOContext(), sID );
-+ xOutGraphicObj = graphic::GraphicObject::createWithId( aContext.getUNOContext(), sID );
- }
- else // linked
-- rxGrfObj = NULL; // release the GraphicObject
-+ xOutGraphicObj = NULL; // release the GraphicObject
-
- if ( !_rURL.getLength() )
- return xGraphic;
-@@ -575,6 +575,11 @@ uno::Any GraphicControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
- return xGraphic;
- }
-
-+ uno::Reference< graphic::XGraphic > GraphicControlModel::getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL )
-+ {
-+ return ImageHelper::getGraphicAndGraphicObjectFromURL_nothrow( mxGrfObj, _rURL );
-+ }
-+
- void SAL_CALL GraphicControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception)
- {
- UnoControlModel::setFastPropertyValue_NoBroadcast( nHandle, rValue );
-@@ -591,7 +596,7 @@ void SAL_CALL GraphicControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 n
- mbAdjustingGraphic = true;
- ::rtl::OUString sImageURL;
- OSL_VERIFY( rValue >>= sImageURL );
-- setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( getGraphicFromURL_nothrow( mxGrfObj, sImageURL ) ) );
-+ setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( getGraphicFromURL_nothrow( sImageURL ) ) );
- mbAdjustingGraphic = false;
- }
- break;
-@@ -1729,75 +1734,6 @@ sal_Bool UnoGroupBoxControl::isTransparent() throw(uno::RuntimeException)
- return sal_True;
- }
-
--// MultiPage
--
--UnoMultiPageModel::UnoMultiPageModel()
--{
-- ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
-- ImplRegisterProperty( BASEPROPERTY_ENABLED );
-- ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
-- ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
-- ImplRegisterProperty( BASEPROPERTY_HELPURL );
-- ImplRegisterProperty( BASEPROPERTY_LABEL );
-- ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
-- ImplRegisterProperty( BASEPROPERTY_PROGRESSVALUE );
-- ImplRegisterProperty( BASEPROPERTY_PROGRESSVALUE_MAX );
--}
--
--::rtl::OUString UnoMultiPageModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
--{
-- return ::rtl::OUString::createFromAscii( szServiceName_UnoMultiPageModel );
--}
--
--uno::Any UnoMultiPageModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
--{
-- if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
-- {
-- uno::Any aAny;
-- aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlGroupBox );
-- //aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoMultiPageControl );
-- return aAny;
-- }
-- return UnoControlModel::ImplGetDefaultValue( nPropId );
--}
--
--::cppu::IPropertyArrayHelper& UnoMultiPageModel::getInfoHelper()
--{
-- static UnoPropertyArrayHelper* pHelper = NULL;
-- if ( !pHelper )
-- {
-- uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
-- pHelper = new UnoPropertyArrayHelper( aIDs );
-- }
-- return *pHelper;
--}
--
--// beans::XMultiPropertySet
--uno::Reference< beans::XPropertySetInfo > UnoMultiPageModel::getPropertySetInfo( ) throw(uno::RuntimeException)
--{
-- static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
-- return xInfo;
--}
--
--// ----------------------------------------------------
--// class MultiPageControl
--// ----------------------------------------------------
--UnoMultiPageControl::UnoMultiPageControl()
--{
-- maComponentInfos.nWidth = 100;
-- maComponentInfos.nHeight = 100;
--}
--
--::rtl::OUString UnoMultiPageControl::GetComponentServiceName()
--{
-- return ::rtl::OUString::createFromAscii( "multipage" );
--}
--
--sal_Bool UnoMultiPageControl::isTransparent() throw(uno::RuntimeException)
--{
-- return sal_True;
--}
--
- // =====================================================================================================================
- // = UnoControlListBoxModel_Data
- // =====================================================================================================================
-diff --git toolkit/source/helper/listenermultiplexer.cxx toolkit/source/helper/listenermultiplexer.cxx
-index c197d7e..f9d1daa 100644
---- toolkit/source/helper/listenermultiplexer.cxx
-+++ toolkit/source/helper/listenermultiplexer.cxx
-@@ -154,6 +154,21 @@ IMPL_LISTENERMULTIPLEXER_BASEMETHODS( ItemListenerMultiplexer, ::com::sun::star:
- IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ItemListenerMultiplexer, ::com::sun::star::awt::XItemListener, itemStateChanged, ::com::sun::star::awt::ItemEvent )
-
- // ----------------------------------------------------
-+// class TabListenerMultiplexer
-+// ----------------------------------------------------
-+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TabListenerMultiplexer, ::com::sun::star::awt::XTabListener )
-+void TabListenerMultiplexer::inserted( sal_Int32 evt ) throw(::com::sun::star::uno::RuntimeException)
-+IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_1PARAM( TabListenerMultiplexer, ::com::sun::star::awt::XTabListener, inserted, ::sal_Int32 )
-+void TabListenerMultiplexer::removed( sal_Int32 evt ) throw(::com::sun::star::uno::RuntimeException)
-+IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_1PARAM( TabListenerMultiplexer, ::com::sun::star::awt::XTabListener, removed, ::sal_Int32 )
-+void TabListenerMultiplexer::changed( sal_Int32 evt, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& evt2 ) throw(::com::sun::star::uno::RuntimeException)
-+IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_2PARAM( TabListenerMultiplexer, ::com::sun::star::awt::XTabListener, changed, ::sal_Int32, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > )
-+void TabListenerMultiplexer::activated( sal_Int32 evt ) throw(::com::sun::star::uno::RuntimeException)
-+IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_1PARAM( TabListenerMultiplexer, ::com::sun::star::awt::XTabListener, activated, ::sal_Int32 )
-+void TabListenerMultiplexer::deactivated( sal_Int32 evt ) throw(::com::sun::star::uno::RuntimeException)
-+IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_1PARAM( TabListenerMultiplexer, ::com::sun::star::awt::XTabListener, deactivated, ::sal_Int32 )
-+
-+// ----------------------------------------------------
- // class ContainerListenerMultiplexer
- // ----------------------------------------------------
- IMPL_LISTENERMULTIPLEXER_BASEMETHODS( ContainerListenerMultiplexer, ::com::sun::star::container::XContainerListener )
-diff --git toolkit/source/helper/property.cxx toolkit/source/helper/property.cxx
-index 93d6850..c26937b 100644
---- toolkit/source/helper/property.cxx
-+++ toolkit/source/helper/property.cxx
-@@ -56,6 +56,7 @@
- #include <com/sun/star/beans/PropertyAttribute.hpp>
- #include <com/sun/star/graphic/XGraphic.hpp>
- #include <com/sun/star/resource/XStringResourceResolver.hpp>
-+#include <com/sun/star/container/XNameContainer.hpp>
- #include <comphelper/types.hxx>
- #include <functional>
- #include <algorithm>
-@@ -289,7 +290,11 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount )
- DECL_PROP_3 ( "EvenRowBackgroundColor", GRID_EVEN_ROW_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_3 ( "HeaderBackgroundColor", GRID_HEADER_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_3 ( "GridLineColor", GRID_LINE_COLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
-- DECL_PROP_3 ( "RowBackgroundColor", GRID_ROW_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID )
-+ DECL_PROP_3 ( "RowBackgroundColor", GRID_ROW_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
-+ DECL_DEP_PROP_3 ( "MultiPageValue", MULTIPAGEVALUE, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
-+
-+ DECL_PROP_3 ( "AllDialogChildren", USERFORMCONTAINEES, Reference< ::com::sun::star::container::XNameContainer >, BOUND, MAYBEDEFAULT, MAYBEVOID ),
-+
- };
- pPropertyInfos = aImplPropertyInfos;
- nElements = sizeof( aImplPropertyInfos ) / sizeof( ImplPropertyInfo );
-diff --git toolkit/source/helper/registerservices.cxx toolkit/source/helper/registerservices.cxx
-index f219795..7b3dc42 100644
---- toolkit/source/helper/registerservices.cxx
-+++ toolkit/source/helper/registerservices.cxx
-@@ -167,6 +167,8 @@ IMPL_CREATEINSTANCE( UnoControlProgressBarModel )
- IMPL_CREATEINSTANCE( UnoControlScrollBarModel )
- IMPL_CREATEINSTANCE( UnoSpinButtonModel )
- IMPL_CREATEINSTANCE( UnoMultiPageModel )
-+IMPL_CREATEINSTANCE( UnoPageModel )
-+IMPL_CREATEINSTANCE( UnoFrameModel )
- IMPL_CREATEINSTANCE( UnoControlFixedLineModel )
- IMPL_CREATEINSTANCE( UnoCurrencyFieldControl )
- IMPL_CREATEINSTANCE( UnoDateFieldControl )
-@@ -187,6 +189,8 @@ IMPL_CREATEINSTANCE( UnoProgressBarControl )
- IMPL_CREATEINSTANCE( UnoScrollBarControl )
- IMPL_CREATEINSTANCE( UnoSpinButtonControl )
- IMPL_CREATEINSTANCE( UnoMultiPageControl )
-+IMPL_CREATEINSTANCE( UnoPageControl )
-+IMPL_CREATEINSTANCE( UnoFrameControl )
- IMPL_CREATEINSTANCE( UnoFixedLineControl )
- IMPL_CREATEINSTANCE( VCLXMenuBar )
- IMPL_CREATEINSTANCE( VCLXPointer )
-@@ -281,6 +285,10 @@ TOOLKIT_DLLPUBLIC sal_Bool SAL_CALL component_writeInfo( void* _pServiceManager,
- registerServices( xRegistryKey, "UnoSpinButtonControl", szServiceName_UnoSpinButtonControl );
- registerServices( xRegistryKey, "UnoMultiPageModel", szServiceName_UnoMultiPageModel );
- registerServices( xRegistryKey, "UnoMultiPageControl", szServiceName_UnoMultiPageControl );
-+ registerServices( xRegistryKey, "UnoPageModel", szServiceName_UnoPageModel );
-+ registerServices( xRegistryKey, "UnoPageControl", szServiceName_UnoPageControl );
-+ registerServices( xRegistryKey, "UnoFrameModel", szServiceName_UnoFrameModel );
-+ registerServices( xRegistryKey, "UnoFrameControl", szServiceName_UnoFrameControl );
- registerServices( xRegistryKey, "UnoFixedLineControl", szServiceName_UnoControlFixedLine, szServiceName2_UnoControlFixedLine );
- registerServices( xRegistryKey, "UnoControlFixedLineModel", szServiceName_UnoControlFixedLineModel, szServiceName2_UnoControlFixedLineModel );
- registerServices( xRegistryKey, "VCLXPrinterServer", szServiceName_PrinterServer, szServiceName2_PrinterServer );
-@@ -317,7 +325,6 @@ TOOLKIT_DLLPUBLIC void* SAL_CALL component_getFactory( const sal_Char* sImplemen
- {
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory =
- static_cast< ::com::sun::star::lang::XMultiServiceFactory* >( _pServiceManager );
--
- CHECKANDCREATEFACTORY( VCLXToolkit, szServiceName_Toolkit, szServiceName2_Toolkit )
- CHECKANDCREATEFACTORY( VCLXPopupMenu, szServiceName_PopupMenu, szServiceName2_PopupMenu )
- CHECKANDCREATEFACTORY( VCLXMenuBar, szServiceName_MenuBar, szServiceName2_MenuBar )
-@@ -373,6 +380,10 @@ TOOLKIT_DLLPUBLIC void* SAL_CALL component_getFactory( const sal_Char* sImplemen
- CHECKANDCREATEFACTORY( UnoControlRoadmapModel, szServiceName_UnoControlRoadmapModel, szServiceName2_UnoControlRoadmapModel )
- CHECKANDCREATEFACTORY( UnoMultiPageModel, szServiceName_UnoMultiPageModel, NULL )
- CHECKANDCREATEFACTORY( UnoMultiPageControl, szServiceName_UnoMultiPageControl, NULL )
-+ CHECKANDCREATEFACTORY( UnoPageModel, szServiceName_UnoPageModel, NULL )
-+ CHECKANDCREATEFACTORY( UnoPageControl, szServiceName_UnoPageControl, NULL )
-+ CHECKANDCREATEFACTORY( UnoFrameModel, szServiceName_UnoFrameModel, NULL )
-+ CHECKANDCREATEFACTORY( UnoFrameControl, szServiceName_UnoFrameControl, NULL )
- CHECKANDCREATEFACTORY( UnoSpinButtonModel, szServiceName_UnoSpinButtonModel, NULL )
- CHECKANDCREATEFACTORY( UnoSpinButtonControl, szServiceName_UnoSpinButtonControl, NULL )
- CHECKANDCREATEFACTORY( TreeControl, szServiceName_TreeControl, NULL )
-diff --git toolkit/source/helper/servicenames.cxx toolkit/source/helper/servicenames.cxx
-index 5bd87f1..1fd8ee4 100644
---- toolkit/source/helper/servicenames.cxx
-+++ toolkit/source/helper/servicenames.cxx
-@@ -93,6 +93,10 @@ const sal_Char __FAR_DATA szServiceName_UnoSpinButtonControl[] = "com.sun.star.a
- const sal_Char __FAR_DATA szServiceName_UnoSpinButtonModel[] = "com.sun.star.awt.UnoControlSpinButtonModel";
- const sal_Char __FAR_DATA szServiceName_UnoMultiPageControl[] = "com.sun.star.awt.UnoControlMultiPage";
- const sal_Char __FAR_DATA szServiceName_UnoMultiPageModel[] = "com.sun.star.awt.UnoMultiPageModel";
-+const sal_Char __FAR_DATA szServiceName_UnoPageControl[] = "com.sun.star.awt.UnoControlPage";
-+const sal_Char __FAR_DATA szServiceName_UnoPageModel[] = "com.sun.star.awt.UnoPageModel";
-+const sal_Char __FAR_DATA szServiceName_UnoFrameControl[] = "com.sun.star.awt.UnoControlFrame";
-+const sal_Char __FAR_DATA szServiceName_UnoFrameModel[] = "com.sun.star.awt.UnoFrameModel";
- const sal_Char __FAR_DATA szServiceName_TreeControl[] = "com.sun.star.awt.tree.TreeControl";
- const sal_Char __FAR_DATA szServiceName_TreeControlModel[] = "com.sun.star.awt.tree.TreeControlModel";
- const sal_Char __FAR_DATA szServiceName_MutableTreeDataModel[] = "com.sun.star.awt.tree.MutableTreeDataModel";
-diff --git toolkit/source/helper/unowrapper.cxx toolkit/source/helper/unowrapper.cxx
-index 8ef8c48..9b590e2 100644
---- toolkit/source/helper/unowrapper.cxx
-+++ toolkit/source/helper/unowrapper.cxx
-@@ -39,6 +39,7 @@
- #include <toolkit/awt/vclxcontainer.hxx>
- #include <toolkit/awt/vclxtopwindow.hxx>
- #include <toolkit/awt/vclxgraphics.hxx>
-+#include <awt/vclxtabcontrol.hxx>
-
- #include "toolkit/dllapi.h"
- #include <vcl/svapp.hxx>
-@@ -108,6 +109,7 @@ using namespace ::com::sun::star;
- case WINDOW_TABPAGE: return new VCLXContainer;
-
- case WINDOW_TOOLBOX: return new VCLXToolBox;
-+ case WINDOW_TABCONTROL: return new VCLXMultiPage;
-
- // case WINDOW_FIXEDLINE:
- // case WINDOW_FIXEDBITMAP:
-diff --git vbahelper/inc/vbahelper/vbahelper.hxx vbahelper/inc/vbahelper/vbahelper.hxx
-index 46396bb..1727d50 100644
---- vbahelper/inc/vbahelper/vbahelper.hxx
-+++ vbahelper/inc/vbahelper/vbahelper.hxx
-@@ -49,6 +49,7 @@
- #include <sfx2/docfilt.hxx>
- #include <sfx2/docfile.hxx>
- #include <vcl/pointr.hxx>
-+#include <oox/helper/graphichelper.hxx>
- #include <memory>
- #include "vbaaccesshelper.hxx"
-
-@@ -202,6 +203,7 @@ class VBAHELPER_DLLPUBLIC UserFormGeometryHelper : public AbstractGeometryAttrib
- {
- css::uno::Reference< css::awt::XUnitConversion > mxControlUnits;
- css::uno::Reference< css::beans::XPropertySet > mxModel;
-+ std::auto_ptr< oox::GraphicHelper > mpGraphicHelper;
-
- sal_Int32 ConvertLogicToPixel( sal_Int32 nValue, sal_Bool bIsPoint, sal_Bool bIsX, sal_Int16 nSourceUnit );
- sal_Int32 ConvertPixelToLogic( sal_Int32 nValue, sal_Bool bIsPoint, sal_Bool bIsX, sal_Int16 nTargetUnit );
-diff --git vbahelper/prj/build.lst vbahelper/prj/build.lst
-index 20001db..ded9ee2 100644
---- vbahelper/prj/build.lst
-+++ vbahelper/prj/build.lst
-@@ -1,4 +1,4 @@
--vba vbahelper : oovbaapi basic sfx2 svx filter cppuhelper vcl comphelper svtools tools sal NULL
-+vba vbahelper : oovbaapi oox basic sfx2 svx filter cppuhelper vcl comphelper svtools tools sal NULL
- vba vbahelper usr1 - all vba_mkout NULL
- #vba vbahelper\inc nmake - all vba_inc NULL
- vba vbahelper\source\vbahelper nmake - all vba_vbahelper NULL
-diff --git vbahelper/source/msforms/vbacontrol.cxx vbahelper/source/msforms/vbacontrol.cxx
-index 8b0b640..d08e328 100644
---- vbahelper/source/msforms/vbacontrol.cxx
-+++ vbahelper/source/msforms/vbacontrol.cxx
-@@ -590,6 +590,11 @@ ScVbaControl* ScVbaControlFactory::createControl( const uno::Reference< awt::XCo
- pControl = new ScVbaSpinButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
- else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.custom.awt.UnoControlSystemAXContainerModel") ) ) )
- pControl = new VbaSystemAXControl( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
-+ // #FIXME implement a page control
-+ else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoPageModel") ) ) )
-+ pControl = new ScVbaControl( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
-+ else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoFrameModel") ) ) )
-+ pControl = new ScVbaFrame( 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;
-diff --git vbahelper/source/msforms/vbacontrols.cxx vbahelper/source/msforms/vbacontrols.cxx
-index 9afb602..1c05b81 100644
---- vbahelper/source/msforms/vbacontrols.cxx
-+++ vbahelper/source/msforms/vbacontrols.cxx
-@@ -67,22 +67,35 @@ private:
- msNames.realloc( nIndex );
-
- msNames[ nIndex ] = getControlName( xCtrl );
-- mControls.push_back( xCtrl );
- mIndices[ msNames[ nIndex ] ] = nIndex;
- }
- }
-
-+ void getNestedControls( ControlVec& vControls, uno::Reference< awt::XControlContainer >& xContainer )
-+ {
-+ uno::Sequence< uno::Reference< awt::XControl > > aControls = xContainer->getControls();
-+ const uno::Reference< awt::XControl >* pCtrl = aControls.getConstArray();
-+ const uno::Reference< awt::XControl >* pCtrlsEnd = pCtrl + aControls.getLength();
-+ for ( ; pCtrl < pCtrlsEnd; ++pCtrl )
-+ {
-+ uno::Reference< awt::XControlContainer > xC( *pCtrl, uno::UNO_QUERY );
-+ vControls.push_back( *pCtrl );
-+ if ( xC.is() )
-+ getNestedControls( vControls, xC );
-+ }
-+ }
-+
- public:
- ControlArrayWrapper( const uno::Reference< awt::XControl >& xDialog )
- {
- try
- {
- 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 )
-- SetArrayElementTo( sXControls[ i ], i );
-+// uno::Sequence< uno::Reference< awt::XControl > > sXControls = mxDialog->getControls();
-+ getNestedControls( mControls, mxDialog );
-+ msNames.realloc( mControls.size() );
-+ for ( sal_uInt32 i = 0; i < mControls.size(); ++i )
-+ SetArrayElementTo( mControls[ i ], i );
- }
- catch( uno::Exception& )
- {
-diff --git vbahelper/source/msforms/vbamultipage.cxx vbahelper/source/msforms/vbamultipage.cxx
-index 46593a1..37879ca 100644
---- vbahelper/source/msforms/vbamultipage.cxx
-+++ vbahelper/source/msforms/vbamultipage.cxx
-@@ -29,14 +29,12 @@
- #include <ooo/vba/XCollection.hpp>
- #include "vbapages.hxx"
- #include <vector>
-+#include <com/sun/star/container/XNameContainer.hpp>
-
- 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") );
-+const rtl::OUString SVALUE( RTL_CONSTASCII_USTRINGPARAM("MultiPageValue") );
-
- typedef cppu::WeakImplHelper1< container::XIndexAccess > PagesImpl_Base;
- class PagesImpl : public PagesImpl_Base
-@@ -72,8 +70,6 @@ ScVbaMultiPage::getPages( sal_Int32 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
-@@ -82,17 +78,17 @@ ScVbaMultiPage::getValue() throw (css::uno::RuntimeException)
- {
- sal_Int32 nValue = 0;
- m_xProps->getPropertyValue( SVALUE ) >>= nValue;
-- return nValue;
-+ // VBA 0 based tab index
-+ return nValue - 1;
- }
-
- 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 )
-- sal_Int32 nVal = _value; // will be _value + 1 when cws container_controls is integrated
-+ // Openoffice 1 based tab index
-+ sal_Int32 nVal = _value + 1;
- sal_Int32 nOldVal = getValue();
-- m_xProps->setPropertyValue( SVALUE, uno::makeAny( _value ) );
-- mxDialogProps->setPropertyValue( SSTEP, uno::makeAny( _value + 1) );
-+ m_xProps->setPropertyValue( SVALUE, uno::makeAny( nVal ) );
- if ( nVal != nOldVal )
- fireChangeEvent();
- }
-@@ -108,9 +104,9 @@ ScVbaMultiPage::getServiceImplName()
- 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 ) ) );
-+ // get the container model
-+ uno::Reference< container::XNameContainer > xContainer( m_xProps, uno::UNO_QUERY_THROW );
-+ uno::Reference< XCollection > xColl( new ScVbaPages( this, mxContext, getPages( xContainer->getElementNames().getLength() ) ) );
- if ( !index.hasValue() )
- return uno::makeAny( xColl );
- return xColl->Item( uno::makeAny( index ), uno::Any() );
-diff --git vbahelper/source/msforms/vbauserform.cxx vbahelper/source/msforms/vbauserform.cxx
-index 1894d3c..a248965 100644
---- vbahelper/source/msforms/vbauserform.cxx
-+++ vbahelper/source/msforms/vbauserform.cxx
-@@ -28,9 +28,9 @@
- #include <vbahelper/helperdecl.hxx>
- #include "vbauserform.hxx"
- #include <com/sun/star/awt/XControl.hpp>
--#include <com/sun/star/awt/XControlContainer.hpp>
- #include <com/sun/star/awt/XWindow2.hpp>
- #include <com/sun/star/beans/PropertyConcept.hpp>
-+#include <com/sun/star/container/XNameContainer.hpp>
- #include <basic/sbx.hxx>
- #include <basic/sbstar.hxx>
- #include <basic/sbmeth.hxx>
-@@ -191,6 +191,30 @@ ScVbaUserForm::setValue( const ::rtl::OUString& aPropertyName, const uno::Any& a
- }
- }
-
-+uno::Reference< awt::XControl >
-+ScVbaUserForm::nestedSearch( const rtl::OUString& aPropertyName, uno::Reference< awt::XControlContainer >& xContainer )
-+{
-+ uno::Reference< awt::XControl > xControl = xContainer->getControl( aPropertyName );
-+ if ( !xControl.is() )
-+ {
-+ uno::Sequence< uno::Reference< awt::XControl > > aControls = xContainer->getControls();
-+ const uno::Reference< awt::XControl >* pCtrl = aControls.getConstArray();
-+ const uno::Reference< awt::XControl >* pCtrlsEnd = pCtrl + aControls.getLength();
-+
-+ for ( ; pCtrl < pCtrlsEnd; ++pCtrl )
-+ {
-+ uno::Reference< awt::XControlContainer > xC( *pCtrl, uno::UNO_QUERY );
-+ if ( xC.is() )
-+ {
-+ xControl.set( nestedSearch( aPropertyName, xC ) );
-+ if ( xControl.is() )
-+ break;
-+ }
-+ }
-+ }
-+ return xControl;
-+}
-+
- uno::Any SAL_CALL
- ScVbaUserForm::getValue( const ::rtl::OUString& aPropertyName ) throw (beans::UnknownPropertyException, uno::RuntimeException)
- {
-@@ -201,7 +225,9 @@ ScVbaUserForm::getValue( const ::rtl::OUString& aPropertyName ) throw (beans::Un
- {
- 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 );
-+
-+ uno::Reference< awt::XControl > xControl = nestedSearch( aPropertyName, xContainer );
-+ 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() );
-@@ -235,14 +261,19 @@ ScVbaUserForm::Controls( const uno::Any& index ) throw (uno::RuntimeException)
- 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 );
-+ uno::Reference< beans::XPropertySet > xDlgProps( xControl->getModel(), uno::UNO_QUERY );
-+ if ( xDlgProps.is() )
-+ {
-+ uno::Reference< container::XNameContainer > xAllChildren( xDlgProps->getPropertyValue( rtl::OUString::createFromAscii("AllDialogChildren" ) ), uno::UNO_QUERY_THROW );
-+ sal_Bool bRes = xAllChildren->hasByName( aName );
-+ OSL_TRACE("ScVbaUserForm::hasProperty(%s) %d ---> %d", rtl::OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr(), xAllChildren.is(), bRes );
- return bRes;
- }
-+ }
- return sal_False;
- }
-
-diff --git vbahelper/source/msforms/vbauserform.hxx vbahelper/source/msforms/vbauserform.hxx
-index 216f558..bd609ad 100644
---- vbahelper/source/msforms/vbauserform.hxx
-+++ vbahelper/source/msforms/vbauserform.hxx
-@@ -30,6 +30,7 @@
- #include <cppuhelper/implbase1.hxx>
- #include <ooo/vba/msforms/XUserForm.hpp>
- #include <com/sun/star/awt/XDialog.hpp>
-+#include <com/sun/star/awt/XControlContainer.hpp>
- #include <com/sun/star/frame/XModel.hpp>
-
- #include <vbahelper/vbahelperinterface.hxx>
-@@ -48,6 +49,7 @@ 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();
-+ static css::uno::Reference< css::awt::XControl > nestedSearch( const rtl::OUString& aPropertyName, css::uno::Reference< css::awt::XControlContainer >& xContainer );
- virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (css::uno::RuntimeException);
- // XUserForm
-diff --git vbahelper/util/makefile.mk vbahelper/util/makefile.mk
-index a09ffa5..da3f31a 100644
---- vbahelper/util/makefile.mk
-+++ vbahelper/util/makefile.mk
-@@ -61,6 +61,7 @@ SHL1STDLIBS= \
- $(VCLLIB) \
- $(SVTOOLLIB) \
- $(MSFILTERLIB) \
-+ $(OOXLIB) \
- $(TKLIB)
-
- SHL1DEPN=
-diff --git vcl/inc/vcl/tabctrl.hxx vcl/inc/vcl/tabctrl.hxx
-index 877772f..f6ac7e6 100644
---- vcl/inc/vcl/tabctrl.hxx
-+++ vcl/inc/vcl/tabctrl.hxx
-@@ -103,6 +103,7 @@ private:
- protected:
- using Window::ImplInit;
- SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle );
-+ SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle );
- SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId );
-
- virtual void FillLayoutData() const;
-diff --git vcl/source/control/group.cxx vcl/source/control/group.cxx
-index 9922b45..f209123 100644
---- vcl/source/control/group.cxx
-+++ vcl/source/control/group.cxx
-@@ -135,6 +135,7 @@ GroupBox::GroupBox( Window* pParent, const ResId& rResId ) :
- void GroupBox::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags,
- const Point& rPos, const Size& rSize, bool bLayout )
- {
-+ OSL_TRACE("GroupBox::ImplDraw Y %d, X %d", rPos.Y(), rPos.X() );
- long nTop;
- long nTextOff;
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
-diff --git vcl/source/control/tabctrl.cxx vcl/source/control/tabctrl.cxx
-index 6fccc62..f67dc5d 100644
---- vcl/source/control/tabctrl.cxx
-+++ vcl/source/control/tabctrl.cxx
-@@ -195,6 +195,18 @@ const Color& TabControl::GetCanonicalTextColor( const StyleSettings& _rStyle ) c
-
- // -----------------------------------------------------------------------
-
-+WinBits TabControl::ImplInitStyle( WinBits nStyle )
-+{
-+ if ( !(nStyle & WB_NOTABSTOP) )
-+ nStyle |= WB_TABSTOP;
-+ if ( !(nStyle & WB_NOGROUP) )
-+ nStyle |= WB_GROUP;
-+
-+ return nStyle;
-+}
-+
-+// -----------------------------------------------------------------------
-+
- void TabControl::ImplInitSettings( BOOL bFont,
- BOOL bForeground, BOOL bBackground )
- {
-@@ -251,6 +263,7 @@ TabControl::TabControl( Window* pParent, WinBits nStyle ) :
- Control( WINDOW_TABCONTROL )
- {
- ImplInit( pParent, nStyle );
-+ OSL_TRACE("*** TABCONTROL no notabs? %s", ( GetStyle() & WB_NOBORDER ) ? "true" : "false" );
- }
-
- // -----------------------------------------------------------------------
-@@ -716,6 +729,12 @@ void TabControl::ImplChangeTabPage( USHORT nId, USHORT nOldId )
-
- if ( pPage )
- {
-+ if ( ( GetStyle() & WB_NOBORDER ) )
-+ {
-+ Rectangle aRectNoTab( (const Point&)Point( 0, 0 ), GetSizePixel() );
-+ pPage->SetPosSizePixel( aRectNoTab.TopLeft(), aRectNoTab.GetSize() );
-+ }
-+ else
- pPage->SetPosSizePixel( aRect.TopLeft(), aRect.GetSize() );
-
- // activate page here so the conbtrols can be switched
-@@ -776,6 +795,12 @@ BOOL TabControl::ImplPosCurTabPage()
- ImplTabItem* pItem = ImplGetItem( GetCurPageId() );
- if ( pItem && pItem->mpTabPage )
- {
-+ if ( ( GetStyle() & WB_NOBORDER ) )
-+ {
-+ Rectangle aRectNoTab( (const Point&)Point( 0, 0 ), GetSizePixel() );
-+ pItem->mpTabPage->SetPosSizePixel( aRectNoTab.TopLeft(), aRectNoTab.GetSize() );
-+ return TRUE;
-+ }
- Rectangle aRect = ImplGetTabRect( TAB_PAGERECT );
- pItem->mpTabPage->SetPosSizePixel( aRect.TopLeft(), aRect.GetSize() );
- return TRUE;
-@@ -1184,6 +1209,7 @@ void TabControl::KeyInput( const KeyEvent& rKEvt )
-
- void TabControl::Paint( const Rectangle& rRect )
- {
-+ if ( !( GetStyle() & WB_NOBORDER ) )
- ImplPaint( rRect, false );
- }
-
-@@ -1621,6 +1647,10 @@ void TabControl::StateChanged( StateChangedType nType )
- ImplInitSettings( FALSE, FALSE, TRUE );
- Invalidate();
- }
-+ else if ( nType == STATE_CHANGE_STYLE )
-+ {
-+ SetStyle( ImplInitStyle( GetStyle() ) );
-+ }
- }
-
- // -----------------------------------------------------------------------
-diff --git xmlscript/inc/xmlscript/xmldlg_imexp.hxx xmlscript/inc/xmlscript/xmldlg_imexp.hxx
-index ed3c131..d390e27 100644
---- xmlscript/inc/xmlscript/xmldlg_imexp.hxx
-+++ xmlscript/inc/xmlscript/xmldlg_imexp.hxx
-@@ -27,12 +27,11 @@
- #ifndef _XMLSCRIPT_XMLDLG_IMEXP_HXX_
- #define _XMLSCRIPT_XMLDLG_IMEXP_HXX_
-
--#include <com/sun/star/frame/XModel.hpp>
--
- #include <com/sun/star/container/XNameContainer.hpp>
- #include <com/sun/star/io/XInputStreamProvider.hpp>
- #include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
- #include <com/sun/star/uno/XComponentContext.hpp>
-+#include <com/sun/star/frame/XModel.hpp>
-
- #include "xmlscript/xmlns.h"
-
-@@ -85,7 +84,6 @@ void SAL_CALL importDialogModel(
- ::com::sun::star::uno::Reference<
- ::com::sun::star::frame::XModel > const & xDocument )
- SAL_THROW( (::com::sun::star::uno::Exception) );
--
- }
-
- #endif
-diff --git xmlscript/source/xmldlg_imexp/common.hxx xmlscript/source/xmldlg_imexp/common.hxx
-index 5a41608..68ef4fb 100644
---- xmlscript/source/xmldlg_imexp/common.hxx
-+++ xmlscript/source/xmldlg_imexp/common.hxx
-@@ -39,6 +39,7 @@ const sal_Int16 BORDER_SIMPLE_COLOR = 3;
-
- }
-
-+#define XMLSCRIPT_GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:"
- #endif
-
- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
-diff --git xmlscript/source/xmldlg_imexp/exp_share.hxx xmlscript/source/xmldlg_imexp/exp_share.hxx
-index d06ffee..46088bf 100644
---- xmlscript/source/xmldlg_imexp/exp_share.hxx
-+++ xmlscript/source/xmldlg_imexp/exp_share.hxx
-@@ -90,16 +90,18 @@ class ElementDescriptor
- {
- css::uno::Reference< css::beans::XPropertySet > _xProps;
- css::uno::Reference< css::beans::XPropertyState > _xPropState;
-+ css::uno::Reference< css::frame::XModel > _xDocument;
-
- public:
- inline ElementDescriptor(
- css::uno::Reference< css::beans::XPropertySet > const & xProps,
- css::uno::Reference< css::beans::XPropertyState > const & xPropState,
-- ::rtl::OUString const & name )
-+ ::rtl::OUString const & name, css::uno::Reference< css::frame::XModel > const & xDocument )
- SAL_THROW( () )
- : XMLElement( name )
- , _xProps( xProps )
- , _xPropState( xPropState )
-+ , _xDocument( xDocument )
- {}
- inline ElementDescriptor(
- ::rtl::OUString const & name )
-@@ -141,6 +143,8 @@ public:
- ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
- void readVerticalAlignAttr(
- ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
-+ void readImageURLAttr(
-+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
- void readImageAlignAttr(
- ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
- void readImagePositionAttr(
-@@ -158,6 +162,8 @@ public:
- void readSelectionTypeAttr(
- ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName );
- //
-+ void readDataAwareAttr(
-+ ::rtl::OUString const & rAttrName );
- inline void addBoolAttr(
- ::rtl::OUString const & rAttrName, sal_Bool bValue )
- { addAttribute( rAttrName, ::rtl::OUString::valueOf(bValue) ); }
-@@ -171,17 +177,23 @@ public:
- //
- void readDialogModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
-+ void readBullitinBoard( StyleBag * all_styles )
-+ SAL_THROW( (css::uno::Exception) );
- void readMultiPageModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
-+ void readFrameModel( StyleBag * all_styles )
-+ SAL_THROW( (css::uno::Exception) );
-+ void readPageModel( StyleBag * all_styles )
-+ SAL_THROW( (css::uno::Exception) );
- void readButtonModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
- void readEditModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
- void readCheckBoxModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
-- void readRadioButtonModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
-+ void readRadioButtonModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
-- void readComboBoxModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
-+ void readComboBoxModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
- void readCurrencyFieldModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
-@@ -195,9 +207,9 @@ public:
- SAL_THROW( (css::uno::Exception) );
- void readGroupBoxModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
-- void readImageControlModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
-+ void readImageControlModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
-- void readListBoxModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
-+ void readListBoxModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
- void readNumericFieldModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
-@@ -211,9 +223,9 @@ public:
- SAL_THROW( (css::uno::Exception) );
- void readProgressBarModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
-- void readScrollBarModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
-+ void readScrollBarModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
-- void readSpinButtonModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
-+ void readSpinButtonModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
- void readFixedHyperLinkModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
-diff --git xmlscript/source/xmldlg_imexp/imp_share.hxx xmlscript/source/xmldlg_imexp/imp_share.hxx
-index a13a205..7f57f35 100644
---- xmlscript/source/xmldlg_imexp/imp_share.hxx
-+++ xmlscript/source/xmldlg_imexp/imp_share.hxx
-@@ -42,9 +42,8 @@
- #include <com/sun/star/awt/FontEmphasisMark.hpp>
- #include <com/sun/star/awt/FontRelief.hpp>
- #include <com/sun/star/xml/input/XRoot.hpp>
--#include <com/sun/star/script/XLibraryContainer.hpp>
- #include <vector>
--
-+#include <boost/shared_ptr.hpp>
-
- namespace css = ::com::sun::star;
-
-@@ -116,21 +115,25 @@ inline bool getLongAttr(
- class ImportContext;
-
- //==============================================================================
-+typedef ::cppu::WeakImplHelper1< css::xml::input::XRoot > DialogImport_Base;
- struct DialogImport
-- : public ::cppu::WeakImplHelper1< css::xml::input::XRoot >
-+ : DialogImport_Base
- {
- friend class ImportContext;
-
- css::uno::Reference< css::uno::XComponentContext > _xContext;
- css::uno::Reference< css::util::XNumberFormatsSupplier > _xSupplier;
-
-- ::std::vector< ::rtl::OUString > _styleNames;
-- ::std::vector< css::uno::Reference< css::xml::input::XElement > > _styles;
-+ ::boost::shared_ptr< ::std::vector< ::rtl::OUString > > _pStyleNames;
-+ ::boost::shared_ptr< ::std::vector< css::uno::Reference< css::xml::input::XElement > > > _pStyles;
-+ ::std::vector< ::rtl::OUString >& _styleNames;
-+ ::std::vector< css::uno::Reference< css::xml::input::XElement > >& _styles;
-+
-
- css::uno::Reference< css::container::XNameContainer > _xDialogModel;
- css::uno::Reference< css::lang::XMultiServiceFactory > _xDialogModelFactory;
- css::uno::Reference< css::frame::XModel > _xDoc;
-- css::uno::Reference< css::script::XLibraryContainer > _xScriptLibraryContainer;
-+
-
- sal_Int32 XMLNS_DIALOGS_UID, XMLNS_SCRIPT_UID;
-
-@@ -165,19 +168,36 @@ public:
- css::uno::Reference<css::uno::XComponentContext> const & xContext,
- css::uno::Reference<css::container::XNameContainer>
- const & xDialogModel,
-+ ::boost::shared_ptr< ::std::vector< ::rtl::OUString > >& pStyleNames,
-+ ::boost::shared_ptr< ::std::vector< css::uno::Reference< css::xml::input::XElement > > >& pStyles,
- css::uno::Reference<css::frame::XModel> const & xDoc )
- SAL_THROW( () )
- : _xContext( xContext )
-+ , _pStyleNames( pStyleNames )
-+ , _pStyles( pStyles )
-+ , _styleNames( *_pStyleNames )
-+ , _styles( *_pStyles )
- , _xDialogModel( xDialogModel )
-- , _xDialogModelFactory( xDialogModel, css::uno::UNO_QUERY_THROW ), _xDoc( xDoc )
-+ , _xDialogModelFactory( xDialogModel, css::uno::UNO_QUERY_THROW )
-+ , _xDoc( xDoc )
- { OSL_ASSERT( _xDialogModel.is() && _xDialogModelFactory.is() &&
- _xContext.is() ); }
-+
-+ inline DialogImport( const DialogImport& rOther ) : DialogImport_Base()
-+ , _xContext( rOther._xContext )
-+ , _xSupplier( rOther._xSupplier )
-+ , _pStyleNames( rOther._pStyleNames )
-+ , _pStyles( rOther._pStyles )
-+ , _styleNames( *_pStyleNames )
-+ , _styles( *_pStyles )
-+ , _xDialogModel( rOther._xDialogModel )
-+ , _xDialogModelFactory( rOther._xDialogModelFactory )
-+ , _xDoc( rOther._xDoc )
-+ , XMLNS_DIALOGS_UID( rOther.XMLNS_DIALOGS_UID )
-+ , XMLNS_SCRIPT_UID( rOther.XMLNS_SCRIPT_UID ) {}
- virtual ~DialogImport()
- SAL_THROW( () );
--
- inline css::uno::Reference< css::frame::XModel > getDocOwner() { return _xDoc; }
--
-- css::uno::Reference< css::script::XLibraryContainer > getScriptLibraryContainer();
- // XRoot
- virtual void SAL_CALL startDocument(
- css::uno::Reference< css::xml::input::XNamespaceMapping >
-@@ -364,6 +384,9 @@ protected:
-
- ::rtl::OUString getControlId(
- css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
-+ ::rtl::OUString getControlModelName(
-+ rtl::OUString const& rDefaultModel,
-+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
- css::uno::Reference< css::xml::input::XElement > getStyle(
- css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
- public:
-@@ -434,6 +457,8 @@ public:
- bool importVerticalAlignProperty(
- ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
- css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
-+ bool importImageURLProperty( rtl::OUString const & rPropName, rtl::OUString const & rAttrName,
-+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes );
- bool importImageAlignProperty(
- ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
- css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
-@@ -458,6 +483,9 @@ public:
- bool importSelectionTypeProperty(
- ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
- css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
-+ bool importDataAwareProperty(
-+ ::rtl::OUString const & rPropName,
-+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
- };
-
- //==============================================================================
-@@ -473,6 +501,14 @@ public:
- pImport->_xDialogModelFactory->createInstance( rControlName ),
- css::uno::UNO_QUERY_THROW ), rId )
- {}
-+ inline ControlImportContext(
-+ DialogImport * pImport,
-+ const css::uno::Reference< css::beans::XPropertySet >& xProps, ::rtl::OUString const & rControlName )
-+ : ImportContext(
-+ pImport,
-+ xProps,
-+ rControlName )
-+ {}
- inline ~ControlImportContext()
- {
- _pImport->_xDialogModel->insertByName(
-@@ -1003,6 +1039,7 @@ public:
- };
-
- //==============================================================================
-+
- class SpinButtonElement
- : public ControlElement
- {
-@@ -1043,7 +1080,62 @@ public:
- ElementBase * pParent, DialogImport * pImport )
- SAL_THROW( () )
- : ControlElement( rLocalName, xAttributes, pParent, pImport )
-+ {
-+ m_xContainer.set( _pImport->_xDialogModelFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoMultiPageModel") ) ), css::uno::UNO_QUERY );
-+ }
-+private:
-+ css::uno::Reference< css::container::XNameContainer > m_xContainer;
-+};
-+
-+//==============================================================================
-+class Frame
-+ : public ControlElement
-+{
-+ ::rtl::OUString _label;
-+public:
-+ virtual css::uno::Reference< css::xml::input::XElement >
-+ SAL_CALL startChildElement(
-+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
-+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
-+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-+ virtual void SAL_CALL endElement()
-+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-+
-+ inline Frame(
-+ ::rtl::OUString const & rLocalName,
-+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
-+ ElementBase * pParent, DialogImport * pImport )
-+ SAL_THROW( () )
-+ : ControlElement( rLocalName, xAttributes, pParent, pImport )
- {}
-+private:
-+ css::uno::Reference< css::container::XNameContainer > m_xContainer;
-+};
-+
-+//==============================================================================
-+class Page
-+ : public ControlElement
-+{
-+public:
-+ virtual css::uno::Reference< css::xml::input::XElement >
-+ SAL_CALL startChildElement(
-+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
-+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
-+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-+ virtual void SAL_CALL endElement()
-+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-+
-+ inline Page(
-+ ::rtl::OUString const & rLocalName,
-+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
-+ ElementBase * pParent, DialogImport * pImport )
-+ SAL_THROW( () )
-+ : ControlElement( rLocalName, xAttributes, pParent, pImport )
-+ {
-+ m_xContainer.set( _pImport->_xDialogModelFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoPageModel") ) ), css::uno::UNO_QUERY );
-+ }
-+private:
-+ css::uno::Reference< css::container::XNameContainer > m_xContainer;
- };
-
- class ProgressBarElement
-diff --git xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx
-index 6564ee3..48fb6d5 100644
---- xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx
-+++ xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx
-@@ -72,8 +72,7 @@ Reference< io::XInputStream > InputStreamProvider::createInputStream()
- //==================================================================================================
- Reference< io::XInputStreamProvider > SAL_CALL exportDialogModel(
- Reference< container::XNameContainer > const & xDialogModel,
-- Reference< XComponentContext > const & xContext,
-- Reference< XModel > const & xDocument )
-+ Reference< XComponentContext > const & xContext, Reference< XModel > const & xDocument )
- SAL_THROW( (Exception) )
- {
- Reference< lang::XMultiComponentFactory > xSMgr( xContext->getServiceManager() );
-@@ -107,8 +106,7 @@ Reference< io::XInputStreamProvider > SAL_CALL exportDialogModel(
- void SAL_CALL importDialogModel(
- Reference< io::XInputStream > xInput,
- Reference< container::XNameContainer > const & xDialogModel,
-- Reference< XComponentContext > const & xContext,
-- Reference< XModel > const & xDocument )
-+ Reference< XComponentContext > const & xContext, Reference< XModel > const & xDocument )
- SAL_THROW( (Exception) )
- {
- Reference< lang::XMultiComponentFactory > xSMgr( xContext->getServiceManager() );
-diff --git xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
-index fbe68fe..c74ee06 100644
---- xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
-+++ xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
-@@ -30,16 +30,8 @@
- #include "precompiled_xmlscript.hxx"
- #include "exp_share.hxx"
-
--#include <com/sun/star/form/binding/XListEntrySink.hpp>
--#include <com/sun/star/form/binding/XBindableValue.hpp>
--#include <com/sun/star/form/binding/XValueBinding.hpp>
--#include <com/sun/star/table/CellAddress.hpp>
--#include <com/sun/star/table/CellRangeAddress.hpp>
- #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
--#include <com/sun/star/document/XStorageBasedDocument.hpp>
--#include <com/sun/star/document/XGraphicObjectResolver.hpp>
--#include <comphelper/componentcontext.hxx>
--#include <comphelper/processfactory.hxx>
-+#include <com/sun/star/lang/XServiceInfo.hpp>
-
-
- using namespace ::com::sun::star;
-@@ -49,66 +49,6 @@
- namespace xmlscript
- {
-
--void lclExportBindableAndListSourceBits( Reference< frame::XModel > const & xDocument, const Reference< beans::XPropertySet >& _xProps, ElementDescriptor& rModel )
--{
-- Reference< lang::XMultiServiceFactory > xFac;
-- if ( xDocument.is() )
-- xFac.set( xDocument, uno::UNO_QUERY );
--
-- Reference< form::binding::XBindableValue > xBinding( _xProps, UNO_QUERY );
--
-- if ( xFac.is() && xBinding.is() )
-- {
-- try
-- {
-- Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellAddressConversion" )), uno::UNO_QUERY );
-- Reference< beans::XPropertySet > xBindable( xBinding->getValueBinding(), UNO_QUERY );
-- if ( xBindable.is() )
-- {
-- table::CellAddress aAddress;
-- xBindable->getPropertyValue( OUSTR("BoundCell") ) >>= aAddress;
-- xConvertor->setPropertyValue( OUSTR("Address"), makeAny( aAddress ) );
-- rtl::OUString sAddress;
-- xConvertor->getPropertyValue( OUSTR("PersistentRepresentation") ) >>= sAddress;
-- if ( sAddress.getLength() > 0 )
-- rModel.addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell"), sAddress );
--
-- OSL_TRACE( "*** Bindable value %s", rtl::OUStringToOString( sAddress, RTL_TEXTENCODING_UTF8 ).getStr() );
--
-- }
-- }
-- catch( uno::Exception& )
-- {
-- }
-- }
-- Reference< form::binding::XListEntrySink > xEntrySink( _xProps, UNO_QUERY );
-- if ( xEntrySink.is() )
-- {
-- Reference< beans::XPropertySet > xListSource( xEntrySink->getListEntrySource(), UNO_QUERY );
-- if ( xListSource.is() )
-- {
-- try
-- {
-- Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellRangeAddressConversion" )), uno::UNO_QUERY );
--
-- table::CellRangeAddress aAddress;
-- xListSource->getPropertyValue( OUSTR( "CellRange" ) ) >>= aAddress;
--
-- rtl::OUString sAddress;
-- xConvertor->setPropertyValue( OUSTR("Address"), makeAny( aAddress ) );
-- xConvertor->getPropertyValue( OUSTR("PersistentRepresentation") ) >>= sAddress;
-- OSL_TRACE("**** cell range source list %s",
-- rtl::OUStringToOString( sAddress, RTL_TEXTENCODING_UTF8 ).getStr() );
-- if ( sAddress.getLength() > 0 )
-- rModel.addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":source-cell-range"), sAddress );
-- }
-- catch( uno::Exception& )
-- {
-- }
-- }
-- }
--
--}
- static inline bool readBorderProps(
- ElementDescriptor * element, Style & style )
- {
-@@ -138,7 +70,9 @@ static inline bool readFontProps( ElementDescriptor * element, Style & style )
- void ElementDescriptor::readMultiPageModel( StyleBag * all_styles )
- {
- // collect styles
-- Style aStyle( 0x2 | 0x8 | 0x20 );
-+ Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
-+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
-+ aStyle._set |= 0x1;
- if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
- aStyle._set |= 0x2;
- if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
-@@ -153,24 +87,101 @@ void ElementDescriptor::readMultiPageModel( StyleBag * all_styles )
-
- // collect elements
- readDefaults();
-- readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ),
-+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiPageValue") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
-- readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) );
-+ Any aDecorationAny( _xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Decoration") ) ) );
-+ bool bDecoration = sal_True;
-+ if ( (aDecorationAny >>= bDecoration) && !bDecoration )
-+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":withtabs") ), OUString( RTL_CONSTASCII_USTRINGPARAM("false") ) );
-+
-+ readEvents();
-+ uno::Reference< container::XNameContainer > xPagesContainer( _xProps, uno::UNO_QUERY );
-+ if ( xPagesContainer.is() && xPagesContainer->getElementNames().getLength() )
-+ {
-+ ElementDescriptor * pElem = new ElementDescriptor( _xProps, _xPropState, OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":bulletinboard") ), _xDocument );
-+ pElem->readBullitinBoard( all_styles );
-+ addSubElement( pElem );
-+ }
-+}
-+//__________________________________________________________________________________________________
-+void ElementDescriptor::readFrameModel( StyleBag * all_styles )
-+{
-+ // collect styles
-+ Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
-+/*
-+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
-+ aStyle._set |= 0x1;
-+*/
-+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
-+ aStyle._set |= 0x2;
-+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
-+ aStyle._set |= 0x20;
-+ if (readFontProps( this, aStyle ))
-+ aStyle._set |= 0x8;
-+ if (aStyle._set)
-+ {
-+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
-+ all_styles->getStyleId( aStyle ) );
-+ }
-
-+ // collect elements
-+ readDefaults();
- OUString aTitle;
-+
- if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ) ) >>= aTitle)
- {
- ElementDescriptor * title = new ElementDescriptor(
- _xProps, _xPropState,
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ) );
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ), _xDocument );
- title->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ),
- aTitle );
- addSubElement( title );
- }
-
-+ uno::Reference< container::XNameContainer > xControlContainer( _xProps, uno::UNO_QUERY );
-+ if ( xControlContainer.is() && xControlContainer->getElementNames().getLength() )
-+ {
-+ ElementDescriptor * pElem = new ElementDescriptor( _xProps, _xPropState, OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":bulletinboard") ), _xDocument );
-+ pElem->readBullitinBoard( all_styles );
-+ addSubElement( pElem );
-+ }
- readEvents();
- }
-+//__________________________________________________________________________________________________
-+void ElementDescriptor::readPageModel( StyleBag * all_styles )
-+{
-+ // collect styles
-+ Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
-+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
-+ aStyle._set |= 0x1;
-+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
-+ aStyle._set |= 0x2;
-+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
-+ aStyle._set |= 0x20;
-+ if (readFontProps( this, aStyle ))
-+ aStyle._set |= 0x8;
-+ if (aStyle._set)
-+ {
-+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
-+ all_styles->getStyleId( aStyle ) );
-+ }
-+
-+ // collect elements
-+ readDefaults();
-+ rtl::OUString aTitle;
-+ readStringAttr(
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ) );
-+ uno::Reference< container::XNameContainer > xControlContainer( _xProps, uno::UNO_QUERY );
-+ if ( xControlContainer.is() && xControlContainer->getElementNames().getLength() )
-+ {
-+ ElementDescriptor * pElem = new ElementDescriptor( _xProps, _xPropState, OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":bulletinboard") ), _xDocument );
-+ pElem->readBullitinBoard( all_styles );
-+ addSubElement( pElem );
-+ }
-+ readEvents();
-+}
-+
- void ElementDescriptor::readButtonModel( StyleBag * all_styles )
- SAL_THROW( (Exception) )
- {
-@@ -204,8 +215,10 @@ void ElementDescriptor::readButtonModel( StyleBag * all_styles )
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":valign") ) );
- readButtonTypeAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("PushButtonType") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":button-type") ) );
-- readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
-+ readImageURLAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) );
-+
-+
- readImagePositionAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-position") ) );
- readImageAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageAlign") ),
-@@ -275,7 +288,7 @@ void ElementDescriptor::readCheckBoxModel( StyleBag * all_styles )
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
- readVerticalAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":valign") ) );
-- readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
-+ readImageURLAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) );
- readImagePositionAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-position") ) );
-@@ -312,7 +325,7 @@ void ElementDescriptor::readCheckBoxModel( StyleBag * all_styles )
- readEvents();
- }
- //__________________________________________________________________________________________________
--void ElementDescriptor::readComboBoxModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
-+void ElementDescriptor::readComboBoxModel( StyleBag * all_styles )
- SAL_THROW( (Exception) )
- {
- // collect styles
-@@ -353,8 +366,10 @@ void ElementDescriptor::readComboBoxModel( StyleBag * all_styles, Reference< fra
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxlength") ) );
- readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linecount") ) );
-- // Cell Range, Ref Cell etc.
-- lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
-+
-+ readDataAwareAttr( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell") );
-+ readDataAwareAttr( OUSTR( XMLNS_DIALOGS_PREFIX ":source-cell-range") );
-+
- // string item list
- Sequence< OUString > itemValues;
- if ((readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ) ) >>= itemValues) &&
-@@ -362,14 +377,14 @@ void ElementDescriptor::readComboBoxModel( StyleBag * all_styles, Reference< fra
- {
- ElementDescriptor * popup = new ElementDescriptor(
- _xProps, _xPropState,
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menupopup") ) );
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menupopup") ), _xDocument );
-
- OUString const * pItemValues = itemValues.getConstArray();
- for ( sal_Int32 nPos = 0; nPos < itemValues.getLength(); ++nPos )
- {
- ElementDescriptor * item = new ElementDescriptor(
- _xProps, _xPropState,
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menuitem") ) );
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menuitem") ), _xDocument );
- item->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ),
- pItemValues[ nPos ] );
- popup->addSubElement( item );
-@@ -380,7 +395,7 @@ void ElementDescriptor::readComboBoxModel( StyleBag * all_styles, Reference< fra
- readEvents();
- }
- //__________________________________________________________________________________________________
--void ElementDescriptor::readListBoxModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
-+void ElementDescriptor::readListBoxModel( StyleBag * all_styles )
- SAL_THROW( (Exception) )
- {
- // collect styles
-@@ -415,7 +430,8 @@ void ElementDescriptor::readListBoxModel( StyleBag * all_styles, Reference< fram
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linecount") ) );
- readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
-- lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
-+ readDataAwareAttr( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell") );
-+ readDataAwareAttr( OUSTR( XMLNS_DIALOGS_PREFIX ":source-cell-range") );
- // string item list
- Sequence< OUString > itemValues;
- if ((readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ) ) >>= itemValues) &&
-@@ -423,7 +439,7 @@ void ElementDescriptor::readListBoxModel( StyleBag * all_styles, Reference< fram
- {
- ElementDescriptor * popup = new ElementDescriptor(
- _xProps, _xPropState,
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menupopup") ) );
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menupopup") ), _xDocument );
-
- OUString const * pItemValues = itemValues.getConstArray();
- sal_Int32 nPos;
-@@ -431,7 +447,7 @@ void ElementDescriptor::readListBoxModel( StyleBag * all_styles, Reference< fram
- {
- ElementDescriptor * item = new ElementDescriptor(
- _xProps, _xPropState,
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menuitem") ) );
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menuitem") ), _xDocument );
- item->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ),
- pItemValues[ nPos ] );
- popup->addSubElement( item );
-@@ -455,7 +471,7 @@ void ElementDescriptor::readListBoxModel( StyleBag * all_styles, Reference< fram
- readEvents();
- }
- //__________________________________________________________________________________________________
--void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
-+void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles )
- SAL_THROW( (Exception) )
- {
- // collect styles
-@@ -486,14 +502,12 @@ void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles, Reference<
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
- readVerticalAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":valign") ) );
-- readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
-+ readImageURLAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) );
- readImagePositionAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-position") ) );
- readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multiline") ) );
-- readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("GroupName") ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":group-name") ) );
-
- sal_Int16 nState = 0;
- if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ) ) >>= nState)
-@@ -513,7 +527,7 @@ void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles, Reference<
- break;
- }
- }
-- lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
-+ readDataAwareAttr( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell") );
- readEvents();
- }
- //__________________________________________________________________________________________________
-@@ -542,7 +556,7 @@ void ElementDescriptor::readGroupBoxModel( StyleBag * all_styles )
- {
- ElementDescriptor * title = new ElementDescriptor(
- _xProps, _xPropState,
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ) );
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ), _xDocument );
- title->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ),
- aTitle );
- addSubElement( title );
-@@ -686,7 +700,7 @@ void ElementDescriptor::readEditModel( StyleBag * all_styles )
- readEvents();
- }
- //__________________________________________________________________________________________________
--void ElementDescriptor::readImageControlModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
-+void ElementDescriptor::readImageControlModel( StyleBag * all_styles )
- SAL_THROW( (Exception) )
- {
- // collect styles
-@@ -705,33 +719,11 @@ void ElementDescriptor::readImageControlModel( StyleBag * all_styles, com::sun::
- readDefaults();
- readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleImage") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":scale-image") ) );
-- rtl::OUString sURL;
-- _xProps->getPropertyValue( OUSTR("ImageURL") ) >>= sURL;
-
-- if ( sURL.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.GraphicObject:" ) ) ) == 0 )
-- {
-- Reference< document::XStorageBasedDocument > xDocStorage( xDocument, UNO_QUERY );
--
-- if ( xDocStorage.is() )
-- {
-- uno::Sequence< Any > aArgs( 1 );
-- aArgs[ 0 ] <<= xDocStorage->getDocumentStorage();
--
-- ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
-- uno::Reference< document::XGraphicObjectResolver > xGraphicResolver;
-- aContext.createComponentWithArguments( OUSTR( "com.sun.star.comp.Svx.GraphicExportHelper" ), aArgs, xGraphicResolver );
-- if ( xGraphicResolver.is() )
-- {
-- sURL = xGraphicResolver->resolveGraphicObjectURL( sURL );
-- }
-- }
-- }
-- if ( sURL.getLength() > 0 )
-- {
-- addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":src"), sURL );
-- }
- readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
-+ readImageURLAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":src") ) );
- readEvents();
- }
- //__________________________________________________________________________________________________
-@@ -1151,6 +1143,45 @@ void ElementDescriptor::readFormattedFieldModel( StyleBag * all_styles )
-
- readEvents();
- }
-+
-+void ElementDescriptor::readSpinButtonModel( StyleBag * all_styles )
-+ SAL_THROW( (Exception) )
-+{
-+ // collect styles
-+ Style aStyle( 0x1 | 0x4 );
-+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
-+ aStyle._set |= 0x1;
-+ if (readBorderProps( this, aStyle ))
-+ aStyle._set |= 0x4;
-+ if (aStyle._set)
-+ {
-+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
-+ all_styles->getStyleId( aStyle ) );
-+ }
-+
-+ // collect elements
-+ readDefaults();
-+ readOrientationAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
-+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinIncrement") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":increment") ) );
-+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValue") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":curval") ) );
-+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValueMax") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxval") ) );
-+ readLongAttr( OUSTR("SpinValueMin"),
-+ OUSTR(XMLNS_DIALOGS_PREFIX ":minval") );
-+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Repeat") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":repeat") ) );
-+ readLongAttr( OUSTR("RepeatDelay"), OUSTR(XMLNS_DIALOGS_PREFIX ":repeat-delay") );
-+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
-+ readHexLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":symbol-color") ) );
-+ readDataAwareAttr( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell") );
-+ readEvents();
-+}
-+
- //__________________________________________________________________________________________________
- void ElementDescriptor::readFixedLineModel( StyleBag * all_styles )
- SAL_THROW( (Exception) )
-@@ -1206,7 +1237,7 @@ void ElementDescriptor::readProgressBarModel( StyleBag * all_styles )
- readEvents();
- }
- //__________________________________________________________________________________________________
--void ElementDescriptor::readScrollBarModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
-+void ElementDescriptor::readScrollBarModel( StyleBag * all_styles )
- SAL_THROW( (Exception) )
- {
- // collect styles
-@@ -1244,47 +1275,7 @@ void ElementDescriptor::readScrollBarModel( StyleBag * all_styles, Reference< fr
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":live-scroll") ) );
- readHexLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":symbol-color") ) );
-- // Cell Range, Ref Cell etc.
-- lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
-- readEvents();
--}
--//__________________________________________________________________________________________________
--void ElementDescriptor::readSpinButtonModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
-- SAL_THROW( (Exception) )
--{
-- // collect styles
-- Style aStyle( 0x1 | 0x4 );
-- if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
-- aStyle._set |= 0x1;
-- if (readBorderProps( this, aStyle ))
-- aStyle._set |= 0x4;
-- if (aStyle._set)
-- {
-- addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
-- all_styles->getStyleId( aStyle ) );
-- }
--
-- // collect elements
-- readDefaults();
-- readOrientationAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
-- readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinIncrement") ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":increment") ) );
-- readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValue") ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":curval") ) );
-- readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValueMax") ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxval") ) );
-- readLongAttr( OUSTR("SpinValueMin"),
-- OUSTR(XMLNS_DIALOGS_PREFIX ":minval") );
-- readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Repeat") ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":repeat") ) );
-- readLongAttr( OUSTR("RepeatDelay"), OUSTR(XMLNS_DIALOGS_PREFIX ":repeat-delay") );
-- readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
-- readHexLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":symbol-color") ) );
-- // Cell Range, Ref Cell etc.
-- lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
-+ readDataAwareAttr( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell") );
- readEvents();
- }
- //__________________________________________________________________________________________________
-@@ -1334,12 +1325,256 @@ void ElementDescriptor::readDialogModel( StyleBag * all_styles )
- addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":withtitlebar") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("false") ) );
-
-- readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
-+ readImageURLAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) );
-
- readEvents();
- }
-
-+void ElementDescriptor::readBullitinBoard( StyleBag * all_styles )
-+ SAL_THROW( (Exception) )
-+{
-+ // collect elements
-+ ::std::vector< ElementDescriptor* > all_elements;
-+ // read out all props
-+ Reference< container::XNameContainer > xDialogModel( _xProps, UNO_QUERY );
-+ if ( !xDialogModel.is() )
-+ return; // #TODO throw???
-+ Sequence< OUString > aElements( xDialogModel->getElementNames() );
-+ OUString const * pElements = aElements.getConstArray();
-+
-+ ElementDescriptor * pRadioGroup = 0;
-+
-+ sal_Int32 nPos;
-+ for ( nPos = 0; nPos < aElements.getLength(); ++nPos )
-+ {
-+ Any aControlModel( xDialogModel->getByName( pElements[ nPos ] ) );
-+ Reference< beans::XPropertySet > xProps;
-+ OSL_VERIFY( aControlModel >>= xProps );
-+ if (! xProps.is())
-+ continue;
-+ Reference< beans::XPropertyState > xPropState( xProps, UNO_QUERY );
-+ OSL_ENSURE( xPropState.is(), "no XPropertyState!" );
-+ if (! xPropState.is())
-+ continue;
-+ Reference< lang::XServiceInfo > xServiceInfo( xProps, UNO_QUERY );
-+ OSL_ENSURE( xServiceInfo.is(), "no XServiceInfo!" );
-+ if (! xServiceInfo.is())
-+ continue;
-+
-+ ElementDescriptor * pElem = 0;
-+
-+ // group up radio buttons
-+ if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) ) )
-+ {
-+ if (! pRadioGroup) // open radiogroup
-+ {
-+ pRadioGroup = new ElementDescriptor(
-+ xProps, xPropState,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":radiogroup") ), _xDocument );
-+ all_elements.push_back( pRadioGroup );
-+ }
-+
-+ pElem = new ElementDescriptor(
-+ xProps, xPropState,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":radio") ), _xDocument );
-+ pElem->readRadioButtonModel( all_styles );
-+ pRadioGroup->addSubElement( pElem );
-+ }
-+ else // no radio
-+ {
-+ pRadioGroup = 0; // close radiogroup
-+
-+ if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlButtonModel") ) ) )
-+ {
-+ pElem = new ElementDescriptor(
-+ xProps, xPropState,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":button") ), _xDocument );
-+ pElem->readButtonModel( all_styles );
-+ }
-+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCheckBoxModel") ) ) )
-+ {
-+ pElem = new ElementDescriptor(
-+ xProps, xPropState,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":checkbox") ), _xDocument );
-+ pElem->readCheckBoxModel( all_styles );
-+ }
-+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ) ) )
-+ {
-+ pElem = new ElementDescriptor(
-+ xProps, xPropState,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":combobox") ), _xDocument );
-+ pElem->readComboBoxModel( all_styles );
-+ }
-+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) ) )
-+ {
-+ pElem = new ElementDescriptor(
-+ xProps, xPropState,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menulist") ), _xDocument );
-+ pElem->readListBoxModel( all_styles );
-+ }
-+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) ) )
-+ {
-+ pElem = new ElementDescriptor(
-+ xProps, xPropState,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":titledbox") ), _xDocument );
-+ pElem->readGroupBoxModel( all_styles );
-+ }
-+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoMultiPageModel") ) ) )
-+ {
-+ pElem = new ElementDescriptor(
-+ xProps, xPropState,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multipage") ), _xDocument );
-+ pElem->readMultiPageModel( all_styles );
-+ }
-+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoFrameModel") ) ) )
-+ {
-+ pElem = new ElementDescriptor(
-+ xProps, xPropState,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":frame") ), _xDocument );
-+ pElem->readFrameModel( all_styles );
-+ }
-+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoPageModel") ) ) )
-+ {
-+ pElem = new ElementDescriptor(
-+ xProps, xPropState,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":page") ), _xDocument );
-+ pElem->readPageModel( all_styles );
-+ }
-+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedTextModel") ) ) )
-+ {
-+ pElem = new ElementDescriptor(
-+ xProps, xPropState,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":text") ), _xDocument );
-+ pElem->readFixedTextModel( all_styles );
-+ }
-+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlEditModel") ) ) )
-+ {
-+ pElem = new ElementDescriptor(
-+ xProps, xPropState,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":textfield") ), _xDocument );
-+ pElem->readEditModel( all_styles );
-+ }
-+ // FixedHyperLink
-+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedHyperlinkModel") ) ) )
-+ {
-+ pElem = new ElementDescriptor(
-+ xProps, xPropState,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linklabel") ), _xDocument );
-+ pElem->readFixedHyperLinkModel( all_styles );
-+ }
-+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlImageControlModel") ) ) )
-+ {
-+ pElem = new ElementDescriptor(
-+ xProps, xPropState,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":img") ), _xDocument );
-+ pElem->readImageControlModel( all_styles );
-+ }
-+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFileControlModel") ) ) )
-+ {
-+ pElem = new ElementDescriptor(
-+ xProps, xPropState,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":filecontrol") ), _xDocument );
-+ pElem->readFileControlModel( all_styles );
-+ }
-+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.tree.TreeControlModel") ) ) )
-+ {
-+ pElem = new ElementDescriptor(
-+ xProps, xPropState,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":treecontrol") ), _xDocument );
-+ pElem->readTreeControlModel( all_styles );
-+ }
-+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCurrencyFieldModel") ) ) )
-+ {
-+ pElem = new ElementDescriptor(
-+ xProps, xPropState,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":currencyfield") ), _xDocument );
-+ pElem->readCurrencyFieldModel( all_styles );
-+ }
-+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlDateFieldModel") ) ) )
-+ {
-+ pElem = new ElementDescriptor(
-+ xProps, xPropState,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":datefield") ), _xDocument );
-+ pElem->readDateFieldModel( all_styles );
-+ }
-+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlNumericFieldModel") ) ) )
-+ {
-+ pElem = new ElementDescriptor(
-+ xProps, xPropState,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":numericfield") ), _xDocument );
-+ pElem->readNumericFieldModel( all_styles );
-+ }
-+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlTimeFieldModel") ) ) )
-+ {
-+ pElem = new ElementDescriptor(
-+ xProps, xPropState,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":timefield") ) , _xDocument);
-+ pElem->readTimeFieldModel( all_styles );
-+ }
-+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlPatternFieldModel") ) ) )
-+ {
-+ pElem = new ElementDescriptor(
-+ xProps, xPropState,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":patternfield") ), _xDocument );
-+ pElem->readPatternFieldModel( all_styles );
-+ }
-+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFormattedFieldModel") ) ) )
-+ {
-+ pElem = new ElementDescriptor(
-+ xProps, xPropState,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":formattedfield") ), _xDocument );
-+ pElem->readFormattedFieldModel( all_styles );
-+ }
-+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedLineModel") ) ) )
-+ {
-+ pElem = new ElementDescriptor(
-+ xProps, xPropState,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":fixedline") ), _xDocument );
-+ pElem->readFixedLineModel( all_styles );
-+ }
-+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlScrollBarModel") ) ) )
-+ {
-+ pElem = new ElementDescriptor(
-+ xProps, xPropState,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":scrollbar") ), _xDocument );
-+ pElem->readScrollBarModel( all_styles );
-+ }
-+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlSpinButtonModel") ) ) )
-+ {
-+ pElem = new ElementDescriptor(
-+ xProps, xPropState,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spinbutton") ), _xDocument );
-+ pElem->readSpinButtonModel( all_styles );
-+ }
-+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlProgressBarModel") ) ) )
-+ {
-+ pElem = new ElementDescriptor(
-+ xProps, xPropState,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":progressmeter") ), _xDocument );
-+ pElem->readProgressBarModel( all_styles );
-+ }
-+ //
-+
-+ if (pElem)
-+ {
-+ all_elements.push_back( pElem );
-+ }
-+ else
-+ {
-+ OSL_ENSURE( sal_False, "unknown control type!" );
-+ continue;
-+ }
-+ }
-+ }
-+ if (! all_elements.empty())
-+ {
-+ for ( std::size_t n = 0; n < all_elements.size(); ++n )
-+ {
-+ addSubElement( all_elements[ n ] );
-+ }
-+ }
-+}
- }
-
- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
-diff --git xmlscript/source/xmldlg_imexp/xmldlg_export.cxx xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
-index 36c3a2d..0df9b16 100644
---- xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
-+++ xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
-@@ -47,6 +47,8 @@
- #include <com/sun/star/awt/PushButtonType.hpp>
- #include <com/sun/star/awt/VisualEffect.hpp>
-
-+#include <com/sun/star/io/XPersistObject.hpp>
-+
- #include <com/sun/star/script/XScriptEventsSupplier.hpp>
- #include <com/sun/star/script/ScriptEventDescriptor.hpp>
-
-@@ -58,6 +60,17 @@
-
- #include <com/sun/star/view/SelectionType.hpp>
-
-+#include <com/sun/star/form/binding/XListEntrySink.hpp>
-+#include <com/sun/star/form/binding/XBindableValue.hpp>
-+#include <com/sun/star/form/binding/XValueBinding.hpp>
-+#include <com/sun/star/table/CellAddress.hpp>
-+#include <com/sun/star/table/CellRangeAddress.hpp>
-+#include <com/sun/star/lang/XServiceInfo.hpp>
-+#include <com/sun/star/document/XStorageBasedDocument.hpp>
-+#include <com/sun/star/document/XGraphicObjectResolver.hpp>
-+
-+#include <comphelper/componentcontext.hxx>
-+#include <comphelper/processfactory.hxx>
-
- using namespace ::com::sun::star;
- using namespace ::com::sun::star::uno;
-@@ -777,6 +790,33 @@ void ElementDescriptor::readVerticalAlignAttr( OUString const & rPropName, OUStr
- }
- }
- //__________________________________________________________________________________________________
-+void ElementDescriptor::readImageURLAttr( OUString const & rPropName, OUString const & rAttrName )
-+{
-+ if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName ))
-+ {
-+ rtl::OUString sURL;
-+ _xProps->getPropertyValue( rPropName ) >>= sURL;
-+
-+ if ( sURL.getLength() && sURL.compareToAscii( XMLSCRIPT_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( XMLSCRIPT_GRAPHOBJ_URLPREFIX ) ) == 0 )
-+ {
-+ Reference< document::XStorageBasedDocument > xDocStorage( _xDocument, UNO_QUERY );
-+ if ( xDocStorage.is() )
-+ {
-+ uno::Sequence< Any > aArgs( 1 );
-+ aArgs[ 0 ] <<= xDocStorage->getDocumentStorage();
-+
-+ ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
-+ uno::Reference< document::XGraphicObjectResolver > xGraphicResolver;
-+ aContext.createComponentWithArguments( OUSTR( "com.sun.star.comp.Svx.GraphicExportHelper" ), aArgs, xGraphicResolver );
-+ if ( xGraphicResolver.is() )
-+ sURL = xGraphicResolver->resolveGraphicObjectURL( sURL );
-+ }
-+ }
-+ if ( sURL.getLength() )
-+ addAttribute( rAttrName, sURL );
-+ }
-+}
-+//__________________________________________________________________________________________________
- void ElementDescriptor::readImageAlignAttr( OUString const & rPropName, OUString const & rAttrName )
- {
- if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName ))
-@@ -940,6 +980,66 @@ void ElementDescriptor::readLineEndFormatAttr( OUString const & rPropName, OUStr
- }
- }
- //__________________________________________________________________________________________________
-+void ElementDescriptor::readDataAwareAttr( OUString const & rAttrName )
-+{
-+ Reference< lang::XMultiServiceFactory > xFac;
-+ if ( _xDocument.is() )
-+ xFac.set( _xDocument, uno::UNO_QUERY );
-+
-+ Reference< form::binding::XBindableValue > xBinding( _xProps, UNO_QUERY );
-+
-+ if ( xFac.is() && xBinding.is() && rAttrName.equals( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell") ) )
-+ {
-+ try
-+ {
-+ Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellAddressConversion" )), uno::UNO_QUERY );
-+ Reference< beans::XPropertySet > xBindable( xBinding->getValueBinding(), UNO_QUERY );
-+ if ( xBindable.is() )
-+ {
-+ table::CellAddress aAddress;
-+ xBindable->getPropertyValue( OUSTR("BoundCell") ) >>= aAddress;
-+ xConvertor->setPropertyValue( OUSTR("Address"), makeAny( aAddress ) );
-+ rtl::OUString sAddress;
-+ xConvertor->getPropertyValue( OUSTR("PersistentRepresentation") ) >>= sAddress;
-+ if ( sAddress.getLength() > 0 )
-+ addAttribute( rAttrName, sAddress );
-+
-+ OSL_TRACE( "*** Bindable value %s", rtl::OUStringToOString( sAddress, RTL_TEXTENCODING_UTF8 ).getStr() );
-+
-+ }
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+ }
-+ Reference< form::binding::XListEntrySink > xEntrySink( _xProps, UNO_QUERY );
-+ if ( xEntrySink.is() && rAttrName.equals( OUSTR( XMLNS_DIALOGS_PREFIX ":source-cell-range") ) )
-+ {
-+ Reference< beans::XPropertySet > xListSource( xEntrySink->getListEntrySource(), UNO_QUERY );
-+ if ( xListSource.is() )
-+ {
-+ try
-+ {
-+ Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellRangeAddressConversion" )), uno::UNO_QUERY );
-+
-+ table::CellRangeAddress aAddress;
-+ xListSource->getPropertyValue( OUSTR( "CellRange" ) ) >>= aAddress;
-+
-+ rtl::OUString sAddress;
-+ xConvertor->setPropertyValue( OUSTR("Address"), makeAny( aAddress ) );
-+ xConvertor->getPropertyValue( OUSTR("PersistentRepresentation") ) >>= sAddress;
-+ OSL_TRACE("**** cell range source list %s",
-+ rtl::OUStringToOString( sAddress, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ if ( sAddress.getLength() > 0 )
-+ addAttribute( rAttrName, sAddress );
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+ }
-+ }
-+}
-+//__________________________________________________________________________________________________
- void ElementDescriptor::readSelectionTypeAttr( OUString const & rPropName, OUString const & rAttrName )
- {
- if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName ))
-@@ -976,6 +1076,28 @@ void ElementDescriptor::readSelectionTypeAttr( OUString const & rPropName, OUStr
- void ElementDescriptor::readDefaults( bool supportPrintable, bool supportVisible )
- {
- Any a( _xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ) ) );
-+
-+ // The following is a hack to allow 'form' controls to override the default
-+ // control supported by dialogs. This should work well for both vba support and
-+ // normal openoffice ( when normal 'Dialogs' decide to support form control models )
-+ // In the future VBA support might require custom models ( and not the just the form
-+ // variant of a control that we currently use ) In this case the door is still open,
-+ // we just need to define a new way for the 'ServiceName' to be extracted from the
-+ // incomming model. E.g. the use of supporting service
-+ // "com.sun.star.form.FormComponent", 'ServiceName' and XPersistObject
-+ // is only an implementation detail here, in the future some other
-+ // method ( perhaps a custom prop ) could be used instead.
-+ Reference< lang::XServiceInfo > xSrvInfo( _xProps, UNO_QUERY );
-+ if ( xSrvInfo.is() && xSrvInfo->supportsService( OUSTR("com.sun.star.form.FormComponent" ) ) )
-+ {
-+ Reference< io::XPersistObject > xPersist( _xProps, UNO_QUERY );
-+ if ( xPersist.is() )
-+ {
-+ OUString sCtrlName = xPersist->getServiceName();
-+ if ( sCtrlName.getLength() )
-+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":control-implementation") ), sCtrlName );
-+ }
-+ }
- addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":id") ),
- * reinterpret_cast< const OUString * >( a.getValue() ) );
- readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("TabIndex") ),
-@@ -1326,253 +1448,21 @@ void StyleBag::dump( Reference< xml::sax::XExtendedDocumentHandler > const & xOu
- //==================================================================================================
- void SAL_CALL exportDialogModel(
- Reference< xml::sax::XExtendedDocumentHandler > const & xOut,
-- Reference< container::XNameContainer > const & xDialogModel,
-- Reference< frame::XModel > const & xDocument )
-+ Reference< container::XNameContainer > const & xDialogModel, Reference< frame::XModel > const & xDocument )
- SAL_THROW( (Exception) )
- {
- StyleBag all_styles;
-- ::std::vector< Reference< xml::sax::XAttributeList > > all_elements;
--
-- // read out all props
--
-- Sequence< OUString > aElements( xDialogModel->getElementNames() );
-- OUString const * pElements = aElements.getConstArray();
--
-- ElementDescriptor * pRadioGroup = 0;
--
-- sal_Int32 nPos;
-- for ( nPos = 0; nPos < aElements.getLength(); ++nPos )
-- {
-- Any aControlModel( xDialogModel->getByName( pElements[ nPos ] ) );
-- Reference< beans::XPropertySet > xProps;
-- OSL_VERIFY( aControlModel >>= xProps );
-- if (! xProps.is())
-- continue;
-+ // window
-+ Reference< beans::XPropertySet > xProps( xDialogModel, UNO_QUERY );
-+ OSL_ASSERT( xProps.is() );
- Reference< beans::XPropertyState > xPropState( xProps, UNO_QUERY );
-- OSL_ENSURE( xPropState.is(), "no XPropertyState!" );
-- if (! xPropState.is())
-- continue;
-- Reference< lang::XServiceInfo > xServiceInfo( xProps, UNO_QUERY );
-- OSL_ENSURE( xServiceInfo.is(), "no XServiceInfo!" );
-- if (! xServiceInfo.is())
-- continue;
--
-- ElementDescriptor * pElem = 0;
-- Reference< xml::sax::XAttributeList > xElem;
-+ OSL_ASSERT( xPropState.is() );
-
-- // group up radio buttons
-- if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) ) )
-- {
-- if (! pRadioGroup) // open radiogroup
-- {
-- pRadioGroup = new ElementDescriptor(
-- xProps, xPropState,
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":radiogroup") ) );
-- all_elements.push_back( pRadioGroup );
-- }
--
-- pElem = new ElementDescriptor(
-- xProps, xPropState,
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":radio") ) );
-- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readRadioButtonModel( &all_styles, xDocument );
-- pRadioGroup->addSubElement( xElem );
-- }
-- else // no radio
-- {
-- pRadioGroup = 0; // close radiogroup
--
-- if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlButtonModel") ) ) )
-- {
-- pElem = new ElementDescriptor(
-- xProps, xPropState,
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":button") ) );
-- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readButtonModel( &all_styles );
-- }
-- else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCheckBoxModel") ) ) )
-- {
-- pElem = new ElementDescriptor(
-- xProps, xPropState,
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":checkbox") ) );
-- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readCheckBoxModel( &all_styles );
-- }
-- else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ) ) )
-- {
-- pElem = new ElementDescriptor(
-- xProps, xPropState,
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":combobox") ) );
-- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readComboBoxModel( &all_styles, xDocument );
-- }
-- else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) ) )
-- {
-- pElem = new ElementDescriptor(
-+ ElementDescriptor * pElem = new ElementDescriptor(
- xProps, xPropState,
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menulist") ) );
-- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readListBoxModel( &all_styles, xDocument );
-- }
-- else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) ) )
-- {
-- pElem = new ElementDescriptor(
-- xProps, xPropState,
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":titledbox") ) );
-- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readGroupBoxModel( &all_styles );
-- }
-- else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoMultiPageModel") ) ) )
-- {
-- pElem = new ElementDescriptor(
-- xProps, xPropState,
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multipage") ) );
-- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readMultiPageModel( &all_styles );
-- }
-- else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedTextModel") ) ) )
-- {
-- pElem = new ElementDescriptor(
-- xProps, xPropState,
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":text") ) );
-- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readFixedTextModel( &all_styles );
-- }
-- else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlEditModel") ) ) )
-- {
-- pElem = new ElementDescriptor(
-- xProps, xPropState,
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":textfield") ) );
-- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readEditModel( &all_styles );
-- }
-- // FixedHyperLink
-- else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedHyperlinkModel") ) ) )
-- {
-- pElem = new ElementDescriptor(
-- xProps, xPropState,
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linklabel") ) );
-- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readFixedHyperLinkModel( &all_styles );
-- }
-- else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlImageControlModel") ) ) )
-- {
-- pElem = new ElementDescriptor(
-- xProps, xPropState,
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":img") ) );
-- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readImageControlModel( &all_styles, xDocument );
-- }
-- else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFileControlModel") ) ) )
-- {
-- pElem = new ElementDescriptor(
-- xProps, xPropState,
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":filecontrol") ) );
-- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readFileControlModel( &all_styles );
-- }
-- else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.tree.TreeControlModel") ) ) )
-- {
-- pElem = new ElementDescriptor(
-- xProps, xPropState,
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":treecontrol") ) );
-- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readTreeControlModel( &all_styles );
-- }
-- else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCurrencyFieldModel") ) ) )
-- {
-- pElem = new ElementDescriptor(
-- xProps, xPropState,
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":currencyfield") ) );
-- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readCurrencyFieldModel( &all_styles );
-- }
-- else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlDateFieldModel") ) ) )
-- {
-- pElem = new ElementDescriptor(
-- xProps, xPropState,
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":datefield") ) );
-- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readDateFieldModel( &all_styles );
-- }
-- else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlNumericFieldModel") ) ) )
-- {
-- pElem = new ElementDescriptor(
-- xProps, xPropState,
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":numericfield") ) );
-- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readNumericFieldModel( &all_styles );
-- }
-- else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlTimeFieldModel") ) ) )
-- {
-- pElem = new ElementDescriptor(
-- xProps, xPropState,
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":timefield") ) );
-- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readTimeFieldModel( &all_styles );
-- }
-- else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlPatternFieldModel") ) ) )
-- {
-- pElem = new ElementDescriptor(
-- xProps, xPropState,
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":patternfield") ) );
-- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readPatternFieldModel( &all_styles );
-- }
-- else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFormattedFieldModel") ) ) )
-- {
-- pElem = new ElementDescriptor(
-- xProps, xPropState,
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":formattedfield") ) );
-- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readFormattedFieldModel( &all_styles );
-- }
-- else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedLineModel") ) ) )
-- {
-- pElem = new ElementDescriptor(
-- xProps, xPropState,
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":fixedline") ) );
-- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readFixedLineModel( &all_styles );
-- }
-- else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlScrollBarModel") ) ) )
-- {
-- pElem = new ElementDescriptor(
-- xProps, xPropState,
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":scrollbar") ) );
-- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readScrollBarModel( &all_styles, xDocument );
-- }
-- else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlSpinButtonModel") ) ) )
-- {
-- pElem = new ElementDescriptor(
-- xProps, xPropState,
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spinbutton") ) );
-- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readSpinButtonModel( &all_styles, xDocument );
-- }
-- else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlProgressBarModel") ) ) )
-- {
-- pElem = new ElementDescriptor(
-- xProps, xPropState,
-- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":progressmeter") ) );
-- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readProgressBarModel( &all_styles );
-- }
-- //
--
-- OSL_ASSERT( xElem.is() );
-- if (xElem.is())
-- {
-- all_elements.push_back( xElem );
-- }
-- else
-- {
-- OSL_ENSURE( sal_False, "unknown control type!" );
-- continue;
-- }
-- }
-- }
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":bulletinboard") ), xDocument );
-+ Reference< xml::sax::XAttributeList > xElem( pElem );
-+ pElem->readBullitinBoard( &all_styles );
-
- xOut->startDocument();
-
-@@ -1582,14 +1472,9 @@ void SAL_CALL exportDialogModel(
- xOut->unknown( aDocTypeStr );
- xOut->ignorableWhitespace( OUString() );
-
-- // window
-- Reference< beans::XPropertySet > xProps( xDialogModel, UNO_QUERY );
-- OSL_ASSERT( xProps.is() );
-- Reference< beans::XPropertyState > xPropState( xProps, UNO_QUERY );
-- OSL_ASSERT( xPropState.is() );
-
- OUString aWindowName( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":window") );
-- ElementDescriptor * pWindow = new ElementDescriptor( xProps, xPropState, aWindowName );
-+ ElementDescriptor * pWindow = new ElementDescriptor( xProps, xPropState, aWindowName, xDocument );
- Reference< xml::sax::XAttributeList > xWindow( pWindow );
- pWindow->readDialogModel( &all_styles );
- xOut->ignorableWhitespace( OUString() );
-@@ -1599,20 +1484,14 @@ void SAL_CALL exportDialogModel(
- // dump out stylebag
- all_styles.dump( xOut );
-
-- if (! all_elements.empty())
-+ if ( xDialogModel->getElementNames().getLength() )
- {
- // open up bulletinboard
- OUString aBBoardName( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":bulletinboard") );
- xOut->ignorableWhitespace( OUString() );
-- xOut->startElement( aBBoardName, Reference< xml::sax::XAttributeList >() );
--
-- // export control elements
-- for ( std::size_t n = 0; n < all_elements.size(); ++n )
-- {
-- ElementDescriptor * pElem = static_cast< ElementDescriptor * >( all_elements[ n ].get() );
-- pElem->dump( xOut.get() );
-- }
-+ xOut->startElement( aBBoardName, xElem );
-
-+ pElem->dumpSubElements( xOut.get() );
- // end bulletinboard
- xOut->ignorableWhitespace( OUString() );
- xOut->endElement( aBBoardName );
-diff --git xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
-index 4575baa..5db980f 100644
---- xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
-+++ xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
-@@ -29,38 +29,37 @@
- // MARKER(update_precomp.py): autogen include statement, do not remove
- #include "precompiled_xmlscript.hxx"
- #include "imp_share.hxx"
--#include <com/sun/star/form/binding/XBindableValue.hpp>
--#include <com/sun/star/form/binding/XValueBinding.hpp>
--#include <com/sun/star/form/binding/XListEntrySink.hpp>
--#include <com/sun/star/beans/NamedValue.hpp>
--#include <com/sun/star/table/CellAddress.hpp>
--#include <com/sun/star/table/CellRangeAddress.hpp>
-+
- #include <com/sun/star/beans/XPropertySet.hpp>
- #include <com/sun/star/beans/XPropertyState.hpp>
- #include <com/sun/star/document/XStorageBasedDocument.hpp>
--#include <com/sun/star/document/XGraphicObjectResolver.hpp>
--#include <com/sun/star/script/vba/XVBACompatibility.hpp>
--
--#include <comphelper/componentcontext.hxx>
--#include <comphelper/processfactory.hxx>
- using namespace ::com::sun::star;
- using namespace ::com::sun::star::uno;
- using ::rtl::OUString;
-
- namespace xmlscript
- {
--Reference< xml::input::XElement > MultiPage::startChildElement(
-+
-+Reference< xml::input::XElement > Frame::startChildElement(
- sal_Int32 nUid, OUString const & rLocalName,
- Reference< xml::input::XAttributes > const & xAttributes )
- throw (xml::sax::SAXException, RuntimeException)
- {
-+ if ( !m_xContainer.is() )
-+ m_xContainer.set( _pImport->_xDialogModelFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoFrameModel") ) ), UNO_QUERY );
- // event
--rtl::OUString _label = rtl::OUString::createFromAscii("foo");
- if (_pImport->isEventElement( nUid, rLocalName ))
- {
- return new EventElement(
- nUid, rLocalName, xAttributes, this, _pImport );
- }
-+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bulletinboard") ))
-+ {
-+ // Create new DialogImport for this container
-+ DialogImport* pFrameImport = new DialogImport( *_pImport );
-+ pFrameImport->_xDialogModel = m_xContainer;
-+ return new BulletinBoardElement( rLocalName, xAttributes, this, pFrameImport );
-+ }
- else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("title") ))
- {
- getStringAttr( &_label,
-@@ -74,7 +73,7 @@ rtl::OUString _label = rtl::OUString::createFromAscii("foo");
- }
- else
- {
--
-+ OSL_TRACE("****** ARGGGGG!!!! **********");
- throw xml::sax::SAXException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
- Reference< XInterface >(), Any() );
-@@ -82,13 +81,15 @@ rtl::OUString _label = rtl::OUString::createFromAscii("foo");
- }
- //__________________________________________________________________________________________________
-
--void MultiPage::endElement()
-+void Frame::endElement()
- throw (xml::sax::SAXException, RuntimeException)
- {
-- ControlImportContext ctx(
-- _pImport, getControlId( _xAttributes ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoMultiPageModel") ) );
--// OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) );
-+ if ( !m_xContainer.is() )
-+ m_xContainer.set( _pImport->_xDialogModelFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoFrameModel") ) ), UNO_QUERY );
-+ Reference< beans::XPropertySet > xProps( m_xContainer, UNO_QUERY_THROW );
-+ // _pImport is what we need to add to ( e.g. the dialog in this case )
-+ ControlImportContext ctx( _pImport, xProps, getControlId( _xAttributes ) );
-+
- Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
-
- Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
-@@ -101,122 +102,134 @@ void MultiPage::endElement()
- }
-
- ctx.importDefaults( 0, 0, _xAttributes ); // inherited from BulletinBoardElement
-- ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
-- _xAttributes );
-- ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ),
-- _xAttributes );
-+ if (_label.getLength())
-+ {
-+ xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
-+ makeAny( _label ) );
-+ }
- ctx.importEvents( _events );
- // avoid ring-reference:
- // vector< event elements > holding event elements holding this (via _pParent)
- _events.clear();
- }
-
--// #FIXME cut'n'pasted from xmloff/source/core/xmlimp.cxx:1251
--// of course we need to find a common home for this helper
--
--bool IsPackageURL( const ::rtl::OUString& rURL )
-+//===
-+Reference< xml::input::XElement > MultiPage::startChildElement(
-+ sal_Int32 nUid, OUString const & rLocalName,
-+ Reference< xml::input::XAttributes > const & xAttributes )
-+ throw (xml::sax::SAXException, RuntimeException)
- {
-- // Some quick tests: Some may rely on the package structure!
-- sal_Int32 nLen = rURL.getLength();
-- if( (nLen > 0 && '/' == rURL[0]) )
-- // RFC2396 net_path or abs_path
-- return false;
-- else if( nLen > 1 && '.' == rURL[0] )
-- {
-- if( '.' == rURL[1] )
-- // ../: We are never going up one level, so we know
-- // it's not an external URI
-- return false;
-- else if( '/' == rURL[1] )
-- // we are remaining on a level, so it's an package URI
-- return true;
-- }
--
-- // Now check for a RFC2396 schema
-- sal_Int32 nPos = 1;
-- while( nPos < nLen )
-- {
-- switch( rURL[nPos] )
-+ // event
-+rtl::OUString _label = rtl::OUString::createFromAscii("foo");
-+ if (_pImport->isEventElement( nUid, rLocalName ))
-+ {
-+ return new EventElement(
-+ nUid, rLocalName, xAttributes, this, _pImport );
-+ }
-+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bulletinboard") ))
- {
-- case '/':
-- // a relative path segement
-- return true;
-- case ':':
-- // a schema
-- return false;
-- default:
-- break;
-- // we don't care about any other characters
-- }
-- ++nPos;
-+ // Create new DialogImport for this container
-+
-+ DialogImport* pMultiPageImport = new DialogImport( *_pImport );
-+ pMultiPageImport->_xDialogModel = m_xContainer;
-+ return new BulletinBoardElement( rLocalName, xAttributes, this, pMultiPageImport );
- }
-+ else
-+ {
-
-- return true;
-+ throw xml::sax::SAXException(
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
-+ Reference< XInterface >(), Any() );
-+}
- }
-+//__________________________________________________________________________________________________
-
--void importBindableAndListRangeBits( DialogImport* _pImport, const rtl::OUString sLinkedCell, const rtl::OUString & sCellRange, ControlImportContext& ctx )
--{
-- Reference< lang::XMultiServiceFactory > xFac( _pImport->getDocOwner(), UNO_QUERY );
-- if ( xFac.is() && ( sLinkedCell.getLength() || sCellRange.getLength() ) )
-- {
-- // Set up Celllink
-- if ( sLinkedCell.getLength() )
-- {
-- Reference< form::binding::XBindableValue > xBindable( ctx.getControlModel(), uno::UNO_QUERY );
-- Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellAddressConversion" )), uno::UNO_QUERY );
-- if ( xBindable.is() && xConvertor.is() )
-+void MultiPage::endElement()
-+ throw (xml::sax::SAXException, RuntimeException)
- {
-- table::CellAddress aAddress;
-- xConvertor->setPropertyValue( OUSTR( "PersistentRepresentation" ), uno::makeAny( sLinkedCell ) );
-- xConvertor->getPropertyValue( OUSTR( "Address" ) ) >>= aAddress;
-- beans::NamedValue aArg1;
-- aArg1.Name = OUSTR("BoundCell");
-- aArg1.Value <<= aAddress;
--
-- uno::Sequence< uno::Any > aArgs(1);
-- aArgs[ 0 ] <<= aArg1;
--
-- uno::Reference< form::binding::XValueBinding > xBinding( xFac->createInstanceWithArguments( OUSTR("com.sun.star.table.CellValueBinding" ), aArgs ), uno::UNO_QUERY );
-- xBindable->setValueBinding( xBinding );
--
-+ Reference< beans::XPropertySet > xProps( m_xContainer, UNO_QUERY_THROW );
-+ // _pImport is what we need to add to ( e.g. the dialog in this case )
-+ ControlImportContext ctx( _pImport, xProps, getControlId( _xAttributes ));
-+
-+ Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
-+
-+ Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
-+ if (xStyle.is())
-+ {
-+ StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
-+ pStyle->importTextColorStyle( xControlModel );
-+ pStyle->importTextLineColorStyle( xControlModel );
-+ pStyle->importFontStyle( xControlModel );
-+ pStyle->importBackgroundColorStyle( xControlModel );
- }
-+
-+ ctx.importDefaults( 0, 0, _xAttributes ); // inherited from BulletinBoardElement
-+ ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiPageValue") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
-+ _xAttributes );
-+ ctx.importBooleanProperty(
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("Decoration") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("withtabs") ),
-+ _xAttributes );
-+ ctx.importEvents( _events );
-+ // avoid ring-reference:
-+ // vector< event elements > holding event elements holding this (via _pParent)
-+ _events.clear();
- }
-- // Set up CelllRange
-- if ( sCellRange.getLength() )
-+
-+Reference< xml::input::XElement > Page::startChildElement(
-+ sal_Int32 nUid, OUString const & rLocalName,
-+ Reference< xml::input::XAttributes > const & xAttributes )
-+ throw (xml::sax::SAXException, RuntimeException)
- {
-- Reference< form::binding::XListEntrySink > xListEntrySink( ctx.getControlModel(), uno::UNO_QUERY );
-- Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellRangeAddressConversion" )), uno::UNO_QUERY );
-- if ( xListEntrySink.is() && xConvertor.is() )
-+ // event
-+ if (_pImport->isEventElement( nUid, rLocalName ))
- {
-- table::CellRangeAddress aAddress;
-- xConvertor->setPropertyValue( OUSTR( "PersistentRepresentation" ), uno::makeAny( sCellRange ) );
-- xConvertor->getPropertyValue( OUSTR( "Address" ) ) >>= aAddress;
-- beans::NamedValue aArg1;
-- aArg1.Name = OUSTR("CellRange");
-- aArg1.Value <<= aAddress;
--
-- uno::Sequence< uno::Any > aArgs(1);
-- aArgs[ 0 ] <<= aArg1;
--
-- uno::Reference< form::binding::XListEntrySource > xSource( xFac->createInstanceWithArguments( OUSTR("com.sun.star.table.CellRangeListSource" ), aArgs ), uno::UNO_QUERY );
-- xListEntrySink->setListEntrySource( xSource );
--
-+ return new EventElement(
-+ nUid, rLocalName, xAttributes, this, _pImport );
- }
-+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bulletinboard") ))
-+ {
-+
-+ DialogImport* pPageImport = new DialogImport( *_pImport );
-+ pPageImport->_xDialogModel = m_xContainer;
-+ return new BulletinBoardElement( rLocalName, xAttributes, this, pPageImport );
- }
-+ else
-+ {
-+
-+ throw xml::sax::SAXException(
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
-+ Reference< XInterface >(), Any() );
- }
- }
-+//__________________________________________________________________________________________________
-
--sal_Bool isVBACompatibilityMode( DialogImport* _pImport )
-+void Page::endElement()
-+ throw (xml::sax::SAXException, RuntimeException)
- {
-- sal_Bool bVBAMode = sal_False;
-- Reference< script::vba::XVBACompatibility > xVBACompat( _pImport->getScriptLibraryContainer(), UNO_QUERY );
-- if( xVBACompat.is() )
-- {
-- bVBAMode = xVBACompat->getVBACompatibilityMode();
-- }
-- return bVBAMode;
-+ Reference< beans::XPropertySet > xProps( m_xContainer, UNO_QUERY_THROW );
-+
-+ ControlImportContext ctx( _pImport, xProps, getControlId( _xAttributes ));
-+
-+ Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
-+
-+ Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
-+ if (xStyle.is())
-+ {
-+ StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
-+ pStyle->importTextColorStyle( xControlModel );
-+ pStyle->importTextLineColorStyle( xControlModel );
-+ pStyle->importFontStyle( xControlModel );
-+ pStyle->importBackgroundColorStyle( xControlModel );
-+ }
-+
-+ ctx.importDefaults( 0, 0, _xAttributes ); // inherited from BulletinBoardElement
-+ ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ), OUString( RTL_CONSTASCII_USTRINGPARAM("title") ), _xAttributes );
-+ ctx.importEvents( _events );
-+ // avoid ring-reference:
-+ // vector< event elements > holding event elements holding this (via _pParent)
-+ _events.clear();
- }
-
- // progessmeter
-@@ -298,23 +311,9 @@ Reference< xml::input::XElement > ScrollBarElement::startChildElement(
- void ScrollBarElement::endElement()
- throw (xml::sax::SAXException, RuntimeException)
- {
-- OUString sService( OUSTR("com.sun.star.awt.UnoControlScrollBarModel") );
-- // we should probably limit this to vba mode also ( leave for now )
-- if ( isVBACompatibilityMode( _pImport ) )
-- sService = OUSTR("com.sun.star.form.component.ScrollBar");
--
-- OUString sLinkedCell;
-- try
-- {
-- sLinkedCell = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
-- }
-- catch( Exception& /*e*/ )
-- {
-- }
--
- ControlImportContext ctx(
- _pImport, getControlId( _xAttributes ),
-- sService );
-+ getControlModelName( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlScrollBarModel") ), _xAttributes ) );
-
- Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
- if (xStyle.is())
-@@ -358,10 +357,7 @@ void ScrollBarElement::endElement()
- OUString( RTL_CONSTASCII_USTRINGPARAM("symbol-color") ),
- _xAttributes );
-
-- // import cell-link
-- OUString sCellRange;
-- importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
--
-+ ctx.importDataAwareProperty( OUSTR("linked-cell" ), _xAttributes );
- ctx.importEvents( _events );
- // avoid ring-reference:
- // vector< event elements > holding event elements holding this (via _pParent)
-@@ -393,18 +389,9 @@ Reference< xml::input::XElement > SpinButtonElement::startChildElement(
- void SpinButtonElement::endElement()
- throw (xml::sax::SAXException, RuntimeException)
- {
-- OUString sLinkedCell;
-- try
-- {
-- sLinkedCell = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
-- }
-- catch( Exception& /*e*/ )
-- {
-- }
--
- ControlImportContext ctx(
- _pImport, getControlId( _xAttributes ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.SpinButton") ) );
-+ getControlModelName( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlSpinButtonModel") ), _xAttributes ) );
-
- Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
- if (xStyle.is())
-@@ -440,10 +427,7 @@ void SpinButtonElement::endElement()
- ctx.importHexLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("symbol-color") ),
- _xAttributes );
-- // import cell-link
-- OUString sCellRange;
-- importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
--
-+ ctx.importDataAwareProperty( OUSTR("linked-cell" ), _xAttributes );
- ctx.importEvents( _events );
- // avoid ring-reference:
- // vector< event elements > holding event elements holding this (via _pParent)
-@@ -451,7 +435,6 @@ void SpinButtonElement::endElement()
- }
-
- //##################################################################################################
--
- // fixedline
- //__________________________________________________________________________________________________
- Reference< xml::input::XElement > FixedLineElement::startChildElement(
-@@ -1282,37 +1265,7 @@ void ImageControlElement::endElement()
- ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleImage") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("scale-image") ),
- _xAttributes );
-- rtl::OUString sURL = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "src" ) );
-- Reference< document::XStorageBasedDocument > xDocStorage( _pImport->getDocOwner(), UNO_QUERY );
--
-- if ( xDocStorage.is() && IsPackageURL( sURL ) )
-- {
-- uno::Sequence< Any > aArgs( 1 );
-- aArgs[ 0 ] <<= xDocStorage->getDocumentStorage();
--
-- ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
-- uno::Reference< document::XGraphicObjectResolver > xGraphicResolver;
-- aContext.createComponentWithArguments( OUSTR( "com.sun.star.comp.Svx.GraphicImportHelper" ), aArgs, xGraphicResolver );
--
-- if ( xGraphicResolver.is() )
-- {
-- rtl::OUString aTmp( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.Package:" ) );
-- aTmp += sURL;
-- sURL = xGraphicResolver->resolveGraphicObjectURL( aTmp );
-- Reference< beans::XPropertySet > xProps( ctx.getControlModel(), UNO_QUERY );
-- // we must set the url while the graphic object ( held by the resolver is in scope )
-- if ( xProps.is() )
-- xProps->setPropertyValue( OUSTR("ImageURL"), makeAny( sURL ) );
-- }
-- }
--
-- else if ( sURL.getLength() > 0 )
-- {
-- Reference< beans::XPropertySet > xProps( ctx.getControlModel(), UNO_QUERY );
-- if ( xProps.is() )
-- xProps->setPropertyValue( OUSTR("ImageURL"), makeAny( sURL ) );
-- }
--
-+ ctx.importImageURLProperty( OUSTR( "ImageURL" ), OUSTR( "src" ), _xAttributes );
- ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
- _xAttributes );
-@@ -1645,24 +1598,10 @@ void TitledBoxElement::endElement()
- Reference< xml::input::XElement > xRadio( _radios[ nPos ] );
- Reference< xml::input::XAttributes > xAttributes(
- xRadio->getAttributes() );
-- OUString sLinkedCell;
-- OUString sCellRange;
-- OUString sService( OUSTR("com.sun.star.awt.UnoControlRadioButtonModel") );
-- try
-- {
-- sLinkedCell = xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
-- // we should probably limit this to vba mode also ( leave for now )
-- if ( isVBACompatibilityMode( _pImport ) )
-- sService = OUSTR("com.sun.star.form.component.RadioButton");
-- }
-- catch( Exception& /*e*/ )
-- {
-- }
--
-
- ControlImportContext ctx(
- _pImport, getControlId( xAttributes ),
-- sService );
-+ getControlModelName( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ), xAttributes ) );
- Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
-
- Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) );
-@@ -1689,19 +1628,13 @@ void TitledBoxElement::endElement()
- ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ),
- xAttributes );
-- ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ),
-- xAttributes );
-+ ctx.importImageURLProperty( OUSTR( "ImageURL" ), OUSTR( "image-src" ), _xAttributes );
- ctx.importImagePositionProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("image-position") ),
- xAttributes );
- ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
- xAttributes );
-- ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("GroupName") ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM("group-name") ),
-- xAttributes );
--
- sal_Int16 nVal = 0;
- sal_Bool bChecked = sal_False;
- if (getBoolAttr( &bChecked,
-@@ -1714,7 +1647,9 @@ void TitledBoxElement::endElement()
- }
- xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
- makeAny( nVal ) );
-- importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
-+
-+ ctx.importDataAwareProperty( OUSTR("linked-cell" ), xAttributes );
-+
- ::std::vector< Reference< xml::input::XElement > > * radioEvents =
- static_cast< RadioElement * >( xRadio.get() )->getEvents();
- ctx.importEvents( *radioEvents );
-@@ -1790,23 +1725,10 @@ void RadioGroupElement::endElement()
- Reference< xml::input::XElement > xRadio( _radios[ nPos ] );
- Reference< xml::input::XAttributes > xAttributes(
- xRadio->getAttributes() );
-- OUString sLinkedCell;
-- OUString sCellRange;
-- OUString sService( OUSTR("com.sun.star.awt.UnoControlRadioButtonModel") );
-- try
-- {
-- sLinkedCell = xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
-- // we should probably limit this to vba mode also ( leave for now )
-- if ( isVBACompatibilityMode( _pImport ) )
-- sService = OUSTR("com.sun.star.form.component.RadioButton");
-- }
-- catch( Exception& /*e*/ )
-- {
-- }
-
- ControlImportContext ctx(
- _pImport, getControlId( xAttributes ),
-- sService );
-+ getControlModelName( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ), xAttributes ) );
- Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
-
- Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) );
-@@ -1833,18 +1755,13 @@ void RadioGroupElement::endElement()
- ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ),
- xAttributes );
-- ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ),
-- xAttributes );
-+ ctx.importImageURLProperty( OUSTR( "ImageURL" ), OUSTR( "image-src" ), xAttributes );
- ctx.importImagePositionProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("image-position") ),
- xAttributes );
- ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
- xAttributes );
-- ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("GroupName") ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM("group-name") ),
-- xAttributes );
- sal_Int16 nVal = 0;
- sal_Bool bChecked = sal_False;
- if (getBoolAttr( &bChecked,
-@@ -1858,7 +1775,8 @@ void RadioGroupElement::endElement()
- xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
- makeAny( nVal ) );
-
-- importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
-+ ctx.importDataAwareProperty( OUSTR("linked-cell" ), xAttributes );
-+
- ::std::vector< Reference< xml::input::XElement > > * radioEvents =
- static_cast< RadioElement * >( xRadio.get() )->getEvents();
- ctx.importEvents( *radioEvents );
-@@ -1979,26 +1897,10 @@ Reference< xml::input::XElement > MenuListElement::startChildElement(
- void MenuListElement::endElement()
- throw (xml::sax::SAXException, RuntimeException)
- {
-- OUString sLinkedCell;
-- OUString sCellRange;
-- OUString sListBoxService( OUSTR("com.sun.star.awt.UnoControlListBoxModel") );
--
-- // we should probably limit this to vba mode also ( leave for now )
-- if ( isVBACompatibilityMode( _pImport ) )
-- sListBoxService = OUSTR("com.sun.star.form.component.ListBox");
--
-- try
-- {
-- sLinkedCell = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
-- sCellRange = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "source-cell-range" ) );
-- }
-- catch( Exception& /*e*/ )
-- {
-- }
- ControlImportContext ctx(
- _pImport, getControlId( _xAttributes ),
-- //OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) );
-- sListBoxService );
-+ getControlModelName( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ), _xAttributes ) );
-+
- Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
-
- Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
-@@ -2031,15 +1933,17 @@ void MenuListElement::endElement()
- ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
- _xAttributes );
-- // import cell-link and cell source range
-- importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
-+
-+ bool bHasLinkedCell = ctx.importDataAwareProperty( OUSTR("linked-cell" ), _xAttributes );
-+ bool bHasSrcRange = ctx.importDataAwareProperty( OUSTR("source-cell-range" ), _xAttributes );
-+
- if (_popup.is())
- {
- MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() );
-- if ( !sCellRange.getLength() )
-+ if ( !bHasSrcRange )
- xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ),
- makeAny( p->getItemValues() ) );
-- if ( !sLinkedCell.getLength() )
-+ if ( !bHasLinkedCell )
- xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") ),
- makeAny( p->getSelectedItems() ) );
- }
-@@ -2086,26 +1990,9 @@ Reference< xml::input::XElement > ComboBoxElement::startChildElement(
- void ComboBoxElement::endElement()
- throw (xml::sax::SAXException, RuntimeException)
- {
-- OUString sService( OUSTR("com.sun.star.awt.UnoControlComboBoxModel") );
--
-- // we should probably limit this to vba mode also ( leave for now )
-- if ( isVBACompatibilityMode( _pImport ) )
-- sService = OUSTR("com.sun.star.form.component.ComboBox");
--
-- OUString sLinkedCell;
-- OUString sCellRange;
-- try
-- {
-- sLinkedCell = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
-- sCellRange = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "source-cell-range" ) );
-- }
-- catch( Exception& /*e*/ )
-- {
-- }
--
- ControlImportContext ctx(
- _pImport, getControlId( _xAttributes ),
-- sService );
-+ getControlModelName( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ), _xAttributes ) );
- Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
-
- Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
-@@ -2147,10 +2034,10 @@ void ComboBoxElement::endElement()
- ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
- _xAttributes );
-- // import cell-link and cell source range
-- importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
-+ ctx.importDataAwareProperty( OUSTR("linked-cell" ), _xAttributes );
-+ bool bHasSrcRange = ctx.importDataAwareProperty( OUSTR("source-cell-range" ), _xAttributes );
-
-- if (_popup.is() && !sCellRange.getLength() )
-+ if (_popup.is() && !bHasSrcRange )
- {
- MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() );
- xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ),
-@@ -2217,9 +2104,7 @@ void CheckBoxElement::endElement()
- ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ),
- _xAttributes );
-- ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ),
-- _xAttributes );
-+ ctx.importImageURLProperty( OUSTR( "ImageURL" ), OUSTR( "image-src" ), _xAttributes );
- ctx.importImagePositionProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("image-position") ),
- _xAttributes );
-@@ -2320,9 +2205,7 @@ void ButtonElement::endElement()
- ctx.importButtonTypeProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("PushButtonType") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("button-type") ),
- _xAttributes );
-- ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ),
-- _xAttributes );
-+ ctx.importImageURLProperty( OUSTR( "ImageURL" ), OUSTR( "image-src" ), _xAttributes );
- ctx.importImagePositionProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("image-position") ),
- _xAttributes );
-@@ -2476,8 +2359,7 @@ Reference< xml::input::XElement > BulletinBoardElement::startChildElement(
- {
- return new ScrollBarElement( rLocalName, xAttributes, this, _pImport );
- }
-- // spinbutton
-- else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("spinbutton") ) && isVBACompatibilityMode( _pImport ) )
-+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("spinbutton") ))
- {
- return new SpinButtonElement( rLocalName, xAttributes, this, _pImport );
- }
-@@ -2490,9 +2372,18 @@ Reference< xml::input::XElement > BulletinBoardElement::startChildElement(
- {
- return new MultiPage( rLocalName, xAttributes, this, _pImport );
- }
-+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("frame") ))
-+ {
-+ return new Frame( rLocalName, xAttributes, this, _pImport );
-+ }
-+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("page") ))
-+ {
-+ return new Page( rLocalName, xAttributes, this, _pImport );
-+ }
- // bulletinboard
- else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bulletinboard") ))
- {
-+ OSL_TRACE("*** BulletinBoard createing BulletinBoardElement with %d styles", _pImport->_styles.size() );
- return new BulletinBoardElement( rLocalName, xAttributes, this, _pImport );
- }
- else
-@@ -2665,10 +2556,7 @@ void WindowElement::endElement()
- OUString( RTL_CONSTASCII_USTRINGPARAM("Decoration") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("withtitlebar") ),
- _xAttributes );
-- ctx.importStringProperty(
-- OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ),
-- _xAttributes );
-+ ctx.importImageURLProperty( OUSTR( "ImageURL" ), OUSTR( "image-src" ), _xAttributes );
- ctx.importEvents( _events );
- // avoid ring-reference:
- // vector< event elements > holding event elements holding this (via _pParent)
-diff --git xmlscript/source/xmldlg_imexp/xmldlg_import.cxx xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
-index 81ba97c..408884a 100644
---- xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
-+++ xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
-@@ -58,13 +58,20 @@
- #include <com/sun/star/script/ScriptEventDescriptor.hpp>
-
- #include <com/sun/star/view/SelectionType.hpp>
-+#include <com/sun/star/lang/XServiceInfo.hpp>
-+#include <com/sun/star/form/binding/XBindableValue.hpp>
-+#include <com/sun/star/form/binding/XValueBinding.hpp>
-+#include <com/sun/star/form/binding/XListEntrySink.hpp>
-+#include <com/sun/star/beans/NamedValue.hpp>
-+#include <com/sun/star/table/CellAddress.hpp>
-+#include <com/sun/star/table/CellRangeAddress.hpp>
-+#include <com/sun/star/document/XGraphicObjectResolver.hpp>
- #include <com/sun/star/document/XStorageBasedDocument.hpp>
--#include <com/sun/star/script/DocumentScriptLibraryContainer.hpp>
--#include <com/sun/star/script/vba/XVBACompatibility.hpp>
-+
-+#include <comphelper/componentcontext.hxx>
-
- using namespace ::com::sun::star;
- using namespace ::com::sun::star::uno;
--using namespace ::com::sun::star::frame;
- using ::rtl::OUString;
-
- namespace xmlscript
-@@ -129,6 +136,20 @@ OUString ControlElement::getControlId(
- return aId;
- }
-
-+OUString ControlElement::getControlModelName(
-+ OUString const& rDefaultModel,
-+ Reference< xml::input::XAttributes > const & xAttributes )
-+{
-+ OUString aModel;
-+ aModel = xAttributes->getValueByUidName(
-+ _pImport->XMLNS_DIALOGS_UID,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("control-implementation") ) );
-+ if (! aModel.getLength())
-+ aModel = rDefaultModel;
-+ return aModel;
-+}
-+
-+
- //##################################################################################################
-
- //__________________________________________________________________________________________________
-@@ -820,6 +841,7 @@ bool ImportContext::importDoubleProperty(
- }
- return false;
- }
-+
- //__________________________________________________________________________________________________
- bool ImportContext::importBooleanProperty(
- OUString const & rPropName, OUString const & rAttrName,
-@@ -971,6 +993,115 @@ bool ImportContext::importVerticalAlignProperty(
- return false;
- }
- //__________________________________________________________________________________________________
-+bool ImportContext::importImageURLProperty(
-+ OUString const & rPropName, OUString const & rAttrName,
-+ Reference< xml::input::XAttributes > const & xAttributes )
-+{
-+ rtl::OUString sURL = xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, rAttrName );
-+ if ( sURL.getLength() )
-+ {
-+ Reference< document::XStorageBasedDocument > xDocStorage( _pImport->getDocOwner(), UNO_QUERY );
-+
-+ uno::Reference< document::XGraphicObjectResolver > xGraphicResolver;
-+ if ( xDocStorage.is() )
-+ {
-+ uno::Sequence< Any > aArgs( 1 );
-+ aArgs[ 0 ] <<= xDocStorage->getDocumentStorage();
-+ ::comphelper::ComponentContext aContext( _pImport->getComponentContext() );
-+ aContext.createComponentWithArguments( OUSTR( "com.sun.star.comp.Svx.GraphicImportHelper" ), aArgs, xGraphicResolver );
-+ if ( xGraphicResolver.is() )
-+ {
-+ rtl::OUString aTmp( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.Package:" ) );
-+ aTmp += sURL;
-+ try
-+ {
-+ aTmp = xGraphicResolver->resolveGraphicObjectURL( aTmp );
-+ if ( aTmp.getLength() )
-+ sURL = aTmp;
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ (void)e;
-+ return false;
-+ }
-+
-+ }
-+ }
-+ if ( sURL.getLength() > 0 )
-+ {
-+ Reference< beans::XPropertySet > xProps( getControlModel(), UNO_QUERY );
-+ if ( xProps.is() )
-+ {
-+ xProps->setPropertyValue( rPropName, makeAny( sURL ) );
-+ return true;
-+ }
-+ }
-+ }
-+ return false;
-+}
-+//__________________________________________________________________________________________________
-+ bool ImportContext::importDataAwareProperty(
-+ ::rtl::OUString const & rPropName,
-+ Reference<xml::input::XAttributes> const & xAttributes )
-+{
-+ OUString sLinkedCell;
-+ OUString sCellRange;
-+ if ( rPropName.equals( OUSTR("linked-cell" ) ) )
-+ sLinkedCell = xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, rPropName );
-+ if ( rPropName.equals( OUSTR( "source-cell-range" ) ) )
-+ sCellRange = xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, rPropName );
-+ bool bRes = false;
-+ Reference< lang::XMultiServiceFactory > xFac( _pImport->getDocOwner(), UNO_QUERY );
-+ if ( xFac.is() && ( sLinkedCell.getLength() || sCellRange.getLength() ) )
-+ {
-+ // Set up Celllink
-+ if ( sLinkedCell.getLength() )
-+ {
-+ Reference< form::binding::XBindableValue > xBindable( getControlModel(), uno::UNO_QUERY );
-+ Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellAddressConversion" )), uno::UNO_QUERY );
-+ if ( xBindable.is() && xConvertor.is() )
-+ {
-+ table::CellAddress aAddress;
-+ xConvertor->setPropertyValue( OUSTR( "PersistentRepresentation" ), uno::makeAny( sLinkedCell ) );
-+ xConvertor->getPropertyValue( OUSTR( "Address" ) ) >>= aAddress;
-+ beans::NamedValue aArg1;
-+ aArg1.Name = OUSTR("BoundCell");
-+ aArg1.Value <<= aAddress;
-+
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[ 0 ] <<= aArg1;
-+
-+ uno::Reference< form::binding::XValueBinding > xBinding( xFac->createInstanceWithArguments( OUSTR("com.sun.star.table.CellValueBinding" ), aArgs ), uno::UNO_QUERY );
-+ xBindable->setValueBinding( xBinding );
-+ bRes = true;
-+ }
-+ }
-+ // Set up CelllRange
-+ if ( sCellRange.getLength() )
-+ {
-+ Reference< form::binding::XListEntrySink > xListEntrySink( getControlModel(), uno::UNO_QUERY );
-+ Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellRangeAddressConversion" )), uno::UNO_QUERY );
-+ if ( xListEntrySink.is() && xConvertor.is() )
-+ {
-+ table::CellRangeAddress aAddress;
-+ xConvertor->setPropertyValue( OUSTR( "PersistentRepresentation" ), uno::makeAny( sCellRange ) );
-+ xConvertor->getPropertyValue( OUSTR( "Address" ) ) >>= aAddress;
-+ beans::NamedValue aArg1;
-+ aArg1.Name = OUSTR("CellRange");
-+ aArg1.Value <<= aAddress;
-+
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[ 0 ] <<= aArg1;
-+
-+ uno::Reference< form::binding::XListEntrySource > xSource( xFac->createInstanceWithArguments( OUSTR("com.sun.star.table.CellRangeListSource" ), aArgs ), uno::UNO_QUERY );
-+ xListEntrySink->setListEntrySource( xSource );
-+ bRes = true;
-+ }
-+ }
-+ }
-+ return bRes;
-+}
-+//__________________________________________________________________________________________________
- bool ImportContext::importImageAlignProperty(
- OUString const & rPropName, OUString const & rAttrName,
- Reference< xml::input::XAttributes > const & xAttributes )
-@@ -1893,39 +2024,22 @@ Reference< xml::input::XElement > DialogImport::getStyle(
- }
- return 0;
- }
--//__________________________________________________________________________________________________
--Reference< script::XLibraryContainer > DialogImport::getScriptLibraryContainer()
--{
-- if( !_xScriptLibraryContainer.is() )
-- {
-- try
-- {
-- Reference< beans::XPropertySet > xProps( _xDoc, UNO_QUERY );
-- if( xProps.is() )
-- _xScriptLibraryContainer.set( xProps->getPropertyValue( OUSTR("BasicLibraries") ), UNO_QUERY );
-- }
-- catch( const Exception& )
-- {
-- }
-- }
--
-- return _xScriptLibraryContainer;
--}
-
- //##################################################################################################
-
- //==================================================================================================
- Reference< xml::sax::XDocumentHandler > SAL_CALL importDialogModel(
- Reference< container::XNameContainer > const & xDialogModel,
-- Reference< XComponentContext > const & xContext,
-- Reference< XModel > const & xDocument )
-+ Reference< XComponentContext > const & xContext, Reference< frame::XModel > const & xDocument )
- SAL_THROW( (Exception) )
- {
-- DialogImport* pImport = new DialogImport( xContext, xDialogModel, xDocument );
-+ // single set of styles and stylenames apply to all containees
-+ :: boost::shared_ptr< ::std::vector< ::rtl::OUString > > pStyleNames( new ::std::vector< ::rtl::OUString > );
-+ :: boost::shared_ptr< ::std::vector< css::uno::Reference< css::xml::input::XElement > > > pStyles( new ::std::vector< css::uno::Reference< css::xml::input::XElement > > );
- return ::xmlscript::createDocumentHandler(
-- static_cast< xml::input::XRoot * >( pImport ) );
-+ static_cast< xml::input::XRoot * >(
-+ new DialogImport( xContext, xDialogModel, pStyleNames, pStyles, xDocument ) ) );
- }
--
- }
-
- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
-diff --git xmlscript/util/makefile.mk xmlscript/util/makefile.mk
-index bc259db..ef5e0b0 100644
---- xmlscript/util/makefile.mk
-+++ xmlscript/util/makefile.mk
-@@ -54,8 +54,8 @@ SHL1LIBS= \
- $(LIB1TARGET)
-
- SHL1STDLIBS= \
-- $(COMPHELPERLIB) \
- $(CPPUHELPERLIB) \
-+ $(COMPHELPERLIB) \
- $(CPPULIB) \
- $(SALLIB)
-
diff --git a/patches/vba/vba-ctb-fix-looponload.diff b/patches/vba/vba-ctb-fix-looponload.diff
deleted file mode 100644
index 7d4d91100..000000000
--- a/patches/vba/vba-ctb-fix-looponload.diff
+++ /dev/null
@@ -1,80 +0,0 @@
-From 5b6db4f974875b973a2521e8368d88f5d6906ebe Mon Sep 17 00:00:00 2001
-From: Jan Holesovsky <kendy@suse.cz>
-Date: Fri, 14 May 2010 17:00:19 +0200
-Subject: [PATCH 405/878] vba-ctb-fix-looponload.diff
-
----
- sw/source/filter/ww8/ww8par.cxx | 8 ++++++--
- sw/source/filter/ww8/ww8toolbar.cxx | 18 ++++++++++++++++--
- 2 files changed, 22 insertions(+), 4 deletions(-)
-
-diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
-index 1014927..f7c8793 100644
---- a/sw/source/filter/ww8/ww8par.cxx
-+++ b/sw/source/filter/ww8/ww8par.cxx
-@@ -3912,9 +3912,13 @@ bool WW8Customizations::Import( SwDocShell* pShell )
- Tcg aTCG;
- long nCur = mpTableStream->Tell();
- mpTableStream->Seek( mWw8Fib.fcCmds ); // point at tgc record
-- if (!aTCG.Read( mpTableStream ) )
-- OSL_TRACE("** Read of Customization data failed!!!! ");
-+ bool bReadResult = aTCG.Read( mpTableStream );
- mpTableStream->Seek( nCur ); // return to previous position, is that necessary?
-+ if ( !bReadResult )
-+ {
-+ OSL_TRACE("** Read of Customization data failed!!!! ");
-+ return false;
-+ }
- #if DEBUG
- aTCG.Print( stderr );
- #endif
-diff --git a/sw/source/filter/ww8/ww8toolbar.cxx b/sw/source/filter/ww8/ww8toolbar.cxx
-index c5fcea3..8f672d4 100644
---- a/sw/source/filter/ww8/ww8toolbar.cxx
-+++ b/sw/source/filter/ww8/ww8toolbar.cxx
-@@ -105,6 +105,7 @@ bool CTBWrapper::Read( SvStream* pS )
- Tcg255SubStruct::Read( pS );
- *pS >> reserved2 >> reserved3 >> reserved4 >> reserved5;
- *pS >> cbTBD >> cCust >> cbDTBC;
-+ long nExpectedPos = pS->Tell() + cbDTBC;
- if ( cbDTBC )
- {
- // cbDTBC is the size in bytes of the TBC array
-@@ -125,6 +126,16 @@ bool CTBWrapper::Read( SvStream* pS )
- bytesToRead = cbDTBC - ( pS->Tell() - nStart );
- } while ( bytesToRead > 0 );
- }
-+ if ( pS->Tell() != nExpectedPos )
-+ {
-+ // Strange error condition, shouldn't happen ( but does in at least
-+ // one test document ) In the case where it happens the TBC &
-+ // TBCHeader records seem blank??? ( and incorrect )
-+ OSL_ENSURE( pS->Tell() == nExpectedPos, "### Error: Expected pos not equal to actual pos after reading rtbdc");
-+ OSL_TRACE("\tPos now is 0x%x should be 0x%x", pS->Tell(), nExpectedPos );
-+ // seek to correct position after rtbdc
-+ pS->Seek( nExpectedPos );
-+ }
- if ( cCust )
- {
- for ( sal_Int32 index = 0; index < cCust; ++index )
-@@ -773,12 +784,15 @@ void Tcg::Print( FILE* fp )
- Indent a(true);
- indent_printf(fp, "[ 0x%x ] Tcg - dump %d\n", nOffSet, nTcgVer);
- indent_printf(fp," nTcgVer %d\n", nTcgVer);
-- tcg->Print( fp );
-+ if ( tcg.get() )
-+ tcg->Print( fp );
- }
-
- bool Tcg::ImportCustomToolBar( SfxObjectShell& rDocSh )
- {
-- return tcg->ImportCustomToolBar( rDocSh );
-+ if ( tcg.get() )
-+ return tcg->ImportCustomToolBar( rDocSh );
-+ return false;
- }
-
- Tcg255::Tcg255()
---
-1.7.0.1
-
diff --git a/patches/vba/vba-currentcomponent-rework.diff b/patches/vba/vba-currentcomponent-rework.diff
deleted file mode 100644
index c252fa2d1..000000000
--- a/patches/vba/vba-currentcomponent-rework.diff
+++ /dev/null
@@ -1,1553 +0,0 @@
-diff --git sc/source/filter/excel/excimp8.cxx sc/source/filter/excel/excimp8.cxx
-index 846682b..4d1db8b 100644
---- sc/source/filter/excel/excimp8.cxx
-+++ sc/source/filter/excel/excimp8.cxx
-@@ -295,9 +295,16 @@ void ImportExcel8::ReadBasic( void )
- // 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
-+ //SfxObjectShell::SetCurrentComponent( pShell->GetModel() );
- BasicManager* pAppMgr = SFX_APP()->GetBasicManager();
- if ( pAppMgr )
-- pAppMgr->SetGlobalUNOConstant( "ThisComponent", makeAny( pShell->GetModel() ) );
-+ {
-+ uno::Any aModel = uno::makeAny( pShell->GetModel() );
-+ pAppMgr->SetGlobalUNOConstant( "ThisExcelDoc", aModel );
-+ }
-+
- }
- }
- }
---- sc/source/ui/unoobj/docuno.cxx
-+++ sc/source/ui/unoobj/docuno.cxx
-@@ -102,6 +102,7 @@
- using namespace com::sun::star;
- using namespace com::sun::star::document::VbaEventId;
-
-+#define SC_UNO_VBADOCOBJ "ThisVBADocObj" // perhaps we want to actually make this ThisWorkbook ?
- //------------------------------------------------------------------------
-
- // alles ohne Which-ID, Map nur fuer PropertySetInfo
-@@ -116,6 +117,7 @@ const SfxItemPropertyMap* lcl_GetDocOptPropertyMap()
- {MAP_CHAR_LEN(SC_UNO_AUTOCONTFOC), 0, &getBooleanCppuType(), 0, 0},
- {MAP_CHAR_LEN(SC_UNO_BASICLIBRARIES), 0, &getCppuType((uno::Reference< script::XLibraryContainer >*)0), beans::PropertyAttribute::READONLY, 0},
- {MAP_CHAR_LEN(SC_UNO_DIALOGLIBRARIES), 0, &getCppuType((uno::Reference< script::XLibraryContainer >*)0), beans::PropertyAttribute::READONLY, 0},
-+ {MAP_CHAR_LEN(SC_UNO_VBADOCOBJ), 0, &getCppuType((beans::PropertyValue*)0), beans::PropertyAttribute::READONLY, 0},
- {MAP_CHAR_LEN(SC_UNO_CALCASSHOWN), PROP_UNO_CALCASSHOWN, &getBooleanCppuType(), 0, 0},
- {MAP_CHAR_LEN(SC_UNONAME_CLOCAL), 0, &getCppuType((lang::Locale*)0), 0, 0},
- {MAP_CHAR_LEN(SC_UNO_CJK_CLOCAL), 0, &getCppuType((lang::Locale*)0), 0, 0},
-@@ -1555,6 +1557,13 @@ uno::Any SAL_CALL ScModelObj::getPropertyValue( const rtl::OUString& aPropertyNa
- {
- aRet <<= pDocShell->GetDialogContainer();
- }
-+ else if ( aString.EqualsAscii( SC_UNO_VBADOCOBJ ) )
-+ {
-+ beans::PropertyValue aProp;
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ThisExcelDoc") );
-+ aProp.Value <<= pDocShell->GetModel();
-+ aRet <<= aProp;
-+ }
- else if ( aString.EqualsAscii( SC_UNO_RUNTIMEUID ) )
- {
- aRet <<= getRuntimeUID();
-diff --git sc/source/ui/vba/excelvbahelper.cxx sc/source/ui/vba/excelvbahelper.cxx
-index 795ec5a..5f133d9 100644
---- sc/source/ui/vba/excelvbahelper.cxx
-+++ sc/source/ui/vba/excelvbahelper.cxx
-@@ -193,7 +193,7 @@ getBestViewShell( const css::uno::Reference< css::frame::XModel>& xModel )
- ScTabViewShell*
- getCurrentBestViewShell()
- {
-- uno::Reference< frame::XModel > xModel = getCurrentDocument();
-+ uno::Reference< frame::XModel > xModel = getCurrentExcelDoc();
- return getBestViewShell( xModel );
- }
-
-diff --git sc/source/ui/vba/vbaapplication.cxx sc/source/ui/vba/vbaapplication.cxx
-index 9088dc9..c06f3bd 100644
---- sc/source/ui/vba/vbaapplication.cxx
-+++ sc/source/ui/vba/vbaapplication.cxx
-@@ -123,7 +123,7 @@ class ActiveWorkbook : public ScVbaWorkbook
- protected:
- virtual uno::Reference< frame::XModel > getModel()
- {
-- return getCurrentDocument();
-+ return getCurrentExcelDoc();
- }
- public:
- ActiveWorkbook( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext) : ScVbaWorkbook( xParent, xContext ){}
-@@ -163,8 +163,9 @@ uno::Any SAL_CALL
- ScVbaApplication::getSelection() throw (uno::RuntimeException)
- {
- OSL_TRACE("** ScVbaApplication::getSelection() ** ");
-+ uno::Reference< frame::XModel > xModel( getCurrentDocument() );
-
-- Reference< view::XSelectionSupplier > xSelSupp( getCurrentDocument()->getCurrentController(), UNO_QUERY_THROW );
-+ Reference< view::XSelectionSupplier > xSelSupp( xModel->getCurrentController(), UNO_QUERY_THROW );
- Reference< beans::XPropertySet > xPropSet( xSelSupp, UNO_QUERY_THROW );
- OUString aPropName = OUString::createFromAscii( SC_UNO_FILTERED_RANGE_SELECTION );
- uno::Any aOldVal = xPropSet->getPropertyValue( aPropName );
-@@ -198,10 +199,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")))
-@@ -288,7 +289,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 >( this ), 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 ) );
-@@ -581,7 +582,7 @@ ScVbaApplication::GoTo( const uno::Any& Reference, const uno::Any& Scroll ) thro
- sal_Int32 SAL_CALL
- ScVbaApplication::getCursor() throw (uno::RuntimeException)
- {
-- sal_Int32 nPointerStyle = getPointerStyle();
-+ sal_Int32 nPointerStyle = getPointerStyle(getCurrentDocument());
-
- switch( nPointerStyle )
- {
-@@ -603,12 +604,13 @@ ScVbaApplication::setCursor( sal_Int32 _cursor ) throw (uno::RuntimeException)
- {
- try
- {
-+ uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
- switch( _cursor )
- {
- case excel::XlMousePointer::xlNorthwestArrow:
- {
- const Pointer& rPointer( POINTER_ARROW );
-- setCursorHelper( rPointer, sal_False );
-+ setCursorHelper( xModel, rPointer, sal_False );
- break;
- }
- case excel::XlMousePointer::xlWait:
-@@ -616,13 +618,13 @@ ScVbaApplication::setCursor( sal_Int32 _cursor ) throw (uno::RuntimeException)
- {
- const Pointer& rPointer( static_cast< PointerStyle >( _cursor ) );
- //It will set the edit window, toobar and statusbar's mouse pointer.
-- setCursorHelper( rPointer, sal_True );
-+ setCursorHelper( xModel, rPointer, sal_True );
- break;
- }
- case excel::XlMousePointer::xlDefault:
- {
- const Pointer& rPointer( POINTER_NULL );
-- setCursorHelper( rPointer, sal_False );
-+ setCursorHelper( xModel, rPointer, sal_False );
- break;
- }
- default:
-@@ -1125,17 +1127,6 @@ ScVbaApplication::Volatile( const uno::Any& aVolatile ) throw ( uno::RuntimeExc
-
- // this is bound to break when loading the document
- 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 );
--*/
- }
-
- ::sal_Bool SAL_CALL
-@@ -1189,6 +1180,12 @@ ScVbaApplication::Caller( const uno::Any& /*aIndex*/ ) throw ( uno::RuntimeExcep
- return aRet;
- }
-
-+uno::Reference< frame::XModel >
-+ScVbaApplication::getCurrentDocument() throw (css::uno::RuntimeException)
-+{
-+ return getCurrentExcelDoc();
-+}
-+
- rtl::OUString&
- ScVbaApplication::getServiceImplName()
- {
-diff --git sc/source/ui/vba/vbaapplication.hxx sc/source/ui/vba/vbaapplication.hxx
-index 67b6ba9..d7098b4 100644
---- sc/source/ui/vba/vbaapplication.hxx
-+++ sc/source/ui/vba/vbaapplication.hxx
-@@ -47,6 +47,8 @@ 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( const css::uno::Reference< css::uno::XComponentContext >& m_xContext );
- virtual ~ScVbaApplication();
-diff --git sc/source/ui/vba/vbachartobject.cxx sc/source/ui/vba/vbachartobject.cxx
-index c87e356..71942f1 100644
---- sc/source/ui/vba/vbachartobject.cxx
-+++ 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()->getCurrentController(), uno::UNO_QUERY_THROW );
- xSelectionSupplier->select(uno::makeAny(xShape));
- }
- catch (uno::Exception& )
-diff --git sc/source/ui/vba/vbacharts.cxx sc/source/ui/vba/vbacharts.cxx
-index 3c87bb5..7dc8cbc 100644
---- sc/source/ui/vba/vbacharts.cxx
-+++ 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 sc/source/ui/vba/vbacharts.hxx sc/source/ui/vba/vbacharts.hxx
-index cedfeaa..fc227ba 100644
---- sc/source/ui/vba/vbacharts.hxx
-+++ sc/source/ui/vba/vbacharts.hxx
-@@ -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 sc/source/ui/vba/vbadialog.hxx sc/source/ui/vba/vbadialog.hxx
-index 8625166..648f038 100644
---- sc/source/ui/vba/vbadialog.hxx
-+++ sc/source/ui/vba/vbadialog.hxx
-@@ -40,7 +40,7 @@ typedef cppu::ImplInheritanceHelper1< VbaDialogBase, ov::excel::XDialog > ScVbaD
- class ScVbaDialog : public ScVbaDialog_BASE
- {
- public:
-- ScVbaDialog( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, sal_Int32 nIndex ):ScVbaDialog_BASE( xParent, xContext, 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
-diff --git sc/source/ui/vba/vbadialogs.cxx sc/source/ui/vba/vbadialogs.cxx
-index c0c8bf7..6f90e4b 100644
---- sc/source/ui/vba/vbadialogs.cxx
-+++ sc/source/ui/vba/vbadialogs.cxx
-@@ -44,7 +44,7 @@ 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 >( Application(),uno::UNO_QUERY_THROW ), mxContext, nIndex ) );
-+ uno::Reference< excel::XDialog > aDialog( new ScVbaDialog( uno::Reference< XHelperInterface >( Application(),uno::UNO_QUERY_THROW ), mxContext, m_xModel, nIndex ) );
- return uno::Any( aDialog );
- }
-
-diff --git sc/source/ui/vba/vbadialogs.hxx sc/source/ui/vba/vbadialogs.hxx
-index ab53253..c902b7a 100644
---- sc/source/ui/vba/vbadialogs.hxx
-+++ sc/source/ui/vba/vbadialogs.hxx
-@@ -42,7 +42,7 @@ typedef cppu::ImplInheritanceHelper1< VbaDialogsBase, ov::excel::XDialogs > ScVb
- 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
-diff --git sc/source/ui/vba/vbarange.cxx sc/source/ui/vba/vbarange.cxx
-index 927152b..986c376 100644
---- sc/source/ui/vba/vbarange.cxx
-+++ sc/source/ui/vba/vbarange.cxx
-@@ -2024,13 +2024,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
-- // #FIXME don't use getCurrentDocument
-- uno::Reference< sheet::XCellRangeAddressable > xRange( getCurrentDocument()->getCurrentSelection(), ::uno::UNO_QUERY);
-+ uno::Reference< sheet::XCellRangeAddressable > xRange( xModel->getCurrentSelection(), ::uno::UNO_QUERY);
-
-- // #FIXME don't use getCurrentDocument
-- uno::Reference< sheet::XSheetCellRanges > xRanges( getCurrentDocument()->getCurrentSelection(), ::uno::UNO_QUERY);
-+ uno::Reference< sheet::XSheetCellRanges > xRanges( xModel->getCurrentSelection(), ::uno::UNO_QUERY);
-
- if ( xRanges.is() )
- {
-@@ -2543,10 +2549,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 >() );
-- // #FIXME doen't use current document
-- 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( getScDocShell()->GetModel()->getCurrentSelection() );
-+ uno::Reference< uno::XInterface > xSel( xModel->getCurrentSelection() );
- // select this range
- xSelection->select( uno::makeAny( mxRange ) );
- // set up defaults
-@@ -3880,7 +3888,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(), uno::UNO_QUERY_THROW );
-
- uno::Reference< container::XNameAccess > xNamed( xPropSet->getPropertyValue( sNamedRanges ), uno::UNO_QUERY_THROW );
- uno::Reference< sheet::XCellRangeReferrer > xReferrer;
-@@ -3903,7 +3911,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()->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 );
-diff --git sc/source/ui/vba/vbatextboxshape.cxx sc/source/ui/vba/vbatextboxshape.cxx
-index 49600d3..954521b 100644
---- sc/source/ui/vba/vbatextboxshape.cxx
-+++ 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 );
-diff --git sc/source/ui/vba/vbaworkbook.cxx sc/source/ui/vba/vbaworkbook.cxx
-index ded6aad..1c60441 100644
---- sc/source/ui/vba/vbaworkbook.cxx
-+++ sc/source/ui/vba/vbaworkbook.cxx
-@@ -64,7 +64,7 @@ class ActiveSheet : public ScVbaWorksheet
- protected:
- virtual uno::Reference< frame::XModel > getModel()
- {
-- return getCurrentDocument();
-+ return getCurrentExcelDoc();
- }
- virtual uno::Reference< sheet::XSpreadsheet > getSheet()
- {
-diff --git sc/source/ui/vba/vbaworksheet.cxx sc/source/ui/vba/vbaworksheet.cxx
-index ddd5111..7922782 100644
---- sc/source/ui/vba/vbaworksheet.cxx
-+++ sc/source/ui/vba/vbaworksheet.cxx
-@@ -712,7 +712,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 );
-diff --git sfx2/source/doc/objxtor.cxx sfx2/source/doc/objxtor.cxx
-index 3421628..43c7458 100644
---- sfx2/source/doc/objxtor.cxx
-+++ sfx2/source/doc/objxtor.cxx
-@@ -136,6 +136,33 @@ DBG_NAME(SfxObjectShell)
- extern svtools::AsynchronLink* pPendingCloser;
- static WeakReference< XInterface > s_xCurrentComponent;
-
-+void lcl_UpdateAppBasicDocVars( const Reference< XInterface >& _rxComponent, bool bClear = false )
-+{
-+ BasicManager* pAppMgr = SFX_APP()->GetBasicManager();
-+ if ( pAppMgr )
-+ {
-+ uno::Reference< beans::XPropertySet > xProps( _rxComponent, uno::UNO_QUERY );
-+ if ( xProps.is() )
-+ {
-+ try
-+ {
-+ beans::PropertyValue aProp;
-+ xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ThisVBADocObj") ) ) >>= aProp;
-+ rtl::OString sTmp( rtl::OUStringToOString( aProp.Name, RTL_TEXTENCODING_UTF8 ) );
-+ const char* pAscii = sTmp.getStr();
-+ if ( bClear )
-+ pAppMgr->SetGlobalUNOConstant( pAscii, uno::makeAny( uno::Reference< uno::XInterface >() ) );
-+ else
-+ pAppMgr->SetGlobalUNOConstant( pAscii, aProp.Value );
-+
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ }
-+ }
-+ }
-+}
-+
- //=========================================================================
-
- /** This Listener is used to get notified when the XDocumentProperties of the
-@@ -211,6 +237,7 @@ void SAL_CALL SfxModelListener_Impl::disposing( const com::sun::star::lang::Even
- ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
- if ( SfxObjectShell::GetCurrentComponent() == _rEvent.Source )
- {
-+ lcl_UpdateAppBasicDocVars( SfxObjectShell::GetCurrentComponent(), true );
- // remove ThisComponent reference from AppBasic
- SfxObjectShell::SetCurrentComponent( Reference< XInterface >() );
- }
-@@ -1095,7 +1122,10 @@ void SfxObjectShell::SetCurrentComponent( const Reference< XInterface >& _rxComp
-
- BasicManager* pAppMgr = SFX_APP()->GetBasicManager();
- if ( pAppMgr )
-+ {
-+ lcl_UpdateAppBasicDocVars( _rxComponent );
- pAppMgr->SetGlobalUNOConstant( "ThisComponent", makeAny( _rxComponent ) );
-+ }
-
- #if OSL_DEBUG_LEVEL > 0
- const char* pComponentImplName = _rxComponent.get() ? typeid( *_rxComponent.get() ).name() : "void";
-diff --git sw/inc/unomap.hxx sw/inc/unomap.hxx
-index 1e842ab..9e928cb 100644
---- sw/inc/unomap.hxx
-+++ sw/inc/unomap.hxx
-@@ -307,6 +307,7 @@
-
- #define WID_LAYOUT_SIZE 1104
- #define WID_DOC_DIALOG_LIBRARIES 1105
-+#define WID_DOC_VBA_DOCOBJ 1106
-
-
- //AutoText
---- sw/inc/unoprnms.hxx
-+++ sw/inc/unoprnms.hxx
-@@ -805,7 +805,8 @@ enum SwPropNameIds
- /* 0737 */ UNO_NAME_DESCRIPTION,
- // <--
- /* 0738 */ UNO_NAME_IS_TEMPLATE,
--/* 0739 */ SW_PROPNAME_END
-+/* 0739 */ UNO_NAME_VBA_DOCOBJ,
-+/* 0740 */ SW_PROPNAME_END
- };
-
-
-diff --git sw/source/core/unocore/unomap.cxx sw/source/core/unocore/unomap.cxx
-index 14ff14e..1430c12 100644
---- sw/source/core/unocore/unomap.cxx
-+++ sw/source/core/unocore/unomap.cxx
-@@ -1698,6 +1698,7 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP
- { SW_PROP_NMID(UNO_NAME_CHAR_LOCALE), RES_CHRATR_LANGUAGE , CPPU_E2T(CPPUTYPE_LOCALE), PropertyAttribute::MAYBEVOID, MID_LANG_LOCALE },
- { SW_PROP_NMID(UNO_NAME_CHARACTER_COUNT), WID_DOC_CHAR_COUNT, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::READONLY, 0},
- { SW_PROP_NMID(UNO_NAME_DIALOG_LIBRARIES), WID_DOC_DIALOG_LIBRARIES, CPPU_E2T(CPPUTYPE_REFLIBCONTAINER), PropertyAttribute::READONLY, 0},
-+ { SW_PROP_NMID(UNO_NAME_VBA_DOCOBJ), WID_DOC_VBA_DOCOBJ, CPPU_E2T(CPPUTYPE_PROPERTYVALUE), PropertyAttribute::READONLY, 0},
- { SW_PROP_NMID(UNO_NAME_INDEX_AUTO_MARK_FILE_U_R_L), WID_DOC_AUTO_MARK_URL, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
- { SW_PROP_NMID(UNO_NAME_PARAGRAPH_COUNT), WID_DOC_PARA_COUNT, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::READONLY, 0},
- { SW_PROP_NMID(UNO_NAME_RECORD_CHANGES), WID_DOC_CHANGES_RECORD, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
---- sw/source/core/unocore/unoprnms.cxx
-+++ sw/source/core/unocore/unoprnms.cxx
-@@ -779,7 +779,8 @@ const SwPropNameTab aPropNameTab = {
- /* 0735 CHAR_OVERLINE_HAS_COLOR */ {MAP_CHAR_LEN("CharOverlineHasColor")},
- /* 0736 UNO_NAME_OUTLINE_LEVEL */ {MAP_CHAR_LEN("OutlineLevel")},//#outline level,add<-zhaojianwei Outlinelevel
- /* 0737 UNO_NAME_DESCRIPTION */ {MAP_CHAR_LEN("Description")},
--/* 0738 UNO_NAME_IS_TEMPLATE */ {MAP_CHAR_LEN("IsTemplate")}
-+/* 0738 UNO_NAME_IS_TEMPLATE */ {MAP_CHAR_LEN("IsTemplate")},
-+/* 0739 UNO_NAME_VBA_DOCOBJ */ {MAP_CHAR_LEN("ThisVBADocObj")},
- };
-
- const SwPropNameLen& SwGetPropName( USHORT nId )
-diff --git sw/source/ui/uno/unotxdoc.cxx sw/source/ui/uno/unotxdoc.cxx
-index 9bc3d85..c22a03b 100644
---- sw/source/ui/uno/unotxdoc.cxx
-+++ sw/source/ui/uno/unotxdoc.cxx
-@@ -2264,6 +2264,14 @@ Any SwXTextDocument::getPropertyValue(const OUString& rPropertyName)
- case WID_DOC_DIALOG_LIBRARIES:
- aAny <<= pDocShell->GetDialogContainer();
- break;
-+ case WID_DOC_VBA_DOCOBJ:
-+ {
-+ beans::PropertyValue aProp;
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ThisWordDoc") );
-+ aProp.Value <<= pDocShell->GetModel();
-+ aAny <<= aProp;
-+ }
-+ break;
- case WID_DOC_RUNTIME_UID:
- aAny <<= getRuntimeUID();
- break;
-diff --git sw/source/ui/vba/vbaapplication.cxx sw/source/ui/vba/vbaapplication.cxx
-index 4117688..9c70772 100644
---- sw/source/ui/vba/vbaapplication.cxx
-+++ sw/source/ui/vba/vbaapplication.cxx
-@@ -148,7 +148,7 @@ SwVbaApplication::Addins( const uno::Any& index ) throw (uno::RuntimeException)
- uno::Any SAL_CALL
- SwVbaApplication::Dialogs( const uno::Any& index ) throw (uno::RuntimeException)
- {
-- uno::Reference< word::XDialogs > xCol( new SwVbaDialogs( this, mxContext ) );
-+ uno::Reference< word::XDialogs > xCol( new SwVbaDialogs( this, mxContext, getCurrentDocument() ));
- if ( index.hasValue() )
- return xCol->Item( index );
- return uno::makeAny( xCol );
-@@ -180,6 +180,12 @@ float SAL_CALL SwVbaApplication::CentimetersToPoints( float _Centimeters ) throw
- return VbaApplicationBase::CentimetersToPoints( _Centimeters );
- }
-
-+uno::Reference< frame::XModel >
-+SwVbaApplication::getCurrentDocument() throw (css::uno::RuntimeException)
-+{
-+ return getCurrentWordDoc();
-+}
-+
- rtl::OUString&
- SwVbaApplication::getServiceImplName()
- {
-diff --git sw/source/ui/vba/vbaapplication.hxx sw/source/ui/vba/vbaapplication.hxx
-index e896e02..935a03c 100644
---- sw/source/ui/vba/vbaapplication.hxx
-+++ sw/source/ui/vba/vbaapplication.hxx
-@@ -71,5 +71,7 @@ public:
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+protected:
-+ virtual css::uno::Reference< css::frame::XModel > getCurrentDocument() throw (css::uno::RuntimeException);
- };
- #endif /* SW_VBA_APPLICATION_HXX */
-diff --git sw/source/ui/vba/vbadialog.hxx sw/source/ui/vba/vbadialog.hxx
-index 9090f15..b320a18 100644
---- sw/source/ui/vba/vbadialog.hxx
-+++ sw/source/ui/vba/vbadialog.hxx
-@@ -40,7 +40,7 @@ typedef cppu::ImplInheritanceHelper1< VbaDialogBase, ov::word::XDialog > SwVbaDi
- class SwVbaDialog : public SwVbaDialog_BASE
- {
- public:
-- SwVbaDialog( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, sal_Int32 nIndex ):SwVbaDialog_BASE( xParent, xContext, nIndex ) {}
-+ SwVbaDialog( 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 ):SwVbaDialog_BASE( xParent, xContext, xModel, nIndex ) {}
- virtual ~SwVbaDialog() {}
-
- // Methods
-diff --git sw/source/ui/vba/vbadialogs.cxx sw/source/ui/vba/vbadialogs.cxx
-index 26dd7f1..e905442 100644
---- sw/source/ui/vba/vbadialogs.cxx
-+++ sw/source/ui/vba/vbadialogs.cxx
-@@ -39,7 +39,7 @@ SwVbaDialogs::Item( const uno::Any &aItem ) throw (uno::RuntimeException)
- {
- sal_Int32 nIndex = 0;
- aItem >>= nIndex;
-- uno::Reference< word::XDialog > aDialog( new SwVbaDialog( uno::Reference< XHelperInterface >( Application(),uno::UNO_QUERY_THROW ), mxContext, nIndex ) );
-+ uno::Reference< word::XDialog > aDialog( new SwVbaDialog( uno::Reference< XHelperInterface >( Application(),uno::UNO_QUERY_THROW ), mxContext, m_xModel, nIndex ) );
- return uno::Any( aDialog );
- }
-
-diff --git sw/source/ui/vba/vbadialogs.hxx sw/source/ui/vba/vbadialogs.hxx
-index ef36067..63e45f5 100644
---- sw/source/ui/vba/vbadialogs.hxx
-+++ sw/source/ui/vba/vbadialogs.hxx
-@@ -42,7 +42,7 @@ typedef cppu::ImplInheritanceHelper1< VbaDialogsBase, ov::word::XDialogs > SwVba
- class SwVbaDialogs : public SwVbaDialogs_BASE
- {
- public:
-- SwVbaDialogs( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext ): SwVbaDialogs_BASE( xParent, xContext ) {}
-+ SwVbaDialogs( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext, const css::uno::Reference< css::frame::XModel >& xModel ): SwVbaDialogs_BASE( xParent, xContext, xModel ) {}
- virtual ~SwVbaDialogs() {}
-
- // XCollection
-diff --git sw/source/ui/vba/vbadocument.cxx sw/source/ui/vba/vbadocument.cxx
-index 906a617..1090a8b 100644
---- sw/source/ui/vba/vbadocument.cxx
-+++ sw/source/ui/vba/vbadocument.cxx
-@@ -205,7 +205,9 @@ SwVbaDocument::Shapes( const uno::Any& index ) throw (uno::RuntimeException)
- uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( getModel(), uno::UNO_QUERY_THROW );
- //uno::Reference< drawing::XShapes > xShapes( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
- uno::Reference< container::XIndexAccess > xIndexAccess( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
-- uno::Reference< XCollection > xCol( new ScVbaShapes( this, mxContext, xIndexAccess ) );
-+ uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW );
-+ uno::Reference< XCollection > xCol( new ScVbaShapes( this, mxContext, xIndexAccess, xModel ) );
-+
- if ( index.hasValue() )
- return xCol->Item( index, uno::Any() );
- return uno::makeAny( xCol );
-diff --git sw/source/ui/vba/vbaheaderfooter.cxx sw/source/ui/vba/vbaheaderfooter.cxx
-index c1eb4ec..a08c155 100644
---- sw/source/ui/vba/vbaheaderfooter.cxx
-+++ sw/source/ui/vba/vbaheaderfooter.cxx
-@@ -87,7 +87,7 @@ SwVbaHeaderFooter::Shapes( const uno::Any& index ) throw (uno::RuntimeException)
- uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxModel, uno::UNO_QUERY_THROW );
- //uno::Reference< drawing::XShapes > xShapes( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
- uno::Reference< container::XIndexAccess > xIndexAccess( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
-- uno::Reference< XCollection > xCol( new ScVbaShapes( this, mxContext, xIndexAccess ) );
-+ uno::Reference< XCollection > xCol( new ScVbaShapes( this, mxContext, xIndexAccess, mxModel ) );
- if ( index.hasValue() )
- return xCol->Item( index, uno::Any() );
- return uno::makeAny( xCol );
-diff --git sw/source/ui/vba/vbaselection.cxx sw/source/ui/vba/vbaselection.cxx
-index b85c2d7..167838f 100644
---- sw/source/ui/vba/vbaselection.cxx
-+++ sw/source/ui/vba/vbaselection.cxx
-@@ -639,7 +639,7 @@ SwVbaSelection::ShapeRange( ) throw (uno::RuntimeException)
- uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxModel, uno::UNO_QUERY_THROW );
- uno::Reference< drawing::XDrawPage > xDrawPage = xDrawPageSupplier->getDrawPage();
- uno::Reference< container::XIndexAccess > xShapesAccess( xShapes, uno::UNO_QUERY_THROW );
-- return uno::makeAny( uno::Reference< msforms::XShapeRange >( new ScVbaShapeRange( this, mxContext, xShapesAccess, xDrawPage ) ) );
-+ return uno::makeAny( uno::Reference< msforms::XShapeRange >( new ScVbaShapeRange( this, mxContext, xShapesAccess, xDrawPage, mxModel ) ) );
- }
-
- ::sal_Int32 SAL_CALL SwVbaSelection::getStart() throw (uno::RuntimeException)
-diff --git sw/source/ui/vba/vbasystem.cxx sw/source/ui/vba/vbasystem.cxx
-index 0b233a4..c68a7c0 100644
---- sw/source/ui/vba/vbasystem.cxx
-+++ sw/source/ui/vba/vbasystem.cxx
-@@ -88,7 +88,7 @@ SwVbaSystem::~SwVbaSystem()
- sal_Int32 SAL_CALL
- SwVbaSystem::getCursor() throw (uno::RuntimeException)
- {
-- sal_Int32 nPointerStyle = getPointerStyle();
-+ sal_Int32 nPointerStyle = getPointerStyle( getCurrentWordDoc() );
-
- switch( nPointerStyle )
- {
-@@ -115,27 +115,27 @@ SwVbaSystem::setCursor( sal_Int32 _cursor ) throw (uno::RuntimeException)
- case word::WdCursorType::wdCursorNorthwestArrow:
- {
- const Pointer& rPointer( POINTER_ARROW );
-- setCursorHelper( rPointer, sal_False );
-+ setCursorHelper( getCurrentWordDoc(), rPointer, sal_False );
- break;
- }
- case word::WdCursorType::wdCursorWait:
- {
- const Pointer& rPointer( static_cast< PointerStyle >( POINTER_WAIT ) );
- //It will set the edit window, toobar and statusbar's mouse pointer.
-- setCursorHelper( rPointer, sal_True );
-+ setCursorHelper( getCurrentWordDoc(), rPointer, sal_True );
- break;
- }
- case word::WdCursorType::wdCursorIBeam:
- {
- const Pointer& rPointer( static_cast< PointerStyle >( POINTER_TEXT ) );
- //It will set the edit window, toobar and statusbar's mouse pointer.
-- setCursorHelper( rPointer, sal_True );
-+ setCursorHelper( getCurrentWordDoc(), rPointer, sal_True );
- break;
- }
- case word::WdCursorType::wdCursorNormal:
- {
- const Pointer& rPointer( POINTER_NULL );
-- setCursorHelper( rPointer, sal_False );
-+ setCursorHelper( getCurrentWordDoc(), rPointer, sal_False );
- break;
- }
- default:
-diff --git vbahelper/inc/vbahelper/vbaapplicationbase.hxx vbahelper/inc/vbahelper/vbaapplicationbase.hxx
-index a4d550b..e100387 100644
---- vbahelper/inc/vbahelper/vbaapplicationbase.hxx
-+++ vbahelper/inc/vbahelper/vbaapplicationbase.hxx
-@@ -42,8 +42,8 @@ class VBAHELPER_DLLPUBLIC VbaApplicationBase : public ApplicationBase_BASE
- protected:
- VbaApplicationBase( const css::uno::Reference< css::uno::XComponentContext >& xContext );
- virtual ~VbaApplicationBase();
-- virtual SfxObjectShell* GetDocShell( const css::uno::Reference< css::frame::XModel >& /*xModel*/ ) throw (css::uno::RuntimeException) { return NULL; }
-
-+ virtual css::uno::Reference< css::frame::XModel > getCurrentDocument() throw (css::uno::RuntimeException) = 0;
- public:
- // XHelperInterface ( parent is itself )
- virtual css::uno::Reference< ov::XHelperInterface > SAL_CALL getParent( ) throw (css::script::BasicErrorException, css::uno::RuntimeException) { return this; }
-diff --git vbahelper/inc/vbahelper/vbadialogbase.hxx vbahelper/inc/vbahelper/vbadialogbase.hxx
-index 4b3e2a2..a36c056 100644
---- vbahelper/inc/vbahelper/vbadialogbase.hxx
-+++ vbahelper/inc/vbahelper/vbadialogbase.hxx
-@@ -33,6 +33,7 @@
- #include <cppuhelper/implbase1.hxx>
- #include <ooo/vba/XDialogBase.hpp>
- #include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/frame/XModel.hpp>
-
- typedef InheritedHelperInterfaceImpl1< ov::XDialogBase > VbaDialogBase_BASE;
-
-@@ -40,8 +41,9 @@ class VBAHELPER_DLLPUBLIC VbaDialogBase : public VbaDialogBase_BASE
- {
- protected:
- sal_Int32 mnIndex;
-+ css::uno::Reference< css::frame::XModel > m_xModel;
- public:
-- VbaDialogBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, sal_Int32 nIndex ):VbaDialogBase_BASE( xParent, xContext ), mnIndex( nIndex ) {}
-+ VbaDialogBase( 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 ):VbaDialogBase_BASE( xParent, xContext ), mnIndex( nIndex ), m_xModel( xModel ) {}
- virtual ~VbaDialogBase() {}
-
- // Methods
-diff --git vbahelper/inc/vbahelper/vbadialogsbase.hxx vbahelper/inc/vbahelper/vbadialogsbase.hxx
-index e8b1b2e..dc5d389 100644
---- vbahelper/inc/vbahelper/vbadialogsbase.hxx
-+++ vbahelper/inc/vbahelper/vbadialogsbase.hxx
-@@ -34,13 +34,16 @@
- #include <ooo/vba/XHelperInterface.hpp>
- #include <ooo/vba/XDialogsBase.hpp>
- #include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/frame/XModel.hpp>
-
- typedef InheritedHelperInterfaceImpl1< ov::XDialogsBase > VbaDialogsBase_BASE;
-
- class VBAHELPER_DLLPUBLIC VbaDialogsBase : public VbaDialogsBase_BASE
- {
-+protected:
-+ css::uno::Reference< css::frame::XModel > m_xModel;
- public:
-- VbaDialogsBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext ): VbaDialogsBase_BASE( xParent, xContext ) {}
-+ VbaDialogsBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext, const css::uno::Reference< css::frame::XModel >& xModel ): VbaDialogsBase_BASE( xParent, xContext ), m_xModel( xModel ) {}
- virtual ~VbaDialogsBase() {}
-
- // XCollection
-diff --git vbahelper/inc/vbahelper/vbahelper.hxx vbahelper/inc/vbahelper/vbahelper.hxx
-index 77eb2a3..047019c 100644
---- vbahelper/inc/vbahelper/vbahelper.hxx
-+++ vbahelper/inc/vbahelper/vbahelper.hxx
-@@ -66,8 +66,9 @@ namespace ooo
- VBAHELPER_DLLPUBLIC SfxObjectShell* getSfxObjShell( const css::uno::Reference< css::frame::XModel >& xModel ) throw ( css::uno::RuntimeException);
- VBAHELPER_DLLPUBLIC css::uno::Reference< css::uno::XInterface > createVBAUnoAPIService( SfxObjectShell* pShell, const sal_Char* _pAsciiName ) throw (css::uno::RuntimeException);
- VBAHELPER_DLLPUBLIC css::uno::Reference< css::uno::XInterface > createVBAUnoAPIServiceWithArgs( SfxObjectShell* pShell, const sal_Char* _pAsciiName, const css::uno::Sequence< css::uno::Any >& aArgs ) throw (css::uno::RuntimeException);
-- VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getCurrentDocument() throw (css::uno::RuntimeException);
-- VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getDocumentContext() throw (css::uno::RuntimeException);
-+ css::uno::Reference< css::frame::XModel > getCurrentDoc( const rtl::OUString& sKey ) throw (css::uno::RuntimeException);
-+ VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getCurrentExcelDoc() throw (css::uno::RuntimeException);
-+ VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getCurrentWordDoc() throw (css::uno::RuntimeException);
-
- VBAHELPER_DLLPUBLIC css::uno::Reference< css::beans::XIntrospectionAccess > getIntrospectionAccess( const css::uno::Any& aObject ) throw (css::uno::RuntimeException);
- VBAHELPER_DLLPUBLIC css::uno::Reference< css::script::XTypeConverter > getTypeConverter( const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException);
-@@ -91,8 +92,8 @@ namespace ooo
- VBAHELPER_DLLPUBLIC double getPixelTo100thMillimeterConversionFactor( css::uno::Reference< css::awt::XDevice >& xDevice, sal_Bool bVertical);
- VBAHELPER_DLLPUBLIC double PointsToPixels( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical);
- VBAHELPER_DLLPUBLIC double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical);
-- VBAHELPER_DLLPUBLIC sal_Int32 getPointerStyle();
-- VBAHELPER_DLLPUBLIC void setCursorHelper( const Pointer& rPointer, sal_Bool bOverWrite );
-+ VBAHELPER_DLLPUBLIC sal_Int32 getPointerStyle( const css::uno::Reference< css::frame::XModel >& );
-+ VBAHELPER_DLLPUBLIC void setCursorHelper( const css::uno::Reference< css::frame::XModel >& xModel, const Pointer& rPointer, sal_Bool bOverWrite );
-
- class VBAHELPER_DLLPUBLIC Millimeter
- {
-diff --git vbahelper/inc/vbahelper/vbashape.hxx vbahelper/inc/vbahelper/vbashape.hxx
-index 7893905..14debe4 100644
---- vbahelper/inc/vbahelper/vbashape.hxx
-+++ vbahelper/inc/vbahelper/vbashape.hxx
-@@ -54,6 +54,7 @@ protected:
- css::uno::Reference< css::drawing::XShapes > m_xShapes;
- css::uno::Reference< css::beans::XPropertySet > m_xPropertySet;
- sal_Int32 m_nType;
-+ css::uno::Reference< css::frame::XModel > m_xModel;
- css::uno::Any m_aRange;
- virtual void addListeners();
- virtual void removeShapeListener() throw( css::uno::RuntimeException );
-@@ -61,8 +62,8 @@ protected:
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> 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 );
-+ 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, const css::uno::Reference< css::frame::XModel >& xModel, sal_Int32 nType ) throw ( css::lang::IllegalArgumentException );
-+ ScVbaShape( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape, const css::uno::Reference< css::frame::XModel >& xModel ) throw ( css::lang::IllegalArgumentException );
- virtual ~ScVbaShape();
- css::uno::Any getRange() { return m_aRange; };
- void setRange( css::uno::Any aRange ) { m_aRange = aRange; };
-diff --git vbahelper/inc/vbahelper/vbashaperange.hxx vbahelper/inc/vbahelper/vbashaperange.hxx
-index af39456..0d29c3a 100644
---- vbahelper/inc/vbahelper/vbashaperange.hxx
-+++ vbahelper/inc/vbahelper/vbashaperange.hxx
-@@ -46,11 +46,12 @@ private:
- css::uno::Reference< css::drawing::XShapes > m_xShapes;
- sal_Int32 m_nShapeGroupCount;
- protected:
-+ css::uno::Reference< css::frame::XModel > m_xModel;
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> 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 );
-+ 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, const css::uno::Reference< css::frame::XModel >& xModel );
-
- // Methods
- virtual void SAL_CALL Select( ) throw (css::uno::RuntimeException);
-diff --git vbahelper/inc/vbahelper/vbashapes.hxx vbahelper/inc/vbahelper/vbashapes.hxx
-index 597f97b..dfbe5b1 100644
---- vbahelper/inc/vbahelper/vbashapes.hxx
-+++ vbahelper/inc/vbahelper/vbashapes.hxx
-@@ -49,6 +49,7 @@ private:
- sal_Int32 m_nNewShapeCount;
- void initBaseCollection();
- protected:
-+ css::uno::Reference< css::frame::XModel > m_xModel;
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
- virtual css::uno::Reference< css::container::XIndexAccess > getShapesByArrayIndices( const css::uno::Any& Index ) throw (css::uno::RuntimeException);
-@@ -62,7 +63,7 @@ protected:
- //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 );
-+ ScVbaShapes( 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::frame::XModel >& xModel );
- 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
-diff --git vbahelper/source/vbahelper/vbaapplicationbase.cxx vbahelper/source/vbahelper/vbaapplicationbase.cxx
-index 0d9f52e..b73013f 100644
---- vbahelper/source/vbahelper/vbaapplicationbase.cxx
-+++ vbahelper/source/vbahelper/vbaapplicationbase.cxx
-@@ -120,7 +120,7 @@ VbaApplicationBase::setDisplayStatusBar(sal_Bool bDisplayStatusBar) throw (uno::
- uno::Any SAL_CALL
- VbaApplicationBase::CommandBars( const uno::Any& aIndex ) throw (uno::RuntimeException)
- {
-- uno::Reference< XCommandBars > xCommandBars( new ScVbaCommandBars( this, mxContext, uno::Reference< container::XIndexAccess >() ) );
-+ uno::Reference< XCommandBars > xCommandBars( new ScVbaCommandBars( this, mxContext, uno::Reference< container::XIndexAccess >(), getCurrentDocument() ) );
- if( aIndex.hasValue() )
- return uno::makeAny( xCommandBars->Item( aIndex, uno::Any() ) );
- return uno::makeAny( xCommandBars );
-@@ -134,7 +134,7 @@ VbaApplicationBase::getVersion() throw (uno::RuntimeException)
-
- void SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, const uno::Any& varg1, const uno::Any& varg2, const uno::Any& varg3, const uno::Any& varg4, const uno::Any& varg5, const uno::Any& varg6, const uno::Any& varg7, const uno::Any& varg8, const uno::Any& varg9, const uno::Any& varg10, const uno::Any& varg11, const uno::Any& varg12, const uno::Any& varg13, const uno::Any& varg14, const uno::Any& varg15, const uno::Any& varg16, const uno::Any& varg17, const uno::Any& varg18, const uno::Any& varg19, const uno::Any& varg20, const uno::Any& varg21, const uno::Any& varg22, const uno::Any& varg23, const uno::Any& varg24, const uno::Any& varg25, const uno::Any& varg26, const uno::Any& varg27, const uno::Any& varg28, const uno::Any& varg29, const uno::Any& varg30 ) throw (uno::RuntimeException)
- {
-- VBAMacroResolvedInfo aMacroInfo = resolveVBAMacro( GetDocShell( getCurrentDocument() ), MacroName );
-+ VBAMacroResolvedInfo aMacroInfo = resolveVBAMacro( getSfxObjShell( getCurrentDocument() ), MacroName );
- if( aMacroInfo.IsResolved() )
- {
- // handle the arguments
-diff --git vbahelper/source/vbahelper/vbacommandbar.cxx vbahelper/source/vbahelper/vbacommandbar.cxx
-index ba9f49b..a74ccd5 100644
---- vbahelper/source/vbahelper/vbacommandbar.cxx
-+++ vbahelper/source/vbahelper/vbacommandbar.cxx
-@@ -46,7 +46,7 @@
- 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 )
-+ScVbaCommandBar::ScVbaCommandBar( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< frame::XModel >& xModel, sal_Int32 nModuleType ) throw (uno::RuntimeException) : CommandBar_BASE( xParent, xContext ), m_xModel( xModel )
- {
- // it's a menu bar
- // only supporting factory menus ( no custom menus )
-@@ -67,7 +67,7 @@ ScVbaCommandBar::ScVbaCommandBar( const uno::Reference< XHelperInterface > xPare
- 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 )
-+ScVbaCommandBar::ScVbaCommandBar( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< frame::XModel >& xModel, rtl::OUString sToolBarName, sal_Bool bTemporary, sal_Bool bCreate ) throw (uno::RuntimeException) : CommandBar_BASE( xParent, xContext ), m_xModel( xModel )
- {
- // it's a tool bar
- m_xParentHardRef.set( xParent, uno::UNO_QUERY_THROW );
-@@ -248,7 +248,7 @@ ScVbaCommandBar::setVisible( ::sal_Bool _visible ) throw (uno::RuntimeException)
- {
- try
- {
-- uno::Reference< frame::XFrame > xFrame( getCurrentDocument()->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW );
-+ uno::Reference< frame::XFrame > xFrame( m_xModel->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 )
-@@ -313,7 +313,7 @@ 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 >() ) );
-+ uno::Reference< XCommandBarControls > xCommandBarControls( new ScVbaCommandBarControls( this, mxContext, uno::Reference< container::XIndexAccess >(), m_xModel ) );
- if( aIndex.hasValue() )
- {
- if( aIndex >>= nIndex )
-diff --git vbahelper/source/vbahelper/vbacommandbar.hxx vbahelper/source/vbahelper/vbacommandbar.hxx
-index c53a5cd..52f63bc 100644
---- vbahelper/source/vbahelper/vbacommandbar.hxx
-+++ vbahelper/source/vbahelper/vbacommandbar.hxx
-@@ -78,9 +78,10 @@ protected:
- void getToolBarSettings( rtl::OUString sToolBarName ) throw( css::uno::RuntimeException );
- void getMenuSettings();
- void addCustomBar();
-+ css::uno::Reference< css::frame::XModel > m_xModel;
- 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 );
-+ ScVbaCommandBar( 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 nModuleType ) throw( css::uno::RuntimeException );
-+ ScVbaCommandBar( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, const css::uno::Reference< css::frame::XModel >& xModel, 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; };
-diff --git vbahelper/source/vbahelper/vbacommandbarcontrol.cxx vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
-index 2fcce8a..1bea689 100644
---- vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
-+++ vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
-@@ -69,7 +69,7 @@ beans::PropertyValues lcl_repalcePropertyValue( beans::PropertyValues aPropertyV
- return aPropertyValues;
- }
-
--ScVbaCommandBarControl::ScVbaCommandBarControl( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition, sal_Int32 nType ) throw (uno::RuntimeException) : CommandBarControl_BASE( xParent, xContext ), m_sName( sName ), m_nPosition( nPosition ), m_nType( nType )
-+ScVbaCommandBarControl::ScVbaCommandBarControl( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const rtl::OUString& sName, sal_Int32 nPosition, sal_Int32 nType ) throw (uno::RuntimeException) : CommandBarControl_BASE( xParent, xContext ), m_sName( sName ), m_nPosition( nPosition ), m_nType( nType )
- {
- // exsiting CommandBarBarControl
- m_xParentHardRef.set( xParent, uno::UNO_QUERY_THROW );
-@@ -99,7 +99,7 @@ ScVbaCommandBarControl::ScVbaCommandBarControl( const uno::Reference< XHelperInt
- }
- m_bTemporary = sal_True;
- }
--ScVbaCommandBarControl::ScVbaCommandBarControl( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition, sal_Bool bTemporary, sal_Int32 nType) throw (uno::RuntimeException) : CommandBarControl_BASE( xParent, xContext ), m_nPosition( nPosition ), m_bTemporary( bTemporary ), m_nType( nType )
-+ScVbaCommandBarControl::ScVbaCommandBarControl( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const rtl::OUString& sName, sal_Int32 nPosition, sal_Bool bTemporary, sal_Int32 nType) throw (uno::RuntimeException) : CommandBarControl_BASE( xParent, xContext ), m_nPosition( nPosition ), m_bTemporary( bTemporary ), m_nType( nType )
- {
- m_xParentHardRef.set( xParent, uno::UNO_QUERY_THROW );
- initObjects();
-@@ -289,8 +289,7 @@ ScVbaCommandBarControl::setOnAction( const ::rtl::OUString& _onaction ) throw (u
- if( m_xCurrentSettings.is() )
- {
- // get the current model
-- uno::Reference< frame::XModel > xModel( getCurrentDocument() );
-- VBAMacroResolvedInfo aResolvedMacro = ooo::vba::resolveVBAMacro( getSfxObjShell( xModel ), _onaction, true );
-+ VBAMacroResolvedInfo aResolvedMacro = ooo::vba::resolveVBAMacro( getSfxObjShell( m_pCommandBarControls->GetModel() ), _onaction, true );
- if ( aResolvedMacro.IsResolved() )
- {
- rtl::OUString aCommandURL = ooo::vba::makeMacroURL( aResolvedMacro.ResolvedMacro() );
-@@ -353,7 +352,7 @@ 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 >() ) );
-+ uno::Reference< XCommandBarControls > xCommandBarControls( new ScVbaCommandBarControls( this, mxContext, uno::Reference< container::XIndexAccess >(), m_pCommandBarControls->GetModel() ) );
- if( aIndex.hasValue() )
- {
- if( aIndex >>= nIndex )
-@@ -385,11 +384,11 @@ ScVbaCommandBarControl::getServiceNames()
- }
-
- //////////// ScVbaCommandBarPopup //////////////////////////////
--ScVbaCommandBarPopup::ScVbaCommandBarPopup( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition ) throw (uno::RuntimeException) : CommandBarPopup_BASE( xParent, xContext, sName, nPosition, office::MsoControlType::msoControlPopup )
-+ScVbaCommandBarPopup::ScVbaCommandBarPopup( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const rtl::OUString& sName, sal_Int32 nPosition ) throw (uno::RuntimeException) : CommandBarPopup_BASE( xParent, xContext, sName, nPosition, office::MsoControlType::msoControlPopup )
- {
- }
-
--ScVbaCommandBarPopup::ScVbaCommandBarPopup( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition, sal_Bool bTemporary ) throw (uno::RuntimeException) : CommandBarPopup_BASE( xParent, xContext, sName, nPosition, bTemporary, office::MsoControlType::msoControlPopup)
-+ScVbaCommandBarPopup::ScVbaCommandBarPopup( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const rtl::OUString& sName, sal_Int32 nPosition, sal_Bool bTemporary ) throw (uno::RuntimeException) : CommandBarPopup_BASE( xParent, xContext, sName, nPosition, bTemporary, office::MsoControlType::msoControlPopup )
- {
- }
-
-@@ -412,11 +411,11 @@ ScVbaCommandBarPopup::getServiceNames()
- }
-
- //////////// ScVbaCommandBarButton //////////////////////////////
--ScVbaCommandBarButton::ScVbaCommandBarButton( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition ) throw (uno::RuntimeException) : CommandBarButton_BASE( xParent, xContext, sName, nPosition, office::MsoControlType::msoControlButton )
-+ScVbaCommandBarButton::ScVbaCommandBarButton( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const rtl::OUString& sName, sal_Int32 nPosition ) throw (uno::RuntimeException) : CommandBarButton_BASE( xParent, xContext, sName, nPosition, office::MsoControlType::msoControlButton )
- {
- }
-
--ScVbaCommandBarButton::ScVbaCommandBarButton( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition, sal_Bool bTemporary ) throw (uno::RuntimeException) : CommandBarButton_BASE( xParent, xContext, sName, nPosition, bTemporary, office::MsoControlType::msoControlButton)
-+ScVbaCommandBarButton::ScVbaCommandBarButton( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const rtl::OUString& sName, sal_Int32 nPosition, sal_Bool bTemporary ) throw (uno::RuntimeException) : CommandBarButton_BASE( xParent, xContext, sName, nPosition, bTemporary, office::MsoControlType::msoControlButton)
- {
- }
-
-diff --git vbahelper/source/vbahelper/vbacommandbarcontrol.hxx vbahelper/source/vbahelper/vbacommandbarcontrol.hxx
-index 4d7d133..c1a8b07 100644
---- vbahelper/source/vbahelper/vbacommandbarcontrol.hxx
-+++ vbahelper/source/vbahelper/vbacommandbarcontrol.hxx
-@@ -51,9 +51,9 @@ 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_Int32 m_nType;
- sal_Bool m_bIsMenu;
- ScVbaCommandBarControls* m_pCommandBarControls;
- css::uno::Reference< ov::XHelperInterface > m_xParentHardRef;
-@@ -67,8 +67,8 @@ private:
- void createNewMenuBarControl();
- void createNewToolBarControl();
- public:
-- ScVbaCommandBarControl( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition = 0, sal_Int32 nType = ov::office::MsoControlType::msoControlButton ) throw (css::uno::RuntimeException);
-- ScVbaCommandBarControl( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition, sal_Bool bTemporary, sal_Int32 nType = ov::office::MsoControlType::msoControlButton ) throw (css::uno::RuntimeException);
-+ ScVbaCommandBarControl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const rtl::OUString& sName, sal_Int32 nPosition = 0, sal_Int32 nType = ov::office::MsoControlType::msoControlButton ) throw (css::uno::RuntimeException);
-+ ScVbaCommandBarControl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const rtl::OUString& sName, sal_Int32 nPosition, sal_Bool bTemporary, sal_Int32 nType = ov::office::MsoControlType::msoControlButton ) 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; };
-@@ -99,8 +99,8 @@ typedef cppu::ImplInheritanceHelper1< ScVbaCommandBarControl, ov::XCommandBarPop
- class ScVbaCommandBarPopup : public CommandBarPopup_BASE
- {
- public:
-- ScVbaCommandBarPopup( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition = 0 ) throw (css::uno::RuntimeException);
-- ScVbaCommandBarPopup( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition, sal_Bool bTemporary ) throw (css::uno::RuntimeException);
-+ ScVbaCommandBarPopup( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const rtl::OUString& sName, sal_Int32 nPosition = 0 ) throw (css::uno::RuntimeException);
-+ ScVbaCommandBarPopup( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const rtl::OUString& sName, sal_Int32 nPosition, sal_Bool bTemporary ) throw (css::uno::RuntimeException);
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-@@ -110,8 +110,8 @@ typedef cppu::ImplInheritanceHelper1< ScVbaCommandBarControl, ov::XCommandBarBut
- class ScVbaCommandBarButton : public CommandBarButton_BASE
- {
- public:
-- ScVbaCommandBarButton( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition = 0 ) throw (css::uno::RuntimeException);
-- ScVbaCommandBarButton( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition, sal_Bool bTemporary ) throw (css::uno::RuntimeException);
-+ ScVbaCommandBarButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const rtl::OUString& sName, sal_Int32 nPosition = 0 ) throw (css::uno::RuntimeException);
-+ ScVbaCommandBarButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const rtl::OUString& sName, sal_Int32 nPosition, sal_Bool bTemporary ) throw (css::uno::RuntimeException);
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-diff --git vbahelper/source/vbahelper/vbacommandbarcontrols.cxx vbahelper/source/vbahelper/vbacommandbarcontrols.cxx
-index 1d01405..c6adbc2 100644
---- vbahelper/source/vbahelper/vbacommandbarcontrols.cxx
-+++ vbahelper/source/vbahelper/vbacommandbarcontrols.cxx
-@@ -70,7 +70,7 @@ public:
- }
- };
-
--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 )
-+ScVbaCommandBarControls::ScVbaCommandBarControls( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< container::XIndexAccess> xIndexAccess, const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException) : CommandBarControls_BASE( xParent, xContext, xIndexAccess ), m_xModel( xModel )
- {
- m_bIsMenu = sal_False;
- m_bHasElements = sal_False;
-diff --git vbahelper/source/vbahelper/vbacommandbarcontrols.hxx vbahelper/source/vbahelper/vbacommandbarcontrols.hxx
-index ff00609..f9ebe25 100644
---- vbahelper/source/vbahelper/vbacommandbarcontrols.hxx
-+++ vbahelper/source/vbahelper/vbacommandbarcontrols.hxx
-@@ -57,9 +57,10 @@ private:
- 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::uno::Reference< css::frame::XModel > m_xModel;
-
- 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 );
-+ ScVbaCommandBarControls( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, const css::uno::Reference< css::container::XIndexAccess > xIndexAccess, const css::uno::Reference< css::frame::XModel >& xModel ) 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; };
-@@ -73,6 +74,7 @@ public:
- }
- rtl::OUString GetControlNameByIndex( const sal_Int32 nIndex ) throw ( css::uno::RuntimeException );
-
-+ css::uno::Reference< css::frame::XModel > GetModel() { return m_xModel; }
- // Attributes
- virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException);
- // XEnumerationAccess
-diff --git vbahelper/source/vbahelper/vbacommandbars.cxx vbahelper/source/vbahelper/vbacommandbars.cxx
-index 66a1652..3aae99b 100644
---- vbahelper/source/vbahelper/vbacommandbars.cxx
-+++ vbahelper/source/vbahelper/vbacommandbars.cxx
-@@ -54,8 +54,9 @@ class CommandBarEnumeration : public CommandBarEnumeration_BASE
- uno::Reference< XCommandBars > m_xCommandBars;
- uno::Sequence< rtl::OUString > m_sNames;
- sal_Int32 m_nCurrentPosition;
-+ uno::Reference< frame::XModel > m_xModel;
- 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 )
-+ CommandBarEnumeration( const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< XCommandBars > xCommandBars, const uno::Sequence< rtl::OUString > sNames, const uno::Reference< frame::XModel >& xModel ) : m_xContext( xContext ), m_xCommandBars( xCommandBars ), m_sNames( sNames ), m_nCurrentPosition( 0 ), m_xModel( xModel )
- {
- }
- virtual sal_Bool SAL_CALL hasMoreElements() throw ( uno::RuntimeException )
-@@ -79,7 +80,7 @@ public:
- 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 ) );
-+ uno::Reference< XCommandBar > xCommandBar( new ScVbaCommandBar( xHelperInterface, m_xContext, m_xModel, sName, sal_True, sal_False ) );
- if( xCommandBar.is() )
- return uno::makeAny( xCommandBar );
- else
-@@ -99,14 +100,14 @@ public:
- };
-
-
--ScVbaCommandBars::ScVbaCommandBars( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< container::XIndexAccess > xIndexAccess ) : CommandBars_BASE( xParent, xContext, xIndexAccess )
-+ScVbaCommandBars::ScVbaCommandBars( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< container::XIndexAccess > xIndexAccess, const uno::Reference< frame::XModel >& xModel ) : CommandBars_BASE( xParent, xContext, xIndexAccess ), m_xModel( xModel )
- {
- retrieveObjects();
- }
- void
- ScVbaCommandBars::retrieveObjects() throw ( uno::RuntimeException )
- {
-- uno::Reference< lang::XServiceInfo > xServiceInfo( getCurrentDocument(), uno::UNO_QUERY_THROW );
-+ uno::Reference< lang::XServiceInfo > xServiceInfo( m_xModel, uno::UNO_QUERY_THROW );
- if( xServiceInfo->supportsService( sSpreadsheetDocumentUrl ) )
- {
- m_sModuleName = sSpreadsheetDocumentUrl;
-@@ -132,7 +133,7 @@ ScVbaCommandBars::getElementType() throw ( uno::RuntimeException )
- uno::Reference< container::XEnumeration >
- ScVbaCommandBars::createEnumeration() throw ( uno::RuntimeException )
- {
-- return uno::Reference< container::XEnumeration >( new CommandBarEnumeration( mxContext, this, m_xNameAccess->getElementNames() ) );
-+ return uno::Reference< container::XEnumeration >( new CommandBarEnumeration( mxContext, this, m_xNameAccess->getElementNames(), m_xModel ) );
- }
-
- uno::Any
-@@ -145,15 +146,15 @@ ScVbaCommandBars::createCollectionObject( const uno::Any& aSource )
- sToolBarName = sToolBarName.toAsciiLowerCase();
- if( sToolBarName.equalsIgnoreAsciiCase( rtl::OUString::createFromAscii("Worksheet Menu Bar") ) )
- {
-- return uno::makeAny( uno::Reference< XCommandBar > ( new ScVbaCommandBar( this, mxContext, 0 ) ) );
-+ return uno::makeAny( uno::Reference< XCommandBar > ( new ScVbaCommandBar( this, mxContext, m_xModel, 0 ) ) );
- }
- else if( sToolBarName.equalsIgnoreAsciiCase( rtl::OUString::createFromAscii("Menu Bar") ) )
- {
-- return uno::makeAny( uno::Reference< XCommandBar > ( new ScVbaCommandBar( this, mxContext, 1 ) ) );
-+ return uno::makeAny( uno::Reference< XCommandBar > ( new ScVbaCommandBar( this, mxContext, m_xModel, 1 ) ) );
- }
- else if( checkToolBarExist( sToolBarName ) )
- {
-- return uno::makeAny( uno::Reference< XCommandBar > (new ScVbaCommandBar( this, mxContext, sToolBarName, sal_True, sal_False ) ) );
-+ return uno::makeAny( uno::Reference< XCommandBar > (new ScVbaCommandBar( this, mxContext, m_xModel, sToolBarName, sal_True, sal_False ) ) );
- }
- }
- return uno::Any();
-@@ -175,7 +176,7 @@ ScVbaCommandBars::Add( const css::uno::Any& Name, const css::uno::Any& /*Positio
- {
- bTemporary = sal_True;
- }
-- return uno::Reference< XCommandBar >( new ScVbaCommandBar( this, mxContext, sName.toAsciiLowerCase(), bTemporary, sal_True ) );
-+ return uno::Reference< XCommandBar >( new ScVbaCommandBar( this, mxContext, m_xModel, sName.toAsciiLowerCase(), bTemporary, sal_True ) );
- }
- sal_Int32 SAL_CALL
- ScVbaCommandBars::getCount() throw(css::uno::RuntimeException)
-diff --git vbahelper/source/vbahelper/vbacommandbars.hxx vbahelper/source/vbahelper/vbacommandbars.hxx
-index 7442002..d1ebf4b 100644
---- vbahelper/source/vbahelper/vbacommandbars.hxx
-+++ vbahelper/source/vbahelper/vbacommandbars.hxx
-@@ -52,8 +52,10 @@ private:
- css::uno::Reference< css::container::XNameAccess > m_xNameAccess;
- rtl::OUString m_sModuleName;
- void retrieveObjects() throw( css::uno::RuntimeException );
-+protected:
-+ css::uno::Reference< css::frame::XModel > m_xModel;
- 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 );
-+ ScVbaCommandBars( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, const css::uno::Reference< css::container::XIndexAccess > xIndexAccess, const css::uno::Reference< css::frame::XModel >& xModel );
-
- sal_Bool checkToolBarExist( rtl::OUString sToolBarName );
- rtl::OUString GetModuleName(){ return m_sModuleName; };
-diff --git vbahelper/source/vbahelper/vbadialogbase.cxx vbahelper/source/vbahelper/vbadialogbase.cxx
-index 205442e..6294fc7 100644
---- vbahelper/source/vbahelper/vbadialogbase.cxx
-+++ vbahelper/source/vbahelper/vbadialogbase.cxx
-@@ -38,15 +38,14 @@ void
- VbaDialogBase::Show() throw(uno::RuntimeException)
- {
- rtl::OUString aURL;
-- uno::Reference< frame::XModel > xModel = getCurrentDocument();
-- if ( xModel.is() )
-+ if ( m_xModel.is() )
- {
- aURL = mapIndexToName( mnIndex );
- if( aURL.getLength() == 0 )
- throw uno::RuntimeException(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " Unable to open the specified dialog " ) ),
- uno::Reference< XInterface > () );
-- dispatchRequests( xModel, aURL );
-+ dispatchRequests( m_xModel, aURL );
- }
- }
-
-diff --git vbahelper/source/vbahelper/vbadocumentbase.cxx vbahelper/source/vbahelper/vbadocumentbase.cxx
-index e53279e..339e454 100644
---- vbahelper/source/vbahelper/vbadocumentbase.cxx
-+++ vbahelper/source/vbahelper/vbadocumentbase.cxx
-@@ -137,7 +137,7 @@ VbaDocumentBase::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg,
- // we shouldn't do so. Otherwhise some strange things can happen.
- else
- {
-- uno::Reference< lang::XComponent > xDisposable ( getCurrentDocument(), uno::UNO_QUERY );
-+ uno::Reference< lang::XComponent > xDisposable ( getModel(), uno::UNO_QUERY );
- if ( xDisposable.is() )
- xDisposable->dispose();
- }
-diff --git vbahelper/source/vbahelper/vbadocumentsbase.cxx vbahelper/source/vbahelper/vbadocumentsbase.cxx
-index 6d5ddb3..e7907b7 100644
---- vbahelper/source/vbahelper/vbadocumentsbase.cxx
-+++ vbahelper/source/vbahelper/vbadocumentsbase.cxx
-@@ -242,11 +242,15 @@ VbaDocumentsBase::Add() throw (uno::RuntimeException)
- void
- VbaDocumentsBase::Close() throw (uno::RuntimeException)
- {
-+// #FIXME this *MUST* be wrong documents::close surely closes ALL documents
-+// in the collection, use of getCurrentDocument here is totally wrong
-+/*
- 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);
-+*/
- }
-
- // #TODO# #FIXME# can any of the unused params below be used?
-diff --git vbahelper/source/vbahelper/vbahelper.cxx vbahelper/source/vbahelper/vbahelper.cxx
-index 97ebb3b..c8c96cc 100644
---- vbahelper/source/vbahelper/vbahelper.cxx
-+++ vbahelper/source/vbahelper/vbahelper.cxx
-@@ -400,8 +400,9 @@ dispatchRequests (uno::Reference< frame::XModel>& xModel,rtl::OUString & aUrl)
-
-
-
-+
- uno::Reference< frame::XModel >
--getCurrentDocument() throw (uno::RuntimeException)
-+getCurrentDoc( const rtl::OUString& sKey ) throw (uno::RuntimeException)
- {
- uno::Reference< frame::XModel > xModel;
- SbxObject* pBasic = dynamic_cast< SbxObject* > ( SFX_APP()->GetBasic() );
-@@ -426,7 +427,7 @@ getCurrentDocument() throw (uno::RuntimeException)
-
-
- uno::Any aModel;
-- SbxVariable *pCompVar = basicChosen->Find( UniString(RTL_CONSTASCII_USTRINGPARAM("ThisComponent")), SbxCLASS_OBJECT );
-+ SbxVariable *pCompVar = basicChosen->Find( sKey, SbxCLASS_OBJECT );
-
- if ( pCompVar )
- {
-@@ -434,30 +435,19 @@ getCurrentDocument() throw (uno::RuntimeException)
- if ( sal_False == ( aModel >>= xModel ) ||
- !xModel.is() )
- {
-- // trying last gasp try the current component
-- uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-- // test if vba service is present
-- uno::Reference< uno::XComponentContext > xCtx( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
-- uno::Reference<lang::XMultiComponentFactory > xSMgr( xCtx->getServiceManager(), uno::UNO_QUERY_THROW );
-- uno::Reference< frame::XDesktop > xDesktop (xSMgr->createInstanceWithContext(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"), xCtx), uno::UNO_QUERY_THROW );
-- xModel.set( xDesktop->getCurrentComponent(), uno::UNO_QUERY );
-- if ( !xModel.is() )
-- {
-- throw uno::RuntimeException(
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can't extract model from basic ( its obviously not set yet ) therefore don't know the currently selected document") ), uno::Reference< uno::XInterface >() );
-- }
-- return xModel;
-+ throw uno::RuntimeException(
-+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can't extract model from basic ( its obviously not set yet ) therefore don't know the current documet context") ), uno::Reference< uno::XInterface >() );
- }
- else
- {
-- OSL_TRACE("Have model ThisComponent points to url %s",
-+ OSL_TRACE("Have model points to url %s",
- ::rtl::OUStringToOString( xModel->getURL(),
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- }
- }
- else
- {
-- OSL_TRACE("Failed to get ThisComponent");
-+ OSL_TRACE("Failed to get %s", rtl::OUStringToOString( sKey, RTL_TEXTENCODING_UTF8 ).getStr() );
- throw uno::RuntimeException(
- rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
-@@ -467,6 +457,21 @@ getCurrentDocument() throw (uno::RuntimeException)
- return xModel;
- }
-
-+
-+ uno::Reference< frame::XModel >
-+getCurrentExcelDoc() throw (uno::RuntimeException)
-+{
-+ static const rtl::OUString sThisExcelDoc( RTL_CONSTASCII_USTRINGPARAM("ThisExcelDoc" ) );
-+ return getCurrentDoc( sThisExcelDoc );
-+}
-+
-+ uno::Reference< frame::XModel >
-+getCurrentWordDoc() throw (uno::RuntimeException)
-+{
-+ static const rtl::OUString sThisWordDoc( RTL_CONSTASCII_USTRINGPARAM("ThisWordDoc" ) );
-+ return getCurrentDoc( sThisWordDoc );
-+}
-+
- sal_Int32
- OORGBToXLRGB( sal_Int32 nCol )
- {
-@@ -828,23 +833,13 @@ ConcreteXShapeGeometryAttributes::ConcreteXShapeGeometryAttributes( const css::u
- m_pShapeHelper.reset( new ShapeHelper( xShape ) );
- }
-
--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 getPointerStyle()
-+sal_Int32 getPointerStyle( const uno::Reference< frame::XModel >& xModel )
- {
-+
- sal_Int32 nPointerStyle( POINTER_ARROW );
- try
- {
-- const uno::Reference< frame::XController > xController( lcl_getCurrentController(), uno::UNO_SET_THROW );
-+ const uno::Reference< frame::XController > xController( xModel->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?
-@@ -859,11 +854,14 @@ sal_Int32 getPointerStyle()
- return nPointerStyle;
- }
-
--void setCursorHelper( const Pointer& rPointer, sal_Bool bOverWrite )
-+// #FIXME this method looks wrong, shouldn't it just affect calc *or* writer
-+// document/frame/window(s) but not both ( and depending on what api called
-+// this )
-+void setCursorHelper( const uno::Reference< frame::XModel >& xModel, const Pointer& rPointer, sal_Bool bOverWrite )
- {
- ::std::vector< uno::Reference< frame::XController > > aControllers;
-
-- const uno::Reference< frame::XModel2 > xModel2( SfxObjectShell::GetCurrentComponent(), uno::UNO_QUERY );
-+ uno::Reference< frame::XModel2 > xModel2( xModel, uno::UNO_QUERY );
- if ( xModel2.is() )
- {
- const uno::Reference< container::XEnumeration > xEnumControllers( xModel2->getControllers(), uno::UNO_SET_THROW );
-@@ -875,17 +873,12 @@ void setCursorHelper( const Pointer& rPointer, sal_Bool bOverWrite )
- }
- else
- {
-- const uno::Reference< frame::XModel > xModel( SfxObjectShell::GetCurrentComponent(), uno::UNO_QUERY );
-+ const uno::Reference< frame::XModel > xModel( xModel2, uno::UNO_QUERY );
- if ( xModel.is() )
- {
- const uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_SET_THROW );
- aControllers.push_back( xController );
- }
-- else
-- {
-- 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();
-diff --git vbahelper/source/vbahelper/vbashape.cxx vbahelper/source/vbahelper/vbashape.cxx
-index 5a8dbd6..c35745b 100644
---- vbahelper/source/vbahelper/vbashape.cxx
-+++ vbahelper/source/vbahelper/vbashape.cxx
-@@ -58,14 +58,14 @@ 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 )
-+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, const uno::Reference< frame::XModel >& xModel, sal_Int32 nType ) throw( lang::IllegalArgumentException ) : ScVbaShape_BASE( xParent, xContext ), m_xShape( xShape ), m_xShapes( xShapes ), m_nType( nType ), m_xModel( xModel )
- {
- m_xPropertySet.set( m_xShape, uno::UNO_QUERY_THROW );
- m_pShapeHelper.reset( new ShapeHelper( m_xShape ) );
- 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 )
-+ScVbaShape::ScVbaShape( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape >& xShape, const uno::Reference< frame::XModel >& xModel ) throw( lang::IllegalArgumentException ) : ScVbaShape_BASE( uno::Reference< XHelperInterface >(), xContext ), m_xShape( xShape ), m_xModel( xModel )
- {
- // add listener
- addListeners();
-@@ -311,8 +311,7 @@ ScVbaShape::getPictureFormat() throw (uno::RuntimeException)
- uno::Any SAL_CALL
- ScVbaShape::TextFrame() throw (uno::RuntimeException)
- {
-- uno::Reference< frame::XModel > xModel = getCurrentDocument();
-- uno::Reference< lang::XServiceInfo > xServiceInfo( xModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< lang::XServiceInfo > xServiceInfo( m_xModel, uno::UNO_QUERY_THROW );
- if( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.SpreadsheetDocument" ) ) ) )
- {
- uno::Reference< lang::XMultiServiceFactory > xSF( comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-@@ -452,8 +451,7 @@ ScVbaShape::ScaleWidth( double Factor, sal_Bool /*RelativeToOriginalSize*/, sal_
- 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 );
-+ uno::Reference< view::XSelectionSupplier > xSelectSupp( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW );
- xSelectSupp->select( uno::makeAny( m_xShape ) );
- }
-
-@@ -473,7 +471,7 @@ ScVbaShape::ShapeRange( const uno::Any& index ) throw ( uno::RuntimeException )
- 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 ) ) );
-+ uno::Reference< msforms::XShapeRange > xShapeRange( new ScVbaShapeRange( mxParent, mxContext, xIndexAccess, uno::Reference< drawing::XDrawPage >( xChild->getParent(), uno::UNO_QUERY_THROW ), m_xModel ) );
- if ( index.hasValue() )
- return xShapeRange->Item( index, uno::Any() );
- return uno::makeAny( xShapeRange );
-@@ -644,8 +642,7 @@ ScVbaShape::setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition )
- uno::Any SAL_CALL
- ScVbaShape::WrapFormat() throw (uno::RuntimeException)
- {
-- uno::Reference< frame::XModel > xModel = getCurrentDocument();
-- uno::Reference< lang::XServiceInfo > xServiceInfo( xModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< lang::XServiceInfo > xServiceInfo( m_xModel, uno::UNO_QUERY_THROW );
- if( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument" ) ) ) )
- {
- uno::Reference< lang::XMultiServiceFactory > xSF( comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-diff --git vbahelper/source/vbahelper/vbashaperange.cxx vbahelper/source/vbahelper/vbashaperange.cxx
-index ae1a1fb..0c3535b 100644
---- vbahelper/source/vbahelper/vbashaperange.cxx
-+++ vbahelper/source/vbahelper/vbashaperange.cxx
-@@ -58,7 +58,7 @@ public:
-
- };
-
--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)
-+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, const uno::Reference< frame::XModel >& xModel ) : ScVbaShapeRange_BASE( xParent, xContext, xShapes ), m_xDrawPage( xDrawPage ), m_nShapeGroupCount(0), m_xModel( xModel )
- {
- }
-
-@@ -66,8 +66,7 @@ ScVbaShapeRange::ScVbaShapeRange( const uno::Reference< XHelperInterface >& xPar
- 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 );
-+ uno::Reference< view::XSelectionSupplier > xSelectSupp( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW );
- xSelectSupp->select( uno::makeAny( getShapes() ) );
- }
-
-@@ -77,7 +76,7 @@ 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 ) );
-+ return uno::Reference< msforms::XShape >( new ScVbaShape( getParent(), mxContext, xShape, getShapes(), m_xModel, office::MsoShapeType::msoGroup ) );
- }
-
- uno::Reference< drawing::XShapes >
-@@ -359,7 +358,7 @@ 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 ) ) );
-+ uno::Reference< msforms::XShape > xVbShape( new ScVbaShape( uno::Reference< XHelperInterface >(), mxContext, xShape, getShapes(), m_xModel, ScVbaShape::getType( xShape ) ) );
- return uno::makeAny( xVbShape );
- }
-
-diff --git vbahelper/source/vbahelper/vbashapes.cxx vbahelper/source/vbahelper/vbashapes.cxx
-index 6515c6e..ee5cf91 100644
---- vbahelper/source/vbahelper/vbashapes.cxx
-+++ vbahelper/source/vbahelper/vbashapes.cxx
-@@ -89,7 +89,7 @@ void ScVbaShapes::initBaseCollection()
- 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)
-+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, const uno::Reference< frame::XModel>& xModel ): ScVbaShapes_BASE( xParent, xContext, xShapes ), m_nNewShapeCount(0), m_xModel( xModel )
- {
- m_xShapes.set( xShapes, uno::UNO_QUERY_THROW );
- m_xDrawPage.set( xShapes, uno::UNO_QUERY_THROW );
-@@ -108,7 +108,7 @@ ScVbaShapes::createCollectionObject( const css::uno::Any& aSource ) throw (uno::
- 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::makeAny( uno::Reference< msforms::XShape >( new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, m_xModel, ScVbaShape::getType( xShape ) ) ) );
- }
- return uno::Any();
- }
-@@ -208,14 +208,13 @@ ScVbaShapes::Range( const uno::Any& shapes ) throw (css::uno::RuntimeException)
- aIndex <<= sIndices;
- xShapes = getShapesByArrayIndices( aIndex );
- }
-- return new ScVbaShapeRange( getParent(), mxContext, xShapes, m_xDrawPage );
-+ return new ScVbaShapeRange( getParent(), mxContext, xShapes, m_xDrawPage, m_xModel );
- }
-
- 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 );
-+ uno::Reference< view::XSelectionSupplier > xSelectSupp( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW );
- try
- {
- xSelectSupp->select( uno::makeAny( m_xShapes ) );
-@@ -231,8 +230,7 @@ ScVbaShapes::SelectAll() throw (uno::RuntimeException)
- uno::Reference< drawing::XShape >
- ScVbaShapes::createShape( rtl::OUString service ) throw (css::uno::RuntimeException)
- {
-- // #FIXME don't use getCurrentDocument
-- uno::Reference< lang::XMultiServiceFactory > xMSF( getCurrentDocument(), uno::UNO_QUERY_THROW );
-+ uno::Reference< lang::XMultiServiceFactory > xMSF( m_xModel, uno::UNO_QUERY_THROW );
- uno::Reference< drawing::XShape > xShape( xMSF->createInstance( service ), uno::UNO_QUERY_THROW );
- return xShape;
- }
-@@ -264,7 +262,7 @@ ScVbaShapes::AddRectangle( sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWi
- size.Width = nWidth;
- xShape->setSize( size );
-
-- ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, ScVbaShape::getType( xShape ) );
-+ ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, m_xModel, ScVbaShape::getType( xShape ) );
- pScVbaShape->setRange( aRange );
- return uno::makeAny( uno::Reference< msforms::XShape > ( pScVbaShape ) );
- }
-@@ -308,7 +306,7 @@ ScVbaShapes::AddEllipse( sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWidt
- size.Width = nWidth;
- xShape->setSize(size);
-
-- ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, ScVbaShape::getType( xShape ) );
-+ ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, m_xModel, ScVbaShape::getType( xShape ) );
- pScVbaShape->setRange( aRange );
- return uno::makeAny( uno::Reference< msforms::XShape > ( pScVbaShape ) );
- }
-@@ -344,7 +342,7 @@ ScVbaShapes::AddLine( sal_Int32 StartX, sal_Int32 StartY, sal_Int32 endX, sal_In
- size.Width = nWidth;
- xShape->setSize(size);
-
-- ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, ScVbaShape::getType( xShape ) );
-+ ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, m_xModel, ScVbaShape::getType( xShape ) );
- return uno::makeAny( uno::Reference< msforms::XShape > ( pScVbaShape ) );
- }
-
-@@ -366,7 +364,7 @@ ScVbaShapes::AddShape( sal_Int32 _nType, sal_Int32 _nLeft, sal_Int32 _nTop, sal_
- uno::Any SAL_CALL
- ScVbaShapes::AddTextbox( sal_Int32 _nOrientation, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) throw (uno::RuntimeException)
- {
-- uno::Reference< lang::XServiceInfo > xServiceInfo( getCurrentDocument(), uno::UNO_QUERY_THROW );
-+ uno::Reference< lang::XServiceInfo > xServiceInfo( m_xModel, uno::UNO_QUERY_THROW );
- if( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument" ) ) ) )
- {
- return AddTextboxInWriter( _nOrientation, _nLeft, _nTop, _nWidth, _nHeight );
-@@ -416,7 +414,7 @@ ScVbaShapes::AddTextboxInWriter( sal_Int32 _nOrientation, sal_Int32 _nLeft, sal_
- xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "LayerName" ), uno::makeAny( sLayerName ) );
-
-
-- ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, ScVbaShape::getType( xShape ) );
-+ ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, m_xModel, ScVbaShape::getType( xShape ) );
- return uno::makeAny( uno::Reference< msforms::XShape > ( pScVbaShape ) );
- }
-
-@@ -445,7 +443,7 @@ ScVbaShapes::AddShape( const rtl::OUString& sService, const rtl::OUString& sName
- size.Width = nWidth;
- xShape->setSize(size);
-
-- ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, ScVbaShape::getType( xShape ) );
-+ ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, m_xModel, ScVbaShape::getType( xShape ) );
- return uno::makeAny( uno::Reference< msforms::XShape > ( pScVbaShape ) );
- }
- void
diff --git a/patches/vba/vba-cursor-pos-for-selected-maxrange.diff b/patches/vba/vba-cursor-pos-for-selected-maxrange.diff
deleted file mode 100644
index a25db85c0..000000000
--- a/patches/vba/vba-cursor-pos-for-selected-maxrange.diff
+++ /dev/null
@@ -1,24 +0,0 @@
-diff --git sc/source/ui/view/tabview3.cxx sc/source/ui/view/tabview3.cxx
-index c71049a..1a87bfb 100644
---- sc/source/ui/view/tabview3.cxx
-+++ sc/source/ui/view/tabview3.cxx
-@@ -1439,10 +1439,15 @@ void ScTabView::MarkRange( const ScRange& rRange, BOOL bSetCursor, BOOL bContinu
- {
- SCCOL nAlignX = rRange.aStart.Col();
- SCROW nAlignY = rRange.aStart.Row();
-- if ( rRange.aStart.Col() == 0 && rRange.aEnd.Col() == MAXCOL )
-- nAlignX = aViewData.GetPosX(WhichH(aViewData.GetActivePart()));
-- if ( rRange.aStart.Row() == 0 && rRange.aEnd.Row() == MAXROW )
-- nAlignY = aViewData.GetPosY(WhichV(aViewData.GetActivePart()));
-+ bool bCol = ( rRange.aStart.Col() == 0 && rRange.aEnd.Col() == MAXCOL );
-+ bool bRow = ( rRange.aStart.Row() == 0 && rRange.aEnd.Row() == MAXROW );
-+ if ( !bCol && !bRow )
-+ {
-+ if ( bCol )
-+ nAlignX = aViewData.GetPosX(WhichH(aViewData.GetActivePart()));
-+ if ( bRow )
-+ nAlignY = aViewData.GetPosY(WhichV(aViewData.GetActivePart()));
-+ }
- AlignToCursor( nAlignX, nAlignY, SC_FOLLOW_JUMP );
- }
- InitBlockMode( rRange.aStart.Col(), rRange.aStart.Row(), nTab );
diff --git a/patches/vba/vba-datevalue-function-fix.diff b/patches/vba/vba-datevalue-function-fix.diff
deleted file mode 100644
index 4d7728321..000000000
--- a/patches/vba/vba-datevalue-function-fix.diff
+++ /dev/null
@@ -1,22 +0,0 @@
---- basic/source/runtime/methods.cxx.orig 2008-09-05 10:23:14.000000000 +0800
-+++ basic/source/runtime/methods.cxx 2008-09-05 10:43:33.000000000 +0800
-@@ -1991,15 +1991,14 @@ RTLFUNC(DateValue)
- // It seems that both locale number formatter and English number formatter
- // are supported in Visual Basic.
- LanguageType eLangType = GetpApp()->GetSettings().GetLanguage();
-- if( !bSuccess && !(eLangType & LANGUAGE_ENGLISH))
-+ if( !bSuccess && ( eLangType != LANGUAGE_ENGLISH_US ) )
- {
- // Create a new SvNumberFormatter by using LANGUAGE_ENGLISH to get the date value;
- com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
- xFactory = comphelper::getProcessServiceFactory();
-- SvNumberFormatter* pFormatterEn = new SvNumberFormatter( xFactory, LANGUAGE_ENGLISH );
-- bSuccess = pFormatterEn->IsNumberFormat( aStr, nIndex, fResult );
-- nType = pFormatterEn->GetType( nIndex );
-- delete pFormatterEn;
-+ SvNumberFormatter aFormatter( xFactory, LANGUAGE_ENGLISH_US );
-+ bSuccess = aFormatter.IsNumberFormat( aStr, nIndex, fResult );
-+ nType = aFormatter.GetType( nIndex );
- }
-
- if(bSuccess && (nType==NUMBERFORMAT_DATE || nType==NUMBERFORMAT_DATETIME))
diff --git a/patches/vba/vba-dim-as-contants-fix.diff b/patches/vba/vba-dim-as-contants-fix.diff
deleted file mode 100644
index 5510647da..000000000
--- a/patches/vba/vba-dim-as-contants-fix.diff
+++ /dev/null
@@ -1,193 +0,0 @@
-diff --git basic/source/classes/sbunoobj.cxx basic/source/classes/sbunoobj.cxx
-index 18e1cce..ccf20e6 100644
---- basic/source/classes/sbunoobj.cxx
-+++ basic/source/classes/sbunoobj.cxx
-@@ -3170,11 +3170,16 @@ getTypeDescriptorEnumeration( const ::rtl::OUString& sSearchRoot,
-
- typedef std::hash_map< ::rtl::OUString, Any, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > VBAConstantsHash;
-
--SbxVariable* getVBAConstant( const String& rName )
-+VBAConstantHelper&
-+VBAConstantHelper::instance()
-+{
-+ static VBAConstantHelper aHelper;
-+ return aHelper;
-+}
-+
-+void
-+VBAConstantHelper::init()
- {
-- SbxVariable* pConst = NULL;
-- static VBAConstantsHash aConstCache;
-- static bool isInited = false;
- if ( !isInited )
- {
- Sequence< TypeClass > types(1);
-@@ -3182,39 +3187,77 @@ SbxVariable* getVBAConstant( const String& rName )
- Reference< XTypeDescriptionEnumeration > xEnum = getTypeDescriptorEnumeration( defaultNameSpace, types, TypeDescriptionSearchDepth_INFINITE );
-
- if ( !xEnum.is() )
-- return NULL;
-+ return; //NULL;
-
- while ( xEnum->hasMoreElements() )
- {
- Reference< XConstantsTypeDescription > xConstants( xEnum->nextElement(), UNO_QUERY );
- if ( xConstants.is() )
- {
-+ // store constant group name
-+ ::rtl::OUString sFullName = xConstants->getName();
-+ sal_Int32 indexLastDot = sFullName.lastIndexOf('.');
-+ ::rtl::OUString sLeafName( sFullName );
-+ if ( indexLastDot > -1 )
-+ sLeafName = sFullName.copy( indexLastDot + 1);
-+ aConstCache.push_back( sLeafName ); // assume constant group names are unique
- Sequence< Reference< XConstantTypeDescription > > aConsts = xConstants->getConstants();
- Reference< XConstantTypeDescription >* pSrc = aConsts.getArray();
- sal_Int32 nLen = aConsts.getLength();
- for ( sal_Int32 index =0; index<nLen; ++pSrc, ++index )
- {
-+ // store constant member name
- Reference< XConstantTypeDescription >& rXConst =
- *pSrc;
-- ::rtl::OUString sFullName = rXConst->getName();
-- sal_Int32 indexLastDot = sFullName.lastIndexOf('.');
-- ::rtl::OUString sLeafName;
-+ sFullName = rXConst->getName();
-+ indexLastDot = sFullName.lastIndexOf('.');
-+ sLeafName = sFullName;
- if ( indexLastDot > -1 )
- sLeafName = sFullName.copy( indexLastDot + 1);
-- aConstCache[ sLeafName.toAsciiLowerCase() ] = rXConst->getConstantValue();
-+ aConstHash[ sLeafName.toAsciiLowerCase() ] = rXConst->getConstantValue();
- }
- }
- }
- isInited = true;
- }
-+}
-+
-+bool
-+VBAConstantHelper::isVBAConstantType( const String& rName )
-+{
-+ init();
-+ bool bConstant = false;
-+ ::rtl::OUString sKey( rName );
-+ VBAConstantsVector::const_iterator it = aConstCache.begin();
-+
-+ for( ; it != aConstCache.end(); it++ )
-+ {
-+ if( sKey.equalsIgnoreAsciiCase( *it ) )
-+ {
-+ bConstant = true;
-+ break;
-+ }
-+ }
-+ return bConstant;
-+}
-+
-+SbxVariable*
-+VBAConstantHelper::getVBAConstant( const String& rName )
-+{
-+ SbxVariable* pConst = NULL;
-+ init();
-+
- ::rtl::OUString sKey( rName );
-- VBAConstantsHash::const_iterator it = aConstCache.find( sKey.toAsciiLowerCase() );
-- if ( it != aConstCache.end() )
-+
-+ VBAConstantsHash::const_iterator it = aConstHash.find( sKey.toAsciiLowerCase() );
-+
-+ if ( it != aConstHash.end() )
- {
- pConst = new SbxVariable( SbxVARIANT );
- pConst->SetName( rName );
- unoToSbxValue( pConst, it->second );
- }
-+
- return pConst;
- }
-
-diff --git basic/source/comp/dim.cxx basic/source/comp/dim.cxx
-index d23175e..b8b6a54 100644
---- basic/source/comp/dim.cxx
-+++ basic/source/comp/dim.cxx
-@@ -32,6 +32,8 @@
- #include "precompiled_basic.hxx"
- #include <basic/sbx.hxx>
- #include "sbcomp.hxx"
-+#include "sbunoobj.hxx"
-+
-
- // Deklaration einer Variablen
- // Bei Fehlern wird bis zum Komma oder Newline geparst.
-@@ -147,7 +149,7 @@ void SbiParser::TypeDecl( SbiSymDef& rDef, BOOL bAsNewAlreadyParsed )
- }
- }
- }
-- else if( rEnumArray->Find( aCompleteName, SbxCLASS_OBJECT ) )
-+ else if( rEnumArray->Find( aCompleteName, SbxCLASS_OBJECT ) || ( IsVBASupportOn() && VBAConstantHelper::instance().isVBAConstantType( aCompleteName ) ) )
- {
- eType = SbxLONG;
- break;
-diff --git basic/source/inc/sbunoobj.hxx basic/source/inc/sbunoobj.hxx
-index dc2cfef..6fff986 100644
---- basic/source/inc/sbunoobj.hxx
-+++ basic/source/inc/sbunoobj.hxx
-@@ -44,6 +44,7 @@
- #include <com/sun/star/script/XInvocation.hpp>
- #include <com/sun/star/reflection/XIdlClass.hpp>
- #include <rtl/ustring.hxx>
-+#include <hash_map>
-
- class SbUnoObject: public SbxObject
- {
-@@ -256,6 +257,26 @@ public:
- virtual void Clear();
- };
-
-+typedef std::hash_map< ::rtl::OUString, ::com::sun::star::uno::Any, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > VBAConstantsHash;
-+
-+typedef std::vector< rtl::OUString > VBAConstantsVector;
-+
-+class VBAConstantHelper
-+{
-+private:
-+
-+ VBAConstantsVector aConstCache;
-+ VBAConstantsHash aConstHash;
-+ bool isInited;
-+ VBAConstantHelper():isInited( false ) {}
-+ VBAConstantHelper(const VBAConstantHelper&);
-+ void init();
-+public:
-+ static VBAConstantHelper& instance();
-+ SbxVariable* getVBAConstant( const String& rName );
-+ bool isVBAConstantType( const String& rName );
-+};
-+
- #endif
-
-
-diff --git basic/source/runtime/step2.cxx basic/source/runtime/step2.cxx
-index 89b02c0..571e8cd 100644
---- basic/source/runtime/step2.cxx
-+++ basic/source/runtime/step2.cxx
-@@ -54,8 +54,6 @@ using namespace com::sun::star::script;
-
- using com::sun::star::uno::Reference;
-
--SbxVariable* getVBAConstant( const String& rName );
--
- // Suchen eines Elements
- // Die Bits im String-ID:
- // 0x8000 - Argv ist belegt
-@@ -144,7 +142,7 @@ SbxVariable* SbiRuntime::FindElement
- if ( pElem )
- bSetName = false; // don't overwrite uno name
- else
-- pElem = getVBAConstant( aName );
-+ pElem = VBAConstantHelper::instance().getVBAConstant( aName );
- }
- // #72382 VORSICHT! Liefert jetzt wegen unbekannten
- // Modulen IMMER ein Ergebnis!
diff --git a/patches/vba/vba-disable-toolbar+customizationimport.diff b/patches/vba/vba-disable-toolbar+customizationimport.diff
deleted file mode 100644
index d13cd2672..000000000
--- a/patches/vba/vba-disable-toolbar+customizationimport.diff
+++ /dev/null
@@ -1,54 +0,0 @@
-diff --git svx/inc/svx/xflbmsxy.hxx svx/inc/svx/xflbmsxy.hxx
-index 39f1f67..1b09bb6 100644
-diff --git svx/source/msfilter/msvbasic.cxx svx/source/msfilter/msvbasic.cxx
-index e25ff74..60667ed 100644
---- svx/source/msfilter/msvbasic.cxx
-+++ svx/source/msfilter/msvbasic.cxx
-@@ -952,6 +952,9 @@ int VBA_Impl::ReadVBAProject(const SvStorageRef &rxVBAStorage)
- SvStorageStreamRef xDir = rxVBAStorage->OpenSotStream(
- String( RTL_CONSTASCII_USTRINGPARAM( "dir" ) ),
- STREAM_STD_READ | STREAM_NOCREATE );
-+// disable read and import of Dir stream bits, e.g. project references and
-+// project name for 3.1 ( a bit unstable yet )
-+#if 0
- // decompress the stream
- std::auto_ptr< SvMemoryStream > xCmpDir;
- xCmpDir.reset( MSLZSS::decompressAsStream( xDir, 0 ) );
-@@ -959,6 +962,7 @@ int VBA_Impl::ReadVBAProject(const SvStorageRef &rxVBAStorage)
- DirDumper dDump;
- dDump.read( xCmpDir.get() );
- dDump.import( *this );
-+#endif
- if( !xVBAProject.Is() || SVSTREAM_OK != xVBAProject->GetError() )
- {
- DBG_WARNING("Not able to find vba project, cannot find macros");
-diff --git sw/source/filter/ww8/ww8par.cxx sw/source/filter/ww8/ww8par.cxx
-index c8ecc43..385de9b 100644
---- sw/source/filter/ww8/ww8par.cxx
-+++ sw/source/filter/ww8/ww8par.cxx
-@@ -4189,8 +4189,12 @@ ULONG SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
- mpDocShell->SetIsTemplate( pWwFib->fDot ); // point at tgc record
- const SvtFilterOptions* pVBAFlags = SvtFilterOptions::Get();
- maTracer.EnterEnvironment(sw::log::eMacros);
-+// dissable below for 3.1 at the moment, 'cause it's kinda immature
-+// similarly the project reference in svx/source/msvba
-+#if 0
- // Read Global templates
- ReadGlobalTemplateSettings();
-+#endif
- // Create and insert Excel vba Globals
- uno::Any aGlobs;
- aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstance( ::rtl::OUString::createFromAscii( "ooo.vba.word.Globals") );
-@@ -4202,8 +4206,12 @@ ULONG SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
- String s1(CREATE_CONST_ASC("Macros"));
- String s2(CREATE_CONST_ASC("VBA"));
- int nRet = aVBasic.Import( s1, s2, ! pVBAFlags->IsLoadWordBasicCode() );
-+// dissable below for 3.1 at the moment, 'cause it's kinda immature
-+// similarly the project reference in svx/source/msvba
-+#if 0
- WW8Customizations aCustomisations( pTableStream, *pWwFib );
- aCustomisations.Import( mpDocShell );
-+#endif
- if( 2 & nRet )
- {
- maTracer.Log(sw::log::eContainsVisualBasic);
diff --git a/patches/vba/vba-documentcontext.diff b/patches/vba/vba-documentcontext.diff
deleted file mode 100644
index bd856e9cd..000000000
--- a/patches/vba/vba-documentcontext.diff
+++ /dev/null
@@ -1,101 +0,0 @@
-diff --git basic/inc/basic/sbstar.hxx basic/inc/basic/sbstar.hxx
-index 5f2d594..ea7e75e 100644
---- basic/inc/basic/sbstar.hxx
-+++ basic/inc/basic/sbstar.hxx
-@@ -204,6 +204,7 @@ public:
- SbxObjectRef getRTL( void ) { return pRtl; }
- BOOL IsDocBasic() { return bDocBasic; }
- SbxVariable* VBAFind( const String& rName, SbxClassType t );
-+ bool GetUNOConstant( const sal_Char* _pAsciiName, ::com::sun::star::uno::Any& aOut );
- };
-
- #ifndef __SB_SBSTARBASICREF_HXX
-diff --git basic/source/basmgr/basmgr.cxx basic/source/basmgr/basmgr.cxx
-index 63c4376..1b25f42 100644
---- basic/source/basmgr/basmgr.cxx
-+++ basic/source/basmgr/basmgr.cxx
-@@ -1840,15 +1840,7 @@ bool BasicManager::GetGlobalUNOConstant( const sal_Char* _pAsciiName, ::com::sun
- StarBASIC* pStandardLib = GetStdLib();
- OSL_PRECOND( pStandardLib, "BasicManager::SetGlobalUNOConstant: no lib to insert into!" );
- if ( pStandardLib )
-- {
-- ::rtl::OUString sVarName( ::rtl::OUString::createFromAscii( _pAsciiName ) );
-- SbUnoObject* pGlobs = dynamic_cast<SbUnoObject*>( pStandardLib->Find( sVarName, SbxCLASS_DONTCARE ) );
-- if ( pGlobs )
-- {
-- aOut = pGlobs->getUnoAny();
-- bRes = true;
-- }
-- }
-+ bRes = pStandardLib->GetUNOConstant( _pAsciiName, aOut );
- return bRes;
- }
-
-diff --git basic/source/classes/sb.cxx basic/source/classes/sb.cxx
-index 302a2ed..de99045 100644
---- basic/source/classes/sb.cxx
-+++ basic/source/classes/sb.cxx
-@@ -1547,6 +1547,18 @@ BOOL StarBASIC::LoadOldModules( SvStream& )
- return FALSE;
- }
-
-+bool StarBASIC::GetUNOConstant( const sal_Char* _pAsciiName, ::com::sun::star::uno::Any& aOut )
-+{
-+ bool bRes = false;
-+ ::rtl::OUString sVarName( ::rtl::OUString::createFromAscii( _pAsciiName ) );
-+ SbUnoObject* pGlobs = dynamic_cast<SbUnoObject*>( Find( sVarName, SbxCLASS_DONTCARE ) );
-+ if ( pGlobs )
-+ {
-+ aOut = pGlobs->getUnoAny();
-+ bRes = true;
-+ }
-+ return bRes;
-+}
-
- //========================================================================
- // #118116 Implementation Collection object
-diff --git sc/source/ui/vba/vbarange.cxx sc/source/ui/vba/vbarange.cxx
-index 5f62736..6f303f0 100644
---- sc/source/ui/vba/vbarange.cxx
-+++ sc/source/ui/vba/vbarange.cxx
-@@ -1976,8 +1976,7 @@ ScVbaRange::Select() throw (uno::RuntimeException)
- // ThisComponent.CurrentController.Frame.getContainerWindow.SetFocus
- try
- {
-- // #FIXME don't use current document
-- 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();
-@@ -2547,8 +2546,7 @@ ScVbaRange::PasteSpecial( const uno::Any& Paste, const uno::Any& Operation, cons
- // #FIXME doen't use current document
- uno::Reference< view::XSelectionSupplier > xSelection( getCurrentDocument()->getCurrentController(), uno::UNO_QUERY_THROW );
- // save old selection
-- // #FIXME doen't use current document
-- uno::Reference< uno::XInterface > xSel( getCurrentDocument()->getCurrentSelection() );
-+ uno::Reference< uno::XInterface > xSel( getScDocShell()->GetModel()->getCurrentSelection() );
- // select this range
- xSelection->select( uno::makeAny( mxRange ) );
- // set up defaults
-@@ -3905,7 +3903,6 @@ ScVbaRange::ApplicationRange( const uno::Reference< uno::XComponentContext >& xC
- }
- }
- }
-- // #FIXME don't use current document
- uno::Reference< sheet::XSpreadsheetView > xView( getCurrentDocument()->getCurrentController(), uno::UNO_QUERY );
- uno::Reference< table::XCellRange > xSheetRange( xView->getActiveSheet(), uno::UNO_QUERY_THROW );
- ScVbaRange* pRange = new ScVbaRange( uno::Reference< XHelperInterface >(), xContext, xSheetRange );
-diff --git vbahelper/inc/vbahelper/vbahelper.hxx vbahelper/inc/vbahelper/vbahelper.hxx
-index cfc8ee0..29e8236 100644
---- vbahelper/inc/vbahelper/vbahelper.hxx
-+++ vbahelper/inc/vbahelper/vbahelper.hxx
-@@ -65,6 +65,8 @@ namespace ooo
- VBAHELPER_DLLPUBLIC css::uno::Reference< css::uno::XInterface > createVBAUnoAPIService( SfxObjectShell* pShell, const sal_Char* _pAsciiName ) throw (css::uno::RuntimeException);
- VBAHELPER_DLLPUBLIC css::uno::Reference< css::uno::XInterface > createVBAUnoAPIServiceWithArgs( SfxObjectShell* pShell, const sal_Char* _pAsciiName, const css::uno::Sequence< css::uno::Any >& aArgs ) throw (css::uno::RuntimeException);
- VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getCurrentDocument() throw (css::uno::RuntimeException);
-+ VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getDocumentContext() throw (css::uno::RuntimeException);
-+
- VBAHELPER_DLLPUBLIC css::uno::Reference< css::beans::XIntrospectionAccess > getIntrospectionAccess( const css::uno::Any& aObject ) throw (css::uno::RuntimeException);
- VBAHELPER_DLLPUBLIC css::uno::Reference< css::script::XTypeConverter > getTypeConverter( const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException);
-
diff --git a/patches/vba/vba-dont-load-for-odf.diff b/patches/vba/vba-dont-load-for-odf.diff
deleted file mode 100644
index 1e714f865..000000000
--- a/patches/vba/vba-dont-load-for-odf.diff
+++ /dev/null
@@ -1,522 +0,0 @@
-From 9c77225910a7bc637ecbaf83659502c816866621 Mon Sep 17 00:00:00 2001
-From: Jan Holesovsky <kendy@suse.cz>
-Date: Fri, 14 May 2010 17:00:03 +0200
-Subject: [PATCH 392/878] vba-dont-load-for-odf.diff
-
----
- forms/source/misc/InterfaceContainer.cxx | 2 +-
- sc/source/core/data/documen2.cxx | 3 +-
- sc/source/core/tool/interpr4.cxx | 4 +-
- sc/source/filter/excel/excimp8.cxx | 11 ++++
- sc/source/ui/docshell/docsh.cxx | 2 +
- sc/source/ui/docshell/docsh2.cxx | 2 +
- sc/source/ui/unoobj/servuno.cxx | 18 +++++--
- sc/util/makefile.mk | 1 -
- svx/source/form/fmundo.cxx | 47 ++++++++++-------
- sw/source/core/doc/doc.cxx | 3 +-
- sw/source/core/unocore/unocoll.cxx | 13 +++--
- sw/util/makefile.mk | 1 -
- vbahelper/inc/vbahelper/vbaaccesshelper.hxx | 79 +++++++++++++++++++++++++++
- vbahelper/inc/vbahelper/vbahelper.hxx | 12 +++--
- vbahelper/prj/d.lst | 1 +
- vbahelper/source/vbahelper/vbahelper.cxx | 16 ------
- 16 files changed, 158 insertions(+), 57 deletions(-)
- create mode 100644 vbahelper/inc/vbahelper/vbaaccesshelper.hxx
-
-diff --git a/forms/source/misc/InterfaceContainer.cxx b/forms/source/misc/InterfaceContainer.cxx
-index de4e1a2..6b7acbc 100644
---- a/forms/source/misc/InterfaceContainer.cxx
-+++ b/forms/source/misc/InterfaceContainer.cxx
-@@ -145,9 +145,9 @@ OInterfaceContainer::fakeVbaEventsHack( sal_Int32 _nIndex )
- {
- try
- {
-+ Reference< XCodeNameQuery > xNameQuery( xDocFac->createInstance( rtl::OUString::createFromAscii( "ooo.vba.VBACodeNameProvider" ) ), UNO_QUERY_THROW );
- Reference< ooo::vba::XVBAToOOEventDescGen > xDescSupplier( xFac->createInstance( rtl::OUString::createFromAscii( "ooo.vba.VBAToOOEventDesc" ) ), UNO_QUERY_THROW );
- Reference< XInterface > xIf( getByIndex( _nIndex ) , UNO_QUERY_THROW );
-- Reference< XCodeNameQuery > xNameQuery( xDocFac->createInstance( rtl::OUString::createFromAscii( "ooo.vba.VBACodeNameProvider" ) ), UNO_QUERY_THROW );
- rtl::OUString sCodeName;
- sCodeName = xNameQuery->getCodeNameForObject( xIf );
- Reference< XPropertySet > xProps( xIf, UNO_QUERY );
-diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
-index 5b4e826..a732d8d 100644
---- a/sc/source/core/data/documen2.cxx
-+++ b/sc/source/core/data/documen2.cxx
-@@ -95,6 +95,7 @@
- #include "clipparam.hxx"
- #include "macromgr.hxx"
- #include <com/sun/star/document/XVbaEventsHelper.hpp>
-+#include <vbahelper/vbaaccesshelper.hxx>
-
- // pImpl because including lookupcache.hxx in document.hxx isn't wanted, and
- // dtor plus helpers are convenient.
-@@ -1257,7 +1258,7 @@ using namespace com::sun::star;
- uno::Reference< document::XVbaEventsHelper >
- ScDocument::GetVbaEventsHelper()
- {
-- if( !mxVbaEventsHelper.is() )
-+ if( !mxVbaEventsHelper.is() && pShell && ooo::vba::isAlienExcelDoc( *pShell ) )
- {
- try
- {
-diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
-index a4e9af2..03e9c90 100644
---- a/sc/source/core/tool/interpr4.cxx
-+++ b/sc/source/core/tool/interpr4.cxx
-@@ -78,8 +78,8 @@
- #include <map>
- #include <algorithm>
- #include <functional>
--#include <vbahelper/vbahelper.hxx>
- #include <basic/basmgr.hxx>
-+#include <vbahelper/vbaaccesshelper.hxx>
- #include <memory>
-
- using namespace com::sun::star;
-@@ -2710,7 +2710,7 @@ lcl_setVBARange( ScRange& aRange, ScDocument* pDok, SbxVariable* pPar )
- uno::Sequence< uno::Any > aArgs(2);
- aArgs[0] = uno::Any( uno::Reference< uno::XInterface >() ); // dummy parent
- aArgs[1] = uno::Any( xCellRange );
-- xVBARange = ov::createVBAUnoAPIServiceWithArgs( pDok->GetDocumentShell(), "ooo.vba.excel.Range", aArgs );
-+ xVBARange = ooo::vba::createVBAUnoAPIServiceWithArgs( pDok->GetDocumentShell(), "ooo.vba.excel.Range", aArgs );
- if ( xVBARange.is() )
- {
- String sDummy(RTL_CONSTASCII_USTRINGPARAM("A-Range") );
-diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx
-index 05c4384..32a529a 100644
---- a/sc/source/filter/excel/excimp8.cxx
-+++ b/sc/source/filter/excel/excimp8.cxx
-@@ -275,6 +275,17 @@ void ImportExcel8::ReadBasic( void )
- {
- SvxImportMSVBasic aBasicImport( *pShell, *xRootStrg, bLoadCode, bLoadStrg );
- bool bAsComment = !bLoadExecutable;
-+ if ( !bAsComment )
-+ {
-+ uno::Any aGlobs;
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[ 0 ] <<= pShell->GetModel();
-+ aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.excel.Globals" ) ), aArgs );
-+ pShell->GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
-+ BasicManager* pAppMgr = SFX_APP()->GetBasicManager();
-+ if ( pAppMgr )
-+ pAppMgr->SetGlobalUNOConstant( "ThisExcelDoc", aArgs[ 0 ] );
-+ }
- aBasicImport.Import( EXC_STORAGE_VBA_PROJECT, EXC_STORAGE_VBA, bAsComment );
- if ( !bAsComment )
- {
-diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
-index 4e3ae87..5bc2743 100644
---- a/sc/source/ui/docshell/docsh.cxx
-+++ b/sc/source/ui/docshell/docsh.cxx
-@@ -370,6 +370,7 @@ void ScDocShell::AfterXMLLoading(sal_Bool bRet)
- }
- else
- aDocument.SetInsertingFromOtherDoc( FALSE );
-+#if 0
- // add vba globals ( if they are availabl )
- uno::Any aGlobs;
- uno::Sequence< uno::Any > aArgs(1);
-@@ -396,6 +397,7 @@ void ScDocShell::AfterXMLLoading(sal_Bool bRet)
- if ( xEvt.is() )
- xEvt->setIgnoreEvents( sal_False );
- #endif
-+#endif
- aDocument.SetImportingXML( FALSE );
- aDocument.EnableExecuteLink( true );
- aDocument.EnableUndo( TRUE );
-diff --git a/sc/source/ui/docshell/docsh2.cxx b/sc/source/ui/docshell/docsh2.cxx
-index 91a9204..8ca6e5f 100644
---- a/sc/source/ui/docshell/docsh2.cxx
-+++ b/sc/source/ui/docshell/docsh2.cxx
-@@ -102,6 +102,7 @@ BOOL __EXPORT ScDocShell::InitNew( const uno::Reference < embed::XStorage >& xSt
-
- InitItems();
- CalcOutputFactor();
-+#if 0
- uno::Any aGlobs;
- uno::Sequence< uno::Any > aArgs(1);
- aArgs[ 0 ] <<= GetModel();
-@@ -121,6 +122,7 @@ BOOL __EXPORT ScDocShell::InitNew( const uno::Reference < embed::XStorage >& xSt
- BasicManager* pAppMgr = SFX_APP()->GetBasicManager();
- if ( pAppMgr )
- pAppMgr->SetGlobalUNOConstant( "ThisExcelDoc", aArgs[ 0 ] );
-+#endif
-
- return bRet;
- }
-diff --git a/sc/source/ui/unoobj/servuno.cxx b/sc/source/ui/unoobj/servuno.cxx
-index aec4384..e97bf57 100644
---- a/sc/source/ui/unoobj/servuno.cxx
-+++ b/sc/source/ui/unoobj/servuno.cxx
-@@ -66,7 +66,7 @@
- #include <com/sun/star/script/ScriptEventDescriptor.hpp>
- #include <comphelper/componentcontext.hxx>
- #include <cppuhelper/component_context.hxx>
--#include <vbahelper/vbahelper.hxx>
-+#include <vbahelper/vbaaccesshelper.hxx>
- using namespace ::com::sun::star;
-
- class ScVbaObjectForCodeNameProvider : public ::cppu::WeakImplHelper1< container::XNameAccess >
-@@ -84,7 +84,7 @@ public:
- uno::Sequence< uno::Any > aArgs(2);
- aArgs[0] = uno::Any( uno::Reference< uno::XInterface >() );
- aArgs[1] = uno::Any( mpDocShell->GetModel() );
-- maWorkbook <<= ov::createVBAUnoAPIServiceWithArgs( mpDocShell, "ooo.vba.excel.Workbook", aArgs );
-+ maWorkbook <<= ooo::vba::createVBAUnoAPIServiceWithArgs( mpDocShell, "ooo.vba.excel.Workbook", aArgs );
- }
-
- virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException )
-@@ -117,7 +117,7 @@ public:
- aArgs[0] = maWorkbook;
- aArgs[1] = uno::Any( xModel );
- aArgs[2] = uno::Any( rtl::OUString( sSheetName ) );
-- maCachedObject <<= ov::createVBAUnoAPIServiceWithArgs( mpDocShell, "ooo.vba.excel.Worksheet", aArgs );
-+ maCachedObject <<= ooo::vba::createVBAUnoAPIServiceWithArgs( mpDocShell, "ooo.vba.excel.Worksheet", aArgs );
- break;
- }
- }
-@@ -532,10 +532,18 @@ uno::Reference<uno::XInterface> ScServiceProvider::MakeInstance(
- }
- break;
- case SC_SERVICE_VBAOBJECTPROVIDER:
-- xRet.set(static_cast<container::XNameAccess*>(new ScVbaObjectForCodeNameProvider( pDocShell )));
-+ if ( pDocShell && ooo::vba::isAlienExcelDoc( *pDocShell ) )
-+ {
-+ OSL_TRACE("**** creating VBA Object mapper");
-+ xRet.set(static_cast<container::XNameAccess*>(new ScVbaObjectForCodeNameProvider( pDocShell )));
-+ }
- break;
- case SC_SERVICE_VBACODENAMEPROVIDER:
-- xRet.set(static_cast<document::XCodeNameQuery*>(new ScVbaCodeNameProvider( pDocShell )));
-+ if ( pDocShell && ooo::vba::isAlienExcelDoc( *pDocShell ) )
-+ {
-+ OSL_TRACE("**** creating VBA Object provider");
-+ xRet.set(static_cast<document::XCodeNameQuery*>(new ScVbaCodeNameProvider( pDocShell )));
-+ }
- break;
- }
- return xRet;
-diff --git a/sc/util/makefile.mk b/sc/util/makefile.mk
-index a20cc03..cccfae0 100644
---- a/sc/util/makefile.mk
-+++ b/sc/util/makefile.mk
-@@ -75,7 +75,6 @@ SHL1IMPLIB= sci
-
- # dynamic libraries
- SHL1STDLIBS= \
-- $(VBAHELPERLIB) \
- $(BASICLIB) \
- $(SFXLIB) \
- $(SVTOOLLIB) \
-diff --git a/svx/source/form/fmundo.cxx b/svx/source/form/fmundo.cxx
-index 5082693..6112fdc 100644
---- a/svx/source/form/fmundo.cxx
-+++ b/svx/source/form/fmundo.cxx
-@@ -95,25 +95,7 @@ class ScriptEventListenerWrapper : public ScriptEventListener_BASE
- public:
- ScriptEventListenerWrapper( FmFormModel& _rModel) throw ( RuntimeException ) : pModel(&_rModel)
- {
-- Reference < XPropertySet > xProps(
-- ::comphelper::getProcessServiceFactory(), UNO_QUERY );
-- if ( xProps.is() )
-- {
-- Reference< XComponentContext > xCtx( xProps->getPropertyValue(
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), UNO_QUERY );
-- if ( xCtx.is() )
-- {
-- Reference< XMultiComponentFactory > xMFac(
-- xCtx->getServiceManager(), UNO_QUERY );
-- if ( xMFac.is() )
-- {
-- m_vbaListener.set( xMFac->createInstanceWithContext(
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
-- "ooo.vba.EventListener" ) ), xCtx ),
-- UNO_QUERY_THROW );
-- }
-- }
-- }
-+
- }
- // XEventListener
- virtual void SAL_CALL disposing(const EventObject& ) throw( RuntimeException ){}
-@@ -141,6 +123,33 @@ public:
- private:
- void setModel()
- {
-+ if ( !m_vbaListener.is() )
-+ {
-+ Reference < XPropertySet > xProps(
-+ ::comphelper::getProcessServiceFactory(), UNO_QUERY );
-+ if ( xProps.is() )
-+ {
-+ Reference< XComponentContext > xCtx( xProps->getPropertyValue(
-+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), UNO_QUERY );
-+ if ( xCtx.is() )
-+ {
-+ Reference< XMultiComponentFactory > xMFac(
-+ xCtx->getServiceManager(), UNO_QUERY );
-+ SfxObjectShellRef xObjSh = pModel->GetObjectShell();
-+ Reference< XMultiServiceFactory > xDocFac;
-+ if ( xObjSh.Is() )
-+ xDocFac.set( xObjSh->GetModel(), UNO_QUERY );
-+
-+ if ( xMFac.is() )
-+ {
-+ m_vbaListener.set( xMFac->createInstanceWithContext(
-+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
-+ "ooo.vba.EventListener" ) ), xCtx ),
-+ UNO_QUERY_THROW );
-+ }
-+ }
-+ }
-+ }
- Reference< XPropertySet > xProps( m_vbaListener, UNO_QUERY );
- if ( xProps.is() )
- {
-diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
-index a223dc7..1f61019 100644
---- a/sw/source/core/doc/doc.cxx
-+++ b/sw/source/core/doc/doc.cxx
-@@ -107,6 +107,7 @@
-
- #include <osl/diagnose.h>
- #include <osl/interlck.h>
-+#include <vbahelper/vbaaccesshelper.hxx>
-
- /* @@@MAINTAINABILITY-HORROR@@@
- Probably unwanted dependency on SwDocShell
-@@ -2007,7 +2008,7 @@ void SwDoc::ChkCondColls()
- uno::Reference< document::XVbaEventsHelper >
- SwDoc::GetVbaEventsHelper()
- {
-- if( !mxVbaEventsHelper.is() )
-+ if( !mxVbaEventsHelper.is() && GetDocShell() && ooo::vba::isAlienWordDoc( *GetDocShell() ) )
- {
- try
- {
-diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx
-index 73acb2d..25c8297 100644
---- a/sw/source/core/unocore/unocoll.cxx
-+++ b/sw/source/core/unocore/unocoll.cxx
-@@ -81,7 +81,7 @@
- #include <com/sun/star/script/ModuleInfo.hpp>
- #include <com/sun/star/script/ModuleType.hpp>
- #include <com/sun/star/script/ScriptEventDescriptor.hpp>
--#include <vbahelper/vbahelper.hxx>
-+#include <vbahelper/vbaaccesshelper.hxx>
- #include <basic/basmgr.hxx>
-
- using ::rtl::OUString;
-@@ -255,7 +255,7 @@ public:
- uno::Sequence< uno::Any > aArgs( 2 );
- aArgs[0] = uno::Any( uno::Reference< uno::XInterface >() );
- aArgs[1] = uno::Any( mpDocShell->GetModel() );
-- uno::Reference< uno::XInterface > xDocObj = ov::createVBAUnoAPIServiceWithArgs( mpDocShell, "ooo.vba.word.Document" , aArgs );
-+ uno::Reference< uno::XInterface > xDocObj = ooo::vba::createVBAUnoAPIServiceWithArgs( mpDocShell, "ooo.vba.word.Document" , aArgs );
- OSL_TRACE("Creating Object ( ooo.vba.word.Document ) 0x%x", xDocObj.get() );
- return uno::makeAny( xDocObj );
- }
-@@ -583,14 +583,17 @@ uno::Reference< uno::XInterface > SwXServiceProvider::MakeInstance(sal_uInt16
- break;
- case SW_SERVICE_VBACODENAMEPROVIDER :
- {
-- SwVbaCodeNameProvider* pObjProv = new SwVbaCodeNameProvider( pDoc->GetDocShell() );
-- xRet = (cppu::OWeakObject*)pObjProv;
-+ if ( pDoc->GetDocShell() && ooo::vba::isAlienWordDoc( *pDoc->GetDocShell() ) )
-+ {
-+ SwVbaCodeNameProvider* pObjProv = new SwVbaCodeNameProvider( pDoc->GetDocShell() );
-+ xRet = (cppu::OWeakObject*)pObjProv;
-+ }
- }
- break;
- case SW_SERVICE_VBAPROJECTNAMEPROVIDER :
- {
- uno::Reference< container::XNameContainer > xProjProv = pDoc->GetVBATemplateToProjectCache();
-- if ( !xProjProv.is() )
-+ if ( !xProjProv.is() && pDoc->GetDocShell() && ooo::vba::isAlienWordDoc( *pDoc->GetDocShell() ) )
- {
- xProjProv = new SwVbaProjectNameProvider( pDoc->GetDocShell() );
- pDoc->SetVBATemplateToProjectCache( xProjProv );
-diff --git a/sw/util/makefile.mk b/sw/util/makefile.mk
-index 88f6731..6c74b8f 100644
---- a/sw/util/makefile.mk
-+++ b/sw/util/makefile.mk
-@@ -123,7 +123,6 @@ SHL1STDLIBS+= \
- $(SALHELPERLIB) \
- $(ICUUCLIB) \
- $(I18NUTILLIB) \
-- $(VBAHELPERLIB) \
- $(AVMEDIALIB)
-
- .IF "$(GUI)"=="WNT"
-diff --git a/vbahelper/inc/vbahelper/vbaaccesshelper.hxx b/vbahelper/inc/vbahelper/vbaaccesshelper.hxx
-new file mode 100644
-index 0000000..79bb44c
---- /dev/null
-+++ b/vbahelper/inc/vbahelper/vbaaccesshelper.hxx
-@@ -0,0 +1,79 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef OOVBAAPI_VBA_ACCESS_HELPER_HXX
-+#define OOVBAAPI_VBA_ACCESS_HELPER_HXX
-+
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <basic/basmgr.hxx>
-+#include <sfx2/objsh.hxx>
-+#include <sfx2/docfilt.hxx>
-+#include <sfx2/docfile.hxx>
-+#define VBAHELPER_DLLIMPLEMENTATION
-+#include <vbahelper/vbadllapi.h>
-+#include <memory>
-+namespace css = ::com::sun::star;
-+namespace ooo
-+{
-+ namespace vba
-+ {
-+
-+ VBAHELPER_DLLPRIVATE inline css::uno::Reference< css::lang::XMultiServiceFactory > getVBAServiceFactory( SfxObjectShell* pShell )
-+ {
-+ css::uno::Any aUnoVar;
-+ if ( !pShell || ! pShell->GetBasicManager()->GetGlobalUNOConstant( "VBAGlobals", aUnoVar ) )
-+ throw css::lang::IllegalArgumentException();
-+ css::uno::Reference< css::lang::XMultiServiceFactory > xVBAFactory( aUnoVar, css::uno::UNO_QUERY_THROW );
-+ return xVBAFactory;
-+ }
-+
-+ VBAHELPER_DLLPUBLIC inline css::uno::Reference< css::uno::XInterface > createVBAUnoAPIServiceWithArgs( SfxObjectShell* pShell, const sal_Char* _pAsciiName, const css::uno::Sequence< css::uno::Any >& aArgs ) throw (css::uno::RuntimeException)
-+ {
-+ OSL_PRECOND( pShell, "createVBAUnoAPIService: no shell!" );
-+ ::rtl::OUString sVarName( ::rtl::OUString::createFromAscii( _pAsciiName ) );
-+ css::uno::Reference< css::uno::XInterface > xIf = getVBAServiceFactory( pShell )->createInstanceWithArguments( sVarName, aArgs );
-+ return xIf;
-+ }
-+
-+
-+ VBAHELPER_DLLPRIVATE inline bool isAlienDoc( SfxObjectShell& rDocShell, const char* pMimeType )
-+ {
-+ bool bRes( false );
-+ const SfxFilter *pFilt = rDocShell.GetMedium()->GetFilter();
-+ if ( pFilt && pFilt->IsAlienFormat() )
-+ bRes = ( pFilt->GetMimeType().CompareToAscii( pMimeType ) == 0 );
-+ return bRes;
-+ }
-+ VBAHELPER_DLLPUBLIC inline bool isAlienExcelDoc( SfxObjectShell& rDocShell ) { return isAlienDoc( rDocShell, "application/vnd.ms-excel" ); }
-+ VBAHELPER_DLLPUBLIC inline bool isAlienWordDoc( SfxObjectShell& rDocShell ) { return isAlienDoc( rDocShell, "application/vnd.ms-word" ); }
-+
-+ } // openoffice
-+} // org
-+
-+#endif
-diff --git a/vbahelper/inc/vbahelper/vbahelper.hxx b/vbahelper/inc/vbahelper/vbahelper.hxx
-index 8ec59f8..89b0298 100644
---- a/vbahelper/inc/vbahelper/vbahelper.hxx
-+++ b/vbahelper/inc/vbahelper/vbahelper.hxx
-@@ -38,17 +38,19 @@
- #include <com/sun/star/lang/IllegalArgumentException.hpp>
- #include <com/sun/star/awt/XControl.hpp>
- #include <com/sun/star/awt/XDevice.hpp>
-+#include <basic/basmgr.hxx>
- #include <basic/sberrors.hxx>
- #include <cppuhelper/implbase1.hxx>
- #include <com/sun/star/frame/XModel.hpp>
- #include <sfx2/dispatch.hxx>
--//#include <ooo/vba/msforms/XShape.hpp>
-+#include <sfx2/objsh.hxx>
-+#include <sfx2/docfilt.hxx>
-+#include <sfx2/docfile.hxx>
- #include <vcl/pointr.hxx>
--#define VBAHELPER_DLLIMPLEMENTATION
--#include <vbahelper/vbadllapi.h>
- #include <memory>
--namespace css = ::com::sun::star;
-+#include "vbaaccesshelper.hxx"
-
-+namespace css = ::com::sun::star;
- namespace ooo
- {
- namespace vba
-@@ -65,7 +67,7 @@ namespace ooo
- }
- VBAHELPER_DLLPUBLIC SfxObjectShell* getSfxObjShell( const css::uno::Reference< css::frame::XModel >& xModel ) throw ( css::uno::RuntimeException);
- VBAHELPER_DLLPUBLIC css::uno::Reference< css::uno::XInterface > createVBAUnoAPIService( SfxObjectShell* pShell, const sal_Char* _pAsciiName ) throw (css::uno::RuntimeException);
-- VBAHELPER_DLLPUBLIC css::uno::Reference< css::uno::XInterface > createVBAUnoAPIServiceWithArgs( SfxObjectShell* pShell, const sal_Char* _pAsciiName, const css::uno::Sequence< css::uno::Any >& aArgs ) throw (css::uno::RuntimeException);
-+
- css::uno::Reference< css::frame::XModel > getCurrentDoc( const rtl::OUString& sKey ) throw (css::uno::RuntimeException);
- VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getCurrentExcelDoc( const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException);
- VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getCurrentWordDoc( const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException);
-diff --git a/vbahelper/prj/d.lst b/vbahelper/prj/d.lst
-index db11559..2d20ab1 100644
---- a/vbahelper/prj/d.lst
-+++ b/vbahelper/prj/d.lst
-@@ -8,6 +8,7 @@
- mkdir: %_DEST%\inc%_EXT%\basic
- ..\inc\vbahelper\vbacollectionimpl.hxx %_DEST%\inc%_EXT%\vbahelper\vbacollectionimpl.hxx
- ..\inc\vbahelper\vbahelper.hxx %_DEST%\inc%_EXT%\vbahelper\vbahelper.hxx
-+..\inc\vbahelper\vbaaccesshelper.hxx %_DEST%\inc%_EXT%\vbahelper\vbaaccesshelper.hxx
- ..\inc\vbahelper\helperdecl.hxx %_DEST%\inc%_EXT%\vbahelper\helperdecl.hxx
- ..\inc\vbahelper\vbahelperinterface.hxx %_DEST%\inc%_EXT%\vbahelper\vbahelperinterface.hxx
- ..\inc\vbahelper\vbaapplicationbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbaapplicationbase.hxx
-diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx
-index fd99816..2f57755 100644
---- a/vbahelper/source/vbahelper/vbahelper.cxx
-+++ b/vbahelper/source/vbahelper/vbahelper.cxx
-@@ -102,15 +102,6 @@ namespace ooo
- namespace vba
- {
-
--uno::Reference< lang::XMultiServiceFactory > getVBAServiceFactory( SfxObjectShell* pShell )
--{
-- uno::Any aUnoVar;
-- if ( !pShell || ! pShell->GetBasicManager()->GetGlobalUNOConstant( "VBAGlobals", aUnoVar ) )
-- throw lang::IllegalArgumentException();
-- uno::Reference< lang::XMultiServiceFactory > xVBAFactory( aUnoVar, uno::UNO_QUERY_THROW );
-- return xVBAFactory;
--}
--
- css::uno::Reference< css::uno::XInterface > createVBAUnoAPIService( SfxObjectShell* pShell, const sal_Char* _pAsciiName ) throw (css::uno::RuntimeException)
- {
- OSL_PRECOND( pShell, "createVBAUnoAPIService: no shell!" );
-@@ -118,13 +109,6 @@ css::uno::Reference< css::uno::XInterface > createVBAUnoAPIService( SfxObjectShe
- return getVBAServiceFactory( pShell )->createInstance( sVarName );
- }
-
--css::uno::Reference< css::uno::XInterface > createVBAUnoAPIServiceWithArgs( SfxObjectShell* pShell, const sal_Char* _pAsciiName, const uno::Sequence< uno::Any >& aArgs ) throw ( css::uno::RuntimeException )
--{
-- OSL_PRECOND( pShell, "createVBAUnoAPIService: no shell!" );
-- ::rtl::OUString sVarName( ::rtl::OUString::createFromAscii( _pAsciiName ) );
-- uno::Reference< uno::XInterface > xIf = getVBAServiceFactory( pShell )->createInstanceWithArguments( sVarName, aArgs );
-- return xIf;
--}
- // helper method to determine if the view ( calc ) is in print-preview mode
- bool isInPrintPreview( SfxViewFrame* pView )
- {
---
-1.7.0.1
-
diff --git a/patches/vba/vba-empty-comparison-fix.diff b/patches/vba/vba-empty-comparison-fix.diff
deleted file mode 100644
index d37c7dabc..000000000
--- a/patches/vba/vba-empty-comparison-fix.diff
+++ /dev/null
@@ -1,11 +0,0 @@
---- basic/source/sbx/sbxvalue.cxx.orig 2008-06-10 12:50:41.000000000 +0800
-+++ basic/source/sbx/sbxvalue.cxx 2008-06-10 12:55:14.000000000 +0800
-@@ -1470,7 +1470,7 @@ BOOL SbxValue::Compare( SbxOperator eOp,
- bRes = TRUE;
- }
- else if( GetType() == SbxEMPTY && rOp.GetType() == SbxEMPTY )
-- bRes = TRUE;
-+ bRes = !bVBAInterop ? TRUE : ( eOp == SbxEQ ? TRUE : FALSE );
- // Sonderregel 1: Ist ein Operand Null, ist das Ergebnis FALSE
- else if( GetType() == SbxNULL || rOp.GetType() == SbxNULL )
- bRes = FALSE;
diff --git a/patches/vba/vba-enable-fieldrelatedbits.diff b/patches/vba/vba-enable-fieldrelatedbits.diff
deleted file mode 100644
index e53cc685a..000000000
--- a/patches/vba/vba-enable-fieldrelatedbits.diff
+++ /dev/null
@@ -1,27 +0,0 @@
- sw/source/ui/vba/makefile.mk | 5 ++++-
- 1 files changed, 4 insertions(+), 1 deletions(-)
-
-diff --git sw/source/ui/vba/makefile.mk sw/source/ui/vba/makefile.mk
-index 50335f3..052287d 100644
---- sw/source/ui/vba/makefile.mk
-+++ sw/source/ui/vba/makefile.mk
-@@ -42,7 +42,7 @@ dummy:
- .ENDIF
-
- INCPRE=$(INCCOM)$/$(TARGET)
--CDEFS+=-DVBA_OOBUILD_HACK
-+CDEFS+=-DVBA_OOBUILD_HACK -DFIELDPATCH
- # ------------------------------------------------------------------
-
- SLOFILES= \
-@@ -115,7 +115,10 @@ SLOFILES= \
- $(SLO)$/vbarevisions.obj \
- $(SLO)$/vbaframe.obj \
- $(SLO)$/vbaframes.obj \
-+ $(SLO)$/vbaformfield.obj \
-+ $(SLO)$/vbaformfields.obj \
- $(SLO)$/vbaeventshelper.obj \
-+ $(SLO)$/vbacheckbox.obj \
-
- # These files to be enabled when field related patches
- # are folded into libreoffice
diff --git a/patches/vba/vba-error-object.diff b/patches/vba/vba-error-object.diff
deleted file mode 100644
index 13c6db0a0..000000000
--- a/patches/vba/vba-error-object.diff
+++ /dev/null
@@ -1,379 +0,0 @@
---- basic/source/runtime/stdobj.cxx.old 2009-04-02 10:49:15.000000000 +0000
-+++ basic/source/runtime/stdobj.cxx 2009-04-06 16:41:58.000000000 +0000
-@@ -36,6 +36,7 @@
- #include <basic/sbstdobj.hxx>
- #include "rtlproto.hxx"
- #include "sbintern.hxx"
-+#include "errobject.hxx"
-
- // Das nArgs-Feld eines Tabelleneintrags ist wie folgt verschluesselt:
- // Zur Zeit wird davon ausgegangen, dass Properties keine Parameter
-@@ -655,6 +656,11 @@ SbiStdObject::~SbiStdObject()
-
- SbxVariable* SbiStdObject::Find( const String& rName, SbxClassType t )
- {
-+ // #TODO #FIXME hack for substituting ooo-basic Err with vba-ish
-+ // ErrObject object
-+ static String sErr( RTL_CONSTASCII_USTRINGPARAM("Err") );
-+ if ( rName.EqualsIgnoreCaseAscii( sErr ) )
-+ return SbxErrObject::getErrObject();
- // Bereits eingetragen?
- SbxVariable* pVar = SbxObject::Find( rName, t );
- if( !pVar )
---- basic/source/classes/makefile.mk.old 2009-04-02 10:49:17.000000000 +0000
-+++ basic/source/classes/makefile.mk 2009-04-06 16:41:58.000000000 +0000
-@@ -41,6 +41,14 @@ ENABLE_EXCEPTIONS=TRUE
-
- .INCLUDE : settings.mk
-
-+ALLTAR : \
-+ $(MISC)$/$(TARGET).don \
-+ $(SLOTARGET)
-+
-+$(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb
-+ +$(CPPUMAKER) -O$(OUT)$/inc -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@
-+ echo $@
-+
- # --- Allgemein -----------------------------------------------------------
-
- COMMON_SLOFILES= \
-@@ -50,7 +58,8 @@ COMMON_SLOFILES= \
- $(SLO)$/sbintern.obj \
- $(SLO)$/sbunoobj.obj \
- $(SLO)$/propacc.obj \
-- $(SLO)$/disas.obj
-+ $(SLO)$/disas.obj \
-+ $(SLO)$/errobject.obj \
-
- SLOFILES= $(COMMON_SLOFILES) \
- $(SLO)$/eventatt.obj
---- basic/source/inc/errobject.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ basic/source/inc/errobject.hxx 2009-04-06 16:41:58.000000000 +0000
-@@ -0,0 +1,16 @@
-+#ifndef ERROBJECT_HXX
-+#define ERROBJECT_HXX
-+#include "sbunoobj.hxx"
-+#include <ooo/vba/XErrObject.hpp>
-+
-+
-+class SbxErrObject : public SbUnoObject
-+{
-+ com::sun::star::uno::Reference< ooo::vba::XErrObject > m_xErr;
-+ SbxErrObject( const String& aName_, const com::sun::star::uno::Any& aUnoObj_ );
-+ ~SbxErrObject();
-+public:
-+ static SbxVariableRef getErrObject();
-+ static com::sun::star::uno::Reference< ooo::vba::XErrObject > getUnoErrObject();
-+};
-+#endif
---- basic/source/classes/errobject.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ basic/source/classes/errobject.cxx 2009-04-06 16:41:58.000000000 +0000
-@@ -0,0 +1,181 @@
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_basic.hxx"
-+#include "errobject.hxx"
-+
-+#include <cppuhelper/implbase2.hxx>
-+#include <com/sun/star/script/XDefaultProperty.hpp>
-+#include "sbintern.hxx"
-+#include "runtime.hxx"
-+
-+using namespace ::com::sun::star;
-+using namespace ::ooo;
-+
-+typedef ::cppu::WeakImplHelper2< vba::XErrObject, script::XDefaultProperty > ErrObjectImpl_BASE;
-+
-+class ErrObject : public ErrObjectImpl_BASE
-+{
-+ rtl::OUString m_sHelpFile;
-+ rtl::OUString m_sSource;
-+ rtl::OUString m_sDescription;
-+ sal_Int32 m_nNumber;
-+ sal_Int32 m_nHelpContext;
-+
-+public:
-+ ErrObject();
-+ ~ErrObject();
-+ // Attributes
-+ virtual ::sal_Int32 SAL_CALL getNumber() throw (uno::RuntimeException);
-+ virtual void SAL_CALL setNumber( ::sal_Int32 _number ) throw (uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getHelpContext() throw (uno::RuntimeException);
-+ virtual void SAL_CALL setHelpContext( ::sal_Int32 _helpcontext ) throw (uno::RuntimeException);
-+ virtual ::rtl::OUString SAL_CALL getHelpFile() throw (uno::RuntimeException);
-+ virtual void SAL_CALL setHelpFile( const ::rtl::OUString& _helpfile ) throw (uno::RuntimeException);
-+ virtual ::rtl::OUString SAL_CALL getDescription() throw (uno::RuntimeException);
-+ virtual void SAL_CALL setDescription( const ::rtl::OUString& _description ) throw (uno::RuntimeException);
-+ virtual ::rtl::OUString SAL_CALL getSource() throw (uno::RuntimeException);
-+ virtual void SAL_CALL setSource( const ::rtl::OUString& _source ) throw (uno::RuntimeException);
-+
-+ // Methods
-+ virtual void SAL_CALL Clear( ) throw (uno::RuntimeException);
-+ virtual void SAL_CALL Raise( const uno::Any& Number, const uno::Any& Source, const uno::Any& Description, const uno::Any& HelpFile, const uno::Any& HelpContext ) throw (uno::RuntimeException);
-+ // XDefaultProperty
-+ virtual ::rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (uno::RuntimeException);
-+};
-+
-+
-+ErrObject::~ErrObject()
-+{
-+}
-+
-+ErrObject::ErrObject() : m_nNumber(0), m_nHelpContext(0)
-+{
-+}
-+
-+sal_Int32 SAL_CALL
-+ErrObject::getNumber() throw (uno::RuntimeException)
-+{
-+ return m_nNumber;
-+}
-+
-+void SAL_CALL
-+ErrObject::setNumber( ::sal_Int32 _number ) throw (uno::RuntimeException)
-+{
-+ m_nNumber = _number;
-+
-+
-+}
-+
-+::sal_Int32 SAL_CALL
-+ErrObject::getHelpContext() throw (uno::RuntimeException)
-+{
-+ return m_nHelpContext;
-+}
-+void SAL_CALL
-+ErrObject::setHelpContext( ::sal_Int32 _helpcontext ) throw (uno::RuntimeException)
-+{
-+ m_nHelpContext = _helpcontext;
-+}
-+
-+::rtl::OUString SAL_CALL
-+ErrObject::getHelpFile() throw (uno::RuntimeException)
-+{
-+ return m_sHelpFile;
-+}
-+
-+void SAL_CALL
-+ErrObject::setHelpFile( const ::rtl::OUString& _helpfile ) throw (uno::RuntimeException)
-+{
-+ m_sHelpFile = _helpfile;
-+}
-+
-+::rtl::OUString SAL_CALL
-+ErrObject::getDescription() throw (uno::RuntimeException)
-+{
-+ return m_sDescription;
-+}
-+
-+void SAL_CALL
-+ErrObject::setDescription( const ::rtl::OUString& _description ) throw (uno::RuntimeException)
-+{
-+ m_sDescription = _description;
-+}
-+
-+::rtl::OUString SAL_CALL
-+ErrObject::getSource() throw (uno::RuntimeException)
-+{
-+ return m_sSource;
-+}
-+
-+void SAL_CALL
-+ErrObject::setSource( const ::rtl::OUString& _source ) throw (uno::RuntimeException)
-+{
-+ m_sSource = _source;
-+}
-+
-+// Methods
-+void SAL_CALL
-+ErrObject::Clear( ) throw (uno::RuntimeException)
-+{
-+ m_sHelpFile = rtl::OUString();
-+ m_sSource = m_sHelpFile;
-+ m_sDescription = m_sSource;
-+ m_nNumber = 0;
-+ m_nHelpContext = 0;
-+}
-+
-+void SAL_CALL
-+ErrObject::Raise( const uno::Any& Number, const uno::Any& Source, const uno::Any& Description, const uno::Any& HelpFile, const uno::Any& HelpContext ) throw (uno::RuntimeException)
-+{
-+ if ( !Number.hasValue() )
-+ throw uno::RuntimeException( rtl::OUString::createFromAscii("Missing Required Paramater"), uno::Reference< uno::XInterface >() );
-+ Description >>= m_sDescription;
-+ Source >>= m_sSource;
-+ HelpFile >>= m_sHelpFile;
-+ HelpContext >>= m_nHelpContext;
-+ Number >>= m_nNumber;
-+ if ( m_nNumber )
-+ {
-+ SbError n = StarBASIC::GetSfxFromVBError( m_nNumber );
-+ if ( !n )
-+ n = m_nNumber; // force orig number, probably should have a specific table of vb ( localized ) errors
-+ pINST->Error( n, m_sDescription );
-+ }
-+}
-+
-+// XDefaultProperty
-+::rtl::OUString SAL_CALL
-+ErrObject::getDefaultPropertyName( ) throw (uno::RuntimeException)
-+{
-+ static rtl::OUString sDfltPropName( RTL_CONSTASCII_USTRINGPARAM("Number") );
-+ return sDfltPropName;
-+}
-+
-+// SbxErrObject
-+SbxErrObject::SbxErrObject( const String& rName, const Any& rUnoObj ): SbUnoObject( rName, rUnoObj )
-+{
-+ OSL_TRACE("SbxErrObject::SbxErrObject ctor");
-+ rUnoObj >>= m_xErr;
-+ if ( m_xErr.is() )
-+ SetDfltProperty( uno::Reference< script::XDefaultProperty >( m_xErr, uno::UNO_QUERY_THROW )->getDefaultPropertyName() ) ;
-+}
-+
-+SbxErrObject::~SbxErrObject()
-+{
-+ OSL_TRACE("SbxErrObject::~SbxErrObject dtor");
-+}
-+
-+uno::Reference< vba::XErrObject >
-+SbxErrObject::getUnoErrObject()
-+{
-+ SbxVariable* pVar = getErrObject();
-+ SbxErrObject* pGlobErr = static_cast< SbxErrObject* >( pVar );
-+ return pGlobErr->m_xErr;
-+}
-+
-+SbxVariableRef
-+SbxErrObject::getErrObject()
-+{
-+ static SbxVariableRef pGlobErr = new SbxErrObject( String( RTL_CONSTASCII_USTRINGPARAM("Err")), uno::makeAny( uno::Reference< vba::XErrObject >( new ErrObject() ) ) );
-+ return pGlobErr;
-+}
-+
---- basic/source/runtime/runtime.cxx.old 2009-04-02 10:49:15.000000000 +0000
-+++ basic/source/runtime/runtime.cxx 2009-04-06 16:41:58.000000000 +0000
-@@ -46,6 +46,7 @@
- #include <comphelper/processfactory.hxx>
- #include <com/sun/star/container/XEnumerationAccess.hpp>
- #include "sbunoobj.hxx"
-+#include "errobject.hxx"
-
- bool SbiRuntime::isVBAEnabled()
- {
-@@ -272,6 +273,7 @@ SbiInstance::SbiInstance( StarBASIC* p )
- nErl = 0;
- bReschedule = TRUE;
- bCompatibility = FALSE;
-+ SbxErrObject::getUnoErrObject()->Clear();
- }
-
- SbiInstance::~SbiInstance()
-@@ -792,7 +794,38 @@ BOOL SbiRuntime::Step()
- void SbiRuntime::Error( SbError n )
- {
- if( n )
-+ {
- nError = n;
-+ if ( isVBAEnabled() )
-+ {
-+ String aMsg = pInst->GetErrorMsg();
-+ // If a message is defined use that ( in preference to
-+ // the defined one for the error ) NB #TODO
-+ // if there is an error defined it more than likely
-+ // is not the one you want ( some are the same though )
-+ // we really need a new vba compatible error list
-+ if ( !aMsg.Len() )
-+ {
-+ StarBASIC::MakeErrorText( n, aMsg );
-+ aMsg = StarBASIC::GetErrorText();
-+ if ( !aMsg.Len() ) // no message for err no.
-+ // need localized resource here
-+ aMsg = String( RTL_CONSTASCII_USTRINGPARAM("Internal Object Error:") );
-+ }
-+ // no num? most likely then it *is* really a vba err
-+ SbxErrObject::getUnoErrObject()->setNumber( ( StarBASIC::GetVBErrorCode( n ) == 0 ) ? n : StarBASIC::GetVBErrorCode( n ) );
-+ SbxErrObject::getUnoErrObject()->setDescription( aMsg );
-+
-+ // prepend an error number to the message.
-+ String aTmp = '\'';
-+ aTmp += String::CreateFromInt32( SbxErrObject::getUnoErrObject()->getNumber() );
-+ aTmp += String( RTL_CONSTASCII_USTRINGPARAM("\'\n") );
-+ aTmp += aMsg;
-+
-+ pInst->aErrorMsg = aTmp;
-+ nError = SbERR_BASIC_COMPAT;
-+ }
-+ }
- }
-
- void SbiRuntime::FatalError( SbError n )
---- basic/source/classes/sb.cxx
-+++ basic/source/classes/sb.cxx
-@@ -199,6 +199,7 @@ const SFX_VB_ErrorItem __FAR_DATA SFX_VB
- { 1004, SbERR_METHOD_FAILED },
- { 1005, SbERR_SETPROP_FAILED },
- { 1006, SbERR_GETPROP_FAILED },
-+ { 1007, SbERR_BASIC_COMPAT },
- { 0xFFFF, 0xFFFFFFFFL } // End mark
- };
-
---- basic/source/classes/sb.src.old 2009-04-02 10:49:17.000000000 +0000
-+++ basic/source/classes/sb.src 2009-04-06 16:41:58.000000000 +0000
-@@ -591,6 +591,12 @@ Resource RID_BASIC_START
- {
- Text [ en-US ] = "For loop not initialized." ;
- };
-+ String ERRCODE_BASIC_COMPAT & ERRCODE_RES_MASK
-+ {
-+ Text [ de ] = "$(ARG1)." ;
-+ Text [ en-US ] = "$(ARG1)." ;
-+ Text [ x-comment ] = " ";
-+ };
- };
- // Hinweis: IDS_SBERR_TERMINATED = IDS_SBERR_START+2000.
- String IDS_SBERR_TERMINATED
---- basic/inc/basic/sberrors.hxx
-+++ basic/inc/basic/sberrors.hxx
-@@ -290,6 +290,8 @@ typedef ULONG SbError;
- #define ERRCODE_BASIC_LOOP_NOT_INIT ((LAST_SBX_ERROR_ID+109UL) | ERRCODE_AREA_SBX | \
- ERRCODE_CLASS_COMPILER) // For loop not initialized
-
-+#define ERRCODE_BASIC_COMPAT ((LAST_SBX_ERROR_ID+103UL)| ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME)
-+
- // Map old codes to new codes
- #define SbERR_SYNTAX ERRCODE_BASIC_SYNTAX
- #define SbERR_NO_GOSUB ERRCODE_BASIC_NO_GOSUB
-@@ -413,6 +415,7 @@ typedef ULONG SbError;
- #define SbERR_PROG_TOO_LARGE ERRCODE_BASIC_PROG_TOO_LARGE
- #define SbERR_NO_STRINGS_ARRAYS ERRCODE_BASIC_NO_STRINGS_ARRAYS
- #define SbERR_BASIC_EXCEPTION ERRCODE_BASIC_EXCEPTION
-+#define SbERR_BASIC_COMPAT ERRCODE_BASIC_COMPAT
- #define SbERR_BASIC_ARRAY_FIX ERRCODE_BASIC_ARRAY_FIX
- #define SbERR_BASIC_STRING_OVERFLOW ERRCODE_BASIC_STRING_OVERFLOW
- #define SbERR_BASIC_EXPR_TOO_COMPLEX ERRCODE_BASIC_EXPR_TOO_COMPLEX
---- basic/source/runtime/step0.cxx.old 2009-04-02 10:49:15.000000000 +0000
-+++ basic/source/runtime/step0.cxx 2009-04-06 16:41:58.000000000 +0000
-@@ -33,6 +33,7 @@
- #include <vcl/msgbox.hxx>
- #include <tools/fsys.hxx>
-
-+#include "errobject.hxx"
- #include "runtime.hxx"
- #include "sbintern.hxx"
- #include "iosys.hxx"
-@@ -1119,6 +1120,7 @@ void SbiRuntime::StepSTDERROR()
- pInst->nErr = 0L;
- pInst->nErl = 0;
- nError = 0L;
-+ SbxErrObject::getUnoErrObject()->Clear();
- }
-
- void SbiRuntime::StepNOERROR()
-@@ -1268,6 +1270,6 @@ void SbiRuntime::StepERROR()
- SbxVariableRef refCode = PopVar();
- USHORT n = refCode->GetUShort();
- SbError error = StarBASIC::GetSfxFromVBError( n );
-- Error( error );
-+ pInst->Error( error );
- }
-
diff --git a/patches/vba/vba-excel-iserror-fix.diff b/patches/vba/vba-excel-iserror-fix.diff
deleted file mode 100644
index bbc6f2230..000000000
--- a/patches/vba/vba-excel-iserror-fix.diff
+++ /dev/null
@@ -1,168 +0,0 @@
---- sc/source/ui/vba/vbawsfunction.cxx 2009-02-02 15:33:32.000000000 +0000
-+++ sc/source/ui/vba/vbawsfunction.cxx.patched 2009-02-02 16:18:58.000000000 +0000
-@@ -88,12 +88,13 @@ ScVbaWSFunction::invoke(const rtl::OUStr
- count, rtl::OUStringToOString( comphelper::anyToString( aParamTemp[count] ), RTL_TEXTENCODING_UTF8 ).getStr() );
-
- uno::Any aRet = xFunctionAccess->callFunction(FunctionName,aParamTemp);
-+
- // MATCH function should alwayse return a double value, but currently if the first argument is XCellRange, MATCH function returns an array instead of a double value. Don't know why?
- // To fix this issue in safe, current solution is to convert this array to a double value just for MATCH function.
- String aUpper( FunctionName );
- ScCompiler aCompiler( NULL, ScAddress() );
- OpCode eOp = aCompiler.GetEnglishOpCode( aUpper.ToUpperAscii() );
-- if( eOp == ocMatch )
-+ if( eOp == ocMatch || eOp == ocIsError )
- {
- double fVal = 0.0;
- if( aRet >>= fVal )
-diff --git basic/source/runtime/methods.cxx basic/source/runtime/methods.cxx
-index 8a9d408..0a7a30e 100644
---- basic/source/runtime/methods.cxx
-+++ basic/source/runtime/methods.cxx
-@@ -78,6 +78,7 @@
- #include <com/sun/star/io/XOutputStream.hpp>
- #include <com/sun/star/io/XStream.hpp>
- #include <com/sun/star/io/XSeekable.hpp>
-+#include <com/sun/star/script/XErrorQuery.hpp>
-
- using namespace comphelper;
- using namespace osl;
-@@ -85,6 +86,7 @@ using namespace com::sun::star::uno;
- using namespace com::sun::star::lang;
- using namespace com::sun::star::ucb;
- using namespace com::sun::star::io;
-+using namespace com::sun::star::script;
-
- #endif /* _USE_UNO */
-
-@@ -2426,7 +2428,22 @@ RTLFUNC(IsError)
- if ( rPar.Count() < 2 )
- StarBASIC::Error( SbERR_BAD_ARGUMENT );
- else
-- rPar.Get( 0 )->PutBool( rPar.Get(1)->IsErr() );
-+ {
-+ SbxVariable* pVar =rPar.Get( 1 );
-+ SbUnoObject* pObj = PTR_CAST(SbUnoObject,pVar );
-+ if ( !pObj )
-+ {
-+ if ( SbxBase* pBaseObj = pVar->GetObject() )
-+ pObj = PTR_CAST(SbUnoObject, pBaseObj );
-+ }
-+ Reference< XErrorQuery > xError;
-+ if ( pObj )
-+ xError.set( pObj->getUnoAny(), UNO_QUERY );
-+ if ( xError.is() )
-+ rPar.Get( 0 )->PutBool( xError->hasError() );
-+ else
-+ rPar.Get( 0 )->PutBool( rPar.Get(1)->IsErr() );
-+ }
- }
-
- RTLFUNC(IsNull)
-diff --git oovbaapi/ooo/vba/excel/XRange.idl oovbaapi/ooo/vba/excel/XRange.idl
-index d84dcae..8062497 100644
---- oovbaapi/ooo/vba/excel/XRange.idl
-+++ oovbaapi/ooo/vba/excel/XRange.idl
-@@ -45,6 +45,9 @@
- #ifndef __com_sun_star_script_XDefaultMethod_idl__
- #include <com/sun/star/script/XDefaultMethod.idl>
- #endif
-+#ifndef __com_sun_star_script_XErrorQuery_idl__
-+#include <com/sun/star/script/XErrorQuery.idl>
-+#endif
- #ifndef __ooo_vba_XCollection_idl__
- #include <ooo/vba/XCollection.idl>
- #endif
-@@ -77,6 +80,7 @@ interface XRange
- interface com::sun::star::container::XEnumerationAccess;
- interface com::sun::star::script::XDefaultMethod;
- interface com::sun::star::script::XDefaultProperty;
-+ interface com::sun::star::script::XErrorQuery;
- interface ::ooo::vba::excel::XFormat;
- //interface ::ooo::vba::XHelperInterface;
-
-diff --git sc/source/ui/vba/vbarange.cxx sc/source/ui/vba/vbarange.cxx
-index d7e20e5..a052262 100644
---- sc/source/ui/vba/vbarange.cxx
-+++ sc/source/ui/vba/vbarange.cxx
-@@ -5358,6 +5358,24 @@ ScVbaRange::getServiceNames()
- return aServiceNames;
- }
-
-+sal_Bool SAL_CALL
-+ScVbaRange::hasError() throw (uno::RuntimeException)
-+{
-+ double dResult = sal_False;
-+ uno::Reference< script::XInvocation > xInvoc( ScVbaGlobals::getGlobalsImpl( mxContext )->getApplication()->WorksheetFunction(), uno::UNO_QUERY_THROW );
-+
-+ static rtl::OUString FunctionName( RTL_CONSTASCII_USTRINGPARAM("IsError" ) );
-+ uno::Sequence< uno::Any > Params(1);
-+ uno::Reference< excel::XRange > aRange( this );
-+ Params[0] = uno::makeAny( aRange );
-+ uno::Sequence< sal_Int16 > OutParamIndex;
-+ uno::Sequence< uno::Any > OutParam;
-+ xInvoc->invoke( FunctionName, Params, OutParamIndex, OutParam ) >>= dResult;
-+ if ( dResult > 0.0 )
-+ return sal_True;
-+ return sal_False;
-+}
-+
- namespace range
- {
- namespace sdecl = comphelper::service_decl;
-diff --git sc/source/ui/vba/vbarange.hxx sc/source/ui/vba/vbarange.hxx
-index ce902f1..0df668c 100644
---- sc/source/ui/vba/vbarange.hxx
-+++ sc/source/ui/vba/vbarange.hxx
-@@ -274,6 +274,8 @@ public:
- static css::uno::Reference< ov::excel::XRange > ApplicationRange( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Any &Cell1, const css::uno::Any &Cell2 ) throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL GoalSeek( const css::uno::Any& Goal, const css::uno::Reference< ov::excel::XRange >& ChangingCell ) throw (css::uno::RuntimeException);
- virtual css::uno::Reference< ov::excel::XRange > SAL_CALL SpecialCells( const css::uno::Any& _oType, const css::uno::Any& _oValue) throw ( css::script::BasicErrorException );
-+ // XErrorQuery
-+ virtual ::sal_Bool SAL_CALL hasError( ) throw (css::uno::RuntimeException);
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-diff --git udkapi/com/sun/star/script/XErrorQuery.idl udkapi/com/sun/star/script/XErrorQuery.idl
-new file mode 100644
-index 0000000..9a1860e
---- /dev/null
-+++ udkapi/com/sun/star/script/XErrorQuery.idl
-@@ -0,0 +1,25 @@
-+#ifndef __com_sun_star_script_XErrorQuery_idl__
-+#define __com_sun_star_script_XErrorQuery_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+module com { module sun { module star { module script {
-+//==============================================================================
-+
-+interface XErrorQuery : ::com::sun::star::uno::XInterface
-+{
-+ //-----------------------------------------------------------------------
-+ /**
-+ Returns whether this object has an error
-+
-+ @return
-+ <atom>boolean</atom> indicating an error or not
-+ */
-+ boolean hasError();
-+
-+};
-+
-+}; }; }; };
-+#endif
-diff --git udkapi/com/sun/star/script/makefile.mk udkapi/com/sun/star/script/makefile.mk
-index 69e06dd..250b5cc 100644
---- udkapi/com/sun/star/script/makefile.mk
-+++ udkapi/com/sun/star/script/makefile.mk
-@@ -87,6 +87,7 @@ IDLFILES=\
- XDefaultProperty.idl\
- ModuleInfo.idl\
- ModuleType.idl\
-+ XErrorQuery.idl\
-
- # ------------------------------------------------------------------
-
diff --git a/patches/vba/vba-fallback-to-calling-doc-context.diff b/patches/vba/vba-fallback-to-calling-doc-context.diff
deleted file mode 100644
index 85563196f..000000000
--- a/patches/vba/vba-fallback-to-calling-doc-context.diff
+++ /dev/null
@@ -1,735 +0,0 @@
-diff --git sc/source/filter/excel/excimp8.cxx sc/source/filter/excel/excimp8.cxx
-index 4d1db8b..e064e41 100644
---- sc/source/filter/excel/excimp8.cxx
-+++ sc/source/filter/excel/excimp8.cxx
-@@ -276,7 +276,9 @@ void ImportExcel8::ReadBasic( void )
- if( bLoadCode || bLoadStrg )
- {
- uno::Any aGlobs;
-- aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstance( ::rtl::OUString::createFromAscii( "ooo.vba.excel.Globals") );
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[ 0 ] <<= pShell->GetModel();
-+ aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( ::rtl::OUString::createFromAscii( "ooo.vba.excel.Globals"), aArgs );
- pShell->GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
- SvxImportMSVBasic aBasicImport( *pShell, *xRootStrg, bLoadCode, bLoadStrg );
- bool bAsComment = !bLoadExecutable || !aGlobs.hasValue();
-diff --git sc/source/ui/vba/excelvbahelper.cxx sc/source/ui/vba/excelvbahelper.cxx
-index 5f133d9..d4f8967 100644
---- sc/source/ui/vba/excelvbahelper.cxx
-+++ sc/source/ui/vba/excelvbahelper.cxx
-@@ -107,10 +107,10 @@ public:
- };
-
- void
--implnPaste()
-+implnPaste( const uno::Reference< frame::XModel>& xModel )
- {
- PasteCellsWarningReseter resetWarningBox;
-- ScTabViewShell* pViewShell = getCurrentBestViewShell();
-+ ScTabViewShell* pViewShell = getBestViewShell( xModel );
- if ( pViewShell )
- {
- pViewShell->PasteFromSystem();
-@@ -120,31 +120,28 @@ implnPaste()
-
-
- void
--implnCopy()
-+implnCopy( const uno::Reference< frame::XModel>& xModel )
- {
-- ScTabViewShell* pViewShell = getCurrentBestViewShell();
-+ ScTabViewShell* pViewShell = getBestViewShell( xModel );
- if ( pViewShell )
- pViewShell->CopyToClip(NULL,false,false,true);
- }
-
- void
--implnCut()
-+implnCut( const uno::Reference< frame::XModel>& xModel )
- {
-- ScTabViewShell* pViewShell = getCurrentBestViewShell();
-+ ScTabViewShell* pViewShell = getBestViewShell( xModel );
- if ( pViewShell )
- pViewShell->CutToClip( NULL, TRUE );
- }
-
--void implnPasteSpecial(USHORT nFlags,USHORT nFunction,sal_Bool bSkipEmpty, sal_Bool bTranspose)
-+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 = ScTabViewShell::GetActiveViewShell();
-- if ( !pTabViewShell )
-- // none active, try next best
-- pTabViewShell = getCurrentBestViewShell();
-+ ScTabViewShell* pTabViewShell = getBestViewShell( xModel );
- if ( pTabViewShell )
- {
- ScViewData* pView = pTabViewShell->GetViewData();
-@@ -191,16 +188,16 @@ getBestViewShell( const css::uno::Reference< css::frame::XModel>& xModel )
- }
-
- ScTabViewShell*
--getCurrentBestViewShell()
-+getCurrentBestViewShell( const uno::Reference< uno::XComponentContext >& xContext )
- {
-- uno::Reference< frame::XModel > xModel = getCurrentExcelDoc();
-+ uno::Reference< frame::XModel > xModel = getCurrentExcelDoc( xContext );
- return getBestViewShell( xModel );
- }
-
- SfxViewFrame*
--getCurrentViewFrame()
-+getViewFrame( const uno::Reference< frame::XModel >& xModel )
- {
-- ScTabViewShell* pViewShell = getCurrentBestViewShell();
-+ ScTabViewShell* pViewShell = getBestViewShell( xModel );
- if ( pViewShell )
- return pViewShell->GetViewFrame();
- return NULL;
-diff --git sc/source/ui/vba/excelvbahelper.hxx sc/source/ui/vba/excelvbahelper.hxx
-index 3a3b7f8..8c7c430 100644
---- sc/source/ui/vba/excelvbahelper.hxx
-+++ sc/source/ui/vba/excelvbahelper.hxx
-@@ -41,15 +41,15 @@ namespace ooo
- 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();
-- void implnPaste();
-- void implnCut();
-- void implnPasteSpecial(sal_uInt16 nFlags,sal_uInt16 nFunction,sal_Bool bSkipEmpty, sal_Bool bTranspose);
-+ 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();
-- SfxViewFrame* getCurrentViewFrame();
-+ ScTabViewShell* getCurrentBestViewShell( const css::uno::Reference< css::uno::XComponentContext >& xContext );
-+ SfxViewFrame* getViewFrame( const css::uno::Reference< css::frame::XModel >& xModel );
- class ScVbaCellRangeAccess
- {
- public:
-diff --git sc/source/ui/vba/vbaapplication.cxx sc/source/ui/vba/vbaapplication.cxx
-index 68d0834..68dff2f 100644
---- sc/source/ui/vba/vbaapplication.cxx
-+++ sc/source/ui/vba/vbaapplication.cxx
-@@ -125,7 +125,7 @@ class ActiveWorkbook : public ScVbaWorkbook
- protected:
- virtual uno::Reference< frame::XModel > getModel()
- {
-- return getCurrentExcelDoc();
-+ return getCurrentExcelDoc(mxContext);
- }
- public:
- ActiveWorkbook( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext) : ScVbaWorkbook( xParent, xContext ){}
-@@ -230,7 +230,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 = excel::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();
-@@ -509,7 +509,7 @@ 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 = excel::getCurrentBestViewShell();
-+ ScTabViewShell* pShell = excel::getCurrentBestViewShell( mxContext );
- ScGridWindow* gridWindow = (ScGridWindow*)pShell->GetWindow();
- try
- {
-@@ -551,7 +551,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 = excel::getCurrentBestViewShell();
-+ ScTabViewShell* pShell = excel::getCurrentBestViewShell( mxContext );
- ScGridWindow* gridWindow = (ScGridWindow*)pShell->GetWindow();
- if ( xVbaRange.is() )
- {
-@@ -1135,7 +1135,7 @@ ScVbaApplication::Volatile( const uno::Any& aVolatile ) throw ( uno::RuntimeExc
- ScVbaApplication::getDisplayFormulaBar() throw ( css::uno::RuntimeException )
- {
- sal_Bool bRes = sal_False;
-- ScTabViewShell* pViewShell = excel::getCurrentBestViewShell();
-+ ScTabViewShell* pViewShell = excel::getCurrentBestViewShell( mxContext );
- if ( pViewShell )
- {
- SfxBoolItem sfxFormBar( FID_TOGGLEINPUTLINE);
-@@ -1153,7 +1153,7 @@ ScVbaApplication::getDisplayFormulaBar() throw ( css::uno::RuntimeException )
- void SAL_CALL
- ScVbaApplication::setDisplayFormulaBar( ::sal_Bool _displayformulabar ) throw ( css::uno::RuntimeException )
- {
-- ScTabViewShell* pViewShell = excel::getCurrentBestViewShell();
-+ ScTabViewShell* pViewShell = excel::getCurrentBestViewShell( mxContext );
- if ( pViewShell && ( _displayformulabar != getDisplayFormulaBar() ) )
- {
- SfxBoolItem sfxFormBar( FID_TOGGLEINPUTLINE, _displayformulabar);
-@@ -1185,7 +1185,7 @@ ScVbaApplication::Caller( const uno::Any& /*aIndex*/ ) throw ( uno::RuntimeExcep
- uno::Reference< frame::XModel >
- ScVbaApplication::getCurrentDocument() throw (css::uno::RuntimeException)
- {
-- return getCurrentExcelDoc();
-+ return getCurrentExcelDoc(mxContext);
- }
-
- uno::Any SAL_CALL
-diff --git sc/source/ui/vba/vbachartobject.cxx sc/source/ui/vba/vbachartobject.cxx
-index 71942f1..2a2899e 100644
---- sc/source/ui/vba/vbachartobject.cxx
-+++ sc/source/ui/vba/vbachartobject.cxx
-@@ -124,7 +124,7 @@ ScVbaChartObject::Activate() throw ( script::BasicErrorException )
- // fact probably the chart object should be created with
- // the XModel owner
- //uno::Reference< view::XSelectionSupplier > xSelectionSupplier( getXModel().getCurrentController());
-- uno::Reference< view::XSelectionSupplier > xSelectionSupplier( getCurrentExcelDoc()->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 sc/source/ui/vba/vbaglobals.cxx sc/source/ui/vba/vbaglobals.cxx
-index ac5e4f5..6181cf0 100644
---- sc/source/ui/vba/vbaglobals.cxx
-+++ sc/source/ui/vba/vbaglobals.cxx
-@@ -50,10 +50,20 @@ using namespace ::ooo::vba;
- // ScVbaGlobals
- // =============================================================================
-
--ScVbaGlobals::ScVbaGlobals( css::uno::Reference< css::uno::XComponentContext >const& rxContext ) : ScVbaGlobals_BASE( uno::Reference< XHelperInterface >(), 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()");
-- init( rxContext, uno::Any( getApplication() ) );
-+
-+ 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()
-@@ -68,8 +78,9 @@ uno::Reference<excel::XApplication >
- ScVbaGlobals::getApplication() throw (uno::RuntimeException)
- {
- // OSL_TRACE("In ScVbaGlobals::getApplication");
-- static uno::Reference< excel::XApplication > ExcelApplication( new ScVbaApplication( mxContext) );
-- return ExcelApplication;
-+ if ( !mxApplication.is() )
-+ mxApplication.set( new ScVbaApplication( mxContext) );
-+ return mxApplication;
- }
-
- uno::Reference< excel::XWorkbook > SAL_CALL
-@@ -264,7 +275,7 @@ ScVbaGlobals::getServiceNames()
- namespace globals
- {
- namespace sdecl = comphelper::service_decl;
--sdecl::vba_service_class_<ScVbaGlobals, sdecl::with_args<false> > serviceImpl;
-+sdecl::vba_service_class_<ScVbaGlobals, sdecl::with_args<true> > serviceImpl;
- extern sdecl::ServiceDecl const serviceDecl(
- serviceImpl,
- "ScVbaGlobals",
-diff --git sc/source/ui/vba/vbaglobals.hxx sc/source/ui/vba/vbaglobals.hxx
-index 66dd1fa..53838b9 100644
---- sc/source/ui/vba/vbaglobals.hxx
-+++ sc/source/ui/vba/vbaglobals.hxx
-@@ -48,13 +48,16 @@ typedef ::cppu::ImplInheritanceHelper1< VbaGlobalsBase, ov::excel::XGlobals > Sc
-
- class ScVbaGlobals : public ScVbaGlobals_BASE
- {
-+ css::uno::Reference< ov::excel::XApplication > mxApplication;
- virtual css::uno::Reference<
- ov::excel::XApplication > SAL_CALL getApplication()
- throw (css::uno::RuntimeException);
- public:
-
-- ScVbaGlobals(
-+ 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
-diff --git sc/source/ui/vba/vbarange.cxx sc/source/ui/vba/vbarange.cxx
-index 4512c46..a3907a7 100644
---- sc/source/ui/vba/vbarange.cxx
-+++ sc/source/ui/vba/vbarange.cxx
-@@ -1996,9 +1996,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 = excel::getCurrentBestViewShell();
-+ ScTabViewShell* pShell = excel::getBestViewShell( xModel );
- if ( pShell )
- {
- if ( bInSel )
-@@ -2045,7 +2045,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;
- }
-
-@@ -2053,7 +2053,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
-@@ -2061,7 +2061,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();
- }
-@@ -2216,8 +2216,9 @@ ScVbaRange::Copy(const ::uno::Any& Destination) throw (uno::RuntimeException)
- }
- else
- {
-+ uno::Reference< frame::XModel > xModel = getModelFromRange( mxRange );
- Select();
-- excel::implnCopy();
-+ excel::implnCopy( xModel );
- }
- }
-
-@@ -2240,8 +2241,9 @@ ScVbaRange::Cut(const ::uno::Any& Destination) throw (uno::RuntimeException)
- xMover->moveRange( xDestination->getCellAddress(), xSource->getRangeAddress() );
- }
- {
-+ uno::Reference< frame::XModel > xModel = getModelFromRange( mxRange );
- Select();
-- excel::implnCut();
-+ excel::implnCut( xModel );
- }
- }
-
-@@ -2574,7 +2576,7 @@ ScVbaRange::PasteSpecial( const uno::Any& Paste, const uno::Any& Operation, cons
-
- USHORT nFlags = getPasteFlags(nPaste);
- USHORT nFormulaBits = getPasteFormulaBits(nOperation);
-- excel::implnPasteSpecial(nFlags,nFormulaBits,bSkipBlanks,bTranspose);
-+ excel::implnPasteSpecial(pShell->GetModel(), nFlags,nFormulaBits,bSkipBlanks,bTranspose);
- // restore selection
- xSelection->select( uno::makeAny( xSel ) );
- }
-@@ -3249,7 +3251,9 @@ ScVbaRange::End( ::sal_Int32 Direction ) throw (uno::RuntimeException)
- // position current cell upper left of this range
- Cells( uno::makeAny( (sal_Int32) 1 ), uno::makeAny( (sal_Int32) 1 ) )->Select();
-
-- SfxViewFrame* pViewFrame = excel::getCurrentViewFrame();
-+ uno::Reference< frame::XModel > xModel = getModelFromRange( mxRange );
-+
-+ SfxViewFrame* pViewFrame = excel::getViewFrame( xModel );
- if ( pViewFrame )
- {
- SfxAllItemSet aArgs( SFX_APP()->GetPool() );
-@@ -3893,7 +3897,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( getCurrentExcelDoc(), 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;
-@@ -3916,7 +3920,7 @@ ScVbaRange::ApplicationRange( const uno::Reference< uno::XComponentContext >& xC
- }
- }
- }
-- uno::Reference< sheet::XSpreadsheetView > xView( getCurrentExcelDoc()->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 );
-diff --git sc/source/ui/vba/vbaworkbook.cxx sc/source/ui/vba/vbaworkbook.cxx
-index 1c60441..5b6e277 100644
---- sc/source/ui/vba/vbaworkbook.cxx
-+++ sc/source/ui/vba/vbaworkbook.cxx
-@@ -64,7 +64,7 @@ class ActiveSheet : public ScVbaWorksheet
- protected:
- virtual uno::Reference< frame::XModel > getModel()
- {
-- return getCurrentExcelDoc();
-+ return getCurrentExcelDoc( mxContext );
- }
- virtual uno::Reference< sheet::XSpreadsheet > getSheet()
- {
-@@ -218,7 +218,12 @@ ScVbaWorkbook::ScVbaWorkbook( uno::Sequence< uno::Any> const & args,
- 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)
-diff --git sc/source/ui/vba/vbaworksheet.cxx sc/source/ui/vba/vbaworksheet.cxx
-index a416c8c..0323c4f 100644
---- sc/source/ui/vba/vbaworksheet.cxx
-+++ sc/source/ui/vba/vbaworksheet.cxx
-@@ -442,11 +442,11 @@ ScVbaWorksheet::Move( const uno::Any& Before, const uno::Any& After ) throw (uno
- uno::Reference<excel::XRange> xRange = new ScVbaRange( this, mxContext, xRange1);
- if (xRange.is())
- xRange->Select();
-- excel::implnCopy();
-+ excel::implnCopy(mxModel);
- uno::Reference<frame::XModel> xModel = openNewDoc(aCurrSheetName);
- if (xModel.is())
- {
-- excel::implnPaste();
-+ excel::implnPaste(xModel);
- Delete();
- }
- return ;
-@@ -480,11 +480,11 @@ ScVbaWorksheet::Copy( const uno::Any& Before, const uno::Any& After ) throw (uno
- uno::Reference<excel::XRange> xRange = new ScVbaRange( this, mxContext, xRange1);
- if (xRange.is())
- xRange->Select();
-- excel::implnCopy();
-+ excel::implnCopy(mxModel);
- uno::Reference<frame::XModel> xModel = openNewDoc(aCurrSheetName);
- if (xModel.is())
- {
-- excel::implnPaste();
-+ excel::implnPaste(xModel);
- }
- return;
- }
-@@ -513,7 +513,7 @@ ScVbaWorksheet::Paste( const uno::Any& Destination, const uno::Any& /*Link*/ ) t
- uno::Reference<excel::XRange> xRange( Destination, uno::UNO_QUERY );
- if ( xRange.is() )
- xRange->Select();
-- excel::implnPaste();
-+ excel::implnPaste( mxModel );
- }
-
- void
-diff --git sc/source/ui/view/.tabview5.cxx.swp sc/source/ui/view/.tabview5.cxx.swp
-deleted file mode 100644
-index e3ca8cb..0000000
-Binary files sc/source/ui/view/.tabview5.cxx.swp and /dev/null differ
-diff --git sw/source/filter/ww8/ww8par.cxx sw/source/filter/ww8/ww8par.cxx
-index e1366a2..21a8014 100644
---- sw/source/filter/ww8/ww8par.cxx
-+++ sw/source/filter/ww8/ww8par.cxx
-@@ -4230,7 +4230,9 @@ ULONG SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
- #endif
- // Create and insert Word vba Globals
- uno::Any aGlobs;
-- aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstance( ::rtl::OUString::createFromAscii( "ooo.vba.word.Globals") );
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[ 0 ] <<= mpDocShell->GetModel();
-+ aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( ::rtl::OUString::createFromAscii( "ooo.vba.word.Globals"), aArgs );
- mpDocShell->GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
-
- SvxImportMSVBasic aVBasic(*mpDocShell, *pStg,
-diff --git sw/source/ui/vba/vbaapplication.cxx sw/source/ui/vba/vbaapplication.cxx
-index 9c70772..ba57192 100644
---- sw/source/ui/vba/vbaapplication.cxx
-+++ sw/source/ui/vba/vbaapplication.cxx
-@@ -183,7 +183,7 @@ float SAL_CALL SwVbaApplication::CentimetersToPoints( float _Centimeters ) throw
- uno::Reference< frame::XModel >
- SwVbaApplication::getCurrentDocument() throw (css::uno::RuntimeException)
- {
-- return getCurrentWordDoc();
-+ return getCurrentWordDoc( mxContext );
- }
-
- rtl::OUString&
-diff --git sw/source/ui/vba/vbaglobals.cxx sw/source/ui/vba/vbaglobals.cxx
-index acf6b06..935a95c 100644
---- sw/source/ui/vba/vbaglobals.cxx
-+++ sw/source/ui/vba/vbaglobals.cxx
-@@ -42,15 +42,22 @@ using namespace ::com::sun::star::uno;
- using namespace ::ooo::vba;
-
-
-+rtl::OUString sDocCtxName( RTL_CONSTASCII_USTRINGPARAM("WordDocumentContext") );
-
- // =============================================================================
- // SwVbaGlobals
- // =============================================================================
-
--SwVbaGlobals::SwVbaGlobals( css::uno::Reference< css::uno::XComponentContext >const& rxContext ) : SwVbaGlobals_BASE( uno::Reference< XHelperInterface >(), rxContext )
-+SwVbaGlobals::SwVbaGlobals( uno::Sequence< uno::Any > const& aArgs, uno::Reference< uno::XComponentContext >const& rxContext ) : SwVbaGlobals_BASE( uno::Reference< XHelperInterface >(), rxContext, sDocCtxName )
- {
- OSL_TRACE("SwVbaGlobals::SwVbaGlobals()");
-- init( rxContext, uno::makeAny( getApplication() ) );
-+ 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 );
- }
-
- SwVbaGlobals::~SwVbaGlobals()
-@@ -65,8 +72,10 @@ uno::Reference<word::XApplication >
- SwVbaGlobals::getApplication() throw (uno::RuntimeException)
- {
- OSL_TRACE("In SwVbaGlobals::getApplication");
-- static uno::Reference< word::XApplication > WordApplication( new SwVbaApplication( mxContext) );
-- return WordApplication;
-+ if ( !mxApplication.is() )
-+ mxApplication.set( new SwVbaApplication( mxContext) );
-+
-+ return mxApplication;
- }
-
- uno::Reference<word::XSystem > SAL_CALL
-@@ -178,7 +187,7 @@ SwVbaGlobals::getAvailableServiceNames( ) throw (uno::RuntimeException)
- namespace globals
- {
- namespace sdecl = comphelper::service_decl;
--sdecl::vba_service_class_<SwVbaGlobals, sdecl::with_args<false> > serviceImpl;
-+sdecl::vba_service_class_<SwVbaGlobals, sdecl::with_args<true> > serviceImpl;
- extern sdecl::ServiceDecl const serviceDecl(
- serviceImpl,
- "SwVbaGlobals",
-diff --git sw/source/ui/vba/vbaglobals.hxx sw/source/ui/vba/vbaglobals.hxx
-index 267b1ed..066282e 100644
---- sw/source/ui/vba/vbaglobals.hxx
-+++ sw/source/ui/vba/vbaglobals.hxx
-@@ -58,7 +58,7 @@ private:
-
- public:
-
-- SwVbaGlobals( css::uno::Reference< css::uno::XComponentContext >const& rxContext );
-+ SwVbaGlobals( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& rxContext );
- virtual ~SwVbaGlobals();
-
- // XGlobals
-diff --git sw/source/ui/vba/vbasystem.cxx sw/source/ui/vba/vbasystem.cxx
-index c68a7c0..3a16e23 100644
---- sw/source/ui/vba/vbasystem.cxx
-+++ sw/source/ui/vba/vbasystem.cxx
-@@ -88,7 +88,7 @@ SwVbaSystem::~SwVbaSystem()
- sal_Int32 SAL_CALL
- SwVbaSystem::getCursor() throw (uno::RuntimeException)
- {
-- sal_Int32 nPointerStyle = getPointerStyle( getCurrentWordDoc() );
-+ sal_Int32 nPointerStyle = getPointerStyle( getCurrentWordDoc(mxContext) );
-
- switch( nPointerStyle )
- {
-@@ -115,27 +115,27 @@ SwVbaSystem::setCursor( sal_Int32 _cursor ) throw (uno::RuntimeException)
- case word::WdCursorType::wdCursorNorthwestArrow:
- {
- const Pointer& rPointer( POINTER_ARROW );
-- setCursorHelper( getCurrentWordDoc(), rPointer, sal_False );
-+ setCursorHelper( getCurrentWordDoc(mxContext), rPointer, sal_False );
- break;
- }
- case word::WdCursorType::wdCursorWait:
- {
- const Pointer& rPointer( static_cast< PointerStyle >( POINTER_WAIT ) );
- //It will set the edit window, toobar and statusbar's mouse pointer.
-- setCursorHelper( getCurrentWordDoc(), rPointer, sal_True );
-+ setCursorHelper( getCurrentWordDoc(mxContext), rPointer, sal_True );
- break;
- }
- case word::WdCursorType::wdCursorIBeam:
- {
- const Pointer& rPointer( static_cast< PointerStyle >( POINTER_TEXT ) );
- //It will set the edit window, toobar and statusbar's mouse pointer.
-- setCursorHelper( getCurrentWordDoc(), rPointer, sal_True );
-+ setCursorHelper( getCurrentWordDoc( mxContext ), rPointer, sal_True );
- break;
- }
- case word::WdCursorType::wdCursorNormal:
- {
- const Pointer& rPointer( POINTER_NULL );
-- setCursorHelper( getCurrentWordDoc(), rPointer, sal_False );
-+ setCursorHelper( getCurrentWordDoc( mxContext ), rPointer, sal_False );
- break;
- }
- default:
-diff --git vbahelper/inc/vbahelper/vbaglobalbase.hxx vbahelper/inc/vbahelper/vbaglobalbase.hxx
-index f9c0d25..d12040d 100644
---- vbahelper/inc/vbahelper/vbaglobalbase.hxx
-+++ vbahelper/inc/vbahelper/vbaglobalbase.hxx
-@@ -40,10 +40,10 @@ class VBAHELPER_DLLPUBLIC VbaGlobalsBase : public Globals_BASE
- protected:
-
- bool hasServiceName( const rtl::OUString& serviceName );
-- void init( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Any& aApplication );
-+ void init( const css::uno::Sequence< css::beans::PropertyValue >& aInitArgs );
-
- public:
-- VbaGlobalsBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext);
-+ VbaGlobalsBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const rtl::OUString& sDocCtxName );
- virtual ~VbaGlobalsBase(){};
- // XMultiServiceFactory
- virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( const ::rtl::OUString& aServiceSpecifier ) throw (css::uno::Exception, css::uno::RuntimeException);
-diff --git vbahelper/inc/vbahelper/vbahelper.hxx vbahelper/inc/vbahelper/vbahelper.hxx
-index 3773474..5d97b81 100644
---- vbahelper/inc/vbahelper/vbahelper.hxx
-+++ vbahelper/inc/vbahelper/vbahelper.hxx
-@@ -67,8 +67,8 @@ namespace ooo
- VBAHELPER_DLLPUBLIC css::uno::Reference< css::uno::XInterface > createVBAUnoAPIService( SfxObjectShell* pShell, const sal_Char* _pAsciiName ) throw (css::uno::RuntimeException);
- VBAHELPER_DLLPUBLIC css::uno::Reference< css::uno::XInterface > createVBAUnoAPIServiceWithArgs( SfxObjectShell* pShell, const sal_Char* _pAsciiName, const css::uno::Sequence< css::uno::Any >& aArgs ) throw (css::uno::RuntimeException);
- css::uno::Reference< css::frame::XModel > getCurrentDoc( const rtl::OUString& sKey ) throw (css::uno::RuntimeException);
-- VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getCurrentExcelDoc() throw (css::uno::RuntimeException);
-- VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getCurrentWordDoc() throw (css::uno::RuntimeException);
-+ VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getCurrentExcelDoc( const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException);
-+ VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getCurrentWordDoc( const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException);
-
- VBAHELPER_DLLPUBLIC css::uno::Reference< css::beans::XIntrospectionAccess > getIntrospectionAccess( const css::uno::Any& aObject ) throw (css::uno::RuntimeException);
- VBAHELPER_DLLPUBLIC css::uno::Reference< css::script::XTypeConverter > getTypeConverter( const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException);
-diff --git vbahelper/source/vbahelper/vbaglobalbase.cxx vbahelper/source/vbahelper/vbaglobalbase.cxx
-index 3ce0f72..bc0eda2 100644
---- vbahelper/source/vbahelper/vbaglobalbase.cxx
-+++ vbahelper/source/vbahelper/vbaglobalbase.cxx
-@@ -41,28 +41,41 @@
- using namespace com::sun::star;
- using namespace ooo::vba;
-
-+rtl::OUString sApplication( RTL_CONSTASCII_USTRINGPARAM("Application") );
-+
- VbaGlobalsBase::VbaGlobalsBase(
- const uno::Reference< ov::XHelperInterface >& xParent,
--const uno::Reference< uno::XComponentContext >& xContext)
-+const uno::Reference< uno::XComponentContext >& xContext, const rtl::OUString& sDocCtxName )
- : Globals_BASE( xParent, xContext )
- {
- // overwrite context with custom one ( that contains the application )
- ::cppu::ContextEntry_Init aHandlerContextInfo[] =
- {
-- ::cppu::ContextEntry_Init( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Application" ) ), uno::Any() )
-+ ::cppu::ContextEntry_Init( sApplication, uno::Any() ),
-+ ::cppu::ContextEntry_Init( sDocCtxName, uno::Any() ),
- };
-
- mxContext = ::cppu::createComponentContext( aHandlerContextInfo, sizeof( aHandlerContextInfo ) / sizeof( aHandlerContextInfo[0] ), xContext );
-
- }
-
-+
- void
--VbaGlobalsBase::init( uno::Reference< uno::XComponentContext >const& rxContext, const uno::Any& aApplication )
-+VbaGlobalsBase::init( const uno::Sequence< beans::PropertyValue >& aInitArgs )
- {
-- uno::Reference< container::XNameContainer > xNameContainer( mxContext, uno::UNO_QUERY_THROW );
-- xNameContainer->replaceByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Application") ), aApplication );
-- uno::Reference< XHelperInterface > xParent( aApplication, uno::UNO_QUERY );
-+ sal_Int32 nLen = aInitArgs.getLength();
-+ for ( sal_Int32 nIndex = 0; nIndex < nLen; ++nIndex )
-+ {
-+ uno::Reference< container::XNameContainer > xNameContainer( mxContext, uno::UNO_QUERY_THROW );
-+ if ( aInitArgs[ nIndex ].Name.equals( sApplication ) )
-+ {
-+ xNameContainer->replaceByName( sApplication, aInitArgs[ nIndex ].Value );
-+ uno::Reference< XHelperInterface > xParent( aInitArgs[ nIndex ].Value, uno::UNO_QUERY );
- mxParent = xParent;
-+ }
-+ else
-+ xNameContainer->replaceByName( aInitArgs[ nIndex ].Name, aInitArgs[ nIndex ].Value );
-+ }
- }
-
- uno::Reference< uno::XInterface > SAL_CALL
-diff --git vbahelper/source/vbahelper/vbahelper.cxx vbahelper/source/vbahelper/vbahelper.cxx
-index 8290f66..110d15f 100644
---- vbahelper/source/vbahelper/vbahelper.cxx
-+++ vbahelper/source/vbahelper/vbahelper.cxx
-@@ -458,19 +458,46 @@ getCurrentDoc( const rtl::OUString& sKey ) throw (uno::RuntimeException)
- return xModel;
- }
-
-+ uno::Reference< frame::XModel >
-+getCurrentDocCtx( const rtl::OUString& ctxName, const uno::Reference< uno::XComponentContext >& xContext ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< frame::XModel > xModel;
-+ // try fallback to calling doc
-+ css::uno::Reference< css::container::XNameAccess > xNameAccess( xContext, css::uno::UNO_QUERY_THROW );
-+ xModel.set( xNameAccess->getByName( ctxName ), uno::UNO_QUERY_THROW );
-+ return xModel;
-+}
-
- uno::Reference< frame::XModel >
--getCurrentExcelDoc() throw (uno::RuntimeException)
-+getCurrentExcelDoc( const uno::Reference< uno::XComponentContext >& xContext ) throw (uno::RuntimeException)
- {
-- static const rtl::OUString sThisExcelDoc( RTL_CONSTASCII_USTRINGPARAM("ThisExcelDoc" ) );
-- return getCurrentDoc( sThisExcelDoc );
-+ static const rtl::OUString sThisExcelDoc( RTL_CONSTASCII_USTRINGPARAM("ThisExcelDoc" ) );
-+ uno::Reference< frame::XModel > xModel;
-+ try
-+ {
-+ xModel = getCurrentDoc( sThisExcelDoc );
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ xModel = getCurrentDocCtx( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ExcelDocumentContext" ) ), xContext );
-+ }
-+ return xModel;
- }
-
- uno::Reference< frame::XModel >
--getCurrentWordDoc() throw (uno::RuntimeException)
-+getCurrentWordDoc( const uno::Reference< uno::XComponentContext >& xContext ) throw (uno::RuntimeException)
- {
-- static const rtl::OUString sThisWordDoc( RTL_CONSTASCII_USTRINGPARAM("ThisWordDoc" ) );
-- return getCurrentDoc( sThisWordDoc );
-+ static const rtl::OUString sThisWordDoc( RTL_CONSTASCII_USTRINGPARAM("ThisWordDoc" ) );
-+ uno::Reference< frame::XModel > xModel;
-+ try
-+ {
-+ xModel = getCurrentDoc( sThisWordDoc );
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ xModel = getCurrentDocCtx( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WordDocumentContext" ) ), xContext );
-+ }
-+ return xModel;
- }
-
- sal_Int32
-diff --git sc/source/ui/docshell/docsh.cxx sc/source/ui/docshell/docsh.cxx
-index 337ceb3..72d92cf 100644
---- sc/source/ui/docshell/docsh.cxx
-+++ sc/source/ui/docshell/docsh.cxx
-@@ -376,7 +376,9 @@ void ScDocShell::AfterXMLLoading(sal_Bool bRet)
- if ( pShell )
- {
- uno::Any aGlobs;
-- aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.excel.Globals" ) ) );
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[ 0 ] <<= pShell->GetModel();
-+ aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.excel.Globals" ) ), aArgs );
- pShell->GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
- }
- // suppress VBA events when loading the xml
diff --git a/patches/vba/vba-financial-functions.diff b/patches/vba/vba-financial-functions.diff
deleted file mode 100644
index 842c8e2cc..000000000
--- a/patches/vba/vba-financial-functions.diff
+++ /dev/null
@@ -1,813 +0,0 @@
-diff --git basic/source/runtime/methods1.cxx basic/source/runtime/methods1.cxx
-index 6917e1b..1f87c04 100644
---- basic/source/runtime/methods1.cxx
-+++ basic/source/runtime/methods1.cxx
-@@ -82,11 +82,15 @@
- #include <com/sun/star/uno/Sequence.hxx>
- #include <com/sun/star/lang/XMultiServiceFactory.hpp>
- #include <com/sun/star/i18n/XCalendar.hpp>
-+#include <com/sun/star/sheet/XFunctionAccess.hpp>
-
- using namespace comphelper;
-+using namespace com::sun::star::sheet;
- using namespace com::sun::star::uno;
- using namespace com::sun::star::i18n;
-
-+void unoToSbxValue( SbxVariable* pVar, const Any& aValue );
-+Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, com::sun::star::beans::Property* pUnoProperty = NULL );
-
- static Reference< XCalendar > getLocaleCalendar( void )
- {
-@@ -2508,6 +2512,546 @@ RTLFUNC(Round)
- rPar.Get(0)->PutDouble( dRes );
- }
-
-+void CallFunctionAccessFunction( const Sequence< Any >& aArgs, const rtl::OUString& sFuncName, SbxVariable* pRet )
-+{
-+ static Reference< XFunctionAccess > xFunc;
-+ Any aRes;
-+ try
-+ {
-+ if ( !xFunc.is() )
-+ {
-+ Reference< XMultiServiceFactory > xFactory( getProcessServiceFactory() );
-+ if( xFactory.is() )
-+ {
-+ xFunc.set( xFactory->createInstance(::rtl::OUString::createFromAscii( "com.sun.star.sheet.FunctionAccess")), UNO_QUERY_THROW);
-+ }
-+ }
-+ Any aRet = xFunc->callFunction( sFuncName, aArgs );
-+
-+ unoToSbxValue( pRet, aRet );
-+
-+ }
-+ catch( Exception& )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ }
-+}
-+
-+RTLFUNC(SYD)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ ULONG nArgCount = rPar.Count()-1;
-+
-+ if ( nArgCount < 4 )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ return;
-+ }
-+
-+ // retrieve non-optional params
-+
-+ Sequence< Any > aParams( 4 );
-+ aParams[ 0 ] <<= makeAny( rPar.Get(1)->GetDouble() );
-+ aParams[ 1 ] <<= makeAny( rPar.Get(2)->GetDouble() );
-+ aParams[ 2 ] <<= makeAny( rPar.Get(3)->GetDouble() );
-+ aParams[ 3 ] <<= makeAny( rPar.Get(4)->GetDouble() );
-+
-+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SYD") ), rPar.Get( 0 ) );
-+}
-+
-+RTLFUNC(SLN)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ ULONG nArgCount = rPar.Count()-1;
-+
-+ if ( nArgCount < 3 )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ return;
-+ }
-+
-+ // retrieve non-optional params
-+
-+ Sequence< Any > aParams( 3 );
-+ aParams[ 0 ] <<= makeAny( rPar.Get(1)->GetDouble() );
-+ aParams[ 1 ] <<= makeAny( rPar.Get(2)->GetDouble() );
-+ aParams[ 2 ] <<= makeAny( rPar.Get(3)->GetDouble() );
-+
-+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SLN") ), rPar.Get( 0 ) );
-+}
-+
-+RTLFUNC(Pmt)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ ULONG nArgCount = rPar.Count()-1;
-+
-+ if ( nArgCount < 3 || nArgCount > 5 )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ return;
-+ }
-+ // retrieve non-optional params
-+
-+ double rate = rPar.Get(1)->GetDouble();
-+ double nper = rPar.Get(2)->GetDouble();
-+ double pmt = rPar.Get(3)->GetDouble();
-+
-+ // set default values for Optional args
-+ double fv = 0;
-+ double type = 0;
-+
-+ // fv
-+ if ( nArgCount >= 4 )
-+ {
-+ if( rPar.Get(4)->GetType() != SbxEMPTY )
-+ fv = rPar.Get(4)->GetDouble();
-+ }
-+ // type
-+ if ( nArgCount >= 5 )
-+ {
-+ if( rPar.Get(5)->GetType() != SbxEMPTY )
-+ type = rPar.Get(5)->GetDouble();
-+ }
-+
-+ Sequence< Any > aParams( 5 );
-+ aParams[ 0 ] <<= rate;
-+ aParams[ 1 ] <<= nper;
-+ aParams[ 2 ] <<= pmt;
-+ aParams[ 3 ] <<= fv;
-+ aParams[ 4 ] <<= type;
-+
-+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Pmt") ), rPar.Get( 0 ) );
-+}
-+
-+RTLFUNC(PPmt)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ ULONG nArgCount = rPar.Count()-1;
-+
-+ if ( nArgCount < 4 || nArgCount > 6 )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ return;
-+ }
-+ // retrieve non-optional params
-+
-+ double rate = rPar.Get(1)->GetDouble();
-+ double per = rPar.Get(2)->GetDouble();
-+ double nper = rPar.Get(3)->GetDouble();
-+ double pv = rPar.Get(4)->GetDouble();
-+
-+ // set default values for Optional args
-+ double fv = 0;
-+ double type = 0;
-+
-+ // fv
-+ if ( nArgCount >= 5 )
-+ {
-+ if( rPar.Get(5)->GetType() != SbxEMPTY )
-+ fv = rPar.Get(5)->GetDouble();
-+ }
-+ // type
-+ if ( nArgCount >= 6 )
-+ {
-+ if( rPar.Get(6)->GetType() != SbxEMPTY )
-+ type = rPar.Get(6)->GetDouble();
-+ }
-+
-+ Sequence< Any > aParams( 6 );
-+ aParams[ 0 ] <<= rate;
-+ aParams[ 1 ] <<= per;
-+ aParams[ 2 ] <<= nper;
-+ aParams[ 3 ] <<= pv;
-+ aParams[ 4 ] <<= fv;
-+ aParams[ 5 ] <<= type;
-+
-+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PPmt") ), rPar.Get( 0 ) );
-+}
-+
-+RTLFUNC(PV)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ ULONG nArgCount = rPar.Count()-1;
-+
-+ if ( nArgCount < 3 || nArgCount > 5 )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ return;
-+ }
-+ // retrieve non-optional params
-+
-+ double rate = rPar.Get(1)->GetDouble();
-+ double nper = rPar.Get(2)->GetDouble();
-+ double pmt = rPar.Get(3)->GetDouble();
-+
-+ // set default values for Optional args
-+ double fv = 0;
-+ double type = 0;
-+
-+ // fv
-+ if ( nArgCount >= 4 )
-+ {
-+ if( rPar.Get(4)->GetType() != SbxEMPTY )
-+ fv = rPar.Get(4)->GetDouble();
-+ }
-+ // type
-+ if ( nArgCount >= 5 )
-+ {
-+ if( rPar.Get(5)->GetType() != SbxEMPTY )
-+ type = rPar.Get(5)->GetDouble();
-+ }
-+
-+ Sequence< Any > aParams( 5 );
-+ aParams[ 0 ] <<= rate;
-+ aParams[ 1 ] <<= nper;
-+ aParams[ 2 ] <<= pmt;
-+ aParams[ 3 ] <<= fv;
-+ aParams[ 4 ] <<= type;
-+
-+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PV") ), rPar.Get( 0 ) );
-+}
-+
-+RTLFUNC(NPV)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ ULONG nArgCount = rPar.Count()-1;
-+
-+ if ( nArgCount < 1 || nArgCount > 2 )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ return;
-+ }
-+
-+ Sequence< Any > aParams( 2 );
-+ aParams[ 0 ] <<= makeAny( rPar.Get(1)->GetDouble() );
-+ Any aValues = sbxToUnoValue( rPar.Get(2),
-+ getCppuType( (Sequence<double>*)0 ) );
-+
-+ // convert for calc functions
-+ Sequence< Sequence< double > > sValues(1);
-+ aValues >>= sValues[ 0 ];
-+ aValues <<= sValues;
-+
-+ aParams[ 1 ] <<= aValues;
-+
-+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NPV") ), rPar.Get( 0 ) );
-+}
-+
-+RTLFUNC(NPer)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ ULONG nArgCount = rPar.Count()-1;
-+
-+ if ( nArgCount < 3 || nArgCount > 5 )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ return;
-+ }
-+ // retrieve non-optional params
-+
-+ double rate = rPar.Get(1)->GetDouble();
-+ double pmt = rPar.Get(2)->GetDouble();
-+ double pv = rPar.Get(3)->GetDouble();
-+
-+ // set default values for Optional args
-+ double fv = 0;
-+ double type = 0;
-+
-+ // fv
-+ if ( nArgCount >= 4 )
-+ {
-+ if( rPar.Get(4)->GetType() != SbxEMPTY )
-+ fv = rPar.Get(4)->GetDouble();
-+ }
-+ // type
-+ if ( nArgCount >= 5 )
-+ {
-+ if( rPar.Get(5)->GetType() != SbxEMPTY )
-+ type = rPar.Get(5)->GetDouble();
-+ }
-+
-+ Sequence< Any > aParams( 5 );
-+ aParams[ 0 ] <<= rate;
-+ aParams[ 1 ] <<= pmt;
-+ aParams[ 2 ] <<= pv;
-+ aParams[ 3 ] <<= fv;
-+ aParams[ 4 ] <<= type;
-+
-+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NPer") ), rPar.Get( 0 ) );
-+}
-+
-+RTLFUNC(MIRR)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ ULONG nArgCount = rPar.Count()-1;
-+
-+ if ( nArgCount < 3 )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ return;
-+ }
-+
-+ // retrieve non-optional params
-+
-+ Sequence< Any > aParams( 3 );
-+ Any aValues = sbxToUnoValue( rPar.Get(1),
-+ getCppuType( (Sequence<double>*)0 ) );
-+
-+ // convert for calc functions
-+ Sequence< Sequence< double > > sValues(1);
-+ aValues >>= sValues[ 0 ];
-+ aValues <<= sValues;
-+
-+ aParams[ 0 ] <<= aValues;
-+ aParams[ 1 ] <<= makeAny( rPar.Get(2)->GetDouble() );
-+ aParams[ 2 ] <<= makeAny( rPar.Get(3)->GetDouble() );
-+
-+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("MIRR") ), rPar.Get( 0 ) );
-+}
-+
-+RTLFUNC(IRR)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ ULONG nArgCount = rPar.Count()-1;
-+
-+ if ( nArgCount < 1 || nArgCount > 2 )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ return;
-+ }
-+ // retrieve non-optional params
-+ Any aValues = sbxToUnoValue( rPar.Get(1),
-+ getCppuType( (Sequence<double>*)0 ) );
-+
-+ // convert for calc functions
-+ Sequence< Sequence< double > > sValues(1);
-+ aValues >>= sValues[ 0 ];
-+ aValues <<= sValues;
-+
-+ // set default values for Optional args
-+ double guess = 0.1;
-+ // guess
-+ if ( nArgCount >= 2 )
-+ {
-+ if( rPar.Get(2)->GetType() != SbxEMPTY )
-+ guess = rPar.Get(2)->GetDouble();
-+ }
-+
-+ Sequence< Any > aParams( 2 );
-+ aParams[ 0 ] <<= aValues;
-+ aParams[ 1 ] <<= guess;
-+
-+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IRR") ), rPar.Get( 0 ) );
-+}
-+
-+RTLFUNC(IPmt)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ ULONG nArgCount = rPar.Count()-1;
-+
-+ if ( nArgCount < 4 || nArgCount > 6 )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ return;
-+ }
-+ // retrieve non-optional params
-+
-+ double rate = rPar.Get(1)->GetDouble();
-+ double per = rPar.Get(2)->GetInteger();
-+ double nper = rPar.Get(3)->GetDouble();
-+ double pv = rPar.Get(4)->GetDouble();
-+
-+ // set default values for Optional args
-+ double fv = 0;
-+ double type = 0;
-+
-+ // fv
-+ if ( nArgCount >= 5 )
-+ {
-+ if( rPar.Get(5)->GetType() != SbxEMPTY )
-+ fv = rPar.Get(5)->GetDouble();
-+ }
-+ // type
-+ if ( nArgCount >= 6 )
-+ {
-+ if( rPar.Get(6)->GetType() != SbxEMPTY )
-+ type = rPar.Get(6)->GetDouble();
-+ }
-+
-+ Sequence< Any > aParams( 6 );
-+ aParams[ 0 ] <<= rate;
-+ aParams[ 1 ] <<= per;
-+ aParams[ 2 ] <<= nper;
-+ aParams[ 3 ] <<= pv;
-+ aParams[ 4 ] <<= fv;
-+ aParams[ 5 ] <<= type;
-+
-+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IPmt") ), rPar.Get( 0 ) );
-+}
-+
-+RTLFUNC(FV)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ ULONG nArgCount = rPar.Count()-1;
-+
-+ if ( nArgCount < 3 || nArgCount > 5 )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ return;
-+ }
-+ // retrieve non-optional params
-+
-+ double rate = rPar.Get(1)->GetDouble();
-+ double nper = rPar.Get(2)->GetDouble();
-+ double pmt = rPar.Get(3)->GetDouble();
-+
-+ // set default values for Optional args
-+ double pv = 0;
-+ double type = 0;
-+
-+ // pv
-+ if ( nArgCount >= 4 )
-+ {
-+ if( rPar.Get(4)->GetType() != SbxEMPTY )
-+ pv = rPar.Get(4)->GetDouble();
-+ }
-+ // type
-+ if ( nArgCount >= 5 )
-+ {
-+ if( rPar.Get(5)->GetType() != SbxEMPTY )
-+ type = rPar.Get(5)->GetDouble();
-+ }
-+
-+ Sequence< Any > aParams( 5 );
-+ aParams[ 0 ] <<= rate;
-+ aParams[ 1 ] <<= nper;
-+ aParams[ 2 ] <<= pmt;
-+ aParams[ 3 ] <<= pv;
-+ aParams[ 4 ] <<= type;
-+
-+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FV") ), rPar.Get( 0 ) );
-+}
-+
-+RTLFUNC(DDB)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ ULONG nArgCount = rPar.Count()-1;
-+
-+ if ( nArgCount < 4 || nArgCount > 5 )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ return;
-+ }
-+ // retrieve non-optional params
-+
-+ double cost = rPar.Get(1)->GetDouble();
-+ double salvage = rPar.Get(2)->GetDouble();
-+ double life = rPar.Get(3)->GetDouble();
-+ double period = rPar.Get(4)->GetDouble();
-+
-+ // set default values for Optional args
-+ double factor = 2;
-+
-+ // factor
-+ if ( nArgCount >= 5 )
-+ {
-+ if( rPar.Get(5)->GetType() != SbxEMPTY )
-+ factor = rPar.Get(5)->GetDouble();
-+ }
-+
-+ Sequence< Any > aParams( 5 );
-+ aParams[ 0 ] <<= cost;
-+ aParams[ 1 ] <<= salvage;
-+ aParams[ 2 ] <<= life;
-+ aParams[ 3 ] <<= period;
-+ aParams[ 4 ] <<= factor;
-+
-+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DDB") ), rPar.Get( 0 ) );
-+}
-+
-+RTLFUNC(Rate)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ ULONG nArgCount = rPar.Count()-1;
-+
-+ if ( nArgCount < 3 || nArgCount > 6 )
-+ {
-+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
-+ return;
-+ }
-+ // retrieve non-optional params
-+
-+ double nper = 0;
-+ double pmt = 0;
-+ double pv = 0;
-+
-+ nper = rPar.Get(1)->GetDouble();
-+ pmt = rPar.Get(2)->GetDouble();
-+ pv = rPar.Get(3)->GetDouble();
-+
-+ // set default values for Optional args
-+ double fv = 0;
-+ double type = 0;
-+ double guess = 0.1;
-+
-+ // fv
-+ if ( nArgCount >= 4 )
-+ {
-+ if( rPar.Get(4)->GetType() != SbxEMPTY )
-+ fv = rPar.Get(4)->GetDouble();
-+ }
-+
-+ // type
-+ if ( nArgCount >= 5 )
-+ {
-+ if( rPar.Get(5)->GetType() != SbxEMPTY )
-+ type = rPar.Get(5)->GetDouble();
-+ }
-+
-+ // guess
-+ if ( nArgCount >= 6 )
-+ {
-+ if( rPar.Get(6)->GetType() != SbxEMPTY )
-+ type = rPar.Get(6)->GetDouble();
-+ }
-+
-+ Sequence< Any > aParams( 6 );
-+ aParams[ 0 ] <<= nper;
-+ aParams[ 1 ] <<= pmt;
-+ aParams[ 2 ] <<= pv;
-+ aParams[ 3 ] <<= fv;
-+ aParams[ 4 ] <<= type;
-+ aParams[ 5 ] <<= guess;
-+
-+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Rate") ), rPar.Get( 0 ) );
-+}
-+
- RTLFUNC(StrReverse)
- {
- (void)pBasic;
-diff --git basic/source/runtime/rtlproto.hxx basic/source/runtime/rtlproto.hxx
-index 3564a46..7f4df3c 100644
---- basic/source/runtime/rtlproto.hxx
-+++ basic/source/runtime/rtlproto.hxx
-@@ -167,29 +167,41 @@ extern RTLFUNC(Kill); // JSM
- extern RTLFUNC(MkDir); // JSM
- extern RTLFUNC(RmDir); // JSM
- extern RTLFUNC(SendKeys); // JSM
-+extern RTLFUNC(DDB);
- extern RTLFUNC(DoEvents);
- extern RTLFUNC(DimArray);
- extern RTLFUNC(Dir);
- extern RTLFUNC(Exp);
- extern RTLFUNC(FileLen);
- extern RTLFUNC(Fix);
-+extern RTLFUNC(FV);
- extern RTLFUNC(Hex);
- extern RTLFUNC(Input);
- extern RTLFUNC(InStr);
- extern RTLFUNC(InStrRev);
- extern RTLFUNC(Int);
-+extern RTLFUNC(IPmt);
-+extern RTLFUNC(IRR);
- extern RTLFUNC(Join);
- extern RTLFUNC(LCase);
- extern RTLFUNC(Left);
- extern RTLFUNC(Log);
- extern RTLFUNC(LTrim);
- extern RTLFUNC(Mid);
-+extern RTLFUNC(MIRR);
-+extern RTLFUNC(NPer);
-+extern RTLFUNC(NPV);
- extern RTLFUNC(Oct);
-+extern RTLFUNC(Pmt);
-+extern RTLFUNC(PPmt);
-+extern RTLFUNC(PV);
-+extern RTLFUNC(Rate);
- extern RTLFUNC(Replace);
- extern RTLFUNC(Right);
- extern RTLFUNC(RTrim);
- extern RTLFUNC(RTL);
- extern RTLFUNC(Sgn);
-+extern RTLFUNC(SLN);
- extern RTLFUNC(Space);
- extern RTLFUNC(Split);
- extern RTLFUNC(Sqr);
-@@ -197,6 +209,7 @@ extern RTLFUNC(Str);
- extern RTLFUNC(StrComp);
- extern RTLFUNC(String);
- extern RTLFUNC(StrReverse);
-+extern RTLFUNC(SYD);
- extern RTLFUNC(Tan);
- extern RTLFUNC(UCase);
- extern RTLFUNC(Val);
-diff --git basic/source/runtime/stdobj.cxx basic/source/runtime/stdobj.cxx
-index f997065..38ba7cd 100644
---- basic/source/runtime/stdobj.cxx
-+++ basic/source/runtime/stdobj.cxx
-@@ -175,7 +175,12 @@ static Methods aMethods[] = {
- { "expression", SbxVARIANT, 0,NULL,0 },
- { "CVErr", SbxVARIANT, 1 | _FUNCTION, RTLNAME(CVErr),0 },
- { "expression", SbxVARIANT, 0,NULL,0 },
--
-+{ "DDB", SbxDOUBLE, 5 | _FUNCTION | _COMPTMASK, RTLNAME(DDB),0 },
-+ { "Cost", SbxDOUBLE, 0, NULL,0 },
-+ { "Salvage", SbxDOUBLE, 0, NULL,0 },
-+ { "Life", SbxDOUBLE, 0, NULL,0 },
-+ { "Period", SbxDOUBLE, 0, NULL,0 },
-+ { "Factor", SbxVARIANT, _OPT, NULL,0 },
- { "Date", SbxDATE, _LFUNCTION,RTLNAME(Date),0 },
- { "DateAdd", SbxDATE, 3 | _FUNCTION, RTLNAME(DateAdd),0 },
- { "Interval", SbxSTRING, 0,NULL,0 },
-@@ -273,6 +278,12 @@ static Methods aMethods[] = {
- { "FreeLibrary", SbxNULL, 1 | _FUNCTION, RTLNAME(FreeLibrary),0 },
- { "Modulename", SbxSTRING, 0,NULL,0 },
-
-+{ "FV", SbxDOUBLE, 5 | _FUNCTION | _COMPTMASK, RTLNAME(FV),0 },
-+ { "Rate", SbxDOUBLE, 0, NULL,0 },
-+ { "NPer", SbxDOUBLE, 0, NULL,0 },
-+ { "Pmt", SbxDOUBLE, 0, NULL,0 },
-+ { "PV", SbxVARIANT, _OPT, NULL,0 },
-+ { "Due", SbxVARIANT, _OPT, NULL,0 },
- { "Get", SbxNULL, 3 | _FUNCTION, RTLNAME(Get),0 },
- { "filenumber", SbxINTEGER, 0,NULL,0 },
- { "recordnumber", SbxLONG, 0,NULL,0 },
-@@ -333,6 +344,16 @@ static Methods aMethods[] = {
- { "Compare", SbxINTEGER, _OPT, NULL,0 },
- { "Int", SbxDOUBLE, 1 | _FUNCTION, RTLNAME(Int),0 },
- { "number", SbxDOUBLE, 0,NULL,0 },
-+{ "IPmt", SbxDOUBLE, 6 | _FUNCTION | _COMPTMASK, RTLNAME(IPmt),0 },
-+ { "Rate", SbxDOUBLE, 0, NULL,0 },
-+ { "Per", SbxDOUBLE, 0, NULL,0 },
-+ { "NPer", SbxDOUBLE, 0, NULL,0 },
-+ { "PV", SbxDOUBLE, 0, NULL,0 },
-+ { "FV", SbxVARIANT, _OPT, NULL,0 },
-+ { "Due", SbxVARIANT, _OPT, NULL,0 },
-+{ "IRR", SbxDOUBLE, 2 | _FUNCTION | _COMPTMASK, RTLNAME(IRR),0 },
-+ { "ValueArray", SbxARRAY, 0, NULL,0 },
-+ { "Guess", SbxVARIANT, _OPT, NULL,0 },
- { "IsArray", SbxBOOL, 1 | _FUNCTION, RTLNAME(IsArray),0 },
- { "Variant", SbxVARIANT, 0,NULL,0 },
- { "IsDate", SbxBOOL, 1 | _FUNCTION, RTLNAME(IsDate),0 },
-@@ -401,6 +422,10 @@ static Methods aMethods[] = {
- { "Length", SbxLONG, _OPT, NULL,0 },
- { "Minute", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Minute),0 },
- { "Date", SbxDATE, 0,NULL,0 },
-+{ "MIRR", SbxDOUBLE, 2 | _FUNCTION | _COMPTMASK, RTLNAME(MIRR),0 },
-+ { "ValueArray", SbxARRAY, 0, NULL,0 },
-+ { "FinanceRate", SbxDOUBLE, 0, NULL,0 },
-+ { "ReinvestRate", SbxDOUBLE, 0, NULL,0 },
- { "MkDir", SbxNULL, 1 | _FUNCTION, RTLNAME(MkDir),0 },
- { "pathname", SbxSTRING, 0,NULL,0 },
- { "Month", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Month),0 },
-@@ -417,6 +442,15 @@ static Methods aMethods[] = {
-
- { "Nothing", SbxOBJECT, _CPROP, RTLNAME(Nothing),0 },
- { "Now", SbxDATE, _FUNCTION, RTLNAME(Now),0 },
-+{ "NPer", SbxDOUBLE, 5 | _FUNCTION | _COMPTMASK, RTLNAME(NPer),0 },
-+ { "Rate", SbxDOUBLE, 0, NULL,0 },
-+ { "Pmt", SbxDOUBLE, 0, NULL,0 },
-+ { "PV", SbxDOUBLE, 0, NULL,0 },
-+ { "FV", SbxVARIANT, _OPT, NULL,0 },
-+ { "Due", SbxVARIANT, _OPT, NULL,0 },
-+{ "NPV", SbxDOUBLE, 2 | _FUNCTION | _COMPTMASK, RTLNAME(NPV),0 },
-+ { "Rate", SbxDOUBLE, 0, NULL,0 },
-+ { "ValueArray", SbxARRAY, 0, NULL,0 },
- { "Null", SbxNULL, _CPROP, RTLNAME(Null),0 },
-
- { "Oct", SbxSTRING, 1 | _FUNCTION, RTLNAME(Oct),0 },
-@@ -428,16 +462,46 @@ static Methods aMethods[] = {
- { "stop", SbxLONG, 0,NULL,0 },
- { "interval", SbxLONG, 0,NULL,0 },
- { "Pi", SbxDOUBLE, _CPROP, RTLNAME(PI),0 },
-+
-+{ "Pmt", SbxDOUBLE, 5 | _FUNCTION | _COMPTMASK, RTLNAME(Pmt),0 },
-+ { "Rate", SbxDOUBLE, 0, NULL,0 },
-+ { "NPer", SbxDOUBLE, 0, NULL,0 },
-+ { "PV", SbxDOUBLE, 0, NULL,0 },
-+ { "FV", SbxVARIANT, _OPT, NULL,0 },
-+ { "Due", SbxVARIANT, _OPT, NULL,0 },
-+
-+{ "PPmt", SbxDOUBLE, 6 | _FUNCTION | _COMPTMASK, RTLNAME(PPmt),0 },
-+ { "Rate", SbxDOUBLE, 0, NULL,0 },
-+ { "Per", SbxDOUBLE, 0, NULL,0 },
-+ { "NPer", SbxDOUBLE, 0, NULL,0 },
-+ { "PV", SbxDOUBLE, 0, NULL,0 },
-+ { "FV", SbxVARIANT, _OPT, NULL,0 },
-+ { "Due", SbxVARIANT, _OPT, NULL,0 },
-+
- { "Put", SbxNULL, 3 | _FUNCTION, RTLNAME(Put),0 },
- { "filenumber", SbxINTEGER, 0,NULL,0 },
- { "recordnumber", SbxLONG, 0,NULL,0 },
- { "variablename", SbxVARIANT, 0,NULL,0 },
-
-+{ "PV", SbxDOUBLE, 5 | _FUNCTION | _COMPTMASK, RTLNAME(PV),0 },
-+ { "Rate", SbxDOUBLE, 0, NULL,0 },
-+ { "NPer", SbxDOUBLE, 0, NULL,0 },
-+ { "Pmt", SbxDOUBLE, 0, NULL,0 },
-+ { "FV", SbxVARIANT, _OPT, NULL,0 },
-+ { "Due", SbxVARIANT, _OPT, NULL,0 },
-+
- { "QBColor", SbxLONG, 1 | _FUNCTION, RTLNAME(QBColor),0 },
- { "number", SbxINTEGER, 0,NULL,0 },
-
- { "Randomize", SbxNULL, 1 | _FUNCTION, RTLNAME(Randomize),0 },
- { "Number", SbxDOUBLE, _OPT, NULL,0 },
-+{ "Rate", SbxDOUBLE, 6 | _FUNCTION | _COMPTMASK, RTLNAME(Rate),0 },
-+ { "NPer", SbxDOUBLE, 0, NULL,0 },
-+ { "Pmt", SbxDOUBLE, 0, NULL,0 },
-+ { "PV", SbxDOUBLE, 0, NULL,0 },
-+ { "FV", SbxVARIANT, _OPT, NULL,0 },
-+ { "Due", SbxVARIANT, _OPT, NULL,0 },
-+ { "Guess", SbxVARIANT, _OPT, NULL,0 },
- { "Red", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Red),0 },
- { "RGB-Value", SbxLONG, 0,NULL,0 },
- { "Reset", SbxNULL, 0 | _FUNCTION, RTLNAME(Reset),0 },
-@@ -492,6 +556,15 @@ static Methods aMethods[] = {
- { "WindowStyle", SbxINTEGER, _OPT, NULL,0 },
- { "Sin", SbxDOUBLE, 1 | _FUNCTION, RTLNAME(Sin),0 },
- { "number", SbxDOUBLE, 0,NULL,0 },
-+{ "SLN", SbxDOUBLE, 2 | _FUNCTION | _COMPTMASK, RTLNAME(SLN),0 },
-+ { "Cost", SbxDOUBLE, 0,NULL,0 },
-+ { "Double", SbxDOUBLE, 0,NULL,0 },
-+ { "Life", SbxDOUBLE, 0,NULL,0 },
-+{ "SYD", SbxDOUBLE, 2 | _FUNCTION | _COMPTMASK, RTLNAME(SYD),0 },
-+ { "Cost", SbxDOUBLE, 0,NULL,0 },
-+ { "Salvage", SbxDOUBLE, 0,NULL,0 },
-+ { "Life", SbxDOUBLE, 0,NULL,0 },
-+ { "Period", SbxDOUBLE, 0,NULL,0 },
- { "Space", SbxSTRING, 1 | _FUNCTION, RTLNAME(Space),0 },
- { "string", SbxLONG, 0,NULL,0 },
- { "Spc", SbxSTRING, 1 | _FUNCTION, RTLNAME(Spc),0 },
-diff --git sc/source/ui/vba/vbawsfunction.cxx sc/source/ui/vba/vbawsfunction.cxx
-index 6d6629b..101e1c9 100644
---- sc/source/ui/vba/vbawsfunction.cxx
-+++ sc/source/ui/vba/vbawsfunction.cxx
-@@ -74,13 +74,48 @@ ScVbaWSFunction::invoke(const rtl::OUString& FunctionName, const uno::Sequence<
-
- for (int i=0; i < Params.getLength();i++)
- {
-+ aArrayTemp[i]= aArray[i];
- uno::Reference<excel::XRange> myRange( aArray[ i ], uno::UNO_QUERY );
- if ( myRange.is() )
- {
- aArrayTemp[i] = myRange->getCellRange();
- continue;
- }
-- aArrayTemp[i]= aArray[i];
-+ else if ( aArray[ i ].getValueType().getTypeClass() == uno::TypeClass_SEQUENCE )
-+ {
-+ // the sheet.FunctionAccess service doesn't deal with Sequences, only Sequences of Sequence
-+ uno::Type aType = aArray[ i ].getValueType();
-+ if ( aType.equals( getCppuType( (uno::Sequence<sal_Int16>*)0 ) ) )
-+ {
-+ uno::Sequence< uno::Sequence< sal_Int16 > > aTmp(1);
-+ aArray[ i ] >>= aTmp[ 0 ];
-+ aArrayTemp[i] <<= aTmp;
-+ }
-+ else if ( aType.equals( getCppuType( (uno::Sequence<sal_Int32>*)0 ) ) )
-+ {
-+ uno::Sequence< uno::Sequence< sal_Int32 > > aTmp(1);
-+ aArray[ i ] >>= aTmp[ 0 ];
-+ aArrayTemp[i] <<= aTmp;
-+ }
-+ else if ( aType.equals( getCppuType( (uno::Sequence<double>*)0 ) ) )
-+ {
-+ uno::Sequence< uno::Sequence< double > > aTmp(1);
-+ aArray[ i ] >>= aTmp[ 0 ];
-+ aArrayTemp[i] <<= aTmp;
-+ }
-+ else if ( aType.equals( getCppuType( (uno::Sequence<rtl::OUString>*)0 ) ) )
-+ {
-+ uno::Sequence< uno::Sequence< rtl::OUString > > aTmp(1);
-+ aArray[ i ] >>= aTmp[ 0 ];
-+ aArrayTemp[i] <<= aTmp;
-+ }
-+ else if ( aType.equals( getCppuType( (uno::Sequence<uno::Any>*)0 ) ) )
-+ {
-+ uno::Sequence< uno::Sequence<uno::Any > > aTmp(1);
-+ aArray[ i ] >>= aTmp[ 0 ];
-+ aArrayTemp[i] <<= aTmp;
-+ }
-+ }
- }
-
- for ( int count=0; count < aParamTemp.getLength(); ++count )
diff --git a/patches/vba/vba-fireevents-from-apichange.diff b/patches/vba/vba-fireevents-from-apichange.diff
deleted file mode 100644
index cc70e9cba..000000000
--- a/patches/vba/vba-fireevents-from-apichange.diff
+++ /dev/null
@@ -1,472 +0,0 @@
-From 9222eccc93c41db87bd2ea2d9fe5d39d5ba05299 Mon Sep 17 00:00:00 2001
-From: Jan Holesovsky <kendy@suse.cz>
-Date: Fri, 14 May 2010 17:00:05 +0200
-Subject: [PATCH 394/878] vba-fireevents-from-apichange.diff
-
----
- basic/source/classes/sbxmod.cxx | 3 +-
- scripting/source/vbaevents/eventhelper.cxx | 48 +++++++++++++---
- vbahelper/source/msforms/vbacheckbox.cxx | 4 +
- vbahelper/source/msforms/vbacombobox.cxx | 30 ++--------
- vbahelper/source/msforms/vbacontrol.cxx | 84 ++++++++++++++++++++++++++-
- vbahelper/source/msforms/vbacontrol.hxx | 11 ++++
- vbahelper/source/msforms/vbalistbox.cxx | 6 ++
- vbahelper/source/msforms/vbaradiobutton.cxx | 7 ++
- vbahelper/source/msforms/vbauserform.cxx | 4 +
- vbahelper/source/msforms/vbauserform.hxx | 1 +
- 10 files changed, 164 insertions(+), 34 deletions(-)
-
-diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
-index 5f0aacb..16740e8 100644
---- a/basic/source/classes/sbxmod.cxx
-+++ b/basic/source/classes/sbxmod.cxx
-@@ -2001,10 +2001,11 @@ void SbUserFormModule::InitObject()
- m_xDialog = xProvider->createDialog( sDialogUrl );
-
- // create vba api object
-- aArgs.realloc( 3 );
-+ aArgs.realloc( 4 );
- aArgs[ 0 ] = uno::Any();
- aArgs[ 1 ] <<= m_xDialog;
- aArgs[ 2 ] <<= m_xModel;
-+ aArgs[ 3 ] <<= rtl::OUString( GetParent()->GetName() );
- pDocObject = new SbUnoObject( GetName(), uno::makeAny( xVBAFactory->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.UserForm")), aArgs ) ) );
- uno::Reference< lang::XComponent > xComponent( aArgs[ 1 ], uno::UNO_QUERY_THROW );
- // remove old listener if it exists
-diff --git a/scripting/source/vbaevents/eventhelper.cxx b/scripting/source/vbaevents/eventhelper.cxx
-index c696a35..b04c842 100644
---- a/scripting/source/vbaevents/eventhelper.cxx
-+++ b/scripting/source/vbaevents/eventhelper.cxx
-@@ -23,6 +23,8 @@
- #include <com/sun/star/script/ScriptEventDescriptor.hpp>
- #include <com/sun/star/script/provider/XScriptProviderSupplier.hpp>
-
-+#include <com/sun/star/container/XNamed.hpp>
-+
- #include <com/sun/star/drawing/XControlShape.hpp>
-
- #include <com/sun/star/awt/XControl.hpp>
-@@ -33,6 +35,7 @@
- #include <com/sun/star/awt/XTextComponent.hpp> //liuchen 2009-6-5
- #include <com/sun/star/awt/XComboBox.hpp> //liuchen 2009-6-18
- #include <com/sun/star/awt/XRadioButton.hpp> //liuchen 2009-7-30
-+#include <com/sun/star/awt/XListBox.hpp>
-
- #include <msforms/ReturnInteger.hpp>
-
-@@ -274,24 +277,27 @@ Type typeXFixedText = GET_TYPE(awt::XFixedText);
- Type typeXTextComponent = GET_TYPE(awt::XTextComponent);
- Type typeXComboBox = GET_TYPE(awt::XComboBox);
- Type typeXRadioButton = GET_TYPE(awt::XRadioButton);
-+Type typeXListBox = GET_TYPE(awt::XListBox);
-
-
- TypeList fixedTextList = {&typeXFixedText, 1};
- TypeList textCompList = {&typeXTextComponent, 1};
- TypeList radioButtonList = {&typeXRadioButton, 1};
- TypeList comboBoxList = {&typeXComboBox, 1};
-+TypeList listBoxList = {&typeXListBox, 1};
-
- //this array stores the OO event to VBA event translation info
- static TranslatePropMap aTranslatePropMap_Impl[] =
- {
-+ { MAP_CHAR_LEN("actionPerformed"), { MAP_CHAR_LEN("_Change"), NULL, DenyType, (void*)(&radioButtonList) } }, //liuchen 2009-7-30, OptionalButton_Change event is not the same as OptionalButton_Click event
- // actionPerformed ooo event
- { MAP_CHAR_LEN("actionPerformed"), { MAP_CHAR_LEN("_Click"), NULL, ApproveAll, NULL } },
-- { MAP_CHAR_LEN("actionPerformed"), { MAP_CHAR_LEN("_Change"), NULL, DenyType, (void*)(&radioButtonList) } }, //liuchen 2009-7-30, OptionalButton_Change event is not the same as OptionalButton_Click event
-
-+ { MAP_CHAR_LEN("itemStateChanged"), { MAP_CHAR_LEN("_Change"), NULL, ApproveType, (void*)(&radioButtonList) } }, //liuchen 2009-7-30, OptionalButton_Change event should be triggered when the button state is changed
- // itemStateChanged ooo event
- { MAP_CHAR_LEN("itemStateChanged"), { MAP_CHAR_LEN("_Click"), NULL, ApproveType, (void*)(&comboBoxList) } }, //liuchen, add to support VBA ComboBox_Click event
-- { MAP_CHAR_LEN("itemStateChanged"), { MAP_CHAR_LEN("_Change"), NULL, ApproveType, (void*)(&radioButtonList) } }, //liuchen 2009-7-30, OptionalButton_Change event should be triggered when the button state is changed
-
-+ { MAP_CHAR_LEN("itemStateChanged"), { MAP_CHAR_LEN("_Click"), NULL, ApproveType, (void*)(&listBoxList) } },
- // changed ooo event
- { MAP_CHAR_LEN("changed"), { MAP_CHAR_LEN("_Change"), NULL, ApproveAll, NULL } },
-
-@@ -908,17 +914,43 @@ EventListener::firing_Impl(const ScriptEvent& evt, Any* pRet ) throw(RuntimeExce
- evt.Arguments[ 0 ] >>= aEvent;
- OSL_TRACE("evt.MethodName is %s", rtl::OUStringToOString( evt.MethodName, RTL_TEXTENCODING_UTF8 ).getStr() );
- OSL_TRACE("Argument[0] is %s", rtl::OUStringToOString( comphelper::anyToString( evt.Arguments[0] ), RTL_TEXTENCODING_UTF8 ).getStr() );
-- OSL_TRACE("Getting Control");
-- uno::Reference< awt::XControl > xControl( aEvent.Source, uno::UNO_QUERY_THROW );
-- OSL_TRACE("Getting properties");
-- uno::Reference< beans::XPropertySet > xProps( xControl->getModel(), uno::UNO_QUERY_THROW );
--
- rtl::OUString sName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UserForm") );
- OSL_TRACE("Getting Name");
-
- uno::Reference< awt::XDialog > xDlg( aEvent.Source, uno::UNO_QUERY );
- if ( !xDlg.is() )
-- xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ) ) >>= sName;
-+ {
-+ OSL_TRACE("Getting Control");
-+ // evt.Source is
-+ // a) Dialog
-+ // b) xShapeControl ( from api (sheet control) )
-+ // c) eventmanager ( I guess )
-+ // d) vba control ( from api also )
-+ uno::Reference< drawing::XControlShape > xCntrlShape( evt.Source, uno::UNO_QUERY );
-+ uno::Reference< awt::XControl > xControl( aEvent.Source, uno::UNO_QUERY );
-+ if ( xCntrlShape.is() )
-+ {
-+ // for sheet controls ( that fire from the api ) we don't
-+ // have the real control ( thats only available from the view )
-+ // api code creates just a control instance that is transferred
-+ // via aEvent.Arguments[ 0 ] that control though has no
-+ // info like name etc.
-+ uno::Reference< drawing::XControlShape > xCntrlShape( evt.Source, UNO_QUERY_THROW );
-+ OSL_TRACE("Got control shape");
-+ uno::Reference< container::XNamed > xName( xCntrlShape->getControl(), uno::UNO_QUERY_THROW );
-+ OSL_TRACE("Got xnamed ");
-+ sName = xName->getName();
-+ }
-+ else
-+ {
-+ // Userform control ( fired from the api or from event manager )
-+ uno::Reference< beans::XPropertySet > xProps;
-+ OSL_TRACE("Getting properties");
-+ xProps.set( xControl->getModel(), uno::UNO_QUERY_THROW );
-+ xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ) ) >>= sName;
-+ }
-+
-+ }
- //dumpEvent( evt );
- EventInfoHash& infos = getEventTransInfo();
- EventInfoHash::const_iterator eventInfo_it = infos.find( evt.MethodName );
-diff --git a/vbahelper/source/msforms/vbacheckbox.cxx b/vbahelper/source/msforms/vbacheckbox.cxx
-index cbd028a..d5103e0 100644
---- a/vbahelper/source/msforms/vbacheckbox.cxx
-+++ b/vbahelper/source/msforms/vbacheckbox.cxx
-@@ -78,6 +78,8 @@ void SAL_CALL
- ScVbaCheckbox::setValue( const uno::Any& _value ) throw (css::uno::RuntimeException)
- {
- sal_Int16 nValue = 0;
-+ sal_Int16 nOldValue = 0;
-+ m_xProps->getPropertyValue( STATE ) >>= nOldValue;
- sal_Bool bValue = false;
- if( _value >>= nValue )
- {
-@@ -90,6 +92,8 @@ ScVbaCheckbox::setValue( const uno::Any& _value ) throw (css::uno::RuntimeExcept
- nValue = 1;
- }
- m_xProps->setPropertyValue( STATE, uno::makeAny( nValue ) );
-+ if ( nValue != nOldValue )
-+ fireClickEvent();
- }
- rtl::OUString&
- ScVbaCheckbox::getServiceImplName()
-diff --git a/vbahelper/source/msforms/vbacombobox.cxx b/vbahelper/source/msforms/vbacombobox.cxx
-index d13bdea..2cadbab 100644
---- a/vbahelper/source/msforms/vbacombobox.cxx
-+++ b/vbahelper/source/msforms/vbacombobox.cxx
-@@ -80,30 +80,7 @@ ScVbaComboBox::setListIndex( const uno::Any& _value ) throw (uno::RuntimeExcepti
-
- // fire the _Change event
- if( nOldIndex != nIndex )
-- {
-- rtl::OUString sControlName = getName();
-- // get active module
-- SbModule* pModule = StarBASIC::GetActiveModule();
-- StarBASIC* pLib = pModule ? dynamic_cast< StarBASIC* >( pModule->GetParent() ) : NULL;
-- if( pModule && pLib )
-- {
-- rtl::OUString sMacroName = pModule->GetParent()->GetName();
-- rtl::OUString sModuleName = pModule->GetName();
-- sMacroName = sMacroName.concat( rtl::OUString::createFromAscii(".") ).concat( sModuleName ).concat( rtl::OUString::createFromAscii(".") ).concat( sControlName ).concat( rtl::OUString::createFromAscii("_Change") );
-- OSL_TRACE("ScVbaComboBox::setListIndex, fire the event %s",
-- rtl::OUStringToOString( sMacroName, RTL_TEXTENCODING_UTF8 ).getStr() );
-- //static const rtl::OUString sThisComponent( RTL_CONSTASCII_USTRINGPARAM("ThisComponent" ) );
-- //uno::Reference< frame::XModel > xModel = getCurrentDoc( sThisComponent );
-- VBAMacroResolvedInfo aMacroInfo = resolveVBAMacro( getSfxObjShell( m_xModel ), sMacroName );
-- if( aMacroInfo.IsResolved() )
-- {
-- uno::Sequence< uno::Any > aArgs;
-- uno::Any aRet;
-- uno::Any aDummyCaller;
-- executeMacro( aMacroInfo.MacroDocContext(), aMacroInfo.ResolvedMacro(), aArgs, aRet, aDummyCaller );
-- }
-- }
-- }
-+ fireClickEvent();
- }
- }
- }
-@@ -138,7 +115,12 @@ ScVbaComboBox::getListIndex() throw (uno::RuntimeException)
- void SAL_CALL
- ScVbaComboBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
- {
-+ rtl::OUString sOldValue;
-+ rtl::OUString sNewValue;
-+ _value >>= sNewValue;
- m_xProps->setPropertyValue( sSourceName, _value );
-+ if ( sNewValue != sOldValue )
-+ fireClickEvent();
- }
-
- // see Value
-diff --git a/vbahelper/source/msforms/vbacontrol.cxx b/vbahelper/source/msforms/vbacontrol.cxx
-index ac97e3b..44c7f2f 100644
---- a/vbahelper/source/msforms/vbacontrol.cxx
-+++ b/vbahelper/source/msforms/vbacontrol.cxx
-@@ -31,6 +31,7 @@
- #include <com/sun/star/awt/XControlModel.hpp>
- #include <com/sun/star/awt/XControl.hpp>
- #include <com/sun/star/awt/XWindow2.hpp>
-+#include <com/sun/star/awt/XActionListener.hpp>
- #include <com/sun/star/lang/XEventListener.hpp>
- #include <com/sun/star/drawing/XShape.hpp>
- #include <com/sun/star/drawing/XControlShape.hpp>
-@@ -42,6 +43,9 @@
- #include <com/sun/star/form/binding/XListEntrySink.hpp>
- #include <com/sun/star/table/CellAddress.hpp>
- #include <com/sun/star/table/CellRangeAddress.hpp>
-+#include <com/sun/star/script/XScriptListener.hpp>
-+#include <com/sun/star/document/XCodeNameQuery.hpp>
-+#include <com/sun/star/form/XChangeListener.hpp>
- #include <ooo/vba/XControlProvider.hpp>
- #ifdef VBA_OOBUILD_HACK
- #include <svtools/bindablecontrolhelper.hxx>
-@@ -129,7 +133,7 @@ ScVbaControlListener::disposing( const lang::EventObject& ) throw( uno::RuntimeE
-
- //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 )
-+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 ), bIsDialog(false), m_xControl( xControl ), m_xModel( xModel )
- {
- //add listener
- m_xEventListener.set( new ScVbaControlListener( this ) );
-@@ -141,9 +145,18 @@ ScVbaControl::ScVbaControl( const uno::Reference< XHelperInterface >& xParent, c
- 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 );
-+ rtl::OUString sDefaultControl;
-+ m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DefaultControl") ) ) >>= sDefaultControl;
-+ uno::Reference< lang::XMultiComponentFactory > xMFac( mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
-+ m_xEmptyFormControl.set( xMFac->createInstanceWithContext( sDefaultControl, mxContext ), uno::UNO_QUERY_THROW );
-+ }
- else if ( xUserFormControl.is() ) // userform control
-+ {
- m_xProps.set( xUserFormControl->getModel(), uno::UNO_QUERY_THROW );
-+ bIsDialog = true;
-+ }
- }
-
- ScVbaControl::~ScVbaControl()
-@@ -383,6 +396,75 @@ void SAL_CALL ScVbaControl::setForeColor( ::sal_Int32 _forecolor ) throw (::com:
- {
- m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextColor" ) ), uno::makeAny( XLRGBToOORGB( _forecolor ) ) );
- }
-+
-+void ScVbaControl::fireEvent( script::ScriptEvent& evt )
-+{
-+ uno::Reference<lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
-+ uno::Reference< script::XScriptListener > xScriptListener( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.EventListener" ) ), mxContext ), uno::UNO_QUERY_THROW );
-+
-+ uno::Reference< beans::XPropertySet > xProps( xScriptListener, uno::UNO_QUERY_THROW );
-+ xProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Model" ) ), uno::makeAny( m_xModel ) );
-+
-+ // handling for sheet control
-+ uno::Reference< msforms::XControl > xThisControl( this );
-+ try
-+ {
-+ evt.Arguments.realloc( 1 );
-+ lang::EventObject aEvt;
-+
-+ uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY ) ;
-+ uno::Reference< awt::XControl > xControl( m_xControl, uno::UNO_QUERY ) ;
-+
-+ if ( xControlShape.is() )
-+ {
-+ evt.Source = xControlShape;
-+ aEvt.Source = m_xEmptyFormControl;
-+ // Set up proper scriptcode
-+ uno::Reference< lang::XMultiServiceFactory > xDocFac( m_xModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< document::XCodeNameQuery > xNameQuery( xDocFac->createInstance( rtl::OUString::createFromAscii( "ooo.vba.VBACodeNameProvider" ) ), uno::UNO_QUERY_THROW );
-+ uno::Reference< uno::XInterface > xIf( xControlShape->getControl(), uno::UNO_QUERY_THROW );
-+ evt.ScriptCode = xNameQuery->getCodeNameForObject( xIf );
-+ evt.Arguments[ 0 ] = uno::makeAny( aEvt );
-+ xScriptListener->firing( evt );
-+ }
-+ else
-+ {
-+ if ( xControl.is() ) // normal control ( from dialog/userform )
-+ {
-+ // #FIXME We should probably store a reference to the
-+ // parent dialog/userform here ( other wise the name of
-+ // dialog could be changed and we won't be aware of it.
-+ // ( OTOH this is probably an unlikely scenario )
-+ evt.Source = xThisControl;
-+ aEvt.Source = xControl;
-+ evt.ScriptCode = m_sLibraryAndCodeName;
-+ evt.Arguments[ 0 ] = uno::makeAny( aEvt );
-+ xScriptListener->firing( evt );
-+ }
-+ }
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ }
-+}
-+void ScVbaControl::fireChangeEvent()
-+{
-+ script::ScriptEvent evt;
-+ evt.ScriptType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VBAInterop") );
-+ evt.ListenerType = form::XChangeListener::static_type(0);
-+ evt.MethodName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("changed") );
-+ fireEvent( evt );
-+}
-+
-+void ScVbaControl::fireClickEvent()
-+{
-+ script::ScriptEvent evt;
-+ evt.ScriptType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VBAInterop") );
-+ evt.ListenerType = awt::XActionListener::static_type(0);
-+ evt.MethodName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("actionPerformed") );
-+ fireEvent( evt );
-+}
-+
- //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 )
-diff --git a/vbahelper/source/msforms/vbacontrol.hxx b/vbahelper/source/msforms/vbacontrol.hxx
-index 3926a8e..fd1e1ff 100644
---- a/vbahelper/source/msforms/vbacontrol.hxx
-+++ b/vbahelper/source/msforms/vbacontrol.hxx
-@@ -37,6 +37,7 @@
- #include <com/sun/star/drawing/XControlShape.hpp>
- #include <com/sun/star/awt/XControl.hpp>
- #include <com/sun/star/awt/XWindowPeer.hpp>
-+#include <com/sun/star/script/ScriptEvent.hpp>
- #include <ooo/vba/msforms/XControl.hpp>
-
- #include <vbahelper/vbahelper.hxx>
-@@ -50,13 +51,19 @@ class ScVbaControl : public ControlImpl_BASE
- {
- private:
- com::sun::star::uno::Reference< com::sun::star::lang::XEventListener > m_xEventListener;
-+ com::sun::star::uno::Reference< com::sun::star::awt::XControl > m_xEmptyFormControl;
- protected:
-+ bool bIsDialog;
-+ rtl::OUString m_sLibraryAndCodeName;
- 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);
-+ void fireChangeEvent();
-+ void fireClickEvent();
-+ void fireEvent( css::script::ScriptEvent& evt );
- 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 );
-@@ -64,6 +71,10 @@ public:
- // This class will own the helper, so make sure it is allocated from
- // the heap
- void setGeometryHelper( ov::AbstractGeometryAttributes* pHelper );
-+ // sets the name of the associated library ( used for UserForm controls )
-+ void setLibraryAndCodeName( const rtl::OUString& sLibCodeName ) { m_sLibraryAndCodeName = sLibCodeName; }
-+ rtl::OUString getLibraryAndCodeName() { return m_sLibraryAndCodeName; }
-+
- // XControl
- virtual sal_Bool SAL_CALL getEnabled() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setEnabled( sal_Bool _enabled ) throw (css::uno::RuntimeException);
-diff --git a/vbahelper/source/msforms/vbalistbox.cxx b/vbahelper/source/msforms/vbalistbox.cxx
-index ad4e004..15b707d 100644
---- a/vbahelper/source/msforms/vbalistbox.cxx
-+++ b/vbahelper/source/msforms/vbalistbox.cxx
-@@ -111,8 +111,12 @@ ScVbaListBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
- "Attribute use invalid." ), uno::Reference< uno::XInterface >() );
-
- uno::Sequence< sal_Int16 > nSelectedIndices(1);
-+ uno::Sequence< sal_Int16 > nOldSelectedIndices;
-+ m_xProps->getPropertyValue( SELECTEDITEMS ) >>= nOldSelectedIndices;
- nSelectedIndices[ 0 ] = nValue;
- m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nSelectedIndices ) );
-+ if ( nSelectedIndices != nOldSelectedIndices )
-+ fireClickEvent();
- //m_xProps->setPropertyValue( TEXT, uno::makeAny( sValue ) ); //liuchen 2009-8-12 solve the problem that ListBox.Text and ListBox.Value cannot be set
- }
-
-@@ -210,6 +214,7 @@ ScVbaListBox::setValueEvent( const uno::Any& value )
- }
- nList.realloc( nLength - 1 );
- //m_xProps->setPropertyValue( sSourceName, uno::makeAny( nList ) );
-+ fireClickEvent();
- m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nList ) );
- return;
- }
-@@ -228,6 +233,7 @@ ScVbaListBox::setValueEvent( const uno::Any& value )
- nList[0] = nIndex;
- }
- //m_xProps->setPropertyValue( sSourceName, uno::makeAny( nList ) );
-+ fireClickEvent();
- m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nList ) );
- }
- }
-diff --git a/vbahelper/source/msforms/vbaradiobutton.cxx b/vbahelper/source/msforms/vbaradiobutton.cxx
-index 3ce00bf..b007734 100644
---- a/vbahelper/source/msforms/vbaradiobutton.cxx
-+++ b/vbahelper/source/msforms/vbaradiobutton.cxx
-@@ -73,7 +73,9 @@ void SAL_CALL
- ScVbaRadioButton::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
- {
- sal_Int16 nValue = 0;
-+ sal_Int16 nOldValue = 0;
- sal_Bool bValue = sal_False;
-+ getValue() >>= nOldValue;
- if( _value >>= nValue )
- {
- if( nValue == -1)
-@@ -85,6 +87,11 @@ ScVbaRadioButton::setValue( const uno::Any& _value ) throw (uno::RuntimeExceptio
- nValue = 1;
- }
- m_xProps->setPropertyValue( STATE, uno::makeAny( nValue ) );
-+ if ( nValue != nOldValue )
-+ {
-+ fireChangeEvent();
-+ fireClickEvent();
-+ }
- }
-
- rtl::OUString&
-diff --git a/vbahelper/source/msforms/vbauserform.cxx b/vbahelper/source/msforms/vbauserform.cxx
-index 882b5ec..ddf4ff2 100644
---- a/vbahelper/source/msforms/vbauserform.cxx
-+++ b/vbahelper/source/msforms/vbauserform.cxx
-@@ -61,6 +61,8 @@ ScVbaUserForm::ScVbaUserForm( uno::Sequence< uno::Any > const& aArgs, uno::Refer
- uno::Reference< awt::XControl > xControl( m_xDialog, uno::UNO_QUERY_THROW );
- m_xProps.set( xControl->getModel(), uno::UNO_QUERY_THROW );
- setGeometryHelper( new UserFormGeometryHelper( xContext, xControl ) );
-+ if ( aArgs.getLength() >= 4 )
-+ aArgs[ 3 ] >>= m_sLibName;
- }
-
- ScVbaUserForm::~ScVbaUserForm()
-@@ -182,6 +184,8 @@ ScVbaUserForm::getValue( const ::rtl::OUString& aPropertyName ) throw (beans::Un
- uno::Reference< msforms::XControl > xVBAControl( aFac.createControl( xDialogControl->getModel() ) );
- ScVbaControl* pControl = dynamic_cast< ScVbaControl* >( xVBAControl.get() );
- pControl->setGeometryHelper( new UserFormGeometryHelper( mxContext, xControl ) );
-+ if ( m_sLibName.getLength() )
-+ pControl->setLibraryAndCodeName( m_sLibName.concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "." ) ) ).concat( getName() ) );
- return uno::makeAny( xVBAControl );
- }
-
-diff --git a/vbahelper/source/msforms/vbauserform.hxx b/vbahelper/source/msforms/vbauserform.hxx
-index be93dc7..9ad194d 100644
---- a/vbahelper/source/msforms/vbauserform.hxx
-+++ b/vbahelper/source/msforms/vbauserform.hxx
-@@ -51,6 +51,7 @@ class ScVbaUserForm : public ScVbaUserForm_BASE
- private:
- css::uno::Reference< css::awt::XDialog > m_xDialog;
- bool mbDispose;
-+ rtl::OUString m_sLibName;
- protected:
- public:
- ScVbaUserForm( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext ) throw ( css::lang::IllegalArgumentException );
---
-1.7.0.1
-
diff --git a/patches/vba/vba-fix-IsEmpty-api-object.diff b/patches/vba/vba-fix-IsEmpty-api-object.diff
deleted file mode 100644
index 4e7fcda0b..000000000
--- a/patches/vba/vba-fix-IsEmpty-api-object.diff
+++ /dev/null
@@ -1,33 +0,0 @@
-diff --git basic/source/runtime/methods.cxx basic/source/runtime/methods.cxx
-index 72219ee..50dcf6b 100644
---- basic/source/runtime/methods.cxx
-+++ basic/source/runtime/methods.cxx
-@@ -108,6 +108,8 @@ using namespace com::sun::star::script;
- #include <stdlib.h>
- #include <ctype.h>
-
-+SbxVariable* getDefaultProp( SbxVariable* pRef );
-+
- #if defined (WIN) || defined (WNT) || defined (OS2)
- #include <direct.h> // _getdcwd get current work directory, _chdrive
- #endif
-@@ -2426,7 +2429,18 @@ RTLFUNC(IsEmpty)
- if ( rPar.Count() < 2 )
- StarBASIC::Error( SbERR_BAD_ARGUMENT );
- else
-- rPar.Get( 0 )->PutBool( rPar.Get(1)->IsEmpty() );
-+ {
-+ SbxVariable* pVar = NULL;
-+ if( SbiRuntime::isVBAEnabled() )
-+ pVar = getDefaultProp( rPar.Get(1) );
-+ if ( pVar )
-+ {
-+ pVar->Broadcast( SBX_HINT_DATAWANTED );
-+ rPar.Get( 0 )->PutBool( pVar->IsEmpty() );
-+ }
-+ else
-+ rPar.Get( 0 )->PutBool( rPar.Get(1)->IsEmpty() );
-+ }
- }
-
- RTLFUNC(IsError)
diff --git a/patches/vba/vba-fix-Range-Insert-CopyOrigin.diff b/patches/vba/vba-fix-Range-Insert-CopyOrigin.diff
deleted file mode 100644
index 75839f419..000000000
--- a/patches/vba/vba-fix-Range-Insert-CopyOrigin.diff
+++ /dev/null
@@ -1,33 +0,0 @@
---- sc/source/ui/vba/vbarange.cxx 2009-04-27 18:35:48.000000000 +0100
-+++ sc/source/ui/vba/vbarange.cxx 2009-04-27 19:41:46.000000000 +0100
-@@ -4340,8 +4340,10 @@ ScVbaRange::AutoFilter( const uno::Any&
- }
-
- 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
-@@ -4373,8 +4375,17 @@ ScVbaRange::Insert( const uno::Any& Shif
- 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
diff --git a/patches/vba/vba-fix-basic-macro-organizer.diff b/patches/vba/vba-fix-basic-macro-organizer.diff
deleted file mode 100644
index 35c0c1c1e..000000000
--- a/patches/vba/vba-fix-basic-macro-organizer.diff
+++ /dev/null
@@ -1,40 +0,0 @@
-diff --git basctl/source/basicide/moduldlg.cxx basctl/source/basicide/moduldlg.cxx
-index 23b890c..54fc2ea 100644
---- basctl/source/basicide/moduldlg.cxx
-+++ basctl/source/basicide/moduldlg.cxx
-@@ -636,9 +636,13 @@ void ObjectPage::CheckButtons()
- USHORT nMode = aBasicBox.GetMode();
-
- USHORT nDepth = pCurEntry ? aBasicBox.GetModel()->GetDepth( pCurEntry ) : 0;
-- if ( ( !bVBAEnabled && ( nDepth == 2 ) )
-- || ( bVBAEnabled && ( nMode & BROWSEMODE_MODULES ) && ( nDepth == 3 ) ) )
-- aEditButton.Enable();
-+ if ( nDepth >= 2 )
-+ {
-+ if( bVBAEnabled && ( nMode & BROWSEMODE_MODULES ) && ( nDepth == 2 ) )
-+ aEditButton.Disable();
-+ else
-+ aEditButton.Enable();
-+ }
- else
- aEditButton.Disable();
-
-@@ -667,10 +671,14 @@ void ObjectPage::CheckButtons()
- }
-
- // enable/disable delete button
-- if ( ( ( !bVBAEnabled && nDepth == 2 ) || ( bVBAEnabled && ( nDepth == 3 ) && !aLibSubName.Equals( String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) ) )
-- && !bReadOnly && eLocation != LIBRARY_LOCATION_SHARE )
-- aDelButton.Enable();
-- else
-+ if ( nDepth >= 2 && !bReadOnly && eLocation != LIBRARY_LOCATION_SHARE )
-+ {
-+ if( bVBAEnabled && ( nMode & BROWSEMODE_MODULES ) && ( ( nDepth == 2 ) || aLibSubName.Equals( String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) ) )
-+ aDelButton.Disable();
-+ else
-+ aDelButton.Enable();
-+ }
-+ else
- aDelButton.Disable();
- }
-
diff --git a/patches/vba/vba-fix-checkbox-ole-access.diff b/patches/vba/vba-fix-checkbox-ole-access.diff
deleted file mode 100644
index 6c9094ef9..000000000
--- a/patches/vba/vba-fix-checkbox-ole-access.diff
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git vbahelper/source/msforms/vbacontrol.cxx vbahelper/source/msforms/vbacontrol.cxx
-index 3503631..623b0cd 100644
---- vbahelper/source/msforms/vbacontrol.cxx
-+++ vbahelper/source/msforms/vbacontrol.cxx
-@@ -416,6 +416,8 @@ ScVbaControl* ScVbaControlFactory::createControl(const uno::Reference< drawing::
- 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::CHECKBOX:
-+ return new ScVbaCheckbox( 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:
diff --git a/patches/vba/vba-fix-control-shape-geom-fix.diff b/patches/vba/vba-fix-control-shape-geom-fix.diff
deleted file mode 100644
index 71049740d..000000000
--- a/patches/vba/vba-fix-control-shape-geom-fix.diff
+++ /dev/null
@@ -1,233 +0,0 @@
-diff --git sc/source/ui/vba/vbashape.cxx sc/source/ui/vba/vbashape.cxx
-index a8d9e82..eb31a64 100644
---- sc/source/ui/vba/vbashape.cxx
-+++ sc/source/ui/vba/vbashape.cxx
-@@ -53,6 +53,7 @@ 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 );
-+ m_pShapeHelper.reset( new ShapeHelper( m_xShape ) );
- addListeners();
- }
-
-@@ -179,59 +180,49 @@ ScVbaShape::setName( const rtl::OUString& _name ) throw (uno::RuntimeException)
- double SAL_CALL
- ScVbaShape::getHeight() throw (uno::RuntimeException)
- {
-- return Millimeter::getInPoints( m_xShape->getSize().Height );
-+ return m_pShapeHelper->getHeight();
- }
-
- 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 );
-+ m_pShapeHelper->setHeight( _height );
- }
-
- double SAL_CALL
- ScVbaShape::getWidth() throw (uno::RuntimeException)
- {
-- return Millimeter::getInPoints( m_xShape->getSize().Width );
-+ return m_pShapeHelper->getWidth();
- }
-
- 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 );
-+ m_pShapeHelper->setWidth( _width );
- }
-
- double SAL_CALL
- ScVbaShape::getLeft() throw (uno::RuntimeException)
- {
-- return Millimeter::getInPoints( m_xShape->getPosition().X );
-+ return m_pShapeHelper->getLeft();
- }
-
- 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 );
-+ m_pShapeHelper->setLeft( _left );
- }
-
- double SAL_CALL
- ScVbaShape::getTop() throw (uno::RuntimeException)
- {
-- return Millimeter::getInPoints( m_xShape->getPosition().Y );
-+ return m_pShapeHelper->getTop();
- }
-
- 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 );
-+ return m_pShapeHelper->setTop( _top );
- }
-
- sal_Bool SAL_CALL
-diff --git sc/source/ui/vba/vbashape.hxx sc/source/ui/vba/vbashape.hxx
-index d896a3d..eb48b93 100644
---- sc/source/ui/vba/vbashape.hxx
-+++ sc/source/ui/vba/vbashape.hxx
-@@ -47,9 +47,9 @@ typedef InheritedHelperInterfaceImpl< ListeningShape > ScVbaShape_BASE;
-
- class ScVbaShape : public ScVbaShape_BASE
- {
--friend class ConcreteXShapeHelper; // perhaps an accessor would be better
- private:
- protected:
-+ std::auto_ptr< ov::ShapeHelper > m_pShapeHelper;
- css::uno::Reference< css::drawing::XShape > m_xShape;
- css::uno::Reference< css::drawing::XShapes > m_xShapes;
- css::uno::Reference< css::beans::XPropertySet > m_xPropertySet;
-diff --git vbahelper/inc/vbahelper/vbahelper.hxx vbahelper/inc/vbahelper/vbahelper.hxx
-index cfc8ee0..5749839 100644
---- vbahelper/inc/vbahelper/vbahelper.hxx
-+++ vbahelper/inc/vbahelper/vbahelper.hxx
-@@ -46,6 +46,7 @@
- #include <vcl/pointr.hxx>
- #define VBAHELPER_DLLIMPLEMENTATION
- #include <vbahelper/vbadllapi.h>
-+#include <memory>
- namespace css = ::com::sun::star;
-
- namespace ooo
-@@ -132,10 +133,34 @@ namespace msforms {
- class XShape;
- }
-
-+class VBAHELPER_DLLPUBLIC ShapeHelper
-+{
-+protected:
-+ css::uno::Reference< css::drawing::XShape > xShape;
-+public:
-+ ShapeHelper( const css::uno::Reference< css::drawing::XShape >& _xShape) throw (css::script::BasicErrorException );
-+
-+ double getHeight();
-+
-+ void setHeight(double _fheight) throw ( css::script::BasicErrorException );
-+
-+ double getWidth();
-+
-+ void setWidth(double _fWidth) throw ( css::script::BasicErrorException );
-+
-+ double getLeft();
-+
-+ void setLeft(double _fLeft);
-+
-+ double getTop();
-+
-+ void setTop(double _fTop);
-+};
-+
- class VBAHELPER_DLLPUBLIC ConcreteXShapeGeometryAttributes : public AbstractGeometryAttributes
- {
-+ std::auto_ptr< ShapeHelper > m_pShapeHelper;
- 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();
- virtual void setLeft( double nLeft );
-@@ -164,30 +189,6 @@ public:
- virtual void setWidth( double nWidth);
- };
-
--class VBAHELPER_DLLPUBLIC ShapeHelper
--{
--protected:
-- css::uno::Reference< css::drawing::XShape > xShape;
--public:
-- ShapeHelper( const css::uno::Reference< css::drawing::XShape >& _xShape) throw (css::script::BasicErrorException );
--
-- double getHeight();
--
-- void setHeight(double _fheight) throw ( css::script::BasicErrorException );
--
-- double getWidth();
--
-- void setWidth(double _fWidth) throw ( css::script::BasicErrorException );
--
-- double getLeft();
--
-- void setLeft(double _fLeft);
--
-- double getTop();
--
-- void setTop(double _fTop);
--};
--
- class VBAHELPER_DLLPUBLIC ContainerUtilities
- {
-
-diff --git vbahelper/source/vbahelper/vbahelper.cxx vbahelper/source/vbahelper/vbahelper.cxx
-index bc66be6..b95ccf1 100644
---- vbahelper/source/vbahelper/vbahelper.cxx
-+++ vbahelper/source/vbahelper/vbahelper.cxx
-@@ -818,8 +818,7 @@ double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double
-
- ConcreteXShapeGeometryAttributes::ConcreteXShapeGeometryAttributes( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape )
- {
--// #FIXME needs to be an instantiable service
--// m_xShape = new ScVbaShape( xContext, xShape );
-+ m_pShapeHelper.reset( new ShapeHelper( xShape ) );
- }
-
- static uno::Reference< frame::XController > lcl_getCurrentController()
-@@ -1002,36 +1001,36 @@ UserFormGeometryHelper::UserFormGeometryHelper( const uno::Reference< uno::XComp
-
- double ConcreteXShapeGeometryAttributes::getLeft()
- {
-- return m_xShape->getLeft();
-+ return m_pShapeHelper->getLeft();
- }
- void ConcreteXShapeGeometryAttributes::setLeft( double nLeft )
- {
-- m_xShape->setLeft( nLeft );
-+ m_pShapeHelper->setLeft( nLeft );
- }
- double ConcreteXShapeGeometryAttributes::getTop()
- {
-- return m_xShape->getTop();
-+ return m_pShapeHelper->getTop();
- }
- void ConcreteXShapeGeometryAttributes::setTop( double nTop )
- {
-- m_xShape->setTop( nTop );
-+ m_pShapeHelper->setTop( nTop );
- }
-
- double ConcreteXShapeGeometryAttributes::getHeight()
- {
-- return m_xShape->getHeight();
-+ return m_pShapeHelper->getHeight();
- }
- void ConcreteXShapeGeometryAttributes::setHeight( double nHeight )
- {
-- m_xShape->setHeight( nHeight );
-+ m_pShapeHelper->setHeight( nHeight );
- }
- double ConcreteXShapeGeometryAttributes::getWidth()
- {
-- return m_xShape->getWidth();
-+ return m_pShapeHelper->getWidth();
- }
- void ConcreteXShapeGeometryAttributes::setWidth( double nWidth)
- {
-- m_xShape->setHeight( nWidth );
-+ m_pShapeHelper->setWidth( nWidth );
- }
-
-
diff --git a/patches/vba/vba-fix-copysheet-toend.diff b/patches/vba/vba-fix-copysheet-toend.diff
deleted file mode 100644
index 667ce65c1..000000000
--- a/patches/vba/vba-fix-copysheet-toend.diff
+++ /dev/null
@@ -1,51 +0,0 @@
-diff --git sc/source/ui/docshell/docsh5.cxx sc/source/ui/docshell/docsh5.cxx
-index 3b5986c..fe54573 100644
---- sc/source/ui/docshell/docsh5.cxx
-+++ sc/source/ui/docshell/docsh5.cxx
-@@ -69,6 +69,7 @@
- #include "waitoff.hxx"
- #include "sizedev.hxx"
- #include <basic/sbstar.hxx>
-+#include <basic/basmgr.hxx>
-
- // defined in docfunc.cxx
- void lcl_InsertModule( ScDocShell& rDocSh, SCTAB nTab, String& sModuleName, String& sModuleSource );
-@@ -844,17 +845,27 @@ BOOL ScDocShell::MoveTable( SCTAB nSrcTab, SCTAB nDestTab, BOOL bCopy, BOOL bRec
- }
-
- StarBASIC* pStarBASIC = GetBasic();
-+ String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
-+ if ( GetBasicManager()->GetName().Len() > 0 )
-+ {
-+ aLibName = GetBasicManager()->GetName();
-+ pStarBASIC = GetBasicManager()->GetLib( aLibName );
-+ }
- BOOL bVbaEnabled = pStarBASIC ? pStarBASIC->isVBAEnabled() : FALSE;
-+ SCTAB nTabToUse = nDestTab;
-+
-+ if ( nDestTab == SC_TAB_APPEND )
-+ nTabToUse = aDocument.GetMaxTableNumber() - 1;
-+
- if ( bVbaEnabled )
- {
- String sCodeName;
- String sSource;
-- aDocument.GetCodeName( nDestTab, sCodeName );
-+ aDocument.GetCodeName( nTabToUse, sCodeName );
- com::sun::star::uno::Reference< com::sun::star::script::XLibraryContainer > xLibContainer = GetBasicContainer();
- com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > xLib;
- if( xLibContainer.is() )
- {
-- String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
- com::sun::star::uno::Any aLibAny = xLibContainer->getByName( aLibName );
- aLibAny >>= xLib;
- }
-@@ -867,7 +878,7 @@ BOOL ScDocShell::MoveTable( SCTAB nSrcTab, SCTAB nDestTab, BOOL bCopy, BOOL bRec
- xLib->getByName( sModName ) >>= sModuleInfo;
- sSource = sModuleInfo.ModuleSource;
- }
-- lcl_InsertModule( *this, nDestTab, sCodeName, sSource );
-+ lcl_InsertModule( *this, nTabToUse, sCodeName, sSource );
- }
- }
-
diff --git a/patches/vba/vba-fix-docmodule-import-crash.diff b/patches/vba/vba-fix-docmodule-import-crash.diff
deleted file mode 100644
index 51fed13bf..000000000
--- a/patches/vba/vba-fix-docmodule-import-crash.diff
+++ /dev/null
@@ -1,22 +0,0 @@
-diff --git svx/source/msfilter/svxmsbas.cxx svx/source/msfilter/svxmsbas.cxx
-index 3b2feb0..2826ed4 100644
---- svx/source/msfilter/svxmsbas.cxx
-+++ svx/source/msfilter/svxmsbas.cxx
-@@ -457,8 +457,15 @@ BOOL SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName,
- // get the api object for the codename
- if ( xVBACodeNamedObjectAccess.is() )
- {
-- sModuleInfo.ModuleObject.set( xVBACodeNamedObjectAccess->getByName( sModuleInfo.ModuleName ), uno::UNO_QUERY );
-- OSL_TRACE("** Straight up creation of Module");
-+ try
-+ {
-+ sModuleInfo.ModuleObject.set( xVBACodeNamedObjectAccess->getByName( sModuleInfo.ModuleName ), uno::UNO_QUERY );
-+ OSL_TRACE("** Straight up creation of Module");
-+ }
-+ catch(uno::Exception& e)
-+ {
-+ OSL_TRACE("Failed to get documument object for %s", rtl::OUStringToOString( sModuleInfo.ModuleName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ }
- }
- }
- aSourceAny <<= sModuleInfo;
diff --git a/patches/vba/vba-fix-find-wraparound-onfail.diff b/patches/vba/vba-fix-find-wraparound-onfail.diff
deleted file mode 100644
index 066ed12ae..000000000
--- a/patches/vba/vba-fix-find-wraparound-onfail.diff
+++ /dev/null
@@ -1,18 +0,0 @@
-diff --git sc/source/ui/vba/vbarange.cxx sc/source/ui/vba/vbarange.cxx
-index f327fed..735f913 100644
---- sc/source/ui/vba/vbarange.cxx
-+++ sc/source/ui/vba/vbarange.cxx
-@@ -2953,6 +2953,13 @@ ScVbaRange::Find( const uno::Any& What, const uno::Any& After, const uno::Any& L
- uno::Reference< util::XSearchDescriptor > xSearchDescriptor( xDescriptor, uno::UNO_QUERY );
- uno::Reference< uno::XInterface > xInterface = xStartCell.is() ? xSearch->findNext( xStartCell, xSearchDescriptor) : xSearch->findFirst( xSearchDescriptor );
- uno::Reference< table::XCellRange > xCellRange( xInterface, uno::UNO_QUERY );
-+ // if we are searching from a starting cell and failed to find a match
-+ // then try from the begining
-+ if ( !xCellRange.is() && xStartCell.is() )
-+ {
-+ xInterface = xSearch->findFirst( xSearchDescriptor );
-+ xCellRange.set( xInterface, uno::UNO_QUERY );
-+ }
- if ( xCellRange.is() )
- {
- uno::Reference< excel::XRange > xResultRange = new ScVbaRange( this, mxContext, xCellRange );
diff --git a/patches/vba/vba-fix-ide-friendly-modulename.diff b/patches/vba/vba-fix-ide-friendly-modulename.diff
deleted file mode 100644
index 56130c094..000000000
--- a/patches/vba/vba-fix-ide-friendly-modulename.diff
+++ /dev/null
@@ -1,41 +0,0 @@
-diff --git basctl/source/basicide/basides2.cxx basctl/source/basicide/basides2.cxx
-index 981de5b..f29b272 100644
---- basctl/source/basicide/basides2.cxx
-+++ basctl/source/basicide/basides2.cxx
-@@ -66,19 +66,25 @@ namespace css = ::com::sun::star;
-
- void lcl_getObjectName( const uno::Reference< container::XNameContainer >& rLib, const String& rModName, String& rObjName )
- {
-- uno::Any aElement( rLib->getByName( rModName ) );
-- script::ModuleInfo aModuleInfo;
-- if( aElement >>= aModuleInfo )
-- {
-- uno::Any aObject( aModuleInfo.ModuleObject );
-- uno::Reference< lang::XServiceInfo > xServiceInfo( aObject, uno::UNO_QUERY );
-- if( xServiceInfo.is() && xServiceInfo->supportsService( rtl::OUString::createFromAscii( "org.openoffice.excel.Worksheet" ) ) )
-+ try
-+ {
-+ uno::Any aElement( rLib->getByName( rModName ) );
-+ script::ModuleInfo aModuleInfo;
-+ if( aElement >>= aModuleInfo )
- {
-- uno::Reference< container::XNamed > xNamed( aObject, uno::UNO_QUERY );
-- if( xNamed.is() )
-- rObjName = xNamed->getName();
-+ uno::Any aObject( aModuleInfo.ModuleObject );
-+ uno::Reference< lang::XServiceInfo > xServiceInfo( aObject, uno::UNO_QUERY );
-+ if( xServiceInfo.is() && xServiceInfo->supportsService( rtl::OUString::createFromAscii( "ooo.vba.excel.Worksheet" ) ) )
-+ {
-+ uno::Reference< container::XNamed > xNamed( aObject, uno::UNO_QUERY );
-+ if( xNamed.is() )
-+ rObjName = xNamed->getName();
-+ }
- }
-- }
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
- }
-
- IMPL_LINK_INLINE_START( BasicIDEShell, ObjectDialogCancelHdl, ObjectCatalog *, EMPTYARG )
diff --git a/patches/vba/vba-fix-implicit-indexaccess.diff b/patches/vba/vba-fix-implicit-indexaccess.diff
deleted file mode 100644
index de4aebec5..000000000
--- a/patches/vba/vba-fix-implicit-indexaccess.diff
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git basic/source/runtime/step2.cxx basic/source/runtime/step2.cxx
-index 68bef06..d50d38b 100755
---- basic/source/runtime/step2.cxx
-+++ basic/source/runtime/step2.cxx
-@@ -489,7 +489,7 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
- pPar->Put( NULL, 0 );
- }
- // Index-Access bei UnoObjekten beruecksichtigen
-- else if( pElem->GetType() == SbxOBJECT && !pElem->ISA(SbxMethod) && !pElem->ISA(SbxProperty) )
-+ else if( pElem->GetType() == SbxOBJECT && !pElem->ISA(SbxMethod) && ( !bVBAEnabled || ( bVBAEnabled && !pElem->ISA(SbxProperty) ) ) )
- {
- pPar = pElem->GetParameters();
- if ( pPar )
diff --git a/patches/vba/vba-fix-interesection.diff b/patches/vba/vba-fix-interesection.diff
deleted file mode 100644
index ed67cf019..000000000
--- a/patches/vba/vba-fix-interesection.diff
+++ /dev/null
@@ -1,12 +0,0 @@
-diff --git sc/source/ui/vba/vbaapplication.cxx sc/source/ui/vba/vbaapplication.cxx
-index c0fdff3..95582db 100644
---- sc/source/ui/vba/vbaapplication.cxx
-+++ sc/source/ui/vba/vbaapplication.cxx
-@@ -1228,6 +1228,7 @@ RangesList lcl_intersections( RangesList& vRanges )
- #endif
-
- intersections.push_back( argIntersect );
-+ ++it;
- }
- return intersections;
- }
diff --git a/patches/vba/vba-fix-listboxhang-n560355.diff b/patches/vba/vba-fix-listboxhang-n560355.diff
deleted file mode 100644
index dd5261352..000000000
--- a/patches/vba/vba-fix-listboxhang-n560355.diff
+++ /dev/null
@@ -1,57 +0,0 @@
-From 4d146ed12801f3f3deb7e0cd5d3a627be256c7ee Mon Sep 17 00:00:00 2001
-From: Jan Holesovsky <kendy@suse.cz>
-Date: Fri, 14 May 2010 17:00:04 +0200
-Subject: [PATCH 393/878] vba-fix-listboxhang-n560355.diff
-
----
- toolkit/source/awt/vclxwindows.cxx | 17 -----------------
- 1 files changed, 0 insertions(+), 17 deletions(-)
-
-diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
-index 55e7041..7fb2f97 100644
---- a/toolkit/source/awt/vclxwindows.cxx
-+++ b/toolkit/source/awt/vclxwindows.cxx
-@@ -1179,16 +1179,6 @@ void VCLXRadioButton::setProperty( const ::rtl::OUString& PropertyName, const ::
- pButton->Check( b );
- else
- pButton->SetState( b );
-- // If VBA - need to be able to test
-- // simulate click event
-- if ( maActionListeners.getLength() )
-- {
-- ::com::sun::star::awt::ActionEvent aEvent;
-- aEvent.Source = (::cppu::OWeakObject*)this;
-- aEvent.ActionCommand = maActionCommand;
-- maActionListeners.actionPerformed( aEvent );
-- }
--
- }
- }
- break;
-@@ -1951,11 +1941,8 @@ void VCLXListBox::setProperty( const ::rtl::OUString& PropertyName, const ::com:
- ::com::sun::star::uno::Sequence< ::rtl::OUString> aItems;
- if ( Value >>= aItems )
- {
-- sal_Int16 nElem = pListBox->GetEntryCount();
- pListBox->Clear();
- addItems( aItems, 0 );
-- if ( aItems.getLength() == 0 && nElem && maItemListeners.getLength() )
-- ImplCallItemListeners();
- }
- }
- break;
-@@ -1968,11 +1955,7 @@ void VCLXListBox::setProperty( const ::rtl::OUString& PropertyName, const ::com:
- pListBox->SelectEntryPos( --n, sal_False );
-
- if ( aItems.getLength() )
-- {
- selectItemsPos( aItems, sal_True );
-- if ( maItemListeners.getLength() )
-- ImplCallItemListeners();
-- }
- else
- pListBox->SetNoSelection();
-
---
-1.7.0.1
-
diff --git a/patches/vba/vba-fix-logical-precedence-order.diff b/patches/vba/vba-fix-logical-precedence-order.diff
deleted file mode 100644
index f486a0d69..000000000
--- a/patches/vba/vba-fix-logical-precedence-order.diff
+++ /dev/null
@@ -1,161 +0,0 @@
-diff --git basic/source/comp/exprtree.cxx basic/source/comp/exprtree.cxx
-index e7025f7..dc3ec80 100644
---- basic/source/comp/exprtree.cxx
-+++ basic/source/comp/exprtree.cxx
-@@ -582,13 +582,19 @@ SbiExprNode* SbiExpression::Unary()
- {
- case MINUS:
- eTok = NEG;
-- case NOT:
- pParser->Next();
-- // process something like "Do While Not "foo"="" "
-+ pNd = new SbiExprNode( pParser, Unary(), eTok, NULL );
-+ break;
-+ case NOT:
- if( pParser->IsVBASupportOn() )
-- pNd = new SbiExprNode( pParser, Like(), eTok, NULL );
-- else
-+ {
-+ pNd = Operand();
-+ }
-+ else
-+ {
-+ pParser->Next();
- pNd = new SbiExprNode( pParser, Unary(), eTok, NULL );
-+ }
- break;
- case PLUS:
- pParser->Next();
-@@ -733,9 +739,114 @@ SbiExprNode* SbiExpression::Comp()
- return pNd;
- }
-
-+
-+SbiExprNode* SbiExpression::VBA_Not()
-+{
-+ SbiExprNode* pNd = NULL;
-+
-+ SbiToken eTok = pParser->Peek();
-+ if( eTok == NOT )
-+ {
-+ pParser->Next();
-+ pNd = new SbiExprNode( pParser, VBA_Not(), eTok, NULL );
-+ }
-+ else
-+ {
-+ pNd = Comp();
-+ }
-+ return pNd;
-+}
-+
-+SbiExprNode* SbiExpression::VBA_And()
-+{
-+ SbiExprNode* pNd = VBA_Not();
-+ if( m_eMode != EXPRMODE_EMPTY_PAREN )
-+ {
-+ for( ;; )
-+ {
-+ SbiToken eTok = pParser->Peek();
-+ if( eTok != AND )
-+ break;
-+ eTok = pParser->Next();
-+ pNd = new SbiExprNode( pParser, pNd, eTok, VBA_Not() );
-+ }
-+ }
-+ return pNd;
-+}
-+
-+SbiExprNode* SbiExpression::VBA_Or()
-+{
-+ SbiExprNode* pNd = VBA_And();
-+ if( m_eMode != EXPRMODE_EMPTY_PAREN )
-+ {
-+ for( ;; )
-+ {
-+ SbiToken eTok = pParser->Peek();
-+ if( eTok != OR )
-+ break;
-+ eTok = pParser->Next();
-+ pNd = new SbiExprNode( pParser, pNd, eTok, VBA_And() );
-+ }
-+ }
-+ return pNd;
-+}
-+
-+SbiExprNode* SbiExpression::VBA_Xor()
-+{
-+ SbiExprNode* pNd = VBA_Or();
-+ if( m_eMode != EXPRMODE_EMPTY_PAREN )
-+ {
-+ for( ;; )
-+ {
-+ SbiToken eTok = pParser->Peek();
-+ if( eTok != XOR )
-+ break;
-+ eTok = pParser->Next();
-+ pNd = new SbiExprNode( pParser, pNd, eTok, VBA_Or() );
-+ }
-+ }
-+ return pNd;
-+
-+}
-+
-+SbiExprNode* SbiExpression::VBA_Eqv()
-+{
-+ SbiExprNode* pNd = VBA_Xor();
-+ if( m_eMode != EXPRMODE_EMPTY_PAREN )
-+ {
-+ for( ;; )
-+ {
-+ SbiToken eTok = pParser->Peek();
-+ if( eTok != EQV )
-+ break;
-+ eTok = pParser->Next();
-+ pNd = new SbiExprNode( pParser, pNd, eTok, VBA_Xor() );
-+ }
-+ }
-+ return pNd;
-+}
-+
-+SbiExprNode* SbiExpression::VBA_Imp()
-+{
-+ SbiExprNode* pNd = VBA_Eqv();
-+ if( m_eMode != EXPRMODE_EMPTY_PAREN )
-+ {
-+ for( ;; )
-+ {
-+ SbiToken eTok = pParser->Peek();
-+ if( eTok != IMP )
-+ break;
-+ eTok = pParser->Next();
-+ pNd = new SbiExprNode( pParser, pNd, eTok, VBA_Eqv() );
-+ }
-+ }
-+ return pNd;
-+
-+}
-+
- SbiExprNode* SbiExpression::Like()
- {
-- SbiExprNode* pNd = Comp();
-+ SbiExprNode* pNd = pParser->IsVBASupportOn() ? VBA_Imp() : Comp();
- if( m_eMode != EXPRMODE_EMPTY_PAREN )
- {
- short nCount = 0;
-diff --git basic/source/inc/expr.hxx basic/source/inc/expr.hxx
-index 96604cb..d76dc14 100644
---- basic/source/inc/expr.hxx
-+++ basic/source/inc/expr.hxx
-@@ -188,6 +188,12 @@ protected:
- SbiExprNode* AddSub();
- SbiExprNode* Cat();
- SbiExprNode* Like();
-+ SbiExprNode* VBA_Not();
-+ SbiExprNode* VBA_And();
-+ SbiExprNode* VBA_Or();
-+ SbiExprNode* VBA_Xor();
-+ SbiExprNode* VBA_Eqv();
-+ SbiExprNode* VBA_Imp();
- SbiExprNode* Comp();
- SbiExprNode* Boolean();
- public:
diff --git a/patches/vba/vba-fix-macromode-api-docopen.diff b/patches/vba/vba-fix-macromode-api-docopen.diff
deleted file mode 100644
index 9151745a7..000000000
--- a/patches/vba/vba-fix-macromode-api-docopen.diff
+++ /dev/null
@@ -1,27 +0,0 @@
-diff --git vbahelper/source/vbahelper/vbadocumentsbase.cxx vbahelper/source/vbahelper/vbadocumentsbase.cxx
-index 813e084..6d5ddb3 100644
---- vbahelper/source/vbahelper/vbadocumentsbase.cxx
-+++ vbahelper/source/vbahelper/vbadocumentsbase.cxx
-@@ -45,6 +45,7 @@
- #include <com/sun/star/util/XCloseable.hpp>
- #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
- #include <com/sun/star/document/XTypeDetection.hpp>
-+#include <com/sun/star/document/MacroExecMode.hpp>
- #include <com/sun/star/uri/XUriReference.hpp>
- #include <com/sun/star/uri/XUriReferenceFactory.hpp>
- #include <com/sun/star/lang/XServiceInfo.hpp>
-@@ -271,8 +272,13 @@ VbaDocumentsBase::Open( const rtl::OUString& rFileName, const uno::Any& ReadOnly
- ::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"),
- mxContext),
- uno::UNO_QUERY_THROW );
-+
- uno::Sequence< beans::PropertyValue > sProps( rProps );
-- sal_Int32 nIndex = 0;
-+ sProps.realloc( sProps.getLength() + 1 );
-+ sProps[ sProps.getLength() - 1 ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("MacroExecutionMode") );
-+ sProps[ sProps.getLength() - 1 ].Value <<= uno::makeAny( document::MacroExecMode::ALWAYS_EXECUTE_NO_WARN );
-+
-+ sal_Int32 nIndex = sProps.getLength() - 1;
-
- if ( ReadOnly.hasValue() )
- {
diff --git a/patches/vba/vba-fix-missing-codename.diff b/patches/vba/vba-fix-missing-codename.diff
deleted file mode 100644
index 811100870..000000000
--- a/patches/vba/vba-fix-missing-codename.diff
+++ /dev/null
@@ -1,424 +0,0 @@
-diff --git sc/source/filter/excel/excimp8.cxx sc/source/filter/excel/excimp8.cxx
-index 4d1db8b..d4953f8 100644
---- sc/source/filter/excel/excimp8.cxx
-+++ sc/source/filter/excel/excimp8.cxx
-@@ -249,7 +249,7 @@ void ImportExcel8::Codename( BOOL bWorkbookGlobals )
- else
- {
- GetExtDocOptions().AppendCodeName( aName );
-- GetDoc().SetCodeName( mnTab++, aName );
-+ GetDoc().SetCodeName( GetCurrScTab(), aName );
- }
- }
- }
-@@ -280,7 +280,7 @@ void ImportExcel8::ReadBasic( void )
- pShell->GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
- SvxImportMSVBasic aBasicImport( *pShell, *xRootStrg, bLoadCode, bLoadStrg );
- bool bAsComment = !bLoadExecutable || !aGlobs.hasValue();
-- aBasicImport.Import( EXC_STORAGE_VBA_PROJECT, EXC_STORAGE_VBA, bAsComment );
-+ aBasicImport.Import( EXC_STORAGE_VBA_PROJECT, EXC_STORAGE_VBA, AutoGeneratedCodeNames, bAsComment );
- if ( !bAsComment )
- {
- GetObjectManager().SetOleNameOverrideInfo( aBasicImport.ControlNameForObjectId() );
-diff --git sc/source/filter/excel/read.cxx sc/source/filter/excel/read.cxx
-index aa2b377..3ceabf1 100644
---- sc/source/filter/excel/read.cxx
-+++ sc/source/filter/excel/read.cxx
-@@ -809,6 +809,12 @@ FltError ImportExcel8::Read( void )
- ::std::auto_ptr< ScfSimpleProgressBar > pProgress( new ScfSimpleProgressBar(
- aIn.GetSvStreamSize(), GetDocShell(), STR_LOAD_DOC ) );
-
-+ bool bSheetHasCodeName = false;
-+
-+ std::vector< String > CodeNames;
-+
-+ std::vector < SCTAB > nTabsWithNoCodeName;
-+
- while( eAkt != EXC_STATE_END )
- {
- aIn.StartNextRecord();
-@@ -876,6 +882,7 @@ FltError ImportExcel8::Read( void )
- // #i62752# possible to have BIFF8 sheet without globals
- NeueTabelle();
- eAkt = EXC_STATE_SHEET_PRE; // Shrfmla Prefetch, Row-Prefetch
-+ bSheetHasCodeName = false; // reset
- aIn.StoreGlobalPosition();
- }
- }
-@@ -1047,9 +1054,30 @@ FltError ImportExcel8::Read( void )
- case EXC_ID3_DIMENSIONS: ReadDimensions(); break;
-
- case 0x0A: // EOF [ 2345 ]
-+ {
- eAkt = EXC_STATE_SHEET;
-+ String sName;
-+ GetDoc().GetName( GetCurrScTab(), sName );
-+ if ( !bSheetHasCodeName )
-+ {
-+ nTabsWithNoCodeName.push_back( GetCurrScTab() );
-+ OSL_TRACE("No Codename for %d", GetCurrScTab() );
-+ }
-+ else
-+ {
-+ String sCodeName;
-+ GetDoc().GetCodeName( GetCurrScTab(), sCodeName );
-+ OSL_TRACE("Have CodeName %s for SheetName %s",
-+ rtl::OUStringToOString( sCodeName, RTL_TEXTENCODING_UTF8 ).getStr(), rtl::OUStringToOString( sName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ CodeNames.push_back( sCodeName );
-+ }
-+
-+ bSheetHasCodeName = false; // reset
-+
-+
- aIn.SeekGlobalPosition(); // und zurueck an alte Position
- break;
-+ }
- case 0x12: SheetProtect(); break;
- case 0x13: SheetPassword(); break;
- case 0x42: Codepage(); break; // CODEPAGE [ 2345 ]
-@@ -1061,7 +1089,7 @@ FltError ImportExcel8::Read( void )
- case 0x9B: FilterMode(); break; // FILTERMODE
- case 0x9D: AutoFilterInfo(); break;// AUTOFILTERINFO
- case 0x9E: AutoFilter(); break; // AUTOFILTER
-- case 0x01BA: Codename( FALSE ); break;
-+ case 0x01BA: Codename( FALSE ); bSheetHasCodeName = true; break;
- case 0x0208: Row34(); break; // ROW [ 34 ]
- case 0x0021:
- case 0x0221: Array34(); break; // ARRAY [ 34 ]
-@@ -1171,6 +1199,42 @@ FltError ImportExcel8::Read( void )
-
- if( eLastErr == eERR_OK )
- {
-+ // In some strange circumstances a the codename might be missing
-+ // # Create any missing Sheet CodeNames
-+ std::vector < SCTAB >::iterator it_end = nTabsWithNoCodeName.end();
-+ for ( std::vector < SCTAB >::iterator it = nTabsWithNoCodeName.begin(); it != it_end; ++it )
-+ {
-+ bool bGotCodeName = false;
-+ SCTAB nTab = 1;
-+ OSL_TRACE("Trying to find suitable codename for %d", *it );
-+ while ( true )
-+ {
-+ String sTmpName( RTL_CONSTASCII_USTRINGPARAM("Sheet" ) );
-+ sTmpName += String::CreateFromInt32( sal_Int32(nTab++) );
-+ std::vector< String >::iterator codeName_It = CodeNames.begin();
-+ std::vector< String >::iterator codeName_It_end = CodeNames.end();
-+ // search for codename
-+ for ( ; codeName_It != codeName_It_end; ++codeName_It )
-+ {
-+ if ( *codeName_It == sTmpName )
-+ break;
-+ }
-+
-+ if ( codeName_It == codeName_It_end ) // generated codename not found
-+ {
-+ OSL_TRACE("Using generated codename %s", rtl::OUStringToOString( sTmpName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ // Set new codename
-+ GetDoc().SetCodeName( *it, sTmpName );
-+ // Record newly used codename
-+ CodeNames.push_back( sTmpName );
-+ // Record those we have created so they can be created in
-+ // basic
-+ AutoGeneratedCodeNames.push_back( sTmpName );
-+ break;
-+ }
-+ }
-+
-+ }
- // #i45843# Convert pivot tables before calculation, so they are available
- // for the GETPIVOTDATA function.
- if( GetBiff() == EXC_BIFF8 )
-diff --git sc/source/filter/inc/excimp8.hxx sc/source/filter/inc/excimp8.hxx
-index f35faef..226ec6b 100644
---- sc/source/filter/inc/excimp8.hxx
-+++ sc/source/filter/inc/excimp8.hxx
-@@ -54,6 +54,9 @@ class ImportExcel8 : public ImportExcel
- {
- SCTAB mnTab;
- protected:
-+ // represents codename ( and associated modules )
-+ // not speficied directly in the binary format
-+ std::vector< String > AutoGeneratedCodeNames;
- ExcScenarioList aScenList;
-
- BOOL bHasBasic;
-diff --git svx/inc/svxmsbas.hxx svx/inc/svxmsbas.hxx
-index fab5faf..f1a4c44 100644
---- svx/inc/svxmsbas.hxx
-+++ svx/inc/svxmsbas.hxx
-@@ -76,8 +76,10 @@ public:
- // 0 - nothing has done
- // bit 0 = 1 -> any code is imported to the SO-Basic
- // bit 1 = 1 -> the VBA - storage is copy to the ObjectShell storage
-- int Import( const String& rStorageName, const String &rSubStorageName,
-+ int Import( const String& rStorageName, const String &rSubStorageName,
- BOOL bAsComment=TRUE, BOOL bStripped=TRUE );
-+ int Import( const String& rStorageName, const String &rSubStorageName,
-+ const std::vector< String >& codeNames, BOOL bAsComment=TRUE, BOOL bStripped=TRUE );
-
- // only for the export - copy or delete the saved VBA-macro-storage
- // form the ObjectShell
-@@ -98,15 +100,16 @@ private:
- BOOL bImport;
- BOOL bCopy;
-
-- SVX_DLLPRIVATE BOOL ImportCode_Impl( const String& rStorageName,
-- const String &rSubStorageName,
-- BOOL bAsComment, BOOL bStripped );
-+ SVX_DLLPRIVATE BOOL ImportCode_Impl( const String& rStorageName,
-+ const String &rSubStorageName,
-+ const std::vector< String >&,
-+ BOOL bAsComment, BOOL bStripped );
- SVX_DLLPRIVATE bool ImportForms_Impl(const String& rStorageName,
- const String &rSubStorageName, BOOL bVBAMode );
- SVX_DLLPRIVATE BOOL CopyStorage_Impl( const String& rStorageName,
- const String &rSubStorageName);
- rtl::OUString msProjectName;
-- SVX_DLLPRIVATE BOOL ImportCode_Impl( VBA_Impl&, BOOL, BOOL );
-+ SVX_DLLPRIVATE BOOL ImportCode_Impl( VBA_Impl&, const std::vector< String >&, BOOL, BOOL );
- SVX_DLLPRIVATE bool ImportForms_Impl( VBA_Impl&, const String&, const String&, BOOL);
- };
-
-diff --git svx/source/msfilter/svxmsbas.cxx svx/source/msfilter/svxmsbas.cxx
-index d4d6838..0ebc074 100644
---- svx/source/msfilter/svxmsbas.cxx
-+++ svx/source/msfilter/svxmsbas.cxx
-@@ -62,6 +62,8 @@ using namespace com::sun::star;
-
- using rtl::OUString;
-
-+static ::rtl::OUString sVBAOption( RTL_CONSTASCII_USTRINGPARAM( "Option VBASupport 1\n" ) );
-+
- void SvxImportMSVBasic::extractAttribute( const String& rAttribute, const String& rModName )
- {
- // format of the attribute we are interested in is
-@@ -83,9 +85,17 @@ int SvxImportMSVBasic::Import( const String& rStorageName,
- const String &rSubStorageName,
- BOOL bAsComment, BOOL bStripped )
- {
-+ std::vector< String > codeNames;
-+ return Import( rStorageName, rSubStorageName, codeNames, bAsComment, bStripped );
-+}
-+int SvxImportMSVBasic::Import( const String& rStorageName,
-+ const String &rSubStorageName,
-+ const std::vector< String >& codeNames,
-+ BOOL bAsComment, BOOL bStripped )
-+{
- msProjectName = rtl::OUString();
- int nRet = 0;
-- if( bImport && ImportCode_Impl( rStorageName, rSubStorageName,
-+ if( bImport && ImportCode_Impl( rStorageName, rSubStorageName, codeNames,
- bAsComment, bStripped ))
- nRet |= 1;
-
-@@ -296,6 +306,7 @@ BOOL SvxImportMSVBasic::CopyStorage_Impl( const String& rStorageName,
-
- BOOL SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName,
- const String &rSubStorageName,
-+ const std::vector< String >& codeNames,
- BOOL bAsComment, BOOL bStripped )
- {
- BOOL bRet = FALSE;
-@@ -308,31 +319,24 @@ BOOL SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName,
- if ( msProjectName.getLength() )
- rDocSh.GetBasicManager()->SetName( msProjectName ); // set name of Project
-
-- bRet = ImportCode_Impl( aVBA, bAsComment, bStripped );
-+ bRet = ImportCode_Impl( aVBA, codeNames, bAsComment, bStripped );
- std::vector<rtl::OUString> sProjectRefs = aVBA.ProjectReferences();
-
- for ( std::vector<rtl::OUString>::iterator it = sProjectRefs.begin(); it != sProjectRefs.end(); ++it )
- {
- rtl::OUString sFileName = *it;
--#ifndef WIN
--#ifdef DEBUG
-- // hacky test code to read referenced projects on linux
-- sal_Int32 nPos = (*it).lastIndexOf('\\');
-- sFileName = (*it).copy( nPos + 1 );
-- sFileName = rtl::OUString::createFromAscii("~/Documents/") + sFileName;
--#endif
--#endif
- OSL_TRACE("referenced project %s ", rtl::OUStringToOString( sFileName, RTL_TEXTENCODING_UTF8 ).getStr() );
- SotStorageRef rRoot = new SotStorage( sFileName, STREAM_STD_READWRITE, STORAGE_TRANSACTED );
- VBA_Impl refVBA( *rRoot, bAsComment );
-- if( refVBA.Open(rStorageName,rSubStorageName) && ImportCode_Impl( refVBA, bAsComment, bStripped ) )
-+ std::vector< String > codeNamesNone;
-+ if( refVBA.Open(rStorageName,rSubStorageName) && ImportCode_Impl( refVBA, codeNamesNone, bAsComment, bStripped ) )
- bRet = TRUE; // mark that some code was imported
- }
- }
- return bRet;
- }
-
--BOOL SvxImportMSVBasic::ImportCode_Impl( VBA_Impl& aVBA, BOOL bAsComment, BOOL bStripped )
-+BOOL SvxImportMSVBasic::ImportCode_Impl( VBA_Impl& aVBA, const std::vector< String >& codeNames, BOOL bAsComment, BOOL bStripped )
- {
- BOOL bRet = FALSE;
- SFX_APP()->EnterBasicCall();
-@@ -357,7 +361,7 @@ BOOL SvxImportMSVBasic::ImportCode_Impl( VBA_Impl& aVBA, BOOL bAsComment, BOOL b
- }
- if( xLib.is() )
- {
-- Reference< container::XNameAccess > xVBAObjectForCodeName;
-+ Reference< container::XNameAccess > xVBACodeNamedObjectAccess;
- if ( !bAsComment )
- {
- rDocSh.GetBasicManager()->GetLib( aLibName )->SetVBAEnabled( true );
-@@ -366,11 +370,16 @@ BOOL SvxImportMSVBasic::ImportCode_Impl( VBA_Impl& aVBA, BOOL bAsComment, BOOL b
- {
- try
- {
-- xVBAObjectForCodeName.set( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAObjectModuleObjectProvider"))), UNO_QUERY );
-+ xVBACodeNamedObjectAccess.set( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAObjectModuleObjectProvider"))), UNO_QUERY );
- }
- catch( Exception& ) { }
- }
- }
-+ typedef std::hash_map< rtl::OUString, uno::Any, ::rtl::OUStringHash,
-+::std::equal_to< ::rtl::OUString > > NameModuleDataHash;
-+
-+ NameModuleDataHash moduleData;
-+
- for( UINT16 i=0; i<nStreamCount;i++)
- {
- StringArray aDecompressed = aVBA.Decompress(i);
-@@ -436,7 +445,6 @@ BOOL SvxImportMSVBasic::ImportCode_Impl( VBA_Impl& aVBA, BOOL bAsComment, BOOL b
- DBG_ERRORFILE( "SvxImportMSVBasic::ImportCode_Impl - unknown module type" );
- break;
- }
-- static ::rtl::OUString sVBAOption( RTL_CONSTASCII_USTRINGPARAM( "Option VBASupport 1\n" ) );
- static ::rtl::OUString sClassOption( RTL_CONSTASCII_USTRINGPARAM( "Option ClassModule\n" ) );
- if ( !bAsComment /*&& !rDocSh.GetBasic()->isVBAEnabled() */)
- {
-@@ -508,60 +516,79 @@ BOOL SvxImportMSVBasic::ImportCode_Impl( VBA_Impl& aVBA, BOOL bAsComment, BOOL b
- aSource += rtl::OUString::createFromAscii("\nEnd Sub");
- }
- ::rtl::OUString aModName( sModule );
-- {
-- aSource = modeTypeComment + aSource;
-+ aSource = modeTypeComment + aSource;
-
-- Any aSourceAny;
-- OSL_TRACE("erm %d", mType );
-- if ( !bAsComment )
-- {
-- OSL_TRACE("vba processing %d", mType );
-- script::ModuleInfo sModuleInfo;
-- sModuleInfo.ModuleName = aModName;
-- sModuleInfo.ModuleSource = aSource;
-- sModuleInfo.ModuleType = mType;
-- if ( mType == ModuleType::Form )
-- // hack, the module ( imo document basic should...
-- // know the XModel... ) but it doesn't
-- sModuleInfo.ModuleObject.set( rDocSh.GetModel(), UNO_QUERY );
-- // document modules, we should be able to access
-- // the api objects at this time
-- else if ( mType == ModuleType::Document )
-- {
-- uno::Reference< lang::XMultiServiceFactory> xSF( rDocSh.GetModel(), uno::UNO_QUERY);
-- uno::Reference< container::XNameAccess > xVBACodeNamedObjectAccess;
-- if ( xSF.is() )
-- xVBACodeNamedObjectAccess.set( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAObjectModuleObjectProvider"))), uno::UNO_QUERY );
-- // get the api object for the codename
-- if ( xVBACodeNamedObjectAccess.is() )
-- {
-- try
-- {
-- sModuleInfo.ModuleObject.set( xVBACodeNamedObjectAccess->getByName( sModuleInfo.ModuleName ), uno::UNO_QUERY );
-- OSL_TRACE("** Straight up creation of Module");
-- }
-- catch(uno::Exception& e)
-- {
-- OSL_TRACE("Failed to get documument object for %s", rtl::OUStringToOString( sModuleInfo.ModuleName, RTL_TEXTENCODING_UTF8 ).getStr() );
-- }
-- }
-- }
-- aSourceAny <<= sModuleInfo;
-- }
-- else
-- aSourceAny <<= aSource;
-- if( xLib->hasByName( aModName ) )
-- xLib->replaceByName( aModName, aSourceAny );
-- else
-- xLib->insertByName( aModName, aSourceAny );
-- }
--
-- bRet = true;
-- }
-- }
-+ Any aSourceAny;
-+ OSL_TRACE("erm %d", mType );
-+ if ( !bAsComment )
-+ {
-+ OSL_TRACE("vba processing %d", mType );
-+ script::ModuleInfo sModuleInfo;
-+ sModuleInfo.ModuleName = aModName;
-+ sModuleInfo.ModuleSource = aSource;
-+ sModuleInfo.ModuleType = mType;
-+ aSourceAny <<= sModuleInfo;
-+ }
-+ else
-+ aSourceAny <<= aSource;
-+ moduleData[ aModName ] = aSourceAny;
-+ }
-+
-+ // Hack for missing codenames ( only know to happen in excel but... )
-+ // only makes sense to do this if we are importing non-commented basic
-+ if ( !bAsComment )
-+ {
-+ for ( std::vector< String >::const_iterator it = codeNames.begin(); it != codeNames.end(); ++it )
-+ {
-+ script::ModuleInfo sModuleInfo;
-+ sModuleInfo.ModuleName = *it;
-+ sModuleInfo.ModuleType = ModuleType::Document ;
-+ sModuleInfo.ModuleSource = sVBAOption;
-+ moduleData[ *it ] = uno::makeAny( sModuleInfo );
-+ }
-+ }
-+ NameModuleDataHash::iterator it_end = moduleData.end();
-+ for ( NameModuleDataHash::iterator it = moduleData.begin(); it != it_end; ++it )
-+ {
-+ script::ModuleInfo sModuleInfo;
-+ if ( it->second >>=sModuleInfo )
-+ {
-+
-+ if ( sModuleInfo.ModuleType == ModuleType::Form )
-+ // hack, the module ( imo document basic should...
-+ // know the XModel... ) but it doesn't
-+ sModuleInfo.ModuleObject.set( rDocSh.GetModel(), UNO_QUERY );
-+ // document modules, we should be able to access
-+ // the api objects at this time
-+ else if ( sModuleInfo.ModuleType == ModuleType::Document )
-+ {
-+ if ( xVBACodeNamedObjectAccess.is() )
-+ {
-+ try
-+ {
-+ sModuleInfo.ModuleObject.set( xVBACodeNamedObjectAccess->getByName( sModuleInfo.ModuleName ), uno::UNO_QUERY );
-+ OSL_TRACE("** Straight up creation of Module");
-+ }
-+ catch(uno::Exception& e)
-+ {
-+ OSL_TRACE("Failed to get documument object for %s", rtl::OUStringToOString( sModuleInfo.ModuleName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ }
-+ }
-+ }
-+ it->second = uno::makeAny( sModuleInfo );
-+ }
-+
-+ if( xLib->hasByName( it->first ) )
-+ xLib->replaceByName( it->first, it->second );
-+ else
-+ xLib->insertByName( it->first, it->second );
-+ bRet = true;
-+ }
-+
-+ }
- if( bRet )
-- SFX_APP()->LeaveBasicCall();
-- return bRet;
-+ SFX_APP()->LeaveBasicCall();
-+ return bRet;
- }
-
- /* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/patches/vba/vba-fix-named-any-para-pass.diff b/patches/vba/vba-fix-named-any-para-pass.diff
deleted file mode 100644
index e618cc2a2..000000000
--- a/patches/vba/vba-fix-named-any-para-pass.diff
+++ /dev/null
@@ -1,20 +0,0 @@
-diff --git basic/source/runtime/step1.cxx basic/source/runtime/step1.cxx
-index 7997feb..1b28f61 100644
---- basic/source/runtime/step1.cxx
-+++ basic/source/runtime/step1.cxx
-@@ -94,6 +94,15 @@ void SbiRuntime::StepARGN( UINT32 nOp1 )
- {
- String aAlias( pImg->GetString( static_cast<short>( nOp1 ) ) );
- SbxVariableRef pVal = PopVar();
-+ if( bVBAEnabled && ( pVal->ISA(SbxMethod) || pVal->ISA(SbUnoProperty) || pVal->ISA(SbProcedureProperty) ) )
-+ {
-+ // named variables ( that are Any especially properties ) can be empty at this point and need a broadcast
-+ if ( pVal->GetType() == SbxEMPTY )
-+ pVal->Broadcast( SBX_HINT_DATAWANTED );
-+ // Methoden und Properties evaluieren!
-+ SbxVariable* pRes = new SbxVariable( *pVal );
-+ pVal = pRes;
-+ }
- refArgv->Put( pVal, nArgc );
- refArgv->PutAlias( aAlias, nArgc++ );
- }
diff --git a/patches/vba/vba-fix-optionalparam-assigment.diff b/patches/vba/vba-fix-optionalparam-assigment.diff
deleted file mode 100644
index 8e4e56320..000000000
--- a/patches/vba/vba-fix-optionalparam-assigment.diff
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git basic/source/runtime/step2.cxx basic/source/runtime/step2.cxx
-index 644ecdb..5606274 100644
---- basic/source/runtime/step2.cxx
-+++ basic/source/runtime/step2.cxx
-@@ -723,6 +723,8 @@ void SbiRuntime::StepPARAM( UINT32 nOp1, UINT32 nOp2 )
- SaveRef( q );
- *q = *p;
- p = q;
-+ if ( i )
-+ refParams->Put( p, i );
- }
- SetupArgs( p, nOp1 );
- PushVar( CheckArray( p ) );
diff --git a/patches/vba/vba-fix-override-exportproblem.diff b/patches/vba/vba-fix-override-exportproblem.diff
deleted file mode 100644
index 46677752f..000000000
--- a/patches/vba/vba-fix-override-exportproblem.diff
+++ /dev/null
@@ -1,71 +0,0 @@
-diff --git sc/source/filter/excel/xiescher.cxx sc/source/filter/excel/xiescher.cxx
-index 5eb246e..7a36a07 100644
---- sc/source/filter/excel/xiescher.cxx
-+++ sc/source/filter/excel/xiescher.cxx
-@@ -401,16 +401,11 @@ void XclImpDrawObjBase::SetAnchor( const XclObjAnchor& rAnchor )
-
- String XclImpDrawObjBase::GetObjName() const
- {
-- String sName( GetObjectManager().GetOleNameOverride( GetObjId() ) );
--
--
- /* #118053# #i51348# Always return a non-empty name. Create English
- default names depending on the object type. This is not implemented as
- virtual functions in derived classes, as class type and object type may
- not match. */
-- if ( sName.Len() == 0 )
-- sName = ( (maObjName.Len() > 0) ? maObjName : GetObjectManager().GetDefaultObjName( *this ) );
-- return sName;
-+ return (maObjName.Len() > 0) ? maObjName : GetObjectManager().GetDefaultObjName( *this );
- }
-
- bool XclImpDrawObjBase::IsValidSize( const Rectangle& rAnchorRect ) const
-@@ -2788,6 +2783,17 @@ SdrObject* XclImpPictureObj::DoCreateSdrObj( const Rectangle& rAnchorRect, ScfPr
- return xSdrObj.release();
- }
-
-+String XclImpPictureObj::GetObjName() const
-+{
-+ if( IsOcxControl() )
-+ {
-+ String sName( GetObjectManager().GetOleNameOverride( GetObjId() ) );
-+ if ( sName.Len() > 0 )
-+ return sName;
-+ }
-+ return XclImpDrawObjBase::GetObjName();
-+}
-+
- void XclImpPictureObj::DoProcessSdrObj( SdrObject& rSdrObj ) const
- {
- if( IsOcxControl() )
-diff --git sc/source/filter/inc/xiescher.hxx sc/source/filter/inc/xiescher.hxx
-index a673a5e..a9eca6e 100644
---- sc/source/filter/inc/xiescher.hxx
-+++ sc/source/filter/inc/xiescher.hxx
-@@ -95,7 +95,7 @@ public:
- /** Returns the Excel object type from OBJ record. */
- inline sal_uInt16 GetObjType() const { return mnObjType; }
- /** Returns the name of this object, may generate a default name. */
-- String GetObjName() const;
-+ virtual String GetObjName() const;
- /** Returns associated macro name, if set, otherwise zero length string. */
- inline const String& GetMacroName() const { return maMacroName; }
-
-@@ -860,7 +860,8 @@ class XclImpPictureObj : public XclImpRectObj, public XclImpControlHelper
- {
- public:
- explicit XclImpPictureObj( const XclImpRoot& rRoot );
--
-+ /** Returns the ObjectName - can use non-obvious lookup for override in the associated vba document module stream**/
-+ virtual String GetObjName() const;
- /** Returns the graphic imported from the IMGDATA record. */
- inline const Graphic& GetGraphic() const { return maGraphic; }
- /** Returns the visible area of the imported graphic. */
-@@ -891,7 +892,6 @@ protected:
- virtual SdrObject* DoCreateSdrObj( const Rectangle& rAnchorRect, ScfProgressBar& rProgress ) const;
- /** Overloaded to do additional processing on the SdrObject. */
- virtual void DoProcessSdrObj( SdrObject& rSdrObj ) const;
--
- private:
- /** Reads and sets the picture flags from a BIFF3-BIFF5 OBJ picture record. */
- void ReadFlags3( XclImpStream& rStrm );
diff --git a/patches/vba/vba-fix-path-fullname.diff b/patches/vba/vba-fix-path-fullname.diff
deleted file mode 100644
index 25cea4f2a..000000000
--- a/patches/vba/vba-fix-path-fullname.diff
+++ /dev/null
@@ -1,32 +0,0 @@
-diff --git vbahelper/source/vbahelper/vbadocumentbase.cxx vbahelper/source/vbahelper/vbadocumentbase.cxx
-index e53279e..b8054cc 100644
---- vbahelper/source/vbahelper/vbadocumentbase.cxx
-+++ vbahelper/source/vbahelper/vbadocumentbase.cxx
-@@ -82,17 +82,22 @@ VbaDocumentBase::getName() throw (uno::RuntimeException)
- ::rtl::OUString
- VbaDocumentBase::getPath() throw (uno::RuntimeException)
- {
-- INetURLObject aURL( getModel()->getURL() );
-- aURL.CutLastName();
-- return aURL.GetURLPath();
-+ INetURLObject aURL( getModel()->getURL() );
-+ rtl::OUString sURL( aURL.GetMainURL( INetURLObject::DECODE_TO_IURI ) );
-+ sURL = sURL.copy( 0, sURL.getLength() - aURL.GetLastName().getLength() - 1 );
-+ rtl::OUString sPath;
-+ ::osl::File::getSystemPathFromFileURL( sURL, sPath );
-+ return sPath;
- }
-
- ::rtl::OUString
- VbaDocumentBase::getFullName() throw (uno::RuntimeException)
- {
-- INetURLObject aURL( getModel()->getURL() );
-- return aURL.GetURLPath();
-+ rtl::OUString sPath;
-+ ::osl::File::getSystemPathFromFileURL( getModel()->getURL(), sPath );
-+ return sPath;
- }
-+
- void
- VbaDocumentBase::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg,
- const uno::Any &rRouteArg ) throw (uno::RuntimeException)
diff --git a/patches/vba/vba-fix-private-declare.diff b/patches/vba/vba-fix-private-declare.diff
deleted file mode 100644
index de25dd76a..000000000
--- a/patches/vba/vba-fix-private-declare.diff
+++ /dev/null
@@ -1,60 +0,0 @@
-diff --git basic/source/comp/dim.cxx basic/source/comp/dim.cxx
-index 01c23e8..3e46579 100644
---- basic/source/comp/dim.cxx
-+++ basic/source/comp/dim.cxx
-@@ -214,7 +214,7 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic )
- Next(), bConst = TRUE;
-
- // #110004 It can also be a sub/function
-- if( !bConst && (eCurTok == SUB || eCurTok == FUNCTION || eCurTok == PROPERTY ||
-+ if( !bConst && (eCurTok == DECLARE || eCurTok == SUB || eCurTok == FUNCTION || eCurTok == PROPERTY ||
- eCurTok == STATIC || eCurTok == ENUM ) )
- {
- // Next token is read here, because !bConst
-@@ -225,6 +225,12 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic )
- Next();
- DefStatic( bPrivate );
- }
-+ else if( eCurTok == DECLARE )
-+ {
-+ Next();
-+ DefDeclare( bPrivate );
-+ return;
-+ }
- else if( eCurTok == SUB || eCurTok == FUNCTION || eCurTok == PROPERTY )
- {
- // End global chain if necessary (not done in
-@@ -875,6 +881,11 @@ SbiProcDef* SbiParser::ProcDecl( BOOL bDecl )
-
- void SbiParser::Declare()
- {
-+ DefDeclare( FALSE );
-+}
-+
-+void SbiParser::DefDeclare( BOOL bPrivate )
-+{
- Next();
- if( eCurTok != SUB && eCurTok != FUNCTION )
- Error( SbERR_UNEXPECTED, eCurTok );
-@@ -901,6 +912,9 @@ void SbiParser::Declare()
- }
- else
- aPublics.Add( pDef );
-+ if ( pDef )
-+ pDef->SetPublic( !bPrivate );
-+
- }
- }
- }
-diff --git basic/source/inc/parser.hxx basic/source/inc/parser.hxx
-index d13b8ac..d5afbea 100644
---- basic/source/inc/parser.hxx
-+++ basic/source/inc/parser.hxx
-@@ -68,6 +68,7 @@ class SbiParser : public SbiTokenizer
- void StmntBlock( SbiToken ); // Statement-Block abarbeiten
- void DefType( BOOL bPrivate ); // Parse type declaration
- void DefEnum( BOOL bPrivate ); // Parse enum declaration
-+ void DefDeclare( BOOL bPrivate );
- void EnableCompatibility();
- public:
- SbxArrayRef rTypeArray; // das Type-Array
diff --git a/patches/vba/vba-fix-range-delete-shift.diff b/patches/vba/vba-fix-range-delete-shift.diff
deleted file mode 100644
index bb9fe2b6b..000000000
--- a/patches/vba/vba-fix-range-delete-shift.diff
+++ /dev/null
@@ -1,42 +0,0 @@
-diff --git sc/source/ui/vba/vbarange.cxx sc/source/ui/vba/vbarange.cxx
-index 19bf089..9743989 100644
---- sc/source/ui/vba/vbarange.cxx
-+++ sc/source/ui/vba/vbarange.cxx
-@@ -3317,7 +3317,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();
-@@ -3329,6 +3328,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;
-@@ -3346,13 +3347,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 );
-
- }
-
diff --git a/patches/vba/vba-fix-scripting-parallelbuild.diff b/patches/vba/vba-fix-scripting-parallelbuild.diff
deleted file mode 100644
index 19a5590c5..000000000
--- a/patches/vba/vba-fix-scripting-parallelbuild.diff
+++ /dev/null
@@ -1,72 +0,0 @@
-From f53e1140270442957c4e625508173a356893c7a2 Mon Sep 17 00:00:00 2001
-From: Jan Holesovsky <kendy@suse.cz>
-Date: Fri, 14 May 2010 17:00:18 +0200
-Subject: [PATCH 404/878] vba-fix-scripting-parallelbuild.diff
-
----
- scripting/source/dlgprov/makefile.mk | 9 +++++++++
- scripting/source/vbaevents/makefile.mk | 21 ++++++++++++---------
- 2 files changed, 21 insertions(+), 9 deletions(-)
-
-diff --git a/scripting/source/dlgprov/makefile.mk b/scripting/source/dlgprov/makefile.mk
-index 1333491..b1e666c 100644
---- a/scripting/source/dlgprov/makefile.mk
-+++ b/scripting/source/dlgprov/makefile.mk
-@@ -67,3 +67,12 @@ SHL1LIBS=$(SLB)$/$(TARGET).lib
- # --- Targets ------------------------------------------------------
-
- .INCLUDE : target.mk
-+
-+ALLTAR : \
-+ $(MISC)$/$(TARGET).don \
-+
-+$(SLOFILES) : $(MISC)$/$(TARGET).don
-+
-+$(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb
-+ +$(CPPUMAKER) -O$(INCCOM)$/$(TARGET) -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@
-+ echo $@
-diff --git a/scripting/source/vbaevents/makefile.mk b/scripting/source/vbaevents/makefile.mk
-index 0a9fc0c..5e9b0a1 100644
---- a/scripting/source/vbaevents/makefile.mk
-+++ b/scripting/source/vbaevents/makefile.mk
-@@ -1,6 +1,6 @@
- PRJ=..$/..
-
--PRJNAME=vbaevents
-+PRJNAME=scripting
- TARGET=vbaevents
- .IF "$(ENABLE_VBA)"!="YES"
- dummy:
-@@ -19,14 +19,6 @@ DLLPRE =
-
- # ------------------------------------------------------------------
-
--ALLTAR : \
-- $(MISC)$/$(TARGET).don \
-- $(SLOTARGET)
--
--$(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb
-- +$(CPPUMAKER) -O$(OUT)$/inc -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@
-- echo $@
--# ------------------------------------------------------------------
-
- #.INCLUDE : ..$/cppumaker.mk
-
-@@ -57,3 +49,14 @@ SHL1LIBS=$(SLB)$/$(TARGET).lib
- # --- Targets ------------------------------------------------------
-
- .INCLUDE : target.mk
-+
-+# ------------------------------------------------------------------
-+
-+ALLTAR : \
-+ $(MISC)$/$(TARGET).don \
-+
-+$(SLOFILES) : $(MISC)$/$(TARGET).don
-+
-+$(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb
-+ +$(CPPUMAKER) -O$(INCCOM)$/$(TARGET) -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@
-+ echo $@
---
-1.7.0.1
-
diff --git a/patches/vba/vba-fix-selection-dot-inproject.diff b/patches/vba/vba-fix-selection-dot-inproject.diff
deleted file mode 100644
index cbfd2853a..000000000
--- a/patches/vba/vba-fix-selection-dot-inproject.diff
+++ /dev/null
@@ -1,176 +0,0 @@
-diff --git basic/source/runtime/stdobj.cxx basic/source/runtime/stdobj.cxx
-index 38ba7cd..4c8c807 100644
---- basic/source/runtime/stdobj.cxx
-+++ basic/source/runtime/stdobj.cxx
-@@ -73,6 +73,45 @@ struct Methods {
- USHORT nHash; // Hashcode
- };
-
-+struct StringHashCode
-+{
-+ size_t operator()( const String& rStr ) const
-+ {
-+ return rtl_ustr_hashCode_WithLength( rStr.GetBuffer(), rStr.Len() );
-+ }
-+};
-+
-+class VBABlacklist
-+{
-+friend class VBABlackListQuery;
-+ std::hash_map< String, bool, StringHashCode > mBlackList;
-+ VBABlacklist()
-+ {
-+ const char* list[] = { "Red" };
-+ sal_Int32 nSize = sizeof( list ) / sizeof( list[ 0 ] );
-+ for ( sal_Int32 index = 0; index < nSize; ++index )
-+ {
-+ mBlackList[ String::CreateFromAscii( list[ index ] ).ToLowerAscii() ] = true;
-+ }
-+ }
-+public:
-+ bool isBlackListed( const String& sName )
-+ {
-+ String sNameLower( sName );
-+ sNameLower.ToLowerAscii();
-+ return ( mBlackList.find( sNameLower ) != mBlackList.end() );
-+ }
-+};
-+
-+class VBABlackListQuery
-+{
-+public:
-+ static bool isBlackListed( const String& sName )
-+ {
-+ static VBABlacklist blackList;
-+ return blackList.isBlackListed( sName );
-+ }
-+};
- static Methods aMethods[] = {
-
- { "AboutStarBasic", SbxNULL, 1 | _FUNCTION, RTLNAME(AboutStarBasic),0 },
-@@ -759,13 +798,15 @@ SbxVariable* SbiStdObject::Find( const String& rName, SbxClassType t )
- && ( p->nHash == nHash_ )
- && ( rName.EqualsIgnoreCaseAscii( p->pName ) ) )
- {
-+ SbiInstance* pInst = pINST;
- bFound = TRUE;
- if( p->nArgs & _COMPTMASK )
- {
-- SbiInstance* pInst = pINST;
- if( !pInst || !pInst->IsCompatibility() )
- bFound = FALSE;
- }
-+ if ( pInst && pInst->IsCompatibility() && VBABlackListQuery::isBlackListed( rName ) )
-+ bFound = FALSE;
- break;
- }
- nIndex += ( p->nArgs & _ARGSMASK ) + 1;
-diff --git sc/source/ui/vba/vbarange.cxx sc/source/ui/vba/vbarange.cxx
-index d09c699..7ba906e 100644
---- sc/source/ui/vba/vbarange.cxx
-+++ sc/source/ui/vba/vbarange.cxx
-@@ -2555,8 +2555,6 @@ ScVbaRange::PasteSpecial( const uno::Any& Paste, const uno::Any& Operation, cons
-
- 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( xModel->getCurrentSelection() );
- // select this range
- xSelection->select( uno::makeAny( mxRange ) );
- // set up defaults
-@@ -2577,8 +2575,6 @@ ScVbaRange::PasteSpecial( const uno::Any& Paste, const uno::Any& Operation, cons
- USHORT nFlags = getPasteFlags(nPaste);
- USHORT nFormulaBits = getPasteFormulaBits(nOperation);
- excel::implnPasteSpecial(pShell->GetModel(), nFlags,nFormulaBits,bSkipBlanks,bTranspose);
-- // restore selection
-- xSelection->select( uno::makeAny( xSel ) );
- }
-
- uno::Reference< excel::XRange >
-diff --git scripting/source/basprov/basprov.cxx scripting/source/basprov/basprov.cxx
-index 562e605..562a8e5 100644
---- scripting/source/basprov/basprov.cxx
-+++ scripting/source/basprov/basprov.cxx
-@@ -374,7 +374,33 @@ namespace basprov
- ::rtl::OUString::createFromAscii( "location" ) );
-
- sal_Int32 nIndex = 0;
-- ::rtl::OUString aLibrary = aDescription.getToken( 0, (sal_Unicode)'.', nIndex );
-+ // In some strange circumstances the Library name can have an
-+ // apparantly illegal '.' in it ( in imported VBA )
-+
-+ BasicManager* pBasicMgr = NULL;
-+ if ( aLocation.equals( ::rtl::OUString::createFromAscii("document") ) )
-+ {
-+ pBasicMgr = m_pDocBasicManager;
-+ }
-+ else if ( aLocation.equals( ::rtl::OUString::createFromAscii("application") ) )
-+ {
-+ pBasicMgr = m_pAppBasicManager;
-+ }
-+ rtl::OUString sProjectName;
-+ if ( pBasicMgr )
-+ sProjectName = pBasicMgr->GetName();
-+
-+ ::rtl::OUString aLibrary;
-+ if ( sProjectName.getLength() && aDescription.match( sProjectName ) )
-+ {
-+ OSL_TRACE("LibraryName %s is part of the url %s",
-+ rtl::OUStringToOString( sProjectName, RTL_TEXTENCODING_UTF8 ).getStr(),
-+ rtl::OUStringToOString( aDescription, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ aLibrary = sProjectName;
-+ nIndex = sProjectName.getLength() + 1;
-+ }
-+ else
-+ aLibrary = aDescription.getToken( 0, (sal_Unicode)'.', nIndex );
- ::rtl::OUString aModule;
- if ( nIndex != -1 )
- aModule = aDescription.getToken( 0, (sal_Unicode)'.', nIndex );
-@@ -384,15 +410,6 @@ namespace basprov
-
- if ( aLibrary.getLength() != 0 && aModule.getLength() != 0 && aMethod.getLength() != 0 && aLocation.getLength() != 0 )
- {
-- BasicManager* pBasicMgr = NULL;
-- if ( aLocation.equals( ::rtl::OUString::createFromAscii("document") ) )
-- {
-- pBasicMgr = m_pDocBasicManager;
-- }
-- else if ( aLocation.equals( ::rtl::OUString::createFromAscii("application") ) )
-- {
-- pBasicMgr = m_pAppBasicManager;
-- }
-
- if ( pBasicMgr )
- {
-diff --git svx/source/msfilter/msvbahelper.cxx svx/source/msfilter/msvbahelper.cxx
-index d02746f..cf66309 100644
---- svx/source/msfilter/msvbahelper.cxx
-+++ svx/source/msfilter/msvbahelper.cxx
-@@ -98,7 +98,17 @@ SfxObjectShell* findShellForUrl( const rtl::OUString& sMacroURLOrPath )
- }
- else
- {
-- if ( aURL.equals( xModel->getURL() ) )
-+ // sometimes just the name of the document ( without the path
-+ // is used
-+ bool bDocNameNoPathMatch = false;
-+ if ( aURL.getLength() && aURL.indexOf( '/' ) == -1 )
-+ {
-+ sal_Int32 lastSlashIndex = xModel->getURL().lastIndexOf( '/' );
-+ if ( lastSlashIndex > -1 )
-+ bDocNameNoPathMatch = xModel->getURL().copy( lastSlashIndex + 1 ).equals( aURL );
-+ }
-+
-+ if ( aURL.equals( xModel->getURL() ) || bDocNameNoPathMatch )
- {
- pFoundShell = pShell;
- break;
-@@ -207,7 +217,7 @@ VBAMacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const rtl::OUStrin
- OSL_TRACE("doc search, current shell is 0x%x", pShell );
- SfxObjectShell* pFoundShell = findShellForUrl( sDocUrlOrPath );
- OSL_TRACE("doc search, after find, found shell is 0x%x", pFoundShell );
-- aRes = resolveVBAMacro( pFoundShell, sMacroUrl );
-+ return resolveVBAMacro( pFoundShell, sMacroUrl );
- }
- else
- {
diff --git a/patches/vba/vba-fix-shapepic-hlinkmacro.diff b/patches/vba/vba-fix-shapepic-hlinkmacro.diff
deleted file mode 100644
index ec931ddf0..000000000
--- a/patches/vba/vba-fix-shapepic-hlinkmacro.diff
+++ /dev/null
@@ -1,41 +0,0 @@
-diff --git sc/source/filter/excel/xiescher.cxx sc/source/filter/excel/xiescher.cxx
-index 35336f7..e708d07 100644
---- sc/source/filter/excel/xiescher.cxx
-+++ sc/source/filter/excel/xiescher.cxx
-@@ -539,8 +539,9 @@ void XclImpDrawObjBase::PreProcessSdrObject( XclImpDffConverter& rDffConv, SdrOb
- }
-
- // macro and hyperlink
-- if( mbSimpleMacro && ((maMacroName.Len() > 0) ||
-- (maHyperlink.Len() > 0)) )
-+ // removed oracle/sun check for mbSimpleMacro ( no idea what its for )
-+ if( (maMacroName.Len() > 0 ) ||
-+ (maHyperlink.Len() > 0) )
- {
- if( ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( &rSdrObj, TRUE ) )
- {
-diff --git sc/source/filter/excel/xltools.cxx sc/source/filter/excel/xltools.cxx
-index 51146d5..e703159 100644
---- sc/source/filter/excel/xltools.cxx
-+++ sc/source/filter/excel/xltools.cxx
-@@ -695,7 +695,7 @@ void XclTools::SkipSubStream( XclImpStream& rStrm )
-
- // Basic macro names ----------------------------------------------------------
-
--const OUString XclTools::maSbMacroPrefix( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.script:Standard." ) );
-+const OUString XclTools::maSbMacroPrefix( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.script:" ) );
- const OUString XclTools::maSbMacroSuffix( RTL_CONSTASCII_USTRINGPARAM( "?language=Basic&location=document" ) );
-
- OUString XclTools::GetSbMacroUrl( const String& rMacroName, SfxObjectShell* pDocShell )
-@@ -727,7 +727,10 @@ String XclTools::GetXclMacroName( const OUString& rSbMacroUrl )
- sal_Int32 nMacroNameLen = nSbMacroUrlLen - maSbMacroPrefix.getLength() - maSbMacroSuffix.getLength();
- if( (nMacroNameLen > 0) && rSbMacroUrl.matchIgnoreAsciiCase( maSbMacroPrefix, 0 ) &&
- rSbMacroUrl.matchIgnoreAsciiCase( maSbMacroSuffix, nSbMacroUrlLen - maSbMacroSuffix.getLength() ) )
-- return rSbMacroUrl.copy( maSbMacroPrefix.getLength(), nMacroNameLen );
-+ {
-+ sal_Int32 nPrjDot = rSbMacroUrl.indexOf( '.', maSbMacroPrefix.getLength() ) + 1;
-+ return rSbMacroUrl.copy( nPrjDot, nSbMacroUrlLen - nPrjDot - maSbMacroSuffix.getLength() );
-+ }
- return String::EmptyString();
- }
-
diff --git a/patches/vba/vba-fix-userform-init.diff b/patches/vba/vba-fix-userform-init.diff
deleted file mode 100644
index 182d7a72e..000000000
--- a/patches/vba/vba-fix-userform-init.diff
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git basic/source/classes/sbxmod.cxx basic/source/classes/sbxmod.cxx
-index cf5b5a5..44a8ff2 100644
---- basic/source/classes/sbxmod.cxx
-+++ basic/source/classes/sbxmod.cxx
-@@ -1824,7 +1824,7 @@ void SbUserFormModule::InitObject()
- SbxVariable*
- SbUserFormModule::Find( const XubString& rName, SbxClassType t )
- {
-- if ( !pDocObject && !GetSbData()->bRunInit )
-+ if ( !pDocObject && !GetSbData()->bRunInit && pINST )
- InitObject();
- return SbObjModule::Find( rName, t );
- }
diff --git a/patches/vba/vba-fix-workbook-resize-core.diff b/patches/vba/vba-fix-workbook-resize-core.diff
deleted file mode 100644
index 62c78717c..000000000
--- a/patches/vba/vba-fix-workbook-resize-core.diff
+++ /dev/null
@@ -1,234 +0,0 @@
-Index: sc/source/ui/vba/vbaeventshelper.hxx
-===================================================================
---- sc/source/ui/vba/vbaeventshelper.hxx (revision 271848)
-+++ sc/source/ui/vba/vbaeventshelper.hxx (working copy)
-@@ -40,6 +40,7 @@
- #include <cppuhelper/implbase1.hxx>
- #include <com/sun/star/document/VbaEventId.hpp>
- #include <com/sun/star/document/XVbaEventsHelper.hpp>
-+#include <com/sun/star/awt/XWindowListener.hpp>
- #include "excelvbahelper.hxx"
-
- #define INVALID_TAB -1
-@@ -54,7 +55,7 @@
- ScDocument* pDoc;
- ScDocShell* pDocShell;
- css::uno::Reference< css::uno::XComponentContext > m_xContext;
-- VbaEventsListener* mpVbaEventsListener;
-+ css::uno::Reference< css::awt::XWindowListener > m_xVbaEventsListener;
- sal_Bool mbOpened;
- sal_Bool mbIgnoreEvents;
-
-@@ -69,7 +70,7 @@
- sal_Bool processVbaEvent( const sal_Int32 nEventId, const css::uno::Sequence< css::uno::Any >& rArgs, const SCTAB nTab = INVALID_TAB );
-
- public:
-- ScVbaEventsHelper( ScDocument* pDocument ):pDoc( pDocument ), mpVbaEventsListener( NULL ), mbOpened( sal_False ){};
-+ ScVbaEventsHelper( ScDocument* pDocument ):pDoc( pDocument ), mbOpened( sal_False ){};
- ScVbaEventsHelper( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext > const& xContext );
- ~ScVbaEventsHelper();
- ScDocument* getDocument() { return pDoc; };
-Index: sc/source/ui/vba/vbaeventshelper.cxx
-===================================================================
---- sc/source/ui/vba/vbaeventshelper.cxx (revision 271848)
-+++ sc/source/ui/vba/vbaeventshelper.cxx (working copy)
-@@ -49,7 +49,6 @@
- #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
- #include <com/sun/star/sheet/XSpreadsheet.hpp>
- #include <com/sun/star/container/XNamed.hpp>
--#include <com/sun/star/awt/XWindowListener.hpp>
- #include <com/sun/star/awt/WindowEvent.hpp>
- #include <com/sun/star/lang/EventObject.hpp>
- #include <com/sun/star/util/XCloseListener.hpp>
-@@ -64,6 +63,7 @@
- #include <convuno.hxx>
- #include <map>
- #include <svx/msvbahelper.hxx>
-+#include <vcl/svapp.hxx>
-
- using namespace std;
- using namespace com::sun::star;
-@@ -140,19 +140,20 @@
- // This class is to process Workbook window related event
- class VbaEventsListener : public WindowListener_BASE
- {
-+ ::osl::Mutex m_aMutex;
- ScVbaEventsHelper* pVbaEventsHelper;
- uno::Reference< frame::XModel > m_xModel;
-- sal_Bool m_bPrepare;
- sal_Bool m_bWindowResized;
- sal_Bool m_bBorderChanged;
- protected :
- uno::Reference< awt::XWindow > GetContainerWindow();
- uno::Reference< frame::XFrame > GetFrame();
- sal_Bool IsMouseReleased();
-- DECL_LINK( fireResizeMacro, Timer* );
-+ DECL_LINK( fireResizeMacro, void* );
- void processWindowResizeMacro();
- public :
- VbaEventsListener( ScVbaEventsHelper* pHelper );
-+ ~VbaEventsListener();
- void startEventsLinstener();
- void stopEventsLinstener();
- // XWindowListener
-@@ -169,11 +170,16 @@
- };
- VbaEventsListener::VbaEventsListener( ScVbaEventsHelper* pHelper ) : pVbaEventsHelper( pHelper )
- {
-+ OSL_TRACE("VbaEventsListener::VbaEventsListener( 0x%x ) - ctor ", this );
- m_xModel.set( pVbaEventsHelper->getDocument()->GetDocumentShell()->GetModel(), uno::UNO_QUERY );
-- m_bPrepare = sal_False;
- m_bWindowResized = sal_False;
- m_bBorderChanged = sal_False;
- }
-+
-+VbaEventsListener::~VbaEventsListener()
-+{
-+ OSL_TRACE("VbaEventsListener::~VbaEventsListener( 0x%x ) - dtor ", this );
-+}
- uno::Reference< frame::XFrame >
- VbaEventsListener::GetFrame()
- {
-@@ -286,41 +292,39 @@
- pVbaEventsHelper = NULL;
- }
- }
-+
- void
- VbaEventsListener::processWindowResizeMacro()
- {
-+ OSL_TRACE("**** Attempt to FIRE MACRO **** ");
- if( pVbaEventsHelper )
- pVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_WINDOWRESIZE, uno::Sequence< uno::Any >() );
- }
--IMPL_LINK( VbaEventsListener, fireResizeMacro, Timer*, pTimer )
-+
-+IMPL_LINK( VbaEventsListener, fireResizeMacro, void*, pParam )
- {
-- if( pVbaEventsHelper && m_bPrepare && pTimer )
-+ if ( pVbaEventsHelper )
- {
- if( IsMouseReleased() )
-- {
-- pTimer->Stop();
-- delete pTimer;
-- pTimer = 0;
-- m_bPrepare = sal_False;
-- processWindowResizeMacro();
-- }
-+ processWindowResizeMacro();
- }
-+ release();
- return 0;
- }
-+
- void SAL_CALL
- VbaEventsListener::windowResized( const awt::WindowEvent& /*aEvent*/ ) throw ( uno::RuntimeException )
- {
-+ ::osl::MutexGuard aGuard( m_aMutex );
- // Workbook_window_resize event
-- OSL_TRACE("VbaEventsListener::windowResized");
- m_bWindowResized = sal_True;
- Window* pWindow = (VCLUnoHelper::GetWindow( GetContainerWindow() ) );
-- if( pWindow && !m_bPrepare && m_bBorderChanged )
-+
-+ if( pWindow && m_bBorderChanged )
- {
-- m_bPrepare = sal_True;
- m_bBorderChanged = m_bWindowResized = sal_False;
-- AutoTimer* pTimer = new AutoTimer();
-- pTimer->SetTimeoutHdl( LINK( this, VbaEventsListener, fireResizeMacro ) );
-- pTimer->Start();
-+ acquire(); // ensure we don't get deleted before the event is handled
-+ Application::PostUserEvent( LINK( this, VbaEventsListener, fireResizeMacro ), NULL );
- }
- }
- void SAL_CALL
-@@ -341,6 +345,8 @@
- void SAL_CALL
- VbaEventsListener::disposing( const lang::EventObject& /*aEvent*/ ) throw ( uno::RuntimeException )
- {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ OSL_TRACE("VbaEventsListener::disposing(0x%x)", this);
- pVbaEventsHelper = NULL;
- }
- void SAL_CALL
-@@ -351,23 +357,21 @@
- void SAL_CALL
- VbaEventsListener::notifyClosing( const lang::EventObject& Source ) throw (uno::RuntimeException)
- {
-- OSL_TRACE("VbaEventsListener::notifyClosing");
-+ ::osl::MutexGuard aGuard( m_aMutex );
- stopEventsLinstener();
- }
- void SAL_CALL
- VbaEventsListener::borderWidthsChanged( const uno::Reference< uno::XInterface >& aObject, const frame::BorderWidths& aNewSize ) throw (uno::RuntimeException)
- {
-+ ::osl::MutexGuard aGuard( m_aMutex );
- // work with WindowResized event to guard Window Resize event.
-- OSL_TRACE("VbaEventsListener::borderWidthsChanged");
- m_bBorderChanged = sal_True;
- Window* pWindow = (VCLUnoHelper::GetWindow( GetContainerWindow() ) );
-- if( pWindow && !m_bPrepare && m_bWindowResized )
-+ if( pWindow && m_bWindowResized )
- {
-- m_bPrepare = sal_True;
- m_bWindowResized = m_bBorderChanged = sal_False;
-- AutoTimer* pTimer = new AutoTimer();
-- pTimer->SetTimeoutHdl( LINK( this, VbaEventsListener, fireResizeMacro ) );
-- pTimer->Start();
-+ acquire(); // ensure we don't get deleted before the timer fires.
-+ Application::PostUserEvent( LINK( this, VbaEventsListener, fireResizeMacro ), NULL );
- }
- }
-
-@@ -456,7 +460,7 @@
- }
-
- ScVbaEventsHelper::ScVbaEventsHelper( uno::Sequence< css::uno::Any > const& aArgs, uno::Reference< uno::XComponentContext > const& xContext )
-- : m_xContext( xContext ), mpVbaEventsListener( NULL ), mbOpened( sal_False ), mbIgnoreEvents( sal_False )
-+ : m_xContext( xContext ), mbOpened( sal_False ), mbIgnoreEvents( sal_False )
- {
- uno::Reference< frame::XModel > xModel ( getXSomethingFromArgs< frame::XModel >( aArgs, 0 ), uno::UNO_QUERY );
- pDocShell = excel::getDocShell( xModel );
-@@ -469,10 +473,6 @@
-
- ScVbaEventsHelper::~ScVbaEventsHelper()
- {
-- if( mpVbaEventsListener )
-- {
-- mpVbaEventsListener = NULL;
-- }
- }
-
- rtl::OUString
-@@ -993,10 +993,11 @@
- ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_ACTIVATE, aArgs );
- }
- // register the window listener.
-- if( !mpVbaEventsListener )
-+ if( !m_xVbaEventsListener.is() )
- {
-- mpVbaEventsListener = new VbaEventsListener( this );
-- mpVbaEventsListener->startEventsLinstener();
-+ m_xVbaEventsListener = new VbaEventsListener( this );
-+ VbaEventsListener* pEventsListener = dynamic_cast< VbaEventsListener* >( m_xVbaEventsListener.get() );
-+ pEventsListener->startEventsLinstener();
- }
- break;
- }
-@@ -1006,10 +1007,11 @@
- case VBAEVENT_WORKBOOK_BEFORECLOSE:
- {
- sal_Bool bCancel = processVbaEvent( nEventId, aArgs );
-- if( mpVbaEventsListener && !bCancel )
-+ if( m_xVbaEventsListener.is() && !bCancel )
- {
-- mpVbaEventsListener->stopEventsLinstener();
-- mpVbaEventsListener = NULL;
-+ VbaEventsListener* pEventsListener = dynamic_cast< VbaEventsListener* >( m_xVbaEventsListener.get() );
-+ pEventsListener->stopEventsLinstener();
-+ m_xVbaEventsListener = NULL;
- }
- return bCancel;
- }
diff --git a/patches/vba/vba-fix-worksheet-add-activate.diff b/patches/vba/vba-fix-worksheet-add-activate.diff
deleted file mode 100644
index 9f2dc88f2..000000000
--- a/patches/vba/vba-fix-worksheet-add-activate.diff
+++ /dev/null
@@ -1,15 +0,0 @@
-diff --git sc/source/ui/vba/vbaworksheets.cxx sc/source/ui/vba/vbaworksheets.cxx
-index f2c0312..a927236 100644
---- sc/source/ui/vba/vbaworksheets.cxx
-+++ sc/source/ui/vba/vbaworksheets.cxx
-@@ -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;
- }
-
diff --git a/patches/vba/vba-fix-worksheet-add-before-param-object.diff b/patches/vba/vba-fix-worksheet-add-before-param-object.diff
deleted file mode 100644
index 356591ddc..000000000
--- a/patches/vba/vba-fix-worksheet-add-before-param-object.diff
+++ /dev/null
@@ -1,31 +0,0 @@
-diff --git sc/source/ui/vba/vbaworksheets.cxx sc/source/ui/vba/vbaworksheets.cxx
-index f2c0312..a927236 100644
---- sc/source/ui/vba/vbaworksheets.cxx
-+++ sc/source/ui/vba/vbaworksheets.cxx
-@@ -209,10 +209,23 @@ 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())
diff --git a/patches/vba/vba-fixerror-nonvba.diff b/patches/vba/vba-fixerror-nonvba.diff
deleted file mode 100644
index c096cba39..000000000
--- a/patches/vba/vba-fixerror-nonvba.diff
+++ /dev/null
@@ -1,25 +0,0 @@
-From b83705241c40b3c92027e0b8de34a01af3f93461 Mon Sep 17 00:00:00 2001
-From: Jan Holesovsky <kendy@suse.cz>
-Date: Fri, 14 May 2010 17:00:27 +0200
-Subject: [PATCH 409/878] vba-fixerror-nonvba.diff
-
----
- basic/source/runtime/stdobj.cxx | 2 +-
- 1 files changed, 1 insertions(+), 1 deletions(-)
-
-diff --git a/basic/source/runtime/stdobj.cxx b/basic/source/runtime/stdobj.cxx
-index 0fc7f41..0ccd56a 100644
---- a/basic/source/runtime/stdobj.cxx
-+++ b/basic/source/runtime/stdobj.cxx
-@@ -770,7 +770,7 @@ SbxVariable* SbiStdObject::Find( const String& rName, SbxClassType t )
- // #TODO #FIXME hack for substituting ooo-basic Err with vba-ish
- // ErrObject object
- static String sErr( RTL_CONSTASCII_USTRINGPARAM("Err") );
-- if ( rName.EqualsIgnoreCaseAscii( sErr ) )
-+ if ( SbiRuntime::isVBAEnabled() && rName.EqualsIgnoreCaseAscii( sErr ) )
- return SbxErrObject::getErrObject();
- // Bereits eingetragen?
- SbxVariable* pVar = SbxObject::Find( rName, t );
---
-1.7.0.1
-
diff --git a/patches/vba/vba-fixup-macrosearch.diff b/patches/vba/vba-fixup-macrosearch.diff
deleted file mode 100644
index db726c457..000000000
--- a/patches/vba/vba-fixup-macrosearch.diff
+++ /dev/null
@@ -1,1581 +0,0 @@
-diff --git sc/source/filter/excel/xlescher.cxx sc/source/filter/excel/xlescher.cxx
-index 2109a0a..88eb9d0 100644
---- sc/source/filter/excel/xlescher.cxx
-+++ sc/source/filter/excel/xlescher.cxx
-@@ -45,6 +45,7 @@
- #include <basic/sbmod.hxx>
- #include <basic/sbmeth.hxx>
- #include <basic/basmgr.hxx>
-+#include <svx/msvbahelper.hxx>
-
- using ::rtl::OUString;
- using ::com::sun::star::uno::Reference;
-@@ -306,7 +307,6 @@ Reference< XControlModel > XclControlHelper::GetControlModel( Reference< XShape
- }
-
- #define EXC_MACRONAME_PRE "vnd.sun.star.script:Standard."
--#define EXC_MACRO_SCHEME "vnd.sun.star.script:"
- #define EXC_MACRONAME_SUF "?language=Basic&location=document"
-
- OUString XclControlHelper::GetScMacroName( const String& rXclMacroName, SfxObjectShell* pDocShell )
-@@ -314,27 +314,10 @@ OUString XclControlHelper::GetScMacroName( const String& rXclMacroName, SfxObjec
- String sTmp( rXclMacroName );
- if( rXclMacroName.Len() > 0 )
- {
-- String sProjectName( RTL_CONSTASCII_USTRINGPARAM("Standard") );
-+ ooo::vba::VBAMacroResolvedInfo aMacro = ooo::vba::resolveVBAMacro( pDocShell, rXclMacroName, false );
-+ if ( aMacro.IsResolved() )
-+ return ooo::vba::makeMacroURL( aMacro.ResolvedMacro() );
-
-- if ( pDocShell && pDocShell->GetBasicManager()->GetName().Len() > 0 )
-- sProjectName = pDocShell->GetBasicManager()->GetName();
--
-- if ( ( sTmp.Search( '.' ) == STRING_NOTFOUND) && pDocShell )
-- {
-- if( StarBASIC* pBasic = pDocShell->GetBasicManager()->GetLib( sProjectName ) )
-- {
-- if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pBasic->Find( sTmp, SbxCLASS_METHOD ) ) )
-- {
-- if( SbModule* pModule = pMethod->GetModule() )
-- {
-- sTmp.Insert( '.', 0 ).Insert( pModule->GetName(), 0 );
-- }
-- }
-- }
-- }
-- sProjectName.Append( '.' );
-- sTmp.Insert( sProjectName, 0 );
-- return CREATE_OUSTRING( EXC_MACRO_SCHEME ) + sTmp + CREATE_OUSTRING( EXC_MACRONAME_SUF );
- }
- return OUString();
- }
-diff --git sc/source/ui/unoobj/docuno.cxx sc/source/ui/unoobj/docuno.cxx
-index af78648..16a1c03 100644
---- sc/source/ui/unoobj/docuno.cxx
-+++ sc/source/ui/unoobj/docuno.cxx
-@@ -1793,6 +1793,12 @@ sal_Int64 SAL_CALL ScModelObj::getSomething(
- return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
- }
-
-+ if ( rId.getLength() == 16 &&
-+ 0 == rtl_compareMemory( SfxObjectShell::getUnoTunnelId().getConstArray(),
-+ rId.getConstArray(), 16 ) )
-+ {
-+ return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(pDocShell ));
-+ }
- // aggregated number formats supplier has XUnoTunnel, too
- // interface from aggregated object must be obtained via queryAggregation
-
-diff --git sc/source/ui/vba/vbaeventshelper.cxx sc/source/ui/vba/vbaeventshelper.cxx
-index 3948ac6..36e1115 100644
---- sc/source/ui/vba/vbaeventshelper.cxx
-+++ sc/source/ui/vba/vbaeventshelper.cxx
-@@ -614,8 +614,8 @@ rtl::OUString
- ScVbaEventsHelper::getMacroPath( const sal_Int32 nEventId, const SCTAB nTab )
- {
- SfxObjectShell* pShell = pDoc->GetDocumentShell();
-- rtl::OUString sMacroPath;
-- rtl::OUString sMacroName = getEventName( nEventId );
-+ String sMacroName = getEventName( nEventId );
-+ VBAMacroResolvedInfo sMacroResolvedInfo;
- switch( nEventId )
- {
- // Worksheet
-@@ -629,8 +629,9 @@ ScVbaEventsHelper::getMacroPath( const sal_Int32 nEventId, const SCTAB nTab )
- case VBAEVENT_WORKSHEET_PIVOTTABLEUPDATE :
- case VBAEVENT_WORKSHEET_SELECTIONCHANGE :
- {
-- rtl::OUString aSheetModuleName = getSheetModuleName( nTab );
-- sMacroPath = findVBAMacro( pShell, aSheetModuleName, sMacroName );
-+ String aSheetModuleName = getSheetModuleName( nTab );
-+ sMacroName.Insert( '.', 0 ).Insert( aSheetModuleName, 0);
-+ sMacroResolvedInfo = resolveVBAMacro( pShell, sMacroName );
- break;
- }
- // Workbook
-@@ -664,13 +665,14 @@ ScVbaEventsHelper::getMacroPath( const sal_Int32 nEventId, const SCTAB nTab )
- sWorkbookModuleName = aExtDocSettings.maGlobCodeName;
- }
-
-- sMacroPath = findVBAMacro( pShell, sWorkbookModuleName, sMacroName );
-+ sMacroName.Insert( '.', 0 ).Insert( sWorkbookModuleName, 0);
-+ sMacroResolvedInfo = resolveVBAMacro( pShell, sMacroName );
- break;
- }
- default:
- break;
- }
-- return sMacroPath;
-+ return sMacroResolvedInfo.ResolvedMacro();
- }
-
- sal_Bool ScVbaEventsHelper::processVbaEvent( const sal_Int32 nEventId, const uno::Sequence< uno::Any >& rArgs, const SCTAB nTab )
-@@ -681,6 +683,7 @@ sal_Bool ScVbaEventsHelper::processVbaEvent( const sal_Int32 nEventId, const uno
- sal_Bool bCancel = sal_False;
- uno::Sequence< uno::Any > aArgs;
- uno::Any aRet;
-+ uno::Any aDummyCaller;
-
- // For most cases, there is no corresponsible event macro in the document.
- // It is better fo check if the event macro exists before process the arguments to improve performance.
-@@ -777,7 +780,7 @@ sal_Bool ScVbaEventsHelper::processVbaEvent( const sal_Int32 nEventId, const uno
- // process Cancel argument
- aArgs = uno::Sequence< uno::Any >(1);
- aArgs[0] <<= bCancel;
-- executeMacro( pShell, sMacroPath, aArgs, aRet );
-+ executeMacro( pShell, sMacroPath, aArgs, aRet, aDummyCaller );
- aArgs[0] >>= bCancel;
- return bCancel;
- }
-@@ -787,7 +790,7 @@ sal_Bool ScVbaEventsHelper::processVbaEvent( const sal_Int32 nEventId, const uno
- aArgs = uno::Sequence< uno::Any >(2);
- aArgs[0] = rArgs[0];
- aArgs[1] <<= bCancel;
-- executeMacro( pShell, sMacroPath, aArgs, aRet );
-+ executeMacro( pShell, sMacroPath, aArgs, aRet, aDummyCaller );
- aArgs[1] >>= bCancel;
- return bCancel;
- }
-@@ -805,7 +808,7 @@ sal_Bool ScVbaEventsHelper::processVbaEvent( const sal_Int32 nEventId, const uno
- }
-
- // excute the macro
-- result = executeMacro( pShell, sMacroPath, aArgs, aRet );
-+ result = executeMacro( pShell, sMacroPath, aArgs, aRet, aDummyCaller );
- }
-
- return result;
-diff --git scripting/prj/build.lst scripting/prj/build.lst
-index fc33238..f216009 100644
---- scripting/prj/build.lst
-+++ scripting/prj/build.lst
-@@ -1,4 +1,4 @@
--tc scripting : oovbaapi bridges rdbmaker vcl xmlscript basic sfx2 rhino BSH:beanshell javaunohelper NULL
-+tc scripting : oovbaapi svx bridges rdbmaker vcl xmlscript basic sfx2 rhino BSH:beanshell javaunohelper NULL
- tc scripting usr1 - all tc1_mkout NULL
- tc scripting\inc nmake - all tc1_inc NULL
- tc scripting\source\provider nmake - all tc1_scriptingprovider tc1_inc NULL
-diff --git scripting/source/vbaevents/eventhelper.cxx scripting/source/vbaevents/eventhelper.cxx
-index 84dc900..f85ac51 100644
---- scripting/source/vbaevents/eventhelper.cxx
-+++ scripting/source/vbaevents/eventhelper.cxx
-@@ -35,14 +35,11 @@
- #include <basic/sbmeth.hxx>
- #include <basic/sbmod.hxx>
- #include <basic/sbx.hxx>
--
--
--
-+#include <svx/msvbahelper.hxx>
-
- // for debug
- #include <comphelper/anytostring.hxx>
-
--
- #include <com/sun/star/lang/XMultiComponentFactory.hpp>
- #include <com/sun/star/script/XScriptListener.hpp>
- #include <cppuhelper/implbase1.hxx>
-@@ -771,7 +768,7 @@ EventListener::getPropertySetInfo( ) throw (RuntimeException)
- // EventListener
-
- void
--EventListener::firing_Impl(const ScriptEvent& evt, Any* /*pRet*/ ) throw(RuntimeException)
-+EventListener::firing_Impl(const ScriptEvent& evt, Any* pRet ) throw(RuntimeException)
- {
- OSL_TRACE("EventListener::firing_Impl( FAKE VBA_EVENTS )");
- static const ::rtl::OUString vbaInterOp =
-@@ -842,22 +839,16 @@ EventListener::firing_Impl(const ScriptEvent& evt, Any* /*pRet*/ ) throw(Runtime
- sMacroLoc = sMacroLoc.concat( sScriptCode ).concat( rtl::OUString::createFromAscii(".") );
-
- OSL_TRACE("sMacroLoc is %s", rtl::OUStringToOString( sMacroLoc, RTL_TEXTENCODING_UTF8 ).getStr() );
--
-- // find library
-- pBasic = pBasicManager->GetLib( sProject );
--
-- SbModule* pModule = pBasic ? pBasic->FindModule( sScriptCode ) : NULL;
--
-- for ( ; pModule && txInfo != txInfo_end; ++txInfo )
-+ for ( ; txInfo != txInfo_end; ++txInfo )
- {
-+ rtl::OUString sTemp = sName.concat( (*txInfo).sVBAName );
- // see if we have a match for the handlerextension
- // where ScriptCode is methodname_handlerextension
-- rtl::OUString sTemp = sName.concat( (*txInfo).sVBAName );
--
-+ rtl::OUString sToResolve = sMacroLoc.concat( sTemp );
- OSL_TRACE("*** trying to invoke %s ",
-- rtl::OUStringToOString( sTemp, RTL_TEXTENCODING_UTF8 ).getStr() );
-- SbMethod* pMeth = static_cast< SbMethod* >( pModule->Find( sTemp, SbxCLASS_METHOD ) );
-- if ( pMeth )
-+ rtl::OUStringToOString( sToResolve, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ ooo::vba::VBAMacroResolvedInfo aMacroResolvedInfo = ooo::vba::resolveVBAMacro( mpShell, sToResolve );
-+ if ( aMacroResolvedInfo.IsResolved() )
- {
- // !! translate arguments & emulate events where necessary
- Sequence< Any > aArguments;
-@@ -869,31 +860,22 @@ EventListener::firing_Impl(const ScriptEvent& evt, Any* /*pRet*/ ) throw(Runtime
- {
- // call basic event handlers for event
-
-- static rtl::OUString part1 = rtl::OUString::createFromAscii( "vnd.sun.star.script:");
-- static rtl::OUString part2 = rtl::OUString::createFromAscii("?language=Basic&location=document");
--
- // create script url
-- rtl::OUString url = part1 + sMacroLoc + sTemp + part2;
-+ rtl::OUString url = aMacroResolvedInfo.ResolvedMacro();
-
-- OSL_TRACE("script url = %s",
-+ OSL_TRACE("resolved script = %s",
- rtl::OUStringToOString( url,
- RTL_TEXTENCODING_UTF8 ).getStr() );
-- Sequence< sal_Int16 > aOutArgsIndex;
-- Sequence< Any > aOutArgs;
- try
- {
-- uno::Reference< script::provider::XScript > xScript = xScriptProvider->getScript( url );
-- if ( xScript.is() )
-- {
-- uno::Reference< beans::XPropertySet > xProps( xScript, uno::UNO_QUERY );
-- if ( xProps.is() )
-- {
-- Sequence< Any > aCallerHack(1);
-- aCallerHack[ 0 ] = uno::makeAny( rtl::OUString::createFromAscii("Error") );
-- xProps->setPropertyValue( rtl::OUString::createFromAscii( "Caller" ), uno::makeAny( aCallerHack ) );
-- }
-- xScript->invoke( aArguments, aOutArgsIndex, aOutArgs );
-- }
-+ uno::Any aDummyCaller = uno::makeAny( rtl::OUString::createFromAscii("Error") );
-+ if ( pRet )
-+ ooo::vba::executeMacro( mpShell, url, aArguments, *pRet, aDummyCaller );
-+ else
-+ {
-+ uno::Any aRet;
-+ ooo::vba::executeMacro( mpShell, url, aArguments, aRet, aDummyCaller );
-+ }
- }
- catch ( uno::Exception& e )
- {
-diff --git scripting/source/vbaevents/makefile.mk scripting/source/vbaevents/makefile.mk
-index eabb67e..96f4e3d 100644
---- scripting/source/vbaevents/makefile.mk
-+++ scripting/source/vbaevents/makefile.mk
-@@ -46,6 +46,7 @@ SHL1STDLIBS= \
- $(BASICLIB) \
- $(COMPHELPERLIB) \
- $(SFXLIB) \
-+ $(SVXMSFILTERLIB) \
- $(CPPULIB) \
- $(TOOLSLIB) \
- $(SALLIB)
-diff --git sfx2/inc/sfx2/objsh.hxx sfx2/inc/sfx2/objsh.hxx
-index c65280b..3f2d197 100644
---- sfx2/inc/sfx2/objsh.hxx
-+++ sfx2/inc/sfx2/objsh.hxx
-@@ -265,6 +265,7 @@ public:
- TYPEINFO();
- SFX_DECL_INTERFACE(SFX_INTERFACE_SFXDOCSH)
-
-+ static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId();
- /* Stampit disable/enable cancel button for print jobs
- default = true = enable! */
- void Stamp_SetPrintCancelState(sal_Bool bState);
-@@ -885,6 +886,7 @@ public:
- virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 );
- SfxObjectShell* GetObjectShell() const
- { return pObjSh; }
-+
- };
-
- #endif
-diff --git sfx2/source/doc/objserv.cxx sfx2/source/doc/objserv.cxx
-index d16f0c8..dd4f044 100644
---- sfx2/source/doc/objserv.cxx
-+++ sfx2/source/doc/objserv.cxx
-@@ -1480,3 +1480,19 @@ void SfxObjectShell::SignScriptingContent()
- ImplSign( TRUE );
- }
-
-+// static
-+const uno::Sequence<sal_Int8>& SfxObjectShell::getUnoTunnelId()
-+{
-+ static uno::Sequence<sal_Int8> * pSeq = 0;
-+ if( !pSeq )
-+ {
-+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
-+ if( !pSeq )
-+ {
-+ static uno::Sequence< sal_Int8 > aSeq( 16 );
-+ rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
-+ pSeq = &aSeq;
-+ }
-+ }
-+ return *pSeq;
-+}
-diff --git svx/inc/svx/mstoolbar.hxx svx/inc/svx/mstoolbar.hxx
-index b3667a8..5d76eaf 100644
---- svx/inc/svx/mstoolbar.hxx
-+++ svx/inc/svx/mstoolbar.hxx
-@@ -55,6 +55,7 @@ public:
- void applyIcons();
- rtl::OUString MSOCommandToOOCommand( sal_Int16 msoCmd );
- rtl::OUString MSOTCIDToOOCommand( sal_Int16 msoTCID );
-+ SfxObjectShell& GetDocShell() { return mrDocSh; }
- };
-
- class SVX_DLLPUBLIC TBBase
-diff --git svx/inc/svx/msvbahelper.hxx svx/inc/svx/msvbahelper.hxx
-index 8be6901..294f26e 100644
---- svx/inc/svx/msvbahelper.hxx
-+++ svx/inc/svx/msvbahelper.hxx
-@@ -35,9 +35,24 @@
-
- namespace ooo { namespace vba
- {
-+ class SVX_DLLPUBLIC VBAMacroResolvedInfo
-+ {
-+ SfxObjectShell* mpDocContext;
-+ bool mbFound;
-+ String msResolvedMacro;
-+ public:
-+ VBAMacroResolvedInfo() : mpDocContext(NULL), mbFound( false ){}
-+ void SetResolved( bool bRes ) { mbFound = bRes; }
-+ bool IsResolved() { return mbFound; }
-+ void SetMacroDocContext(SfxObjectShell* pShell ) { mpDocContext = pShell; }
-+ SfxObjectShell* MacroDocContext() { return mpDocContext; }
-+ String ResolvedMacro() { return msResolvedMacro; }
-+ void SetResolvedMacro(const String& sMacro ) { msResolvedMacro = sMacro; }
-+ };
-+
- SVX_DLLPUBLIC String makeMacroURL( const String& sMacroName );
-- SVX_DLLPUBLIC String findVBAMacro( SfxObjectShell* pShell, const String& sMod, const String& sMacro );
-- SVX_DLLPUBLIC sal_Bool executeMacro( SfxObjectShell* pShell, const String& sMacroName, com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArgs, com::sun::star::uno::Any& aRet );
-+ SVX_DLLPUBLIC VBAMacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const rtl::OUString& sMod, bool bSearchGlobalTemplates = false );
-+ SVX_DLLPUBLIC sal_Bool executeMacro( SfxObjectShell* pShell, const String& sMacroName, com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArgs, com::sun::star::uno::Any& aRet, const com::sun::star::uno::Any& aCaller );
- } }
-
- #endif
-diff --git svx/inc/svxmsbas.hxx svx/inc/svxmsbas.hxx
-index a777795..fab5faf 100644
---- svx/inc/svxmsbas.hxx
-+++ svx/inc/svxmsbas.hxx
-@@ -91,6 +91,7 @@ public:
- static ULONG GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocS );
-
- static String GetMSBasicStorageName();
-+ rtl::OUString GetVBAProjectName() { return msProjectName; }
- private:
- SotStorageRef xRoot;
- SfxObjectShell &rDocSh;
-diff --git svx/source/msfilter/mstoolbar.cxx svx/source/msfilter/mstoolbar.cxx
-index 9579db7..fa66fe5 100644
---- svx/source/msfilter/mstoolbar.cxx
-+++ svx/source/msfilter/mstoolbar.cxx
-@@ -12,6 +12,7 @@
- #include <basic/basmgr.hxx>
- #include <svtools/filterutils.hxx>
- #include <boost/scoped_array.hpp>
-+#include <svx/msvbahelper.hxx>
-
- int TBBase::nIndent = 0;
-
-@@ -67,16 +68,8 @@ CustomToolBarImportHelper::createCommandFromMacro( const rtl::OUString& sCmd )
- //"vnd.sun.star.script:Standard.Module1.Main?language=Basic&location=document"
- static rtl::OUString scheme = rtl::OUString::createFromAscii( "vnd.sun.star.script:");
- static rtl::OUString part2 = rtl::OUString::createFromAscii("?language=Basic&location=document");
-- rtl::OUString sProject( RTL_CONSTASCII_USTRINGPARAM("Standard") );
-- if ( mrDocSh.GetBasicManager()->GetName().Len() )
-- sProject = mrDocSh.GetBasicManager()->GetName();
-- sProject += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".") );
--
-- // #TODO #FIXME a script can also be loosly defined ( e.g. with no module
-- // spec )
--
- // create script url
-- rtl::OUString scriptURL = scheme + sProject + sCmd + part2;
-+ rtl::OUString scriptURL = scheme + sCmd + part2;
- return uno::makeAny( scriptURL );
- }
-
-@@ -377,7 +370,9 @@ TBCGeneralInfo::ImportToolBarControlData( CustomToolBarImportHelper& helper, std
- if ( extraInfo.getOnAction().getLength() )
- {
- aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CommandURL") );
-- aProp.Value = helper.createCommandFromMacro( extraInfo.getOnAction() );
-+ ooo::vba::VBAMacroResolvedInfo aMacroInf = ooo::vba::resolveVBAMacro( &helper.GetDocShell(), extraInfo.getOnAction(), true );
-+ if ( aMacroInf.IsResolved() )
-+ aProp.Value = helper.createCommandFromMacro( aMacroInf.ResolvedMacro() );
- sControlData.push_back( aProp );
- }
-
-@@ -390,7 +385,7 @@ TBCGeneralInfo::ImportToolBarControlData( CustomToolBarImportHelper& helper, std
- sControlData.push_back( aProp );
-
- aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HelpURL") );
-- aProp.Value = uno::makeAny( helper.createCommandFromMacro( tooltip.getString() ) );
-+ aProp.Value = uno::makeAny( tooltip.getString() );
- sControlData.push_back( aProp );
-
- // #TODO find out what is the property for tooltip?
-diff --git svx/source/msfilter/msvbahelper.cxx svx/source/msfilter/msvbahelper.cxx
-index 5875cf7..d02746f 100644
---- svx/source/msfilter/msvbahelper.cxx
-+++ svx/source/msfilter/msvbahelper.cxx
-@@ -34,6 +34,11 @@
- #include <basic/basmgr.hxx>
- #include <basic/sbmod.hxx>
- #include <basic/sbmeth.hxx>
-+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
-+#include <com/sun/star/document/XDocumentProperties.hpp>
-+#include <com/sun/star/document/XDocumentInfoSupplier.hpp>
-+#include <tools/urlobj.hxx>
-+#include <osl/file.hxx>
-
- using namespace ::com::sun::star;
-
-@@ -44,91 +49,335 @@ namespace ooo { namespace vba {
-
- String makeMacroURL( const String& sMacroName )
- {
-- return sUrlPart0.concat( sMacroName ).concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".") ) ).concat( sUrlPart1 ) ;
-+ return sUrlPart0.concat( sMacroName ).concat( sUrlPart1 ) ;
- }
-
--String findVBAMacro( SfxObjectShell* pShell, const String& sMod, const String& sMacro )
-+SfxObjectShell* findShellForUrl( const rtl::OUString& sMacroURLOrPath )
- {
-- String sFullName;
-- // would use the script provider to see if the macro exists but
-- // called at this stage tdoc content handler stuff is not set up
-- // so it fails
--
-- String sLibrary( RTL_CONSTASCII_USTRINGPARAM("Standard"));
-- BasicManager* pBasicMgr = pShell-> GetBasicManager();
-- if ( pBasicMgr )
-- {
-- if ( pBasicMgr->GetName().Len() )
-- sLibrary = pBasicMgr->GetName();
-- StarBASIC* pBasic = pBasicMgr->GetLib( sLibrary );
-- if ( !pBasic )
-- {
-- USHORT nId = pBasicMgr->GetLibId( sLibrary );
-- pBasicMgr->LoadLib( nId );
-- pBasic = pBasicMgr->GetLib( sLibrary );
-- }
-- if ( pBasic )
-- {
-- if ( sMod.Len() ) // we wish to find the macro is a specific module
-- {
-- SbModule* pModule = pBasic->FindModule( sMod );
-- if ( pModule )
-- {
-- SbxArray* pMethods = pModule->GetMethods();
-- if ( pMethods )
-- {
-- SbMethod* pMethod = static_cast< SbMethod* >( pMethods->Find( sMacro, SbxCLASS_METHOD ) );
-- if ( pMethod )
-- {
-- sFullName = sMacro;
-- sFullName.Insert( '.', 0 ).Insert( sMod, 0 ).Insert( '.', 0 ).Insert( sLibrary, 0 );
-- }
-- }
-- }
-- }
-- else if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pBasic->Find( sMacro, SbxCLASS_METHOD ) ) )
-- {
-- if( SbModule* pModule = pMethod->GetModule() )
-- {
-- sFullName = sMacro;
-- sFullName.Insert( '.', 0 ).Insert( pModule->GetName(), 0).Insert( '.', 0 ).Insert( sLibrary, 0 );
-- }
-- }
--
-- }
-- }
-- return sFullName;
-+ SfxObjectShell* pFoundShell=NULL;
-+ SfxObjectShell* pShell = SfxObjectShell::GetFirst();
-+ INetURLObject aObj;
-+ aObj.SetURL( sMacroURLOrPath );
-+ bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
-+ rtl::OUString aURL;
-+ if ( bIsURL )
-+ aURL = sMacroURLOrPath;
-+ else
-+ {
-+ osl::FileBase::getFileURLFromSystemPath( sMacroURLOrPath, aURL );
-+ aObj.SetURL( aURL );
-+ }
-+ OSL_TRACE("Trying to find shell for url %s", rtl::OUStringToOString( aURL, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ while ( pShell )
-+ {
-+
-+ uno::Reference< frame::XModel > xModel = pShell->GetModel();
-+ // are we searching for a template? if so we have to cater for the
-+ // fact that in openoffice a document opened from a template is always
-+ // a new document :/
-+ if ( xModel.is() )
-+ {
-+ OSL_TRACE("shell 0x%x has model with url %s and we look for %s", pShell
-+ , rtl::OUStringToOString( xModel->getURL(), RTL_TEXTENCODING_UTF8 ).getStr()
-+ , rtl::OUStringToOString( aURL, RTL_TEXTENCODING_UTF8 ).getStr()
-+ );
-+ if ( sMacroURLOrPath.endsWithIgnoreAsciiCaseAsciiL( ".dot", 4 ) )
-+ {
-+ uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( xModel, uno::UNO_QUERY );
-+ if( xDocInfoSupp.is() )
-+ {
-+ uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW );
-+ uno::Reference< document::XDocumentProperties > xDocProps( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW );
-+ rtl::OUString sCurrName = xDocProps->getTemplateName();
-+ if( sMacroURLOrPath.lastIndexOf( sCurrName ) >= 0 )
-+ {
-+ pFoundShell = pShell;
-+ break;
-+ }
-+ }
-+ }
-+ else
-+ {
-+ if ( aURL.equals( xModel->getURL() ) )
-+ {
-+ pFoundShell = pShell;
-+ break;
-+ }
-+ }
-+ }
-+ pShell = SfxObjectShell::GetNext( *pShell );
-+ }
-+ return pFoundShell;
- }
-
--// Treat the args as possible inouts ( convertion at bottom of method )
--sal_Bool executeMacro( SfxObjectShell* pShell, const String& sMacroName, uno::Sequence< uno::Any >& aArgs, uno::Any& aRet )
-+// sMod can be empty ( but we really need the library to search in )
-+// if sMod is empty and a macro is found then sMod is updated
-+bool hasMacro( SfxObjectShell* pShell, const String& sLibrary, String& sMod, const String& sMacro )
-+{
-+ bool bFound = false;
-+ if ( sLibrary.Len() && sMacro.Len() )
-+ {
-+ OSL_TRACE("** Searching for %s.%s in library %s"
-+ ,rtl::OUStringToOString( sMod, RTL_TEXTENCODING_UTF8 ).getStr()
-+ ,rtl::OUStringToOString( sMacro, RTL_TEXTENCODING_UTF8 ).getStr()
-+ ,rtl::OUStringToOString( sLibrary, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ BasicManager* pBasicMgr = pShell-> GetBasicManager();
-+ if ( pBasicMgr )
-+ {
-+ StarBASIC* pBasic = pBasicMgr->GetLib( sLibrary );
-+ if ( !pBasic )
-+ {
-+ USHORT nId = pBasicMgr->GetLibId( sLibrary );
-+ pBasicMgr->LoadLib( nId );
-+ pBasic = pBasicMgr->GetLib( sLibrary );
-+ }
-+ if ( pBasic )
-+ {
-+ if ( sMod.Len() ) // we wish to find the macro is a specific module
-+ {
-+ SbModule* pModule = pBasic->FindModule( sMod );
-+ if ( pModule )
-+ {
-+ SbxArray* pMethods = pModule->GetMethods();
-+ if ( pMethods )
-+ {
-+ SbMethod* pMethod = static_cast< SbMethod* >( pMethods->Find( sMacro, SbxCLASS_METHOD ) );
-+ if ( pMethod )
-+ bFound = true;
-+ }
-+ }
-+ }
-+ else if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pBasic->Find( sMacro, SbxCLASS_METHOD ) ) )
-+ {
-+ if( SbModule* pModule = pMethod->GetModule() )
-+ {
-+ sMod = pModule->GetName();
-+ bFound = true;
-+ }
-+ }
-+ }
-+ }
-+ }
-+ return bFound;
-+}
-+void parseMacro( const rtl::OUString& sMacro, String& sContainer, String& sModule, String& sProcedure )
- {
-- // until ObjectModules ( and persisting of codenames ) is supported, if this is a
-- // document saved from XL then we won't be able to determine the codename for the Workbook
-- // Module, so... we have no choice but to search all modules for the moment, thus the macro
-- // passed in should be the fully specified name.
-- rtl::OUString sUrl = makeMacroURL( sMacroName );
-- uno::Sequence< sal_Int16 > aOutArgsIndex;
-- uno::Sequence< uno::Any > aOutArgs;
-- ErrCode nErr = pShell->CallXScript( sUrl, aArgs, aRet,
-- aOutArgsIndex, aOutArgs, sal_False );
--
-- // Script Executed?
-- if ( nErr != ERRCODE_NONE )
-- return sal_False;
--
-- sal_Int32 nLen = aOutArgs.getLength();
-- // convert any out params to seem like they were inouts
-- if ( nLen )
-- {
-- for ( sal_Int32 index=0; index < nLen; ++index )
-- {
-- sal_Int32 nOutIndex = aOutArgsIndex[ index ];
-- aArgs[ nOutIndex ] = aOutArgs[ index ];
-- }
--
-- }
-- return sal_True;
-+ sal_Int32 nMacroDot = sMacro.lastIndexOf( '.' );
-+
-+ if ( nMacroDot != -1 )
-+ {
-+ sProcedure = sMacro.copy( nMacroDot + 1 );
-+
-+ sal_Int32 nContainerDot = sMacro.lastIndexOf( '.', nMacroDot - 1 );
-+ if ( nContainerDot != -1 )
-+ {
-+ sModule = sMacro.copy( nContainerDot + 1, nMacroDot - nContainerDot - 1 );
-+ sContainer = sMacro.copy( 0, nContainerDot );
-+ }
-+ else
-+ sModule = sMacro.copy( 0, nMacroDot );
-+ }
-+ else
-+ sProcedure = sMacro;
-+}
-+
-+VBAMacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const rtl::OUString& MacroName, bool bSearchGlobalTemplates )
-+{
-+ VBAMacroResolvedInfo aRes;
-+ if ( !pShell )
-+ return aRes;
-+ aRes.SetMacroDocContext( pShell );
-+ // parse the macro name
-+ sal_Int32 nDocSepIndex = MacroName.indexOfAsciiL( "!", 1 );
-+ String sMacroUrl = MacroName;
-+
-+ String sContainer;
-+ String sModule;
-+ String sProcedure;
-+
-+ if( nDocSepIndex > 0 )
-+ {
-+ // macro specified by document name
-+ // find document shell for document name and call ourselves
-+ // recursively
-+
-+ // assume for now that the document name is *this* document
-+ String sDocUrlOrPath = MacroName.copy( 0, nDocSepIndex );
-+ sMacroUrl = MacroName.copy( nDocSepIndex + 1 );
-+ OSL_TRACE("doc search, current shell is 0x%x", pShell );
-+ SfxObjectShell* pFoundShell = findShellForUrl( sDocUrlOrPath );
-+ OSL_TRACE("doc search, after find, found shell is 0x%x", pFoundShell );
-+ aRes = resolveVBAMacro( pFoundShell, sMacroUrl );
-+ }
-+ else
-+ {
-+ // macro is contained in 'this' document ( or code imported from a template
-+ // where that template is a global template or perhaps the template this
-+ // document is created from )
-+
-+ // macro format = Container.Module.Procedure
-+ parseMacro( MacroName, sContainer, sModule, sProcedure );
-+ uno::Reference< lang::XMultiServiceFactory> xSF( pShell->GetModel(), uno::UNO_QUERY);
-+ uno::Reference< container::XNameContainer > xPrjNameCache;
-+ if ( xSF.is() )
-+ xPrjNameCache.set( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAProjectNameProvider" ) ) ), uno::UNO_QUERY );
-+
-+ std::vector< rtl::OUString > sSearchList;
-+
-+ if ( sContainer.Len() > 0 )
-+ {
-+ // get the Project associated with the Container
-+ if ( xPrjNameCache.is() )
-+ {
-+ if ( xPrjNameCache->hasByName( sContainer ) )
-+ {
-+ rtl::OUString sProject;
-+ xPrjNameCache->getByName( sContainer ) >>= sProject;
-+ sContainer = sProject;
-+ }
-+ }
-+ sSearchList.push_back( sContainer ); // First Lib to search
-+ }
-+ else
-+ {
-+ // Ok, if we have no Container specified then we need to search them in order, this document, template this document created from, global templates,
-+ // get the name of Project/Library for 'this' document
-+ rtl::OUString sThisProject;
-+ BasicManager* pBasicMgr = pShell-> GetBasicManager();
-+ if ( pBasicMgr )
-+ {
-+ if ( pBasicMgr->GetName().Len() )
-+ sThisProject = pBasicMgr->GetName();
-+ else // cater for the case where VBA is not enabled
-+ sThisProject = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Standard") );
-+ }
-+ sSearchList.push_back( sThisProject ); // First Lib to search
-+ if ( xPrjNameCache.is() )
-+ {
-+ // is this document created from a template?
-+ uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( pShell->GetModel(), uno::UNO_QUERY_THROW );
-+ uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW );
-+ uno::Reference< document::XDocumentProperties > xDocProps( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW );
-+
-+ rtl::OUString sCreatedFrom = xDocProps->getTemplateURL();
-+ if ( sCreatedFrom.getLength() )
-+ {
-+ INetURLObject aObj;
-+ aObj.SetURL( sCreatedFrom );
-+ bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
-+ rtl::OUString aURL;
-+ if ( bIsURL )
-+ aURL = sCreatedFrom;
-+ else
-+ {
-+ osl::FileBase::getFileURLFromSystemPath( sCreatedFrom, aURL );
-+ aObj.SetURL( aURL );
-+ }
-+ sCreatedFrom = aObj.GetLastName();
-+ }
-+
-+ sal_Int32 nIndex = sCreatedFrom.lastIndexOf( '.' );
-+ if ( nIndex != -1 )
-+ sCreatedFrom = sCreatedFrom.copy( 0, nIndex );
-+
-+ rtl::OUString sPrj;
-+ if ( sCreatedFrom.getLength() && xPrjNameCache->hasByName( sCreatedFrom ) )
-+ {
-+ xPrjNameCache->getByName( sCreatedFrom ) >>= sPrj;
-+ // Make sure we don't double up with this project
-+ if ( !sPrj.equals( sThisProject ) )
-+ sSearchList.push_back( sPrj );
-+ }
-+
-+ // get list of global template Names
-+ uno::Sequence< rtl::OUString > sTemplateNames = xPrjNameCache->getElementNames();
-+ sal_Int32 nLen = sTemplateNames.getLength();
-+ for ( sal_Int32 index = 0; ( bSearchGlobalTemplates && index < nLen ); ++index )
-+ {
-+
-+ if ( !sCreatedFrom.equals( sTemplateNames[ index ] ) )
-+ {
-+ if ( xPrjNameCache->hasByName( sTemplateNames[ index ] ) )
-+ {
-+ xPrjNameCache->getByName( sTemplateNames[ index ] ) >>= sPrj;
-+ // Make sure we don't double up with this project
-+ if ( !sPrj.equals( sThisProject ) )
-+ sSearchList.push_back( sPrj );
-+ }
-+ }
-+
-+ }
-+ }
-+ }
-+ std::vector< rtl::OUString >::iterator it_end = sSearchList.end();
-+ for ( std::vector< rtl::OUString >::iterator it = sSearchList.begin(); it != it_end; ++it )
-+ {
-+ bool bRes = hasMacro( pShell, *it, sModule, sProcedure );
-+ if ( bRes )
-+ {
-+ aRes.SetResolved( true );
-+ aRes.SetMacroDocContext( pShell );
-+ sContainer = *it;
-+ break;
-+ }
-+ }
-+ }
-+ aRes.SetResolvedMacro( sProcedure.Insert( '.', 0 ).Insert( sModule, 0).Insert( '.', 0 ).Insert( sContainer, 0 ) );
-+
-+ return aRes;
- }
-
-+// Treat the args as possible inouts ( convertion at bottom of method )
-+sal_Bool executeMacro( SfxObjectShell* pShell, const String& sMacroName, uno::Sequence< uno::Any >& aArgs, uno::Any& /*aRet*/, const uno::Any& aCaller )
-+{
-+ sal_Bool bRes = sal_False;
-+ if ( !pShell )
-+ return bRes;
-+ rtl::OUString sUrl = makeMacroURL( sMacroName );
-+
-+ uno::Sequence< sal_Int16 > aOutArgsIndex;
-+ uno::Sequence< uno::Any > aOutArgs;
-+
-+ try
-+ {
-+ uno::Reference< script::provider::XScriptProvider > xScriptProvider;
-+ uno::Reference< script::provider::XScriptProviderSupplier > xSPS( pShell->GetModel(), uno::UNO_QUERY_THROW );
-+
-+ xScriptProvider.set( xSPS->getScriptProvider(), uno::UNO_QUERY_THROW );
-+
-+ uno::Reference< script::provider::XScript > xScript( xScriptProvider->getScript( sUrl ), uno::UNO_QUERY_THROW );
-+
-+ if ( aCaller.hasValue() )
-+ {
-+ uno::Reference< beans::XPropertySet > xProps( xScript, uno::UNO_QUERY );
-+ if ( xProps.is() )
-+ {
-+ uno::Sequence< uno::Any > aCallerHack(1);
-+ aCallerHack[ 0 ] = aCaller;
-+ xProps->setPropertyValue( rtl::OUString::createFromAscii( "Caller" ), uno::makeAny( aCallerHack ) );
-+ }
-+ }
-+
-+
-+ xScript->invoke( aArgs, aOutArgsIndex, aOutArgs );
-+
-+ sal_Int32 nLen = aOutArgs.getLength();
-+ // convert any out params to seem like they were inouts
-+ if ( nLen )
-+ {
-+ for ( sal_Int32 index=0; index < nLen; ++index )
-+ {
-+ sal_Int32 nOutIndex = aOutArgsIndex[ index ];
-+ aArgs[ nOutIndex ] = aOutArgs[ index ];
-+ }
-+ }
-+
-+ bRes = sal_True;
-+ }
-+ catch ( uno::Exception& e )
-+ {
-+ bRes = sal_False;
-+ }
-+ return bRes;
-+}
- } } // vba // ooo
---- sw/inc/doc.hxx
-+++ sw/inc/doc.hxx
-@@ -417,6 +417,7 @@ class SW_DLLPUBLIC SwDoc :
-
- // table of forbidden characters of this document
- vos::ORef<SvxForbiddenCharactersTable> xForbiddenCharsTable;
-+ com::sun::star::uno::Reference<com::sun::star::container::XNameContainer> m_xTemplateToProjectCache;
-
- // --> OD 2007-10-26 #i83479#
- public:
-@@ -2127,6 +2128,8 @@ public:
- {
- return n32DummyCompatabilityOptions2;
- }
-+ void SetVBATemplateToProjectCache( com::sun::star::uno::Reference< com::sun::star::container::XNameContainer >& xCache ) { m_xTemplateToProjectCache = xCache; };
-+ com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > GetVBATemplateToProjectCache() { return m_xTemplateToProjectCache; };
-
- ::sfx2::IXmlIdRegistry& GetXmlIdRegistry();
- SwDoc* CreateCopy() const;
-diff --git sw/inc/unocoll.hxx sw/inc/unocoll.hxx
-index e9da66c..2c6bd02 100644
---- sw/inc/unocoll.hxx
-+++ sw/inc/unocoll.hxx
-@@ -197,8 +197,9 @@ class SwUnoCollection
- #define SW_SERVICE_TYPE_FORMFIELDMARK 108
- #define SW_SERVICE_VBAOBJECTPROVIDER 109
- #define SW_SERVICE_VBACODENAMEPROVIDER 110
-+#define SW_SERVICE_VBAPROJECTNAMEPROVIDER 111
-
--#define SW_SERVICE_LAST SW_SERVICE_VBACODENAMEPROVIDER
-+#define SW_SERVICE_LAST SW_SERVICE_VBAPROJECTNAMEPROVIDER
-
- #define SW_SERVICE_INVALID USHRT_MAX
-
-diff --git sw/source/core/unocore/unocoll.cxx sw/source/core/unocore/unocoll.cxx
-index 54797da..e3cded8 100644
---- sw/source/core/unocore/unocoll.cxx
-+++ sw/source/core/unocore/unocoll.cxx
-@@ -163,6 +163,71 @@ public:
- }
- };
-
-+typedef std::hash_map< rtl::OUString, rtl::OUString, rtl::OUStringHash > StringHashMap;
-+class SwVbaProjectNameProvider : public ::cppu::WeakImplHelper1< container::XNameContainer >
-+{
-+ SwDocShell* mpDocShell;
-+ StringHashMap mTemplateToProject;
-+public:
-+ SwVbaProjectNameProvider( SwDocShell* pDocShell ) : mpDocShell( pDocShell )
-+ {
-+ }
-+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException )
-+ {
-+ return ( mTemplateToProject.find( aName ) != mTemplateToProject.end() );
-+ }
-+ virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
-+ {
-+ if ( !hasByName( aName ) )
-+ throw container::NoSuchElementException();
-+ return uno::makeAny( mTemplateToProject.find( aName )->second );
-+ }
-+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (::com::sun::star::uno::RuntimeException)
-+ {
-+ uno::Sequence< rtl::OUString > aElements( mTemplateToProject.size() );
-+ StringHashMap::iterator it_end = mTemplateToProject.end();
-+ sal_Int32 index = 0;
-+ for ( StringHashMap::iterator it = mTemplateToProject.begin(); it != it_end; ++it, ++index )
-+ aElements[ index ] = it->first;
-+ return aElements;
-+ }
-+
-+ virtual void SAL_CALL insertByName( const rtl::OUString& aName, const uno::Any& aElement ) throw ( com::sun::star::lang::IllegalArgumentException, com::sun::star::container::ElementExistException, com::sun::star::lang::WrappedTargetException )
-+ {
-+
-+ rtl::OUString sProjectName;
-+ aElement >>= sProjectName;
-+ OSL_TRACE("** Template cache inserting template name %s with project %s"
-+ , rtl::OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr()
-+ , rtl::OUStringToOString( sProjectName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ mTemplateToProject[ aName ] = sProjectName;
-+ }
-+
-+ virtual void SAL_CALL removeByName( const rtl::OUString& Name ) throw ( com::sun::star::container::NoSuchElementException, com::sun::star::lang::WrappedTargetException )
-+ {
-+ if ( !hasByName( Name ) )
-+ throw container::NoSuchElementException();
-+ mTemplateToProject.erase( Name );
-+ }
-+ virtual void SAL_CALL replaceByName( const rtl::OUString& aName, const uno::Any& aElement ) throw ( com::sun::star::lang::IllegalArgumentException, com::sun::star::container::NoSuchElementException, com::sun::star::lang::WrappedTargetException )
-+ {
-+ if ( !hasByName( aName ) )
-+ throw container::NoSuchElementException();
-+ insertByName( aName, aElement ); // insert will overwrite
-+ }
-+ // XElemenAccess
-+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException)
-+ {
-+ return ::getCppuType((const rtl::OUString*)0);
-+ }
-+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException )
-+ {
-+
-+ return ( mTemplateToProject.size() > 0 );
-+ }
-+
-+};
-+
- class SwVbaObjectForCodeNameProvider : public ::cppu::WeakImplHelper1< container::XNameAccess >
- {
- SwDocShell* mpDocShell;
-@@ -325,6 +390,7 @@ const ProvNamesId_Type __FAR_DATA aProvNamesId[] =
- { "com.sun.star.chart2.data.DataProvider", SW_SERVICE_CHART2_DATA_PROVIDER },
- { "ooo.vba.VBAObjectModuleObjectProvider", SW_SERVICE_VBAOBJECTPROVIDER },
- { "ooo.vba.VBACodeNameProvider", SW_SERVICE_VBACODENAMEPROVIDER },
-+ { "ooo.vba.VBAProjectNameProvider", SW_SERVICE_VBAPROJECTNAMEPROVIDER },
-
- // case-correct versions of the service names (see #i67811)
- { CSS_TEXT_TEXTFIELD_DATE_TIME, SW_SERVICE_FIELDTYPE_DATETIME },
-@@ -517,6 +583,18 @@ uno::Reference< uno::XInterface > SwXServiceProvider::MakeInstance(sal_uInt16
- xRet = (cppu::OWeakObject*)pObjProv;
- }
- break;
-+ case SW_SERVICE_VBAPROJECTNAMEPROVIDER :
-+ {
-+ uno::Reference< container::XNameContainer > xProjProv = pDoc->GetVBATemplateToProjectCache();
-+ if ( !xProjProv.is() )
-+ {
-+ xProjProv = new SwVbaProjectNameProvider( pDoc->GetDocShell() );
-+ pDoc->SetVBATemplateToProjectCache( xProjProv );
-+ }
-+ //xRet = (cppu::OWeakObject*)xProjProv;
-+ xRet = xProjProv;
-+ }
-+ break;
- case SW_SERVICE_TYPE_FOOTNOTE :
- xRet = (cppu::OWeakObject*)new SwXFootnote(sal_False);
- break;
-diff --git sw/source/filter/ww8/ww8par.cxx sw/source/filter/ww8/ww8par.cxx
-index 90efd7b..e1366a2 100644
---- sw/source/filter/ww8/ww8par.cxx
-+++ sw/source/filter/ww8/ww8par.cxx
-@@ -161,7 +161,7 @@ using namespace nsHdFtFlags;
- #include <svtools/pathoptions.hxx>
- #include <com/sun/star/ucb/XSimpleFileAccess.hpp>
-
--const static String sModule( RTL_CONSTASCII_USTRINGPARAM("ThisDocument"));
-+const static String sThisDocument( RTL_CONSTASCII_USTRINGPARAM("ThisDocument"));
-
- struct DocEventNameTable
- {
-@@ -191,10 +191,10 @@ bool registerDocEvent( SfxObjectShell* pShell )
- for( const DocEventNameTable* pTable = aEventNameTable; pTable->sEventName != NULL; pTable++ )
- {
- rtl::OUString sEvt = rtl::OUString::createFromAscii( pTable->sEventName );
-- rtl::OUString sMacroName = rtl::OUString::createFromAscii( pTable->sMacroName );
-+ String sMacroName = String::CreateFromAscii( pTable->sMacroName ).Insert( '.', 0 ).Insert( sThisDocument, 0);
- // fail to search the macro if the module is not specified.
-- String sFullPath = ooo::vba::findVBAMacro( pShell, sModule, sMacroName );
-- if( sFullPath.Len() == 0 )
-+ ooo::vba::VBAMacroResolvedInfo aMacroInfo = ooo::vba::resolveVBAMacro( pShell, sMacroName );
-+ if( !aMacroInfo.IsResolved() )
- continue;
-
- uno::Sequence< beans::PropertyValue > aEvents;
-@@ -203,7 +203,7 @@ bool registerDocEvent( SfxObjectShell* pShell )
- aOpenEvt[ 0 ].Name = sEvtType;
- aOpenEvt[ 0 ].Value = uno::makeAny(sScript);
- aOpenEvt[ 1 ].Name = sScript;
-- rtl::OUString sUrl = ooo::vba::makeMacroURL( sFullPath );
-+ rtl::OUString sUrl = ooo::vba::makeMacroURL( aMacroInfo.ResolvedMacro() );
- aOpenEvt[ 1 ].Value = uno::makeAny(sUrl);
- sal_Int32 nPos = aEvents.getLength();
-
-@@ -3834,6 +3834,39 @@ void SwWW8ImplReader::ReadDocInfo()
- }
- }
-
-+void lcl_createTemplateToProjectEntry( const uno::Reference< container::XNameContainer >& xPrjNameCache, const rtl::OUString& sTemplatePathOrURL, const rtl::OUString& sVBAProjName )
-+{
-+ if ( xPrjNameCache.is() )
-+ {
-+ INetURLObject aObj;
-+ aObj.SetURL( sTemplatePathOrURL );
-+ bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
-+ rtl::OUString aURL;
-+ if ( bIsURL )
-+ aURL = sTemplatePathOrURL;
-+ else
-+ {
-+ osl::FileBase::getFileURLFromSystemPath( sTemplatePathOrURL, aURL );
-+ aObj.SetURL( aURL );
-+ }
-+ try
-+ {
-+ rtl::OUString templateNameWithExt = aObj.GetLastName();
-+ rtl::OUString templateName;
-+ sal_Int32 nIndex = templateNameWithExt.lastIndexOf( '.' );
-+ //xPrjNameCache->insertByName( templateNameWithExt, uno::makeAny( sVBAProjName ) );
-+ if ( nIndex != -1 )
-+ {
-+ templateName = templateNameWithExt.copy( 0, nIndex );
-+ xPrjNameCache->insertByName( templateName, uno::makeAny( sVBAProjName ) );
-+ }
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+ }
-+}
-+
- class WW8Customizations
- {
- SvStream* mpTableStream;
-@@ -3863,7 +3896,7 @@ bool WW8Customizations::Import( SwDocShell* pShell )
- return aTCG.ImportCustomToolBar( *pShell );
- }
-
--bool SwWW8ImplReader::ReadGlobalTemplateSettings()
-+bool SwWW8ImplReader::ReadGlobalTemplateSettings( const rtl::OUString& sCreatedFrom, const uno::Reference< container::XNameContainer >& xPrjNameCache )
- {
- SvtPathOptions aPathOpt;
- String aAddinPath = aPathOpt.GetAddinPath();
-@@ -3878,11 +3911,6 @@ bool SwWW8ImplReader::ReadGlobalTemplateSettings()
- sal_Int32 nEntries = sGlobalTemplates.getLength();
- bool bRes = true;
- const SvtFilterOptions* pVBAFlags = SvtFilterOptions::Get();
-- uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( mpDocShell->GetModel(), uno::UNO_QUERY_THROW );
-- uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW );
-- uno::Reference< document::XDocumentProperties > xDocProps( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW );
--
-- rtl::OUString sCreatedFrom = xDocProps->getTemplateURL();
- for ( sal_Int32 i=0; i<nEntries; ++i )
- {
- INetURLObject aObj;
-@@ -3897,13 +3925,17 @@ bool SwWW8ImplReader::ReadGlobalTemplateSettings()
- continue; // don't try and read the same document as ourselves
-
- SotStorageRef rRoot = new SotStorage( aURL, STREAM_STD_READWRITE, STORAGE_TRANSACTED );
-+
- // Read Macro Projects
- SvxImportMSVBasic aVBasic(*mpDocShell, *rRoot,
- pVBAFlags->IsLoadWordBasicCode(),
- pVBAFlags->IsLoadWordBasicStorage() );
-+
-+
- String s1(CREATE_CONST_ASC("Macros"));
- String s2(CREATE_CONST_ASC("VBA"));
- int nRet = aVBasic.Import( s1, s2, ! pVBAFlags->IsLoadWordBasicCode() );
-+ lcl_createTemplateToProjectEntry( xPrjNameCache, aURL, aVBasic.GetVBAProjectName() );
- // Read toolbars & menus
- SvStorageStreamRef refMainStream = rRoot->OpenSotStream( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WordDocument") ) );
- refMainStream->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN);
-@@ -4183,10 +4215,20 @@ ULONG SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
- // dissable below for 3.1 at the moment, 'cause it's kinda immature
- // similarly the project reference in svx/source/msvba
- #if 1
-+ uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( mpDocShell->GetModel(), uno::UNO_QUERY_THROW );
-+ uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW );
-+ uno::Reference< document::XDocumentProperties > xDocProps( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW );
-+
-+ rtl::OUString sCreatedFrom = xDocProps->getTemplateURL();
-+ uno::Reference< container::XNameContainer > xPrjNameCache;
-+ uno::Reference< lang::XMultiServiceFactory> xSF(mpDocShell->GetModel(), uno::UNO_QUERY);
-+ if ( xSF.is() )
-+ xPrjNameCache.set( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAProjectNameProvider" ) ) ), uno::UNO_QUERY );
-+
- // Read Global templates
-- ReadGlobalTemplateSettings();
-+ ReadGlobalTemplateSettings( sCreatedFrom, xPrjNameCache );
- #endif
-- // Create and insert Excel vba Globals
-+ // Create and insert Word vba Globals
- uno::Any aGlobs;
- aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstance( ::rtl::OUString::createFromAscii( "ooo.vba.word.Globals") );
- mpDocShell->GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
-@@ -4200,6 +4242,7 @@ ULONG SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
- // dissable below for 3.1 at the moment, 'cause it's kinda immature
- // similarly the project reference in svx/source/msvba
- #if 1
-+ lcl_createTemplateToProjectEntry( xPrjNameCache, sCreatedFrom, aVBasic.GetVBAProjectName() );
- WW8Customizations aCustomisations( pTableStream, *pWwFib );
- aCustomisations.Import( mpDocShell );
- #endif
-diff --git sw/source/filter/ww8/ww8par.hxx sw/source/filter/ww8/ww8par.hxx
-index 89ab0d6..9389568 100644
---- sw/source/filter/ww8/ww8par.hxx
-+++ sw/source/filter/ww8/ww8par.hxx
-@@ -1415,7 +1415,7 @@ private:
- // determine object attribute "Layout in Table Cell"
- bool IsObjectLayoutInTableCell( const UINT32 nLayoutInTableCell ) const;
- // <--
-- bool ReadGlobalTemplateSettings();
-+ bool ReadGlobalTemplateSettings( const rtl::OUString& sCreatedFrom, const com::sun::star::uno::Reference< com::sun::star::container::XNameContainer >& xPrjNameMap );
- //No copying
- SwWW8ImplReader(const SwWW8ImplReader &);
- SwWW8ImplReader& operator=(const SwWW8ImplReader&);
-diff --git sw/source/ui/uno/unotxdoc.cxx sw/source/ui/uno/unotxdoc.cxx
-index 0aacbda..9bc3d85 100644
---- sw/source/ui/uno/unotxdoc.cxx
-+++ sw/source/ui/uno/unotxdoc.cxx
-@@ -225,6 +225,12 @@ sal_Int64 SAL_CALL SwXTextDocument::getSomething( const Sequence< sal_Int8 >& rI
- {
- return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this ));
- }
-+ if( rId.getLength() == 16
-+ && 0 == rtl_compareMemory( SfxObjectShell::getUnoTunnelId().getConstArray(),
-+ rId.getConstArray(), 16 ) )
-+ {
-+ return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(pDocShell ));
-+ }
-
- sal_Int64 nRet = SfxBaseModel::getSomething( rId );
- if ( nRet )
-diff --git vbahelper/inc/vbahelper/vbahelper.hxx vbahelper/inc/vbahelper/vbahelper.hxx
-index 1849437..77eb2a3 100644
---- vbahelper/inc/vbahelper/vbahelper.hxx
-+++ vbahelper/inc/vbahelper/vbahelper.hxx
-@@ -63,6 +63,7 @@ namespace ooo
- throw css::lang::IllegalArgumentException();
- return aSomething;
- }
-+ VBAHELPER_DLLPUBLIC SfxObjectShell* getSfxObjShell( const css::uno::Reference< css::frame::XModel >& xModel ) throw ( css::uno::RuntimeException);
- VBAHELPER_DLLPUBLIC css::uno::Reference< css::uno::XInterface > createVBAUnoAPIService( SfxObjectShell* pShell, const sal_Char* _pAsciiName ) throw (css::uno::RuntimeException);
- VBAHELPER_DLLPUBLIC css::uno::Reference< css::uno::XInterface > createVBAUnoAPIServiceWithArgs( SfxObjectShell* pShell, const sal_Char* _pAsciiName, const css::uno::Sequence< css::uno::Any >& aArgs ) throw (css::uno::RuntimeException);
- VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getCurrentDocument() throw (css::uno::RuntimeException);
-diff --git vbahelper/source/vbahelper/vbaapplicationbase.cxx vbahelper/source/vbahelper/vbaapplicationbase.cxx
-index a424b35..0d9f52e 100644
---- vbahelper/source/vbahelper/vbaapplicationbase.cxx
-+++ vbahelper/source/vbahelper/vbaapplicationbase.cxx
-@@ -134,234 +134,39 @@ VbaApplicationBase::getVersion() throw (uno::RuntimeException)
-
- void SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, const uno::Any& varg1, const uno::Any& varg2, const uno::Any& varg3, const uno::Any& varg4, const uno::Any& varg5, const uno::Any& varg6, const uno::Any& varg7, const uno::Any& varg8, const uno::Any& varg9, const uno::Any& varg10, const uno::Any& varg11, const uno::Any& varg12, const uno::Any& varg13, const uno::Any& varg14, const uno::Any& varg15, const uno::Any& varg16, const uno::Any& varg17, const uno::Any& varg18, const uno::Any& varg19, const uno::Any& varg20, const uno::Any& varg21, const uno::Any& varg22, const uno::Any& varg23, const uno::Any& varg24, const uno::Any& varg25, const uno::Any& varg26, const uno::Any& varg27, const uno::Any& varg28, const uno::Any& varg29, const uno::Any& varg30 ) throw (uno::RuntimeException)
- {
-- // parse the macro name
-- sal_Int32 nDocSepIndex = MacroName.indexOfAsciiL( "!", 1 );
-- String sMacroUrl = MacroName;
-- uno::Reference< frame::XModel > xModel;
-- if( nDocSepIndex > 0 )
-+ VBAMacroResolvedInfo aMacroInfo = resolveVBAMacro( GetDocShell( getCurrentDocument() ), MacroName );
-+ if( aMacroInfo.IsResolved() )
- {
-- rtl::OUString sTemplate = MacroName.copy( 0, nDocSepIndex );
-- OSL_TRACE("VbaApplicationBase::Run, template name: %s", rtl::OUStringToOString( sTemplate, RTL_TEXTENCODING_UTF8 ).getStr() );
-- sMacroUrl = MacroName.copy( nDocSepIndex + 1 );
-- OSL_TRACE("VbaApplicationBase::Run, macro name: %s", rtl::OUStringToOString( sMacroUrl, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ // handle the arguments
-+ const uno::Any* aArgsPtrArray[] = { &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8, &varg9, &varg10, &varg11, &varg12, &varg13, &varg14, &varg15, &varg16, &varg17, &varg18, &varg19, &varg20, &varg21, &varg22, &varg23, &varg24, &varg25, &varg26, &varg27, &varg28, &varg29, &varg30 };
-
-- // get the template model
-- uno::Reference< lang::XMultiComponentFactory > xSMgr( mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
-+ int nArg = sizeof( aArgsPtrArray ) / sizeof( aArgsPtrArray[0] );
-+ uno::Sequence< uno::Any > aArgs( nArg );
-
-- uno::Reference< frame::XDesktop > xDesktop
-- (xSMgr->createInstanceWithContext(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"), mxContext), uno::UNO_QUERY_THROW );
-- uno::Reference< container::XEnumeration > mxComponents = xDesktop->getComponents()->createEnumeration();
-- sal_Int32 nCount = 0;
-- while( mxComponents->hasMoreElements() )
-- {
-- uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( mxComponents->nextElement(), uno::UNO_QUERY );
-- if( xDocInfoSupp.is() )
-- {
-- uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW );
-- uno::Reference< document::XDocumentProperties > xDocProps( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW );
-- rtl::OUString sCurrName = xDocProps->getTemplateName();
-- OSL_TRACE("VbaApplicationBase::Run, current template %d name: %s", ++nCount, rtl::OUStringToOString( sCurrName, RTL_TEXTENCODING_UTF8 ).getStr() );
-- // FIXME: should be check the full path of the template
-- if( sTemplate.lastIndexOf( sCurrName ) >= 0 )
-- {
-- xModel.set( xDocInfoSupp, uno::UNO_QUERY_THROW );
-- break;
-- }
-- }
-+ const uno::Any** pArg = aArgsPtrArray;
-+ const uno::Any** pArgEnd = ( aArgsPtrArray + nArg );
-+
-+ sal_Int32 nLastArgWithValue = 0;
-+ sal_Int32 nArgProcessed = 0;
-+
-+ for ( ; pArg != pArgEnd; ++pArg, ++nArgProcessed )
-+ {
-+ aArgs[ nArgProcessed ] = **pArg;
-+ if( (*pArg)->hasValue() )
-+ nLastArgWithValue = nArgProcessed;
- }
-- }
-- else
-- {
-- xModel = getCurrentDocument();
-- }
-
-- if( !xModel.is() )
-- {
-- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Fail to find the template in Application.Run") ), uno::Reference< uno::XInterface >() );
-- }
-+ // resize array to position of last param with value
-+ aArgs.realloc( nArgProcessed + 1 );
-
-- String sMacro;
-- String sModule;
-- sal_Int32 nTokens = sMacroUrl.GetTokenCount( '.' );
-- xub_StrLen nToken = 0;
-- xub_StrLen nIndex = 0;
-- // only support ThisModule.ThisMacro
-- if( nTokens == 2 )
-- {
-- sModule = sMacroUrl.GetToken( nToken, '.', nIndex );
-- sMacro = sMacroUrl.GetToken( nToken, '.', nIndex );
-+ uno::Any aRet;
-+ uno::Any aDummyCaller;
-+ executeMacro( aMacroInfo.MacroDocContext(), aMacroInfo.ResolvedMacro(), aArgs, aRet, aDummyCaller );
- }
- else
- {
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("The macro doesn't exist") ), uno::Reference< uno::XInterface >() );
- }
--
-- SfxObjectShell* pShell = GetDocShell( xModel );
-- if( pShell )
-- {
-- sMacroUrl = findVBAMacro( pShell, sModule, sMacro );
-- if( sMacroUrl.Len() )
-- {
-- // handle the arguments
-- uno::Sequence< uno::Any > aArgs;
-- if( varg1.hasValue() )
-- {
-- aArgs.realloc( aArgs.getLength() + 1 );
-- aArgs[ aArgs.getLength() ] = varg1;
-- }
-- if( varg2.hasValue() )
-- {
-- aArgs.realloc( aArgs.getLength() + 1 );
-- aArgs[ aArgs.getLength() ] = varg2;
-- }
-- if( varg3.hasValue() )
-- {
-- aArgs.realloc( aArgs.getLength() + 1 );
-- aArgs[ aArgs.getLength() ] = varg3;
-- }
-- if( varg4.hasValue() )
-- {
-- aArgs.realloc( aArgs.getLength() + 1 );
-- aArgs[ aArgs.getLength() ] = varg4;
-- }
-- if( varg5.hasValue() )
-- {
-- aArgs.realloc( aArgs.getLength() + 1 );
-- aArgs[ aArgs.getLength() ] = varg5;
-- }
-- if( varg6.hasValue() )
-- {
-- aArgs.realloc( aArgs.getLength() + 1 );
-- aArgs[ aArgs.getLength() ] = varg6;
-- }
-- if( varg7.hasValue() )
-- {
-- aArgs.realloc( aArgs.getLength() + 1 );
-- aArgs[ aArgs.getLength() ] = varg7;
-- }
-- if( varg8.hasValue() )
-- {
-- aArgs.realloc( aArgs.getLength() + 1 );
-- aArgs[ aArgs.getLength() ] = varg8;
-- }
-- if( varg9.hasValue() )
-- {
-- aArgs.realloc( aArgs.getLength() + 1 );
-- aArgs[ aArgs.getLength() ] = varg9;
-- }
-- if( varg10.hasValue() )
-- {
-- aArgs.realloc( aArgs.getLength() + 1 );
-- aArgs[ aArgs.getLength() ] = varg10;
-- }
-- if( varg11.hasValue() )
-- {
-- aArgs.realloc( aArgs.getLength() + 1 );
-- aArgs[ aArgs.getLength() ] = varg11;
-- }
-- if( varg12.hasValue() )
-- {
-- aArgs.realloc( aArgs.getLength() + 1 );
-- aArgs[ aArgs.getLength() ] = varg12;
-- }
-- if( varg13.hasValue() )
-- {
-- aArgs.realloc( aArgs.getLength() + 1 );
-- aArgs[ aArgs.getLength() ] = varg13;
-- }
-- if( varg14.hasValue() )
-- {
-- aArgs.realloc( aArgs.getLength() + 1 );
-- aArgs[ aArgs.getLength() ] = varg14;
-- }
-- if( varg15.hasValue() )
-- {
-- aArgs.realloc( aArgs.getLength() + 1 );
-- aArgs[ aArgs.getLength() ] = varg15;
-- }
-- if( varg16.hasValue() )
-- {
-- aArgs.realloc( aArgs.getLength() + 1 );
-- aArgs[ aArgs.getLength() ] = varg16;
-- }
-- if( varg17.hasValue() )
-- {
-- aArgs.realloc( aArgs.getLength() + 1 );
-- aArgs[ aArgs.getLength() ] = varg17;
-- }
-- if( varg18.hasValue() )
-- {
-- aArgs.realloc( aArgs.getLength() + 1 );
-- aArgs[ aArgs.getLength() ] = varg18;
-- }
-- if( varg19.hasValue() )
-- {
-- aArgs.realloc( aArgs.getLength() + 1 );
-- aArgs[ aArgs.getLength() ] = varg19;
-- }
-- if( varg20.hasValue() )
-- {
-- aArgs.realloc( aArgs.getLength() + 1 );
-- aArgs[ aArgs.getLength() ] = varg20;
-- }
-- if( varg21.hasValue() )
-- {
-- aArgs.realloc( aArgs.getLength() + 1 );
-- aArgs[ aArgs.getLength() ] = varg21;
-- }
-- if( varg22.hasValue() )
-- {
-- aArgs.realloc( aArgs.getLength() + 1 );
-- aArgs[ aArgs.getLength() ] = varg22;
-- }
-- if( varg23.hasValue() )
-- {
-- aArgs.realloc( aArgs.getLength() + 1 );
-- aArgs[ aArgs.getLength() ] = varg23;
-- }
-- if( varg24.hasValue() )
-- {
-- aArgs.realloc( aArgs.getLength() + 1 );
-- aArgs[ aArgs.getLength() ] = varg24;
-- }
-- if( varg25.hasValue() )
-- {
-- aArgs.realloc( aArgs.getLength() + 1 );
-- aArgs[ aArgs.getLength() ] = varg25;
-- }
-- if( varg26.hasValue() )
-- {
-- aArgs.realloc( aArgs.getLength() + 1 );
-- aArgs[ aArgs.getLength() ] = varg26;
-- }
-- if( varg27.hasValue() )
-- {
-- aArgs.realloc( aArgs.getLength() + 1 );
-- aArgs[ aArgs.getLength() ] = varg27;
-- }
-- if( varg28.hasValue() )
-- {
-- aArgs.realloc( aArgs.getLength() + 1 );
-- aArgs[ aArgs.getLength() ] = varg28;
-- }
-- if( varg29.hasValue() )
-- {
-- aArgs.realloc( aArgs.getLength() + 1 );
-- aArgs[ aArgs.getLength() ] = varg29;
-- }
-- if( varg30.hasValue() )
-- {
-- aArgs.realloc( aArgs.getLength() + 1 );
-- aArgs[ aArgs.getLength() ] = varg30;
-- }
-- uno::Any aRet;
-- executeMacro( pShell, sMacroUrl, aArgs, aRet );
-- }
-- else
-- {
-- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("The macro doesn't exist") ), uno::Reference< uno::XInterface >() );
-- }
-- }
- }
-
- float SAL_CALL VbaApplicationBase::CentimetersToPoints( float _Centimeters ) throw (uno::RuntimeException)
-diff --git vbahelper/source/vbahelper/vbacommandbarcontrol.cxx vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
-index 718cdd0..2fcce8a 100644
---- vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
-+++ vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
-@@ -36,6 +36,8 @@
- #include <basic/sbstar.hxx>
- #include <basic/sbmod.hxx>
- #include <basic/sbmeth.hxx>
-+#include <vbahelper/vbahelper.hxx>
-+#include <svx/msvbahelper.hxx>
-
- using namespace com::sun::star;
- using namespace ooo::vba;
-@@ -286,79 +288,31 @@ ScVbaCommandBarControl::setOnAction( const ::rtl::OUString& _onaction ) throw (u
- {
- if( m_xCurrentSettings.is() )
- {
-- // convert the comand url into something like vnd.sun.star.script:Standard.testMacro.Macro1?language=Basic&location=document
-- rtl::OUString aCommandURL;
-- rtl::OUString sScheme = rtl::OUString::createFromAscii( "vnd.sun.star.script:");
-- SbModule* pModule = StarBASIC::GetActiveModule();
-- StarBASIC* pLib = pModule ? dynamic_cast< StarBASIC* >( pModule->GetParent() ) : NULL;
--
-- // Ok, we should be able to deal with the following params for onAction
-- // a) macro ( we assume the macro lives in this Project ( that is not really a valid assumption but we can't currently search outside this Library yet )
-- // b) module.macro ( again assume the macro is in this Project )
-- // c) project.module.macro fully specified
--
-- if( pModule && pLib )
-+ // get the current model
-+ uno::Reference< frame::XModel > xModel( getCurrentDocument() );
-+ VBAMacroResolvedInfo aResolvedMacro = ooo::vba::resolveVBAMacro( getSfxObjShell( xModel ), _onaction, true );
-+ if ( aResolvedMacro.IsResolved() )
- {
-- String sProject;
-- String sModule;
-- String sMacro = _onaction;
--
-- sal_Int32 nMacroDot = _onaction.lastIndexOf( '.' );
--
-- if ( nMacroDot != -1 )
-+ rtl::OUString aCommandURL = ooo::vba::makeMacroURL( aResolvedMacro.ResolvedMacro() );
-+ OSL_TRACE(" ScVbaCommandBarControl::setOnAction: %s", rtl::OUStringToOString( aCommandURL, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ beans::PropertyValues aPropertyValues;
-+ m_xCurrentSettings->getByIndex( m_nPosition ) >>= aPropertyValues;
-+ beans::PropertyValues aNewPropertyValues;
-+ aNewPropertyValues = lcl_repalcePropertyValue( aPropertyValues, rtl::OUString::createFromAscii("CommandURL"), uno::makeAny( aCommandURL ) );
-+ m_xCurrentSettings->replaceByIndex( m_nPosition, uno::makeAny( aNewPropertyValues ) );
-+ if( m_xUICfgManager->hasSettings( m_sBarName ) )
- {
-- sMacro = _onaction.copy( nMacroDot + 1 );
--
-- sal_Int32 nProjectDot = _onaction.lastIndexOf( '.', nMacroDot - 1 );
-- if ( nProjectDot != -1 )
-- {
-- sModule = _onaction.copy( nProjectDot + 1, nMacroDot - nProjectDot - 1 );
-- pModule = NULL; // force full spec. no search
--
-- }
-- else
-- sModule = _onaction.copy( 0, nMacroDot );
-- pModule = pLib->FindModule( sModule );
-+ m_xUICfgManager->replaceSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
- }
--
-- // Hopefully eventually if no project is specified 'Find' below
-- // will do the right thing
-- if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pModule ? pModule->Find( sMacro, SbxCLASS_METHOD ) : NULL ) )
-+ else
- {
-- if( pMethod )
-- {
-- sModule = pModule->GetName();
-- sProject = pModule->GetParent()->GetName();
-- }
-+ m_xUICfgManager->insertSettings( m_sBarName, uno::Reference< container::XIndexAccess > (m_xBarSettings, uno::UNO_QUERY_THROW ) );
-+ }
-+ // make it permanent
-+ if( !m_bTemporary )
-+ {
-+ m_xUICfgPers->store();
- }
-- sMacro.Insert( '.', 0 ).Insert( sModule, 0 ).Insert( '.', 0 ).Insert( sProject, 0 );
--
-- rtl::OUString sUrlPart2 = rtl::OUString::createFromAscii( "?language=Basic&location=document");
-- aCommandURL = sScheme.concat( sMacro ).concat( sUrlPart2 );
-- OSL_TRACE("**** METHOD IS %s", rtl::OUStringToOString( aCommandURL, RTL_TEXTENCODING_UTF8 ).getStr() );
-- }
-- else
-- {
-- aCommandURL = _onaction;
-- }
-- OSL_TRACE(" ScVbaCommandBarControl::setOnAction: %s", rtl::OUStringToOString( aCommandURL, RTL_TEXTENCODING_UTF8 ).getStr() );
-- beans::PropertyValues aPropertyValues;
-- m_xCurrentSettings->getByIndex( m_nPosition ) >>= aPropertyValues;
-- beans::PropertyValues aNewPropertyValues;
-- aNewPropertyValues = lcl_repalcePropertyValue( aPropertyValues, rtl::OUString::createFromAscii("CommandURL"), uno::makeAny( aCommandURL ) );
-- 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();
- }
- }
- }
-diff --git vbahelper/source/vbahelper/vbahelper.cxx vbahelper/source/vbahelper/vbahelper.cxx
-index 57bca7c..97ebb3b 100644
---- vbahelper/source/vbahelper/vbahelper.cxx
-+++ vbahelper/source/vbahelper/vbahelper.cxx
-@@ -67,6 +67,7 @@
- #include <toolkit/awt/vclxwindow.hxx>
- #include <toolkit/helper/vclunohelper.hxx>
- #include <com/sun/star/frame/XModel2.hpp>
-+#include <com/sun/star/lang/XUnoTunnel.hpp>
- #include <vcl/window.hxx>
- #include <vcl/syswin.hxx>
- #include <tools/diagnose_ex.h>
-@@ -1116,7 +1117,19 @@ UserFormGeometryHelper::UserFormGeometryHelper( const uno::Reference< uno::XComp
- double points = double( static_cast<double>(_hmm) / factor);
- return points;
- }
--
-+
-+ SfxObjectShell* getSfxObjShell( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
-+ {
-+ SfxObjectShell* pFoundShell = NULL;
-+ if ( xModel.is() )
-+ {
-+ uno::Reference< lang::XUnoTunnel > xObjShellTunnel( xModel, uno::UNO_QUERY_THROW );
-+ pFoundShell = reinterpret_cast<SfxObjectShell*>( xObjShellTunnel->getSomething(SfxObjectShell::getUnoTunnelId()));
-+ }
-+ if ( !pFoundShell )
-+ throw uno::RuntimeException();
-+ return pFoundShell;
-+ }
-
- } // openoffice
- } //org
diff --git a/patches/vba/vba-fixup-singlerange-sheetref.diff b/patches/vba/vba-fixup-singlerange-sheetref.diff
deleted file mode 100644
index 662ff9f5d..000000000
--- a/patches/vba/vba-fixup-singlerange-sheetref.diff
+++ /dev/null
@@ -1,62 +0,0 @@
-Index: sc/inc/address.hxx
-===================================================================
-RCS file: /cvs/sc/sc/inc/address.hxx,v
-retrieving revision 1.14
-diff -u -p -u -p -r1.14 address.hxx
---- sc/inc/address.hxx 27 Sep 2007 13:51:08 -0000 1.14
-+++ sc/inc/address.hxx 15 Apr 2008 11:48:23 -0000
-@@ -221,6 +221,9 @@ inline bool ValidColRowTab( SCCOL nCol,
- #define SCA_VALID_ROW 0x0100
- #define SCA_VALID_COL 0x0200
- #define SCA_VALID_TAB 0x0400
-+// SCA_BITS is a convience for
-+// (SCA_VALID_TAB | SCA_VALID_COL | SCA_VALID_ROW | SCA_TAB_3D | SCA_TAB_ABSOLUTE | SCA_ROW_ABSOLUTE | SCA_COL_ABSOLUTE)
-+#define SCA_BITS 0x070F
- // somewhat cheesy kludge to force the display of the document name even for
- // local references. Requires TAB_3D to be valid
- #define SCA_FORCE_DOC 0x0800
-Index: sc/source/core/tool/rangelst.cxx
-===================================================================
-RCS file: /cvs/sc/sc/source/core/tool/rangelst.cxx,v
-retrieving revision 1.10
-diff -u -p -u -p -r1.10 rangelst.cxx
---- sc/source/core/tool/rangelst.cxx 27 Feb 2007 12:18:02 -0000 1.10
-+++ sc/source/core/tool/rangelst.cxx 15 Apr 2008 11:48:41 -0000
-@@ -109,15 +109,18 @@ USHORT ScRangeList::Parse( const String&
- for ( USHORT i=0; i<nTCount; i++ )
- {
- aOne = rStr.GetToken( i, cDelimiter );
-- // FIXME : broken for Lotus
-- if ( aOne.Search( ':' ) == STRING_NOTFOUND )
-- { // Range muss es sein
-- String aStrTmp( aOne );
-- aOne += ':';
-- aOne += aStrTmp;
-- }
- aRange.aStart.SetTab( nTab ); // Default Tab wenn nicht angegeben
-- USHORT nRes = aRange.Parse( aOne, pDoc, eConv );
-+ USHORT nRes = aRange.ParseAny( aOne, pDoc, eConv );
-+ USHORT nEndRangeBits = SCA_VALID_COL2 | SCA_VALID_ROW2 |
-+SCA_VALID_TAB2;
-+ USHORT nTmp1 = ( nRes & SCA_BITS );
-+ USHORT nTmp2 = ( nRes & nEndRangeBits );
-+ // If we have a valid single range with
-+ // any of the address bits we are interested in
-+ // set - set the equiv end range bits
-+ if ( (nRes & SCA_VALID ) && nTmp1 && ( nTmp2 != nEndRangeBits ) )
-+ nRes |= ( nTmp1 << 4 );
-+
- if ( (nRes & nMask) == nMask )
- Append( aRange );
- nResult &= nRes; // alle gemeinsamen Bits bleiben erhalten
---- sc/source/core/tool/address.cxx 18 Jan 2008 14:33:24 -0000 1.9.248.1
-+++ sc/source/core/tool/address.cxx 15 Apr 2008 11:49:25 -0000
-@@ -1027,7 +1098,7 @@ lcl_ScRange_Parse_OOo( ScRange &aRange,
- }
- nRes1 = ( ( nRes1 | nRes2 ) & SCA_VALID )
- | nRes1
-- | ( ( nRes2 & 0x070F ) << 4 );
-+ | ( ( nRes2 & SCA_BITS ) << 4 );
- return nRes1;
- }
-
diff --git a/patches/vba/vba-fixup-vbasupportcws.diff b/patches/vba/vba-fixup-vbasupportcws.diff
deleted file mode 100644
index 77134dcdf..000000000
--- a/patches/vba/vba-fixup-vbasupportcws.diff
+++ /dev/null
@@ -1,123 +0,0 @@
-From b8c116054c43910a8f64b3b4c7f21291ef983d64 Mon Sep 17 00:00:00 2001
-From: Jan Holesovsky <kendy@suse.cz>
-Date: Fri, 14 May 2010 17:00:09 +0200
-Subject: [PATCH 397/878] vba-fixup-vbasupportcws.diff
-
----
- basic/source/comp/dim.cxx | 6 ----
- sc/source/filter/excel/excimp8.cxx | 2 +-
- svx/inc/svx/msvbahelper.hxx | 58 ------------------------------------
- toolkit/source/awt/vclxwindows.cxx | 1 -
- 4 files changed, 1 insertions(+), 66 deletions(-)
-
-diff --git a/basic/source/comp/dim.cxx b/basic/source/comp/dim.cxx
-index 6131209..d0931ac 100644
---- a/basic/source/comp/dim.cxx
-+++ b/basic/source/comp/dim.cxx
-@@ -224,12 +224,6 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic )
- Next();
- DefStatic( bPrivate );
- }
-- else if( eCurTok == DECLARE )
-- {
-- Next();
-- DefDeclare( bPrivate );
-- return;
-- }
- else if( eCurTok == SUB || eCurTok == FUNCTION || eCurTok == PROPERTY )
- {
- // End global chain if necessary (not done in
-diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx
-index 32a529a..a049429 100644
---- a/sc/source/filter/excel/excimp8.cxx
-+++ b/sc/source/filter/excel/excimp8.cxx
-@@ -286,7 +286,7 @@ void ImportExcel8::ReadBasic( void )
- if ( pAppMgr )
- pAppMgr->SetGlobalUNOConstant( "ThisExcelDoc", aArgs[ 0 ] );
- }
-- aBasicImport.Import( EXC_STORAGE_VBA_PROJECT, EXC_STORAGE_VBA, bAsComment );
-+ aBasicImport.Import( EXC_STORAGE_VBA_PROJECT, EXC_STORAGE_VBA, AutoGeneratedCodeNames, bAsComment );
- if ( !bAsComment )
- {
- GetObjectManager().SetOleNameOverrideInfo( aBasicImport.ControlNameForObjectId() );
-diff --git a/svx/inc/svx/msvbahelper.hxx b/svx/inc/svx/msvbahelper.hxx
-index 40814db..b1db442 100644
---- a/svx/inc/svx/msvbahelper.hxx
-+++ b/svx/inc/svx/msvbahelper.hxx
-@@ -56,61 +56,3 @@ namespace ooo { namespace vba
- } }
-
- #endif
--/*************************************************************************
-- *
-- * 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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--#ifndef _MSVBAHELPER_HXX
--#define _MSVBAHELPER_HXX
--
--#include <sfx2/objsh.hxx>
--#include "svx/svxdllapi.h"
--
--namespace ooo { namespace vba
--{
-- class SVX_DLLPUBLIC VBAMacroResolvedInfo
-- {
-- SfxObjectShell* mpDocContext;
-- bool mbFound;
-- String msResolvedMacro;
-- public:
-- VBAMacroResolvedInfo() : mpDocContext(NULL), mbFound( false ){}
-- void SetResolved( bool bRes ) { mbFound = bRes; }
-- bool IsResolved() { return mbFound; }
-- void SetMacroDocContext(SfxObjectShell* pShell ) { mpDocContext = pShell; }
-- SfxObjectShell* MacroDocContext() { return mpDocContext; }
-- String ResolvedMacro() { return msResolvedMacro; }
-- void SetResolvedMacro(const String& sMacro ) { msResolvedMacro = sMacro; }
-- };
--
-- SVX_DLLPUBLIC String makeMacroURL( const String& sMacroName );
-- SVX_DLLPUBLIC VBAMacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const rtl::OUString& sMod, bool bSearchGlobalTemplates = false );
-- SVX_DLLPUBLIC sal_Bool executeMacro( SfxObjectShell* pShell, const String& sMacroName, com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArgs, com::sun::star::uno::Any& aRet, const com::sun::star::uno::Any& aCaller );
--} }
--
--#endif
-diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
-index 7fb2f97..2878cf8 100644
---- a/toolkit/source/awt/vclxwindows.cxx
-+++ b/toolkit/source/awt/vclxwindows.cxx
-@@ -677,7 +677,6 @@ void VCLXImageControl::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
- BASEPROPERTY_TABSTOP,
- BASEPROPERTY_WRITING_MODE,
- BASEPROPERTY_CONTEXT_WRITING_MODE,
-- BASEPROPERTY_GROUPNAME,
- 0);
- VCLXImageConsumer::ImplGetPropertyIds( rIds );
- }
---
-1.7.0.1
-
diff --git a/patches/vba/vba-ide-choose-macro-to-run.diff b/patches/vba/vba-ide-choose-macro-to-run.diff
deleted file mode 100644
index e98bd2d1d..000000000
--- a/patches/vba/vba-ide-choose-macro-to-run.diff
+++ /dev/null
@@ -1,32 +0,0 @@
---- basctl/source/basicide/baside2.cxx.old 2009-04-02 10:56:36.000000000 +0000
-+++ basctl/source/basicide/baside2.cxx 2009-04-06 16:41:44.000000000 +0000
-@@ -331,6 +331,8 @@ BOOL ModulWindow::BasicExecute()
- DBG_ASSERT( xModule.Is(), "Kein Modul!" );
- AddStatus( BASWIN_RUNNINGBASIC );
- USHORT nStart, nEnd, nCurMethodStart = 0;
-+ TextSelection aSel = GetEditView()->GetSelection();
-+ nCurMethodStart = ( aSel.GetStart().GetPara() + 1 );
- SbMethod* pMethod = 0;
- // erstes Macro, sonst blind "Main" (ExtSearch?)
- for ( USHORT nMacro = 0; nMacro < xModule->GetMethods()->Count(); nMacro++ )
-@@ -338,16 +340,16 @@ BOOL ModulWindow::BasicExecute()
- SbMethod* pM = (SbMethod*)xModule->GetMethods()->Get( nMacro );
- DBG_ASSERT( pM, "Method?" );
- pM->GetLineRange( nStart, nEnd );
-- if ( !pMethod || ( nStart < nCurMethodStart ) )
-+ if ( nCurMethodStart >= nStart && nCurMethodStart <= nEnd )
- {
- pMethod = pM;
-- nCurMethodStart = nStart;
-+ break;
- }
- }
- if ( !pMethod )
-- pMethod = (SbMethod*)xModule->Find( String( RTL_CONSTASCII_USTRINGPARAM( "Main" ) ), SbxCLASS_METHOD );
-+ return ( BasicIDE::ChooseMacro( uno::Reference< frame::XModel >(), FALSE, rtl::OUString() ).getLength() > 0 ) ? TRUE : FALSE;
-
-- if ( pMethod )
-+ else
- {
- pMethod->SetDebugFlags( aStatus.nBasicFlags );
- BasicDLL::SetDebugMode( TRUE );
diff --git a/patches/vba/vba-import-and-use-localrangenames.diff b/patches/vba/vba-import-and-use-localrangenames.diff
deleted file mode 100644
index f77281d10..000000000
--- a/patches/vba/vba-import-and-use-localrangenames.diff
+++ /dev/null
@@ -1,144 +0,0 @@
-diff --git sc/inc/document.hxx sc/inc/document.hxx
-index 42479b4..61e23c9 100644
---- sc/inc/document.hxx
-+++ sc/inc/document.hxx
-@@ -452,7 +452,8 @@ public:
- void SetName( const String& r ) { aDocName = r; }
- const String& GetCodeName() const { return aDocCodeName; }
- void SetCodeName( const String& r ) { aDocCodeName = r; }
--
-+
-+ SC_DLLPUBLIC NameToNameMap* GetLocalNameMap( SCTAB& rTab );
- void GetDocStat( ScDocStat& rDocStat );
-
- SC_DLLPUBLIC void InitDrawLayer( SfxObjectShell* pDocShell = NULL );
-diff --git sc/inc/rangenam.hxx sc/inc/rangenam.hxx
-index 980f593..3991b8e 100644
---- sc/inc/rangenam.hxx
-+++ sc/inc/rangenam.hxx
-@@ -145,7 +145,7 @@ public:
-
- SC_DLLPUBLIC BOOL IsReference( ScRange& rRef ) const;
- BOOL IsReference( ScRange& rRef, const ScAddress& rPos ) const;
-- BOOL IsValidReference( ScRange& rRef ) const;
-+ SC_DLLPUBLIC BOOL IsValidReference( ScRange& rRef ) const;
-
- //UNUSED2009-05 BOOL IsRangeAtCursor( const ScAddress&, BOOL bStartOnly ) const;
- BOOL IsRangeAtBlock( const ScRange& ) const;
-diff --git sc/inc/table.hxx sc/inc/table.hxx
-index c7836c5..a259b48 100644
---- sc/inc/table.hxx
-+++ sc/inc/table.hxx
-@@ -89,6 +89,8 @@ class ScFlatUInt16RowSegments;
- class ScFlatBoolRowSegments;
- class ScFlatBoolColSegments;
-
-+typedef std::hash_map< ::rtl::OUString, rtl::OUString, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > NameToNameMap;
-+
- class ScTable
- {
- private:
-@@ -180,7 +181,7 @@ private:
- USHORT nScenarioFlags;
- BOOL bActiveScenario;
- bool mbPageBreaksValid;
--
-+ NameToNameMap localNameToGlobalName;
- friend class ScDocument; // fuer FillInfo
- friend class ScDocumentIterator;
- friend class ScValueIterator;
-diff --git sc/source/core/data/document.cxx sc/source/core/data/document.cxx
-index b4a134e..a783519 100644
---- sc/source/core/data/document.cxx
-+++ sc/source/core/data/document.cxx
-@@ -189,6 +189,13 @@ BOOL ScDocument::GetCodeName( SCTAB nTab, String& rName ) const
- return FALSE;
- }
-
-+NameToNameMap*
-+ScDocument::GetLocalNameMap( SCTAB& rTab )
-+{
-+ if ( !HasTable( rTab ) )
-+ return NULL;
-+ return &pTab[rTab]->localNameToGlobalName;
-+}
-
- BOOL ScDocument::GetTable( const String& rName, SCTAB& rTab ) const
- {
-diff --git sc/source/filter/excel/xiname.cxx sc/source/filter/excel/xiname.cxx
-index 0ad70d5..04d9ca3 100644
---- sc/source/filter/excel/xiname.cxx
-+++ sc/source/filter/excel/xiname.cxx
-@@ -38,7 +38,8 @@
- #include "excform.hxx"
- // for filter manager
- #include "excimp8.hxx"
--
-+#include "scextopt.hxx"
-+#include "document.hxx"
- // ============================================================================
- // *** Implementation ***
- // ============================================================================
-@@ -130,6 +131,7 @@ XclImpName::XclImpName( XclImpStream& rStrm, sal_uInt16 nXclNameIdx ) :
- maScName = maXclName;
- ScfTools::ConvertToScDefinedName( maScName );
- }
-+ rtl::OUString aRealOrigName = maScName;
-
- // add index for local names
- if( nXclTab != EXC_NAME_GLOBAL )
-@@ -224,6 +226,25 @@ XclImpName::XclImpName( XclImpStream& rStrm, sal_uInt16 nXclNameIdx ) :
- pData->GuessPosition(); // calculate base position for relative refs
- pData->SetIndex( nXclNameIdx ); // used as unique identifier in formulas
- rRangeNames.Insert( pData ); // takes ownership of pData
-+ if( nXclTab != EXC_NAME_GLOBAL )
-+ {
-+ if (GetBiff() == EXC_BIFF8)
-+ {
-+ ScRange aRange;
-+ // discard deleted ranges ( for the moment at least )
-+ if ( pData->IsValidReference( aRange ) )
-+ {
-+ ScExtTabSettings& rTabSett = GetExtDocOptions().GetOrCreateTabSettings( nXclTab );
-+ // create a mapping between the unmodified localname to
-+ // the name in the global name container for named ranges
-+ OSL_TRACE(" mapping local name to global name for tab %d which exists? %s", nXclTab, GetDoc().HasTable( mnScTab ) ? "true" : "false" );
-+ SCTAB nTab( static_cast< SCTAB >( mnScTab ) );
-+ NameToNameMap* pMap = GetDoc().GetLocalNameMap( nTab );
-+ if ( pMap )
-+ (*pMap)[ aRealOrigName ] = maScName;
-+ }
-+ }
-+ }
- mpScData = pData; // cache for later use
- }
- }
-diff --git sc/source/ui/vba/vbarange.cxx sc/source/ui/vba/vbarange.cxx
-index 735f913..923868e 100644
---- sc/source/ui/vba/vbarange.cxx
-+++ sc/source/ui/vba/vbarange.cxx
-@@ -1105,6 +1105,24 @@ bool getScRangeListForAddress( const rtl::OUString& sName, ScDocShell* pDocSh, S
- formula::FormulaGrammar::AddressConvention eConv = aConv;
- // spaces are illegal ( but the user of course can enter them )
- rtl::OUString sAddress = (*it).trim();
-+ // if a local name ( on the active sheet ) exists this will
-+ // take precedence over a global with the same name
-+ if ( !xNameAccess->hasByName( sAddress ) && pDocSh )
-+ {
-+ // try a local name
-+ ScDocument* pDoc = pDocSh->GetDocument();
-+ SCTAB nCurTab = pDocSh->GetCurTab();
-+ if ( pDoc )
-+ {
-+ NameToNameMap* pMap = pDoc->GetLocalNameMap( nCurTab );
-+ if ( pMap )
-+ {
-+ NameToNameMap::iterator it = pMap->find( sAddress );
-+ if ( it != pMap->end() ) // found a mapping
-+ sAddress = it->second;
-+ }
-+ }
-+ }
- if ( xNameAccess->hasByName( sAddress ) )
- {
- uno::Reference< sheet::XNamedRange > xNamed( xNameAccess->getByName( sAddress ), uno::UNO_QUERY_THROW );
diff --git a/patches/vba/vba-import-globaltemplate-customizations.diff b/patches/vba/vba-import-globaltemplate-customizations.diff
deleted file mode 100644
index 348702dd9..000000000
--- a/patches/vba/vba-import-globaltemplate-customizations.diff
+++ /dev/null
@@ -1,231 +0,0 @@
-diff --git officecfg/registry/schema/org/openoffice/Office/Writer.xcs officecfg/registry/schema/org/openoffice/Office/Writer.xcs
-index b578c56..666a69f 100644
---- officecfg/registry/schema/org/openoffice/Office/Writer.xcs
-+++ officecfg/registry/schema/org/openoffice/Office/Writer.xcs
-@@ -749,6 +749,17 @@
- </group>
- </templates>
- <component>
-+ <group oor:name="GlobalTemplateList">
-+ <info>
-+ <desc>Contains the most recently opened documents.</desc>
-+ </info>
-+ <prop oor:name="Paths" oor:type="oor:string-list">
-+ <info>
-+ <desc>Lists the file global templates loaded when importing writer documents.</desc>
-+ </info>
-+ <value oor:separator=";"></value>
-+ </prop>
-+ </group>
- <group oor:name="MailMergeWizard">
- <info>
- <desc>Settings of the mail merge wizard.</desc>
-diff --git sw/source/filter/ww8/ww8par.cxx sw/source/filter/ww8/ww8par.cxx
-index 80d5549..2d55a70 100644
---- sw/source/filter/ww8/ww8par.cxx
-+++ sw/source/filter/ww8/ww8par.cxx
-@@ -136,11 +136,15 @@
- #include <basic/basmgr.hxx>
-
- #include "ww8toolbar.hxx"
-+#include <osl/file.hxx>
-+#include <com/sun/star/document/XDocumentInfoSupplier.hpp>
-+
- #ifdef DEBUG
- #include <iostream>
- #include <dbgoutsw.hxx>
- #endif
- #include <unotools/localfilehelper.hxx>
-+#include <comphelper/configurationhelper.hxx>
-
- #define MM_250 1417 // WW-Default fuer Hor. Seitenraender: 2.5 cm
- #define MM_200 1134 // WW-Default fuer u.Seitenrand: 2.0 cm
-@@ -241,7 +245,7 @@ public:
- ~Sttb();
- bool Read(SvStream *pS);
- void Print( FILE* fp );
-- rtl::OUString getStringAtIndex( sal_Int32 );
-+ rtl::OUString getStringAtIndex( sal_uInt32 );
- };
-
- Sttb::Sttb() : fExtend( 0 )
-@@ -287,7 +291,7 @@ void Sttb::Print( FILE* fp )
- }
-
- rtl::OUString
--Sttb::getStringAtIndex( sal_Int32 index )
-+Sttb::getStringAtIndex( sal_uInt32 index )
- {
- rtl::OUString aRet;
- if ( index < dataItems.size() )
-@@ -3840,6 +3844,91 @@ void SwWW8ImplReader::ReadDocInfo()
- }
- }
-
-+class WW8Customizations
-+{
-+ SvStream* mpTableStream;
-+ WW8Fib mWw8Fib;
-+public:
-+ WW8Customizations( SvStream*, WW8Fib& );
-+ bool Import( SwDocShell* pShell );
-+};
-+
-+WW8Customizations::WW8Customizations( SvStream* pTableStream, WW8Fib& rFib ) : mpTableStream(pTableStream), mWw8Fib( rFib )
-+{
-+}
-+
-+bool WW8Customizations::Import( SwDocShell* pShell )
-+{
-+ if ( mWw8Fib.lcbCmds == 0 )
-+ return false;
-+ Tcg aTCG;
-+ long nCur = mpTableStream->Tell();
-+ mpTableStream->Seek( mWw8Fib.fcCmds ); // point at tgc record
-+ if (!aTCG.Read( mpTableStream ) )
-+ OSL_TRACE("** Read of Customization data failed!!!! ");
-+ mpTableStream->Seek( nCur ); // return to previous position, is that necessary?
-+#if 1
-+ aTCG.Print( stderr );
-+#endif
-+ return aTCG.ImportCustomToolBar( *pShell );
-+}
-+
-+bool SwWW8ImplReader::ReadGlobalTemplateSettings()
-+{
-+ uno::Sequence< rtl::OUString > sGlobalTemplates;
-+ rtl::OUString sNode = rtl::OUString::createFromAscii( "org.openoffice.Office.Writer/GlobalTemplateList" );
-+ try
-+ {
-+ css::uno::Reference< css::container::XNameAccess > xCfg( ::comphelper::ConfigurationHelper::openConfig( ::comphelper::getProcessServiceFactory(), sNode, ::comphelper::ConfigurationHelper::E_STANDARD), uno::UNO_QUERY_THROW);
-+ xCfg->getByName( rtl::OUString::createFromAscii("Paths") ) >>= sGlobalTemplates;
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+ sal_Int32 nEntries = sGlobalTemplates.getLength();
-+ bool bRes = true;
-+ const SvtFilterOptions* pVBAFlags = SvtFilterOptions::Get();
-+ uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( mpDocShell->GetModel(), uno::UNO_QUERY_THROW );
-+ uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW );
-+ uno::Reference< document::XDocumentProperties > xDocProps( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW );
-+
-+ rtl::OUString sCreatedFrom = xDocProps->getTemplateURL();
-+ for ( sal_Int32 i=0; i<nEntries; ++i )
-+ {
-+ INetURLObject aObj;
-+ aObj.SetURL( sGlobalTemplates[ i ] );
-+ bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
-+ rtl::OUString aURL;
-+ if ( bIsURL )
-+ aURL = sGlobalTemplates[ i ];
-+ else
-+ osl::FileBase::getFileURLFromSystemPath( sGlobalTemplates[ i ], aURL );
-+ if ( sCreatedFrom.getLength() && sCreatedFrom.equals( aURL ) )
-+ continue; // don't try and read the same document as ourselves
-+ SotStorageRef rRoot = new SotStorage( aURL, STREAM_STD_READWRITE, STORAGE_TRANSACTED );
-+ // Read Macro Projects
-+ SvxImportMSVBasic aVBasic(*mpDocShell, *rRoot,
-+ pVBAFlags->IsLoadWordBasicCode(),
-+ pVBAFlags->IsLoadWordBasicStorage() );
-+ String s1(CREATE_CONST_ASC("Macros"));
-+ String s2(CREATE_CONST_ASC("VBA"));
-+ int nRet = aVBasic.Import( s1, s2, ! pVBAFlags->IsLoadWordBasicCode() );
-+ // Read toolbars & menus
-+ SvStorageStreamRef refMainStream = rRoot->OpenSotStream( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WordDocument") ) );
-+ refMainStream->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN);
-+ WW8Fib aWwFib( *refMainStream, 8 );
-+ SvStorageStreamRef xTableStream = rRoot->OpenSotStream(String::CreateFromAscii( aWwFib.fWhichTblStm ? SL::a1Table : SL::a0Table), STREAM_STD_READ);
-+
-+ if (xTableStream.Is() && SVSTREAM_OK == xTableStream->GetError())
-+ {
-+ xTableStream->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN);
-+ WW8Customizations aGblCustomisations( xTableStream, aWwFib );
-+ aGblCustomisations.Import( mpDocShell );
-+ }
-+ }
-+ return bRes;
-+}
-+
- ULONG SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
- {
- ULONG nErrRet = 0;
-@@ -4097,10 +4184,11 @@ ULONG SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
- {
- if (mbNewDoc && pStg && !pGloss) /*meaningless for a glossary, cmc*/
- {
--
- mpDocShell->SetIsTemplate( pWwFib->fDot ); // point at tgc record
- const SvtFilterOptions* pVBAFlags = SvtFilterOptions::Get();
- maTracer.EnterEnvironment(sw::log::eMacros);
-+ // Read Global templates
-+ ReadGlobalTemplateSettings();
- // Create and insert Excel vba Globals
- uno::Any aGlobs;
- aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstance( ::rtl::OUString::createFromAscii( "ooo.vba.word.Globals") );
-@@ -4112,21 +4200,8 @@ ULONG SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
- String s1(CREATE_CONST_ASC("Macros"));
- String s2(CREATE_CONST_ASC("VBA"));
- int nRet = aVBasic.Import( s1, s2, ! pVBAFlags->IsLoadWordBasicCode() );
-- // Read custom toolbars
-- if ( pWwFib->lcbCmds )
-- {
-- // there is a tgc255 structure
-- long nCur = pTableStream->Tell();
-- Tcg aTCG;
-- pTableStream->Seek( pWwFib->fcCmds ); // point at tgc record
-- if (!aTCG.Read( pTableStream ) )
-- OSL_TRACE("** Read of Customization data failed!!!! ");
-- pTableStream->Seek( nCur ); // return to previous position, is that necessary?
--#if 1
-- aTCG.Print( stderr );
--#endif
-- aTCG.ImportCustomToolBar( *mpDocShell );
-- }
-+ WW8Customizations aCustomisations( pTableStream, *pWwFib );
-+ aCustomisations.Import( mpDocShell );
- if( 2 & nRet )
- {
- maTracer.Log(sw::log::eContainsVisualBasic);
-diff --git sw/source/filter/ww8/ww8par.hxx sw/source/filter/ww8/ww8par.hxx
-index 69f8e36..840dfdf 100644
---- sw/source/filter/ww8/ww8par.hxx
-+++ sw/source/filter/ww8/ww8par.hxx
-@@ -1424,7 +1424,7 @@ private:
- // determine object attribute "Layout in Table Cell"
- bool IsObjectLayoutInTableCell( const UINT32 nLayoutInTableCell ) const;
- // <--
--
-+ bool ReadGlobalTemplateSettings();
- //No copying
- SwWW8ImplReader(const SwWW8ImplReader &);
- SwWW8ImplReader& operator=(const SwWW8ImplReader&);
-diff --git sw/source/filter/ww8/ww8toolbar.cxx sw/source/filter/ww8/ww8toolbar.cxx
-index d30856a..d63fd77 100644
---- sw/source/filter/ww8/ww8toolbar.cxx
-+++ sw/source/filter/ww8/ww8toolbar.cxx
-@@ -300,8 +300,12 @@ bool Customization::ImportCustomToolBar( CustomToolBarImportHelper& helper )
- // see if the document has already setting for the menubar
-
- uno::Reference< container::XIndexContainer > xIndexContainer;
-+ bool bHasSettings = false;
- if ( helper.getCfgManager()->hasSettings( sMenuBar ) )
-+ {
- xIndexContainer.set( helper.getCfgManager()->getSettings( sMenuBar, sal_True ), uno::UNO_QUERY_THROW );
-+ bHasSettings = true;
-+ }
- else
- {
- if ( helper.getAppCfgManager()->hasSettings( sMenuBar ) )
-@@ -329,7 +333,10 @@ bool Customization::ImportCustomToolBar( CustomToolBarImportHelper& helper )
- OSL_TRACE("** there are %d menu items on the bar, inserting after that", xIndexContainer->getCount() );
- xIndexContainer->insertByIndex( xIndexContainer->getCount(), uno::makeAny( aPopupMenu ) );
-
-- helper.getCfgManager()->insertSettings( sMenuBar, uno::Reference< container::XIndexAccess >( xIndexContainer, uno::UNO_QUERY_THROW ) );
-+ if ( bHasSettings )
-+ helper.getCfgManager()->replaceSettings( sMenuBar, uno::Reference< container::XIndexAccess >( xIndexContainer, uno::UNO_QUERY_THROW ) );
-+ else
-+ helper.getCfgManager()->insertSettings( sMenuBar, uno::Reference< container::XIndexAccess >( xIndexContainer, uno::UNO_QUERY_THROW ) );
- }
- }
- }
diff --git a/patches/vba/vba-import-xlsm.diff b/patches/vba/vba-import-xlsm.diff
deleted file mode 100644
index e57d13858..000000000
--- a/patches/vba/vba-import-xlsm.diff
+++ /dev/null
@@ -1,796 +0,0 @@
-From 824e9cdff125e2ca56b19170c934c6086ffbb37b Mon Sep 17 00:00:00 2001
-From: Jan Holesovsky <kendy@suse.cz>
-Date: Fri, 14 May 2010 17:00:23 +0200
-Subject: [PATCH 406/878] vba-import-xlsm.diff
-
----
- offapi/com/sun/star/document/XVBAImporter.idl | 58 ++++++++++++++++++
- offapi/com/sun/star/document/makefile.mk | 1 +
- offapi/com/sun/star/sheet/XCodeName.idl | 62 ++++++++++++++++++++
- offapi/com/sun/star/sheet/makefile.mk | 1 +
- oox/inc/oox/xls/workbookhelper.hxx | 2 +
- oox/inc/oox/xls/worksheetsettings.hxx | 2 +
- oox/source/xls/workbookfragment.cxx | 9 +++
- oox/source/xls/workbookhelper.cxx | 15 +++++
- oox/source/xls/workbooksettings.cxx | 7 ++
- oox/source/xls/worksheethelper.cxx | 4 +
- oox/source/xls/worksheetsettings.cxx | 19 ++++++
- sc/inc/cellsuno.hxx | 8 ++-
- sc/inc/document.hxx | 2 +-
- sc/inc/servuno.hxx | 3 +-
- sc/inc/unonames.hxx | 1 +
- sc/source/filter/excel/excimp8.cxx | 6 ++-
- sc/source/ui/unoobj/cellsuno.cxx | 28 +++++++++
- sc/source/ui/unoobj/docuno.cxx | 13 ++++
- sc/source/ui/unoobj/servuno.cxx | 59 +++++++++++++++++++
- sc/util/makefile.mk | 1 +
- svx/source/msfilter/msvbasic.cxx | 14 ++++-
- svx/source/msfilter/svxmsbas.cxx | 11 +++-
- sw/source/filter/ww8/ww8par.cxx | 7 ++
- vbahelper/inc/vbahelper/vbaaccesshelper.hxx | 10 +++-
- vbahelper/source/vbahelper/vbaeventshelperbase.cxx | 2 +-
- 25 files changed, 335 insertions(+), 10 deletions(-)
- create mode 100644 offapi/com/sun/star/document/XVBAImporter.idl
- create mode 100644 offapi/com/sun/star/sheet/XCodeName.idl
-
-diff --git a/offapi/com/sun/star/document/XVBAImporter.idl b/offapi/com/sun/star/document/XVBAImporter.idl
-new file mode 100644
-index 0000000..a46267c
---- /dev/null
-+++ b/offapi/com/sun/star/document/XVBAImporter.idl
-@@ -0,0 +1,58 @@
-+/*************************************************************************
-+ *
-+ * 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: XVBAImporter.idl,v $
-+ * $Revision: 1.7 $
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __com_sun_star_document_XVBAImporter_idl__
-+#define __com_sun_star_document_XVBAImporter_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __com_sun_star_io_XInputStream
-+#include <com/sun/star/io/XInputStream.idl>
-+#endif
-+
-+//=============================================================================
-+
-+module com { module sun { module star { module document {
-+
-+//=============================================================================
-+
-+/** simple VBA import interface
-+ */
-+interface XVBAImporter : com::sun::star::uno::XInterface
-+{
-+ boolean importVBA( [in] com::sun::star::io::XInputStream xVBAContainerBlob );
-+};
-+
-+//=============================================================================
-+
-+}; }; }; };
-+
-+#endif
-diff --git a/offapi/com/sun/star/document/makefile.mk b/offapi/com/sun/star/document/makefile.mk
-index 2855d1f..ab0e549 100644
---- a/offapi/com/sun/star/document/makefile.mk
-+++ b/offapi/com/sun/star/document/makefile.mk
-@@ -56,6 +56,7 @@ IDLFILES=\
- FilterOptionsRequest.idl\
- HeaderFooterSettings.idl\
- ImportFilter.idl\
-+ XVBAImporter.idl\
- LinkTarget.idl\
- LinkTargets.idl\
- LockFileIgnoreRequest.idl\
-diff --git a/offapi/com/sun/star/sheet/XCodeName.idl b/offapi/com/sun/star/sheet/XCodeName.idl
-new file mode 100644
-index 0000000..f11ef65
---- /dev/null
-+++ b/offapi/com/sun/star/sheet/XCodeName.idl
-@@ -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: XExternalSheetName.idl,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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef __com_sun_star_sheet_XCodeName_idl__
-+#define __com_sun_star_sheet_XCodeName_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __com_sun_star_container_ElementExistException_idl__
-+#include <com/sun/star/container/ElementExistException.idl>
-+#endif
-+
-+//=============================================================================
-+
-+module com { module sun { module star { module sheet {
-+
-+//=============================================================================
-+
-+/** provides a method to set the code name of a sheet
-+ */
-+interface XCodeName: com::sun::star::uno::XInterface
-+{
-+ //-------------------------------------------------------------------------
-+
-+ [ attribute ] string CodeName;
-+
-+};
-+
-+//=============================================================================
-+
-+}; }; }; };
-+
-+#endif
-diff --git a/offapi/com/sun/star/sheet/makefile.mk b/offapi/com/sun/star/sheet/makefile.mk
-index c9d88c6..a66a284 100644
---- a/offapi/com/sun/star/sheet/makefile.mk
-+++ b/offapi/com/sun/star/sheet/makefile.mk
-@@ -340,6 +340,7 @@ IDLFILES=\
- XViewPanesSupplier.idl\
- XViewSplitable.idl\
- XVolatileResult.idl\
-+ XCodeName.idl\
- _NamedRange.idl
-
- # ------------------------------------------------------------------
-diff --git a/oox/inc/oox/xls/workbookhelper.hxx b/oox/inc/oox/xls/workbookhelper.hxx
-index 6fa79c6..892c70a 100644
---- a/oox/inc/oox/xls/workbookhelper.hxx
-+++ b/oox/inc/oox/xls/workbookhelper.hxx
-@@ -39,6 +39,7 @@ namespace com { namespace sun { namespace star {
- namespace container { class XNameContainer; }
- namespace lang { class XMultiServiceFactory; }
- namespace awt { class XDevice; }
-+ namespace io { class XInputStream; }
- namespace table { struct CellAddress; }
- namespace table { struct CellRangeAddress; }
- namespace table { class XCell; }
-@@ -231,6 +232,7 @@ public:
- void setCurrentSheetIndex( sal_Int16 nSheet );
- /** Final conversion after importing the workbook. */
- void finalizeWorkbookImport();
-+ bool importVBA( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& );
-
- // document model ---------------------------------------------------------
-
-diff --git a/oox/inc/oox/xls/worksheetsettings.hxx b/oox/inc/oox/xls/worksheetsettings.hxx
-index c96f126..821deca 100644
---- a/oox/inc/oox/xls/worksheetsettings.hxx
-+++ b/oox/inc/oox/xls/worksheetsettings.hxx
-@@ -126,6 +126,8 @@ public:
- /** Converts the imported worksheet settings. */
- void finalizeImport();
-
-+ /** Applies the codeName. */
-+ void applyImportedCodeName();
- private:
- PhoneticSettings maPhoneticSett;
- SheetSettingsModel maSheetSettings;
-diff --git a/oox/source/xls/workbookfragment.cxx b/oox/source/xls/workbookfragment.cxx
-index e61820a..07f7bdc 100644
---- a/oox/source/xls/workbookfragment.cxx
-+++ b/oox/source/xls/workbookfragment.cxx
-@@ -53,6 +53,7 @@ using ::com::sun::star::uno::Reference;
- using ::com::sun::star::uno::Exception;
- using ::com::sun::star::uno::UNO_QUERY;
- using ::com::sun::star::uno::UNO_QUERY_THROW;
-+using ::com::sun::star::io::XInputStream;
- using ::com::sun::star::table::CellAddress;
- using ::oox::core::ContextHandlerRef;
- using ::oox::core::FragmentHandlerRef;
-@@ -293,6 +294,14 @@ void OoxWorkbookFragment::finalizeImport()
-
- // final conversions, e.g. calculation settings and view settings
- finalizeWorkbookImport();
-+
-+ OUString aProjectFragmentPath = getFragmentPathFromFirstType( CREATE_MSOFFICE_RELATIONSTYPE( "vbaProject" ) );
-+ if ( aProjectFragmentPath.getLength() > 0 )
-+ {
-+ // attempt to open a stream
-+ Reference< XInputStream > xInStrm = getFilter().openInputStream( aProjectFragmentPath );
-+ importVBA( xInStrm );
-+ }
- }
-
- // private --------------------------------------------------------------------
-diff --git a/oox/source/xls/workbookhelper.cxx b/oox/source/xls/workbookhelper.cxx
-index 8f6fb87..029859e 100644
---- a/oox/source/xls/workbookhelper.cxx
-+++ b/oox/source/xls/workbookhelper.cxx
-@@ -32,6 +32,7 @@
- #include <com/sun/star/container/XNameContainer.hpp>
- #include <com/sun/star/awt/XDevice.hpp>
- #include <com/sun/star/document/XActionLockable.hpp>
-+#include <com/sun/star/document/XVBAImporter.hpp>
- #include <com/sun/star/table/CellAddress.hpp>
- #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
- #include <com/sun/star/sheet/XSpreadsheet.hpp>
-@@ -76,12 +77,14 @@ using ::com::sun::star::uno::Exception;
- using ::com::sun::star::uno::UNO_QUERY;
- using ::com::sun::star::uno::UNO_QUERY_THROW;
- using ::com::sun::star::uno::UNO_SET_THROW;
-+using ::com::sun::star::io::XInputStream;
- using ::com::sun::star::container::XIndexAccess;
- using ::com::sun::star::container::XNameAccess;
- using ::com::sun::star::container::XNameContainer;
- using ::com::sun::star::lang::XMultiServiceFactory;
- using ::com::sun::star::awt::XDevice;
- using ::com::sun::star::document::XActionLockable;
-+using ::com::sun::star::document::XVBAImporter;
- using ::com::sun::star::table::CellAddress;
- using ::com::sun::star::table::CellRangeAddress;
- using ::com::sun::star::table::XCell;
-@@ -826,6 +829,18 @@ void WorkbookHelper::finalizeWorkbookImport()
- aDefPageStyle.setProperty< sal_Int16 >( PROP_FirstPageNumber, 0 );
- }
-
-+bool WorkbookHelper::importVBA( const Reference< XInputStream >& vbaProjBlob )
-+{
-+ bool bResult( false );
-+ if ( vbaProjBlob.is() )
-+ {
-+ Reference< XVBAImporter > xImport( getDocumentFactory()->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.excel.VBAImporter") ) ), UNO_QUERY );
-+ if ( xImport.is() )
-+ bResult = ( xImport->importVBA( vbaProjBlob ) == sal_True );
-+ }
-+ return bResult;
-+}
-+
- // document model -------------------------------------------------------------
-
- Reference< XSpreadsheetDocument > WorkbookHelper::getDocument() const
-diff --git a/oox/source/xls/workbooksettings.cxx b/oox/source/xls/workbooksettings.cxx
-index 1277b08..6b47886 100644
---- a/oox/source/xls/workbooksettings.cxx
-+++ b/oox/source/xls/workbooksettings.cxx
-@@ -40,6 +40,7 @@
-
- using ::rtl::OUString;
- using ::com::sun::star::uno::Reference;
-+using ::com::sun::star::uno::makeAny;
- using ::com::sun::star::uno::UNO_QUERY;
- using ::com::sun::star::util::Date;
- using ::com::sun::star::util::XNumberFormatsSupplier;
-@@ -285,8 +286,14 @@ void WorkbookSettings::finalizeImport()
- {
- case FILTER_OOX:
- case FILTER_BIFF:
-+ {
- aPropSet.setProperty( PROP_IgnoreCase, true ); // always in Excel
- aPropSet.setProperty( PROP_RegularExpressions, false ); // not supported in Excel
-+ rtl::OUString sCodeName = maBookSettings.maCodeName.getLength() ? maBookSettings.maCodeName : CREATE_OUSTRING("ThisWorkbook");
-+
-+ if ( aPropSet.getXPropertySet().is() )
-+ aPropSet.getXPropertySet()->setPropertyValue( CREATE_OUSTRING("CodeName"), makeAny( sCodeName ));
-+ }
- break;
- case FILTER_UNKNOWN:
- break;
-diff --git a/oox/source/xls/worksheethelper.cxx b/oox/source/xls/worksheethelper.cxx
-index e28df89..11f4f15 100644
---- a/oox/source/xls/worksheethelper.cxx
-+++ b/oox/source/xls/worksheethelper.cxx
-@@ -1004,6 +1004,10 @@ void WorksheetData::finalizeWorksheetImport()
- finalizeDrawing();
- finalizeVmlDrawing();
- maComments.finalizeImport(); // after VML drawing
-+
-+ // Really I think we should be calling getWorksheetSettings::finalizeImport
-+ // but as this is a late patch, I don't want to risk that
-+ getWorksheetSettings().applyImportedCodeName();
- lclUpdateProgressBar( mxFinalProgress, 1.0 );
-
- // reset current sheet index in global data
-diff --git a/oox/source/xls/worksheetsettings.cxx b/oox/source/xls/worksheetsettings.cxx
-index b9e4f4b..b759266 100644
---- a/oox/source/xls/worksheetsettings.cxx
-+++ b/oox/source/xls/worksheetsettings.cxx
-@@ -27,6 +27,8 @@
-
- #include "oox/xls/worksheetsettings.hxx"
- #include <com/sun/star/util/XProtectable.hpp>
-+#include <com/sun/star/sheet/XCodeName.hpp>
-+
- #include "oox/helper/attributelist.hxx"
- #include "oox/helper/recordinputstream.hxx"
- #include "oox/xls/biffinputstream.hxx"
-@@ -38,6 +40,7 @@ using ::com::sun::star::uno::Exception;
- using ::com::sun::star::uno::Reference;
- using ::com::sun::star::uno::UNO_QUERY_THROW;
- using ::com::sun::star::util::XProtectable;
-+using ::com::sun::star::sheet::XCodeName;
- using ::oox::core::CodecHelper;
-
- namespace oox {
-@@ -310,6 +313,22 @@ void WorksheetSettings::finalizeImport()
- }
- }
-
-+// for some reason currently finalizeImport is not called by WorksheetDataImport
-+// as this patch is a late commit I don' want to risk changing the import too
-+// much ( so really this method should be called by
-+// WorsheetSettings::finalizeImport() which in turn should be called by
-+// WorksheetDataImport::finalizeWorksheetImport() )
-+void WorksheetSettings::applyImportedCodeName()
-+{
-+ try
-+ {
-+ Reference< XCodeName > xCodeNameSetter( getSheet(), UNO_QUERY_THROW );
-+ xCodeNameSetter->setCodeName( maSheetSettings.maCodeName );
-+ }
-+ catch( Exception& )
-+ {
-+ }
-+}
- // ============================================================================
-
- } // namespace xls
-diff --git a/sc/inc/cellsuno.hxx b/sc/inc/cellsuno.hxx
-index 4884b29..4e2bf6c 100644
---- a/sc/inc/cellsuno.hxx
-+++ b/sc/inc/cellsuno.hxx
-@@ -51,6 +51,7 @@
- #include <com/sun/star/sheet/XSpreadsheet.hpp>
- #include <com/sun/star/sheet/XSheetPageBreak.hpp>
- #include <com/sun/star/sheet/XCellRangeMovement.hpp>
-+#include <com/sun/star/sheet/XCodeName.hpp>
- #include <com/sun/star/text/XText.hpp>
- #include <com/sun/star/sheet/XPrintAreas.hpp>
- #include <com/sun/star/sheet/XSheetLinkable.hpp>
-@@ -1002,7 +1003,8 @@ class ScTableSheetObj : public ScCellRangeObj,
- public com::sun::star::util::XProtectable,
- public com::sun::star::sheet::XScenario,
- public com::sun::star::sheet::XScenarioEnhanced,
-- public com::sun::star::sheet::XExternalSheetName
-+ public com::sun::star::sheet::XExternalSheetName,
-+ public com::sun::star::sheet::XCodeName
- {
- friend class ScTableSheetsObj; // fuer insertByName()
-
-@@ -1234,6 +1236,10 @@ public:
- throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
- throw(::com::sun::star::uno::RuntimeException);
-+ // XCodeName
-+ virtual void SAL_CALL setCodeName( const ::rtl::OUString& aSheetName ) throw (::com::sun::star::uno::RuntimeException);
-+ virtual ::rtl::OUString SAL_CALL getCodeName( ) throw (::com::sun::star::uno::RuntimeException);
-+
- };
-
-
-diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
-index 63d4837..90edd62 100644
---- a/sc/inc/document.hxx
-+++ b/sc/inc/document.hxx
-@@ -1770,7 +1770,7 @@ public:
- void GetSortParam( ScSortParam& rParam, SCTAB nTab );
- void SetSortParam( ScSortParam& rParam, SCTAB nTab );
-
-- com::sun::star::uno::Reference< com::sun::star::document::XVbaEventsHelper > GetVbaEventsHelper();
-+ SC_DLLPUBLIC com::sun::star::uno::Reference< com::sun::star::document::XVbaEventsHelper > GetVbaEventsHelper();
-
- /** Should only be GRAM_PODF or GRAM_ODFF. */
- void SetStorageGrammar( formula::FormulaGrammar::Grammar eGrammar );
-diff --git a/sc/inc/servuno.hxx b/sc/inc/servuno.hxx
-index 24f98e0..e3b693f 100644
---- a/sc/inc/servuno.hxx
-+++ b/sc/inc/servuno.hxx
-@@ -92,7 +92,8 @@ class ScDocShell;
- #define SC_SERVICE_OPCODEMAPPER 39
- #define SC_SERVICE_VBAOBJECTPROVIDER 40
- #define SC_SERVICE_VBACODENAMEPROVIDER 41
--#define SC_SERVICE_COUNT 42
-+#define SC_SERVICE_VBAXLSMIMPORT 42
-+#define SC_SERVICE_COUNT 43
- #define SC_SERVICE_INVALID USHRT_MAX
-
-
-diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx
-index b704b0a..1260267 100644
---- a/sc/inc/unonames.hxx
-+++ b/sc/inc/unonames.hxx
-@@ -487,6 +487,7 @@
- #define SC_UNO_ISEXECUTELINKENABLED "IsExecuteLinkEnabled"
- #define SC_UNO_ISCHANGEREADONLYENABLED "IsChangeReadOnlyEnabled"
- #define SC_UNO_REFERENCEDEVICE "ReferenceDevice"
-+#define SC_UNO_CODENAME "CodeName"
-
- // document properties from FormModel
- #define SC_UNO_APPLYFMDES "ApplyFormDesignMode"
-diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx
-index a049429..229a1d2 100644
---- a/sc/source/filter/excel/excimp8.cxx
-+++ b/sc/source/filter/excel/excimp8.cxx
-@@ -100,6 +100,7 @@
-
- #include <com/sun/star/document/XDocumentProperties.hpp>
- #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
-+#include <com/sun/star/document/XVbaEventsHelper.hpp>
- #include <com/sun/star/script/ModuleInfo.hpp>
- #include <basic/basmgr.hxx>
- #include <cppuhelper/component_context.hxx>
-@@ -306,7 +307,10 @@ void ImportExcel8::ReadBasic( void )
- }
- }
- #endif
--
-+ // enable VBA events ( now that code is imported )
-+ uno::Reference< document::XVbaEventsHelper > xEvt( GetDoc().GetVbaEventsHelper() );
-+ if ( xEvt.is() )
-+ xEvt->setIgnoreEvents( sal_False );
- }
- }
- }
-diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
-index 1bb40a7..b148d93 100644
---- a/sc/source/ui/unoobj/cellsuno.cxx
-+++ b/sc/source/ui/unoobj/cellsuno.cxx
-@@ -6847,6 +6847,7 @@ uno::Any SAL_CALL ScTableSheetObj::queryInterface( const uno::Type& rType ) thro
- SC_QUERYINTERFACE( sheet::XScenarioEnhanced )
- SC_QUERYINTERFACE( sheet::XSheetLinkable )
- SC_QUERYINTERFACE( sheet::XExternalSheetName )
-+ SC_QUERYINTERFACE( sheet::XCodeName )
-
- return ScCellRangeObj::queryInterface( rType );
- }
-@@ -8681,6 +8682,33 @@ ScTableSheetObj* ScTableSheetObj::getImplementation( const uno::Reference<uno::X
-
- //------------------------------------------------------------------------
-
-+rtl::OUString SAL_CALL
-+ScTableSheetObj::getCodeName() throw (uno::RuntimeException)
-+{
-+ ScUnoGuard aGuard;
-+ ScDocShell* pDocSh = GetDocShell();
-+ String aName;
-+ if ( pDocSh )
-+ pDocSh->GetDocument()->GetCodeName( GetTab_Impl(), aName );
-+ return aName;
-+}
-+
-+void SAL_CALL ScTableSheetObj::setCodeName( const rtl::OUString& aNewName ) throw (uno::RuntimeException)
-+{
-+ ScUnoGuard aGuard;
-+ ScDocShell* pDocSh = GetDocShell();
-+
-+ if ( pDocSh )
-+ {
-+ String aCodeName( aNewName );
-+ if ( !pDocSh->GetDocument()->SetCodeName( GetTab_Impl(), aCodeName ) )
-+ throw uno::RuntimeException();
-+ }
-+}
-+
-+
-+//------------------------------------------------------------------------
-+
- ScTableColumnObj::ScTableColumnObj( ScDocShell* pDocSh, SCCOL nCol, SCTAB nTab ) :
- ScCellRangeObj( pDocSh, ScRange(nCol,0,nTab, nCol,MAXROW,nTab) ),
- pColPropSet(lcl_GetColumnPropertySet())
-diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
-index 2079a86..58205bd 100644
---- a/sc/source/ui/unoobj/docuno.cxx
-+++ b/sc/source/ui/unoobj/docuno.cxx
-@@ -152,6 +152,7 @@ const SfxItemPropertyMapEntry* lcl_GetDocOptPropertyMap()
- {MAP_CHAR_LEN(SC_UNO_ISCHANGEREADONLYENABLED), 0, &getBooleanCppuType(), 0, 0},
- {MAP_CHAR_LEN(SC_UNO_REFERENCEDEVICE), 0, &getCppuType((uno::Reference<awt::XDevice>*)0), beans::PropertyAttribute::READONLY, 0},
- {MAP_CHAR_LEN("BuildId"), 0, &::getCppuType(static_cast< const rtl::OUString * >(0)), 0, 0},
-+ {MAP_CHAR_LEN(SC_UNO_CODENAME), 0, &getCppuType(static_cast< const rtl::OUString * >(0)), 0, 0},
-
- {0,0,0,0,0,0}
- };
-@@ -1370,6 +1371,12 @@ void SAL_CALL ScModelObj::setPropertyValue(
- pDoc->SetLanguage( eLatin, eCjk, eCtl );
- }
- }
-+ else if ( aString.EqualsAscii( SC_UNO_CODENAME ) )
-+ {
-+ rtl::OUString sCodeName;
-+ if ( aValue >>= sCodeName )
-+ pDoc->SetCodeName( sCodeName );
-+ }
- else if ( aString.EqualsAscii( SC_UNO_CJK_CLOCAL ) )
- {
- lang::Locale aLocale;
-@@ -1502,6 +1509,12 @@ uno::Any SAL_CALL ScModelObj::getPropertyValue( const rtl::OUString& aPropertyNa
- ScUnoConversion::FillLocale( aLocale, eLatin );
- aRet <<= aLocale;
- }
-+ else if ( aString.EqualsAscii( SC_UNO_CODENAME ) )
-+ {
-+ rtl::OUString sCodeName = pDoc->GetCodeName();
-+ aRet <<= sCodeName;
-+ }
-+
- else if ( aString.EqualsAscii( SC_UNO_CJK_CLOCAL ) )
- {
- LanguageType eLatin, eCjk, eCtl;
-diff --git a/sc/source/ui/unoobj/servuno.cxx b/sc/source/ui/unoobj/servuno.cxx
-index e97bf57..5e01528 100644
---- a/sc/source/ui/unoobj/servuno.cxx
-+++ b/sc/source/ui/unoobj/servuno.cxx
-@@ -36,6 +36,8 @@
- #include <svx/unonrule.hxx>
- #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
- #include <com/sun/star/container/XNameAccess.hpp>
-+#include <com/sun/star/document/XVbaEventsHelper.hpp>
-+#include <com/sun/star/document/XVBAImporter.hpp>
-
- #include "servuno.hxx"
- #include "unonames.hxx"
-@@ -58,6 +60,10 @@
- // #100263# Support creation of GraphicObjectResolver and EmbeddedObjectResolver
- #include <svx/xmleohlp.hxx>
- #include <svx/xmlgrhlp.hxx>
-+#include <unotools/ucbstreamhelper.hxx>
-+#include <svtools/fltrcfg.hxx>
-+#include <svx/svxmsbas.hxx>
-+#include <sfx2/app.hxx>
-
- #include <comphelper/processfactory.hxx>
- #include <com/sun/star/document/XCodeNameQuery.hpp>
-@@ -215,6 +221,51 @@ struct ProvNamesId_Type
- sal_uInt16 nType;
- };
-
-+class ScXLSMVBAImporter : public ::cppu::WeakImplHelper1< document::XVBAImporter >
-+{
-+ ScDocShell* mpDocShell;
-+public:
-+ ScXLSMVBAImporter( ScDocShell* pDocShell ) : mpDocShell( pDocShell ) {}
-+virtual ::sal_Bool SAL_CALL importVBA( const uno::Reference< io::XInputStream >& xVBAContainerBlob ) throw (uno::RuntimeException)
-+ {
-+ // get SOTStorage
-+ SotStorageRef VBAContainer = new SotStorage( utl::UcbStreamHelper::CreateStream( xVBAContainerBlob ), TRUE );
-+ SvtFilterOptions* pFilterOpt = SvtFilterOptions::Get();
-+ if( mpDocShell && pFilterOpt )
-+ {
-+ bool bLoadCode = pFilterOpt->IsLoadExcelBasicCode();
-+ bool bLoadExecutable = pFilterOpt->IsLoadExcelBasicExecutable();
-+ bool bLoadStrg = pFilterOpt->IsLoadExcelBasicStorage();
-+ if( bLoadCode || bLoadStrg )
-+ {
-+ SvxImportMSVBasic aBasicImport( *mpDocShell, *VBAContainer, bLoadCode, bLoadStrg );
-+ bool bAsComment = !bLoadExecutable;
-+ if ( !bAsComment )
-+ {
-+ uno::Any aGlobs;
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[ 0 ] <<= mpDocShell->GetModel();
-+ aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.excel.Globals" ) ), aArgs );
-+ mpDocShell->GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
-+ BasicManager* pAppMgr = SFX_APP()->GetBasicManager();
-+ if ( pAppMgr )
-+ pAppMgr->SetGlobalUNOConstant( "ThisExcelDoc", aArgs[ 0 ] );
-+ }
-+ // need to set the load as comment etc. from options
-+ aBasicImport.Import( String(), String::CreateFromAscii("VBA"), bAsComment, TRUE );
-+ if ( !bAsComment )
-+ {
-+ // enable VBA events ( now that code is imported )
-+ uno::Reference< document::XVbaEventsHelper > xEvt( mpDocShell->GetDocument()->GetVbaEventsHelper() );
-+ if ( xEvt.is() )
-+ xEvt->setIgnoreEvents( sal_False );
-+ }
-+ }
-+ }
-+ return sal_True;
-+ }
-+};
-+
- static const ProvNamesId_Type __FAR_DATA aProvNamesId[] =
- {
- { "com.sun.star.sheet.Spreadsheet", SC_SERVICE_SHEET },
-@@ -264,6 +315,7 @@ static const ProvNamesId_Type __FAR_DATA aProvNamesId[] =
- { SC_SERVICENAME_OPCODEMAPPER, SC_SERVICE_OPCODEMAPPER },
- { "ooo.vba.VBAObjectModuleObjectProvider", SC_SERVICE_VBAOBJECTPROVIDER }, // SC_SERVICE_VBAOBJECTPROVIDER
- { "ooo.vba.VBACodeNameProvider", SC_SERVICE_VBACODENAMEPROVIDER }, // SC_SERVICE_VBACODENAMEPROVIDER
-+ { "com.sun.star.document.excel.VBAImporter", SC_SERVICE_VBAXLSMIMPORT }, // SC_SERVICE_VBAXLSMIMPORT
- // case-correct versions of the service names (#i102468#)
- { "com.sun.star.text.textfield.URL", SC_SERVICE_URLFIELD },
- { "com.sun.star.text.textfield.PageNumber", SC_SERVICE_PAGEFIELD },
-@@ -327,6 +379,7 @@ static const sal_Char* __FAR_DATA aOldNames[SC_SERVICE_COUNT] =
- "", // SC_SERVICE_OPCODEMAPPER
- "", // SC_SERVICE_VBAOBJECTPROVIDER
- "", // SC_SERVICE_VBACODENAMEPROVIDER
-+ "", // SC_SERVICE_VBAXLSIMPORT
- };
-
-
-@@ -545,6 +598,12 @@ uno::Reference<uno::XInterface> ScServiceProvider::MakeInstance(
- xRet.set(static_cast<document::XCodeNameQuery*>(new ScVbaCodeNameProvider( pDocShell )));
- }
- break;
-+ case SC_SERVICE_VBAXLSMIMPORT:
-+ if ( pDocShell )
-+ {
-+ xRet.set(static_cast<document::XVBAImporter*>( new ScXLSMVBAImporter( pDocShell ) ) );
-+ }
-+ break;
- }
- return xRet;
- }
-diff --git a/sc/util/makefile.mk b/sc/util/makefile.mk
-index cccfae0..d013442 100644
---- a/sc/util/makefile.mk
-+++ b/sc/util/makefile.mk
-@@ -99,6 +99,7 @@ SHL1STDLIBS= \
- $(XMLOFFLIB) \
- $(AVMEDIALIB) \
- $(FORLIB) \
-+ $(SVXMSFILTERLIB) \
- $(FORUILIB)
-
- SHL1LIBS=$(LIB3TARGET) $(LIB4TARGET)
-diff --git a/svx/source/msfilter/msvbasic.cxx b/svx/source/msfilter/msvbasic.cxx
-index e5138e6..1d19d1b 100644
---- a/svx/source/msfilter/msvbasic.cxx
-+++ b/svx/source/msfilter/msvbasic.cxx
-@@ -1253,7 +1253,19 @@ bool VBA_Impl::Open( const String &rToplevel, const String &rSublevel )
- {
- /* beginning test for vba stuff */
- bool bRet = false;
-- SvStorageRef xMacros= xStor->OpenSotStorage( rToplevel,
-+ SvStorageRef xMacros;
-+ // hack for xlsm if no TopLevel sepecified then just assume the root storage
-+ // is the toplevel
-+ // #FIXME but... why do this even, I don't see why we can't just store
-+ // the root storage of the VBA project when we create this class
-+ // note: currently xStor is the level above the level that contains the
-+ // vba project :-/
-+ // OTOH all of this mess should dissappear when services in oox come
-+ // good
-+ if ( rToplevel.Len() == 0 )
-+ xMacros = xStor;
-+ else
-+ xMacros = xStor->OpenSotStorage( rToplevel,
- STREAM_READWRITE | STREAM_NOCREATE |
- STREAM_SHARE_DENYALL );
- if( !xMacros.Is() || SVSTREAM_OK != xMacros->GetError() )
-diff --git a/svx/source/msfilter/svxmsbas.cxx b/svx/source/msfilter/svxmsbas.cxx
-index 48b61af..2f2971a 100644
---- a/svx/source/msfilter/svxmsbas.cxx
-+++ b/svx/source/msfilter/svxmsbas.cxx
-@@ -84,6 +84,8 @@ int SvxImportMSVBasic::Import( const String& rStorageName,
- const String &rSubStorageName,
- BOOL bAsComment, BOOL bStripped )
- {
-+
-+
- std::vector< String > codeNames;
- return Import( rStorageName, rSubStorageName, codeNames, bAsComment, bStripped );
- }
-@@ -145,8 +147,13 @@ bool SvxImportMSVBasic::ImportForms_Impl(const String& rStorageName,
-
- bool SvxImportMSVBasic::ImportForms_Impl( VBA_Impl& rVBA, const String& rStorageName, const String& rSubStorageName, BOOL bVBAMode )
- {
-- SvStorageRef xVBAStg(rVBA.GetStorage()->OpenSotStorage(rStorageName,
-- STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYALL));
-+ SvStorageRef xVBAStg;
-+ if ( rStorageName.Len() == 0 )
-+ xVBAStg = rVBA.GetStorage();
-+ else
-+ xVBAStg = rVBA.GetStorage()->OpenSotStorage(rStorageName,
-+ STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYALL);
-+
- if (!xVBAStg.Is() || xVBAStg->GetError())
- return false;
-
-diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
-index f7c8793..c27f28c 100644
---- a/sw/source/filter/ww8/ww8par.cxx
-+++ b/sw/source/filter/ww8/ww8par.cxx
-@@ -4307,6 +4307,13 @@ ULONG SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
- WW8Customizations aCustomisations( pTableStream, *pWwFib );
- aCustomisations.Import( mpDocShell );
- #endif
-+ if ( !bAsComment )
-+ {
-+ // enable VBA events ( now that code is imported )
-+ uno::Reference< document::XVbaEventsHelper > xEvt( rDoc.GetVbaEventsHelper() );
-+ if ( xEvt.is() )
-+ xEvt->setIgnoreEvents( sal_False );
-+ }
- if( 2 & nRet )
- {
- maTracer.Log(sw::log::eContainsVisualBasic);
-diff --git a/vbahelper/inc/vbahelper/vbaaccesshelper.hxx b/vbahelper/inc/vbahelper/vbaaccesshelper.hxx
-index 79bb44c..2292786 100644
---- a/vbahelper/inc/vbahelper/vbaaccesshelper.hxx
-+++ b/vbahelper/inc/vbahelper/vbaaccesshelper.hxx
-@@ -62,15 +62,21 @@ namespace ooo
- }
-
-
-- VBAHELPER_DLLPRIVATE inline bool isAlienDoc( SfxObjectShell& rDocShell, const char* pMimeType )
-+ VBAHELPER_DLLPRIVATE inline bool isAlienDoc( SfxObjectShell& rDocShell, const char* pMimeType, const char* pFilterName=NULL )
- {
- bool bRes( false );
- const SfxFilter *pFilt = rDocShell.GetMedium()->GetFilter();
- if ( pFilt && pFilt->IsAlienFormat() )
-+ {
- bRes = ( pFilt->GetMimeType().CompareToAscii( pMimeType ) == 0 );
-+ // if no match and we have a filter name, try that
-+ // xlsx and xlsm document currently don't show MimeType
-+ if ( pFilterName && !bRes )
-+ bRes = ( pFilt->GetFilterName().CompareToAscii( pFilterName ) == 0 );
-+ }
- return bRes;
- }
-- VBAHELPER_DLLPUBLIC inline bool isAlienExcelDoc( SfxObjectShell& rDocShell ) { return isAlienDoc( rDocShell, "application/vnd.ms-excel" ); }
-+ VBAHELPER_DLLPUBLIC inline bool isAlienExcelDoc( SfxObjectShell& rDocShell ) { return isAlienDoc( rDocShell, "application/vnd.ms-excel", "Calc MS Excel 2007 XML" ); }
- VBAHELPER_DLLPUBLIC inline bool isAlienWordDoc( SfxObjectShell& rDocShell ) { return isAlienDoc( rDocShell, "application/vnd.ms-word" ); }
-
- } // openoffice
-diff --git a/vbahelper/source/vbahelper/vbaeventshelperbase.cxx b/vbahelper/source/vbahelper/vbaeventshelperbase.cxx
-index baa56bc..4128ebe 100644
---- a/vbahelper/source/vbahelper/vbaeventshelperbase.cxx
-+++ b/vbahelper/source/vbahelper/vbaeventshelperbase.cxx
-@@ -31,7 +31,7 @@
-
- using namespace ::com::sun::star;
-
--VbaEventsHelperBase::VbaEventsHelperBase( const css::uno::Reference< css::uno::XComponentContext >& xContext ) : m_xContext( xContext ), mbIgnoreEvents( sal_False )
-+VbaEventsHelperBase::VbaEventsHelperBase( const css::uno::Reference< css::uno::XComponentContext >& xContext ) : m_xContext( xContext ), mbIgnoreEvents( sal_True )
- {
- }
-
---
-1.7.0.1
-
diff --git a/patches/vba/vba-improve-toolbarapi-macro-search.diff b/patches/vba/vba-improve-toolbarapi-macro-search.diff
deleted file mode 100644
index b09e92303..000000000
--- a/patches/vba/vba-improve-toolbarapi-macro-search.diff
+++ /dev/null
@@ -1,61 +0,0 @@
-diff --git vbahelper/source/vbahelper/vbacommandbarcontrol.cxx vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
-index fdea661..718cdd0 100644
---- vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
-+++ vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
-@@ -290,19 +290,51 @@ ScVbaCommandBarControl::setOnAction( const ::rtl::OUString& _onaction ) throw (u
- rtl::OUString aCommandURL;
- rtl::OUString sScheme = rtl::OUString::createFromAscii( "vnd.sun.star.script:");
- SbModule* pModule = StarBASIC::GetActiveModule();
-- if( pModule )
-+ StarBASIC* pLib = pModule ? dynamic_cast< StarBASIC* >( pModule->GetParent() ) : NULL;
-+
-+ // Ok, we should be able to deal with the following params for onAction
-+ // a) macro ( we assume the macro lives in this Project ( that is not really a valid assumption but we can't currently search outside this Library yet )
-+ // b) module.macro ( again assume the macro is in this Project )
-+ // c) project.module.macro fully specified
-+
-+ if( pModule && pLib )
- {
-- String sTmp = _onaction;
-- if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pModule->Find( sTmp, SbxCLASS_METHOD ) ) )
-+ String sProject;
-+ String sModule;
-+ String sMacro = _onaction;
-+
-+ sal_Int32 nMacroDot = _onaction.lastIndexOf( '.' );
-+
-+ if ( nMacroDot != -1 )
-+ {
-+ sMacro = _onaction.copy( nMacroDot + 1 );
-+
-+ sal_Int32 nProjectDot = _onaction.lastIndexOf( '.', nMacroDot - 1 );
-+ if ( nProjectDot != -1 )
-+ {
-+ sModule = _onaction.copy( nProjectDot + 1, nMacroDot - nProjectDot - 1 );
-+ pModule = NULL; // force full spec. no search
-+
-+ }
-+ else
-+ sModule = _onaction.copy( 0, nMacroDot );
-+ pModule = pLib->FindModule( sModule );
-+ }
-+
-+ // Hopefully eventually if no project is specified 'Find' below
-+ // will do the right thing
-+ if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pModule ? pModule->Find( sMacro, SbxCLASS_METHOD ) : NULL ) )
- {
- if( pMethod )
- {
-- sTmp.Insert( '.', 0 ).Insert( pModule->GetName(), 0 ).Insert( '.', 0 ).Insert( pModule->GetParent()->GetName(), 0 );
-+ sModule = pModule->GetName();
-+ sProject = pModule->GetParent()->GetName();
- }
- }
-+ sMacro.Insert( '.', 0 ).Insert( sModule, 0 ).Insert( '.', 0 ).Insert( sProject, 0 );
-
- rtl::OUString sUrlPart2 = rtl::OUString::createFromAscii( "?language=Basic&location=document");
-- aCommandURL = sScheme.concat( sTmp ).concat( sUrlPart2 );
-+ aCommandURL = sScheme.concat( sMacro ).concat( sUrlPart2 );
- OSL_TRACE("**** METHOD IS %s", rtl::OUStringToOString( aCommandURL, RTL_TEXTENCODING_UTF8 ).getStr() );
- }
- else
diff --git a/patches/vba/vba-interior-object-fix.diff b/patches/vba/vba-interior-object-fix.diff
deleted file mode 100644
index 0318b9194..000000000
--- a/patches/vba/vba-interior-object-fix.diff
+++ /dev/null
@@ -1,52 +0,0 @@
-diff --git sc/source/ui/vba/vbainterior.cxx sc/source/ui/vba/vbainterior.cxx
-index 99f1bd7..e9f538a 100644
---- sc/source/ui/vba/vbainterior.cxx
-+++ sc/source/ui/vba/vbainterior.cxx
-@@ -162,11 +162,19 @@ 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/patches/vba/vba-keyword-fix.diff b/patches/vba/vba-keyword-fix.diff
deleted file mode 100644
index 32ced0329..000000000
--- a/patches/vba/vba-keyword-fix.diff
+++ /dev/null
@@ -1,116 +0,0 @@
---- basic/source/inc/token.hxx.orig 2008-07-30 11:33:31.000000000 +0800
-+++ basic/source/inc/token.hxx 2008-07-30 16:54:58.000000000 +0800
-@@ -162,6 +162,10 @@ public:
- { return BOOL( t >= FIRSTKWD && t <= LASTKWD ); }
- static BOOL IsExtra( SbiToken t )
- { return BOOL( t >= FIRSTEXTRA ); }
-+
-+ // process somthing like dim Name as String
-+ virtual BOOL IsSymbol( SbiToken )
-+ { return FALSE; }
- };
-
-
---- basic/source/inc/parser.hxx.orig 2008-07-30 11:33:31.000000000 +0800
-+++ basic/source/inc/parser.hxx 2008-07-30 16:54:58.000000000 +0800
-@@ -40,6 +40,7 @@
- typedef ::std::vector< String > IfaceVector;
-
- struct SbiParseStack;
-+struct SbiStatement;
-
- class SbiParser : public SbiTokenizer
- {
-@@ -53,6 +54,7 @@ class SbiParser : public SbiTokenizer
- BOOL bGblDefs; // TRUE globale Definitionen allgemein
- BOOL bNewGblDefs; // TRUE globale Definitionen vor Sub
- BOOL bSingleLineIf; // TRUE einzeiliges if-Statement
-+ SbiStatement* pCurStat;
-
- SbiSymDef* VarDecl( SbiDimList**,BOOL,BOOL );// Variablen-Deklaration
- SbiProcDef* ProcDecl(BOOL bDecl);// Prozedur-Deklaration
-@@ -100,6 +102,7 @@ public:
- BOOL TestSymbol( BOOL=FALSE ); // Symbol?
- BOOL TestComma(); // Komma oder EOLN?
- void TestEoln(); // EOLN?
-+ virtual BOOL IsSymbol( SbiToken t ); // Process something like DIM Name as String
-
- void Symbol(); // Let oder Call
- void ErrorStmnt(); // ERROR n
---- basic/source/comp/token.cxx.orig 2008-07-30 11:33:31.000000000 +0800
-+++ basic/source/comp/token.cxx 2008-08-08 16:12:12.000000000 +0800
-@@ -594,6 +594,13 @@ special:
- }
- return eCurTok;
- }
-+
-+ // check whether the keyword has been dim as a variable
-+ if( IsSymbol( tp->t ) )
-+ {
-+ return eCurTok = SYMBOL;
-+ }
-+
- // Sind Datentypen Keywords?
- // Nur nach AS, sonst sind es Symbole!
- // Es gibt ja ERROR(), DATA(), STRING() etc.
---- basic/source/comp/parser.cxx.orig 2008-07-30 11:33:33.000000000 +0800
-+++ basic/source/comp/parser.cxx 2008-08-11 10:10:40.000000000 +0800
-@@ -138,6 +138,7 @@ SbiParser::SbiParser( StarBASIC* pb, SbM
- pProc = NULL;
- pStack = NULL;
- pWithVar = NULL;
-+ pCurStat = NULL;
- nBase = 0;
- bText =
- bGblDefs =
-@@ -308,6 +309,26 @@ void SbiParser::TestEoln()
- }
- }
-
-+// If some keywords e.g. Name have been dim as a variable,
-+// they should be treated as symbol
-+BOOL SbiParser::IsSymbol( SbiToken t )
-+{
-+ // FIXME: if "name" is a argument in a subroutine like "Sub Test( name as String )".
-+ if( IsVBASupportOn() && ( t == NAME || t == LINE || t == TEXT ))
-+ {
-+ if( pCurStat && ( pCurStat->eTok == DIM || pCurStat->eTok == PUBLIC ||
-+ pCurStat->eTok == PRIVATE || pCurStat->eTok == GLOBAL ))
-+ {
-+ return TRUE;
-+ }
-+ if( pPool->Find(aSym) )
-+ {
-+ return TRUE;
-+ }
-+ }
-+ return FALSE;
-+}
-+
- // Parsing eines Statement-Blocks
- // Das Parsing laeuft bis zum Ende-Token.
-
-@@ -431,7 +452,9 @@ BOOL SbiParser::Parse()
- if( ( p->bSubr && (eCurTok != STATIC || Peek() == SUB || Peek() == FUNCTION ) ) ||
- eCurTok == SUB || eCurTok == FUNCTION )
- aGen.Statement();
-+ pCurStat = p;
- (this->*( p->Func ) )();
-+ pCurStat = NULL;
- SbxError nSbxErr = SbxBase::GetError();
- if( nSbxErr )
- SbxBase::ResetError(), Error( (SbError)nSbxErr );
---- basic/source/comp/dim.cxx.orig 2008-07-31 14:54:31.000000000 +0800
-+++ basic/source/comp/dim.cxx 2008-08-11 10:12:22.000000000 +0800
-@@ -40,7 +40,10 @@
-
- SbiSymDef* SbiParser::VarDecl( SbiDimList** ppDim, BOOL bStatic, BOOL bConst )
- {
-- if( !TestSymbol() ) return NULL;
-+ // Some keywords can be dim as varibles like " Sub Test( Name as String )"
-+ eCurTok = Peek();
-+ BOOL bKwdOk = IsVBASupportOn() ? BOOL( (eCurTok == NAME) || (eCurTok == LINE) || (eCurTok == TEXT) ): FALSE;
-+ if( !TestSymbol( bKwdOk ) ) return NULL;
- SbxDataType t = eScanType;
- SbiSymDef* pDef = bConst ? new SbiConstDef( aSym ) : new SbiSymDef( aSym );
- SbiDimList* pDim = NULL;
diff --git a/patches/vba/vba-macro-properties.diff b/patches/vba/vba-macro-properties.diff
deleted file mode 100644
index 5d679857d..000000000
--- a/patches/vba/vba-macro-properties.diff
+++ /dev/null
@@ -1,117 +0,0 @@
-From fd8f3693e4024e1a688fcacc14971214b8b0cc33 Mon Sep 17 00:00:00 2001
-From: Jan Holesovsky <kendy@suse.cz>
-Date: Fri, 14 May 2010 17:00:06 +0200
-Subject: [PATCH 395/878] vba-macro-properties.diff
-
----
- sfx2/inc/sfx2/objsh.hxx | 4 +-
- sfx2/source/doc/objmisc.cxx | 4 +-
- svx/source/msfilter/msvbahelper.cxx | 44 +++++++++++-----------------------
- 3 files changed, 18 insertions(+), 34 deletions(-)
-
-diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx
-index 8f9fc44..922bbc1 100644
---- a/sfx2/inc/sfx2/objsh.hxx
-+++ b/sfx2/inc/sfx2/objsh.hxx
-@@ -407,7 +407,7 @@ public:
- ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam,
- bool bRaiseError = true,
-- ::com::sun::star::uno::Any* aCaller = 0 );
-+ const ::com::sun::star::uno::Any* aCaller = 0 );
-
- static ErrCode CallXScript(
- const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxScriptContext,
-@@ -417,7 +417,7 @@ public:
- ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam,
- bool bRaiseError = true,
-- ::com::sun::star::uno::Any* aCaller = 0
-+ const ::com::sun::star::uno::Any* aCaller = 0
- );
-
- /** adjusts the internal macro mode, according to the current security settings
-diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
-index 344af8d..8d21da7 100644
---- a/sfx2/source/doc/objmisc.cxx
-+++ b/sfx2/source/doc/objmisc.cxx
-@@ -1683,7 +1683,7 @@ namespace
- }
-
- ErrCode SfxObjectShell::CallXScript( const Reference< XInterface >& _rxScriptContext, const ::rtl::OUString& _rScriptURL,
-- const Sequence< Any >& aParams, Any& aRet, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam, bool bRaiseError, ::com::sun::star::uno::Any* pCaller )
-+ const Sequence< Any >& aParams, Any& aRet, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam, bool bRaiseError, const ::com::sun::star::uno::Any* pCaller )
- {
- OSL_TRACE( "in CallXScript" );
- ErrCode nErr = ERRCODE_NONE;
-@@ -1757,7 +1757,7 @@ ErrCode SfxObjectShell::CallXScript( const String& rScriptURL,
- ::com::sun::star::uno::Any& aRet,
- ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >&
-- aOutParam, bool bRaiseError, ::com::sun::star::uno::Any* pCaller )
-+ aOutParam, bool bRaiseError, const ::com::sun::star::uno::Any* pCaller )
- {
- return CallXScript( GetModel(), rScriptURL, aParams, aRet, aOutParamIndex, aOutParam, bRaiseError, pCaller );
- }
-diff --git a/svx/source/msfilter/msvbahelper.cxx b/svx/source/msfilter/msvbahelper.cxx
-index 9e3e2c2..6f12927 100644
---- a/svx/source/msfilter/msvbahelper.cxx
-+++ b/svx/source/msfilter/msvbahelper.cxx
-@@ -361,40 +361,24 @@ sal_Bool executeMacro( SfxObjectShell* pShell, const String& sMacroName, uno::Se
- uno::Sequence< uno::Any > aOutArgs;
-
- try
-- {
-- uno::Reference< script::provider::XScriptProvider > xScriptProvider;
-- uno::Reference< script::provider::XScriptProviderSupplier > xSPS( pShell->GetModel(), uno::UNO_QUERY_THROW );
--
-- xScriptProvider.set( xSPS->getScriptProvider(), uno::UNO_QUERY_THROW );
--
-- uno::Reference< script::provider::XScript > xScript( xScriptProvider->getScript( sUrl ), uno::UNO_QUERY_THROW );
--
-- if ( aCaller.hasValue() )
-+ { ErrCode nErr( ERRCODE_BASIC_INTERNAL_ERROR );
-+ if ( pShell )
- {
-- uno::Reference< beans::XPropertySet > xProps( xScript, uno::UNO_QUERY );
-- if ( xProps.is() )
-+ uno::Any aRet;
-+ nErr = pShell->CallXScript( sUrl,
-+ aArgs, aRet, aOutArgsIndex, aOutArgs, false, &aCaller );
-+ sal_Int32 nLen = aOutArgs.getLength();
-+ // convert any out params to seem like they were inouts
-+ if ( nLen )
- {
-- uno::Sequence< uno::Any > aCallerHack(1);
-- aCallerHack[ 0 ] = aCaller;
-- xProps->setPropertyValue( rtl::OUString::createFromAscii( "Caller" ), uno::makeAny( aCallerHack ) );
-+ for ( sal_Int32 index=0; index < nLen; ++index )
-+ {
-+ sal_Int32 nOutIndex = aOutArgsIndex[ index ];
-+ aArgs[ nOutIndex ] = aOutArgs[ index ];
-+ }
- }
- }
--
--
-- xScript->invoke( aArgs, aOutArgsIndex, aOutArgs );
--
-- sal_Int32 nLen = aOutArgs.getLength();
-- // convert any out params to seem like they were inouts
-- if ( nLen )
-- {
-- for ( sal_Int32 index=0; index < nLen; ++index )
-- {
-- sal_Int32 nOutIndex = aOutArgsIndex[ index ];
-- aArgs[ nOutIndex ] = aOutArgs[ index ];
-- }
-- }
--
-- bRes = sal_True;
-+ bRes = ( nErr == ERRCODE_NONE );
- }
- catch ( uno::Exception& e )
- {
---
-1.7.0.1
-
diff --git a/patches/vba/vba-menubar-objects.diff b/patches/vba/vba-menubar-objects.diff
deleted file mode 100644
index eea2ac0a4..000000000
--- a/patches/vba/vba-menubar-objects.diff
+++ /dev/null
@@ -1,1732 +0,0 @@
-diff --git oovbaapi/ooo/vba/excel/XApplication.idl oovbaapi/ooo/vba/excel/XApplication.idl
-index 2d903de..cf758f3 100644
---- oovbaapi/ooo/vba/excel/XApplication.idl
-+++ oovbaapi/ooo/vba/excel/XApplication.idl
-@@ -103,6 +103,7 @@ interface XApplication : com::sun::star::uno::XInterface
- raises(com::sun::star::script::BasicErrorException);
- void Volatile([in] any Volatile);
- any Caller( [in] any aIndex );
-+ any MenuBars( [in] any aIndex );
- };
-
- }; }; };
-diff --git oovbaapi/ooo/vba/excel/XGlobals.idl oovbaapi/ooo/vba/excel/XGlobals.idl
-index b21e902..782da39 100644
---- oovbaapi/ooo/vba/excel/XGlobals.idl
-+++ oovbaapi/ooo/vba/excel/XGlobals.idl
-@@ -76,6 +76,7 @@ XRange Intersect([in] XRange Arg1, [in] XRange Arg2, [in] /*Optional*/ any Arg3,
- any Names( [in] any Index );
- XRange Union([in] XRange Arg1, [in] XRange Arg2, [in] /*Optional*/ any Arg3, [in] /*Optional*/ any Arg4, [in] /*Optional*/ any Arg5, [in] /*Optional*/ any Arg6, [in] /*Optional*/ any Arg7, [in] /*Optional*/ any Arg8, [in] /*Optional*/ any Arg9, [in] /*Optional*/ any Arg10, [in] /*Optional*/ any Arg11, [in] /*Optional*/ any Arg12, [in] /*Optional*/ any Arg13, [in] /*Optional*/ any Arg14, [in] /*Optional*/ any Arg15, [in] /*Optional*/ any Arg16, [in] /*Optional*/ any Arg17, [in] /*Optional*/ any Arg18, [in] /*Optional*/ any Arg19, [in] /*Optional*/ any Arg20, [in] /*Optional*/ any Arg21, [in] /*Optional*/ any Arg22, [in] /*Optional*/ any Arg23, [in] /*Optional*/ any Arg24, [in] /*Optional*/ any Arg25, [in] /*Optional*/ any Arg26, [in] /*Optional*/ any Arg27, [in] /*Optional*/ any Arg28, [in] /*Optional*/ any Arg29, [in] /*Optional*/ any Arg30)
- raises(com::sun::star::script::BasicErrorException);
-+ any MenuBars( [in] any aIndex );
-
- };
-
-diff --git oovbaapi/ooo/vba/excel/XMenu.idl oovbaapi/ooo/vba/excel/XMenu.idl
-new file mode 100644
-index 0000000..cb3698b
---- /dev/null
-+++ oovbaapi/ooo/vba/excel/XMenu.idl
-@@ -0,0 +1,62 @@
-+/*************************************************************************
-+ *
-+ * 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 __ooo_vba_excel_XMenu_idl__
-+#define __ooo_vba_excel_XMenu_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+//=============================================================================
-+
-+module ooo { module vba { module excel {
-+//=============================================================================
-+
-+interface XMenu
-+{
-+ interface XHelperInterface;
-+
-+ [attribute] string Caption;
-+
-+ void Delete() raises ( com::sun::star::script::BasicErrorException );
-+ any MenuItems( [in] any Index ) raises ( com::sun::star::script::BasicErrorException );
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/excel/XMenuBar.idl oovbaapi/ooo/vba/excel/XMenuBar.idl
-new file mode 100644
-index 0000000..3ead272
---- /dev/null
-+++ oovbaapi/ooo/vba/excel/XMenuBar.idl
-@@ -0,0 +1,59 @@
-+/*************************************************************************
-+ *
-+ * 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 __ooo_vba_excel_XMenuBar_idl__
-+#define __ooo_vba_excel_XMenuBar_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+//=============================================================================
-+
-+module ooo { module vba { module excel {
-+//=============================================================================
-+
-+interface XMenuBar
-+{
-+ interface XHelperInterface;
-+
-+ any Menus( [in] any Index ) raises ( com::sun::star::script::BasicErrorException );
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/excel/XMenuBars.idl oovbaapi/ooo/vba/excel/XMenuBars.idl
-new file mode 100644
-index 0000000..3a46c3b
---- /dev/null
-+++ oovbaapi/ooo/vba/excel/XMenuBars.idl
-@@ -0,0 +1,66 @@
-+/*************************************************************************
-+ *
-+ * 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: XMenuBars.idl,v $
-+ * $Revision: 1.0 $
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_excel_XMenuBars_idl__
-+#define __ooo_vba_excel_XMenuBars_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+#ifndef __com_sun_star_helper_script_BasicErrorException_idl__
-+#include <com/sun/star/script/BasicErrorException.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+//=============================================================================
-+
-+module ooo { module vba { module excel {
-+
-+//=============================================================================
-+
-+interface XMenuBars
-+{
-+ interface ooo::vba::XCollection;
-+};
-+
-+//=============================================================================
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/excel/XMenuItem.idl oovbaapi/ooo/vba/excel/XMenuItem.idl
-new file mode 100644
-index 0000000..2dcfb2f
---- /dev/null
-+++ oovbaapi/ooo/vba/excel/XMenuItem.idl
-@@ -0,0 +1,62 @@
-+/*************************************************************************
-+ *
-+ * 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 __ooo_vba_excel_XMenuItem_idl__
-+#define __ooo_vba_excel_XMenuItem_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+//=============================================================================
-+
-+module ooo { module vba { module excel {
-+//=============================================================================
-+
-+interface XMenuItem
-+{
-+ interface XHelperInterface;
-+
-+ [attribute] string Caption;
-+ [attribute] string OnAction;
-+
-+ void Delete() raises ( com::sun::star::script::BasicErrorException );
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/excel/XMenuItems.idl oovbaapi/ooo/vba/excel/XMenuItems.idl
-new file mode 100644
-index 0000000..9ba7b38
---- /dev/null
-+++ oovbaapi/ooo/vba/excel/XMenuItems.idl
-@@ -0,0 +1,70 @@
-+/*************************************************************************
-+ *
-+ * 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: XMenuItems.idl,v $
-+ * $Revision: 1.0 $
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_excel_XMenuItems_idl__
-+#define __ooo_vba_excel_XMenuItems_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+#ifndef __com_sun_star_helper_script_BasicErrorException_idl__
-+#include <com/sun/star/script/BasicErrorException.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+//=============================================================================
-+
-+module ooo { module vba { module excel {
-+
-+//=============================================================================
-+
-+interface XMenuItem;
-+
-+interface XMenuItems
-+{
-+ interface ooo::vba::XCollection;
-+
-+ XMenuItem Add( [in] string Caption, [in] any OnAction, [in] any ShortcutKey, [in] any Before, [in] any Restore, [in] any StatusBar, [in] any HelpFile, [in] any HelpContextID ) raises ( com::sun::star::script::BasicErrorException );
-+};
-+
-+//=============================================================================
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/excel/XMenus.idl oovbaapi/ooo/vba/excel/XMenus.idl
-new file mode 100644
-index 0000000..c8e4ea2
---- /dev/null
-+++ oovbaapi/ooo/vba/excel/XMenus.idl
-@@ -0,0 +1,70 @@
-+/*************************************************************************
-+ *
-+ * 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: XMenus.idl,v $
-+ * $Revision: 1.0 $
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_excel_XMenus_idl__
-+#define __ooo_vba_excel_XMenus_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+#ifndef __com_sun_star_helper_script_BasicErrorException_idl__
-+#include <com/sun/star/script/BasicErrorException.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+//=============================================================================
-+
-+module ooo { module vba { module excel {
-+
-+//=============================================================================
-+
-+interface XMenu;
-+
-+interface XMenus
-+{
-+ interface ooo::vba::XCollection;
-+
-+ XMenu Add( [in] string Caption, [in] any Before, [in] any Restore ) raises ( com::sun::star::script::BasicErrorException );
-+};
-+
-+//=============================================================================
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/excel/makefile.mk oovbaapi/ooo/vba/excel/makefile.mk
-index 232f83c..f3ad793 100644
---- oovbaapi/ooo/vba/excel/makefile.mk
-+++ oovbaapi/ooo/vba/excel/makefile.mk
-@@ -103,6 +103,12 @@ IDLFILES= XGlobals.idl\
- XVPageBreak.idl \
- XVPageBreaks.idl \
- TextFrame.idl \
-+ XMenuBar.idl \
-+ XMenuBars.idl \
-+ XMenu.idl \
-+ XMenus.idl \
-+ XMenuItem.idl \
-+ XMenuItems.idl \
-
-
- # ------------------------------------------------------------------
-diff --git sc/source/ui/vba/makefile.mk sc/source/ui/vba/makefile.mk
-index 9350a3b..2f8a16f 100644
---- sc/source/ui/vba/makefile.mk
-+++ sc/source/ui/vba/makefile.mk
-@@ -104,7 +104,13 @@ SLOFILES= \
- $(SLO)$/vbapagebreak.obj \
- $(SLO)$/vbapagebreaks.obj \
- $(SLO)$/service.obj \
-- $(SLO)$/vbaeventshelper.obj
-+ $(SLO)$/vbaeventshelper.obj \
-+ $(SLO)$/vbamenubar.obj \
-+ $(SLO)$/vbamenubars.obj \
-+ $(SLO)$/vbamenu.obj \
-+ $(SLO)$/vbamenus.obj \
-+ $(SLO)$/vbamenuitem.obj \
-+ $(SLO)$/vbamenuitems.obj \
-
- # --- Targets ------------------------------------------------------
-
-diff --git sc/source/ui/vba/vbaapplication.cxx sc/source/ui/vba/vbaapplication.cxx
-index c06f3bd..68d0834 100644
---- sc/source/ui/vba/vbaapplication.cxx
-+++ sc/source/ui/vba/vbaapplication.cxx
-@@ -43,6 +43,7 @@
- #include <ooo/vba/excel/XlMousePointer.hpp>
- #include <com/sun/star/sheet/XNamedRanges.hpp>
- #include <com/sun/star/sheet/XCellRangeAddressable.hpp>
-+#include<ooo/vba/XCommandBars.hpp>
-
- #include "vbaapplication.hxx"
- #include "vbaworkbooks.hxx"
-@@ -54,6 +55,7 @@
- #include "vbawindow.hxx"
- #include "vbawindows.hxx"
- #include "vbaglobals.hxx"
-+#include "vbamenubars.hxx"
- #include "tabvwsh.hxx"
- #include "gridwin.hxx"
- #include "vbanames.hxx"
-@@ -1186,6 +1188,19 @@ ScVbaApplication::getCurrentDocument() throw (css::uno::RuntimeException)
- return getCurrentExcelDoc();
- }
-
-+uno::Any SAL_CALL
-+ScVbaApplication::MenuBars( const uno::Any& aIndex ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< XCommandBars > xCommandBars( CommandBars( uno::Any() ), uno::UNO_QUERY_THROW );
-+ uno::Reference< XCollection > xMenuBars( new ScVbaMenuBars( this, mxContext, xCommandBars ) );
-+ if ( aIndex.hasValue() )
-+ {
-+ return uno::Any ( xMenuBars->Item( aIndex, uno::Any() ) );
-+ }
-+
-+ return uno::Any( xMenuBars );
-+}
-+
- rtl::OUString&
- ScVbaApplication::getServiceImplName()
- {
-diff --git sc/source/ui/vba/vbaapplication.hxx sc/source/ui/vba/vbaapplication.hxx
-index d7098b4..8e5da56 100644
---- sc/source/ui/vba/vbaapplication.hxx
-+++ sc/source/ui/vba/vbaapplication.hxx
-@@ -101,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 css::uno::Any SAL_CALL Caller( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL MenuBars( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-diff --git sc/source/ui/vba/vbaglobals.cxx sc/source/ui/vba/vbaglobals.cxx
-index d32eb78..ac5e4f5 100644
---- sc/source/ui/vba/vbaglobals.cxx
-+++ sc/source/ui/vba/vbaglobals.cxx
-@@ -211,6 +211,12 @@ ScVbaGlobals::Rows( const uno::Any& aIndex ) throw (uno::RuntimeException)
-
- }
-
-+uno::Any SAL_CALL
-+ScVbaGlobals::MenuBars( const uno::Any& aIndex ) throw (uno::RuntimeException)
-+{
-+ return uno::Any( getApplication()->MenuBars(aIndex) );
-+}
-+
- uno::Sequence< ::rtl::OUString > SAL_CALL
- ScVbaGlobals::getAvailableServiceNames( ) throw (uno::RuntimeException)
- {
-diff --git sc/source/ui/vba/vbaglobals.hxx sc/source/ui/vba/vbaglobals.hxx
-index 89861ee..66dd1fa 100644
---- sc/source/ui/vba/vbaglobals.hxx
-+++ sc/source/ui/vba/vbaglobals.hxx
-@@ -83,6 +83,8 @@ typedef ::cppu::ImplInheritanceHelper1< VbaGlobalsBase, ov::excel::XGlobals > Sc
- 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);
-
-+ virtual css::uno::Any SAL_CALL MenuBars( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+
-
-
- // XMultiServiceFactory
-diff --git sc/source/ui/vba/vbamenu.cxx sc/source/ui/vba/vbamenu.cxx
-new file mode 100644
-index 0000000..58972b0
---- /dev/null
-+++ sc/source/ui/vba/vbamenu.cxx
-@@ -0,0 +1,91 @@
-+/*************************************************************************
-+ *
-+ * 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 "vbamenu.hxx"
-+#include "vbamenuitems.hxx"
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+
-+ScVbaMenu::ScVbaMenu( const uno::Reference< ov::XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< XCommandBarControl >& xCommandBarControl ) throw( uno::RuntimeException ) : Menu_BASE( xParent, xContext ), m_xCommandBarControl( xCommandBarControl )
-+{
-+}
-+
-+::rtl::OUString SAL_CALL
-+ScVbaMenu::getCaption() throw ( uno::RuntimeException )
-+{
-+ return m_xCommandBarControl->getCaption();
-+}
-+
-+void SAL_CALL
-+ScVbaMenu::setCaption( const ::rtl::OUString& _caption ) throw (uno::RuntimeException)
-+{
-+ m_xCommandBarControl->setCaption( _caption );
-+}
-+
-+void SAL_CALL
-+ScVbaMenu::Delete( ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ m_xCommandBarControl->Delete();
-+}
-+
-+uno::Any SAL_CALL
-+ScVbaMenu::MenuItems( const uno::Any& aIndex ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ uno::Reference< XCommandBarControls > xCommandBarControls( m_xCommandBarControl->Controls( uno::Any() ), uno::UNO_QUERY_THROW );
-+ uno::Reference< excel::XMenuItems > xMenuItems( new ScVbaMenuItems( this, mxContext, xCommandBarControls ) );
-+ if( aIndex.hasValue() )
-+ {
-+ return xMenuItems->Item( aIndex, uno::Any() );
-+ }
-+ return uno::makeAny( xMenuItems );
-+}
-+
-+rtl::OUString&
-+ScVbaMenu::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaMenu") );
-+ return sImplName;
-+}
-+uno::Sequence<rtl::OUString>
-+ScVbaMenu::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Menu" ) );
-+ }
-+ return aServiceNames;
-+}
-diff --git sc/source/ui/vba/vbamenu.hxx sc/source/ui/vba/vbamenu.hxx
-new file mode 100644
-index 0000000..cd96857
---- /dev/null
-+++ sc/source/ui/vba/vbamenu.hxx
-@@ -0,0 +1,62 @@
-+/*************************************************************************
-+ *
-+ * 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_MENU_HXX
-+#define SC_VBA_MENU_HXX
-+
-+#include <ooo/vba/excel/XMenu.hpp>
-+#include <ooo/vba/XCommandBarControl.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+
-+typedef InheritedHelperInterfaceImpl1< ov::excel::XMenu > Menu_BASE;
-+
-+class ScVbaMenu : public Menu_BASE
-+{
-+private:
-+ css::uno::Reference< ov::XCommandBarControl > m_xCommandBarControl;
-+
-+public:
-+ ScVbaMenu( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, const css::uno::Reference< ov::XCommandBarControl >& xCommandBarControl ) 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);
-+
-+ virtual void SAL_CALL Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL MenuItems( const css::uno::Any& aIndex ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif//SC_VBA_MENU_HXX
-diff --git sc/source/ui/vba/vbamenubar.cxx sc/source/ui/vba/vbamenubar.cxx
-new file mode 100644
-index 0000000..9386028
---- /dev/null
-+++ sc/source/ui/vba/vbamenubar.cxx
-@@ -0,0 +1,74 @@
-+/*************************************************************************
-+ *
-+ * 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 "vbamenubar.hxx"
-+#include "vbamenus.hxx"
-+#include <ooo/vba/XCommandBarControls.hpp>
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+
-+ScVbaMenuBar::ScVbaMenuBar( const uno::Reference< ov::XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< XCommandBar >& xCommandBar ) throw( uno::RuntimeException ) : MenuBar_BASE( xParent, xContext ), m_xCommandBar( xCommandBar )
-+{
-+}
-+
-+uno::Any SAL_CALL
-+ScVbaMenuBar::Menus( const uno::Any& aIndex ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ uno::Reference< XCommandBarControls > xCommandBarControls( m_xCommandBar->Controls( uno::Any() ), uno::UNO_QUERY_THROW );
-+ uno::Reference< excel::XMenus > xMenus( new ScVbaMenus( this, mxContext, xCommandBarControls ) );
-+ if( aIndex.hasValue() )
-+ {
-+ return xMenus->Item( aIndex, uno::Any() );
-+ }
-+ return uno::makeAny( xMenus );
-+}
-+
-+rtl::OUString&
-+ScVbaMenuBar::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaMenuBar") );
-+ return sImplName;
-+}
-+uno::Sequence<rtl::OUString>
-+ScVbaMenuBar::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.MenuBar" ) );
-+ }
-+ return aServiceNames;
-+}
-diff --git sc/source/ui/vba/vbamenubar.hxx sc/source/ui/vba/vbamenubar.hxx
-new file mode 100644
-index 0000000..fa39054
---- /dev/null
-+++ sc/source/ui/vba/vbamenubar.hxx
-@@ -0,0 +1,58 @@
-+/*************************************************************************
-+ *
-+ * 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_MENUBAR_HXX
-+#define SC_VBA_MENUBAR_HXX
-+
-+#include <ooo/vba/excel/XMenuBar.hpp>
-+#include <ooo/vba/XCommandBar.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+
-+typedef InheritedHelperInterfaceImpl1< ov::excel::XMenuBar > MenuBar_BASE;
-+
-+class ScVbaMenuBar : public MenuBar_BASE
-+{
-+private:
-+ css::uno::Reference< ov::XCommandBar > m_xCommandBar;
-+
-+public:
-+ ScVbaMenuBar( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, const css::uno::Reference< ov::XCommandBar >& xCommandBar ) throw( css::uno::RuntimeException );
-+
-+ virtual css::uno::Any SAL_CALL Menus( const css::uno::Any& aIndex ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif//SC_VBA_MENUBAR_HXX
-diff --git sc/source/ui/vba/vbamenubars.cxx sc/source/ui/vba/vbamenubars.cxx
-new file mode 100644
-index 0000000..a5f9e9b
---- /dev/null
-+++ sc/source/ui/vba/vbamenubars.cxx
-@@ -0,0 +1,146 @@
-+/*************************************************************************
-+ *
-+ * 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 "vbamenubars.hxx"
-+#include "vbamenubar.hxx"
-+#include <ooo/vba/excel/XlSheetType.hpp>
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+
-+
-+typedef ::cppu::WeakImplHelper1< container::XEnumeration > MenuBarEnumeration_BASE;
-+
-+class MenuBarEnumeration : public MenuBarEnumeration_BASE
-+{
-+ uno::Reference< XHelperInterface > m_xParent;
-+ uno::Reference< uno::XComponentContext > m_xContext;
-+ uno::Reference< container::XEnumeration > m_xEnumeration;
-+public:
-+ MenuBarEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration) throw ( uno::RuntimeException ) : m_xParent( xParent ), m_xContext( xContext ), m_xEnumeration( xEnumeration )
-+ {
-+ }
-+ virtual sal_Bool SAL_CALL hasMoreElements() throw ( uno::RuntimeException )
-+ {
-+ return m_xEnumeration->hasMoreElements();
-+ }
-+ virtual uno::Any SAL_CALL nextElement() throw ( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
-+ {
-+ // FIXME: should be add menubar
-+ if( hasMoreElements() )
-+ {
-+ uno::Reference< XCommandBar > xCommandBar( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
-+ uno::Reference< excel::XMenuBar > xMenuBar( new ScVbaMenuBar( m_xParent, m_xContext, xCommandBar ) );
-+ return uno::makeAny( xMenuBar );
-+ }
-+ else
-+ throw container::NoSuchElementException();
-+ return uno::Any();
-+ }
-+};
-+
-+ScVbaMenuBars::ScVbaMenuBars( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< XCommandBars >& xCommandBars ) throw ( uno::RuntimeException ) : MenuBars_BASE( xParent, xContext, uno::Reference< container::XIndexAccess>() ), m_xCommandBars( xCommandBars )
-+{
-+}
-+
-+ScVbaMenuBars::~ScVbaMenuBars()
-+{
-+}
-+
-+// XEnumerationAccess
-+uno::Type SAL_CALL
-+ScVbaMenuBars::getElementType() throw ( uno::RuntimeException )
-+{
-+ return excel::XMenuBar::static_type( 0 );
-+}
-+
-+uno::Reference< container::XEnumeration >
-+ScVbaMenuBars::createEnumeration() throw ( uno::RuntimeException )
-+{
-+ uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xCommandBars, uno::UNO_QUERY_THROW );
-+ return uno::Reference< container::XEnumeration >( new MenuBarEnumeration( this, mxContext, xEnumAccess->createEnumeration() ) );
-+}
-+
-+uno::Any
-+ScVbaMenuBars::createCollectionObject( const uno::Any& aSource )
-+{
-+ // make no sense
-+ return aSource;
-+}
-+
-+sal_Int32 SAL_CALL
-+ScVbaMenuBars::getCount() throw(css::uno::RuntimeException)
-+{
-+ return m_xCommandBars->getCount();
-+}
-+
-+// ScVbaCollectionBaseImpl
-+uno::Any SAL_CALL
-+ScVbaMenuBars::Item( const uno::Any& aIndex, const uno::Any& /*aIndex2*/ ) throw( uno::RuntimeException )
-+{
-+ sal_Int16 nIndex = 0;
-+ aIndex >>= nIndex;
-+ if( nIndex == excel::XlSheetType::xlWorksheet )
-+ {
-+ uno::Any aSource;
-+ aSource <<= rtl::OUString::createFromAscii( "Worksheet Menu Bar" );
-+ uno::Reference< XCommandBar > xCommandBar( m_xCommandBars->Item( aSource, uno::Any() ), uno::UNO_QUERY_THROW );
-+ uno::Reference< excel::XMenuBar > xMenuBar( new ScVbaMenuBar( this, mxContext, xCommandBar ) );
-+ return uno::makeAny( xMenuBar );
-+ }
-+
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+
-+ return uno::Any();
-+}
-+
-+// XHelperInterface
-+rtl::OUString&
-+ScVbaMenuBars::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaMenuBars") );
-+ return sImplName;
-+}
-+uno::Sequence<rtl::OUString>
-+ScVbaMenuBars::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.MenuBars" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sc/source/ui/vba/vbamenubars.hxx sc/source/ui/vba/vbamenubars.hxx
-new file mode 100644
-index 0000000..0d8ea58
---- /dev/null
-+++ sc/source/ui/vba/vbamenubars.hxx
-@@ -0,0 +1,69 @@
-+/*************************************************************************
-+ *
-+ * 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_MENUBARS_HXX
-+#define SC_VBA_MENUBARS_HXX
-+
-+#include <ooo/vba/excel/XMenuBars.hpp>
-+#include <ooo/vba/excel/XMenuBar.hpp>
-+#include <ooo/vba/XCommandBars.hpp>
-+#include <com/sun/star/container/XNameAccess.hpp>
-+#include <cppuhelper/implbase1.hxx>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <vbahelper/vbacollectionimpl.hxx>
-+
-+typedef CollTestImplHelper< ov::excel::XMenuBars > MenuBars_BASE;
-+
-+class ScVbaMenuBars : public MenuBars_BASE
-+{
-+private:
-+ css::uno::Reference< ov::XCommandBars > m_xCommandBars;
-+
-+public:
-+ ScVbaMenuBars( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< ov::XCommandBars >& xCommandBars ) throw (css::uno::RuntimeException);
-+ virtual ~ScVbaMenuBars();
-+
-+ // 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<rtl::OUString> getServiceNames();
-+};
-+
-+#endif//SC_VBA_MENUBARS_HXX
-diff --git sc/source/ui/vba/vbamenuitem.cxx sc/source/ui/vba/vbamenuitem.cxx
-new file mode 100644
-index 0000000..48254cc
---- /dev/null
-+++ sc/source/ui/vba/vbamenuitem.cxx
-@@ -0,0 +1,90 @@
-+/*************************************************************************
-+ *
-+ * 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 "vbamenuitem.hxx"
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+
-+ScVbaMenuItem::ScVbaMenuItem( const uno::Reference< ov::XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, const uno::Reference< XCommandBarControl >& xCommandBarControl ) throw( uno::RuntimeException ) : MenuItem_BASE( xParent, xContext ), m_xCommandBarControl( xCommandBarControl )
-+{
-+}
-+
-+::rtl::OUString SAL_CALL
-+ScVbaMenuItem::getCaption() throw ( uno::RuntimeException )
-+{
-+ return m_xCommandBarControl->getCaption();
-+}
-+
-+void SAL_CALL
-+ScVbaMenuItem::setCaption( const ::rtl::OUString& _caption ) throw (uno::RuntimeException)
-+{
-+ m_xCommandBarControl->setCaption( _caption );
-+}
-+
-+::rtl::OUString SAL_CALL
-+ScVbaMenuItem::getOnAction() throw ( uno::RuntimeException )
-+{
-+ return m_xCommandBarControl->getOnAction();
-+}
-+
-+void SAL_CALL
-+ScVbaMenuItem::setOnAction( const ::rtl::OUString& _onaction ) throw (uno::RuntimeException)
-+{
-+ m_xCommandBarControl->setOnAction( _onaction );
-+}
-+
-+void SAL_CALL
-+ScVbaMenuItem::Delete( ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ m_xCommandBarControl->Delete();
-+}
-+
-+rtl::OUString&
-+ScVbaMenuItem::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaMenuItem") );
-+ return sImplName;
-+}
-+uno::Sequence<rtl::OUString>
-+ScVbaMenuItem::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.MenuItem" ) );
-+ }
-+ return aServiceNames;
-+}
-diff --git sc/source/ui/vba/vbamenuitem.hxx sc/source/ui/vba/vbamenuitem.hxx
-new file mode 100644
-index 0000000..bf4c087
---- /dev/null
-+++ sc/source/ui/vba/vbamenuitem.hxx
-@@ -0,0 +1,63 @@
-+/*************************************************************************
-+ *
-+ * 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_MENUITEM_HXX
-+#define SC_VBA_MENUITEM_HXX
-+
-+#include <ooo/vba/excel/XMenuItem.hpp>
-+#include <ooo/vba/XCommandBarControl.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+
-+typedef InheritedHelperInterfaceImpl1< ov::excel::XMenuItem > MenuItem_BASE;
-+
-+class ScVbaMenuItem : public MenuItem_BASE
-+{
-+private:
-+ css::uno::Reference< ov::XCommandBarControl > m_xCommandBarControl;
-+
-+public:
-+ ScVbaMenuItem( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, const css::uno::Reference< ov::XCommandBarControl >& xCommandBarControl ) 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);
-+ virtual ::rtl::OUString SAL_CALL getOnAction() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setOnAction( const ::rtl::OUString& _onaction ) throw (css::uno::RuntimeException);
-+
-+ virtual void SAL_CALL Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif//SC_VBA_MENUITEM_HXX
-diff --git sc/source/ui/vba/vbamenuitems.cxx sc/source/ui/vba/vbamenuitems.cxx
-new file mode 100644
-index 0000000..3a5cd79
---- /dev/null
-+++ sc/source/ui/vba/vbamenuitems.cxx
-@@ -0,0 +1,159 @@
-+/*************************************************************************
-+ *
-+ * 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 "vbamenuitems.hxx"
-+#include "vbamenuitem.hxx"
-+#include "vbamenu.hxx"
-+#include <ooo/vba/office/MsoControlType.hpp>
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+
-+
-+typedef ::cppu::WeakImplHelper1< container::XEnumeration > MenuEnumeration_BASE;
-+
-+class MenuEnumeration : public MenuEnumeration_BASE
-+{
-+ uno::Reference< XHelperInterface > m_xParent;
-+ uno::Reference< uno::XComponentContext > m_xContext;
-+ uno::Reference< container::XEnumeration > m_xEnumeration;
-+public:
-+ MenuEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration) throw ( uno::RuntimeException ) : m_xParent( xParent ), m_xContext( xContext ), m_xEnumeration( xEnumeration )
-+ {
-+ }
-+ virtual sal_Bool SAL_CALL hasMoreElements() throw ( uno::RuntimeException )
-+ {
-+ return m_xEnumeration->hasMoreElements();
-+ }
-+ virtual uno::Any SAL_CALL nextElement() throw ( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
-+ {
-+ // FIXME: should be add menu
-+ if( hasMoreElements() )
-+ {
-+ uno::Reference< XCommandBarControl > xCommandBarControl( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
-+ if( xCommandBarControl->getType() == office::MsoControlType::msoControlPopup )
-+ {
-+ uno::Reference< excel::XMenu > xMenu( new ScVbaMenu( m_xParent, m_xContext, xCommandBarControl ) );
-+ return uno::makeAny( xMenu );
-+ }
-+ else if( xCommandBarControl->getType() == office::MsoControlType::msoControlButton )
-+ {
-+ uno::Reference< excel::XMenuItem > xMenuItem( new ScVbaMenuItem( m_xParent, m_xContext, xCommandBarControl ) );
-+ return uno::makeAny( xMenuItem );
-+ }
-+ nextElement();
-+ }
-+ else
-+ throw container::NoSuchElementException();
-+ return uno::Any();
-+ }
-+};
-+
-+ScVbaMenuItems::ScVbaMenuItems( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< XCommandBarControls >& xCommandBarControls ) throw ( uno::RuntimeException ) : MenuItems_BASE( xParent, xContext, uno::Reference< container::XIndexAccess>() ), m_xCommandBarControls( xCommandBarControls )
-+{
-+}
-+
-+// XEnumerationAccess
-+uno::Type SAL_CALL
-+ScVbaMenuItems::getElementType() throw ( uno::RuntimeException )
-+{
-+ return excel::XMenuItem::static_type( 0 );
-+}
-+
-+uno::Reference< container::XEnumeration >
-+ScVbaMenuItems::createEnumeration() throw ( uno::RuntimeException )
-+{
-+ uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xCommandBarControls, uno::UNO_QUERY_THROW );
-+ return uno::Reference< container::XEnumeration >( new MenuEnumeration( this, mxContext, xEnumAccess->createEnumeration() ) );
-+}
-+
-+uno::Any
-+ScVbaMenuItems::createCollectionObject( const uno::Any& aSource )
-+{
-+ // make no sense
-+ return aSource;
-+}
-+
-+sal_Int32 SAL_CALL
-+ScVbaMenuItems::getCount() throw(css::uno::RuntimeException)
-+{
-+ // FIXME: should check if it is a popup menu
-+ return m_xCommandBarControls->getCount();
-+}
-+
-+// ScVbaCollectionBaseImpl
-+uno::Any SAL_CALL
-+ScVbaMenuItems::Item( const uno::Any& aIndex, const uno::Any& /*aIndex2*/ ) throw( uno::RuntimeException )
-+{
-+ uno::Reference< XCommandBarControl > xCommandBarControl( m_xCommandBarControls->Item( aIndex, uno::Any() ), uno::UNO_QUERY_THROW );
-+ if( xCommandBarControl->getType() == office::MsoControlType::msoControlPopup )
-+ return uno::makeAny( uno::Reference< excel::XMenu > ( new ScVbaMenu( this, mxContext, xCommandBarControl ) ) );
-+ else if( xCommandBarControl->getType() == office::MsoControlType::msoControlButton )
-+ return uno::makeAny( uno::Reference< excel::XMenuItem > ( new ScVbaMenuItem( this, mxContext, xCommandBarControl ) ) );
-+ throw uno::RuntimeException();
-+}
-+
-+uno::Reference< excel::XMenuItem > SAL_CALL ScVbaMenuItems::Add( const rtl::OUString& Caption, const css::uno::Any& OnAction, const css::uno::Any& /*ShortcutKey*/, const css::uno::Any& Before, const css::uno::Any& Restore, const css::uno::Any& /*StatusBar*/, const css::uno::Any& /*HelpFile*/, const css::uno::Any& /*HelpContextID*/ ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
-+{
-+ sal_Int32 nType = office::MsoControlType::msoControlButton;
-+ uno::Reference< XCommandBarControl > xCommandBarControl = m_xCommandBarControls->Add( uno::makeAny( nType ), uno::Any(), uno::Any(), Before, Restore );
-+ xCommandBarControl->setCaption( Caption );
-+ if( OnAction.hasValue() )
-+ {
-+ rtl::OUString sAction;
-+ OnAction >>= sAction;
-+ xCommandBarControl->setOnAction( sAction );
-+ }
-+ return uno::Reference< excel::XMenuItem >( new ScVbaMenuItem( this, mxContext, xCommandBarControl ) );
-+}
-+
-+// XHelperInterface
-+rtl::OUString&
-+ScVbaMenuItems::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaMenuItems") );
-+ return sImplName;
-+}
-+uno::Sequence<rtl::OUString>
-+ScVbaMenuItems::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.MenuItems" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sc/source/ui/vba/vbamenuitems.hxx sc/source/ui/vba/vbamenuitems.hxx
-new file mode 100644
-index 0000000..8aeb931
---- /dev/null
-+++ sc/source/ui/vba/vbamenuitems.hxx
-@@ -0,0 +1,68 @@
-+/*************************************************************************
-+ *
-+ * 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_MENUITEMS_HXX
-+#define SC_VBA_MENUITEMS_HXX
-+
-+#include <ooo/vba/excel/XMenuItems.hpp>
-+#include <ooo/vba/excel/XMenuItem.hpp>
-+#include <ooo/vba/XCommandBarControls.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <vbahelper/vbacollectionimpl.hxx>
-+
-+typedef CollTestImplHelper< ov::excel::XMenuItems > MenuItems_BASE;
-+
-+class ScVbaMenuItems : public MenuItems_BASE
-+{
-+private:
-+ css::uno::Reference< ov::XCommandBarControls > m_xCommandBarControls;
-+
-+public:
-+ ScVbaMenuItems( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< ov::XCommandBarControls >& xCommandBarControls ) 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 sal_Int32 SAL_CALL getCount() throw(css::uno::RuntimeException);
-+ 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::excel::XMenuItem > SAL_CALL Add( const rtl::OUString& Caption, const css::uno::Any& OnAction, const css::uno::Any& ShortcutKey, const css::uno::Any& Before, const css::uno::Any& Restore, const css::uno::Any& StatusBar, const css::uno::Any& HelpFile, const css::uno::Any& HelpContextID ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif//SC_VBA_MENUITEMS_HXX
-diff --git sc/source/ui/vba/vbamenus.cxx sc/source/ui/vba/vbamenus.cxx
-new file mode 100644
-index 0000000..7d5a21b
---- /dev/null
-+++ sc/source/ui/vba/vbamenus.cxx
-@@ -0,0 +1,145 @@
-+/*************************************************************************
-+ *
-+ * 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 "vbamenus.hxx"
-+#include "vbamenu.hxx"
-+#include <ooo/vba/office/MsoControlType.hpp>
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+
-+
-+typedef ::cppu::WeakImplHelper1< container::XEnumeration > MenuEnumeration_BASE;
-+
-+class MenuEnumeration : public MenuEnumeration_BASE
-+{
-+ uno::Reference< XHelperInterface > m_xParent;
-+ uno::Reference< uno::XComponentContext > m_xContext;
-+ uno::Reference< container::XEnumeration > m_xEnumeration;
-+public:
-+ MenuEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration) throw ( uno::RuntimeException ) : m_xParent( xParent ), m_xContext( xContext ), m_xEnumeration( xEnumeration )
-+ {
-+ }
-+ virtual sal_Bool SAL_CALL hasMoreElements() throw ( uno::RuntimeException )
-+ {
-+ return m_xEnumeration->hasMoreElements();
-+ }
-+ virtual uno::Any SAL_CALL nextElement() throw ( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
-+ {
-+ // FIXME: should be add menu
-+ if( hasMoreElements() )
-+ {
-+ uno::Reference< XCommandBarControl > xCommandBarControl( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
-+ if( xCommandBarControl->getType() == office::MsoControlType::msoControlPopup )
-+ {
-+ uno::Reference< excel::XMenu > xMenu( new ScVbaMenu( m_xParent, m_xContext, xCommandBarControl ) );
-+ return uno::makeAny( xMenu );
-+ }
-+ nextElement();
-+ }
-+ else
-+ throw container::NoSuchElementException();
-+ return uno::Any();
-+ }
-+};
-+
-+ScVbaMenus::ScVbaMenus( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< XCommandBarControls >& xCommandBarControls ) throw ( uno::RuntimeException ) : Menus_BASE( xParent, xContext, uno::Reference< container::XIndexAccess>() ), m_xCommandBarControls( xCommandBarControls )
-+{
-+}
-+
-+// XEnumerationAccess
-+uno::Type SAL_CALL
-+ScVbaMenus::getElementType() throw ( uno::RuntimeException )
-+{
-+ return excel::XMenu::static_type( 0 );
-+}
-+
-+uno::Reference< container::XEnumeration >
-+ScVbaMenus::createEnumeration() throw ( uno::RuntimeException )
-+{
-+ uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xCommandBarControls, uno::UNO_QUERY_THROW );
-+ return uno::Reference< container::XEnumeration >( new MenuEnumeration( this, mxContext, xEnumAccess->createEnumeration() ) );
-+}
-+
-+uno::Any
-+ScVbaMenus::createCollectionObject( const uno::Any& aSource )
-+{
-+ // make no sense
-+ return aSource;
-+}
-+
-+sal_Int32 SAL_CALL
-+ScVbaMenus::getCount() throw(css::uno::RuntimeException)
-+{
-+ // FIXME: should check if it is a popup menu
-+ return m_xCommandBarControls->getCount();
-+}
-+
-+// ScVbaCollectionBaseImpl
-+uno::Any SAL_CALL
-+ScVbaMenus::Item( const uno::Any& aIndex, const uno::Any& /*aIndex2*/ ) throw( uno::RuntimeException )
-+{
-+ uno::Reference< XCommandBarControl > xCommandBarControl( m_xCommandBarControls->Item( aIndex, uno::Any() ), uno::UNO_QUERY_THROW );
-+ if( xCommandBarControl->getType() != office::MsoControlType::msoControlPopup )
-+ throw uno::RuntimeException();
-+ return uno::makeAny( uno::Reference< excel::XMenu > ( new ScVbaMenu( this, mxContext, xCommandBarControl ) ) );
-+}
-+
-+uno::Reference< excel::XMenu > SAL_CALL ScVbaMenus::Add( const rtl::OUString& Caption, const css::uno::Any& Before, const css::uno::Any& Restore ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
-+{
-+ sal_Int32 nType = office::MsoControlType::msoControlPopup;
-+ uno::Reference< XCommandBarControl > xCommandBarControl = m_xCommandBarControls->Add( uno::makeAny( nType ), uno::Any(), uno::Any(), Before, Restore );
-+ xCommandBarControl->setCaption( Caption );
-+ return uno::Reference< excel::XMenu >( new ScVbaMenu( this, mxContext, xCommandBarControl ) );
-+}
-+
-+// XHelperInterface
-+rtl::OUString&
-+ScVbaMenus::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaMenus") );
-+ return sImplName;
-+}
-+uno::Sequence<rtl::OUString>
-+ScVbaMenus::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Menus" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sc/source/ui/vba/vbamenus.hxx sc/source/ui/vba/vbamenus.hxx
-new file mode 100644
-index 0000000..596127e
---- /dev/null
-+++ sc/source/ui/vba/vbamenus.hxx
-@@ -0,0 +1,68 @@
-+/*************************************************************************
-+ *
-+ * 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_MENUS_HXX
-+#define SC_VBA_MENUS_HXX
-+
-+#include <ooo/vba/excel/XMenus.hpp>
-+#include <ooo/vba/excel/XMenu.hpp>
-+#include <ooo/vba/XCommandBarControls.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <vbahelper/vbacollectionimpl.hxx>
-+
-+typedef CollTestImplHelper< ov::excel::XMenus > Menus_BASE;
-+
-+class ScVbaMenus : public Menus_BASE
-+{
-+private:
-+ css::uno::Reference< ov::XCommandBarControls > m_xCommandBarControls;
-+
-+public:
-+ ScVbaMenus( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< ov::XCommandBarControls >& xCommandBarControls ) 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 sal_Int32 SAL_CALL getCount() throw(css::uno::RuntimeException);
-+ 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::excel::XMenu > SAL_CALL Add( const rtl::OUString& Caption, const css::uno::Any& Before, const css::uno::Any& Restore ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif//SC_VBA_MENUS_HXX
diff --git a/patches/vba/vba-misc-tweakupstream-m2.diff b/patches/vba/vba-misc-tweakupstream-m2.diff
deleted file mode 100644
index 1add8f584..000000000
--- a/patches/vba/vba-misc-tweakupstream-m2.diff
+++ /dev/null
@@ -1,36 +0,0 @@
-diff --git basic/source/runtime/methods1.cxx basic/source/runtime/methods1.cxx
-index 9d3b51a..e429217 100644
---- basic/source/runtime/methods1.cxx
-+++ basic/source/runtime/methods1.cxx
-@@ -532,11 +532,18 @@ RTLFUNC(DoEvents)
- (void)pBasic;
- (void)bWrite;
- (void)rPar;
-+// don't undstand what upstream are up to
-+// we already process application events etc. in between
-+// basic runtime pcode ( on a timed basis )
-+#if 0
- Timer aTimer;
- aTimer.SetTimeout( 1 );
- aTimer.Start();
- while ( aTimer.IsActive() )
- Application::Yield();
-+#endif
-+ // always return 0
-+ rPar.Get(0)->PutInteger( 0 );
- }
-
- RTLFUNC(GetGUIVersion)
-diff --git basic/source/runtime/stdobj.cxx basic/source/runtime/stdobj.cxx
-index 38b995d..89de3b0 100644
---- basic/source/runtime/stdobj.cxx
-+++ basic/source/runtime/stdobj.cxx
-@@ -260,7 +260,7 @@ static Methods aMethods[] = {
- { "Dir", SbxSTRING, 2 | _FUNCTION, RTLNAME(Dir),0 },
- { "FileSpec", SbxSTRING, _OPT, NULL,0 },
- { "attrmask", SbxINTEGER, _OPT, NULL,0 },
--{ "DoEvents", SbxEMPTY, _FUNCTION, RTLNAME(DoEvents),0 },
-+{ "DoEvents", SbxINTEGER, _FUNCTION, RTLNAME(DoEvents),0 },
- { "DumpAllObjects", SbxEMPTY, 2 | _SUB, RTLNAME(DumpAllObjects),0 },
- { "FileSpec", SbxSTRING, 0,NULL,0 },
- { "DumpAll", SbxINTEGER, _OPT, NULL,0 },
diff --git a/patches/vba/vba-misc-tweakupstream.diff b/patches/vba/vba-misc-tweakupstream.diff
deleted file mode 100644
index 46a01d824..000000000
--- a/patches/vba/vba-misc-tweakupstream.diff
+++ /dev/null
@@ -1,54 +0,0 @@
-diff --git oox/source/ole/vbaproject.cxx oox/source/ole/vbaproject.cxx
-index 5acff7f..3db6de4 100755
---- oox/source/ole/vbaproject.cxx
-+++ oox/source/ole/vbaproject.cxx
-@@ -373,7 +373,10 @@ void VbaProject::importVba( StorageBase& rVbaPrjStrg, const GraphicHelper& rGrap
- // set library container to VBA compatibility mode
- try
- {
-- Reference< XVBACompatibility >( getLibraryContainer( PROP_BasicLibraries ), UNO_QUERY_THROW )->setVBACompatibilityMode( sal_True );
-+ Reference< XVBACompatibility > xVBACompat( getLibraryContainer( PROP_BasicLibraries ), UNO_QUERY_THROW );
-+ xVBACompat->setVBACompatibilityMode( sal_True );
-+ xVBACompat->setProjectName( maPrjName );
-+
- }
- catch( Exception& )
- {
-diff --git basic/source/runtime/methods1.cxx basic/source/runtime/methods1.cxx
-index 9d3b51a..e429217 100644
---- basic/source/runtime/methods1.cxx
-+++ basic/source/runtime/methods1.cxx
-@@ -532,13 +532,20 @@ RTLFUNC(DoEvents)
- (void)pBasic;
- (void)bWrite;
- (void)rPar;
-+// don't undstand what upstream are up to
-+// we already process application events etc. in between
-+// basic runtime pcode ( on a timed basis )
-+#if 0
- // Dummy implementation as the following code leads
- // to performance problems for unknown reasons
- //Timer aTimer;
- //aTimer.SetTimeout( 1 );
- //aTimer.Start();
- //while ( aTimer.IsActive() )
- // Application::Reschedule();
-+#endif
-+ // always return 0
-+ rPar.Get(0)->PutInteger( 0 );
- }
-
- RTLFUNC(GetGUIVersion)
-diff --git basic/source/runtime/stdobj.cxx basic/source/runtime/stdobj.cxx
-index 38b995d..89de3b0 100644
---- basic/source/runtime/stdobj.cxx
-+++ basic/source/runtime/stdobj.cxx
-@@ -260,7 +260,7 @@ static Methods aMethods[] = {
- { "Dir", SbxSTRING, 2 | _FUNCTION, RTLNAME(Dir),0 },
- { "FileSpec", SbxSTRING, _OPT, NULL,0 },
- { "attrmask", SbxINTEGER, _OPT, NULL,0 },
--{ "DoEvents", SbxEMPTY, _FUNCTION, RTLNAME(DoEvents),0 },
-+{ "DoEvents", SbxINTEGER, _FUNCTION, RTLNAME(DoEvents),0 },
- { "DumpAllObjects", SbxEMPTY, 2 | _SUB, RTLNAME(DumpAllObjects),0 },
- { "FileSpec", SbxSTRING, 0,NULL,0 },
- { "DumpAll", SbxINTEGER, _OPT, NULL,0 },
diff --git a/patches/vba/vba-msvbahelper-splitbuilt.diff b/patches/vba/vba-msvbahelper-splitbuilt.diff
deleted file mode 100644
index e381984da..000000000
--- a/patches/vba/vba-msvbahelper-splitbuilt.diff
+++ /dev/null
@@ -1,1767 +0,0 @@
-diff --git filter/inc/filter/msfilter/msvbahelper.hxx filter/inc/filter/msfilter/msvbahelper.hxx
-deleted file mode 100644
-index 1623fd3..0000000
---- filter/inc/filter/msfilter/msvbahelper.hxx
-+++ /dev/null
-@@ -1,59 +0,0 @@
--/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
--/*************************************************************************
-- *
-- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-- *
-- * Copyright 2000, 2010 Oracle and/or its affiliates.
-- *
-- * OpenOffice.org - a multi-platform office productivity suite
-- *
-- * 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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--#ifndef _MSVBAHELPER_HXX
--#define _MSVBAHELPER_HXX
--
--#include <sfx2/objsh.hxx>
--#include "filter/msfilter/msfilterdllapi.h"
--
--namespace ooo { namespace vba
--{
-- class MSFILTER_DLLPUBLIC VBAMacroResolvedInfo
-- {
-- SfxObjectShell* mpDocContext;
-- bool mbFound;
-- String msResolvedMacro;
-- public:
-- VBAMacroResolvedInfo() : mpDocContext(NULL), mbFound( false ){}
-- void SetResolved( bool bRes ) { mbFound = bRes; }
-- bool IsResolved() { return mbFound; }
-- void SetMacroDocContext(SfxObjectShell* pShell ) { mpDocContext = pShell; }
-- SfxObjectShell* MacroDocContext() { return mpDocContext; }
-- String ResolvedMacro() { return msResolvedMacro; }
-- void SetResolvedMacro(const String& sMacro ) { msResolvedMacro = sMacro; }
-- };
--
-- MSFILTER_DLLPUBLIC String makeMacroURL( const String& sMacroName );
-- MSFILTER_DLLPUBLIC ::rtl::OUString extractMacroName( const ::rtl::OUString& rMacroUrl );
-- MSFILTER_DLLPUBLIC VBAMacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const rtl::OUString& sMod, bool bSearchGlobalTemplates = false );
-- MSFILTER_DLLPUBLIC sal_Bool executeMacro( SfxObjectShell* pShell, const String& sMacroName, com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArgs, com::sun::star::uno::Any& aRet, const com::sun::star::uno::Any& aCaller );
--} }
--
--#endif
--
--/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
-diff --git filter/source/msfilter/makefile.mk filter/source/msfilter/makefile.mk
-index c59a126..b37dc7b 100644
---- filter/source/msfilter/makefile.mk
-+++ filter/source/msfilter/makefile.mk
-@@ -52,7 +52,6 @@ SLOFILES= \
- $(SLO)$/msfiltertracer.obj \
- $(SLO)$/svdfppt.obj \
- $(SLO)$/svxmsbas2.obj \
-- $(SLO)$/msvbahelper.obj \
- $(SLO)$/mstoolbar.obj\
-
- SHL1TARGET= msfilter$(DLLPOSTFIX)
-diff --git filter/source/msfilter/mstoolbar.cxx filter/source/msfilter/mstoolbar.cxx
-index eead43c..3b92f80 100644
---- filter/source/msfilter/mstoolbar.cxx
-+++ filter/source/msfilter/mstoolbar.cxx
-@@ -5,6 +5,7 @@
- #include <com/sun/star/ui/XImageManager.hpp>
- #include <com/sun/star/ui/ItemType.hpp>
- #include <com/sun/star/ui/ItemStyle.hpp>
-+#include <com/sun/star/script/theVBAMacroHelper.hpp>
- #include <com/sun/star/frame/XLayoutManager.hpp>
- #include <fstream>
- #include <vcl/graph.hxx>
-@@ -15,10 +16,10 @@
- #include <basic/basmgr.hxx>
- #include <svtools/filterutils.hxx>
- #include <boost/scoped_array.hpp>
--#include <filter/msfilter/msvbahelper.hxx>
- #include <svtools/miscopt.hxx>
- #include <vcl/svapp.hxx>
- #include <vcl/window.hxx>
-+#include <comphelper/processfactory.hxx>
-
- using namespace com::sun::star;
-
-@@ -488,9 +489,18 @@ TBCGeneralInfo::ImportToolBarControlData( CustomToolBarImportHelper& helper, std
- if ( extraInfo.getOnAction().getLength() )
- {
- aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CommandURL") );
-- ooo::vba::VBAMacroResolvedInfo aMacroInf = ooo::vba::resolveVBAMacro( &helper.GetDocShell(), extraInfo.getOnAction(), true );
-- if ( aMacroInf.IsResolved() )
-- aProp.Value = helper.createCommandFromMacro( aMacroInf.ResolvedMacro() );
-+ uno::Reference< script::XVBAMacroResolvedInfo > xMacroInf;
-+ try
-+ {
-+ uno::Reference< script::XVBAMacroHelper > xMacroHelper = script::theVBAMacroHelper::get( comphelper::getProcessComponentContext() );
-+ xMacroInf = xMacroHelper->resolveVBAMacro( helper.GetDocShell().GetModel(), extraInfo.getOnAction(), sal_True );
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ }
-+
-+ if ( xMacroInf.is() && xMacroInf->getResolved() )
-+ aProp.Value = helper.createCommandFromMacro( xMacroInf->getResolvedMacro() );
- else
- aProp.Value <<= rtl::OUString::createFromAscii("UnResolvedMacro[").concat( extraInfo.getOnAction() ).concat( rtl::OUString::createFromAscii("]") );
- sControlData.push_back( aProp );
-diff --git filter/source/msfilter/msvbahelper.cxx filter/source/msfilter/msvbahelper.cxx
-deleted file mode 100644
-index 64256f6..0000000
---- filter/source/msfilter/msvbahelper.cxx
-+++ /dev/null
-@@ -1,414 +0,0 @@
--/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
--/*************************************************************************
-- *
-- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-- *
-- * Copyright 2000, 2010 Oracle and/or its affiliates.
-- *
-- * OpenOffice.org - a multi-platform office productivity suite
-- *
-- * 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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--// MARKER(update_precomp.py): autogen include statement, do not remove
--#include "precompiled_filter.hxx"
--
--#include <filter/msfilter/msvbahelper.hxx>
--#include <basic/sbx.hxx>
--#include <basic/sbstar.hxx>
--#include <basic/basmgr.hxx>
--#include <basic/sbmod.hxx>
--#include <basic/sbmeth.hxx>
--#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
--#include <com/sun/star/document/XDocumentProperties.hpp>
--#include <com/sun/star/document/XDocumentInfoSupplier.hpp>
--#include <com/sun/star/script/vba/XVBACompatibility.hpp>
--#include <tools/urlobj.hxx>
--#include <osl/file.hxx>
--#include <unotools/pathoptions.hxx>
--
--using namespace ::com::sun::star;
--
--namespace ooo { namespace vba {
--
--const static rtl::OUString sUrlPart0 = rtl::OUString::createFromAscii( "vnd.sun.star.script:");
--const static rtl::OUString sUrlPart1 = rtl::OUString::createFromAscii( "?language=Basic&location=document");
--
--String makeMacroURL( const String& sMacroName )
--{
-- return sUrlPart0.concat( sMacroName ).concat( sUrlPart1 ) ;
--}
--
--::rtl::OUString extractMacroName( const ::rtl::OUString& rMacroUrl )
--{
-- if( (rMacroUrl.getLength() > sUrlPart0.getLength() + sUrlPart1.getLength()) &&
-- rMacroUrl.match( sUrlPart0 ) &&
-- rMacroUrl.match( sUrlPart1, rMacroUrl.getLength() - sUrlPart1.getLength() ) )
-- {
-- return rMacroUrl.copy( sUrlPart0.getLength(), rMacroUrl.getLength() - sUrlPart0.getLength() - sUrlPart1.getLength() );
-- }
-- return ::rtl::OUString();
--}
--
--SfxObjectShell* findShellForUrl( const rtl::OUString& sMacroURLOrPath )
--{
-- SfxObjectShell* pFoundShell=NULL;
-- SfxObjectShell* pShell = SfxObjectShell::GetFirst();
-- INetURLObject aObj;
-- aObj.SetURL( sMacroURLOrPath );
-- bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
-- rtl::OUString aURL;
-- if ( bIsURL )
-- aURL = sMacroURLOrPath;
-- else
-- {
-- osl::FileBase::getFileURLFromSystemPath( sMacroURLOrPath, aURL );
-- aObj.SetURL( aURL );
-- }
-- OSL_TRACE("Trying to find shell for url %s", rtl::OUStringToOString( aURL, RTL_TEXTENCODING_UTF8 ).getStr() );
-- while ( pShell )
-- {
--
-- uno::Reference< frame::XModel > xModel = pShell->GetModel();
-- // are we searching for a template? if so we have to cater for the
-- // fact that in openoffice a document opened from a template is always
-- // a new document :/
-- if ( xModel.is() )
-- {
-- OSL_TRACE("shell 0x%x has model with url %s and we look for %s", pShell
-- , rtl::OUStringToOString( xModel->getURL(), RTL_TEXTENCODING_UTF8 ).getStr()
-- , rtl::OUStringToOString( aURL, RTL_TEXTENCODING_UTF8 ).getStr()
-- );
-- if ( sMacroURLOrPath.endsWithIgnoreAsciiCaseAsciiL( ".dot", 4 ) )
-- {
-- uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( xModel, uno::UNO_QUERY );
-- if( xDocInfoSupp.is() )
-- {
-- uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW );
-- uno::Reference< document::XDocumentProperties > xDocProps( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW );
-- rtl::OUString sCurrName = xDocProps->getTemplateName();
-- if( sMacroURLOrPath.lastIndexOf( sCurrName ) >= 0 )
-- {
-- pFoundShell = pShell;
-- break;
-- }
-- }
-- }
-- else
-- {
-- // sometimes just the name of the document ( without the path
-- // is used
-- bool bDocNameNoPathMatch = false;
-- if ( aURL.getLength() && aURL.indexOf( '/' ) == -1 )
-- {
-- sal_Int32 lastSlashIndex = xModel->getURL().lastIndexOf( '/' );
-- if ( lastSlashIndex > -1 )
-- {
-- bDocNameNoPathMatch = xModel->getURL().copy( lastSlashIndex + 1 ).equals( aURL );
-- if ( !bDocNameNoPathMatch )
-- {
-- rtl::OUString aTmpName = rtl::OUString::createFromAscii("'") + xModel->getURL().copy( lastSlashIndex + 1 ) + rtl::OUString::createFromAscii("'");
-- bDocNameNoPathMatch = aTmpName.equals( aURL );
-- }
-- }
-- }
--
-- if ( aURL.equals( xModel->getURL() ) || bDocNameNoPathMatch )
-- {
-- pFoundShell = pShell;
-- break;
-- }
-- }
-- }
-- pShell = SfxObjectShell::GetNext( *pShell );
-- }
-- return pFoundShell;
--}
--
--// sMod can be empty ( but we really need the library to search in )
--// if sMod is empty and a macro is found then sMod is updated
--bool hasMacro( SfxObjectShell* pShell, const String& sLibrary, String& sMod, const String& sMacro )
--{
-- bool bFound = false;
-- if ( sLibrary.Len() && sMacro.Len() )
-- {
-- OSL_TRACE("** Searching for %s.%s in library %s"
-- ,rtl::OUStringToOString( sMod, RTL_TEXTENCODING_UTF8 ).getStr()
-- ,rtl::OUStringToOString( sMacro, RTL_TEXTENCODING_UTF8 ).getStr()
-- ,rtl::OUStringToOString( sLibrary, RTL_TEXTENCODING_UTF8 ).getStr() );
-- BasicManager* pBasicMgr = pShell-> GetBasicManager();
-- if ( pBasicMgr )
-- {
-- StarBASIC* pBasic = pBasicMgr->GetLib( sLibrary );
-- if ( !pBasic )
-- {
-- USHORT nId = pBasicMgr->GetLibId( sLibrary );
-- pBasicMgr->LoadLib( nId );
-- pBasic = pBasicMgr->GetLib( sLibrary );
-- }
-- if ( pBasic )
-- {
-- if ( sMod.Len() ) // we wish to find the macro is a specific module
-- {
-- SbModule* pModule = pBasic->FindModule( sMod );
-- if ( pModule )
-- {
-- SbxArray* pMethods = pModule->GetMethods();
-- if ( pMethods )
-- {
-- SbMethod* pMethod = static_cast< SbMethod* >( pMethods->Find( sMacro, SbxCLASS_METHOD ) );
-- if ( pMethod )
-- bFound = true;
-- }
-- }
-- }
-- else if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pBasic->Find( sMacro, SbxCLASS_METHOD ) ) )
-- {
-- if( SbModule* pModule = pMethod->GetModule() )
-- {
-- sMod = pModule->GetName();
-- bFound = true;
-- }
-- }
-- }
-- }
-- }
-- return bFound;
--}
--void parseMacro( const rtl::OUString& sMacro, String& sContainer, String& sModule, String& sProcedure )
--{
-- sal_Int32 nMacroDot = sMacro.lastIndexOf( '.' );
--
-- if ( nMacroDot != -1 )
-- {
-- sProcedure = sMacro.copy( nMacroDot + 1 );
--
-- sal_Int32 nContainerDot = sMacro.lastIndexOf( '.', nMacroDot - 1 );
-- if ( nContainerDot != -1 )
-- {
-- sModule = sMacro.copy( nContainerDot + 1, nMacroDot - nContainerDot - 1 );
-- sContainer = sMacro.copy( 0, nContainerDot );
-- }
-- else
-- sModule = sMacro.copy( 0, nMacroDot );
-- }
-- else
-- sProcedure = sMacro;
--}
--
--VBAMacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const rtl::OUString& MacroName, bool bSearchGlobalTemplates )
--{
-- VBAMacroResolvedInfo aRes;
-- if ( !pShell )
-- return aRes;
-- aRes.SetMacroDocContext( pShell );
--
-- // the name may be enclosed in apostrophs
-- ::rtl::OUString sMacroUrl = MacroName;
-- sal_Int32 nMacroLen = MacroName.getLength();
-- if( (nMacroLen >= 2) && (MacroName[0] == '\'') && (MacroName[nMacroLen-1] == '\'') )
-- sMacroUrl = MacroName.copy( 1, nMacroLen - 2 );
--
-- // parse the macro name
-- sal_Int32 nDocSepIndex = sMacroUrl.indexOf( '!' );
--
-- String sContainer;
-- String sModule;
-- String sProcedure;
--
-- if( nDocSepIndex > 0 )
-- {
-- // macro specified by document name
-- // find document shell for document name and call ourselves
-- // recursively
--
-- // assume for now that the document name is *this* document
-- String sDocUrlOrPath = sMacroUrl.copy( 0, nDocSepIndex );
-- sMacroUrl = sMacroUrl.copy( nDocSepIndex + 1 );
-- OSL_TRACE("doc search, current shell is 0x%x", pShell );
-- SfxObjectShell* pFoundShell = NULL;
-- if( bSearchGlobalTemplates )
-- {
-- SvtPathOptions aPathOpt;
-- String aAddinPath = aPathOpt.GetAddinPath();
-- if( rtl::OUString( sDocUrlOrPath ).indexOf( aAddinPath ) == 0 )
-- pFoundShell = pShell;
-- }
-- if( pFoundShell == NULL )
-- pFoundShell = findShellForUrl( sDocUrlOrPath );
-- OSL_TRACE("doc search, after find, found shell is 0x%x", pFoundShell );
-- aRes = resolveVBAMacro( pFoundShell, sMacroUrl, bSearchGlobalTemplates );
-- return aRes;
-- }
-- else
-- {
-- // macro is contained in 'this' document ( or code imported from a template
-- // where that template is a global template or perhaps the template this
-- // document is created from )
--
-- // macro format = Container.Module.Procedure
-- parseMacro( sMacroUrl, sContainer, sModule, sProcedure );
-- uno::Reference< lang::XMultiServiceFactory> xSF( pShell->GetModel(), uno::UNO_QUERY);
-- uno::Reference< container::XNameContainer > xPrjNameCache;
-- if ( xSF.is() )
-- xPrjNameCache.set( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAProjectNameProvider" ) ) ), uno::UNO_QUERY );
--
-- std::vector< rtl::OUString > sSearchList;
--
-- if ( sContainer.Len() > 0 )
-- {
-- // get the Project associated with the Container
-- if ( xPrjNameCache.is() )
-- {
-- if ( xPrjNameCache->hasByName( sContainer ) )
-- {
-- rtl::OUString sProject;
-- xPrjNameCache->getByName( sContainer ) >>= sProject;
-- sContainer = sProject;
-- }
-- }
-- sSearchList.push_back( sContainer ); // First Lib to search
-- }
-- else
-- {
-- // Ok, if we have no Container specified then we need to search them in order, this document, template this document created from, global templates,
-- // get the name of Project/Library for 'this' document
-- rtl::OUString sThisProject = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Standard") );
-- try
-- {
-- uno::Reference< beans::XPropertySet > xProps( pShell->GetModel(), uno::UNO_QUERY_THROW );
-- uno::Reference< script::vba::XVBACompatibility > xVBAMode( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BasicLibraries") ) ), uno::UNO_QUERY_THROW );
-- sThisProject = xVBAMode->getProjectName();
-- }
-- catch( uno::Exception& /*e*/) {}
--
-- sSearchList.push_back( sThisProject ); // First Lib to search
-- if ( xPrjNameCache.is() )
-- {
-- // is this document created from a template?
-- uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( pShell->GetModel(), uno::UNO_QUERY_THROW );
-- uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW );
-- uno::Reference< document::XDocumentProperties > xDocProps( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW );
--
-- rtl::OUString sCreatedFrom = xDocProps->getTemplateURL();
-- if ( sCreatedFrom.getLength() )
-- {
-- INetURLObject aObj;
-- aObj.SetURL( sCreatedFrom );
-- bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
-- rtl::OUString aURL;
-- if ( bIsURL )
-- aURL = sCreatedFrom;
-- else
-- {
-- osl::FileBase::getFileURLFromSystemPath( sCreatedFrom, aURL );
-- aObj.SetURL( aURL );
-- }
-- sCreatedFrom = aObj.GetLastName();
-- }
--
-- sal_Int32 nIndex = sCreatedFrom.lastIndexOf( '.' );
-- if ( nIndex != -1 )
-- sCreatedFrom = sCreatedFrom.copy( 0, nIndex );
--
-- rtl::OUString sPrj;
-- if ( sCreatedFrom.getLength() && xPrjNameCache->hasByName( sCreatedFrom ) )
-- {
-- xPrjNameCache->getByName( sCreatedFrom ) >>= sPrj;
-- // Make sure we don't double up with this project
-- if ( !sPrj.equals( sThisProject ) )
-- sSearchList.push_back( sPrj );
-- }
--
-- // get list of global template Names
-- uno::Sequence< rtl::OUString > sTemplateNames = xPrjNameCache->getElementNames();
-- sal_Int32 nLen = sTemplateNames.getLength();
-- for ( sal_Int32 index = 0; ( bSearchGlobalTemplates && index < nLen ); ++index )
-- {
--
-- if ( !sCreatedFrom.equals( sTemplateNames[ index ] ) )
-- {
-- if ( xPrjNameCache->hasByName( sTemplateNames[ index ] ) )
-- {
-- xPrjNameCache->getByName( sTemplateNames[ index ] ) >>= sPrj;
-- // Make sure we don't double up with this project
-- if ( !sPrj.equals( sThisProject ) )
-- sSearchList.push_back( sPrj );
-- }
-- }
--
-- }
-- }
-- }
-- std::vector< rtl::OUString >::iterator it_end = sSearchList.end();
-- for ( std::vector< rtl::OUString >::iterator it = sSearchList.begin(); it != it_end; ++it )
-- {
-- bool bRes = hasMacro( pShell, *it, sModule, sProcedure );
-- if ( bRes )
-- {
-- aRes.SetResolved( true );
-- aRes.SetMacroDocContext( pShell );
-- sContainer = *it;
-- break;
-- }
-- }
-- aRes.SetResolvedMacro( sProcedure.Insert( '.', 0 ).Insert( sModule, 0).Insert( '.', 0 ).Insert( sContainer, 0 ) );
-- }
--
-- return aRes;
--}
--
--// Treat the args as possible inouts ( convertion at bottom of method )
--sal_Bool executeMacro( SfxObjectShell* pShell, const String& sMacroName, uno::Sequence< uno::Any >& aArgs, uno::Any& aRet, const uno::Any& /*aCaller*/)
--{
-- sal_Bool bRes = sal_False;
-- if ( !pShell )
-- return bRes;
-- rtl::OUString sUrl = makeMacroURL( sMacroName );
--
-- uno::Sequence< sal_Int16 > aOutArgsIndex;
-- uno::Sequence< uno::Any > aOutArgs;
--
-- try
-- { ErrCode nErr( ERRCODE_BASIC_INTERNAL_ERROR );
-- if ( pShell )
-- {
-- nErr = pShell->CallXScript( sUrl,
-- aArgs, aRet, aOutArgsIndex, aOutArgs, false );
-- sal_Int32 nLen = aOutArgs.getLength();
-- // convert any out params to seem like they were inouts
-- if ( nLen )
-- {
-- for ( sal_Int32 index=0; index < nLen; ++index )
-- {
-- sal_Int32 nOutIndex = aOutArgsIndex[ index ];
-- aArgs[ nOutIndex ] = aOutArgs[ index ];
-- }
-- }
-- }
-- bRes = ( nErr == ERRCODE_NONE );
-- }
-- catch ( uno::Exception& )
-- {
-- bRes = sal_False;
-- }
-- return bRes;
--}
--} } // vba // ooo
--
--/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
-diff --git offapi/com/sun/star/script/VBAMacroHelper.idl offapi/com/sun/star/script/VBAMacroHelper.idl
-new file mode 100644
-index 0000000..e971b8c
---- /dev/null
-+++ offapi/com/sun/star/script/VBAMacroHelper.idl
-@@ -0,0 +1,15 @@
-+#ifndef com_sun_star_script_VBAMacroHelper_idl
-+#define com_sun_star_script_VBAMacroHelper_idl
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+#ifndef __com_sun_star_script_XVBAMacroHelper_idl__
-+#include <com/sun/star/script/XVBAMacroHelper.idl>
-+#endif
-+#ifndef __com_sun_star_frame_XModel_idl__
-+#include <com/sun/star/frame/XModel.idl>
-+#endif
-+module com { module sun { module star { module script {
-+singleton theVBAMacroHelper : ::com::sun::star::script::XVBAMacroHelper;
-+}; }; }; };
-+#endif
-diff --git offapi/com/sun/star/script/XVBAMacroHelper.idl offapi/com/sun/star/script/XVBAMacroHelper.idl
-new file mode 100644
-index 0000000..04ef842
---- /dev/null
-+++ offapi/com/sun/star/script/XVBAMacroHelper.idl
-@@ -0,0 +1,22 @@
-+#ifndef com_sun_star_script_XVBAMacroHelper_idl
-+#define com_sun_star_script_XVBAMacroHelper_idl
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+#ifndef __com_sun_star_script_XVBAMacroResolvedInfo_idl__
-+#include <com/sun/star/script/XVBAMacroResolvedInfo.idl>
-+#endif
-+#ifndef __com_sun_star_frame_XModel_idl__
-+#include <com/sun/star/frame/XModel.idl>
-+#endif
-+
-+module com { module sun { module star { module script {
-+interface XVBAMacroHelper : com::sun::star::uno::XInterface
-+{
-+ string makeMacroURL( [in] string sMacroName );
-+ string extractMacroNameFromURL( [in] string sURL );
-+ com::sun::star::script::XVBAMacroResolvedInfo resolveVBAMacro( [in] com::sun::star::frame::XModel model, [in] string moduleName, [in] boolean bSearchGlobalTemplates );
-+ boolean executeMacro( [in] com::sun::star::frame::XModel model, [in] string smacroName, [inout] sequence< any > aArgs, [inout] any aRet, [in] any aCaller );
-+};
-+}; }; }; };
-+#endif
-diff --git offapi/com/sun/star/script/XVBAMacroResolvedInfo.idl offapi/com/sun/star/script/XVBAMacroResolvedInfo.idl
-new file mode 100644
-index 0000000..7d4b37e
---- /dev/null
-+++ offapi/com/sun/star/script/XVBAMacroResolvedInfo.idl
-@@ -0,0 +1,18 @@
-+#ifndef com_sun_star_script_XVBAMacroResolvedInfo_idl
-+#define com_sun_star_script_XVBAMacroResolvedInfo_idl
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+#ifndef __com_sun_star_frame_XModel_idl__
-+#include <com/sun/star/frame/XModel.idl>
-+#endif
-+
-+module com { module sun { module star { module script {
-+interface XVBAMacroResolvedInfo
-+{
-+ [attribute] boolean Resolved;
-+ [attribute] string ResolvedMacro;
-+ [attribute] com::sun::star::frame::XModel DocumentContext;
-+};
-+}; }; }; };
-+#endif
-diff --git offapi/com/sun/star/script/makefile.mk offapi/com/sun/star/script/makefile.mk
-index 8c46453..bc75a92 100644
---- offapi/com/sun/star/script/makefile.mk
-+++ offapi/com/sun/star/script/makefile.mk
-@@ -51,7 +51,11 @@ IDLFILES=\
- XLibraryQueryExecutable.idl \
- ModuleSizeExceededRequest.idl\
- ModuleInfo.idl\
-- ModuleType.idl
-+ ModuleType.idl\
-+ XVBAMacroHelper.idl\
-+ XVBAMacroResolvedInfo.idl\
-+ VBAMacroHelper.idl\
-+ ModuleType.idl\
-
- # ------------------------------------------------------------------
-
-diff --git sc/source/filter/excel/makefile.mk sc/source/filter/excel/makefile.mk
-index a84f4aa..e8b170e 100644
---- sc/source/filter/excel/makefile.mk
-+++ sc/source/filter/excel/makefile.mk
-@@ -146,6 +146,7 @@ EXCEPTIONSFILES = \
- $(SLO)$/xistring.obj \
- $(SLO)$/xistyle.obj \
- $(SLO)$/xladdress.obj \
-+ $(SLO)$/xlescher.obj \
- $(SLO)$/xiescher.obj \
- $(SLO)$/xlchart.obj \
- $(SLO)$/xlformula.obj \
-diff --git sc/source/filter/excel/xlescher.cxx sc/source/filter/excel/xlescher.cxx
-index 3360b02..9f6ed58 100644
---- sc/source/filter/excel/xlescher.cxx
-+++ sc/source/filter/excel/xlescher.cxx
-@@ -32,6 +32,7 @@
-
- #include <com/sun/star/drawing/XControlShape.hpp>
- #include <com/sun/star/script/ScriptEventDescriptor.hpp>
-+
- #include <svx/unoapi.hxx>
- #include "document.hxx"
- #include "xestream.hxx"
-diff --git sc/source/filter/excel/xltools.cxx sc/source/filter/excel/xltools.cxx
-index e2bb19d..51146d5 100644
---- sc/source/filter/excel/xltools.cxx
-+++ sc/source/filter/excel/xltools.cxx
-@@ -34,7 +34,6 @@
- #include <unotools/fontcvt.hxx>
- #include <sfx2/objsh.hxx>
- #include <editeng/editstat.hxx>
--#include <filter/msfilter/msvbahelper.hxx>
- #include "xestream.hxx"
- #include "document.hxx"
- #include "docuno.hxx"
-@@ -46,8 +45,15 @@
- #include "xistream.hxx"
- #include "xiroot.hxx"
- #include "xltools.hxx"
-+#include <comphelper/processfactory.hxx>
-+#include <com/sun/star/script/theVBAMacroHelper.hpp>
-
- using ::rtl::OUString;
-+using ::com::sun::star::uno::Reference;
-+
-+using ::com::sun::star::script::XVBAMacroHelper;
-+using ::com::sun::star::script::XVBAMacroResolvedInfo;
-+using ::com::sun::star::script::theVBAMacroHelper;
-
- // GUID import/export =========================================================
-
-@@ -695,9 +701,16 @@ const OUString XclTools::maSbMacroSuffix( RTL_CONSTASCII_USTRINGPARAM( "?languag
- OUString XclTools::GetSbMacroUrl( const String& rMacroName, SfxObjectShell* pDocShell )
- {
- OSL_ENSURE( rMacroName.Len() > 0, "XclTools::GetSbMacroUrl - macro name is empty" );
-- ::ooo::vba::VBAMacroResolvedInfo aMacroInfo = ::ooo::vba::resolveVBAMacro( pDocShell, rMacroName, false );
-- if( aMacroInfo.IsResolved() )
-- return ::ooo::vba::makeMacroURL( aMacroInfo.ResolvedMacro() );
-+ try
-+ {
-+ Reference< XVBAMacroHelper > xMacroHelper = theVBAMacroHelper::get( comphelper::getProcessComponentContext() );
-+ Reference< XVBAMacroResolvedInfo > xResolvedMacro = xMacroHelper->resolveVBAMacro( pDocShell->GetModel(), rMacroName, sal_False );
-+ if ( xResolvedMacro->getResolved() )
-+ return xMacroHelper->makeMacroURL( xResolvedMacro->getResolvedMacro() );
-+ }
-+ catch( com::sun::star::uno::Exception& )
-+ {
-+ }
- return OUString();
- }
-
-diff --git sc/source/ui/vba/vbasheetobject.cxx sc/source/ui/vba/vbasheetobject.cxx
-index 215a62c..daad041 100755
---- sc/source/ui/vba/vbasheetobject.cxx
-+++ sc/source/ui/vba/vbasheetobject.cxx
-@@ -32,11 +32,12 @@
- #include <com/sun/star/script/ScriptEventDescriptor.hpp>
- #include <com/sun/star/script/XEventAttacherManager.hpp>
- #include <com/sun/star/style/VerticalAlignment.hpp>
-+#include <com/sun/star/script/theVBAMacroHelper.hpp>
-+
- #include <ooo/vba/excel/Constants.hpp>
- #include <ooo/vba/excel/XlOrientation.hpp>
- #include <ooo/vba/excel/XlPlacement.hpp>
- #include <rtl/ustrbuf.hxx>
--#include <filter/msfilter/msvbahelper.hxx>
- #include <oox/helper/helper.hxx>
- #include "vbafont.hxx"
-
-@@ -308,6 +309,13 @@ ScVbaControlObjectBase::ScVbaControlObjectBase(
- break;
- // no default, to let the compiler complain about missing case
- }
-+ try
-+ {
-+ m_xMacroHelper = script::theVBAMacroHelper::get( mxContext );
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
- }
-
- // XSheetObject attributes
-@@ -333,8 +341,8 @@ OUString SAL_CALL ScVbaControlObjectBase::getOnAction() throw (uno::RuntimeExcep
- const script::ScriptEventDescriptor* pEventEnd = pEvent + aEvents.getLength();
- const OUString aScriptType = CREATE_OUSTRING( "Script" );
- for( ; pEvent < pEventEnd; ++pEvent )
-- if( (pEvent->ListenerType == maListenerType) && (pEvent->EventMethod == maEventMethod) && (pEvent->ScriptType == aScriptType) )
-- return extractMacroName( pEvent->ScriptCode );
-+ if( (pEvent->ListenerType == maListenerType) && (pEvent->EventMethod == maEventMethod) && (pEvent->ScriptType == aScriptType) && m_xMacroHelper.is() )
-+ return m_xMacroHelper->extractMacroNameFromURL( pEvent->ScriptCode );
- }
- return OUString();
- }
-@@ -348,16 +356,17 @@ void SAL_CALL ScVbaControlObjectBase::setOnAction( const OUString& rMacroName )
- try { xEventMgr->revokeScriptEvent( nIndex, maListenerType, maEventMethod, OUString() ); } catch( uno::Exception& ) {}
-
- // if a macro name has been passed, try to attach it to the event
-- if( rMacroName.getLength() > 0 )
-+ if( rMacroName.getLength() > 0 && m_xMacroHelper.is() )
- {
-- VBAMacroResolvedInfo aResolvedMacro = resolveVBAMacro( getSfxObjShell( mxModel ), rMacroName );
-- if( !aResolvedMacro.IsResolved() )
-+ uno::Reference< script::XVBAMacroResolvedInfo > xResolvedMacro = m_xMacroHelper->resolveVBAMacro( mxModel, rMacroName, sal_False );
-+;
-+ if( !xResolvedMacro->getResolved() )
- throw uno::RuntimeException();
- script::ScriptEventDescriptor aDescriptor;
- aDescriptor.ListenerType = maListenerType;
- aDescriptor.EventMethod = maEventMethod;
- aDescriptor.ScriptType = CREATE_OUSTRING( "Script" );
-- aDescriptor.ScriptCode = makeMacroURL( aResolvedMacro.ResolvedMacro() );
-+ aDescriptor.ScriptCode = m_xMacroHelper->makeMacroURL( xResolvedMacro->getResolvedMacro() );
- xEventMgr->registerScriptEvent( nIndex, aDescriptor );
- }
- }
-diff --git sc/source/ui/vba/vbasheetobject.hxx sc/source/ui/vba/vbasheetobject.hxx
-index a7af036..e5f3c21 100755
---- sc/source/ui/vba/vbasheetobject.hxx
-+++ sc/source/ui/vba/vbasheetobject.hxx
-@@ -33,6 +33,7 @@
- #include <ooo/vba/excel/XControlObject.hpp>
- #include <ooo/vba/excel/XSheetObject.hpp>
- #include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/script/XVBAMacroHelper.hpp>
- #include "vbapalette.hxx"
-
- namespace com { namespace sun { namespace star {
-@@ -173,8 +174,10 @@ protected:
- protected:
- css::uno::Reference< css::container::XIndexContainer > mxFormIC;
- css::uno::Reference< css::beans::XPropertySet > mxControlProps;
-+ css::uno::Reference< css::script::XVBAMacroHelper > m_xMacroHelper;
- ::rtl::OUString maListenerType;
- ::rtl::OUString maEventMethod;
-+
- };
-
- // ============================================================================
-diff --git scripting/source/vbaevents/eventhelper.cxx scripting/source/vbaevents/eventhelper.cxx
-index 53dc7d2..89f10fc 100644
---- scripting/source/vbaevents/eventhelper.cxx
-+++ scripting/source/vbaevents/eventhelper.cxx
-@@ -78,10 +78,7 @@
- #include <basic/sbmeth.hxx>
- #include <basic/sbmod.hxx>
- #include <basic/sbx.hxx>
--#include <filter/msfilter/msvbahelper.hxx>
--
--
--
-+#include <com/sun/star/script/theVBAMacroHelper.hpp>
-
- // for debug
- #include <comphelper/anytostring.hxx>
-@@ -762,6 +759,7 @@ private:
-
- Reference< XComponentContext > m_xContext;
- Reference< frame::XModel > m_xModel;
-+ Reference< script::XVBAMacroHelper > m_xMacroHelper;
- SfxObjectShell* mpShell;
- sal_Bool m_bDocClosed;
- rtl::OUString msProject;
-@@ -773,6 +771,13 @@ OPropertyContainer(GetBroadcastHelper()), m_xContext( rxContext ), m_bDocClosed(
- registerProperty( EVENTLSTNR_PROPERTY_MODEL, EVENTLSTNR_PROPERTY_ID_MODEL,
- beans::PropertyAttribute::TRANSIENT, &m_xModel, ::getCppuType( &m_xModel ) );
- msProject = rtl::OUString::createFromAscii("Standard");
-+ try
-+ {
-+ m_xMacroHelper = script::theVBAMacroHelper::get( m_xContext );
-+ }
-+ catch( Exception& )
-+ {
-+ }
- }
-
- void
-@@ -1000,7 +1005,7 @@ EventListener::firing_Impl(const ScriptEvent& evt, Any* pRet ) throw(RuntimeExce
- ::rtl::OUString::createFromAscii("VBAInterop");
-
- // let default handlers deal with non vba stuff
-- if ( !evt.ScriptType.equals( vbaInterOp ) )
-+ if ( !evt.ScriptType.equals( vbaInterOp ) || !m_xMacroHelper.is() )
- return;
- lang::EventObject aEvent;
- evt.Arguments[ 0 ] >>= aEvent;
-@@ -1024,8 +1024,8 @@
-
- OSL_TRACE("*** trying to invoke %s ",
- rtl::OUStringToOString( sToResolve, RTL_TEXTENCODING_UTF8 ).getStr() );
-- ooo::vba::VBAMacroResolvedInfo aMacroResolvedInfo = ooo::vba::resolveVBAMacro( mpShell, sToResolve );
-- if ( aMacroResolvedInfo.IsResolved() )
-+ Reference< script::XVBAMacroResolvedInfo > xMacroResolvedInfo = m_xMacroHelper->resolveVBAMacro( m_xModel, sToResolve, sal_False );
-+ if ( xMacroResolvedInfo->getResolved() )
- {
-
- if (! txInfo->ApproveRule(evt, txInfo->pPara) )
-@@ -1117,7 +1122,7 @@ EventListener::firing_Impl(const ScriptEvent& evt, Any* pRet ) throw(RuntimeExce
- // call basic event handlers for event
-
- // create script url
-- rtl::OUString url = aMacroResolvedInfo.ResolvedMacro();
-+ rtl::OUString url = xMacroResolvedInfo->getResolvedMacro();
-
- OSL_TRACE("resolved script = %s",
- rtl::OUStringToOString( url,
-@@ -1126,11 +1131,11 @@ EventListener::firing_Impl(const ScriptEvent& evt, Any* pRet ) throw(RuntimeExce
- {
- uno::Any aDummyCaller = uno::makeAny( rtl::OUString::createFromAscii("Error") );
- if ( pRet )
-- ooo::vba::executeMacro( mpShell, url, aArguments, *pRet, aDummyCaller );
-+ m_xMacroHelper->executeMacro( m_xModel, url, aArguments, *pRet, aDummyCaller );
- else
- {
- uno::Any aRet;
-- ooo::vba::executeMacro( mpShell, url, aArguments, aRet, aDummyCaller );
-+ m_xMacroHelper->executeMacro( m_xModel, url, aArguments, aRet, aDummyCaller );
- }
- }
- catch ( uno::Exception& e )
---- scripting/source/vbaevents/makefile.mk.old 2010-09-03 21:26:41.000000000 +0200
-+++ scripting/source/vbaevents/makefile.mk 2010-09-03 21:41:27.000000000 +0200
-@@ -69,7 +69,6 @@ SHL1STDLIBS= \
- $(BASICLIB) \
- $(COMPHELPERLIB) \
- $(SFXLIB) \
-- $(MSFILTERLIB) \
- $(CPPULIB) \
- $(TOOLSLIB) \
- $(SALLIB)
-diff --git svx/source/unodraw/makefile.mk svx/source/unodraw/makefile.mk
-index 6815f28..8ea6b81 100644
---- svx/source/unodraw/makefile.mk
-+++ svx/source/unodraw/makefile.mk
-@@ -41,6 +41,7 @@ ENABLE_EXCEPTIONS=TRUE
-
- LIB1TARGET= $(SLB)$/$(TARGET)-core.lib
- LIB1OBJFILES= \
-+ $(SLO)$/msvbahelper.obj \
- $(SLO)$/UnoGraphicExporter.obj \
- $(SLO)$/XPropertyTable.obj \
- $(SLO)$/UnoNameItemTable.obj \
-diff --git svx/source/unodraw/msvbahelper.cxx svx/source/unodraw/msvbahelper.cxx
-new file mode 100644
-index 0000000..f818b95
---- /dev/null
-+++ svx/source/unodraw/msvbahelper.cxx
-@@ -0,0 +1,533 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_svx.hxx"
-+
-+#include "msvbahelper.hxx"
-+#include <basic/sbx.hxx>
-+#include <basic/sbstar.hxx>
-+#include <basic/basmgr.hxx>
-+#include <basic/sbmod.hxx>
-+#include <basic/sbmeth.hxx>
-+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
-+#include <com/sun/star/document/XDocumentProperties.hpp>
-+#include <com/sun/star/document/XDocumentInfoSupplier.hpp>
-+#include <com/sun/star/script/vba/XVBACompatibility.hpp>
-+#include <com/sun/star/script/XVBAMacroHelper.hpp>
-+
-+#include <tools/urlobj.hxx>
-+#include <osl/file.hxx>
-+#include <unotools/pathoptions.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/lang/XUnoTunnel.hpp>
-+
-+using namespace ::com::sun::star;
-+
-+const static rtl::OUString sUrlPart0 = rtl::OUString::createFromAscii( "vnd.sun.star.script:");
-+const static rtl::OUString sUrlPart1 = rtl::OUString::createFromAscii( "?language=Basic&location=document");
-+
-+namespace svx {
-+
-+// old code from msvbahelper ( was in filter ), we need to define an uno service to break some
-+// compile time dependencies for the split build. Additionally the location of this service has
-+// been just chosen for // convenience, really putting the service in any library that is
-+// generally available/loaded is good. The decision to not to put this service in an existing
-+// vba library is intentional as we already call the resolve macro stuff from the binary filters
-+// ( even if the vba functionality is not enabled ) - but... calling this ( service ) could be
-+// determined at runtime so I guess. So, in theory we could put this code in a vba specific
-+// library. ( anyway, lets leave it here for the moment )
-+
-+class VBAMacroResolvedInfo
-+{
-+ SfxObjectShell* mpDocContext;
-+ bool mbFound;
-+ String msResolvedMacro;
-+
-+ public:
-+ VBAMacroResolvedInfo() : mpDocContext(NULL), mbFound( false ){}
-+ void SetResolved( bool bRes ) { mbFound = bRes; }
-+ bool IsResolved() const { return mbFound; }
-+ void SetMacroDocContext(SfxObjectShell* pShell ) { mpDocContext = pShell; }
-+ SfxObjectShell* MacroDocContext() const { return mpDocContext; }
-+ String ResolvedMacro() const { return msResolvedMacro; }
-+ void SetResolvedMacro(const String& sMacro ) { msResolvedMacro = sMacro; }
-+};
-+
-+String makeMacroURLImpl( const String& sMacroName )
-+{
-+ return sUrlPart0.concat( sMacroName ).concat( sUrlPart1 ) ;
-+}
-+
-+::rtl::OUString extractMacroFromURL( const ::rtl::OUString& rMacroUrl )
-+{
-+ if( (rMacroUrl.getLength() > sUrlPart0.getLength() + sUrlPart1.getLength()) &&
-+ rMacroUrl.match( sUrlPart0 ) &&
-+ rMacroUrl.match( sUrlPart1, rMacroUrl.getLength() - sUrlPart1.getLength() ) )
-+ {
-+ return rMacroUrl.copy( sUrlPart0.getLength(), rMacroUrl.getLength() - sUrlPart0.getLength() - sUrlPart1.getLength() );
-+ }
-+ return ::rtl::OUString();
-+}
-+
-+SfxObjectShell* findShellForUrl( const rtl::OUString& sMacroURLOrPath )
-+{
-+ SfxObjectShell* pFoundShell=NULL;
-+ SfxObjectShell* pShell = SfxObjectShell::GetFirst();
-+ INetURLObject aObj;
-+ aObj.SetURL( sMacroURLOrPath );
-+ bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
-+ rtl::OUString aURL;
-+ if ( bIsURL )
-+ aURL = sMacroURLOrPath;
-+ else
-+ {
-+ osl::FileBase::getFileURLFromSystemPath( sMacroURLOrPath, aURL );
-+ aObj.SetURL( aURL );
-+ }
-+ OSL_TRACE("Trying to find shell for url %s", rtl::OUStringToOString( aURL, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ while ( pShell )
-+ {
-+
-+ uno::Reference< frame::XModel > xModel = pShell->GetModel();
-+ // are we searching for a template? if so we have to cater for the
-+ // fact that in openoffice a document opened from a template is always
-+ // a new document :/
-+ if ( xModel.is() )
-+ {
-+ OSL_TRACE("shell 0x%x has model with url %s and we look for %s", pShell
-+ , rtl::OUStringToOString( xModel->getURL(), RTL_TEXTENCODING_UTF8 ).getStr()
-+ , rtl::OUStringToOString( aURL, RTL_TEXTENCODING_UTF8 ).getStr()
-+ );
-+ if ( sMacroURLOrPath.endsWithIgnoreAsciiCaseAsciiL( ".dot", 4 ) )
-+ {
-+ uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( xModel, uno::UNO_QUERY );
-+ if( xDocInfoSupp.is() )
-+ {
-+ uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW );
-+ uno::Reference< document::XDocumentProperties > xDocProps( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW );
-+ rtl::OUString sCurrName = xDocProps->getTemplateName();
-+ if( sMacroURLOrPath.lastIndexOf( sCurrName ) >= 0 )
-+ {
-+ pFoundShell = pShell;
-+ break;
-+ }
-+ }
-+ }
-+ else
-+ {
-+ // sometimes just the name of the document ( without the path
-+ // is used
-+ bool bDocNameNoPathMatch = false;
-+ if ( aURL.getLength() && aURL.indexOf( '/' ) == -1 )
-+ {
-+ sal_Int32 lastSlashIndex = xModel->getURL().lastIndexOf( '/' );
-+ if ( lastSlashIndex > -1 )
-+ {
-+ bDocNameNoPathMatch = xModel->getURL().copy( lastSlashIndex + 1 ).equals( aURL );
-+ if ( !bDocNameNoPathMatch )
-+ {
-+ rtl::OUString aTmpName = rtl::OUString::createFromAscii("'") + xModel->getURL().copy( lastSlashIndex + 1 ) + rtl::OUString::createFromAscii("'");
-+ bDocNameNoPathMatch = aTmpName.equals( aURL );
-+ }
-+ }
-+ }
-+
-+ if ( aURL.equals( xModel->getURL() ) || bDocNameNoPathMatch )
-+ {
-+ pFoundShell = pShell;
-+ break;
-+ }
-+ }
-+ }
-+ pShell = SfxObjectShell::GetNext( *pShell );
-+ }
-+ return pFoundShell;
-+}
-+
-+// sMod can be empty ( but we really need the library to search in )
-+// if sMod is empty and a macro is found then sMod is updated
-+bool hasMacro( SfxObjectShell* pShell, const String& sLibrary, String& sMod, const String& sMacro )
-+{
-+ bool bFound = false;
-+ if ( sLibrary.Len() && sMacro.Len() )
-+ {
-+ OSL_TRACE("** Searching for %s.%s in library %s"
-+ ,rtl::OUStringToOString( sMod, RTL_TEXTENCODING_UTF8 ).getStr()
-+ ,rtl::OUStringToOString( sMacro, RTL_TEXTENCODING_UTF8 ).getStr()
-+ ,rtl::OUStringToOString( sLibrary, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ BasicManager* pBasicMgr = pShell-> GetBasicManager();
-+ if ( pBasicMgr )
-+ {
-+ StarBASIC* pBasic = pBasicMgr->GetLib( sLibrary );
-+ if ( !pBasic )
-+ {
-+ USHORT nId = pBasicMgr->GetLibId( sLibrary );
-+ pBasicMgr->LoadLib( nId );
-+ pBasic = pBasicMgr->GetLib( sLibrary );
-+ }
-+ if ( pBasic )
-+ {
-+ if ( sMod.Len() ) // we wish to find the macro is a specific module
-+ {
-+ SbModule* pModule = pBasic->FindModule( sMod );
-+ if ( pModule )
-+ {
-+ SbxArray* pMethods = pModule->GetMethods();
-+ if ( pMethods )
-+ {
-+ SbMethod* pMethod = static_cast< SbMethod* >( pMethods->Find( sMacro, SbxCLASS_METHOD ) );
-+ if ( pMethod )
-+ bFound = true;
-+ }
-+ }
-+ }
-+ else if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pBasic->Find( sMacro, SbxCLASS_METHOD ) ) )
-+ {
-+ if( SbModule* pModule = pMethod->GetModule() )
-+ {
-+ sMod = pModule->GetName();
-+ bFound = true;
-+ }
-+ }
-+ }
-+ }
-+ }
-+ return bFound;
-+}
-+void parseMacro( const rtl::OUString& sMacro, String& sContainer, String& sModule, String& sProcedure )
-+{
-+ sal_Int32 nMacroDot = sMacro.lastIndexOf( '.' );
-+
-+ if ( nMacroDot != -1 )
-+ {
-+ sProcedure = sMacro.copy( nMacroDot + 1 );
-+
-+ sal_Int32 nContainerDot = sMacro.lastIndexOf( '.', nMacroDot - 1 );
-+ if ( nContainerDot != -1 )
-+ {
-+ sModule = sMacro.copy( nContainerDot + 1, nMacroDot - nContainerDot - 1 );
-+ sContainer = sMacro.copy( 0, nContainerDot );
-+ }
-+ else
-+ sModule = sMacro.copy( 0, nMacroDot );
-+ }
-+ else
-+ sProcedure = sMacro;
-+}
-+
-+VBAMacroResolvedInfo resolveVBAMacroImpl( SfxObjectShell* pShell, const rtl::OUString& MacroName, sal_Bool bSearchGlobalTemplates )
-+{
-+ VBAMacroResolvedInfo aRes;
-+ if ( !pShell )
-+ return aRes;
-+ aRes.SetMacroDocContext( pShell );
-+
-+ // the name may be enclosed in apostrophs
-+ ::rtl::OUString sMacroUrl = MacroName;
-+ sal_Int32 nMacroLen = MacroName.getLength();
-+ if( (nMacroLen >= 2) && (MacroName[0] == '\'') && (MacroName[nMacroLen-1] == '\'') )
-+ sMacroUrl = MacroName.copy( 1, nMacroLen - 2 );
-+
-+ // parse the macro name
-+ sal_Int32 nDocSepIndex = sMacroUrl.indexOf( '!' );
-+
-+ String sContainer;
-+ String sModule;
-+ String sProcedure;
-+
-+ if( nDocSepIndex > 0 )
-+ {
-+ // macro specified by document name
-+ // find document shell for document name and call ourselves
-+ // recursively
-+
-+ // assume for now that the document name is *this* document
-+ String sDocUrlOrPath = sMacroUrl.copy( 0, nDocSepIndex );
-+ sMacroUrl = sMacroUrl.copy( nDocSepIndex + 1 );
-+ OSL_TRACE("doc search, current shell is 0x%x", pShell );
-+ SfxObjectShell* pFoundShell = NULL;
-+ if( bSearchGlobalTemplates )
-+ {
-+ SvtPathOptions aPathOpt;
-+ String aAddinPath = aPathOpt.GetAddinPath();
-+ if( rtl::OUString( sDocUrlOrPath ).indexOf( aAddinPath ) == 0 )
-+ pFoundShell = pShell;
-+ }
-+ if( pFoundShell == NULL )
-+ pFoundShell = findShellForUrl( sDocUrlOrPath );
-+ OSL_TRACE("doc search, after find, found shell is 0x%x", pFoundShell );
-+ aRes = resolveVBAMacroImpl( pFoundShell, sMacroUrl, bSearchGlobalTemplates );
-+ return aRes;
-+ }
-+ else
-+ {
-+ // macro is contained in 'this' document ( or code imported from a template
-+ // where that template is a global template or perhaps the template this
-+ // document is created from )
-+
-+ // macro format = Container.Module.Procedure
-+ parseMacro( sMacroUrl, sContainer, sModule, sProcedure );
-+ uno::Reference< lang::XMultiServiceFactory> xSF( pShell->GetModel(), uno::UNO_QUERY);
-+ uno::Reference< container::XNameContainer > xPrjNameCache;
-+ if ( xSF.is() )
-+ xPrjNameCache.set( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAProjectNameProvider" ) ) ), uno::UNO_QUERY );
-+
-+ std::vector< rtl::OUString > sSearchList;
-+
-+ if ( sContainer.Len() > 0 )
-+ {
-+ // get the Project associated with the Container
-+ if ( xPrjNameCache.is() )
-+ {
-+ if ( xPrjNameCache->hasByName( sContainer ) )
-+ {
-+ rtl::OUString sProject;
-+ xPrjNameCache->getByName( sContainer ) >>= sProject;
-+ sContainer = sProject;
-+ }
-+ }
-+ sSearchList.push_back( sContainer ); // First Lib to search
-+ }
-+ else
-+ {
-+ // Ok, if we have no Container specified then we need to search them in order, this document, template this document created from, global templates,
-+ // get the name of Project/Library for 'this' document
-+ rtl::OUString sThisProject = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Standard") );
-+ try
-+ {
-+ uno::Reference< beans::XPropertySet > xProps( pShell->GetModel(), uno::UNO_QUERY_THROW );
-+ uno::Reference< script::vba::XVBACompatibility > xVBAMode( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BasicLibraries") ) ), uno::UNO_QUERY_THROW );
-+ sThisProject = xVBAMode->getProjectName();
-+ }
-+ catch( uno::Exception& /*e*/) {}
-+
-+ sSearchList.push_back( sThisProject ); // First Lib to search
-+ if ( xPrjNameCache.is() )
-+ {
-+ // is this document created from a template?
-+ uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( pShell->GetModel(), uno::UNO_QUERY_THROW );
-+ uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW );
-+ uno::Reference< document::XDocumentProperties > xDocProps( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW );
-+
-+ rtl::OUString sCreatedFrom = xDocProps->getTemplateURL();
-+ if ( sCreatedFrom.getLength() )
-+ {
-+ INetURLObject aObj;
-+ aObj.SetURL( sCreatedFrom );
-+ bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
-+ rtl::OUString aURL;
-+ if ( bIsURL )
-+ aURL = sCreatedFrom;
-+ else
-+ {
-+ osl::FileBase::getFileURLFromSystemPath( sCreatedFrom, aURL );
-+ aObj.SetURL( aURL );
-+ }
-+ sCreatedFrom = aObj.GetLastName();
-+ }
-+
-+ sal_Int32 nIndex = sCreatedFrom.lastIndexOf( '.' );
-+ if ( nIndex != -1 )
-+ sCreatedFrom = sCreatedFrom.copy( 0, nIndex );
-+
-+ rtl::OUString sPrj;
-+ if ( sCreatedFrom.getLength() && xPrjNameCache->hasByName( sCreatedFrom ) )
-+ {
-+ xPrjNameCache->getByName( sCreatedFrom ) >>= sPrj;
-+ // Make sure we don't double up with this project
-+ if ( !sPrj.equals( sThisProject ) )
-+ sSearchList.push_back( sPrj );
-+ }
-+
-+ // get list of global template Names
-+ uno::Sequence< rtl::OUString > sTemplateNames = xPrjNameCache->getElementNames();
-+ sal_Int32 nLen = sTemplateNames.getLength();
-+ for ( sal_Int32 index = 0; ( bSearchGlobalTemplates && index < nLen ); ++index )
-+ {
-+
-+ if ( !sCreatedFrom.equals( sTemplateNames[ index ] ) )
-+ {
-+ if ( xPrjNameCache->hasByName( sTemplateNames[ index ] ) )
-+ {
-+ xPrjNameCache->getByName( sTemplateNames[ index ] ) >>= sPrj;
-+ // Make sure we don't double up with this project
-+ if ( !sPrj.equals( sThisProject ) )
-+ sSearchList.push_back( sPrj );
-+ }
-+ }
-+
-+ }
-+ }
-+ }
-+ std::vector< rtl::OUString >::iterator it_end = sSearchList.end();
-+ for ( std::vector< rtl::OUString >::iterator it = sSearchList.begin(); it != it_end; ++it )
-+ {
-+ bool bRes = hasMacro( pShell, *it, sModule, sProcedure );
-+ if ( bRes )
-+ {
-+ aRes.SetResolved( true );
-+ aRes.SetMacroDocContext( pShell );
-+ sContainer = *it;
-+ break;
-+ }
-+ }
-+ aRes.SetResolvedMacro( sProcedure.Insert( '.', 0 ).Insert( sModule, 0).Insert( '.', 0 ).Insert( sContainer, 0 ) );
-+ }
-+
-+ return aRes;
-+}
-+
-+// Treat the args as possible inouts ( convertion at bottom of method )
-+sal_Bool executeMacroImpl( SfxObjectShell* pShell, const String& sMacroName, uno::Sequence< uno::Any >& aArgs, uno::Any& aRet, const uno::Any& /*aCaller*/ )
-+{
-+ sal_Bool bRes = sal_False;
-+ if ( !pShell )
-+ return bRes;
-+ rtl::OUString sUrl = makeMacroURLImpl( sMacroName );
-+
-+ uno::Sequence< sal_Int16 > aOutArgsIndex;
-+ uno::Sequence< uno::Any > aOutArgs;
-+
-+ try
-+ { ErrCode nErr( ERRCODE_BASIC_INTERNAL_ERROR );
-+ if ( pShell )
-+ {
-+ nErr = pShell->CallXScript( sUrl,
-+ aArgs, aRet, aOutArgsIndex, aOutArgs, false );
-+ sal_Int32 nLen = aOutArgs.getLength();
-+ // convert any out params to seem like they were inouts
-+ if ( nLen )
-+ {
-+ for ( sal_Int32 index=0; index < nLen; ++index )
-+ {
-+ sal_Int32 nOutIndex = aOutArgsIndex[ index ];
-+ aArgs[ nOutIndex ] = aOutArgs[ index ];
-+ }
-+ }
-+ }
-+ bRes = ( nErr == ERRCODE_NONE );
-+ }
-+ catch ( uno::Exception& )
-+ {
-+ bRes = sal_False;
-+ }
-+ return bRes;
-+}
-+
-+SfxObjectShell* getShellFromModel( const uno::Reference< frame::XModel >& rxModel )
-+{
-+ SfxObjectShell* pFoundShell = NULL;
-+ try
-+ {
-+ uno::Reference< lang::XUnoTunnel > xObjShellTunnel( rxModel, uno::UNO_QUERY );
-+ if ( xObjShellTunnel.is() )
-+ pFoundShell = reinterpret_cast<SfxObjectShell*>( xObjShellTunnel->getSomething(SfxObjectShell::getUnoTunnelId()));
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+ return pFoundShell;
-+}
-+//wrapper service(s)
-+
-+class VBAMacroResolvedInfoWrapper : public ::cppu::WeakImplHelper1< script::XVBAMacroResolvedInfo >
-+{
-+ sal_Bool mbResolved;
-+ rtl::OUString msResolvedMacro;
-+ uno::Reference< frame::XModel > mxDocCtx;
-+ public:
-+ VBAMacroResolvedInfoWrapper( const VBAMacroResolvedInfo& rInfo ) : mbResolved( rInfo.IsResolved() ), msResolvedMacro( rInfo.ResolvedMacro() ), mxDocCtx( rInfo.MacroDocContext() ? rInfo.MacroDocContext()->GetModel() : NULL )
-+ {
-+ }
-+ // Attributes
-+ virtual ::sal_Bool SAL_CALL getResolved() throw (uno::RuntimeException) { return mbResolved; }
-+ virtual void SAL_CALL setResolved( ::sal_Bool _resolved ) throw (uno::RuntimeException){ mbResolved = _resolved; }
-+ virtual ::rtl::OUString SAL_CALL getResolvedMacro() throw (uno::RuntimeException) { return msResolvedMacro; }
-+ virtual void SAL_CALL setResolvedMacro( const ::rtl::OUString& _resolvedmacro ) throw (uno::RuntimeException) { msResolvedMacro = _resolvedmacro; }
-+ virtual uno::Reference< frame::XModel > SAL_CALL getDocumentContext() throw (uno::RuntimeException) { return mxDocCtx; }
-+ virtual void SAL_CALL setDocumentContext( const uno::Reference< frame::XModel >& _documentcontext ) throw (uno::RuntimeException) { mxDocCtx = _documentcontext; }
-+};
-+
-+class VBAMacroHelper : public ::cppu::WeakImplHelper1< script::XVBAMacroHelper >
-+{
-+
-+ public:
-+ VBAMacroHelper() {}
-+ // Methods
-+ virtual ::rtl::OUString SAL_CALL makeMacroURL( const ::rtl::OUString& sMacroName ) throw (uno::RuntimeException);
-+ virtual ::rtl::OUString SAL_CALL extractMacroNameFromURL( const ::rtl::OUString& sURL ) throw (uno::RuntimeException);
-+ virtual uno::Reference< script::XVBAMacroResolvedInfo > SAL_CALL resolveVBAMacro( const uno::Reference< frame::XModel >& model, const ::rtl::OUString& moduleName, ::sal_Bool bSearchGlobalTemplates ) throw (uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL executeMacro( const uno::Reference< frame::XModel >& model, const ::rtl::OUString& smacroName, uno::Sequence< uno::Any >& aArgs, uno::Any& aRet, const uno::Any& aCaller ) throw (uno::RuntimeException);
-+};
-+
-+::rtl::OUString SAL_CALL
-+VBAMacroHelper::makeMacroURL( const ::rtl::OUString& sMacroName ) throw (uno::RuntimeException)
-+{
-+ rtl::OUString sMacro = makeMacroURLImpl( sMacroName );
-+ return sMacro;
-+}
-+
-+::rtl::OUString SAL_CALL
-+VBAMacroHelper::extractMacroNameFromURL( const ::rtl::OUString& sURL ) throw (uno::RuntimeException)
-+{
-+ rtl::OUString sMacro = extractMacroFromURL( sURL );
-+ return sMacro;
-+}
-+uno::Reference< script::XVBAMacroResolvedInfo > SAL_CALL
-+VBAMacroHelper::resolveVBAMacro( const uno::Reference< frame::XModel >& model, const ::rtl::OUString& moduleName, ::sal_Bool bSearchGlobalTemplates ) throw (uno::RuntimeException)
-+{
-+ VBAMacroResolvedInfo tmpInfo = resolveVBAMacroImpl( getShellFromModel( model ), moduleName, bSearchGlobalTemplates );
-+ uno::Reference< script::XVBAMacroResolvedInfo > xMacro = new VBAMacroResolvedInfoWrapper( tmpInfo );
-+ return xMacro;
-+}
-+
-+// Treat the args as possible inouts ( convertion at bottom of method )
-+::sal_Bool SAL_CALL
-+VBAMacroHelper::executeMacro( const uno::Reference< frame::XModel >& model, const ::rtl::OUString& smacroName, uno::Sequence< uno::Any >& aArgs, uno::Any& aRet, const uno::Any& aCaller ) throw (uno::RuntimeException)
-+{
-+ return executeMacroImpl( getShellFromModel( model ), smacroName, aArgs, aRet, aCaller );
-+}
-+
-+uno::Reference< uno::XInterface > SAL_CALL VBAMacroHelper_createInstance(const uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & /*rSMgr*/ ) throw( uno::Exception )
-+{
-+ uno::Reference< script::XVBAMacroHelper > xHelper( new VBAMacroHelper() );
-+ return xHelper;
-+}
-+
-+uno::Sequence< ::rtl::OUString > SAL_CALL VBAMacroHelper_getSupportedServiceNames() throw()
-+{
-+ uno::Sequence< rtl::OUString > aSupportedServiceNames( 1 );
-+ aSupportedServiceNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.VBAMacroHelper" ) );
-+ return aSupportedServiceNames;
-+}
-+
-+::rtl::OUString VBAMacroHelper_getImplementationName() throw()
-+{
-+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.VBAMacroHelper" ) );
-+}
-+
-+} // svx
-diff --git svx/source/unodraw/msvbahelper.hxx svx/source/unodraw/msvbahelper.hxx
-new file mode 100644
-index 0000000..59abd2f
---- /dev/null
-+++ svx/source/unodraw/msvbahelper.hxx
-@@ -0,0 +1,39 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2000, 2010 Oracle and/or its affiliates.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef _MSVBAHELPER_HXX
-+#define _MSVBAHELPER_HXX
-+
-+#include <sfx2/objsh.hxx>
-+#include "svx/svxdllapi.h"
-+
-+namespace svx {
-+ SVX_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL VBAMacroHelper_createInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr) throw( ::com::sun::star::uno::Exception );
-+ SVX_DLLPUBLIC ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL VBAMacroHelper_getSupportedServiceNames() throw();
-+ SVX_DLLPUBLIC ::rtl::OUString SAL_CALL VBAMacroHelper_getImplementationName() throw();
-+} //svx
-+
-+#endif
-diff --git svx/source/unodraw/unoctabl.cxx svx/source/unodraw/unoctabl.cxx
-index 060ab89..6503abc 100644
---- svx/source/unodraw/unoctabl.cxx
-+++ svx/source/unodraw/unoctabl.cxx
-@@ -40,6 +40,7 @@
- #include "xmlgrhlp.hxx"
- #include "tbunocontroller.hxx"
- #include "tbunosearchcontrollers.hxx"
-+#include "msvbahelper.hxx"
-
- using namespace ::com::sun::star;
- using namespace ::rtl;
-@@ -274,6 +275,17 @@ static void writeInfo (
- xNewKey->createKey( rServices.getConstArray()[i]);
- }
-
-+static void writeSingletonInfo (
-+ registry::XRegistryKey * pRegistryKey,
-+ const OUString& rImplementationName,
-+ const OUString& rSingletonName )
-+{
-+ uno::Reference< registry::XRegistryKey > xNewKey(
-+ pRegistryKey->createKey(
-+ OUString( rImplementationName + OUString( RTL_CONSTASCII_USTRINGPARAM("/UNO/SINGLETONS/") ) + rSingletonName ) ) );
-+
-+ xNewKey->setStringValue( rImplementationName );
-+}
- SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo (
- void * , void * pRegistryKey)
- {
-@@ -288,6 +300,8 @@ SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo (
- writeInfo( pKey, EnhancedCustomShapeEngine_getImplementationName(), EnhancedCustomShapeEngine_getSupportedServiceNames() );
- writeInfo( pKey, svx::RecoveryUI::st_getImplementationName(), svx::RecoveryUI::st_getSupportedServiceNames() );
- writeInfo( pKey, svx::GraphicExporter_getImplementationName(), svx::GraphicExporter_getSupportedServiceNames() );
-+ writeInfo( pKey, svx::VBAMacroHelper_getImplementationName(), svx::VBAMacroHelper_getSupportedServiceNames() );
-+ writeSingletonInfo( pKey, svx::VBAMacroHelper_getImplementationName(), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.theVBAMacroHelper" ) ) );
- writeInfo( pKey, svx::FontHeightToolBoxControl::getImplementationName_Static(), svx::FontHeightToolBoxControl::getSupportedServiceNames_Static() );
-
- writeInfo( pKey, svx::FindTextToolbarController::getImplementationName_Static(), svx::FindTextToolbarController::getSupportedServiceNames_Static() );
-@@ -358,6 +372,13 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory (
- svx::GraphicExporter_createInstance,
- svx::GraphicExporter_getSupportedServiceNames() );
- }
-+ else if( svx::VBAMacroHelper_getImplementationName().equalsAscii( pImplName ) )
-+ {
-+ xFactory = ::cppu::createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ),
-+ svx::VBAMacroHelper_getImplementationName(),
-+ svx::VBAMacroHelper_createInstance,
-+ svx::VBAMacroHelper_getSupportedServiceNames() );
-+ }
- else if ( svx::FontHeightToolBoxControl::getImplementationName_Static().equalsAscii( pImplName ) )
- {
- xFactory = createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ),
-diff --git sw/source/filter/ww8/ww8par.cxx sw/source/filter/ww8/ww8par.cxx
-index c71f885..394b2af 100644
---- sw/source/filter/ww8/ww8par.cxx
-+++ sw/source/filter/ww8/ww8par.cxx
-@@ -155,7 +155,6 @@ using namespace nsHdFtFlags;
- #include <com/sun/star/document/XEventsSupplier.hpp>
- #include <com/sun/star/container/XNameReplace.hpp>
- #include <com/sun/star/frame/XModel.hpp>
--#include <filter/msfilter/msvbahelper.hxx>
- #include <unotools/pathoptions.hxx>
- #include <com/sun/star/ucb/XSimpleFileAccess.hpp>
-
-diff --git vbahelper/inc/vbahelper/vbaapplicationbase.hxx vbahelper/inc/vbahelper/vbaapplicationbase.hxx
-index d1ef76c..737274d 100644
---- vbahelper/inc/vbahelper/vbaapplicationbase.hxx
-+++ vbahelper/inc/vbahelper/vbaapplicationbase.hxx
-@@ -30,6 +30,8 @@
- #include <ooo/vba/XHelperInterface.hpp>
- #include <ooo/vba/XApplicationBase.hpp>
- #include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/script/XVBAMacroHelper.hpp>
-+
- #include <sfx2/objsh.hxx>
-
- typedef InheritedHelperInterfaceImpl1< ov::XApplicationBase > ApplicationBase_BASE;
-@@ -41,6 +43,7 @@ class VBAHELPER_DLLPUBLIC VbaApplicationBase : public ApplicationBase_BASE
- VbaApplicationBase_Impl* m_pImpl;
-
- protected:
-+ css::uno::Reference< css::script::XVBAMacroHelper > m_xMacroHelper;
- VbaApplicationBase( const css::uno::Reference< css::uno::XComponentContext >& xContext );
- virtual ~VbaApplicationBase();
-
-diff --git vbahelper/inc/vbahelper/vbaeventshelperbase.hxx vbahelper/inc/vbahelper/vbaeventshelperbase.hxx
-index b0dd184..8443251 100755
---- vbahelper/inc/vbahelper/vbaeventshelperbase.hxx
-+++ vbahelper/inc/vbahelper/vbaeventshelperbase.hxx
-@@ -30,6 +30,7 @@
-
- #include <com/sun/star/lang/XEventListener.hpp>
- #include <com/sun/star/script/vba/XVBAEventProcessor.hpp>
-+#include <com/sun/star/script/XVBAMacroHelper.hpp>
- #include <cppuhelper/implbase2.hxx>
- #include <map>
- #include <deque>
-@@ -147,7 +148,9 @@ private:
- void stopListening();
-
- protected:
-+ css::uno::Reference< css::script::XVBAMacroHelper > mxMacroHelper;
- css::uno::Reference< css::frame::XModel > mxModel;
-+ css::uno::Reference< css::uno::XComponentContext > mxContext;
- SfxObjectShell* mpShell;
-
- private:
-diff --git vbahelper/source/msforms/vbacombobox.cxx vbahelper/source/msforms/vbacombobox.cxx
-index 5c05894..f7346f4 100644
---- vbahelper/source/msforms/vbacombobox.cxx
-+++ vbahelper/source/msforms/vbacombobox.cxx
-@@ -26,7 +26,6 @@
- ************************************************************************/
- #include "vbacombobox.hxx"
- #include <vector>
--#include <filter/msfilter/msvbahelper.hxx>
- #include <basic/sbstar.hxx>
- #include <basic/sbmod.hxx>
-
-diff --git vbahelper/source/vbahelper/vbaapplicationbase.cxx vbahelper/source/vbahelper/vbaapplicationbase.cxx
-index bb12c44..1541d97 100644
---- vbahelper/source/vbahelper/vbaapplicationbase.cxx
-+++ vbahelper/source/vbahelper/vbaapplicationbase.cxx
-@@ -40,9 +40,10 @@
- #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
- #include <com/sun/star/document/XEmbeddedScripts.hpp>
- #include <com/sun/star/awt/XWindow2.hpp>
-+#include <com/sun/star/script/theVBAMacroHelper.hpp>
-+#include <comphelper/processfactory.hxx>
-
- #include <hash_map>
--#include <filter/msfilter/msvbahelper.hxx>
- #include <tools/datetime.hxx>
-
- #include <basic/sbx.hxx>
-@@ -182,6 +183,13 @@ VbaApplicationBase::VbaApplicationBase( const uno::Reference< uno::XComponentCon
- : ApplicationBase_BASE( uno::Reference< XHelperInterface >(), xContext )
- , m_pImpl( new VbaApplicationBase_Impl )
- {
-+ try
-+ {
-+ m_xMacroHelper = script::theVBAMacroHelper::get( comphelper::getProcessComponentContext() );
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ }
- }
-
- VbaApplicationBase::~VbaApplicationBase()
-@@ -345,8 +353,10 @@ uno::Any SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, con
-
-
- // search the global tempalte
-- VBAMacroResolvedInfo aMacroInfo = resolveVBAMacro( getSfxObjShell( aMacroDocumentModel ), sMacro_only_Name, sal_True );
-- if( aMacroInfo.IsResolved() )
-+ uno::Reference< script::XVBAMacroResolvedInfo > xMacroInfo;
-+ if ( m_xMacroHelper.is() )
-+ xMacroInfo = m_xMacroHelper->resolveVBAMacro( getCurrentDocument(), MacroName, sal_True );
-+ if( xMacroInfo->getResolved() )
- {
- // handle the arguments
- const uno::Any* aArgsPtrArray[] = { &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8, &varg9, &varg10, &varg11, &varg12, &varg13, &varg14, &varg15, &varg16, &varg17, &varg18, &varg19, &varg20, &varg21, &varg22, &varg23, &varg24, &varg25, &varg26, &varg27, &varg28, &varg29, &varg30 };
-@@ -372,7 +382,7 @@ uno::Any SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, con
-
- uno::Any aRet;
- uno::Any aDummyCaller;
-- executeMacro( aMacroInfo.MacroDocContext(), aMacroInfo.ResolvedMacro(), aArgs, aRet, aDummyCaller );
-+ m_xMacroHelper->executeMacro( xMacroInfo->getDocumentContext(), xMacroInfo->getResolvedMacro(), aArgs, aRet, aDummyCaller );
-
- return aRet;
- }
-diff --git vbahelper/source/vbahelper/vbacommandbarcontrol.cxx vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
-index 1b2d013..3378a4d 100644
---- vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
-+++ vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
-@@ -27,7 +27,8 @@
- #include "vbacommandbarcontrol.hxx"
- #include "vbacommandbarcontrols.hxx"
- #include <vbahelper/vbahelper.hxx>
--#include <filter/msfilter/msvbahelper.hxx>
-+#include <com/sun/star/script/theVBAMacroHelper.hpp>
-+#include <comphelper/processfactory.hxx>
-
- using namespace com::sun::star;
- using namespace ooo::vba;
-@@ -78,10 +79,11 @@ ScVbaCommandBarControl::setOnAction( const ::rtl::OUString& _onaction ) throw (u
- {
- // get the current model
- uno::Reference< frame::XModel > xModel( pCBarHelper->getModel() );
-- VBAMacroResolvedInfo aResolvedMacro = ooo::vba::resolveVBAMacro( getSfxObjShell( xModel ), _onaction, true );
-- if ( aResolvedMacro.IsResolved() )
-+ uno::Reference< script::XVBAMacroHelper > xMacroHelper = script::theVBAMacroHelper::get( comphelper::getProcessComponentContext() );
-+ uno::Reference< script::XVBAMacroResolvedInfo > xResolvedMacro = xMacroHelper->resolveVBAMacro( xModel, _onaction, sal_True );
-+ if ( xResolvedMacro->getResolved() )
- {
-- rtl::OUString aCommandURL = ooo::vba::makeMacroURL( aResolvedMacro.ResolvedMacro() );
-+ rtl::OUString aCommandURL = xMacroHelper->makeMacroURL( xResolvedMacro->getResolvedMacro() );
- OSL_TRACE(" ScVbaCommandBarControl::setOnAction: %s", rtl::OUStringToOString( aCommandURL, RTL_TEXTENCODING_UTF8 ).getStr() );
- setPropertyValue( m_aPropertyValues, rtl::OUString::createFromAscii("CommandURL"), uno::makeAny( aCommandURL ) );
- ApplyChange();
-diff --git vbahelper/source/vbahelper/vbaeventshelperbase.cxx vbahelper/source/vbahelper/vbaeventshelperbase.cxx
-index ee6eccb..43f63f3 100755
---- vbahelper/source/vbahelper/vbaeventshelperbase.cxx
-+++ vbahelper/source/vbahelper/vbaeventshelperbase.cxx
-@@ -26,14 +26,15 @@
- ************************************************************************/
-
- #include "vbahelper/vbaeventshelperbase.hxx"
--#include <filter/msfilter/msvbahelper.hxx>
-+#include <com/sun/star/script/theVBAMacroHelper.hpp>
-
- using namespace ::com::sun::star;
- using namespace ::ooo::vba;
-
- // ============================================================================
-
--VbaEventsHelperBase::VbaEventsHelperBase( const uno::Sequence< uno::Any >& rArgs, const uno::Reference< uno::XComponentContext >& /*xContext*/ ) :
-+VbaEventsHelperBase::VbaEventsHelperBase( const uno::Sequence< uno::Any >& rArgs, const uno::Reference< uno::XComponentContext >& xContext ) :
-+ mxContext( xContext ),
- mpShell( 0 ),
- mbDisposed( false )
- {
-@@ -49,6 +50,17 @@ VbaEventsHelperBase::VbaEventsHelperBase( const uno::Sequence< uno::Any >& rArgs
- catch( uno::Exception& )
- {
- }
-+ try
-+ {
-+ // Our custom context does not handler requests for singletons
-+ // we need to get the system context for that
-+ uno::Reference< beans::XPropertySet > xProps( mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
-+ uno::Reference< uno::XComponentContext > xDfltContext( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DefaultContext") ) ), uno::UNO_QUERY_THROW );
-+ mxMacroHelper = script::theVBAMacroHelper::get( xDfltContext );
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
- }
-
- VbaEventsHelperBase::~VbaEventsHelperBase()
-@@ -111,7 +123,7 @@ void SAL_CALL VbaEventsHelperBase::processVbaEvent( sal_Int32 nEventId, const un
- // search the event handler macro in the document
- ::rtl::OUString aMacroPath = getEventHandlerPath( rInfo, aEventArgs );
- bool bEventSuccess = false;
-- if( aMacroPath.getLength() > 0 )
-+ if( mxMacroHelper.is() && aMacroPath.getLength() > 0 )
- {
- // build the argument list
- uno::Sequence< uno::Any > aVbaArgs = implBuildArgumentList( rInfo, aEventArgs );
-@@ -124,7 +136,9 @@ void SAL_CALL VbaEventsHelperBase::processVbaEvent( sal_Int32 nEventId, const un
- }
- // execute the event handler
- uno::Any aRet, aCaller;
-- bEventSuccess = executeMacro( mpShell, aMacroPath, aVbaArgs, aRet, aCaller );
-+
-+ bEventSuccess = mxMacroHelper->executeMacro( mpShell->GetModel(), aMacroPath, aVbaArgs, aRet, aCaller );
-+
- // extract new cancel value
- if( rInfo.mnCancelIndex >= 0 )
- {
-@@ -200,7 +214,14 @@ const VbaEventsHelperBase::EventHandlerInfo& VbaEventsHelperBase::getEventHandle
- append( sal_Unicode( '.' ) ).append( rInfo.maMacroName ).makeStringAndClear();
- break;
- }
-- return resolveVBAMacro( mpShell, aMacroName ).ResolvedMacro();
-+ rtl::OUString sResolvedMacro;
-+ if ( mxMacroHelper.is() )
-+ {
-+ uno::Reference< script::XVBAMacroResolvedInfo > xResolvedMacroInfo = mxMacroHelper->resolveVBAMacro( mpShell->GetModel(), aMacroName, sal_False );
-+ if ( xResolvedMacroInfo.is() )
-+ sResolvedMacro = xResolvedMacroInfo->getResolvedMacro();
-+ }
-+ return sResolvedMacro;
- }
-
- void VbaEventsHelperBase::stopListening()
---- vbahelper/util/makefile.mk.old 2010-09-03 20:43:41.000000000 +0200
-+++ vbahelper/util/makefile.mk 2010-09-03 21:09:21.000000000 +0200
-@@ -60,7 +60,6 @@ SHL1STDLIBS= \
- $(SVLLIB) \
- $(VCLLIB) \
- $(SVTOOLLIB) \
-- $(MSFILTERLIB) \
- $(TKLIB)
-
- SHL1DEPN=
diff --git a/patches/vba/vba-multipage-fireapichange.diff b/patches/vba/vba-multipage-fireapichange.diff
deleted file mode 100644
index 380b1f432..000000000
--- a/patches/vba/vba-multipage-fireapichange.diff
+++ /dev/null
@@ -1,29 +0,0 @@
-From ad4c937c45b8c44db06a5804f0b88edcedd02a98 Mon Sep 17 00:00:00 2001
-From: Jan Holesovsky <kendy@suse.cz>
-Date: Fri, 14 May 2010 17:00:14 +0200
-Subject: [PATCH 401/878] vba-multipage-fireapichange.diff
-
----
- vbahelper/source/msforms/vbamultipage.cxx | 5 ++++-
- 1 files changed, 4 insertions(+), 1 deletions(-)
-
-diff --git a/vbahelper/source/msforms/vbamultipage.cxx b/vbahelper/source/msforms/vbamultipage.cxx
-index b8fa10b..69084f0 100644
---- a/vbahelper/source/msforms/vbamultipage.cxx
-+++ b/vbahelper/source/msforms/vbamultipage.cxx
-@@ -92,8 +92,11 @@ void SAL_CALL
- ScVbaMultiPage::setValue( const sal_Int32 _value ) throw (::com::sun::star::uno::RuntimeException)
- {
- // Openoffice 1 based tab index
-- sal_Int32 nVal = _value + 1;
-+ sal_Int32 nVal = _value + 1;
-+ sal_Int32 nOldVal = getValue();
- m_xProps->setPropertyValue( SVALUE, uno::makeAny( nVal ) );
-+ if ( nVal != nOldVal )
-+ fireChangeEvent();
- }
-
-
---
-1.7.0.1
-
diff --git a/patches/vba/vba-noregrex-for-match.diff b/patches/vba/vba-noregrex-for-match.diff
deleted file mode 100644
index 47cfeadf9..000000000
--- a/patches/vba/vba-noregrex-for-match.diff
+++ /dev/null
@@ -1,34 +0,0 @@
-diff --git sc/source/core/tool/interpr1.cxx sc/source/core/tool/interpr1.cxx
-index fc008c4..22b0807 100644
---- sc/source/core/tool/interpr1.cxx
-+++ sc/source/core/tool/interpr1.cxx
-@@ -75,6 +75,7 @@
- #include "externalrefmgr.hxx"
- #include "doubleref.hxx"
- #include "queryparam.hxx"
-+#include <basic/sbstar.hxx>
-
- #define SC_DOUBLE_MAXVALUE 1.7e307
-
-@@ -4138,7 +4139,20 @@ void ScInterpreter::ScMatch()
- }
- }
- if ( rEntry.bQueryByString )
-- rParam.bRegExp = MayBeRegExp( *rEntry.pStr, pDok );
-+ {
-+ BOOL bIsVBAMode = FALSE;
-+ if ( pDok )
-+ {
-+ SfxObjectShell* pDocSh = pDok->GetDocumentShell();
-+ if ( pDocSh )
-+ bIsVBAMode = pDocSh->GetBasic()->isVBAEnabled();
-+ }
-+ // #TODO handle MSO wildcards
-+ if ( bIsVBAMode )
-+ rParam.bRegExp = FALSE;
-+ else
-+ rParam.bRegExp = MayBeRegExp( *rEntry.pStr, pDok );
-+ }
-
- if (pMatSrc) // The source data is matrix array.
- {
diff --git a/patches/vba/vba-not-param-withoutbrackets.diff b/patches/vba/vba-not-param-withoutbrackets.diff
deleted file mode 100644
index bc8f21f86..000000000
--- a/patches/vba/vba-not-param-withoutbrackets.diff
+++ /dev/null
@@ -1,11 +0,0 @@
---- basic/source/comp/exprtree.cxx.orig 2008-06-05 17:15:38.000000000 +0800
-+++ basic/source/comp/exprtree.cxx 2008-06-05 17:16:19.000000000 +0800
-@@ -117,7 +117,7 @@ static BOOL DoParametersFollow( SbiParse
- if( !p->WhiteSpace() || eCurExpr != SbSYMBOL )
- return FALSE;
- if ( eTok == NUMBER || eTok == MINUS || eTok == FIXSTRING
-- || eTok == SYMBOL || eTok == COMMA || eTok == DOT )
-+ || eTok == SYMBOL || eTok == COMMA || eTok == DOT || eTok == NOT )
- {
- return TRUE;
- }
diff --git a/patches/vba/vba-null-not-treatment.diff b/patches/vba/vba-null-not-treatment.diff
deleted file mode 100644
index bd8c11adf..000000000
--- a/patches/vba/vba-null-not-treatment.diff
+++ /dev/null
@@ -1,87 +0,0 @@
-diff --git basic/source/runtime/step0.cxx basic/source/runtime/step0.cxx
-index 0666725..a2df718 100644
---- basic/source/runtime/step0.cxx
-+++ basic/source/runtime/step0.cxx
-@@ -118,8 +118,21 @@ void SbiRuntime::StepCompare( SbxOperato
- #ifndef WIN
- static SbxVariable* pTRUE = NULL;
- static SbxVariable* pFALSE = NULL;
--
-- if( p2->Compare( eOp, *p1 ) )
-+ static SbxVariable* pNULL = NULL;
-+ // why do this on non-windows ?
-+ // why do this at all ?
-+ // I dumbly follow the pattern :-/
-+ if ( bVBAEnabled && ( p1->IsNull() || p2->IsNull() ) )
-+ {
-+ if( !pNULL )
-+ {
-+ pNULL = new SbxVariable;
-+ pNULL->PutNull();
-+ pNULL->AddRef();
-+ }
-+ PushVar( pNULL );
-+ }
-+ else if( p2->Compare( eOp, *p1 ) )
- {
- if( !pTRUE )
- {
-@@ -140,9 +153,14 @@ void SbiRuntime::StepCompare( SbxOperato
- PushVar( pFALSE );
- }
- #else
-- BOOL bRes = p2->Compare( eOp, *p1 );
- SbxVariable* pRes = new SbxVariable;
-- pRes->PutBool( bRes );
-+ if ( bVBAEnabled && ( p1->IsNull() || p2->IsNull() ) )
-+ pRes->PutNull();
-+ else
-+ {
-+ BOOL bRes = p2->Compare( eOp, *p1 );
-+ pRes->PutBool( bRes );
-+ }
- PushVar( pRes );
- #endif
- }
-diff --git basic/source/runtime/step1.cxx basic/source/runtime/step1.cxx
-index 8a4adfa..57d7f02 100644
---- basic/source/runtime/step1.cxx
-+++ basic/source/runtime/step1.cxx
-@@ -192,7 +192,9 @@ void SbiRuntime::StepJUMPT( UINT32 nOp1 )
- void SbiRuntime::StepJUMPF( UINT32 nOp1 )
- {
- SbxVariableRef p = PopVar();
-- if( !p->GetBool() )
-+ // In a test e.g. If Null then
-+ // will evaluate Null will act as if False
-+ if( ( bVBAEnabled && p->IsNull() ) || !p->GetBool() )
- StepJUMP( nOp1 );
- }
-
-diff --git basic/source/sbx/sbxvalue.cxx basic/source/sbx/sbxvalue.cxx
-index 37e9523..5447439 100644
---- basic/source/sbx/sbxvalue.cxx
-+++ basic/source/sbx/sbxvalue.cxx
-@@ -1195,6 +1195,8 @@ BOOL SbxValue::Compute( SbxOperator eOp,
- aL.eType = aR.eType = GetType();
- // else if( GetType() == SbxDouble || GetType() == SbxSingle )
- // aL.eType = aR.eType = SbxLONG64;
-+ else if ( bVBAInterop && eOpType == SbxBOOL )
-+ aL.eType = aR.eType = SbxBOOL;
- else
- aL.eType = aR.eType = SbxLONG;
- }
-@@ -1281,7 +1283,12 @@ BOOL SbxValue::Compute( SbxOperator eOp,
- break;
- case SbxNOT:
- if( aL.eType != SbxLONG && aL.eType != SbxULONG )
-- aL.nLong64 = ~aL.nLong64;
-+ {
-+ if ( aL.eType != SbxBOOL )
-+ aL.nLong64 = ~aL.nLong64;
-+ else
-+ aL.nLong = ~aL.nLong;
-+ }
- else
- aL.nLong = ~aL.nLong;
- break;
diff --git a/patches/vba/vba-only-import-std-menutoolbar.diff b/patches/vba/vba-only-import-std-menutoolbar.diff
deleted file mode 100644
index a1e656a9b..000000000
--- a/patches/vba/vba-only-import-std-menutoolbar.diff
+++ /dev/null
@@ -1,14 +0,0 @@
-diff --git sw/source/filter/ww8/ww8toolbar.cxx sw/source/filter/ww8/ww8toolbar.cxx
-index dfcaa17..b5648bf 100644
---- sw/source/filter/ww8/ww8toolbar.cxx
-+++ sw/source/filter/ww8/ww8toolbar.cxx
-@@ -216,7 +216,8 @@ bool Customization::Read( SvStream *pS)
- if (!aTBDelta.Read( pS ) )
- return false;
- customizationDataTBDelta.push_back( aTBDelta );
-- if ( aTBDelta.ControlDropsToolBar() )
-+ // Only set the drop down for menu's associated with standard toolbar
-+ if ( aTBDelta.ControlDropsToolBar() && tbidForTBD == 0x25 )
- pWrapper->InsertDropIndex( aTBDelta.CustomizationIndex() );
- }
- }
diff --git a/patches/vba/vba-oovbaapi-parallel-build.diff b/patches/vba/vba-oovbaapi-parallel-build.diff
deleted file mode 100644
index 6ee63b2e7..000000000
--- a/patches/vba/vba-oovbaapi-parallel-build.diff
+++ /dev/null
@@ -1,23 +0,0 @@
---- oovbaapi/genconstidl/makefile.mk 2009-04-06 23:28:54.000000000 +0200
-+++ oovbaapi/genconstidl/makefile.mk 2009-04-06 23:30:06.000000000 +0200
-@@ -49,18 +49,16 @@ MYDONEFILES += $(foreach,i,$(MYSYMFILES)
-
- ALLTAR: GENIDL
-
--GENIDL : $(MY_GEN_IDL_PATH) $(MYDONEFILES)
-+GENIDL : $(MYDONEFILES)
-
- GENRDB : GENIDL $(MYURDFILES)
-
- $(MISC)$/%.done : %.api
-+ @@-$(MKDIR) $(MY_GEN_IDL_PATH)
- @echo Processing $?
- $(PERL) api-to-idl.pl $? $(MY_GEN_IDL_PATH)
- @$(TOUCH) $@
-
--$(MY_GEN_IDL_PATH) :
-- @@-$(MKDIR) $@
--
- CLEAN :
- @$(RM) $(MY_GEN_IDL_PATH)$/*.idl
- @$(RM) $(foreach,i,$(MYSYMFILES) $(MISC)$/$(i:b).done)
diff --git a/patches/vba/vba-oox-autocodename.diff b/patches/vba/vba-oox-autocodename.diff
deleted file mode 100644
index a901123d8..000000000
--- a/patches/vba/vba-oox-autocodename.diff
+++ /dev/null
@@ -1,225 +0,0 @@
-diff --git oox/inc/oox/ole/vbamodule.hxx oox/inc/oox/ole/vbamodule.hxx
-index 3b529ce..cef676d 100755
---- oox/inc/oox/ole/vbamodule.hxx
-+++ oox/inc/oox/ole/vbamodule.hxx
-@@ -74,6 +74,10 @@ public:
- const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxBasicLib,
- const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& rxDocObjectNA ) const;
-
-+ /** Creates empty document module for the passed Basic library/project. */
-+ void createEmptyDocModule(
-+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxBasicLib,
-+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& rxDocObjectNA ) const;
- private:
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
- mxDocModel; /// Document model used to import/export the VBA project.
-diff --git oox/inc/oox/ole/vbaproject.hxx oox/inc/oox/ole/vbaproject.hxx
-index 09f4c74..07e94ef 100755
---- oox/inc/oox/ole/vbaproject.hxx
-+++ oox/inc/oox/ole/vbaproject.hxx
-@@ -85,6 +85,7 @@ public:
- void importVbaProject(
- StorageBase& rVbaPrjStrg,
- const GraphicHelper& rGraphicHelper,
-+ const ::com::sun::star::uno::Sequence< rtl::OUString >& sGeneratedCNames = ::com::sun::star::uno::Sequence< rtl::OUString >(0),
- bool bDefaultColorBgr = true );
-
- /** Returns true, if the document contains at least one code module. */
-@@ -114,7 +115,7 @@ private:
- ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
- createDialogLibrary();
- /** Imports the VBA code modules and forms. */
-- void importVba( StorageBase& rVbaPrjStrg, const GraphicHelper& rGraphicHelper, bool bDefaultColorBgr );
-+ void importVba( StorageBase& rVbaPrjStrg, const GraphicHelper& rGraphicHelper, const ::com::sun::star::uno::Sequence< rtl::OUString >& sGeneratedCNames, bool bDefaultColorBgr );
- /** Copies the entire VBA project storage to the passed document model. */
- void copyStorage( StorageBase& rVbaPrjStrg );
-
-diff --git oox/source/ole/vbamodule.cxx oox/source/ole/vbamodule.cxx
-index 2953ecf..635991a 100755
---- oox/source/ole/vbamodule.cxx
-+++ oox/source/ole/vbamodule.cxx
-@@ -232,6 +232,46 @@ void VbaModule::importSourceCode( StorageBase& rVbaStrg,
- OSL_ENSURE( false, "VbaModule::importSourceCode - cannot insert module into library" );
- }
- }
-+void VbaModule::createEmptyDocModule( const Reference< XNameContainer >& rxBasicLib, const Reference< XNameAccess >& rxDocObjectNA ) const
-+{
-+ if( maName.getLength() == 0 )
-+ return;
-+
-+ // prepare the Basic module
-+ ModuleInfo aModuleInfo;
-+ aModuleInfo.ModuleType = mnType;
-+ OUStringBuffer aSourceCode;
-+ aSourceCode.appendAscii( RTL_CONSTASCII_STRINGPARAM( "Rem Attribute VBA_ModuleType=VBADocumentModule" ) );
-+
-+ // get the VBA object associated to the document module
-+ if( rxDocObjectNA.is() ) try
-+ {
-+ aModuleInfo.ModuleObject.set( rxDocObjectNA->getByName( maName ), UNO_QUERY );
-+ }
-+ catch( Exception& )
-+ {
-+ }
-+
-+ // insert extended module info
-+ try
-+ {
-+ Reference< XVBAModuleInfo > xVBAModuleInfo( rxBasicLib, UNO_QUERY_THROW );
-+ xVBAModuleInfo->insertModuleInfo( maName, aModuleInfo );
-+ }
-+ catch( Exception& )
-+ {
-+ }
-+
-+ // insert the module into the passed Basic library
-+ try
-+ {
-+ rxBasicLib->insertByName( maName, Any( aSourceCode.makeStringAndClear() ) );
-+ }
-+ catch( Exception& )
-+ {
-+ OSL_ENSURE( false, "VbaModule::importSourceCode - cannot insert module into library" );
-+ }
-+}
-
- // ============================================================================
-
-diff --git oox/source/ole/vbaproject.cxx oox/source/ole/vbaproject.cxx
-index 11ae11d..af90e41 100755
---- oox/source/ole/vbaproject.cxx
-+++ oox/source/ole/vbaproject.cxx
-@@ -52,6 +52,7 @@
- using ::rtl::OUString;
- using ::rtl::OUStringBuffer;
- using ::comphelper::ConfigurationHelper;
-+using ::com::sun::star::uno::Sequence;
-
- using namespace ::com::sun::star::container;
- using namespace ::com::sun::star::document;
-@@ -138,13 +139,13 @@ VbaProject::~VbaProject()
- {
- }
-
--void VbaProject::importVbaProject( StorageBase& rVbaPrjStrg, const GraphicHelper& rGraphicHelper, bool bDefaultColorBgr )
-+void VbaProject::importVbaProject( StorageBase& rVbaPrjStrg, const GraphicHelper& rGraphicHelper, const Sequence< OUString >& rGeneratedCNames, bool bDefaultColorBgr )
- {
- if( rVbaPrjStrg.isStorage() )
- {
- // load the code modules and forms
- if( isImportVba() )
-- importVba( rVbaPrjStrg, rGraphicHelper, bDefaultColorBgr );
-+ importVba( rVbaPrjStrg, rGraphicHelper, rGeneratedCNames, bDefaultColorBgr );
- // copy entire storage into model
- if( isExportVba() )
- copyStorage( rVbaPrjStrg );
-@@ -211,7 +212,7 @@ Reference< XNameContainer > VbaProject::createDialogLibrary()
- return mxDialogLib;
- }
-
--void VbaProject::importVba( StorageBase& rVbaPrjStrg, const GraphicHelper& rGraphicHelper, bool bDefaultColorBgr )
-+void VbaProject::importVba( StorageBase& rVbaPrjStrg, const GraphicHelper& rGraphicHelper, const Sequence< OUString >& rGeneratedCNames, bool bDefaultColorBgr )
- {
- StorageRef xVbaStrg = rVbaPrjStrg.openSubStorage( CREATE_OUSTRING( "VBA" ), false );
- OSL_ENSURE( xVbaStrg.get(), "VbaProject::importVba - cannot open 'VBA' substorage" );
-@@ -235,7 +236,7 @@ void VbaProject::importVba( StorageBase& rVbaPrjStrg, const GraphicHelper& rGrap
- bool bExecutable = isImportVbaExecutable();
-
- typedef RefMap< OUString, VbaModule > VbaModuleMap;
-- VbaModuleMap aModules, aModulesByStrm;
-+ VbaModuleMap aModules, aModulesByStrm, aGeneratedModules;
-
- sal_uInt16 nRecId = 0;
- StreamDataSequence aRecData;
-@@ -349,11 +350,21 @@ void VbaProject::importVba( StorageBase& rVbaPrjStrg, const GraphicHelper& rGrap
- }
- }
-
-+ // populate aModules with modules from generated codenames ( if they exist )
-+ const rtl::OUString* pGenModName = rGeneratedCNames.getConstArray();
-+ const rtl::OUString* pEnd = rGeneratedCNames.getConstArray() + rGeneratedCNames.getLength();
-+ for ( ; pGenModName != pEnd; ++pGenModName )
-+ {
-+ VbaModuleMap::mapped_type& rxModule = aGeneratedModules[ *pGenModName ];
-+ rxModule.reset( new VbaModule( mxDocModel, *pGenModName, eTextEnc, bExecutable ) );
-+ rxModule->setType( ModuleType::DOCUMENT );
-+ }
-+
- /* Now it is time to load the source code. All modules will be inserted
- into the Basic library of the document specified by the 'maPrjName'
- member. Do not create the Basic library, if there are no modules
- specified. */
-- if( !aModules.empty() ) try
-+ if( !aModules.empty() || !aGeneratedModules.empty() ) try
- {
- // get the model factory and the basic library
- Reference< XMultiServiceFactory > xModelFactory( mxDocModel, UNO_QUERY_THROW );
-@@ -390,8 +401,12 @@ void VbaProject::importVba( StorageBase& rVbaPrjStrg, const GraphicHelper& rGrap
-
- // call Basic source code import for each module, boost::[c]ref enforces pass-by-ref
- if( xBasicLib.is() )
-+ {
-+ aGeneratedModules.forEachMem( &VbaModule::createEmptyDocModule,
-+ ::boost::cref( xBasicLib ), ::boost::cref( xDocObjectNA ) );
- aModules.forEachMem( &VbaModule::importSourceCode,
- ::boost::ref( *xVbaStrg ), ::boost::cref( xBasicLib ), ::boost::cref( xDocObjectNA ) );
-+ }
- }
- catch( Exception& )
- {
-diff --git oox/source/xls/excelfilter.cxx oox/source/xls/excelfilter.cxx
-index 6f3263f..3947221 100644
---- oox/source/xls/excelfilter.cxx
-+++ oox/source/xls/excelfilter.cxx
-@@ -274,13 +274,15 @@ bool SimpleExcelVBAProjFilter::importDocument() throw()
- OSL_ENSURE( eBiff != BIFF_UNKNOWN, "ExcelBiffFilter::ExcelBiffFilter - invalid file format" );
- if( eBiff != BIFF_UNKNOWN )
- {
-+ Sequence< rtl::OUString > sGeneratedCNames;
-+ getArgument( CREATE_OUSTRING( "GeneratedCodeNames" ) ) >>= sGeneratedCNames;
- WorkbookHelperRoot aHelper( *this, eBiff );
- StorageRef xVbaPrjStrg = openSubStorage( CREATE_OUSTRING( "_VBA_PROJECT_CUR" ), false ) ;
- if( xVbaPrjStrg.get() && xVbaPrjStrg->isStorage() )
- {
- //VbaProject aVbaProject( getGlobalFactory(), aHelper.getDocument() );
- ole::VbaProject aVbaProject( getGlobalFactory(), Reference< com::sun::star::frame::XModel >( aHelper.getDocument(), UNO_QUERY ), CREATE_OUSTRING( "Calc" ) );
-- aVbaProject.importVbaProject( *xVbaPrjStrg, getGraphicHelper() );
-+ aVbaProject.importVbaProject( *xVbaPrjStrg, getGraphicHelper(), sGeneratedCNames );
- bRet = true;
- }
- }
-diff --git sc/source/filter/excel/excimp8.cxx sc/source/filter/excel/excimp8.cxx
-index d50848b..e300103 100644
---- sc/source/filter/excel/excimp8.cxx
-+++ sc/source/filter/excel/excimp8.cxx
-@@ -259,8 +259,28 @@ void ImportExcel8::ReadBasic( void )
- try
- {
- uno::Reference< lang::XComponent > xComponent( pShell->GetModel(), uno::UNO_QUERY_THROW );
--
-- uno::Reference< document::XImporter > xImporter( ScfApiHelper::CreateInstance( CREATE_OUSTRING( "com.sun.star.comp.xls.SimpleExcelVBAProjFilter" ) ), uno::UNO_QUERY_THROW );
-+ uno::Sequence< beans::NamedValue > aArgSeq(1);
-+ // I guess we could actually handle the GeneratedCodeNames here
-+ // ( e.g. after import create the required modules ) but...
-+ // better to reuse the code in the filter right?
-+ uno::Sequence< rtl::OUString > sGeneratedCNames;
-+ aArgSeq[ 0 ].Name = CREATE_OUSTRING( "GeneratedCodeNames");
-+ if ( AutoGeneratedCodeNames.size() )
-+ {
-+ sGeneratedCNames.realloc( AutoGeneratedCodeNames.size() );
-+ std::vector< String >::iterator it_end = AutoGeneratedCodeNames.end();
-+ rtl::OUString* pItem = sGeneratedCNames.getArray();
-+ for ( std::vector< String >::iterator it = AutoGeneratedCodeNames.begin(); it != it_end; ++it, ++pItem )
-+ *pItem = *it;
-+ }
-+ aArgSeq[ 0 ].Value <<= sGeneratedCNames;
-+
-+ uno::Sequence< uno::Any > aArgs( 2 );
-+ aArgs[ 0 ] <<= getProcessServiceFactory();
-+ aArgs[ 1 ] <<= aArgSeq;
-+
-+ uno::Reference< document::XImporter > xImporter( ScfApiHelper::CreateInstanceWithArgs( CREATE_OUSTRING( "com.sun.star.comp.xls.SimpleExcelVBAProjFilter" ), aArgs ), uno::UNO_QUERY_THROW );
-+
- xImporter->setTargetDocument( xComponent );
-
- MediaDescriptor aMediaDesc;
diff --git a/patches/vba/vba-oox-olenameoverride.diff b/patches/vba/vba-oox-olenameoverride.diff
deleted file mode 100644
index 038d6338e..000000000
--- a/patches/vba/vba-oox-olenameoverride.diff
+++ /dev/null
@@ -1,446 +0,0 @@
-diff --git oox/inc/oox/helper/containerhelper.hxx oox/inc/oox/helper/containerhelper.hxx
-index 25065f9..89445c4 100644
---- oox/inc/oox/helper/containerhelper.hxx
-+++ oox/inc/oox/helper/containerhelper.hxx
-@@ -124,6 +124,13 @@ public:
- forEach( ::boost::bind( pFunc, _1, aParam1, aParam2, aParam3 ) );
- }
-
-+ /** Calls the passed member function of ObjType on every contained object,
-+ automatically skips all elements that are empty references. */
-+ template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3, typename ParamType4 >
-+ inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3, ParamType4 aParam4 ) const
-+ {
-+ forEach( ::boost::bind( pFunc, _1, aParam1, aParam2, aParam3, aParam4 ) );
-+ }
- /** Calls the passed functor for every contained object. Passes the index as
- first argument and the object reference as second argument to rFunctor. */
- template< typename FunctorType >
-@@ -281,6 +288,13 @@ public:
- {
- forEach( ::boost::bind( pFunc, _1, aParam1, aParam2, aParam3 ) );
- }
-+ /** Calls the passed member function of ObjType on every contained object,
-+ automatically skips all elements that are empty references. */
-+ template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3, typename ParamType4 >
-+ inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3, ParamType4 aParam4 ) const
-+ {
-+ forEach( ::boost::bind( pFunc, _1, aParam1, aParam2, aParam3, aParam4 ) );
-+ }
- /** Calls the passed functor for every contained object. Passes the key as
- first argument and the object reference as second argument to rFunctor. */
- template< typename FunctorType >
-diff --git oox/inc/oox/ole/vbamodule.hxx oox/inc/oox/ole/vbamodule.hxx
-index cef676d..c93a54f 100755
---- oox/inc/oox/ole/vbamodule.hxx
-+++ oox/inc/oox/ole/vbamodule.hxx
-@@ -30,6 +30,7 @@
-
- #include <rtl/ustring.hxx>
- #include <com/sun/star/uno/Reference.hxx>
-+#include <tools/string.hxx>
-
- namespace com { namespace sun { namespace star {
- namespace container { class XNameAccess; }
-@@ -72,13 +73,15 @@ public:
- void importSourceCode(
- StorageBase& rVbaStrg,
- const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxBasicLib,
-- const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& rxDocObjectNA ) const;
-+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& rxDocObjectNA, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxOleNameOverrides ) const;
-
- /** Creates empty document module for the passed Basic library/project. */
- void createEmptyDocModule(
- const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxBasicLib,
- const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& rxDocObjectNA ) const;
- private:
-+ void extractOleOverrideFromAttr( const String& rAttribute,
-+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxOleNameOverrides ) const;
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
- mxDocModel; /// Document model used to import/export the VBA project.
- ::rtl::OUString maName;
-diff --git oox/inc/oox/ole/vbaproject.hxx oox/inc/oox/ole/vbaproject.hxx
-index 07e94ef..6968ce0 100755
---- oox/inc/oox/ole/vbaproject.hxx
-+++ oox/inc/oox/ole/vbaproject.hxx
-@@ -98,6 +98,7 @@ public:
- /** Returns true, if the document contains the specified dialog. */
- bool hasDialog( const ::rtl::OUString& rDialogName ) const;
-
-+ void setOleOverridesSink( ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxOleOverridesSink ){ mxOleOverridesSink = rxOleOverridesSink; }
- private:
- VbaProject( const VbaProject& );
- VbaProject& operator=( const VbaProject& );
-@@ -128,6 +129,8 @@ private:
- mxBasicLib; /// The Basic library of the document used for import.
- ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
- mxDialogLib; /// The dialog library of the document used for import.
-+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
-+ mxOleOverridesSink;
- ::rtl::OUString maPrjName; /// Name of VBA project being imported
- };
-
-diff --git oox/source/ole/vbamodule.cxx oox/source/ole/vbamodule.cxx
-index 635991a..e60f6f6 100755
---- oox/source/ole/vbamodule.cxx
-+++ oox/source/ole/vbamodule.cxx
-@@ -27,6 +27,7 @@
-
- #include "oox/ole/vbamodule.hxx"
- #include <com/sun/star/container/XNameContainer.hpp>
-+#include <com/sun/star/container/XIndexContainer.hpp>
- #include <com/sun/star/script/ModuleInfo.hpp>
- #include <com/sun/star/script/ModuleType.hpp>
- #include <com/sun/star/script/vba/XVBAModuleInfo.hpp>
-@@ -35,6 +36,9 @@
- #include "oox/helper/textinputstream.hxx"
- #include "oox/ole/vbahelper.hxx"
- #include "oox/ole/vbainputstream.hxx"
-+#include <hash_map>
-+#include <cppuhelper/implbase1.hxx>
-+using namespace ::com::sun::star::lang;
-
- using ::rtl::OUString;
- using ::rtl::OUStringBuffer;
-@@ -49,6 +52,70 @@ namespace oox {
- namespace ole {
-
- // ============================================================================
-+typedef ::cppu::WeakImplHelper1< XIndexContainer > OleIdToNameContainer_BASE;
-+typedef std::hash_map< sal_Int32, rtl::OUString > ObjIdToName;
-+class OleIdToNameContainer : public OleIdToNameContainer_BASE
-+{
-+ ObjIdToName ObjIdToNameHash;
-+ ::osl::Mutex m_aMutex;
-+ bool hasByIndex( ::sal_Int32 Index )
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ return ( ObjIdToNameHash.find( Index ) != ObjIdToNameHash.end() );
-+ }
-+public:
-+ OleIdToNameContainer() {}
-+ // XIndexContainer Methods
-+ virtual void SAL_CALL insertByIndex( ::sal_Int32 Index, const Any& Element ) throw (IllegalArgumentException, IndexOutOfBoundsException, WrappedTargetException, RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ rtl::OUString sOleName;
-+ if ( !( Element >>= sOleName ) )
-+ throw IllegalArgumentException();
-+ ObjIdToNameHash[ Index ] = sOleName;
-+ }
-+ virtual void SAL_CALL removeByIndex( ::sal_Int32 Index ) throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ if ( !hasByIndex( Index ) )
-+ throw IndexOutOfBoundsException();
-+ ObjIdToNameHash.erase( ObjIdToNameHash.find( Index ) );
-+ }
-+ // XIndexReplace Methods
-+ virtual void SAL_CALL replaceByIndex( ::sal_Int32 Index, const Any& Element ) throw (IllegalArgumentException, IndexOutOfBoundsException, WrappedTargetException, RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ if ( !hasByIndex( Index ) )
-+ throw IndexOutOfBoundsException();
-+ rtl::OUString sOleName;
-+ if ( !( Element >>= sOleName ) )
-+ throw IllegalArgumentException();
-+ ObjIdToNameHash[ Index ] = sOleName;
-+ }
-+ // XIndexAccess Methods
-+ virtual ::sal_Int32 SAL_CALL getCount( ) throw (RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ return ObjIdToNameHash.size();
-+ }
-+ virtual Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ if ( !hasByIndex( Index ) )
-+ throw IndexOutOfBoundsException();
-+ return makeAny( ObjIdToNameHash[ Index ] );
-+ }
-+ // XElementAccess Methods
-+ virtual Type SAL_CALL getElementType( ) throw (RuntimeException)
-+ {
-+ return ::getCppuType((const ::rtl::OUString*)(NULL) );
-+ }
-+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ return ( getCount() > 0 );
-+ }
-+};
-
- VbaModule::VbaModule( const Reference< XModel >& rxDocModel, const OUString& rName, rtl_TextEncoding eTextEnc, bool bExecutable ) :
- mxDocModel( rxDocModel ),
-@@ -128,8 +195,35 @@ void VbaModule::importDirRecords( BinaryInputStream& rDirStrm )
- OSL_ENSURE( mnOffset < SAL_MAX_UINT32, "VbaModule::importDirRecords - missing module stream offset" );
- }
-
-+void VbaModule::extractOleOverrideFromAttr( const String& rAttributeLine,
-+ const Reference< XNameContainer >& rxOleNameOverrides ) const
-+{
-+ String rAttribute = rAttributeLine;
-+ // format of the attribute we are interested in is
-+ // Attribute VB_Control = "ControlName", intString, MSForms, ControlTypeAsString
-+ // e.g.
-+ // Attribute VB_Control = "CommandButton1, 201, 19, MSForms, CommandButton"
-+ String sControlAttribute( RTL_CONSTASCII_USTRINGPARAM("Attribute VB_Control = \"") );
-+ if ( rxOleNameOverrides.is() && rAttribute.Search( sControlAttribute ) != STRING_NOTFOUND )
-+ {
-+ String sRest = rAttribute.Copy( sControlAttribute.Len() );
-+ xub_StrLen nPos = 0;
-+ String sCntrlName = sRest.GetToken( 0, ',', nPos );
-+
-+ sal_Int32 nCntrlId = sRest.GetToken( 0, ',', nPos).ToInt32();
-+ OSL_TRACE("In module %s, assiging %d controlname %s",
-+ rtl::OUStringToOString( maName, RTL_TEXTENCODING_UTF8 ).getStr(), nCntrlId,
-+ rtl::OUStringToOString( sCntrlName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ if ( !rxOleNameOverrides->hasByName( maName ) )
-+ rxOleNameOverrides->insertByName( maName, makeAny( Reference< XIndexContainer> ( new OleIdToNameContainer() ) ) );
-+ Reference< XIndexContainer > xIdToOleName;
-+ if ( rxOleNameOverrides->getByName( maName ) >>= xIdToOleName )
-+ xIdToOleName->insertByIndex( nCntrlId, makeAny( rtl::OUString( sCntrlName ) ) );
-+ }
-+}
-+
- void VbaModule::importSourceCode( StorageBase& rVbaStrg,
-- const Reference< XNameContainer >& rxBasicLib, const Reference< XNameAccess >& rxDocObjectNA ) const
-+ const Reference< XNameContainer >& rxBasicLib, const Reference< XNameAccess >& rxDocObjectNA, const Reference< XNameContainer >& rxOleNameOverrides ) const
- {
- if( (maName.getLength() == 0) || (maStreamName.getLength() == 0) || (mnOffset == SAL_MAX_UINT32) )
- return;
-@@ -202,6 +296,8 @@ void VbaModule::importSourceCode( StorageBase& rVbaStrg,
- aSourceCode.appendAscii( RTL_CONSTASCII_STRINGPARAM( "Rem " ) );
- aSourceCode.append( aCodeLine ).append( sal_Unicode( '\n' ) );
- }
-+ else
-+ extractOleOverrideFromAttr( aCodeLine, rxOleNameOverrides );
- }
-
- // close the subroutine named after the module
-diff --git oox/source/ole/vbaproject.cxx oox/source/ole/vbaproject.cxx
-index af90e41..017790f 100755
---- oox/source/ole/vbaproject.cxx
-+++ oox/source/ole/vbaproject.cxx
-@@ -405,7 +405,7 @@ void VbaProject::importVba( StorageBase& rVbaPrjStrg, const GraphicHelper& rGrap
- aGeneratedModules.forEachMem( &VbaModule::createEmptyDocModule,
- ::boost::cref( xBasicLib ), ::boost::cref( xDocObjectNA ) );
- aModules.forEachMem( &VbaModule::importSourceCode,
-- ::boost::ref( *xVbaStrg ), ::boost::cref( xBasicLib ), ::boost::cref( xDocObjectNA ) );
-+ ::boost::ref( *xVbaStrg ), ::boost::cref( xBasicLib ), ::boost::cref( xDocObjectNA ), ::boost::cref( mxOleOverridesSink ) );
- }
- }
- catch( Exception& )
-diff --git oox/source/xls/excelfilter.cxx oox/source/xls/excelfilter.cxx
-index 3947221..548245e 100644
---- oox/source/xls/excelfilter.cxx
-+++ oox/source/xls/excelfilter.cxx
-@@ -35,6 +35,7 @@
- #include "oox/xls/workbookfragment.hxx"
- #include "oox/dump/biffdumper.hxx"
- #include "oox/dump/xlsbdumper.hxx"
-+#include <com/sun/star/container/XNameContainer.hpp>
-
- using ::rtl::OUString;
- using ::com::sun::star::uno::Any;
-@@ -42,6 +43,7 @@ using ::com::sun::star::uno::Reference;
- using ::com::sun::star::uno::Exception;
- using ::com::sun::star::uno::UNO_QUERY;
- using ::com::sun::star::uno::XInterface;
-+using ::com::sun::star::container::XNameContainer;
- using ::com::sun::star::lang::XComponent;
- using ::com::sun::star::lang::XMultiServiceFactory;
- using ::com::sun::star::xml::sax::XFastDocumentHandler;
-@@ -276,12 +278,15 @@ bool SimpleExcelVBAProjFilter::importDocument() throw()
- {
- Sequence< rtl::OUString > sGeneratedCNames;
- getArgument( CREATE_OUSTRING( "GeneratedCodeNames" ) ) >>= sGeneratedCNames;
-+ Reference< XNameContainer > xOleNameOverrideSink;
-+ getArgument( CREATE_OUSTRING( "OleNameOverrideInfo" ) ) >>= xOleNameOverrideSink;
- WorkbookHelperRoot aHelper( *this, eBiff );
- StorageRef xVbaPrjStrg = openSubStorage( CREATE_OUSTRING( "_VBA_PROJECT_CUR" ), false ) ;
- if( xVbaPrjStrg.get() && xVbaPrjStrg->isStorage() )
- {
- //VbaProject aVbaProject( getGlobalFactory(), aHelper.getDocument() );
- ole::VbaProject aVbaProject( getGlobalFactory(), Reference< com::sun::star::frame::XModel >( aHelper.getDocument(), UNO_QUERY ), CREATE_OUSTRING( "Calc" ) );
-+ aVbaProject.setOleOverridesSink( xOleNameOverrideSink );
- aVbaProject.importVbaProject( *xVbaPrjStrg, getGraphicHelper(), sGeneratedCNames );
- bRet = true;
- }
-diff --git sc/source/filter/excel/excimp8.cxx sc/source/filter/excel/excimp8.cxx
-index e300103..f4d69b5 100644
---- sc/source/filter/excel/excimp8.cxx
-+++ sc/source/filter/excel/excimp8.cxx
-@@ -116,6 +116,86 @@ using namespace com::sun::star;
- using namespace ::comphelper;
- using ::rtl::OUString;
-
-+//OleNameOverrideContainer
-+
-+typedef ::cppu::WeakImplHelper1< container::XNameContainer > OleNameOverrideContainer_BASE;
-+
-+class OleNameOverrideContainer : public OleNameOverrideContainer_BASE
-+{
-+private:
-+ typedef std::hash_map< rtl::OUString, uno::Reference< container::XIndexContainer >, ::rtl::OUStringHash,
-+ ::std::equal_to< ::rtl::OUString > > NamedIndexToOleName;
-+ NamedIndexToOleName IdToOleNameHash;
-+ ::osl::Mutex m_aMutex;
-+public:
-+ // XElementAccess
-+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) { return container::XIndexContainer::static_type(0); }
-+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ return ( IdToOleNameHash.size() > 0 );
-+ }
-+ // XNameAcess
-+ virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ if ( !hasByName(aName) )
-+ throw container::NoSuchElementException();
-+ return uno::makeAny( IdToOleNameHash[ aName ] );
-+ }
-+ virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ uno::Sequence< ::rtl::OUString > aResult( IdToOleNameHash.size() );
-+ NamedIndexToOleName::iterator it = IdToOleNameHash.begin();
-+ NamedIndexToOleName::iterator it_end = IdToOleNameHash.end();
-+ rtl::OUString* pName = aResult.getArray();
-+ for (; it != it_end; ++it, ++pName )
-+ *pName = it->first;
-+ return aResult;
-+ }
-+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ return ( IdToOleNameHash.find( aName ) != IdToOleNameHash.end() );
-+ }
-+
-+ // XElementAccess
-+ virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ return IdToOleNameHash.size();
-+ }
-+ // XNameContainer
-+ virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const uno::Any& aElement ) throw(lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ if ( hasByName( aName ) )
-+ throw container::ElementExistException();
-+ uno::Reference< container::XIndexContainer > xElement;
-+ if ( ! ( aElement >>= xElement ) )
-+ throw lang::IllegalArgumentException();
-+ IdToOleNameHash[ aName ] = xElement;
-+ }
-+ virtual void SAL_CALL removeByName( const ::rtl::OUString& aName ) throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ if ( !hasByName( aName ) )
-+ throw container::NoSuchElementException();
-+ IdToOleNameHash.erase( IdToOleNameHash.find( aName ) );
-+ }
-+ virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const uno::Any& aElement ) throw(lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ if ( !hasByName( aName ) )
-+ throw container::NoSuchElementException();
-+ uno::Reference< container::XIndexContainer > xElement;
-+ if ( ! ( aElement >>= xElement ) )
-+ throw lang::IllegalArgumentException();
-+ IdToOleNameHash[ aName ] = xElement;
-+ }
-+};
-+
- // defined in docfunc.cxx ( really this needs a new name )
- script::ModuleInfo lcl_InitModuleInfo( SfxObjectShell& rDocSh, String& sModule );
-
-@@ -259,7 +339,7 @@ void ImportExcel8::ReadBasic( void )
- try
- {
- uno::Reference< lang::XComponent > xComponent( pShell->GetModel(), uno::UNO_QUERY_THROW );
-- uno::Sequence< beans::NamedValue > aArgSeq(1);
-+ uno::Sequence< beans::NamedValue > aArgSeq(2);
- // I guess we could actually handle the GeneratedCodeNames here
- // ( e.g. after import create the required modules ) but...
- // better to reuse the code in the filter right?
-@@ -275,6 +355,10 @@ void ImportExcel8::ReadBasic( void )
- }
- aArgSeq[ 0 ].Value <<= sGeneratedCNames;
-
-+ aArgSeq[ 1 ].Name = CREATE_OUSTRING( "OleNameOverrideInfo");
-+ uno::Reference< container::XNameContainer > xOleNameOverrideSink( new OleNameOverrideContainer() );
-+ aArgSeq[ 1 ].Value <<= xOleNameOverrideSink;
-+
- uno::Sequence< uno::Any > aArgs( 2 );
- aArgs[ 0 ] <<= getProcessServiceFactory();
- aArgs[ 1 ] <<= aArgSeq;
-@@ -299,6 +383,7 @@ void ImportExcel8::ReadBasic( void )
- // call the filter
- uno::Reference< document::XFilter > xFilter( xImporter, uno::UNO_QUERY_THROW );
- xFilter->filter( aMediaDesc.getAsConstPropertyValueList() );
-+ GetObjectManager().SetOleNameOverrideInfo( xOleNameOverrideSink );
- }
- catch( uno::Exception& )
- {
-@@ -320,11 +405,6 @@ void ImportExcel8::ReadBasic( void )
- #endif
-
- }
-- // #FIXME how to get this info from oox
-- #if FIXME
-- if ( !bAsComment )
-- GetObjectManager().SetOleNameOverrideInfo( aBasicImport.ControlNameForObjectId() );
-- #endif
- }
- }
- }
-diff --git sc/source/filter/excel/xiescher.cxx sc/source/filter/excel/xiescher.cxx
-index 5ba8fe4..d31d5ad 100644
---- sc/source/filter/excel/xiescher.cxx
-+++ sc/source/filter/excel/xiescher.cxx
-@@ -3185,17 +3185,14 @@ XclImpDffConverter::~XclImpDffConverter()
-
- String XclImpObjectManager::GetOleNameOverride( SCTAB nTab, sal_uInt16 nObjId )
- {
-- String sOleName;
-+ rtl::OUString sOleName;
- String sCodeName = GetExtDocOptions().GetCodeName( nTab );
-
-- CodeNameToCntrlObjIdInfo::iterator it = maOleCtrlNameOverride.find( sCodeName );
-- if ( it != maOleCtrlNameOverride.end() )
-+ if ( mxOleCtrlNameOverride->hasByName( sCodeName ) )
- {
-- CntrlObjIdToName::iterator it_id = it->second.find( nObjId );
-- if ( it_id != it->second.end() )
-- {
-- sOleName = it_id->second;
-- }
-+ Reference< XIndexContainer > xIdToOleName;
-+ mxOleCtrlNameOverride->getByName( sCodeName ) >>= xIdToOleName;
-+ xIdToOleName->getByIndex( nObjId ) >>= sOleName;
- }
- OSL_TRACE("XclImpObjectManager::GetOleNameOverride tab %d, ( module %s ) object id ( %d ) is %s", nTab,
- rtl::OUStringToOString( sCodeName, RTL_TEXTENCODING_UTF8 ).getStr(), nObjId,
-diff --git sc/source/filter/inc/xiescher.hxx sc/source/filter/inc/xiescher.hxx
-index a5998ed..38464fa 100644
---- sc/source/filter/inc/xiescher.hxx
-+++ sc/source/filter/inc/xiescher.hxx
-@@ -1232,11 +1232,12 @@ public:
- String GetDefaultObjName( const XclImpDrawObjBase& rDrawObj ) const;
- /** Returns the used area in the sheet with the passed index. */
- ScRange GetUsedArea( SCTAB nScTab ) const;
-- void SetOleNameOverrideInfo( const CodeNameToCntrlObjIdInfo& rOverrideInfo ) { maOleCtrlNameOverride = rOverrideInfo; }
-+ void SetOleNameOverrideInfo( const com::sun::star::uno::Reference< com::sun::star::container::XNameContainer >& rxOverrideInfo ) { mxOleCtrlNameOverride = rxOverrideInfo; }
- String GetOleNameOverride( SCTAB nTab, sal_uInt16 nObjId );
- // ------------------------------------------------------------------------
- private:
-
-+ com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > mxOleCtrlNameOverride;
- CodeNameToCntrlObjIdInfo maOleCtrlNameOverride;
-
- /** Reads and returns a bitmap from WMF/PICT format. */
diff --git a/patches/vba/vba-override-base-vbaevents.diff b/patches/vba/vba-override-base-vbaevents.diff
deleted file mode 100644
index 433132507..000000000
--- a/patches/vba/vba-override-base-vbaevents.diff
+++ /dev/null
@@ -1,198 +0,0 @@
-diff --git basic/source/classes/sbxmod.cxx basic/source/classes/sbxmod.cxx
-index d22d117..4f6ae25 100644
---- basic/source/classes/sbxmod.cxx
-+++ basic/source/classes/sbxmod.cxx
-@@ -2485,7 +2485,10 @@ void SbUserFormModule::Unload()
- triggerMethod( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Userform_QueryClose") ), aParams);
-
- aParams[0] >>= nCancel;
-- if (nCancel == 1)
-+ // basic boolean ( and what the user might use ) can be ambiguous ( e.g. basic true = -1 )
-+ // test agains 0 ( false ) and assume anything else is true
-+ // ( Note: ) this used to work ( something changes somewhere )
-+ if (nCancel != 0)
- {
- return;
- }
-diff --git sc/source/ui/unoobj/viewuno.cxx sc/source/ui/unoobj/viewuno.cxx
-index a08c2a6..442673f 100644
---- sc/source/ui/unoobj/viewuno.cxx
-+++ sc/source/ui/unoobj/viewuno.cxx
-@@ -460,6 +460,95 @@ void SAL_CALL ScViewPaneObj::release() throw()
- OWeakObject::release();
- }
-
-+// To process sheet compatibile event
-+typedef ::cppu::WeakImplHelper2< awt::XEnhancedMouseClickHandler, view::XSelectionChangeListener > TabViewEventListener_BASE;
-+class ScTabViewEventListener: public TabViewEventListener_BASE
-+{
-+private:
-+ ScTabViewObj* pViewObj;
-+ uno::Reference< script::vba::XVBAEventProcessor > xVbaEventsHelper;
-+ sal_Bool bDelaySelectionEvent;
-+ sal_Bool bSelectionChangeOccured;
-+
-+ void fireSelectionChangeEvent();
-+
-+public:
-+ ScTabViewEventListener( ScTabViewObj* pObj, uno::Reference< script::vba::XVBAEventProcessor >& rVbaEventsHelper);
-+ ~ScTabViewEventListener();
-+ // XEnhancedMouseClickHandler
-+ virtual sal_Bool SAL_CALL mousePressed( const awt::EnhancedMouseEvent& e ) throw (uno::RuntimeException);
-+ virtual sal_Bool SAL_CALL mouseReleased( const awt::EnhancedMouseEvent& e ) throw (uno::RuntimeException);
-+
-+ // XSelectionChangeListener
-+ virtual void SAL_CALL selectionChanged( const lang::EventObject& aEvent ) throw ( uno::RuntimeException );
-+ // XEventListener
-+ virtual void SAL_CALL disposing( const lang::EventObject& aEvent ) throw ( uno::RuntimeException );
-+};
-+
-+ScTabViewEventListener::ScTabViewEventListener(ScTabViewObj* pObj, uno::Reference< script::vba::XVBAEventProcessor >& rVbaEventsHelper):
-+ pViewObj( pObj ),xVbaEventsHelper( rVbaEventsHelper ), bDelaySelectionEvent( sal_False ), bSelectionChangeOccured( sal_False )
-+{
-+}
-+
-+ScTabViewEventListener::~ScTabViewEventListener()
-+{
-+}
-+
-+void SAL_CALL ScTabViewEventListener::disposing( const lang::EventObject& /*aEvent*/ ) throw ( uno::RuntimeException )
-+{
-+}
-+
-+void ScTabViewEventListener::fireSelectionChangeEvent()
-+{
-+ if ( xVbaEventsHelper.is() && pViewObj )
-+ {
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] = pViewObj->getSelection();
-+ try
-+ {
-+ xVbaEventsHelper->processVbaEvent( script::vba::VBAEventId::WORKSHEET_SELECTIONCHANGE, aArgs );
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+ }
-+ bDelaySelectionEvent = sal_False;
-+ bSelectionChangeOccured = sal_False;
-+}
-+
-+sal_Bool SAL_CALL ScTabViewEventListener::mousePressed( const awt::EnhancedMouseEvent& e ) throw (uno::RuntimeException)
-+{
-+ // Delay to fire the selection change event if clicking the left mouse button to do selection.
-+ bDelaySelectionEvent = ( e.Buttons == ::com::sun::star::awt::MouseButton::RIGHT ) ? sal_False : sal_True;
-+ bSelectionChangeOccured = sal_False;
-+
-+ sal_Bool result = sal_False;
-+
-+ // ScTabViewObj::MousePressed should handle process BeforeDoubleClick and BeforeRightClick events
-+ return sal_True;
-+}
-+
-+sal_Bool SAL_CALL ScTabViewEventListener::mouseReleased( const awt::EnhancedMouseEvent&/*e*/) throw (uno::RuntimeException)
-+{
-+ if ( bSelectionChangeOccured )
-+ {
-+ fireSelectionChangeEvent();
-+ }
-+ return sal_True;
-+}
-+
-+void SAL_CALL ScTabViewEventListener::selectionChanged( const lang::EventObject& /*aEvent*/ ) throw ( uno::RuntimeException )
-+{
-+ if ( !bDelaySelectionEvent )
-+ {
-+ fireSelectionChangeEvent();
-+ }
-+ else
-+ {
-+ bSelectionChangeOccured = sal_True;
-+ }
-+}
-+
- //------------------------------------------------------------------------
-
- // Default-ctor wird fuer SMART_REFLECTION_IMPLEMENTATION gebraucht
-@@ -485,7 +596,22 @@ ScTabViewObj::ScTabViewObj( ScTabViewShell* pViewSh ) :
- bDrawSelModeSet(sal_False)
- {
- if (pViewSh)
-+ {
- nPreviousTab = pViewSh->GetViewData()->GetTabNo();
-+ ScViewData* pViewData = pViewSh->GetViewData();
-+ if( pViewData )
-+ {
-+ uno::Reference< script::vba::XVBAEventProcessor > xVbaEventsHelper (pViewData->GetDocument()->GetVbaEventProcessor(), uno::UNO_QUERY );
-+ if ( xVbaEventsHelper.is() )
-+ {
-+ ScTabViewEventListener* pEventListener = new ScTabViewEventListener( this, xVbaEventsHelper );
-+ uno::Reference< awt::XEnhancedMouseClickHandler > aMouseClickHandler( *pEventListener, uno::UNO_QUERY );
-+ addEnhancedMouseClickHandler( aMouseClickHandler );
-+ uno::Reference< view::XSelectionChangeListener > aSelectionChangeListener( *pEventListener, uno::UNO_QUERY );
-+ addSelectionChangeListener( aSelectionChangeListener );
-+ }
-+ }
-+ }
- }
-
- ScTabViewObj::~ScTabViewObj()
-@@ -1858,19 +1981,7 @@ void ScTabViewObj::SelectionChanged()
- /*ErrCode eRet =*/ pDocSh->CallXScript( *pScript, aParams, aRet, aOutArgsIndex, aOutArgs );
- }
- }
--
-- // execute VBA event handler
-- try
-- {
-- uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents( pDoc->GetVbaEventProcessor(), uno::UNO_SET_THROW );
-- // the parameter is the clicked object, as in the mousePressed call above
-- uno::Sequence< uno::Any > aArgs( 1 );
-- aArgs[ 0 ] <<= getSelection();
-- xVbaEvents->processVbaEvent( ScSheetEvents::GetVbaSheetEventId( SC_SHEETEVENT_SELECT ), aArgs );
-- }
-- catch( uno::Exception& )
-- {
-- }
-+ // Removed Sun/Oracle code intentionally, it doesn't work properly ( selection should be fired after mouse release )
- }
-
-
-diff --git sc/source/ui/vba/vbaeventshelper.cxx sc/source/ui/vba/vbaeventshelper.cxx
-index bd71c9e..c50e613 100755
---- sc/source/ui/vba/vbaeventshelper.cxx
-+++ sc/source/ui/vba/vbaeventshelper.cxx
-@@ -372,7 +372,15 @@ void ScVbaEventsListener::processWindowResizeMacro()
- {
- OSL_TRACE( "**** Attempt to FIRE MACRO **** " );
- if( !mbDisposed )
-- mrVbaEvents.processVbaEvent( WORKBOOK_WINDOWRESIZE, uno::Sequence< uno::Any >() );
-+ {
-+ try
-+ {
-+ mrVbaEvents.processVbaEvent( WORKBOOK_WINDOWRESIZE, uno::Sequence< uno::Any >() );
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+ }
- }
-
- // ============================================================================
-diff --git vcl/source/window/dialog.cxx vcl/source/window/dialog.cxx
-index 1e493ce..901c934 100644
---- vcl/source/window/dialog.cxx
-+++ vcl/source/window/dialog.cxx
-@@ -562,7 +562,11 @@ BOOL Dialog::Close()
- //liuchen 2009-7-22, support Excel VBA UserForm_QueryClose event
- mnCancelClose = 0;
- ImplCallEventListeners( VCLEVENT_WINDOW_CLOSE );
-- if (mnCancelClose == 1)
-+ // basic boolean ( and what the user might use in the event handler) can
-+ // be ambiguous ( e.g. basic true = -1 )
-+ // test agains 0 ( false ) and assume anything else is true
-+ // ( Note: ) this used to work ( something changes somewhere )
-+ if (mnCancelClose != 0)
- {
- return FALSE;
- }
diff --git a/patches/vba/vba-parallel-build.diff b/patches/vba/vba-parallel-build.diff
deleted file mode 100644
index 08df966a6..000000000
--- a/patches/vba/vba-parallel-build.diff
+++ /dev/null
@@ -1,79 +0,0 @@
---- basic/source/classes/makefile.mk 2007-03-01 16:50:05.000000000 +0100
-+++ basic/source/classes/makefile.mk 2007-03-01 16:50:39.000000000 +0100
-@@ -53,10 +53,6 @@ ALLTAR : \
- $(MISC)$/$(TARGET).don \
- $(SLOTARGET)
-
--$(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb
-- +$(CPPUMAKER) -O$(OUT)$/inc -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@
-- echo $@
--
- # --- Allgemein -----------------------------------------------------------
-
- COMMON_SLOFILES= \
-@@ -85,3 +81,9 @@ LIB1OBJFILES = $(SLOFILES)
-
- .INCLUDE : target.mk
-
-+$(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb
-+ +$(CPPUMAKER) -O$(OUT)$/inc -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@
-+ echo $@
-+
-+$(OBJFILES) : $(MISC)$/$(TARGET).don
-+
---- sc/source/ui/vba/makefile.mk 2007-03-01 14:51:01.000000000 +0100
-+++ sc/source/ui/vba/makefile.mk 2007-03-01 15:24:47.000000000 +0100
-@@ -1,6 +1,6 @@
--PRJ=../..$/..
-+PRJ=..$/..$/..
-
--PRJNAME=
-+PRJNAME=sc
- TARGET=vbaobj
- .IF "$(ENABLE_VBA)"!="YES"
- dummy:
-@@ -21,10 +21,6 @@ ALLTAR : \
- $(MISC)$/$(TARGET).don \
- $(SLOTARGET)
-
--$(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb
-- +$(CPPUMAKER) -O$(OUT)$/inc -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@
-- echo $@
--
- # ------------------------------------------------------------------
-
- SLOFILES= \
-@@ -65,3 +61,10 @@ SLOFILES= \
- # --- Targets ------------------------------------------------------
-
- .INCLUDE : target.mk
-+
-+$(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb
-+ +$(CPPUMAKER) -O$(OUT)$/inc -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@
-+ echo $@
-+
-+$(OBJFILES) : $(MISC)$/$(TARGET).don
-+
---- scripting/source/vbaevents/makefile.mk 2007-03-01 16:54:36.000000000 +0100
-+++ scripting/source/vbaevents/makefile.mk 2007-03-01 16:56:15.000000000 +0100
-@@ -24,9 +24,6 @@ ALLTAR : \
- $(MISC)$/$(TARGET).don \
- $(SLOTARGET)
-
--$(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb
-- +$(CPPUMAKER) -O$(OUT)$/inc -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@
-- echo $@
- # ------------------------------------------------------------------
-
- #.INCLUDE : ..$/cppumaker.mk
-@@ -57,3 +54,10 @@ SHL1LIBS=$(SLB)$/$(TARGET).lib
- # --- Targets ------------------------------------------------------
-
- .INCLUDE : target.mk
-+
-+$(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb
-+ +$(CPPUMAKER) -O$(OUT)$/inc -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@
-+ echo $@
-+
-+$(OBJFILES) : $(MISC)$/$(TARGET).don
-+
diff --git a/patches/vba/vba-rangecell-colparam.diff b/patches/vba/vba-rangecell-colparam.diff
deleted file mode 100644
index 3f2a23e5d..000000000
--- a/patches/vba/vba-rangecell-colparam.diff
+++ /dev/null
@@ -1,75 +0,0 @@
-diff --git sc/source/ui/vba/vbarange.cxx sc/source/ui/vba/vbarange.cxx
-index e67766e..aa7e0bc 100755
---- sc/source/ui/vba/vbarange.cxx
-+++ sc/source/ui/vba/vbarange.cxx
-@@ -2185,7 +2185,7 @@ ScVbaRange::Cells( const uno::Any &nRowIndex, const uno::Any &nColumnIndex ) thr
- }
- catch( uno::Exception& ) {}
- }
-- if ( aRowIndexAny.hasValue() && !( aRowIndexAny >>= nRow ) )
-+ else if ( aRowIndexAny.hasValue() && !( aRowIndexAny >>= nRow ) )
- {
- uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( mxContext );
- uno::Any aConverted;
-@@ -2196,27 +2196,45 @@ ScVbaRange::Cells( const uno::Any &nRowIndex, const uno::Any &nColumnIndex ) thr
- }
- catch( uno::Exception& ) {} // silence any errors
- }
-+
- uno::Any aColumnAny = nColumnIndex;
-- if ( aColumnAny.getValueTypeClass() == uno::TypeClass_INTERFACE )
-- {
-- try
-- {
-- aColumnAny = getDefaultPropByIntrospection( aColumnAny );
-- }
-- catch( uno::Exception& ) {}
-- }
-- if ( bIsColumnIndex && !( aColumnAny >>= nColumn ) )
-+
-+ if ( bIsColumnIndex )
- {
-- uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( mxContext );
-- uno::Any aConverted;
-- try
-+ // Column index can be a col address e.g Cells( 1, "B" ) etc.
-+ rtl::OUString sCol;
-+ if ( nColumnIndex >>= sCol )
- {
-- aConverted = xConverter->convertTo( aColumnAny, getCppuType((sal_Int32*)0) );
-- bIsColumnIndex = ( aConverted >>= nColumn );
-+ ScAddress::Details dDetails( formula::FormulaGrammar::CONV_XL_A1, 0, 0 );
-+ ScRange tmpRange;
-+ USHORT flags = tmpRange.ParseCols( sCol, excel::GetDocumentFromRange( mxRange ), dDetails );
-+ if ( ( flags & 0x200 ) != 0x200 )
-+ throw uno::RuntimeException();
-+ nColumn = tmpRange.aStart.Col() + 1;
- }
-- catch( uno::Exception& ) {} // silence any errors
-+ else
-+ {
-+ if ( aColumnAny.getValueTypeClass() == uno::TypeClass_INTERFACE )
-+ {
-+ try
-+ {
-+ aColumnAny = getDefaultPropByIntrospection( aColumnAny );
-+ }
-+ catch( uno::Exception& ) {}
-+ }
-+ if ( !( aColumnAny >>= nColumn ) )
-+ {
-+ uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( mxContext );
-+ uno::Any aConverted;
-+ try
-+ {
-+ aConverted = xConverter->convertTo( aColumnAny, getCppuType((sal_Int32*)0) );
-+ bIsColumnIndex = ( aConverted >>= nColumn );
-+ }
-+ catch( uno::Exception& ) {} // silence any errors
-+ }
-+ }
- }
--
- RangeHelper thisRange( mxRange );
- table::CellRangeAddress thisRangeAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
- uno::Reference< table::XCellRange > xSheetRange = thisRange.getCellRangeFromSheet();
diff --git a/patches/vba/vba-redim-array-fix.diff b/patches/vba/vba-redim-array-fix.diff
deleted file mode 100644
index 7bbd6a47d..000000000
--- a/patches/vba/vba-redim-array-fix.diff
+++ /dev/null
@@ -1,92 +0,0 @@
-diff --git basic/source/inc/runtime.hxx basic/source/inc/runtime.hxx
-index 5a1bff2..6384306 100644
---- basic/source/inc/runtime.hxx
-+++ basic/source/inc/runtime.hxx
-@@ -315,6 +315,7 @@ class SbiRuntime
- SbxArrayRef refExprStk; // expression stack
- SbxArrayRef refCaseStk; // CASE expression stack
- SbxArrayRef refRedimpArray; // Array saved to use for REDIM PRESERVE
-+ SbxVariableRef refRedim; // Array saved to use for REDIM
- SbxVariableRef xDummyVar; // Ersatz fuer nicht gefundene Variablen
- SbxVariable* mpExtCaller; // Caller ( external - e.g. button name, shape, range object etc. - only in vba mode )
- SbiArgvStack* pArgvStk; // ARGV-Stack
-diff --git basic/source/runtime/step0.cxx basic/source/runtime/step0.cxx
-index a2df718..fa66194 100644
---- basic/source/runtime/step0.cxx
-+++ basic/source/runtime/step0.cxx
-@@ -48,6 +48,11 @@
-
- #include <algorithm>
-
-+// for a patch forward declaring these methods below makes sense
-+// but, #FIXME lets really just move the methods to the top
-+void lcl_clearImpl( SbxVariableRef& refVar, SbxDataType& eType );
-+void lcl_eraseImpl( SbxVariableRef& refVar, bool bVBAEnabled );
-+
- SbxVariable* getDefaultProp( SbxVariable* pRef );
-
- void SbiRuntime::StepNOP()
-@@ -637,6 +642,17 @@ void SbiRuntime::StepDIM()
- // #56204 DIM-Funktionalitaet in Hilfsmethode auslagern (step0.cxx)
- void SbiRuntime::DimImpl( SbxVariableRef refVar )
- {
-+ // If refDim then this DIM statement is terminating a ReDIM and
-+ // previous StepERASE_CLEAR for an array, the following actions have
-+ // been delayed from ( StepERASE_CLEAR ) 'till here
-+ if ( refRedim )
-+ {
-+ if ( !refRedimpArray ) // only erase the array not ReDim Preserve
-+ lcl_eraseImpl( refVar, bVBAEnabled );
-+ SbxDataType eType = refVar->GetType();
-+ lcl_clearImpl( refVar, eType );
-+ refRedim = NULL;
-+ }
- SbxArray* pDims = refVar->GetParameters();
- // Muss eine gerade Anzahl Argumente haben
- // Man denke daran, dass Arg[0] nicht zaehlt!
-@@ -802,6 +818,7 @@ void SbiRuntime::StepREDIMP()
- void SbiRuntime::StepREDIMP_ERASE()
- {
- SbxVariableRef refVar = PopVar();
-+ refRedim = refVar;
- SbxDataType eType = refVar->GetType();
- if( eType & SbxARRAY )
- {
-@@ -812,12 +829,6 @@ void SbiRuntime::StepREDIMP_ERASE()
- refRedimpArray = pDimArray;
- }
-
-- // As in ERASE
-- USHORT nSavFlags = refVar->GetFlags();
-- refVar->ResetFlag( SBX_FIXED );
-- refVar->SetType( SbxDataType(eType & 0x0FFF) );
-- refVar->SetFlags( nSavFlags );
-- refVar->Clear();
- }
- else
- if( refVar->IsFixed() )
-@@ -890,10 +901,7 @@ void SbiRuntime::StepERASE()
-
- void SbiRuntime::StepERASE_CLEAR()
- {
-- SbxVariableRef refVar = PopVar();
-- lcl_eraseImpl( refVar, bVBAEnabled );
-- SbxDataType eType = refVar->GetType();
-- lcl_clearImpl( refVar, eType );
-+ refRedim = PopVar();
- }
-
- void SbiRuntime::StepARRAYACCESS()
-diff --git basic/source/runtime/step2.cxx basic/source/runtime/step2.cxx
-index 5606274..8e82cbf 100644
---- basic/source/runtime/step2.cxx
-+++ basic/source/runtime/step2.cxx
-@@ -458,7 +458,7 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
- {
- // Falls wir ein Array haben, wollen wir bitte das Array-Element!
- SbxArray* pPar;
-- if( pElem->GetType() & SbxARRAY )
-+ if( ( pElem->GetType() & SbxARRAY ) && (SbxVariable*)refRedim != pElem )
- {
- SbxBase* pElemObj = pElem->GetObject();
- SbxDimArray* pDimArray = PTR_CAST(SbxDimArray,pElemObj);
diff --git a/patches/vba/vba-reenable-cwssheetproctectbits.diff b/patches/vba/vba-reenable-cwssheetproctectbits.diff
deleted file mode 100644
index 4ef5cbffa..000000000
--- a/patches/vba/vba-reenable-cwssheetproctectbits.diff
+++ /dev/null
@@ -1,35 +0,0 @@
-diff --git sc/source/ui/vba/vbaworksheet.cxx sc/source/ui/vba/vbaworksheet.cxx
-index 3a38bd3..5584cab 100644
---- sc/source/ui/vba/vbaworksheet.cxx
-+++ sc/source/ui/vba/vbaworksheet.cxx
-@@ -77,9 +77,7 @@
-
- #include "cellsuno.hxx"
- #include "drwlayer.hxx"
--#ifdef CWSSCSHEETPROTECTION
- #include "tabprotection.hxx"
--#endif
- #include "scextopt.hxx"
- #include "vbaoutline.hxx"
- #include "vbarange.hxx"
-@@ -411,7 +409,6 @@ ScVbaWorksheet::getProtectContents()throw (uno::RuntimeException)
- sal_Bool
- ScVbaWorksheet::getProtectDrawingObjects() throw (uno::RuntimeException)
- {
--#ifdef CWSSCSHEETPROTECTION
- SCTAB nTab = 0;
- rtl::OUString aSheetName = getName();
- uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( getModel(), uno::UNO_QUERY_THROW );
-@@ -422,11 +419,8 @@ ScVbaWorksheet::getProtectDrawingObjects() throw (uno::RuntimeException)
- ScDocument* pDoc = excel::getDocShell( xModel )->GetDocument();
- ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
- if ( pProtect )
-- return pProtect->getOption( ScTableProtection::OBJECTS );
-+ return pProtect->isOptionEnabled( ScTableProtection::OBJECTS );
- }
--#else
-- return getProtectContents(); // fallback
--#endif
- return false;
- }
-
diff --git a/patches/vba/vba-reenable-rowsourcefixes.diff b/patches/vba/vba-reenable-rowsourcefixes.diff
deleted file mode 100644
index abd8ee896..000000000
--- a/patches/vba/vba-reenable-rowsourcefixes.diff
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git vbahelper/source/msforms/makefile.mk vbahelper/source/msforms/makefile.mk
-index ad5e7b4..9bde7db 100644
---- vbahelper/source/msforms/makefile.mk
-+++ vbahelper/source/msforms/makefile.mk
-@@ -39,6 +39,8 @@ ENABLE_EXCEPTIONS := TRUE
-
- .INCLUDE : settings.mk
-
-+CDEFS+=-DVBA_OOBUILD_HACK
-+
- SLOFILES=\
- $(SLO)$/vbacontrol.obj \
- $(SLO)$/vbacontrols.obj \
diff --git a/patches/vba/vba-reset-screenupdateing.diff b/patches/vba/vba-reset-screenupdateing.diff
deleted file mode 100644
index 3b0a609b8..000000000
--- a/patches/vba/vba-reset-screenupdateing.diff
+++ /dev/null
@@ -1,69 +0,0 @@
-diff --git basic/source/classes/.sbxmod.cxx.swp basic/source/classes/.sbxmod.cxx.swp
-deleted file mode 100644
-index cf9f771..0000000
-Binary files basic/source/classes/.sbxmod.cxx.swp and /dev/null differ
-diff --git basic/source/classes/sbxmod.cxx basic/source/classes/sbxmod.cxx
-index cf5b5a5..7e42498 100644
---- basic/source/classes/sbxmod.cxx
-+++ basic/source/classes/sbxmod.cxx
-@@ -98,7 +98,31 @@ SV_IMPL_VARARR(SbiBreakpoints,USHORT)
-
- SV_IMPL_VARARR(HighlightPortions, HighlightPortion)
-
--
-+bool UnlockControllerHack( StarBASIC* pBasic )
-+{
-+ bool bRes = false;
-+ if ( pBasic && pBasic->IsDocBasic() )
-+ {
-+ uno::Any aUnoVar;
-+ ::rtl::OUString sVarName( ::rtl::OUString::createFromAscii( "ThisComponent" ) );
-+ SbUnoObject* pGlobs = dynamic_cast<SbUnoObject*>( pBasic->Find( sVarName, SbxCLASS_DONTCARE ) );
-+ if ( pGlobs )
-+ aUnoVar = pGlobs->getUnoAny();
-+ uno::Reference< frame::XModel > xModel( aUnoVar, uno::UNO_QUERY);
-+ if ( xModel.is() )
-+ {
-+ try
-+ {
-+ xModel->unlockControllers();
-+ bRes = true;
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+ }
-+ }
-+ return bRes;
-+}
- /////////////////////////////////////////////////////////////////////////////
-
- // Ein BASIC-Modul hat EXTSEARCH gesetzt, damit die im Modul enthaltenen
-@@ -750,6 +774,15 @@ USHORT SbModule::Run( SbMethod* pMeth )
-
- delete pRt;
- pMOD = pOldMod;
-+ if ( pINST->nCallLvl == 0 && IsVBACompat() )
-+ {
-+ // VBA always ensure screenupdating is enabled after completing
-+ StarBASIC* pBasic = PTR_CAST(StarBASIC,GetParent());
-+ if ( pBasic && pBasic->IsDocBasic() )
-+ {
-+ UnlockControllerHack( pBasic );
-+ }
-+ }
- if( bDelInst )
- {
- // #57841 Uno-Objekte, die in RTL-Funktionen gehalten werden,
-@@ -774,6 +807,11 @@ USHORT SbModule::Run( SbMethod* pMeth )
- pINST->nCallLvl--; // Call-Level wieder runter
- StarBASIC::FatalError( SbERR_STACK_OVERFLOW );
- }
-+
-+ // VBA always ensure screenupdating is enabled after completing
-+ StarBASIC* pBasic = PTR_CAST(StarBASIC,GetParent());
-+ if ( pBasic && pBasic->IsDocBasic() && !pINST )
-+ UnlockControllerHack( pBasic );
- if( bDelInst )
- {
- // #57841 Uno-Objekte, die in RTL-Funktionen gehalten werden,
diff --git a/patches/vba/vba-servicemacros-rework.diff b/patches/vba/vba-servicemacros-rework.diff
deleted file mode 100644
index 7059edbb1..000000000
--- a/patches/vba/vba-servicemacros-rework.diff
+++ /dev/null
@@ -1,251 +0,0 @@
-diff --git comphelper/inc/comphelper/servicedecl.hxx comphelper/inc/comphelper/servicedecl.hxx
-index bbfb1c8..bd114be 100644
---- comphelper/inc/comphelper/servicedecl.hxx
-+++ comphelper/inc/comphelper/servicedecl.hxx
-@@ -169,21 +169,20 @@ template <bool> struct with_args;
-
- /// @internal
- namespace detail {
--
- template <typename ImplT>
--class ServiceImpl
-- : public ::cppu::ImplInheritanceHelper1<ImplT, css::lang::XServiceInfo>,
-+class OwnServiceImpl
-+ : public ImplT,
- private ::boost::noncopyable
- {
-- typedef ::cppu::ImplInheritanceHelper1<ImplT,css::lang::XServiceInfo> BaseT;
-+ typedef ImplT BaseT;
-
- public:
-- ServiceImpl(
-+ OwnServiceImpl(
- ServiceDecl const& rServiceDecl,
- css::uno::Sequence<css::uno::Any> const& args,
- css::uno::Reference<css::uno::XComponentContext> const& xContext )
-- : BaseT(args, xContext), m_rServiceDecl(rServiceDecl) {}
-- ServiceImpl(
-+ :BaseT(args, xContext), m_rServiceDecl(rServiceDecl) {}
-+ OwnServiceImpl(
- ServiceDecl const& rServiceDecl,
- css::uno::Reference<css::uno::XComponentContext> const& xContext )
- : BaseT(xContext), m_rServiceDecl(rServiceDecl) {}
-@@ -206,6 +205,22 @@ private:
- ServiceDecl const& m_rServiceDecl;
- };
-
-+template <typename ImplT>
-+class ServiceImpl : public OwnServiceImpl< ::cppu::ImplInheritanceHelper1<ImplT,css::lang::XServiceInfo> >
-+{
-+typedef OwnServiceImpl< ::cppu::ImplInheritanceHelper1<ImplT,css::lang::XServiceInfo> > ServiceImpl_BASE;
-+public:
-+ ServiceImpl(
-+ ServiceDecl const& rServiceDecl,
-+ css::uno::Sequence<css::uno::Any> const& args,
-+ css::uno::Reference<css::uno::XComponentContext> const& xContext )
-+ : ServiceImpl_BASE(rServiceDecl, args, xContext) {}
-+ ServiceImpl(
-+ ServiceDecl const& rServiceDecl,
-+ css::uno::Reference<css::uno::XComponentContext> const& xContext )
-+ : ServiceImpl_BASE(rServiceDecl, xContext) {}
-+};
-+
- template <typename ServiceImplT>
- struct PostProcessDefault {
- css::uno::Reference<css::uno::XInterface>
-@@ -230,7 +245,7 @@ struct CreateFunc<ImplT, PostProcessFuncT, with_args<false> > {
- const& xContext ) const
- {
- return m_postProcessFunc(
-- new ServiceImpl<ImplT>( rServiceDecl, xContext ) );
-+ new ImplT( rServiceDecl, xContext ) );
- }
- };
-
-@@ -247,7 +262,7 @@ struct CreateFunc<ImplT, PostProcessFuncT, with_args<true> > {
- const& xContext ) const
- {
- return m_postProcessFunc(
-- new ServiceImpl<ImplT>( rServiceDecl, args, xContext ) );
-+ new ImplT( rServiceDecl, args, xContext ) );
- }
- };
-
-@@ -261,18 +276,17 @@ struct CreateFunc<ImplT, PostProcessFuncT, with_args<true> > {
- or just (uno::Reference<uno::XComponentContext>)
- */
- template <typename ImplT_, typename WithArgsT = with_args<false> >
--struct class_ {
-+struct serviceimpl_base {
- typedef ImplT_ ImplT;
-- typedef detail::ServiceImpl<ImplT_> ServiceImplT;
-
- detail::CreateFuncF const m_createFunc;
-
-- typedef detail::PostProcessDefault<ServiceImplT> PostProcessDefaultT;
-+ typedef detail::PostProcessDefault<ImplT> PostProcessDefaultT;
-
- /** Default ctor. Implementation class without args, expecting
- component context as single argument.
- */
-- class_() : m_createFunc(
-+ serviceimpl_base() : m_createFunc(
- detail::CreateFunc<ImplT, PostProcessDefaultT, WithArgsT>(
- PostProcessDefaultT() ) ) {}
-
-@@ -284,11 +298,29 @@ struct class_ {
- uno::Reference<uno::XInterface>
- */
- template <typename PostProcessFuncT>
-- explicit class_( PostProcessFuncT const& postProcessFunc )
-+ explicit serviceimpl_base( PostProcessFuncT const& postProcessFunc )
- : m_createFunc( detail::CreateFunc<ImplT, PostProcessFuncT, WithArgsT>(
- postProcessFunc ) ) {}
- };
-
-+template <typename ImplT_, typename WithArgsT = with_args<false> >
-+struct class_ : public serviceimpl_base< detail::ServiceImpl<ImplT_>, WithArgsT >
-+{
-+ typedef serviceimpl_base< detail::ServiceImpl<ImplT_>, WithArgsT > baseT;
-+ /** Default ctor. Implementation class without args, expecting
-+ component context as single argument.
-+ */
-+ class_() : baseT() {}
-+ template <typename PostProcessFuncT>
-+ /** 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<uno::XInterface>
-+ */
-+ explicit class_( PostProcessFuncT const& postProcessFunc ) : baseT( postProcessFunc ) {}
-+};
-
- //
- // component_... helpers with arbitrary service declarations:
-diff --git sc/source/ui/vba/helperdecl.hxx sc/source/ui/vba/helperdecl.hxx
-index 1581e66..c3c1007 100644
---- sc/source/ui/vba/helperdecl.hxx
-+++ sc/source/ui/vba/helperdecl.hxx
-@@ -32,107 +32,25 @@
-
- namespace comphelper {
- namespace service_decl {
--
--namespace detail {
--namespace css = ::com::sun::star;
--template <typename ImplT>
--class OwnServiceImpl
-- : public ImplT,
-- private ::boost::noncopyable
--{
-- typedef ImplT BaseT;
--
--public:
-- OwnServiceImpl(
-- ServiceDecl const& rServiceDecl,
-- css::uno::Sequence<css::uno::Any> const& args,
-- css::uno::Reference<css::uno::XComponentContext> const& xContext )
-- :BaseT(args, xContext), m_rServiceDecl(rServiceDecl) {}
-- OwnServiceImpl(
-- ServiceDecl const& rServiceDecl,
-- css::uno::Reference<css::uno::XComponentContext> 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 <typename ImplT, typename WithArgsT>
--struct OwnCreateFunc;
--
--template <typename ImplT>
--struct OwnCreateFunc<ImplT, with_args<false> > {
-- explicit OwnCreateFunc( )
-- {}
--
-- css::uno::Reference<css::uno::XInterface>
-- operator()( ServiceDecl const& rServiceDecl,
-- css::uno::Sequence<css::uno::Any> const&,
-- css::uno::Reference<css::uno::XComponentContext>
-- const& xContext ) const
-- {
-- return css::uno::Reference< ooo::vba::XHelperInterface >(new OwnServiceImpl<ImplT>( rServiceDecl, xContext ));
-- }
--};
--
--template <typename ImplT>
--struct OwnCreateFunc<ImplT, with_args<true> > {
-- explicit OwnCreateFunc( )
-- {}
--
-- css::uno::Reference<css::uno::XInterface>
-- operator()( ServiceDecl const& rServiceDecl,
-- css::uno::Sequence<css::uno::Any> const& args,
-- css::uno::Reference<css::uno::XComponentContext>
-- const& xContext ) const
-- {
-- css::uno::Reference< ooo::vba::XHelperInterface > xHelp(
-- new OwnServiceImpl<ImplT>( 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::Any>, uno::Reference<uno::XComponentContext>)
-- or just (uno::Reference<uno::XComponentContext>)
--*/
- template <typename ImplT_, typename WithArgsT = with_args<false> >
--struct vba_service_class_ {
-- typedef ImplT_ ImplT;
-- typedef detail::OwnServiceImpl<ImplT_ > ServiceImplT;
--
-- detail::CreateFuncF const m_createFunc;
--
-+struct vba_service_class_ : public serviceimpl_base< detail::OwnServiceImpl<ImplT_>, WithArgsT >
-+{
-+ typedef serviceimpl_base< detail::OwnServiceImpl<ImplT_>, WithArgsT > baseT;
- /** Default ctor. Implementation class without args, expecting
- component context as single argument.
- */
-- vba_service_class_() : m_createFunc(
-- detail::OwnCreateFunc<ImplT, WithArgsT>() ) {}
--
-+ vba_service_class_() : baseT() {}
-+ template <typename PostProcessFuncT>
-+ /** 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<uno::XInterface>
-+ */
-+ explicit vba_service_class_( PostProcessFuncT const& postProcessFunc ) : baseT( postProcessFunc ) {}
- };
-
--
- } // namespace service_decl
- } // namespace comphelper
-
diff --git a/patches/vba/vba-show-data-form-link-fix.diff b/patches/vba/vba-show-data-form-link-fix.diff
deleted file mode 100644
index 8608717a4..000000000
--- a/patches/vba/vba-show-data-form-link-fix.diff
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git sc/source/ui/inc/tabvwsh.hxx sc/source/ui/inc/tabvwsh.hxx
-index 7ce1670..d8966e2 100644
---- sc/source/ui/inc/tabvwsh.hxx
-+++ sc/source/ui/inc/tabvwsh.hxx
-@@ -251,7 +251,7 @@ public:
-
- virtual ~ScTabViewShell();
-
-- Window* GetDialogParent();
-+ SC_DLLPUBLIC Window* GetDialogParent();
-
- bool IsRefInputMode() const;
- void ExecuteInputDirect();
diff --git a/patches/vba/vba-spinbutton-in-userform.diff b/patches/vba/vba-spinbutton-in-userform.diff
deleted file mode 100644
index f79a42900..000000000
--- a/patches/vba/vba-spinbutton-in-userform.diff
+++ /dev/null
@@ -1,344 +0,0 @@
---- svx/inc/svx/msocximex.hxx.orig 2008-09-10 13:54:24.000000000 +0800
-+++ svx/inc/svx/msocximex.hxx 2008-09-11 13:27:15.000000000 +0800
-@@ -292,6 +292,8 @@ public:
- UniString msToolTip;
- UniString msParentName;
- OCX_FontData aFontData;
-+ rtl::OUString msCtrlSource;
-+ rtl::OUString msRowSource;
- SfxObjectShell *pDocSh;
- protected:
-
-@@ -405,8 +407,6 @@ public:
- sal_uInt32 nGroupNameLen;
- sal_uInt32 nUnknown10;
-
-- rtl::OUString msCtrlSource;
-- rtl::OUString msRowSource;
- char *pValue;
- char *pCaption;
- char *pGroupName;
---- svx/source/msfilter/msocximex.cxx.orig 2008-09-10 13:54:24.000000000 +0800
-+++ svx/source/msfilter/msocximex.cxx 2008-09-11 13:30:06.000000000 +0800
-@@ -3669,8 +3669,7 @@ void OCX_ContainerControl::ProcessContro
- SotStorageStreamRef oStream = mContainedControlsStream;
-
- // can insert into OO Dialog (e.g is this a supported dialog control)??
-- if ( rec.nTypeIdent == SPINBUTTON ||
-- rec.nTypeIdent == TABSTRIP)
-+ if ( rec.nTypeIdent == TABSTRIP )
- {
- // skip the record in the stream, discard the control
- oStream->SeekRel( rec.nSubStreamLen );
-@@ -3694,13 +3693,11 @@ void OCX_ContainerControl::ProcessContro
- case LISTBOX:
- case OPTIONBUTTON:
- case COMBOBOX:
-+ case SPINBUTTON:
-+ case SCROLLBAR:
- {
-- OCX_ModernControl* pList = static_cast< OCX_ModernControl* >( pControl );
-- if ( pList )
-- {
-- pList->msCtrlSource = rec.sCtrlSource;
-- pList->msRowSource = rec.sRowSource;
-- }
-+ pControl->msCtrlSource = rec.sCtrlSource;
-+ pControl->msRowSource = rec.sRowSource;
- }
- }
- pControl->sName = rec.cName;
-@@ -5566,7 +5563,7 @@ OCX_SpinButton::OCX_SpinButton() :
- mbPropThumb( true )
- {
- msFormType = C2U("com.sun.star.form.component.SpinButton");
-- msDialogType = C2U("com.sun.star.awt.UnoControlSpinButtonModel");
-+ msDialogType = C2U("com.sun.star.form.component.SpinButton");
- mnBackColor = 0x8000000F;
- mnForeColor = 0x80000012;
- }
-@@ -5689,6 +5686,9 @@ sal_Bool OCX_SpinButton::Import(com::sun
- aTmp <<= sal_Int16( 0 );
- rPropSet->setPropertyValue( WW8_ASCII2STR("Border"), aTmp);
-
-+ uno::Reference< frame::XModel > xModel ( pDocSh ? pDocSh->GetModel() : NULL );
-+ lcl_ApplyListSourceAndBindableStuff( xModel, rPropSet, msCtrlSource, msRowSource );
-+
- return sal_True;
- }
-
-@@ -5856,7 +5856,7 @@ OCX_ScrollBar::OCX_ScrollBar()
- sName = OUString( RTL_CONSTASCII_USTRINGPARAM( "ScrollBar" ) );
- mnMax = 32767;
- msFormType = C2U("com.sun.star.form.component.ScrollBar");
-- msDialogType = C2U("com.sun.star.awt.UnoControlScrollBarModel");
-+ msDialogType = C2U("com.sun.star.form.component.ScrollBar");
-
- }
-
-@@ -5922,6 +5922,9 @@ sal_Bool OCX_ScrollBar::Import(com::sun:
- aTmp <<= sal_Int16( 0 );
- rPropSet->setPropertyValue( WW8_ASCII2STR("Border"), aTmp);
-
-+ uno::Reference< frame::XModel > xModel ( pDocSh ? pDocSh->GetModel() : NULL );
-+ lcl_ApplyListSourceAndBindableStuff( xModel, rPropSet, msCtrlSource, msRowSource );
-+
- return sal_True;
- }
-
---- xmlscript/source/xmldlg_imexp/exp_share.hxx.orig 2008-09-10 13:54:25.000000000 +0800
-+++ xmlscript/source/xmldlg_imexp/exp_share.hxx 2008-09-10 13:54:35.000000000 +0800
-@@ -212,7 +212,9 @@ public:
- SAL_THROW( (css::uno::Exception) );
- void readProgressBarModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
-- void readScrollBarModel( StyleBag * all_styles )
-+ void readScrollBarModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
-+ SAL_THROW( (css::uno::Exception) );
-+ void readSpinButtonModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
- SAL_THROW( (css::uno::Exception) );
- void readFixedHyperLinkModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
---- xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx.orig 2008-09-10 13:54:25.000000000 +0800
-+++ xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx 2008-09-10 13:54:35.000000000 +0800
-@@ -1164,7 +1164,7 @@ void ElementDescriptor::readProgressBarM
- readEvents();
- }
- //__________________________________________________________________________________________________
--void ElementDescriptor::readScrollBarModel( StyleBag * all_styles )
-+void ElementDescriptor::readScrollBarModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
- SAL_THROW( (Exception) )
- {
- // collect styles
-@@ -1202,6 +1202,47 @@ void ElementDescriptor::readScrollBarMod
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":live-scroll") ) );
- readHexLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":symbol-color") ) );
-+ // Cell Range, Ref Cell etc.
-+ lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
-+ readEvents();
-+}
-+//__________________________________________________________________________________________________
-+void ElementDescriptor::readSpinButtonModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
-+ SAL_THROW( (Exception) )
-+{
-+ // collect styles
-+ Style aStyle( 0x1 | 0x4 );
-+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
-+ aStyle._set |= 0x1;
-+ if (readBorderProps( this, aStyle ))
-+ aStyle._set |= 0x4;
-+ if (aStyle._set)
-+ {
-+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
-+ all_styles->getStyleId( aStyle ) );
-+ }
-+
-+ // collect elements
-+ readDefaults();
-+ readOrientationAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
-+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinIncrement") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":increment") ) );
-+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValue") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":curval") ) );
-+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValueMax") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxval") ) );
-+ readLongAttr( OUSTR("SpinValueMin"),
-+ OUSTR(XMLNS_DIALOGS_PREFIX ":minval") );
-+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Repeat") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":repeat") ) );
-+ readLongAttr( OUSTR("RepeatDelay"), OUSTR(XMLNS_DIALOGS_PREFIX ":repeat-delay") );
-+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
-+ readHexLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":symbol-color") ) );
-+ // Cell Range, Ref Cell etc.
-+ lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
- readEvents();
- }
- //__________________________________________________________________________________________________
---- xmlscript/source/xmldlg_imexp/xmldlg_export.cxx.orig 2008-09-10 13:54:25.000000000 +0800
-+++ xmlscript/source/xmldlg_imexp/xmldlg_export.cxx 2008-09-10 13:54:35.000000000 +0800
-@@ -1516,7 +1516,15 @@ void SAL_CALL exportDialogModel(
- xProps, xPropState,
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":scrollbar") ) );
- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-- pElem->readScrollBarModel( &all_styles );
-+ pElem->readScrollBarModel( &all_styles, xDocument );
-+ }
-+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlSpinButtonModel") ) ) )
-+ {
-+ pElem = new ElementDescriptor(
-+ xProps, xPropState,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spinbutton") ) );
-+ xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-+ pElem->readSpinButtonModel( &all_styles, xDocument );
- }
- else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlProgressBarModel") ) ) )
- {
---- xmlscript/source/xmldlg_imexp/imp_share.hxx.orig 2008-09-10 13:54:25.000000000 +0800
-+++ xmlscript/source/xmldlg_imexp/imp_share.hxx 2008-09-10 13:54:35.000000000 +0800
-@@ -1006,6 +1006,28 @@ public:
- };
-
- //==============================================================================
-+class SpinButtonElement
-+ : public ControlElement
-+{
-+public:
-+ virtual css::uno::Reference< css::xml::input::XElement >
-+ SAL_CALL startChildElement(
-+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
-+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
-+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-+ virtual void SAL_CALL endElement()
-+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-+
-+ inline SpinButtonElement(
-+ ::rtl::OUString const & rLocalName,
-+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
-+ ElementBase * pParent, DialogImport * pImport )
-+ SAL_THROW( () )
-+ : ControlElement( rLocalName, xAttributes, pParent, pImport )
-+ {}
-+};
-+
-+//==============================================================================
- class ProgressBarElement
- : public ControlElement
- {
---- xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx.orig 2008-09-10 13:54:25.000000000 +0800
-+++ xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx 2008-09-10 13:54:35.000000000 +0800
-@@ -237,10 +237,24 @@ Reference< xml::input::XElement > Scroll
- void ScrollBarElement::endElement()
- throw (xml::sax::SAXException, RuntimeException)
- {
-+ OUString sService( OUSTR("com.sun.star.awt.UnoControlScrollBarModel") );
-+ // we should probably limit this to vba mode also ( leave for now )
-+ if ( isVBACompatModeOn( _pImport ) )
-+ sService = OUSTR("com.sun.star.form.component.ScrollBar");
-+
-+ OUString sLinkedCell;
-+ try
-+ {
-+ sLinkedCell = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
-+ }
-+ catch( Exception& /*e*/ )
-+ {
-+ }
-+
- ControlImportContext ctx(
- _pImport, getControlId( _xAttributes ),
-- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlScrollBarModel") ) );
--
-+ sService );
-+
- Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
- if (xStyle.is())
- {
-@@ -283,6 +297,92 @@ void ScrollBarElement::endElement()
- OUString( RTL_CONSTASCII_USTRINGPARAM("symbol-color") ),
- _xAttributes );
-
-+ // import cell-link
-+ OUString sCellRange;
-+ importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
-+
-+ ctx.importEvents( _events );
-+ // avoid ring-reference:
-+ // vector< event elements > holding event elements holding this (via _pParent)
-+ _events.clear();
-+}
-+
-+//##################################################################################################
-+
-+// spinbutton
-+//__________________________________________________________________________________________________
-+Reference< xml::input::XElement > SpinButtonElement::startChildElement(
-+ sal_Int32 nUid, OUString const & rLocalName,
-+ Reference< xml::input::XAttributes > const & xAttributes )
-+ throw (xml::sax::SAXException, RuntimeException)
-+{
-+ // event
-+ if (_pImport->isEventElement( nUid, rLocalName ))
-+ {
-+ return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
-+ }
-+ else
-+ {
-+ throw xml::sax::SAXException(
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
-+ Reference< XInterface >(), Any() );
-+ }
-+}
-+//__________________________________________________________________________________________________
-+void SpinButtonElement::endElement()
-+ throw (xml::sax::SAXException, RuntimeException)
-+{
-+ OUString sLinkedCell;
-+ try
-+ {
-+ sLinkedCell = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
-+ }
-+ catch( Exception& /*e*/ )
-+ {
-+ }
-+
-+ ControlImportContext ctx(
-+ _pImport, getControlId( _xAttributes ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.SpinButton") ) );
-+
-+ Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
-+ if (xStyle.is())
-+ {
-+ StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
-+ Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
-+ pStyle->importBackgroundColorStyle( xControlModel );
-+ pStyle->importBorderStyle( xControlModel );
-+ }
-+
-+ ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
-+ ctx.importOrientationProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
-+ _xAttributes );
-+ ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinIncrement") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("increment") ),
-+ _xAttributes );
-+ ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValue") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("curval") ),
-+ _xAttributes );
-+ ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValueMax") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("maxval") ),
-+ _xAttributes );
-+ ctx.importLongProperty( OUSTR("SpinValueMin"), OUSTR("minval"),
-+ _xAttributes );
-+ ctx.importLongProperty( OUSTR("Repeat"), OUSTR("repeat"),
-+ _xAttributes );
-+ ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat-delay"),
-+ _xAttributes );
-+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
-+ _xAttributes );
-+ ctx.importHexLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("symbol-color") ),
-+ _xAttributes );
-+ // import cell-link
-+ OUString sCellRange;
-+ importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
-+
- ctx.importEvents( _events );
- // avoid ring-reference:
- // vector< event elements > holding event elements holding this (via _pParent)
-@@ -2312,6 +2412,11 @@ Reference< xml::input::XElement > Bullet
- {
- return new ScrollBarElement( rLocalName, xAttributes, this, _pImport );
- }
-+ // spinbutton
-+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("spinbutton") ) && isVBACompatModeOn( _pImport ) )
-+ {
-+ return new SpinButtonElement( rLocalName, xAttributes, this, _pImport );
-+ }
- // progressmeter
- else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("progressmeter") ))
- {
diff --git a/patches/vba/vba-styles-add-fix.diff b/patches/vba/vba-styles-add-fix.diff
deleted file mode 100644
index 301b74aff..000000000
--- a/patches/vba/vba-styles-add-fix.diff
+++ /dev/null
@@ -1,34 +0,0 @@
-diff --git sc/source/ui/vba/vbarange.cxx sc/source/ui/vba/vbarange.cxx
-index a3907a7..61d2f35 100644
---- sc/source/ui/vba/vbarange.cxx
-+++ sc/source/ui/vba/vbarange.cxx
-@@ -5054,6 +5054,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 sc/source/ui/vba/vbastyle.cxx sc/source/ui/vba/vbastyle.cxx
-index 5081858..7c6e677 100644
---- sc/source/ui/vba/vbastyle.cxx
-+++ 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/patches/vba/vba-support-export-palette.diff b/patches/vba/vba-support-export-palette.diff
deleted file mode 100644
index ff06b79a2..000000000
--- a/patches/vba/vba-support-export-palette.diff
+++ /dev/null
@@ -1,95 +0,0 @@
---- sc/source/filter/inc/xistyle.hxx.old 2009-04-02 10:44:58.000000000 +0000
-+++ sc/source/filter/inc/xistyle.hxx 2009-04-06 16:41:58.000000000 +0000
-@@ -72,8 +72,10 @@ public:
- void ReadPalette( XclImpStream& rStrm );
-
- private:
-+ void ExportPalette();
- typedef ::std::vector< ColorData > ColorDataVec;
- ColorDataVec maColorTable; /// Colors read from file.
-+ const XclImpRoot& mrRoot;
- };
-
- // FONT record - font information =============================================
---- sc/source/filter/excel/xistyle.cxx.old 2009-04-02 10:44:55.000000000 +0000
-+++ sc/source/filter/excel/xistyle.cxx 2009-04-06 16:41:58.000000000 +0000
-@@ -68,10 +68,70 @@
- #include "root.hxx"
- #include "colrowst.hxx"
-
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/container/XIndexAccess.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+using namespace ::com::sun::star;
-+
-+typedef ::cppu::WeakImplHelper1< container::XIndexAccess > XIndexAccess_BASE;
-+typedef ::std::vector< ColorData > ColorDataVec;
-+
-+class PaletteIndex : public XIndexAccess_BASE
-+{
-+public:
-+ PaletteIndex( const ColorDataVec& rColorDataTable ) : maColorData( rColorDataTable ) {}
-+
-+ // Methods XIndexAccess
-+ virtual ::sal_Int32 SAL_CALL getCount() throw (uno::RuntimeException)
-+ {
-+ return maColorData.size();
-+ }
-+
-+ virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ //--Index; // apparently the palette is already 1 based
-+ return uno::makeAny( sal_Int32( maColorData[ Index ] ) );
-+ }
-+
-+ // Methods XElementAcess
-+ virtual uno::Type SAL_CALL getElementType() throw (uno::RuntimeException)
-+ {
-+ return ::getCppuType( (sal_Int32*)0 );
-+ }
-+ virtual ::sal_Bool SAL_CALL hasElements() throw (uno::RuntimeException)
-+ {
-+ return (maColorData.size() > 0);
-+ }
-+
-+private:
-+ ColorDataVec maColorData;
-+};
-+
-+void
-+XclImpPalette::ExportPalette()
-+{
-+ if( SfxObjectShell* pDocShell = mrRoot.GetDocShell() )
-+ {
-+ // copy values in color palette
-+ sal_Int16 nColors = maColorTable.size();
-+ ColorDataVec aColors;
-+ aColors.resize( nColors );
-+ for( sal_uInt16 nIndex = 0; nIndex < nColors; ++nIndex )
-+ aColors[ nIndex ] = GetColorData( nIndex );
-+
-+ uno::Reference< beans::XPropertySet > xProps( pDocShell->GetModel(), uno::UNO_QUERY );
-+ if ( xProps.is() )
-+ {
-+ uno::Reference< container::XIndexAccess > xIndex( new PaletteIndex( aColors ) );
-+ xProps->setPropertyValue( CREATE_OUSTRING("ColorPalette"), uno::makeAny( xIndex ) );
-+ }
-+ }
-+
-+}
- // PALETTE record - color information =========================================
-
- XclImpPalette::XclImpPalette( const XclImpRoot& rRoot ) :
-- XclDefaultPalette( rRoot )
-+ XclDefaultPalette( rRoot ), mrRoot( rRoot )
- {
- }
-
-@@ -105,6 +165,7 @@ void XclImpPalette::ReadPalette( XclImpS
- rStrm >> aColor;
- maColorTable[ nIndex ] = aColor.GetColor();
- }
-+ ExportPalette();
- }
-
- // FONT record - font information =============================================
diff --git a/patches/vba/vba-support-properties-inmodules.diff b/patches/vba/vba-support-properties-inmodules.diff
deleted file mode 100644
index af341ccd8..000000000
--- a/patches/vba/vba-support-properties-inmodules.diff
+++ /dev/null
@@ -1,145 +0,0 @@
-diff -rup basic/source/classes/sb.cxx basic.patched/source/classes/sb.cxx
---- basic/source/classes/sb.cxx 2008-05-22 09:44:11.000000000 +0100
-+++ basic/source/classes/sb.cxx 2008-05-23 18:10:51.000000000 +0100
-@@ -461,72 +461,7 @@ SbClassModuleObject::~SbClassModuleObjec
- void SbClassModuleObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
- const SfxHint& rHint, const TypeId& rHintType )
- {
-- bool bDone = false;
--
-- const SbxHint* pHint = PTR_CAST(SbxHint,&rHint);
-- if( pHint )
-- {
-- SbxVariable* pVar = pHint->GetVar();
-- SbProcedureProperty* pProcProperty = PTR_CAST( SbProcedureProperty, pVar );
-- if( pProcProperty )
-- {
-- bDone = true;
--
-- if( pHint->GetId() == SBX_HINT_DATAWANTED )
-- {
-- String aProcName;
-- aProcName.AppendAscii( "Property Get " );
-- aProcName += pProcProperty->GetName();
--
-- SbxVariable* pMeth = Find( aProcName, SbxCLASS_METHOD );
-- if( pMeth )
-- {
-- SbxValues aVals;
-- aVals.eType = SbxVARIANT;
-- pMeth->Get( aVals );
-- pVar->Put( aVals );
-- }
-- }
-- else if( pHint->GetId() == SBX_HINT_DATACHANGED )
-- {
-- SbxVariable* pMeth = NULL;
--
-- bool bSet = pProcProperty->isSet();
-- if( bSet )
-- {
-- pProcProperty->setSet( false );
--
-- String aProcName;
-- aProcName.AppendAscii( "Property Set " );
-- aProcName += pProcProperty->GetName();
-- pMeth = Find( aProcName, SbxCLASS_METHOD );
-- }
-- if( !pMeth ) // Let
-- {
-- String aProcName;
-- aProcName.AppendAscii( "Property Let " );
-- aProcName += pProcProperty->GetName();
-- pMeth = Find( aProcName, SbxCLASS_METHOD );
-- }
--
-- if( pMeth )
-- {
-- // Setup parameters
-- SbxArrayRef xArray = new SbxArray;
-- xArray->Put( pMeth, 0 ); // Method as parameter 0
-- xArray->Put( pVar, 1 );
-- pMeth->SetParameters( xArray );
--
-- SbxValues aVals;
-- pMeth->Get( aVals );
-- pMeth->SetParameters( NULL );
-- }
-- }
-- }
-- }
--
-- if( !bDone )
-- SbModule::SFX_NOTIFY( rBC, rBCType, rHint, rHintType );
-+ SbModule::SFX_NOTIFY( rBC, rBCType, rHint, rHintType );
- }
-
- SbxVariable* SbClassModuleObject::Find( const XubString& rName, SbxClassType t )
-diff -rup basic/source/classes/sbxmod.cxx basic.patched/source/classes/sbxmod.cxx
---- basic/source/classes/sbxmod.cxx 2008-05-22 09:44:12.000000000 +0100
-+++ basic.patched/source/classes/sbxmod.cxx 2008-05-23 18:11:36.000000000 +0100
-@@ -471,6 +471,64 @@ void SbModule::SFX_NOTIFY( SfxBroadcaste
- SbxVariable* pVar = pHint->GetVar();
- SbProperty* pProp = PTR_CAST(SbProperty,pVar);
- SbMethod* pMeth = PTR_CAST(SbMethod,pVar);
-+ SbProcedureProperty* pProcProperty = PTR_CAST( SbProcedureProperty, pVar );
-+ if( pProcProperty )
-+ {
-+ if( pHint->GetId() == SBX_HINT_DATAWANTED )
-+ {
-+ String aProcName;
-+ aProcName.AppendAscii( "Property Get " );
-+ aProcName += pProcProperty->GetName();
-+
-+ SbxVariable* pPropMeth = Find( aProcName, SbxCLASS_METHOD );
-+ if( pPropMeth )
-+ {
-+ // Setup parameters
-+ pPropMeth->SetParameters( pVar->GetParameters() );
-+
-+ SbxValues aVals;
-+ aVals.eType = SbxVARIANT;
-+ pPropMeth->Get( aVals );
-+ pVar->Put( aVals );
-+ }
-+ }
-+ else if( pHint->GetId() == SBX_HINT_DATACHANGED )
-+ {
-+ SbxVariable* pPropMeth = NULL;
-+
-+ bool bSet = pProcProperty->isSet();
-+ if( bSet )
-+ {
-+ pProcProperty->setSet( false );
-+
-+ String aProcName;
-+ aProcName.AppendAscii( "Property Set " );
-+ aProcName += pProcProperty->GetName();
-+ pPropMeth = Find( aProcName, SbxCLASS_METHOD );
-+ }
-+ if( !pPropMeth ) // Let
-+ {
-+ String aProcName;
-+ aProcName.AppendAscii( "Property Let " );
-+ aProcName += pProcProperty->GetName();
-+ pPropMeth = Find( aProcName, SbxCLASS_METHOD );
-+ }
-+
-+ if( pPropMeth )
-+ {
-+ // Setup parameters
-+ SbxArrayRef xArray = new SbxArray;
-+ xArray->Put( pPropMeth, 0 ); // Method as parameter 0
-+ xArray->Put( pVar, 1 );
-+ pPropMeth->SetParameters( xArray );
-+
-+ SbxValues aVals;
-+ pPropMeth->Get( aVals );
-+ pPropMeth->SetParameters( NULL );
-+ }
-+ }
-+ }
-+
- if( pProp )
- {
- if( pProp->GetModule() != this )
diff --git a/patches/vba/vba-support-stoc-typeprovider-xexactname.diff b/patches/vba/vba-support-stoc-typeprovider-xexactname.diff
deleted file mode 100644
index 63db8707d..000000000
--- a/patches/vba/vba-support-stoc-typeprovider-xexactname.diff
+++ /dev/null
@@ -1,372 +0,0 @@
-Index: stoc/source/registry_tdprovider/makefile.mk
-===================================================================
-RCS file: /cvs/udk/stoc/source/registry_tdprovider/makefile.mk,v
-retrieving revision 1.13
-diff -u -r1.13 makefile.mk
---- stoc/source/registry_tdprovider/makefile.mk 4 Jun 2004 02:32:05 -0000 1.13
-+++ stoc/source/registry_tdprovider/makefile.mk 29 Sep 2005 11:27:37 -0000
-@@ -77,6 +77,10 @@
-
- .INCLUDE : ..$/cppumaker.mk
-
-+.IF "$(ENABLE_VBA)"=="YES"
-+ CDEFS+=-DENABLE_VBA
-+.ENDIF
-+
- SLOFILES= \
- $(SLO)$/tdprovider.obj \
- $(SLO)$/td.obj \
-Index: stoc/source/registry_tdprovider/rdbtdp.xml
-===================================================================
-RCS file: /cvs/udk/stoc/source/registry_tdprovider/rdbtdp.xml,v
-retrieving revision 1.14
-diff -u -r1.14 rdbtdp.xml
---- stoc/source/registry_tdprovider/rdbtdp.xml 23 Jul 2004 15:03:39 -0000 1.14
-+++ stoc/source/registry_tdprovider/rdbtdp.xml 29 Sep 2005 11:27:37 -0000
-@@ -45,6 +45,7 @@
- <type> com.sun.star.registry.XSimpleRegistry </type>
- <type> com.sun.star.beans.PropertyAttribute </type>
- <type> com.sun.star.beans.XPropertySet </type>
-+ <type> com.sun.star.beans.XExactName </type>
- <type> com.sun.star.container.NoSuchElementException </type>
- <type> com.sun.star.container.XHierarchicalNameAccess </type>
- <type> com.sun.star.container.XSet </type>
-Index: stoc/source/registry_tdprovider/tdprovider.cxx
-===================================================================
-RCS file: /cvs/udk/stoc/source/registry_tdprovider/tdprovider.cxx,v
-retrieving revision 1.18
-diff -u -r1.18 tdprovider.cxx
---- stoc/source/registry_tdprovider/tdprovider.cxx 20 Sep 2004 14:30:28 -0000 1.18
-+++ stoc/source/registry_tdprovider/tdprovider.cxx 29 Sep 2005 11:27:37 -0000
-@@ -98,6 +98,12 @@
- #include <com/sun/star/reflection/XTypeDescriptionEnumerationAccess.hpp>
- #include "com/sun/star/uno/RuntimeException.hpp"
-
-+#ifdef ENABLE_VBA
-+#include <cppuhelper/compbase5.hxx>
-+#include <com/sun/star/beans/XExactName.hpp>
-+#include <rtl/ustrbuf.hxx>
-+#endif //ENABLE_VBA
-+
- #include "registry/reader.hxx"
- #include "registry/version.h"
-
-@@ -157,10 +163,17 @@
- };
- //==================================================================================================
- class ProviderImpl
-- : public MutexHolder
-- , public WeakComponentImplHelper4< XServiceInfo,
-+ : public MutexHolder ,
-+#ifdef ENABLE_VBA
-+ public WeakComponentImplHelper5< XServiceInfo,
-+#else
-+ public WeakComponentImplHelper4< XServiceInfo,
-+#endif //ENABLE_VBA
- XHierarchicalNameAccess,
- XTypeDescriptionEnumerationAccess,
-+#ifdef ENABLE_VBA
-+ XExactName,
-+#endif //ENABLE_VBA
- XInitialization >
- {
- // XHierarchicalNameAccess + XTypeDescriptionEnumerationAccess wrapper
-@@ -238,12 +251,23 @@
- throw ( ::com::sun::star::reflection::NoSuchTypeNameException,
- ::com::sun::star::reflection::InvalidTypeNameException,
- ::com::sun::star::uno::RuntimeException );
-+#ifdef ENABLE_VBA
-+ // XExactName
-+ virtual ::rtl::OUString SAL_CALL getExactName( const ::rtl::OUString& aApproximateName ) throw (::com::sun::star::uno::RuntimeException);
-+#endif //ENABLE_VBA
-+
- };
- //__________________________________________________________________________________________________
- ProviderImpl::ProviderImpl( const com::sun::star::uno::Reference< XComponentContext > & xContext )
-+#ifdef ENABLE_VBA
-+ : WeakComponentImplHelper5<
-+ XServiceInfo, XHierarchicalNameAccess,
-+ XTypeDescriptionEnumerationAccess, XExactName, XInitialization >( _aComponentMutex )
-+#else
- : WeakComponentImplHelper4<
- XServiceInfo, XHierarchicalNameAccess,
-- XTypeDescriptionEnumerationAccess, XInitialization >( _aComponentMutex )
-+ XTypeDescriptionEnumerationAccess, XInitialization >( _aComponentMutex )
-+#endif //ENABLE_VBA
- , _xContext( xContext )
- {
- g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
-@@ -527,6 +551,143 @@
- _aBaseKeys ).get() );
- }
-
-+#ifdef ENABLE_VBA
-+// Recursive routine to find the exact name of a namespace in the
-+// Registry.
-+// relativeName is the "/" delimited name e.g. org/openoffice/vba/xxx
-+// and represents the name to be resolved, each successive recursive
-+// call processes/resolves just the leading "/" delimited name.
-+// e.g.
-+// ->org/openoffice/vba/xxx ( findExactName just processes org )
-+// -> openoffice/vba/xx ( " " " openoffice )
-+// -> vba/xx " " "
-+// -> xx " " "
-+// xParentKey is the key that "hopefully" contains the sub keys the match node
-+// to be processed/resolved
-+// sExactNameBuf buffer is passed to each call that allows the exact name to
-+// built up.
-+
-+bool findExactName( const OUString& relativeName, const uno::Reference< XRegistryKey >& xParentKey,
-+ OUStringBuffer& sExactNameBuf )
-+{
-+ OUString searchName = relativeName;
-+ OUString newNameToSearch;
-+ int dotIndex = 0;
-+ if ( ( dotIndex = relativeName.indexOf('/') ) > -1 )
-+ {
-+ searchName = relativeName.copy( 0, dotIndex );
-+ newNameToSearch = relativeName.copy( dotIndex+1 );
-+ }
-+ Sequence< OUString > aChildNames = xParentKey->getKeyNames();
-+ sal_Int32 nLen = aChildNames.getLength();
-+ OUString* pStr = aChildNames.getArray();
-+ sal_Int32 nKeyLen = xParentKey->getKeyName().getLength();
-+ OUString sExactName;
-+ for ( sal_Int32 index=0; index<nLen; ++index, ++pStr )
-+ {
-+ sal_Int32 fromIndex = nKeyLen + 1;
-+ OUString temp = pStr->copy( fromIndex );
-+ if ( searchName.equalsIgnoreAsciiCase( temp ) )
-+ {
-+ sExactName = temp;
-+ break;
-+ }
-+ }
-+ // no match && this is a leaf name ( the last "/" delimited element )
-+ if ( !sExactName.getLength() && !newNameToSearch.getLength() )
-+ {
-+ try
-+ {
-+ // Maybe the leaf name is a constant or enum
-+ // if so, the name is not in the registry keys but is a field of
-+ // a constant group or enum etc.
-+ if ( xParentKey->isValid() )
-+ {
-+ if (xParentKey->getValueType() == RegistryValueType_BINARY)
-+ {
-+ Sequence< sal_Int8 > aBytes( xParentKey->getBinaryValue() );
-+ typereg::Reader aReader(
-+ aBytes.getConstArray(), aBytes.getLength(),
-+ false, TYPEREG_VERSION_1);
-+
-+ if (aReader.getTypeClass() == RT_TYPE_MODULE ||
-+ aReader.getTypeClass() == RT_TYPE_CONSTANTS ||
-+ aReader.getTypeClass() == RT_TYPE_ENUM)
-+ {
-+ sal_Int16 nPos = aReader.getFieldCount();
-+ while (nPos--)
-+ {
-+ if (relativeName.equalsIgnoreAsciiCase(
-+ aReader.getFieldName(nPos)))
-+ {
-+ sExactName = aReader.getFieldName( nPos );
-+ break;
-+ }
-+ }
-+ }
-+ }
-+ }
-+ }
-+ catch ( InvalidRegistryException& ) {}
-+ }
-+ if ( sExactName.getLength() )
-+ {
-+ sExactNameBuf.append( sExactName );
-+ if ( newNameToSearch.getLength() )
-+ {
-+ try
-+ {
-+ uno::Reference< XRegistryKey > xMatchKey( xParentKey->openKey( sExactName ) );
-+ if ( xMatchKey.is() )
-+ {
-+ RegistryKeyCloser aCloser( xMatchKey );
-+ sExactNameBuf.append( OUString::createFromAscii(".") );
-+ return findExactName( newNameToSearch, xMatchKey, sExactNameBuf );
-+ }
-+ }
-+ catch ( InvalidRegistryException& ) {}
-+
-+ return false;
-+ }
-+ return true;
-+ }
-+ return false;
-+}
-+
-+// XExactName
-+//__________________________________________________________________________________________________
-+// virtual
-+
-+::rtl::OUString SAL_CALL
-+ProviderImpl::getExactName( const ::rtl::OUString& aApproximateName ) throw (::com::sun::star::uno::RuntimeException)
-+{
-+ OUString aKey( aApproximateName.replace( '.', '/' ) );
-+
-+ OUStringBuffer sBuf( aKey.getLength() );
-+ OUString sExactName;
-+
-+ for ( RegistryKeyList::const_iterator iPos( _aBaseKeys.begin() );
-+ iPos != _aBaseKeys.end(); ++iPos )
-+ {
-+ try
-+ {
-+ com::sun::star::uno::Reference< XRegistryKey > xBaseKey( *iPos );
-+ if ( xBaseKey.is() )
-+ {
-+ Sequence< OUString > aStrings = xBaseKey->getKeyNames();
-+ if ( findExactName( aKey, xBaseKey, sBuf ) )
-+ {
-+ sExactName = sBuf.makeStringAndClear();
-+ break;
-+ }
-+ }
-+ }
-+ catch( InvalidRegistryException const & ) {}
-+ }
-+ return sExactName;
-+}
-+#endif //#ENABLE_VBA
-+
- //==================================================================================================
- static com::sun::star::uno::Reference< XInterface > SAL_CALL ProviderImpl_create(
- com::sun::star::uno::Reference< XComponentContext > const & xContext )
-Index: stoc/source/tdmanager/makefile.mk
-===================================================================
-RCS file: /cvs/udk/stoc/source/tdmanager/makefile.mk,v
-retrieving revision 1.10
-diff -u -r1.10 makefile.mk
---- stoc/source/tdmanager/makefile.mk 12 Aug 2004 12:18:46 -0000 1.10
-+++ stoc/source/tdmanager/makefile.mk 29 Sep 2005 11:27:37 -0000
-@@ -77,6 +77,10 @@
-
- .INCLUDE : ..$/cppumaker.mk
-
-+.IF "$(ENABLE_VBA)"=="YES"
-+ CDEFS+=-DENABLE_VBA
-+.ENDIF
-+
- SLOFILES= \
- $(SLO)$/tdmgr.obj \
- $(SLO)$/tdmgr_check.obj \
-Index: stoc/source/tdmanager/tdmgr.cxx
-===================================================================
-RCS file: /cvs/udk/stoc/source/tdmanager/tdmgr.cxx,v
-retrieving revision 1.18
-diff -u -r1.18 tdmgr.cxx
---- stoc/source/tdmanager/tdmgr.cxx 12 Aug 2004 12:18:59 -0000 1.18
-+++ stoc/source/tdmanager/tdmgr.cxx 29 Sep 2005 11:27:38 -0000
-@@ -106,6 +106,13 @@
- #include <com/sun/star/registry/XRegistryKey.hpp>
- #include "com/sun/star/uno/RuntimeException.hpp"
-
-+#ifdef ENABLE_VBA
-+#ifndef _CPPUHELPER_IMPLBASE6_HXX_
-+#include <cppuhelper/compbase6.hxx>
-+#endif
-+#include <com/sun/star/beans/XExactName.hpp>
-+#endif //ENABLE_VBA
-+
- #include <algorithm>
- #include <vector>
-
-@@ -197,10 +204,17 @@
-
- //==================================================================================================
- class ManagerImpl
-+#ifdef ENABLE_VBA
-+ : public WeakComponentImplHelper6< XServiceInfo,
-+#else
- : public WeakComponentImplHelper5< XServiceInfo,
-+#endif //ENABLE_VBA
- XSet,
- XHierarchicalNameAccess,
- XTypeDescriptionEnumerationAccess,
-+#ifdef ENABLE_VBA
-+ beans::XExactName,
-+#endif //ENABLE_VBA
- XInitialization >
- {
- friend class EnumerationImpl;
-@@ -262,6 +276,10 @@
- throw ( ::com::sun::star::reflection::NoSuchTypeNameException,
- ::com::sun::star::reflection::InvalidTypeNameException,
- ::com::sun::star::uno::RuntimeException );
-+#ifdef ENABLE_VBA
-+ // XExactName
-+ virtual ::rtl::OUString SAL_CALL getExactName( const ::rtl::OUString& aApproximateName ) throw (::com::sun::star::uno::RuntimeException);
-+#endif //ENABLE_VBA
- };
-
- //==================================================================================================
-@@ -344,9 +362,15 @@
- //__________________________________________________________________________________________________
- ManagerImpl::ManagerImpl(
- Reference< XComponentContext > const & xContext, sal_Int32 nCacheSize )
-+#ifdef ENABLE_VBA
-+ : WeakComponentImplHelper6<
-+ XServiceInfo, XSet, XHierarchicalNameAccess,
-+ XTypeDescriptionEnumerationAccess, beans::XExactName, XInitialization >( _aComponentMutex )
-+#else
- : WeakComponentImplHelper5<
- XServiceInfo, XSet, XHierarchicalNameAccess,
- XTypeDescriptionEnumerationAccess, XInitialization >( _aComponentMutex )
-+#endif //ENABLE_VBA
- , _xContext( xContext )
- , _aEventListener( this )
- , _bCaching( sal_True )
-@@ -641,6 +665,30 @@
- aStack ) );
- }
-
-+#ifdef ENABLE_VBA
-+::rtl::OUString SAL_CALL
-+ManagerImpl::getExactName( const ::rtl::OUString& aApproximateName ) throw (::com::sun::star::uno::RuntimeException)
-+{
-+ OUString sExactName;
-+ for ( ProviderVector::const_iterator iPos( _aProviders.begin() );
-+ iPos != _aProviders.end(); ++iPos )
-+ {
-+ try
-+ {
-+ Reference< XExactName > xExact( *iPos, UNO_QUERY );
-+ if ( xExact.is() )
-+ {
-+ sExactName = xExact->getExactName( aApproximateName );
-+ if ( sExactName.getLength() )
-+ break;
-+ }
-+ }
-+ catch (NoSuchElementException &) {}
-+ }
-+ return sExactName;
-+}
-+#endif //ENABLE_VBA
-+
-
- //##################################################################################################
- //##################################################################################################
-Index: stoc/source/tdmanager/tdmgr.xml
-===================================================================
-RCS file: /cvs/udk/stoc/source/tdmanager/tdmgr.xml,v
-retrieving revision 1.9
-diff -u -r1.9 tdmgr.xml
---- stoc/source/tdmanager/tdmgr.xml 12 Aug 2004 12:19:13 -0000 1.9
-+++ stoc/source/tdmanager/tdmgr.xml 29 Sep 2005 11:27:38 -0000
-@@ -48,6 +48,7 @@
- <type> com.sun.star.registry.XRegistryKey </type>
- <type> com.sun.star.container.XSet </type>
- <type> com.sun.star.container.XHierarchicalNameAccess </type>
-+ <type> com.sun.star.beans.XExactName </type>
- <type> com.sun.star.container.XContentEnumerationAccess </type>
- <type> com.sun.star.uno.XAggregation </type>
- <type> com.sun.star.uno.XWeak </type>
diff --git a/patches/vba/vba-templateobject.diff b/patches/vba/vba-templateobject.diff
deleted file mode 100644
index d2a9932bc..000000000
--- a/patches/vba/vba-templateobject.diff
+++ /dev/null
@@ -1,579 +0,0 @@
-diff --git oovbaapi/ooo/vba/word/XDocument.idl oovbaapi/ooo/vba/word/XDocument.idl
-index 32cf6d8..2502846 100644
---- oovbaapi/ooo/vba/word/XDocument.idl
-+++ oovbaapi/ooo/vba/word/XDocument.idl
-@@ -47,6 +47,7 @@ module ooo { module vba { module word {
- interface XDocument : com::sun::star::uno::XInterface
- {
- [attribute, readonly] XRange Content;
-+ [attribute] any AttachedTemplate;
-
- XRange Range( [in] any Start, [in] any End );
- any BuiltInDocumentProperties( [in] any index );
-diff --git oovbaapi/ooo/vba/word/XTemplate.idl oovbaapi/ooo/vba/word/XTemplate.idl
-new file mode 100644
-index 0000000..1913118
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XTemplate.idl
-@@ -0,0 +1,54 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XTemplate_idl__
-+#define __ooo_vba_word_XTemplate_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XTemplate
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ [attribute, readonly] string Name;
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/makefile.mk oovbaapi/ooo/vba/word/makefile.mk
-index 646e623..c638476 100644
---- oovbaapi/ooo/vba/word/makefile.mk
-+++ oovbaapi/ooo/vba/word/makefile.mk
-@@ -56,6 +56,7 @@ IDLFILES= XGlobals.idl\
- XPanes.idl \
- XOptions.idl \
- XSelection.idl \
-+ XTemplate.idl \
-
- # ------------------------------------------------------------------
-
---- sw/inc/docsh.hxx
-+++ sw/inc/docsh.hxx
-@@ -85,6 +85,7 @@ class SW_DLLPUBLIC SwDocShell: public SfxObjectShell, public SfxListener
- comphelper::EmbeddedObjectContainer* pOLEChildList;
- sal_Int16 nUpdateDocMode; // contains the com::sun::star::document::UpdateDocMode
- bool bInUpdateFontList; //prevent nested calls of UpdateFontList
-+ bool bIsATemplate; //prevent nested calls of UpdateFontList
- // Methoden fuer den Zugriff aufs Doc
- SW_DLLPRIVATE void AddLink();
- SW_DLLPRIVATE void RemoveLink();
-@@ -299,6 +300,8 @@ public:
- GetController();
-
- SfxInPlaceClient* GetIPClient( const ::svt::EmbeddedObjectRef& xObjRef );
-+ SW_DLLPRIVATE sal_Bool IsTemplate() { return bIsATemplate; }
-+ SW_DLLPRIVATE void SetIsTemplate( bool bValue ) { bIsATemplate = bValue; }
-
- virtual const ::sfx2::IXmlIdRegistry* GetXmlIdRegistry() const;
- };
-diff --git sw/inc/unomap.hxx sw/inc/unomap.hxx
-index 92feb78..1e842ab 100644
---- sw/inc/unomap.hxx
-+++ sw/inc/unomap.hxx
-@@ -262,6 +262,7 @@
- #define WID_DOC_LOCK_UPDATES 1016
- #define WID_DOC_HAS_VALID_SIGNATURES 1017
- #define WID_DOC_BUILDID 1024
-+#define WID_DOC_ISTEMPLATEID 1025
- // --> OD 2006-03-21 #b6375613#
- #define WID_APPLY_WORKAROUND_FOR_B6375613 1070
- // <--
---- sw/inc/unoprnms.hxx
-+++ sw/inc/unoprnms.hxx
-@@ -804,7 +804,8 @@ enum SwPropNameIds
- // --> OD 2009-07-13 #i73249#
- /* 0737 */ UNO_NAME_DESCRIPTION,
- // <--
--/* 0738 */ SW_PROPNAME_END
-+/* 0738 */ UNO_NAME_IS_TEMPLATE,
-+/* 0739 */ SW_PROPNAME_END
- };
-
-
-diff --git sw/source/core/unocore/unomap.cxx sw/source/core/unocore/unomap.cxx
-index abc341b..14ff14e 100644
---- sw/source/core/unocore/unomap.cxx
-+++ sw/source/core/unocore/unomap.cxx
-@@ -1703,6 +1703,7 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP
- { SW_PROP_NMID(UNO_NAME_RECORD_CHANGES), WID_DOC_CHANGES_RECORD, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
- { SW_PROP_NMID(UNO_NAME_SHOW_CHANGES), WID_DOC_CHANGES_SHOW, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
- { SW_PROP_NMID(UNO_NAME_WORD_COUNT), WID_DOC_WORD_COUNT, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::READONLY, 0},
-+ { SW_PROP_NMID(UNO_NAME_IS_TEMPLATE), WID_DOC_ISTEMPLATEID, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::READONLY, 0},
- { SW_PROP_NMID(UNO_NAME_WORD_SEPARATOR), WID_DOC_WORD_SEPARATOR, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
- { SW_PROP_NMID(UNO_NAME_HIDE_FIELD_TIPS), WID_DOC_HIDE_TIPS, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
- { SW_PROP_NMID(UNO_NAME_REDLINE_DISPLAY_TYPE), WID_DOC_REDLINE_DISPLAY, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
---- sw/source/core/unocore/unoprnms.cxx
-+++ sw/source/core/unocore/unoprnms.cxx
-@@ -778,7 +778,8 @@ const SwPropNameTab aPropNameTab = {
- /* 0734 CHAR_OVERLINE_COLOR */ {MAP_CHAR_LEN("CharOverlineColor")},
- /* 0735 CHAR_OVERLINE_HAS_COLOR */ {MAP_CHAR_LEN("CharOverlineHasColor")},
- /* 0736 UNO_NAME_OUTLINE_LEVEL */ {MAP_CHAR_LEN("OutlineLevel")},//#outline level,add<-zhaojianwei Outlinelevel
--/* 0737 UNO_NAME_DESCRIPTION */ {MAP_CHAR_LEN("Description")}
-+/* 0737 UNO_NAME_DESCRIPTION */ {MAP_CHAR_LEN("Description")},
-+/* 0738 UNO_NAME_IS_TEMPLATE */ {MAP_CHAR_LEN("IsTemplate")}
- };
-
- const SwPropNameLen& SwGetPropName( USHORT nId )
-diff --git sw/source/filter/ww8/ww8par.cxx sw/source/filter/ww8/ww8par.cxx
-index 714c63a..e6cca0f 100644
---- sw/source/filter/ww8/ww8par.cxx
-+++ sw/source/filter/ww8/ww8par.cxx
-@@ -140,6 +140,7 @@
- #include <iostream>
- #include <dbgoutsw.hxx>
- #endif
-+#include <unotools/localfilehelper.hxx>
-
- #define MM_250 1417 // WW-Default fuer Hor. Seitenraender: 2.5 cm
- #define MM_200 1134 // WW-Default fuer u.Seitenrand: 2.0 cm
-@@ -219,6 +220,80 @@ bool registerDocEvent( SfxObjectShell* pShell )
- return result;
- }
-
-+class Sttb : TBBase
-+{
-+struct SBBItem
-+{
-+ sal_uInt16 cchData;
-+ rtl::OUString data;
-+ SBBItem() : cchData(0){}
-+};
-+ sal_uInt16 fExtend;
-+ sal_uInt16 cData;
-+ sal_uInt16 cbExtra;
-+
-+ std::vector< SBBItem > dataItems;
-+
-+ Sttb(const Sttb&);
-+ Sttb& operator = ( const Sttb&);
-+public:
-+ Sttb();
-+ ~Sttb();
-+ bool Read(SvStream *pS);
-+ void Print( FILE* fp );
-+ rtl::OUString getStringAtIndex( sal_Int32 );
-+};
-+
-+Sttb::Sttb() : fExtend( 0 )
-+,cData( 0 )
-+,cbExtra( 0 )
-+{
-+}
-+
-+Sttb::~Sttb()
-+{
-+}
-+
-+bool Sttb::Read( SvStream* pS )
-+{
-+ OSL_TRACE("Sttb::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> fExtend >> cData >> cbExtra;
-+ if ( cData )
-+ {
-+ for ( sal_Int32 index = 0; index < cData; ++index )
-+ {
-+ SBBItem aItem;
-+ *pS >> aItem.cchData;
-+ aItem.data = readUnicodeString( pS, aItem.cchData );
-+ dataItems.push_back( aItem );
-+ }
-+ }
-+ return true;
-+}
-+
-+void Sttb::Print( FILE* fp )
-+{
-+ fprintf( fp, "[ 0x%x ] Sttb - dump\n", nOffSet);
-+ fprintf( fp, " fExtend 0x%x [expected 0xFFFF ]\n", fExtend );
-+ fprintf( fp, " cData no. or string data items %d (0x%x)\n", cData, cData );
-+
-+ if ( cData )
-+ {
-+ for ( sal_Int32 index = 0; index < cData; ++index )
-+ fprintf(fp," string dataItem[ %d(0x%x) ] has name %s\n", static_cast< int >( index ), static_cast< unsigned int >( index ), rtl::OUStringToOString( dataItems[ index ].data, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ }
-+
-+}
-+
-+rtl::OUString
-+Sttb::getStringAtIndex( sal_Int32 index )
-+{
-+ rtl::OUString aRet;
-+ if ( index < dataItems.size() )
-+ aRet = dataItems[ index ].data;
-+ return aRet;
-+}
-
- SwMSDffManager::SwMSDffManager( SwWW8ImplReader& rRdr )
- : SvxMSDffManager(*rRdr.pTableStream, rRdr.GetBaseURL(), rRdr.pWwFib->fcDggInfo,
-@@ -3725,6 +3800,41 @@ void SwWW8ImplReader::ReadDocInfo()
- DBG_ASSERT(xDocProps.is(), "DocumentProperties is null");
-
- if (xDocProps.is()) {
-+ if ( pWwFib->fDot )
-+ {
-+ rtl::OUString sTemplateURL;
-+ SfxMedium* pMedium = mpDocShell->GetMedium();
-+ if ( pMedium )
-+ {
-+ rtl::OUString aName = pMedium->GetName();
-+ INetURLObject aURL( aName );
-+ sTemplateURL = aURL.GetMainURL(INetURLObject::DECODE_TO_IURI);
-+ if ( sTemplateURL.getLength() > 0 )
-+ xDocProps->setTemplateURL( sTemplateURL );
-+ }
-+ }
-+ else // not a template
-+ {
-+ long nCur = pTableStream->Tell();
-+ Sttb aSttb;
-+ pTableStream->Seek( pWwFib->fcSttbfAssoc ); // point at tgc record
-+ if (!aSttb.Read( pTableStream ) )
-+ OSL_TRACE("** Read of SttbAssoc data failed!!!! ");
-+ pTableStream->Seek( nCur ); // return to previous position, is that necessary?
-+#if DEBUG
-+ aSttb.Print( stderr );
-+#endif
-+ String sPath = aSttb.getStringAtIndex( 0x1 );
-+ String aURL;
-+ // attempt to convert to url ( won't work for obvious reasons on linux
-+ if ( sPath.Len() )
-+ ::utl::LocalFileHelper::ConvertPhysicalNameToURL( sPath, aURL );
-+ if ( aURL.Len() )
-+ xDocProps->setTemplateURL( aURL );
-+ else
-+ xDocProps->setTemplateURL( sPath );
-+
-+ }
- sfx2::LoadOlePropertySet(xDocProps, pStg);
- }
- }
-@@ -3987,6 +3987,8 @@ ULONG SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
- {
- if (mbNewDoc && pStg && !pGloss) /*meaningless for a glossary, cmc*/
- {
-+
-+ mpDocShell->SetIsTemplate( pWwFib->fDot ); // point at tgc record
- const SvtFilterOptions* pVBAFlags = SvtFilterOptions::Get();
- maTracer.EnterEnvironment(sw::log::eMacros);
- // Create and insert Excel vba Globals
-diff --git sw/source/ui/uno/unotxdoc.cxx sw/source/ui/uno/unotxdoc.cxx
-index fc3b8b9..356efaf 100644
---- sw/source/ui/uno/unotxdoc.cxx
-+++ sw/source/ui/uno/unotxdoc.cxx
-@@ -2147,6 +2147,9 @@ Any SwXTextDocument::getPropertyValue(const OUString& rPropertyName)
- Any aAny;
- switch(pMap->nWID)
- {
-+ case WID_DOC_ISTEMPLATEID :
-+ aAny <<= pDocShell->IsTemplate();
-+ break;
- case WID_DOC_CHAR_COUNT :
- case WID_DOC_PARA_COUNT :
- case WID_DOC_WORD_COUNT :
-diff --git sw/source/ui/vba/makefile.mk sw/source/ui/vba/makefile.mk
-index e789fde..42a9bbc 100644
---- sw/source/ui/vba/makefile.mk
-+++ sw/source/ui/vba/makefile.mk
-@@ -69,6 +69,7 @@ SLOFILES= \
- $(SLO)$/vbapanes.obj \
- $(SLO)$/vbaoptions.obj \
- $(SLO)$/vbaselection.obj \
-+ $(SLO)$/vbatemplate.obj \
-
- # --- Targets ------------------------------------------------------
-
-diff --git sw/source/ui/vba/vbadocument.cxx sw/source/ui/vba/vbadocument.cxx
-index c6b1c25..9e9fdc4 100644
---- sw/source/ui/vba/vbadocument.cxx
-+++ sw/source/ui/vba/vbadocument.cxx
-@@ -35,8 +35,12 @@
- #include "vbavariables.hxx"
- #include <com/sun/star/text/XBookmarksSupplier.hpp>
- #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
-+#include <com/sun/star/document/XDocumentInfoSupplier.hpp>
- #include <com/sun/star/document/XDocumentProperties.hpp>
- #include <vbahelper/helperdecl.hxx>
-+#include <wordvbahelper.hxx>
-+#include <docsh.hxx>
-+#include "vbatemplate.hxx"
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-@@ -161,6 +165,25 @@ SwVbaDocument::getServiceImplName()
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaDocument") );
- return sImplName;
- }
-+uno::Any SAL_CALL
-+SwVbaDocument::getAttachedTemplate() throw (uno::RuntimeException)
-+{
-+ SwDocShell* pDocShell = word::getDocShell( getModel() );
-+ uno::Reference< word::XTemplate > xTemplate;
-+ uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( getModel(), uno::UNO_QUERY_THROW );
-+ uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW );
-+ uno::Reference< document::XDocumentProperties > xDocProps( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW );
-+ rtl::OUString sTemplateName = xDocProps->getTemplateName();
-+
-+ xTemplate = new SwVbaTemplate( this, mxContext, getModel(), sTemplateName );
-+ return uno::makeAny( xTemplate );
-+}
-+
-+void SAL_CALL
-+SwVbaDocument::setAttachedTemplate( const css::uno::Any& _attachedtemplate ) throw (uno::RuntimeException)
-+{
-+ throw uno::RuntimeException();
-+}
-
- uno::Sequence< rtl::OUString >
- SwVbaDocument::getServiceNames()
-diff --git sw/source/ui/vba/vbadocument.hxx sw/source/ui/vba/vbadocument.hxx
-index 0f696ce..a82503b 100644
---- sw/source/ui/vba/vbadocument.hxx
-+++ sw/source/ui/vba/vbadocument.hxx
-@@ -55,6 +55,9 @@ public:
- virtual css::uno::Any SAL_CALL CustomDocumentProperties( const css::uno::Any& index ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Bookmarks( const css::uno::Any& rIndex ) throw ( css::uno::RuntimeException );
- virtual css::uno::Any SAL_CALL Variables( const css::uno::Any& rIndex ) throw ( css::uno::RuntimeException );
-+ virtual css::uno::Any SAL_CALL getAttachedTemplate() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setAttachedTemplate( const css::uno::Any& _attachedtemplate ) throw (css::uno::RuntimeException);
-+
-
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
-diff --git sw/source/ui/vba/vbatemplate.cxx sw/source/ui/vba/vbatemplate.cxx
-new file mode 100644
-index 0000000..11c1a59
---- /dev/null
-+++ sw/source/ui/vba/vbatemplate.cxx
-@@ -0,0 +1,70 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbatemplate.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include "wordvbahelper.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaTemplate::SwVbaTemplate( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& rModel, const rtl::OUString& rName )
-+ : SwVbaTemplate_BASE( rParent, rContext ), mxModel( rModel ), msName( rName )
-+{
-+}
-+
-+
-+SwVbaTemplate::~SwVbaTemplate()
-+{
-+}
-+
-+rtl::OUString
-+SwVbaTemplate::getName() throw ( css::uno::RuntimeException )
-+{
-+ return msName;
-+}
-+rtl::OUString&
-+SwVbaTemplate::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaTemplate") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaTemplate::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Template" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbatemplate.hxx sw/source/ui/vba/vbatemplate.hxx
-new file mode 100644
-index 0000000..63a2f26
---- /dev/null
-+++ sw/source/ui/vba/vbatemplate.hxx
-@@ -0,0 +1,54 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_TEMPLATE_HXX
-+#define SW_VBA_TEMPLATE_HXX
-+
-+#include <ooo/vba/word/XTemplate.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XTemplate > SwVbaTemplate_BASE;
-+
-+class SwVbaTemplate : public SwVbaTemplate_BASE
-+{
-+private:
-+ css::uno::Reference< css::frame::XModel > mxModel;
-+ rtl::OUString msName;
-+public:
-+ SwVbaTemplate( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext,
-+ const css::uno::Reference< css::frame::XModel >& rModel, const rtl::OUString& );
-+ virtual ~SwVbaTemplate();
-+
-+ // XTemplate
-+ virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_TEMPLATE_HXX */
-diff --git sfx2/source/doc/objcont.cxx sfx2/source/doc/objcont.cxx
-index 3d1668b..9bb525f 100644
---- sfx2/source/doc/objcont.cxx
-+++ sfx2/source/doc/objcont.cxx
-@@ -1471,31 +1471,35 @@ sal_Bool SfxObjectShell::IsHelpDocument() const
-
- void SfxObjectShell::ResetFromTemplate( const String& rTemplateName, const String& rFileName )
- {
-- uno::Reference<document::XDocumentProperties> xDocProps(getDocProperties());
-- xDocProps->setTemplateURL( ::rtl::OUString() );
-- xDocProps->setTemplateName( ::rtl::OUString() );
-- xDocProps->setTemplateDate( util::DateTime() );
-- xDocProps->resetUserData( ::rtl::OUString() );
--
-- // TODO/REFACTOR:
-- // Title?
--
-- if( ::utl::LocalFileHelper::IsLocalFile( rFileName ) )
-- {
-- String aFoundName;
-- if( SFX_APP()->Get_Impl()->GetDocumentTemplates()->GetFull( String(), rTemplateName, aFoundName ) )
-- {
-- INetURLObject aObj( rFileName );
-- xDocProps->setTemplateURL( aObj.GetMainURL(INetURLObject::DECODE_TO_IURI) );
-- xDocProps->setTemplateName( rTemplateName );
--
-- ::DateTime now;
-- xDocProps->setTemplateDate( util::DateTime(
-- now.Get100Sec(), now.GetSec(), now.GetMin(),
-- now.GetHour(), now.GetDay(), now.GetMonth(),
-- now.GetYear() ) );
--
-- SetQueryLoadTemplate( sal_True );
-+ // only care about reseting this data for openoffice formats otherwise
-+ if ( IsOwnStorageFormat_Impl( *GetMedium()) )
-+ {
-+ uno::Reference<document::XDocumentProperties> xDocProps(getDocProperties());
-+ xDocProps->setTemplateURL( ::rtl::OUString() );
-+ xDocProps->setTemplateName( ::rtl::OUString() );
-+ xDocProps->setTemplateDate( util::DateTime() );
-+ xDocProps->resetUserData( ::rtl::OUString() );
-+
-+ // TODO/REFACTOR:
-+ // Title?
-+
-+ if( ::utl::LocalFileHelper::IsLocalFile( rFileName ) )
-+ {
-+ String aFoundName;
-+ if( SFX_APP()->Get_Impl()->GetDocumentTemplates()->GetFull( String(), rTemplateName, aFoundName ) )
-+ {
-+ INetURLObject aObj( rFileName );
-+ xDocProps->setTemplateURL( aObj.GetMainURL(INetURLObject::DECODE_TO_IURI) );
-+ xDocProps->setTemplateName( rTemplateName );
-+
-+ ::DateTime now;
-+ xDocProps->setTemplateDate( util::DateTime(
-+ now.Get100Sec(), now.GetSec(), now.GetMin(),
-+ now.GetHour(), now.GetDay(), now.GetMonth(),
-+ now.GetYear() ) );
-+
-+ SetQueryLoadTemplate( sal_True );
-+ }
- }
- }
- }
diff --git a/patches/vba/vba-testclient-fix-project.diff b/patches/vba/vba-testclient-fix-project.diff
deleted file mode 100644
index 88d80b33c..000000000
--- a/patches/vba/vba-testclient-fix-project.diff
+++ /dev/null
@@ -1,23 +0,0 @@
-diff --git sc/source/ui/vba/testvba/testvba.cxx sc/source/ui/vba/testvba/testvba.cxx
-index b25997e..efb74b2 100644
---- sc/source/ui/vba/testvba/testvba.cxx
-+++ sc/source/ui/vba/testvba/testvba.cxx
-@@ -159,15 +159,15 @@ mxCompLoader( _xCompLoader ), msOutDirPath( convertToURL( _outDirPath ) )
- Reference< script::provider::XScript > xScript;
- try
- {
-- xScript = xProv->getScript( rtl::OUString::createFromAscii( "vnd.sun.star.script:Standard.TestMacros.Main?language=Basic&location=document" ));
-+ xScript = xProv->getScript( rtl::OUString::createFromAscii( "vnd.sun.star.script:VBAProject.TestMacros.Main?language=Basic&location=document" ));
- } catch ( uno::Exception& e )
- {
- try
- {
-- xScript = xProv->getScript( rtl::OUString::createFromAscii( "vnd.sun.star.script:Standard.testMacro.Main?language=Basic&location=document" ));
-+ xScript = xProv->getScript( rtl::OUString::createFromAscii( "vnd.sun.star.script:VBAProject.testMacro.Main?language=Basic&location=document" ));
- } catch ( uno::Exception& e2 )
- {
-- xScript = xProv->getScript( rtl::OUString::createFromAscii( "vnd.sun.star.script:Standard.testMain.Main?language=Basic&location=document" ));
-+ xScript = xProv->getScript( rtl::OUString::createFromAscii( "vnd.sun.star.script:VBAProject.testMain.Main?language=Basic&location=document" ));
- }
- }
- OSL_TRACE("Got script for doc %s", rtl::OUStringToOString( sUrl, RTL_TEXTENCODING_UTF8 ).getStr() );
diff --git a/patches/vba/vba-thiscomponent-fix.diff b/patches/vba/vba-thiscomponent-fix.diff
deleted file mode 100644
index 610d31a7e..000000000
--- a/patches/vba/vba-thiscomponent-fix.diff
+++ /dev/null
@@ -1,58 +0,0 @@
-diff --git sc/source/ui/unoobj/docuno.cxx sc/source/ui/unoobj/docuno.cxx
-index b621d90..9570e22 100644
---- sc/source/ui/unoobj/docuno.cxx
-+++ sc/source/ui/unoobj/docuno.cxx
-@@ -105,6 +105,8 @@
- using namespace com::sun::star;
- using namespace com::sun::star::document::VbaEventId;
-
-+#define SC_UNO_VBADOCOBJ "ThisVBADocObj" // perhaps we want to actually make this ThisWorkbook ?
-+
- //------------------------------------------------------------------------
-
- // alles ohne Which-ID, Map nur fuer PropertySetInfo
-@@ -119,6 +121,7 @@ const SfxItemPropertyMapEntry* lcl_GetDocOptPropertyMap()
- {MAP_CHAR_LEN(SC_UNO_AUTOCONTFOC), 0, &getBooleanCppuType(), 0, 0},
- {MAP_CHAR_LEN(SC_UNO_BASICLIBRARIES), 0, &getCppuType((uno::Reference< script::XLibraryContainer >*)0), beans::PropertyAttribute::READONLY, 0},
- {MAP_CHAR_LEN(SC_UNO_DIALOGLIBRARIES), 0, &getCppuType((uno::Reference< script::XLibraryContainer >*)0), beans::PropertyAttribute::READONLY, 0},
-+ {MAP_CHAR_LEN(SC_UNO_VBADOCOBJ), 0, &getCppuType((beans::PropertyValue*)0), beans::PropertyAttribute::READONLY, 0},
- {MAP_CHAR_LEN(SC_UNO_CALCASSHOWN), PROP_UNO_CALCASSHOWN, &getBooleanCppuType(), 0, 0},
- {MAP_CHAR_LEN(SC_UNONAME_CLOCAL), 0, &getCppuType((lang::Locale*)0), 0, 0},
- {MAP_CHAR_LEN(SC_UNO_CJK_CLOCAL), 0, &getCppuType((lang::Locale*)0), 0, 0},
-@@ -1581,6 +1584,18 @@ uno::Any SAL_CALL ScModelObj::getPropertyValue( const rtl::OUString& aPropertyNa
- {
- aRet <<= pDocShell->GetDialogContainer();
- }
-+ else if ( aString.EqualsAscii( SC_UNO_VBADOCOBJ ) )
-+ {
-+ // PropertyValue seems extreme because we store
-+ // the model ( as the value member ) of the PropertyValue that is
-+ // itself a property of the model ( the intention however is to
-+ // store something like a Workbook object... but we don't do that )
-+ // yet
-+ beans::PropertyValue aProp;
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ThisExcelDoc") );
-+ aProp.Value <<= pDocShell->GetModel();
-+ aRet <<= aProp;
-+ }
- else if ( aString.EqualsAscii( SC_UNO_RUNTIMEUID ) )
- {
- aRet <<= getRuntimeUID();
-diff --git sfx2/source/doc/objxtor.cxx sfx2/source/doc/objxtor.cxx
-index e267793..fb43eaf 100644
---- sfx2/source/doc/objxtor.cxx
-+++ sfx2/source/doc/objxtor.cxx
-@@ -147,6 +147,13 @@ void lcl_UpdateAppBasicDocVars( const Reference< XInterface >& _rxComponent, bo
- {
- try
- {
-+ // ThisVBADocObj contains a PropertyValue
-+ // Name is ( the name of the VBA global to insert )
-+ // Value is the Object to insert.
-+ // ( note: at the moment the Value is actually the model so
-+ // it strictly is not necessary, however we do intend to store
-+ // not the model in basic but a custom object, so we keep this
-+ // level of indirection for future proofing )
- beans::PropertyValue aProp;
- xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ThisVBADocObj") ) ) >>= aProp;
- rtl::OString sTmp( rtl::OUStringToOString( aProp.Name, RTL_TEXTENCODING_UTF8 ) );
diff --git a/patches/vba/vba-toolbar-menu-support.diff b/patches/vba/vba-toolbar-menu-support.diff
deleted file mode 100644
index 09dc19624..000000000
--- a/patches/vba/vba-toolbar-menu-support.diff
+++ /dev/null
@@ -1,1469 +0,0 @@
-diff --git framework/inc/uielement/generictoolbarcontroller.hxx framework/inc/uielement/generictoolbarcontroller.hxx
-index 316c60d..377b685 100644
---- framework/inc/uielement/generictoolbarcontroller.hxx
-+++ framework/inc/uielement/generictoolbarcontroller.hxx
-@@ -37,6 +37,9 @@
-
- #include <svtools/toolboxcontroller.hxx>
- #include <vcl/toolbox.hxx>
-+#include <memory>
-+
-+class PopupMenu;
-
- namespace framework
- {
-@@ -64,7 +67,7 @@ class GenericToolbarController : public svt::ToolboxController
-
- DECL_STATIC_LINK( GenericToolbarController, ExecuteHdl_Impl, ExecuteInfo* );
-
-- private:
-+ protected:
- ToolBox* m_pToolbar;
- sal_uInt16 m_nID;
- sal_Bool m_bEnumCommand : 1,
-@@ -72,6 +75,28 @@ class GenericToolbarController : public svt::ToolboxController
- rtl::OUString m_aEnumCommand;
- };
-
-+class MenuToolbarController : public GenericToolbarController
-+{
-+ com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > m_xMenuDesc;
-+ PopupMenu* pMenu;
-+ com::sun::star::uno::Reference< com::sun::star::lang::XComponent > m_xMenuManager;
-+ rtl::OUString m_aModuleIdentifier;
-+ public:
-+ MenuToolbarController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager,
-+ const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame,
-+ ToolBox* pToolBar,
-+ USHORT nID,
-+ const rtl::OUString& aCommand,
-+ const rtl::OUString& aModuleIdentifier,
-+ const com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess >& xMenuDesc );
-+
-+ ~MenuToolbarController();
-+ // XToolbarController
-+ virtual void SAL_CALL click() throw ( ::com::sun::star::uno::RuntimeException );
-+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException);
-+
-+};
-+
- }
-
- #endif // __FRAMEWORK_UIELEMENT_GENERICTOOLBARCONTROLLER_HXX_
-diff --git framework/inc/uielement/toolbarmanager.hxx framework/inc/uielement/toolbarmanager.hxx
-index 9f1c2cd..3bdb284 100644
---- framework/inc/uielement/toolbarmanager.hxx
-+++ framework/inc/uielement/toolbarmanager.hxx
-@@ -50,6 +50,7 @@
- #include <com/sun/star/lang/XComponent.hpp>
- #include <com/sun/star/container/XIndexAccess.hpp>
- #include <com/sun/star/container/XNameAccess.hpp>
-+#include <com/sun/star/container/XIndexContainer.hpp>
- #include <com/sun/star/frame/XModuleManager.hpp>
- #include <com/sun/star/lang/XMultiServiceFactory.hpp>
- #include <com/sun/star/frame/XUIControllerRegistration.hpp>
-@@ -200,6 +201,7 @@ class ToolBarManager : public ::com::sun::star::frame::XFrameActionListener
- typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XSubToolbarController > > SubToolBarControllerVector;
- typedef BaseHash< SubToolBarControllerVector > SubToolBarToSubToolBarControllerMap;
-
-+ typedef ::std::hash_map< sal_uInt16, ::com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > > MenuDescriptionMap;
- sal_Bool m_bDisposed : 1,
- m_bIsHiContrast : 1,
- m_bSmallSymbols : 1,
-@@ -229,6 +231,7 @@ class ToolBarManager : public ::com::sun::star::frame::XFrameActionListener
- SubToolBarToSubToolBarControllerMap m_aSubToolBarControllerMap;
- Timer m_aAsyncUpdateControllersTimer;
- sal_Int16 m_nSymbolsStyle;
-+ MenuDescriptionMap m_aMenuMap;
- };
-
- }
-diff --git framework/inc/xml/menuconfiguration.hxx framework/inc/xml/menuconfiguration.hxx
-index cff0e8d..f24994b 100644
---- framework/inc/xml/menuconfiguration.hxx
-+++ framework/inc/xml/menuconfiguration.hxx
-@@ -85,6 +85,7 @@ class MenuConfiguration
- ::rtl::OUString aTargetFrame;
- ::rtl::OUString aImageId;
- ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XDispatchProvider > xDispatchProvider;
-+ sal_Int16 nStyle;
- };
-
- MenuConfiguration(
-diff --git framework/source/uielement/generictoolbarcontroller.cxx framework/source/uielement/generictoolbarcontroller.cxx
-index 311776c..0a6d929 100644
---- framework/source/uielement/generictoolbarcontroller.cxx
-+++ framework/source/uielement/generictoolbarcontroller.cxx
-@@ -68,6 +68,9 @@
- #include <classes/fwkresid.hxx>
- #include <dispatch/uieventloghelper.hxx>
-
-+#include <xml/menuconfiguration.hxx>
-+#include <uielement/menubarmanager.hxx>
-+
- using namespace ::com::sun::star::awt;
- using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::beans;
-@@ -75,6 +78,7 @@ using namespace ::com::sun::star::lang;
- using namespace ::com::sun::star::frame;
- using namespace ::com::sun::star::frame::status;
- using namespace ::com::sun::star::util;
-+using namespace ::com::sun::star::container;
-
- namespace framework
- {
-@@ -326,5 +330,67 @@ IMPL_STATIC_LINK_NOINSTANCE( GenericToolbarController, ExecuteHdl_Impl, ExecuteI
- return 0;
- }
-
-+MenuToolbarController::MenuToolbarController( const Reference< XMultiServiceFactory >& rServiceManager, const Reference< XFrame >& rFrame, ToolBox* pToolBar, USHORT nID, const rtl::OUString& aCommand, const rtl::OUString& aModuleIdentifier, const Reference< XIndexAccess >& xMenuDesc ) : GenericToolbarController( rServiceManager, rFrame, pToolBar, nID, aCommand ), m_xMenuDesc( xMenuDesc ), pMenu( NULL ), m_aModuleIdentifier( aModuleIdentifier )
-+{
-+}
-+
-+MenuToolbarController::~MenuToolbarController()
-+{
-+ try
-+ {
-+ if ( m_xMenuManager.is() )
-+ m_xMenuManager->dispose();
-+ }
-+ catch( Exception& ) {}
-+ if ( pMenu )
-+ {
-+ delete pMenu;
-+ pMenu = NULL;
-+ }
-+
-+}
-+
-+class Toolbarmenu : public PopupMenu
-+{
-+ public:
-+ Toolbarmenu();
-+ ~Toolbarmenu();
-+};
-+
-+Toolbarmenu::Toolbarmenu()
-+{
-+ OSL_TRACE("**** contstructing Toolbarmenu 0x%x", this );
-+}
-+
-+Toolbarmenu::~Toolbarmenu()
-+{
-+ OSL_TRACE("**** destructing Toolbarmenu 0x%x", this );
-+}
-+
-+void SAL_CALL MenuToolbarController::click() throw (RuntimeException)
-+{
-+ createPopupWindow();
-+}
-+
-+Reference< XWindow > SAL_CALL
-+MenuToolbarController::createPopupWindow() throw (::com::sun::star::uno::RuntimeException)
-+{
-+ if ( !pMenu )
-+ {
-+ Reference< XDispatchProvider > xDispatch;
-+ Reference< XURLTransformer > xURLTransformer( m_xServiceManager->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), UNO_QUERY );
-+ pMenu = new Toolbarmenu();
-+ m_xMenuManager.set( new MenuBarManager( m_xServiceManager, m_xFrame, xURLTransformer, xDispatch, m_aModuleIdentifier, pMenu, sal_True, sal_True ) );
-+ if ( m_xMenuManager.is() )
-+ {
-+ MenuBarManager* pMgr = dynamic_cast< MenuBarManager* >( m_xMenuManager.get() );
-+ pMgr->SetItemContainer( m_xMenuDesc );
-+ }
-+ }
-+
-+ ::Rectangle aRect( m_pToolbar->GetItemRect( m_nID ) );
-+ pMenu->Execute( m_pToolbar, aRect, POPUPMENU_EXECUTE_DOWN );
-+ return NULL;
-+}
- } // namespace
-
-diff --git framework/source/uielement/menubarmanager.cxx framework/source/uielement/menubarmanager.cxx
-index f1add0d..0b4620d 100644
---- framework/source/uielement/menubarmanager.cxx
-+++ framework/source/uielement/menubarmanager.cxx
-@@ -74,6 +74,7 @@
- #include <com/sun/star/frame/XModuleManager.hpp>
- #include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
- #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
-+#include <com/sun/star/ui/ItemStyle.hpp>
- #include <com/sun/star/frame/status/Visibility.hpp>
-
- //_________________________________________________________________________________________________________________
-@@ -136,6 +137,7 @@ static const char ITEM_DESCRIPTOR_LABEL[] = "Label";
- static const char ITEM_DESCRIPTOR_TYPE[] = "Type";
- static const char ITEM_DESCRIPTOR_MODULEIDENTIFIER[] = "ModuleIdentifier";
- static const char ITEM_DESCRIPTOR_DISPATCHPROVIDER[] = "DispatchProvider";
-+static const char ITEM_DESCRIPTOR_STYLE[] = "Style";
-
- const sal_Int32 LEN_DESCRIPTOR_COMMANDURL = 10;
- const sal_Int32 LEN_DESCRIPTOR_HELPURL = 7;
-@@ -144,6 +146,7 @@ const sal_Int32 LEN_DESCRIPTOR_LABEL = 5;
- const sal_Int32 LEN_DESCRIPTOR_TYPE = 4;
- const sal_Int32 LEN_DESCRIPTOR_MODULEIDENTIFIER = 16;
- const sal_Int32 LEN_DESCRIPTOR_DISPATCHPROVIDER = 16;
-+static const sal_Int32 ITEM_DESCRIPTOR_STYLE_LEN = 5;
-
- const sal_uInt16 ADDONMENU_MERGE_ITEMID_START = 1500;
-
-@@ -1327,6 +1330,11 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF
- Reference< XDispatch > xDispatch;
- Reference< XStatusListener > xStatusListener;
- PopupMenu* pPopup = pMenu->GetPopupMenu( nItemId );
-+ bool bItemShowMenuImages = m_bShowMenuImages;
-+ MenuItemBits nBits = pMenu->GetItemBits( nItemId );
-+ // overwrite the show icons on menu option?
-+ if ( nBits )
-+ bItemShowMenuImages = ( ( nBits & MIB_ICON ) == MIB_ICON );
- if ( pPopup )
- {
- // Retrieve module identifier from Help Command entry
-@@ -1422,7 +1430,7 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF
- pSubMenuManager->m_aMenuItemCommand = ::rtl::OUString();
-
- // Set image for the addon popup menu item
-- if ( m_bShowMenuImages && !pPopup->GetItemImage( ITEMID_ADDONLIST ))
-+ if ( bItemShowMenuImages && !pPopup->GetItemImage( ITEMID_ADDONLIST ))
- {
- Reference< XFrame > xTemp( rFrame );
- Image aImage = GetImageFromURL( xTemp, aItemCommand, FALSE, m_bWasHiContrast );
-@@ -1441,7 +1449,7 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF
- }
- else if ( pMenu->GetItemType( i ) != MENUITEM_SEPARATOR )
- {
-- if ( m_bShowMenuImages )
-+ if ( bItemShowMenuImages )
- {
- if ( AddonMenuManager::IsAddonMenuId( nItemId ))
- {
-@@ -1752,7 +1760,7 @@ void MenuBarManager::FillMenu(
- sal_uInt16 nType = 0;
- Reference< XIndexAccess > xIndexContainer;
- Reference< XDispatchProvider > xDispatchProvider( rDispatchProvider );
--
-+ sal_Int16 nStyle = 0;
- try
- {
- if ( rItemContainer->getByIndex( n ) >>= aProp )
-@@ -1781,6 +1789,8 @@ void MenuBarManager::FillMenu(
- else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_DISPATCHPROVIDER,
- LEN_DESCRIPTOR_DISPATCHPROVIDER ))
- aProp[i].Value >>= xDispatchProvider;
-+ else if ( aProp[i].Name.equalsAsciiL( ITEM_DESCRIPTOR_STYLE, ITEM_DESCRIPTOR_STYLE_LEN ))
-+ aProp[i].Value >>= nStyle;
- }
-
- if ( nType == ::com::sun::star::ui::ItemType::DEFAULT )
-@@ -1791,7 +1801,15 @@ void MenuBarManager::FillMenu(
- sal_Int32 nHelpId = aHelpURL.toInt32();
- if ( nHelpId > 0 )
- pMenu->SetHelpId( nId, (USHORT)nHelpId );
--
-+ if ( nStyle )
-+ {
-+ MenuItemBits nBits = pMenu->GetItemBits( nId );
-+ if ( nStyle & ::com::sun::star::ui::ItemStyle::ICON )
-+ nBits |= MIB_ICON;
-+ if ( nStyle & ::com::sun::star::ui::ItemStyle::TEXT )
-+ nBits |= MIB_TEXT;
-+ pMenu->SetItemBits( nId, nBits );
-+ }
- if ( xIndexContainer.is() )
- {
- PopupMenu* pNewPopupMenu = new PopupMenu;
-diff --git framework/source/uielement/toolbarmanager.cxx framework/source/uielement/toolbarmanager.cxx
-index b8e268f..7b74c20 100644
---- framework/source/uielement/toolbarmanager.cxx
-+++ framework/source/uielement/toolbarmanager.cxx
-@@ -71,7 +71,6 @@
- #include <com/sun/star/lang/XMultiComponentFactory.hpp>
- #include <com/sun/star/frame/XModuleManager.hpp>
- #include <com/sun/star/ui/XUIElementSettings.hpp>
--#include <com/sun/star/container/XIndexContainer.hpp>
- #include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
- #include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
- #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
-@@ -986,8 +985,13 @@ void ToolBarManager::CreateControllers()
- }
- else
- {
-- xController = Reference< XStatusListener >(
-- new GenericToolbarController( m_xServiceManager, m_xFrame, m_pToolBar, nId, aCommandURL ));
-+ MenuDescriptionMap::iterator it = m_aMenuMap.find( nId );
-+ if ( it == m_aMenuMap.end() )
-+ xController = Reference< XStatusListener >(
-+ new GenericToolbarController( m_xServiceManager, m_xFrame, m_pToolBar, nId, aCommandURL ));
-+ else
-+ xController = Reference< XStatusListener >(
-+ new MenuToolbarController( m_xServiceManager, m_xFrame, m_pToolBar, nId, aCommandURL, m_aModuleIdentifier, m_aMenuMap[ nId ] ));
- }
- }
- else if ( pController )
-@@ -1119,6 +1123,10 @@ sal_uInt16 ToolBarManager::ConvertStyleToToolboxItemBits( sal_Int32 nStyle )
- nItemBits |= TIB_REPEAT;
- if ( nStyle & ::com::sun::star::ui::ItemStyle::DROPDOWN_ONLY )
- nItemBits |= TIB_DROPDOWNONLY;
-+ if ( nStyle & ::com::sun::star::ui::ItemStyle::TEXT )
-+ nItemBits |= TIB_TEXT_ONLY;
-+ if ( nStyle & ::com::sun::star::ui::ItemStyle::ICON )
-+ nItemBits |= TIB_ICON_ONLY;
-
- return nItemBits;
- }
-@@ -1184,6 +1192,8 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine
- m_aControllerMap.clear();
- m_aCommandMap.clear();
-
-+ m_aMenuMap.clear();
-+
- CommandInfo aCmdInfo;
- for ( sal_Int32 n = 0; n < rItemContainer->getCount(); n++ )
- {
-@@ -1197,6 +1207,7 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine
- sal_Bool bIsVisible( sal_True );
- sal_uInt32 nStyle( 0 );
-
-+ Reference< XIndexAccess > aMenuDesc;
- try
- {
- if ( rItemContainer->getByIndex( n ) >>= aProp )
-@@ -1219,6 +1230,8 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine
- aProp[i].Value >>= nWidth;
- else if ( aProp[i].Name.equalsAsciiL( ITEM_DESCRIPTOR_STYLE, ITEM_DESCRIPTOR_STYLE_LEN ))
- aProp[i].Value >>= nStyle;
-+ else if ( aProp[i].Name.equalsAsciiL( ITEM_DESCRIPTOR_CONTAINER, ITEM_DESCRIPTOR_CONTAINER_LEN ))
-+ aProp[i].Value >>= aMenuDesc;
- }
-
- if (( nType == ::com::sun::star::ui::ItemType::DEFAULT ) && ( aCommandURL.getLength() > 0 ))
-@@ -1226,7 +1239,8 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine
- ::rtl::OUString aString( RetrieveLabelFromCommand( aCommandURL ));
-
- sal_uInt16 nItemBits = ConvertStyleToToolboxItemBits( nStyle );
-- OSL_TRACE("** style for command url %s is 0x%x", rtl::OUStringToOString( aCommandURL, RTL_TEXTENCODING_UTF8 ).getStr(), nItemBits );
-+ if ( aMenuDesc.is() )
-+ m_aMenuMap[ nId ] = aMenuDesc;
- m_pToolBar->InsertItem( nId, aString, nItemBits );
- m_pToolBar->SetItemCommand( nId, aCommandURL );
- if ( aTooltip.getLength() )
-diff --git offapi/com/sun/star/ui/ItemStyle.idl offapi/com/sun/star/ui/ItemStyle.idl
-index 1243c67..5728b4a 100644
---- offapi/com/sun/star/ui/ItemStyle.idl
-+++ offapi/com/sun/star/ui/ItemStyle.idl
-@@ -149,6 +149,7 @@ constants ItemStyle
- <p>This style is only valid if the item describes a toolbar item.</p>
- */
- const short DROPDOWN_ONLY = 1024;
-+ const short TEXT = 2048;
- };
-
- }; }; }; };
-diff --git sc/source/filter/excel/excimp8.cxx sc/source/filter/excel/excimp8.cxx
-index 28771cb..c06fcc4 100644
---- sc/source/filter/excel/excimp8.cxx
-+++ sc/source/filter/excel/excimp8.cxx
-@@ -306,7 +306,7 @@ void ImportExcel8::ReadBasic( void )
- uno::Any aModel = uno::makeAny( pShell->GetModel() );
- pAppMgr->SetGlobalUNOConstant( "ThisExcelDoc", aModel );
- }
--#if 0
-+#if 1
- // see if we have the XCB stream
- SvStorageStreamRef xXCB = xRootStrg->OpenSotStream( String( RTL_CONSTASCII_USTRINGPARAM( "XCB" ) ), STREAM_STD_READ | STREAM_NOCREATE );
- if ( xXCB.Is()|| SVSTREAM_OK == xXCB->GetError() )
-diff --git sc/source/filter/excel/xltoolbar.cxx sc/source/filter/excel/xltoolbar.cxx
-index 6591539..b7eacb1 100644
---- sc/source/filter/excel/xltoolbar.cxx
-+++ sc/source/filter/excel/xltoolbar.cxx
-@@ -122,16 +122,32 @@ void CTB::Print( FILE* fp )
- }
- }
-
--bool CTB::ImportCustomToolBar( CustomToolBarImportHelper& helper )
-+bool CTB::IsMenuToolbar()
- {
-+ return tb.IsMenuToolbar();
-+}
-+
-+bool CTB::ImportMenuTB( CTBWrapper& rWrapper, const css::uno::Reference< css::container::XIndexContainer >& xMenuDesc, CustomToolBarImportHelper& helper )
-+{
-+ sal_Int32 index = 0;
-+ for ( std::vector< TBC >::iterator it = rTBC.begin(); it != rTBC.end(); ++it, ++index )
-+ {
-+ if ( !it->ImportToolBarControl( rWrapper, xMenuDesc, helper, IsMenuToolbar() ) )
-+ return false;
-+ }
-+ return true;
-+}
-+
-+bool CTB::ImportCustomToolBar( CTBWrapper& rWrapper, CustomToolBarImportHelper& helper )
-+{
-+
- static rtl::OUString sToolbarPrefix( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/custom_" ) );
- bool bRes = false;
- try
- {
-- // #Fixme same issue here as in word, some deleted data
-- // seems to still exist
- if ( !tb.IsEnabled() )
- return true; // didn't fail, just ignoring
-+
- // Create default setting
- uno::Reference< container::XIndexContainer > xIndexContainer( helper.getCfgManager()->createSettings(), uno::UNO_QUERY_THROW );
- uno::Reference< container::XIndexAccess > xIndexAccess( xIndexContainer, uno::UNO_QUERY_THROW );
-@@ -143,8 +159,7 @@ bool CTB::ImportCustomToolBar( CustomToolBarImportHelper& helper )
- rtl::OUString sToolBarName = sToolbarPrefix.concat( name.getString() );
- for ( std::vector< TBC >::iterator it = rTBC.begin(); it != rTBC.end(); ++it )
- {
-- // createToolBar item for control
-- if ( !it->ImportToolBarControl( xIndexContainer, helper ) )
-+ if ( !it->ImportToolBarControl( rWrapper, xIndexContainer, helper, IsMenuToolbar() ) )
- return false;
- }
-
-@@ -152,12 +167,13 @@ bool CTB::ImportCustomToolBar( CustomToolBarImportHelper& helper )
-
- helper.getCfgManager()->insertSettings( sToolBarName, xIndexAccess );
- helper.applyIcons();
--
-+#if 0
- uno::Reference< ui::XUIConfigurationPersistence > xPersistence( helper.getCfgManager()->getImageManager(), uno::UNO_QUERY_THROW );
- xPersistence->store();
-
- xPersistence.set( helper.getCfgManager(), uno::UNO_QUERY_THROW );
- xPersistence->store();
-+#endif
-
- bRes = true;
- }
-@@ -233,7 +249,7 @@ TBC::Print(FILE* fp)
- tbcd->Print( fp );
- }
-
--bool TBC::ImportToolBarControl( const css::uno::Reference< css::container::XIndexContainer >& toolbarcontainer, CustomToolBarImportHelper& helper )
-+bool TBC::ImportToolBarControl( CTBWrapper& rWrapper, const css::uno::Reference< css::container::XIndexContainer >& toolbarcontainer, CustomToolBarImportHelper& helper, bool bIsMenuToolbar )
- {
- // how to identify built-in-command ?
- // bool bBuiltin = false;
-@@ -256,8 +272,31 @@ bool TBC::ImportToolBarControl( const css::uno::Reference< css::container::XInde
- }
- */
- bool bBeginGroup = false;
-- if ( ! tbcd->ImportToolBarControl( toolbarcontainer, helper, props, bBeginGroup ) )
-+ if ( ! tbcd->ImportToolBarControl( helper, props, bBeginGroup, bIsMenuToolbar ) )
- return false;
-+ TBCMenuSpecific* pMenu = tbcd->getMenuSpecific();
-+ if ( pMenu )
-+ {
-+ // search for CTB with the appropriate name ( it contains the
-+ // menu items, although we cannot import ( or create ) a menu on
-+ // a custom toolbar we can import the menu items in a separate
-+ // toolbar ( better than nothing )
-+ CTB* pCustTB = rWrapper.GetCustomizationData( pMenu->Name() );
-+ if ( pCustTB )
-+ {
-+ uno::Reference< container::XIndexContainer > xMenuDesc;
-+ uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+ xMenuDesc.set( xMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.IndexedPropertyValues" ) ) ), uno::UNO_QUERY_THROW );
-+ if ( !pCustTB->ImportMenuTB( rWrapper, xMenuDesc, helper ) )
-+ return false;
-+ OSL_TRACE("*** Read menu, no. items is %d", xMenuDesc->getCount() );
-+ beans::PropertyValue aProp;
-+
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ItemDescriptorContainer") );
-+ aProp.Value <<= xMenuDesc;
-+ props.push_back( aProp );
-+ }
-+ }
-
- if ( bBeginGroup )
- {
-@@ -346,6 +385,20 @@ CTBWrapper::Print( FILE* fp )
- }
- }
-
-+CTB* CTBWrapper::GetCustomizationData( const rtl::OUString& sTBName )
-+{
-+ CTB* pCTB = NULL;
-+ for ( std::vector< CTB >::iterator it = rCTB.begin(); it != rCTB.end(); ++it )
-+ {
-+ if ( it->GetName().equals( sTBName ) )
-+ {
-+ pCTB = &(*it);
-+ break;
-+ }
-+ }
-+ return pCTB;
-+}
-+
- bool CTBWrapper::ImportCustomToolBar( SfxObjectShell& rDocSh )
- {
- std::vector<CTB>::iterator it_end = rCTB.end();
-@@ -356,8 +409,17 @@ bool CTBWrapper::ImportCustomToolBar( SfxObjectShell& rDocSh )
- uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xAppCfgSupp( xMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.ModuleUIConfigurationManagerSupplier" ) ) ), uno::UNO_QUERY_THROW );
- CustomToolBarImportHelper helper( rDocSh, xAppCfgSupp->getUIConfigurationManager( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.SpreadsheetDocument" ) ) ) );
- helper.setMSOCommandMap( new MSOExcelCommandConvertor() );
-- if ( !(*it).ImportCustomToolBar( helper ) )
-- return false;
-+ // Ignore menu toolbars, excel doesn't ( afaics ) store
-+ // menu customizations ( but you can have menus in a customtoolbar
-+ // such menus will be dealt with when they are encountered
-+ // as part of importing the appropriate MenuSpecific toolbar control )
-+
-+
-+ if ( !(*it).IsMenuToolbar() )
-+ {
-+ if ( !(*it).ImportCustomToolBar( *this, helper ) )
-+ return false;
-+ }
- }
- return true;
- }
-diff --git sc/source/filter/excel/xltoolbar.hxx sc/source/filter/excel/xltoolbar.hxx
-index af986c7..deef46c 100644
---- sc/source/filter/excel/xltoolbar.hxx
-+++ sc/source/filter/excel/xltoolbar.hxx
-@@ -5,6 +5,7 @@
-
- namespace css = ::com::sun::star;
-
-+class CTBWrapper;
- // hmm I don't normally use these packed structures
- // but.. hey always good to do something different
- class TBCCmd : public TBBase
-@@ -31,7 +32,7 @@ public:
- ~TBC(){}
- void Print( FILE* );
- bool Read(SvStream *pS);
-- bool ImportToolBarControl( const com::sun::star::uno::Reference< com::sun::star::container::XIndexContainer >& toolbarcontainer, CustomToolBarImportHelper& helper );
-+ bool ImportToolBarControl( CTBWrapper&, const com::sun::star::uno::Reference< com::sun::star::container::XIndexContainer >& toolbarcontainer, CustomToolBarImportHelper& helper, bool bIsMenuBar );
- };
-
- class CTB : public TBBase
-@@ -41,13 +42,19 @@ class CTB : public TBBase
- std::vector<TBVisualData> rVisualData;
- sal_uInt32 ectbid;
- std::vector< TBC > rTBC;
-+ bool ImportCustomToolBar_Impl( CTBWrapper&, CustomToolBarImportHelper& );
- public:
- CTB();
- CTB(sal_uInt16);
- ~CTB(){}
- void Print( FILE* );
- bool Read(SvStream *pS);
-- bool ImportCustomToolBar( CustomToolBarImportHelper& );
-+ bool IsMenuToolbar();
-+ bool ImportCustomToolBar( CTBWrapper&, CustomToolBarImportHelper& );
-+ bool ImportMenuTB( CTBWrapper&, const css::uno::Reference< css::container::XIndexContainer >&, CustomToolBarImportHelper& );
-+ rtl::OUString GetName() { return tb.getName().getString(); }
-+
-+
- };
-
- class CTBS : public TBBase
-@@ -81,6 +88,7 @@ public:
- bool Read(SvStream *pS);
- void Print( FILE* );
- bool ImportCustomToolBar( SfxObjectShell& rDocSh );
-+ CTB* GetCustomizationData( const rtl::OUString& name );
- };
-
-
-diff --git svx/inc/svx/mstoolbar.hxx svx/inc/svx/mstoolbar.hxx
-index c102ade..01ef608 100644
---- svx/inc/svx/mstoolbar.hxx
-+++ svx/inc/svx/mstoolbar.hxx
-@@ -10,9 +10,11 @@
- #include <com/sun/star/frame/XModel.hpp>
- #include <com/sun/star/container/XIndexContainer.hpp>
- #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
-+#include <com/sun/star/ui/ImageType.hpp>
- #include <com/sun/star/graphic/XGraphic.hpp>
- #include <com/sun/star/beans/XPropertySet.hpp>
- #include <vcl/bitmap.hxx>
-+#include <cppuhelper/implbase1.hxx>
-
- namespace css = ::com::sun::star;
-
-@@ -41,6 +43,7 @@ class SVX_DLLPUBLIC CustomToolBarImportHelper
- css::uno::Reference< css::ui::XUIConfigurationManagerSupplier > m_xCfgSupp;
- css::uno::Reference< css::ui::XUIConfigurationManager > m_xAppCfgMgr;
- SfxObjectShell& mrDocSh;
-+ void ScaleImage( css::uno::Reference< css::graphic::XGraphic >& xGraphic, long nNewSize );
- public:
- CustomToolBarImportHelper( SfxObjectShell& rDocSh, const css::uno::Reference< css::ui::XUIConfigurationManager >& rxAppCfgMgr );
-
-@@ -56,6 +59,7 @@ public:
- rtl::OUString MSOCommandToOOCommand( sal_Int16 msoCmd );
- rtl::OUString MSOTCIDToOOCommand( sal_Int16 msoTCID );
- SfxObjectShell& GetDocShell() { return mrDocSh; }
-+ void showToolbar( const rtl::OUString& rName );
- };
-
- class SVX_DLLPUBLIC TBBase
-@@ -163,6 +167,7 @@ public:
- ~TBCMenuSpecific(){}
- bool Read(SvStream *pS);
- void Print( FILE* );
-+ rtl::OUString Name();
- };
-
- class SVX_DLLPUBLIC TBCCDData : public TBBase
-@@ -268,8 +273,9 @@ public:
- ~TBCData(){}
- bool Read(SvStream *pS);
- void Print( FILE* );
-- bool ImportToolBarControl( const css::uno::Reference< css::container::XIndexContainer >&, CustomToolBarImportHelper&, std::vector< css::beans::PropertyValue >&, bool& bBeginGroup );
-+ bool ImportToolBarControl( CustomToolBarImportHelper&, std::vector< css::beans::PropertyValue >&, bool& bBeginGroup, bool bIsMenuBar );
- TBCGeneralInfo& getGeneralInfo() { return controlGeneralInfo; }
-+ TBCMenuSpecific* getMenuSpecific();
- };
-
- class SVX_DLLPUBLIC TB : public TBBase
-@@ -290,6 +296,7 @@ public:
- sal_Int16 getcCL(){ return cCL; }
- WString& getName(){ return name; }
- bool IsEnabled();
-+ bool IsMenuToolbar(){ return ( ( ltbtr & 0x2000000 ) == 0x2000000 ); }
- bool NeedsPositioning();
- };
-
-@@ -305,6 +312,8 @@ public:
- void Print( FILE* fo );
- };
-
-+typedef cppu::WeakImplHelper1< css::container::XIndexContainer > PropertyValueIndexContainer_BASE;
-+
- class SVX_DLLPUBLIC TBVisualData : public TBBase
- {
- sal_Int8 tbds;
-diff --git svx/source/cui/cfg.cxx svx/source/cui/cfg.cxx
-index 2931be6..80280d3 100644
---- svx/source/cui/cfg.cxx
-+++ svx/source/cui/cfg.cxx
-@@ -5724,7 +5724,7 @@ bool SvxIconSelectorDialog::ReplaceGraphicItem(
- if ( bOK && ((aSize.Width != m_nExpectedSize) || (aSize.Height != m_nExpectedSize)) )
- {
- BitmapEx aBitmap = aImage.GetBitmapEx();
-- BitmapEx aBitmapex = AutoScaleBitmap(aBitmap, m_nExpectedSize);
-+ BitmapEx aBitmapex = BitmapEx::AutoScaleBitmap(aBitmap, m_nExpectedSize);
- aImage = Image( aBitmapex);
- }
- aTbSymbol.InsertItem( nId,aImage, aURL, 0, 0 ); //modify
-@@ -5888,7 +5888,7 @@ bool SvxIconSelectorDialog::ImportGraphic( const OUString& aURL )
- if ( bOK && ((aSize.Width != m_nExpectedSize) || (aSize.Height != m_nExpectedSize)) )
- {
- BitmapEx aBitmap = aImage.GetBitmapEx();
-- BitmapEx aBitmapex = AutoScaleBitmap(aBitmap, m_nExpectedSize);
-+ BitmapEx aBitmapex = BitmapEx::AutoScaleBitmap(aBitmap, m_nExpectedSize);
- aImage = Image( aBitmapex);
- }
- if ( bOK && !!aImage )
-@@ -6004,56 +6004,56 @@ SvxIconChangeDialog::SvxIconChangeDialog(
-
- BitmapEx SvxIconSelectorDialog::AutoScaleBitmap(BitmapEx & aBitmap, const long aStandardSize)
- {
-- Point aEmptyPoint(0,0);
-- sal_Int32 imgNewWidth = 0;
-- sal_Int32 imgNewHeight = 0;
-- double imgposX = 0;
-- double imgposY = 0;
-+ Point aEmptyPoint(0,0);
-+ sal_Int32 imgNewWidth = 0;
-+ sal_Int32 imgNewHeight = 0;
-+ double imgposX = 0;
-+ double imgposY = 0;
- BitmapEx aRet = aBitmap;
-- double imgOldWidth = aRet.GetSizePixel().Width();
-- double imgOldHeight =aRet.GetSizePixel().Height();
-+ double imgOldWidth = aRet.GetSizePixel().Width();
-+ double imgOldHeight =aRet.GetSizePixel().Height();
-
- Size aScaledSize;
- if (imgOldWidth >= aStandardSize || imgOldHeight >= aStandardSize)
-- {
-- if (imgOldWidth >= imgOldHeight)
-- {
-- imgNewWidth = aStandardSize;
-- imgNewHeight = sal_Int32(imgOldHeight / (imgOldWidth / aStandardSize) + 0.5);
-- imgposX = 0;
-- imgposY = (aStandardSize - (imgOldHeight / (imgOldWidth / aStandardSize) + 0.5)) / 2 + 0.5;
-- }
-- else
-- {
-- imgNewHeight = aStandardSize;
-- imgNewWidth = sal_Int32(imgOldWidth / (imgOldHeight / aStandardSize) + 0.5);
-- imgposY = 0;
-- imgposX = (aStandardSize - (imgOldWidth / (imgOldHeight / aStandardSize) + 0.5)) / 2 + 0.5;
-- }
--
-- aScaledSize = Size( imgNewWidth, imgNewHeight );
-+ {
-+ if (imgOldWidth >= imgOldHeight)
-+ {
-+ imgNewWidth = aStandardSize;
-+ imgNewHeight = sal_Int32(imgOldHeight / (imgOldWidth / aStandardSize) + 0.5);
-+ imgposX = 0;
-+ imgposY = (aStandardSize - (imgOldHeight / (imgOldWidth / aStandardSize) + 0.5)) / 2 + 0.5;
-+ }
-+ else
-+ {
-+ imgNewHeight = aStandardSize;
-+ imgNewWidth = sal_Int32(imgOldWidth / (imgOldHeight / aStandardSize) + 0.5);
-+ imgposY = 0;
-+ imgposX = (aStandardSize - (imgOldWidth / (imgOldHeight / aStandardSize) + 0.5)) / 2 + 0.5;
-+ }
-+
-+ aScaledSize = Size( imgNewWidth, imgNewHeight );
- aRet.Scale( aScaledSize, BMP_SCALE_INTERPOLATE );
-- }
-- else
-- {
-- imgposX = (aStandardSize - imgOldWidth) / 2 + 0.5;
-- imgposY = (aStandardSize - imgOldHeight) / 2 + 0.5;
-- }
-+ }
-+ else
-+ {
-+ imgposX = (aStandardSize - imgOldWidth) / 2 + 0.5;
-+ imgposY = (aStandardSize - imgOldHeight) / 2 + 0.5;
-+ }
-
- Size aBmpSize = aRet.GetSizePixel();
- Size aStdSize( aStandardSize, aStandardSize );
- Rectangle aRect(aEmptyPoint, aStdSize );
-
- VirtualDevice aVirDevice( *Application::GetDefaultDevice(), 0, 1 );
-- aVirDevice.SetOutputSizePixel( aStdSize );
-- aVirDevice.SetFillColor( COL_TRANSPARENT );
-+ aVirDevice.SetOutputSizePixel( aStdSize );
-+ aVirDevice.SetFillColor( COL_TRANSPARENT );
- aVirDevice.SetLineColor( COL_TRANSPARENT );
-
- //draw a rect into virDevice
-- aVirDevice.DrawRect( aRect );
-- Point aPointPixel( (long)imgposX, (long)imgposY );
-- aVirDevice.DrawBitmapEx( aPointPixel, aRet );
-- aRet = aVirDevice.GetBitmapEx( aEmptyPoint, aStdSize );
-+ aVirDevice.DrawRect( aRect );
-+ Point aPointPixel( (long)imgposX, (long)imgposY );
-+ aVirDevice.DrawBitmapEx( aPointPixel, aRet );
-+ aRet = aVirDevice.GetBitmapEx( aEmptyPoint, aStdSize );
-
-- return aRet;
-+ return aRet;
- }
-diff --git svx/source/msfilter/mstoolbar.cxx svx/source/msfilter/mstoolbar.cxx
-index 1d5c801..0d45af7 100644
---- svx/source/msfilter/mstoolbar.cxx
-+++ svx/source/msfilter/mstoolbar.cxx
-@@ -4,19 +4,55 @@
- #include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
- #include <com/sun/star/ui/XImageManager.hpp>
- #include <com/sun/star/ui/ItemType.hpp>
-+#include <com/sun/star/ui/ItemStyle.hpp>
-+#include <com/sun/star/frame/XLayoutManager.hpp>
- #include <fstream>
- #include <vcl/graph.hxx>
- #include <vcl/bitmapex.hxx>
-+#include <vcl/image.hxx>
- #include <map>
- #include <sfx2/objsh.hxx>
- #include <basic/basmgr.hxx>
- #include <svtools/filterutils.hxx>
- #include <boost/scoped_array.hpp>
- #include <svx/msvbahelper.hxx>
-+#include <svtools/miscopt.hxx>
-+#include <vcl/svapp.hxx>
-+#include <vcl/window.hxx>
-+
-+using namespace com::sun::star;
-
- int TBBase::nIndent = 0;
-
--using namespace com::sun::star;
-+void CustomToolBarImportHelper::showToolbar( const rtl::OUString& rName )
-+{
-+ try
-+ {
-+ uno::Reference< frame::XController > xCntrller( mrDocSh.GetModel()->getCurrentController(), uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xProps( xCntrller->getFrame(), uno::UNO_QUERY_THROW );
-+ uno::Reference< frame::XLayoutManager > xLayoutMgr( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LayoutManager") ) ), uno::UNO_QUERY_THROW );
-+ xLayoutMgr->showElement( rName );
-+ }
-+ catch( uno::Exception& ) {}
-+}
-+
-+void CustomToolBarImportHelper::ScaleImage( uno::Reference< graphic::XGraphic >& xGraphic, long nNewSize )
-+{
-+ Graphic aGraphic( xGraphic );
-+ Size aSize = aGraphic.GetSizePixel();
-+ if ( aSize.Height() && ( aSize.Height() == aSize.Width() ) )
-+ {
-+ Image aImage( xGraphic );
-+ if ( aSize.Height() != nNewSize )
-+ {
-+ BitmapEx aBitmap = aImage.GetBitmapEx();
-+ BitmapEx aBitmapex = BitmapEx::AutoScaleBitmap(aBitmap, nNewSize );
-+ aImage = Image( aBitmapex);
-+ xGraphic = aImage.GetXGraphic();
-+ }
-+ }
-+}
-+
- void CustomToolBarImportHelper::applyIcons()
- {
- for ( std::vector< iconcontrolitem >::iterator it = iconcommands.begin(); it != iconcommands.end(); ++it )
-@@ -25,14 +61,19 @@ void CustomToolBarImportHelper::applyIcons()
- commands[ 0 ] = it->sCommand;
- uno::Sequence< uno::Reference< graphic::XGraphic > > images(1);
- images[ 0 ] = it->image;
-+
- OSL_TRACE("About to applyIcons for command %s, have image ? %s", rtl::OUStringToOString( commands[ 0 ], RTL_TEXTENCODING_UTF8 ).getStr(), images[ 0 ].is() ? "yes" : "no" );
- uno::Reference< ui::XImageManager > xImageManager( getCfgManager()->getImageManager(), uno::UNO_QUERY_THROW );
-- // 1 seems to work best for MSO images, otherwise they don't get displayed ( I guess the default size
-- // in ooo is different )
-- //xImageManager->insertImages( 1, commands, images ); // #FIXME and scale images based on default icon size
-- xImageManager->replaceImages( 1, commands, images );
-- xImageManager->replaceImages( 2, commands, images );
-- xImageManager->replaceImages( 3, commands, images );
-+ sal_uInt16 nColor = ui::ImageType::COLOR_NORMAL;
-+
-+ Window* topwin = Application::GetActiveTopWindow();
-+ if ( topwin != NULL && topwin->GetDisplayBackground().GetColor().IsDark() )
-+ nColor = css::ui::ImageType::COLOR_HIGHCONTRAST;
-+
-+ ScaleImage( images[ 0 ], 16 );
-+ xImageManager->replaceImages( ui::ImageType::SIZE_DEFAULT | nColor, commands, images );
-+ ScaleImage( images[ 0 ], 26 );
-+ xImageManager->replaceImages( ui::ImageType::SIZE_LARGE | nColor, commands, images );
- }
- }
-
-@@ -196,23 +237,27 @@ bool TBCData::Read(SvStream *pS)
- return true;
- }
-
--bool TBCData::ImportToolBarControl( const css::uno::Reference< css::container::XIndexContainer >& /*toolbarcontainer*/, CustomToolBarImportHelper& helper, std::vector< css::beans::PropertyValue >& props, bool& bBeginGroup )
-+TBCMenuSpecific* TBCData::getMenuSpecific()
-+{
-+ TBCMenuSpecific* pMenu = dynamic_cast< TBCMenuSpecific* >( controlSpecificInfo.get() );
-+ return pMenu;
-+}
-+bool TBCData::ImportToolBarControl( CustomToolBarImportHelper& helper, std::vector< css::beans::PropertyValue >& props, bool& bBeginGroup, bool bIsMenuBar )
- {
-+ sal_uInt16 nStyle = 0;
- bBeginGroup = rHeader.isBeginGroup();
- controlGeneralInfo.ImportToolBarControlData( helper, props );
- beans::PropertyValue aProp;
- aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Visible") ) ;
- aProp.Value = uno::makeAny( rHeader.isVisible() ); // where is the visible attribute stored
--
-+ props.push_back( aProp );
- if ( rHeader.getTct() == 0x01
- || rHeader.getTct() == 0x10 )
- {
- TBCBSpecific* pSpecificInfo = dynamic_cast< TBCBSpecific* >( controlSpecificInfo.get() );
- if ( pSpecificInfo )
- {
-- // if we have a icon then lets set it for the command ( but I
-- // have a nasty suspicion the toolbar actually needs to be set
-- // up ( and added ) before you can asssign an image :-/
-+ // if we have a icon then lets set it for the command
- rtl::OUString sCommand;
- for ( std::vector< css::beans::PropertyValue >::iterator it = props.begin(); it != props.end(); ++it )
- {
-@@ -252,6 +297,32 @@ bool TBCData::ImportToolBarControl( const css::uno::Reference< css::container::X
- }
- }
- }
-+ else if ( rHeader.getTct() == 0x0a )
-+ {
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CommandURL") ) ;
-+ aProp.Value = uno::makeAny( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("private:" ) ) ); // dummy command
-+ nStyle |= ui::ItemStyle::DROP_DOWN;
-+ props.push_back( aProp );
-+ }
-+
-+ short icontext = ( rHeader.getTbct() & 0x03 );
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Style") ) ;
-+ if ( bIsMenuBar )
-+ {
-+ nStyle |= ui::ItemStyle::TEXT;
-+ if ( !icontext || icontext == 0x3 )
-+ // Text And image
-+ nStyle |= ui::ItemStyle::ICON;
-+ }
-+ else
-+ {
-+ if ( ( icontext & 0x02 ) == 0x02 )
-+ nStyle |= ui::ItemStyle::TEXT;
-+ if ( !icontext || ( icontext & 0x03 ) == 0x03 )
-+ nStyle |= ui::ItemStyle::ICON;
-+ }
-+ aProp.Value <<= nStyle;
-+ props.push_back( aProp );
- return true; // just ignore
- }
-
-@@ -391,9 +462,6 @@ TBCGeneralInfo::ImportToolBarControlData( CustomToolBarImportHelper& helper, std
- aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Tooltip") );
- aProp.Value = uno::makeAny( tooltip.getString() );
- sControlData.push_back( aProp );
--
-- // #TODO find out what is the property for tooltip?
-- sControlData.push_back( aProp );
- /*
- aToolbarItem(0).Name = "CommandURL" wstrOnAction
- aToolbarItem(0).Value = Command
-@@ -437,6 +505,13 @@ TBCMenuSpecific::Print( FILE* fp )
-
- }
-
-+rtl::OUString TBCMenuSpecific::Name()
-+{
-+ rtl::OUString aName;
-+ if ( name.get() )
-+ aName = name->getString();
-+ return aName;
-+}
- TBCBSpecific::TBCBSpecific() : bFlags( 0 )
- {
- }
-diff --git sw/source/filter/ww8/ww8toolbar.cxx sw/source/filter/ww8/ww8toolbar.cxx
-index 22581ea..e6b047a 100644
---- sw/source/filter/ww8/ww8toolbar.cxx
-+++ sw/source/filter/ww8/ww8toolbar.cxx
-@@ -15,6 +15,9 @@
- #include <map>
- using namespace com::sun::star;
-
-+// no. of visual data elements in a CTB ( fixed )
-+const short nVisualData = 5;
-+
- typedef std::map< sal_Int16, rtl::OUString > IdToString;
-
- class MSOWordCommandConvertor : public MSOCommandConvertor
-@@ -81,6 +84,20 @@ Customization* CTBWrapper::GetCustomizaton( sal_Int16 index )
- return &rCustomizations[ index ];
- }
-
-+CTB* CTBWrapper::GetCustomizationData( const rtl::OUString& sTBName )
-+{
-+ CTB* pCTB = NULL;
-+ for ( std::vector< Customization >::iterator it = rCustomizations.begin(); it != rCustomizations.end(); ++it )
-+ {
-+ if ( it->GetCustomizationData() && it->GetCustomizationData()->GetName().equals( sTBName ) )
-+ {
-+ pCTB = it->GetCustomizationData();
-+ break;
-+ }
-+ }
-+ return pCTB;
-+}
-+
- bool CTBWrapper::Read( SvStream* pS )
- {
- OSL_TRACE("CTBWrapper::Read() stream pos 0x%x", pS->Tell() );
-@@ -178,14 +195,14 @@ void CTBWrapper::Print( FILE* fp )
-
- bool CTBWrapper::ImportCustomToolBar( SfxObjectShell& rDocSh )
- {
--
- for ( std::vector< Customization >::iterator it = rCustomizations.begin(); it != rCustomizations.end(); ++it )
- {
- uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
- uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xAppCfgSupp( xMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.ModuleUIConfigurationManagerSupplier" ) ) ), uno::UNO_QUERY_THROW );
- CustomToolBarImportHelper helper( rDocSh, xAppCfgSupp->getUIConfigurationManager( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument" ) ) ) );
-- helper.setMSOCommandMap( new MSOWordCommandConvertor() );
-- if ( !(*it).ImportCustomToolBar( helper ) )
-+ helper.setMSOCommandMap( new MSOWordCommandConvertor() );
-+
-+ if ( !(*it).ImportCustomToolBar( *this, helper ) )
- return false;
- }
- return false;
-@@ -263,17 +280,8 @@ void Customization::Print( FILE* fp )
-
- }
-
--bool Customization::ImportMenu( const uno::Reference< container::XIndexContainer >& xIndexContainer, CustomToolBarImportHelper& helper )
-+bool Customization::ImportMenu( CTBWrapper& rWrapper, CustomToolBarImportHelper& helper )
- {
-- if ( !customizationDataCTB.get() )
-- return false;
-- return customizationDataCTB->ImportMenu( xIndexContainer, helper );
--}
--
--bool Customization::ImportCustomToolBar( CustomToolBarImportHelper& helper )
--{
-- if ( bIsDroppedMenuTB )
-- return true; // ignore ( will be processed by the ImportMenu )
- if ( tbidForTBD == 0x25 ) // we can handle in a limited way additions the built-in menu bar
- {
- for ( std::vector< TBDelta >::iterator it = customizationDataTBDelta.begin(); it != customizationDataTBDelta.end(); ++it )
-@@ -287,8 +295,6 @@ bool Customization::ImportCustomToolBar( CustomToolBarImportHelper& helper )
- {
- // currently only support built-in menu
- rtl::OUString sMenuBar( RTL_CONSTASCII_USTRINGPARAM("private:resource/menubar/") );
-- if ( tbidForTBD != 0x25 )
-- return false;
-
- sMenuBar = sMenuBar.concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("menubar") ) );
- // Get menu name
-@@ -329,7 +335,7 @@ bool Customization::ImportCustomToolBar( CustomToolBarImportHelper& helper )
- aPopupMenu[3].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ItemDescriptorContainer") );
- uno::Reference< container::XIndexContainer > xMenuContainer( xSCF->createInstanceWithContext( xContext ), uno::UNO_QUERY_THROW );
- aPopupMenu[3].Value <<= xMenuContainer;
-- if ( !pCust->ImportMenu( xMenuContainer, helper ) )
-+ if ( pCust->customizationDataCTB.get() && !pCust->customizationDataCTB->ImportMenuTB( rWrapper, xMenuContainer, helper ) )
- return false;
- OSL_TRACE("** there are %d menu items on the bar, inserting after that", xIndexContainer->getCount() );
- xIndexContainer->insertByIndex( xIndexContainer->getCount(), uno::makeAny( aPopupMenu ) );
-@@ -338,14 +344,28 @@ bool Customization::ImportCustomToolBar( CustomToolBarImportHelper& helper )
- helper.getCfgManager()->replaceSettings( sMenuBar, uno::Reference< container::XIndexAccess >( xIndexContainer, uno::UNO_QUERY_THROW ) );
- else
- helper.getCfgManager()->insertSettings( sMenuBar, uno::Reference< container::XIndexAccess >( xIndexContainer, uno::UNO_QUERY_THROW ) );
-+ uno::Reference< ui::XUIConfigurationPersistence > xPersistence( helper.getCfgManager(), uno::UNO_QUERY_THROW );
-+ xPersistence->store();
- }
- }
- }
- return true;
- }
-+ return true;
-+}
-+
-+bool Customization::ImportCustomToolBar( CTBWrapper& rWrapper, CustomToolBarImportHelper& helper )
-+{
-+ if ( GetTBIDForTB() == 0x25 )
-+ return ImportMenu( rWrapper, helper );
- if ( !customizationDataCTB.get() )
- return false;
-- return customizationDataCTB->ImportCustomToolBar( helper );
-+ if ( !customizationDataCTB->IsMenuToolbar() )
-+ {
-+ if ( !customizationDataCTB->ImportCustomToolBar( rWrapper, helper ) )
-+ return false;
-+ }
-+ return true;
- }
-
- TBDelta::TBDelta() : doprfatendFlags(0)
-@@ -431,6 +451,12 @@ CTB::~CTB()
- {
- }
-
-+bool CTB::IsMenuToolbar()
-+{
-+ return tb.IsMenuToolbar();
-+}
-+
-+
- bool CTB::Read( SvStream *pS)
- {
- OSL_TRACE("CTB::Read() stream pos 0x%x", pS->Tell() );
-@@ -438,10 +464,14 @@ bool CTB::Read( SvStream *pS)
- if ( !name.Read( pS ) )
- return false;
- *pS >> cbTBData;
-- // sal_Int32 nTBSize = cbTBData - sizeof(rVisualData) - 12;
- if ( !tb.Read( pS ) )
- return false;
-- pS->Read( &rVisualData, sizeof( rVisualData ) );
-+ for ( short index = 0; index < nVisualData; ++index )
-+ {
-+ TBVisualData aVisData;
-+ aVisData.Read( pS );
-+ rVisualData.push_back( aVisData );
-+ }
-
- *pS >> iWCTBl >> reserved >> unused >> cCtls;
-
-@@ -467,6 +497,12 @@ CTB::Print( FILE* fp )
- indent_printf(fp, " cbTBData size, in bytes, of this structure excluding the name, cCtls, and rTBC fields. %x\n", static_cast< unsigned int >( cbTBData ) );
-
- tb.Print(fp);
-+ for ( short counter = 0; counter < nVisualData; ++counter )
-+ {
-+ indent_printf( fp, " TBVisualData [%d]\n", counter);
-+ Indent b;
-+ rVisualData[ counter ].Print( fp );
-+ }
- indent_printf(fp, " iWCTBl 0x%x reserved 0x%x unused 0x%x cCtls( toolbar controls ) 0x%x \n", static_cast< unsigned int >( iWCTBl ), reserved, unused, static_cast< unsigned int >( cCtls ) );
- if ( cCtls )
- {
-@@ -479,18 +515,13 @@ CTB::Print( FILE* fp )
- }
- }
-
--bool CTB::ImportCustomToolBar( CustomToolBarImportHelper& helper )
-+bool CTB::ImportCustomToolBar( CTBWrapper& rWrapper, CustomToolBarImportHelper& helper )
- {
- static rtl::OUString sToolbarPrefix( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/custom_" ) );
- bool bRes = false;
- try
- {
-- // #FIXME this is a bogus check ( but is seems to work )
-- // the fNeedsPositioning seems always to be set for toolbars that
-- // have been deleted ( sofar I fail to find something else to indicate
-- // not to read them ) - e.g. We can have CTB records which relate to
-- // deleted items ( usually associated with popups )
-- if ( !tb.IsEnabled() || tb.NeedsPositioning() )
-+ if ( !tb.IsEnabled() )
- return true; // didn't fail, just ignoring
- // Create default setting
- uno::Reference< container::XIndexContainer > xIndexContainer( helper.getCfgManager()->createSettings(), uno::UNO_QUERY_THROW );
-@@ -504,7 +535,7 @@ bool CTB::ImportCustomToolBar( CustomToolBarImportHelper& helper )
- for ( std::vector< TBC >::iterator it = rTBC.begin(); it != rTBC.end(); ++it )
- {
- // createToolBar item for control
-- if ( !it->ImportToolBarControl( xIndexContainer, helper ) )
-+ if ( !it->ImportToolBarControl( rWrapper, xIndexContainer, helper, IsMenuToolbar() ) )
- return false;
- }
-
-@@ -512,27 +543,29 @@ bool CTB::ImportCustomToolBar( CustomToolBarImportHelper& helper )
-
- helper.getCfgManager()->insertSettings( sToolBarName, xIndexAccess );
- helper.applyIcons();
--
-+#if 1 // don't think this is necessary
- uno::Reference< ui::XUIConfigurationPersistence > xPersistence( helper.getCfgManager()->getImageManager(), uno::UNO_QUERY_THROW );
- xPersistence->store();
--
-+
- xPersistence.set( helper.getCfgManager(), uno::UNO_QUERY_THROW );
- xPersistence->store();
-+#endif
- bRes = true;
- }
-- catch( uno::Exception& )
-+ catch( uno::Exception& e )
- {
-+ OSL_TRACE("***** For some reason we have an exception %s", rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
- bRes = false;
- }
- return bRes;
- }
-
--bool CTB::ImportMenu( const css::uno::Reference< css::container::XIndexContainer >& xIndexContainer, CustomToolBarImportHelper& rHelper )
-+bool CTB::ImportMenuTB( CTBWrapper& rWrapper, const css::uno::Reference< css::container::XIndexContainer >& xIndexContainer, CustomToolBarImportHelper& rHelper )
- {
- for ( std::vector< TBC >::iterator it = rTBC.begin(); it != rTBC.end(); ++it )
- {
- // createToolBar item for control
-- if ( !it->ImportToolBarControl( xIndexContainer, rHelper ) )
-+ if ( !it->ImportToolBarControl( rWrapper, xIndexContainer, rHelper, true ) )
- return false;
- }
- return true;
-@@ -583,7 +616,7 @@ void TBC::Print( FILE* fp )
- }
-
- bool
--TBC::ImportToolBarControl( const css::uno::Reference< css::container::XIndexContainer >& toolbarcontainer, CustomToolBarImportHelper& helper )
-+TBC::ImportToolBarControl( CTBWrapper& rWrapper, const css::uno::Reference< css::container::XIndexContainer >& toolbarcontainer, CustomToolBarImportHelper& helper, bool bIsMenuBar )
- {
- // cmtFci 0x1 Command based on a built-in command. See CidFci.
- // cmtMacro 0x2 Macro command. See CidMacro.
-@@ -634,12 +667,35 @@ TBC::ImportToolBarControl( const css::uno::Reference< css::container::XIndexCont
- aProp.Value <<= sCommand;
- props.push_back( aProp );
- }
--
- }
- bool bBeginGroup = false;
-- if ( ! tbcd->ImportToolBarControl( toolbarcontainer, helper, props, bBeginGroup ) )
-+ if ( ! tbcd->ImportToolBarControl( helper, props, bBeginGroup, bIsMenuBar ) )
- return false;
-
-+ TBCMenuSpecific* pMenu = tbcd->getMenuSpecific();
-+ if ( pMenu )
-+ {
-+ OSL_TRACE("** control has a menu, name of toolbar with menu items is %s", rtl::OUStringToOString( pMenu->Name(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ // search for CTB with the appropriate name ( it contains the
-+ // menu items, although we cannot import ( or create ) a menu on
-+ // a custom toolbar we can import the menu items in a separate
-+ // toolbar ( better than nothing )
-+ CTB* pCustTB = rWrapper.GetCustomizationData( pMenu->Name() );
-+ if ( pCustTB )
-+ {
-+ uno::Reference< container::XIndexContainer > xMenuDesc;
-+ uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+ xMenuDesc.set( xMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.IndexedPropertyValues" ) ) ), uno::UNO_QUERY_THROW );
-+ if ( !pCustTB->ImportMenuTB( rWrapper,xMenuDesc, helper ) )
-+ return false;
-+ beans::PropertyValue aProp;
-+
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ItemDescriptorContainer") );
-+ aProp.Value <<= xMenuDesc;
-+ props.push_back( aProp );
-+ }
-+ }
-+
- if ( bBeginGroup )
- {
- // insert spacer
-diff --git sw/source/filter/ww8/ww8toolbar.hxx sw/source/filter/ww8/ww8toolbar.hxx
-index b533cbf..3dcf2de 100644
---- sw/source/filter/ww8/ww8toolbar.hxx
-+++ sw/source/filter/ww8/ww8toolbar.hxx
-@@ -15,6 +15,7 @@ public:
- void Print( FILE* fp );
- };
-
-+class CTBWrapper;
- class TBC : public TBBase
- {
- TBCHeader tbch;
-@@ -25,7 +26,7 @@ public:
- ~TBC();
- bool Read(SvStream *pS);
- void Print( FILE* );
-- bool ImportToolBarControl( const css::uno::Reference< css::container::XIndexContainer >&, CustomToolBarImportHelper& );
-+ bool ImportToolBarControl( CTBWrapper&, const css::uno::Reference< css::container::XIndexContainer >&, CustomToolBarImportHelper&, bool );
- rtl::OUString GetCustomText();
- };
-
-@@ -34,7 +35,7 @@ class CTB : public TBBase
- Xst name;
- sal_Int32 cbTBData;
- TB tb;
-- sal_uInt8 rVisualData[ 100 ];
-+ std::vector<TBVisualData> rVisualData;
- sal_Int32 iWCTBl;
- sal_uInt16 reserved;
- sal_uInt16 unused;
-@@ -48,8 +49,10 @@ public:
- ~CTB();
- bool Read(SvStream *pS);
- void Print( FILE* fp );
-- bool ImportCustomToolBar( CustomToolBarImportHelper& );
-- bool ImportMenu( const css::uno::Reference< css::container::XIndexContainer >&, CustomToolBarImportHelper& );
-+ bool IsMenuToolbar();
-+ bool ImportCustomToolBar( CTBWrapper&, CustomToolBarImportHelper& );
-+ bool ImportMenuTB( CTBWrapper&, const css::uno::Reference< css::container::XIndexContainer >&, CustomToolBarImportHelper& );
-+ rtl::OUString GetName() { return tb.getName().getString(); }
- };
-
- class TBDelta : public TBBase
-@@ -102,13 +105,16 @@ friend class CTBWrapper;
- boost::shared_ptr< CTB > customizationDataCTB;
- std::vector< TBDelta > customizationDataTBDelta;
- bool bIsDroppedMenuTB;
-+ bool ImportMenu( CTBWrapper&, const css::uno::Reference< css::container::XIndexContainer >&, CustomToolBarImportHelper& );
- public:
- Customization( CTBWrapper* rapper );
- ~Customization();
- bool Read(SvStream *pS);
-- bool ImportCustomToolBar( CustomToolBarImportHelper& );
-- bool ImportMenu( const css::uno::Reference< css::container::XIndexContainer >&, CustomToolBarImportHelper& );
-+ bool ImportCustomToolBar( CTBWrapper&, CustomToolBarImportHelper& );
-+ bool ImportMenu( CTBWrapper&, CustomToolBarImportHelper& );
- void Print( FILE* );
-+ sal_Int32 GetTBIDForTB(){ return tbidForTBD; }
-+ CTB* GetCustomizationData() { return customizationDataCTB.get(); };
- };
-
- class SfxObjectShell;
-@@ -138,7 +144,9 @@ public:
- TBC* GetTBCAtOffset( sal_uInt32 nStreamOffset );
- bool Read(SvStream *pS);
- bool ImportCustomToolBar( SfxObjectShell& rDocSh );
-+
- Customization* GetCustomizaton( sal_Int16 index );
-+ CTB* GetCustomizationData( const rtl::OUString& name );
- void Print( FILE* );
- };
-
-diff --git vcl/inc/vcl/bitmapex.hxx vcl/inc/vcl/bitmapex.hxx
-index 82287c5..1381e55 100644
---- vcl/inc/vcl/bitmapex.hxx
-+++ vcl/inc/vcl/bitmapex.hxx
-@@ -385,6 +385,7 @@ public:
-
- friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const BitmapEx& rBitmapEx );
- friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, BitmapEx& rBitmapEx );
-+ static BitmapEx AutoScaleBitmap(BitmapEx & aBitmap, const long aStandardSize);
- };
-
- #endif // _SV_BITMAPEX_HXX
-diff --git vcl/inc/vcl/menu.hxx vcl/inc/vcl/menu.hxx
-index 4f8ad3a..106080c 100644
---- vcl/inc/vcl/menu.hxx
-+++ vcl/inc/vcl/menu.hxx
-@@ -93,6 +93,8 @@ typedef USHORT MenuItemBits;
- #define MIB_POPUPSELECT ((MenuItemBits)0x0020)
- // not in rsc/vclsrc.hxx because only a prelimitary solution
- #define MIB_NOSELECT ((MenuItemBits)0x0040)
-+#define MIB_ICON ((MenuItemBits)0x0080)
-+#define MIB_TEXT ((MenuItemBits)0x0100)
-
- #define MENU_FLAG_NOAUTOMNEMONICS 0x0001
- #define MENU_FLAG_HIDEDISABLEDENTRIES 0x0002
-diff --git vcl/inc/vcl/toolbox.hxx vcl/inc/vcl/toolbox.hxx
-index 105f9da..b2b27f0 100644
---- vcl/inc/vcl/toolbox.hxx
-+++ vcl/inc/vcl/toolbox.hxx
-@@ -124,6 +124,9 @@ typedef USHORT ToolBoxItemBits;
- #define TIB_DROPDOWN ((ToolBoxItemBits)0x0020)
- #define TIB_REPEAT ((ToolBoxItemBits)0x0040)
- #define TIB_DROPDOWNONLY ((ToolBoxItemBits)0x0080 | TIB_DROPDOWN) // this button has only drop down functionality
-+#define TIB_TEXT_ONLY ((ToolBoxItemBits)0x0100)
-+#define TIB_ICON_ONLY ((ToolBoxItemBits)0x0200)
-+#define TIB_TEXTICON ((ToolBoxItemBits) TIB_TEXT_ONLY | TIB_ICON_ONLY )
-
- // -----------------
- // - ToolBox-Types -
-diff --git vcl/source/gdi/bitmapex.cxx vcl/source/gdi/bitmapex.cxx
-index 1af5b19..aaae40f 100644
---- vcl/source/gdi/bitmapex.cxx
-+++ vcl/source/gdi/bitmapex.cxx
-@@ -47,6 +47,7 @@
- #include <tools/rc.h>
- #endif
- #include <vcl/svapp.hxx>
-+#include <vcl/virdev.hxx>
-
- // ------------
- // - BitmapEx -
-@@ -759,6 +760,61 @@ void BitmapEx::Draw( OutputDevice* pOutDev,
- pOutDev->DrawBitmapEx( rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel, *this );
- }
-
-+BitmapEx BitmapEx:: AutoScaleBitmap(BitmapEx & aBitmap, const long aStandardSize)
-+{
-+ Point aEmptyPoint(0,0);
-+ sal_Int32 imgNewWidth = 0;
-+ sal_Int32 imgNewHeight = 0;
-+ double imgposX = 0;
-+ double imgposY = 0;
-+ BitmapEx aRet = aBitmap;
-+ double imgOldWidth = aRet.GetSizePixel().Width();
-+ double imgOldHeight =aRet.GetSizePixel().Height();
-+
-+ Size aScaledSize;
-+ if (imgOldWidth >= aStandardSize || imgOldHeight >= aStandardSize)
-+ {
-+ if (imgOldWidth >= imgOldHeight)
-+ {
-+ imgNewWidth = aStandardSize;
-+ imgNewHeight = sal_Int32(imgOldHeight / (imgOldWidth / aStandardSize) + 0.5);
-+ imgposX = 0;
-+ imgposY = (aStandardSize - (imgOldHeight / (imgOldWidth / aStandardSize) + 0.5)) / 2 + 0.5;
-+ }
-+ else
-+ {
-+ imgNewHeight = aStandardSize;
-+ imgNewWidth = sal_Int32(imgOldWidth / (imgOldHeight / aStandardSize) + 0.5);
-+ imgposY = 0;
-+ imgposX = (aStandardSize - (imgOldWidth / (imgOldHeight / aStandardSize) + 0.5)) / 2 + 0.5;
-+ }
-+
-+ aScaledSize = Size( imgNewWidth, imgNewHeight );
-+ aRet.Scale( aScaledSize, BMP_SCALE_INTERPOLATE );
-+ }
-+ else
-+ {
-+ imgposX = (aStandardSize - imgOldWidth) / 2 + 0.5;
-+ imgposY = (aStandardSize - imgOldHeight) / 2 + 0.5;
-+ }
-+
-+ Size aBmpSize = aRet.GetSizePixel();
-+ Size aStdSize( aStandardSize, aStandardSize );
-+ Rectangle aRect(aEmptyPoint, aStdSize );
-+
-+ VirtualDevice aVirDevice( *Application::GetDefaultDevice(), 0, 1 );
-+ aVirDevice.SetOutputSizePixel( aStdSize );
-+ aVirDevice.SetFillColor( COL_TRANSPARENT );
-+ aVirDevice.SetLineColor( COL_TRANSPARENT );
-+
-+ //draw a rect into virDevice
-+ aVirDevice.DrawRect( aRect );
-+ Point aPointPixel( (long)imgposX, (long)imgposY );
-+ aVirDevice.DrawBitmapEx( aPointPixel, aRet );
-+ aRet = aVirDevice.GetBitmapEx( aEmptyPoint, aStdSize );
-+
-+ return aRet;
-+}
- // ------------------------------------------------------------------
-
- SvStream& operator<<( SvStream& rOStm, const BitmapEx& rBitmapEx )
-diff --git vcl/source/window/toolbox.cxx vcl/source/window/toolbox.cxx
-index ea27948..904a78e 100644
---- vcl/source/window/toolbox.cxx
-+++ vcl/source/window/toolbox.cxx
-@@ -229,6 +229,22 @@ int ToolBox::ImplGetDragWidth( ToolBox* pThis )
- }
- return width;
- }
-+
-+ButtonType determineButtonType( ImplToolItem* pItem, ButtonType defaultType )
-+{
-+ ButtonType tmpButtonType = defaultType;
-+ ToolBoxItemBits nBits( pItem->mnBits & 0x300 );
-+ if ( nBits & TIB_TEXTICON ) // item has custom setting
-+ {
-+ tmpButtonType = BUTTON_SYMBOLTEXT;
-+ if ( nBits == TIB_TEXT_ONLY )
-+ tmpButtonType = BUTTON_TEXT;
-+ else if ( nBits == TIB_ICON_ONLY )
-+ tmpButtonType = BUTTON_SYMBOL;
-+ }
-+ return tmpButtonType;
-+}
-+
- // -----------------------------------------------------------------------
-
- void ToolBox::ImplUpdateDragArea( ToolBox *pThis )
-@@ -1992,12 +2008,13 @@ BOOL ToolBox::ImplCalcItem()
- bText = FALSE;
- else
- bText = TRUE;
--
-+ ButtonType tmpButtonType = determineButtonType( &(*it), meButtonType ); // default to toolbox setting
- if ( bImage || bText )
- {
-+
- it->mbEmptyBtn = FALSE;
-
-- if ( meButtonType == BUTTON_SYMBOL )
-+ if ( tmpButtonType == BUTTON_SYMBOL )
- {
- // we're drawing images only
- if ( bImage || !bText )
-@@ -2011,7 +2028,7 @@ BOOL ToolBox::ImplCalcItem()
- it->mbVisibleText = TRUE;
- }
- }
-- else if ( meButtonType == BUTTON_TEXT )
-+ else if ( tmpButtonType == BUTTON_TEXT )
- {
- // we're drawing text only
- if ( bText || !bImage )
-@@ -3625,7 +3642,8 @@ void ToolBox::ImplDrawItem( USHORT nPos, BOOL bHighlight, BOOL bPaint, BOOL bLay
- // determine what has to be drawn on the button: image, text or both
- BOOL bImage;
- BOOL bText;
-- pItem->DetermineButtonDrawStyle( meButtonType, bImage, bText );
-+ ButtonType tmpButtonType = determineButtonType( pItem, meButtonType ); // default to toolbox setting
-+ pItem->DetermineButtonDrawStyle( tmpButtonType, bImage, bText );
-
- // compute output values
- long nBtnWidth = aBtnSize.Width()-SMALLBUTTON_HSIZE;
-diff --git vcl/source/window/toolbox2.cxx vcl/source/window/toolbox2.cxx
-index 16d4b42..31e061d 100644
---- vcl/source/window/toolbox2.cxx
-+++ vcl/source/window/toolbox2.cxx
-@@ -59,6 +59,8 @@ using namespace rtl;
-
- #define TB_SEP_SIZE 8
-
-+ButtonType determineButtonType( ImplToolItem* pItem, ButtonType defaultType );
-+
- // -----------------------------------------------------------------------
-
- ImplToolBoxPrivateData::ImplToolBoxPrivateData() :
diff --git a/patches/vba/vba-toolbar-menufilter-core-fix.diff b/patches/vba/vba-toolbar-menufilter-core-fix.diff
deleted file mode 100644
index d683cfec9..000000000
--- a/patches/vba/vba-toolbar-menufilter-core-fix.diff
+++ /dev/null
@@ -1,22 +0,0 @@
-diff --git sw/source/filter/ww8/ww8toolbar.cxx sw/source/filter/ww8/ww8toolbar.cxx
-index facc7a9..216ac28 100644
---- sw/source/filter/ww8/ww8toolbar.cxx
-+++ sw/source/filter/ww8/ww8toolbar.cxx
-@@ -184,7 +184,7 @@ bool Customization::Read( SvStream *pS)
- OSL_TRACE("Custimization::Read() stream pos 0x%x", pS->Tell() );
- nOffSet = pS->Tell();
- *pS >> tbidForTBD >> reserved1 >> ctbds;
-- if ( tbidForTBD && ctbds )
-+ if ( tbidForTBD )
- {
- TBDelta aTBDelta;
- for ( sal_Int32 index = 0; index < ctbds; ++index )
-@@ -972,7 +972,7 @@ Kme::Read(SvStream *pS)
- {
- OSL_TRACE("Kme::Read() stream pos 0x%x", pS->Tell() );
- nOffSet = pS->Tell();
-- *pS >> reserved1 >> reserved2 >> kcm1 >> kcm2 >> param;
-+ *pS >> reserved1 >> reserved2 >> kcm1 >> kcm2 >> kt >> param;
- return true;
- }
-
diff --git a/patches/vba/vba-transient-imported-autotext.diff b/patches/vba/vba-transient-imported-autotext.diff
deleted file mode 100644
index fe8a006ad..000000000
--- a/patches/vba/vba-transient-imported-autotext.diff
+++ /dev/null
@@ -1,543 +0,0 @@
-diff --git sw/inc/docsh.hxx sw/inc/docsh.hxx
-index 9d76217..ac2fb3e 100644
---- sw/inc/docsh.hxx
-+++ sw/inc/docsh.hxx
-@@ -32,6 +32,7 @@
-
- #include <rtl/ref.hxx>
- #include <com/sun/star/frame/XController.hpp>
-+#include <com/sun/star/container/XNamed.hpp>
- #include <vcl/timer.hxx>
- #include <sfx2/docfac.hxx>
- #include <sfx2/objsh.hxx>
-@@ -62,6 +63,12 @@ class IDocumentSettingAccess;
- class IDocumentTimerAccess;
- class IDocumentChartDataProviderAccess;
-
-+class SW_DLLPUBLIC SwImportedAutoText
-+{
-+ std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > > mImportedAutotext;
-+public:
-+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > ImportAutoText( const String& TemplateURL );
-+};
-
- class SW_DLLPUBLIC SwDocShell: public SfxObjectShell, public SfxListener
- {
-@@ -86,6 +93,7 @@ class SW_DLLPUBLIC SwDocShell: public SfxObjectShell, public SfxListener
- sal_Int16 nUpdateDocMode; // contains the com::sun::star::document::UpdateDocMode
- bool bInUpdateFontList; //prevent nested calls of UpdateFontList
- bool bIsATemplate; //prevent nested calls of UpdateFontList
-+ SwImportedAutoText mImportedAutoText;
- // Methoden fuer den Zugriff aufs Doc
- SW_DLLPRIVATE void AddLink();
- SW_DLLPRIVATE void RemoveLink();
-@@ -302,6 +310,7 @@ public:
- SfxInPlaceClient* GetIPClient( const ::svt::EmbeddedObjectRef& xObjRef );
- SW_DLLPRIVATE sal_Bool IsTemplate() { return bIsATemplate; }
- SW_DLLPRIVATE void SetIsTemplate( bool bValue ) { bIsATemplate = bValue; }
-+ SwImportedAutoText& AutoTextImporter(){ return mImportedAutoText; }
- };
-
- class Graphic;
-diff --git sw/inc/unoatxt.hxx sw/inc/unoatxt.hxx
-index e54d4b0..a152f56 100644
---- sw/inc/unoatxt.hxx
-+++ sw/inc/unoatxt.hxx
-@@ -75,9 +75,9 @@ class SwXAutoTextContainer : public cppu::WeakImplHelper3
- ::com::sun::star::container::XIndexAccess
- >
- {
-- SwGlossaries *pGlossaries;
-
- protected:
-+ SwGlossaries *pGlossaries;
- virtual ~SwXAutoTextContainer(); // ref-counted objects are not to be deleted from outside -> protected dtor
-
- public:
-diff --git sw/source/core/swg/SwXMLTextBlocks.cxx sw/source/core/swg/SwXMLTextBlocks.cxx
-index 15e91e7..0386378 100644
---- sw/source/core/swg/SwXMLTextBlocks.cxx
-+++ sw/source/core/swg/SwXMLTextBlocks.cxx
-@@ -92,6 +92,7 @@ SwXMLTextBlocks::SwXMLTextBlocks( const String& rFile )
- try
- {
- refStg = comphelper::OStorageHelper::GetStorageFromURL( rFile, embed::ElementModes::READWRITE );
-+ Touch(); // update creation & modification times ( on slow systems IsFileChanged can fail )
- bReadOnly = FALSE;
- }
- catch( const uno::Exception& )
-diff --git sw/source/ui/app/docsh.cxx sw/source/ui/app/docsh.cxx
-index dd2f32d..87553e4 100644
---- sw/source/ui/app/docsh.cxx
-+++ sw/source/ui/app/docsh.cxx
-@@ -162,6 +162,7 @@
- #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
-
- #include <unomid.h>
-+#include "glosdoc.hxx"
-
- using rtl::OUString;
- using namespace ::com::sun::star;
-@@ -169,6 +170,32 @@ using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::script;
- using namespace ::com::sun::star::container;
-
-+uno::Reference< container::XNamed >
-+SwImportedAutoText::ImportAutoText( const String& sTemplateURL )
-+{
-+ uno::Reference< container::XNamed > xResult;
-+ // see if we already have imported this template
-+ std::vector< uno::Reference< container::XNamed > >::iterator it_end = mImportedAutotext.end();
-+ rtl::OUString sGroupName = SwTransientGlossaries::GetTransientImportedGlossaries().GetGroupName( sTemplateURL );
-+
-+ for ( std::vector< uno::Reference< container::XNamed > >::iterator it = mImportedAutotext.begin(); it != it_end; ++it )
-+ {
-+ if ( (*it)->getName().equals( sGroupName ) )
-+ {
-+ xResult = (*it);
-+ break;
-+ }
-+ }
-+ if ( !xResult.is() )
-+ {
-+ OSL_TRACE("Attempting import of autotext");
-+ xResult =SwTransientGlossaries::GetTransientImportedGlossaries().Import( sTemplateURL );
-+ if ( xResult.is() )
-+ mImportedAutotext.push_back( xResult );
-+ OSL_TRACE("after import of autotext");
-+ }
-+ return xResult;
-+}
-
- SFX_IMPL_INTERFACE( SwDocShell, SfxObjectShell, SW_RES(0) )
- {
-diff --git sw/source/ui/inc/glosdoc.hxx sw/source/ui/inc/glosdoc.hxx
-index 355078b..9a0273c 100644
---- sw/source/ui/inc/glosdoc.hxx
-+++ sw/source/ui/inc/glosdoc.hxx
-@@ -50,7 +50,9 @@ SV_DECL_REF( SwDocShell )
- #define INCLUDED_VECTOR
- #endif
- #include "swdllapi.h"
--
-+#include <osl/mutex.hxx>
-+#include <com/sun/star/container/XNamed.hpp>
-+#include <hash_map>
- typedef ::com::sun::star::uno::WeakReference< ::com::sun::star::text::XAutoTextGroup > AutoTextGroupRef;
- typedef ::std::vector< AutoTextGroupRef > UnoAutoTextGroups;
-
-@@ -62,6 +64,7 @@ typedef ::std::vector< AutoTextEntryRef > UnoAutoTextEntries;
- // CLASS -----------------------------------------------------------------
- class SW_DLLPUBLIC SwGlossaries
- {
-+protected:
- UnoAutoTextGroups m_aGlossaryGroups;
- UnoAutoTextEntries m_aGlossaryEntries;
-
-@@ -71,6 +74,7 @@ class SW_DLLPUBLIC SwGlossaries
- SvStrings *m_pPathArr;
- SvStrings *m_pGlosArr;
- BOOL m_bError;
-+ void UpdateGlosPath(BOOL bFull, const String& rPath );
-
- SW_DLLPRIVATE SwTextBlocks* GetGlosDoc(const String &rName, BOOL bCreate = TRUE) const;
- SW_DLLPRIVATE SvStrings *GetNameList();
-@@ -146,6 +150,26 @@ public:
- inline ULONG IsGlosPathErr() { return m_bError; }
- const SvStrings* GetPathArray() const {return m_pPathArr;}
- };
--
-+typedef std::vector< ::com::sun::star::uno::WeakReference< ::com::sun::star::container::XNamed > > GlossGroups;
-+typedef std::hash_map< rtl::OUString, rtl::OUString, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > StringMap;
-+class SW_DLLPUBLIC SwTransientGlossaries : public SwGlossaries
-+{
-+ SwTransientGlossaries() throw( com::sun::star::uno::RuntimeException );
-+ ~SwTransientGlossaries();
-+ GlossGroups mGroups;
-+ StringMap PathToGroup;
-+ StringMap GroupToPath;
-+ bool findGroupForPath( StringMap::iterator&, String& );
-+ osl::Mutex m_aMutex;
-+public:
-+ com::sun::star::uno::Reference< com::sun::star::container::XNamed > Import( const String& sTemplateURL );
-+ void DeleteGroup( const String& sGroupName );
-+ String GetGroupName( const String& sTemplateURL );
-+ static SwTransientGlossaries& GetTransientImportedGlossaries() throw( com::sun::star::uno::RuntimeException )
-+ {
-+ static SwTransientGlossaries importedGlossaries;
-+ return importedGlossaries;
-+ }
-+};
-
- #endif // _GLOSDOC_HXX
-diff --git sw/source/ui/misc/glosdoc.cxx sw/source/ui/misc/glosdoc.cxx
-index a34c374..0647f87 100644
---- sw/source/ui/misc/glosdoc.cxx
-+++ sw/source/ui/misc/glosdoc.cxx
-@@ -62,6 +62,10 @@
- #ifndef _GLOBALS_HRC
- #include <globals.hrc>
- #endif
-+#include <comphelper/processfactory.hxx>
-+#include <rtl/bootstrap.hxx>
-+#include <svx/acorrcfg.hxx>
-+#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
-
- using namespace ::com::sun::star;
- using namespace ::com::sun::star::uno;
-@@ -487,6 +491,10 @@ void SwGlossaries::UpdateGlosPath(sal_Bool bFull)
- {
- SvtPathOptions aPathOpt;
- String aNewPath( aPathOpt.GetAutoTextPath() );
-+}
-+
-+void SwGlossaries::UpdateGlosPath(sal_Bool bFull, const String& aNewPath )
-+{
- sal_Bool bPathChanged = m_aPath != aNewPath;
- if (bFull || bPathChanged)
- {
-@@ -805,5 +813,183 @@ Reference< text::XAutoTextEntry > SwGlossaries::GetAutoTextEntry( const String&
- return xReturn;
- }
-
-+SwTransientGlossaries::SwTransientGlossaries() throw ( uno::RuntimeException ) : SwGlossaries()
-+{
-+ rtl::OUString sTransientPath = rtl::OUString::createFromAscii("${$BRAND_BASE_DIR/program/") + rtl::OUString::createFromAscii( SAL_CONFIGFILE( "bootstrap" ) ) + rtl::OUString::createFromAscii("::UserInstallation}/user/temp/autotext");
-+
-+ rtl::Bootstrap::expandMacros( sTransientPath );
-+ uno::Reference< lang::XMultiServiceFactory > xMCF( comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+ Reference< ucb::XSimpleFileAccess > xSFA( xMCF->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY_THROW );
-+
-+ if ( !xSFA->exists( sTransientPath ) )
-+ xSFA->createFolder( sTransientPath ); // will throw if is fails
-+
-+ else if ( !xSFA->isFolder( sTransientPath ) )
-+ throw uno::RuntimeException(); // something very wrong, temp/autotext exists but isn't a folder
-+ // ok we have the folder but maybe there is some stale content
-+ // ( after a crash maybe? ) so, attempt to empty it
-+ uno::Sequence< rtl::OUString > sDirEntries = xSFA->getFolderContents( sTransientPath, sal_False );
-+ sal_Int32 nItems = sDirEntries.getLength();
-+ for ( sal_Int32 index = 0; index < nItems; ++index )
-+ {
-+ rtl::OUString sItem( sDirEntries[ index ] );
-+ sal_Int32 nDot = sItem.lastIndexOf('.');
-+ if ( nDot > -1 )
-+ {
-+ rtl::OUString sExt = sDirEntries[ index ].copy( nDot + 1 );
-+ if ( sExt.equalsIgnoreAsciiCase( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("bau") ) ) )
-+ {
-+ try
-+ {
-+ xSFA->kill( sItem );
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+ }
-+ }
-+ }
-+ UpdateGlosPath( true, sTransientPath );
-+}
-+
-+
-+SwTransientGlossaries::~SwTransientGlossaries()
-+{
-+}
-+
-+bool SwTransientGlossaries::findGroupForPath( StringMap::iterator& it, String& sName )
-+{
-+
-+ it = GroupToPath.find( sName );
-+ return ( it != PathToGroup.end() );
-+}
-+
-+String SwTransientGlossaries::GetGroupName( const String& sTemplateURL )
-+{
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ INetURLObject aURL( sTemplateURL );
-+ String sGroupName = aURL.GetLastName();
-+ aURL.CutLastName();
-+ rtl::OUString sPath = aURL.GetURLPath();
-+ StringMap::iterator it = PathToGroup.find( sPath );
-+ if ( it != PathToGroup.end() )
-+ {
-+ // we already have a group for this path
-+ String sName( it->second );
-+ // append delimiter
-+ sName.AppendAscii("*0");
-+ return sName;
-+ }
-+ // create new groupName
-+ sGroupName = sGroupName.GetToken( 0, '.' );
-+ sal_Int32 index = 0;
-+
-+ // we need to do a reverse lookup to ensure that the groupname is
-+ // not already used ( for a different path )
-+ while ( findGroupForPath( it, sGroupName ) )
-+ sGroupName += String::CreateFromInt32( ++index );
-+
-+ PathToGroup[ sPath ] = sGroupName;
-+ GroupToPath[ sGroupName ] = sPath;
-+
-+ sGroupName.AppendAscii("*0");
-+
-+
-+ return sGroupName;
-+}
-+
-+typedef cppu::WeakImplHelper1< container::XNamed > GroupWrapperBASE;
-+Reader* GetWW8Reader();
-+class GroupWrapper : public GroupWrapperBASE
-+{
-+ rtl::OUString msName;
-+public:
-+ GroupWrapper( const rtl::OUString& sName ) : msName( sName )
-+ {
-+ OSL_TRACE(" *** creating GroupWrapper %s", rtl::OUStringToOString( msName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ }
-+ ~GroupWrapper()
-+ {
-+ OSL_TRACE(" *** deleting GroupWrapper %s", rtl::OUStringToOString( msName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ // nothing holding a Group, delete it
-+ SwTransientGlossaries::GetTransientImportedGlossaries().DeleteGroup( msName );
-+ }
-+ virtual ::rtl::OUString SAL_CALL getName() throw (uno::RuntimeException)
-+ {
-+ return msName;
-+ }
-+ virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
-+ {
-+ throw uno::RuntimeException(); // not supported
-+ }
-+};
-
-+void SwTransientGlossaries::DeleteGroup( const String& sGroupName )
-+{
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ StringMap::iterator it = PathToGroup.find( sGroupName );
-+ if ( it != PathToGroup.end() )
-+ PathToGroup.erase( it );
-+ if ( it != GroupToPath.end() )
-+ GroupToPath.erase( it );
-+ DelGroupDoc( sGroupName );
-+}
-+uno::Reference< container::XNamed > SwTransientGlossaries::Import( const String& sTemplateURL )
-+{
-+ ::osl::MutexGuard aGuard( m_aMutex );
-+ uno::Reference< container::XNamed > xRet;
-+ String sGroupName = GetGroupName( sTemplateURL );
-+ OSL_TRACE("** attempt to open %s", rtl::OUStringToOString( sTemplateURL, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ if( sGroupName.Len() )
-+ {
-+ // first see if we have a reference to this
-+ GlossGroups::iterator it_end = mGroups.end();
-+ for( GlossGroups::iterator it = mGroups.begin(); it != it_end; ++it )
-+ {
-+ xRet.set( (*it).get(), uno::UNO_QUERY ) ;
-+ if ( xRet.is() )
-+ {
-+ if ( xRet->getName().equals( sGroupName ) )
-+ {
-+ OSL_TRACE("** Found autotext for %s in cache", rtl::OUStringToOString( sGroupName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ return xRet;
-+ }
-+ }
-+ else
-+ mGroups.erase( it ); // lost reference to the group
-+ }
-+ const SfxFilter* pFilter = 0;
-+ std::auto_ptr< SfxMedium > pMed( new SfxMedium( sTemplateURL, STREAM_READ, TRUE, 0, 0 ) );
-+ SfxFilterMatcher aMatcher( String::CreateFromAscii("swriter") );
-+ pMed->UseInteractionHandler( FALSE );
-+ if( !aMatcher.GuessFilter( *pMed, &pFilter, FALSE ) )
-+ {
-+ pMed->SetFilter( pFilter );
-+ std::auto_ptr< Reader > pR( ::GetWW8Reader() );
-+ // should test if equal to ascii defined by FILTER_WW8
-+ if ( pR.get() && pFilter->GetUserData() == String( RTL_CONSTASCII_USTRINGPARAM( FILTER_WW8 ) ) )
-+ {
-+ pR->SetFltName( pFilter->GetUserData() );
-+ OSL_TRACE("GroupName is %s", rtl::OUStringToOString( sGroupName, RTL_TEXTENCODING_UTF8 ).getStr() );
-
-+ SwTextBlocks *pGlossary = GetGroupDoc( sGroupName, true );
-+ if( pR.get() && pGlossary )
-+ {
-+ SwReader aReader( *pMed, sTemplateURL );
-+ if( aReader.HasGlossaries( *pR ) )
-+ {
-+ const SvxAutoCorrCfg* pCfg = SvxAutoCorrCfg::Get();
-+ if ( aReader.ReadGlossaries( *pR, *pGlossary, pCfg->IsSaveRelFile() ) )
-+ {
-+ xRet = new GroupWrapper( sGroupName );
-+ mGroups.push_back( xRet ); // cache file and object
-+ }
-+ else
-+ OSL_TRACE("*** Reader says no glossaries!!");
-+ }
-+ }
-+ }
-+ }
-+ }
-+ return xRet;
-+}
-diff --git sw/source/ui/uno/unoatxt.cxx sw/source/ui/uno/unoatxt.cxx
-index 210b784..6d002cd 100644
---- sw/source/ui/uno/unoatxt.cxx
-+++ sw/source/ui/uno/unoatxt.cxx
-@@ -70,7 +70,44 @@
- SV_IMPL_REF ( SwDocShell )
- using namespace ::com::sun::star;
- using ::rtl::OUString;
-+class SwImportedAutoTextContainer : public SwXAutoTextContainer
-+{
-+ virtual ~SwImportedAutoTextContainer();
-+public:
-+ SwImportedAutoTextContainer();
-+};
-+
-+uno::Reference< uno::XInterface > SAL_CALL SwImportedAutoTextContainer_createInstance(
-+ const uno::Reference< lang::XMultiServiceFactory > & ) throw( uno::Exception )
-+{
-+ //the module may not be loaded
-+ ::vos::OGuard aGuard(Application::GetSolarMutex());
-+ SwDLL::Init();
-+ static uno::Reference< uno::XInterface > xAText = (cppu::OWeakObject*)new SwImportedAutoTextContainer();;
-+ return xAText;
-+}
-+
-+uno::Sequence< OUString > SAL_CALL SwImportedAutoTextContainer_getSupportedServiceNames() throw()
-+{
-+ OUString sService( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.ImportedAutoTextContainer"));
-+ const uno::Sequence< OUString > aSeq( &sService, 1 );
-+ return aSeq;
-+}
-+
-+OUString SAL_CALL SwImportedAutoTextContainer_getImplementationName() throw()
-+{
-+ return OUString( RTL_CONSTASCII_USTRINGPARAM("SwImportedAutoTextContainer" ) );
-+}
-
-+SwImportedAutoTextContainer::SwImportedAutoTextContainer()
-+{
-+ pGlossaries = &SwTransientGlossaries::GetTransientImportedGlossaries();
-+}
-+
-+SwImportedAutoTextContainer::~SwImportedAutoTextContainer()
-+{
-+
-+}
- /******************************************************************
- *
- ******************************************************************/
-diff --git sw/source/ui/uno/unofreg.cxx sw/source/ui/uno/unofreg.cxx
-index 50e7709..cdb66d6 100644
---- sw/source/ui/uno/unofreg.cxx
-+++ sw/source/ui/uno/unofreg.cxx
-@@ -119,6 +119,10 @@ extern uno::Sequence< OUString > SAL_CALL SwXAutoTextContainer_getSupportedServi
- extern OUString SAL_CALL SwXAutoTextContainer_getImplementationName() throw();
- extern uno::Reference< uno::XInterface > SAL_CALL SwXAutoTextContainer_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
-
-+extern uno::Sequence< OUString > SAL_CALL SwImportedAutoTextContainer_getSupportedServiceNames() throw();
-+extern OUString SAL_CALL SwImportedAutoTextContainer_getImplementationName() throw();
-+extern uno::Reference< uno::XInterface > SAL_CALL SwImportedAutoTextContainer_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
-+
- extern uno::Sequence< OUString > SAL_CALL SwXModule_getSupportedServiceNames() throw();
- extern OUString SAL_CALL SwXModule_getImplementationName() throw();
- extern uno::Reference< uno::XInterface > SAL_CALL SwXModule_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
-@@ -216,6 +220,8 @@ SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo(
- //API objects
- lcl_uno_writeInfo( pKey, SwXAutoTextContainer_getImplementationName(),
- SwXAutoTextContainer_getSupportedServiceNames() );
-+ lcl_uno_writeInfo( pKey, SwImportedAutoTextContainer_getImplementationName(),
-+ SwImportedAutoTextContainer_getSupportedServiceNames() );
- lcl_uno_writeInfo( pKey, SwXModule_getImplementationName(),
- SwXModule_getSupportedServiceNames() );
- lcl_uno_writeInfo( pKey, SwXMailMerge_getImplementationName(),
-@@ -400,6 +406,15 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
- SwXAutoTextContainer_createInstance,
- SwXAutoTextContainer_getSupportedServiceNames() );
- }
-+ else if( SwImportedAutoTextContainer_getImplementationName().equalsAsciiL(
-+ pImplName, nImplNameLen ) )
-+ {
-+ xFactory = ::cppu::createSingleFactory( xMSF,
-+ SwImportedAutoTextContainer_getImplementationName(),
-+ SwImportedAutoTextContainer_createInstance,
-+ SwImportedAutoTextContainer_getSupportedServiceNames() );
-+ }
-+
- else if( SwXModule_getImplementationName().equalsAsciiL(
- pImplName, nImplNameLen ) )
- {
-diff --git sw/source/ui/vba/vbadocument.cxx sw/source/ui/vba/vbadocument.cxx
-index 1090a8b..f82b69c 100644
---- sw/source/ui/vba/vbadocument.cxx
-+++ sw/source/ui/vba/vbadocument.cxx
-@@ -245,7 +245,7 @@ SwVbaDocument::getAttachedTemplate() throw (uno::RuntimeException)
- uno::Reference< document::XDocumentProperties > xDocProps( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW );
- rtl::OUString sTemplateName = xDocProps->getTemplateName();
-
-- xTemplate = new SwVbaTemplate( this, mxContext, getModel(), sTemplateName );
-+ xTemplate = new SwVbaTemplate( this, mxContext, getModel(), sTemplateName, xDocProps->getTemplateURL() );
- return uno::makeAny( xTemplate );
- }
-
-diff --git sw/source/ui/vba/vbatemplate.cxx sw/source/ui/vba/vbatemplate.cxx
-index 9413428..485a864 100644
---- sw/source/ui/vba/vbatemplate.cxx
-+++ sw/source/ui/vba/vbatemplate.cxx
-@@ -33,12 +33,12 @@
- #include "vbaautotextentry.hxx"
- #include <comphelper/processfactory.hxx>
- #include <com/sun/star/text/XAutoTextContainer.hpp>
--
-+#include <docsh.hxx>
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-
--SwVbaTemplate::SwVbaTemplate( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& rModel, const rtl::OUString& rName )
-- : SwVbaTemplate_BASE( rParent, rContext ), mxModel( rModel ), msName( rName )
-+SwVbaTemplate::SwVbaTemplate( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& rModel, const rtl::OUString& rName, const rtl::OUString& rURL )
-+ : SwVbaTemplate_BASE( rParent, rContext ), mxModel( rModel ), msName( rName ), msURL( rURL )
- {
- }
-
-@@ -57,16 +57,14 @@ uno::Any SAL_CALL
- SwVbaTemplate::AutoTextEntries( const uno::Any& index ) throw (uno::RuntimeException)
- {
- uno::Reference< lang::XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory();
-- uno::Reference< text::XAutoTextContainer > xAutoTextContainer( xMgr->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.AutoTextContainer") ) ), uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XAutoTextContainer > xAutoTextContainer( xMgr->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.ImportedAutoTextContainer") ) ), uno::UNO_QUERY_THROW );
-+
-+ SwDocShell* pDocShell = word::getDocShell( mxModel );
-
-- // the default template is "Normal.dot" in Word.
-- rtl::OUString sGroup( RTL_CONSTASCII_USTRINGPARAM("Normal") );
-- if( sal_Int32 nIndex = msName.lastIndexOf( sal_Unicode('.') ) > 0 )
-- {
-- sGroup = msName.copy( 0, msName.lastIndexOf( sal_Unicode('.') ) );
-- // OSL_TRACE("SwVbaTemplate::AutoTextEntries: %s", rtl::OUStringToOString( sGroup, RTL_TEXTENCODING_UTF8 ).getStr() );
-- }
-+ uno::Reference< container::XNamed > xGroupName( pDocShell->AutoTextImporter().ImportAutoText( msURL ), uno::UNO_QUERY_THROW );
-
-+ rtl::OUString sGroup = xGroupName->getName();
-+
- uno::Reference< container::XIndexAccess > xGroup;
- if( xAutoTextContainer->hasByName( sGroup ) )
- {
-diff --git sw/source/ui/vba/vbatemplate.hxx sw/source/ui/vba/vbatemplate.hxx
-index df8848b..84caaf0 100644
---- sw/source/ui/vba/vbatemplate.hxx
-+++ sw/source/ui/vba/vbatemplate.hxx
-@@ -40,9 +40,10 @@ class SwVbaTemplate : public SwVbaTemplate_BASE
- private:
- css::uno::Reference< css::frame::XModel > mxModel;
- rtl::OUString msName;
-+ rtl::OUString msURL;
- public:
- SwVbaTemplate( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext,
-- const css::uno::Reference< css::frame::XModel >& rModel, const rtl::OUString& );
-+ const css::uno::Reference< css::frame::XModel >& rModel, const rtl::OUString&, const rtl::OUString& );
- virtual ~SwVbaTemplate();
-
- // XTemplate
diff --git a/patches/vba/vba-tweak-errorobj.diff b/patches/vba/vba-tweak-errorobj.diff
deleted file mode 100644
index 4df87145f..000000000
--- a/patches/vba/vba-tweak-errorobj.diff
+++ /dev/null
@@ -1,472 +0,0 @@
-diff --git basic/source/classes/errobject.cxx basic/source/classes/errobject.cxx
-index 4005d85..cbfea31 100644
---- basic/source/classes/errobject.cxx
-+++ basic/source/classes/errobject.cxx
-@@ -16,7 +16,7 @@ class ErrObject : public ErrObjectImpl_BASE
- {
- rtl::OUString m_sHelpFile;
- rtl::OUString m_sSource;
-- rtl::OUString m_sDescription;
-+ rtl::OUString m_sDescription;
- sal_Int32 m_nNumber;
- sal_Int32 m_nHelpContext;
-
-@@ -40,6 +40,10 @@ public:
- virtual void SAL_CALL Raise( const uno::Any& Number, const uno::Any& Source, const uno::Any& Description, const uno::Any& HelpFile, const uno::Any& HelpContext ) throw (uno::RuntimeException);
- // XDefaultProperty
- virtual ::rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (uno::RuntimeException);
-+
-+ // Helper method
-+ void setData( const uno::Any& Number, const uno::Any& Source, const uno::Any& Description,
-+ const uno::Any& HelpFile, const uno::Any& HelpContext ) throw (uno::RuntimeException);
- };
-
-
-@@ -60,9 +64,9 @@ ErrObject::getNumber() throw (uno::RuntimeException)
- void SAL_CALL
- ErrObject::setNumber( ::sal_Int32 _number ) throw (uno::RuntimeException)
- {
-- m_nNumber = _number;
--
--
-+ pINST->setErrorVB( _number, String() );
-+ ::rtl::OUString _description = pINST->GetErrorMsg();
-+ setData( uno::makeAny( _number ), uno::Any(), uno::makeAny( _description ), uno::Any(), uno::Any() );
- }
-
- ::sal_Int32 SAL_CALL
-@@ -126,20 +130,9 @@ ErrObject::Clear( ) throw (uno::RuntimeException)
- void SAL_CALL
- ErrObject::Raise( const uno::Any& Number, const uno::Any& Source, const uno::Any& Description, const uno::Any& HelpFile, const uno::Any& HelpContext ) throw (uno::RuntimeException)
- {
-- if ( !Number.hasValue() )
-- throw uno::RuntimeException( rtl::OUString::createFromAscii("Missing Required Paramater"), uno::Reference< uno::XInterface >() );
-- Description >>= m_sDescription;
-- Source >>= m_sSource;
-- HelpFile >>= m_sHelpFile;
-- HelpContext >>= m_nHelpContext;
-- Number >>= m_nNumber;
-+ setData( Number, Source, Description, HelpFile, HelpContext );
- if ( m_nNumber )
-- {
-- SbError n = StarBASIC::GetSfxFromVBError( m_nNumber );
-- if ( !n )
-- n = m_nNumber; // force orig number, probably should have a specific table of vb ( localized ) errors
-- pINST->Error( n, m_sDescription );
-- }
-+ pINST->ErrorVB( m_nNumber, m_sDescription );
- }
-
- // XDefaultProperty
-@@ -150,13 +143,30 @@ ErrObject::getDefaultPropertyName( ) throw (uno::RuntimeException)
- return sDfltPropName;
- }
-
-+void ErrObject::setData( const uno::Any& Number, const uno::Any& Source, const uno::Any& Description, const uno::Any& HelpFile, const uno::Any& HelpContext )
-+ throw (uno::RuntimeException)
-+{
-+ if ( !Number.hasValue() )
-+ throw uno::RuntimeException( rtl::OUString::createFromAscii("Missing Required Paramater"), uno::Reference< uno::XInterface >() );
-+ Number >>= m_nNumber;
-+ Description >>= m_sDescription;
-+ Source >>= m_sSource;
-+ HelpFile >>= m_sHelpFile;
-+ HelpContext >>= m_nHelpContext;
-+}
-+
- // SbxErrObject
--SbxErrObject::SbxErrObject( const String& rName, const Any& rUnoObj ): SbUnoObject( rName, rUnoObj )
-+SbxErrObject::SbxErrObject( const String& rName, const Any& rUnoObj )
-+ : SbUnoObject( rName, rUnoObj )
-+ , m_pErrObject( NULL )
- {
- OSL_TRACE("SbxErrObject::SbxErrObject ctor");
- rUnoObj >>= m_xErr;
- if ( m_xErr.is() )
-+ {
- SetDfltProperty( uno::Reference< script::XDefaultProperty >( m_xErr, uno::UNO_QUERY_THROW )->getDefaultPropertyName() ) ;
-+ m_pErrObject = static_cast< ErrObject* >( m_xErr.get() );
-+ }
- }
-
- SbxErrObject::~SbxErrObject()
-@@ -179,3 +189,10 @@ SbxErrObject::getErrObject()
- return pGlobErr;
- }
-
-+void SbxErrObject::setNumberAndDescription( ::sal_Int32 _number, const ::rtl::OUString& _description )
-+ throw (uno::RuntimeException)
-+{
-+ if( m_pErrObject != NULL )
-+ m_pErrObject->setData( uno::makeAny( _number ), uno::Any(), uno::makeAny( _description ), uno::Any(), uno::Any() );
-+}
-+
-diff --git basic/source/classes/sb.cxx basic/source/classes/sb.cxx
-index 1525d0b..73f5c26 100644
---- basic/source/classes/sb.cxx
-+++ basic/source/classes/sb.cxx
-@@ -55,6 +55,7 @@
- #include "sb.hrc"
- #include <basrid.hxx>
- #include <vos/mutex.hxx>
-+#include "errobject.hxx"
-
- #include <com/sun/star/script/ModuleType.hpp>
- #include <com/sun/star/script/ModuleInfo.hpp>
-@@ -1306,6 +1307,7 @@ void StarBASIC::MakeErrorText( SbError nId, const String& aMsg )
- }
- else
- GetSbData()->aErrMsg = String::EmptyString();
-+
- }
-
- BOOL StarBASIC::CError
-@@ -1362,7 +1364,22 @@ BOOL StarBASIC::RTError( SbError code, const String& rMsg, USHORT l, USHORT c1,
-
- // Umsetzung des Codes fuer String-Transport in SFX-Error
- if( rMsg.Len() )
-+ {
-+ // very confusing, even though MakeErrorText sets up the error text
-+ // seems that this is not used ( if rMsg already has content )
-+ // In the case of VBA MakeErrorText also formats the error to be alittle more
-+ // like vba ( adds an error number etc )
-+ if ( SbiRuntime::isVBAEnabled() && ( code == SbERR_BASIC_COMPAT ) )
-+ {
-+ String aTmp = '\'';
-+ aTmp += String::CreateFromInt32( SbxErrObject::getUnoErrObject()->getNumber() );
-+ aTmp += String( RTL_CONSTASCII_USTRINGPARAM("\'\n") );
-+ aTmp += GetSbData()->aErrMsg.Len() ? GetSbData()->aErrMsg : rMsg;
-+ code = (ULONG)*new StringErrorInfo( code, aTmp );
-+ }
-+ else
- code = (ULONG)*new StringErrorInfo( code, String(rMsg) );
-+ }
-
- SetErrorData( code, l, c1, c2 );
- if( GetSbData()->aErrHdl.IsSet() )
-diff --git basic/source/classes/sb.src basic/source/classes/sb.src
-index c9a5e1b..b60500a 100644
---- basic/source/classes/sb.src
-+++ basic/source/classes/sb.src
-@@ -590,8 +590,8 @@ Resource RID_BASIC_START
- };
- String ERRCODE_BASIC_COMPAT & ERRCODE_RES_MASK
- {
-- Text [ de ] = "$(ARG1)." ;
-- Text [ en-US ] = "$(ARG1)." ;
-+ Text [ de ] = "$(ARG1)" ;
-+ Text [ en-US ] = "$(ARG1)" ;
- Text [ x-comment ] = " ";
- };
- };
-diff --git basic/source/inc/errobject.hxx basic/source/inc/errobject.hxx
-index 1a5c044..ae8a740 100644
---- basic/source/inc/errobject.hxx
-+++ basic/source/inc/errobject.hxx
-@@ -6,11 +6,20 @@
-
- class SbxErrObject : public SbUnoObject
- {
-+ class ErrObject* m_pErrObject;
- com::sun::star::uno::Reference< ooo::vba::XErrObject > m_xErr;
-+
- SbxErrObject( const String& aName_, const com::sun::star::uno::Any& aUnoObj_ );
- ~SbxErrObject();
-+
-+ class ErrObject* getImplErrObject( void )
-+ { return m_pErrObject; }
-+
- public:
- static SbxVariableRef getErrObject();
- static com::sun::star::uno::Reference< ooo::vba::XErrObject > getUnoErrObject();
-+
-+ void setNumberAndDescription( ::sal_Int32 _number, const ::rtl::OUString& _description )
-+ throw (com::sun::star::uno::RuntimeException);
- };
- #endif
-diff --git basic/source/inc/runtime.hxx basic/source/inc/runtime.hxx
-index 5363a99..e8176dd 100644
---- basic/source/inc/runtime.hxx
-+++ basic/source/inc/runtime.hxx
-@@ -218,6 +218,8 @@ public:
-
- void Error( SbError ); // trappable Error
- void Error( SbError, const String& rMsg ); // trappable Error mit Message
-+ void ErrorVB( sal_Int32 nVBNumber, const String& rMsg );
-+ void setErrorVB( sal_Int32 nVBNumber, const String& rMsg );
- void FatalError( SbError ); // non-trappable Error
- void FatalError( SbError, const String& ); // non-trappable Error
- void Abort(); // Abbruch mit aktuellem Fehlercode
-@@ -442,10 +444,11 @@ public:
-
- SbiRuntime( SbModule*, SbMethod*, UINT32 );
- ~SbiRuntime();
-- void Error( SbError ); // Fehler setzen, falls != 0
-+ void Error( SbError, bool bVBATranslationAlreadyDone = false ); // Fehler setzen, falls != 0
- void Error( SbError, const String& ); // Fehler setzen, falls != 0
- void FatalError( SbError ); // Fehlerbehandlung=Standard, Fehler setzen
- void FatalError( SbError, const String& ); // Fehlerbehandlung=Standard, Fehler setzen
-+ static sal_Int32 translateErrorToVba( SbError nError, String& rMsg );
- void DumpPCode();
- BOOL Step(); // Einzelschritt (ein Opcode)
- void Stop() { bRun = FALSE; }
-diff --git basic/source/runtime/methods.cxx basic/source/runtime/methods.cxx
-index e33dc9d..b346b9f 100644
---- basic/source/runtime/methods.cxx
-+++ basic/source/runtime/methods.cxx
-@@ -62,6 +62,7 @@
- #else
- #include <osl/file.hxx>
- #endif
-+#include "errobject.hxx"
-
- #ifdef _USE_UNO
- #include <comphelper/processfactory.hxx>
-@@ -266,6 +267,7 @@ RTLFUNC(Error)
- {
- String aErrorMsg;
- SbError nErr = 0L;
-+ INT32 nCode = 0;
- if( rPar.Count() == 1 )
- {
- nErr = StarBASIC::GetErrBasic();
-@@ -273,14 +275,34 @@ RTLFUNC(Error)
- }
- else
- {
-- INT32 nCode = rPar.Get( 1 )->GetLong();
-+ nCode = rPar.Get( 1 )->GetLong();
- if( nCode > 65535L )
- StarBASIC::Error( SbERR_CONVERSION );
- else
- nErr = StarBASIC::GetSfxFromVBError( (USHORT)nCode );
- }
-- pBasic->MakeErrorText( nErr, aErrorMsg );
-- rPar.Get( 0 )->PutString( pBasic->GetErrorText() );
-+
-+ bool bVBA = SbiRuntime::isVBAEnabled();
-+ String tmpErrMsg;
-+ if( bVBA && aErrorMsg.Len() > 0 )
-+ {
-+ tmpErrMsg = aErrorMsg;
-+ }
-+ else
-+ {
-+ pBasic->MakeErrorText( nErr, aErrorMsg );
-+ tmpErrMsg = pBasic->GetErrorText();
-+ }
-+ // If this rtlfunc 'Error' passed a errcode the same as the active Err Objects's
-+ // current err then return the description for the error message if it is set
-+ // ( complicated isn't it ? )
-+ if ( bVBA && rPar.Count() > 1 )
-+ {
-+ com::sun::star::uno::Reference< ooo::vba::XErrObject > xErrObj( SbxErrObject::getUnoErrObject() );
-+ if ( xErrObj.is() && xErrObj->getNumber() == nCode && xErrObj->getDescription().getLength() )
-+ tmpErrMsg = xErrObj->getDescription();
-+ }
-+ rPar.Get( 0 )->PutString( tmpErrMsg );
- }
- }
-
-diff --git basic/source/runtime/props.cxx basic/source/runtime/props.cxx
-index 21fc7c8..a3034c7 100644
---- basic/source/runtime/props.cxx
-+++ basic/source/runtime/props.cxx
-@@ -31,6 +31,7 @@
- #include "runtime.hxx"
- #include "stdobj.hxx"
- #include "rtlproto.hxx"
-+#include "errobject.hxx"
-
-
- // Properties und Methoden legen beim Get (bWrite = FALSE) den Returnwert
-@@ -50,14 +51,21 @@ RTLFUNC(Err)
- (void)pBasic;
- (void)bWrite;
-
-- if( bWrite )
-+ if( SbiRuntime::isVBAEnabled() )
- {
-- INT32 nVal = rPar.Get( 0 )->GetLong();
-- if( nVal <= 65535L )
-- StarBASIC::Error( StarBASIC::GetSfxFromVBError( (USHORT) nVal ) );
-+ rPar.Get( 0 )->PutObject( SbxErrObject::getErrObject() );
- }
- else
-- rPar.Get( 0 )->PutLong( StarBASIC::GetVBErrorCode( StarBASIC::GetErrBasic() ) );
-+ {
-+ if( bWrite )
-+ {
-+ INT32 nVal = rPar.Get( 0 )->GetLong();
-+ if( nVal <= 65535L )
-+ StarBASIC::Error( StarBASIC::GetSfxFromVBError( (USHORT) nVal ) );
-+ }
-+ else
-+ rPar.Get( 0 )->PutLong( StarBASIC::GetVBErrorCode( StarBASIC::GetErrBasic() ) );
-+ }
- }
-
- RTLFUNC(False)
-diff --git basic/source/runtime/runtime.cxx basic/source/runtime/runtime.cxx
-index fc4553e..91d36e4 100644
---- basic/source/runtime/runtime.cxx
-+++ basic/source/runtime/runtime.cxx
-@@ -45,6 +45,8 @@
- #include "sbunoobj.hxx"
- #include "errobject.hxx"
-
-+using namespace ::com::sun::star;
-+
- SbxVariable* getDefaultProp( SbxVariable* pRef );
-
- bool SbiRuntime::isVBAEnabled()
-@@ -444,6 +446,35 @@ void SbiInstance::Error( SbError n, const String& rMsg )
- }
- }
-
-+void SbiInstance::ErrorVB( sal_Int32 nVBNumber, const String& rMsg )
-+{
-+ if( !bWatchMode )
-+ {
-+ SbError n = StarBASIC::GetSfxFromVBError( static_cast< USHORT >( nVBNumber ) );
-+ if ( !n )
-+ n = nVBNumber; // force orig number, probably should have a specific table of vb ( localized ) errors
-+
-+ aErrorMsg = rMsg;
-+ SbiRuntime::translateErrorToVba( n, aErrorMsg );
-+
-+ bool bVBATranslationAlreadyDone = true;
-+ pRun->Error( SbERR_BASIC_COMPAT, bVBATranslationAlreadyDone );
-+ }
-+}
-+
-+void SbiInstance::setErrorVB( sal_Int32 nVBNumber, const String& rMsg )
-+{
-+ SbError n = StarBASIC::GetSfxFromVBError( static_cast< USHORT >( nVBNumber ) );
-+ if( !n )
-+ n = nVBNumber; // force orig number, probably should have a specific table of vb ( localized ) errors
-+
-+ aErrorMsg = rMsg;
-+ SbiRuntime::translateErrorToVba( n, aErrorMsg );
-+
-+ nErr = n;
-+}
-+
-+
- void SbiInstance::FatalError( SbError n )
- {
- pRun->FatalError( n );
-@@ -825,38 +856,21 @@ BOOL SbiRuntime::Step()
- return bRun;
- }
-
--void SbiRuntime::Error( SbError n )
-+void SbiRuntime::Error( SbError n, bool bVBATranslationAlreadyDone )
- {
- if( n )
- {
- nError = n;
-- if ( isVBAEnabled() )
-+ if( isVBAEnabled() && !bVBATranslationAlreadyDone )
- {
- String aMsg = pInst->GetErrorMsg();
-- // If a message is defined use that ( in preference to
-- // the defined one for the error ) NB #TODO
-- // if there is an error defined it more than likely
-- // is not the one you want ( some are the same though )
-- // we really need a new vba compatible error list
-- if ( !aMsg.Len() )
-- {
-- StarBASIC::MakeErrorText( n, aMsg );
-- aMsg = StarBASIC::GetErrorText();
-- if ( !aMsg.Len() ) // no message for err no.
-- // need localized resource here
-- aMsg = String( RTL_CONSTASCII_USTRINGPARAM("Internal Object Error:") );
-- }
-- // no num? most likely then it *is* really a vba err
-- SbxErrObject::getUnoErrObject()->setNumber( ( StarBASIC::GetVBErrorCode( n ) == 0 ) ? n : StarBASIC::GetVBErrorCode( n ) );
-- SbxErrObject::getUnoErrObject()->setDescription( aMsg );
--
-- // prepend an error number to the message.
-- String aTmp = '\'';
-- aTmp += String::CreateFromInt32( SbxErrObject::getUnoErrObject()->getNumber() );
-- aTmp += String( RTL_CONSTASCII_USTRINGPARAM("\'\n") );
-- aTmp += aMsg;
--
-- pInst->aErrorMsg = aTmp;
-+ sal_Int32 nVBAErrorNumber = translateErrorToVba( nError, aMsg );
-+ SbxVariable* pSbxErrObjVar = SbxErrObject::getErrObject();
-+ SbxErrObject* pGlobErr = static_cast< SbxErrObject* >( pSbxErrObjVar );
-+ if( pGlobErr != NULL )
-+ pGlobErr->setNumberAndDescription( nVBAErrorNumber, aMsg );
-+
-+ pInst->aErrorMsg = aMsg;
- nError = SbERR_BASIC_COMPAT;
- }
- }
-@@ -891,6 +905,30 @@ void SbiRuntime::FatalError( SbError _errCode, const String& _details )
- Error( _errCode, _details );
- }
-
-+sal_Int32 SbiRuntime::translateErrorToVba( SbError nError, String& rMsg )
-+{
-+ // If a message is defined use that ( in preference to
-+ // the defined one for the error ) NB #TODO
-+ // if there is an error defined it more than likely
-+ // is not the one you want ( some are the same though )
-+ // we really need a new vba compatible error list
-+ if ( !rMsg.Len() )
-+ {
-+ // TEST, has to be vb here always
-+ SbError nTmp = StarBASIC::GetSfxFromVBError( nError );
-+ DBG_ASSERT( nTmp, "No VB error!" );
-+
-+ StarBASIC::MakeErrorText( nError, rMsg );
-+ rMsg = StarBASIC::GetErrorText();
-+ if ( !rMsg.Len() ) // no message for err no, need localized resource here
-+ rMsg = String( RTL_CONSTASCII_USTRINGPARAM("Internal Object Error:") );
-+ }
-+ // no num? most likely then it *is* really a vba err
-+ USHORT nVBErrorCode = StarBASIC::GetVBErrorCode( nError );
-+ sal_Int32 nVBAErrorNumber = ( nVBErrorCode == 0 ) ? nError : nVBErrorCode;
-+ return nVBAErrorNumber;
-+}
-+
- //////////////////////////////////////////////////////////////////////////
- //
- // Parameter, Locals, Caller
-diff --git basic/source/runtime/stdobj.cxx basic/source/runtime/stdobj.cxx
-index ae51734..96c9ad4 100644
---- basic/source/runtime/stdobj.cxx
-+++ basic/source/runtime/stdobj.cxx
-@@ -33,7 +33,8 @@
- #include <basic/sbstdobj.hxx>
- #include "rtlproto.hxx"
- #include "sbintern.hxx"
--#include "errobject.hxx"
-+
-+#include <hash_map>
-
- // Das nArgs-Feld eines Tabelleneintrags ist wie folgt verschluesselt:
- // Zur Zeit wird davon ausgegangen, dass Properties keine Parameter
-@@ -275,7 +276,7 @@ static Methods aMethods[] = {
- { "EOF", SbxBOOL, 1 | _FUNCTION, RTLNAME(EOF),0 },
- { "Channel", SbxINTEGER, 0,NULL,0 },
- { "Erl", SbxLONG, _ROPROP, RTLNAME( Erl ),0 },
--{ "Err", SbxLONG, _RWPROP, RTLNAME( Err ),0 },
-+{ "Err", SbxVARIANT, _RWPROP, RTLNAME( Err ),0 },
- { "Error", SbxSTRING, 1 | _FUNCTION, RTLNAME( Error ),0 },
- { "code", SbxLONG, 0,NULL,0 },
- { "Exp", SbxDOUBLE, 1 | _FUNCTION, RTLNAME(Exp),0 },
-@@ -767,11 +768,6 @@ SbiStdObject::~SbiStdObject()
-
- SbxVariable* SbiStdObject::Find( const String& rName, SbxClassType t )
- {
-- // #TODO #FIXME hack for substituting ooo-basic Err with vba-ish
-- // ErrObject object
-- static String sErr( RTL_CONSTASCII_USTRINGPARAM("Err") );
-- if ( SbiRuntime::isVBAEnabled() && rName.EqualsIgnoreCaseAscii( sErr ) )
-- return SbxErrObject::getErrObject();
- // Bereits eingetragen?
- SbxVariable* pVar = SbxObject::Find( rName, t );
- if( !pVar )
diff --git a/patches/vba/vba-typename-fix.diff b/patches/vba/vba-typename-fix.diff
deleted file mode 100644
index ca117e864..000000000
--- a/patches/vba/vba-typename-fix.diff
+++ /dev/null
@@ -1,94 +0,0 @@
-diff --git basic/source/runtime/methods.cxx basic/source/runtime/methods.cxx
-index 2c5dab3..5b239a6 100644
---- basic/source/runtime/methods.cxx
-+++ basic/source/runtime/methods.cxx
-@@ -79,7 +79,8 @@
- #include <com/sun/star/io/XStream.hpp>
- #include <com/sun/star/io/XSeekable.hpp>
- #include <com/sun/star/script/XErrorQuery.hpp>
--
-+#include <ooo/vba/XHelperInterface.hpp>
-+#include <com/sun/star/bridge/oleautomation/XAutomationObject.hpp>
- using namespace comphelper;
- using namespace osl;
- using namespace com::sun::star::uno;
-@@ -3670,6 +3671,65 @@ String getBasicTypeName( SbxDataType eType )
- return aRetStr;
- }
-
-+String getObjectTypeName( SbxVariable* pVar )
-+{
-+ rtl::OUString sRet( RTL_CONSTASCII_USTRINGPARAM("Object") );
-+ if ( pVar )
-+ {
-+ SbxBase* pObj = pVar->GetObject();
-+ if( !pObj )
-+ sRet = String( RTL_CONSTASCII_USTRINGPARAM("Nothing") );
-+ else
-+ {
-+ SbUnoObject* pUnoObj = PTR_CAST(SbUnoObject,pVar );
-+ if ( !pUnoObj )
-+ {
-+ if ( SbxBase* pBaseObj = pVar->GetObject() )
-+ pUnoObj = PTR_CAST(SbUnoObject, pBaseObj );
-+ }
-+ if ( pUnoObj )
-+ {
-+ Any aObj = pUnoObj->getUnoAny();
-+ // For upstreaming unless we start to build oovbaapi by default
-+ // we need to get detect the vba-ness of the object in some
-+ // other way
-+ // note: Automation objects do not support XServiceInfo
-+ Reference< XServiceInfo > xServInfo( aObj, UNO_QUERY );
-+ if ( xServInfo.is() )
-+ {
-+ // is this a VBA object ?
-+ Reference< ooo::vba::XHelperInterface > xVBA( aObj, UNO_QUERY );
-+ Sequence< rtl::OUString > sServices = xServInfo->getSupportedServiceNames();
-+ if ( sServices.getLength() )
-+ sRet = sServices[ 0 ];
-+ }
-+ else
-+ {
-+ Reference< com::sun::star::bridge::oleautomation::XAutomationObject > xAutoMation( aObj, UNO_QUERY );
-+ if ( xAutoMation.is() )
-+ {
-+ Reference< XInvocation > xInv( aObj, UNO_QUERY );
-+ if ( xInv.is() )
-+ {
-+ try
-+ {
-+ xInv->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("$GetTypeName") ) ) >>= sRet;
-+ }
-+ catch( Exception& )
-+ {
-+ }
-+ }
-+ }
-+ }
-+ sal_Int32 nDot = sRet.lastIndexOf( '.' );
-+ if ( nDot != -1 && nDot < sRet.getLength() )
-+ sRet = sRet.copy( nDot + 1 );
-+ }
-+ }
-+ }
-+ return sRet;
-+}
-+
- RTLFUNC(TypeName)
- {
- (void)pBasic;
-@@ -3681,7 +3741,12 @@ RTLFUNC(TypeName)
- {
- SbxDataType eType = rPar.Get(1)->GetType();
- BOOL bIsArray = ( ( eType & SbxARRAY ) != 0 );
-- String aRetStr = getBasicTypeName( eType );
-+
-+ String aRetStr;
-+ if ( SbiRuntime::isVBAEnabled() && eType == SbxOBJECT )
-+ aRetStr = getObjectTypeName( rPar.Get(1) );
-+ else
-+ aRetStr = getBasicTypeName( eType );
- if( bIsArray )
- aRetStr.AppendAscii( "()" );
- rPar.Get(0)->PutString( aRetStr );
diff --git a/patches/vba/vba-use-ooxfilter-forcontrols.diff b/patches/vba/vba-use-ooxfilter-forcontrols.diff
deleted file mode 100644
index e537ee4fb..000000000
--- a/patches/vba/vba-use-ooxfilter-forcontrols.diff
+++ /dev/null
@@ -1,615 +0,0 @@
-diff --git oox/inc/oox/ole/simplevbaprojectfilter.hxx oox/inc/oox/ole/simplevbaprojectfilter.hxx
-index 8639db1..a50fb2f 100644
---- oox/inc/oox/ole/simplevbaprojectfilter.hxx
-+++ oox/inc/oox/ole/simplevbaprojectfilter.hxx
-@@ -27,6 +27,7 @@ public:
- explicit SimpleWordVBAProjFilter(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxGlobalFactory );
- private:
-+ virtual bool importDocument() throw();
- virtual ::rtl::OUString implGetImplementationName() const;
- };
- }
-diff --git oox/inc/oox/xls/excelfilter.hxx oox/inc/oox/xls/excelfilter.hxx
-index 72ed636..27956d5 100644
---- oox/inc/oox/xls/excelfilter.hxx
-+++ oox/inc/oox/xls/excelfilter.hxx
-@@ -32,6 +32,7 @@
- #include "oox/core/binaryfilterbase.hxx"
- #include "oox/ole/vbaproject.hxx"
- #include "oox/ole/simplevbaprojectfilter.hxx"
-+#include <com/sun/star/form/XFormComponent.hpp>
-
- namespace oox {
- namespace xls {
-@@ -73,6 +74,7 @@ public:
- virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rDescriptor ) throw( ::com::sun::star::uno::RuntimeException );
-
- private:
-+ bool importFormControl( ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >& rxFormComp, sal_Int32 nStrmPos );
- virtual GraphicHelper* implCreateGraphicHelper() const;
- virtual ::rtl::OUString implGetImplementationName() const;
- };
-@@ -102,6 +104,7 @@ public:
- virtual bool importDocument() throw();
-
- private:
-+ bool importFormControl( ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >& rxFormComp, sal_Int32 nStrmPos );
- virtual GraphicHelper* implCreateGraphicHelper() const;
- virtual ::rtl::OUString implGetImplementationName() const;
- };
-diff --git oox/source/ole/simplevbaprojectfilter.cxx oox/source/ole/simplevbaprojectfilter.cxx
-index 85c1e70..d5255b6 100644
---- oox/source/ole/simplevbaprojectfilter.cxx
-+++ oox/source/ole/simplevbaprojectfilter.cxx
-@@ -1,6 +1,14 @@
- #include "oox/ole/simplevbaprojectfilter.hxx"
- #include "oox/ole/vbaproject.hxx"
- #include "oox/helper/binaryinputstream.hxx"
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <com/sun/star/form/XFormComponent.hpp>
-+#include <com/sun/star/awt/XControlModel.hpp>
-+#include "oox/ole/axcontrol.hxx"
-+
-+#include "properties.hxx"
-+#include "oox/helper/propertymap.hxx"
-+#include "oox/helper/propertyset.hxx"
-
- using ::rtl::OUString;
- using ::com::sun::star::uno::Any;
-@@ -15,6 +23,10 @@ using ::oox::core::BinaryFilterBase;
- using ::oox::core::Relation;
- using ::oox::core::Relations;
- using ::oox::core::XmlFilterBase;
-+using ::com::sun::star::form::XFormComponent;
-+using ::com::sun::star::awt::XControlModel;
-+using ::com::sun::star::beans::XPropertySet;
-+using ::com::sun::star::uno::UNO_QUERY;
-
- namespace oox {
- namespace ole {
-@@ -67,6 +79,53 @@ SimpleWordVBAProjFilter::SimpleWordVBAProjFilter( const ::com::sun::star::uno::R
- {
- }
-
-+bool SimpleWordVBAProjFilter::importDocument() throw()
-+{
-+ Reference< XPropertySet > xProps;
-+ Reference< XFormComponent > rxFormComp;
-+ // Hack to remove msocximex filter for word ocx controls
-+ if ( ( getArgument( CREATE_OUSTRING( "ImportFormControl" ) ) >>= xProps ) && xProps.is() )
-+ {
-+ OUString nPoolName;
-+ xProps->getPropertyValue( CREATE_OUSTRING( "ObjPoolName" ) ) >>= nPoolName;
-+ ::oox::ole::EmbeddedControl aControl( CREATE_OUSTRING( "Unknown" ) );
-+
-+ StorageRef xPoolStrg = openSubStorage( CREATE_OUSTRING( "ObjectPool" ), false );
-+ if ( xPoolStrg.get() && xPoolStrg->isStorage() )
-+ {
-+ StorageRef xObjStrg = xPoolStrg->openSubStorage( nPoolName, false );
-+ if ( xObjStrg.get() && xObjStrg->isStorage() )
-+ {
-+ BinaryXInputStream aNameStream( xObjStrg->openInputStream( CREATE_OUSTRING("\3OCXNAME") ), true );
-+ BinaryXInputStream aInStrm( xObjStrg->openInputStream( CREATE_OUSTRING("contents") ), true );
-+ BinaryXInputStream aClsStrm( xObjStrg->openInputStream( CREATE_OUSTRING("\1CompObj") ), true );
-+ aClsStrm.skip(12);
-+ OUString aStrmClassId = ::oox::ole::OleHelper::importGuid( aClsStrm );
-+
-+ if( ::oox::ole::ControlModelBase* pModel = aControl.createModel( aStrmClassId ).get() )
-+ {
-+ pModel->importBinaryModel( aInStrm );
-+ rxFormComp.set( getGlobalFactory()->createInstance( pModel->getServiceName() ), UNO_QUERY );
-+ Reference< XControlModel > xCtlModel( rxFormComp, UNO_QUERY );
-+ ::oox::ole::ControlConverter aConv( getGraphicHelper() );
-+ aControl.convertProperties( xCtlModel, aConv );
-+ OUString aName = aNameStream.readNulUnicodeArray();
-+ if ( aName.getLength() )
-+ {
-+ PropertyMap aPropMap;
-+ aPropMap.setProperty( PROP_Name, aName );
-+ FormPropertySet aPropSet( xCtlModel );
-+ aPropSet.setProperties( aPropMap );
-+ }
-+ }
-+ }
-+ }
-+ xProps->setPropertyValue( CREATE_OUSTRING( "Control" ), Any( rxFormComp ) );
-+ return rxFormComp.is();
-+ }
-+ return SimpleVBAProjFilter::importDocument();
-+}
-+
- OUString SimpleWordVBAProjFilter::implGetImplementationName() const
- {
- return SimpleWordVBAProjFilter_getImplementationName();
-diff --git oox/source/xls/excelfilter.cxx oox/source/xls/excelfilter.cxx
-index 548245e..a2870b3 100644
---- oox/source/xls/excelfilter.cxx
-+++ oox/source/xls/excelfilter.cxx
-@@ -33,9 +33,11 @@
- #include "oox/xls/stylesbuffer.hxx"
- #include "oox/xls/themebuffer.hxx"
- #include "oox/xls/workbookfragment.hxx"
-+#include "oox/ole/axcontrol.hxx"
- #include "oox/dump/biffdumper.hxx"
- #include "oox/dump/xlsbdumper.hxx"
- #include <com/sun/star/container/XNameContainer.hpp>
-+#include <com/sun/star/awt/XControlModel.hpp>
-
- using ::rtl::OUString;
- using ::com::sun::star::uno::Any;
-@@ -52,6 +54,9 @@ using ::oox::core::Relation;
- using ::oox::core::Relations;
- using ::oox::core::XmlFilterBase;
- using ::oox::drawingml::table::TableStyleListPtr;
-+using ::com::sun::star::form::XFormComponent;
-+using ::com::sun::star::awt::XControlModel;
-+using ::com::sun::star::beans::XPropertySet;
-
- namespace oox {
- namespace xls {
-@@ -266,6 +271,28 @@ SimpleExcelVBAProjFilter::SimpleExcelVBAProjFilter( const Reference< XMultiServi
- {
- }
-
-+bool SimpleExcelVBAProjFilter::importFormControl( Reference< XFormComponent >& rxFormComp, sal_Int32 nPos )
-+{
-+ bool bRet = false;
-+
-+ ::oox::ole::EmbeddedControl aControl( CREATE_OUSTRING( "Unknown" ) );
-+ BinaryXInputStream aInStrm( openInputStream( CREATE_OUSTRING( "Ctls" ) ), true );
-+
-+ aInStrm.skip( nPos );
-+ OUString aStrmClassId = ::oox::ole::OleHelper::importGuid( aInStrm );
-+
-+ if( ::oox::ole::ControlModelBase* pModel = aControl.createModel( aStrmClassId ).get() )
-+ {
-+ pModel->importBinaryModel( aInStrm );
-+ rxFormComp.set( getGlobalFactory()->createInstance( pModel->getServiceName() ), UNO_QUERY );
-+ Reference< XControlModel > xCtlModel( rxFormComp, UNO_QUERY );
-+ ::oox::ole::ControlConverter aConv( getGraphicHelper() );
-+ aControl.convertProperties( xCtlModel, aConv );
-+ }
-+
-+ return bRet;
-+}
-+
- bool SimpleExcelVBAProjFilter::importDocument() throw()
- {
- bool bRet = false;
-@@ -280,7 +307,22 @@ bool SimpleExcelVBAProjFilter::importDocument() throw()
- getArgument( CREATE_OUSTRING( "GeneratedCodeNames" ) ) >>= sGeneratedCNames;
- Reference< XNameContainer > xOleNameOverrideSink;
- getArgument( CREATE_OUSTRING( "OleNameOverrideInfo" ) ) >>= xOleNameOverrideSink;
-+
- WorkbookHelperRoot aHelper( *this, eBiff );
-+ // # Temporary Hack to allow at least for Excel removal of
-+ // the old msocximex filter for importing controls
-+
-+ Reference< XPropertySet > xProps;
-+ if ( ( getArgument( CREATE_OUSTRING( "ImportFormControl" ) ) >>= xProps ) && xProps.is() )
-+ {
-+ sal_Int32 nStrmPos = 0;
-+ xProps->getPropertyValue( CREATE_OUSTRING( "StreamPosition" ) ) >>= nStrmPos;
-+ Reference< XFormComponent > xFormComp;
-+ bRet = importFormControl( xFormComp, nStrmPos );
-+ xProps->setPropertyValue( CREATE_OUSTRING( "Control" ), Any( xFormComp ) );
-+ return xFormComp.is();
-+ }
-+
- StorageRef xVbaPrjStrg = openSubStorage( CREATE_OUSTRING( "_VBA_PROJECT_CUR" ), false ) ;
- if( xVbaPrjStrg.get() && xVbaPrjStrg->isStorage() )
- {
-diff --git sc/source/filter/excel/xiescher.cxx sc/source/filter/excel/xiescher.cxx
-index d31d5ad..bd31ede 100644
---- sc/source/filter/excel/xiescher.cxx
-+++ sc/source/filter/excel/xiescher.cxx
-@@ -113,6 +113,15 @@
-
- #include "namebuff.hxx"
-
-+#include <sfx2/docfile.hxx>
-+#include <com/sun/star/document/XFilter.hpp>
-+#include <comphelper/processfactory.hxx>
-+#include <com/sun/star/document/XImporter.hpp>
-+#include <com/sun/star/beans/XPropertyContainer.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <com/sun/star/beans/PropertyAttribute.hpp>
-+#include <comphelper/mediadescriptor.hxx>
-+
- using ::rtl::OUString;
- using ::rtl::OUStringBuffer;
- using ::com::sun::star::uno::Any;
-@@ -124,6 +133,7 @@ using ::com::sun::star::uno::UNO_QUERY_THROW;
- using ::com::sun::star::uno::UNO_SET_THROW;
- using ::com::sun::star::beans::NamedValue;
- using ::com::sun::star::lang::XMultiServiceFactory;
-+using ::com::sun::star::lang::XComponent;
- using ::com::sun::star::container::XIndexContainer;
- using ::com::sun::star::container::XNameContainer;
- using ::com::sun::star::frame::XModel;
-@@ -143,7 +153,13 @@ using ::com::sun::star::script::ScriptEventDescriptor;
- using ::com::sun::star::script::XEventAttacherManager;
- using ::com::sun::star::table::CellAddress;
- using ::com::sun::star::table::CellRangeAddress;
-+using ::com::sun::star::document::XImporter;
-+using ::com::sun::star::document::XFilter;
-+using ::com::sun::star::beans::XPropertyContainer;
-+using ::com::sun::star::beans::XPropertySet;
-+using ::com::sun::star::beans::PropertyAttribute::MAYBEVOID;
-
-+using namespace ::comphelper;
- // ============================================================================
-
- namespace {
-@@ -186,6 +202,54 @@ typedef TSdrObjectPtr< SdrObject > SdrObjectPtr;
-
- } // namespace
-
-+// SfxMedium& rMedium = GetMedium();
-+void importFormControl( const Reference< XModel >& xModel, SfxMedium& rMedium, Reference< XFormComponent >& xFComp, sal_Int32 nStrmPos )
-+{
-+ try
-+ {
-+ Reference< XComponent > xComponent( xModel, UNO_QUERY_THROW );
-+ Sequence< NamedValue > aArgSeq(1);
-+ aArgSeq[ 0 ].Name = CREATE_OUSTRING( "ImportFormControl");
-+ Reference< XMultiServiceFactory > xFac( ::comphelper::getProcessServiceFactory
-+(), UNO_QUERY_THROW );
-+
-+ Reference< XPropertyContainer > xPropBag( xFac->createInstance( CREATE_OUSTRING( "com.sun.star.beans.PropertyBag" ) ), UNO_QUERY_THROW );
-+ aArgSeq[ 0 ].Value <<= xPropBag;
-+
-+ xPropBag->addProperty( CREATE_OUSTRING( "StreamPosition" ), MAYBEVOID, Any( nStrmPos ) );
-+ xPropBag->addProperty( CREATE_OUSTRING( "Control" ), MAYBEVOID, Any( xFComp ) );
-+
-+ Sequence< Any > aArgs(2);
-+ aArgs[ 0 ] <<= ::comphelper::getProcessServiceFactory();
-+ aArgs[ 1 ] <<= aArgSeq;
-+
-+ Reference< XImporter > xImporter( ScfApiHelper::CreateInstanceWithArgs( CREATE_OUSTRING( "com.sun.star.comp.xls.SimpleExcelVBAProjFilter" ), aArgs ), UNO_QUERY_THROW );
-+ xImporter->setTargetDocument( xComponent );
-+
-+ MediaDescriptor aMediaDesc;
-+ SfxItemSet* pItemSet = rMedium.GetItemSet();
-+ if( pItemSet )
-+ {
-+ if( const SfxStringItem* pItem = static_cast< const SfxStringItem* >( pItemSet->GetItem( SID_FILE_NAME ) ) )
-+ aMediaDesc[ MediaDescriptor::PROP_URL() ] <<= ::rtl::OUString( pItem->GetValue() );
-+ if( const SfxStringItem* pItem = static_cast< const SfxStringItem* >( pItemSet->GetItem( SID_PASSWORD ) ) )
-+ aMediaDesc[ MediaDescriptor::PROP_PASSWORD() ] <<= ::rtl::OUString( pItem->GetValue() );
-+ }
-+ aMediaDesc[ MediaDescriptor::PROP_INPUTSTREAM() ] <<= rMedium.GetInputStream();
-+ aMediaDesc[ MediaDescriptor::PROP_INTERACTIONHANDLER() ] <<= rMedium.GetInteractionHandler();
-+
-+ // call the filter
-+ Reference< XFilter > xFilter( xImporter, UNO_QUERY_THROW );
-+ if ( xFilter->filter( aMediaDesc.getAsConstPropertyValueList() ) )
-+ {
-+ Reference< XPropertySet > xPropSet( xPropBag, UNO_QUERY_THROW );
-+ xPropSet->getPropertyValue( CREATE_OUSTRING( "Control" ) ) >>= xFComp;
-+ }
-+ }
-+ catch( Exception& )
-+ {
-+ }
-+}
- // Drawing objects ============================================================
-
- XclImpDrawObjBase::XclImpDrawObjBase( const XclImpRoot& rRoot ) :
-@@ -3157,7 +3221,7 @@ XclImpDffConverter::XclImpDffConvData::XclImpDffConvData(
-
- XclImpDffConverter::XclImpDffConverter( const XclImpRoot& rRoot, SvStream& rDffStrm ) :
- XclImpSimpleDffConverter( rRoot, rDffStrm ),
-- SvxMSConvertOCXControls( rRoot.GetDocShell(), 0 ),
-+// SvxMSConvertOCXControls( rRoot.GetDocShell(), 0 ),
- maStdFormName( CREATE_OUSTRING( "Standard" ) ),
- mnOleImpFlags( 0 )
- {
-@@ -3322,8 +3386,24 @@ SdrObject* XclImpDffConverter::CreateSdrObject( const XclImpPictureObj& rPicObj,
- mxCtlsStrm->Seek( rPicObj.GetCtlsStreamPos() );
- // read from mxCtlsStrm into xShape, insert the control model into the form
- Reference< XShape > xShape;
-+/*
- if( GetConvData().mxCtrlForm.is() && ReadOCXExcelKludgeStream( mxCtlsStrm, &xShape, TRUE ) )
- xSdrObj.reset( rPicObj.CreateSdrObjectFromShape( xShape, rAnchorRect ) );
-+*/
-+ if( GetConvData().mxCtrlForm.is() )
-+ {
-+ Reference< XFormComponent > xFComp;
-+ com::sun::star::awt::Size aSz; // not used in import
-+ SfxMedium& rMedium = GetMedium();
-+ importFormControl( GetDocShell()->GetModel(), rMedium, xFComp, rPicObj.GetCtlsStreamPos() );
-+ // recreate the method formally known as
-+ // ReadOCXExcelKludgeStream( )
-+ if ( xFComp.is() )
-+ {
-+ InsertControl( xFComp, aSz,&xShape,TRUE);
-+ xSdrObj.reset( rPicObj.CreateSdrObjectFromShape( xShape, rAnchorRect ) );
-+ }
-+ }
- }
- catch( Exception& )
- {
-diff --git sc/source/filter/inc/xiescher.hxx sc/source/filter/inc/xiescher.hxx
-index 38464fa..81f1cfd 100644
---- sc/source/filter/inc/xiescher.hxx
-+++ sc/source/filter/inc/xiescher.hxx
-@@ -990,7 +990,7 @@ protected:
- contains core implementation of DFF stream import and OCX form control
- import.
- */
--class XclImpDffConverter : public XclImpSimpleDffConverter, private SvxMSConvertOCXControls
-+class XclImpDffConverter : public XclImpSimpleDffConverter/*, private SvxMSConvertOCXControls*/
- {
- public:
- explicit XclImpDffConverter( const XclImpRoot& rRoot, SvStream& rDffStrm );
-diff --git sw/source/filter/ww8/wrtw8esh.cxx sw/source/filter/ww8/wrtw8esh.cxx
-index 71889e2..8c1dad3 100644
---- sw/source/filter/ww8/wrtw8esh.cxx
-+++ sw/source/filter/ww8/wrtw8esh.cxx
-@@ -106,6 +106,13 @@
- #include <ndtxt.hxx>
- // <--
- #include "WW8FFData.hxx"
-+#include <com/sun/star/drawing/XShape.hpp>
-+#include <com/sun/star/beans/XPropertyContainer.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <com/sun/star/beans/PropertyAttribute.hpp>
-+#include <com/sun/star/form/XFormComponent.hpp>
-+#include <comphelper/processfactory.hxx>
-+#include "docsh.hxx"
-
- using namespace com::sun::star;
- using namespace sw::util;
-@@ -2764,6 +2771,40 @@ UINT32 SwEscherEx::QueryTextID(
- return nId;
- }
-
-+// A bit ugly but lets keep the old signature ( but remove all calls to
-+// filter/source/msocximex.cxx )
-+
-+sal_Bool SwMSConvertControls::ReadOCXStream( SotStorageRef& rSrc1,
-+ com::sun::star::uno::Reference< com::sun::star::drawing::XShape > *pShapeRef,
-+ BOOL bFloatingCtrl )
-+{
-+ uno::Sequence< beans::NamedValue > aArgSeq(1);
-+ aArgSeq[ 0 ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ImportFormControl") );
-+
-+ uno::Reference< lang::XMultiServiceFactory > xFac( ::comphelper::getProcessServiceFactory (), uno::UNO_QUERY_THROW );
-+
-+ uno::Reference< beans::XPropertyContainer > xPropBag( xFac->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.beans.PropertyBag" ) ) ), uno::UNO_QUERY_THROW );
-+ aArgSeq[ 0 ].Value <<= xPropBag;
-+
-+ uno::Reference< form::XFormComponent > xFComp;
-+ xPropBag->addProperty( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ObjPoolName" ) ), beans::PropertyAttribute::MAYBEVOID, uno::Any( rtl::OUString( rSrc1->GetName() ) ) );
-+ xPropBag->addProperty( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Control" ) ), beans::PropertyAttribute::MAYBEVOID, uno::Any( xFComp ) );
-+
-+ BasicProjImportHelper aVBAImporter( *( static_cast< SwDocShell* >( pDocSh ) ) );
-+ sal_Bool bRes = aVBAImporter.import( aArgSeq );
-+ if ( bRes )
-+ {
-+ uno::Reference< beans::XPropertySet > xPropSet( xPropBag, uno::UNO_QUERY_THROW );
-+ xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Control" ) ) ) >>= xFComp;
-+ if ( xFComp.is() )
-+ {
-+ com::sun::star::awt::Size aSz; // not used in import
-+ bRes = InsertControl( xFComp, aSz,pShapeRef,bFloatingCtrl);
-+ }
-+ }
-+ return bRes;
-+}
-+
- bool SwMSConvertControls::ExportControl(WW8Export &rWW8Wrt, const SdrObject *pObj)
- {
- if (!rWW8Wrt.bWrtWW8)
-diff --git sw/source/filter/ww8/ww8par.cxx sw/source/filter/ww8/ww8par.cxx
-index c71f885..d033355 100644
---- sw/source/filter/ww8/ww8par.cxx
-+++ sw/source/filter/ww8/ww8par.cxx
-@@ -144,6 +144,13 @@
-
- #include "WW8Sttbf.hxx"
- #include "WW8FibData.hxx"
-+#include <comphelper/processfactory.hxx>
-+#include <com/sun/star/document/XFilter.hpp>
-+#include <com/sun/star/script/vba/XVBACompatibility.hpp>
-+#include <com/sun/star/document/XImporter.hpp>
-+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-+#include <comphelper/mediadescriptor.hxx>
-+
- #define MM_250 1417 // WW-Default fuer Hor. Seitenraender: 2.5 cm
- #define MM_200 1134 // WW-Default fuer u.Seitenrand: 2.0 cm
-
-@@ -152,6 +159,8 @@ using namespace sw::util;
- using namespace sw::types;
- using namespace nsHdFtFlags;
-
-+using namespace ::comphelper;
-+
- #include <com/sun/star/document/XEventsSupplier.hpp>
- #include <com/sun/star/container/XNameReplace.hpp>
- #include <com/sun/star/frame/XModel.hpp>
-@@ -159,6 +168,75 @@ using namespace nsHdFtFlags;
- #include <unotools/pathoptions.hxx>
- #include <com/sun/star/ucb/XSimpleFileAccess.hpp>
-
-+bool BasicProjImportHelper::import()
-+{
-+ uno::Sequence< beans::NamedValue > aArgSeq;
-+ return import( aArgSeq );
-+}
-+
-+bool BasicProjImportHelper::import( const uno::Sequence< beans::NamedValue >& aArgSeq )
-+{
-+ bool bRet = false;
-+ try
-+ {
-+ uno::Reference< lang::XComponent > xComponent( mrDocShell.GetModel(), uno::UNO_QUERY_THROW );
-+
-+ uno::Reference< lang::XMultiServiceFactory > xFac( getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+ uno::Reference< document::XImporter > xImporter;
-+ if ( aArgSeq.getLength() )
-+ {
-+ uno::Sequence< uno::Any > aArgs( 2 );
-+ aArgs[ 0 ] <<= getProcessServiceFactory();
-+ aArgs[ 1 ] <<= aArgSeq;
-+ xImporter.set( xFac->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.ole.SimpleWordVBAProjFilter" ) ), aArgs ), uno::UNO_QUERY_THROW );
-+ }
-+ else
-+ xImporter.set( xFac->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.ole.SimpleWordVBAProjFilter" ) )), uno::UNO_QUERY_THROW );
-+ xImporter->setTargetDocument( xComponent );
-+
-+ MediaDescriptor aMediaDesc;
-+ SfxMedium& rMedium = *mrDocShell.GetMedium();
-+ SfxItemSet* pItemSet = rMedium.GetItemSet();
-+ if( pItemSet )
-+ {
-+ if( const SfxStringItem* pItem = static_cast< const SfxStringItem* >( pItemSet->GetItem( SID_FILE_NAME ) ) )
-+ aMediaDesc[ MediaDescriptor::PROP_URL() ] <<= ::rtl::OUString( pItem->GetValue() );
-+ if( const SfxStringItem* pItem = static_cast< const SfxStringItem* >( pItemSet->GetItem( SID_PASSWORD ) ) )
-+ aMediaDesc[ MediaDescriptor::PROP_PASSWORD() ] <<= ::rtl::OUString( pItem->GetValue() );
-+ }
-+ aMediaDesc[ MediaDescriptor::PROP_INPUTSTREAM() ] <<= rMedium.GetInputStream();
-+ aMediaDesc[ MediaDescriptor::PROP_INTERACTIONHANDLER() ] <<= rMedium.GetInteractionHandler();
-+
-+ // call the filter
-+ uno::Reference< document::XFilter > xFilter( xImporter, uno::UNO_QUERY_THROW );
-+ bRet = xFilter->filter( aMediaDesc.getAsConstPropertyValueList() );
-+ }
-+ catch( uno::Exception& )
-+ {
-+ bRet = false;
-+ }
-+ return bRet;
-+}
-+
-+rtl::OUString BasicProjImportHelper::getProjectName()
-+{
-+ rtl::OUString sProjName( RTL_CONSTASCII_USTRINGPARAM("Standard") );
-+ uno::Reference< beans::XPropertySet > xProps( mrDocShell.GetModel(), uno::UNO_QUERY );
-+ if ( xProps.is() )
-+ {
-+ try
-+ {
-+ uno::Reference< script::vba::XVBACompatibility > xVBA( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BasicLibraries" ) ) ), uno::UNO_QUERY_THROW );
-+ sProjName = xVBA->getProjectName();
-+
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+ }
-+ return sProjName;
-+}
-+
- class Sttb : TBBase
- {
- struct SBBItem
-@@ -4008,16 +4086,11 @@ bool SwWW8ImplReader::ReadGlobalTemplateSettings( const rtl::OUString& sCreatedF
-
- SotStorageRef rRoot = new SotStorage( aURL, STREAM_STD_READWRITE, STORAGE_TRANSACTED );
-
-- // Read Macro Projects
-- SvxImportMSVBasic aVBasic(*mpDocShell, *rRoot,
-- pVBAFlags->IsLoadWordBasicCode(),
-- pVBAFlags->IsLoadWordBasicStorage() );
--
-+ BasicProjImportHelper aBasicImporter( *mpDocShell );
-+ // Import vba via oox filter
-+ aBasicImporter.import();
-
-- String s1(CREATE_CONST_ASC("Macros"));
-- String s2(CREATE_CONST_ASC("VBA"));
-- aVBasic.Import( s1, s2, !pVBAFlags->IsLoadWordBasicExecutable() );
-- lcl_createTemplateToProjectEntry( xPrjNameCache, aURL, aVBasic.GetVBAProjectName() );
-+ lcl_createTemplateToProjectEntry( xPrjNameCache, aURL, aBasicImporter.getProjectName() );
- // Read toolbars & menus
- SvStorageStreamRef refMainStream = rRoot->OpenSotStream( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WordDocument") ) );
- refMainStream->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN);
-@@ -4344,21 +4417,21 @@ ULONG SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
- aArgs[ 0 ] <<= mpDocShell->GetModel();
- aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Globals")), aArgs );
- mpDocShell->GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
--
-- SvxImportMSVBasic aVBasic(*mpDocShell, *pStg,
-- pVBAFlags->IsLoadWordBasicCode(),
-- pVBAFlags->IsLoadWordBasicStorage() );
-- String s1(CREATE_CONST_ASC("Macros"));
-- String s2(CREATE_CONST_ASC("VBA"));
-- int nRet = aVBasic.Import( s1, s2, !pVBAFlags->IsLoadWordBasicExecutable() );
-+
-+ BasicProjImportHelper aBasicImporter( *mpDocShell );
-+ // Import vba via oox filter
-+ bool bRet = aBasicImporter.import();
-+
- // dissable below for 3.1 at the moment, 'cause it's kinda immature
- // similarly the project reference in svx/source/msvba
-+
- #if 1
-- lcl_createTemplateToProjectEntry( xPrjNameCache, sCreatedFrom, aVBasic.GetVBAProjectName() );
-+ lcl_createTemplateToProjectEntry( xPrjNameCache, sCreatedFrom, aBasicImporter.getProjectName() );
-+
- WW8Customizations aCustomisations( pTableStream, *pWwFib );
- aCustomisations.Import( mpDocShell );
- #endif
-- if( 2 & nRet )
-+ if( bRet )
- {
- maTracer.Log(sw::log::eContainsVisualBasic);
- rDoc.SetContainsMSVBasic(true);
-diff --git sw/source/filter/ww8/ww8par.hxx sw/source/filter/ww8/ww8par.hxx
-index 95a072f..28b6042 100644
---- sw/source/filter/ww8/ww8par.hxx
-+++ sw/source/filter/ww8/ww8par.hxx
-@@ -49,6 +49,7 @@
- #include "../inc/msfilter.hxx"
- #include <xmloff/odffields.hxx>
- #include <IMark.hxx>
-+#include <com/sun/star/beans/NamedValue.hpp>
-
- class SwDoc;
- class SwPaM;
-@@ -556,6 +557,10 @@ public:
- com::sun::star::uno::Reference <
- com::sun::star::drawing::XShape > *pShape,BOOL bFloatingCtrl);
- bool ExportControl(WW8Export &rWrt, const SdrObject *pObj);
-+ virtual sal_Bool ReadOCXStream( SotStorageRef& rSrc1,
-+ com::sun::star::uno::Reference<
-+ com::sun::star::drawing::XShape > *pShapeRef=0,
-+ BOOL bFloatingCtrl=FALSE );
- };
-
- class SwMSDffManager : public SvxMSDffManager
-@@ -1634,6 +1639,19 @@ void MatchEscherMirrorIntoFlySet(const SvxMSDffImportRec &rRecord,
- bool RTLDrawingsHack(long &rLeft, long nWidth,
- sal_Int16 eHoriOri, sal_Int16 eHoriRel, SwTwips nPageLeft,
- SwTwips nPageRight, SwTwips nPageSize);
-+
-+class BasicProjImportHelper
-+{
-+ SwDocShell& mrDocShell;
-+public:
-+ BasicProjImportHelper( SwDocShell& rShell ) : mrDocShell( rShell ) {}
-+ bool import();
-+ bool import( const com::sun::star::uno::Sequence< com::sun::star::beans::NamedValue >& aArgSeq );
-+ rtl::OUString getProjectName();
-+};
-+
-+
-+
- #endif
-
- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
-diff --git sw/util/makefile.mk sw/util/makefile.mk
-index 3993ad0..ce1419b 100644
---- sw/util/makefile.mk
-+++ sw/util/makefile.mk
-@@ -335,7 +335,6 @@ SHL4STDLIBS= \
- $(SALLIB) \
- $(ICUUCLIB) \
- $(BASICLIB) \
-- $(MSFILTERLIB) \
- $(I18NUTILLIB)
-
- .IF "$(ENABLE_VBA)" == "YES"
diff --git a/patches/vba/vba-userform-geometry-tweak.diff b/patches/vba/vba-userform-geometry-tweak.diff
deleted file mode 100644
index 21f24bf19..000000000
--- a/patches/vba/vba-userform-geometry-tweak.diff
+++ /dev/null
@@ -1,394 +0,0 @@
-diff --git basctl/source/basicide/baside3.cxx basctl/source/basicide/baside3.cxx
-index e89c22f..8d11a16 100644
---- basctl/source/basicide/baside3.cxx
-+++ basctl/source/basicide/baside3.cxx
-@@ -82,6 +82,7 @@
- #include <com/sun/star/resource/XStringResourceResolver.hpp>
- #include <com/sun/star/resource/StringResourceWithLocation.hpp>
- #include <com/sun/star/task/XInteractionHandler.hpp>
-+#include <com/sun/star/script/XVBACompat.hpp>
-
- using namespace comphelper;
- using namespace ::com::sun::star;
-@@ -114,6 +115,14 @@ DialogWindow::DialogWindow( Window* pParent, const ScriptDocument& rDocument, St
-
- pEditor = new DlgEditor( rDocument.getDocument() );
- pEditor->SetWindow( this );
-+ // set vba mode on DialogModel ( allows it to work in 100thmm instead of MAP_APPFONT )
-+ if ( rDocument.getDocument().is() )
-+ {
-+ uno::Reference< script::XVBACompat > xDocVBAMode( rDocument.getLibraryContainer( E_SCRIPTS ), uno::UNO_QUERY );
-+ uno::Reference< script::XVBACompat > xDialogModelVBAMode( xDialogModel, uno::UNO_QUERY );
-+ if ( xDocVBAMode.is() && xDialogModelVBAMode.is() )
-+ xDialogModelVBAMode->setVBACompatModeOn( xDocVBAMode->getVBACompatModeOn() );
-+ }
- pEditor->SetDialog( xDialogModel );
-
- // Undo einrichten
-diff --git basctl/source/dlged/dlgedobj.cxx basctl/source/dlged/dlgedobj.cxx
-index bed7bc3..0899661 100644
---- basctl/source/dlged/dlgedobj.cxx
-+++ basctl/source/dlged/dlgedobj.cxx
-@@ -77,6 +77,22 @@ TYPEINIT1(DlgEdObj, SdrUnoObj);
- DBG_NAME(DlgEdObj);
-
- //----------------------------------------------------------------------------
-+MapMode lcl_getMapModeForForm( DlgEdForm* pForm )
-+{
-+ MapMode aMode( MAP_APPFONT ); //Default
-+ try
-+ {
-+ uno::Reference< beans::XPropertySet > xProps( pForm ? pForm->GetUnoControlModel() : NULL, uno::UNO_QUERY_THROW );
-+ sal_Bool bVBAForm = sal_False;
-+ xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VBAForm") ) ) >>= bVBAForm;
-+ if ( bVBAForm )
-+ aMode = MapMode( MAP_100TH_MM );
-+ }
-+ catch ( Exception& )
-+ {
-+ }
-+ return aMode;
-+}
-
- DlgEdObj::DlgEdObj()
- :SdrUnoObj(String(), sal_False)
-@@ -207,8 +223,9 @@ bool DlgEdObj::TransformSdrToControlCoordinates(
- }
-
- // convert pixel to logic units
-- aPos = pDevice->PixelToLogic( aPos, MapMode( MAP_APPFONT ) );
-- aSize = pDevice->PixelToLogic( aSize, MapMode( MAP_APPFONT ) );
-+ MapMode aConvMode = lcl_getMapModeForForm( pForm );
-+ aPos = pDevice->PixelToLogic( aPos, aConvMode );
-+ aSize = pDevice->PixelToLogic( aSize, aConvMode );
-
- // set out parameters
- nXOut = aPos.Width();
-@@ -255,10 +272,10 @@ bool DlgEdObj::TransformSdrToFormCoordinates(
- aSize.Width() -= aDeviceInfo.LeftInset + aDeviceInfo.RightInset;
- aSize.Height() -= aDeviceInfo.TopInset + aDeviceInfo.BottomInset;
- }
--
-+ MapMode aConvMode = lcl_getMapModeForForm( pForm );
- // convert pixel to logic units
-- aPos = pDevice->PixelToLogic( aPos, MapMode( MAP_APPFONT ) );
-- aSize = pDevice->PixelToLogic( aSize, MapMode( MAP_APPFONT ) );
-+ aPos = pDevice->PixelToLogic( aPos, aConvMode );
-+ aSize = pDevice->PixelToLogic( aSize, aConvMode );
-
- // set out parameters
- nXOut = aPos.Width();
-@@ -300,9 +317,10 @@ bool DlgEdObj::TransformControlToSdrCoordinates(
- DBG_ASSERT( pDevice, "DlgEdObj::TransformControlToSdrCoordinates: missing default device!" );
- if ( !pDevice )
- return false;
-- aPos = pDevice->LogicToPixel( aPos, MapMode( MAP_APPFONT ) );
-- aSize = pDevice->LogicToPixel( aSize, MapMode( MAP_APPFONT ) );
-- aFormPos = pDevice->LogicToPixel( aFormPos, MapMode( MAP_APPFONT ) );
-+ MapMode aConvMode = lcl_getMapModeForForm( pForm );
-+ aPos = pDevice->LogicToPixel( aPos, aConvMode );
-+ aSize = pDevice->LogicToPixel( aSize, aConvMode );
-+ aFormPos = pDevice->LogicToPixel( aFormPos, aConvMode );
-
- // add form position
- aPos.Width() += aFormPos.Width();
-@@ -346,14 +364,16 @@ bool DlgEdObj::TransformFormToSdrCoordinates(
- DBG_ASSERT( pDevice, "DlgEdObj::TransformFormToSdrCoordinates: missing default device!" );
- if ( !pDevice )
- return false;
-- aPos = pDevice->LogicToPixel( aPos, MapMode( MAP_APPFONT ) );
-- aSize = pDevice->LogicToPixel( aSize, MapMode( MAP_APPFONT ) );
-
- // take window borders into account
- DlgEdForm* pForm = NULL;
- if ( !lcl_getDlgEdForm( this, pForm ) )
- return false;
-
-+ MapMode aConvMode = lcl_getMapModeForForm( pForm );
-+ aPos = pDevice->LogicToPixel( aPos, aConvMode );
-+ aSize = pDevice->LogicToPixel( aSize, aConvMode );
-+
- // take window borders into account
- Reference< beans::XPropertySet > xPSetForm( pForm->GetUnoControlModel(), UNO_QUERY );
- DBG_ASSERT( xPSetForm.is(), "DlgEdObj::TransformFormToSdrCoordinates: no form property set!" );
-diff --git svx/inc/svxmsbas.hxx svx/inc/svxmsbas.hxx
-index f99247b..5e87fe6 100644
---- svx/inc/svxmsbas.hxx
-+++ svx/inc/svxmsbas.hxx
-@@ -99,7 +99,7 @@ private:
- const String &rSubStorageName,
- BOOL bAsComment, BOOL bStripped );
- SVX_DLLPRIVATE bool ImportForms_Impl(const String& rStorageName,
-- const String &rSubStorageName);
-+ const String &rSubStorageName, BOOL bVBAMode );
- SVX_DLLPRIVATE BOOL CopyStorage_Impl( const String& rStorageName,
- const String &rSubStorageName);
- };
-diff --git svx/source/msfilter/msocximex.cxx svx/source/msfilter/msocximex.cxx
-index f773bc4..ea070c6 100644
---- svx/source/msfilter/msocximex.cxx
-+++ svx/source/msfilter/msocximex.cxx
-@@ -1075,6 +1075,9 @@ sal_Bool OCX_Control::Import(
- sal_Bool OCX_Control::Import(uno::Reference<container::XNameContainer> &rDialog
- )
- {
-+ uno::Reference<beans::XPropertySet > xDlgProps( rDialog, uno::UNO_QUERY);
-+
-+
- uno::Reference<lang::XMultiServiceFactory>
- xFactory(rDialog, uno::UNO_QUERY);
-
-@@ -1087,11 +1090,15 @@ sal_Bool OCX_Control::Import(uno::Reference<container::XNameContainer> &rDialog
- if (!xModel.is())
- return sal_False;
-
-+ sal_Bool bVBA = sal_False;
- /* #147900# sometimes insertion of a control fails due to existing name,
- do not break entire form import then... */
- try
- {
- rDialog->insertByName(sName, uno::makeAny(xModel));
-+ if ( xDlgProps.is() )
-+ xDlgProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("VBAForm") ) ) >>= bVBA;
-+
- }
- catch( uno::Exception& )
- {
-@@ -1107,16 +1114,32 @@ sal_Bool OCX_Control::Import(uno::Reference<container::XNameContainer> &rDialog
-
- if (!Import(xPropSet))
- return sal_False;
--
-+
- uno::Any aTmp;
-- aTmp <<= sal_Int32((mnLeft * 2) / 100);
-- xPropSet->setPropertyValue(WW8_ASCII2STR("PositionX"), aTmp);
-- aTmp <<= sal_Int32((mnTop * 2) / 100);
-- xPropSet->setPropertyValue(WW8_ASCII2STR("PositionY"), aTmp);
-- aTmp <<= sal_Int32((nWidth * 2) / 100);
-- xPropSet->setPropertyValue(WW8_ASCII2STR("Width"), aTmp);
-- aTmp <<= sal_Int32((nHeight * 2) / 100);
-- xPropSet->setPropertyValue(WW8_ASCII2STR("Height"), aTmp);
-+ sal_Int32 nFactor = 3528;
-+
-+ if ( !bVBA )
-+ {
-+ aTmp <<= sal_Int32((mnLeft * 2) / 100);
-+ xPropSet->setPropertyValue(WW8_ASCII2STR("PositionX"), aTmp);
-+ aTmp <<= sal_Int32((mnTop * 2) / 100);
-+ xPropSet->setPropertyValue(WW8_ASCII2STR("PositionY"), aTmp);
-+ aTmp <<= sal_Int32((nWidth * 2) / 100);
-+ xPropSet->setPropertyValue(WW8_ASCII2STR("Width"), aTmp);
-+ aTmp <<= sal_Int32((nHeight * 2) / 100);
-+ xPropSet->setPropertyValue(WW8_ASCII2STR("Height"), aTmp);
-+ }
-+ else
-+ {
-+ aTmp <<= sal_Int32(mnLeft); // 100thmm
-+ xPropSet->setPropertyValue(WW8_ASCII2STR("PositionX"), aTmp);
-+ aTmp <<= sal_Int32(mnTop); //100th mm
-+ xPropSet->setPropertyValue(WW8_ASCII2STR("PositionY"), aTmp);
-+ aTmp <<= sal_Int32(nWidth); // 100thmm
-+ xPropSet->setPropertyValue(WW8_ASCII2STR("Width"), aTmp);
-+ aTmp <<= sal_Int32(nHeight); //100th mm
-+ xPropSet->setPropertyValue(WW8_ASCII2STR("Height"), aTmp);
-+ }
- if ( msToolTip.Len() > 0 )
- {
- uno::Any aTmp(&msToolTip,getCppuType((OUString *)0));
-@@ -4330,6 +4353,8 @@ sal_Bool OCX_UserForm::Import(
- {
- uno::Reference<beans::XPropertySet>
- xDialogPropSet(mxParent, uno::UNO_QUERY);
-+ if ( !xDialogPropSet.is() )
-+ return sal_False;
- uno::Any aTmp(&sName,getCppuType((OUString *)0));
- xDialogPropSet->setPropertyValue(
- OUString(RTL_CONSTASCII_USTRINGPARAM("Name")), aTmp);
-@@ -4337,11 +4362,32 @@ sal_Bool OCX_UserForm::Import(
- OUString(RTL_CONSTASCII_USTRINGPARAM("Title")), aTmp);
- aTmp <<= ImportColor(mnBackColor);
- xDialogPropSet->setPropertyValue( WW8_ASCII2STR("BackgroundColor"), aTmp);
-+ sal_Bool bVBA = sal_False;
-+ // Ok we are importing xls but maybe we aren't in VBA mode
-+ // if we are not in VBA mode then we should import sizes etc. ( as before )
-+ try
-+ {
-+ xDialogPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("VBAForm") ) ) >>= bVBA;
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ }
-+ sal_Int32 nFactor( 3528 );
-+ if ( !bVBA )
-+ {
-+ aTmp <<= sal_Int32((nWidth * 2) / 100);
-+ xDialogPropSet->setPropertyValue(WW8_ASCII2STR("Width"), aTmp);
-+ aTmp <<= sal_Int32((nHeight * 2) / 100);
-+ xDialogPropSet->setPropertyValue(WW8_ASCII2STR("Height"), aTmp);
-+ }
-+ else
-+ {
-+ aTmp <<= sal_Int32( nWidth + 160 ); // 100thmm
-+ xDialogPropSet->setPropertyValue(WW8_ASCII2STR("Width"), aTmp);
-+ aTmp <<= sal_Int32(nHeight + 662 - 714); //100th mm
-+ xDialogPropSet->setPropertyValue(WW8_ASCII2STR("Height"), aTmp);
-+ }
-
-- aTmp <<= sal_Int32((nWidth * 2) / 100);
-- xDialogPropSet->setPropertyValue(WW8_ASCII2STR("Width"), aTmp);
-- aTmp <<= sal_Int32((nHeight * 2) / 100);
-- xDialogPropSet->setPropertyValue(WW8_ASCII2STR("Height"), aTmp);
-
- uno::Reference<beans::XPropertySet> xPropSet( mxParent, uno::UNO_QUERY );
- OCX_ContainerControl::Import( xPropSet );
-diff --git svx/source/msfilter/svxmsbas.cxx svx/source/msfilter/svxmsbas.cxx
-index bf3bca5..2a94b6f 100644
---- svx/source/msfilter/svxmsbas.cxx
-+++ svx/source/msfilter/svxmsbas.cxx
-@@ -89,7 +89,7 @@ int SvxImportMSVBasic::Import( const String& rStorageName,
- nRet |= 1;
-
- if (bImport)
-- ImportForms_Impl(rStorageName, rSubStorageName);
-+ ImportForms_Impl(rStorageName, rSubStorageName, !bAsComment);
-
- if( bCopy && CopyStorage_Impl( rStorageName, rSubStorageName ))
- nRet |= 2;
-@@ -98,7 +98,7 @@ int SvxImportMSVBasic::Import( const String& rStorageName,
- }
-
- bool SvxImportMSVBasic::ImportForms_Impl(const String& rStorageName,
-- const String& rSubStorageName)
-+ const String& rSubStorageName, BOOL bVBAMode )
- {
- SvStorageRef xVBAStg(xRoot->OpenSotStorage(rStorageName,
- STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYALL));
-@@ -182,7 +182,17 @@ bool SvxImportMSVBasic::ImportForms_Impl(const String& rStorageName,
- xSF->createInstance(
- OUString(RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.awt.UnoControlDialogModel"))), uno::UNO_QUERY);
--
-+ // #FIXME HACK - mark the Model with the VBA mode
-+ // In vba mode the imported userform uses 100th mm as units
-+ // or geometry
-+ // In non vba mode MAP_APPFONT is used ( same as normal basic
-+ // dialogs
-+ if ( bVBAMode )
-+ {
-+ Reference<XPropertySet> xDlgProps(xDialog, UNO_QUERY);
-+ if ( xDlgProps.is() )
-+ xDlgProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VBAForm") ), uno::makeAny( sal_True ) );
-+ }
- OCX_UserForm aForm(xVBAStg, *aIter, *aIter, xDialog, xSF );
- aForm.pDocSh = &rDocSh;
- sal_Bool bOk = aForm.Read(xTypes);
---- toolkit/inc/toolkit/helper/property.hxx
-+++ toolkit/inc/toolkit/helper/property.hxx
-@@ -193,6 +193,7 @@ namespace rtl {
- #define BASEPROPERTY_GRID_SELECTIONMODE 144
- #define BASEPROPERTY_ENABLEVISIBLE 145 // sal_Bool
- #define BASEPROPERTY_GROUPNAME 146 // ::rtl::OUString
-+#define BASEPROPERTY_VBAFORM 147 // sal_Bool
-
-
- // Keine gebundenen Properties, werden immer aus der Property BASEPROPERTY_FONTDESCRIPTOR entnommen.
-diff --git toolkit/source/controls/dialogcontrol.cxx toolkit/source/controls/dialogcontrol.cxx
-index be06bbb..f976562 100644
---- toolkit/source/controls/dialogcontrol.cxx
-+++ toolkit/source/controls/dialogcontrol.cxx
-@@ -80,6 +80,7 @@ using namespace ::com::sun::star::lang;
- using namespace ::com::sun::star::container;
- using namespace ::com::sun::star::beans;
- using namespace ::com::sun::star::util;
-+using namespace ::com::sun::star::script;
- using namespace toolkit;
-
- #define PROPERTY_RESOURCERESOLVER ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ))
-@@ -289,6 +290,8 @@ UnoControlDialogModel::UnoControlDialogModel()
- aBool <<= (sal_Bool) sal_True;
- ImplRegisterProperty( BASEPROPERTY_MOVEABLE, aBool );
- ImplRegisterProperty( BASEPROPERTY_CLOSEABLE, aBool );
-+ aBool <<= (sal_Bool) sal_False;
-+ ImplRegisterProperty( BASEPROPERTY_VBAFORM, aBool );
- }
-
- UnoControlDialogModel::UnoControlDialogModel( const UnoControlDialogModel& rModel )
-@@ -1475,17 +1478,32 @@ void UnoDialogControl::ImplSetPosSize( Reference< XControl >& rxCtrl )
- xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" ) ) ) >>= nWidth;
- xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) ) >>= nHeight;
-
-- // Currentley we are simply using MAP_APPFONT
-+ // Currentley we are simply using MAP_APPFONT ( for normal Dialogs )
-+ // and MAP_100TH_MM for imported Userforms
-+ MapMode aMode( MAP_APPFONT );
-+ sal_Bool bVBAForm = sal_False;
-+ Reference< XPropertySet > xDlgModelProps( getModel(), UNO_QUERY );
-+ if ( xDlgModelProps.is() )
-+ {
-+ try
-+ {
-+ xDlgModelProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAForm" ) ) ) >>= bVBAForm;
-+ }
-+ catch( Exception& )
-+ {
-+ }
-+ }
-+ if ( bVBAForm )
-+ aMode = MapMode( MAP_100TH_MM );
- OutputDevice*pOutDev = Application::GetDefaultDevice();
-- DBG_ASSERT( pOutDev, "Missing Default Device!" );
- if ( pOutDev )
- {
- ::Size aTmp( nX, nY );
-- aTmp = pOutDev->LogicToPixel( aTmp, MAP_APPFONT );
-+ aTmp = pOutDev->LogicToPixel( aTmp, aMode );
- nX = aTmp.Width();
- nY = aTmp.Height();
- aTmp = ::Size( nWidth, nHeight );
-- aTmp = pOutDev->LogicToPixel( aTmp, MAP_APPFONT );
-+ aTmp = pOutDev->LogicToPixel( aTmp, aMode );
- nWidth = aTmp.Width();
- nHeight = aTmp.Height();
- }
---- toolkit/source/helper/property.cxx
-+++ toolkit/source/helper/property.cxx
-@@ -274,7 +274,8 @@ ImplPropertyInfo* ImplGetPropertyInfos(
- DECL_PROP_3 ( "GridDataModel", GRID_DATAMODEL, Reference< ::com::sun::star::awt::grid::XGridDataModel >, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_3 ( "ColumnModel", GRID_COLUMNMODEL, Reference< ::com::sun::star::awt::grid::XGridColumnModel >, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_3 ( "SelectionModel", GRID_SELECTIONMODE, ::com::sun::star::view::SelectionType, BOUND, MAYBEDEFAULT, MAYBEVOID ),
-- DECL_PROP_2 ( "EnableVisible", ENABLEVISIBLE, sal_Bool, BOUND, MAYBEDEFAULT )
-+ DECL_PROP_2 ( "EnableVisible", ENABLEVISIBLE, sal_Bool, BOUND, MAYBEDEFAULT ),
-+ DECL_PROP_2 ( "VBAForm", VBAFORM, sal_Bool, BOUND, MAYBEDEFAULT )
- };
- pPropertyInfos = aImplPropertyInfos;
- nElements = sizeof( aImplPropertyInfos ) / sizeof( ImplPropertyInfo );
-diff --git xmlscript/source/xmldlg_imexp/xmldlg_import.cxx xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
-index 9abe014..816731a 100644
---- xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
-+++ xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
-@@ -61,6 +61,7 @@
- #include <com/sun/star/view/SelectionType.hpp>
- #include <com/sun/star/document/XStorageBasedDocument.hpp>
- #include <com/sun/star/script/DocumentScriptLibraryContainer.hpp>
-+#include <com/sun/star/script/XVBACompat.hpp>
-
- using namespace ::com::sun::star;
- using namespace ::com::sun::star::uno;
-@@ -1906,9 +1907,14 @@ Reference< xml::sax::XDocumentHandler > SAL_CALL importDialogModel(
- Reference< XModel > const & xDocument )
- SAL_THROW( (Exception) )
- {
-+ DialogImport* pImport = new DialogImport( xContext, xDialogModel, xDocument );
-+ uno::Reference< script::XVBACompat > xVBAModeSource( pImport->getScriptLibraryContainer(), uno::UNO_QUERY );
-+
-+ uno::Reference< beans::XPropertySet > xDlgProps( xDialogModel, uno::UNO_QUERY );
-+ if ( xVBAModeSource.is() && xDlgProps.is() && xVBAModeSource->getVBACompatModeOn() )
-+ xDlgProps->setPropertyValue( OUSTR("VBAForm"), uno::makeAny( sal_True ) );
- return ::xmlscript::createDocumentHandler(
-- static_cast< xml::input::XRoot * >(
-- new DialogImport( xContext, xDialogModel, xDocument ) ) );
-+ static_cast< xml::input::XRoot * >( pImport ) );
- }
-
- }
diff --git a/patches/vba/vba-userform.diff b/patches/vba/vba-userform.diff
deleted file mode 100644
index 3e853a389..000000000
--- a/patches/vba/vba-userform.diff
+++ /dev/null
@@ -1,395 +0,0 @@
-diff --git basic/inc/basic/sbmod.hxx basic/inc/basic/sbmod.hxx
-index e676a49..ab496bc 100644
---- basic/inc/basic/sbmod.hxx
-+++ basic/inc/basic/sbmod.hxx
-@@ -59,6 +59,8 @@ class SbModule : public SbxObject
- friend class SbClassModuleObject;
-
- SbModuleImpl* mpSbModuleImpl; // Impl data
-+ SbModule();
-+ SbModule(const SbModule&);
-
- protected:
- ::rtl::OUString aOUSource;
-diff --git basic/inc/basic/sbobjmod.hxx basic/inc/basic/sbobjmod.hxx
-index cb581c1..96cbe9b 100644
---- basic/inc/basic/sbobjmod.hxx
-+++ basic/inc/basic/sbobjmod.hxx
-@@ -41,6 +41,7 @@
- #include <com/sun/star/script/ModuleInfo.hpp>
- #include <com/sun/star/lang/XEventListener.hpp>
- #include <com/sun/star/awt/XDialog.hpp>
-+#include <com/sun/star/frame/XModel.hpp>
-
- namespace css = ::com::sun::star;
-
-@@ -48,6 +49,8 @@ namespace css = ::com::sun::star;
-
- class SbObjModule : public SbModule
- {
-+ SbObjModule( const SbObjModule& );
-+ SbObjModule();
- public:
- TYPEINFO();
- SbObjModule( const com::sun::star::script::ModuleInfo& mInfo, bool bIsVbaCompatible );
-@@ -56,6 +59,32 @@ public:
- void SetUnoObject( const com::sun::star::uno::Any& aObj )throw ( com::sun::star::uno::RuntimeException ) ;
- };
-
-+class SbUserFormModule : public SbObjModule
-+{
-+ css::uno::Reference<css::lang::XEventListener> m_DialogListener;
-+ css::uno::Reference<css::awt::XDialog> m_xDialog;
-+ css::uno::Reference<css::frame::XModel> m_xModel;
-+ String sFormName;
-+ bool mbInit;
-+ SbUserFormModule( const SbUserFormModule& );
-+ SbUserFormModule();
-+
-+protected:
-+ virtual void InitObject();
-+public:
-+ TYPEINFO();
-+ SbUserFormModule( const com::sun::star::script::ModuleInfo& mInfo, bool bIsVBACompat );
-+ virtual SbxVariable* Find( const XubString& rName, SbxClassType t );
-+ void ResetApiObj();
-+ void Unload();
-+ void load();
-+ void triggerMethod( const String& );
-+ void triggerActivateEvent();
-+ void triggerDeActivateEvent();
-+ void triggerInitializeEvent();
-+ void triggerTerminateEvent();
-+};
-+
- #ifndef __SB_SBOBJMODULEREF_HXX
- #define __SB_SBOBJMODULEREF_HXX
-
---- basic/source/classes/sb.cxx
-+++ basic/source/classes/sb.cxx
-@@ -715,6 +715,9 @@ SbModule* StarBASIC::MakeModule32( const
- p = new SbModule( mInfo.ModuleName, isVBAEnabled() );
- p->SetModuleType( com::sun::star::script::ModuleType::Class );
- break;
-+ case ModuleType::Form:
-+ p = new SbUserFormModule( mInfo, isVBAEnabled() );
-+ break;
- default:
- p = new SbModule( mInfo.ModuleName, isVBAEnabled() );
-
-@@ -900,9 +903,8 @@ SbxVariable* StarBASIC::Find( const Stri
- // Only variables qualified by the Module Name e.g. Sheet1.foo
- // should work for Documant && Class type Modules
- INT32 nType = p->GetModuleType();
-- //if ( nType == com::sun::star::script::ModuleType::Class || nType == com::sun::star::script::ModuleType::Document )
-- if ( nType == com::sun::star::script::ModuleType::Document )
-- continue;
-+ if ( nType == com::sun::star::script::ModuleType::Document || nType == com::sun::star::script::ModuleType::Form )
-+ continue;
- // otherwise check if the element is available
- // unset GBLSEARCH-Flag (due to Rekursion)
- USHORT nGblFlag = p->GetFlags() & SBX_GBLSEARCH;
-diff --git basic/source/classes/sbxmod.cxx basic/source/classes/sbxmod.cxx
-index 8ea4b64..d3dd8d5 100644
---- basic/source/classes/sbxmod.cxx
-+++ basic/source/classes/sbxmod.cxx
-@@ -73,7 +73,6 @@
- #include <com/sun/star/awt/XDialogProvider.hpp>
- #include <com/sun/star/awt/XTopWindow.hpp>
- #include <com/sun/star/awt/XControl.hpp>
--#include <com/sun/star/frame/XModel.hpp>
- #include <cppuhelper/implbase1.hxx>
- #include <comphelper/anytostring.hxx>
-
-@@ -86,6 +85,7 @@ TYPEINIT1(SbProcedureProperty,SbxPropert
- TYPEINIT1(SbJScriptModule,SbModule)
- TYPEINIT1(SbJScriptMethod,SbMethod)
- TYPEINIT1(SbObjModule,SbModule)
-+TYPEINIT1(SbUserFormModule,SbObjModule)
-
- SV_DECL_VARARR(SbiBreakpoints,USHORT,4,4)
- SV_IMPL_VARARR(SbiBreakpoints,USHORT)
-@@ -2272,6 +2272,242 @@ SbObjModule::Find( const XubString& rNam
- pVar = SbModule::Find( rName, t );
- return pVar;
- }
-+
-+typedef ::cppu::WeakImplHelper1< awt::XTopWindowListener > EventListener_BASE;
-+
-+class FormObjEventListenerImpl : public EventListener_BASE
-+{
-+ SbUserFormModule* mpUserForm;
-+ uno::Reference< lang::XComponent > mxComponent;
-+ bool mbDisposed;
-+ sal_Bool mbOpened;
-+ sal_Bool mbActivated;
-+ sal_Bool mbShowing;
-+ FormObjEventListenerImpl(); // not defined
-+ FormObjEventListenerImpl(const FormObjEventListenerImpl&); // not defined
-+public:
-+ FormObjEventListenerImpl( SbUserFormModule* pUserForm, const uno::Reference< lang::XComponent >& xComponent ) : mpUserForm( pUserForm ), mxComponent( xComponent) , mbDisposed( false ), mbOpened( sal_False ), mbActivated( sal_False ), mbShowing( sal_False )
-+ {
-+ if ( mxComponent.is() );
-+ {
-+ uno::Reference< awt::XTopWindow > xList( mxComponent, uno::UNO_QUERY_THROW );;
-+ //uno::Reference< awt::XWindow > xList( mxComponent, uno::UNO_QUERY_THROW );;
-+ OSL_TRACE("*********** Registering the listener");
-+ xList->addTopWindowListener( this );
-+ }
-+ }
-+
-+ ~FormObjEventListenerImpl()
-+ {
-+ removeListener();
-+ }
-+ sal_Bool isShowing() { return mbShowing; }
-+ void removeListener()
-+ {
-+ try
-+ {
-+ if ( mxComponent.is() && !mbDisposed )
-+ {
-+ uno::Reference< awt::XTopWindow > xList( mxComponent, uno::UNO_QUERY_THROW );;
-+ OSL_TRACE("*********** Removing the listener");
-+ xList->removeTopWindowListener( this );
-+ mxComponent = NULL;
-+ }
-+ }
-+ catch( uno::Exception& ) {}
-+ }
-+ virtual void SAL_CALL windowOpened( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException)
-+ {
-+ if ( mpUserForm )
-+ {
-+ mbOpened = sal_True;
-+ mbShowing = sal_True;
-+ if ( mbActivated )
-+ {
-+ mbOpened = mbActivated = sal_False;
-+ mpUserForm->triggerActivateEvent();
-+ }
-+ }
-+ }
-+ virtual void SAL_CALL windowClosing( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException) {}
-+ virtual void SAL_CALL windowClosed( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException) { mbOpened = sal_False; mbShowing = sal_False; }
-+ virtual void SAL_CALL windowMinimized( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException) {}
-+ virtual void SAL_CALL windowNormalized( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException){}
-+ virtual void SAL_CALL windowActivated( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException)
-+ {
-+ if ( mpUserForm )
-+ {
-+ mbActivated = sal_True;
-+ if ( mbOpened )
-+ {
-+ mbOpened = mbActivated = sal_False;
-+ mpUserForm->triggerActivateEvent();
-+ }
-+ }
-+ }
-+
-+ virtual void SAL_CALL windowDeactivated( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException)
-+ {
-+ if ( mpUserForm )
-+ mpUserForm->triggerDeActivateEvent();
-+ }
-+
-+
-+ virtual void SAL_CALL disposing( const lang::EventObject& Source ) throw (uno::RuntimeException)
-+ {
-+ OSL_TRACE("** Userform/Dialog disposing");
-+ mbDisposed = true;
-+ uno::Any aSource;
-+ aSource <<= Source;
-+ mxComponent = NULL;
-+ if ( mpUserForm )
-+ mpUserForm->ResetApiObj();
-+ }
-+};
-+
-+SbUserFormModule::SbUserFormModule( const com::sun::star::script::ModuleInfo& mInfo, bool bIsCompat )
-+ :SbObjModule( mInfo, bIsCompat ), mbInit( false )
-+{
-+ m_xModel.set( mInfo.ModuleObject, uno::UNO_QUERY_THROW );
-+}
-+
-+void SbUserFormModule::ResetApiObj()
-+{
-+ if ( m_xDialog.is() ) // probably someone close the dialog window
-+ {
-+ triggerTerminateEvent();
-+ }
-+ pDocObject = NULL;
-+ m_xDialog = NULL;
-+}
-+
-+void SbUserFormModule::triggerMethod( const String& aMethodToRun )
-+{
-+ OSL_TRACE("*** trigger %s ***", rtl::OUStringToOString( aMethodToRun, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ // Search method
-+ SbxVariable* pMeth = SbObjModule::Find( aMethodToRun, SbxCLASS_METHOD );
-+ if( pMeth )
-+ {
-+ SbxValues aVals;
-+ pMeth->Get( aVals );
-+ }
-+}
-+
-+void SbUserFormModule::triggerActivateEvent( void )
-+{
-+ OSL_TRACE("**** entering SbUserFormModule::triggerActivate");
-+ triggerMethod( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UserForm_activate") ) );
-+ OSL_TRACE("**** leaving SbUserFormModule::triggerActivate");
-+}
-+
-+void SbUserFormModule::triggerDeActivateEvent( void )
-+{
-+ OSL_TRACE("**** SbUserFormModule::triggerDeActivate");
-+ triggerMethod( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Userform_DeActivate") ) );
-+}
-+
-+void SbUserFormModule::triggerInitializeEvent( void )
-+
-+{
-+ if ( mbInit )
-+ return;
-+ OSL_TRACE("**** SbUserFormModule::triggerInitializeEvent");
-+ static String aInitMethodName( RTL_CONSTASCII_USTRINGPARAM("Userform_Initialize") );
-+ triggerMethod( aInitMethodName );
-+ mbInit = true;
-+}
-+
-+void SbUserFormModule::triggerTerminateEvent( void )
-+{
-+ OSL_TRACE("**** SbUserFormModule::triggerTerminateEvent");
-+ static String aTermMethodName( RTL_CONSTASCII_USTRINGPARAM("Userform_Terminate") );
-+ triggerMethod( aTermMethodName );
-+ mbInit=false;
-+}
-+
-+void SbUserFormModule::load()
-+{
-+ OSL_TRACE("** load() ");
-+ // forces a load
-+ if ( !pDocObject )
-+ InitObject();
-+}
-+void SbUserFormModule::Unload()
-+{
-+ OSL_TRACE("** Unload() ");
-+ if ( m_xDialog.is() )
-+ {
-+ triggerTerminateEvent();
-+ }
-+ // Search method
-+ SbxVariable* pMeth = SbObjModule::Find( String( RTL_CONSTASCII_USTRINGPARAM( "UnloadObject" ) ), SbxCLASS_METHOD );
-+ if( pMeth )
-+ {
-+ OSL_TRACE("Attempting too run the UnloadObjectMethod");
-+ m_xDialog = NULL; //release ref to the uno object
-+ SbxValues aVals;
-+ FormObjEventListenerImpl* pFormListener = dynamic_cast< FormObjEventListenerImpl* >( m_DialogListener.get() );
-+ bool bWaitForDispose = true; // assume dialog is showing
-+ if ( pFormListener )
-+ {
-+ bWaitForDispose = pFormListener->isShowing();
-+ OSL_TRACE("Showing %d", bWaitForDispose );
-+ }
-+ pMeth->Get( aVals);
-+ if ( !bWaitForDispose )
-+ {
-+ // we've either already got a dispose or we'er never going to get one
-+ ResetApiObj();
-+ } // else wait for dispose
-+ OSL_TRACE("UnloadObject completed ( we hope )");
-+ }
-+}
-+
-+void SbUserFormModule::InitObject()
-+{
-+ try
-+ {
-+
-+ if ( m_xModel.is() )
-+ {
-+ uno::Reference< lang::XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[ 0 ] <<= m_xModel;
-+ rtl::OUString sDialogUrl( RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.script:" ) );
-+ sDialogUrl = sDialogUrl.concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Standard") ) ).concat( rtl::OUString( '.') ).concat( GetName() ).concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("?location=document") ) );
-+
-+ uno::Reference< awt::XDialogProvider > xProvider( xFactory->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.DialogProvider")), aArgs ), uno::UNO_QUERY_THROW );
-+ m_xDialog = xProvider->createDialog( sDialogUrl );
-+
-+ // create vba api object
-+ aArgs.realloc( 3 );
-+ aArgs[ 0 ] = uno::Any();
-+ aArgs[ 1 ] <<= m_xDialog;
-+ aArgs[ 2 ] <<= m_xModel;
-+ pDocObject = new SbUnoObject( GetName(), uno::makeAny( xFactory->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.UserForm")), aArgs ) ) );
-+ uno::Reference< lang::XComponent > xComponent( aArgs[ 1 ], uno::UNO_QUERY_THROW );
-+ // remove old listener if it exists
-+ FormObjEventListenerImpl* pFormListener = dynamic_cast< FormObjEventListenerImpl* >( m_DialogListener.get() );
-+ if ( pFormListener )
-+ pFormListener->removeListener();
-+ m_DialogListener = new FormObjEventListenerImpl( this, xComponent );
-+
-+ triggerInitializeEvent();
-+ }
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ }
-+
-+}
-+
-+SbxVariable*
-+SbUserFormModule::Find( const XubString& rName, SbxClassType t )
-+{
-+ if ( !pDocObject && !GetSbData()->bRunInit )
-+ InitObject();
-+ return SbObjModule::Find( rName, t );
-+}
- /////////////////////////////////////////////////////////////////////////
-
- SbProperty::SbProperty( const String& r, SbxDataType t, SbModule* p )
-diff --git basic/source/runtime/methods.cxx basic/source/runtime/methods.cxx
-index 792bce2..a0c3cad 100644
---- basic/source/runtime/methods.cxx
-+++ basic/source/runtime/methods.cxx
-@@ -126,6 +126,8 @@ using namespace com::sun::star::io;
-
- using namespace rtl;
-
-+#include <basic/sbobjmod.hxx>
-+
- static void FilterWhiteSpace( String& rStr )
- {
- rStr.EraseAllChars( ' ' );
-@@ -4135,7 +4137,12 @@ RTLFUNC(Load)
-
- // Diesen Call einfach an das Object weiterreichen
- SbxBase* pObj = (SbxObject*)rPar.Get(1)->GetObject();
-- if( pObj && pObj->IsA( TYPE( SbxObject ) ) )
-+ if( pObj && pObj->IsA( TYPE( SbUserFormModule ) ) )
-+ {
-+ SbUserFormModule* pFormModule = ( SbUserFormModule* )pObj;
-+ pFormModule->load();
-+ }
-+ else if( pObj && pObj->IsA( TYPE( SbxObject ) ) )
- {
- SbxVariable* pVar = ((SbxObject*)pObj)->
- Find( String( RTL_CONSTASCII_USTRINGPARAM("Load") ), SbxCLASS_METHOD );
-@@ -4158,7 +4165,12 @@ RTLFUNC(Unload)
-
- // Diesen Call einfach an das Object weitereichen
- SbxBase* pObj = (SbxObject*)rPar.Get(1)->GetObject();
-- if( pObj && pObj->IsA( TYPE( SbxObject ) ) )
-+ if( pObj && pObj->IsA( TYPE( SbUserFormModule ) ) )
-+ {
-+ SbUserFormModule* pFormModule = ( SbUserFormModule* )pObj;
-+ pFormModule->Unload();
-+ }
-+ else if( pObj && pObj->IsA( TYPE( SbxObject ) ) )
- {
- SbxVariable* pVar = ((SbxObject*)pObj)->
- Find( String( RTL_CONSTASCII_USTRINGPARAM("Unload") ), SbxCLASS_METHOD );
diff --git a/patches/vba/vba-variant-fix.diff b/patches/vba/vba-variant-fix.diff
deleted file mode 100644
index efa977950..000000000
--- a/patches/vba/vba-variant-fix.diff
+++ /dev/null
@@ -1,13 +0,0 @@
---- basic/source/sbx/sbxvalue.cxx.orig 2008-09-17 14:56:02.000000000 +0800
-+++ basic/source/sbx/sbxvalue.cxx 2008-09-17 15:11:36.000000000 +0800
-@@ -1147,8 +1147,8 @@ BOOL SbxValue::Compute( SbxOperator eOp,
- {
- SbxValues aL, aR;
- bool bDecimal = false;
-- if( bVBAInterop && ( ( eThisType == SbxSTRING && eOpType != SbxSTRING ) ||
-- ( eThisType != SbxSTRING && eOpType == SbxSTRING ) ) &&
-+ if( bVBAInterop && ( ( eThisType == SbxSTRING && eOpType != SbxSTRING && eOpType != SbxEMPTY ) ||
-+ ( eThisType != SbxSTRING && eThisType != SbxEMPTY && eOpType == SbxSTRING ) ) &&
- ( eOp == SbxMUL || eOp == SbxDIV || eOp == SbxPLUS || eOp == SbxMINUS ) )
- {
- goto Lbl_OpIsDouble;
diff --git a/patches/vba/vba-vpagebreak-object.diff b/patches/vba/vba-vpagebreak-object.diff
deleted file mode 100644
index 06f9b6d83..000000000
--- a/patches/vba/vba-vpagebreak-object.diff
+++ /dev/null
@@ -1,445 +0,0 @@
-diff --git oovbaapi/ooo/vba/excel/XVPageBreak.idl oovbaapi/ooo/vba/excel/XVPageBreak.idl
-new file mode 100755
-index 0000000..8dc9692
---- /dev/null
-+++ oovbaapi/ooo/vba/excel/XVPageBreak.idl
-@@ -0,0 +1,54 @@
-+/*************************************************************************
-+ *
-+ * 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: XVPageBreak.idl,v $
-+ * $Revision: 1.0 $
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_excel_XVPageBreak_idl__
-+#define __ooo_vba_excel_XVPageBreak_idl__
-+
-+#ifndef __ooo_vba_excel_XPageBreak_idl__
-+#include <ooo/vba/excel/XPageBreak.idl>
-+#endif
-+
-+//=============================================================================
-+
-+module ooo { module vba { module excel {
-+
-+//=============================================================================
-+
-+interface XVPageBreak
-+{
-+ interface ::ooo::vba::excel::XPageBreak;
-+};
-+
-+//=============================================================================
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/excel/XVPageBreaks.idl oovbaapi/ooo/vba/excel/XVPageBreaks.idl
-new file mode 100755
-index 0000000..91501db
---- /dev/null
-+++ oovbaapi/ooo/vba/excel/XVPageBreaks.idl
-@@ -0,0 +1,71 @@
-+/*************************************************************************
-+ *
-+ * 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: XVPageBreaks.idl,v $
-+ * $Revision: 1.0 $
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_excel_XVPageBreaks_idl__
-+#define __ooo_vba_excel_XVPageBreaks_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+#ifndef __com_sun_star_helper_script_BasicErrorException_idl__
-+#include <com/sun/star/script/BasicErrorException.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+//=============================================================================
-+
-+module ooo { module vba { module excel {
-+
-+//=============================================================================
-+
-+//interface XVPageBreak;
-+
-+interface XVPageBreaks
-+{
-+ interface ooo::vba::XCollection;
-+
-+ //Methods
-+ any Add( [in] any Before ) raises( com::sun::star::script::BasicErrorException );
-+};
-+
-+//=============================================================================
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/excel/XWorksheet.idl oovbaapi/ooo/vba/excel/XWorksheet.idl
-index 03d2cc3..9e9b803 100644
---- oovbaapi/ooo/vba/excel/XWorksheet.idl
-+++ oovbaapi/ooo/vba/excel/XWorksheet.idl
-@@ -56,6 +56,7 @@ interface XRange;
- interface XOutline;
- interface XPageSetup;
- interface XHPageBreaks;
-+interface XVPageBreaks;
- interface XWorksheet
- {
- interface ::ooo::vba::XHelperInterface;
-@@ -92,6 +93,7 @@ interface XWorksheet
- XOutline Outline();
- XPageSetup PageSetup();
- any HPageBreaks([in] any Index);
-+ any VPageBreaks([in] any Index);
- any OLEObjects([in] any Index);
- void ShowDataForm();
- any Shapes([in] any Index);
-diff --git oovbaapi/ooo/vba/excel/makefile.mk oovbaapi/ooo/vba/excel/makefile.mk
-index 59333bf..2170810 100644
---- oovbaapi/ooo/vba/excel/makefile.mk
-+++ oovbaapi/ooo/vba/excel/makefile.mk
-@@ -98,6 +98,8 @@ IDLFILES= XApplication.idl\
- XPageBreak.idl \
- XHPageBreak.idl \
- XHPageBreaks.idl \
-+ XVPageBreak.idl \
-+ XVPageBreaks.idl \
-
-
- # ------------------------------------------------------------------
-diff --git sc/source/ui/vba/vbapagebreak.cxx sc/source/ui/vba/vbapagebreak.cxx
-old mode 100644
-new mode 100755
-index 581e5bd..13ad8b5
---- sc/source/ui/vba/vbapagebreak.cxx
-+++ 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 sc/source/ui/vba/vbapagebreak.hxx sc/source/ui/vba/vbapagebreak.hxx
-old mode 100644
-new mode 100755
-index a07cfda..04c8702
---- sc/source/ui/vba/vbapagebreak.hxx
-+++ sc/source/ui/vba/vbapagebreak.hxx
-@@ -33,6 +33,7 @@
- #include <cppuhelper/implbase1.hxx>
- #include <ooo/vba/excel/XPageBreak.hpp>
- #include <ooo/vba/excel/XHPageBreak.hpp>
-+#include <ooo/vba/excel/XVPageBreak.hpp>
- #include <ooo/vba/excel/XRange.hpp>
- #include <com/sun/star/uno/XComponentContext.hpp>
- #include <com/sun/star/script/BasicErrorException.hpp>
-@@ -84,4 +85,22 @@ public:
- virtual css::uno::Sequence<rtl::OUString> 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<rtl::OUString> getServiceNames();
-+};
-+
- #endif
-diff --git sc/source/ui/vba/vbapagebreaks.cxx sc/source/ui/vba/vbapagebreaks.cxx
-old mode 100644
-new mode 100755
-index 8859ca6..51eaffb
---- sc/source/ui/vba/vbapagebreaks.cxx
-+++ 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 sc/source/ui/vba/vbapagebreaks.hxx sc/source/ui/vba/vbapagebreaks.hxx
-old mode 100644
-new mode 100755
-index 530d82a..cc2a642
---- sc/source/ui/vba/vbapagebreaks.hxx
-+++ sc/source/ui/vba/vbapagebreaks.hxx
-@@ -33,6 +33,8 @@
- #include <cppuhelper/implbase1.hxx>
- #include <ooo/vba/excel/XHPageBreaks.hpp>
- #include <ooo/vba/excel/XHPageBreak.hpp>
-+#include <ooo/vba/excel/XVPageBreaks.hpp>
-+#include <ooo/vba/excel/XVPageBreak.hpp>
- #include <ooo/vba/excel/XRange.hpp>
- #include <com/sun/star/uno/XComponentContext.hpp>
- #include <com/sun/star/script/BasicErrorException.hpp>
-@@ -68,4 +70,31 @@ public:
- virtual css::uno::Sequence<rtl::OUString> 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<rtl::OUString> getServiceNames();
-+};
-+
- #endif
-diff --git sc/source/ui/vba/vbaworksheet.cxx sc/source/ui/vba/vbaworksheet.cxx
-old mode 100644
-new mode 100755
-index d687610..fddb886
---- sc/source/ui/vba/vbaworksheet.cxx
-+++ sc/source/ui/vba/vbaworksheet.cxx
-@@ -370,6 +370,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)
- {
-diff --git sc/source/ui/vba/vbaworksheet.hxx sc/source/ui/vba/vbaworksheet.hxx
-index e70b282..b275960 100644
---- sc/source/ui/vba/vbaworksheet.hxx
-+++ sc/source/ui/vba/vbaworksheet.hxx
-@@ -44,6 +44,7 @@
- #include <ooo/vba/excel/XOutline.hpp>
- #include <ooo/vba/excel/XPageSetup.hpp>
- #include <ooo/vba/excel/XHPageBreaks.hpp>
-+#include <ooo/vba/excel/XVPageBreaks.hpp>
- #include <ooo/vba/excel/XChartObjects.hpp>
- #include <com/sun/star/container/XNamed.hpp>
-
-@@ -94,6 +95,7 @@ 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);
diff --git a/patches/vba/vba-word-executable-option.diff b/patches/vba/vba-word-executable-option.diff
deleted file mode 100644
index a6333f4f8..000000000
--- a/patches/vba/vba-word-executable-option.diff
+++ /dev/null
@@ -1,351 +0,0 @@
-From 48697c52b7f5f7d64cf8b3b9660543686b0cabeb Mon Sep 17 00:00:00 2001
-From: Jan Holesovsky <kendy@suse.cz>
-Date: Fri, 14 May 2010 17:00:07 +0200
-Subject: [PATCH 396/878] vba-word-executable-option.diff
-
----
- .../schema/org/openoffice/Office/Writer.xcs | 8 +++
- svtools/inc/fltrcfg.hxx | 2 +
- svtools/source/config/fltrcfg.cxx | 62 +++++++++++++++++++-
- svx/source/cui/optfltr.cxx | 13 ++++
- svx/source/cui/optfltr.hrc | 1 +
- svx/source/cui/optfltr.hxx | 2 +
- svx/source/cui/optfltr.src | 23 +++++---
- sw/source/filter/ww8/ww8par.cxx | 8 ++-
- 8 files changed, 107 insertions(+), 12 deletions(-)
-
-diff --git a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs
-index 369110b..a504cf1 100644
---- a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs
-+++ b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs
-@@ -6043,6 +6043,14 @@
- </info>
- <value>true</value>
- </prop>
-+ <prop oor:name="Executable" oor:type="xs:boolean">
-+ <info>
-+ <author>pflin</author>
-+ <desc>Indicates whether VBA macros are imported without comments to be executable.</desc>
-+ <label>Executable code</label>
-+ </info>
-+ <value>true</value>
-+ </prop>
- <prop oor:name="Save" oor:type="xs:boolean">
- <!-- OldPath: Filter/MS_Office/Basic/Word -->
- <!-- OldLocation: soffice.cfg -->
-diff --git a/svtools/inc/fltrcfg.hxx b/svtools/inc/fltrcfg.hxx
-index d4f2a64..1eb3a51 100644
---- a/svtools/inc/fltrcfg.hxx
-+++ b/svtools/inc/fltrcfg.hxx
-@@ -48,6 +48,8 @@ public:
-
- void SetLoadWordBasicCode( sal_Bool bFlag );
- sal_Bool IsLoadWordBasicCode() const;
-+ void SetLoadWordBasicExecutable( sal_Bool bFlag );
-+ sal_Bool IsLoadWordBasicExecutable() const;
- void SetLoadWordBasicStorage( sal_Bool bFlag );
- sal_Bool IsLoadWordBasicStorage() const;
-
-diff --git a/svtools/source/config/fltrcfg.cxx b/svtools/source/config/fltrcfg.cxx
-index 6987ab1..44741af 100644
---- a/svtools/source/config/fltrcfg.cxx
-+++ b/svtools/source/config/fltrcfg.cxx
-@@ -61,6 +61,7 @@ using namespace com::sun::star::uno;
- #define FILTERCFG_ENABLE_EXCEL_PREVIEW 0x40000
- #define FILTERCFG_ENABLE_WORD_PREVIEW 0x80000
- #define FILTERCFG_USE_ENHANCED_FIELDS 0x100000
-+#define FILTERCFG_WORD_WBCTBL 0x200000
-
- static SvtFilterOptions* pOptions=0;
-
-@@ -142,6 +143,52 @@ void SvtAppFilterOptions_Impl::Load()
- }
-
- // -----------------------------------------------------------------------
-+class SvtWriterFilterOptions_Impl : public SvtAppFilterOptions_Impl
-+{
-+ sal_Bool bLoadExecutable;
-+public:
-+ SvtWriterFilterOptions_Impl(const OUString& rRoot) :
-+ SvtAppFilterOptions_Impl(rRoot),
-+ bLoadExecutable(sal_False)
-+ {}
-+ virtual void Commit();
-+ void Load();
-+
-+ sal_Bool IsLoadExecutable() const {return bLoadExecutable;}
-+ void SetLoadExecutable(sal_Bool bSet)
-+ {
-+ if(bSet != bLoadExecutable)
-+ SetModified();
-+ bLoadExecutable = bSet;
-+ }
-+};
-+
-+void SvtWriterFilterOptions_Impl::Commit()
-+{
-+ SvtAppFilterOptions_Impl::Commit();
-+
-+ Sequence<OUString> aNames(1);
-+ aNames[0] = C2U("Executable");
-+ Sequence<Any> aValues(1);
-+ aValues[0] <<= bLoadExecutable;
-+
-+ PutProperties(aNames, aValues);
-+}
-+
-+void SvtWriterFilterOptions_Impl::Load()
-+{
-+ SvtAppFilterOptions_Impl::Load();
-+
-+ Sequence<OUString> aNames(1);
-+ aNames[0] = C2U("Executable");
-+
-+ Sequence<Any> aValues = GetProperties(aNames);
-+ const Any* pValues = aValues.getConstArray();
-+ if(pValues[0].hasValue())
-+ bLoadExecutable = *(sal_Bool*)pValues[0].getValue();
-+}
-+
-+// -----------------------------------------------------------------------
- class SvtCalcFilterOptions_Impl : public SvtAppFilterOptions_Impl
- {
- sal_Bool bLoadExecutable;
-@@ -193,7 +240,7 @@ void SvtCalcFilterOptions_Impl::Load()
- struct SvtFilterOptions_Impl
- {
- ULONG nFlags;
-- SvtAppFilterOptions_Impl aWriterCfg;
-+ SvtWriterFilterOptions_Impl aWriterCfg;
- SvtCalcFilterOptions_Impl aCalcCfg;
- SvtAppFilterOptions_Impl aImpressCfg;
-
-@@ -238,6 +285,7 @@ void SvtFilterOptions_Impl::SetFlag( ULONG nFlag, BOOL bSet )
- {
- case FILTERCFG_WORD_CODE: aWriterCfg.SetLoad(bSet);break;
- case FILTERCFG_WORD_STORAGE: aWriterCfg.SetSave(bSet);break;
-+ case FILTERCFG_WORD_WBCTBL: aWriterCfg.SetLoadExecutable(bSet);break;
- case FILTERCFG_EXCEL_CODE: aCalcCfg.SetLoad(bSet);break;
- case FILTERCFG_EXCEL_STORAGE: aCalcCfg.SetSave(bSet);break;
- case FILTERCFG_EXCEL_EXECTBL: aCalcCfg.SetLoadExecutable(bSet);break;
-@@ -260,6 +308,7 @@ BOOL SvtFilterOptions_Impl::IsFlag( ULONG nFlag ) const
- {
- case FILTERCFG_WORD_CODE : bRet = aWriterCfg.IsLoad();break;
- case FILTERCFG_WORD_STORAGE : bRet = aWriterCfg.IsSave();break;
-+ case FILTERCFG_WORD_WBCTBL : bRet = aWriterCfg.IsLoadExecutable();break;
- case FILTERCFG_EXCEL_CODE : bRet = aCalcCfg.IsLoad();break;
- case FILTERCFG_EXCEL_STORAGE : bRet = aCalcCfg.IsSave();break;
- case FILTERCFG_EXCEL_EXECTBL : bRet = aCalcCfg.IsLoadExecutable();break;
-@@ -402,6 +451,17 @@ BOOL SvtFilterOptions::IsLoadWordBasicCode() const
- return pImp->IsFlag( FILTERCFG_WORD_CODE );
- }
-
-+void SvtFilterOptions::SetLoadWordBasicExecutable( BOOL bFlag )
-+{
-+ pImp->SetFlag( FILTERCFG_WORD_WBCTBL, bFlag );
-+ SetModified();
-+}
-+
-+BOOL SvtFilterOptions::IsLoadWordBasicExecutable() const
-+{
-+ return pImp->IsFlag( FILTERCFG_WORD_WBCTBL );
-+}
-+
- void SvtFilterOptions::SetLoadWordBasicStorage( BOOL bFlag )
- {
- pImp->SetFlag( FILTERCFG_WORD_STORAGE, bFlag );
-diff --git a/svx/source/cui/optfltr.cxx b/svx/source/cui/optfltr.cxx
-index 5d4ba21..5fac4e5 100644
---- a/svx/source/cui/optfltr.cxx
-+++ b/svx/source/cui/optfltr.cxx
-@@ -59,6 +59,7 @@ OfaMSFilterTabPage::OfaMSFilterTabPage(Window* pParent, const SfxItemSet& rSet)
- : SfxTabPage( pParent, SVX_RES( RID_OFAPAGE_MSFILTEROPT ), rSet ),
- aMSWordGB ( this, SVX_RES( GB_WORD ) ),
- aWBasicCodeCB ( this, SVX_RES( CB_WBAS_CODE ) ),
-+ aWBasicWbctblCB ( this, SVX_RES( CB_WBAS_WBCTBL ) ),
- aWBasicStgCB ( this, SVX_RES( CB_WBAS_STG ) ),
- aMSExcelGB ( this, SVX_RES( GB_EXCEL ) ),
- aEBasicCodeCB ( this, SVX_RES( CB_EBAS_CODE ) ),
-@@ -70,6 +71,7 @@ OfaMSFilterTabPage::OfaMSFilterTabPage(Window* pParent, const SfxItemSet& rSet)
- {
- FreeResource();
-
-+ aWBasicCodeCB.SetClickHdl( LINK( this, OfaMSFilterTabPage, LoadWordBasicCheckHdl_Impl ) );
- aEBasicCodeCB.SetClickHdl( LINK( this, OfaMSFilterTabPage, LoadExcelBasicCheckHdl_Impl ) );
- }
-
-@@ -77,6 +79,12 @@ OfaMSFilterTabPage::~OfaMSFilterTabPage()
- {
- }
-
-+IMPL_LINK( OfaMSFilterTabPage, LoadWordBasicCheckHdl_Impl, CheckBox*, EMPTYARG )
-+{
-+ aWBasicWbctblCB.Enable( aWBasicCodeCB.IsChecked() );
-+ return 0;
-+}
-+
- IMPL_LINK( OfaMSFilterTabPage, LoadExcelBasicCheckHdl_Impl, CheckBox*, EMPTYARG )
- {
- aEBasicExectblCB.Enable( aEBasicCodeCB.IsChecked() );
-@@ -96,6 +104,8 @@ BOOL OfaMSFilterTabPage::FillItemSet( SfxItemSet& )
- BOOL bFlag;
- if( aWBasicCodeCB.GetSavedValue() != (bFlag = aWBasicCodeCB.IsChecked()))
- pOpt->SetLoadWordBasicCode( bFlag );
-+ if( aWBasicWbctblCB.GetSavedValue() != (bFlag = aWBasicWbctblCB.IsChecked()))
-+ pOpt->SetLoadWordBasicExecutable( bFlag );
- if( aWBasicStgCB.GetSavedValue() != (bFlag = aWBasicStgCB.IsChecked()))
- pOpt->SetLoadWordBasicStorage( bFlag );
-
-@@ -124,8 +134,11 @@ void OfaMSFilterTabPage::Reset( const SfxItemSet& )
-
- aWBasicCodeCB.Check( pOpt->IsLoadWordBasicCode() );
- aWBasicCodeCB.SaveValue();
-+ aWBasicWbctblCB.Check( pOpt->IsLoadWordBasicExecutable() );
-+ aWBasicWbctblCB.SaveValue();
- aWBasicStgCB.Check( pOpt->IsLoadWordBasicStorage() );
- aWBasicStgCB.SaveValue();
-+ LoadWordBasicCheckHdl_Impl( &aWBasicCodeCB );
-
- aEBasicCodeCB.Check( pOpt->IsLoadExcelBasicCode() );
- aEBasicCodeCB.SaveValue();
-diff --git a/svx/source/cui/optfltr.hrc b/svx/source/cui/optfltr.hrc
-index 9164d80..7677f84 100644
---- a/svx/source/cui/optfltr.hrc
-+++ b/svx/source/cui/optfltr.hrc
-@@ -40,6 +40,7 @@
- #define CB_EBAS_STG 5
- #define CB_PBAS_CODE 6
- #define CB_PBAS_STG 7
-+#define CB_WBAS_WBCTBL 8
-
- #define CLB_SETTINGS 1
- #define ST_CHG_MATH 1
-diff --git a/svx/source/cui/optfltr.hxx b/svx/source/cui/optfltr.hxx
-index 1ac244e..bbf0a27 100644
---- a/svx/source/cui/optfltr.hxx
-+++ b/svx/source/cui/optfltr.hxx
-@@ -43,6 +43,7 @@ class OfaMSFilterTabPage : public SfxTabPage
- {
- FixedLine aMSWordGB;
- CheckBox aWBasicCodeCB;
-+ CheckBox aWBasicWbctblCB;
- CheckBox aWBasicStgCB;
- FixedLine aMSExcelGB;
- CheckBox aEBasicCodeCB;
-@@ -55,6 +56,7 @@ class OfaMSFilterTabPage : public SfxTabPage
- OfaMSFilterTabPage( Window* pParent, const SfxItemSet& rSet );
- virtual ~OfaMSFilterTabPage();
-
-+ DECL_LINK( LoadWordBasicCheckHdl_Impl, CheckBox* );
- DECL_LINK( LoadExcelBasicCheckHdl_Impl, CheckBox* );
- public:
-
-diff --git a/svx/source/cui/optfltr.src b/svx/source/cui/optfltr.src
-index 5216d21..76a7f8e 100644
---- a/svx/source/cui/optfltr.src
-+++ b/svx/source/cui/optfltr.src
-@@ -51,9 +51,16 @@ TabPage RID_OFAPAGE_MSFILTEROPT
- TabStop = TRUE ;
- Text [ en-US ] = "Load Basic ~code";
- };
-+ CheckBox CB_WBAS_WBCTBL
-+ {
-+ Pos = MAP_APPFONT ( 22 , 28 ) ;
-+ Size = MAP_APPFONT ( 236 , 10 ) ;
-+ TabStop = TRUE ;
-+ Text [ en-US ] = "E~xecutable code";
-+ };
- CheckBox CB_WBAS_STG
- {
-- Pos = MAP_APPFONT ( 12 , 28 ) ;
-+ Pos = MAP_APPFONT ( 12 , 42 ) ;
- Size = MAP_APPFONT ( 236 , 10 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "Save ~original Basic code";
-@@ -61,27 +68,27 @@ TabPage RID_OFAPAGE_MSFILTEROPT
-
- FixedLine GB_EXCEL
- {
-- Pos = MAP_APPFONT ( 6 , 44 ) ;
-+ Pos = MAP_APPFONT ( 6 , 58 ) ;
- Size = MAP_APPFONT ( 248 , 8 ) ;
- Text [ en-US ] = "Microsoft Excel 97/2000/XP";
- };
- CheckBox CB_EBAS_CODE
- {
-- Pos = MAP_APPFONT ( 12 , 55 ) ;
-+ Pos = MAP_APPFONT ( 12 , 69 ) ;
- Size = MAP_APPFONT ( 236 , 10 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "Lo~ad Basic code";
- };
- CheckBox CB_EBAS_EXECTBL
- {
-- Pos = MAP_APPFONT ( 22 , 69 ) ;
-+ Pos = MAP_APPFONT ( 22 , 83 ) ;
- Size = MAP_APPFONT ( 236 , 10 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "E~xecutable code";
- };
- CheckBox CB_EBAS_STG
- {
-- Pos = MAP_APPFONT ( 12 , 83 ) ;
-+ Pos = MAP_APPFONT ( 12 , 97 ) ;
- Size = MAP_APPFONT ( 236 , 10 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "Sa~ve original Basic code";
-@@ -89,20 +96,20 @@ TabPage RID_OFAPAGE_MSFILTEROPT
-
- FixedLine GB_PPOINT
- {
-- Pos = MAP_APPFONT ( 6 , 99 ) ;
-+ Pos = MAP_APPFONT ( 6 , 113 ) ;
- Size = MAP_APPFONT ( 248 , 8 ) ;
- Text [ en-US ] = "Microsoft PowerPoint 97/2000/XP";
- };
- CheckBox CB_PBAS_CODE
- {
-- Pos = MAP_APPFONT ( 12 , 110 ) ;
-+ Pos = MAP_APPFONT ( 12 , 124 ) ;
- Size = MAP_APPFONT ( 236 , 10 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "Load Ba~sic code";
- };
- CheckBox CB_PBAS_STG
- {
-- Pos = MAP_APPFONT ( 12 , 124 ) ;
-+ Pos = MAP_APPFONT ( 12 , 138 ) ;
- Size = MAP_APPFONT ( 236 , 10 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "Sav~e original Basic code";
-diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
-index 98233dd..1014927 100644
---- a/sw/source/filter/ww8/ww8par.cxx
-+++ b/sw/source/filter/ww8/ww8par.cxx
-@@ -3956,10 +3956,11 @@ bool SwWW8ImplReader::ReadGlobalTemplateSettings( const rtl::OUString& sCreatedF
- pVBAFlags->IsLoadWordBasicCode(),
- pVBAFlags->IsLoadWordBasicStorage() );
-
--
- String s1(CREATE_CONST_ASC("Macros"));
- String s2(CREATE_CONST_ASC("VBA"));
-- int nRet = aVBasic.Import( s1, s2, ! pVBAFlags->IsLoadWordBasicCode() );
-+
-+ bool bAsComment = !pVBAFlags->IsLoadWordBasicExecutable();
-+ int nRet = aVBasic.Import( s1, s2, bAsComment );
- lcl_createTemplateToProjectEntry( xPrjNameCache, aURL, aVBasic.GetVBAProjectName() );
- // Read toolbars & menus
- SvStorageStreamRef refMainStream = rRoot->OpenSotStream( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WordDocument") ) );
-@@ -4293,7 +4294,8 @@ ULONG SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
- pVBAFlags->IsLoadWordBasicStorage() );
- String s1(CREATE_CONST_ASC("Macros"));
- String s2(CREATE_CONST_ASC("VBA"));
-- int nRet = aVBasic.Import( s1, s2, ! pVBAFlags->IsLoadWordBasicCode() );
-+ bool bAsComment = !pVBAFlags->IsLoadWordBasicExecutable();
-+ int nRet = aVBasic.Import( s1, s2, bAsComment );
- // dissable below for 3.1 at the moment, 'cause it's kinda immature
- // similarly the project reference in svx/source/msvba
- #if 1
---
-1.7.0.1
-
diff --git a/patches/vba/vba-word-support-m4.diff b/patches/vba/vba-word-support-m4.diff
deleted file mode 100644
index c1e2ac142..000000000
--- a/patches/vba/vba-word-support-m4.diff
+++ /dev/null
@@ -1,15050 +0,0 @@
-diff --git offapi/com/sun/star/document/VbaEventId.idl offapi/com/sun/star/document/VbaEventId.idl
-index eaeb877..b5af431 100644
---- offapi/com/sun/star/document/VbaEventId.idl
-+++ offapi/com/sun/star/document/VbaEventId.idl
-@@ -75,6 +75,13 @@ constants VbaEventId
- const long VBAEVENT_WORKBOOK_SHEET_FOLLOWHYPERLINK = 57;
- const long VBAEVENT_WORKBOOK_SHEET_PIVOTTABLEUPDATE = 58;
- const long VBAEVENT_WORKBOOK_SHEET_SELECTIONCHANGE = 59;
-+
-+ // Document event for Word
-+ const long VBAEVENT_DOCUMENT_NEW = 70;
-+ const long VBAEVENT_DOCUMENT_AUTONEW = 71;
-+ const long VBAEVENT_DOCUMENT_OPEN = 72;
-+ const long VBAEVENT_DOCUMENT_AUTOOPEN = 73;
-+ const long VBAEVENT_DOCUMENT_CLOSE = 74;
- };
-
- }; }; }; };
-diff --git offapi/com/sun/star/document/VbaEventsHelper.idl offapi/com/sun/star/document/VbaEventsHelper.idl
-index 610970e..30f8f7e 100644
---- offapi/com/sun/star/document/VbaEventsHelper.idl
-+++ offapi/com/sun/star/document/VbaEventsHelper.idl
-@@ -32,8 +32,8 @@
- * MA 02111-1307 USA
- *
- ************************************************************************/
--#ifndef __org_openoffice_vba_VbaEventsHelper_idl__
--#define __org_openoffice_vba_VbaEventsHelper_idl__
-+#ifndef __com_sun_star_document_VbaEventsHelper_idl__
-+#define __com_sun_star_document_VbaEventsHelper_idl__
-
- #ifndef __com_sun_star_uno_XInterface_idl__
- #include <com/sun/star/uno/XInterface.idl>
-diff --git offapi/com/sun/star/sheet/SpreadsheetDocumentVbaEventsHelper.idl offapi/com/sun/star/sheet/SpreadsheetDocumentVbaEventsHelper.idl
-new file mode 100644
-index 0000000..b08a58c
---- /dev/null
-+++ offapi/com/sun/star/sheet/SpreadsheetDocumentVbaEventsHelper.idl
-@@ -0,0 +1,52 @@
-+/*************************************************************************
-+ *
-+ * 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: TextDocument.idl,v $
-+ * $Revision: 1.18 $
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __com_sun_star_sheet_SpreadsheetDocumentVbaEventsHelper_idl__
-+#define __com_sun_star_sheet_SpreadsheetDocumentVbaEventsHelper_idl__
-+
-+#ifndef __com_sun_star_document_VbaEventsHelper_idl__
-+#include <com/sun/star/document/VbaEventsHelper.idl>
-+#endif
-+
-+//=============================================================================
-+
-+ module com { module sun { module star { module sheet {
-+
-+//=============================================================================
-+
-+service SpreadsheetDocumentVbaEventsHelper
-+{
-+ service com::sun::star::document::VbaEventsHelper;
-+};
-+
-+//=============================================================================
-+
-+}; }; }; };
-+
-+#endif
-diff --git offapi/com/sun/star/sheet/makefile.mk offapi/com/sun/star/sheet/makefile.mk
-index 468e96b..6d245e7 100644
---- offapi/com/sun/star/sheet/makefile.mk
-+++ offapi/com/sun/star/sheet/makefile.mk
-@@ -198,6 +198,7 @@ IDLFILES=\
- Spreadsheet.idl\
- SpreadsheetDocument.idl\
- SpreadsheetDocumentSettings.idl\
-+ SpreadsheetDocumentVbaEventsHelper.idl\
- SpreadsheetDrawPage.idl\
- SpreadsheetView.idl\
- SpreadsheetViewPane.idl\
-diff --git offapi/com/sun/star/text/TextDocumentVbaEventsHelper.idl offapi/com/sun/star/text/TextDocumentVbaEventsHelper.idl
-new file mode 100644
-index 0000000..b4f2707
---- /dev/null
-+++ offapi/com/sun/star/text/TextDocumentVbaEventsHelper.idl
-@@ -0,0 +1,52 @@
-+/*************************************************************************
-+ *
-+ * 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: TextDocument.idl,v $
-+ * $Revision: 1.18 $
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __com_sun_star_text_TextDocumentVbaEventsHelper_idl__
-+#define __com_sun_star_text_TextDocumentVbaEventsHelper_idl__
-+
-+#ifndef __com_sun_star_document_VbaEventsHelper_idl__
-+#include <com/sun/star/document/VbaEventsHelper.idl>
-+#endif
-+
-+//=============================================================================
-+
-+ module com { module sun { module star { module text {
-+
-+//=============================================================================
-+
-+service TextDocumentVbaEventsHelper
-+{
-+ service com::sun::star::document::VbaEventsHelper;
-+};
-+
-+//=============================================================================
-+
-+}; }; }; };
-+
-+#endif
-diff --git offapi/com/sun/star/text/makefile.mk offapi/com/sun/star/text/makefile.mk
-index c018c94..c639d7b 100644
---- offapi/com/sun/star/text/makefile.mk
-+++ offapi/com/sun/star/text/makefile.mk
-@@ -156,6 +156,7 @@ IDLFILES=\
- TextContentCollection.idl\
- TextCursor.idl\
- TextDocument.idl\
-+ TextDocumentVbaEventsHelper.idl\
- TextDocumentView.idl\
- TextEmbeddedObject.idl\
- TextEmbeddedObjects.idl\
-diff --git oovbaapi/ooo/vba/XDocumentBase.idl oovbaapi/ooo/vba/XDocumentBase.idl
-index aab3c8e..0c74fa8 100644
---- oovbaapi/ooo/vba/XDocumentBase.idl
-+++ oovbaapi/ooo/vba/XDocumentBase.idl
-@@ -58,7 +58,6 @@ interface XDocumentBase
- void Close([in] any SaveChanges, [in] any FileName, [in] any RouteWorkBook);
- void Save();
- void Activate();
-- void Protect( [in] any Password );
- void Unprotect( [in] any Password );
- };
-
-diff --git oovbaapi/ooo/vba/excel/XWorkbook.idl oovbaapi/ooo/vba/excel/XWorkbook.idl
-index 4aa9403..d763f2c 100644
---- oovbaapi/ooo/vba/excel/XWorkbook.idl
-+++ oovbaapi/ooo/vba/excel/XWorkbook.idl
-@@ -65,6 +65,7 @@ interface XWorkbook : com::sun::star::uno::XInterface
- any Colors([in] any Index) raises (com::sun::star::script::BasicErrorException);
- long FileFormat() raises (com::sun::star::script::BasicErrorException);
- void SaveCopyAs( [in] string Filename );
-+ void Protect( [in] any Password );
- };
-
- }; }; };
-diff --git oovbaapi/ooo/vba/msforms/XCheckBox.idl oovbaapi/ooo/vba/msforms/XCheckBox.idl
-new file mode 100644
-index 0000000..30bdee0
---- /dev/null
-+++ oovbaapi/ooo/vba/msforms/XCheckBox.idl
-@@ -0,0 +1,53 @@
-+/*************************************************************************
-+ *
-+ * 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: XCheckBox.idl,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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_msforms_XCheckBox_idl__
-+#define __ooo_vba_msforms_XCheckBox_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+//=============================================================================
-+
-+module ooo { module vba { module msforms {
-+
-+//=============================================================================
-+interface XCheckBox: com::sun::star::uno::XInterface
-+{
-+ [attribute] string Caption;
-+ [attribute] any Value;
-+};
-+
-+//=============================================================================
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/msforms/XComboBox.idl oovbaapi/ooo/vba/msforms/XComboBox.idl
-index 42fb76a..c0e8ee3 100644
---- oovbaapi/ooo/vba/msforms/XComboBox.idl
-+++ oovbaapi/ooo/vba/msforms/XComboBox.idl
-@@ -50,6 +50,7 @@ interface XComboBox: ::com::sun::star::uno::XInterface
- void AddItem( [in] any pvargItem, [in] any pvargIndex );
- void removeItem( [in] any index );
- void Clear();
-+ any List( [in] any pvargIndex, [in] any pvarColumn );
- };
-
- //=============================================================================
-diff --git oovbaapi/ooo/vba/msforms/XControl.idl oovbaapi/ooo/vba/msforms/XControl.idl
-index 303b211..12f33bb 100644
---- oovbaapi/ooo/vba/msforms/XControl.idl
-+++ oovbaapi/ooo/vba/msforms/XControl.idl
-@@ -62,6 +62,7 @@ interface XControl
- [attribute] double Top;
- [attribute] string Name;
- [attribute] string ControlTipText;
-+ [attribute] long ForeColor;
- };
-
- //=============================================================================
-diff --git oovbaapi/ooo/vba/msforms/XLabel.idl oovbaapi/ooo/vba/msforms/XLabel.idl
-index c44a063..c5e7e65 100644
---- oovbaapi/ooo/vba/msforms/XLabel.idl
-+++ oovbaapi/ooo/vba/msforms/XLabel.idl
-@@ -42,7 +42,7 @@ interface XLabel: com::sun::star::uno::XInterface
- {
- [attribute] string Caption;
- [attribute] any Value;
-- [attribute] long ForeColor; //liuchen 2009-7-3
-+ [attribute] string Accelerator;
- };
-
- //=============================================================================
-diff --git oovbaapi/ooo/vba/msforms/XShapeRange.idl oovbaapi/ooo/vba/msforms/XShapeRange.idl
-index 0ae1883..34dd2dc 100644
---- oovbaapi/ooo/vba/msforms/XShapeRange.idl
-+++ oovbaapi/ooo/vba/msforms/XShapeRange.idl
-@@ -50,6 +50,7 @@ interface XShapeRange
- {
- interface ooo::vba::XCollection;
-
-+ [attribute] string Name;
- [attribute] double Height;
- [attribute] double Width;
- [attribute] double Left;
-@@ -68,6 +69,7 @@ interface XShapeRange
- void IncrementRotation( [in] double Increment );
- void IncrementLeft( [in] double Increment );
- void IncrementTop( [in] double Increment );
-+ void ZOrder( [in] long ZOrderCmd );
- };
- }; }; };
-
-diff --git oovbaapi/ooo/vba/msforms/makefile.mk oovbaapi/ooo/vba/msforms/makefile.mk
-index 02da992..79a9924 100644
---- oovbaapi/ooo/vba/msforms/makefile.mk
-+++ oovbaapi/ooo/vba/msforms/makefile.mk
-@@ -48,6 +48,7 @@ IDLFILES=\
- XLabel.idl \
- XTextBox.idl \
- XRadioButton.idl \
-+ XCheckBox.idl \
- XShape.idl \
- XShapes.idl \
- XLineFormat.idl \
-diff --git oovbaapi/ooo/vba/word/XApplication.idl oovbaapi/ooo/vba/word/XApplication.idl
-index b3623e4..0b07dd8 100644
---- oovbaapi/ooo/vba/word/XApplication.idl
-+++ oovbaapi/ooo/vba/word/XApplication.idl
-@@ -60,6 +60,7 @@ interface XApplication : com::sun::star::uno::XInterface
- any Documents( [in] any aIndex );
- any Addins( [in] any aIndex );
- any Dialogs( [in] any aIndex );
-+ any ListGalleries( [in] any aIndex );
- float CentimetersToPoints([in] float Centimeters );
- };
-
-diff --git oovbaapi/ooo/vba/word/XCell.idl oovbaapi/ooo/vba/word/XCell.idl
-new file mode 100644
-index 0000000..700b9dc
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XCell.idl
-@@ -0,0 +1,59 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XCell_idl__
-+#define __ooo_vba_word_XCell_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XCell
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ [attribute] long Width;
-+ [attribute] any Height;
-+ [attribute] long HeightRule;
-+
-+ void SetWidth( [in] float ColumnWidth, [in] long RulerStyle );
-+ void SetHeight( [in] float RowHeight, [in] long HeightRule );
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XCells.idl oovbaapi/ooo/vba/word/XCells.idl
-new file mode 100644
-index 0000000..9a18c55
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XCells.idl
-@@ -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:
-+ * $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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XCells_idl__
-+#define __ooo_vba_word_XCells_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XCells
-+{
-+ interface ::ooo::vba::XCollection;
-+
-+ [attribute] long Width;
-+ [attribute] any Height;
-+ [attribute] long HeightRule;
-+
-+ void SetWidth( [in] float ColumnWidth, [in] long RulerStyle );
-+ void SetHeight( [in] float RowHeight, [in] long HeightRule );
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XCheckBox.idl oovbaapi/ooo/vba/word/XCheckBox.idl
-new file mode 100644
-index 0000000..1baafe5
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XCheckBox.idl
-@@ -0,0 +1,54 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XCheckBox_idl__
-+#define __ooo_vba_word_XCheckBox_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XCheckBox
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ [attribute] boolean Value;
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XColumn.idl oovbaapi/ooo/vba/word/XColumn.idl
-new file mode 100644
-index 0000000..78266fc
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XColumn.idl
-@@ -0,0 +1,56 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XColumn_idl__
-+#define __ooo_vba_word_XColumn_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XColumn
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ [attribute] long Width;
-+
-+ void Select();
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XColumns.idl oovbaapi/ooo/vba/word/XColumns.idl
-new file mode 100644
-index 0000000..84ed9cb
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XColumns.idl
-@@ -0,0 +1,59 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XColumns_idl__
-+#define __ooo_vba_word_XColumns_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XColumns
-+{
-+ interface ::ooo::vba::XCollection;
-+
-+ [attribute] long Width;
-+
-+ void Select();
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XDocument.idl oovbaapi/ooo/vba/word/XDocument.idl
-index a7ceb18..b3ec455 100644
---- oovbaapi/ooo/vba/word/XDocument.idl
-+++ oovbaapi/ooo/vba/word/XDocument.idl
-@@ -52,6 +52,11 @@ interface XDocument : com::sun::star::script::XInvocation
- {
- [attribute, readonly] XRange Content;
- [attribute] any AttachedTemplate;
-+ [attribute] long ProtectionType;
-+ [attribute] boolean UpdateStylesOnOpen;
-+ [attribute] boolean AutoHyphenation;
-+ [attribute] long HyphenationZone;
-+ [attribute] long ConsecutiveHyphensLimit;
-
- XRange Range( [in] any Start, [in] any End );
- any BuiltInDocumentProperties( [in] any index );
-@@ -66,6 +71,14 @@ interface XDocument : com::sun::star::script::XInvocation
- any Sections([in] any Index);
- void Activate();
- any PageSetup();
-+ any TablesOfContents([in] any Index);
-+ any FormFields([in] any Index);
-+ void Protect( [in] long Type, [in] any NOReset, [in] any Password, [in] any UseIRM, [in] any EnforceStyleLock );
-+ void PrintOut([in] any Background, [in] any Append, [in] any Range, [in] any OutputFileName, [in] any From, [in] any To, [in] any Item, [in] any Copies, [in] any Pages, [in] any PageType, [in] any PrintToFile, [in] any Collate, [in] any FileName, [in] any ActivePrinterMacGX, [in] any ManualDuplexPrint, [in] any PrintZoomColumn, [in] any PrintZoomRow, [in] any PrintZoomPaperWidth, [in] any PrintZoomPaperHeight);
-+ void PrintPreview();
-+ void ClosePrintPreview();
-+ any Revisions( [in] any index );
-+ any Frames( [in] any index );
- };
-
- }; }; };
-diff --git oovbaapi/ooo/vba/word/XField.idl oovbaapi/ooo/vba/word/XField.idl
-index 19d3d3b..1acd208 100644
---- oovbaapi/ooo/vba/word/XField.idl
-+++ oovbaapi/ooo/vba/word/XField.idl
-@@ -44,6 +44,8 @@ module ooo { module vba { module word {
- interface XField
- {
- interface ::ooo::vba::XHelperInterface;
-+
-+ boolean Update();
- };
-
- }; }; };
-diff --git oovbaapi/ooo/vba/word/XFormField.idl oovbaapi/ooo/vba/word/XFormField.idl
-new file mode 100644
-index 0000000..23d2a83
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XFormField.idl
-@@ -0,0 +1,58 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XFormField_idl__
-+#define __ooo_vba_word_XFormField_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XFormField
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ [attribute] string Result;
-+ [attribute] boolean Enabled;
-+
-+ any CheckBox();
-+
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XFormFields.idl oovbaapi/ooo/vba/word/XFormFields.idl
-new file mode 100644
-index 0000000..7a19d3b
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XFormFields.idl
-@@ -0,0 +1,55 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XFormFields_idl__
-+#define __ooo_vba_word_XFormFields_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XFormFields
-+{
-+ interface ::ooo::vba::XCollection;
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XFrame.idl oovbaapi/ooo/vba/word/XFrame.idl
-new file mode 100644
-index 0000000..5007405
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XFrame.idl
-@@ -0,0 +1,58 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XFrame_idl__
-+#define __ooo_vba_word_XFrame_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+#ifndef __com_sun_star_container_XNamed_idl__
-+#include <com/sun/star/container/XNamed.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XFrame
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ void Select();
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XFrames.idl oovbaapi/ooo/vba/word/XFrames.idl
-new file mode 100644
-index 0000000..4c81545
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XFrames.idl
-@@ -0,0 +1,55 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XFrames_idl__
-+#define __ooo_vba_word_XFrames_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XFrames
-+{
-+ interface ::ooo::vba::XCollection;
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XGlobals.idl oovbaapi/ooo/vba/word/XGlobals.idl
-index 519499c..33106fa 100644
---- oovbaapi/ooo/vba/word/XGlobals.idl
-+++ oovbaapi/ooo/vba/word/XGlobals.idl
-@@ -52,6 +52,7 @@ interface XGlobals : com::sun::star::uno::XInterface
- any Documents( [in] any aIndex );
- any Addins( [in] any aIndex );
- any Dialogs( [in] any aIndex );
-+ any ListGalleries( [in] any aIndex );
- float CentimetersToPoints([in] float Centimeters );
- };
-
-diff --git oovbaapi/ooo/vba/word/XHeadersFooters.idl oovbaapi/ooo/vba/word/XHeadersFooters.idl
-new file mode 100644
-index 0000000..22066e8
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XHeadersFooters.idl
-@@ -0,0 +1,55 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XHeadersFooters_idl__
-+#define __ooo_vba_word_XHeadersFooters_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XHeadersFooters
-+{
-+ interface ::ooo::vba::XCollection;
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XListFormat.idl oovbaapi/ooo/vba/word/XListFormat.idl
-new file mode 100644
-index 0000000..d9aa65a
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XListFormat.idl
-@@ -0,0 +1,60 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XListFormat_idl__
-+#define __ooo_vba_word_XListFormat_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XListTemplate;
-+interface XListFormat
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ void ApplyListTemplate([in] XListTemplate ListTemplate,
-+ [in] any /* optional */ ContinuePreviousList,
-+ [in] any /* optional */ ApplyTo,
-+ [in] any /* optional */ DefaultListBehavior);
-+
-+ void ConvertNumbersToText();
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XListGalleries.idl oovbaapi/ooo/vba/word/XListGalleries.idl
-new file mode 100644
-index 0000000..9268afc
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XListGalleries.idl
-@@ -0,0 +1,55 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XListGalleries_idl__
-+#define __ooo_vba_word_XListGalleries_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XListGalleries
-+{
-+ interface ::ooo::vba::XCollection;
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XListGallery.idl oovbaapi/ooo/vba/word/XListGallery.idl
-new file mode 100644
-index 0000000..4bd83b9
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XListGallery.idl
-@@ -0,0 +1,54 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XListGallery_idl__
-+#define __ooo_vba_word_XListGallery_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XListGallery
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ any ListTemplates( [in] any aIndex );
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XListLevel.idl oovbaapi/ooo/vba/word/XListLevel.idl
-new file mode 100644
-index 0000000..0ea1be7
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XListLevel.idl
-@@ -0,0 +1,66 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XListLevel_idl__
-+#define __ooo_vba_word_XListLevel_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XFont;
-+interface XListLevel
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ [attribute] long Alignment;
-+ [attribute] XFont Font;
-+ [attribute, readonly] long Index;
-+ [attribute] string LinkedStyle;
-+ [attribute] string NumberFormat;
-+ [attribute] float NumberPosition;
-+ [attribute] long NumberStyle;
-+ [attribute] long ResetOnHigher;
-+ [attribute] long StartAt;
-+ [attribute] float TabPosition;
-+ [attribute] float TextPosition;
-+ [attribute] long TrailingCharacter;
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XListLevels.idl oovbaapi/ooo/vba/word/XListLevels.idl
-new file mode 100644
-index 0000000..522d474
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XListLevels.idl
-@@ -0,0 +1,55 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XListLevels_idl__
-+#define __ooo_vba_word_XListLevels_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XListLevels
-+{
-+ interface ::ooo::vba::XCollection;
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XListTemplate.idl oovbaapi/ooo/vba/word/XListTemplate.idl
-new file mode 100644
-index 0000000..403bfa9
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XListTemplate.idl
-@@ -0,0 +1,54 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XListTemplate_idl__
-+#define __ooo_vba_word_XListTemplate_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XListTemplate
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ any ListLevels( [in] any aIndex );
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XListTemplates.idl oovbaapi/ooo/vba/word/XListTemplates.idl
-new file mode 100644
-index 0000000..d6ec96d
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XListTemplates.idl
-@@ -0,0 +1,55 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XListTemplates_idl__
-+#define __ooo_vba_word_XListTemplates_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XListTemplates
-+{
-+ interface ::ooo::vba::XCollection;
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XParagraph.idl oovbaapi/ooo/vba/word/XParagraph.idl
-index 79ad7ae..7dd2b41 100644
---- oovbaapi/ooo/vba/word/XParagraph.idl
-+++ oovbaapi/ooo/vba/word/XParagraph.idl
-@@ -46,6 +46,7 @@ interface XParagraph
- interface ooo::vba::XHelperInterface;
-
- [attribute, readonly] XRange Range;
-+ [attribute] any Style;
- };
-
- }; }; };
-diff --git oovbaapi/ooo/vba/word/XRange.idl oovbaapi/ooo/vba/word/XRange.idl
-index 47e688e..8f19ad5 100644
---- oovbaapi/ooo/vba/word/XRange.idl
-+++ oovbaapi/ooo/vba/word/XRange.idl
-@@ -48,13 +48,14 @@ module ooo { module vba { module word {
- interface XParagraphFormat;
- interface XStyle;
- interface XFont;
-+interface XListFormat;
- interface XRange
- {
- interface ooo::vba::XHelperInterface;
-
- [attribute] string Text;
- [attribute] XParagraphFormat ParagraphFormat;
-- [attribute] XStyle Style;
-+ [attribute] any Style;
- [attribute,readonly] ::com::sun::star::text::XTextRange XTextRange;
- // Of course Font is NOT readonly, #FIXME #TODO
- // readonly though will force an error attempting to write
-@@ -62,6 +63,7 @@ interface XRange
- [attribute] long LanguageID;
- [attribute] long Start;
- [attribute] long End;
-+ [attribute, readonly] XListFormat ListFormat;
-
- void InsertBreak( [in] any Type );
- void Select();
-@@ -69,6 +71,10 @@ interface XRange
- void InsertParagraphBefore();
- void InsertParagraphAfter();
- any PageSetup();
-+ boolean InRange( [in] XRange Range );
-+ any Revisions( [in] any index );
-+ any Sections( [in] any index );
-+ any Fields( [in] any index );
- };
-
- }; }; };
-diff --git oovbaapi/ooo/vba/word/XReplacement.idl oovbaapi/ooo/vba/word/XReplacement.idl
-index daae501..b1d7a6c 100644
---- oovbaapi/ooo/vba/word/XReplacement.idl
-+++ oovbaapi/ooo/vba/word/XReplacement.idl
-@@ -45,6 +45,8 @@ interface XReplacement
- interface ooo::vba::XHelperInterface;
-
- [attribute] string Text;
-+
-+ void ClearFormatting();
- };
-
- }; }; };
-diff --git oovbaapi/ooo/vba/word/XRevision.idl oovbaapi/ooo/vba/word/XRevision.idl
-new file mode 100644
-index 0000000..bb3e570
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XRevision.idl
-@@ -0,0 +1,56 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XRevision_idl__
-+#define __ooo_vba_word_XRevision_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XRange;
-+interface XRevision
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ void Accept();
-+ void Reject();
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XRevisions.idl oovbaapi/ooo/vba/word/XRevisions.idl
-new file mode 100644
-index 0000000..358face
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XRevisions.idl
-@@ -0,0 +1,58 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XRevisions_idl__
-+#define __ooo_vba_word_XRevisions_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XRevisions
-+{
-+ interface ::ooo::vba::XCollection;
-+
-+ void AcceptAll();
-+ void RejectAll();
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XRow.idl oovbaapi/ooo/vba/word/XRow.idl
-new file mode 100644
-index 0000000..2c54828
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XRow.idl
-@@ -0,0 +1,58 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XRow_idl__
-+#define __ooo_vba_word_XRow_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XRow
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ [attribute] any Height;
-+ [attribute] long HeightRule;
-+
-+ void Select();
-+ void SetHeight( [in] float RowHeight, [in] long HeightRule );
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XRows.idl oovbaapi/ooo/vba/word/XRows.idl
-new file mode 100644
-index 0000000..8d0ae61
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XRows.idl
-@@ -0,0 +1,63 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XRows_idl__
-+#define __ooo_vba_word_XRows_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XRows
-+{
-+ interface ::ooo::vba::XCollection;
-+
-+ [attribute] long Alignment;
-+ [attribute] any AllowBreakAcrossPages;
-+ [attribute] float SpaceBetweenColumns;
-+
-+ void Delete();
-+ void SetLeftIndent( [in] float LeftIndent, [in] long RulerStyle );
-+ void Select();
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XSection.idl oovbaapi/ooo/vba/word/XSection.idl
-index c79a24b..6a8671c 100644
---- oovbaapi/ooo/vba/word/XSection.idl
-+++ oovbaapi/ooo/vba/word/XSection.idl
-@@ -46,8 +46,8 @@ interface XSection
-
- [attribute] boolean ProtectedForForms;
-
-- any Headers();
-- any Footers();
-+ any Headers( [in] any aIndex );
-+ any Footers( [in] any aIndex );
- any PageSetup();
- };
-
-diff --git oovbaapi/ooo/vba/word/XSelection.idl oovbaapi/ooo/vba/word/XSelection.idl
-index 44026da..696e7df 100644
---- oovbaapi/ooo/vba/word/XSelection.idl
-+++ oovbaapi/ooo/vba/word/XSelection.idl
-@@ -55,7 +55,7 @@ interface XSelection
- [attribute, readonly] XRange Range;
- [attribute] XParagraphFormat ParagraphFormat;
- [attribute, readonly] XFind Find;
-- [attribute] XStyle Style;
-+ [attribute] any Style;
- [attribute, readonly] XFont Font;
- [attribute, readonly] XHeaderFooter HeaderFooter;
- [attribute] long LanguageID;
-@@ -71,6 +71,7 @@ interface XSelection
- void MoveRight( [in] any Unit, [in] any Count, [in] any Extend );
- void MoveLeft( [in] any Unit, [in] any Count, [in] any Extend );
- void MoveDown( [in] any Unit, [in] any Count, [in] any Extend );
-+ void MoveUp( [in] any Unit, [in] any Count, [in] any Extend );
- void TypeParagraph();
- void InsertParagraph();
- void InsertParagraphBefore();
-@@ -80,6 +81,19 @@ interface XSelection
- any Information( [in] long Type );
- void InsertBreak( [in] any Type );
- any ShapeRange();
-+ void SelectColumn();
-+ void SelectRow();
-+ any Rows( [in] any aIndex );
-+ any Columns( [in] any aIndex );
-+ any Cells( [in] any aIndex );
-+ void Copy();
-+ void CopyAsPicture();
-+ void Paste();
-+ void Collapse([in] any Direction);
-+ void WholeStory();
-+ boolean InRange( [in] XRange Range );
-+ void SplitTable();
-+ any Paragraphs( [in] any aIndex );
- };
-
- }; }; };
-diff --git oovbaapi/ooo/vba/word/XStyle.idl oovbaapi/ooo/vba/word/XStyle.idl
-index af19517..9eb9381 100644
---- oovbaapi/ooo/vba/word/XStyle.idl
-+++ oovbaapi/ooo/vba/word/XStyle.idl
-@@ -38,17 +38,32 @@
- #include <ooo/vba/XHelperInterface.idl>
- #endif
-
-+#ifndef __com_sun_star_script_XDefaultProperty_idl__
-+#include <com/sun/star/script/XDefaultProperty.idl>
-+#endif
-+
- module ooo { module vba { module word {
-
- interface XFont;
-+interface XListTemplate;
-+interface XParagraphFormat;
- interface XStyle
- {
- interface ooo::vba::XHelperInterface;
-+ interface com::sun::star::script::XDefaultProperty;
-
- [attribute] string Name;
- [attribute] long LanguageID;
- [attribute, readonly] long Type;
- [attribute, readonly] XFont Font;
-+ [attribute] string NameLocal;
-+ [attribute, readonly] XParagraphFormat ParagraphFormat;
-+ [attribute] boolean AutomaticallyUpdate;
-+ [attribute] any BaseStyle;
-+ [attribute] any NextParagraphStyle;
-+ [attribute, readonly] long ListLevelNumber;
-+
-+ void LinkToListTemplate( [in] XListTemplate ListTemplate, [in] any ListLevelNumber );
- };
-
- }; }; };
-diff --git oovbaapi/ooo/vba/word/XTabStop.idl oovbaapi/ooo/vba/word/XTabStop.idl
-new file mode 100644
-index 0000000..b9cf94d
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XTabStop.idl
-@@ -0,0 +1,52 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XTabStop_idl__
-+#define __ooo_vba_word_XTabStop_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XTabStop
-+{
-+ interface ooo::vba::XHelperInterface;
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XTabStops.idl oovbaapi/ooo/vba/word/XTabStops.idl
-new file mode 100644
-index 0000000..318d492
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XTabStops.idl
-@@ -0,0 +1,59 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XTabStops_idl__
-+#define __ooo_vba_word_XTabStops_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XTabStop;
-+interface XTabStops
-+{
-+ interface ::ooo::vba::XCollection;
-+
-+ XTabStop Add([in] float Position, [in] any Alignment, [in] any Leader );
-+ void ClearAll();
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XTable.idl oovbaapi/ooo/vba/word/XTable.idl
-index f677da6..ef6d441 100644
---- oovbaapi/ooo/vba/word/XTable.idl
-+++ oovbaapi/ooo/vba/word/XTable.idl
-@@ -77,7 +77,9 @@ interface XTable
- raises(com::sun::star::script::BasicErrorException);
- */
- any Borders( [in] any aIndex );
--
-+
-+ any Rows([in] any aIndex );
-+ any Columns([in] any aIndex );
- };
-
- }; }; };
-diff --git oovbaapi/ooo/vba/word/XTableOfContents.idl oovbaapi/ooo/vba/word/XTableOfContents.idl
-new file mode 100644
-index 0000000..dcb7e8a
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XTableOfContents.idl
-@@ -0,0 +1,60 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XTableOfContents_idl__
-+#define __ooo_vba_word_XTableOfContents_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XTableOfContents
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ [attribute] long LowerHeadingLevel;
-+ [attribute] long TabLeader;
-+ [attribute] boolean UseFields;
-+ [attribute] boolean UseOutlineLevels;
-+
-+ void Delete();
-+ void Update();
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XTablesOfContents.idl oovbaapi/ooo/vba/word/XTablesOfContents.idl
-new file mode 100644
-index 0000000..53c557b
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XTablesOfContents.idl
-@@ -0,0 +1,59 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XTablesOfContents_idl__
-+#define __ooo_vba_word_XTablesOfContents_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XTableOfContents;
-+interface XRange;
-+interface XTablesOfContents
-+{
-+ interface ::ooo::vba::XCollection;
-+
-+ XTableOfContents Add([in] XRange Range, [in] any UseHeadingStyles, [in] any UpperHeadingLevel, [in] any LowerHeadingLevel, [in] any UseFields, [in] any TableID, [in] any RightAlignPageNumbers, [in] any IncludePageNumbers, [in] any AddedStyles, [in] any UseHyperlinks, [in] any HidePageNumbersInWeb, [in] any UseOutlineLevels );
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XTemplate.idl oovbaapi/ooo/vba/word/XTemplate.idl
-index a2bd1d7..0b9cf6e 100644
---- oovbaapi/ooo/vba/word/XTemplate.idl
-+++ oovbaapi/ooo/vba/word/XTemplate.idl
-@@ -45,6 +45,7 @@ interface XTemplate
- interface ooo::vba::XHelperInterface;
-
- [attribute, readonly] string Name;
-+ [attribute, readonly] string Path;
-
- any AutoTextEntries( [in] any aIndex );
- };
-diff --git oovbaapi/ooo/vba/word/XWindow.idl oovbaapi/ooo/vba/word/XWindow.idl
-index 9235335..220d9ee 100644
---- oovbaapi/ooo/vba/word/XWindow.idl
-+++ oovbaapi/ooo/vba/word/XWindow.idl
-@@ -47,6 +47,7 @@ module ooo { module vba { module word {
- interface XWindow : com::sun::star::uno::XInterface
- {
- [attribute] any View;
-+ [attribute] any WindowState;
- void Activate();
- void Close([in] any SaveChanges, [in] any RouteDocument);
- any Panes( [in] any aIndex ); // this is a fake api for it seems not support in Write
-diff --git oovbaapi/ooo/vba/word/makefile.mk oovbaapi/ooo/vba/word/makefile.mk
-index 8126587..83b1f4f 100644
---- oovbaapi/ooo/vba/word/makefile.mk
-+++ oovbaapi/ooo/vba/word/makefile.mk
-@@ -83,6 +83,31 @@ IDLFILES= XGlobals.idl\
- XPageSetup.idl \
- XSection.idl \
- XSections.idl \
-+ XRow.idl \
-+ XRows.idl \
-+ XColumn.idl \
-+ XColumns.idl \
-+ XCell.idl \
-+ XCells.idl \
-+ XTabStop.idl \
-+ XTabStops.idl \
-+ XTableOfContents.idl \
-+ XTablesOfContents.idl \
-+ XListFormat.idl \
-+ XListGalleries.idl \
-+ XListGallery.idl \
-+ XListTemplate.idl \
-+ XListTemplates.idl \
-+ XListLevel.idl \
-+ XListLevels.idl \
-+ XFormField.idl \
-+ XFormFields.idl \
-+ XRevision.idl \
-+ XRevisions.idl \
-+ XFrame.idl \
-+ XFrames.idl \
-+ XCheckBox.idl \
-+ XHeadersFooters.idl \
-
- # ------------------------------------------------------------------
-
-diff --git sc/source/core/data/documen2.cxx sc/source/core/data/documen2.cxx
-index 481178c..2a34517 100644
---- sc/source/core/data/documen2.cxx
-+++ sc/source/core/data/documen2.cxx
-@@ -1276,7 +1276,7 @@ ScDocument::GetVbaEventsHelper()
- uno::Reference< frame::XModel > xModel( pShell ? pShell->GetModel() : NULL, uno::UNO_QUERY );
- uno::Sequence< uno::Any > aArgs(1);
- aArgs[0] = uno::Any( xModel );
-- uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper( xSF->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.VbaEventsHelper" ) ), aArgs ), uno::UNO_QUERY );
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper( xSF->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.SpreadsheetDocumentVbaEventsHelper" ) ), aArgs ), uno::UNO_QUERY );
- // helper will always be created successfully.
- mxVbaEventsHelper.set( xVbaEventsHelper, uno::UNO_QUERY );
- }
-diff --git sc/source/ui/vba/vbaeventshelper.cxx sc/source/ui/vba/vbaeventshelper.cxx
-index 78b3ede..e3a6e85 100644
---- sc/source/ui/vba/vbaeventshelper.cxx
-+++ sc/source/ui/vba/vbaeventshelper.cxx
-@@ -375,50 +375,20 @@ VbaEventsListener::borderWidthsChanged( const uno::Reference< uno::XInterface >&
- }
- }
-
--class ImplVbaEventNameInfo
-+ScVbaEventsHelper::ScVbaEventsHelper( uno::Sequence< css::uno::Any > const& aArgs, uno::Reference< uno::XComponentContext > const& xContext ) : VbaEventsHelperBase( xContext ), mbOpened( sal_False )
- {
--private:
-- map< sal_Int32, rtl::OUString > m_aEventNameMap;
--
--protected:
-- static ImplVbaEventNameInfo* pImplVbaEventNameInfo;
-- ImplVbaEventNameInfo() { InitImplVbaEventNameInfo(); }
--private:
-- void insert( const sal_Int32 nId, const rtl::OUString& sEventName )
-- {
-- m_aEventNameMap.insert( make_pair( nId, sEventName ) );
-- }
-- void InitImplVbaEventNameInfo();
--public:
-- virtual ~ImplVbaEventNameInfo();
-- rtl::OUString getEventName( const sal_Int32 nId )
-- {
-- map< sal_Int32, rtl::OUString >::iterator iter = m_aEventNameMap.find( nId );
-- if( iter != m_aEventNameMap.end() )
-- return iter->second;
-- return rtl::OUString();
-- }
-- static ImplVbaEventNameInfo* GetImplVbaEventNameInfo();
--};
--ImplVbaEventNameInfo* ImplVbaEventNameInfo::pImplVbaEventNameInfo = NULL;
--
--ImplVbaEventNameInfo::~ImplVbaEventNameInfo()
--{
-- if( pImplVbaEventNameInfo )
-- {
-- delete pImplVbaEventNameInfo;
-- pImplVbaEventNameInfo = NULL;
-- }
-+ Initilize();
-+ uno::Reference< frame::XModel > xModel ( getXSomethingFromArgs< frame::XModel >( aArgs, 0 ), uno::UNO_QUERY );
-+ pDocShell = excel::getDocShell( xModel );
-+ pDoc = pDocShell->GetDocument();
-+ // Add worksheet change listener
-+ uno::Reference< util::XChangesNotifier > xChangesNotifier( xModel, uno::UNO_QUERY );
-+ if( xChangesNotifier.is() )
-+ xChangesNotifier->addChangesListener( uno::Reference< util::XChangesListener >( new WorksheetChangeListener( this ) ) );
- }
-
--ImplVbaEventNameInfo*
--ImplVbaEventNameInfo::GetImplVbaEventNameInfo()
-+ScVbaEventsHelper::~ScVbaEventsHelper()
- {
-- if( !pImplVbaEventNameInfo )
-- {
-- pImplVbaEventNameInfo = new ImplVbaEventNameInfo;
-- }
-- return pImplVbaEventNameInfo;
- }
-
- #define CREATEOUSTRING(asciistr) rtl::OUString::createFromAscii(asciistr)
-@@ -433,7 +403,7 @@ ImplVbaEventNameInfo::GetImplVbaEventNameInfo()
- #define INSERT_WORKBOOK_EVENT_INFO( Event, EventName ) \
- INSERT_EVENT_INFO( WORKBOOK, Event, CREATEOUSTRING("Workbook_"), EventName )
-
--void ImplVbaEventNameInfo::InitImplVbaEventNameInfo()
-+void ScVbaEventsHelper::Initilize()
- {
- INSERT_WORKSHEET_EVENT_INFO( ACTIVATE, "Activate");
- INSERT_WORKSHEET_EVENT_INFO( BEFOREDOUBLECLICK, "BeforeDoubleClick" );
-@@ -460,32 +430,6 @@ void ImplVbaEventNameInfo::InitImplVbaEventNameInfo()
- INSERT_WORKBOOK_EVENT_INFO( WINDOWRESIZE, "WindowResize" );
- }
-
--ScVbaEventsHelper::ScVbaEventsHelper( uno::Sequence< css::uno::Any > const& aArgs, uno::Reference< uno::XComponentContext > const& xContext )
-- : m_xContext( xContext ), mbOpened( sal_False ), mbIgnoreEvents( sal_False )
--{
-- uno::Reference< frame::XModel > xModel ( getXSomethingFromArgs< frame::XModel >( aArgs, 0 ), uno::UNO_QUERY );
-- pDocShell = excel::getDocShell( xModel );
-- pDoc = pDocShell->GetDocument();
-- // Add worksheet change listener
-- uno::Reference< util::XChangesNotifier > xChangesNotifier( xModel, uno::UNO_QUERY );
-- if( xChangesNotifier.is() )
-- xChangesNotifier->addChangesListener( uno::Reference< util::XChangesListener >( new WorksheetChangeListener( this ) ) );
--}
--
--ScVbaEventsHelper::~ScVbaEventsHelper()
--{
--}
--
--rtl::OUString
--ScVbaEventsHelper::getEventName( const sal_Int32 nId )
--{
-- rtl::OUString sEventName;
-- ImplVbaEventNameInfo* pEventInfo = ImplVbaEventNameInfo::GetImplVbaEventNameInfo();
-- if( pEventInfo )
-- sEventName = pEventInfo->getEventName( nId );
-- return sEventName;
--}
--
- uno::Any ScVbaEventsHelper::createWorkSheet( SfxObjectShell* pShell, SCTAB nTab )
- {
- uno::Any aRet;
-@@ -1049,16 +993,15 @@ ScVbaEventsHelper::ProcessCompatibleVbaEvent( sal_Int32 nEventId, const uno::Seq
- ::sal_Bool SAL_CALL
- ScVbaEventsHelper::getIgnoreEvents() throw (uno::RuntimeException)
- {
-- return mbIgnoreEvents;
-+ return VbaEventsHelperBase::getIgnoreEvents();
- }
-
- void SAL_CALL
- ScVbaEventsHelper::setIgnoreEvents( ::sal_Bool _ignoreevents ) throw (uno::RuntimeException)
- {
-- mbIgnoreEvents = _ignoreevents;
-+ VbaEventsHelperBase::setIgnoreEvents( _ignoreevents );
- }
-
--
- namespace vbaeventshelper
- {
- namespace sdecl = comphelper::service_decl;
-@@ -1066,5 +1009,5 @@ sdecl::class_<ScVbaEventsHelper, sdecl::with_args<true> > serviceImpl;
- extern sdecl::ServiceDecl const serviceDecl(
- serviceImpl,
- "ScVbaEventsHelper",
-- "com.sun.star.document.VbaEventsHelper" );
-+ "com.sun.star.sheet.SpreadsheetDocumentVbaEventsHelper" );
- }
-diff --git sc/source/ui/vba/vbaeventshelper.hxx sc/source/ui/vba/vbaeventshelper.hxx
-index 78037af..20a2cef 100644
---- sc/source/ui/vba/vbaeventshelper.hxx
-+++ sc/source/ui/vba/vbaeventshelper.hxx
-@@ -42,6 +42,7 @@
- #include <com/sun/star/document/XVbaEventsHelper.hpp>
- #include <com/sun/star/awt/XWindowListener.hpp>
- #include "excelvbahelper.hxx"
-+#include <vbahelper/vbaeventshelperbase.hxx>
-
- #define INVALID_TAB -1
-
-@@ -49,15 +50,13 @@ typedef ::cppu::WeakImplHelper1< com::sun::star::document::XVbaEventsHelper > VB
-
- class VbaEventsListener;
- class ScDocShell;
--class ScVbaEventsHelper : public VBAWorkbookEvent_BASE
-+class ScVbaEventsHelper : public VBAWorkbookEvent_BASE, public VbaEventsHelperBase
- {
- private:
- ScDocument* pDoc;
- ScDocShell* pDocShell;
-- css::uno::Reference< css::uno::XComponentContext > m_xContext;
- css::uno::Reference< css::awt::XWindowListener > m_xVbaEventsListener;
- sal_Bool mbOpened;
-- sal_Bool mbIgnoreEvents;
-
- String getSheetModuleName( SCTAB nTab );
- css::uno::Any createWorkSheet( SfxObjectShell* pShell, SCTAB nTab );
-@@ -65,12 +64,12 @@ private:
- css::uno::Any createHyperlink( const css::uno::Any& rCell );
- css::uno::Any createWindow( SfxObjectShell* pShell );
- SCTAB getTabFromArgs( const css::uno::Sequence< css::uno::Any > aArgs, const sal_Int32 nPos = 0 );
-- rtl::OUString getEventName( const sal_Int32 nEventId );
- rtl::OUString getMacroPath( const sal_Int32 nEventId, const SCTAB nTab = INVALID_TAB );
- sal_Bool processVbaEvent( const sal_Int32 nEventId, const css::uno::Sequence< css::uno::Any >& rArgs, const SCTAB nTab = INVALID_TAB );
-+ void Initilize();
-
- public:
-- ScVbaEventsHelper( ScDocument* pDocument ):pDoc( pDocument ), mbOpened( sal_False ){};
-+ //ScVbaEventsHelper( ScDocument* pDocument ):pDoc( pDocument ), mbOpened( sal_False ){};
- ScVbaEventsHelper( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext > const& xContext );
- ~ScVbaEventsHelper();
- ScDocument* getDocument() { return pDoc; };
-diff --git sc/source/ui/vba/vbaworkbook.cxx sc/source/ui/vba/vbaworkbook.cxx
-index 5a97ed8..bcb9cd2 100644
---- sc/source/ui/vba/vbaworkbook.cxx
-+++ sc/source/ui/vba/vbaworkbook.cxx
-@@ -264,6 +264,12 @@ ScVbaWorkbook::Activate() throw (uno::RuntimeException)
- VbaDocumentBase::Activate();
- }
-
-+void
-+ScVbaWorkbook::Protect( const uno::Any &aPassword ) throw (uno::RuntimeException)
-+{
-+ VbaDocumentBase::Protect( aPassword );
-+}
-+
- ::sal_Bool
- ScVbaWorkbook::getProtectStructure() throw (uno::RuntimeException)
- {
-diff --git sc/source/ui/vba/vbaworkbook.hxx sc/source/ui/vba/vbaworkbook.hxx
-index 8d3d493..7dfcedc 100644
---- sc/source/ui/vba/vbaworkbook.hxx
-+++ sc/source/ui/vba/vbaworkbook.hxx
-@@ -64,6 +64,7 @@ public:
- 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 Activate() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL Protect( const css::uno::Any & aPassword ) throw (css::uno::RuntimeException);
- // Amelia Wang
- virtual css::uno::Any SAL_CALL Names( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-
-diff --git svx/source/msfilter/msvbahelper.cxx svx/source/msfilter/msvbahelper.cxx
-index 6fd2d34..7919fb6 100644
---- svx/source/msfilter/msvbahelper.cxx
-+++ svx/source/msfilter/msvbahelper.cxx
-@@ -40,6 +40,7 @@
- #include <com/sun/star/document/XDocumentInfoSupplier.hpp>
- #include <tools/urlobj.hxx>
- #include <osl/file.hxx>
-+#include <svtools/pathoptions.hxx>
-
- using namespace ::com::sun::star;
-
-@@ -216,9 +217,19 @@ VBAMacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const rtl::OUStrin
- String sDocUrlOrPath = MacroName.copy( 0, nDocSepIndex );
- sMacroUrl = MacroName.copy( nDocSepIndex + 1 );
- OSL_TRACE("doc search, current shell is 0x%x", pShell );
-- SfxObjectShell* pFoundShell = findShellForUrl( sDocUrlOrPath );
-+ SfxObjectShell* pFoundShell = NULL;
-+ if( bSearchGlobalTemplates )
-+ {
-+ SvtPathOptions aPathOpt;
-+ String aAddinPath = aPathOpt.GetAddinPath();
-+ if( rtl::OUString( sDocUrlOrPath ).indexOf( aAddinPath ) == 0 )
-+ pFoundShell = pShell;
-+ }
-+ if( pFoundShell == NULL )
-+ pFoundShell = findShellForUrl( sDocUrlOrPath );
- OSL_TRACE("doc search, after find, found shell is 0x%x", pFoundShell );
-- return resolveVBAMacro( pFoundShell, sMacroUrl );
-+ aRes = resolveVBAMacro( pFoundShell, sMacroUrl, bSearchGlobalTemplates );
-+ return aRes;
- }
- else
- {
-diff --git sw/inc/doc.hxx sw/inc/doc.hxx
-index 7666665..5052f96 100644
---- sw/inc/doc.hxx
-+++ sw/inc/doc.hxx
-@@ -82,6 +82,7 @@ class SwList;
- #include "comphelper/implementationreference.hxx"
- #include <com/sun/star/chart2/data/XDataProvider.hpp>
- #include <com/sun/star/linguistic2/XProofreadingIterator.hpp>
-+#include <com/sun/star/document/XVbaEventsHelper.hpp>
-
- #include <hash_map>
- #include <stringhash.hxx>
-@@ -402,6 +403,7 @@ class SW_DLLPUBLIC SwDoc :
- // table of forbidden characters of this document
- vos::ORef<SvxForbiddenCharactersTable> xForbiddenCharsTable;
- com::sun::star::uno::Reference<com::sun::star::container::XNameContainer> m_xTemplateToProjectCache;
-+ com::sun::star::uno::Reference< com::sun::star::document::XVbaEventsHelper > mxVbaEventsHelper;
-
- // --> OD 2007-10-26 #i83479#
- public:
-@@ -2118,6 +2120,7 @@ public:
- }
- void SetVBATemplateToProjectCache( com::sun::star::uno::Reference< com::sun::star::container::XNameContainer >& xCache ) { m_xTemplateToProjectCache = xCache; };
- com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > GetVBATemplateToProjectCache() { return m_xTemplateToProjectCache; };
-+ com::sun::star::uno::Reference< com::sun::star::document::XVbaEventsHelper > GetVbaEventsHelper();
-
- ::sfx2::IXmlIdRegistry& GetXmlIdRegistry();
- ::sw::MetaFieldManager & GetMetaFieldManager();
-diff --git sw/inc/unotbl.hxx sw/inc/unotbl.hxx
-index 20b769f..cff829f 100644
---- sw/inc/unotbl.hxx
-+++ sw/inc/unotbl.hxx
-@@ -323,7 +323,7 @@ public:
- SwXTextTable(SwFrmFmt& rFrmFmt);
-
-
-- static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
-+ SW_DLLPUBLIC static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
-
- //XUnoTunnel
- virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
-diff --git sw/source/core/doc/doc.cxx sw/source/core/doc/doc.cxx
-index 42f0148..914a843 100644
---- sw/source/core/doc/doc.cxx
-+++ sw/source/core/doc/doc.cxx
-@@ -2015,6 +2015,28 @@ void SwDoc::ChkCondColls()
- }
- }
-
-+uno::Reference< document::XVbaEventsHelper >
-+SwDoc::GetVbaEventsHelper()
-+{
-+ if( !mxVbaEventsHelper.is() )
-+ {
-+ try
-+ {
-+ uno::Reference< lang::XMultiServiceFactory > xSF( comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
-+ uno::Reference< frame::XModel > xModel( pDocShell ? pDocShell->GetModel() : NULL, uno::UNO_QUERY );
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] = uno::Any( xModel );
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper( xSF->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocumentVbaEventsHelper" ) ), aArgs ), uno::UNO_QUERY );
-+ // helper will always be created successfully.
-+ mxVbaEventsHelper.set( xVbaEventsHelper, uno::UNO_QUERY );
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ }
-+ }
-+ return mxVbaEventsHelper;
-+}
-+
- void SwDoc::setExternalData(::sw::tExternalDataType eType,
- ::sw::tExternalDataPointer pPayload)
- {
-diff --git sw/source/filter/ww8/ww8par.cxx sw/source/filter/ww8/ww8par.cxx
-index 462adec..3e10291 100644
---- sw/source/filter/ww8/ww8par.cxx
-+++ sw/source/filter/ww8/ww8par.cxx
-@@ -163,68 +163,6 @@ using namespace nsHdFtFlags;
- #include <svtools/pathoptions.hxx>
- #include <com/sun/star/ucb/XSimpleFileAccess.hpp>
-
--const static String sThisDocument( RTL_CONSTASCII_USTRINGPARAM("ThisDocument"));
--
--struct DocEventNameTable
--{
-- const sal_Char* sEventName;
-- const sal_Char* sMacroName;
--};
--
--const DocEventNameTable aEventNameTable[] =
--{
-- {"OnNew", "Document_New"},
-- {"OnLoad", "Document_Open"},
-- {"OnPrepareUnload", "Document_Close"},
-- {NULL, NULL}
--};
--
--bool registerDocEvent( SfxObjectShell* pShell )
--{
-- bool result = false;
-- const static rtl::OUString sEvtType( RTL_CONSTASCII_USTRINGPARAM("EventType") );
-- const static rtl::OUString sScript( RTL_CONSTASCII_USTRINGPARAM("Script") );
-- uno::Reference< document::XEventsSupplier > xEvtSupplier( pShell->GetModel(), uno::UNO_QUERY );
-- if( !xEvtSupplier.is() )
-- return result;
-- uno::Reference< container::XNameReplace > xEvts( xEvtSupplier->getEvents(), uno::UNO_QUERY );
-- if ( xEvts.is() )
-- {
-- for( const DocEventNameTable* pTable = aEventNameTable; pTable->sEventName != NULL; pTable++ )
-- {
-- rtl::OUString sEvt = rtl::OUString::createFromAscii( pTable->sEventName );
-- String sMacroName = String::CreateFromAscii( pTable->sMacroName ).Insert( '.', 0 ).Insert( sThisDocument, 0);
-- // fail to search the macro if the module is not specified.
-- ooo::vba::VBAMacroResolvedInfo aMacroInfo = ooo::vba::resolveVBAMacro( pShell, sMacroName );
-- if( !aMacroInfo.IsResolved() )
-- continue;
--
-- uno::Sequence< beans::PropertyValue > aEvents;
-- xEvts->getByName( sEvt ) >>= aEvents;
-- uno::Sequence< beans::PropertyValue > aOpenEvt( 2 );
-- aOpenEvt[ 0 ].Name = sEvtType;
-- aOpenEvt[ 0 ].Value = uno::makeAny(sScript);
-- aOpenEvt[ 1 ].Name = sScript;
-- rtl::OUString sUrl = ooo::vba::makeMacroURL( aMacroInfo.ResolvedMacro() );
-- aOpenEvt[ 1 ].Value = uno::makeAny(sUrl);
-- sal_Int32 nPos = aEvents.getLength();
--
-- sal_Int32 nNewSize = aEvents.getLength() + aOpenEvt.getLength();
-- if ( nNewSize > aEvents.getLength() )
-- aEvents.realloc( nNewSize );
--
-- for ( sal_Int32 nIndex = nPos, nCpyIndex = 0; nIndex<nNewSize; nIndex++, nCpyIndex++ )
-- aEvents[ nIndex ] = aOpenEvt[ nCpyIndex ];
--
-- uno::Any aParam = uno::makeAny( aEvents );
--
-- xEvts->replaceByName( sEvt, aParam );
-- result = true;
-- }
-- }
-- return result;
--}
--
- class Sttb : TBBase
- {
- struct SBBItem
-@@ -4363,10 +4301,6 @@ ULONG SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
-
- StoreMacroCmds();
-
-- // Hackly to register the document event.
-- // should be find a better solution to share the codes with Excel Workbook event.
-- registerDocEvent( mpDocShell );
--
- maTracer.LeaveEnvironment(sw::log::eMacros);
- }
- ReadText(0, pWwFib->ccpText, MAN_MAINTEXT);
-diff --git sw/source/ui/app/docsh2.cxx sw/source/ui/app/docsh2.cxx
-index 1b0a0c1..8e59ff5 100644
---- sw/source/ui/app/docsh2.cxx
-+++ sw/source/ui/app/docsh2.cxx
-@@ -151,6 +151,8 @@
- #include <com/sun/star/ui/dialogs/ListboxControlActions.hpp>
- #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp>
- #include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
-+#include <com/sun/star/document/XVbaEventsHelper.hpp>
-+#include <com/sun/star/document/VbaEventId.hpp>
-
- #include <svx/acorrcfg.hxx>
- #include <SwStyleNameMapper.hxx>
-@@ -169,6 +171,7 @@ using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star;
- using ::rtl::OUString;
- using namespace ::sfx2;
-+using namespace com::sun::star::document::VbaEventId;
-
- extern BOOL FindPhyStyle( SwDoc& , const String& , SfxStyleFamily );
-
-@@ -222,6 +225,31 @@ void SwDocShell::DoFlushDocInfo()
- }
- }
-
-+void lcl_processCompatibleSfxHint( const uno::Reference< document::XVbaEventsHelper >& xVbaEventsHelper, const SfxHint& rHint )
-+{
-+ if ( rHint.ISA( SfxEventHint ) )
-+ {
-+ uno::Sequence< uno::Any > aArgs;
-+ ULONG nEventId = ((SfxEventHint&)rHint).GetEventId();
-+ switch( nEventId )
-+ {
-+ case SFX_EVENT_CREATEDOC:
-+ {
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_DOCUMENT_NEW, aArgs );
-+ break;
-+ }
-+ case SFX_EVENT_OPENDOC:
-+ {
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_DOCUMENT_OPEN, aArgs );
-+ break;
-+ }
-+ default:
-+ {
-+ //do nothing
-+ }
-+ }
-+ }
-+}
-
- /*--------------------------------------------------------------------
- Beschreibung: Benachrichtigung bei geaenderter DocInfo
-@@ -233,15 +261,18 @@ void SwDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
- {
- //MA: Kommt bei der OLE-Registration vor!
- // ASSERT( !this, "DocShell ist nicht richtig initialisiert!" );
-- return ;
-- }
--
-- USHORT nAction = 0;
-- if( rHint.ISA(SfxSimpleHint) )
-- {
-- // swithc for more actions
-- switch( ((SfxSimpleHint&) rHint).GetId() )
-- {
-+ return ;
-+ }
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper = pDoc->GetVbaEventsHelper();
-+ if( xVbaEventsHelper.is() )
-+ lcl_processCompatibleSfxHint( xVbaEventsHelper, rHint );
-+
-+ USHORT nAction = 0;
-+ if( rHint.ISA(SfxSimpleHint) )
-+ {
-+ // swithc for more actions
-+ switch( ((SfxSimpleHint&) rHint).GetId() )
-+ {
- case SFX_HINT_TITLECHANGED:
- if( GetMedium() )
- nAction = 2;
-@@ -317,7 +348,17 @@ USHORT SwDocShell::PrepareClose( BOOL bUI, BOOL bForBrowsing )
- if( TRUE == nRet ) //Unbedingt auf TRUE abfragen! (RET_NEWTASK)
- EndListening( *this );
-
-- return nRet;
-+ if( pDoc && IsInPrepareClose() )
-+ {
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper = pDoc->GetVbaEventsHelper();
-+ if( xVbaEventsHelper.is() )
-+ {
-+ uno::Sequence< uno::Any > aArgs;
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_DOCUMENT_CLOSE, aArgs );
-+ }
-+ }
-+
-+ return nRet;
- }
-
- /*--------------------------------------------------------------------
-diff --git sw/source/ui/vba/makefile.mk sw/source/ui/vba/makefile.mk
-index f51ef26..10e4ab6 100644
---- sw/source/ui/vba/makefile.mk
-+++ sw/source/ui/vba/makefile.mk
-@@ -86,6 +86,7 @@ SLOFILES= \
- $(SLO)$/vbaborders.obj \
- $(SLO)$/vbadocuments.obj \
- $(SLO)$/vbaheaderfooter.obj \
-+ $(SLO)$/vbaheadersfooters.obj \
- $(SLO)$/vbaheaderfooterhelper.obj \
- $(SLO)$/vbaaddin.obj \
- $(SLO)$/vbaaddins.obj \
-@@ -95,6 +96,33 @@ SLOFILES= \
- $(SLO)$/vbapagesetup.obj \
- $(SLO)$/vbasection.obj \
- $(SLO)$/vbasections.obj \
-+ $(SLO)$/vbarow.obj \
-+ $(SLO)$/vbarows.obj \
-+ $(SLO)$/vbacolumn.obj \
-+ $(SLO)$/vbacolumns.obj \
-+ $(SLO)$/vbatablehelper.obj \
-+ $(SLO)$/vbacell.obj \
-+ $(SLO)$/vbacells.obj \
-+ $(SLO)$/vbatabstop.obj \
-+ $(SLO)$/vbatabstops.obj \
-+ $(SLO)$/vbatableofcontents.obj \
-+ $(SLO)$/vbatablesofcontents.obj \
-+ $(SLO)$/vbalistgallery.obj \
-+ $(SLO)$/vbalistgalleries.obj \
-+ $(SLO)$/vbalisthelper.obj \
-+ $(SLO)$/vbalisttemplate.obj \
-+ $(SLO)$/vbalisttemplates.obj \
-+ $(SLO)$/vbalistlevel.obj \
-+ $(SLO)$/vbalistlevels.obj \
-+ $(SLO)$/vbalistformat.obj \
-+ $(SLO)$/vbarevision.obj \
-+ $(SLO)$/vbarevisions.obj \
-+ $(SLO)$/vbaframe.obj \
-+ $(SLO)$/vbaframes.obj \
-+ $(SLO)$/vbaformfield.obj \
-+ $(SLO)$/vbaformfields.obj \
-+ $(SLO)$/vbaeventshelper.obj \
-+ $(SLO)$/vbacheckbox.obj \
-
- # --- Targets ------------------------------------------------------
-
-diff --git sw/source/ui/vba/service.cxx sw/source/ui/vba/service.cxx
-index 0ed9492..ae34ec0 100644
---- sw/source/ui/vba/service.cxx
-+++ sw/source/ui/vba/service.cxx
-@@ -55,6 +55,11 @@ namespace wrapformat
- extern sdecl::ServiceDecl const serviceDecl;
- }
-
-+namespace vbaeventshelper
-+{
-+extern sdecl::ServiceDecl const serviceDecl;
-+}
-+
- extern "C"
- {
- void SAL_CALL component_getImplementationEnvironment(
-@@ -71,7 +76,7 @@ extern "C"
-
- // Component registration
- return component_writeInfoHelper( pServiceManager, pRegistryKey,
-- globals::serviceDecl, document::serviceDecl, wrapformat::serviceDecl );
-+ globals::serviceDecl, document::serviceDecl, wrapformat::serviceDecl, vbaeventshelper::serviceDecl );
- }
-
- void * SAL_CALL component_getFactory(
-@@ -80,7 +85,7 @@ extern "C"
- {
- OSL_TRACE("In component_getFactory for %s", pImplName );
- void* pRet = component_getFactoryHelper(
-- pImplName, pServiceManager, pRegistryKey, globals::serviceDecl, document::serviceDecl, wrapformat::serviceDecl );
-+ pImplName, pServiceManager, pRegistryKey, globals::serviceDecl, document::serviceDecl, wrapformat::serviceDecl, vbaeventshelper::serviceDecl );
- OSL_TRACE("Ret is 0x%x", pRet);
- return pRet;
- }
-diff --git sw/source/ui/vba/vbaapplication.cxx sw/source/ui/vba/vbaapplication.cxx
-index ba57192..0d5dadb 100644
---- sw/source/ui/vba/vbaapplication.cxx
-+++ sw/source/ui/vba/vbaapplication.cxx
-@@ -43,6 +43,7 @@
- #include <svx/acorrcfg.hxx>
- #include "wordvbahelper.hxx"
- #include <docsh.hxx>
-+#include "vbalistgalleries.hxx"
-
- using namespace ::ooo;
- using namespace ::ooo::vba;
-@@ -154,6 +155,16 @@ SwVbaApplication::Dialogs( const uno::Any& index ) throw (uno::RuntimeException)
- return uno::makeAny( xCol );
- }
-
-+uno::Any SAL_CALL
-+SwVbaApplication::ListGalleries( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< text::XTextDocument > xTextDoc( getCurrentDocument(), uno::UNO_QUERY_THROW );
-+ uno::Reference< XCollection > xCol( new SwVbaListGalleries( this, mxContext, xTextDoc ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
- sal_Bool SAL_CALL SwVbaApplication::getDisplayAutoCompleteTips() throw (css::uno::RuntimeException)
- {
- return SvxAutoCorrCfg::Get()->IsAutoTextTip();
-diff --git sw/source/ui/vba/vbaapplication.hxx sw/source/ui/vba/vbaapplication.hxx
-index 935a03c..88736ff 100644
---- sw/source/ui/vba/vbaapplication.hxx
-+++ sw/source/ui/vba/vbaapplication.hxx
-@@ -63,6 +63,7 @@ public:
- virtual css::uno::Any SAL_CALL Documents( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Addins( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Dialogs( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL ListGalleries( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getDisplayAutoCompleteTips() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setDisplayAutoCompleteTips( sal_Bool _displayAutoCompleteTips ) throw (css::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getEnableCancelKey() throw (css::uno::RuntimeException);
-diff --git sw/source/ui/vba/vbaautotextentry.cxx sw/source/ui/vba/vbaautotextentry.cxx
-index 30bdc2a..47745d3 100644
---- sw/source/ui/vba/vbaautotextentry.cxx
-+++ sw/source/ui/vba/vbaautotextentry.cxx
-@@ -29,7 +29,9 @@
- ************************************************************************/
- #include "vbaautotextentry.hxx"
- #include <vbahelper/vbahelper.hxx>
-+#include <com/sun/star/text/XParagraphCursor.hpp>
- #include <tools/diagnose_ex.h>
-+#include "wordvbahelper.hxx"
- #include "vbarange.hxx"
-
- using namespace ::ooo::vba;
-@@ -44,7 +46,7 @@ SwVbaAutoTextEntry::~SwVbaAutoTextEntry()
- {
- }
-
--uno::Reference< word::XRange > SAL_CALL SwVbaAutoTextEntry::Insert( const uno::Reference< word::XRange >& _where, const uno::Any& /*_richtext*/ ) throw ( uno::RuntimeException )
-+uno::Reference< word::XRange > SAL_CALL SwVbaAutoTextEntry::Insert( const uno::Reference< word::XRange >& _where, const uno::Any& _richtext ) throw ( uno::RuntimeException )
- {
- SwVbaRange* pWhere = dynamic_cast<SwVbaRange*>( _where.get() );
- if( pWhere )
-@@ -58,8 +60,28 @@ uno::Reference< word::XRange > SAL_CALL SwVbaAutoTextEntry::Insert( const uno::R
- uno::Reference< text::XTextCursor > xTC = xText->createTextCursorByRange( xTextRange->getStart() );
- xTC->goRight( 1, sal_True );
- xTC->setString( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("") ) ); // remove marker
-+ // remove the blank paragraph if it is a rich text
-+ sal_Bool bRich = sal_False;
-+ _richtext >>= bRich;
-+ if( bRich )
-+ {
-+ // check if it is a blank paragraph
-+ uno::Reference< text::XParagraphCursor > xParaCursor( xTC, uno::UNO_QUERY_THROW );
-+ if( xParaCursor->isStartOfParagraph() && xParaCursor->isEndOfParagraph() )
-+ {
-+ //remove the blank paragraph
-+ uno::Reference< frame::XModel > xModel( getCurrentWordDoc( mxContext ), uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextViewCursor > xTVCursor = word::getXTextViewCursor( xModel );
-+ uno::Reference< text::XTextRange > xCurrentRange( xTC->getEnd(), uno::UNO_QUERY_THROW );
-+ xTVCursor->gotoRange( xCurrentRange, sal_False );
-+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Delete"));
-+ dispatchRequests( xModel,url );
-+ xTVCursor->gotoRange( xEndMarker->getEnd(), sal_False );
-+ }
-+ }
- xEndMarker->setString( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("") ) ); // remove marker
-- xTC->gotoRange( xEndMarker, sal_True );
-+ //xTC->gotoRange( xEndMarker, sal_True );
-+ xTC = xText->createTextCursorByRange( xEndMarker->getEnd() );
- pWhere->setXTextCursor( xTC );
- }
- return uno::Reference< word::XRange >( pWhere );
-@@ -98,8 +120,9 @@ SwVbaAutoTextEntries::getElementType() throw (uno::RuntimeException)
- uno::Reference< container::XEnumeration >
- SwVbaAutoTextEntries::createEnumeration() throw (uno::RuntimeException)
- {
-- uno::Reference< container::XEnumerationAccess > xEnumerationAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
-- return xEnumerationAccess->createEnumeration();
-+ //uno::Reference< container::XEnumerationAccess > xEnumerationAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
-+ //return xEnumerationAccess->createEnumeration();
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
- }
-
- uno::Any
-diff --git sw/source/ui/vba/vbabookmark.cxx sw/source/ui/vba/vbabookmark.cxx
-index 0c7bacf..9e77b51 100644
---- sw/source/ui/vba/vbabookmark.cxx
-+++ sw/source/ui/vba/vbabookmark.cxx
-@@ -32,9 +32,12 @@
- #include <tools/diagnose_ex.h>
- #include <com/sun/star/text/XTextDocument.hpp>
- #include <com/sun/star/text/XTextContent.hpp>
-+#include <com/sun/star/text/XTextRange.hpp>
- #include <com/sun/star/text/XTextViewCursor.hpp>
- #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
-+#include <com/sun/star/view/XSelectionSupplier.hpp>
- #include "vbarange.hxx"
-+#include "wordvbahelper.hxx"
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-@@ -68,8 +71,8 @@ void SAL_CALL SwVbaBookmark::Delete() throw ( uno::RuntimeException )
- void SAL_CALL SwVbaBookmark::Select() throw ( uno::RuntimeException )
- {
- checkVality();
-- uno::Reference< text::XTextViewCursorSupplier > xViewCursorSupplier( mxModel->getCurrentController(), uno::UNO_QUERY_THROW );
-- xViewCursorSupplier->getViewCursor()->gotoRange( mxBookmark->getAnchor(),sal_False );
-+ uno::Reference< view::XSelectionSupplier > xSelectSupp( mxModel->getCurrentController(), uno::UNO_QUERY_THROW );
-+ xSelectSupp->select( uno::makeAny( mxBookmark ) );
- }
-
- rtl::OUString SAL_CALL SwVbaBookmark::getName() throw ( uno::RuntimeException )
-diff --git sw/source/ui/vba/vbabookmarks.cxx sw/source/ui/vba/vbabookmarks.cxx
-index e7d73cf..86a82a9 100644
---- sw/source/ui/vba/vbabookmarks.cxx
-+++ sw/source/ui/vba/vbabookmarks.cxx
-@@ -123,7 +123,7 @@ SwVbaBookmarks::SwVbaBookmarks( const uno::Reference< XHelperInterface >& xParen
- uno::Reference< text::XTextDocument > xDocument( mxModel, uno::UNO_QUERY_THROW );
- // use view cursor to insert bookmark, or it will fail if insert bookmark in table
- // mxText = xDocument->getText();
-- mxText = word::getXTextViewCursor( mxModel )->getText();
-+ //mxText = word::getXTextViewCursor( mxModel )->getText();
- }
- // XEnumerationAccess
- uno::Type
-@@ -149,16 +149,16 @@ SwVbaBookmarks::createCollectionObject( const css::uno::Any& aSource )
- void SwVbaBookmarks::removeBookmarkByName( const rtl::OUString& rName ) throw (uno::RuntimeException)
- {
- uno::Reference< text::XTextContent > xBookmark( m_xNameAccess->getByName( rName ), uno::UNO_QUERY_THROW );
-- mxText->removeTextContent( xBookmark );
-+ word::getXTextViewCursor( mxModel )->getText()->removeTextContent( xBookmark );
- }
-
--void SwVbaBookmarks::addBookmarkByName( const rtl::OUString& rName, const uno::Reference< text::XTextRange >& rTextRange ) throw (uno::RuntimeException)
-+void SwVbaBookmarks::addBookmarkByName( const uno::Reference< frame::XModel >& xModel, const rtl::OUString& rName, const uno::Reference< text::XTextRange >& rTextRange ) throw (uno::RuntimeException)
- {
-- uno::Reference< lang::XMultiServiceFactory > xDocMSF( mxModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< lang::XMultiServiceFactory > xDocMSF( xModel, uno::UNO_QUERY_THROW );
- uno::Reference< text::XTextContent > xBookmark( xDocMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.Bookmark")) ), uno::UNO_QUERY_THROW );
- uno::Reference< container::XNamed > xNamed( xBookmark, uno::UNO_QUERY_THROW );
- xNamed->setName( rName );
-- mxText->insertTextContent( rTextRange, xBookmark, sal_False );
-+ rTextRange->getText()->insertTextContent( rTextRange, xBookmark, sal_False );
- }
-
- uno::Any SAL_CALL
-@@ -184,7 +184,7 @@ SwVbaBookmarks::Add( const rtl::OUString& rName, const uno::Any& rRange ) throw
- if( m_xNameAccess->hasByName( aName ) )
- removeBookmarkByName( aName );
-
-- addBookmarkByName( aName, xTextRange );
-+ addBookmarkByName( mxModel, aName, xTextRange );
-
- return uno::makeAny( uno::Reference< word::XBookmark >( new SwVbaBookmark( getParent(), mxContext, mxModel, aName ) ) );
- }
-diff --git sw/source/ui/vba/vbabookmarks.hxx sw/source/ui/vba/vbabookmarks.hxx
-index 6047788..fc7539c 100644
---- sw/source/ui/vba/vbabookmarks.hxx
-+++ sw/source/ui/vba/vbabookmarks.hxx
-@@ -50,12 +50,12 @@ private:
-
- private:
- void removeBookmarkByName( const rtl::OUString& rName ) throw (css::uno::RuntimeException);
-- void addBookmarkByName( const rtl::OUString& rName, const css::uno::Reference< css::text::XTextRange >& rTextRange ) throw (css::uno::RuntimeException);
-
- public:
- SwVbaBookmarks( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::container::XIndexAccess >& xBookmarks, const css::uno::Reference< css::frame::XModel >& xModel );
- virtual ~SwVbaBookmarks() {}
-
-+ static void addBookmarkByName( const css::uno::Reference< css::frame::XModel >& xModel, const rtl::OUString& rName, const css::uno::Reference< css::text::XTextRange >& rTextRange ) 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);
-diff --git sw/source/ui/vba/vbaborders.cxx sw/source/ui/vba/vbaborders.cxx
-index 0c7c4f7..f10864c 100644
---- sw/source/ui/vba/vbaborders.cxx
-+++ sw/source/ui/vba/vbaborders.cxx
-@@ -351,14 +351,19 @@ SwVbaBorders::getItemByIntIndex( const sal_Int32 nIndex ) throw (uno::RuntimeEx
-
- sal_Bool SAL_CALL SwVbaBorders::getShadow() throw (uno::RuntimeException)
- {
-+ /*
- table::ShadowFormat aShadowFormat;
- m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ShadowFormat") ) ) >>= aShadowFormat;
- return ( aShadowFormat.Location != table::ShadowLocation_NONE );
-+ */
-+ // always return False for table border in MS Word
-+ return sal_False;
- }
-
- void SAL_CALL SwVbaBorders::setShadow( sal_Bool /*_shadow*/ ) throw (uno::RuntimeException)
- {
-- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ // not support in Table border in Word
-+ // TODO:
- }
-
- rtl::OUString&
-diff --git sw/source/ui/vba/vbacell.cxx sw/source/ui/vba/vbacell.cxx
-new file mode 100644
-index 0000000..59e2f22
---- /dev/null
-+++ sw/source/ui/vba/vbacell.cxx
-@@ -0,0 +1,120 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbacell.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include "vbatable.hxx"
-+#include <com/sun/star/table/XCellRange.hpp>
-+#include <com/sun/star/view/XSelectionSupplier.hpp>
-+#include <rtl/ustrbuf.hxx>
-+#include "wordvbahelper.hxx"
-+#include "vbatablehelper.hxx"
-+#include "vbarow.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaCell::SwVbaCell( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextTable >& xTextTable, sal_Int32 nColumn, sal_Int32 nRow ) throw ( uno::RuntimeException ) :
-+ SwVbaCell_BASE( rParent, rContext ), mxTextTable( xTextTable ), mnColumn( nColumn ), mnRow( nRow )
-+{
-+}
-+
-+SwVbaCell::~SwVbaCell()
-+{
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaCell::getWidth() throw (css::uno::RuntimeException)
-+{
-+ SwVbaTableHelper aTableHelper( mxTextTable );
-+ return aTableHelper.GetColWidth( mnColumn, mnRow, sal_True );
-+}
-+
-+void SAL_CALL SwVbaCell::setWidth( ::sal_Int32 _width ) throw (css::uno::RuntimeException)
-+{
-+ SwVbaTableHelper aTableHelper( mxTextTable );
-+ aTableHelper.SetColWidth( _width, mnColumn, mnRow, sal_True );
-+}
-+
-+uno::Any SAL_CALL SwVbaCell::getHeight() throw (css::uno::RuntimeException)
-+{
-+ uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnRow ) );
-+ return xRow->getHeight();
-+}
-+
-+void SAL_CALL SwVbaCell::setHeight( const uno::Any& _height ) throw (css::uno::RuntimeException)
-+{
-+ uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnRow ) );
-+ xRow->setHeight( _height );
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaCell::getHeightRule() throw (css::uno::RuntimeException)
-+{
-+ uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnRow ) );
-+ return xRow->getHeightRule();
-+}
-+
-+void SAL_CALL SwVbaCell::setHeightRule( ::sal_Int32 _heightrule ) throw (css::uno::RuntimeException)
-+{
-+ uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnRow ) );
-+ xRow->setHeightRule( _heightrule );
-+}
-+
-+void SAL_CALL SwVbaCell::SetWidth( float width, sal_Int32 rulestyle ) throw (css::uno::RuntimeException)
-+{
-+ // FIXME: handle the argument: rulestyle
-+ setWidth( width );
-+}
-+
-+void SAL_CALL SwVbaCell::SetHeight( float height, sal_Int32 heightrule ) throw (css::uno::RuntimeException)
-+{
-+ // FIXME: handle the argument: heightrule
-+ setHeightRule( heightrule );
-+ setHeight( uno::makeAny( height ) );
-+}
-+
-+rtl::OUString&
-+SwVbaCell::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaCell") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaCell::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Cell" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbacell.hxx sw/source/ui/vba/vbacell.hxx
-new file mode 100644
-index 0000000..1350288
---- /dev/null
-+++ sw/source/ui/vba/vbacell.hxx
-@@ -0,0 +1,67 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_CELL_HXX
-+#define SW_VBA_CELL_HXX
-+
-+#include <ooo/vba/word/XCell.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/text/XTextTable.hpp>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XCell > SwVbaCell_BASE;
-+
-+class SwVbaCell : public SwVbaCell_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XTextTable > mxTextTable;
-+ sal_Int32 mnColumn;
-+ sal_Int32 mnRow;
-+
-+public:
-+ SwVbaCell( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextTable >& xTextTable, sal_Int32 nColumn, sal_Int32 nRow ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaCell();
-+
-+ // Attributes
-+ 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 getHeight() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setHeight( const css::uno::Any& _height ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getHeightRule() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setHeightRule( ::sal_Int32 _heightrule ) throw (css::uno::RuntimeException);
-+
-+ // Methods
-+ virtual void SAL_CALL SetWidth( float width, sal_Int32 rulestyle ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL SetHeight( float height, sal_Int32 heightrule ) throw (css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_CELL_HXX */
-diff --git sw/source/ui/vba/vbacells.cxx sw/source/ui/vba/vbacells.cxx
-new file mode 100644
-index 0000000..603c08f
---- /dev/null
-+++ sw/source/ui/vba/vbacells.cxx
-@@ -0,0 +1,223 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbacells.hxx"
-+#include "vbacell.hxx"
-+#include "wordvbahelper.hxx"
-+#include "vbatablehelper.hxx"
-+#include "vbarow.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+typedef ::cppu::WeakImplHelper2< container::XIndexAccess, container::XEnumerationAccess > CellCollectionHelper_Base;
-+
-+class CellsEnumWrapper : public EnumerationHelper_BASE
-+{
-+ uno::Reference< container::XIndexAccess > mxIndexAccess;
-+ sal_Int32 nIndex;
-+
-+public:
-+ CellsEnumWrapper( const uno::Reference< container::XIndexAccess >& xIndexAccess ) : mxIndexAccess( xIndexAccess ), nIndex( 0 )
-+ {
-+ }
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( nIndex < mxIndexAccess->getCount() );
-+ }
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if( nIndex < mxIndexAccess->getCount() )
-+ {
-+ return mxIndexAccess->getByIndex( nIndex++ );
-+ }
-+ throw container::NoSuchElementException();
-+ }
-+};
-+
-+class CellCollectionHelper : public CellCollectionHelper_Base
-+{
-+private:
-+ uno::Reference< XHelperInterface > mxParent;
-+ uno::Reference< uno::XComponentContext > mxContext;
-+ uno::Reference< css::text::XTextTable > mxTextTable;
-+ sal_Int32 mnLeft;
-+ sal_Int32 mnTop;
-+ sal_Int32 mnRight;
-+ sal_Int32 mnBottom;
-+
-+public:
-+ CellCollectionHelper( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::text::XTextTable >& xTextTable, sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom ) throw ( css::uno::RuntimeException ): mxParent( xParent ), mxContext( xContext ), mxTextTable( xTextTable ), mnLeft( nLeft ), mnTop( nTop ), mnRight( nRight ), mnBottom( nBottom )
-+ {
-+ }
-+ virtual ~CellCollectionHelper() {}
-+
-+ virtual sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
-+ {
-+ return ( mnRight - mnLeft + 1 ) * ( mnBottom - mnTop + 1 );
-+ }
-+ virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( Index < 0 || Index >= getCount() )
-+ throw css::lang::IndexOutOfBoundsException();
-+
-+ for( sal_Int32 row = mnTop; row <= mnBottom; row++ )
-+ {
-+ for( sal_Int32 col = mnLeft; col <= mnRight; col++ )
-+ {
-+ if( Index == ( ( row - mnTop ) * ( mnRight - mnLeft + 1 ) + ( col - mnLeft ) ) )
-+ return uno::makeAny( uno::Reference< word::XCell >( new SwVbaCell( mxParent, mxContext, mxTextTable, col, row ) ) );
-+ }
-+ }
-+ throw css::lang::IndexOutOfBoundsException();
-+
-+ }
-+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
-+ {
-+ return word::XCell::static_type(0);
-+ }
-+ virtual sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
-+ {
-+ return sal_True;
-+ }
-+ // XEnumerationAccess
-+ virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
-+ {
-+ return new CellsEnumWrapper( this );
-+ }
-+};
-+
-+SwVbaCells::SwVbaCells( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextTable >& xTextTable, sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom ) throw (uno::RuntimeException) : SwVbaCells_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new CellCollectionHelper( xParent, xContext, xTextTable, nLeft, nTop, nRight, nBottom ) ) ), mxTextTable( xTextTable ), mnLeft( nLeft ), mnTop( nTop ), mnRight( nRight ), mnBottom( nBottom )
-+{
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaCells::getWidth() throw (css::uno::RuntimeException)
-+{
-+ uno::Reference< word::XCell > xCell( m_xIndexAccess->getByIndex( 0 ), uno::UNO_QUERY_THROW );
-+ return xCell->getWidth();
-+}
-+
-+void SAL_CALL SwVbaCells::setWidth( ::sal_Int32 _width ) throw (css::uno::RuntimeException)
-+{
-+ sal_Int32 nIndex = 0;
-+ while( nIndex < m_xIndexAccess->getCount() )
-+ {
-+ uno::Reference< word::XCell > xCell( m_xIndexAccess->getByIndex( nIndex++ ), uno::UNO_QUERY_THROW );
-+ xCell->setWidth( _width );
-+ }
-+}
-+
-+uno::Any SAL_CALL SwVbaCells::getHeight() throw (css::uno::RuntimeException)
-+{
-+ uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnTop ) );
-+ return xRow->getHeight();
-+}
-+
-+void SAL_CALL SwVbaCells::setHeight( const uno::Any& _height ) throw (css::uno::RuntimeException)
-+{
-+ for( sal_Int32 row = mnTop; row <= mnBottom; row++ )
-+ {
-+ uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, row ) );
-+ xRow->setHeight( _height );
-+ }
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaCells::getHeightRule() throw (css::uno::RuntimeException)
-+{
-+ uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, mnTop ) );
-+ return xRow->getHeightRule();
-+}
-+
-+void SAL_CALL SwVbaCells::setHeightRule( ::sal_Int32 _heightrule ) throw (css::uno::RuntimeException)
-+{
-+ for( sal_Int32 row = mnTop; row <= mnBottom; row++ )
-+ {
-+ uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, row ) );
-+ xRow->setHeightRule( _heightrule );
-+ }
-+}
-+
-+void SAL_CALL SwVbaCells::SetWidth( float width, sal_Int32 rulestyle ) throw (css::uno::RuntimeException)
-+{
-+ sal_Int32 nIndex = 0;
-+ while( nIndex < m_xIndexAccess->getCount() )
-+ {
-+ uno::Reference< word::XCell > xCell( m_xIndexAccess->getByIndex( nIndex++ ), uno::UNO_QUERY_THROW );
-+ xCell->SetWidth( width, rulestyle );
-+ }
-+}
-+
-+void SAL_CALL SwVbaCells::SetHeight( float height, sal_Int32 heightrule ) throw (css::uno::RuntimeException)
-+{
-+ for( sal_Int32 row = mnTop; row <= mnBottom; row++ )
-+ {
-+ uno::Reference< word::XRow > xRow( new SwVbaRow( getParent(), mxContext, mxTextTable, row ) );
-+ xRow->SetHeight( height, heightrule );
-+ }
-+}
-+
-+// XEnumerationAccess
-+uno::Type
-+SwVbaCells::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XCell::static_type(0);
-+}
-+
-+uno::Reference< container::XEnumeration >
-+SwVbaCells::createEnumeration() throw (uno::RuntimeException)
-+{
-+ uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
-+ return xEnumAccess->createEnumeration();
-+}
-+
-+uno::Any
-+SwVbaCells::createCollectionObject( const uno::Any& aSource )
-+{
-+ return aSource;
-+}
-+
-+rtl::OUString&
-+SwVbaCells::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaCells") );
-+ return sImplName;
-+}
-+
-+uno::Sequence<rtl::OUString>
-+SwVbaCells::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Cells") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbacells.hxx sw/source/ui/vba/vbacells.hxx
-new file mode 100644
-index 0000000..3468b29
---- /dev/null
-+++ sw/source/ui/vba/vbacells.hxx
-@@ -0,0 +1,75 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_CELLS_HXX
-+#define SW_VBA_CELLS_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XCells.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/text/XTextTable.hpp>
-+
-+typedef CollTestImplHelper< ooo::vba::word::XCells > SwVbaCells_BASE;
-+
-+class SwVbaCells : public SwVbaCells_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XTextTable > mxTextTable;
-+ sal_Int32 mnLeft;
-+ sal_Int32 mnTop;
-+ sal_Int32 mnRight;
-+ sal_Int32 mnBottom;
-+
-+public:
-+ SwVbaCells( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::text::XTextTable >& xTextTable, sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaCells() {}
-+
-+ // Attributes
-+ 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 getHeight() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setHeight( const css::uno::Any& _height ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getHeightRule() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setHeightRule( ::sal_Int32 _heightrule ) throw (css::uno::RuntimeException);
-+
-+ // Methods
-+ virtual void SAL_CALL SetWidth( float width, sal_Int32 rulestyle ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL SetHeight( float height, sal_Int32 heightrule ) 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);
-+
-+ // SwVbaCells_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* SW_VBA_CELLS_HXX */
-diff --git sw/source/ui/vba/vbacheckbox.cxx sw/source/ui/vba/vbacheckbox.cxx
-new file mode 100644
-index 0000000..307f7a2
---- /dev/null
-+++ sw/source/ui/vba/vbacheckbox.cxx
-@@ -0,0 +1,98 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbacheckbox.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include <com/sun/star/text/XTextContent.hpp>
-+#include <com/sun/star/text/XTextViewCursor.hpp>
-+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
-+#include <ecmaflds.hxx>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaCheckBox::SwVbaCheckBox( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< frame::XModel >& rModel, const uno::Reference< text::XFormField >& xFormField ) throw ( uno::RuntimeException ) : SwVbaCheckBox_BASE( rParent, rContext ), mxModel( rModel ), mxFormField( xFormField )
-+{
-+ rtl::OUString sType = mxFormField->getFieldType();
-+ if( !sType.equalsIgnoreAsciiCaseAscii( ECMA_FORMCHECKBOX ) )
-+ {
-+ throw uno::RuntimeException( rtl::OUString(
-+ RTL_CONSTASCII_USTRINGPARAM("It is not a CheckBox")), uno::Reference< uno::XInterface >() );
-+ }
-+}
-+
-+SwVbaCheckBox::~SwVbaCheckBox()
-+{
-+}
-+
-+sal_Bool SAL_CALL SwVbaCheckBox::getValue() throw ( uno::RuntimeException )
-+{
-+ sal_Bool bValue = sal_False;
-+ sal_Int32 nCount = mxFormField->getParamCount();
-+ for( sal_Int32 i = 0; i < nCount; i++ )
-+ {
-+ if( mxFormField->getParamName(i).equalsIgnoreAsciiCaseAscii( ECMA_FORMCHECKBOX_CHECKED ) )
-+ {
-+ if( mxFormField->getParamValue(i).equalsIgnoreAsciiCaseAscii("on") )
-+ bValue = sal_True;
-+ else
-+ bValue = sal_False;
-+ break;
-+ }
-+ }
-+ return bValue;
-+}
-+
-+void SAL_CALL SwVbaCheckBox::setValue( sal_Bool value ) throw ( uno::RuntimeException )
-+{
-+ rtl::OUString sValue = rtl::OUString::createFromAscii( value ? "on" : "off" );
-+ mxFormField->addParam( rtl::OUString::createFromAscii( ECMA_FORMCHECKBOX_CHECKED ), sValue, sal_True );
-+}
-+
-+rtl::OUString&
-+SwVbaCheckBox::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaCheckBox") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaCheckBox::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.CheckBox" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbacheckbox.hxx sw/source/ui/vba/vbacheckbox.hxx
-new file mode 100644
-index 0000000..7b12ed5
---- /dev/null
-+++ sw/source/ui/vba/vbacheckbox.hxx
-@@ -0,0 +1,58 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_CHECKBOX_HXX
-+#define SW_VBA_CHECKBOX_HXX
-+
-+#include <ooo/vba/word/XCheckBox.hpp>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/text/XFormField.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XCheckBox > SwVbaCheckBox_BASE;
-+
-+class SwVbaCheckBox : public SwVbaCheckBox_BASE
-+{
-+private:
-+ css::uno::Reference< css::frame::XModel > mxModel;
-+ css::uno::Reference< css::text::XFormField > mxFormField;
-+
-+public:
-+ SwVbaCheckBox( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& rModel, const css::uno::Reference< css::text::XFormField >& xFormField ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaCheckBox();
-+
-+ // Methods
-+ sal_Bool SAL_CALL getValue() throw ( css::uno::RuntimeException );
-+ void SAL_CALL setValue( sal_Bool value ) throw ( css::uno::RuntimeException );
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_CHECKBOX_HXX */
-diff --git sw/source/ui/vba/vbacolumn.cxx sw/source/ui/vba/vbacolumn.cxx
-new file mode 100644
-index 0000000..3dd4eb1
---- /dev/null
-+++ sw/source/ui/vba/vbacolumn.cxx
-@@ -0,0 +1,201 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbacolumn.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include "vbatable.hxx"
-+#include <com/sun/star/table/XCellRange.hpp>
-+#include <com/sun/star/view/XSelectionSupplier.hpp>
-+#include <rtl/ustrbuf.hxx>
-+#include "wordvbahelper.hxx"
-+#include "vbatablehelper.hxx"
-+
-+#define RELATIVE_TABLE_WIDTH 10000
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaColumn::SwVbaColumn( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextTable >& xTextTable, sal_Int32 nIndex ) throw ( uno::RuntimeException ) :
-+ SwVbaColumn_BASE( rParent, rContext ), mxTextTable( xTextTable ), mnIndex( nIndex )
-+{
-+ mxTableColumns = mxTextTable->getColumns();
-+}
-+
-+SwVbaColumn::~SwVbaColumn()
-+{
-+}
-+
-+void SwVbaColumn::calculateAbsoluteColumnWidth( sal_Int32 nTableWidth, const css::uno::Sequence< css::text::TableColumnSeparator >& aSeparators, double* pAbsWidth )
-+{
-+ const text::TableColumnSeparator* pArray = aSeparators.getConstArray();
-+ sal_Int32 nSepCount = aSeparators.getLength();
-+ for( sal_Int32 i = 0; i <= nSepCount; i++ )
-+ {
-+ sal_Int32 nRelColWidth = 0;
-+ if( i == 0 )
-+ {
-+ if( nSepCount != 0 )
-+ {
-+ nRelColWidth = pArray[0].Position;
-+ }
-+ else
-+ {
-+ nRelColWidth = RELATIVE_TABLE_WIDTH;
-+ }
-+ }
-+ else
-+ {
-+ if( i == nSepCount )
-+ {
-+ nRelColWidth = RELATIVE_TABLE_WIDTH - pArray[i-1].Position;
-+ }
-+ else
-+ {
-+ nRelColWidth = pArray[i].Position - pArray[i-1].Position;
-+ }
-+ }
-+ pAbsWidth[i] = ( (double)nRelColWidth / RELATIVE_TABLE_WIDTH ) * (double) nTableWidth;
-+ }
-+}
-+
-+void SwVbaColumn::calculateRelativeColumnWidth( const double* pAbsWidth, double* pRelWidth, sal_Int32 nCount )
-+{
-+ double tableWidth = 0.0;
-+ for( sal_Int32 i = 0; i < nCount; i++ )
-+ {
-+ tableWidth += pAbsWidth[i];
-+ }
-+
-+ pRelWidth[ nCount - 1 ] = tableWidth;
-+ for( sal_Int32 i = 0; i < nCount - 1; i++ )
-+ {
-+ if( i == 0 )
-+ {
-+ pRelWidth[i] = ( pAbsWidth[i] * RELATIVE_TABLE_WIDTH ) / tableWidth;
-+ }
-+ else
-+ {
-+ pRelWidth[i] = pRelWidth[i-1] + ( pAbsWidth[i] * RELATIVE_TABLE_WIDTH ) / tableWidth;
-+ }
-+ }
-+}
-+
-+sal_Int32 SAL_CALL
-+SwVbaColumn::getWidth( ) throw ( css::uno::RuntimeException )
-+{
-+ /* uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, uno::UNO_QUERY_THROW );
-+ uno::Sequence< text::TableColumnSeparator > aSeparators;
-+ xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TableColumnSeparators") ) ) >>= aSeparators;
-+ sal_Int32 nTableWidth = SwVbaTable::getTableWidth( xTableProps );
-+ sal_Int32 nColCont = aSeparators.getLength() + 1;
-+ double dAbsColWidth[ nColCont ];
-+ calculateAbsoluteColumnWidth( nTableWidth, aSeparators, dAbsColWidth );
-+ return Millimeter::getInPoints( (sal_Int32)( dAbsColWidth[ mnIndex ] ) );
-+ */
-+ SwVbaTableHelper aTableHelper( mxTextTable );
-+ return aTableHelper.GetColWidth( mnIndex );
-+}
-+
-+void SAL_CALL
-+SwVbaColumn::setWidth( sal_Int32 _width ) throw ( css::uno::RuntimeException )
-+{
-+/* uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, uno::UNO_QUERY_THROW );
-+ uno::Sequence< text::TableColumnSeparator > aSeparators;
-+ xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TableColumnSeparators") ) ) >>= aSeparators;
-+ sal_Int32 nTableWidth = SwVbaTable::getTableWidth( xTableProps );
-+ sal_Int32 nColCont = aSeparators.getLength() + 1;
-+ double dAbsColWidth[ nColCont ];
-+ calculateAbsoluteColumnWidth( nTableWidth, aSeparators, dAbsColWidth );
-+ dAbsColWidth[ mnIndex ] = Millimeter::getInHundredthsOfOneMillimeter( _width );
-+ double tableWidth = 0.0;
-+ for( sal_Int32 i = 0; i < nColCont; i++ )
-+ {
-+ tableWidth += dAbsColWidth[i];
-+ }
-+
-+ double dRelColWidth[ nColCont ];
-+ calculateRelativeColumnWidth( dAbsColWidth, dRelColWidth, nColCont);
-+
-+ text::TableColumnSeparator* pArray = aSeparators.getArray();
-+ for( sal_Int32 i = 0; i < nColCont - 1; i++ )
-+ {
-+ pArray[i].Position = (sal_Int16)(dRelColWidth[i]);
-+ }
-+
-+ xTableProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TableColumnSeparators") ), uno::makeAny( aSeparators ) );
-+ SwVbaTable::setTableWidth( xTableProps, (sal_Int32)( tableWidth ) );
-+ */
-+
-+ SwVbaTableHelper aTableHelper( mxTextTable );
-+ aTableHelper.SetColWidth( _width, mnIndex );
-+}
-+
-+void SAL_CALL
-+SwVbaColumn::Select( ) throw ( uno::RuntimeException )
-+{
-+ SelectColumn( getCurrentWordDoc(mxContext), mxTextTable, mnIndex, mnIndex );
-+}
-+
-+void SwVbaColumn::SelectColumn( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XTextTable >& xTextTable, sal_Int32 nStartColumn, sal_Int32 nEndColumn ) throw ( uno::RuntimeException )
-+{
-+ rtl::OUStringBuffer aRangeName;
-+ rtl::OUString sStartCol = SwVbaTableHelper::getColumnStr( nStartColumn );
-+ aRangeName.append(sStartCol).append(sal_Int32( 1 ) );
-+ rtl::OUString sEndCol = SwVbaTableHelper::getColumnStr( nEndColumn );
-+ sal_Int32 nRowCount = xTextTable->getRows()->getCount();
-+ aRangeName.appendAscii(":").append( sEndCol ).append( sal_Int32( nRowCount ) );
-+
-+ uno::Reference< table::XCellRange > xCellRange( xTextTable, uno::UNO_QUERY_THROW );
-+ rtl::OUString sSelRange = aRangeName.makeStringAndClear();
-+ uno::Reference< table::XCellRange > xSelRange = xCellRange->getCellRangeByName( sSelRange );
-+
-+ uno::Reference< view::XSelectionSupplier > xSelection( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
-+ xSelection->select( uno::makeAny( xSelRange ) );
-+}
-+
-+rtl::OUString&
-+SwVbaColumn::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaColumn") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaColumn::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Column" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbacolumn.hxx sw/source/ui/vba/vbacolumn.hxx
-new file mode 100644
-index 0000000..6d67bdd
---- /dev/null
-+++ sw/source/ui/vba/vbacolumn.hxx
-@@ -0,0 +1,68 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_COLUMN_HXX
-+#define SW_VBA_COLUMN_HXX
-+
-+#include <ooo/vba/word/XColumn.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/table/XTableColumns.hpp>
-+#include <com/sun/star/text/XTextTable.hpp>
-+#include <com/sun/star/text/TableColumnSeparator.hpp>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XColumn > SwVbaColumn_BASE;
-+
-+class SwVbaColumn : public SwVbaColumn_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XTextTable > mxTextTable;
-+ css::uno::Reference< css::table::XTableColumns > mxTableColumns;
-+ sal_Int32 mnIndex;
-+
-+private:
-+ void calculateAbsoluteColumnWidth( sal_Int32 nTableWidth, const css::uno::Sequence< css::text::TableColumnSeparator >& aSeparators, double* pAbsWidth );
-+ void calculateRelativeColumnWidth( const double* pAbsWidth, double* pRelWidth, sal_Int32 nCount );
-+
-+public:
-+ SwVbaColumn( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextTable >& xTextTable, sal_Int32 nIndex ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaColumn();
-+
-+ // Methods
-+ virtual sal_Int32 SAL_CALL getWidth() throw ( css::uno::RuntimeException );
-+ virtual void SAL_CALL setWidth( sal_Int32 _width ) throw ( css::uno::RuntimeException );
-+ virtual void SAL_CALL Select( ) throw (css::uno::RuntimeException);
-+
-+ static void SelectColumn( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XTextTable >& xTextTable, sal_Int32 nStartColumn, sal_Int32 nEndColumn ) throw (css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_COLUMN_HXX */
-diff --git sw/source/ui/vba/vbacolumns.cxx sw/source/ui/vba/vbacolumns.cxx
-new file mode 100644
-index 0000000..1ce3bf9
---- /dev/null
-+++ sw/source/ui/vba/vbacolumns.cxx
-@@ -0,0 +1,160 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbacolumns.hxx"
-+#include "vbacolumn.hxx"
-+#include <com/sun/star/text/HoriOrientation.hpp>
-+#include <com/sun/star/table/XCellRange.hpp>
-+#include <ooo/vba/word/WdConstants.hpp>
-+#include <ooo/vba/word/WdRulerStyle.hpp>
-+#include "wordvbahelper.hxx"
-+#include "vbatablehelper.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+class ColumnsEnumWrapper : public EnumerationHelper_BASE
-+{
-+ uno::Reference< text::XTextTable > mxTextTable;
-+ uno::Reference< container::XIndexAccess > mxIndexAccess;
-+ uno::WeakReference< XHelperInterface > mxParent;
-+ uno::Reference< uno::XComponentContext > mxContext;
-+ sal_Int32 nIndex;
-+
-+public:
-+ ColumnsEnumWrapper( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< text::XTextTable >& xTextTable ) : mxParent( xParent ), mxContext( xContext ), mxTextTable( xTextTable ), nIndex( 0 )
-+ {
-+ mxIndexAccess.set( mxTextTable->getColumns(), uno::UNO_QUERY );
-+ }
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( nIndex < mxIndexAccess->getCount() );
-+ }
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if( nIndex < mxIndexAccess->getCount() )
-+ {
-+ return uno::makeAny( uno::Reference< word::XColumn > ( new SwVbaColumn( mxParent, mxContext, mxTextTable, nIndex++ ) ) );
-+ }
-+ throw container::NoSuchElementException();
-+ }
-+};
-+
-+SwVbaColumns::SwVbaColumns( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextTable >& xTextTable, const uno::Reference< table::XTableColumns >& xTableColumns ) throw (uno::RuntimeException) : SwVbaColumns_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( xTableColumns, uno::UNO_QUERY_THROW ) ), mxTextTable( xTextTable ), mxTableColumns( xTableColumns )
-+{
-+ mnStartColumnIndex = 0;
-+ SwVbaTableHelper aTableHelper( mxTextTable );
-+ mnEndColumnIndex = aTableHelper.getTabColumnsMaxCount( ) - 1;
-+}
-+
-+SwVbaColumns::SwVbaColumns( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextTable >& xTextTable, const uno::Reference< table::XTableColumns >& xTableColumns, sal_Int32 nStartCol, sal_Int32 nEndCol ) throw (uno::RuntimeException) : SwVbaColumns_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( xTableColumns, uno::UNO_QUERY_THROW ) ), mxTextTable( xTextTable ), mxTableColumns( xTableColumns ), mnStartColumnIndex( nStartCol ), mnEndColumnIndex( nEndCol )
-+{
-+ if( mnEndColumnIndex < mnStartColumnIndex )
-+ throw uno::RuntimeException();
-+}
-+
-+uno::Reference< word::XColumn > SwVbaColumns::getColumnAtIndex( sal_Int32 index ) throw (uno::RuntimeException)
-+{
-+ return uno::Reference< word::XColumn >( new SwVbaColumn( this, mxContext, mxTextTable, index ) );
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaColumns::getWidth() throw (uno::RuntimeException)
-+{
-+ return getColumnAtIndex( mnStartColumnIndex )->getWidth();
-+}
-+
-+void SAL_CALL SwVbaColumns::setWidth( ::sal_Int32 _width ) throw (uno::RuntimeException)
-+{
-+ for( sal_Int32 index = mnStartColumnIndex; index <= mnEndColumnIndex; index++ )
-+ {
-+ getColumnAtIndex( index )->setWidth( _width );
-+ }
-+}
-+
-+void SAL_CALL SwVbaColumns::Select( ) throw (uno::RuntimeException)
-+{
-+ SwVbaColumn::SelectColumn( getCurrentWordDoc(mxContext), mxTextTable, mnStartColumnIndex, mnEndColumnIndex );
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaColumns::getCount() throw (uno::RuntimeException)
-+{
-+ return ( mnEndColumnIndex - mnStartColumnIndex + 1 );
-+}
-+
-+uno::Any SAL_CALL SwVbaColumns::Item( const uno::Any& Index1, const uno::Any& /*not processed in this base class*/ ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nIndex = 0;
-+ if( ( Index1 >>= nIndex ) == sal_True )
-+ {
-+ if( nIndex <= 0 || nIndex > getCount() )
-+ {
-+ throw lang::IndexOutOfBoundsException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Index out of bounds") ), uno::Reference< uno::XInterface >() );
-+ }
-+ return uno::makeAny( uno::Reference< word::XColumn >( new SwVbaColumn( this, mxContext, mxTextTable, nIndex - 1 ) ) );
-+ }
-+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Index out of bounds") ), uno::Reference< uno::XInterface >() );
-+}
-+
-+// XEnumerationAccess
-+uno::Type
-+SwVbaColumns::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XColumn::static_type(0);
-+}
-+uno::Reference< container::XEnumeration >
-+SwVbaColumns::createEnumeration() throw (uno::RuntimeException)
-+{
-+ return new ColumnsEnumWrapper( this, mxContext, mxTextTable );
-+}
-+
-+uno::Any
-+SwVbaColumns::createCollectionObject( const uno::Any& aSource )
-+{
-+ return aSource;
-+}
-+
-+rtl::OUString&
-+SwVbaColumns::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaColumns") );
-+ return sImplName;
-+}
-+
-+uno::Sequence<rtl::OUString>
-+SwVbaColumns::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Columns") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbacolumns.hxx sw/source/ui/vba/vbacolumns.hxx
-new file mode 100644
-index 0000000..3fd2b4a
---- /dev/null
-+++ sw/source/ui/vba/vbacolumns.hxx
-@@ -0,0 +1,75 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_COLUMNS_HXX
-+#define SW_VBA_COLUMNS_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XColumns.hpp>
-+#include <ooo/vba/word/XColumn.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/table/XTableColumns.hpp>
-+#include <com/sun/star/text/XTextTable.hpp>
-+
-+typedef CollTestImplHelper< ooo::vba::word::XColumns > SwVbaColumns_BASE;
-+
-+class SwVbaColumns : public SwVbaColumns_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XTextTable > mxTextTable;
-+ css::uno::Reference< css::table::XTableColumns > mxTableColumns;
-+ sal_Int32 mnStartColumnIndex;
-+ sal_Int32 mnEndColumnIndex;
-+
-+private:
-+ css::uno::Reference< ooo::vba::word::XColumn > getColumnAtIndex( sal_Int32 index ) throw (css::uno::RuntimeException);
-+
-+public:
-+ SwVbaColumns( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::text::XTextTable >& xTextTable, const css::uno::Reference< css::table::XTableColumns >& xTableColumns ) throw ( css::uno::RuntimeException );
-+ SwVbaColumns( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::text::XTextTable >& xTextTable, const css::uno::Reference< css::table::XTableColumns >& xTableColumns, sal_Int32 nStartCol, sal_Int32 nEndCol ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaColumns() {}
-+
-+ virtual sal_Int32 SAL_CALL getWidth( ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setWidth( sal_Int32 _width ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL Select( ) throw (css::uno::RuntimeException);
-+
-+ //XCollection
-+ virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException);
-+ 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 );
-+ // 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);
-+
-+ // SwVbaColumns_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* SW_VBA_COLUMNS_HXX */
-diff --git sw/source/ui/vba/vbadocument.cxx sw/source/ui/vba/vbadocument.cxx
-index 1409dbb..d012c27 100644
---- sw/source/ui/vba/vbadocument.cxx
-+++ sw/source/ui/vba/vbadocument.cxx
-@@ -41,7 +41,9 @@
- #include <com/sun/star/drawing/XControlShape.hpp>
- #include <com/sun/star/drawing/XControlShape.hpp>
- #include <com/sun/star/form/XFormsSupplier.hpp>
-+#include <com/sun/star/document/XRedlinesSupplier.hpp>
- #include <ooo/vba/XControlProvider.hpp>
-+#include <ooo/vba/word/WdProtectionType.hpp>
-
- #include <vbahelper/helperdecl.hxx>
- #include <wordvbahelper.hxx>
-@@ -53,7 +55,13 @@
- #include "vbafield.hxx"
- #include "vbapagesetup.hxx"
- #include "vbasections.hxx"
-+#include "vbatablesofcontents.hxx"
- #include <vbahelper/vbashapes.hxx>
-+#include <vbahelper/vbahelper.hxx>
-+#include "vbarevisions.hxx"
-+#include "vbaframes.hxx"
-+#include "vbaformfields.hxx"
-+#include <osl/file.hxx>
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-@@ -223,6 +231,24 @@ SwVbaDocument::Sections( const uno::Any& index ) throw (uno::RuntimeException)
- }
-
- uno::Any SAL_CALL
-+SwVbaDocument::TablesOfContents( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< XCollection > xCol( new SwVbaTablesOfContents( this, mxContext, mxTextDocument ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaDocument::FormFields( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< XCollection > xCol( new SwVbaFormFields( this, mxContext, getModel() ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+uno::Any SAL_CALL
- SwVbaDocument::PageSetup( ) throw (uno::RuntimeException)
- {
- uno::Reference< beans::XPropertySet > xPageProps( word::getCurrentPageStyle( mxModel ), uno::UNO_QUERY_THROW );
-@@ -242,16 +268,35 @@ SwVbaDocument::getAttachedTemplate() throw (uno::RuntimeException)
- uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( getModel(), uno::UNO_QUERY_THROW );
- uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW );
- uno::Reference< document::XDocumentProperties > xDocProps( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW );
-- rtl::OUString sTemplateName = xDocProps->getTemplateName();
-+ rtl::OUString sTemplateUrl = xDocProps->getTemplateURL();
-
-- xTemplate = new SwVbaTemplate( this, mxContext, getModel(), sTemplateName );
-+ xTemplate = new SwVbaTemplate( this, mxContext, getModel(), sTemplateUrl );
- return uno::makeAny( xTemplate );
- }
-
- void SAL_CALL
--SwVbaDocument::setAttachedTemplate( const css::uno::Any& /*_attachedtemplate*/ ) throw (uno::RuntimeException)
-+SwVbaDocument::setAttachedTemplate( const css::uno::Any& _attachedtemplate ) throw (uno::RuntimeException)
- {
-- throw uno::RuntimeException();
-+ rtl::OUString sTemplate;
-+ if( !( _attachedtemplate >>= sTemplate ) )
-+ {
-+ throw uno::RuntimeException();
-+ }
-+ rtl::OUString aURL;
-+ INetURLObject aObj;
-+ aObj.SetURL( sTemplate );
-+ bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
-+ if ( bIsURL )
-+ aURL = sTemplate;
-+ else
-+ osl::FileBase::getFileURLFromSystemPath( sTemplate, aURL );
-+
-+ SwDocShell* pDocShell = word::getDocShell( getModel() );
-+ uno::Reference< word::XTemplate > xTemplate;
-+ uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( getModel(), uno::UNO_QUERY_THROW );
-+ uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW );
-+ uno::Reference< document::XDocumentProperties > xDocProps( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW );
-+ xDocProps->setTemplateURL( aURL );
- }
-
- uno::Any SAL_CALL
-@@ -270,6 +315,116 @@ void SAL_CALL SwVbaDocument::Activate() throw (uno::RuntimeException)
- VbaDocumentBase::Activate();
- }
-
-+::sal_Int32 SAL_CALL SwVbaDocument::getProtectionType() throw (css::uno::RuntimeException)
-+{
-+ //TODO
-+ return word::WdProtectionType::wdNoProtection;
-+}
-+
-+void SAL_CALL SwVbaDocument::setProtectionType( ::sal_Int32 _protectiontype ) throw (css::uno::RuntimeException)
-+{
-+ //TODO
-+}
-+
-+::sal_Bool SAL_CALL SwVbaDocument::getUpdateStylesOnOpen() throw (css::uno::RuntimeException)
-+{
-+ //TODO
-+ return sal_False;
-+}
-+
-+void SAL_CALL SwVbaDocument::setUpdateStylesOnOpen( ::sal_Bool _updatestylesonopen ) throw (uno::RuntimeException)
-+{
-+ //TODO
-+}
-+
-+::sal_Bool SAL_CALL SwVbaDocument::getAutoHyphenation() throw (uno::RuntimeException)
-+{
-+ // check this property only in default paragraph style
-+ sal_Bool IsAutoHyphenation = sal_False;
-+ uno::Reference< beans::XPropertySet > xParaProps( word::getDefaultParagraphStyle( getModel() ), uno::UNO_QUERY_THROW );
-+ xParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaIsHyphenation")) ) >>= IsAutoHyphenation;
-+ return IsAutoHyphenation;
-+}
-+
-+void SAL_CALL SwVbaDocument::setAutoHyphenation( ::sal_Bool _autohyphenation ) throw (uno::RuntimeException)
-+{
-+ //TODO
-+ uno::Reference< beans::XPropertySet > xParaProps( word::getDefaultParagraphStyle( getModel() ), uno::UNO_QUERY_THROW );
-+ xParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaIsHyphenation")), uno::makeAny( _autohyphenation ) );
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaDocument::getHyphenationZone() throw (uno::RuntimeException)
-+{
-+ //TODO
-+ return 0;
-+}
-+
-+void SAL_CALL SwVbaDocument::setHyphenationZone( ::sal_Int32 _hyphenationzone ) throw (uno::RuntimeException)
-+{
-+ //TODO
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaDocument::getConsecutiveHyphensLimit() throw (uno::RuntimeException)
-+{
-+ //TODO
-+ sal_Int16 nHyphensLimit = 0;
-+ uno::Reference< beans::XPropertySet > xParaProps( word::getDefaultParagraphStyle( getModel() ), uno::UNO_QUERY_THROW );
-+ xParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaHyphenationMaxHyphens")) ) >>= nHyphensLimit;
-+ return nHyphensLimit;
-+}
-+
-+void SAL_CALL SwVbaDocument::setConsecutiveHyphensLimit( ::sal_Int32 _consecutivehyphenslimit ) throw (uno::RuntimeException)
-+{
-+ sal_Int16 nHyphensLimit = static_cast< sal_Int16 >( _consecutivehyphenslimit );
-+ uno::Reference< beans::XPropertySet > xParaProps( word::getDefaultParagraphStyle( getModel() ), uno::UNO_QUERY_THROW );
-+ xParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaHyphenationMaxHyphens")), uno::makeAny( nHyphensLimit ) );
-+}
-+
-+void SAL_CALL SwVbaDocument::Protect( ::sal_Int32 Type, const uno::Any& NOReset, const uno::Any& Password, const uno::Any& UseIRM, const uno::Any& EnforceStyleLock ) throw (uno::RuntimeException)
-+{
-+ // Seems not support in Writer
-+ // VbaDocumentBase::Protect( Password );
-+}
-+
-+void SAL_CALL SwVbaDocument::PrintOut( const uno::Any& Background, const uno::Any& Append, const uno::Any& Range, const uno::Any& OutputFileName, const uno::Any& From, const uno::Any& To, const uno::Any& Item, const uno::Any& Copies, const uno::Any& Pages, const uno::Any& PageType, const uno::Any& PrintToFile, const uno::Any& Collate, const uno::Any& FileName, const uno::Any& ActivePrinterMacGX, const uno::Any& ManualDuplexPrint, const uno::Any& PrintZoomColumn, const uno::Any& PrintZoomRow, const uno::Any& PrintZoomPaperWidth, const uno::Any& PrintZoomPaperHeight ) throw (uno::RuntimeException)
-+{
-+ //TODO
-+}
-+
-+void SAL_CALL SwVbaDocument::PrintPreview( ) throw (uno::RuntimeException)
-+{
-+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:PrintPreview"));
-+ dispatchRequests( mxModel,url );
-+}
-+
-+void SAL_CALL SwVbaDocument::ClosePrintPreview( ) throw (uno::RuntimeException)
-+{
-+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ClosePreview"));
-+ dispatchRequests( mxModel,url );
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaDocument::Revisions( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< document::XRedlinesSupplier > xRedlinesSupp( mxTextDocument, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xRedlines( xRedlinesSupp->getRedlines(), uno::UNO_QUERY_THROW );
-+ uno::Reference< XCollection > xCol( new SwVbaRevisions( this, mxContext, getModel(), xRedlines ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaDocument::Frames( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< text::XTextFramesSupplier > xTextFramesSupp( mxTextDocument, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xFrames( xTextFramesSupp->getTextFrames(), uno::UNO_QUERY_THROW );
-+ uno::Reference< XCollection > xCol( new SwVbaFrames( this, mxContext, xFrames, getModel() ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
- uno::Any
- SwVbaDocument::getControlShape( const ::rtl::OUString& sName )
- {
-diff --git sw/source/ui/vba/vbadocument.hxx sw/source/ui/vba/vbadocument.hxx
-index 651b06c..020ab2b 100644
---- sw/source/ui/vba/vbadocument.hxx
-+++ sw/source/ui/vba/vbadocument.hxx
-@@ -68,6 +68,25 @@ public:
- virtual css::uno::Any SAL_CALL Sections( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Activate() throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL PageSetup() throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL TablesOfContents( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL FormFields( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getProtectionType() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setProtectionType( ::sal_Int32 _protectiontype ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getUpdateStylesOnOpen() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setUpdateStylesOnOpen( ::sal_Bool _updatestylesonopen ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getAutoHyphenation() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setAutoHyphenation( ::sal_Bool _autohyphenation ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getHyphenationZone() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setHyphenationZone( ::sal_Int32 _hyphenationzone ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getConsecutiveHyphensLimit() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setConsecutiveHyphensLimit( ::sal_Int32 _consecutivehyphenslimit ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL Protect( ::sal_Int32 Type, const css::uno::Any& NOReset, const css::uno::Any& Password, const css::uno::Any& UseIRM, const css::uno::Any& EnforceStyleLock ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL PrintOut( const css::uno::Any& Background, const css::uno::Any& Append, const css::uno::Any& Range, const css::uno::Any& OutputFileName, const css::uno::Any& From, const css::uno::Any& To, const css::uno::Any& Item, const css::uno::Any& Copies, const css::uno::Any& Pages, const css::uno::Any& PageType, const css::uno::Any& PrintToFile, const css::uno::Any& Collate, const css::uno::Any& FileName, const css::uno::Any& ActivePrinterMacGX, const css::uno::Any& ManualDuplexPrint, const css::uno::Any& PrintZoomColumn, const css::uno::Any& PrintZoomRow, const css::uno::Any& PrintZoomPaperWidth, const css::uno::Any& PrintZoomPaperHeight ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL PrintPreview( ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL ClosePrintPreview( ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Revisions( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Frames( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+
- // XInvocation
- 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);
-diff --git sw/source/ui/vba/vbadocumentproperties.cxx sw/source/ui/vba/vbadocumentproperties.cxx
-index f07b978..dfea425 100644
---- sw/source/ui/vba/vbadocumentproperties.cxx
-+++ sw/source/ui/vba/vbadocumentproperties.cxx
-@@ -206,16 +206,16 @@ public:
-
- static DocPropInfo createDocPropInfo( const rtl::OUString& sDesc, const rtl::OUString& sPropName, boost::shared_ptr< PropertGetSetHelper >& rHelper )
- {
-- return createDocPropInfo( rtl::OUStringToOString( sDesc, RTL_TEXTENCODING_UTF8 ).getStr(), rtl::OUStringToOString( sPropName, RTL_TEXTENCODING_UTF8 ).getStr(), rHelper );
-+ DocPropInfo aItem;
-+ aItem.msMSODesc = sDesc;
-+ aItem.msOOOPropName = sPropName;
-+ aItem.mpPropGetSetHelper = rHelper;
-+ return aItem;
- }
-
- static DocPropInfo createDocPropInfo( const sal_Char* sDesc, const sal_Char* sPropName, boost::shared_ptr< PropertGetSetHelper >& rHelper )
- {
-- DocPropInfo aItem;
-- aItem.msMSODesc = rtl::OUString::createFromAscii( sDesc );
-- aItem.msOOOPropName = rtl::OUString::createFromAscii( sPropName );
-- aItem.mpPropGetSetHelper = rHelper;
-- return aItem;
-+ return createDocPropInfo( rtl::OUString::createFromAscii( sDesc ), rtl::OUString::createFromAscii( sPropName ), rHelper );
- }
- uno::Any getValue()
- {
-diff --git sw/source/ui/vba/vbaeventshelper.cxx sw/source/ui/vba/vbaeventshelper.cxx
-new file mode 100644
-index 0000000..384a81f
---- /dev/null
-+++ sw/source/ui/vba/vbaeventshelper.cxx
-@@ -0,0 +1,169 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: vbaeventshelper.cxx,v $
-+ *
-+ * $Revision: 1.0 $
-+ *
-+ * last change: $Author: vg $ $Date: 2007/12/07 10:42:26 $
-+ *
-+ * 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 "vbaeventshelper.hxx"
-+#include <vbahelper/helperdecl.hxx>
-+#include <sfx2/objsh.hxx>
-+#include <comphelper/processfactory.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <svx/msvbahelper.hxx>
-+#include "wordvbahelper.hxx"
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+using namespace com::sun::star::document::VbaEventId;
-+
-+const static String sThisDocument( RTL_CONSTASCII_USTRINGPARAM("ThisDocument"));
-+
-+SwVbaEventsHelper::SwVbaEventsHelper( uno::Sequence< css::uno::Any > const& aArgs, uno::Reference< uno::XComponentContext > const& xContext ) : VbaEventsHelperBase( xContext )
-+{
-+ Initilize();
-+ uno::Reference< frame::XModel > xModel ( getXSomethingFromArgs< frame::XModel >( aArgs, 0 ), uno::UNO_QUERY );
-+ pDocShell = word::getDocShell( xModel );
-+}
-+
-+SwVbaEventsHelper::~SwVbaEventsHelper()
-+{
-+}
-+
-+void SwVbaEventsHelper::Initilize()
-+{
-+ insert( VBAEVENT_DOCUMENT_NEW, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Document_New") ) );
-+ insert( VBAEVENT_DOCUMENT_AUTONEW, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AutoNew") ) );
-+ insert( VBAEVENT_DOCUMENT_OPEN, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Document_Open") ) );
-+ insert( VBAEVENT_DOCUMENT_AUTOOPEN, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AutoOpen") ) );
-+ insert( VBAEVENT_DOCUMENT_CLOSE, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Document_Close") ) );
-+}
-+
-+rtl::OUString
-+SwVbaEventsHelper::getMacroPath( const sal_Int32 nEventId )
-+{
-+ String sMacroName = getEventName( nEventId );
-+ VBAMacroResolvedInfo sMacroResolvedInfo;
-+ switch( nEventId )
-+ {
-+ // Document events
-+ case VBAEVENT_DOCUMENT_NEW:
-+ case VBAEVENT_DOCUMENT_OPEN:
-+ case VBAEVENT_DOCUMENT_CLOSE:
-+ {
-+ sMacroName.Insert( '.', 0 ).Insert( sThisDocument, 0);
-+ sMacroResolvedInfo = resolveVBAMacro( pDocShell, sMacroName );
-+ break;
-+ }
-+ case VBAEVENT_DOCUMENT_AUTONEW:
-+ case VBAEVENT_DOCUMENT_AUTOOPEN:
-+ {
-+ sMacroResolvedInfo = resolveVBAMacro( pDocShell, sMacroName );
-+ break;
-+ }
-+ default:
-+ break;
-+ }
-+ return sMacroResolvedInfo.ResolvedMacro();
-+}
-+
-+sal_Bool SwVbaEventsHelper::processVbaEvent( const sal_Int32 nEventId, const uno::Sequence< uno::Any >& rArgs )
-+{
-+ sal_Bool result = sal_False;
-+ uno::Sequence< uno::Any > aArgs;
-+ uno::Any aRet;
-+ uno::Any aDummyCaller;
-+
-+ // For most cases, there is no corresponsible event macro in the document.
-+ // It is better fo check if the event macro exists before process the arguments to improve performance.
-+ rtl::OUString sMacroPath = getMacroPath( nEventId );
-+ if( sMacroPath.getLength() )
-+ {
-+ // excute the macro
-+ result = executeMacro( pDocShell, sMacroPath, aArgs, aRet, aDummyCaller );
-+ }
-+
-+ return result;
-+}
-+
-+sal_Bool SAL_CALL
-+SwVbaEventsHelper::ProcessCompatibleVbaEvent( sal_Int32 nEventId, const uno::Sequence< uno::Any >& aArgs ) throw (uno::RuntimeException)
-+{
-+ if( !pDocShell || mbIgnoreEvents)
-+ return sal_False;
-+
-+ // In order to better support "withevents" in the future,
-+ // it is better to process a event at a time
-+ switch( nEventId )
-+ {
-+ case VBAEVENT_DOCUMENT_NEW:
-+ {
-+ processVbaEvent( VBAEVENT_DOCUMENT_AUTONEW, aArgs );
-+ processVbaEvent( nEventId, aArgs );
-+ break;
-+ }
-+ case VBAEVENT_DOCUMENT_OPEN:
-+ {
-+ processVbaEvent( VBAEVENT_DOCUMENT_AUTOOPEN, aArgs );
-+ processVbaEvent( nEventId, aArgs );
-+ break;
-+ }
-+ case VBAEVENT_DOCUMENT_CLOSE:
-+ {
-+ return processVbaEvent( nEventId, aArgs );
-+ }
-+ default:
-+ OSL_TRACE( "Invalid Event" );
-+ }
-+
-+ return sal_True;
-+}
-+
-+::sal_Bool SAL_CALL
-+SwVbaEventsHelper::getIgnoreEvents() throw (uno::RuntimeException)
-+{
-+ return VbaEventsHelperBase::getIgnoreEvents();
-+}
-+
-+void SAL_CALL
-+SwVbaEventsHelper::setIgnoreEvents( ::sal_Bool _ignoreevents ) throw (uno::RuntimeException)
-+{
-+ VbaEventsHelperBase::setIgnoreEvents( _ignoreevents );
-+}
-+
-+namespace vbaeventshelper
-+{
-+namespace sdecl = comphelper::service_decl;
-+sdecl::class_<SwVbaEventsHelper, sdecl::with_args<true> > serviceImpl;
-+extern sdecl::ServiceDecl const serviceDecl(
-+ serviceImpl,
-+ "SwVbaEventsHelper",
-+ "com.sun.star.text.TextDocumentVbaEventsHelper" );
-+}
-diff --git sw/source/ui/vba/vbaeventshelper.hxx sw/source/ui/vba/vbaeventshelper.hxx
-new file mode 100644
-index 0000000..02dd648
---- /dev/null
-+++ sw/source/ui/vba/vbaeventshelper.hxx
-@@ -0,0 +1,67 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: vbaeventshelper.hxx,v $
-+ *
-+ * $Revision: 1.0 $
-+ *
-+ * last change: $Author: vg $ $Date: 2007/12/07 10:42:26 $
-+ *
-+ * 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 SW_VBAEVENTS_HXX
-+#define SW_VBAEVENTS_HXX
-+
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/document/VbaEventId.hpp>
-+#include <com/sun/star/document/XVbaEventsHelper.hpp>
-+#include <vbahelper/vbaeventshelperbase.hxx>
-+#include <doc.hxx>
-+#include <docsh.hxx>
-+
-+typedef ::cppu::WeakImplHelper1< com::sun::star::document::XVbaEventsHelper > VBADocumentEvent_BASE;
-+
-+class SwVbaEventsHelper : public VBADocumentEvent_BASE, public VbaEventsHelperBase
-+{
-+private:
-+ SwDocShell* pDocShell;
-+
-+ rtl::OUString getMacroPath( const sal_Int32 nEventId );
-+ sal_Bool processVbaEvent( const sal_Int32 nEventId, const css::uno::Sequence< css::uno::Any >& rArgs );
-+ void Initilize();
-+
-+public:
-+ SwVbaEventsHelper( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext > const& xContext );
-+ ~SwVbaEventsHelper();
-+ // XVBAWorkbookEventHelper
-+ virtual sal_Bool SAL_CALL ProcessCompatibleVbaEvent( sal_Int32 nEventId, const css::uno::Sequence< css::uno::Any >& aArgs ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setIgnoreEvents( ::sal_Bool _ignoreevents ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getIgnoreEvents() throw (css::uno::RuntimeException);
-+};
-+
-+#endif
-+
-diff --git sw/source/ui/vba/vbafield.cxx sw/source/ui/vba/vbafield.cxx
-index 6effe4d..849f59e 100644
---- sw/source/ui/vba/vbafield.cxx
-+++ sw/source/ui/vba/vbafield.cxx
-@@ -36,6 +36,7 @@
- #include <ooo/vba/word/WdFieldType.hpp>
- #include <com/sun/star/text/FilenameDisplayFormat.hpp>
- #include <com/sun/star/util/XRefreshable.hpp>
-+#include <com/sun/star/util/XUpdatable.hpp>
- #include <swtypes.hxx>
-
- using namespace ::ooo::vba;
-@@ -48,6 +49,17 @@ SwVbaField::SwVbaField( const uno::Reference< ooo::vba::XHelperInterface >& rPa
- mxTextField.set( xTextField, uno::UNO_QUERY_THROW );
- }
-
-+sal_Bool SAL_CALL SwVbaField::Update() throw (uno::RuntimeException)
-+{
-+ uno::Reference< util::XUpdatable > xUpdatable( mxTextField, uno::UNO_QUERY );
-+ if( xUpdatable.is() )
-+ {
-+ xUpdatable->update();
-+ return sal_True;
-+ }
-+ return sal_False;
-+}
-+
- // XHelperInterface
- rtl::OUString&
- SwVbaField::getServiceImplName()
-@@ -371,6 +383,7 @@ SwVbaFields::Add( const css::uno::Reference< ::ooo::vba::word::XRange >& Range,
- {
- _ReadFieldParams aReadParam(sText);
- sFieldName = aReadParam.GetFieldName();
-+ OSL_TRACE("SwVbaFields::Add, the field name is %s ",rtl::OUStringToOString( sFieldName, RTL_TEXTENCODING_UTF8 ).getStr() );
- }
-
- uno::Reference< text::XTextContent > xTextField;
-@@ -378,6 +391,10 @@ SwVbaFields::Add( const css::uno::Reference< ::ooo::vba::word::XRange >& Range,
- {
- xTextField.set( Create_Field_FileName( sText ), uno::UNO_QUERY_THROW );
- }
-+ else if( nType == word::WdFieldType::wdFieldDocProperty || sFieldName.EqualsIgnoreCaseAscii("DOCPROPERTY") )
-+ {
-+ xTextField.set( Create_Field_DocProperty( sText ), uno::UNO_QUERY_THROW );
-+ }
- else
- {
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-@@ -422,6 +439,104 @@ uno::Reference< text::XTextField > SwVbaFields::Create_Field_FileName( const rtl
- return xTextField;
- }
-
-+struct DocPropertyTable
-+{
-+ const char* sDocPropertyName;
-+ const char* sFieldService;
-+};
-+
-+static const DocPropertyTable aDocPropertyTables[] =
-+{
-+ { "Author", "com.sun.star.text.textfield.docinfo.CreateAuthor" },
-+ { "Bytes", NULL },
-+ { "Category", NULL },
-+ { "Characters",NULL },
-+ { "CharactersWithSpaces", NULL },
-+ { "Comments", "com.sun.star.text.textfield.docinfo.Description" },
-+ { "Company", NULL },
-+ { "CreateTime", "com.sun.star.text.textfield.docinfo.CreateDateTime" },
-+ { "HyperlinkBase", NULL },
-+ { "Keywords", "com.sun.star.text.textfield.docinfo.Keywords" },
-+ { "LastPrinted", "com.sun.star.text.textfield.docinfo.PrintDateTime" },
-+ { "LastSavedBy", "com.sun.star.text.textfield.docinfo.ChangeAuthor" },
-+ { "LastSavedTime", "com.sun.star.text.textfield.docinfo.ChangeDateTime" },
-+ { "Lines", NULL },
-+ { "Manager", NULL },
-+ { "NameofApplication", NULL },
-+ { "ODMADocID", NULL },
-+ { "Pages", "com.sun.star.text.textfield.PageCount" },
-+ { "Paragraphs", "com.sun.star.text.textfield.ParagraphCount" },
-+ { "RevisionNumber", "com.sun.star.text.textfield.docinfo.Revision" },
-+ { "Security", NULL },
-+ { "Subject", "com.sun.star.text.textfield.docinfo.Subject" },
-+ { "Template", "com.sun.star.text.textfield.TemplateName" },
-+ { "Title", "com.sun.star.text.textfield.docinfo.Title" },
-+ { "TotalEditingTime", "com.sun.star.text.textfield.docinfo.EditTime" },
-+ { "Words", "com.sun.star.text.textfield.WordCount" },
-+ { NULL, NULL }
-+};
-+
-+uno::Reference< text::XTextField > SwVbaFields::Create_Field_DocProperty( const rtl::OUString _text ) throw (uno::RuntimeException)
-+{
-+ String aDocProperty;
-+ _ReadFieldParams aReadParam( _text );
-+ long nRet;
-+ while( -1 != ( nRet = aReadParam.SkipToNextToken() ))
-+ {
-+ switch( nRet )
-+ {
-+ case -2:
-+ if( !aDocProperty.Len() )
-+ aDocProperty = aReadParam.GetResult();
-+ break;
-+ case '*':
-+ //Skip over MERGEFORMAT
-+ aReadParam.SkipToNextToken();
-+ break;
-+ }
-+ }
-+ aDocProperty.EraseAllChars('"');
-+ OSL_TRACE("SwVbaFields::Create_Field_DocProperty, the document property name is %s ",rtl::OUStringToOString( aDocProperty, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ if( aDocProperty.Len() == 0 )
-+ {
-+ throw uno::RuntimeException();
-+ }
-+
-+ sal_Bool bCustom = sal_True;
-+ rtl::OUString sFieldService;
-+ // find the build in document properties
-+ for( const DocPropertyTable* pTable = aDocPropertyTables; pTable->sDocPropertyName != NULL; pTable++ )
-+ {
-+ if( aDocProperty.EqualsIgnoreCaseAscii( pTable->sDocPropertyName ) )
-+ {
-+ if( pTable->sFieldService != NULL )
-+ sFieldService = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( pTable->sFieldService ) );
-+ bCustom = sal_False;
-+ break;
-+ }
-+ }
-+
-+ if( bCustom )
-+ {
-+ sFieldService = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.textfield.docinfo.Custom" ) );
-+ }
-+ else if( sFieldService.getLength() == 0 )
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+
-+ uno::Reference< text::XTextField > xTextField( mxMSF->createInstance( sFieldService ), uno::UNO_QUERY_THROW );
-+
-+ if( bCustom )
-+ {
-+ uno::Reference< beans::XPropertySet > xProps( xTextField, uno::UNO_QUERY_THROW );
-+ rtl::OUString sDocPropertyName( aDocProperty );
-+ xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ), uno::makeAny( sDocPropertyName ) );
-+ }
-+
-+ return xTextField;
-+}
-+
- uno::Reference< container::XEnumeration > SAL_CALL
- SwVbaFields::createEnumeration() throw (uno::RuntimeException)
- {
-diff --git sw/source/ui/vba/vbafield.hxx sw/source/ui/vba/vbafield.hxx
-index ab28416..9ec21b3 100644
---- sw/source/ui/vba/vbafield.hxx
-+++ sw/source/ui/vba/vbafield.hxx
-@@ -44,7 +44,8 @@ class SwVbaField : public SwVbaField_BASE
- css::uno::Reference< css::text::XTextField > mxTextField;
- public:
- SwVbaField( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rDocument, const css::uno::Reference< css::text::XTextField >& xTextField) throw ( css::uno::RuntimeException);
--
-+
-+ virtual sal_Bool SAL_CALL Update() throw ( css::uno::RuntimeException);
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-@@ -60,6 +61,7 @@ class SwVbaFields : public SwVbaFields_BASE
- css::uno::Reference< css::lang::XMultiServiceFactory > mxMSF;
- private:
- css::uno::Reference< css::text::XTextField > Create_Field_FileName( const rtl::OUString _text ) throw (css::uno::RuntimeException);
-+ css::uno::Reference< css::text::XTextField > Create_Field_DocProperty( const rtl::OUString _text ) throw (css::uno::RuntimeException);
-
- public:
- SwVbaFields( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel );
-diff --git sw/source/ui/vba/vbaformfield.cxx sw/source/ui/vba/vbaformfield.cxx
-new file mode 100644
-index 0000000..944ffbb
---- /dev/null
-+++ sw/source/ui/vba/vbaformfield.cxx
-@@ -0,0 +1,139 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbaformfield.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include <com/sun/star/text/XTextContent.hpp>
-+#include <com/sun/star/text/XTextViewCursor.hpp>
-+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
-+#include <ecmaflds.hxx>
-+#include "vbacheckbox.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaFormField::SwVbaFormField( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< frame::XModel >& rModel, const uno::Reference< text::XFormField >& xFormField ) throw ( uno::RuntimeException ) : SwVbaFormField_BASE( rParent, rContext ), mxModel( rModel ), mxFormField( xFormField )
-+{
-+}
-+
-+SwVbaFormField::~SwVbaFormField()
-+{
-+}
-+
-+rtl::OUString SAL_CALL SwVbaFormField::getResult() throw ( uno::RuntimeException )
-+{
-+ rtl::OUString sResult;
-+ rtl::OUString sType = mxFormField->getFieldType();
-+ if( sType.equalsIgnoreAsciiCaseAscii( ECMA_FORMTEXT ) )
-+ {
-+ uno::Reference< text::XTextContent > xTextContent( mxFormField, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextRange > xTextRange = xTextContent->getAnchor();
-+ sResult = xTextRange->getString();
-+ }
-+ else if( sType.equalsIgnoreAsciiCaseAscii( ECMA_FORMCHECKBOX ) )
-+ {
-+ sal_Int32 nValue = 0;
-+ sal_Int32 nCount = mxFormField->getParamCount();
-+ for( sal_Int32 i = 0; i < nCount; i++ )
-+ {
-+ if( mxFormField->getParamName(i).equalsIgnoreAsciiCaseAscii( ECMA_FORMCHECKBOX_CHECKED ) )
-+ {
-+ if( mxFormField->getParamValue(i).equalsIgnoreAsciiCaseAscii("on") )
-+ nValue = 1;
-+ else
-+ nValue = 0;
-+ break;
-+ }
-+
-+ }
-+ sResult = rtl::OUString::valueOf( nValue );
-+ }
-+ else
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+ return sResult;
-+}
-+
-+void SAL_CALL SwVbaFormField::setResult( const rtl::OUString& result ) throw ( uno::RuntimeException )
-+{
-+ rtl::OUString sType = mxFormField->getFieldType();
-+ if( sType.equalsIgnoreAsciiCaseAscii( ECMA_FORMTEXT ) )
-+ {
-+ uno::Reference< text::XTextContent > xTextContent( mxFormField, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextRange > xTextRange = xTextContent->getAnchor();
-+ xTextRange->setString( result );
-+ }
-+ else if( sType.equalsIgnoreAsciiCaseAscii( ECMA_FORMCHECKBOX ) )
-+ {
-+ // do nothing
-+ }
-+ else
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+}
-+
-+sal_Bool SAL_CALL SwVbaFormField::getEnabled() throw ( uno::RuntimeException )
-+{
-+ //allways return true
-+ return sal_True;
-+}
-+
-+void SAL_CALL SwVbaFormField::setEnabled( sal_Bool/* enabled */ ) throw ( uno::RuntimeException )
-+{
-+ // not support in Writer
-+}
-+
-+uno::Any SAL_CALL SwVbaFormField::CheckBox() throw ( uno::RuntimeException )
-+{
-+ return uno::makeAny( uno::Reference< word::XCheckBox >( new SwVbaCheckBox( this, mxContext, mxModel, mxFormField ) ) );
-+}
-+
-+rtl::OUString&
-+SwVbaFormField::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaFormField") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaFormField::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.FormField" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbaformfield.hxx sw/source/ui/vba/vbaformfield.hxx
-new file mode 100644
-index 0000000..e3a2d7f
---- /dev/null
-+++ sw/source/ui/vba/vbaformfield.hxx
-@@ -0,0 +1,61 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_FORMFIELD_HXX
-+#define SW_VBA_FORMFIELD_HXX
-+
-+#include <ooo/vba/word/XFormField.hpp>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/text/XFormField.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XFormField > SwVbaFormField_BASE;
-+
-+class SwVbaFormField : public SwVbaFormField_BASE
-+{
-+private:
-+ css::uno::Reference< css::frame::XModel > mxModel;
-+ css::uno::Reference< css::text::XFormField > mxFormField;
-+
-+public:
-+ SwVbaFormField( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& rModel, const css::uno::Reference< css::text::XFormField >& xFormField ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaFormField();
-+
-+ // Methods
-+ rtl::OUString SAL_CALL getResult() throw ( css::uno::RuntimeException );
-+ void SAL_CALL setResult( const rtl::OUString& result ) throw ( css::uno::RuntimeException );
-+ sal_Bool SAL_CALL getEnabled() throw ( css::uno::RuntimeException );
-+ void SAL_CALL setEnabled( sal_Bool enabled ) throw ( css::uno::RuntimeException );
-+ css::uno::Any SAL_CALL CheckBox() throw ( css::uno::RuntimeException );
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_FORMFIELD_HXX */
-diff --git sw/source/ui/vba/vbaformfields.cxx sw/source/ui/vba/vbaformfields.cxx
-new file mode 100644
-index 0000000..b56cff8
---- /dev/null
-+++ sw/source/ui/vba/vbaformfields.cxx
-@@ -0,0 +1,205 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbaformfields.hxx"
-+#include "vbaformfield.hxx"
-+#include <com/sun/star/container/XNamed.hpp>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include <com/sun/star/text/XTextViewCursor.hpp>
-+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
-+#include "wordvbahelper.hxx"
-+#include <cppuhelper/implbase3.hxx>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+typedef std::vector< uno::Reference< text::XFormField > > XFormFieldVec;
-+typedef ::cppu::WeakImplHelper1< container::XEnumeration > FormFiledEnumeration_BASE;
-+typedef ::cppu::WeakImplHelper3< container::XNameAccess, container::XIndexAccess, container::XEnumerationAccess > FormFieldCollectionHelper_BASE;
-+
-+rtl::OUString lcl_getFormFieldName( const uno::Reference< text::XFormField >& xFormField )
-+{
-+ rtl::OUString sName;
-+ sal_Int32 nCount = xFormField->getParamCount();
-+ for( sal_Int32 i = 0; i < nCount; i++ )
-+ {
-+ if( xFormField->getParamName(i).equalsIgnoreAsciiCaseAscii( "Name" ) )
-+ {
-+ sName = xFormField->getParamValue(i);
-+ OSL_TRACE("lcl_getFormFieldName: %s", rtl::OUStringToOString( sName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ break;
-+ }
-+ }
-+ return sName;
-+}
-+
-+class FormFieldsEnumeration : public FormFiledEnumeration_BASE
-+{
-+private:
-+ uno::Reference< XHelperInterface > mxParent;
-+ uno::Reference< uno::XComponentContext > mxContext;
-+ uno::Reference< frame::XModel > mxModel;
-+ XFormFieldVec mxFormFields;
-+ XFormFieldVec::iterator cachePos;
-+public:
-+ FormFieldsEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel, const XFormFieldVec& xFormFiels ) throw (uno::RuntimeException) : mxParent( xParent ), mxContext( xContext ), mxModel( xModel ), mxFormFields( xFormFiels ), cachePos( mxFormFields.begin() )
-+ {
-+ }
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( cachePos != mxFormFields.end() );
-+ }
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( !hasMoreElements() )
-+ throw container::NoSuchElementException();
-+ uno::Reference< text::XFormField > xFormField( *cachePos++ );
-+ return uno::makeAny( uno::Reference< word::XFormField > ( new SwVbaFormField( mxParent, mxContext, mxModel, xFormField ) ) );
-+ }
-+
-+};
-+
-+class FormFieldCollectionHelper : public FormFieldCollectionHelper_BASE
-+{
-+private:
-+ uno::Reference< XHelperInterface > mxParent;
-+ uno::Reference< uno::XComponentContext > mxContext;
-+ uno::Reference< frame::XModel > mxModel;
-+ XFormFieldVec mxFormFields;
-+ XFormFieldVec::iterator cachePos;
-+public:
-+ FormFieldCollectionHelper( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException) : mxParent( xParent ), mxContext( xContext ), mxModel( xModel )
-+ {
-+ uno::Reference< text::XBookmarksSupplier > xBookmarksSupplier( xModel,uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xIndexAccess( xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY_THROW );
-+ sal_Int32 nCount = xIndexAccess->getCount();
-+ for( sal_Int32 i = 0; i < nCount; i++ )
-+ {
-+ uno::Reference< text::XFormField > xFormField( xIndexAccess->getByIndex( i ), uno::UNO_QUERY );
-+ if( xFormField.is() )
-+ mxFormFields.push_back( xFormField );
-+ }
-+ cachePos = mxFormFields.begin();
-+ }
-+ // XElementAccess
-+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) { return word::XFormField::static_type(0); }
-+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) { return getCount() > 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();
-+ uno::Reference< text::XFormField > xFormField( *cachePos, uno::UNO_QUERY_THROW );
-+ return uno::makeAny( uno::Reference< word::XFormField >( new SwVbaFormField( mxParent, mxContext, mxModel, xFormField ) ) );
-+ }
-+ virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException)
-+ {
-+ uno::Sequence< rtl::OUString > sNames( mxFormFields.size() );
-+ rtl::OUString* pString = sNames.getArray();
-+ XFormFieldVec::iterator it = mxFormFields.begin();
-+ XFormFieldVec::iterator it_end = mxFormFields.end();
-+ for ( ; it != it_end; ++it, ++pString )
-+ {
-+ uno::Reference< text::XFormField > xFormField( *cachePos, uno::UNO_QUERY_THROW );
-+ *pString = lcl_getFormFieldName( xFormField );
-+ }
-+ return sNames;
-+ }
-+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
-+ {
-+ cachePos = mxFormFields.begin();
-+ XFormFieldVec::iterator it_end = mxFormFields.end();
-+ for ( ; cachePos != it_end; ++cachePos )
-+ {
-+ //uno::Reference< container::XNamed > xName( *cachePos, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XFormField > xFormField( *cachePos, uno::UNO_QUERY_THROW );
-+ if ( aName.equalsIgnoreAsciiCase( lcl_getFormFieldName( xFormField )) )
-+ break;
-+ }
-+ return ( cachePos != it_end );
-+ }
-+ // XIndexAccess
-+ virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
-+ {
-+ return mxFormFields.size();
-+ }
-+ virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
-+ {
-+ if ( Index < 0 || Index >= getCount() )
-+ throw lang::IndexOutOfBoundsException();
-+ return uno::makeAny( uno::Reference< word::XFormField >( new SwVbaFormField( mxParent, mxContext, mxModel, mxFormFields[ Index ] ) ) );
-+ }
-+ // XEnumerationAccess
-+ virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
-+ {
-+ return new FormFieldsEnumeration( mxParent, mxContext, mxModel, mxFormFields );
-+ }
-+};
-+
-+SwVbaFormFields::SwVbaFormFields( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel ): SwVbaFormFields_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new FormFieldCollectionHelper( xParent, xContext, xModel ) ) ), mxModel( xModel )
-+{
-+}
-+// XEnumerationAccess
-+uno::Type
-+SwVbaFormFields::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XFormField::static_type(0);
-+}
-+uno::Reference< container::XEnumeration >
-+SwVbaFormFields::createEnumeration() throw (uno::RuntimeException)
-+{
-+ uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
-+ return xEnumAccess->createEnumeration();
-+}
-+
-+uno::Any
-+SwVbaFormFields::createCollectionObject( const css::uno::Any& aSource )
-+{
-+ return aSource;
-+}
-+
-+rtl::OUString&
-+SwVbaFormFields::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaFormFields") );
-+ return sImplName;
-+}
-+
-+css::uno::Sequence<rtl::OUString>
-+SwVbaFormFields::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.FormFields") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbaformfields.hxx sw/source/ui/vba/vbaformfields.hxx
-new file mode 100644
-index 0000000..76ef6bb
---- /dev/null
-+++ sw/source/ui/vba/vbaformfields.hxx
-@@ -0,0 +1,60 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_FORMFIELDS_HXX
-+#define SW_VBA_FORMFIELDS_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XFormFields.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/text/XBookmarksSupplier.hpp>
-+#include <com/sun/star/text/XTextRange.hpp>
-+
-+typedef CollTestImplHelper< ooo::vba::word::XFormFields > SwVbaFormFields_BASE;
-+
-+class SwVbaFormFields : public SwVbaFormFields_BASE
-+{
-+private:
-+ css::uno::Reference< css::frame::XModel > mxModel;
-+
-+public:
-+ SwVbaFormFields( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel );
-+ virtual ~SwVbaFormFields() {}
-+
-+ // 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);
-+
-+ // SwVbaFormFields_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* SW_VBA_FORMFIELDS_HXX */
-diff --git sw/source/ui/vba/vbaframe.cxx sw/source/ui/vba/vbaframe.cxx
-new file mode 100644
-index 0000000..bec1aa6
---- /dev/null
-+++ sw/source/ui/vba/vbaframe.cxx
-@@ -0,0 +1,75 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbaframe.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include <com/sun/star/text/XTextContent.hpp>
-+#include <com/sun/star/text/XTextViewCursor.hpp>
-+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
-+#include <com/sun/star/view/XSelectionSupplier.hpp>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaFrame::SwVbaFrame( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const css::uno::Reference< frame::XModel >& rModel, const css::uno::Reference< text::XTextFrame >& xTextFrame ) throw ( css::uno::RuntimeException ) :
-+ SwVbaFrame_BASE( rParent, rContext ), mxModel( rModel ), mxTextFrame( xTextFrame )
-+{
-+}
-+
-+SwVbaFrame::~SwVbaFrame()
-+{
-+}
-+
-+void SAL_CALL SwVbaFrame::Select() throw ( uno::RuntimeException )
-+{
-+ uno::Reference< view::XSelectionSupplier > xSelectSupp( mxModel->getCurrentController(), uno::UNO_QUERY_THROW );
-+ xSelectSupp->select( uno::makeAny( mxTextFrame ) );
-+}
-+
-+rtl::OUString&
-+SwVbaFrame::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaFrame") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaFrame::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Frame" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbaframe.hxx sw/source/ui/vba/vbaframe.hxx
-new file mode 100644
-index 0000000..a36ebf8
---- /dev/null
-+++ sw/source/ui/vba/vbaframe.hxx
-@@ -0,0 +1,57 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_FRAME_HXX
-+#define SW_VBA_FRAME_HXX
-+
-+#include <ooo/vba/word/XFrame.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/text/XTextFrame.hpp>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XFrame > SwVbaFrame_BASE;
-+
-+class SwVbaFrame : public SwVbaFrame_BASE
-+{
-+private:
-+ css::uno::Reference< css::frame::XModel > mxModel;
-+ css::uno::Reference< css::text::XTextFrame > mxTextFrame;
-+
-+public:
-+ SwVbaFrame( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& rModel, const css::uno::Reference< css::text::XTextFrame >& xTextFrame ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaFrame();
-+
-+ // Methods
-+ virtual void SAL_CALL Select() throw ( css::uno::RuntimeException );
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_FRAME_HXX */
-diff --git sw/source/ui/vba/vbaframes.cxx sw/source/ui/vba/vbaframes.cxx
-new file mode 100644
-index 0000000..2c9fa92
---- /dev/null
-+++ sw/source/ui/vba/vbaframes.cxx
-@@ -0,0 +1,109 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbaframes.hxx"
-+#include "vbaframe.hxx"
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include <com/sun/star/text/XTextViewCursor.hpp>
-+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
-+#include "wordvbahelper.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+typedef ::cppu::WeakImplHelper1< container::XEnumeration > FramesEnumeration_Base;
-+class FramesEnumeration : public FramesEnumeration_Base
-+{
-+private:
-+ uno::Reference< XHelperInterface > mxParent;
-+ uno::Reference< uno::XComponentContext > mxContext;
-+ uno::Reference< container::XIndexAccess> mxIndexAccess;
-+ uno::Reference< frame::XModel > mxModel;
-+ sal_Int32 nCurrentPos;
-+public:
-+ FramesEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess, const uno::Reference< frame::XModel >& xModel ) throw ( uno::RuntimeException ) : mxParent( xParent ), mxContext( xContext), mxIndexAccess( xIndexAccess ), mxModel( xModel ), nCurrentPos(0)
-+ {
-+ }
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( nCurrentPos < mxIndexAccess->getCount() );
-+ }
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( !hasMoreElements() )
-+ throw container::NoSuchElementException();
-+ uno::Reference< text::XTextFrame > xTextFrame( mxIndexAccess->getByIndex( nCurrentPos++ ), uno::UNO_QUERY_THROW );
-+ return uno::makeAny( uno::Reference< word::XFrame > ( new SwVbaFrame( mxParent, mxContext, mxModel, xTextFrame ) ) );
-+ }
-+
-+};
-+
-+SwVbaFrames::SwVbaFrames( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< container::XIndexAccess >& xFrames, const uno::Reference< frame::XModel >& xModel ): SwVbaFrames_BASE( xParent, xContext, xFrames ), mxModel( xModel )
-+{
-+ mxFramesSupplier.set( mxModel, uno::UNO_QUERY_THROW );
-+}
-+// XEnumerationAccess
-+uno::Type
-+SwVbaFrames::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XFrame::static_type(0);
-+}
-+
-+uno::Reference< container::XEnumeration >
-+SwVbaFrames::createEnumeration() throw (uno::RuntimeException)
-+{
-+ return new FramesEnumeration( this, mxContext,m_xIndexAccess, mxModel );
-+}
-+
-+uno::Any
-+SwVbaFrames::createCollectionObject( const css::uno::Any& aSource )
-+{
-+ uno::Reference< text::XTextFrame > xTextFrame( aSource, uno::UNO_QUERY_THROW );
-+ return uno::makeAny( uno::Reference< word::XFrame > ( new SwVbaFrame( this, mxContext, mxModel, xTextFrame ) ) );
-+}
-+
-+rtl::OUString&
-+SwVbaFrames::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaFrames") );
-+ return sImplName;
-+}
-+
-+css::uno::Sequence<rtl::OUString>
-+SwVbaFrames::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Frames") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbaframes.hxx sw/source/ui/vba/vbaframes.hxx
-new file mode 100644
-index 0000000..0957820
---- /dev/null
-+++ sw/source/ui/vba/vbaframes.hxx
-@@ -0,0 +1,61 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_FRAMES_HXX
-+#define SW_VBA_FRAMES_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XFrames.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/text/XTextFramesSupplier.hpp>
-+
-+typedef CollTestImplHelper< ooo::vba::word::XFrames > SwVbaFrames_BASE;
-+
-+class SwVbaFrames : public SwVbaFrames_BASE
-+{
-+private:
-+ css::uno::Reference< css::frame::XModel > mxModel;
-+ css::uno::Reference< css::text::XTextFramesSupplier > mxFramesSupplier;
-+
-+public:
-+ SwVbaFrames( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::container::XIndexAccess >& xFrames, const css::uno::Reference< css::frame::XModel >& xModel );
-+ virtual ~SwVbaFrames() {}
-+
-+ // 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);
-+
-+ // SwVbaFrames_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+
-+};
-+
-+#endif /* SW_VBA_FRAMES_HXX */
-diff --git sw/source/ui/vba/vbaglobals.cxx sw/source/ui/vba/vbaglobals.cxx
-index 935a95c..ff56a9b 100644
---- sw/source/ui/vba/vbaglobals.cxx
-+++ sw/source/ui/vba/vbaglobals.cxx
-@@ -132,6 +132,12 @@ SwVbaGlobals::Dialogs( const uno::Any& index ) throw (uno::RuntimeException)
- return getApplication()->Dialogs( index );
- }
-
-+uno::Any SAL_CALL
-+SwVbaGlobals::ListGalleries( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ return getApplication()->ListGalleries( index );
-+}
-+
- uno::Reference<word::XSelection > SAL_CALL
- SwVbaGlobals::getSelection() throw (uno::RuntimeException)
- {
-diff --git sw/source/ui/vba/vbaglobals.hxx sw/source/ui/vba/vbaglobals.hxx
-index 066282e..2a2e328 100644
---- sw/source/ui/vba/vbaglobals.hxx
-+++ sw/source/ui/vba/vbaglobals.hxx
-@@ -72,6 +72,7 @@ public:
- virtual css::uno::Any SAL_CALL Documents( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Addins( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Dialogs( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL ListGalleries( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
- virtual float SAL_CALL CentimetersToPoints( float _Centimeters ) throw (css::uno::RuntimeException);
- // XMultiServiceFactory
- virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames( ) throw (css::uno::RuntimeException);
-diff --git sw/source/ui/vba/vbaheaderfooter.cxx sw/source/ui/vba/vbaheaderfooter.cxx
-index 0176edf..138e90d 100644
---- sw/source/ui/vba/vbaheaderfooter.cxx
-+++ sw/source/ui/vba/vbaheaderfooter.cxx
-@@ -84,6 +84,7 @@ uno::Reference< word::XRange > SAL_CALL SwVbaHeaderFooter::getRange() throw (uno
- uno::Any SAL_CALL
- SwVbaHeaderFooter::Shapes( const uno::Any& index ) throw (uno::RuntimeException)
- {
-+ // #FIXME: only get the shapes in the current header/footer
- uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxModel, uno::UNO_QUERY_THROW );
- //uno::Reference< drawing::XShapes > xShapes( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
- uno::Reference< container::XIndexAccess > xIndexAccess( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
-diff --git sw/source/ui/vba/vbaheaderfooterhelper.cxx sw/source/ui/vba/vbaheaderfooterhelper.cxx
-index 4069b85..0f8f194 100644
---- sw/source/ui/vba/vbaheaderfooterhelper.cxx
-+++ sw/source/ui/vba/vbaheaderfooterhelper.cxx
-@@ -32,8 +32,12 @@
- #include <comphelper/processfactory.hxx>
- #include <com/sun/star/frame/XController.hpp>
- #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
-+#include <com/sun/star/text/XTextRangeCompare.hpp>
-+#include <com/sun/star/text/XTextRange.hpp>
- #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
- #include <com/sun/star/container/XNameAccess.hpp>
-+#include <com/sun/star/lang/XServiceInfo.hpp>
-+#include <com/sun/star/lang/IllegalArgumentException.hpp>
-
- using namespace ::com::sun::star;
- using namespace ::ooo::vba;
-@@ -41,41 +45,61 @@ using namespace ::ooo::vba;
- #define FIRST_PAGE 1;
-
- // Class HeaderFooterHelper
-+sal_Bool HeaderFooterHelper::isHeaderFooter( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
-+{
-+ return isHeaderFooter( word::getCurrentXText( xModel ) );
-+}
-
--sal_Bool HeaderFooterHelper::isHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
-+sal_Bool HeaderFooterHelper::isHeaderFooter( const uno::Reference< text::XText >& xText ) throw (uno::RuntimeException)
- {
-- uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
-- uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW );
--
-- sal_Bool isOn = sal_False;
-- xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn"))) >>= isOn;
-- if( !isOn )
-- return sal_False;
-+ uno::Reference< lang::XServiceInfo > xServiceInfo( xText, uno::UNO_QUERY_THROW );
-+ rtl::OUString aImplName = xServiceInfo->getImplementationName();
-+ if( aImplName.equalsAscii("SwXHeadFootText") )
-+ return sal_True;
-+ return sal_False;
-+}
-
-- sal_Bool isShared = sal_False;
-- xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsShared"))) >>= isShared;
-+sal_Bool HeaderFooterHelper::isHeader( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
-+{
-+ const uno::Reference< text::XText > xCurrentText = word::getCurrentXText( xModel );
-+ if( !isHeaderFooter( xCurrentText ) )
-+ return sal_False;
-
-+ rtl::OUString aPropIsShared = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsShared") );
- rtl::OUString aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderText") );
-+ uno::Reference< style::XStyle > xPageStyle = word::getCurrentPageStyle( xModel );
-+ uno::Reference< beans::XPropertySet > xPageProps( xPageStyle, uno::UNO_QUERY_THROW );
-+ sal_Bool isShared = sal_True;
-+ xPageProps->getPropertyValue( aPropIsShared ) >>= isShared;
- if( !isShared )
- {
-+ uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
- if( 0 == xPageCursor->getPage() % 2 )
-- {
- aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderTextLeft") );
-- }
- else
-- {
- aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderTextRight") );
-- }
- }
--
-- uno::Reference< text::XText > xText( xStyleProps->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW );
-- //FIXME: can not compare in this way?
-- return ( xText == xCurrentText );
-+
-+ uno::Reference< text::XText > xHeaderText( xPageProps->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextRangeCompare > xTRC( xHeaderText, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextRange > xTR1( xCurrentText, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextRange > xTR2( xHeaderText, uno::UNO_QUERY_THROW );
-+ try
-+ {
-+ if( xTRC->compareRegionStarts( xTR1, xTR2 ) == 0 )
-+ return sal_True;
-+ }
-+ catch( lang::IllegalArgumentException& )
-+ {
-+ return sal_False;
-+ }
-+
-+ return sal_False;
- }
-
--sal_Bool HeaderFooterHelper::isFirstPageHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
-+sal_Bool HeaderFooterHelper::isFirstPageHeader( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
- {
-- if( isHeader( xModel, xCurrentText ) )
-+ if( isHeader( xModel ) )
- {
- uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
- // FIXME: getPage allways returns 1
-@@ -85,9 +109,9 @@ sal_Bool HeaderFooterHelper::isFirstPageHeader( const uno::Reference< frame::XMo
- return sal_False;
- }
-
--sal_Bool HeaderFooterHelper::isEvenPagesHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
-+sal_Bool HeaderFooterHelper::isEvenPagesHeader( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
- {
-- if( isHeader( xModel, xCurrentText ) )
-+ if( isHeader( xModel ) )
- {
- uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW );
- sal_Bool isShared = sal_False;
-@@ -101,40 +125,47 @@ sal_Bool HeaderFooterHelper::isEvenPagesHeader( const uno::Reference< frame::XMo
- return sal_False;
- }
-
--sal_Bool HeaderFooterHelper::isFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
-+sal_Bool HeaderFooterHelper::isFooter( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
- {
-- uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
-- uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW );
--
-- sal_Bool isOn = sal_False;
-- xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn"))) >>= isOn;
-- if( !isOn )
-+ const uno::Reference< text::XText > xCurrentText = word::getCurrentXText( xModel );
-+ if( !isHeaderFooter( xCurrentText ) )
- return sal_False;
-
-- sal_Bool isShared = sal_False;
-- xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsShared"))) >>= isShared;
--
-+ rtl::OUString aPropIsShared = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsShared") );
- rtl::OUString aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterText") );
-+ uno::Reference< style::XStyle > xPageStyle = word::getCurrentPageStyle( xModel );
-+ uno::Reference< beans::XPropertySet > xPageProps( xPageStyle, uno::UNO_QUERY_THROW );
-+ sal_Bool isShared = sal_True;
-+ xPageProps->getPropertyValue( aPropIsShared ) >>= isShared;
- if( !isShared )
- {
-+ uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
- if( 0 == xPageCursor->getPage() % 2 )
-- {
- aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterTextLeft") );
-- }
- else
-- {
- aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterTextRight") );
-- }
- }
--
-- uno::Reference< text::XText > xText( xStyleProps->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW );
-
-- return ( xText == xCurrentText );
-+ uno::Reference< text::XText > xFooterText( xPageProps->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextRangeCompare > xTRC( xFooterText, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextRange > xTR1( xCurrentText, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextRange > xTR2( xFooterText, uno::UNO_QUERY_THROW );
-+ try
-+ {
-+ if( xTRC->compareRegionStarts( xTR1, xTR2 ) == 0 )
-+ return sal_True;
-+ }
-+ catch( lang::IllegalArgumentException& )
-+ {
-+ return sal_False;
-+ }
-+
-+ return sal_False;
- }
-
--sal_Bool HeaderFooterHelper::isFirstPageFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
-+sal_Bool HeaderFooterHelper::isFirstPageFooter( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
- {
-- if( isFooter( xModel, xCurrentText ) )
-+ if( isFooter( xModel ) )
- {
- uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
- sal_Int32 nPage = xPageCursor->getPage();
-@@ -143,9 +174,9 @@ sal_Bool HeaderFooterHelper::isFirstPageFooter( const uno::Reference< frame::XMo
- return sal_False;
- }
-
--sal_Bool HeaderFooterHelper::isEvenPagesFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
-+sal_Bool HeaderFooterHelper::isEvenPagesFooter( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
- {
-- if( isFooter( xModel, xCurrentText ) )
-+ if( isFooter( xModel ) )
- {
- uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW );
- sal_Bool isShared = sal_False;
-@@ -159,20 +190,20 @@ sal_Bool HeaderFooterHelper::isEvenPagesFooter( const uno::Reference< frame::XMo
- return sal_False;
- }
-
--sal_Bool HeaderFooterHelper::isPrimaryHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
-+sal_Bool HeaderFooterHelper::isPrimaryHeader( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
- {
-- if( isHeader( xModel, xCurrentText ) )
-+ if( isHeader( xModel ) )
- {
-- return( !( isFirstPageHeader( xModel, xCurrentText ) && isEvenPagesHeader( xModel, xCurrentText ) ) );
-+ return( !( isFirstPageHeader( xModel ) && isEvenPagesHeader( xModel ) ) );
- }
- return sal_False;
- }
-
--sal_Bool HeaderFooterHelper::isPrimaryFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
-+sal_Bool HeaderFooterHelper::isPrimaryFooter( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
- {
-- if( isHeader( xModel, xCurrentText ) )
-+ if( isHeader( xModel ) )
- {
-- return( !( isFirstPageFooter( xModel, xCurrentText ) && isEvenPagesFooter( xModel, xCurrentText ) ) );
-+ return( !( isFirstPageFooter( xModel ) && isEvenPagesFooter( xModel ) ) );
- }
- return sal_False;
- }
-diff --git sw/source/ui/vba/vbaheaderfooterhelper.hxx sw/source/ui/vba/vbaheaderfooterhelper.hxx
-index 2dffc59..e95aaa3 100644
---- sw/source/ui/vba/vbaheaderfooterhelper.hxx
-+++ sw/source/ui/vba/vbaheaderfooterhelper.hxx
-@@ -39,14 +39,16 @@
- class HeaderFooterHelper
- {
- public:
-- static sal_Bool isHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-- static sal_Bool isFirstPageHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-- static sal_Bool isEvenPagesHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-- static sal_Bool isFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-- static sal_Bool isFirstPageFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-- static sal_Bool isEvenPagesFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-- static sal_Bool isPrimaryHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-- static sal_Bool isPrimaryFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-+ static sal_Bool isHeaderFooter( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
-+ static sal_Bool isHeaderFooter( const css::uno::Reference< css::text::XText >& xText ) throw (css::uno::RuntimeException);
-+ static sal_Bool isHeader( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
-+ static sal_Bool isFirstPageHeader( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
-+ static sal_Bool isEvenPagesHeader( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
-+ static sal_Bool isFooter( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
-+ static sal_Bool isFirstPageFooter( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
-+ static sal_Bool isEvenPagesFooter( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
-+ static sal_Bool isPrimaryHeader( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
-+ static sal_Bool isPrimaryFooter( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
- };
-
- #endif
-diff --git sw/source/ui/vba/vbaheadersfooters.cxx sw/source/ui/vba/vbaheadersfooters.cxx
-new file mode 100644
-index 0000000..295314a
---- /dev/null
-+++ sw/source/ui/vba/vbaheadersfooters.cxx
-@@ -0,0 +1,150 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbaheadersfooters.hxx"
-+#include "vbaheaderfooter.hxx"
-+#include <ooo/vba/word/WdHeaderFooterIndex.hpp>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+// I assume there is only one headersfooters in Writer
-+typedef ::cppu::WeakImplHelper1<container::XIndexAccess > HeadersFootersIndexAccess_Base;
-+class HeadersFootersIndexAccess : public HeadersFootersIndexAccess_Base
-+{
-+private:
-+ uno::Reference< XHelperInterface > mxParent;
-+ uno::Reference< uno::XComponentContext > mxContext;
-+ uno::Reference< frame::XModel > mxModel;
-+ uno::Reference< beans::XPropertySet > mxPageStyleProps;
-+ sal_Bool mbHeader;
-+
-+public:
-+ HeadersFootersIndexAccess( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< beans::XPropertySet >& xPageStyleProps, sal_Bool bHeader ) : mxParent( xParent ), mxContext( xContext ), mxModel( xModel ), mxPageStyleProps( xPageStyleProps ), mbHeader( bHeader ) {}
-+ ~HeadersFootersIndexAccess(){}
-+
-+ // XIndexAccess
-+ virtual sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
-+ {
-+ // first page, evenpages and primary page
-+ return 3;
-+ }
-+ virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if( Index < 1 || Index > 3 )
-+ throw container::NoSuchElementException();
-+ return uno::makeAny( uno::Reference< word::XHeaderFooter >( new SwVbaHeaderFooter( mxParent, mxContext, mxModel, mxPageStyleProps, mbHeader, Index ) ) );
-+ }
-+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
-+ {
-+ return word::XHeaderFooter::static_type(0);
-+ }
-+ virtual sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
-+ {
-+ return sal_True;
-+ }
-+};
-+
-+class HeadersFootersEnumWrapper : public EnumerationHelper_BASE
-+{
-+ SwVbaHeadersFooters* pHeadersFooters;
-+ sal_Int32 nIndex;
-+public:
-+ HeadersFootersEnumWrapper( SwVbaHeadersFooters* _pHeadersFooters ) : pHeadersFooters( _pHeadersFooters ), nIndex( 0 ) {}
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( nIndex < pHeadersFooters->getCount() );
-+ }
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( nIndex < pHeadersFooters->getCount() )
-+ return pHeadersFooters->Item( uno::makeAny( ++nIndex ), uno::Any() );
-+ throw container::NoSuchElementException();
-+ }
-+};
-+
-+SwVbaHeadersFooters::SwVbaHeadersFooters( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< beans::XPropertySet >& xPageStyleProps, sal_Bool isHeader ): SwVbaHeadersFooters_BASE( xParent, xContext, new HeadersFootersIndexAccess( xParent, xContext, xModel, xPageStyleProps, isHeader ) ), mxModel( xModel ), mxPageStyleProps( xPageStyleProps ), mbHeader( isHeader )
-+{
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaHeadersFooters::getCount() throw (uno::RuntimeException)
-+{
-+ // wdHeaderFooterFirstPage, wdHeaderFooterPrimary and wdHeaderFooterEvenPages
-+ return 3;
-+}
-+
-+uno::Any SAL_CALL SwVbaHeadersFooters::Item( const uno::Any& Index1, const uno::Any& ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nIndex = 0;
-+ Index1 >>= nIndex;
-+ if( ( nIndex < 1 ) || ( nIndex > 3 ) )
-+ {
-+ throw container::NoSuchElementException();
-+ }
-+ return uno::makeAny( uno::Reference< word::XHeaderFooter >( new SwVbaHeaderFooter( this, mxContext, mxModel, mxPageStyleProps, mbHeader, nIndex ) ) );
-+}
-+
-+// XEnumerationAccess
-+uno::Type
-+SwVbaHeadersFooters::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XHeaderFooter::static_type(0);
-+}
-+uno::Reference< container::XEnumeration >
-+
-+SwVbaHeadersFooters::createEnumeration() throw (uno::RuntimeException)
-+{
-+ return new HeadersFootersEnumWrapper( this );
-+}
-+
-+uno::Any
-+SwVbaHeadersFooters::createCollectionObject( const uno::Any& aSource )
-+{
-+ return aSource;
-+}
-+
-+rtl::OUString&
-+SwVbaHeadersFooters::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaHeadersFooters") );
-+ return sImplName;
-+}
-+
-+uno::Sequence<rtl::OUString>
-+SwVbaHeadersFooters::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.HeadersFooters") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbaheadersfooters.hxx sw/source/ui/vba/vbaheadersfooters.hxx
-new file mode 100644
-index 0000000..9bd7683
---- /dev/null
-+++ sw/source/ui/vba/vbaheadersfooters.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:
-+ * $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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_HEADERSFOOTERS_HXX
-+#define SW_VBA_HEADERSFOOTERS_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XHeadersFooters.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+
-+typedef CollTestImplHelper< ooo::vba::word::XHeadersFooters > SwVbaHeadersFooters_BASE;
-+
-+class SwVbaHeadersFooters : public SwVbaHeadersFooters_BASE
-+{
-+private:
-+ css::uno::Reference< css::frame::XModel > mxModel;
-+ css::uno::Reference< css::beans::XPropertySet > mxPageStyleProps;
-+ sal_Bool mbHeader;
-+
-+public:
-+ SwVbaHeadersFooters( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::beans::XPropertySet >& xProps, sal_Bool isHeader );
-+ virtual ~SwVbaHeadersFooters() {}
-+
-+ virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index1, const css::uno::Any& )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);
-+
-+ // SwVbaHeadersFooters_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* SW_VBA_HEADERSFOOTERS_HXX */
-diff --git sw/source/ui/vba/vbalistformat.cxx sw/source/ui/vba/vbalistformat.cxx
-new file mode 100644
-index 0000000..05d9380
---- /dev/null
-+++ sw/source/ui/vba/vbalistformat.cxx
-@@ -0,0 +1,121 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbalistformat.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include <ooo/vba/word/WdListApplyTo.hpp>
-+#include <ooo/vba/word/WdDefaultListBehavior.hpp>
-+#include <com/sun/star/container/XEnumerationAccess.hpp>
-+#include <com/sun/star/container/XEnumeration.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include "vbalisttemplate.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaListFormat::SwVbaListFormat( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextRange >& xTextRange ) throw ( uno::RuntimeException ) : SwVbaListFormat_BASE( rParent, rContext ), mxTextRange( xTextRange )
-+{
-+}
-+
-+SwVbaListFormat::~SwVbaListFormat()
-+{
-+}
-+
-+void SAL_CALL SwVbaListFormat::ApplyListTemplate( const css::uno::Reference< word::XListTemplate >& ListTemplate, const css::uno::Any& ContinuePreviousList, const css::uno::Any& ApplyTo, const css::uno::Any& DefaultListBehavior ) throw (css::uno::RuntimeException)
-+{
-+ sal_Bool bContinuePreviousList = sal_True;
-+ if( ContinuePreviousList.hasValue() )
-+ ContinuePreviousList >>= bContinuePreviousList;
-+
-+ // "applyto" must be current selection
-+ sal_Int32 bApplyTo = word::WdListApplyTo::wdListApplyToSelection;
-+ if( ApplyTo.hasValue() )
-+ ApplyTo >>= bApplyTo;
-+ if( bApplyTo != word::WdListApplyTo::wdListApplyToSelection )
-+ throw uno::RuntimeException();
-+
-+ // default behaviour must be wdWord8ListBehavior
-+ sal_Int32 nDefaultListBehavior = word::WdDefaultListBehavior::wdWord8ListBehavior;
-+ if( DefaultListBehavior.hasValue() )
-+ DefaultListBehavior >>= nDefaultListBehavior;
-+ if( nDefaultListBehavior != word::WdDefaultListBehavior::wdWord8ListBehavior )
-+ throw uno::RuntimeException();
-+
-+ SwVbaListTemplate* pListTemplate = dynamic_cast< SwVbaListTemplate* >( ListTemplate.get() );
-+
-+ uno::Reference< container::XEnumerationAccess > xEnumAccess( mxTextRange, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XEnumeration > xEnum = xEnumAccess->createEnumeration();
-+ sal_Bool isFirstElement = sal_True;
-+ while( xEnum->hasMoreElements() )
-+ {
-+ uno::Reference< beans::XPropertySet > xProps( xEnum->nextElement(), uno::UNO_QUERY_THROW );
-+ if( isFirstElement )
-+ {
-+ sal_Bool isNumberingRestart = !bContinuePreviousList;
-+ xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaIsNumberingRestart") ), uno::makeAny( isNumberingRestart ) );
-+ if( isNumberingRestart )
-+ {
-+ sal_Int16 nStartValue = 1;
-+ xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingStartValue") ), uno::makeAny( nStartValue ) );
-+ }
-+ isFirstElement = sal_False;
-+ }
-+ else
-+ {
-+ xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaIsNumberingRestart") ), uno::makeAny( sal_False ) );
-+ }
-+ pListTemplate->applyListTemplate( xProps );
-+ }
-+}
-+
-+void SAL_CALL SwVbaListFormat::ConvertNumbersToText( ) throw (css::uno::RuntimeException)
-+{
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+}
-+
-+rtl::OUString&
-+SwVbaListFormat::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaListFormat") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaListFormat::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ListFormat" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbalistformat.hxx sw/source/ui/vba/vbalistformat.hxx
-new file mode 100644
-index 0000000..184312a
---- /dev/null
-+++ sw/source/ui/vba/vbalistformat.hxx
-@@ -0,0 +1,60 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_LISTFORMAT_HXX
-+#define SW_VBA_LISTFORMAT_HXX
-+
-+#include <ooo/vba/word/XListFormat.hpp>
-+#include <ooo/vba/word/XListTemplate.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/text/XTextRange.hpp>
-+#include "vbalisthelper.hxx"
-+
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XListFormat > SwVbaListFormat_BASE;
-+
-+class SwVbaListFormat : public SwVbaListFormat_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XTextRange > mxTextRange;
-+
-+public:
-+ SwVbaListFormat( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextRange >& xTextRange ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaListFormat();
-+
-+ // Methods
-+ virtual void SAL_CALL ApplyListTemplate( const css::uno::Reference< ::ooo::vba::word::XListTemplate >& ListTemplate, const css::uno::Any& ContinuePreviousList, const css::uno::Any& ApplyTo, const css::uno::Any& DefaultListBehavior ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL ConvertNumbersToText( ) throw (css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_LISTFORMAT_HXX */
-diff --git sw/source/ui/vba/vbalistgalleries.cxx sw/source/ui/vba/vbalistgalleries.cxx
-new file mode 100644
-index 0000000..ff09ae2
---- /dev/null
-+++ sw/source/ui/vba/vbalistgalleries.cxx
-@@ -0,0 +1,115 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbalistgalleries.hxx"
-+#include "vbalistgallery.hxx"
-+#include <ooo/vba/word/WdListGalleryType.hpp>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+class ListGalleriesEnumWrapper : public EnumerationHelper_BASE
-+{
-+ SwVbaListGalleries* pListGalleries;
-+ sal_Int32 nIndex;
-+public:
-+ ListGalleriesEnumWrapper( SwVbaListGalleries* pGalleries ) : pListGalleries( pGalleries ), nIndex( 1 ) {}
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( nIndex <= pListGalleries->getCount() );
-+ }
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( nIndex <= pListGalleries->getCount() )
-+ return pListGalleries->Item( uno::makeAny( nIndex++ ), uno::Any() );
-+ throw container::NoSuchElementException();
-+ }
-+};
-+
-+SwVbaListGalleries::SwVbaListGalleries( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextDocument >& xTextDoc ) throw (uno::RuntimeException) : SwVbaListGalleries_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >() ), mxTextDocument( xTextDoc )
-+{
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaListGalleries::getCount() throw (uno::RuntimeException)
-+{
-+ // 3 types of list( bullet, numbered and outline )
-+ return 3;
-+}
-+
-+uno::Any SAL_CALL SwVbaListGalleries::Item( const uno::Any& Index1, const uno::Any& /*not processed in this base class*/ ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nIndex = 0;
-+ if( ( Index1 >>= nIndex ) == sal_True )
-+ {
-+ if( nIndex == word::WdListGalleryType::wdBulletGallery
-+ || nIndex == word::WdListGalleryType::wdNumberGallery
-+ || nIndex == word::WdListGalleryType::wdOutlineNumberGallery )
-+ return uno::makeAny( uno::Reference< word::XListGallery >( new SwVbaListGallery( this, mxContext, mxTextDocument, nIndex ) ) );
-+ }
-+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Index out of bounds") ), uno::Reference< uno::XInterface >() );
-+}
-+
-+// XEnumerationAccess
-+uno::Type
-+SwVbaListGalleries::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XListGallery::static_type(0);
-+}
-+
-+uno::Reference< container::XEnumeration >
-+SwVbaListGalleries::createEnumeration() throw (uno::RuntimeException)
-+{
-+ return new ListGalleriesEnumWrapper( this );
-+}
-+
-+uno::Any
-+SwVbaListGalleries::createCollectionObject( const css::uno::Any& aSource )
-+{
-+ return aSource;
-+}
-+
-+rtl::OUString&
-+SwVbaListGalleries::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaListGalleries") );
-+ return sImplName;
-+}
-+
-+css::uno::Sequence<rtl::OUString>
-+SwVbaListGalleries::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ListGalleries") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbalistgalleries.hxx sw/source/ui/vba/vbalistgalleries.hxx
-new file mode 100644
-index 0000000..36cd0ba
---- /dev/null
-+++ sw/source/ui/vba/vbalistgalleries.hxx
-@@ -0,0 +1,61 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_LISTGALLERIES_HXX
-+#define SW_VBA_LISTGALLERIES_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XListGalleries.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+
-+typedef CollTestImplHelper< ooo::vba::word::XListGalleries > SwVbaListGalleries_BASE;
-+
-+class SwVbaListGalleries : public SwVbaListGalleries_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XTextDocument > mxTextDocument;
-+
-+public:
-+ SwVbaListGalleries( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::text::XTextDocument >& xTextDoc ) throw (css::uno::RuntimeException);
-+ virtual ~SwVbaListGalleries() {}
-+
-+ virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException);
-+ 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 );
-+ // 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);
-+
-+ // SwVbaListGalleries_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* SW_VBA_LISTGALLERIES_HXX */
-diff --git sw/source/ui/vba/vbalistgallery.cxx sw/source/ui/vba/vbalistgallery.cxx
-new file mode 100644
-index 0000000..6ac7e7c
---- /dev/null
-+++ sw/source/ui/vba/vbalistgallery.cxx
-@@ -0,0 +1,73 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbalistgallery.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include "vbalisttemplates.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaListGallery::SwVbaListGallery( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& xTextDoc, sal_Int32 nType ) throw ( uno::RuntimeException ) : SwVbaListGallery_BASE( rParent, rContext ), mxTextDocument( xTextDoc ), mnType( nType )
-+{
-+}
-+
-+SwVbaListGallery::~SwVbaListGallery()
-+{
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaListGallery::ListTemplates( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< XCollection > xCol( new SwVbaListTemplates( mxParent, mxContext, mxTextDocument, mnType ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+rtl::OUString&
-+SwVbaListGallery::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaListGallery") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaListGallery::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ListGallery" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbalistgallery.hxx sw/source/ui/vba/vbalistgallery.hxx
-new file mode 100644
-index 0000000..0ece178
---- /dev/null
-+++ sw/source/ui/vba/vbalistgallery.hxx
-@@ -0,0 +1,58 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_LISTGALLERY_HXX
-+#define SW_VBA_LISTGALLERY_HXX
-+
-+#include <ooo/vba/word/XListGallery.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XListGallery > SwVbaListGallery_BASE;
-+
-+class SwVbaListGallery : public SwVbaListGallery_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XTextDocument > mxTextDocument;
-+ sal_Int32 mnType;
-+
-+public:
-+ SwVbaListGallery( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& xTextDoc, sal_Int32 nType ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaListGallery();
-+
-+ // Methods
-+ virtual css::uno::Any SAL_CALL ListTemplates( const css::uno::Any& index ) throw ( css::uno::RuntimeException );
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_LISTGALLERY_HXX */
-diff --git sw/source/ui/vba/vbalisthelper.cxx sw/source/ui/vba/vbalisthelper.cxx
-new file mode 100644
-index 0000000..34cd6be
---- /dev/null
-+++ sw/source/ui/vba/vbalisthelper.cxx
-@@ -0,0 +1,707 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbalisthelper.hxx"
-+#include <tools/diagnose_ex.h>
-+#include <ooo/vba/word/WdListGalleryType.hpp>
-+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
-+#include <com/sun/star/style/NumberingType.hpp>
-+#include <com/sun/star/container/XIndexReplace.hpp>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+static const sal_Int32 LIST_LEVEL_COUNT = 9;
-+
-+static const char WORD_BULLET_GALLERY[] = "WdBullet";
-+static const char WORD_NUMBER_GALLERY[] = "WdNumber";
-+static const char WORD_OUTLINE_NUMBER_GALLERY[] = "WdOutlineNumber";
-+
-+static const char UNO_NAME_ADJUST[] = "Adjust";
-+static const char UNO_NAME_PARENT_NUMBERING[] = "ParentNumbering";
-+static const char UNO_NAME_PREFIX[] = "Prefix";
-+static const char UNO_NAME_SUFFIX[] = "Suffix";
-+static const char UNO_NAME_CHAR_STYLE_NAME[] = "CharStyleName";
-+static const char UNO_NAME_START_WITH[] = "StartWith";
-+static const char UNO_NAME_POSITION_AND_SPACE_MODE[] = "PositionAndSpaceMode";
-+static const char UNO_NAME_LABEL_FOLLOWED_BY[] = "LabelFollowedBy";
-+static const char UNO_NAME_LIST_TAB_STOP_POSITION[] = "ListtabStopPosition";
-+static const char UNO_NAME_FIRST_LINE_INDENT[] = "FirstLineIndent";
-+static const char UNO_NAME_INDENT_AT[] = "IndentAt";
-+static const char UNO_NAME_NUMBERING_TYPE[] = "NumberingType";
-+static const char UNO_NAME_BULLET_ID[] = "BulletId";
-+static const char UNO_NAME_BULLET_CHAR[] = "BulletChar";
-+static const char UNO_NAME_BULLET_FONT_NAME[] = "BulletFontName";
-+static const char UNO_NAME_BULLET_FONT[] = "BulletFont";
-+
-+static const sal_Int16 CHAR_CLOSED_DOT = 8226;
-+static const sal_Int16 CHAR_EMPTY_DOT = 111;
-+static const sal_Int16 CHAR_SQUARE = 9632;
-+static const sal_Int16 CHAR_STAR_SYMBOL = 10026;
-+static const sal_Int16 CHAR_FOUR_DIAMONDS = 10070;
-+static const sal_Int16 CHAR_DIAMOND = 10022;
-+static const sal_Int16 CHAR_ARROW = 10146;
-+static const sal_Int16 CHAR_CHECK_MARK = 10003;
-+
-+SwVbaListHelper::SwVbaListHelper( const css::uno::Reference< css::text::XTextDocument >& xTextDoc, sal_Int32 nGalleryType, sal_Int32 nTemplateType ) throw( css::uno::RuntimeException ) : mxTextDocument( xTextDoc ), mnGalleryType( nGalleryType ), mnTemplateType( nTemplateType )
-+{
-+ Init();
-+}
-+
-+void SwVbaListHelper::Init() throw( css::uno::RuntimeException )
-+{
-+ // set the numbering style name
-+ switch( mnGalleryType )
-+ {
-+ case word::WdListGalleryType::wdBulletGallery:
-+ {
-+ msStyleName = rtl::OUString::createFromAscii( WORD_BULLET_GALLERY );
-+ break;
-+ }
-+ case word::WdListGalleryType::wdNumberGallery:
-+ {
-+ msStyleName = rtl::OUString::createFromAscii( WORD_NUMBER_GALLERY );
-+ break;
-+ }
-+ case word::WdListGalleryType::wdOutlineNumberGallery:
-+ {
-+ msStyleName = rtl::OUString::createFromAscii( WORD_OUTLINE_NUMBER_GALLERY );
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException();
-+ }
-+ }
-+ msStyleName += rtl::OUString::valueOf( mnTemplateType );
-+
-+ // get the numbering style
-+ uno::Reference< style::XStyleFamiliesSupplier > xStyleSupplier( mxTextDocument, uno::UNO_QUERY_THROW );
-+ mxStyleFamily.set( xStyleSupplier->getStyleFamilies()->getByName(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingStyles") ) ), uno::UNO_QUERY_THROW );
-+ OSL_TRACE("SwVbaListHelper::Init: numbering style name: %s", rtl::OUStringToOString( msStyleName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ if( mxStyleFamily->hasByName( msStyleName ) )
-+ {
-+ mxStyleProps.set( mxStyleFamily->getByName( msStyleName ), uno::UNO_QUERY_THROW );
-+ mxNumberingRules.set( mxStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingRules") ) ), uno::UNO_QUERY_THROW );
-+ }
-+ else
-+ {
-+ // create new numbering style
-+ uno::Reference< lang::XMultiServiceFactory > xDocMSF( mxTextDocument, uno::UNO_QUERY_THROW );
-+ mxStyleProps.set( xDocMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.NumberingStyle") ) ), uno::UNO_QUERY_THROW );
-+ // insert this style into style family, or the property NumberingRules doesn't exist.
-+ mxStyleFamily->insertByName( msStyleName, uno::makeAny( mxStyleProps ) );
-+ mxStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingRules") ) ) >>= mxNumberingRules;
-+ //mxNumberingRules.set( xDocMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.NumberingRules") ) ), uno::UNO_QUERY_THROW );
-+
-+ CreateListTemplate();
-+
-+ mxStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingRules") ) , uno::makeAny( mxNumberingRules ) );
-+ }
-+}
-+
-+void SwVbaListHelper::CreateListTemplate() throw( css::uno::RuntimeException )
-+{
-+ switch( mnGalleryType )
-+ {
-+ case word::WdListGalleryType::wdBulletGallery:
-+ {
-+ CreateBulletListTemplate();
-+ break;
-+ }
-+ case word::WdListGalleryType::wdNumberGallery:
-+ {
-+ CreateNumberListTemplate();
-+ break;
-+ }
-+ case word::WdListGalleryType::wdOutlineNumberGallery:
-+ {
-+ CreateOutlineNumberListTemplate();
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException();
-+ }
-+ }
-+}
-+
-+void SwVbaListHelper::CreateBulletListTemplate() throw( css::uno::RuntimeException )
-+{
-+ // there is only 1 level for each bullet list in MSWord
-+ sal_Int32 nLevel = 0;
-+ uno::Sequence< beans::PropertyValue > aPropertyValues;
-+ mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
-+ rtl::OUString sCharStyleName( RTL_CONSTASCII_USTRINGPARAM("Bullet Symbols") );
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_CHAR_STYLE_NAME ), uno::makeAny( sCharStyleName ) );
-+ sal_Int16 nNumberingType = style::NumberingType::CHAR_SPECIAL;
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
-+
-+ rtl::OUString aBulletChar;
-+ switch( mnTemplateType )
-+ {
-+ case 1:
-+ {
-+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_CLOSED_DOT ) );
-+ break;
-+ }
-+ case 2:
-+ {
-+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_EMPTY_DOT ) );
-+ break;
-+ }
-+ case 3:
-+ {
-+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_SQUARE ) );
-+ break;
-+ }
-+ case 4:
-+ {
-+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_STAR_SYMBOL ) );
-+ break;
-+ }
-+ case 5:
-+ {
-+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_FOUR_DIAMONDS ) );
-+ break;
-+ }
-+ case 6:
-+ {
-+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_ARROW ) );
-+ break;
-+ }
-+ case 7:
-+ {
-+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_CHECK_MARK ) );
-+ break;
-+ }
-+ default:
-+ {
-+ // we only support 7 types template now
-+ throw css::uno::RuntimeException();
-+ }
-+ }
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_BULLET_CHAR ), uno::makeAny( aBulletChar ) );
-+
-+ mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
-+}
-+
-+void SwVbaListHelper::CreateNumberListTemplate() throw( css::uno::RuntimeException )
-+{
-+ // there is only 1 level for each bullet list in MSWord
-+ sal_Int32 nLevel = 0;
-+ uno::Sequence< beans::PropertyValue > aPropertyValues;
-+ mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
-+
-+ sal_Int16 nNumberingType = 0;
-+ rtl::OUString sSuffix;
-+ switch( mnTemplateType )
-+ {
-+ case 1:
-+ {
-+ nNumberingType = style::NumberingType::ARABIC;
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ case 2:
-+ {
-+ nNumberingType = style::NumberingType::ARABIC;
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 3:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_UPPER;
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ case 4:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_UPPER_LETTER;
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ case 5:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 6:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ case 7:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_LOWER;
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ default:
-+ {
-+ // we only support 7 types template now
-+ throw css::uno::RuntimeException();
-+ }
-+ }
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_SUFFIX ), uno::makeAny( sSuffix ) );
-+
-+ mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
-+}
-+
-+void SwVbaListHelper::CreateOutlineNumberListTemplate() throw( css::uno::RuntimeException )
-+{
-+ switch( mnTemplateType )
-+ {
-+ case 1:
-+ {
-+ CreateOutlineNumberForType1();
-+ break;
-+ }
-+ case 2:
-+ {
-+ CreateOutlineNumberForType2();
-+ break;
-+ }
-+ case 3:
-+ {
-+ CreateOutlineNumberForType3();
-+ break;
-+ }
-+ case 4:
-+ {
-+ CreateOutlineNumberForType4();
-+ break;
-+ }
-+ case 5:
-+ {
-+ CreateOutlineNumberForType5();
-+ break;
-+ }
-+ case 6:
-+ {
-+ CreateOutlineNumberForType6();
-+ break;
-+ }
-+ case 7:
-+ {
-+ CreateOutlineNumberForType7();
-+ break;
-+ }
-+ default:
-+ {
-+ // we only support 7 types template now
-+ throw css::uno::RuntimeException();
-+ }
-+ }
-+}
-+
-+void SwVbaListHelper::CreateOutlineNumberForType1() throw( css::uno::RuntimeException )
-+{
-+ sal_Int16 nNumberingType = 0;
-+ rtl::OUString sPrefix;
-+ rtl::OUString sSuffix;
-+ uno::Sequence< beans::PropertyValue > aPropertyValues;
-+
-+ for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
-+ {
-+ mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
-+ switch( nLevel )
-+ {
-+ case 0:
-+ case 1:
-+ {
-+ nNumberingType = style::NumberingType::ARABIC;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 2:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_LOWER;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 3:
-+ {
-+ nNumberingType = style::NumberingType::ARABIC;
-+ sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 4:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
-+ sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 5:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_LOWER;
-+ sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 6:
-+ {
-+ nNumberingType = style::NumberingType::ARABIC;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ case 7:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ case 8:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_LOWER;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException();
-+ }
-+ }
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_PREFIX ), uno::makeAny( sPrefix ) );
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_SUFFIX ), uno::makeAny( sSuffix ) );
-+ mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
-+ }
-+}
-+
-+void SwVbaListHelper::CreateOutlineNumberForType2() throw( css::uno::RuntimeException )
-+{
-+ sal_Int16 nNumberingType = style::NumberingType::ARABIC;
-+ sal_Int16 nParentNumbering = 0;
-+ rtl::OUString sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ uno::Sequence< beans::PropertyValue > aPropertyValues;
-+
-+ for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
-+ {
-+ mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_SUFFIX ), uno::makeAny( sSuffix ) );
-+ if( nLevel != 0 )
-+ {
-+ nParentNumbering = sal_Int16( nLevel - 1 );
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_PARENT_NUMBERING ), uno::makeAny( nParentNumbering ) );
-+ }
-+ mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
-+ }
-+}
-+
-+void SwVbaListHelper::CreateOutlineNumberForType3() throw( css::uno::RuntimeException )
-+{
-+ sal_Int16 nNumberingType = style::NumberingType::CHAR_SPECIAL;
-+ rtl::OUString sCharStyleName( RTL_CONSTASCII_USTRINGPARAM("Bullet Symbols") );
-+ rtl::OUString aBulletChar;
-+ uno::Sequence< beans::PropertyValue > aPropertyValues;
-+
-+ for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
-+ {
-+ mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_CHAR_STYLE_NAME ), uno::makeAny( sCharStyleName ) );
-+ switch( nLevel )
-+ {
-+ case 0:
-+ {
-+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_FOUR_DIAMONDS ) );
-+ break;
-+ }
-+ case 1:
-+ case 5:
-+ {
-+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_ARROW ) );
-+ break;
-+ }
-+ case 2:
-+ case 6:
-+ {
-+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_SQUARE ) );
-+ break;
-+ }
-+ case 3:
-+ case 7:
-+ {
-+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_CLOSED_DOT ) );
-+ break;
-+ }
-+ case 4:
-+ case 8:
-+ {
-+ aBulletChar = rtl::OUString( sal_Unicode( CHAR_DIAMOND ) );
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException();
-+ }
-+ }
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_BULLET_CHAR ), uno::makeAny( aBulletChar ) );
-+ mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
-+ }
-+}
-+
-+void SwVbaListHelper::CreateOutlineNumberForType4() throw( css::uno::RuntimeException )
-+{
-+ sal_Int16 nNumberingType = 0;
-+ rtl::OUString sPrefix;
-+ rtl::OUString sSuffix;
-+ uno::Sequence< beans::PropertyValue > aPropertyValues;
-+
-+ for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
-+ {
-+ mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
-+ switch( nLevel )
-+ {
-+ case 0:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_UPPER;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ case 1:
-+ {
-+ nNumberingType = style::NumberingType::ARABIC;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ sal_Int16 nParentNumbering = 0;
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_PARENT_NUMBERING ), uno::makeAny( nParentNumbering ) );
-+ break;
-+ }
-+ case 2:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
-+ sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 3:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_LOWER;
-+ sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 4:
-+ {
-+ nNumberingType = style::NumberingType::ARABIC;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 5:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 6:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_LOWER;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 7:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ case 8:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_LOWER;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException();
-+ }
-+ }
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_PREFIX ), uno::makeAny( sPrefix ) );
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_SUFFIX ), uno::makeAny( sSuffix ) );
-+ mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
-+ }
-+}
-+
-+void SwVbaListHelper::CreateOutlineNumberForType5() throw( css::uno::RuntimeException )
-+{
-+ sal_Int16 nNumberingType = style::NumberingType::ARABIC;
-+ sal_Int16 nParentNumbering = 0;
-+ uno::Sequence< beans::PropertyValue > aPropertyValues;
-+
-+ for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
-+ {
-+ mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
-+ if( nLevel != 0 )
-+ {
-+ nParentNumbering = sal_Int16( nLevel - 1 );
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_PARENT_NUMBERING ), uno::makeAny( nParentNumbering ) );
-+ }
-+ mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
-+ }
-+}
-+
-+void SwVbaListHelper::CreateOutlineNumberForType6() throw( css::uno::RuntimeException )
-+{
-+ sal_Int16 nNumberingType = 0;
-+ rtl::OUString sPrefix;
-+ rtl::OUString sSuffix;
-+ uno::Sequence< beans::PropertyValue > aPropertyValues;
-+
-+ for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
-+ {
-+ mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
-+ switch( nLevel )
-+ {
-+ case 0:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_UPPER;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ case 1:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_UPPER_LETTER;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ case 2:
-+ {
-+ nNumberingType = style::NumberingType::ARABIC;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 3:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
-+ sPrefix = rtl::OUString();
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 4:
-+ {
-+ nNumberingType = style::NumberingType::ARABIC;
-+ sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 5:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
-+ sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 6:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_LOWER;
-+ sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
-+ break;
-+ }
-+ case 7:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
-+ sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ case 8:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_LOWER;
-+ sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
-+ sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException();
-+ }
-+ }
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_PREFIX ), uno::makeAny( sPrefix ) );
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_SUFFIX ), uno::makeAny( sSuffix ) );
-+ mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
-+ }
-+}
-+
-+void SwVbaListHelper::CreateOutlineNumberForType7() throw( css::uno::RuntimeException )
-+{
-+ sal_Int16 nNumberingType = style::NumberingType::ARABIC;
-+ uno::Sequence< beans::PropertyValue > aPropertyValues;
-+ rtl::OUString sPrefix = rtl::OUString::createFromAscii("Chapter ");
-+
-+ for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
-+ {
-+ mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
-+ setOrAppendPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( UNO_NAME_PREFIX ), uno::makeAny( sPrefix ) );
-+ mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
-+ }
-+}
-+
-+uno::Any SwVbaListHelper::getPropertyValueWithNameAndLevel( sal_Int32 nLevel, const rtl::OUString& sName ) throw( css::uno::RuntimeException )
-+{
-+ uno::Sequence< beans::PropertyValue > aPropertyValues;
-+ mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
-+ return getPropertyValue( aPropertyValues, sName );
-+}
-+
-+void SwVbaListHelper::setPropertyValueWithNameAndLevel( sal_Int32 nLevel, const rtl::OUString& sName, const css::uno::Any& aValue ) throw( css::uno::RuntimeException )
-+{
-+ uno::Sequence< beans::PropertyValue > aPropertyValues;
-+ mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
-+ setOrAppendPropertyValue( aPropertyValues, sName, aValue );
-+ mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
-+ mxStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingRules") ) , uno::makeAny( mxNumberingRules ) );
-+}
-+
-diff --git sw/source/ui/vba/vbalisthelper.hxx sw/source/ui/vba/vbalisthelper.hxx
-new file mode 100644
-index 0000000..0f5fa26
---- /dev/null
-+++ sw/source/ui/vba/vbalisthelper.hxx
-@@ -0,0 +1,82 @@
-+/*************************************************************************
-+ *
-+ * 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 SW_VBA_LISTHELPER_HXX
-+#define SW_VBA_LISTHELPER_HXX
-+
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/container/XIndexReplace.hpp>
-+#include <com/sun/star/container/XNameContainer.hpp>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include <boost/shared_ptr.hpp>
-+
-+
-+class SwVbaListHelper;
-+typedef ::boost::shared_ptr< SwVbaListHelper > SwVbaListHelperRef;
-+
-+class SwVbaListHelper
-+{
-+private:
-+ css::uno::Reference< css::text::XTextDocument > mxTextDocument;
-+ css::uno::Reference< css::container::XIndexReplace > mxNumberingRules;
-+ css::uno::Reference< css::container::XNameContainer > mxStyleFamily;
-+ css::uno::Reference< css::beans::XPropertySet > mxStyleProps;
-+ sal_Int32 mnGalleryType;
-+ sal_Int32 mnTemplateType;
-+ rtl::OUString msStyleName;
-+
-+ void Init() throw( css::uno::RuntimeException );
-+ void CreateListTemplate() throw( css::uno::RuntimeException );
-+ void CreateBulletListTemplate() throw( css::uno::RuntimeException );
-+ void CreateNumberListTemplate() throw( css::uno::RuntimeException );
-+ void CreateOutlineNumberListTemplate() throw( css::uno::RuntimeException );
-+ void CreateOutlineNumberForType1() throw( css::uno::RuntimeException );
-+ void CreateOutlineNumberForType2() throw( css::uno::RuntimeException );
-+ void CreateOutlineNumberForType3() throw( css::uno::RuntimeException );
-+ void CreateOutlineNumberForType4() throw( css::uno::RuntimeException );
-+ void CreateOutlineNumberForType5() throw( css::uno::RuntimeException );
-+ void CreateOutlineNumberForType6() throw( css::uno::RuntimeException );
-+ void CreateOutlineNumberForType7() throw( css::uno::RuntimeException );
-+
-+public:
-+ SwVbaListHelper( const css::uno::Reference< css::text::XTextDocument >& xTextDoc, sal_Int32 nGalleryType, sal_Int32 nTemplateType ) throw( css::uno::RuntimeException );
-+
-+ sal_Int32 getGalleryType() { return mnGalleryType; }
-+ css::uno::Reference< css::container::XIndexReplace > getNumberingRules() { return mxNumberingRules; }
-+ css::uno::Any getPropertyValueWithNameAndLevel( sal_Int32 nLevel, const rtl::OUString& sName ) throw( css::uno::RuntimeException );
-+ void setPropertyValueWithNameAndLevel( sal_Int32 nLevel, const rtl::OUString& sName, const css::uno::Any& aValue ) throw( css::uno::RuntimeException );
-+
-+};
-+
-+#endif//SW_VBA_LISTHELPER_HXX
-diff --git sw/source/ui/vba/vbalistlevel.cxx sw/source/ui/vba/vbalistlevel.cxx
-new file mode 100644
-index 0000000..4dc0951
---- /dev/null
-+++ sw/source/ui/vba/vbalistlevel.cxx
-@@ -0,0 +1,401 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbalistlevel.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include <com/sun/star/style/NumberingType.hpp>
-+#include <ooo/vba/word/WdListNumberStyle.hpp>
-+#include <ooo/vba/word/WdTrailingCharacter.hpp>
-+#include <com/sun/star/text/HoriOrientation.hpp>
-+#include <ooo/vba/word/WdListLevelAlignment.hpp>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaListLevel::SwVbaListLevel( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, SwVbaListHelperRef pHelper, sal_Int32 nLevel ) throw ( uno::RuntimeException ) : SwVbaListLevel_BASE( rParent, rContext ), pListHelper( pHelper ), mnLevel( nLevel )
-+{
-+}
-+
-+SwVbaListLevel::~SwVbaListLevel()
-+{
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaListLevel::getAlignment() throw (uno::RuntimeException)
-+{
-+ sal_Int16 nAlignment = 0;
-+ pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Adjust") ) ) >>= nAlignment;
-+ switch( nAlignment )
-+ {
-+ case text::HoriOrientation::LEFT:
-+ {
-+ nAlignment = word::WdListLevelAlignment::wdListLevelAlignLeft;
-+ break;
-+ }
-+ case text::HoriOrientation::RIGHT:
-+ {
-+ nAlignment = word::WdListLevelAlignment::wdListLevelAlignRight;
-+ break;
-+ }
-+ case text::HoriOrientation::CENTER:
-+ {
-+ nAlignment = word::WdListLevelAlignment::wdListLevelAlignCenter;
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException();
-+ }
-+ }
-+ return nAlignment;
-+}
-+
-+void SAL_CALL SwVbaListLevel::setAlignment( ::sal_Int32 _alignment ) throw (uno::RuntimeException)
-+{
-+ sal_Int16 nAlignment = text::HoriOrientation::LEFT;
-+ switch( _alignment )
-+ {
-+ case word::WdListLevelAlignment::wdListLevelAlignLeft:
-+ {
-+ nAlignment = text::HoriOrientation::LEFT;
-+ break;
-+ }
-+ case word::WdListLevelAlignment::wdListLevelAlignRight:
-+ {
-+ nAlignment = text::HoriOrientation::RIGHT;
-+ break;
-+ }
-+ case word::WdListLevelAlignment::wdListLevelAlignCenter:
-+ {
-+ nAlignment = text::HoriOrientation::CENTER;
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException();
-+ }
-+ }
-+ pListHelper->setPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Adjust") ), uno::makeAny( nAlignment ) );
-+}
-+
-+uno::Reference< ::ooo::vba::word::XFont > SAL_CALL SwVbaListLevel::getFont() throw (uno::RuntimeException)
-+{
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ return uno::Reference< word::XFont >();
-+}
-+
-+void SAL_CALL SwVbaListLevel::setFont( const uno::Reference< ::ooo::vba::word::XFont >& /*_font*/ ) throw (uno::RuntimeException)
-+{
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaListLevel::getIndex() throw (uno::RuntimeException)
-+{
-+ return mnLevel + 1;
-+}
-+
-+::rtl::OUString SAL_CALL SwVbaListLevel::getLinkedStyle() throw (uno::RuntimeException)
-+{
-+ // TODO:
-+ return rtl::OUString();
-+}
-+
-+void SAL_CALL SwVbaListLevel::setLinkedStyle( const ::rtl::OUString& _linkedstyle ) throw (uno::RuntimeException)
-+{
-+ // TODO:
-+}
-+
-+::rtl::OUString SAL_CALL SwVbaListLevel::getNumberFormat() throw (uno::RuntimeException)
-+{
-+ // TODO::
-+ return rtl::OUString();
-+}
-+
-+void SAL_CALL SwVbaListLevel::setNumberFormat( const ::rtl::OUString& _numberformat ) throw (uno::RuntimeException)
-+{
-+ // TODO::
-+}
-+
-+float SAL_CALL SwVbaListLevel::getNumberPosition() throw (uno::RuntimeException)
-+{
-+ // indentAt + firstlineindent
-+ sal_Int32 nIndentAt = 0;
-+ sal_Int32 nFirstLineIndent = 0;
-+ pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IndentAt") ) ) >>= nIndentAt;
-+ pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FirstLineIndent") ) ) >>= nFirstLineIndent;
-+
-+ sal_Int32 nResult = nIndentAt + nFirstLineIndent;
-+
-+ return static_cast< float >( Millimeter::getInPoints( nResult ) );
-+}
-+
-+void SAL_CALL SwVbaListLevel::setNumberPosition( float _numberposition ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nNumberPosition = Millimeter::getInHundredthsOfOneMillimeter( _numberposition );
-+
-+ sal_Int32 nIndentAt = 0;
-+ pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IndentAt") ) ) >>= nIndentAt;
-+
-+ sal_Int32 nFirstLineIndent = nNumberPosition - nIndentAt;
-+ pListHelper->setPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FirstLineIndent") ), uno::makeAny( nFirstLineIndent ) );
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaListLevel::getNumberStyle() throw (uno::RuntimeException)
-+{
-+ sal_Int16 nNumberingType = 0;
-+ pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingType") ) ) >>= nNumberingType;
-+ switch( nNumberingType )
-+ {
-+ case style::NumberingType::CHAR_SPECIAL:
-+ {
-+ nNumberingType = word::WdListNumberStyle::wdListNumberStyleBullet;
-+ break;
-+ }
-+ case style::NumberingType::CHARS_UPPER_LETTER:
-+ {
-+ nNumberingType = word::WdListNumberStyle::wdListNumberStyleUppercaseLetter;
-+ break;
-+ }
-+ case style::NumberingType::CHARS_LOWER_LETTER:
-+ {
-+ nNumberingType = word::WdListNumberStyle::wdListNumberStyleLowercaseLetter;
-+ break;
-+ }
-+ case style::NumberingType::ROMAN_UPPER:
-+ {
-+ nNumberingType = word::WdListNumberStyle::wdListNumberStyleUppercaseRoman;
-+ break;
-+ }
-+ case style::NumberingType::ROMAN_LOWER:
-+ {
-+ nNumberingType = word::WdListNumberStyle::wdListNumberStyleLowercaseRoman;
-+ break;
-+ }
-+ case style::NumberingType::ARABIC:
-+ {
-+ nNumberingType = word::WdListNumberStyle::wdListNumberStyleArabic;
-+ break;
-+ }
-+ case style::NumberingType::NUMBER_NONE:
-+ {
-+ nNumberingType = word::WdListNumberStyle::wdListNumberStyleNone;
-+ break;
-+ }
-+ case style::NumberingType::FULLWIDTH_ARABIC:
-+ {
-+ nNumberingType = word::WdListNumberStyle::wdListNumberStyleArabicFullWidth;
-+ break;
-+ }
-+ case style::NumberingType::CIRCLE_NUMBER:
-+ {
-+ nNumberingType = word::WdListNumberStyle::wdListNumberStyleNumberInCircle;
-+ break;
-+ }
-+ case style::NumberingType::CHARS_ARABIC:
-+ {
-+ nNumberingType = word::WdListNumberStyle::wdListNumberStyleCardinalText;
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+ }
-+ return nNumberingType;
-+}
-+
-+void SAL_CALL SwVbaListLevel::setNumberStyle( ::sal_Int32 _numberstyle ) throw (uno::RuntimeException)
-+{
-+ sal_Int16 nNumberingType = 0;
-+ switch( _numberstyle )
-+ {
-+ case word::WdListNumberStyle::wdListNumberStyleBullet:
-+ {
-+ nNumberingType = style::NumberingType::CHAR_SPECIAL;
-+ break;
-+ }
-+ case word::WdListNumberStyle::wdListNumberStyleUppercaseLetter:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_UPPER_LETTER_N;
-+ break;
-+ }
-+ case word::WdListNumberStyle::wdListNumberStyleLowercaseLetter:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_LOWER_LETTER_N;
-+ break;
-+ }
-+ case word::WdListNumberStyle::wdListNumberStyleUppercaseRoman:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_UPPER;
-+ break;
-+ }
-+ case word::WdListNumberStyle::wdListNumberStyleLowercaseRoman:
-+ {
-+ nNumberingType = style::NumberingType::ROMAN_LOWER;
-+ break;
-+ }
-+ case word::WdListNumberStyle::wdListNumberStyleArabic:
-+ {
-+ nNumberingType = style::NumberingType::ARABIC;
-+ break;
-+ }
-+ case word::WdListNumberStyle::wdListNumberStyleNone:
-+ {
-+ nNumberingType = style::NumberingType::NUMBER_NONE;
-+ break;
-+ }
-+ case word::WdListNumberStyle::wdListNumberStyleArabicFullWidth:
-+ {
-+ nNumberingType = style::NumberingType::FULLWIDTH_ARABIC;
-+ break;
-+ }
-+ case word::WdListNumberStyle::wdListNumberStyleNumberInCircle:
-+ {
-+ nNumberingType = style::NumberingType::CIRCLE_NUMBER;
-+ break;
-+ }
-+ case word::WdListNumberStyle::wdListNumberStyleCardinalText:
-+ {
-+ nNumberingType = style::NumberingType::CHARS_ARABIC;
-+ break;
-+ }
-+ case word::WdListNumberStyle::wdListNumberStyleOrdinal:
-+ case word::WdListNumberStyle::wdListNumberStyleOrdinalText:
-+ case word::WdListNumberStyle::wdListNumberStyleKanji:
-+ case word::WdListNumberStyle::wdListNumberStyleKanjiDigit:
-+ case word::WdListNumberStyle::wdListNumberStyleAiueoHalfWidth:
-+ case word::WdListNumberStyle::wdListNumberStyleIrohaHalfWidth:
-+ {
-+ nNumberingType = style::NumberingType::ARABIC;
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+ }
-+
-+ pListHelper->setPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingType") ), uno::makeAny( nNumberingType ) );
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaListLevel::getResetOnHigher() throw (uno::RuntimeException)
-+{
-+ //seems not support?
-+ return 0;
-+}
-+
-+void SAL_CALL SwVbaListLevel::setResetOnHigher( ::sal_Int32 _resetonhigher ) throw (uno::RuntimeException)
-+{
-+ //seems not support?
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaListLevel::getStartAt() throw (uno::RuntimeException)
-+{
-+ sal_Int16 nStartWith = 0;
-+ pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StartWith") ) ) >>= nStartWith;
-+ return nStartWith;
-+}
-+
-+void SAL_CALL SwVbaListLevel::setStartAt( ::sal_Int32 _startat ) throw (uno::RuntimeException)
-+{
-+ sal_Int16 nStartWith = (sal_Int16)_startat;
-+ pListHelper->setPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StartWith") ), uno::makeAny( nStartWith ) );
-+}
-+
-+float SAL_CALL SwVbaListLevel::getTabPosition() throw (uno::RuntimeException)
-+{
-+ sal_Int32 nTabPosition = 0;
-+ pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ListtabStopPosition") ) ) >>= nTabPosition;
-+
-+ return static_cast< float >( Millimeter::getInPoints( nTabPosition ) );
-+}
-+
-+void SAL_CALL SwVbaListLevel::setTabPosition( float _tabposition ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nTabPosition = Millimeter::getInHundredthsOfOneMillimeter( _tabposition );
-+ pListHelper->setPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ListtabStopPosition") ), uno::makeAny( nTabPosition ) );
-+}
-+
-+float SAL_CALL SwVbaListLevel::getTextPosition() throw (uno::RuntimeException)
-+{
-+ // indentAt
-+ sal_Int32 nIndentAt = 0;
-+ pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IndentAt") ) ) >>= nIndentAt;
-+
-+ return static_cast< float >( Millimeter::getInPoints( nIndentAt ) );
-+}
-+
-+void SAL_CALL SwVbaListLevel::setTextPosition( float _textposition ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nIndentAt = 0;
-+ sal_Int32 nFirstLineIndent = 0;
-+ pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IndentAt") ) ) >>= nIndentAt;
-+ pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FirstLineIndent") ) ) >>= nFirstLineIndent;
-+
-+ sal_Int32 nAlignedAt = nIndentAt + nFirstLineIndent;
-+
-+ nIndentAt = Millimeter::getInHundredthsOfOneMillimeter( _textposition );
-+ nFirstLineIndent = nAlignedAt - nIndentAt;
-+ pListHelper->setPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IndentAt") ), uno::makeAny( nIndentAt ) );
-+ pListHelper->setPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FirstLineIndent") ), uno::makeAny( nFirstLineIndent ) );
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaListLevel::getTrailingCharacter() throw (uno::RuntimeException)
-+{
-+ sal_Int16 nLabelFollowedBy= 0;
-+ pListHelper->getPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LabelFollowedBy") ) ) >>= nLabelFollowedBy;
-+
-+ return nLabelFollowedBy;
-+}
-+
-+void SAL_CALL SwVbaListLevel::setTrailingCharacter( ::sal_Int32 _trailingcharacter ) throw (uno::RuntimeException)
-+{
-+ sal_Int16 nLabelFollowedBy = (sal_Int16)_trailingcharacter;
-+ pListHelper->setPropertyValueWithNameAndLevel( mnLevel, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LabelFollowedBy") ), uno::makeAny( nLabelFollowedBy ) );
-+}
-+
-+rtl::OUString&
-+SwVbaListLevel::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaListLevel") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaListLevel::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ListLevel" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbalistlevel.hxx sw/source/ui/vba/vbalistlevel.hxx
-new file mode 100644
-index 0000000..4bcb147
---- /dev/null
-+++ sw/source/ui/vba/vbalistlevel.hxx
-@@ -0,0 +1,81 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_LISTLEVEL_HXX
-+#define SW_VBA_LISTLEVEL_HXX
-+
-+#include <ooo/vba/word/XListLevel.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include "vbalisthelper.hxx"
-+
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XListLevel > SwVbaListLevel_BASE;
-+
-+class SwVbaListLevel : public SwVbaListLevel_BASE
-+{
-+private:
-+ SwVbaListHelperRef pListHelper;
-+ sal_Int32 mnLevel;
-+
-+public:
-+ SwVbaListLevel( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, SwVbaListHelperRef pHelper, sal_Int32 nLevel ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaListLevel();
-+
-+ // Attributes
-+ virtual ::sal_Int32 SAL_CALL getAlignment() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setAlignment( ::sal_Int32 _alignment ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Reference< ::ooo::vba::word::XFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setFont( const css::uno::Reference< ::ooo::vba::word::XFont >& _font ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getIndex() throw (css::uno::RuntimeException);
-+ virtual ::rtl::OUString SAL_CALL getLinkedStyle() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setLinkedStyle( const ::rtl::OUString& _linkedstyle ) throw (css::uno::RuntimeException);
-+ virtual ::rtl::OUString SAL_CALL getNumberFormat() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setNumberFormat( const ::rtl::OUString& _numberformat ) throw (css::uno::RuntimeException);
-+ virtual float SAL_CALL getNumberPosition() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setNumberPosition( float _numberposition ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getNumberStyle() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setNumberStyle( ::sal_Int32 _numberstyle ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getResetOnHigher() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setResetOnHigher( ::sal_Int32 _resetonhigher ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getStartAt() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setStartAt( ::sal_Int32 _startat ) throw (css::uno::RuntimeException);
-+ virtual float SAL_CALL getTabPosition() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setTabPosition( float _tabposition ) throw (css::uno::RuntimeException);
-+ virtual float SAL_CALL getTextPosition() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setTextPosition( float _textposition ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getTrailingCharacter() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setTrailingCharacter( ::sal_Int32 _trailingcharacter ) throw (css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_LISTLEVEL_HXX */
-diff --git sw/source/ui/vba/vbalistlevels.cxx sw/source/ui/vba/vbalistlevels.cxx
-new file mode 100644
-index 0000000..019b6f5
---- /dev/null
-+++ sw/source/ui/vba/vbalistlevels.cxx
-@@ -0,0 +1,118 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbalistlevels.hxx"
-+#include "vbalistlevel.hxx"
-+#include <ooo/vba/word/WdListGalleryType.hpp>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+class ListLevelsEnumWrapper : public EnumerationHelper_BASE
-+{
-+ SwVbaListLevels* pListLevels;
-+ sal_Int32 nIndex;
-+public:
-+ ListLevelsEnumWrapper( SwVbaListLevels* pLevels ) : pListLevels( pLevels ), nIndex( 1 ) {}
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( nIndex <= pListLevels->getCount() );
-+ }
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( nIndex <= pListLevels->getCount() )
-+ return pListLevels->Item( uno::makeAny( nIndex++ ), uno::Any() );
-+ throw container::NoSuchElementException();
-+ }
-+};
-+
-+SwVbaListLevels::SwVbaListLevels( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, SwVbaListHelperRef pHelper ) throw (uno::RuntimeException) : SwVbaListLevels_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >() ), pListHelper( pHelper )
-+{
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaListLevels::getCount() throw (uno::RuntimeException)
-+{
-+ sal_Int32 nGalleryType = pListHelper->getGalleryType();
-+ if( nGalleryType == word::WdListGalleryType::wdBulletGallery
-+ || nGalleryType == word::WdListGalleryType::wdNumberGallery )
-+ return 1;
-+ else if( nGalleryType == word::WdListGalleryType::wdOutlineNumberGallery )
-+ return 9;
-+ return 0;
-+}
-+
-+uno::Any SAL_CALL SwVbaListLevels::Item( const uno::Any& Index1, const uno::Any& /*not processed in this base class*/ ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nIndex = 0;
-+ if( ( Index1 >>= nIndex ) == sal_False )
-+ throw uno::RuntimeException();
-+ if( nIndex <=0 || nIndex > getCount() )
-+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Index out of bounds") ), uno::Reference< uno::XInterface >() );
-+
-+ return uno::makeAny( uno::Reference< word::XListLevel >( new SwVbaListLevel( this, mxContext, pListHelper, nIndex - 1 ) ) );
-+}
-+
-+// XEnumerationAccess
-+uno::Type
-+SwVbaListLevels::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XListLevel::static_type(0);
-+}
-+
-+uno::Reference< container::XEnumeration >
-+SwVbaListLevels::createEnumeration() throw (uno::RuntimeException)
-+{
-+ return new ListLevelsEnumWrapper( this );
-+}
-+
-+uno::Any
-+SwVbaListLevels::createCollectionObject( const css::uno::Any& aSource )
-+{
-+ return aSource;
-+}
-+
-+rtl::OUString&
-+SwVbaListLevels::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaListLevels") );
-+ return sImplName;
-+}
-+
-+css::uno::Sequence<rtl::OUString>
-+SwVbaListLevels::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ListLevels") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbalistlevels.hxx sw/source/ui/vba/vbalistlevels.hxx
-new file mode 100644
-index 0000000..c57da55
---- /dev/null
-+++ sw/source/ui/vba/vbalistlevels.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:
-+ * $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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_LISTLEVELS_HXX
-+#define SW_VBA_LISTLEVELS_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XListLevels.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include "vbalisthelper.hxx"
-+
-+
-+typedef CollTestImplHelper< ooo::vba::word::XListLevels > SwVbaListLevels_BASE;
-+
-+class SwVbaListLevels : public SwVbaListLevels_BASE
-+{
-+private:
-+ SwVbaListHelperRef pListHelper;
-+
-+public:
-+ SwVbaListLevels( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, SwVbaListHelperRef pHelper ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaListLevels() {}
-+
-+ virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException);
-+ 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 );
-+ // 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);
-+
-+ // SwVbaListLevels_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* SW_VBA_LISTLEVELS_HXX */
-diff --git sw/source/ui/vba/vbalisttemplate.cxx sw/source/ui/vba/vbalisttemplate.cxx
-new file mode 100644
-index 0000000..1ad091e
---- /dev/null
-+++ sw/source/ui/vba/vbalisttemplate.cxx
-@@ -0,0 +1,80 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbalisttemplate.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include "vbalistlevels.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaListTemplate::SwVbaListTemplate( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& xTextDoc, sal_Int32 nGalleryType, sal_Int32 nTemplateType ) throw ( uno::RuntimeException ) : SwVbaListTemplate_BASE( rParent, rContext )
-+{
-+ pListHelper.reset( new SwVbaListHelper( xTextDoc, nGalleryType, nTemplateType ) );
-+}
-+
-+SwVbaListTemplate::~SwVbaListTemplate()
-+{
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaListTemplate::ListLevels( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< XCollection > xCol( new SwVbaListLevels( mxParent, mxContext, pListHelper ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+void SwVbaListTemplate::applyListTemplate( uno::Reference< beans::XPropertySet >& xProps ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< container::XIndexReplace > xNumberingRules = pListHelper->getNumberingRules();
-+ xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingRules") ) , uno::makeAny( xNumberingRules ) );
-+}
-+
-+rtl::OUString&
-+SwVbaListTemplate::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaListTemplate") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaListTemplate::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ListTemplate" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbalisttemplate.hxx sw/source/ui/vba/vbalisttemplate.hxx
-new file mode 100644
-index 0000000..733ef76
---- /dev/null
-+++ sw/source/ui/vba/vbalisttemplate.hxx
-@@ -0,0 +1,60 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_LISTTEMPLATE_HXX
-+#define SW_VBA_LISTTEMPLATE_HXX
-+
-+#include <ooo/vba/word/XListTemplate.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include "vbalisthelper.hxx"
-+
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XListTemplate > SwVbaListTemplate_BASE;
-+
-+class SwVbaListTemplate : public SwVbaListTemplate_BASE
-+{
-+private:
-+ SwVbaListHelperRef pListHelper;
-+
-+public:
-+ SwVbaListTemplate( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& xTextDoc, sal_Int32 nGalleryType, sal_Int32 nTemplateType ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaListTemplate();
-+
-+ void applyListTemplate( css::uno::Reference< css::beans::XPropertySet >& xProps ) throw ( css::uno::RuntimeException );
-+
-+ // Methods
-+ virtual css::uno::Any SAL_CALL ListLevels( const css::uno::Any& index ) throw ( css::uno::RuntimeException );
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_LISTTEMPLATE_HXX */
-diff --git sw/source/ui/vba/vbalisttemplates.cxx sw/source/ui/vba/vbalisttemplates.cxx
-new file mode 100644
-index 0000000..ba560d3
---- /dev/null
-+++ sw/source/ui/vba/vbalisttemplates.cxx
-@@ -0,0 +1,112 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbalisttemplates.hxx"
-+#include "vbalisttemplate.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+class ListTemplatesEnumWrapper : public EnumerationHelper_BASE
-+{
-+ SwVbaListTemplates* pListTemplates;
-+ sal_Int32 nIndex;
-+public:
-+ ListTemplatesEnumWrapper( SwVbaListTemplates* pTemplates ) : pListTemplates( pTemplates ), nIndex( 1 ) {}
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( nIndex <= pListTemplates->getCount() );
-+ }
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( nIndex <= pListTemplates->getCount() )
-+ return pListTemplates->Item( uno::makeAny( nIndex++ ), uno::Any() );
-+ throw container::NoSuchElementException();
-+ }
-+};
-+
-+SwVbaListTemplates::SwVbaListTemplates( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextDocument >& xTextDoc, sal_Int32 nType ) throw (uno::RuntimeException) : SwVbaListTemplates_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >() ), mxTextDocument( xTextDoc ), mnGalleryType( nType )
-+{
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaListTemplates::getCount() throw (uno::RuntimeException)
-+{
-+ // 3 types of list( bullet, numbered and outline )
-+ return 7;
-+}
-+
-+uno::Any SAL_CALL SwVbaListTemplates::Item( const uno::Any& Index1, const uno::Any& /*not processed in this base class*/ ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nIndex = 0;
-+ if( ( Index1 >>= nIndex ) == sal_False )
-+ throw uno::RuntimeException();
-+ if( nIndex <=0 || nIndex > getCount() )
-+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Index out of bounds") ), uno::Reference< uno::XInterface >() );
-+
-+ return uno::makeAny( uno::Reference< word::XListTemplate >( new SwVbaListTemplate( this, mxContext, mxTextDocument, mnGalleryType, nIndex ) ) );
-+}
-+
-+// XEnumerationAccess
-+uno::Type
-+SwVbaListTemplates::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XListTemplate::static_type(0);
-+}
-+
-+uno::Reference< container::XEnumeration >
-+SwVbaListTemplates::createEnumeration() throw (uno::RuntimeException)
-+{
-+ return new ListTemplatesEnumWrapper( this );
-+}
-+
-+uno::Any
-+SwVbaListTemplates::createCollectionObject( const css::uno::Any& aSource )
-+{
-+ return aSource;
-+}
-+
-+rtl::OUString&
-+SwVbaListTemplates::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaListTemplates") );
-+ return sImplName;
-+}
-+
-+css::uno::Sequence<rtl::OUString>
-+SwVbaListTemplates::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ListTemplates") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbalisttemplates.hxx sw/source/ui/vba/vbalisttemplates.hxx
-new file mode 100644
-index 0000000..214d01b
---- /dev/null
-+++ sw/source/ui/vba/vbalisttemplates.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:
-+ * $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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_LISTTEMPLATES_HXX
-+#define SW_VBA_LISTTEMPLATES_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XListTemplates.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+
-+typedef CollTestImplHelper< ooo::vba::word::XListTemplates > SwVbaListTemplates_BASE;
-+
-+class SwVbaListTemplates : public SwVbaListTemplates_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XTextDocument > mxTextDocument;
-+ sal_Int32 mnGalleryType;
-+
-+public:
-+ SwVbaListTemplates( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::text::XTextDocument >& xTextDoc, sal_Int32 nType ) throw (css::uno::RuntimeException);
-+ virtual ~SwVbaListTemplates() {}
-+
-+ virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException);
-+ 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 );
-+ // 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);
-+
-+ // SwVbaListTemplates_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* SW_VBA_LISTTEMPLATES_HXX */
-diff --git sw/source/ui/vba/vbaparagraph.cxx sw/source/ui/vba/vbaparagraph.cxx
-index 107ff33..56db358 100644
---- sw/source/ui/vba/vbaparagraph.cxx
-+++ sw/source/ui/vba/vbaparagraph.cxx
-@@ -51,6 +51,20 @@ SwVbaParagraph::getRange( ) throw ( uno::RuntimeException )
- return uno::Reference< word::XRange >( new SwVbaRange( this, mxContext, mxTextDocument, mxTextRange->getStart(), mxTextRange->getEnd(), mxTextRange->getText(), sal_True ) );
- }
-
-+uno::Any SAL_CALL
-+SwVbaParagraph::getStyle( ) throw ( uno::RuntimeException )
-+{
-+ uno::Reference< word::XRange > xRange = getRange();
-+ return xRange->getStyle();
-+}
-+
-+void SAL_CALL
-+SwVbaParagraph::setStyle( const uno::Any& style ) throw ( uno::RuntimeException )
-+{
-+ uno::Reference< word::XRange > xRange = getRange();
-+ xRange->setStyle( style );
-+}
-+
- rtl::OUString&
- SwVbaParagraph::getServiceImplName()
- {
-diff --git sw/source/ui/vba/vbaparagraph.hxx sw/source/ui/vba/vbaparagraph.hxx
-index 979116d..bebafe0 100644
---- sw/source/ui/vba/vbaparagraph.hxx
-+++ sw/source/ui/vba/vbaparagraph.hxx
-@@ -53,6 +53,8 @@ public:
-
- // XParagraph
- virtual css::uno::Reference< ooo::vba::word::XRange > SAL_CALL getRange() throw ( css::uno::RuntimeException );
-+ virtual css::uno::Any SAL_CALL getStyle() throw ( css::uno::RuntimeException );
-+ virtual void SAL_CALL setStyle( const css::uno::Any& style ) throw ( css::uno::RuntimeException );
-
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
-diff --git sw/source/ui/vba/vbaparagraphformat.cxx sw/source/ui/vba/vbaparagraphformat.cxx
-index 2959a23..6639ceb 100644
---- sw/source/ui/vba/vbaparagraphformat.cxx
-+++ sw/source/ui/vba/vbaparagraphformat.cxx
-@@ -37,6 +37,7 @@
- #include <ooo/vba/word/WdOutlineLevel.hpp>
- #include <com/sun/star/style/ParagraphAdjust.hpp>
- #include <com/sun/star/style/BreakType.hpp>
-+#include "vbatabstops.hxx"
-
-
- using namespace ::ooo::vba;
-@@ -203,9 +204,12 @@ sal_Int32 SAL_CALL SwVbaParagraphFormat::getOutlineLevel() throw (uno::RuntimeEx
- return nLevel;
- }
-
--void SAL_CALL SwVbaParagraphFormat::setOutlineLevel( sal_Int32 /*_outlinelevel*/ ) throw (uno::RuntimeException)
-+void SAL_CALL SwVbaParagraphFormat::setOutlineLevel( sal_Int32 _outlinelevel ) throw (uno::RuntimeException)
- {
-- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ if( _outlinelevel != getOutlineLevel() )
-+ {
-+ // TODO: in my test in msword, there is no effect for this function.
-+ }
- }
-
- uno::Any SAL_CALL SwVbaParagraphFormat::getPageBreakBefore() throw (uno::RuntimeException)
-@@ -299,7 +303,7 @@ void SAL_CALL SwVbaParagraphFormat::setRightIndent( float _rightindent ) throw (
-
- uno::Any SAL_CALL SwVbaParagraphFormat::getTabStops() throw (uno::RuntimeException)
- {
-- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ return uno::makeAny( uno::Reference< word::XTabStops >( new SwVbaTabStops( this, mxContext, mxParaProps ) ) );
- }
-
- void SAL_CALL SwVbaParagraphFormat::setTabStops( const uno::Any& /*_tabstops*/ ) throw (uno::RuntimeException)
-diff --git sw/source/ui/vba/vbarange.cxx sw/source/ui/vba/vbarange.cxx
-index 7f166e9..057330b 100644
---- sw/source/ui/vba/vbarange.cxx
-+++ sw/source/ui/vba/vbarange.cxx
-@@ -35,12 +35,21 @@
- #include <com/sun/star/style/BreakType.hpp>
- #include <com/sun/star/text/ControlCharacter.hpp>
- #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
--#include "wordvbahelper.hxx"
-+#include <com/sun/star/text/XTextRangeCompare.hpp>
-+#include <com/sun/star/text/XWordCursor.hpp>
-+#include <com/sun/star/text/XParagraphCursor.hpp>
-+#include <ooo/vba/word/WdUnits.hpp>
-+#include <ooo/vba/word/WdMovementType.hpp>
- #include "vbaparagraphformat.hxx"
- #include "vbastyle.hxx"
- #include "vbafont.hxx"
- #include "vbapalette.hxx"
- #include "vbapagesetup.hxx"
-+#include "vbalistformat.hxx"
-+#include "vbarevisions.hxx"
-+#include "vbabookmarks.hxx"
-+#include "vbasections.hxx"
-+#include "vbafield.hxx"
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-@@ -73,6 +82,8 @@ void SwVbaRange::initialize( const uno::Reference< text::XTextRange >& rStart, c
- }
-
- mxTextCursor = SwVbaRangeHelper::initCursor( rStart, mxText );
-+ if( !mxTextCursor.is() )
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Fails to create text cursor") ), uno::Reference< uno::XInterface >() );
- mxTextCursor->collapseToStart();
-
- if( rEnd.is() )
-@@ -94,6 +105,67 @@ void SwVbaRange::setXTextRange( const uno::Reference< text::XTextRange >& xRange
- mxTextCursor->gotoRange( xRange->getEnd(), sal_True );
- }
-
-+void
-+SwVbaRange::Move( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend, word::E_DIRECTION eDirection ) throw ( uno::RuntimeException )
-+{
-+ sal_Int32 nUnit = word::WdUnits::wdCharacter;
-+ sal_Int32 nCount = 1;
-+ sal_Int32 nExtend = word::WdMovementType::wdMove;
-+
-+ if( _unit.hasValue() )
-+ _unit >>= nUnit;
-+ if( _count.hasValue() )
-+ _count >>= nCount;
-+ if( _extend.hasValue() )
-+ _extend >>= nExtend;
-+
-+ if( nCount == 0 )
-+ return;
-+
-+ sal_Bool bExpand = ( nExtend == word::WdMovementType::wdMove ) ? sal_False : sal_True;
-+
-+ switch( nUnit )
-+ {
-+ case word::WdUnits::wdParagraph:
-+ {
-+ if( eDirection == word::MOVE_LEFT || eDirection == word::MOVE_RIGHT )
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+ uno::Reference< text::XParagraphCursor > xParagraphCursor( mxTextCursor, uno::UNO_QUERY_THROW );
-+ for( sal_Int32 i=0; i<nCount; i++ )
-+ {
-+ if( ( eDirection == word::MOVE_UP ) && ( xParagraphCursor->gotoPreviousParagraph( bExpand ) == sal_False ) )
-+ break;
-+ else if( ( eDirection == word::MOVE_DOWN ) && ( xParagraphCursor->gotoNextParagraph( bExpand ) == sal_False ) )
-+ break;
-+ }
-+ break;
-+ }
-+ case word::WdUnits::wdWord:
-+ {
-+ if( eDirection == word::MOVE_UP || eDirection == word::MOVE_DOWN )
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+ uno::Reference< text::XWordCursor > xWordCursor( mxTextCursor, uno::UNO_QUERY_THROW );
-+ for( sal_Int32 i=0; i<nCount; i++ )
-+ {
-+ if( (eDirection == word::MOVE_LEFT ) && ( xWordCursor->gotoPreviousWord( bExpand ) == sal_False ) )
-+ break;
-+ else if( ( eDirection == word::MOVE_RIGHT ) && ( xWordCursor->gotoNextWord( bExpand ) == sal_False ) )
-+ break;
-+ }
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ break;
-+ }
-+ }
-+}
-+
- /**
- * The complexity in this method is because we need to workaround
- * an issue that the last paragraph in a document does not have a trailing CRLF.
-@@ -131,17 +203,46 @@ SwVbaRange::getText() throw ( uno::RuntimeException )
- void SAL_CALL
- SwVbaRange::setText( const rtl::OUString& rText ) throw ( uno::RuntimeException )
- {
-+ // Emulate the MSWord behavior, Don't delete the bookmark
-+ // which contains no text string in current inserting position,
-+ rtl::OUString sName;
-+ uno::Reference< text::XTextRange > xRange( mxTextCursor, uno::UNO_QUERY_THROW );
-+ try
-+ {
-+ uno::Reference< text::XTextContent > xBookmark = SwVbaRangeHelper::findBookmarkByPosition( mxTextDocument, xRange->getStart() );
-+ if( xBookmark.is() )
-+ {
-+ uno::Reference< container::XNamed > xNamed( xBookmark, uno::UNO_QUERY_THROW );
-+ sName = xNamed->getName();
-+ }
-+ }
-+ catch( uno::Exception& )
-+ {
-+ // do nothing
-+ }
-+
- if( rText.indexOf( '\n' ) != -1 )
- {
- mxTextCursor->setString( rtl::OUString() );
- // process CR in strings
-- uno::Reference< text::XTextRange > xRange( mxTextCursor, uno::UNO_QUERY_THROW );
- SwVbaRangeHelper::insertString( xRange, mxText, rText, sal_True );
- }
- else
- {
- mxTextCursor->setString( rText );
- }
-+
-+ // insert the bookmark if the bookmark is deleted during setting text string
-+ if( sName.getLength() )
-+ {
-+ uno::Reference< text::XBookmarksSupplier > xBookmarksSupplier( mxTextDocument, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XNameAccess > xNameAccess( xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY_THROW );
-+ if( !xNameAccess->hasByName( sName ) )
-+ {
-+ uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW );
-+ SwVbaBookmarks::addBookmarkByName( xModel, sName, xRange->getStart() );
-+ }
-+ }
- }
-
- // FIXME: test is not pass
-@@ -232,11 +333,8 @@ SwVbaRange::setParagraphFormat( const uno::Reference< word::XParagraphFormat >&
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
- }
-
--uno::Reference< word::XStyle > SAL_CALL
--SwVbaRange::getStyle() throw ( uno::RuntimeException )
-+void SwVbaRange::GetStyleInfo(rtl::OUString& aStyleName, rtl::OUString& aStyleType ) throw ( uno::RuntimeException )
- {
-- rtl::OUString aStyleName;
-- rtl::OUString aStyleType;
- uno::Reference< beans::XPropertySet > xProp( mxTextCursor, uno::UNO_QUERY_THROW );
- if( ( xProp->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CharStyleName") ) ) >>= aStyleName ) && aStyleName.getLength() )
- {
-@@ -250,14 +348,23 @@ SwVbaRange::getStyle() throw ( uno::RuntimeException )
- {
- DebugHelper::exception( SbERR_INTERNAL_ERROR, rtl::OUString() );
- }
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaRange::getStyle() throw ( uno::RuntimeException )
-+{
-+ rtl::OUString aStyleName;
-+ rtl::OUString aStyleType;
-+ GetStyleInfo( aStyleName, aStyleType );
- uno::Reference< style::XStyleFamiliesSupplier > xStyleSupplier( mxTextDocument, uno::UNO_QUERY_THROW);
- uno::Reference< container::XNameAccess > xStylesAccess( xStyleSupplier->getStyleFamilies()->getByName( aStyleType ), uno::UNO_QUERY_THROW );
- uno::Reference< beans::XPropertySet > xStyleProps( xStylesAccess->getByName( aStyleName ), uno::UNO_QUERY_THROW );
-- return uno::Reference< word::XStyle >( new SwVbaStyle( this, mxContext, xStyleProps ) );
-+ uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW );
-+ return uno::makeAny( uno::Reference< word::XStyle >( new SwVbaStyle( this, mxContext, xModel, xStyleProps ) ) );
- }
-
- void SAL_CALL
--SwVbaRange::setStyle( const uno::Reference< word::XStyle >& rStyle ) throw ( uno::RuntimeException )
-+SwVbaRange::setStyle( const uno::Any& rStyle ) throw ( uno::RuntimeException )
- {
- uno::Reference< beans::XPropertySet > xParaProps( mxTextCursor, uno::UNO_QUERY_THROW );
- SwVbaStyle::setStyle( xParaProps, rStyle );
-@@ -270,6 +377,12 @@ SwVbaRange::getFont() throw ( uno::RuntimeException )
- return new SwVbaFont( mxParent, mxContext, aColors.getPalette(), uno::Reference< beans::XPropertySet >( getXTextRange(), uno::UNO_QUERY_THROW ) );
- }
-
-+uno::Reference< word::XListFormat > SAL_CALL
-+SwVbaRange::getListFormat() throw ( uno::RuntimeException )
-+{
-+ return uno::Reference< word::XListFormat >( new SwVbaListFormat( this, mxContext, getXTextRange() ) );
-+}
-+
- ::sal_Int32 SAL_CALL SwVbaRange::getLanguageID() throw (uno::RuntimeException)
- {
- uno::Reference< beans::XPropertySet > xParaProps( mxTextCursor, uno::UNO_QUERY_THROW );
-@@ -327,6 +440,50 @@ void SAL_CALL SwVbaRange::setEnd( ::sal_Int32 _end ) throw (uno::RuntimeExceptio
- mxTextCursor->gotoRange( xEnd, sal_True );
- }
-
-+::sal_Bool SAL_CALL SwVbaRange::InRange( const uno::Reference< ::ooo::vba::word::XRange >& Range ) throw (uno::RuntimeException)
-+{
-+ SwVbaRange* pRange = dynamic_cast< SwVbaRange* >( Range.get() );
-+ if( !pRange )
-+ throw uno::RuntimeException();
-+ uno::Reference< text::XTextRange > xTextRange = pRange->getXTextRange();
-+ uno::Reference< text::XTextRangeCompare > xTRC( mxTextCursor->getText(), uno::UNO_QUERY_THROW );
-+ if( xTRC->compareRegionStarts( xTextRange, getXTextRange() ) >= 0 && xTRC->compareRegionEnds( xTextRange, getXTextRange() ) <= 0 )
-+ return sal_True;
-+ return sal_False;
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaRange::Revisions( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< text::XTextRange > xTextRange = getXTextRange();
-+ uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW );
-+ uno::Reference< XCollection > xCol( new SwVbaRevisions( mxParent, mxContext, xModel, xTextRange ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaRange::Sections( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< text::XTextRange > xTextRange = getXTextRange();
-+ uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW );
-+ uno::Reference< XCollection > xCol( new SwVbaSections( mxParent, mxContext, xModel, xTextRange ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaRange::Fields( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ //FIXME: should be get the field in current range
-+ uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW );
-+ uno::Reference< XCollection > xCol( new SwVbaFields( mxParent, mxContext, xModel ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
- rtl::OUString&
- SwVbaRange::getServiceImplName()
- {
-diff --git sw/source/ui/vba/vbarange.hxx sw/source/ui/vba/vbarange.hxx
-index abce5b7..030007e 100644
---- sw/source/ui/vba/vbarange.hxx
-+++ sw/source/ui/vba/vbarange.hxx
-@@ -38,6 +38,8 @@
- #include <com/sun/star/text/XTextRange.hpp>
- #include <com/sun/star/text/XTextDocument.hpp>
- #include <ooo/vba/word/XStyle.hpp>
-+#include <ooo/vba/word/XListFormat.hpp>
-+#include "wordvbahelper.hxx"
-
- typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XRange > SwVbaRange_BASE;
-
-@@ -51,6 +53,7 @@ private:
-
- private:
- void initialize( const css::uno::Reference< css::text::XTextRange >& rStart, const css::uno::Reference< css::text::XTextRange >& rEnd ) throw (css::uno::RuntimeException);
-+ void GetStyleInfo(rtl::OUString& aStyleName, rtl::OUString& aStyleType ) throw ( css::uno::RuntimeException );
- public:
- SwVbaRange( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rTextDocument, const css::uno::Reference< css::text::XTextRange >& rStart, sal_Bool _bMaySpanEndOfDocument = sal_False ) throw (css::uno::RuntimeException);
- SwVbaRange( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rTextDocument, const css::uno::Reference< css::text::XTextRange >& rStart, const css::uno::Reference< css::text::XTextRange >& rEnd, sal_Bool _bMaySpanEndOfDocument = sal_False ) throw (css::uno::RuntimeException);
-@@ -62,16 +65,18 @@ public:
- void setXTextRange( const css::uno::Reference< css::text::XTextRange >& xRange ) throw (css::uno::RuntimeException);
- css::uno::Reference< css::text::XText > getXText() { return mxText; }
- void setXTextCursor( const css::uno::Reference< css::text::XTextCursor >& xTextCursor ) { mxTextCursor = xTextCursor; }
-+ void Move( const css::uno::Any& _unit, const css::uno::Any& _count, const css::uno::Any& _extend, ooo::vba::word::E_DIRECTION eDirection ) throw (css::uno::RuntimeException);
-
- // Attribute
- virtual rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setText( const rtl::OUString& rText ) throw (css::uno::RuntimeException);
- virtual css::uno::Reference< ooo::vba::word::XParagraphFormat > SAL_CALL getParagraphFormat() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setParagraphFormat( const css::uno::Reference< ooo::vba::word::XParagraphFormat >& rParagraphFormat ) throw (css::uno::RuntimeException);
-- virtual css::uno::Reference< ooo::vba::word::XStyle > SAL_CALL getStyle() throw (css::uno::RuntimeException);
-- virtual void SAL_CALL setStyle( const css::uno::Reference< ooo::vba::word::XStyle >& _xStyle ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL getStyle() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setStyle( const css::uno::Any& _xStyle ) throw (css::uno::RuntimeException);
-
- virtual css::uno::Reference< ooo::vba::word::XFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
-+ virtual css::uno::Reference< ooo::vba::word::XListFormat > SAL_CALL getListFormat() throw (css::uno::RuntimeException);
- // Methods
- virtual void SAL_CALL InsertBreak( const css::uno::Any& _breakType ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Select() throw (css::uno::RuntimeException);
-@@ -85,6 +90,10 @@ public:
- virtual void SAL_CALL setStart( ::sal_Int32 _start ) throw (css::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getEnd() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setEnd( ::sal_Int32 _end ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL InRange( const css::uno::Reference< ::ooo::vba::word::XRange >& Range ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Revisions( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Sections( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Fields( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
-diff --git sw/source/ui/vba/vbarangehelper.cxx sw/source/ui/vba/vbarangehelper.cxx
-index 5df01b8..12aa933 100644
---- sw/source/ui/vba/vbarangehelper.cxx
-+++ sw/source/ui/vba/vbarangehelper.cxx
-@@ -30,6 +30,7 @@
- #include "vbarangehelper.hxx"
- #include <com/sun/star/text/ControlCharacter.hpp>
- #include <com/sun/star/text/XTextRangeCompare.hpp>
-+#include <com/sun/star/text/XBookmarksSupplier.hpp>
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-@@ -114,7 +115,7 @@ uno::Reference< text::XTextCursor > SwVbaRangeHelper::initCursor( const uno::Ref
- DebugHelper::exception(e);
- }
-
-- if( !bGotTextCursor )
-+ if( !bGotTextCursor || !xTextCursor.is() )
- {
- try
- {
-@@ -128,7 +129,7 @@ uno::Reference< text::XTextCursor > SwVbaRangeHelper::initCursor( const uno::Ref
- }
- }
-
-- if( !bGotTextCursor )
-+ if( !bGotTextCursor || !xTextCursor.is() )
- {
- try
- {
-@@ -172,3 +173,29 @@ sal_Int32 SwVbaRangeHelper::getPosition( const uno::Reference< text::XText >& rT
-
- return nPosition;
- }
-+
-+uno::Reference< text::XTextContent > SwVbaRangeHelper::findBookmarkByPosition( const uno::Reference< text::XTextDocument >& xTextDoc, const uno::Reference< text::XTextRange >& xTextRange ) throw ( css::uno::RuntimeException )
-+{
-+ uno::Reference< text::XBookmarksSupplier > xBookmarksSupplier( xTextDoc, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xIndexAccess( xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY_THROW );
-+ for( sal_Int32 index = 0; index < xIndexAccess->getCount(); index++ )
-+ {
-+ uno::Reference< text::XTextContent > xBookmark( xIndexAccess->getByIndex( index ), uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextRange > xBkAnchor = xBookmark->getAnchor();
-+ uno::Reference< text::XTextRangeCompare > xCompare( xBkAnchor->getText(), uno::UNO_QUERY_THROW );
-+ if( xCompare->compareRegionStarts( xBkAnchor->getStart(), xBkAnchor->getEnd() ) == 0 )
-+ {
-+ try
-+ {
-+ if( xCompare->compareRegionStarts( xTextRange, xBkAnchor->getStart() ) == 0 )
-+ return xBookmark;
-+ }
-+ catch( uno::Exception& )
-+ {
-+ continue;
-+ }
-+ }
-+ }
-+ return uno::Reference< text::XTextContent >();
-+}
-+
-diff --git sw/source/ui/vba/vbarangehelper.hxx sw/source/ui/vba/vbarangehelper.hxx
-index 5e47899..e17eb72 100644
---- sw/source/ui/vba/vbarangehelper.hxx
-+++ sw/source/ui/vba/vbarangehelper.hxx
-@@ -33,6 +33,8 @@
- #include <vbahelper/vbahelperinterface.hxx>
- #include <com/sun/star/text/XTextViewCursor.hpp>
- #include <com/sun/star/text/XText.hpp>
-+#include <com/sun/star/text/XTextRange.hpp>
-+#include <com/sun/star/text/XTextDocument.hpp>
-
- class SwVbaRangeHelper
- {
-@@ -41,6 +43,7 @@ public:
- static void insertString( css::uno::Reference< css::text::XTextRange >& rTextRange, css::uno::Reference< css::text::XText >& rText, const rtl::OUString& rStr, sal_Bool _bAbsorb ) throw ( css::uno::RuntimeException );
- static css::uno::Reference< css::text::XTextCursor > initCursor( const css::uno::Reference< css::text::XTextRange >& rTextRange, const css::uno::Reference< css::text::XText >& rText ) throw ( css::uno::RuntimeException );
- static sal_Int32 getPosition( const css::uno::Reference< css::text::XText >& rText, const css::uno::Reference< css::text::XTextRange >& rTextRange ) throw ( css::uno::RuntimeException );
-+ static css::uno::Reference< css::text::XTextContent > findBookmarkByPosition( const css::uno::Reference< css::text::XTextDocument >& xTextDoc, const css::uno::Reference< css::text::XTextRange >& xTextRange ) throw ( css::uno::RuntimeException );
-
- };
- #endif /* SW_VBA_RANGEHELPER_HXX */
-diff --git sw/source/ui/vba/vbareplacement.cxx sw/source/ui/vba/vbareplacement.cxx
-index abf85f3..7a46f83 100644
---- sw/source/ui/vba/vbareplacement.cxx
-+++ sw/source/ui/vba/vbareplacement.cxx
-@@ -53,6 +53,12 @@ void SAL_CALL SwVbaReplacement::setText( const ::rtl::OUString& _text ) throw (u
- mxPropertyReplace->setReplaceString( _text );
- }
-
-+void SAL_CALL SwVbaReplacement::ClearFormatting( ) throw (uno::RuntimeException)
-+{
-+ uno::Sequence< beans::PropertyValue > aPropValues;
-+ mxPropertyReplace->setReplaceAttributes( aPropValues );
-+}
-+
- rtl::OUString&
- SwVbaReplacement::getServiceImplName()
- {
-diff --git sw/source/ui/vba/vbareplacement.hxx sw/source/ui/vba/vbareplacement.hxx
-index d590a1d..8d0ef8d 100644
---- sw/source/ui/vba/vbareplacement.hxx
-+++ sw/source/ui/vba/vbareplacement.hxx
-@@ -50,6 +50,9 @@ public:
- 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 ClearFormatting() throw (css::uno::RuntimeException);
-+
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-diff --git sw/source/ui/vba/vbarevision.cxx sw/source/ui/vba/vbarevision.cxx
-new file mode 100644
-index 0000000..0c48b1d
---- /dev/null
-+++ sw/source/ui/vba/vbarevision.cxx
-@@ -0,0 +1,105 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbarevision.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include <com/sun/star/document/XRedlinesSupplier.hpp>
-+#include "wordvbahelper.hxx"
-+#include <docsh.hxx>
-+#include <doc.hxx>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaRevision::SwVbaRevision( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< beans::XPropertySet >& xRedlineProps ) throw ( uno::RuntimeException ) : SwVbaRevision_BASE( rParent, rContext ), mxModel( xModel ), mxRedlineProps( xRedlineProps )
-+{
-+}
-+
-+SwVbaRevision::~SwVbaRevision()
-+{
-+}
-+
-+sal_Int32 SwVbaRevision::GetPosition() throw (css::uno::RuntimeException)
-+{
-+ sal_Int32 nPos = -1;
-+ uno::Reference< document::XRedlinesSupplier > xRedlinesSupp( mxModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xRedlines( xRedlinesSupp->getRedlines(), uno::UNO_QUERY_THROW );
-+ sal_Int32 nCount = xRedlines->getCount();
-+ for( sal_Int32 i = 0; i < nCount; i++ )
-+ {
-+ uno::Reference< beans::XPropertySet > xProps( xRedlines->getByIndex( i ), uno::UNO_QUERY_THROW );
-+ if( xProps == mxRedlineProps )
-+ {
-+ nPos = i;
-+ OSL_TRACE(" SwVbaRevision::SwVbaRevision, the redline position is %d, ", nPos );
-+ break;
-+ }
-+ }
-+ if( nPos == -1 )
-+ throw uno::RuntimeException();
-+
-+ return nPos;
-+}
-+
-+void SAL_CALL
-+SwVbaRevision::Accept() throw ( css::uno::RuntimeException )
-+{
-+ SwDoc* pDoc = word::getDocShell( mxModel )->GetDoc();
-+ if( pDoc )
-+ pDoc->AcceptRedline( GetPosition(), sal_True );
-+}
-+
-+void SAL_CALL
-+SwVbaRevision::Reject( ) throw ( css::uno::RuntimeException )
-+{
-+ SwDoc* pDoc = word::getDocShell( mxModel )->GetDoc();
-+ if( pDoc )
-+ pDoc->RejectRedline( GetPosition(), sal_True );
-+}
-+
-+rtl::OUString&
-+SwVbaRevision::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaRevision") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaRevision::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Revision" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbarevision.hxx sw/source/ui/vba/vbarevision.hxx
-new file mode 100644
-index 0000000..0384370
---- /dev/null
-+++ sw/source/ui/vba/vbarevision.hxx
-@@ -0,0 +1,60 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_REVISION_HXX
-+#define SW_VBA_REVISION_HXX
-+
-+#include <ooo/vba/word/XRevision.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XRevision > SwVbaRevision_BASE;
-+
-+class SwVbaRevision : public SwVbaRevision_BASE
-+{
-+private:
-+ css::uno::Reference< css::frame::XModel > mxModel;
-+ css::uno::Reference< css::beans::XPropertySet > mxRedlineProps;
-+
-+private:
-+ sal_Int32 GetPosition() throw (css::uno::RuntimeException);
-+
-+public:
-+ SwVbaRevision( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::beans::XPropertySet >& xRedlineProps ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaRevision();
-+
-+ // Methods
-+ virtual void SAL_CALL Accept( ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL Reject( ) throw (css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_REVISION_HXX */
-diff --git sw/source/ui/vba/vbarevisions.cxx sw/source/ui/vba/vbarevisions.cxx
-new file mode 100644
-index 0000000..9d3e921
---- /dev/null
-+++ sw/source/ui/vba/vbarevisions.cxx
-@@ -0,0 +1,189 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbarevisions.hxx"
-+#include "vbarevision.hxx"
-+#include <cppuhelper/implbase2.hxx>
-+#include <com/sun/star/document/XRedlinesSupplier.hpp>
-+#include <com/sun/star/text/XTextRangeCompare.hpp>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+typedef ::cppu::WeakImplHelper1< container::XEnumeration > RevisionEnumeration_BASE;
-+typedef ::cppu::WeakImplHelper2< container::XIndexAccess, container::XEnumerationAccess > RevisionCollectionHelper_BASE;
-+typedef std::vector< uno::Reference< beans::XPropertySet > > RevisionMap;
-+
-+class RedlinesEnumeration : public RevisionEnumeration_BASE
-+{
-+ RevisionMap mRevisionMap;
-+ RevisionMap::iterator mIt;
-+public:
-+ RedlinesEnumeration( const RevisionMap& sMap ) : mRevisionMap( sMap ), mIt( mRevisionMap.begin() ) {}
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( mIt != mRevisionMap.end() );
-+ }
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( !hasMoreElements() )
-+ throw container::NoSuchElementException();
-+ uno::Reference< beans::XPropertySet > xRevision( *mIt++ );
-+ return uno::makeAny( xRevision ) ;
-+ }
-+};
-+
-+class RevisionCollectionHelper : public RevisionCollectionHelper_BASE
-+{
-+ RevisionMap mRevisionMap;
-+public:
-+RevisionCollectionHelper( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XTextRange >& xTextRange ) throw (uno::RuntimeException);
-+
-+ // XElementAccess
-+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) { return beans::XPropertySet::static_type(0); }
-+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) { return ( mRevisionMap.size() > 0 ); }
-+ // XIndexAccess
-+ virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException) { return mRevisionMap.size(); }
-+ virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
-+ {
-+ if ( Index < 0 || Index >= getCount() )
-+ throw lang::IndexOutOfBoundsException();
-+
-+ return uno::makeAny( mRevisionMap[ Index ] );
-+
-+ }
-+ // XEnumerationAccess
-+ virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
-+ {
-+ return new RedlinesEnumeration( mRevisionMap );
-+ }
-+};
-+
-+RevisionCollectionHelper::RevisionCollectionHelper( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XTextRange >& xTextRange ) throw (uno::RuntimeException)
-+ {
-+ uno::Reference< text::XTextRangeCompare > xTRC( xTextRange->getText(), uno::UNO_QUERY_THROW );
-+ uno::Reference< document::XRedlinesSupplier > xRedlinesSupp( xModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xRedlines( xRedlinesSupp->getRedlines(), uno::UNO_QUERY_THROW );
-+ sal_Int32 nCount = xRedlines->getCount();
-+ for( sal_Int32 index = 0; index < nCount; index++ )
-+ {
-+ uno::Reference< text::XTextRange > xRedlineRange( xRedlines->getByIndex( index ), uno::UNO_QUERY_THROW );
-+ if( xTRC->compareRegionStarts( xTextRange, xRedlineRange ) >= 0 && xTRC->compareRegionEnds( xTextRange, xRedlineRange ) <= 0 )
-+ {
-+ uno::Reference< beans::XPropertySet > xRedlineProps( xRedlineRange, uno::UNO_QUERY_THROW );
-+ mRevisionMap.push_back( xRedlineProps );
-+ }
-+ }
-+ }
-+class RevisionsEnumeration : public EnumerationHelperImpl
-+{
-+ uno::Reference< frame::XModel > m_xModel;
-+ uno::WeakReference< XHelperInterface > m_xParent;
-+public:
-+ RevisionsEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration, const uno::Reference< frame::XModel >& xModel ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xContext, xEnumeration ), m_xModel( xModel ), m_xParent( xParent ){}
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ uno::Reference< beans::XPropertySet > xRevision( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
-+ return uno::makeAny( uno::Reference< word::XRevision > ( new SwVbaRevision( m_xParent, m_xContext, m_xModel, xRevision ) ) );
-+ }
-+
-+};
-+
-+SwVbaRevisions::SwVbaRevisions( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XTextRange >& xTextRange ): SwVbaRevisions_BASE( xParent, xContext, new RevisionCollectionHelper( xModel, xTextRange ) ), mxModel( xModel )
-+{
-+}
-+
-+SwVbaRevisions::SwVbaRevisions( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< container::XIndexAccess >& xIndexAccess ): SwVbaRevisions_BASE( xParent, xContext, xIndexAccess ), mxModel( xModel )
-+{
-+}
-+
-+// XEnumerationAccess
-+uno::Type
-+SwVbaRevisions::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XRevision::static_type(0);
-+}
-+uno::Reference< container::XEnumeration >
-+SwVbaRevisions::createEnumeration() throw (uno::RuntimeException)
-+{
-+ uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
-+ return new RevisionsEnumeration( this, mxContext, xEnumAccess->createEnumeration(), mxModel );
-+}
-+
-+uno::Any
-+SwVbaRevisions::createCollectionObject( const css::uno::Any& aSource )
-+{
-+ uno::Reference< beans::XPropertySet > xRevision( aSource, uno::UNO_QUERY_THROW );
-+ return uno::makeAny( uno::Reference< word::XRevision > ( new SwVbaRevision( this, mxContext, mxModel, xRevision ) ) );
-+}
-+
-+void SAL_CALL SwVbaRevisions::AcceptAll( ) throw (css::uno::RuntimeException)
-+{
-+ // First we need to put all the redline into a vector, because if the redline is accepted,
-+ // it will auto delete in the document.
-+ std::vector< uno::Reference< word::XRevision > > aRevisions;
-+ uno::Reference< container::XEnumeration > xEnumeration = createEnumeration();
-+ while( xEnumeration->hasMoreElements() )
-+ {
-+ uno::Reference< word::XRevision > xRevision( xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
-+ aRevisions.push_back( xRevision );
-+ }
-+
-+ std::vector< uno::Reference< word::XRevision > >::iterator it = aRevisions.begin();
-+ for( ; it != aRevisions.end(); it++ )
-+ {
-+ uno::Reference< word::XRevision > xRevision( *it );
-+ xRevision->Accept();
-+ }
-+}
-+
-+void SAL_CALL SwVbaRevisions::RejectAll( ) throw (css::uno::RuntimeException)
-+{
-+ throw uno::RuntimeException();
-+}
-+
-+rtl::OUString&
-+SwVbaRevisions::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaRevisions") );
-+ return sImplName;
-+}
-+
-+css::uno::Sequence<rtl::OUString>
-+SwVbaRevisions::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Revisions") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbarevisions.hxx sw/source/ui/vba/vbarevisions.hxx
-new file mode 100644
-index 0000000..88db794
---- /dev/null
-+++ sw/source/ui/vba/vbarevisions.hxx
-@@ -0,0 +1,66 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_PANES_HXX
-+#define SW_VBA_PANES_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XRevisions.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/text/XTextRange.hpp>
-+
-+
-+typedef CollTestImplHelper< ooo::vba::word::XRevisions > SwVbaRevisions_BASE;
-+
-+class SwVbaRevisions : public SwVbaRevisions_BASE
-+{
-+private:
-+ css::uno::Reference< css::frame::XModel > mxModel;
-+
-+public:
-+ SwVbaRevisions( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XTextRange >& xTextRange );
-+
-+ SwVbaRevisions( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess );
-+ virtual ~SwVbaRevisions() {}
-+
-+ // Methods
-+ virtual void SAL_CALL AcceptAll( ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL RejectAll( ) 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);
-+
-+ // SwVbaRevisions_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* SW_VBA_PANES_HXX */
-diff --git sw/source/ui/vba/vbarow.cxx sw/source/ui/vba/vbarow.cxx
-new file mode 100644
-index 0000000..2f4132b
---- /dev/null
-+++ sw/source/ui/vba/vbarow.cxx
-@@ -0,0 +1,136 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbarow.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include <com/sun/star/table/XCellRange.hpp>
-+#include <com/sun/star/view/XSelectionSupplier.hpp>
-+#include <ooo/vba/word/WdRowHeightRule.hpp>
-+#include <ooo/vba/word/WdConstants.hpp>
-+#include <rtl/ustrbuf.hxx>
-+#include "wordvbahelper.hxx"
-+#include "vbatablehelper.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaRow::SwVbaRow( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext,const uno::Reference< text::XTextTable >& xTextTable, sal_Int32 nIndex ) throw ( uno::RuntimeException ) :
-+ SwVbaRow_BASE( rParent, rContext ), mxTextTable( xTextTable ), mnIndex( nIndex )
-+{
-+ mxTableRows = mxTextTable->getRows();
-+ mxRowProps.set( mxTableRows->getByIndex( mnIndex ), uno::UNO_QUERY_THROW );
-+}
-+
-+SwVbaRow::~SwVbaRow()
-+{
-+}
-+
-+uno::Any SAL_CALL SwVbaRow::getHeight() throw (css::uno::RuntimeException)
-+{
-+ if( getHeightRule() == word::WdRowHeightRule::wdRowHeightAuto )
-+ return uno::makeAny( sal_Int32( word::WdConstants::wdUndefined ) );
-+
-+ sal_Int32 nHeight = 0;
-+ mxRowProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Height") ) ) >>= nHeight;
-+ return uno::makeAny( (float)Millimeter::getInPoints( nHeight ) );
-+}
-+
-+void SAL_CALL SwVbaRow::setHeight( const uno::Any& _height ) throw (css::uno::RuntimeException)
-+{
-+ float height = 0;
-+ _height >>= height;
-+
-+ sal_Int32 nHeight = Millimeter::getInHundredthsOfOneMillimeter( height );
-+ mxRowProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Height") ), uno::makeAny( nHeight ) );
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaRow::getHeightRule() throw (css::uno::RuntimeException)
-+{
-+ sal_Bool isAutoHeight = sal_False;
-+ mxRowProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsAutoHeight") ) ) >>= isAutoHeight;
-+ return isAutoHeight ? word::WdRowHeightRule::wdRowHeightAuto : word::WdRowHeightRule::wdRowHeightExactly;
-+}
-+
-+void SAL_CALL SwVbaRow::setHeightRule( ::sal_Int32 _heightrule ) throw (css::uno::RuntimeException)
-+{
-+ sal_Bool isAutoHeight = ( _heightrule == word::WdRowHeightRule::wdRowHeightAuto );
-+ mxRowProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsAutoHeight") ), uno::makeAny( isAutoHeight ) );
-+}
-+
-+void SAL_CALL
-+SwVbaRow::Select( ) throw ( uno::RuntimeException )
-+{
-+ SelectRow( getCurrentWordDoc(mxContext), mxTextTable, mnIndex, mnIndex );
-+}
-+
-+void SwVbaRow::SelectRow( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XTextTable >& xTextTable, sal_Int32 nStartRow, sal_Int32 nEndRow ) throw ( uno::RuntimeException )
-+{
-+ rtl::OUStringBuffer aRangeName;
-+ aRangeName.appendAscii("A").append(sal_Int32( nStartRow + 1 ) );
-+ SwVbaTableHelper aTableHelper( xTextTable );
-+ sal_Int32 nColCount = aTableHelper.getTabColumnsCount( nEndRow );
-+ // FIXME: the column count > 26
-+ //sal_Char cCol = 'A' + nColCount - 1;
-+ rtl::OUString sCol = aTableHelper.getColumnStr( nColCount - 1);
-+ aRangeName.appendAscii(":").append( sCol ).append( sal_Int32( nEndRow + 1 ) );
-+
-+ uno::Reference< table::XCellRange > xCellRange( xTextTable, uno::UNO_QUERY_THROW );
-+ rtl::OUString sSelRange = aRangeName.makeStringAndClear();
-+ uno::Reference< table::XCellRange > xSelRange = xCellRange->getCellRangeByName( sSelRange );
-+
-+ uno::Reference< view::XSelectionSupplier > xSelection( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
-+ xSelection->select( uno::makeAny( xSelRange ) );
-+}
-+
-+void SAL_CALL SwVbaRow::SetHeight( float height, sal_Int32 heightrule ) throw (css::uno::RuntimeException)
-+{
-+ setHeightRule( heightrule );
-+ setHeight( uno::makeAny( height ) );
-+}
-+
-+rtl::OUString&
-+SwVbaRow::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaRow") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaRow::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Row" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbarow.hxx sw/source/ui/vba/vbarow.hxx
-new file mode 100644
-index 0000000..cfbfb4d
---- /dev/null
-+++ sw/source/ui/vba/vbarow.hxx
-@@ -0,0 +1,69 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_ROW_HXX
-+#define SW_VBA_ROW_HXX
-+
-+#include <ooo/vba/word/XRow.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/table/XTableRows.hpp>
-+#include <com/sun/star/text/XTextTable.hpp>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XRow > SwVbaRow_BASE;
-+
-+class SwVbaRow : public SwVbaRow_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XTextTable > mxTextTable;
-+ css::uno::Reference< css::table::XTableRows > mxTableRows;
-+ css::uno::Reference< css::beans::XPropertySet > mxRowProps;
-+ sal_Int32 mnIndex;
-+
-+public:
-+ SwVbaRow( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextTable >& xTextTable, sal_Int32 nIndex ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaRow();
-+
-+ // Attributes
-+ virtual css::uno::Any SAL_CALL getHeight() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setHeight( const css::uno::Any& _height ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getHeightRule() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setHeightRule( ::sal_Int32 _heightrule ) throw (css::uno::RuntimeException);
-+
-+ // Methods
-+ virtual void SAL_CALL Select( ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL SetHeight( float height, sal_Int32 heightrule ) throw (css::uno::RuntimeException);
-+
-+ static void SelectRow( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XTextTable >& xTextTable, sal_Int32 nStartRow, sal_Int32 nEndRow ) throw (css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_ROW_HXX */
-diff --git sw/source/ui/vba/vbarows.cxx sw/source/ui/vba/vbarows.cxx
-new file mode 100644
-index 0000000..875e024
---- /dev/null
-+++ sw/source/ui/vba/vbarows.cxx
-@@ -0,0 +1,368 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbarows.hxx"
-+#include "vbarow.hxx"
-+#include <com/sun/star/text/HoriOrientation.hpp>
-+#include <com/sun/star/table/XCellRange.hpp>
-+#include <ooo/vba/word/WdRowAlignment.hpp>
-+#include <ooo/vba/word/WdConstants.hpp>
-+#include <ooo/vba/word/WdRulerStyle.hpp>
-+#include "wordvbahelper.hxx"
-+#include "vbacolumns.hxx"
-+#include "vbatablehelper.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+class RowsEnumWrapper : public EnumerationHelper_BASE
-+{
-+ uno::Reference< text::XTextTable > mxTextTable;
-+ uno::Reference< container::XIndexAccess > mxIndexAccess;
-+ uno::WeakReference< XHelperInterface > mxParent;
-+ uno::Reference< uno::XComponentContext > mxContext;
-+ sal_Int32 nIndex;
-+
-+public:
-+ RowsEnumWrapper( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< text::XTextTable >& xTextTable ) : mxParent( xParent ), mxContext( xContext ), mxTextTable( xTextTable ), nIndex( 0 )
-+ {
-+ mxIndexAccess.set( mxTextTable->getRows(), uno::UNO_QUERY );
-+ }
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( nIndex < mxIndexAccess->getCount() );
-+ }
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if( nIndex < mxIndexAccess->getCount() )
-+ {
-+ return uno::makeAny( uno::Reference< word::XRow > ( new SwVbaRow( mxParent, mxContext, mxTextTable, nIndex++ ) ) );
-+ }
-+ throw container::NoSuchElementException();
-+ }
-+};
-+
-+SwVbaRows::SwVbaRows( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextTable >& xTextTable, const uno::Reference< table::XTableRows >& xTableRows ) throw (uno::RuntimeException) : SwVbaRows_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( xTableRows, uno::UNO_QUERY_THROW ) ), mxTextTable( xTextTable ), mxTableRows( xTableRows )
-+{
-+ mnStartRowIndex = 0;
-+ mnEndRowIndex = m_xIndexAccess->getCount() - 1;
-+}
-+
-+SwVbaRows::SwVbaRows( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextTable >& xTextTable, const uno::Reference< table::XTableRows >& xTableRows, sal_Int32 nStarIndex, sal_Int32 nEndIndex ) throw (uno::RuntimeException) : SwVbaRows_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( xTableRows, uno::UNO_QUERY_THROW ) ), mxTextTable( xTextTable ), mxTableRows( xTableRows ), mnStartRowIndex( nStarIndex ), mnEndRowIndex( nEndIndex )
-+{
-+ if( mnEndRowIndex < mnStartRowIndex )
-+ throw uno::RuntimeException();
-+}
-+
-+/**
-+ * get the alignment of the rows: SO format com.sun.star.text.HoriOrientation
-+ * is mapped to WdRowAlignment in Word
-+ * @return the alignment
-+ */
-+::sal_Int32 SAL_CALL SwVbaRows::getAlignment() throw (uno::RuntimeException)
-+{
-+ sal_Int16 nAlignment = text::HoriOrientation::LEFT;
-+ uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, uno::UNO_QUERY_THROW );
-+ xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HoriOrient") ) ) >>= nAlignment;
-+ sal_Int32 nRet = 0;
-+ switch( nAlignment )
-+ {
-+ case text::HoriOrientation::CENTER:
-+ {
-+ nRet = word::WdRowAlignment::wdAlignRowCenter;
-+ break;
-+ }
-+ case text::HoriOrientation::RIGHT:
-+ {
-+ nRet = word::WdRowAlignment::wdAlignRowRight;
-+ break;
-+ }
-+ default:
-+ {
-+ nRet = word::WdRowAlignment::wdAlignRowLeft;
-+ }
-+ }
-+ return nRet;
-+}
-+
-+void SAL_CALL SwVbaRows::setAlignment( ::sal_Int32 _alignment ) throw (uno::RuntimeException)
-+{
-+ sal_Int16 nAlignment = text::HoriOrientation::LEFT;
-+ switch( _alignment )
-+ {
-+ case word::WdRowAlignment::wdAlignRowCenter:
-+ {
-+ nAlignment = text::HoriOrientation::CENTER;
-+ break;
-+ }
-+ case word::WdRowAlignment::wdAlignRowRight:
-+ {
-+ nAlignment = text::HoriOrientation::RIGHT;
-+ break;
-+ }
-+ default:
-+ {
-+ nAlignment = text::HoriOrientation::LEFT;
-+ }
-+ }
-+ uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, uno::UNO_QUERY_THROW );
-+ xTableProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HoriOrient") ), uno::makeAny( nAlignment ) );
-+}
-+
-+uno::Any SAL_CALL SwVbaRows::getAllowBreakAcrossPages() throw (uno::RuntimeException)
-+{
-+ sal_Bool bAllowBreak = sal_False;
-+ uno::Reference< container::XIndexAccess > xRowsAccess( mxTableRows, uno::UNO_QUERY_THROW );
-+ for( sal_Int32 index = mnStartRowIndex; index <= mnEndRowIndex; ++index )
-+ {
-+ uno::Reference< beans::XPropertySet > xRowProps( xRowsAccess->getByIndex( index ), uno::UNO_QUERY_THROW );
-+ sal_Bool bSplit = sal_False;
-+ xRowProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsSplitAllowed") ) ) >>= bSplit;
-+ if( index == 0 )
-+ {
-+ bAllowBreak = bSplit;
-+ }
-+ if( bSplit != bAllowBreak )
-+ {
-+ sal_Int32 nRet = word::WdConstants::wdUndefined;
-+ return uno::makeAny( nRet );
-+ }
-+ }
-+ return uno::makeAny( bAllowBreak );
-+}
-+
-+void SAL_CALL SwVbaRows::setAllowBreakAcrossPages( const uno::Any& _allowbreakacrosspages ) throw (uno::RuntimeException)
-+{
-+ sal_Bool bAllowBreak = sal_False;
-+ _allowbreakacrosspages >>= bAllowBreak;
-+ uno::Reference< container::XIndexAccess > xRowsAccess( mxTableRows, uno::UNO_QUERY_THROW );
-+ for( sal_Int32 index = mnStartRowIndex; index <= mnEndRowIndex; ++index )
-+ {
-+ uno::Reference< beans::XPropertySet > xRowProps( xRowsAccess->getByIndex( index ), uno::UNO_QUERY_THROW );
-+ xRowProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsSplitAllowed") ), uno::makeAny( bAllowBreak ) );
-+ }
-+}
-+
-+float SAL_CALL SwVbaRows::getSpaceBetweenColumns() throw (uno::RuntimeException)
-+{
-+ // just get the first spacing of the first cell
-+ uno::Reference< table::XCellRange > xCellRange( mxTextTable, uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xCellProps( xCellRange->getCellByPosition( 0, mnStartRowIndex ), uno::UNO_QUERY_THROW );
-+ sal_Int32 nLeftBorderDistance = 0;
-+ sal_Int32 nRightBorderDistance = 0;
-+ xCellProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftBorderDistance") ) ) >>= nLeftBorderDistance;
-+ xCellProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightBorderDistance") ) ) >>= nRightBorderDistance;
-+ return static_cast< float >( Millimeter::getInPoints( nLeftBorderDistance + nRightBorderDistance ) );
-+}
-+
-+void SAL_CALL SwVbaRows::setSpaceBetweenColumns( float _spacebetweencolumns ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nSpace = Millimeter::getInHundredthsOfOneMillimeter( _spacebetweencolumns ) / 2;
-+ uno::Reference< container::XIndexAccess > xColumnAccess( mxTextTable->getColumns(), uno::UNO_QUERY_THROW );
-+ uno::Reference< table::XCellRange > xCellRange( mxTextTable, uno::UNO_QUERY_THROW );
-+ SwVbaTableHelper aTableHelper( mxTextTable );
-+ for( sal_Int32 row = mnStartRowIndex; row <= mnEndRowIndex; ++row )
-+ {
-+ sal_Int32 nColumns = aTableHelper.getTabColumnsCount( row );
-+ for( sal_Int32 column = 0; column < nColumns; ++column )
-+ {
-+ uno::Reference< beans::XPropertySet > xCellProps( xCellRange->getCellByPosition( column, row ), uno::UNO_QUERY_THROW );
-+ xCellProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftBorderDistance") ), uno::makeAny( nSpace ) );
-+ xCellProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightBorderDistance") ), uno::makeAny( nSpace ) );
-+ }
-+ }
-+}
-+
-+void SAL_CALL SwVbaRows::Delete( ) throw (uno::RuntimeException)
-+{
-+ mxTableRows->removeByIndex( mnStartRowIndex, getCount() );
-+}
-+
-+void SAL_CALL SwVbaRows::SetLeftIndent( float LeftIndent, ::sal_Int32 RulerStyle ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< word::XColumns > xColumns( new SwVbaColumns( getParent(), mxContext, mxTextTable, mxTextTable->getColumns() ) );
-+ sal_Int32 nIndent = (sal_Int32)( LeftIndent );
-+ switch( RulerStyle )
-+ {
-+ case word::WdRulerStyle::wdAdjustFirstColumn:
-+ {
-+ setIndentWithAdjustFirstColumn( xColumns, nIndent );
-+ break;
-+ }
-+ case word::WdRulerStyle::wdAdjustNone:
-+ {
-+ setIndentWithAdjustNone( nIndent );
-+ break;
-+ }
-+ case word::WdRulerStyle::wdAdjustProportional:
-+ {
-+ setIndentWithAdjustProportional( xColumns, nIndent );
-+ break;
-+ }
-+ case word::WdRulerStyle::wdAdjustSameWidth:
-+ {
-+ setIndentWithAdjustSameWidth( xColumns, nIndent );
-+ break;
-+ }
-+ default:
-+ {
-+ DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
-+ }
-+ }
-+}
-+
-+void SwVbaRows::setIndentWithAdjustNone( sal_Int32 indent ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, uno::UNO_QUERY_THROW );
-+ sal_Int32 nMargin = 0;
-+ xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftMargin") ) ) >>= nMargin;
-+ nMargin += indent;
-+ xTableProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftMargin") ), uno::makeAny( nMargin ) );
-+}
-+
-+ void SwVbaRows::setIndentWithAdjustFirstColumn( const uno::Reference< word::XColumns >& xColumns, sal_Int32 indent ) throw (uno::RuntimeException)
-+ {
-+ sal_Int32 nIndex = 1;
-+ uno::Reference< XCollection > xCol( xColumns, uno::UNO_QUERY_THROW );
-+ uno::Reference< word::XColumn > xColumn( xCol->Item( uno::makeAny( nIndex ), uno::Any() ), uno::UNO_QUERY_THROW );
-+ sal_Int32 nWidth = xColumn->getWidth();
-+ nWidth -= indent;
-+ xColumn->setWidth( nWidth );
-+ setIndentWithAdjustNone( indent );
-+ }
-+
-+ void SwVbaRows::setIndentWithAdjustProportional( const uno::Reference< word::XColumns >& xColumns, sal_Int32 indent ) throw (uno::RuntimeException)
-+ {
-+ // calculate the new width and get the proportion between old and new
-+ uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, uno::UNO_QUERY_THROW );
-+ sal_Int32 nWidth = 0;
-+ xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ) ) >>= nWidth;
-+ sal_Int32 nNewWidth = nWidth - indent;
-+ double propFactor = (double)nNewWidth/(double)nWidth;
-+
-+ // get all columns, calculate and set the new width of the columns
-+ uno::Reference< XCollection > xCol( xColumns, uno::UNO_QUERY_THROW );
-+ sal_Int32 nColCount = xCol->getCount();
-+ for( sal_Int32 i = 0; i < nColCount; i++ )
-+ {
-+ uno::Reference< word::XColumn > xColumn( xCol->Item( uno::makeAny( i ), uno::Any() ), uno::UNO_QUERY_THROW );
-+ sal_Int32 nColWidth = xColumn->getWidth();
-+ sal_Int32 nNewColWidth = ( sal_Int32 )( propFactor * nColWidth );
-+ xColumn->setWidth( nNewColWidth );
-+ }
-+
-+ // set the width and position of the table
-+ setIndentWithAdjustNone( indent );
-+ xTableProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ), uno::makeAny( nNewWidth ) );
-+ }
-+
-+ void SwVbaRows::setIndentWithAdjustSameWidth( const uno::Reference< word::XColumns >& xColumns, sal_Int32 indent ) throw (uno::RuntimeException)
-+ {
-+ // calculate the new width and get the width of all columns
-+ uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, uno::UNO_QUERY_THROW );
-+ sal_Int32 nWidth = 0;
-+ xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ) ) >>= nWidth;
-+ sal_Int32 nNewWidth = nWidth - indent;
-+
-+ // get all columns, calculate and set the new width of the columns
-+ uno::Reference< XCollection > xCol( xColumns, uno::UNO_QUERY_THROW );
-+ sal_Int32 nColCount = xCol->getCount();
-+ sal_Int32 nNewColWidth = (sal_Int32)( double( nNewWidth )/nColCount );
-+ for( sal_Int32 i = 0; i < nColCount; i++ )
-+ {
-+ uno::Reference< word::XColumn > xColumn( xCol->Item( uno::makeAny( i ), uno::Any() ), uno::UNO_QUERY_THROW );
-+ xColumn->setWidth( nNewColWidth );
-+ }
-+
-+ // set the width and position of the table
-+ setIndentWithAdjustNone( indent );
-+ xTableProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ), uno::makeAny( nNewWidth ) );
-+ }
-+
-+void SAL_CALL SwVbaRows::Select( ) throw (uno::RuntimeException)
-+{
-+ SwVbaRow::SelectRow( getCurrentWordDoc(mxContext), mxTextTable, mnStartRowIndex, mnEndRowIndex );
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaRows::getCount() throw (uno::RuntimeException)
-+{
-+ return ( mnEndRowIndex - mnStartRowIndex + 1 );
-+}
-+
-+uno::Any SAL_CALL SwVbaRows::Item( const uno::Any& Index1, const uno::Any& /*not processed in this base class*/ ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nIndex = 0;
-+ if( ( Index1 >>= nIndex ) == sal_True )
-+ {
-+ if( nIndex <= 0 || nIndex > getCount() )
-+ {
-+ throw lang::IndexOutOfBoundsException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Index out of bounds") ), uno::Reference< uno::XInterface >() );
-+ }
-+ return uno::makeAny( uno::Reference< word::XRow >( new SwVbaRow( this, mxContext, mxTextTable, nIndex - 1 ) ) );
-+ }
-+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Index out of bounds") ), uno::Reference< uno::XInterface >() );
-+}
-+
-+// XEnumerationAccess
-+uno::Type
-+SwVbaRows::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XRow::static_type(0);
-+}
-+uno::Reference< container::XEnumeration >
-+SwVbaRows::createEnumeration() throw (uno::RuntimeException)
-+{
-+ return new RowsEnumWrapper( this, mxContext, mxTextTable );
-+}
-+
-+uno::Any
-+SwVbaRows::createCollectionObject( const uno::Any& aSource )
-+{
-+ return aSource;
-+}
-+
-+rtl::OUString&
-+SwVbaRows::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaRows") );
-+ return sImplName;
-+}
-+
-+uno::Sequence<rtl::OUString>
-+SwVbaRows::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Rows") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbarows.hxx sw/source/ui/vba/vbarows.hxx
-new file mode 100644
-index 0000000..ccff1ef
---- /dev/null
-+++ sw/source/ui/vba/vbarows.hxx
-@@ -0,0 +1,87 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_ROWS_HXX
-+#define SW_VBA_ROWS_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XRows.hpp>
-+#include <ooo/vba/word/XColumns.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/table/XTableRows.hpp>
-+#include <com/sun/star/text/XTextTable.hpp>
-+
-+typedef CollTestImplHelper< ooo::vba::word::XRows > SwVbaRows_BASE;
-+
-+class SwVbaRows : public SwVbaRows_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XTextTable > mxTextTable;
-+ css::uno::Reference< css::table::XTableRows > mxTableRows;
-+ sal_Int32 mnStartRowIndex;
-+ sal_Int32 mnEndRowIndex;
-+
-+private:
-+ void setIndentWithAdjustNone( sal_Int32 indent ) throw (css::uno::RuntimeException);
-+ void setIndentWithAdjustFirstColumn( const css::uno::Reference< ooo::vba::word::XColumns >& xColumns, sal_Int32 indent ) throw (css::uno::RuntimeException);
-+ void setIndentWithAdjustProportional( const css::uno::Reference< ooo::vba::word::XColumns >& xColumns, sal_Int32 indent ) throw (css::uno::RuntimeException);
-+ void setIndentWithAdjustSameWidth( const css::uno::Reference< ooo::vba::word::XColumns >& xColumns, sal_Int32 indent ) throw (css::uno::RuntimeException);
-+
-+public:
-+ SwVbaRows( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::text::XTextTable >& xTextTable, const css::uno::Reference< css::table::XTableRows >& xTableRows ) throw ( css::uno::RuntimeException );
-+ SwVbaRows( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::text::XTextTable >& xTextTable, const css::uno::Reference< css::table::XTableRows >& xTableRows, sal_Int32 nStarIndex, sal_Int32 nEndIndex ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaRows() {}
-+
-+ // Attributes
-+ virtual ::sal_Int32 SAL_CALL getAlignment() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setAlignment( ::sal_Int32 _alignment ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL getAllowBreakAcrossPages() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setAllowBreakAcrossPages( const css::uno::Any& _allowbreakacrosspages ) throw (css::uno::RuntimeException);
-+ virtual float SAL_CALL getSpaceBetweenColumns() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setSpaceBetweenColumns( float _spacebetweencolumns ) throw (css::uno::RuntimeException);
-+
-+ // Methods
-+ virtual void SAL_CALL Delete( ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL SetLeftIndent( float LeftIndent, ::sal_Int32 RulerStyle ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL Select( ) throw (css::uno::RuntimeException);
-+
-+ //XCollection
-+ virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException);
-+ 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 );
-+ // 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);
-+
-+ // SwVbaRows_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* SW_VBA_ROWS_HXX */
-diff --git sw/source/ui/vba/vbasection.cxx sw/source/ui/vba/vbasection.cxx
-index c30058a..1a61e10 100644
---- sw/source/ui/vba/vbasection.cxx
-+++ sw/source/ui/vba/vbasection.cxx
-@@ -31,6 +31,7 @@
- #include <vbahelper/vbahelper.hxx>
- #include <tools/diagnose_ex.h>
- #include "vbapagesetup.hxx"
-+#include "vbaheadersfooters.hxx"
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-@@ -53,14 +54,20 @@ void SAL_CALL SwVbaSection::setProtectedForForms( ::sal_Bool /*_protectedforform
- {
- }
-
--uno::Any SAL_CALL SwVbaSection::Headers( ) throw (uno::RuntimeException)
-+uno::Any SAL_CALL SwVbaSection::Headers( const uno::Any& index ) throw (uno::RuntimeException)
- {
-- return uno::Any();
-+ uno::Reference< XCollection > xCol( new SwVbaHeadersFooters( this, mxContext, mxModel, mxPageProps, sal_True ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
- }
-
--uno::Any SAL_CALL SwVbaSection::Footers( ) throw (uno::RuntimeException)
-+uno::Any SAL_CALL SwVbaSection::Footers( const uno::Any& index ) throw (uno::RuntimeException)
- {
-- return uno::Any();
-+ uno::Reference< XCollection > xCol( new SwVbaHeadersFooters( this, mxContext, mxModel, mxPageProps, sal_False ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
- }
-
- uno::Any SAL_CALL
-diff --git sw/source/ui/vba/vbasection.hxx sw/source/ui/vba/vbasection.hxx
-index 92a65f3..f30f5ad 100644
---- sw/source/ui/vba/vbasection.hxx
-+++ sw/source/ui/vba/vbasection.hxx
-@@ -51,8 +51,8 @@ public:
- virtual void SAL_CALL setProtectedForForms( ::sal_Bool _protectedforforms ) throw (css::uno::RuntimeException);
-
- // Methods
-- virtual css::uno::Any SAL_CALL Headers( ) throw (css::uno::RuntimeException);
-- virtual css::uno::Any SAL_CALL Footers( ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Headers( const css::uno::Any& index ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Footers( const css::uno::Any& index ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL PageSetup( ) throw (css::uno::RuntimeException);
-
- // XHelperInterface
-diff --git sw/source/ui/vba/vbasections.cxx sw/source/ui/vba/vbasections.cxx
-index 8fca880..0223efe 100644
---- sw/source/ui/vba/vbasections.cxx
-+++ sw/source/ui/vba/vbasections.cxx
-@@ -90,6 +90,15 @@ public:
- }
- }
-
-+ SectionCollectionHelper( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XTextRange >& xTextRange ) throw (uno::RuntimeException) : mxParent( xParent ), mxContext( xContext ), mxModel( xModel )
-+ {
-+ // Hacky implementation of Range.Sections, only support 1 secction
-+ uno::Reference< beans::XPropertySet > xRangeProps( xTextRange, uno::UNO_QUERY_THROW );
-+ uno::Reference< style::XStyle > xStyle = word::getCurrentPageStyle( mxModel, xRangeProps );
-+ uno::Reference< beans::XPropertySet > xPageProps( xStyle, uno::UNO_QUERY_THROW );
-+ mxSections.push_back( xPageProps );
-+ }
-+
- ~SectionCollectionHelper(){}
-
- // XIndexAccess
-@@ -138,6 +147,10 @@ SwVbaSections::SwVbaSections( const uno::Reference< XHelperInterface >& xParent,
- {
- }
-
-+SwVbaSections::SwVbaSections( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XTextRange >& xTextRange ): SwVbaSections_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new SectionCollectionHelper( xParent, xContext, xModel, xTextRange ) ) ), mxModel( xModel )
-+{
-+}
-+
- uno::Any SAL_CALL
- SwVbaSections::PageSetup( ) throw (uno::RuntimeException)
- {
-diff --git sw/source/ui/vba/vbasections.hxx sw/source/ui/vba/vbasections.hxx
-index 1ff9e9e..29e8ce4 100644
---- sw/source/ui/vba/vbasections.hxx
-+++ sw/source/ui/vba/vbasections.hxx
-@@ -34,6 +34,7 @@
- #include <ooo/vba/word/XSections.hpp>
- #include <com/sun/star/container/XEnumerationAccess.hpp>
- #include <com/sun/star/container/XIndexAccess.hpp>
-+#include <com/sun/star/text/XTextRange.hpp>
- #include <vbahelper/vbahelperinterface.hxx>
-
- typedef CollTestImplHelper< ooo::vba::word::XSections > SwVbaSections_BASE;
-@@ -45,6 +46,7 @@ private:
-
- public:
- SwVbaSections( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel );
-+ SwVbaSections( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XTextRange >& xTextRange );
- virtual ~SwVbaSections() {}
-
- // XEnumerationAccess
-diff --git sw/source/ui/vba/vbaselection.cxx sw/source/ui/vba/vbaselection.cxx
-index e510dd8..1a74d5c 100644
---- sw/source/ui/vba/vbaselection.cxx
-+++ sw/source/ui/vba/vbaselection.cxx
-@@ -32,7 +32,6 @@
- #include <tools/diagnose_ex.h>
- #include "vbarange.hxx"
- #include "vbafind.hxx"
--#include "wordvbahelper.hxx"
- #include <com/sun/star/text/XTextRange.hpp>
- #include <com/sun/star/text/XTextTable.hpp>
- #include <com/sun/star/text/XTextTableCursor.hpp>
-@@ -44,14 +43,19 @@
- #include <ooo/vba/word/WdGoToDirection.hpp>
- #include <ooo/vba/word/XBookmark.hpp>
- #include <ooo/vba/word/XApplication.hpp>
-+#include <ooo/vba/word/WdCollapseDirection.hpp>
- #include <com/sun/star/text/XPageCursor.hpp>
- #include "unotbl.hxx"
- #include "unocoll.hxx"
- #include "vbatable.hxx"
- #include <com/sun/star/view/XSelectionSupplier.hpp>
- #include <com/sun/star/view/XViewCursor.hpp>
-+#include <com/sun/star/view/XLineCursor.hpp>
-+#include <com/sun/star/text/XWordCursor.hpp>
-+#include <com/sun/star/text/XParagraphCursor.hpp>
- #include <ooo/vba/word/WdInformation.hpp>
- #include <ooo/vba/word/WdHeaderFooterIndex.hpp>
-+#include <ooo/vba/word/WdSeekView.hpp>
- #include "vbainformationhelper.hxx"
- #include "vbafield.hxx"
- #include "vbaheaderfooter.hxx"
-@@ -59,6 +63,17 @@
- #include <vbahelper/vbashaperange.hxx>
- #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
- #include <com/sun/star/drawing/XDrawPage.hpp>
-+#include <com/sun/star/text/ControlCharacter.hpp>
-+#include "vbarows.hxx"
-+#include "vbacolumns.hxx"
-+#include "vbatablehelper.hxx"
-+#include "vbacells.hxx"
-+#include "vbaview.hxx"
-+#include "vbaparagraph.hxx"
-+#include "vbastyle.hxx"
-+#include <docsh.hxx>
-+#include <tblenum.hxx>
-+#include <fesh.hxx>
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-@@ -126,23 +141,25 @@ SwVbaSelection::HomeKey( const uno::Any& _unit, const uno::Any& _extend ) throw
- sal_Int32 nExtend = word::WdMovementType::wdMove;
- _unit >>= nUnit;
- _extend >>= nExtend;
-+ sal_Bool bExtend = ( nExtend == word::WdMovementType::wdExtend ) ? sal_True : sal_False;
-
- switch( nUnit )
- {
- case word::WdUnits::wdStory:
- {
-+ // go to the valid text first so that the current view cursor is valid to call gotoRange.
-+ word::gotoSelectedObjectAnchor(mxModel);
- // go to the begin of the document
-- rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToStartOfDoc"));
-- dispatchRequests( mxModel,url );
-- // If something is selected, it needs to go twice
-- dispatchRequests( mxModel,url );
-+ uno::Reference< text::XText > xCurrentText = word::getCurrentXText( mxModel );
-+ uno::Reference< text::XTextRange > xFirstRange = word::getFirstObjectPosition( xCurrentText );
-+ mxTextViewCursor->gotoRange( xFirstRange, bExtend );
- break;
- }
- case word::WdUnits::wdLine:
- {
- // go to the begin of the Line
-- rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToStartOfLine"));
-- dispatchRequests( mxModel,url );
-+ uno::Reference< view::XLineCursor > xLineCursor( mxTextViewCursor, uno::UNO_QUERY_THROW );
-+ xLineCursor->gotoStartOfLine( bExtend );
- break;
- }
- default:
-@@ -160,23 +177,25 @@ SwVbaSelection::EndKey( const uno::Any& _unit, const uno::Any& _extend ) throw (
- sal_Int32 nExtend = word::WdMovementType::wdMove;
- _unit >>= nUnit;
- _extend >>= nExtend;
-+ sal_Bool bExtend = ( nExtend == word::WdMovementType::wdExtend ) ? sal_True : sal_False;
-
- switch( nUnit )
- {
- case word::WdUnits::wdStory:
- {
-- // go to the end of the document
-- rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToEndOfDoc"));
-- dispatchRequests( mxModel,url );
-- // If something is selected, it needs to go twice
-- dispatchRequests( mxModel,url );
-+ // go to the valid text first so that the current view cursor is valid to call gotoRange.
-+ word::gotoSelectedObjectAnchor(mxModel);
-+ // go to the end of the document
-+ uno::Reference< text::XText > xCurrentText = word::getCurrentXText( mxModel );
-+ uno::Reference< text::XTextRange > xEnd = xCurrentText->getEnd();
-+ mxTextViewCursor->gotoRange( xEnd, bExtend );
- break;
- }
- case word::WdUnits::wdLine:
- {
- // go to the end of the Line
-- rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToEndOfLine"));
-- dispatchRequests( mxModel,url );
-+ uno::Reference< view::XLineCursor > xLineCursor( mxTextViewCursor, uno::UNO_QUERY_THROW );
-+ xLineCursor->gotoEndOfLine( bExtend );
- break;
- }
- default:
-@@ -188,14 +207,161 @@ SwVbaSelection::EndKey( const uno::Any& _unit, const uno::Any& _extend ) throw (
- }
-
- void SAL_CALL
--SwVbaSelection::Delete( const uno::Any& /*_unit*/, const uno::Any& /*_count*/ ) throw ( uno::RuntimeException )
-+SwVbaSelection::Delete( const uno::Any& _unit, const uno::Any& _count ) throw ( uno::RuntimeException )
- {
-- // FIXME: handle the arguments: _unit and _count
-+ sal_Int32 nUnit = word::WdUnits::wdLine;
-+ sal_Int32 nCount = 0;
-+ if( _count.hasValue() )
-+ _count >>= nCount;
-+ if( _unit.hasValue() && ( nCount > 0 ) )
-+ {
-+ _unit >>= nUnit;
-+ switch( nUnit )
-+ {
-+ case word::WdUnits::wdCharacter:
-+ {
-+ if( HasSelection() )
-+ nCount--;
-+ mxTextViewCursor->goRight( nCount, sal_True );
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+ }
-+ }
- rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Delete"));
- dispatchRequests( mxModel,url );
- }
-
--void SwVbaSelection::NextCell( sal_Int32 nCount, E_DIRECTION eDirection ) throw ( uno::RuntimeException )
-+void
-+SwVbaSelection::Move( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend, word::E_DIRECTION eDirection ) throw ( uno::RuntimeException )
-+{
-+ sal_Int32 nUnit = word::WdUnits::wdCharacter;
-+ sal_Int32 nCount = 1;
-+ sal_Int32 nExtend = word::WdMovementType::wdMove;
-+
-+ if( _unit.hasValue() )
-+ _unit >>= nUnit;
-+ if( _count.hasValue() )
-+ _count >>= nCount;
-+ if( _extend.hasValue() )
-+ _extend >>= nExtend;
-+
-+ if( nCount == 0 )
-+ return;
-+
-+ sal_Bool bExpand = ( nExtend == word::WdMovementType::wdMove ) ? sal_False : sal_True;
-+
-+ switch( nUnit )
-+ {
-+ case word::WdUnits::wdCell:
-+ {
-+ if( nExtend == word::WdMovementType::wdExtend )
-+ {
-+ DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
-+ return;
-+ }
-+ NextCell( nCount, eDirection );
-+ break;
-+ }
-+ case word::WdUnits::wdLine:
-+ {
-+ if( eDirection == word::MOVE_LEFT || eDirection == word::MOVE_RIGHT )
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+ uno::Reference< view::XViewCursor > xViewCursor( mxTextViewCursor, uno::UNO_QUERY_THROW );
-+ if( eDirection == word::MOVE_UP )
-+ xViewCursor->goUp( nCount, bExpand );
-+ else if( eDirection == word::MOVE_DOWN )
-+ xViewCursor->goDown( nCount, bExpand );
-+ break;
-+ }
-+ case word::WdUnits::wdCharacter:
-+ {
-+ if( eDirection == word::MOVE_UP || eDirection == word::MOVE_DOWN )
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+ if( word::gotoSelectedObjectAnchor( mxModel ) )
-+ {
-+ nCount--;
-+ }
-+ uno::Reference< view::XViewCursor > xViewCursor( mxTextViewCursor, uno::UNO_QUERY_THROW );
-+ if( eDirection == word::MOVE_LEFT )
-+ {
-+ // if current select is a cellrange or table,
-+ // the first count of move should move to the first selected cell.
-+ uno::Reference< text::XTextTableCursor > xTextTableCursor( mxModel->getCurrentSelection(), uno::UNO_QUERY );
-+ if ( xTextTableCursor.is() )
-+ {
-+ uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextTable > xTextTable;
-+ xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ) >>= xTextTable;
-+ if( xTextTable.is() )
-+ {
-+ uno::Reference< text::XTextRange > xRange( xTextTable->getCellByName( xTextTableCursor->getRangeName()), uno::UNO_QUERY_THROW );
-+ mxTextViewCursor->gotoRange( xRange->getStart(), bExpand );
-+ nCount--;
-+ }
-+ }
-+ xViewCursor->goLeft( nCount, bExpand );
-+ }
-+ else if( eDirection == word::MOVE_RIGHT )
-+ xViewCursor->goRight( nCount, bExpand );
-+ break;
-+ }
-+ case word::WdUnits::wdWord:
-+ case word::WdUnits::wdParagraph:
-+ {
-+ uno::Reference< text::XTextRange > xRange = GetSelectedRange();
-+ uno::Reference< text::XText > xText = xRange->getText();
-+ uno::Reference< text::XTextCursor > xTextCursor = xText->createTextCursorByRange( xRange );
-+ if( nUnit == word::WdUnits::wdParagraph )
-+ {
-+ if( eDirection == word::MOVE_LEFT || eDirection == word::MOVE_RIGHT )
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+ uno::Reference< text::XParagraphCursor > xParagraphCursor( xTextCursor, uno::UNO_QUERY_THROW );
-+ for( sal_Int32 i=0; i<nCount; i++ )
-+ {
-+ if( ( eDirection == word::MOVE_UP ) && ( xParagraphCursor->gotoPreviousParagraph( bExpand ) == sal_False ) )
-+ break;
-+ else if( ( eDirection == word::MOVE_DOWN ) && ( xParagraphCursor->gotoNextParagraph( bExpand ) == sal_False ) )
-+ break;
-+ }
-+ }
-+ else if( nUnit == word::WdUnits::wdWord )
-+ {
-+ if( eDirection == word::MOVE_UP || eDirection == word::MOVE_DOWN )
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+ uno::Reference< text::XWordCursor > xWordCursor( xTextCursor, uno::UNO_QUERY_THROW );
-+ for( sal_Int32 i=0; i<nCount; i++ )
-+ {
-+ if( (eDirection == word::MOVE_LEFT ) && ( xWordCursor->gotoPreviousWord( bExpand ) == sal_False ) )
-+ break;
-+ else if( ( eDirection == word::MOVE_RIGHT ) && ( xWordCursor->gotoNextWord( bExpand ) == sal_False ) )
-+ break;
-+ }
-+ }
-+ mxTextViewCursor->gotoRange( xTextCursor->getStart(), sal_False );
-+ mxTextViewCursor->gotoRange( xTextCursor->getEnd(), sal_True );
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ break;
-+ }
-+ }
-+}
-+
-+void SwVbaSelection::NextCell( sal_Int32 nCount, word::E_DIRECTION eDirection ) throw ( uno::RuntimeException )
- {
- uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
- uno::Reference< text::XTextTable > xTextTable;
-@@ -214,22 +380,22 @@ void SwVbaSelection::NextCell( sal_Int32 nCount, E_DIRECTION eDirection ) throw
- // move the table cursor
- switch( eDirection )
- {
-- case MOVE_LEFT:
-+ case word::MOVE_LEFT:
- {
- xTextTableCursor->goLeft( nCount, sal_False );
- break;
- }
-- case MOVE_RIGHT:
-+ case word::MOVE_RIGHT:
- {
- xTextTableCursor->goRight( nCount, sal_False );
- break;
- }
-- case MOVE_UP:
-+ case word::MOVE_UP:
- {
- xTextTableCursor->goUp( nCount, sal_False );
- break;
- }
-- case MOVE_DOWN:
-+ case word::MOVE_DOWN:
- {
- xTextTableCursor->goDown( nCount, sal_False );
- break;
-@@ -248,61 +414,29 @@ void SwVbaSelection::NextCell( sal_Int32 nCount, E_DIRECTION eDirection ) throw
- void SAL_CALL
- SwVbaSelection::MoveRight( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend ) throw ( uno::RuntimeException )
- {
-- sal_Int32 nUnit = word::WdUnits::wdCharacter;
- sal_Int32 nCount = 1;
-- sal_Int32 nExtend = word::WdMovementType::wdMove;
-
-- if( _unit.hasValue() )
-- _unit >>= nUnit;
- if( _count.hasValue() )
- _count >>= nCount;
-- if( _extend.hasValue() )
-- _extend >>= nExtend;
-
- if( nCount == 0 )
- return;
-
- if( nCount < 0 )
- {
-- // TODO: call MoveLeft;
- MoveLeft( _unit, uno::makeAny( -nCount ), _extend );
- return;
- }
--
-- switch( nUnit )
-- {
-- case word::WdUnits::wdCell:
-- {
-- if( nExtend == word::WdMovementType::wdExtend )
-- {
-- DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
-- return;
-- }
-- NextCell( nCount, MOVE_RIGHT );
-- break;
-- }
-- default:
-- {
-- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-- break;
-- }
-- }
-
-+ Move( _unit, _count, _extend, word::MOVE_RIGHT );
- }
-
- void SAL_CALL
- SwVbaSelection::MoveLeft( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend ) throw ( uno::RuntimeException )
- {
-- sal_Int32 nUnit = word::WdUnits::wdCharacter;
- sal_Int32 nCount = 1;
-- sal_Int32 nExtend = word::WdMovementType::wdMove;
--
-- if( _unit.hasValue() )
-- _unit >>= nUnit;
- if( _count.hasValue() )
- _count >>= nCount;
-- if( _extend.hasValue() )
-- _extend >>= nExtend;
-
- if( nCount == 0 )
- return;
-@@ -313,67 +447,47 @@ SwVbaSelection::MoveLeft( const uno::Any& _unit, const uno::Any& _count, const u
- return;
- }
-
-- switch( nUnit )
-- {
-- case word::WdUnits::wdCell:
-- {
-- if( nExtend == word::WdMovementType::wdExtend )
-- {
-- DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
-- return;
-- }
-- NextCell( nCount, MOVE_LEFT );
-- break;
-- }
-- default:
-- {
-- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-- break;
-- }
-- }
--
-+ Move( _unit, _count, _extend, word::MOVE_LEFT );
- }
-
- void SAL_CALL
- SwVbaSelection::MoveDown( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend ) throw ( uno::RuntimeException )
- {
-- sal_Int32 nUnit = word::WdUnits::wdCharacter;
- sal_Int32 nCount = 1;
-- sal_Int32 nExtend = word::WdMovementType::wdMove;
-
-- if( _unit.hasValue() )
-- _unit >>= nUnit;
- if( _count.hasValue() )
- _count >>= nCount;
-- if( _extend.hasValue() )
-- _extend >>= nExtend;
-
- if( nCount == 0 )
- return;
-
- if( nCount < 0 )
- {
-- // TODO: call MoveLeft;
-- //MoveUp( _unit, uno::makeAny( -nCount ), _extend );
-+ MoveUp( _unit, uno::makeAny( -nCount ), _extend );
- return;
- }
-
-- switch( nUnit )
-+ Move( _unit, _count, _extend, word::MOVE_DOWN );
-+}
-+
-+void SAL_CALL
-+SwVbaSelection::MoveUp( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend ) throw ( uno::RuntimeException )
-+{
-+ sal_Int32 nCount = 1;
-+
-+ if( _count.hasValue() )
-+ _count >>= nCount;
-+
-+ if( nCount == 0 )
-+ return;
-+
-+ if( nCount < 0 )
- {
-- case word::WdUnits::wdLine:
-- {
-- uno::Reference< view::XViewCursor > xViewCursor( mxTextViewCursor, uno::UNO_QUERY_THROW );
-- sal_Bool bExpand = ( nExtend == word::WdMovementType::wdMove ) ? sal_False : sal_True;
-- xViewCursor->goDown( nCount, bExpand );
-- break;
-- }
-- default:
-- {
-- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-- break;
-- }
-+ MoveDown( _unit, uno::makeAny( -nCount ), _extend );
-+ return;
- }
--
-+
-+ Move( _unit, _count, _extend, word::MOVE_UP );
- }
-
- void SAL_CALL
-@@ -425,16 +539,17 @@ SwVbaSelection::getFind() throw ( uno::RuntimeException )
- return uno::Reference< word::XFind >( new SwVbaFind( this, mxContext, mxModel, xTextRange ) );
- }
-
--uno::Reference< word::XStyle > SAL_CALL
-+uno::Any SAL_CALL
- SwVbaSelection::getStyle() throw ( uno::RuntimeException )
- {
- return getRange()->getStyle();
- }
-
- void SAL_CALL
--SwVbaSelection::setStyle( const uno::Reference< word::XStyle >& rStyle ) throw ( uno::RuntimeException )
-+SwVbaSelection::setStyle( const uno::Any& rStyle ) throw ( uno::RuntimeException )
- {
-- return getRange()->setStyle( rStyle );
-+ uno::Reference< beans::XPropertySet > xParaProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
-+ return SwVbaStyle::setStyle( xParaProps, rStyle );
- }
-
- uno::Reference< word::XFont > SAL_CALL
-@@ -477,39 +592,79 @@ uno::Reference< word::XRange > SAL_CALL SwVbaSelection::GoTo( const uno::Any& _w
- sal_Int32 nWhich = 0;
- if( _which.hasValue() )
- _which >>= nWhich;
-- sal_Int32 nPage = 0;
-- switch( nWhich )
-- {
-- case word::WdGoToDirection::wdGoToLast:
-- {
-- nPage = nLastPage;
-- break;
-- }
-- case word::WdGoToDirection::wdGoToNext:
-- {
-- nPage = nCurrPage + 1;
-- break;
-- }
-- case word::WdGoToDirection::wdGoToPrevious:
-- {
-- nPage = nCurrPage - 1;
-- break;
-- }
-- default:
-- {
-- nPage = nCount;
-- }
-- }
-- if( nPage <= 0 )
-- nPage = 1;
-- if( nPage > nLastPage )
-- nPage = nLastPage;
-- xPageCursor->jumpToPage( ( sal_Int16 )( nPage ) );
-- break;
-+ sal_Int32 nPage = 0;
-+ switch( nWhich )
-+ {
-+ case word::WdGoToDirection::wdGoToLast:
-+ {
-+ nPage = nLastPage;
-+ break;
-+ }
-+ case word::WdGoToDirection::wdGoToNext:
-+ {
-+ if( nCount !=0 )
-+ nPage = nCurrPage + nCount;
-+ else
-+ nPage = nCurrPage + 1;
-+ break;
-+ }
-+ case word::WdGoToDirection::wdGoToPrevious:
-+ {
-+ if( nCount !=0 )
-+ nPage = nCurrPage - nCount;
-+ else
-+ nPage = nCurrPage - 1;
-+ break;
-+ }
-+ default:
-+ {
-+ nPage = nCount;
-+ }
-+ }
-+ if( _name.hasValue() )
-+ {
-+ rtl::OUString sName;
-+ _name >>= sName;
-+ sal_Int32 nName = sName.toInt32();
-+ if( nName !=0 )
-+ nPage = nName;
-+ }
-+ if( nPage <= 0 )
-+ nPage = 1;
-+ if( nPage > nLastPage )
-+ nPage = nLastPage;
-+ xPageCursor->jumpToPage( ( sal_Int16 )( nPage ) );
-+ break;
- }
- case word::WdGoToItem::wdGoToSection:
- {
-- // TODO: implement Section object
-+ uno::Reference< text::XPageCursor > xPageCursor( mxTextViewCursor, uno::UNO_QUERY_THROW );
-+ sal_Int32 nCount = 0;
-+ if( _count.hasValue() )
-+ _count >>= nCount;
-+ sal_Int32 nWhich = 0;
-+ if( _which.hasValue() )
-+ _which >>= nWhich;
-+ sal_Int32 nPage = 0;
-+ switch( nWhich )
-+ {
-+ case word::WdGoToDirection::wdGoToAbsolute:
-+ {
-+ // currently only support this type
-+ if( nCount == 1 )
-+ nPage = 1;
-+ break;
-+ }
-+ default:
-+ {
-+ nPage = 0;
-+ }
-+ }
-+ if( nPage != 0 )
-+ xPageCursor->jumpToPage( ( sal_Int16 )( nPage ) );
-+ else
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ break;
- }
- default:
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-@@ -549,6 +704,82 @@ uno::Any SAL_CALL SwVbaSelection::Information( sal_Int32 _type ) throw (uno::Run
- result = uno::makeAny( SwVbaInformationHelper::handleWdVerticalPositionRelativeToPage( mxModel, mxTextViewCursor ) );
- break;
- }
-+ case word::WdInformation::wdWithInTable:
-+ {
-+ uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextTable > xTextTable;
-+ xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ) >>= xTextTable;
-+ if( xTextTable.is() )
-+ result = uno::makeAny( sal_True );
-+ else
-+ result = uno::makeAny( sal_False );
-+ break;
-+ }
-+ case word::WdInformation::wdHeaderFooterType:
-+ {
-+ uno::Reference< word::XView > xView( new SwVbaView( this, mxContext, mxModel ) );
-+ sal_Int32 nView = xView->getSeekView();
-+ sal_Int32 nHeaderFooterType = 0;
-+ switch( nView )
-+ {
-+ case word::WdSeekView::wdSeekMainDocument:
-+ {
-+ nHeaderFooterType = -1; // not in a header or footer
-+ break;
-+ }
-+ case word::WdSeekView::wdSeekEvenPagesHeader:
-+ {
-+ nHeaderFooterType = 0; // even page header
-+ break;
-+ }
-+ case word::WdSeekView::wdSeekPrimaryHeader:
-+ {
-+ nHeaderFooterType = 1; // odd page header
-+ break;
-+ }
-+ case word::WdSeekView::wdSeekEvenPagesFooter:
-+ {
-+ nHeaderFooterType = 2; // even page footer
-+ break;
-+ }
-+ case word::WdSeekView::wdSeekPrimaryFooter:
-+ {
-+ nHeaderFooterType = 3; // odd page footer
-+ break;
-+ }
-+ case word::WdSeekView::wdSeekFirstPageHeader:
-+ case word::WdSeekView::wdSeekFirstPageFooter:
-+ {
-+ uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
-+ rtl::OUString aPageStyleName;
-+ xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyleName"))) >>= aPageStyleName;
-+ sal_Bool bFirstPage = sal_False;
-+ if( aPageStyleName.equalsAscii( "First Page" ) )
-+ bFirstPage = sal_True;
-+ if( nView == word::WdSeekView::wdSeekFirstPageHeader )
-+ {
-+ if( bFirstPage )
-+ nHeaderFooterType = 4;
-+ else
-+ nHeaderFooterType = 1;
-+ }
-+ else
-+ {
-+ if( bFirstPage )
-+ nHeaderFooterType = 5;
-+ else
-+ nHeaderFooterType = 3;
-+ }
-+ break;
-+ }
-+ default:
-+ {
-+ nHeaderFooterType = -1;
-+ }
-+ }
-+ result = uno::makeAny( nHeaderFooterType );
-+ break;
-+ }
- default:
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
- }
-@@ -569,11 +800,6 @@ SwVbaSelection::Tables( const uno::Any& aIndex ) throw (uno::RuntimeException)
- // we can only support a selection that is a single table
- if ( !aIndex.hasValue() ) // currently we can't support multiple tables in a selection
- throw uno::RuntimeException();
-- // if the current selection is a XTextTableCursor and the index is 1 then we can service this request, otherwise we just have to throw
-- uno::Reference< text::XTextTableCursor > xTextTableCursor( mxModel->getCurrentSelection(), uno::UNO_QUERY );
--
-- if ( !xTextTableCursor.is() )
-- throw uno::RuntimeException();
-
- sal_Int32 nIndex = 0;
- aIndex >>= nIndex;
-@@ -582,6 +808,24 @@ SwVbaSelection::Tables( const uno::Any& aIndex ) throw (uno::RuntimeException)
-
- if ( nIndex != 1 )
- throw uno::RuntimeException();
-+
-+ uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextTable > xTextTable;
-+ xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ) >>= xTextTable;
-+ if( xTextTable.is() )
-+ {
-+ uno::Reference< css::text::XTextDocument > xTextDoc( mxModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< word::XTable > xVBATbl = new SwVbaTable( mxParent, mxContext, xTextDoc, xTextTable );
-+ aRet <<= xVBATbl;
-+ return aRet;
-+ }
-+
-+ // if the current selection is a XTextTableCursor and the index is 1 then we can service this request, otherwise we just have to throw
-+ uno::Reference< text::XTextTableCursor > xTextTableCursor( mxModel->getCurrentSelection(), uno::UNO_QUERY );
-+
-+ if ( !xTextTableCursor.is() )
-+ throw uno::RuntimeException();
-+
- SwXTextTableCursor* pTTCursor = dynamic_cast< SwXTextTableCursor* >( xTextTableCursor.get() );
- if ( pTTCursor )
- {
-@@ -611,15 +855,14 @@ SwVbaSelection::Fields( const uno::Any& index ) throw (uno::RuntimeException)
- uno::Reference< word::XHeaderFooter > SAL_CALL
- SwVbaSelection::getHeaderFooter() throw ( uno::RuntimeException )
- {
-- uno::Reference< text::XText > xCurrentText = word::getXTextViewCursor( mxModel )->getText();
-- if( HeaderFooterHelper::isHeader( mxModel, xCurrentText ) || HeaderFooterHelper::isFooter( mxModel, xCurrentText ) )
-+ if( HeaderFooterHelper::isHeaderFooter( mxModel ) )
- {
- uno::Reference< beans::XPropertySet > xPageStyleProps( word::getCurrentPageStyle( mxModel ), uno::UNO_QUERY_THROW );
- sal_Int32 nIndex = word::WdHeaderFooterIndex::wdHeaderFooterPrimary;
-- sal_Bool isHeader = HeaderFooterHelper::isHeader( mxModel, xCurrentText );
-- if( HeaderFooterHelper::isEvenPagesHeader( mxModel, xCurrentText ) || HeaderFooterHelper::isEvenPagesFooter( mxModel, xCurrentText ) )
-+ sal_Bool isHeader = HeaderFooterHelper::isHeader( mxModel );
-+ if( HeaderFooterHelper::isEvenPagesHeader( mxModel ) || HeaderFooterHelper::isEvenPagesFooter( mxModel ) )
- nIndex = word::WdHeaderFooterIndex::wdHeaderFooterEvenPages;
-- else if( HeaderFooterHelper::isFirstPageHeader( mxModel, xCurrentText ) || HeaderFooterHelper::isFirstPageFooter( mxModel, xCurrentText ) )
-+ else if( HeaderFooterHelper::isFirstPageHeader( mxModel ) || HeaderFooterHelper::isFirstPageFooter( mxModel ) )
- nIndex = word::WdHeaderFooterIndex::wdHeaderFooterFirstPage;
-
- return uno::Reference< word::XHeaderFooter >( new SwVbaHeaderFooter( this, mxContext, mxModel, xPageStyleProps, isHeader, nIndex ) );
-@@ -632,9 +875,13 @@ uno::Any SAL_CALL
- SwVbaSelection::ShapeRange( ) throw (uno::RuntimeException)
- {
- uno::Reference< drawing::XShapes > xShapes( mxModel->getCurrentSelection(), uno::UNO_QUERY );
--
- if ( !xShapes.is() )
-- throw uno::RuntimeException();
-+ {
-+ uno::Reference< drawing::XShape > xShape( mxModel->getCurrentSelection(), uno::UNO_QUERY_THROW );
-+ uno::Reference< lang::XMultiServiceFactory > xMSF( mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
-+ xShapes.set( xMSF->createInstance( rtl::OUString::createFromAscii( "com.sun.star.drawing.ShapeCollection" ) ), uno::UNO_QUERY_THROW );
-+ xShapes->add( xShape );
-+ }
-
- uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxModel, uno::UNO_QUERY_THROW );
- uno::Reference< drawing::XDrawPage > xDrawPage = xDrawPageSupplier->getDrawPage();
-@@ -661,6 +908,281 @@ void SAL_CALL SwVbaSelection::setEnd( ::sal_Int32 _end ) throw (uno::RuntimeExce
- getRange()->setEnd( _end );
- }
-
-+void SAL_CALL SwVbaSelection::SelectRow() throw (uno::RuntimeException)
-+{
-+ uno::Reference< word::XRows > xRows( Rows( uno::Any() ), uno::UNO_QUERY_THROW );
-+ xRows->Select();
-+}
-+
-+void SAL_CALL SwVbaSelection::SelectColumn() throw (uno::RuntimeException)
-+{
-+ uno::Reference< word::XColumns > xColumns( Columns( uno::Any() ), uno::UNO_QUERY_THROW );
-+ xColumns->Select();
-+}
-+
-+uno::Any SAL_CALL SwVbaSelection::Rows( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ rtl::OUString sTLName;
-+ rtl::OUString sBRName;
-+ GetSelectedCellRange( sTLName, sBRName );
-+
-+ sal_Int32 nStartRow = 0;
-+ sal_Int32 nEndRow = 0;
-+ uno::Reference< text::XTextTable > xTextTable = GetXTextTable();
-+ SwVbaTableHelper aTableHelper( xTextTable );
-+ nStartRow = aTableHelper.getTabRowIndex( sTLName );
-+ if( sBRName.getLength() > 0 )
-+ {
-+ nEndRow = aTableHelper.getTabRowIndex( sBRName );
-+ }
-+ else
-+ {
-+ nEndRow = nStartRow;
-+ }
-+
-+ uno::Reference< XCollection > xCol( new SwVbaRows( this, mxContext, xTextTable, xTextTable->getRows(), nStartRow, nEndRow ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+uno::Any SAL_CALL SwVbaSelection::Columns( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ rtl::OUString sTLName;
-+ rtl::OUString sBRName;
-+ GetSelectedCellRange( sTLName, sBRName );
-+ sal_Int32 nStartColumn = 0;
-+ sal_Int32 nEndColumn = 0;
-+
-+ uno::Reference< text::XTextTable > xTextTable = GetXTextTable();
-+ SwVbaTableHelper aTableHelper( xTextTable );
-+ nStartColumn = aTableHelper.getTabColIndex( sTLName );
-+ if( sBRName.getLength() > 0 )
-+ {
-+ nEndColumn = aTableHelper.getTabColIndex( sBRName );
-+ }
-+ else
-+ {
-+ nEndColumn = nStartColumn;
-+ }
-+
-+ uno::Reference< XCollection > xCol( new SwVbaColumns( this, mxContext, xTextTable, xTextTable->getColumns(), nStartColumn, nEndColumn ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+uno::Reference< text::XTextTable > SwVbaSelection::GetXTextTable() throw( uno::RuntimeException )
-+{
-+ uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextTable > xTextTable;
-+ xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ) >>= xTextTable;
-+ return xTextTable;
-+}
-+
-+sal_Bool SwVbaSelection::IsInTable() throw( uno::RuntimeException )
-+{
-+ uno::Reference< text::XTextTable > xTextTable = GetXTextTable();
-+ if( xTextTable.is() )
-+ return sal_True;
-+ return sal_False;
-+}
-+
-+sal_Bool SwVbaSelection::HasSelection() throw( uno::RuntimeException )
-+{
-+ uno::Reference< text::XTextRange > xStart = mxTextViewCursor->getStart();
-+ uno::Reference< text::XTextRange > xEnd = mxTextViewCursor->getEnd();
-+ uno::Reference< text::XTextRangeCompare > xTRC( mxTextViewCursor->getText(), uno::UNO_QUERY_THROW );
-+ if( xTRC->compareRegionStarts( xStart, xEnd ) == 0 && xTRC->compareRegionEnds( xStart, xEnd ) == 0 )
-+ return sal_False;
-+ return sal_True;
-+}
-+
-+void SwVbaSelection::GetSelectedCellRange( rtl::OUString& sTLName, rtl::OUString& sBRName ) throw( uno::RuntimeException )
-+{
-+ uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextTable > xTextTable;
-+ xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ) >>= xTextTable;
-+ if( !xTextTable.is() )
-+ throw uno::RuntimeException( );
-+
-+ uno::Reference< text::XTextTableCursor > xTextTableCursor( mxModel->getCurrentSelection(), uno::UNO_QUERY );
-+ if( xTextTableCursor.is() )
-+ {
-+ String sRange( xTextTableCursor->getRangeName() );
-+ if( sRange.GetTokenCount(':') > 0 )
-+ {
-+ sTLName = sRange.GetToken(0, ':');
-+ sBRName = sRange.GetToken(1, ':');
-+ }
-+ }
-+ if( !sTLName.getLength() )
-+ {
-+ uno::Reference< table::XCell > xCell;
-+ xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Cell") ) ) >>= xCell;
-+ if( !xCell.is() )
-+ {
-+ throw uno::RuntimeException( );
-+ }
-+ uno::Reference< beans::XPropertySet > xCellProps( xCell, uno::UNO_QUERY_THROW );
-+ xCellProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CellName") ) ) >>= sTLName;
-+ }
-+}
-+
-+uno::Any SAL_CALL SwVbaSelection::Cells( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ rtl::OUString sTLName;
-+ rtl::OUString sBRName;
-+ GetSelectedCellRange( sTLName, sBRName );
-+ sal_Int32 nLeft = 0;
-+ sal_Int32 nTop = 0;
-+ sal_Int32 nRight = 0;
-+ sal_Int32 nBottom = 0;
-+
-+ uno::Reference< text::XTextTable > xTextTable = GetXTextTable();
-+ SwVbaTableHelper aTableHelper( xTextTable );
-+ nLeft = aTableHelper.getTabColIndex( sTLName );
-+ nTop = aTableHelper.getTabRowIndex( sTLName );
-+ if( sBRName.getLength() > 0 )
-+ {
-+ nRight = aTableHelper.getTabColIndex( sBRName );
-+ nBottom = aTableHelper.getTabRowIndex( sBRName );
-+ }
-+ else
-+ {
-+ nRight = nLeft;
-+ nBottom = nTop;
-+ }
-+
-+ uno::Reference< XCollection > xCol( new SwVbaCells( this, mxContext, xTextTable, nLeft, nTop, nRight, nBottom ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+void SAL_CALL SwVbaSelection::Copy( ) throw (uno::RuntimeException)
-+{
-+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Copy"));
-+ dispatchRequests( mxModel,url );
-+}
-+
-+void SAL_CALL SwVbaSelection::CopyAsPicture( ) throw (uno::RuntimeException)
-+{
-+ // seems not support in Writer
-+ Copy();
-+}
-+
-+void SAL_CALL SwVbaSelection::Paste( ) throw (uno::RuntimeException)
-+{
-+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Paste"));
-+ dispatchRequests( mxModel,url );
-+}
-+
-+void SAL_CALL SwVbaSelection::Collapse( const uno::Any& Direction ) throw (uno::RuntimeException)
-+{
-+ if( word::gotoSelectedObjectAnchor( mxModel ) )
-+ return;
-+
-+ sal_Int32 nDirection = word::WdCollapseDirection::wdCollapseStart;
-+ if( Direction.hasValue() )
-+ Direction >>= nDirection;
-+
-+ uno::Reference< text::XTextViewCursor > xTextViewCursor = word::getXTextViewCursor( mxModel );
-+ if( nDirection == word::WdCollapseDirection::wdCollapseStart )
-+ {
-+ // it is inaccurate if current seleciton is multipul cells, so it needs to go to start
-+ uno::Reference< text::XTextRange > xTextRange = mxTextViewCursor->getStart();
-+ xTextViewCursor->gotoRange( xTextRange, sal_False );
-+ xTextViewCursor->collapseToStart();
-+ }
-+ else if( nDirection == word::WdCollapseDirection::wdCollapseEnd )
-+ {
-+ uno::Reference< text::XTextRange > xTextRange = mxTextViewCursor->getEnd();
-+ xTextViewCursor->gotoRange( xTextRange, sal_False );
-+ xTextViewCursor->collapseToEnd();
-+ }
-+ else
-+ {
-+ throw uno::RuntimeException();
-+ }
-+}
-+
-+void SAL_CALL SwVbaSelection::WholeStory( ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< text::XText > xText = word::getCurrentXText( mxModel );
-+ // FIXME: for i#7747,if the first line is a table, it fails to select all the contents in the story.
-+ // Temporary solution, insert an empty line before the table so that it could select all the contents.
-+ uno::Reference< container::XEnumerationAccess > xParaAccess( xText, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XEnumeration> xParaEnum = xParaAccess->createEnumeration();
-+ if( xParaEnum->hasMoreElements() )
-+ {
-+ uno::Reference< text::XTextTable > xTextTable( xParaEnum->nextElement(), uno::UNO_QUERY );
-+ if( xTextTable.is() )
-+ {
-+ // insert an empty line
-+ uno::Reference< text::XTextRange > xFirstCellRange = word::getFirstObjectPosition( xText );
-+ mxTextViewCursor->gotoRange( xFirstCellRange, sal_False );
-+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertPara"));
-+ dispatchRequests( mxModel,url );
-+ }
-+ }
-+ uno::Reference< text::XTextRange > xStart = xText->getStart();
-+ uno::Reference< text::XTextRange > xEnd = xText->getEnd();
-+ mxTextViewCursor->gotoRange( xStart, sal_False );
-+ mxTextViewCursor->gotoRange( xEnd, sal_True );
-+}
-+
-+::sal_Bool SAL_CALL SwVbaSelection::InRange( const uno::Reference< ::ooo::vba::word::XRange >& Range ) throw (uno::RuntimeException)
-+{
-+ return getRange()->InRange( Range );
-+}
-+
-+void SAL_CALL SwVbaSelection::SplitTable( ) throw (uno::RuntimeException)
-+{
-+ if( !IsInTable() )
-+ throw uno::RuntimeException();
-+
-+ SwDocShell* pDocShell = word::getDocShell( mxModel );
-+ if( pDocShell )
-+ {
-+ SwFEShell* pFEShell = pDocShell->GetFEShell();
-+ if( pFEShell )
-+ {
-+ pFEShell->SplitTable( HEADLINE_CNTNTCOPY );
-+ }
-+ }
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaSelection::Paragraphs( const uno::Any& aIndex ) throw (uno::RuntimeException)
-+{
-+ // Hacky implementation due to missing api ( and lack of knowledge )
-+ // we can only support a selection that is a single paragraph
-+ if ( !aIndex.hasValue() ) // currently we can't support multiple paragraphs in a selection
-+ throw uno::RuntimeException();
-+
-+ sal_Int32 nIndex = 0;
-+ aIndex >>= nIndex;
-+
-+ uno::Any aRet;
-+
-+ if ( nIndex != 1 )
-+ throw uno::RuntimeException();
-+
-+ uno::Reference< text::XTextRange > xTextRange = mxTextViewCursor->getStart();
-+ uno::Reference< text::XText > xText = xTextRange->getText();
-+ uno::Reference< text::XParagraphCursor > xParaCursor( xText->createTextCursor(), uno::UNO_QUERY_THROW );
-+ xParaCursor->gotoStartOfParagraph( sal_False );
-+ xParaCursor->gotoStartOfParagraph( sal_True );
-+
-+ uno::Reference< text::XTextDocument > xTextDoc( mxModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextRange > xParaRange( xParaCursor, uno::UNO_QUERY_THROW );
-+ uno::Reference< word::XParagraph > xParagraph = new SwVbaParagraph( mxParent, mxContext, xTextDoc, xParaRange );
-+
-+ aRet <<= xParagraph;
-+ return aRet;
-+}
-+
- rtl::OUString&
- SwVbaSelection::getServiceImplName()
- {
-diff --git sw/source/ui/vba/vbaselection.hxx sw/source/ui/vba/vbaselection.hxx
-index 83994f6..c10bf2c 100644
---- sw/source/ui/vba/vbaselection.hxx
-+++ sw/source/ui/vba/vbaselection.hxx
-@@ -34,11 +34,13 @@
- #include <ooo/vba/word/XRange.hpp>
- #include <vbahelper/vbahelperinterface.hxx>
- #include <com/sun/star/text/XTextViewCursor.hpp>
-+#include <com/sun/star/text/XTextTable.hpp>
- #include <ooo/vba/word/XParagraphFormat.hpp>
- #include <ooo/vba/word/XFind.hpp>
- #include <ooo/vba/word/XStyle.hpp>
- #include <ooo/vba/word/XFont.hpp>
- #include <ooo/vba/word/XHeaderFooter.hpp>
-+#include "wordvbahelper.hxx"
-
- typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XSelection > SwVbaSelection_BASE;
-
-@@ -49,17 +51,14 @@ private:
- css::uno::Reference< css::text::XTextViewCursor > mxTextViewCursor;
- css::uno::Reference< ooo::vba::word::XRange > mxRange;
-
-- enum E_DIRECTION
-- {
-- MOVE_LEFT = 1,
-- MOVE_RIGHT,
-- MOVE_UP,
-- MOVE_DOWN
-- };
--
- private:
-- void NextCell( sal_Int32 nCount, E_DIRECTION eDirection ) throw ( css::uno::RuntimeException );
-+ void Move( const css::uno::Any& _unit, const css::uno::Any& _count, const css::uno::Any& _extend, ooo::vba::word::E_DIRECTION eDirection ) throw (css::uno::RuntimeException);
-+ void NextCell( sal_Int32 nCount, ooo::vba::word::E_DIRECTION eDirection ) throw ( css::uno::RuntimeException );
- css::uno::Reference< css::text::XTextRange > GetSelectedRange() throw ( css::uno::RuntimeException );
-+ void GetSelectedCellRange( rtl::OUString& sTLName, rtl::OUString& sBRName ) throw ( css::uno::RuntimeException );
-+ css::uno::Reference< css::text::XTextTable > GetXTextTable() throw ( css::uno::RuntimeException );
-+ sal_Bool IsInTable() throw ( css::uno::RuntimeException );
-+ sal_Bool HasSelection() throw ( css::uno::RuntimeException );
-
- public:
- SwVbaSelection( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& rModel ) throw ( css::uno::RuntimeException );
-@@ -76,6 +75,7 @@ public:
- virtual void SAL_CALL MoveRight( const css::uno::Any& _unit, const css::uno::Any& _count, const css::uno::Any& _extend ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL MoveLeft( const css::uno::Any& _unit, const css::uno::Any& _count, const css::uno::Any& _extend ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL MoveDown( const css::uno::Any& _unit, const css::uno::Any& _count, const css::uno::Any& _extend ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL MoveUp( const css::uno::Any& _unit, const css::uno::Any& _count, const css::uno::Any& _extend ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL TypeParagraph() throw (css::uno::RuntimeException);
- virtual void SAL_CALL InsertParagraph() throw (css::uno::RuntimeException);
- virtual void SAL_CALL InsertParagraphBefore() throw (css::uno::RuntimeException);
-@@ -83,8 +83,8 @@ public:
- virtual css::uno::Reference< ooo::vba::word::XParagraphFormat > SAL_CALL getParagraphFormat() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setParagraphFormat( const css::uno::Reference< ooo::vba::word::XParagraphFormat >& rParagraphFormat ) throw (css::uno::RuntimeException);
- virtual css::uno::Reference< ooo::vba::word::XFind > SAL_CALL getFind() throw (css::uno::RuntimeException);
-- virtual css::uno::Reference< ooo::vba::word::XStyle > SAL_CALL getStyle() throw (css::uno::RuntimeException);
-- virtual void SAL_CALL setStyle( const css::uno::Reference< ooo::vba::word::XStyle >& _xStyle ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL getStyle() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setStyle( const css::uno::Any& _xStyle ) throw (css::uno::RuntimeException);
- virtual css::uno::Reference< ooo::vba::word::XFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
- virtual void SAL_CALL TypeBackspace() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< ooo::vba::word::XRange > SAL_CALL GoTo( const css::uno::Any& _what, const css::uno::Any& _which, const css::uno::Any& _count, const css::uno::Any& _name ) throw (css::uno::RuntimeException);
-@@ -100,6 +100,19 @@ public:
- virtual void SAL_CALL setStart( ::sal_Int32 _start ) throw (css::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getEnd() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setEnd( ::sal_Int32 _end ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL SelectRow() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL SelectColumn() throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Rows( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Columns( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Cells( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL Copy( ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL CopyAsPicture( ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL Paste( ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL Collapse( const css::uno::Any& Direction ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL WholeStory( ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL InRange( const css::uno::Reference< ::ooo::vba::word::XRange >& Range ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL SplitTable( ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Paragraphs( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
-diff --git sw/source/ui/vba/vbastyle.cxx sw/source/ui/vba/vbastyle.cxx
-index 0fe8875..03b27ff 100644
---- sw/source/ui/vba/vbastyle.cxx
-+++ sw/source/ui/vba/vbastyle.cxx
-@@ -31,15 +31,18 @@
- #include "vbastyle.hxx"
- #include <ooo/vba/word/WdStyleType.hpp>
- #include <com/sun/star/lang/Locale.hpp>
-+#include <com/sun/star/text/XTextDocument.hpp>
- #include <i18npool/mslangid.hxx>
- #include "vbafont.hxx"
- #include "vbapalette.hxx"
-+#include "vbaparagraphformat.hxx"
-+#include "vbastyles.hxx"
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-
-
--SwVbaStyle::SwVbaStyle( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< beans::XPropertySet >& _xPropertySet ) throw ( script::BasicErrorException, uno::RuntimeException ) : SwVbaStyle_BASE( xParent, xContext ) , mxStyleProps( _xPropertySet )
-+SwVbaStyle::SwVbaStyle( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel>& xModel, const uno::Reference< beans::XPropertySet >& _xPropertySet ) throw ( script::BasicErrorException, uno::RuntimeException ) : SwVbaStyle_BASE( xParent, xContext ) , mxModel( xModel ), mxStyleProps( _xPropertySet )
- {
- mxStyle.set( _xPropertySet, uno::UNO_QUERY_THROW );
- }
-@@ -87,7 +90,7 @@ void SAL_CALL SwVbaStyle::setLanguageID( ::sal_Int32 _languageid ) throw (uno::R
- nType = word::WdStyleType::wdStyleTypeParagraph;
- else if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.CharacterStyle") ) ) )
- nType = word::WdStyleType::wdStyleTypeCharacter;
-- else // if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.NumberingStyle") ) ) )
-+ else
- nType = word::WdStyleType::wdStyleTypeList;
- return nType;
- }
-@@ -99,10 +102,31 @@ SwVbaStyle::getFont() throw ( uno::RuntimeException )
- return new SwVbaFont( mxParent, mxContext, aColors.getPalette(), mxStyleProps );
- }
-
--void SwVbaStyle::setStyle( const uno::Reference< beans::XPropertySet >& xTCProps, const uno::Reference< ooo::vba::word::XStyle >& xStyle )throw (uno::RuntimeException)
-+
-+void SAL_CALL SwVbaStyle::LinkToListTemplate( const uno::Reference< word::XListTemplate >& /*ListTemplate*/, const uno::Any& /*ListLevelNumber*/ ) throw (uno::RuntimeException)
-+{
-+}
-+
-+void SwVbaStyle::setStyle( const uno::Reference< beans::XPropertySet >& xParaProps, const uno::Any& rStyle )throw (uno::RuntimeException)
- {
-- rtl::OUString aStyleType = getOOoStyleTypeFromMSWord( xStyle->getType() );
-- xTCProps->setPropertyValue( aStyleType, uno::makeAny( xStyle->getName() ) );
-+ rtl::OUString sStyle;
-+ uno::Reference< word::XStyle > xStyle;
-+ if( rStyle >>= xStyle )
-+ {
-+ sStyle = xStyle->getName();
-+ }
-+ else
-+ {
-+ rStyle >>= sStyle;
-+ }
-+
-+ if( sStyle.getLength() )
-+ {
-+ xParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaStyleName") ), uno::makeAny( sStyle ) );
-+ return;
-+ }
-+
-+ throw uno::RuntimeException();
- }
-
- rtl::OUString SwVbaStyle::getOOoStyleTypeFromMSWord( sal_Int32 _wdStyleType )
-@@ -132,6 +156,115 @@ rtl::OUString SwVbaStyle::getOOoStyleTypeFromMSWord( sal_Int32 _wdStyleType )
- return aStyleType;
- }
-
-+::rtl::OUString SAL_CALL SwVbaStyle::getNameLocal() throw (uno::RuntimeException)
-+{
-+ rtl::OUString sNameLocal;
-+ mxStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DisplayName") ) ) >>= sNameLocal;
-+ return sNameLocal;
-+}
-+
-+void SAL_CALL SwVbaStyle::setNameLocal( const ::rtl::OUString& _namelocal ) throw (uno::RuntimeException)
-+{
-+ mxStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DisplayName") ), uno::makeAny( _namelocal ) );
-+}
-+
-+uno::Reference< word::XParagraphFormat > SAL_CALL SwVbaStyle::getParagraphFormat() throw (uno::RuntimeException)
-+{
-+ if( word::WdStyleType::wdStyleTypeParagraph == getType() )
-+ {
-+ uno::Reference< text::XTextDocument > xTextDocument( mxModel, uno::UNO_QUERY_THROW );
-+ return uno::Reference< word::XParagraphFormat >( new SwVbaParagraphFormat( this, mxContext, xTextDocument, mxStyleProps ) );
-+ }
-+ else
-+ {
-+ throw uno::RuntimeException();
-+ }
-+ return uno::Reference< word::XParagraphFormat >();
-+}
-+
-+::sal_Bool SAL_CALL SwVbaStyle::getAutomaticallyUpdate() throw (uno::RuntimeException)
-+{
-+ sal_Bool isAutoUpdate = sal_False;
-+ mxStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsAutoUpdate") ) ) >>= isAutoUpdate;
-+ return isAutoUpdate;
-+}
-+
-+void SAL_CALL SwVbaStyle::setAutomaticallyUpdate( ::sal_Bool _automaticallyupdate ) throw (uno::RuntimeException)
-+{
-+ mxStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsAutoUpdate") ), uno::makeAny( _automaticallyupdate ) );
-+}
-+
-+uno::Any SAL_CALL SwVbaStyle::getBaseStyle() throw (uno::RuntimeException)
-+{
-+ // ParentStyle
-+ rtl::OUString sBaseStyle;
-+ mxStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParentStyle") ) ) >>= sBaseStyle;
-+ if( sBaseStyle.getLength() > 0 )
-+ {
-+ uno::Reference< XCollection > xCol( new SwVbaStyles( this, mxContext, mxModel ) );
-+ return xCol->Item( uno::makeAny( sBaseStyle ), uno::Any() );
-+ }
-+ else
-+ {
-+ throw uno::RuntimeException();
-+ }
-+ return uno::Any();
-+}
-+
-+void SAL_CALL SwVbaStyle::setBaseStyle( const uno::Any& _basestyle ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< word::XStyle > xStyle;
-+ _basestyle >>= xStyle;
-+ if( xStyle.is() )
-+ {
-+ rtl::OUString sBaseStyle = xStyle->getName();
-+ mxStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParentStyle") ), uno::makeAny( sBaseStyle ) );
-+ }
-+ else
-+ {
-+ throw uno::RuntimeException();
-+ }
-+}
-+
-+uno::Any SAL_CALL SwVbaStyle::getNextParagraphStyle() throw (uno::RuntimeException)
-+{
-+ //FollowStyle
-+ rtl::OUString sFollowStyle;
-+ mxStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FollowStyle") ) ) >>= sFollowStyle;
-+ if( sFollowStyle.getLength() > 0 )
-+ {
-+ uno::Reference< XCollection > xCol( new SwVbaStyles( this, mxContext, mxModel ) );
-+ return xCol->Item( uno::makeAny( sFollowStyle ), uno::Any() );
-+ }
-+ else
-+ {
-+ throw uno::RuntimeException();
-+ }
-+ return uno::Any();
-+}
-+
-+void SAL_CALL SwVbaStyle::setNextParagraphStyle( const uno::Any& _nextparagraphstyle ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< word::XStyle > xStyle;
-+ _nextparagraphstyle >>= xStyle;
-+ if( xStyle.is() )
-+ {
-+ rtl::OUString sFollowStyle = xStyle->getName();
-+ mxStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FollowStyle") ), uno::makeAny( sFollowStyle ) );
-+ }
-+ else
-+ {
-+ throw uno::RuntimeException();
-+ }
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaStyle::getListLevelNumber() throw (uno::RuntimeException)
-+{
-+ sal_Int16 nNumberingLevel = 0;
-+ mxStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingLevel") ) ) >>= nNumberingLevel;
-+ return nNumberingLevel;
-+}
-+
- rtl::OUString&
- SwVbaStyle::getServiceImplName()
- {
-diff --git sw/source/ui/vba/vbastyle.hxx sw/source/ui/vba/vbastyle.hxx
-index 9a7f349..49eb7e2 100644
---- sw/source/ui/vba/vbastyle.hxx
-+++ sw/source/ui/vba/vbastyle.hxx
-@@ -36,6 +36,7 @@
- #include <com/sun/star/container/XNameContainer.hpp>
- #include <com/sun/star/style/XStyle.hpp>
- #include <ooo/vba/word/XFont.hpp>
-+#include <ooo/vba/word/XListTemplate.hpp>
-
-
- typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XStyle > SwVbaStyle_BASE;
-@@ -43,13 +44,14 @@ typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XStyle > SwVbaStyle_BASE;
- class SwVbaStyle : public SwVbaStyle_BASE
- {
- private:
-+ css::uno::Reference< css::frame::XModel > mxModel;
- css::uno::Reference< css::beans::XPropertySet > mxStyleProps;
- css::uno::Reference< css::style::XStyle > mxStyle;
- public:
-- SwVbaStyle( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::beans::XPropertySet >& _xPropertySet ) throw ( css::script::BasicErrorException, css::uno::RuntimeException );
-+ SwVbaStyle( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::beans::XPropertySet >& _xPropertySet ) throw ( css::script::BasicErrorException, css::uno::RuntimeException );
- virtual ~SwVbaStyle(){}
-
-- static void setStyle( const css::uno::Reference< css::beans::XPropertySet >& xTCProps, const css::uno::Reference< ooo::vba::word::XStyle >& xStyle ) throw (css::uno::RuntimeException);
-+ static void setStyle( const css::uno::Reference< css::beans::XPropertySet >& xParaProps, const css::uno::Any& xStyle ) throw (css::uno::RuntimeException);
- static rtl::OUString getOOoStyleTypeFromMSWord( sal_Int32 _wdStyleType );
- static sal_Int32 getLanguageID( const css::uno::Reference< css::beans::XPropertySet >& xTCProps ) throw (css::uno::RuntimeException);
- static void setLanguageID( const css::uno::Reference< css::beans::XPropertySet >& xTCProps, sal_Int32 _languageid ) throw (css::uno::RuntimeException);
-@@ -61,6 +63,20 @@ public:
- virtual void SAL_CALL setLanguageID( ::sal_Int32 _languageid ) throw (css::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< ooo::vba::word::XFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL LinkToListTemplate( const css::uno::Reference< ooo::vba::word::XListTemplate >& ListTemplate, const css::uno::Any& ListLevelNumber ) throw (css::uno::RuntimeException);
-+ virtual ::rtl::OUString SAL_CALL getNameLocal() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setNameLocal( const ::rtl::OUString& _namelocal ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Reference< ::ooo::vba::word::XParagraphFormat > SAL_CALL getParagraphFormat() throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getAutomaticallyUpdate() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setAutomaticallyUpdate( ::sal_Bool _automaticallyupdate ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL getBaseStyle() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setBaseStyle( const css::uno::Any& _basestyle ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL getNextParagraphStyle() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setNextParagraphStyle( const css::uno::Any& _nextparagraphstyle ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getListLevelNumber() throw (css::uno::RuntimeException);
-+
-+ //XDefaultProperty
-+ virtual ::rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return rtl::OUString::createFromAscii("Name"); }
-
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
-diff --git sw/source/ui/vba/vbastyles.cxx sw/source/ui/vba/vbastyles.cxx
-index c13ba74..3ca80e8 100644
---- sw/source/ui/vba/vbastyles.cxx
-+++ sw/source/ui/vba/vbastyles.cxx
-@@ -47,7 +47,7 @@ struct BuiltinStyleTable
- sal_Int32 wdStyleType;
- };
-
--const BuiltinStyleTable aBuiltinStyleTable[] =
-+static const BuiltinStyleTable aBuiltinStyleTable[] =
- {
- { word::WdBuiltinStyle::wdStyleBlockQuotation, "", word::WdStyleType::wdStyleTypeParagraph },
- { word::WdBuiltinStyle::wdStyleBodyText, "Text body", word::WdStyleType::wdStyleTypeParagraph },
-@@ -155,6 +155,18 @@ const BuiltinStyleTable aBuiltinStyleTable[] =
- { 0, 0, 0 }
- };
-
-+struct MSOStyleNameTable
-+{
-+ const sal_Char* pMSOStyleName;
-+ const sal_Char* pOOoStyleName;
-+ const sal_Char* pOOoStyleType;
-+};
-+
-+static const MSOStyleNameTable aMSOStyleNameTable[] =
-+{
-+ { "Normal", "Default", "ParagraphStyles" },
-+ { 0, 0, 0 }
-+};
-
- static uno::Sequence< rtl::OUString > getStyleTypes()
- {
-@@ -168,38 +180,21 @@ static uno::Sequence< rtl::OUString > getStyleTypes()
-
- typedef ::cppu::WeakImplHelper1< container::XEnumeration > StyleEnumeration_BASE;
- typedef ::cppu::WeakImplHelper3< container::XNameAccess, container::XIndexAccess, container::XEnumerationAccess > StyleCollectionHelper_BASE;
--/*
--class StylesEnumeration : public StyleEnumeration_BASE
--{
--public:
-- StylesEnumeration( const SheetMap& sMap ) : mSheetMap( sMap ), mIt( mSheetMap.begin() ) {}
-- virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-- {
-- return ( mIt != mSheetMap.end() );
-- }
-- virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-- {
-- if ( !hasMoreElements() )
-- throw container::NoSuchElementException();
-- uno::Reference< sheet::XSpreadsheet > xSheet( *mIt++ );
-- return uno::makeAny( xSheet ) ;
-- }
--};
--*/
-+
- class StyleCollectionHelper : public StyleCollectionHelper_BASE
- {
- private:
- uno::Reference< frame::XModel > mxModel;
-- uno::Reference< container::XNameAccess > mxStyleFamilies;
-- uno::Reference< container::XNameContainer > mxCurrentStyleFamily;
-+ uno::Reference< container::XNameAccess > mxParaStyles;
- uno::Any cachePos;
- public:
- StyleCollectionHelper( const uno::Reference< frame::XModel >& _xModel ) : mxModel( _xModel )
- {
-+ // we only concern about the Paragraph styles
- uno::Reference< style::XStyleFamiliesSupplier > xStyleSupplier( _xModel, uno::UNO_QUERY_THROW);
-- mxStyleFamilies = xStyleSupplier->getStyleFamilies();
-+ uno::Reference< container::XNameAccess > xStyleFamilies = xStyleSupplier->getStyleFamilies();
-+ mxParaStyles.set( xStyleFamilies->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParagraphStyles") ) ), uno::UNO_QUERY_THROW );
- }
-- uno::Reference< container::XNameContainer > getCurrentStyleFamily(){ return mxCurrentStyleFamily; }
- // XElementAccess
- virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) { return style::XStyle::static_type(0); }
- virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) { return getCount() > 0; }
-@@ -212,32 +207,42 @@ public:
- }
- virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException)
- {
-- uno::Sequence< rtl::OUString > sNames( getCount() );
-- rtl::OUString* pString = sNames.getArray();
-- uno::Sequence< rtl::OUString > aStyleTypes = getStyleTypes();
-- sal_Int32 nCount = 0;
-- for( sal_Int32 i = 0; i < aStyleTypes.getLength(); i++ )
-+ return mxParaStyles->getElementNames();
-+ }
-+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
-+ {
-+ // search in the MSOStyleName table first
-+ for( const MSOStyleNameTable* pTable = aMSOStyleNameTable; pTable->pMSOStyleName != NULL; pTable++ )
- {
-- uno::Reference< container::XNameAccess > xNameAccess( mxStyleFamilies->getByName( aStyleTypes[i] ), uno::UNO_QUERY_THROW );
-- uno::Sequence< rtl::OUString > sElementNames = xNameAccess->getElementNames();
-- for( sal_Int32 j = 0; j < sElementNames.getLength(); j++ )
-+ if( aName.equalsIgnoreAsciiCaseAscii( pTable->pMSOStyleName ) )
- {
-- pString[nCount++] = sElementNames[j];
-+ //Found it
-+ rtl::OUString sStyleName = rtl::OUString::createFromAscii( pTable->pOOoStyleName );
-+ if( mxParaStyles->hasByName( sStyleName ) )
-+ {
-+ cachePos = mxParaStyles->getByName( sStyleName );
-+ return sal_True;
-+ }
-+ return sal_False;
- }
- }
-- return sNames;
-- }
-- virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
-- {
-- uno::Sequence< rtl::OUString > aStyleTypes = getStyleTypes();
-- for( sal_Int32 i = 0; i < aStyleTypes.getLength(); i++ )
-+
-+ if( mxParaStyles->hasByName( aName ) )
-+ {
-+ cachePos = mxParaStyles->getByName( aName );
-+ return sal_True;
-+ }
-+ else
- {
-- uno::Reference< container::XNameAccess > xNameAccess( mxStyleFamilies->getByName( aStyleTypes[i] ), uno::UNO_QUERY_THROW );
-- if( xNameAccess->hasByName( aName ) )
-+ uno::Sequence< rtl::OUString > sElementNames = mxParaStyles->getElementNames();
-+ for( sal_Int32 j = 0; j < sElementNames.getLength(); j++ )
- {
-- cachePos = xNameAccess->getByName( aName );
-- mxCurrentStyleFamily.set( xNameAccess, uno::UNO_QUERY_THROW );
-- return sal_True;
-+ rtl::OUString aStyleName = sElementNames[j];
-+ if( aStyleName.equalsIgnoreAsciiCase( aName ) )
-+ {
-+ cachePos = mxParaStyles->getByName( aStyleName );
-+ return sal_True;
-+ }
- }
- }
- return sal_False;
-@@ -246,44 +251,43 @@ public:
- // XIndexAccess
- virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
- {
-- uno::Sequence< rtl::OUString > aStyleTypes = getStyleTypes();
-- sal_Int32 nCount = 0;
-- for( sal_Int32 i = 0; i < aStyleTypes.getLength(); i++ )
-- {
-- uno::Reference< container::XIndexAccess > xIndexAccess( mxStyleFamilies->getByName( aStyleTypes[i] ), uno::UNO_QUERY_THROW );
-- nCount += xIndexAccess->getCount();
-- }
-- return nCount;
-+ uno::Reference< container::XIndexAccess > xIndexAccess( mxParaStyles, uno::UNO_QUERY_THROW );
-+ return xIndexAccess->getCount();
- }
- virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
- {
- if ( Index < 0 || Index >= getCount() )
- throw lang::IndexOutOfBoundsException();
-
-- // FIXME: need to make a alphabetically sorted list of style names
-- uno::Sequence< rtl::OUString > aStyleTypes = getStyleTypes();
-- for( sal_Int32 i = 0; i < aStyleTypes.getLength(); i++ )
-- {
-- uno::Reference< container::XIndexAccess > xIndexAccess( mxStyleFamilies->getByName( aStyleTypes[i] ), uno::UNO_QUERY_THROW );
-- sal_Int32 nCount = xIndexAccess->getCount();
-- if( Index >= nCount )
-- Index -= nCount;
-- else
-- {
-- mxCurrentStyleFamily.set( xIndexAccess, uno::UNO_QUERY_THROW );
-- return xIndexAccess->getByIndex( Index );
-- }
-- }
-- throw lang::IndexOutOfBoundsException();
-+ uno::Reference< container::XIndexAccess > xIndexAccess( mxParaStyles, uno::UNO_QUERY_THROW );
-+ return xIndexAccess->getByIndex( Index );
- }
- // XEnumerationAccess
- virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
- {
-- // FIXME:
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
- }
- };
-
-+class StylesEnumWrapper : public EnumerationHelper_BASE
-+{
-+ SwVbaStyles* pStyles;
-+ sal_Int32 nIndex;
-+public:
-+ StylesEnumWrapper( SwVbaStyles* _pStyles ) : pStyles( _pStyles ), nIndex( 1 ) {}
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( nIndex <= pStyles->getCount() );
-+ }
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( nIndex <= pStyles->getCount() )
-+ return pStyles->Item( uno::makeAny( nIndex++ ), uno::Any() );
-+ throw container::NoSuchElementException();
-+ }
-+};
-+
- SwVbaStyles::SwVbaStyles( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< css::uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel ) throw ( script::BasicErrorException ) : SwVbaStyles_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new StyleCollectionHelper( xModel ) ) ), mxModel( xModel )
- {
- mxMSF.set( mxModel, uno::UNO_QUERY_THROW );
-@@ -293,7 +297,7 @@ uno::Any
- SwVbaStyles::createCollectionObject(const uno::Any& aObject)
- {
- uno::Reference< beans::XPropertySet > xStyleProp( aObject, uno::UNO_QUERY_THROW );
-- return uno::makeAny( uno::Reference< word::XStyle >( new SwVbaStyle( this, mxContext, xStyleProp ) ) );
-+ return uno::makeAny( uno::Reference< word::XStyle >( new SwVbaStyle( this, mxContext, mxModel, xStyleProp ) ) );
- }
-
- uno::Type SAL_CALL
-@@ -305,7 +309,7 @@ SwVbaStyles::getElementType() throw (uno::RuntimeException)
- uno::Reference< container::XEnumeration > SAL_CALL
- SwVbaStyles::createEnumeration() throw (uno::RuntimeException)
- {
-- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ return new StylesEnumWrapper( this );
- }
-
- uno::Any SAL_CALL
-@@ -322,7 +326,8 @@ SwVbaStyles::Item( const uno::Any& Index1, const uno::Any& Index2 ) throw (uno::
- rtl::OUString aStyleName = rtl::OUString::createFromAscii( pTable->pOOoStyleName );
- if( aStyleName.getLength() > 0 )
- {
-- rtl::OUString aStyleType = SwVbaStyle::getOOoStyleTypeFromMSWord( pTable->wdStyleType );
-+ //rtl::OUString aStyleType = SwVbaStyle::getOOoStyleTypeFromMSWord( pTable->wdStyleType );
-+ rtl::OUString aStyleType;
- switch( pTable->wdStyleType )
- {
- case word::WdStyleType::wdStyleTypeParagraph:
-@@ -338,7 +343,8 @@ SwVbaStyles::Item( const uno::Any& Index1, const uno::Any& Index2 ) throw (uno::
- }
- case word::WdStyleType::wdStyleTypeList:
- {
-- aStyleType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingStyles") );
-+ // should use Paragraph style and set the property "NumberingStyleName"
-+ aStyleType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParagraphStyles") );
- break;
- }
- default:
-@@ -347,7 +353,12 @@ SwVbaStyles::Item( const uno::Any& Index1, const uno::Any& Index2 ) throw (uno::
- uno::Reference< style::XStyleFamiliesSupplier > xStyleSupplier( mxModel, uno::UNO_QUERY_THROW);
- uno::Reference< container::XNameAccess > xStylesAccess( xStyleSupplier->getStyleFamilies()->getByName( aStyleType ), uno::UNO_QUERY_THROW );
- uno::Reference< beans::XPropertySet > xStyleProps( xStylesAccess->getByName( aStyleName ), uno::UNO_QUERY_THROW );
-- return uno::makeAny( uno::Reference< word::XStyle >( new SwVbaStyle( this, mxContext, xStyleProps ) ) );
-+ // set the property "NumberingStyleName" if it is a listbullet
-+ if( pTable->wdStyleType == word::WdStyleType::wdStyleTypeList )
-+ {
-+ xStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingStyleName") ), uno::makeAny( aStyleName ) );
-+ }
-+ return uno::makeAny( uno::Reference< word::XStyle >( new SwVbaStyle( this, mxContext, mxModel, xStyleProps ) ) );
- }
- else
- {
-diff --git sw/source/ui/vba/vbasystem.cxx sw/source/ui/vba/vbasystem.cxx
-index 3a16e23..7466894 100644
---- sw/source/ui/vba/vbasystem.cxx
-+++ sw/source/ui/vba/vbasystem.cxx
-@@ -37,6 +37,13 @@
- #include <tools/urlobj.hxx>
- #include <tools/string.hxx>
-
-+#ifdef WNT
-+#include <tools/prewin.h>
-+#include <windows.h>
-+#include <tools/postwin.h>
-+#include <tchar.h>
-+#endif
-+
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-
-@@ -55,13 +62,79 @@ void PrivateProfileStringListener::Initialize( const rtl::OUString& rFileName, c
- maGroupName = rGroupName;
- maKey = rKey;
- }
-+#ifdef WNT
-+void lcl_getRegKeyInfo( const ByteString& sKeyInfo, HKEY& hBaseKey, ByteString& sSubKey )
-+{
-+ sal_Int32 nBaseKeyIndex = sKeyInfo.Search('\\');
-+ if( nBaseKeyIndex > 0 )
-+ {
-+ ByteString sBaseKey = sKeyInfo.Copy( 0, nBaseKeyIndex );
-+ sSubKey = sKeyInfo.Copy( nBaseKeyIndex + 1 );
-+ if( sBaseKey.Equals("HKEY_CURRENT_USER") )
-+ {
-+ hBaseKey = HKEY_CURRENT_USER;
-+ }
-+ else if( sBaseKey.Equals("HKEY_LOCAL_MACHINE") )
-+ {
-+ hBaseKey = HKEY_LOCAL_MACHINE;
-+ }
-+ else if( sBaseKey.Equals("HKEY_CLASSES_ROOT") )
-+ {
-+ hBaseKey = HKEY_CLASSES_ROOT;
-+ }
-+ else if( sBaseKey.Equals("HKEY_USERS") )
-+ {
-+ hBaseKey = HKEY_USERS;
-+ }
-+ else if( sBaseKey.Equals("HKEY_CURRENT_CONFIG") )
-+ {
-+ hBaseKey = HKEY_CURRENT_CONFIG;
-+ }
-+ }
-+}
-+#endif
-
- uno::Any PrivateProfileStringListener::getValueEvent()
- {
- // get the private profile string
-- Config aCfg( maFileName );
-- aCfg.SetGroup( maGroupName );
-- rtl::OUString sValue = String( aCfg.ReadKey( maKey ), RTL_TEXTENCODING_DONTKNOW );
-+ rtl::OUString sValue;
-+ if(maFileName.getLength())
-+ {
-+ // get key/value from a file
-+ Config aCfg( maFileName );
-+ aCfg.SetGroup( maGroupName );
-+ sValue = String( aCfg.ReadKey( maKey ), RTL_TEXTENCODING_DONTKNOW );
-+ }
-+ else
-+ {
-+ // get key/value from windows register
-+#ifdef WNT
-+ HKEY hBaseKey = NULL;
-+ ByteString sSubKey;
-+ sal_Int32 nBaseKeyIndex = maGroupName.Search('\\');
-+ lcl_getRegKeyInfo( maGroupName, hBaseKey, sSubKey );
-+ if( hBaseKey != NULL )
-+ {
-+ HKEY hKey = NULL;
-+ LONG lResult;
-+ LPCTSTR lpSubKey = TEXT( sSubKey.GetBuffer());
-+ TCHAR szBuffer[1024];
-+ DWORD cbData = sizeof( szBuffer );
-+ lResult = RegOpenKeyEx( hBaseKey, lpSubKey, 0, KEY_QUERY_VALUE, &hKey );
-+ if( ERROR_SUCCESS == lResult )
-+ {
-+ LPCTSTR lpValueName = TEXT(maKey.GetBuffer());
-+ lResult = RegQueryValueEx( hKey, lpValueName, NULL, NULL, (LPBYTE)szBuffer, &cbData );
-+ RegCloseKey( hKey );
-+ sValue = rtl::OUString::createFromAscii(szBuffer);
-+ }
-+ }
-+
-+ return uno::makeAny( sValue );
-+#endif
-+ throw uno::RuntimeException( rtl::OUString(
-+ RTL_CONSTASCII_USTRINGPARAM("Only support on Windows")), uno::Reference< uno::XInterface >() );
-+ }
-
- return uno::makeAny( sValue );
- }
-@@ -69,12 +142,44 @@ uno::Any PrivateProfileStringListener::getValueEvent()
- void PrivateProfileStringListener::setValueEvent( const css::uno::Any& value )
- {
- // set the private profile string
-- Config aCfg( maFileName );
-- aCfg.SetGroup( maGroupName );
--
- rtl::OUString aValue;
- value >>= aValue;
-- aCfg.WriteKey( maKey, ByteString( aValue.getStr(), RTL_TEXTENCODING_DONTKNOW ) );
-+ if(maFileName.getLength())
-+ {
-+ // set value into a file
-+ Config aCfg( maFileName );
-+ aCfg.SetGroup( maGroupName );
-+ aCfg.WriteKey( maKey, ByteString( aValue.getStr(), RTL_TEXTENCODING_DONTKNOW ) );
-+ }
-+ else
-+ {
-+ //set value into windows register
-+#ifdef WNT
-+ HKEY hBaseKey = NULL;
-+ ByteString sSubKey;
-+ sal_Int32 nBaseKeyIndex = maGroupName.Search('\\');
-+ lcl_getRegKeyInfo( maGroupName, hBaseKey, sSubKey );
-+ if( hBaseKey != NULL )
-+ {
-+ HKEY hKey = NULL;
-+ LONG lResult;
-+ LPCTSTR lpSubKey = TEXT( sSubKey.GetBuffer());
-+ lResult = RegCreateKeyEx( hBaseKey, lpSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, NULL );
-+ if( ERROR_SUCCESS == lResult )
-+ {
-+ LPCTSTR szValue = TEXT( rtl::OUStringToOString( aValue, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ DWORD cbData = sizeof(TCHAR) * (_tcslen(szValue) + 1);
-+ LPCTSTR lpValueName = TEXT(maKey.GetBuffer());
-+ lResult = RegSetValueEx( hKey, lpValueName, NULL, REG_SZ, (LPBYTE)szValue, cbData );
-+ RegCloseKey( hKey );
-+ }
-+ }
-+ return;
-+#endif
-+ throw uno::RuntimeException( rtl::OUString(
-+ RTL_CONSTASCII_USTRINGPARAM("Not implemented")), uno::Reference< uno::XInterface >() );
-+ }
-+
- }
-
- SwVbaSystem::SwVbaSystem( uno::Reference<uno::XComponentContext >& xContext ): SwVbaSystem_BASE( uno::Reference< XHelperInterface >(), xContext )
-@@ -154,19 +259,19 @@ SwVbaSystem::setCursor( sal_Int32 _cursor ) throw (uno::RuntimeException)
- uno::Any SAL_CALL
- SwVbaSystem::PrivateProfileString( const rtl::OUString& rFilename, const rtl::OUString& rSection, const rtl::OUString& rKey ) throw ( uno::RuntimeException )
- {
-- if( rFilename.getLength() == 0 )
-- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Failed to access document from shell" ) ), uno::Reference< uno::XInterface >() );
--
- // FIXME: need to detect whether it is a relative file path
- // we need to detect if this is a URL, if not then assume its a file path
- rtl::OUString sFileUrl;
-- INetURLObject aObj;
-- aObj.SetURL( rFilename );
-- bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
-- if ( bIsURL )
-- sFileUrl = rFilename;
-- else
-- osl::FileBase::getFileURLFromSystemPath( rFilename, sFileUrl);
-+ if( rFilename.getLength() )
-+ {
-+ INetURLObject aObj;
-+ aObj.SetURL( rFilename );
-+ bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
-+ if ( bIsURL )
-+ sFileUrl = rFilename;
-+ else
-+ osl::FileBase::getFileURLFromSystemPath( rFilename, sFileUrl);
-+ }
-
- ByteString aGroupName = ByteString( rSection.getStr(), RTL_TEXTENCODING_DONTKNOW);
- ByteString aKey = ByteString( rKey.getStr(), RTL_TEXTENCODING_DONTKNOW);
-diff --git sw/source/ui/vba/vbatable.cxx sw/source/ui/vba/vbatable.cxx
-index 7598dfc..1ff9294 100644
---- sw/source/ui/vba/vbatable.cxx
-+++ sw/source/ui/vba/vbatable.cxx
-@@ -9,11 +9,13 @@
- #include <com/sun/star/container/XNamed.hpp>
- #include "vbaborders.hxx"
- #include "vbapalette.hxx"
-+#include "vbarows.hxx"
-+#include "vbacolumns.hxx"
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-
--SwVbaTable::SwVbaTable( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rDocument, const uno::Reference< css::text::XTextTable >& xTextTable) throw ( uno::RuntimeException ) : SwVbaTable_BASE( rParent, rContext ), mxTextDocument( rDocument )
-+SwVbaTable::SwVbaTable( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& rDocument, const uno::Reference< text::XTextTable >& xTextTable) throw ( uno::RuntimeException ) : SwVbaTable_BASE( rParent, rContext ), mxTextDocument( rDocument )
- {
- mxTextTable.set( xTextTable, uno::UNO_QUERY_THROW );
- }
-@@ -75,6 +77,26 @@ SwVbaTable::Borders( const uno::Any& index ) throw (uno::RuntimeException)
- return uno::makeAny( xCol );
- }
-
-+uno::Any SAL_CALL
-+SwVbaTable::Rows( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< table::XTableRows > xTableRows( mxTextTable->getRows(), uno::UNO_QUERY_THROW );
-+ uno::Reference< XCollection > xCol( new SwVbaRows( this, mxContext, mxTextTable, xTableRows ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaTable::Columns( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< table::XTableColumns > xTableColumns( mxTextTable->getColumns(), uno::UNO_QUERY_THROW );
-+ uno::Reference< XCollection > xCol( new SwVbaColumns( this, mxContext, mxTextTable, xTableColumns ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
- // XHelperInterface
- rtl::OUString&
- SwVbaTable::getServiceImplName()
-diff --git sw/source/ui/vba/vbatable.hxx sw/source/ui/vba/vbatable.hxx
-index c28a3cd..1348c60 100644
---- sw/source/ui/vba/vbatable.hxx
-+++ sw/source/ui/vba/vbatable.hxx
-@@ -21,6 +21,9 @@ public:
- virtual css::uno::Reference< ::ooo::vba::word::XRange > SAL_CALL ConvertToText( const css::uno::Any& Separator, const css::uno::Any& NestedTables ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual rtl::OUString SAL_CALL getName( ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Borders( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Rows( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Columns( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-diff --git sw/source/ui/vba/vbatablehelper.cxx sw/source/ui/vba/vbatablehelper.cxx
-new file mode 100644
-index 0000000..2fcae2f
---- /dev/null
-+++ sw/source/ui/vba/vbatablehelper.cxx
-@@ -0,0 +1,306 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbatablehelper.hxx"
-+#include <swtable.hxx>
-+#include <unotbl.hxx>
-+#include <docsh.hxx>
-+
-+using namespace ::com::sun::star;
-+using namespace ::ooo::vba;
-+
-+#define UNO_TABLE_COLUMN_SUM 10000
-+
-+SwVbaTableHelper::SwVbaTableHelper( const uno::Reference< text::XTextTable >& xTextTable ) throw (uno::RuntimeException) : mxTextTable( xTextTable ), pDoc( NULL )
-+{
-+ pTable = GetSwTable( mxTextTable );
-+}
-+
-+SwTable* SwVbaTableHelper::GetSwTable( const uno::Reference< text::XTextTable >& xTextTable ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< lang::XUnoTunnel > xTunnel( xTextTable, uno::UNO_QUERY_THROW );
-+ SwXTextTable* pXTextTable = reinterpret_cast< SwXTextTable * >( sal::static_int_cast< sal_IntPtr >(xTunnel->getSomething(SwXTextTable::getUnoTunnelId())));
-+ if( !pXTextTable )
-+ throw uno::RuntimeException();
-+
-+ SwFrmFmt* pFrmFmt = pXTextTable->GetFrmFmt();
-+ if( !pFrmFmt )
-+ throw uno::RuntimeException();
-+
-+ SwTable* pTable = SwTable::FindTable( pFrmFmt );
-+ return pTable;
-+}
-+
-+sal_Int32 SwVbaTableHelper::getTabColumnsCount( sal_Int32 nRowIndex ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nRet = 0;
-+ if(!pTable->IsTblComplex())
-+ {
-+ SwTableLines& rLines = pTable->GetTabLines();
-+ SwTableLine* pLine = rLines.GetObject( nRowIndex );
-+ nRet = pLine->GetTabBoxes().Count();
-+ }
-+ return nRet;
-+}
-+
-+sal_Int32 SwVbaTableHelper::getTabColumnsMaxCount( ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nRet = 0;
-+ //sal_Int32 nRowCount = mxTextTable->getRows()->getCount();
-+ sal_Int32 nRowCount = pTable->GetTabLines().Count();
-+ for( sal_Int32 index = 0; index < nRowCount; index++ )
-+ {
-+ sal_Int32 nColCount = getTabColumnsCount( index );
-+ if( nRet < nColCount )
-+ nRet = nColCount;
-+ }
-+ return nRet;
-+}
-+
-+sal_Int32 SwVbaTableHelper::getTabRowIndex( const rtl::OUString& CellName ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nRet = 0;
-+ String sCellName(CellName);
-+ SwTableBox* pBox = (SwTableBox*)pTable->GetTblBox( sCellName );
-+ if( !pBox )
-+ throw uno::RuntimeException();
-+
-+ const SwTableLine* pLine = pBox->GetUpper();
-+ const SwTableLines* pLines = pLine->GetUpper()
-+ ? &pLine->GetUpper()->GetTabLines() : &pTable->GetTabLines();
-+ nRet = pLines->GetPos( pLine );
-+ return nRet;
-+}
-+
-+sal_Int32 SwVbaTableHelper::getTabColIndex( const rtl::OUString& CellName ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nRet = 0;
-+ String sCellName(CellName);
-+ const SwTableBox* pBox = (SwTableBox*)pTable->GetTblBox( sCellName );
-+ if( !pBox )
-+ throw uno::RuntimeException();
-+ const SwTableBoxes* pBoxes = &pBox->GetUpper()->GetTabBoxes();
-+ nRet = pBoxes->GetPos( pBox );
-+ return nRet;
-+}
-+
-+rtl::OUString SwVbaTableHelper::getColumnStr( sal_Int32 nCol )
-+{
-+ const sal_Int32 coDiff = 52; // 'A'-'Z' 'a' - 'z'
-+ sal_Int32 nCalc = 0;
-+
-+ String sRet;
-+ do{
-+ nCalc = nCol % coDiff;
-+ if( nCalc >= 26 )
-+ sRet.Insert( sal_Unicode('a' - 26 + nCalc ), 0 );
-+ else
-+ sRet.Insert( sal_Unicode('A' + nCalc ), 0 );
-+
-+ if( 0 == ( nCol = nCol - nCalc ) )
-+ break;
-+ nCol /= coDiff;
-+ --nCol;
-+ }while(1);
-+ return sRet;
-+}
-+
-+sal_Int32 SwVbaTableHelper::getTableWidth( ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nWidth = 0;
-+ sal_Bool isWidthRelatvie = sal_False;
-+ uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, uno::UNO_QUERY_THROW );
-+ xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsWidthRelative") ) ) >>= isWidthRelatvie;
-+ if( isWidthRelatvie )
-+ {
-+ xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RelativeWidth") ) ) >>= nWidth;
-+ }
-+ else
-+ {
-+ xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ) ) >>= nWidth;
-+ }
-+ return nWidth;
-+}
-+
-+void SwVbaTableHelper::setTableWidth( sal_Int32 _width ) throw (uno::RuntimeException)
-+{
-+ sal_Bool isWidthRelatvie = sal_False;
-+ uno::Reference< beans::XPropertySet > xTableProps( mxTextTable, uno::UNO_QUERY_THROW );
-+ xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsWidthRelative") ) ) >>= isWidthRelatvie;
-+ if( isWidthRelatvie )
-+ {
-+ xTableProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RelativeWidth") ), uno::makeAny( _width ));
-+ }
-+ else
-+ {
-+ xTableProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ), uno::makeAny( _width ) );
-+ }
-+}
-+
-+SwTableBox* SwVbaTableHelper::GetTabBox( sal_Int32 nCol, sal_Int32 nRow ) throw (css::uno::RuntimeException)
-+{
-+ SwTableLines& rLines = pTable->GetTabLines();
-+ sal_Int32 nRowCount = rLines.Count();
-+ if( nRowCount < nRow )
-+ throw uno::RuntimeException();
-+
-+ SwTableBox* pStart = NULL;
-+ SwTableLine* pLine = rLines.GetObject( nRow );
-+ if( pLine->GetTabBoxes().Count() < nCol )
-+ throw uno::RuntimeException();
-+
-+ pStart = pLine->GetTabBoxes()[ nCol ];
-+
-+ if( !pStart )
-+ throw uno::RuntimeException();
-+
-+ return pStart;
-+}
-+
-+void SwVbaTableHelper::InitTabCols( SwTabCols& rCols, const SwTableBox *pStart, BOOL bCurRowOnly )
-+{
-+ rCols.SetLeftMin ( 0 );
-+ rCols.SetLeft ( 0 );
-+ rCols.SetRight ( UNO_TABLE_COLUMN_SUM );
-+ rCols.SetRightMax( UNO_TABLE_COLUMN_SUM );
-+
-+ //if( !pDoc )
-+ // {
-+ // pDoc = word::getDocShell( getCurrentDocument() )->GetDoc();
-+ // }
-+ pTable->GetTabCols( rCols, pStart, sal_False, sal_False );
-+}
-+
-+sal_Int32 SwVbaTableHelper::GetColCount( SwTabCols& rCols ) const
-+{
-+ sal_Int32 nCount = 0;
-+ for(sal_Int32 i = 0; i < rCols.Count(); i++ )
-+ if(rCols.IsHidden(i))
-+ nCount ++;
-+ return rCols.Count() - nCount;
-+}
-+
-+sal_Int32 SwVbaTableHelper::GetRightSeparator( SwTabCols& rCols, sal_Int32 nNum) const
-+{
-+ DBG_ASSERT( nNum < (sal_Int32)GetColCount( rCols ) ,"Index out of range");
-+ sal_Int32 i = 0;
-+ while( nNum >= 0 )
-+ {
-+ if( !rCols.IsHidden( static_cast< USHORT >(i)) )
-+ nNum--;
-+ i++;
-+ }
-+ return i - 1;
-+}
-+
-+sal_Int32 SwVbaTableHelper::GetColWidth( sal_Int32 nCol, sal_Int32 nRow, sal_Bool bCurRowOnly ) throw (uno::RuntimeException)
-+{
-+ SwTableBox* pStart = GetTabBox( nCol, nRow );
-+ SwTabCols aCols;
-+ InitTabCols( aCols, pStart, bCurRowOnly );
-+ sal_Int32 nWidth = GetColWidth( aCols, nCol );
-+
-+ sal_Int32 nTableWidth = getTableWidth( );
-+ double dAbsWidth = ( (double)nWidth / UNO_TABLE_COLUMN_SUM ) * (double) nTableWidth;
-+ return ( sal_Int32 )Millimeter::getInPoints( dAbsWidth );
-+}
-+
-+sal_Int32 SwVbaTableHelper::GetColWidth( SwTabCols& rCols, sal_Int32 nNum ) throw (uno::RuntimeException)
-+{
-+ SwTwips nWidth = 0;
-+
-+ if( rCols.Count() > 0 )
-+ {
-+ if(rCols.Count() == GetColCount( rCols ))
-+ {
-+ nWidth = (SwTwips)((nNum == rCols.Count()) ?
-+ rCols.GetRight() - rCols[nNum-1] :
-+ nNum == 0 ? rCols[nNum] - rCols.GetLeft() :
-+ rCols[nNum] - rCols[nNum-1]);
-+ }
-+ else
-+ {
-+ SwTwips nRValid = nNum < GetColCount( rCols ) ?
-+ rCols[(USHORT)GetRightSeparator( rCols, nNum)]:
-+ rCols.GetRight();
-+ SwTwips nLValid = nNum ?
-+ rCols[(USHORT)GetRightSeparator( rCols, nNum - 1)]:
-+ rCols.GetLeft();
-+ nWidth = nRValid - nLValid;
-+ }
-+ }
-+ else
-+ nWidth = rCols.GetRight();
-+
-+ return nWidth;
-+}
-+
-+void SwVbaTableHelper::SetColWidth( sal_Int32 _width, sal_Int32 nCol, sal_Int32 nRow, sal_Bool bCurRowOnly ) throw (css::uno::RuntimeException)
-+{
-+ double dAbsWidth = Millimeter::getInHundredthsOfOneMillimeter( _width );
-+ sal_Int32 nTableWidth = getTableWidth( );
-+ sal_Int32 nNewWidth = (sal_Int32)( dAbsWidth/nTableWidth * UNO_TABLE_COLUMN_SUM );
-+
-+ SwTableBox* pStart = GetTabBox( nCol, nRow );
-+ SwTabCols aOldCols;
-+ InitTabCols( aOldCols, pStart, bCurRowOnly );
-+
-+ //BOOL bCurRowOnly = FALSE;
-+ SwTwips nWidth = 0;
-+
-+ SwTabCols aCols( aOldCols );
-+ if ( aCols.Count() > 0 )
-+ {
-+ // if(aCols.Count() != GetColCount( aCols ))
-+ // bCurRowOnly = TRUE;
-+ nWidth = GetColWidth( aCols, nCol);
-+
-+ int nDiff = (int)(nNewWidth - nWidth);
-+ if( !nCol )
-+ aCols[ static_cast< USHORT >(GetRightSeparator(aCols, 0)) ] += nDiff;
-+ else if( nCol < GetColCount( aCols ) )
-+ {
-+ if(nDiff < GetColWidth( aCols, nCol + 1) - MINLAY)
-+ aCols[ static_cast< USHORT >(GetRightSeparator( aCols, nCol)) ] += nDiff;
-+ else
-+ {
-+ int nDiffLeft = nDiff - (int)GetColWidth( aCols, nCol + 1) + (int)MINLAY;
-+ aCols[ static_cast< USHORT >(GetRightSeparator( aCols, nCol)) ] += (nDiff - nDiffLeft);
-+ aCols[ static_cast< USHORT >(GetRightSeparator( aCols, nCol - 1)) ] -= nDiffLeft;
-+ }
-+ }
-+ else
-+ aCols[ static_cast< USHORT >(GetRightSeparator( aCols, nCol-1)) ] -= nDiff;
-+ }
-+ else
-+ aCols.SetRight( Min( (long)nNewWidth, aCols.GetRightMax()) );
-+
-+ //pDoc->SetTabCols(*pTable, aCols, aOldCols, pStartBox, bCurRowOnly );
-+ pTable->SetTabCols(aCols, aOldCols, pStart, bCurRowOnly );
-+}
-diff --git sw/source/ui/vba/vbatablehelper.hxx sw/source/ui/vba/vbatablehelper.hxx
-new file mode 100644
-index 0000000..73425d4
---- /dev/null
-+++ sw/source/ui/vba/vbatablehelper.hxx
-@@ -0,0 +1,70 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_WORD_VBA_TABLEHELPER_HXX
-+#define SW_WORD_VBA_TABLEHELPER_HXX
-+
-+#include <com/sun/star/text/XTextTable.hpp>
-+#include "wordvbahelper.hxx"
-+#include <swtable.hxx>
-+#include <tabcol.hxx>
-+#include <doc.hxx>
-+
-+class SwVbaTableHelper
-+{
-+private:
-+ css::uno::Reference< css::text::XTextTable > mxTextTable;
-+ SwTable* pTable;
-+ SwDoc* pDoc;
-+
-+private:
-+ SwTableBox* GetTabBox( sal_Int32 nCol, sal_Int32 nRow ) throw (css::uno::RuntimeException);
-+ void InitTabCols( SwTabCols& rCols, const SwTableBox *pStart, sal_Bool bCurRowOnly = FALSE );
-+ sal_Int32 GetRightSeparator( SwTabCols& rCols, sal_Int32 nNum) const;
-+ sal_Int32 GetColCount( SwTabCols& rCols ) const;
-+ sal_Int32 GetColWidth( SwTabCols& rCols, sal_Int32 nNum ) throw (css::uno::RuntimeException);
-+
-+public:
-+ SwVbaTableHelper( const css::uno::Reference< css::text::XTextTable >& xTextTable ) throw (css::uno::RuntimeException);
-+ ~SwVbaTableHelper() {}
-+ sal_Int32 getTabColumnsCount( sal_Int32 nRowIndex ) throw (css::uno::RuntimeException);
-+ sal_Int32 getTabColumnsMaxCount( ) throw (css::uno::RuntimeException);
-+ sal_Int32 getTabRowIndex( const rtl::OUString& sCellName ) throw (css::uno::RuntimeException);
-+ sal_Int32 getTabColIndex( const rtl::OUString& sCellName ) throw (css::uno::RuntimeException);
-+ sal_Int32 getTableWidth( ) throw (css::uno::RuntimeException);
-+ void setTableWidth( sal_Int32 _width ) throw (css::uno::RuntimeException);
-+
-+ sal_Int32 GetColWidth( sal_Int32 nCol, sal_Int32 nRow = 0, sal_Bool bCurRowOnly = FALSE ) throw (css::uno::RuntimeException);
-+ void SetColWidth( sal_Int32 _width, sal_Int32 nCol, sal_Int32 nRow = 0, sal_Bool bCurRowOnly = FALSE ) throw (css::uno::RuntimeException);
-+
-+ static SwTable* GetSwTable( const css::uno::Reference< css::text::XTextTable >& xTextTable ) throw (css::uno::RuntimeException);
-+ static rtl::OUString getColumnStr( sal_Int32 nCol );
-+};
-+
-+#endif
-diff --git sw/source/ui/vba/vbatableofcontents.cxx sw/source/ui/vba/vbatableofcontents.cxx
-new file mode 100644
-index 0000000..1c37e96
---- /dev/null
-+++ sw/source/ui/vba/vbatableofcontents.cxx
-@@ -0,0 +1,125 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbatableofcontents.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include <ooo/vba/word/WdTabLeader.hpp>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaTableOfContents::SwVbaTableOfContents( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& xDoc, const uno::Reference< text::XDocumentIndex >& xDocumentIndex ) throw ( uno::RuntimeException ) :
-+ SwVbaTableOfContents_BASE( rParent, rContext ), mxTextDocument( xDoc ), mxDocumentIndex( xDocumentIndex )
-+{
-+ mxTocProps.set( mxDocumentIndex, uno::UNO_QUERY_THROW );
-+}
-+
-+
-+SwVbaTableOfContents::~SwVbaTableOfContents()
-+{
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaTableOfContents::getLowerHeadingLevel() throw (uno::RuntimeException)
-+{
-+ sal_Int16 nLevel = 0;
-+ mxTocProps->getPropertyValue(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Level") ) ) >>= nLevel;
-+ return nLevel;
-+}
-+
-+void SAL_CALL SwVbaTableOfContents::setLowerHeadingLevel( ::sal_Int32 _lowerheadinglevel ) throw (uno::RuntimeException)
-+{
-+ mxTocProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Level") ), uno::makeAny( sal_Int8( _lowerheadinglevel ) ) );
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaTableOfContents::getTabLeader() throw (uno::RuntimeException)
-+{
-+ // not support in Writer
-+ return word::WdTabLeader::wdTabLeaderDots;
-+}
-+
-+void SAL_CALL SwVbaTableOfContents::setTabLeader( ::sal_Int32 /*_tableader*/ ) throw (uno::RuntimeException)
-+{
-+ // not support in Writer
-+}
-+
-+::sal_Bool SAL_CALL SwVbaTableOfContents::getUseFields() throw (css::uno::RuntimeException)
-+{
-+ sal_Bool bUseFields = sal_False;
-+ mxTocProps->getPropertyValue(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CreateFromMarks") ) ) >>= bUseFields;
-+ return bUseFields;
-+}
-+
-+void SAL_CALL SwVbaTableOfContents::setUseFields( ::sal_Bool _useFields ) throw (css::uno::RuntimeException)
-+{
-+ mxTocProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CreateFromMarks") ), uno::makeAny( _useFields ) );
-+}
-+
-+::sal_Bool SAL_CALL SwVbaTableOfContents::getUseOutlineLevels() throw (css::uno::RuntimeException)
-+{
-+ sal_Bool bUseOutlineLevels = sal_False;
-+ mxTocProps->getPropertyValue(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CreateFromOutline") ) ) >>= bUseOutlineLevels;
-+ return bUseOutlineLevels;
-+}
-+
-+void SAL_CALL SwVbaTableOfContents::setUseOutlineLevels( ::sal_Bool _useOutlineLevels ) throw (css::uno::RuntimeException)
-+{
-+ mxTocProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CreateFromOutline") ), uno::makeAny( _useOutlineLevels ) );
-+}
-+
-+void SAL_CALL SwVbaTableOfContents::Delete( ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< text::XTextContent > xTextContent( mxDocumentIndex, uno::UNO_QUERY_THROW );
-+ mxTextDocument->getText()->removeTextContent( xTextContent );
-+}
-+
-+void SAL_CALL SwVbaTableOfContents::Update( ) throw (uno::RuntimeException)
-+{
-+ mxDocumentIndex->update();
-+}
-+
-+rtl::OUString&
-+SwVbaTableOfContents::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaTableOfContents") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaTableOfContents::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.TableOfContents" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbatableofcontents.hxx sw/source/ui/vba/vbatableofcontents.hxx
-new file mode 100644
-index 0000000..8e9394a
---- /dev/null
-+++ sw/source/ui/vba/vbatableofcontents.hxx
-@@ -0,0 +1,70 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_TABLEOFCONTENTS_HXX
-+#define SW_VBA_TABLEOFCONTENTS_HXX
-+
-+#include <ooo/vba/word/XTableOfContents.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include <com/sun/star/text/XDocumentIndex.hpp>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XTableOfContents > SwVbaTableOfContents_BASE;
-+
-+class SwVbaTableOfContents : public SwVbaTableOfContents_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XTextDocument > mxTextDocument;
-+ css::uno::Reference< css::text::XDocumentIndex > mxDocumentIndex;
-+ css::uno::Reference< css::beans::XPropertySet > mxTocProps;
-+
-+public:
-+ SwVbaTableOfContents( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& xDoc, const css::uno::Reference< css::text::XDocumentIndex >& xDocumentIndex ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaTableOfContents();
-+
-+ // Attributes
-+ virtual ::sal_Int32 SAL_CALL getLowerHeadingLevel() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setLowerHeadingLevel( ::sal_Int32 _lowerheadinglevel ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getTabLeader() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setTabLeader( ::sal_Int32 _tableader ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getUseFields() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setUseFields( ::sal_Bool _useFields ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getUseOutlineLevels() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setUseOutlineLevels( ::sal_Bool _useOutlineLevels ) throw (css::uno::RuntimeException);
-+
-+ // Methods
-+ virtual void SAL_CALL Delete( ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL Update( ) throw (css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_TABLEOFCONTENTS_HXX */
-diff --git sw/source/ui/vba/vbatables.cxx sw/source/ui/vba/vbatables.cxx
-index 53178d1..7423216 100644
---- sw/source/ui/vba/vbatables.cxx
-+++ sw/source/ui/vba/vbatables.cxx
-@@ -4,6 +4,9 @@
- #include <com/sun/star/text/XTextTable.hpp>
- #include <com/sun/star/text/XTextTablesSupplier.hpp>
- #include <com/sun/star/text/XTextDocument.hpp>
-+#include <com/sun/star/lang/XServiceInfo.hpp>
-+#include <com/sun/star/text/XText.hpp>
-+#include <com/sun/star/table/XCellRange.hpp>
- #include <comphelper/componentcontext.hxx>
-
- using namespace ::ooo::vba;
-@@ -26,7 +29,89 @@ uno::Any lcl_createTable( const uno::Reference< XHelperInterface >& xParent, con
- return uno::makeAny( xTable );
- }
-
-+sal_Bool lcl_isInHeaderFooter( const uno::Reference< text::XTextTable >& xTable )
-+{
-+ uno::Reference< text::XTextContent > xTextContent( xTable, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XText > xText = xTextContent->getAnchor()->getText();
-+ uno::Reference< lang::XServiceInfo > xServiceInfo( xText, uno::UNO_QUERY_THROW );
-+ rtl::OUString aImplName = xServiceInfo->getImplementationName();
-+ if( aImplName.equalsAscii("SwXHeadFootText") )
-+ return sal_True;
-+ return sal_False;
-+}
-+
- typedef ::cppu::WeakImplHelper1< css::container::XEnumeration > EnumBase;
-+typedef ::cppu::WeakImplHelper2< container::XIndexAccess, container::XNameAccess > TableCollectionHelper_Base;
-+typedef std::vector< uno::Reference< text::XTextTable > > XTextTableVec;
-+
-+class TableCollectionHelper : public TableCollectionHelper_Base
-+{
-+ XTextTableVec mxTables;
-+ XTextTableVec::iterator cachePos;
-+
-+public:
-+ TableCollectionHelper( const uno::Reference< frame::XModel >& xDocument )
-+ {
-+ // only count the tables in the body text, not in the header/footer
-+ uno::Reference< container::XIndexAccess > xTables = lcl_getTables( xDocument );
-+ sal_Int32 nCount = xTables->getCount();
-+ for( sal_Int32 i = 0; i < nCount; i++ )
-+ {
-+ uno::Reference< text::XTextTable > xTable( xTables->getByIndex( i ) , uno::UNO_QUERY_THROW );
-+ if( !lcl_isInHeaderFooter( xTable ) )
-+ mxTables.push_back( xTable );
-+ }
-+ cachePos = mxTables.begin();
-+ }
-+ // XIndexAccess
-+ virtual sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
-+ {
-+ return mxTables.size();
-+ }
-+ virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( Index < 0 || Index >= getCount() )
-+ throw lang::IndexOutOfBoundsException();
-+ uno::Reference< text::XTextTable > xTable( mxTables[ Index ], uno::UNO_QUERY_THROW );
-+ return uno::makeAny( xTable );
-+ }
-+ // XElementAccess
-+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) { return text::XTextTable::static_type(0); }
-+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) { return getCount() > 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();
-+ uno::Reference< text::XTextTable > xTable( *cachePos, uno::UNO_QUERY_THROW );
-+ return uno::makeAny( xTable );
-+ }
-+ virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException)
-+ {
-+ uno::Sequence< rtl::OUString > sNames( mxTables.size() );
-+ rtl::OUString* pString = sNames.getArray();
-+ XTextTableVec::iterator it = mxTables.begin();
-+ XTextTableVec::iterator it_end = mxTables.end();
-+ for ( ; it != it_end; ++it, ++pString )
-+ {
-+ uno::Reference< container::XNamed > xName( *it, uno::UNO_QUERY_THROW );
-+ *pString = xName->getName();
-+ }
-+ return sNames;
-+ }
-+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
-+ {
-+ cachePos = mxTables.begin();
-+ XTextTableVec::iterator it_end = mxTables.end();
-+ for ( ; cachePos != it_end; ++cachePos )
-+ {
-+ uno::Reference< container::XNamed > xName( *cachePos, uno::UNO_QUERY_THROW );
-+ if ( aName.equalsIgnoreAsciiCase( xName->getName() ) )
-+ break;
-+ }
-+ return ( cachePos != it_end );
-+ }
-+};
-
- class TableEnumerationImpl : public EnumBase
- {
-@@ -52,7 +137,7 @@ public:
-
- };
-
--SwVbaTables::SwVbaTables( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xDocument ) : SwVbaTables_BASE( xParent, xContext , lcl_getTables( xDocument ) ), mxDocument( xDocument )
-+SwVbaTables::SwVbaTables( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xDocument ) : SwVbaTables_BASE( xParent, xContext , uno::Reference< container::XIndexAccess >( new TableCollectionHelper( xDocument ) ) ), mxDocument( xDocument )
- {
- }
-
-@@ -85,6 +170,12 @@ SwVbaTables::Add( const uno::Reference< word::XRange >& Range, const uno::Any& N
- uno::Reference< text::XTextContent > xContext( xTable, uno::UNO_QUERY_THROW );
-
- xText->insertTextContent( xTextRange, xContext, true );
-+
-+ // move the current cursor to the first table cell
-+ uno::Reference< table::XCellRange > xCellRange( xTable, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XText> xFirstCellText( xCellRange->getCellByPosition(0, 0), uno::UNO_QUERY_THROW );
-+ word::getXTextViewCursor( mxDocument )->gotoRange( xFirstCellText->getStart(), sal_False );
-+
- uno::Reference< word::XTable > xVBATable( new SwVbaTable( mxParent, mxContext, pVbaRange->getDocument(), xTable ) );
- return xVBATable;
- }
-diff --git sw/source/ui/vba/vbatablesofcontents.cxx sw/source/ui/vba/vbatablesofcontents.cxx
-new file mode 100644
-index 0000000..fd81978
---- /dev/null
-+++ sw/source/ui/vba/vbatablesofcontents.cxx
-@@ -0,0 +1,197 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbatablesofcontents.hxx"
-+#include "vbatableofcontents.hxx"
-+#include "vbarange.hxx"
-+#include <com/sun/star/text/XDocumentIndexesSupplier.hpp>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+typedef ::cppu::WeakImplHelper2< container::XIndexAccess, container::XEnumerationAccess > TableOfContentsCollectionHelper_Base;
-+typedef std::vector< uno::Reference< text::XDocumentIndex > > XTocVec;
-+
-+class TablesOfContentsEnumWrapper : public EnumerationHelper_BASE
-+{
-+ uno::Reference< container::XIndexAccess > mxIndexAccess;
-+ sal_Int32 nIndex;
-+
-+public:
-+ TablesOfContentsEnumWrapper( const uno::Reference< container::XIndexAccess >& xIndexAccess ) : mxIndexAccess( xIndexAccess ), nIndex( 0 )
-+ {
-+ }
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( nIndex < mxIndexAccess->getCount() );
-+ }
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if( nIndex < mxIndexAccess->getCount() )
-+ {
-+ return mxIndexAccess->getByIndex( nIndex++ );
-+ }
-+ throw container::NoSuchElementException();
-+ }
-+};
-+
-+class TableOfContentsCollectionHelper : public TableOfContentsCollectionHelper_Base
-+{
-+private:
-+ uno::Reference< XHelperInterface > mxParent;
-+ uno::Reference< uno::XComponentContext > mxContext;
-+ uno::Reference< text::XTextDocument > mxTextDocument;
-+ XTocVec maToc;
-+
-+public:
-+ TableOfContentsCollectionHelper( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextDocument >& xDoc ) throw ( uno::RuntimeException ): mxParent( xParent ), mxContext( xContext ), mxTextDocument( xDoc )
-+ {
-+ uno::Reference< text::XDocumentIndexesSupplier > xDocIndexSupp( mxTextDocument, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xDocIndexes = xDocIndexSupp->getDocumentIndexes();
-+ sal_Int32 nCount = xDocIndexes->getCount();
-+ for( sal_Int32 i = 0; i < nCount; i++ )
-+ {
-+ uno::Reference< text::XDocumentIndex > xToc( xDocIndexes->getByIndex(i), uno::UNO_QUERY_THROW );
-+ if( xToc->getServiceName().equalsAscii("com.sun.star.text.ContentIndex") )
-+ {
-+ maToc.push_back( xToc );
-+ }
-+ }
-+ }
-+
-+ virtual ~TableOfContentsCollectionHelper() {}
-+
-+ virtual sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
-+ {
-+ return maToc.size();
-+ }
-+ virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( Index < 0 || Index >= getCount() )
-+ throw lang::IndexOutOfBoundsException();
-+
-+ uno::Reference< text::XDocumentIndex > xToc( maToc[Index], uno::UNO_QUERY_THROW );
-+ return uno::makeAny( uno::Reference< word::XTableOfContents >( new SwVbaTableOfContents( mxParent, mxContext, mxTextDocument, xToc ) ) );
-+ }
-+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
-+ {
-+ return word::XTableOfContents::static_type(0);
-+ }
-+ virtual sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
-+ {
-+ return sal_True;
-+ }
-+ // XEnumerationAccess
-+ virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
-+ {
-+ return new TablesOfContentsEnumWrapper( this );
-+ }
-+};
-+
-+SwVbaTablesOfContents::SwVbaTablesOfContents( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextDocument >& xDoc ) throw (uno::RuntimeException) : SwVbaTablesOfContents_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new TableOfContentsCollectionHelper( xParent, xContext, xDoc ) ) ), mxTextDocument( xDoc )
-+{
-+}
-+
-+uno::Reference< word::XTableOfContents > SAL_CALL
-+SwVbaTablesOfContents::Add( const uno::Reference< word::XRange >& Range, const uno::Any& UseHeadingStyles, const uno::Any& UpperHeadingLevel, const uno::Any& LowerHeadingLevel, const uno::Any& UseFields, const uno::Any& TableID, const uno::Any& RightAlignPageNumbers, const uno::Any& IncludePageNumbers, const uno::Any& AddedStyles, const uno::Any& UseHyperlinks, const uno::Any& HidePageNumbersInWeb, const uno::Any& UseOutlineLevels ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< lang::XMultiServiceFactory > xDocMSF( mxTextDocument, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XDocumentIndex > xDocumentIndex( xDocMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.ContentIndex")) ), uno::UNO_QUERY_THROW );
-+
-+ uno::Reference< beans::XPropertySet > xTocProps( xDocumentIndex, uno::UNO_QUERY_THROW );
-+ sal_Bool isProtected = sal_False;
-+ xTocProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsProtected") ), uno::makeAny( isProtected ) );
-+
-+ uno::Reference< word::XTableOfContents > xToc( new SwVbaTableOfContents( this, mxContext, mxTextDocument, xDocumentIndex ) );
-+
-+ sal_Int32 nLowerHeadingLevel = 9;
-+ if( LowerHeadingLevel.hasValue() )
-+ LowerHeadingLevel >>= nLowerHeadingLevel;
-+ xToc->setLowerHeadingLevel( nLowerHeadingLevel );
-+
-+ sal_Bool bUseFields = sal_False;
-+ if( UseFields.hasValue() )
-+ UseFields >>= bUseFields;
-+ xToc->setUseFields( bUseFields );
-+
-+ sal_Bool bUseOutlineLevels = sal_True;
-+ //if( UseOutlineLevels.hasValue() )
-+ // UseOutlineLevels >>= bUseOutlineLevels;
-+ xToc->setUseOutlineLevels( bUseOutlineLevels );
-+
-+ SwVbaRange* pVbaRange = dynamic_cast<SwVbaRange*>( Range.get() );
-+ if( !pVbaRange )
-+ throw uno::RuntimeException();
-+
-+ uno::Reference< text::XTextRange > xTextRange = pVbaRange->getXTextRange();
-+ uno::Reference< text::XText > xText = pVbaRange->getXText();
-+ uno::Reference< text::XTextContent > xTextContent( xDocumentIndex, uno::UNO_QUERY_THROW );
-+ xText->insertTextContent( xTextRange, xTextContent, sal_False );
-+ xToc->Update();
-+
-+ return xToc;
-+}
-+
-+// XEnumerationAccess
-+uno::Type
-+SwVbaTablesOfContents::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XTableOfContents::static_type(0);
-+}
-+uno::Reference< container::XEnumeration >
-+SwVbaTablesOfContents::createEnumeration() throw (uno::RuntimeException)
-+{
-+ return new TablesOfContentsEnumWrapper( m_xIndexAccess );
-+}
-+
-+uno::Any
-+SwVbaTablesOfContents::createCollectionObject( const uno::Any& aSource )
-+{
-+ return aSource;
-+}
-+
-+rtl::OUString&
-+SwVbaTablesOfContents::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaTablesOfContents") );
-+ return sImplName;
-+}
-+
-+uno::Sequence<rtl::OUString>
-+SwVbaTablesOfContents::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.TablesOfContents") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbatablesofcontents.hxx sw/source/ui/vba/vbatablesofcontents.hxx
-new file mode 100644
-index 0000000..e193df7
---- /dev/null
-+++ sw/source/ui/vba/vbatablesofcontents.hxx
-@@ -0,0 +1,64 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_TABLESOFCONTENTS_HXX
-+#define SW_VBA_TABLESOFCONTENTS_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XTablesOfContents.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include <ooo/vba/word/XTableOfContents.hpp>
-+#include <ooo/vba/word/XRange.hpp>
-+
-+typedef CollTestImplHelper< ooo::vba::word::XTablesOfContents > SwVbaTablesOfContents_BASE;
-+
-+class SwVbaTablesOfContents : public SwVbaTablesOfContents_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XTextDocument > mxTextDocument;
-+
-+public:
-+ SwVbaTablesOfContents( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::text::XTextDocument >& xDoc ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaTablesOfContents() {}
-+
-+ // Methods
-+ virtual css::uno::Reference< ::ooo::vba::word::XTableOfContents > SAL_CALL Add( const css::uno::Reference< ::ooo::vba::word::XRange >& Range, const css::uno::Any& UseHeadingStyles, const css::uno::Any& UpperHeadingLevel, const css::uno::Any& LowerHeadingLevel, const css::uno::Any& UseFields, const css::uno::Any& TableID, const css::uno::Any& RightAlignPageNumbers, const css::uno::Any& IncludePageNumbers, const css::uno::Any& AddedStyles, const css::uno::Any& UseHyperlinks, const css::uno::Any& HidePageNumbersInWeb, const css::uno::Any& UseOutlineLevels ) 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);
-+
-+ // SwVbaTablesOfContents_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* SW_VBA_TABLESOFCONTENTS_HXX */
-diff --git sw/source/ui/vba/vbatabstop.cxx sw/source/ui/vba/vbatabstop.cxx
-new file mode 100644
-index 0000000..259c508
---- /dev/null
-+++ sw/source/ui/vba/vbatabstop.cxx
-@@ -0,0 +1,63 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbatabstop.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaTabStop::SwVbaTabStop( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< beans::XPropertySet >& xParaProps, const style::TabStop& aTabStop ) throw ( uno::RuntimeException ) : SwVbaTabStop_BASE( rParent, rContext ), mxParaProps( xParaProps ), maTabStop( aTabStop )
-+{
-+}
-+
-+SwVbaTabStop::~SwVbaTabStop()
-+{
-+}
-+
-+rtl::OUString&
-+SwVbaTabStop::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaTabStop") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaTabStop::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.TabStop" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbatabstop.hxx sw/source/ui/vba/vbatabstop.hxx
-new file mode 100644
-index 0000000..77780c7
---- /dev/null
-+++ sw/source/ui/vba/vbatabstop.hxx
-@@ -0,0 +1,54 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_TABSTOP_HXX
-+#define SW_VBA_TABSTOP_HXX
-+
-+#include <ooo/vba/word/XTabStop.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/style/TabStop.hpp>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XTabStop > SwVbaTabStop_BASE;
-+
-+class SwVbaTabStop : public SwVbaTabStop_BASE
-+{
-+private:
-+ css::uno::Reference< css::beans::XPropertySet > mxParaProps;
-+ css::style::TabStop maTabStop;
-+
-+public:
-+ SwVbaTabStop( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::beans::XPropertySet >& xParaProps, const css::style::TabStop& aTabStop ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaTabStop();
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_TABSTOP_HXX */
-diff --git sw/source/ui/vba/vbatabstops.cxx sw/source/ui/vba/vbatabstops.cxx
-new file mode 100644
-index 0000000..8d19875
---- /dev/null
-+++ sw/source/ui/vba/vbatabstops.cxx
-@@ -0,0 +1,280 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbatabstops.hxx"
-+#include "vbatabstop.hxx"
-+#include <com/sun/star/style/TabAlign.hpp>
-+#include <ooo/vba/word/WdTabLeader.hpp>
-+#include <ooo/vba/word/WdTabAlignment.hpp>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+uno::Sequence< style::TabStop > lcl_getTabStops( const uno::Reference< beans::XPropertySet >& xParaProps ) throw (uno::RuntimeException)
-+{
-+ uno::Sequence< style::TabStop > aSeq;
-+ xParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaTabStops") ) ) >>= aSeq;
-+ return aSeq;
-+}
-+
-+void lcl_setTabStops( const uno::Reference< beans::XPropertySet >& xParaProps, const uno::Sequence< style::TabStop >& aSeq ) throw (uno::RuntimeException)
-+{
-+ xParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaTabStops") ), uno::makeAny( aSeq ) );
-+}
-+
-+typedef ::cppu::WeakImplHelper2< container::XIndexAccess, container::XEnumerationAccess > TabStopCollectionHelper_Base;
-+
-+class TabStopsEnumWrapper : public EnumerationHelper_BASE
-+{
-+ uno::Reference< container::XIndexAccess > mxIndexAccess;
-+ sal_Int32 nIndex;
-+
-+public:
-+ TabStopsEnumWrapper( const uno::Reference< container::XIndexAccess >& xIndexAccess ) : mxIndexAccess( xIndexAccess ), nIndex( 0 )
-+ {
-+ }
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( nIndex < mxIndexAccess->getCount() );
-+ }
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if( nIndex < mxIndexAccess->getCount() )
-+ {
-+ return mxIndexAccess->getByIndex( nIndex++ );
-+ }
-+ throw container::NoSuchElementException();
-+ }
-+};
-+
-+class TabStopCollectionHelper : public TabStopCollectionHelper_Base
-+{
-+private:
-+ uno::Reference< XHelperInterface > mxParent;
-+ uno::Reference< uno::XComponentContext > mxContext;
-+ uno::Reference< beans::XPropertySet > mxParaProps;
-+ uno::Sequence< style::TabStop > maTabStops;
-+
-+public:
-+ TabStopCollectionHelper( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::beans::XPropertySet >& xParaProps ) throw ( css::uno::RuntimeException ): mxParent( xParent ), mxContext( xContext ), mxParaProps( xParaProps )
-+ {
-+ maTabStops = lcl_getTabStops( xParaProps );
-+ }
-+
-+ virtual ~TabStopCollectionHelper() {}
-+
-+ virtual sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
-+ {
-+ return maTabStops.getLength();
-+ }
-+ virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( Index < 0 || Index >= getCount() )
-+ throw css::lang::IndexOutOfBoundsException();
-+
-+ const style::TabStop* pTabs = maTabStops.getConstArray();
-+ return uno::makeAny( uno::Reference< word::XTabStop >( new SwVbaTabStop( mxParent, mxContext, mxParaProps, pTabs[ Index ] ) ) );
-+ }
-+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
-+ {
-+ return word::XTabStop::static_type(0);
-+ }
-+ virtual sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
-+ {
-+ return sal_True;
-+ }
-+ // XEnumerationAccess
-+ virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
-+ {
-+ return new TabStopsEnumWrapper( this );
-+ }
-+};
-+
-+SwVbaTabStops::SwVbaTabStops( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< beans::XPropertySet >& xParaProps ) throw (uno::RuntimeException) : SwVbaTabStops_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new TabStopCollectionHelper( xParent, xContext, xParaProps ) ) ), mxParaProps( xParaProps )
-+{
-+}
-+
-+uno::Reference< word::XTabStop > SAL_CALL SwVbaTabStops::Add( float Position, const uno::Any& Alignment, const uno::Any& Leader ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nPosition = Millimeter::getInHundredthsOfOneMillimeter( Position );
-+
-+ style::TabAlign nAlign = style::TabAlign_LEFT;
-+ if( Alignment.hasValue() )
-+ {
-+ sal_Int32 wdAlign = word::WdTabAlignment::wdAlignTabLeft;
-+ Alignment >>= wdAlign;
-+ switch( wdAlign )
-+ {
-+ case word::WdTabAlignment::wdAlignTabLeft:
-+ {
-+ nAlign = style::TabAlign_LEFT;
-+ break;
-+ }
-+ case word::WdTabAlignment::wdAlignTabRight:
-+ {
-+ nAlign = style::TabAlign_RIGHT;
-+ break;
-+ }
-+ case word::WdTabAlignment::wdAlignTabCenter:
-+ {
-+ nAlign = style::TabAlign_CENTER;
-+ break;
-+ }
-+ case word::WdTabAlignment::wdAlignTabDecimal:
-+ {
-+ nAlign = style::TabAlign_DECIMAL;
-+ break;
-+ }
-+ case word::WdTabAlignment::wdAlignTabBar:
-+ case word::WdTabAlignment::wdAlignTabList:
-+ {
-+ DebugHelper::exception( SbERR_NOT_IMPLEMENTED, rtl::OUString() );
-+ break;
-+ }
-+ default:
-+ {
-+ //left
-+ }
-+ }
-+ }
-+
-+ sal_Char cLeader = ' '; // default is space
-+ if( Leader.hasValue() )
-+ {
-+ sal_Int32 wdLeader = word::WdTabLeader::wdTabLeaderSpaces;
-+ Leader >>= wdLeader;
-+ switch( wdLeader )
-+ {
-+ case word::WdTabLeader::wdTabLeaderSpaces:
-+ {
-+ cLeader = ' ';
-+ break;
-+ }
-+ case word::WdTabLeader::wdTabLeaderMiddleDot:
-+ {
-+ cLeader = 183;
-+ break;
-+ }
-+ case word::WdTabLeader::wdTabLeaderDots:
-+ {
-+ cLeader = '.';
-+ break;
-+ }
-+ case word::WdTabLeader::wdTabLeaderDashes:
-+ case word::WdTabLeader::wdTabLeaderHeavy:
-+ case word::WdTabLeader::wdTabLeaderLines:
-+ {
-+ cLeader = '_';
-+ break;
-+ }
-+ default:
-+ {
-+ //left
-+ }
-+ }
-+ }
-+
-+ sal_Char cDecimal = '.'; // default value
-+
-+ style::TabStop aTab;
-+ aTab.Position = nPosition;
-+ aTab.Alignment = nAlign;
-+ aTab.DecimalChar = cDecimal;
-+ aTab.FillChar = cLeader;
-+
-+ uno::Sequence< style::TabStop > aOldTabs = lcl_getTabStops( mxParaProps );
-+ sal_Bool bOverWriter = sal_False;
-+
-+ sal_Int32 nTabs = aOldTabs.getLength();
-+ uno::Sequence< style::TabStop > aNewTabs( nTabs + 1 );
-+
-+ style::TabStop* pOldTab = aOldTabs.getArray();
-+ style::TabStop* pNewTab = aNewTabs.getArray();
-+ pNewTab[0] = aTab;
-+ for( sal_Int32 nIndex = 0; nIndex < nTabs && !bOverWriter; nIndex++ )
-+ {
-+ if( pOldTab[nIndex].Position == nPosition )
-+ {
-+ bOverWriter = sal_True;
-+ pOldTab[nIndex] = aTab;
-+ break;
-+ }
-+ pNewTab[ nIndex+1 ] = pOldTab[ nIndex ];
-+ }
-+ if( bOverWriter )
-+ lcl_setTabStops( mxParaProps, aOldTabs );
-+ else
-+ lcl_setTabStops( mxParaProps, aNewTabs );
-+
-+ return uno::Reference< word::XTabStop >( new SwVbaTabStop( this, mxContext, mxParaProps, aTab ) );
-+}
-+
-+void SAL_CALL SwVbaTabStops::ClearAll() throw (uno::RuntimeException)
-+{
-+ uno::Sequence< style::TabStop > aSeq;
-+ lcl_setTabStops( mxParaProps, aSeq );
-+}
-+
-+// XEnumerationAccess
-+uno::Type
-+SwVbaTabStops::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XTabStop::static_type(0);
-+}
-+uno::Reference< container::XEnumeration >
-+SwVbaTabStops::createEnumeration() throw (uno::RuntimeException)
-+{
-+ return new TabStopsEnumWrapper( m_xIndexAccess );
-+}
-+
-+uno::Any
-+SwVbaTabStops::createCollectionObject( const css::uno::Any& aSource )
-+{
-+ return aSource;
-+}
-+
-+rtl::OUString&
-+SwVbaTabStops::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaTabStops") );
-+ return sImplName;
-+}
-+
-+css::uno::Sequence<rtl::OUString>
-+SwVbaTabStops::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.TabStops") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbatabstops.hxx sw/source/ui/vba/vbatabstops.hxx
-new file mode 100644
-index 0000000..913e12b
---- /dev/null
-+++ sw/source/ui/vba/vbatabstops.hxx
-@@ -0,0 +1,65 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_TABSTOPS_HXX
-+#define SW_VBA_TABSTOPS_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XTabStops.hpp>
-+#include <ooo/vba/word/XTabStop.hpp>
-+#include <com/sun/star/container/XEnumerationAccess.hpp>
-+#include <com/sun/star/container/XIndexAccess.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+
-+typedef CollTestImplHelper< ooo::vba::word::XTabStops > SwVbaTabStops_BASE;
-+
-+class SwVbaTabStops : public SwVbaTabStops_BASE
-+{
-+private:
-+ css::uno::Reference< css::beans::XPropertySet > mxParaProps;
-+
-+public:
-+ SwVbaTabStops( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::beans::XPropertySet >& xParaProps ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaTabStops() {}
-+
-+ // Methods
-+ virtual css::uno::Reference< ::ooo::vba::word::XTabStop > SAL_CALL Add( float Position, const css::uno::Any& Alignment, const css::uno::Any& Leader ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL ClearAll( ) 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);
-+
-+ // SwVbaTabStops_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* SW_VBA_TABSTOPS_HXX */
-diff --git sw/source/ui/vba/vbatemplate.cxx sw/source/ui/vba/vbatemplate.cxx
-index 136a9ec..a7a1a6c 100644
---- sw/source/ui/vba/vbatemplate.cxx
-+++ sw/source/ui/vba/vbatemplate.cxx
-@@ -33,12 +33,35 @@
- #include "vbaautotextentry.hxx"
- #include <comphelper/processfactory.hxx>
- #include <com/sun/star/text/XAutoTextContainer.hpp>
-+#include <tools/urlobj.hxx>
-+#include <osl/file.hxx>
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-
--SwVbaTemplate::SwVbaTemplate( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& rModel, const rtl::OUString& rName )
-- : SwVbaTemplate_BASE( rParent, rContext ), mxModel( rModel ), msName( rName )
-+String lcl_CheckGroupName( const String& rGroupName )
-+{
-+ String sRet;
-+ //group name should contain only A-Z and a-z and spaces
-+ for( xub_StrLen i = 0; i < rGroupName.Len(); i++ )
-+ {
-+ sal_Unicode cChar = rGroupName.GetChar(i);
-+ if( (cChar >= 'A' && cChar <= 'Z') ||
-+ (cChar >= 'a' && cChar <= 'z') ||
-+ (cChar >= '0' && cChar <= '9') ||
-+ cChar == '_' || cChar == 0x20 )
-+ {
-+ sRet += cChar;
-+ }
-+ }
-+ sRet.EraseLeadingChars();
-+ sRet.EraseTrailingChars();
-+ return sRet;
-+}
-+
-+
-+SwVbaTemplate::SwVbaTemplate( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& rModel, const rtl::OUString& rFullUrl )
-+ : SwVbaTemplate_BASE( rParent, rContext ), mxModel( rModel ), msFullUrl( rFullUrl )
- {
- }
-
-@@ -50,7 +73,27 @@ SwVbaTemplate::~SwVbaTemplate()
- rtl::OUString
- SwVbaTemplate::getName() throw ( css::uno::RuntimeException )
- {
-- return msName;
-+ rtl::OUString sName;
-+ if( msFullUrl.getLength() )
-+ {
-+ INetURLObject aURL( msFullUrl );
-+ ::osl::File::getSystemPathFromFileURL( aURL.GetLastName(), sName );
-+ }
-+ return sName;
-+}
-+
-+rtl::OUString
-+SwVbaTemplate::getPath() throw ( css::uno::RuntimeException )
-+{
-+ rtl::OUString sPath;
-+ if( msFullUrl.getLength() )
-+ {
-+ INetURLObject aURL( msFullUrl );
-+ rtl::OUString sURL( aURL.GetMainURL( INetURLObject::DECODE_TO_IURI ) );
-+ sURL = sURL.copy( 0, sURL.getLength() - aURL.GetLastName().getLength() - 1 );
-+ ::osl::File::getSystemPathFromFileURL( sURL, sPath );
-+ }
-+ return sPath;
- }
-
- uno::Any SAL_CALL
-@@ -61,17 +104,18 @@ SwVbaTemplate::AutoTextEntries( const uno::Any& index ) throw (uno::RuntimeExcep
-
- // the default template is "Normal.dot" in Word.
- rtl::OUString sGroup( RTL_CONSTASCII_USTRINGPARAM("Normal") );
-- sal_Int32 nIndex = msName.lastIndexOf( sal_Unicode('.') );
-+ rtl::OUString sName = getName();
-+ sal_Int32 nIndex = sName.lastIndexOf( sal_Unicode('.') );
- if( nIndex > 0 )
- {
-- sGroup = msName.copy( 0, msName.lastIndexOf( sal_Unicode('.') ) );
-- // OSL_TRACE("SwVbaTemplate::AutoTextEntries: %s", rtl::OUStringToOString( sGroup, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ sGroup = sName.copy( 0, sName.lastIndexOf( sal_Unicode('.') ) );
- }
--
-+ String sNewGroup = lcl_CheckGroupName( sGroup );
-+
- uno::Reference< container::XIndexAccess > xGroup;
-- if( xAutoTextContainer->hasByName( sGroup ) )
-+ if( xAutoTextContainer->hasByName( sNewGroup ) )
- {
-- xGroup.set( xAutoTextContainer->getByName( sGroup ), uno::UNO_QUERY_THROW );
-+ xGroup.set( xAutoTextContainer->getByName( sNewGroup ), uno::UNO_QUERY_THROW );
- }
- else
- {
-diff --git sw/source/ui/vba/vbatemplate.hxx sw/source/ui/vba/vbatemplate.hxx
-index df8848b..502e9be 100644
---- sw/source/ui/vba/vbatemplate.hxx
-+++ sw/source/ui/vba/vbatemplate.hxx
-@@ -39,7 +39,7 @@ class SwVbaTemplate : public SwVbaTemplate_BASE
- {
- private:
- css::uno::Reference< css::frame::XModel > mxModel;
-- rtl::OUString msName;
-+ rtl::OUString msFullUrl;
- public:
- SwVbaTemplate( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext,
- const css::uno::Reference< css::frame::XModel >& rModel, const rtl::OUString& );
-@@ -47,6 +47,7 @@ public:
-
- // XTemplate
- virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
-+ virtual rtl::OUString SAL_CALL getPath() throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL AutoTextEntries( const css::uno::Any& index ) throw (css::uno::RuntimeException);
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
-diff --git sw/source/ui/vba/vbaview.cxx sw/source/ui/vba/vbaview.cxx
-index bc7b9b4..df9a524 100644
---- sw/source/ui/vba/vbaview.cxx
-+++ sw/source/ui/vba/vbaview.cxx
-@@ -95,20 +95,20 @@ SwVbaView::getSeekView() throw (css::uno::RuntimeException)
- }
- else if( aImplName.equalsAscii("SwXHeadFootText") )
- {
-- if( HeaderFooterHelper::isHeader( mxModel, xCurrentText ) )
-+ if( HeaderFooterHelper::isHeader( mxModel ) )
- {
-- if( HeaderFooterHelper::isFirstPageHeader( mxModel, xCurrentText ) )
-+ if( HeaderFooterHelper::isFirstPageHeader( mxModel ) )
- return word::WdSeekView::wdSeekFirstPageHeader;
-- else if( HeaderFooterHelper::isEvenPagesHeader( mxModel, xCurrentText ) )
-+ else if( HeaderFooterHelper::isEvenPagesHeader( mxModel ) )
- return word::WdSeekView::wdSeekEvenPagesHeader;
- else
- return word::WdSeekView::wdSeekPrimaryHeader;
- }
- else
- {
-- if( HeaderFooterHelper::isFirstPageFooter( mxModel, xCurrentText ) )
-+ if( HeaderFooterHelper::isFirstPageFooter( mxModel ) )
- return word::WdSeekView::wdSeekFirstPageFooter;
-- else if( HeaderFooterHelper::isEvenPagesFooter( mxModel, xCurrentText ) )
-+ else if( HeaderFooterHelper::isEvenPagesFooter( mxModel ) )
- return word::WdSeekView::wdSeekEvenPagesFooter;
- else
- return word::WdSeekView::wdSeekPrimaryFooter;
-@@ -135,6 +135,7 @@ SwVbaView::setSeekView( ::sal_Int32 _seekview ) throw (css::uno::RuntimeExceptio
- // if( _seekview == getSeekView() )
- // return;
-
-+ word::gotoSelectedObjectAnchor( mxModel );
- switch( _seekview )
- {
- case word::WdSeekView::wdSeekFirstPageFooter:
-@@ -184,7 +185,7 @@ SwVbaView::setSeekView( ::sal_Int32 _seekview ) throw (css::uno::RuntimeExceptio
- {
- uno::Reference< text::XTextDocument > xTextDocument( mxModel, uno::UNO_QUERY_THROW );
- uno::Reference< text::XText > xText = xTextDocument->getText();
-- mxViewCursor->gotoRange( getFirstObjectPosition( xText ), sal_False );
-+ mxViewCursor->gotoRange( word::getFirstObjectPosition( xText ), sal_False );
- break;
- }
- }
-@@ -379,28 +380,7 @@ uno::Reference< text::XTextRange > SwVbaView::getHFTextRange( sal_Int32 nType )
- {
- DebugHelper::exception( SbERR_INTERNAL_ERROR, rtl::OUString() );
- }
-- uno::Reference< text::XTextRange > xTextRange = getFirstObjectPosition( xText );
-- return xTextRange;
--}
--
--uno::Reference< text::XTextRange > SwVbaView::getFirstObjectPosition( const uno::Reference< text::XText >& xText ) throw (uno::RuntimeException)
--{
-- // if the first object is table, get the position of first cell
-- uno::Reference< text::XTextRange > xTextRange;
-- uno::Reference< container::XEnumerationAccess > xParaAccess( xText, uno::UNO_QUERY_THROW );
-- uno::Reference< container::XEnumeration> xParaEnum = xParaAccess->createEnumeration();
-- if( xParaEnum->hasMoreElements() )
-- {
-- uno::Reference< lang::XServiceInfo > xServiceInfo( xParaEnum->nextElement(), uno::UNO_QUERY_THROW );
-- if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextTable") ) ) )
-- {
-- uno::Reference< table::XCellRange > xCellRange( xServiceInfo, uno::UNO_QUERY_THROW );
-- uno::Reference< text::XText> xFirstCellText( xCellRange->getCellByPosition(0, 0), uno::UNO_QUERY_THROW );
-- xTextRange = xFirstCellText->getStart();
-- }
-- }
-- if( !xTextRange.is() )
-- xTextRange = xText->getStart();
-+ uno::Reference< text::XTextRange > xTextRange = word::getFirstObjectPosition( xText );
- return xTextRange;
- }
-
-diff --git sw/source/ui/vba/vbawindow.cxx sw/source/ui/vba/vbawindow.cxx
-index abdf3d5..a0ac99d 100644
---- sw/source/ui/vba/vbawindow.cxx
-+++ sw/source/ui/vba/vbawindow.cxx
-@@ -28,12 +28,16 @@
- *
- ************************************************************************/
- #include <vbahelper/helperdecl.hxx>
-+#include <ooo/vba/word/WdWindowState.hpp>
- #include "vbawindow.hxx"
- #include "vbaglobals.hxx"
- #include "vbadocument.hxx"
- #include "vbaview.hxx"
- #include "vbapanes.hxx"
- #include "vbapane.hxx"
-+#include "wordvbahelper.hxx"
-+#include <view.hxx>
-+#include <sfx2/topfrm.hxx>
-
- using namespace ::com::sun::star;
- using namespace ::ooo::vba;
-@@ -81,6 +85,52 @@ void SAL_CALL SwVbaWindow::setView( const uno::Any& _view ) throw (uno::RuntimeE
- }
-
- uno::Any SAL_CALL
-+SwVbaWindow::getWindowState() throw (uno::RuntimeException)
-+{
-+ sal_Int32 nwindowState = word::WdWindowState::wdWindowStateNormal;
-+ SwView* pView = word::getView( m_xModel );
-+ SfxViewFrame* pViewFrame = pView -> GetViewFrame();
-+ SfxTopViewFrame *pTop= PTR_CAST( SfxTopViewFrame, pViewFrame -> GetTopViewFrame() );
-+ if ( pTop )
-+ {
-+ WorkWindow* pWork = (WorkWindow*) pTop->GetTopFrame_Impl()->GetSystemWindow();
-+ if ( pWork )
-+ {
-+ if ( pWork -> IsMaximized())
-+ nwindowState = word::WdWindowState::wdWindowStateMaximize;
-+ else if (pWork -> IsMinimized())
-+ nwindowState = word::WdWindowState::wdWindowStateMinimize;
-+ }
-+ }
-+ return uno::makeAny( nwindowState );
-+}
-+
-+void SAL_CALL
-+SwVbaWindow::setWindowState( const uno::Any& _windowstate ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nwindowState = word::WdWindowState::wdWindowStateMaximize;
-+ _windowstate >>= nwindowState;
-+ SwView* pView = word::getView( m_xModel );
-+ SfxViewFrame* pViewFrame = pView -> GetViewFrame();
-+ SfxTopViewFrame *pTop= PTR_CAST( SfxTopViewFrame, pViewFrame -> GetTopViewFrame() );
-+ if ( pTop )
-+ {
-+ WorkWindow* pWork = (WorkWindow*) pTop->GetTopFrame_Impl()->GetSystemWindow();
-+ if ( pWork )
-+ {
-+ if ( nwindowState == word::WdWindowState::wdWindowStateMaximize )
-+ pWork -> Maximize();
-+ else if (nwindowState == word::WdWindowState::wdWindowStateMinimize)
-+ pWork -> Minimize();
-+ else if (nwindowState == word::WdWindowState::wdWindowStateNormal)
-+ pWork -> Restore();
-+ else
-+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Invalid Parameter" ) ), uno::Reference< uno::XInterface >() );
-+ }
-+ }
-+}
-+
-+uno::Any SAL_CALL
- SwVbaWindow::Panes( const uno::Any& aIndex ) throw (uno::RuntimeException)
- {
- uno::Reference< XCollection > xPanes( new SwVbaPanes( this, mxContext, m_xModel ) );
-diff --git sw/source/ui/vba/vbawindow.hxx sw/source/ui/vba/vbawindow.hxx
-index 11a1a36..7e30d2c 100644
---- sw/source/ui/vba/vbawindow.hxx
-+++ sw/source/ui/vba/vbawindow.hxx
-@@ -48,6 +48,8 @@ public:
- // Attributes
- 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 css::uno::Any SAL_CALL getWindowState() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setWindowState( const css::uno::Any& _windowstate ) throw (css::uno::RuntimeException);
- // Methods
- virtual void SAL_CALL Activate( ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Close( const css::uno::Any& SaveChanges, const css::uno::Any& RouteDocument ) throw (css::uno::RuntimeException);
-diff --git sw/source/ui/vba/wordvbahelper.cxx sw/source/ui/vba/wordvbahelper.cxx
-index 409b8bd..0772d07 100644
---- sw/source/ui/vba/wordvbahelper.cxx
-+++ sw/source/ui/vba/wordvbahelper.cxx
-@@ -32,11 +32,16 @@
- #include <comphelper/processfactory.hxx>
- #include <com/sun/star/frame/XController.hpp>
- #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
-+#include <com/sun/star/text/XTextTable.hpp>
-+#include <com/sun/star/table/XCellRange.hpp>
- #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
- #include <com/sun/star/container/XNameAccess.hpp>
-+#include <com/sun/star/container/XIndexAccess.hpp>
- #include <com/sun/star/lang/XUnoTunnel.hpp>
-+#include <com/sun/star/view/XSelectionSupplier.hpp>
- #include <unotxdoc.hxx>
- #include <doc.hxx>
-+#include <view.hxx>
-
- using namespace ::com::sun::star;
- using namespace ::ooo::vba;
-@@ -74,8 +79,13 @@ uno::Reference< text::XTextViewCursor > getXTextViewCursor( const uno::Reference
- uno::Reference< style::XStyle > getCurrentPageStyle( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
- {
- uno::Reference< beans::XPropertySet > xCursorProps( getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
-+ return getCurrentPageStyle( xModel, xCursorProps );
-+}
-+
-+uno::Reference< style::XStyle > getCurrentPageStyle( const uno::Reference< frame::XModel >& xModel, const uno::Reference< beans::XPropertySet >& xProps ) throw (uno::RuntimeException)
-+{
- rtl::OUString aPageStyleName;
-- xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyleName"))) >>= aPageStyleName;
-+ xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyleName"))) >>= aPageStyleName;
- uno::Reference< style::XStyleFamiliesSupplier > xSytleFamSupp( xModel, uno::UNO_QUERY_THROW );
- uno::Reference< container::XNameAccess > xSytleFamNames( xSytleFamSupp->getStyleFamilies(), uno::UNO_QUERY_THROW );
- uno::Reference< container::XNameAccess > xPageStyles( xSytleFamNames->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyles") ) ), uno::UNO_QUERY_THROW );
-@@ -90,6 +100,92 @@ sal_Int32 getPageCount( const uno::Reference< frame::XModel>& xModel ) throw (un
- return pDocShell ? pDocShell->GetDoc()->GetPageCount() : 0;
- }
-
-+uno::Reference< style::XStyle > getDefaultParagraphStyle( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< style::XStyleFamiliesSupplier > xSytleFamSupp( xModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XNameAccess > xSytleFamNames( xSytleFamSupp->getStyleFamilies(), uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XNameAccess > xParaStyles( xSytleFamNames->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParagraphStyles") ) ), uno::UNO_QUERY_THROW );
-+ uno::Reference< style::XStyle > xStyle( xParaStyles->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Standard") ) ), uno::UNO_QUERY_THROW );
-+
-+ return xStyle;
-+}
-+
-+uno::Reference< text::XTextRange > getFirstObjectPosition( const uno::Reference< text::XText >& xText ) throw (uno::RuntimeException)
-+{
-+ // if the first object is table, get the position of first cell
-+ uno::Reference< text::XTextRange > xTextRange;
-+ uno::Reference< container::XEnumerationAccess > xParaAccess( xText, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XEnumeration> xParaEnum = xParaAccess->createEnumeration();
-+ if( xParaEnum->hasMoreElements() )
-+ {
-+ uno::Reference< lang::XServiceInfo > xServiceInfo( xParaEnum->nextElement(), uno::UNO_QUERY_THROW );
-+ if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextTable") ) ) )
-+ {
-+ uno::Reference< table::XCellRange > xCellRange( xServiceInfo, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XText> xFirstCellText( xCellRange->getCellByPosition(0, 0), uno::UNO_QUERY_THROW );
-+ xTextRange = xFirstCellText->getStart();
-+ }
-+ }
-+ if( !xTextRange.is() )
-+ xTextRange = xText->getStart();
-+ return xTextRange;
-+}
-+
-+uno::Reference< text::XText > getCurrentXText( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< text::XTextRange > xTextRange;
-+ uno::Reference< text::XTextContent > xTextContent( xModel->getCurrentSelection(), uno::UNO_QUERY );
-+ if( !xTextContent.is() )
-+ {
-+ uno::Reference< container::XIndexAccess > xIndexAccess( xModel->getCurrentSelection(), uno::UNO_QUERY );
-+ if( xIndexAccess.is() )
-+ {
-+ xTextContent.set( xIndexAccess->getByIndex(0), uno::UNO_QUERY );
-+ }
-+ }
-+
-+ if( xTextContent.is() )
-+ xTextRange.set( xTextContent->getAnchor(), uno::UNO_QUERY );
-+
-+ if( !xTextRange.is() )
-+ xTextRange.set( getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
-+
-+ uno::Reference< text::XText > xText;
-+ try
-+ {
-+ xText.set( xTextRange->getText(), uno::UNO_QUERY );
-+ }
-+ catch( uno::RuntimeException& )
-+ {
-+ //catch exception "no text selection"
-+ }
-+ uno::Reference< beans::XPropertySet > xVCProps( xTextRange, uno::UNO_QUERY_THROW );
-+ while( xVCProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ) >>= xTextContent )
-+ {
-+ xText = xTextContent->getAnchor()->getText();
-+ xVCProps.set( xText->createTextCursor(), uno::UNO_QUERY_THROW );
-+ }
-+
-+ if( !xText.is() )
-+ throw uno::RuntimeException( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), uno::Reference< uno::XInterface >() );
-+
-+ return xText;
-+}
-+
-+sal_Bool gotoSelectedObjectAnchor( const uno::Reference< frame::XModel>& xModel ) throw (uno::RuntimeException)
-+{
-+ sal_Bool isObjectSelected = sal_False;
-+ uno::Reference< text::XTextContent > xTextContent( xModel->getCurrentSelection(), uno::UNO_QUERY );
-+ if( xTextContent.is() )
-+ {
-+ uno::Reference< text::XTextRange > xTextRange( xTextContent->getAnchor(), uno::UNO_QUERY_THROW );
-+ uno::Reference< view::XSelectionSupplier > xSelectSupp( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
-+ xSelectSupp->select( uno::makeAny( xTextRange ) );
-+ isObjectSelected = sal_True;
-+ }
-+ return isObjectSelected;
-+}
-+
- } // word
- } //
- } //
-diff --git sw/source/ui/vba/wordvbahelper.hxx sw/source/ui/vba/wordvbahelper.hxx
-index 88aa3c1..1f9835b 100644
---- sw/source/ui/vba/wordvbahelper.hxx
-+++ sw/source/ui/vba/wordvbahelper.hxx
-@@ -35,6 +35,8 @@
- #include <com/sun/star/text/XTextViewCursor.hpp>
- #include <com/sun/star/text/XPageCursor.hpp>
- #include <com/sun/star/style/XStyle.hpp>
-+#include <com/sun/star/text/XTextTable.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-
- class SwDocShell;
- class SwView;
-@@ -49,7 +51,20 @@ namespace ooo
- SwView* getView( const css::uno::Reference< css::frame::XModel>& xModel );
- css::uno::Reference< css::text::XTextViewCursor > getXTextViewCursor( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
- css::uno::Reference< css::style::XStyle > getCurrentPageStyle( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
-+ css::uno::Reference< css::style::XStyle > getCurrentPageStyle( const css::uno::Reference< css::frame::XModel>& xModel, const css::uno::Reference< css::beans::XPropertySet >& xProps ) throw (css::uno::RuntimeException);
- sal_Int32 getPageCount( const css::uno::Reference< css::frame::XModel>& xModel ) throw (css::uno::RuntimeException);
-+ css::uno::Reference< css::style::XStyle > getDefaultParagraphStyle( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
-+ css::uno::Reference< css::text::XTextRange > getFirstObjectPosition( const css::uno::Reference< css::text::XText >& xText ) throw (css::uno::RuntimeException);
-+ css::uno::Reference< css::text::XText > getCurrentXText( const css::uno::Reference< css::frame::XModel>& xModel ) throw (css::uno::RuntimeException);
-+ sal_Bool gotoSelectedObjectAnchor( const css::uno::Reference< css::frame::XModel>& xModel ) throw (css::uno::RuntimeException);
-+
-+ enum E_DIRECTION
-+ {
-+ MOVE_LEFT = 1,
-+ MOVE_RIGHT,
-+ MOVE_UP,
-+ MOVE_DOWN
-+ };
-
- } // word
- } // vba
-diff --git sw/util/makefile.mk sw/util/makefile.mk
-index b4e1127..b726149 100644
---- sw/util/makefile.mk
-+++ sw/util/makefile.mk
-@@ -375,6 +375,10 @@ SHL5STDLIBS= \
- $(SVXCORELIB) \
- $(SVXMSFILTERLIB) \
-
-+.IF "$(GUI)"=="WNT"
-+SHL5STDLIBS+=$(SHELLLIB)
-+.ENDIF #WNT
-+
- SHL5DEPN=$(SHL1TARGETN)
- SHL5LIBS=$(SLB)$/$(TARGET_VBA).lib
-
-diff --git vbahelper/inc/vbahelper/vbacollectionimpl.hxx vbahelper/inc/vbahelper/vbacollectionimpl.hxx
-index bc60cf1..9dbd9f7 100644
---- vbahelper/inc/vbahelper/vbacollectionimpl.hxx
-+++ vbahelper/inc/vbahelper/vbacollectionimpl.hxx
-@@ -161,12 +161,25 @@ typedef InheritedHelperInterfaceImpl< Ifc1 > BaseColBase;
- protected:
- css::uno::Reference< css::container::XIndexAccess > m_xIndexAccess;
- css::uno::Reference< css::container::XNameAccess > m_xNameAccess;
-+ sal_Bool mbIgnoreCase;
-
- 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 >() );
-
-+ if( mbIgnoreCase )
-+ {
-+ css::uno::Sequence< rtl::OUString > sElementNames = m_xNameAccess->getElementNames();
-+ for( sal_Int32 i = 0; i < sElementNames.getLength(); i++ )
-+ {
-+ rtl::OUString aName = sElementNames[i];
-+ if( aName.equalsIgnoreAsciiCase( sIndex ) )
-+ {
-+ return createCollectionObject( m_xNameAccess->getByName( aName ) );
-+ }
-+ }
-+ }
- return createCollectionObject( m_xNameAccess->getByName( sIndex ) );
- }
-
-@@ -185,7 +198,7 @@ protected:
- 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); }
-+ ScVbaCollectionBase( 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 bIgnoreCase = sal_False ) : BaseColBase( xParent, xContext ), m_xIndexAccess( xIndexAccess ), mbIgnoreCase( bIgnoreCase ) { m_xNameAccess.set(m_xIndexAccess, css::uno::UNO_QUERY); }
- //XCollection
- virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException)
- {
-@@ -250,7 +263,7 @@ class VBAHELPER_DLLPUBLIC CollTestImplHelper : public ScVbaCollectionBase< ::cp
- 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 ) {}
-+ CollTestImplHelper( 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 bIgnoreCase = sal_False ) throw( css::uno::RuntimeException ) : ImplBase1( xParent, xContext, xIndexAccess, bIgnoreCase ) {}
- };
-
-
-diff --git vbahelper/inc/vbahelper/vbadocumentbase.hxx vbahelper/inc/vbahelper/vbadocumentbase.hxx
-index 9576510..3880a46 100644
---- vbahelper/inc/vbahelper/vbadocumentbase.hxx
-+++ vbahelper/inc/vbahelper/vbadocumentbase.hxx
-@@ -60,7 +60,7 @@ public:
- 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 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);
-diff --git vbahelper/inc/vbahelper/vbaeventshelperbase.hxx vbahelper/inc/vbahelper/vbaeventshelperbase.hxx
-new file mode 100644
-index 0000000..461cfbc
---- /dev/null
-+++ vbahelper/inc/vbahelper/vbaeventshelperbase.hxx
-@@ -0,0 +1,54 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef VBAEVENTS_HELPER_BASE_HXX
-+#define VBAEVENTS_HELPER_BASE_HXX
-+
-+#include <com/sun/star/uno/XComponentContext.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <map>
-+
-+class VBAHELPER_DLLPUBLIC VbaEventsHelperBase
-+{
-+protected:
-+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
-+ sal_Bool mbIgnoreEvents;
-+ std::map< sal_Int32, rtl::OUString > m_aEventNameMap;
-+
-+protected:
-+ void insert( const sal_Int32 nId, const rtl::OUString& sEventName );
-+ rtl::OUString getEventName( const sal_Int32 nEventId );
-+
-+public:
-+ VbaEventsHelperBase( const css::uno::Reference< css::uno::XComponentContext >& xContext );
-+ virtual void SAL_CALL setIgnoreEvents( ::sal_Bool _ignoreevents ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getIgnoreEvents() throw (css::uno::RuntimeException);
-+};
-+
-+#endif /* VBAEVENTS_HELPER_BASE_HXX */
-diff --git vbahelper/inc/vbahelper/vbahelper.hxx vbahelper/inc/vbahelper/vbahelper.hxx
-index 5d97b81..54ab0ad 100644
---- vbahelper/inc/vbahelper/vbahelper.hxx
-+++ vbahelper/inc/vbahelper/vbahelper.hxx
-@@ -97,6 +97,7 @@ namespace ooo
- VBAHELPER_DLLPUBLIC void setDefaultPropByIntrospection( const css::uno::Any& aObj, const css::uno::Any& aValue ) throw ( css::uno::RuntimeException );
- VBAHELPER_DLLPUBLIC css::uno::Any getPropertyValue( const css::uno::Sequence< css::beans::PropertyValue >& aProp, const rtl::OUString& aName );
- VBAHELPER_DLLPUBLIC sal_Bool setPropertyValue( css::uno::Sequence< css::beans::PropertyValue >& aProp, const rtl::OUString& aName, const css::uno::Any& aValue );
-+ VBAHELPER_DLLPUBLIC void setOrAppendPropertyValue( css::uno::Sequence< css::beans::PropertyValue >& aProp, const rtl::OUString& aName, const css::uno::Any& aValue );
-
- class VBAHELPER_DLLPUBLIC Millimeter
- {
-diff --git vbahelper/inc/vbahelper/vbashaperange.hxx vbahelper/inc/vbahelper/vbashaperange.hxx
-index 0d29c3a..8f79b10 100644
---- vbahelper/inc/vbahelper/vbashaperange.hxx
-+++ vbahelper/inc/vbahelper/vbashaperange.hxx
-@@ -59,6 +59,8 @@ public:
- 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 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);
-@@ -79,6 +81,7 @@ public:
- virtual void SAL_CALL setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL SAL_CALL TextFrame( ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL SAL_CALL WrapFormat( ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL ZOrder( sal_Int32 ZOrderCmd ) 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);
-diff --git vbahelper/prj/d.lst vbahelper/prj/d.lst
-index d7b61d1..db11559 100644
---- vbahelper/prj/d.lst
-+++ vbahelper/prj/d.lst
-@@ -25,3 +25,4 @@ mkdir: %_DEST%\inc%_EXT%\basic
- ..\inc\vbahelper\vbatextframe.hxx %_DEST%\inc%_EXT%\vbahelper\vbatextframe.hxx
- ..\inc\vbahelper\vbashaperange.hxx %_DEST%\inc%_EXT%\vbahelper\vbashaperange.hxx
- ..\inc\vbahelper\vbapagesetupbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbapagesetupbase.hxx
-+..\inc\vbahelper\vbaeventshelperbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbaeventshelperbase.hxx
-diff --git vbahelper/source/msforms/vbacheckbox.hxx vbahelper/source/msforms/vbacheckbox.hxx
-index f3374db..71d45ae 100644
---- vbahelper/source/msforms/vbacheckbox.hxx
-+++ vbahelper/source/msforms/vbacheckbox.hxx
-@@ -35,12 +35,12 @@
- #ifndef SC_VBA_CHECKBOX_HXX
- #define SC_VBA_CHECKBOX_HXX
- #include <cppuhelper/implbase2.hxx>
--#include <ooo/vba/msforms/XRadioButton.hpp>
-+#include <ooo/vba/msforms/XCheckBox.hpp>
-
- #include "vbacontrol.hxx"
- #include <vbahelper/vbahelper.hxx>
-
--typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XRadioButton, css::script::XDefaultProperty > CheckBoxImpl_BASE;
-+typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XCheckBox, css::script::XDefaultProperty > CheckBoxImpl_BASE;
-
- class ScVbaCheckbox : public CheckBoxImpl_BASE
- {
-diff --git vbahelper/source/msforms/vbacontrol.cxx vbahelper/source/msforms/vbacontrol.cxx
-index 353a24f..284bf99 100644
---- vbahelper/source/msforms/vbacontrol.cxx
-+++ vbahelper/source/msforms/vbacontrol.cxx
-@@ -371,6 +371,18 @@ ScVbaControl::setControlTipText( const rtl::OUString& rsToolTip ) throw (css::un
- m_xProps->setPropertyValue
- (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HelpText" ) ), uno::makeAny( rsToolTip ) );
- }
-+
-+::sal_Int32 SAL_CALL ScVbaControl::getForeColor() throw (::com::sun::star::uno::RuntimeException)
-+{
-+ sal_Int32 nForeColor;
-+ m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextColor" ) ) ) >>= nForeColor;
-+ return OORGBToXLRGB( nForeColor );
-+}
-+
-+void SAL_CALL ScVbaControl::setForeColor( ::sal_Int32 _forecolor ) throw (::com::sun::star::uno::RuntimeException)
-+{
-+ m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextColor" ) ), uno::makeAny( XLRGBToOORGB( _forecolor ) ) );
-+}
- //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 )
-diff --git vbahelper/source/msforms/vbacontrol.hxx vbahelper/source/msforms/vbacontrol.hxx
-index 3c9a128..3d7f67f 100644
---- vbahelper/source/msforms/vbacontrol.hxx
-+++ vbahelper/source/msforms/vbacontrol.hxx
-@@ -90,6 +90,8 @@ public:
- virtual void SAL_CALL setControlTipText( const rtl::OUString& ) 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 );
-+ virtual ::sal_Int32 SAL_CALL getForeColor() throw (::com::sun::star::uno::RuntimeException);
-+ virtual void SAL_CALL setForeColor( ::sal_Int32 _forecolor ) throw (::com::sun::star::uno::RuntimeException);
- //XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-diff --git vbahelper/source/msforms/vbaframe.cxx vbahelper/source/msforms/vbaframe.cxx
-index d765d9b..e3a586e 100644
---- vbahelper/source/msforms/vbaframe.cxx
-+++ vbahelper/source/msforms/vbaframe.cxx
-@@ -84,6 +84,19 @@ void SAL_CALL ScVbaFrame::setForeColor( ::sal_Int32 /*_forecolor*/ ) throw (::co
- }
- //liuchen 2009-7-6 end
-
-+rtl::OUString SAL_CALL
-+ScVbaFrame::getAccelerator() throw (css::uno::RuntimeException)
-+{
-+ //FIXME: seems not support?
-+ return rtl::OUString();
-+}
-+
-+void SAL_CALL
-+ScVbaFrame::setAccelerator( const rtl::OUString& /*_accelerator*/ ) throw (::com::sun::star::uno::RuntimeException)
-+{
-+ //FIXME: seems not support?
-+}
-+
- rtl::OUString&
- ScVbaFrame::getServiceImplName()
- {
-diff --git vbahelper/source/msforms/vbaframe.hxx vbahelper/source/msforms/vbaframe.hxx
-index 9b1b6bb..a9346a0 100644
---- vbahelper/source/msforms/vbaframe.hxx
-+++ vbahelper/source/msforms/vbaframe.hxx
-@@ -55,6 +55,8 @@ public:
- virtual ::sal_Int32 SAL_CALL getForeColor() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setForeColor( ::sal_Int32 _forecolor ) throw (::com::sun::star::uno::RuntimeException);
- //liuchen 2009-7-6 end
-+ virtual rtl::OUString SAL_CALL getAccelerator() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setAccelerator( const rtl::OUString& _accelerator ) throw (css::uno::RuntimeException);
- //XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-diff --git vbahelper/source/msforms/vbalabel.cxx vbahelper/source/msforms/vbalabel.cxx
-index a9869f7..93fb8c8 100644
---- vbahelper/source/msforms/vbalabel.cxx
-+++ vbahelper/source/msforms/vbalabel.cxx
-@@ -35,7 +35,6 @@ using namespace ooo::vba;
-
-
- const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
--const static rtl::OUString FORECOLOR( RTL_CONSTASCII_USTRINGPARAM("TextColor") ); //liuchen 2009-7-6
- 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 )
- {
- }
-@@ -68,20 +67,18 @@ ScVbaLabel::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::Run
- setCaption( sCaption );
- }
-
--
--//liuchen 2009-7-6
--::sal_Int32 SAL_CALL ScVbaLabel::getForeColor() throw (::com::sun::star::uno::RuntimeException)
-+rtl::OUString SAL_CALL
-+ScVbaLabel::getAccelerator() throw (css::uno::RuntimeException)
- {
-- sal_Int32 nForeColor;
-- m_xProps->getPropertyValue( FORECOLOR ) >>= nForeColor;
-- return OORGBToXLRGB( nForeColor );
-+ //FIXME: seems not support?
-+ return rtl::OUString();
- }
-
--void SAL_CALL ScVbaLabel::setForeColor( ::sal_Int32 _forecolor ) throw (::com::sun::star::uno::RuntimeException)
--{
-- m_xProps->setPropertyValue( FORECOLOR, uno::makeAny( XLRGBToOORGB( _forecolor ) ) );
-+void SAL_CALL
-+ScVbaLabel::setAccelerator( const rtl::OUString& /*_accelerator*/ ) throw (::com::sun::star::uno::RuntimeException)
-+{
-+ //FIXME: seems not support?
- }
--//liuchenn 2009-7-6
-
- rtl::OUString&
- ScVbaLabel::getServiceImplName()
-diff --git vbahelper/source/msforms/vbalabel.hxx vbahelper/source/msforms/vbalabel.hxx
-index 9c8766d..01f4d9b 100644
---- vbahelper/source/msforms/vbalabel.hxx
-+++ vbahelper/source/msforms/vbalabel.hxx
-@@ -47,10 +47,8 @@ public:
- 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);
-- //liuchen 2009-7-6
-- virtual ::sal_Int32 SAL_CALL getForeColor() throw (::com::sun::star::uno::RuntimeException);
-- virtual void SAL_CALL setForeColor( ::sal_Int32 _forecolor ) throw (::com::sun::star::uno::RuntimeException);
-- //liuchen 2009-7-6 end
-+ virtual rtl::OUString SAL_CALL getAccelerator() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setAccelerator( const rtl::OUString& _accelerator ) throw (css::uno::RuntimeException);
- //XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-diff --git vbahelper/source/msforms/vbalistcontrolhelper.cxx vbahelper/source/msforms/vbalistcontrolhelper.cxx
-index 8582821..2aed7f1 100644
---- vbahelper/source/msforms/vbalistcontrolhelper.cxx
-+++ vbahelper/source/msforms/vbalistcontrolhelper.cxx
-@@ -1,11 +1,69 @@
- #include <vbalistcontrolhelper.hxx>
- #include <vector>
-+#include <vbahelper/vbapropvalue.hxx>
-
- using namespace com::sun::star;
- using namespace ooo::vba;
-
- const static rtl::OUString ITEMS( RTL_CONSTASCII_USTRINGPARAM("StringItemList") );
-
-+class ListPropListener : public PropListener
-+{
-+private:
-+ uno::Reference< beans::XPropertySet > m_xProps;
-+ uno::Any m_pvargIndex;
-+ uno::Any m_pvarColumn;
-+
-+public:
-+ ListPropListener( const uno::Reference< beans::XPropertySet >& xProps, const uno::Any& pvargIndex, const uno::Any& pvarColumn );
-+ virtual void setValueEvent( const css::uno::Any& value );
-+ virtual css::uno::Any getValueEvent();
-+};
-+
-+ListPropListener::ListPropListener( const uno::Reference< beans::XPropertySet >& xProps, const uno::Any& pvargIndex, const uno::Any& pvarColumn ) : m_xProps( xProps ), m_pvargIndex( pvargIndex ), m_pvarColumn( pvarColumn )
-+{
-+}
-+
-+void ListPropListener::setValueEvent( const uno::Any& value )
-+{
-+ if( m_pvargIndex.hasValue() || m_pvarColumn.hasValue() )
-+ throw uno::RuntimeException( rtl::OUString::createFromAscii(
-+ "Bad argument" ), uno::Reference< uno::XInterface >() );
-+
-+ m_xProps->setPropertyValue( ITEMS, value );
-+}
-+
-+uno::Any ListPropListener::getValueEvent()
-+{
-+ uno::Sequence< rtl::OUString > sList;
-+ m_xProps->getPropertyValue( ITEMS ) >>= sList;
-+ sal_Int16 nLength = static_cast< sal_Int16 >( sList.getLength() );
-+ uno::Any aRet;
-+ if ( m_pvargIndex.hasValue() )
-+ {
-+ sal_Int16 nIndex = -1;
-+ m_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 ( m_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;
-+}
-+
- void SAL_CALL
- ListControlHelper::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex ) throw (uno::RuntimeException)
- {
-@@ -116,31 +174,5 @@ ListControlHelper::getListCount() throw (uno::RuntimeException)
- 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;
-+ return uno::makeAny( uno::Reference< XPropValue > ( new ScVbaPropValue( new ListPropListener( m_xProps, pvargIndex, pvarColumn ) ) ) );
- }
-diff --git vbahelper/source/vbahelper/makefile.mk vbahelper/source/vbahelper/makefile.mk
-index bd57415..53e14dc 100644
---- vbahelper/source/vbahelper/makefile.mk
-+++ vbahelper/source/vbahelper/makefile.mk
-@@ -64,6 +64,7 @@ SLOFILES=\
- $(SLO)$/vbashaperange.obj \
- $(SLO)$/vbatextframe.obj \
- $(SLO)$/vbapagesetupbase.obj \
-+ $(SLO)$/vbaeventshelperbase.obj \
-
- # --- Targets -------------------------------------------------------
-
-diff --git vbahelper/source/vbahelper/vbaapplicationbase.cxx vbahelper/source/vbahelper/vbaapplicationbase.cxx
-index 81ff270..5468339 100644
---- vbahelper/source/vbahelper/vbaapplicationbase.cxx
-+++ vbahelper/source/vbahelper/vbaapplicationbase.cxx
-@@ -76,6 +76,8 @@ void SAL_CALL
- VbaApplicationBase::setScreenUpdating(sal_Bool bUpdate) throw (uno::RuntimeException)
- {
- uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
-+ if( bUpdate != xModel->hasControllersLocked() )
-+ return;
- if (bUpdate)
- xModel->unlockControllers();
- else
-@@ -141,7 +143,8 @@ VbaApplicationBase::getVersion() throw (uno::RuntimeException)
-
- void SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, const uno::Any& varg1, const uno::Any& varg2, const uno::Any& varg3, const uno::Any& varg4, const uno::Any& varg5, const uno::Any& varg6, const uno::Any& varg7, const uno::Any& varg8, const uno::Any& varg9, const uno::Any& varg10, const uno::Any& varg11, const uno::Any& varg12, const uno::Any& varg13, const uno::Any& varg14, const uno::Any& varg15, const uno::Any& varg16, const uno::Any& varg17, const uno::Any& varg18, const uno::Any& varg19, const uno::Any& varg20, const uno::Any& varg21, const uno::Any& varg22, const uno::Any& varg23, const uno::Any& varg24, const uno::Any& varg25, const uno::Any& varg26, const uno::Any& varg27, const uno::Any& varg28, const uno::Any& varg29, const uno::Any& varg30 ) throw (uno::RuntimeException)
- {
-- VBAMacroResolvedInfo aMacroInfo = resolveVBAMacro( getSfxObjShell( getCurrentDocument() ), MacroName );
-+ // search the global tempalte
-+ VBAMacroResolvedInfo aMacroInfo = resolveVBAMacro( getSfxObjShell( getCurrentDocument() ), MacroName, sal_True );
- if( aMacroInfo.IsResolved() )
- {
- // handle the arguments
-diff --git vbahelper/source/vbahelper/vbadocumentbase.cxx vbahelper/source/vbahelper/vbadocumentbase.cxx
-index 3830fe9..87a7e68 100644
---- vbahelper/source/vbahelper/vbadocumentbase.cxx
-+++ vbahelper/source/vbahelper/vbadocumentbase.cxx
-@@ -36,6 +36,7 @@
- #include <com/sun/star/util/XCloseable.hpp>
- #include <com/sun/star/frame/XStorable.hpp>
- #include <com/sun/star/frame/XFrame.hpp>
-+#include <com/sun/star/frame/XTitle.hpp>
- #include <com/sun/star/beans/XPropertySet.hpp>
-
- #include <tools/urlobj.hxx>
-@@ -69,13 +70,8 @@ VbaDocumentBase::getName() throw (uno::RuntimeException)
- }
- 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);
-+ uno::Reference< frame::XTitle > xTitle( getModel(), uno::UNO_QUERY_THROW );
-+ sName = xTitle->getTitle();
- }
- return sName;
- }
-@@ -136,7 +132,13 @@ VbaDocumentBase::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg,
- // 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);
-+ try
-+ {
-+ xCloseable->close(sal_True);
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
- // 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.
-@@ -144,7 +146,16 @@ VbaDocumentBase::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg,
- {
- uno::Reference< lang::XComponent > xDisposable ( getModel(), uno::UNO_QUERY );
- if ( xDisposable.is() )
-- xDisposable->dispose();
-+ {
-+ // To be on the safe side, catch possible veto exception anyway.
-+ try
-+ {
-+ xDisposable->dispose();
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+ }
- }
- }
-
-diff --git vbahelper/source/vbahelper/vbadocumentsbase.cxx vbahelper/source/vbahelper/vbadocumentsbase.cxx
-index e7907b7..d8a9df7 100644
---- vbahelper/source/vbahelper/vbadocumentsbase.cxx
-+++ vbahelper/source/vbahelper/vbadocumentsbase.cxx
-@@ -37,6 +37,7 @@
- #include <com/sun/star/lang/XComponent.hpp>
- #include <com/sun/star/frame/XModel.hpp>
- #include <com/sun/star/frame/XFrame.hpp>
-+#include <com/sun/star/frame/XTitle.hpp>
- #include <com/sun/star/frame/FrameSearchFlag.hpp>
- #include <com/sun/star/util/XModifiable.hpp>
- #include <com/sun/star/frame/XStorable.hpp>
-@@ -146,8 +147,18 @@ public:
- {
- uno::Reference< frame::XModel > xModel( xServiceInfo, uno::UNO_QUERY_THROW ); // that the spreadsheetdocument is a xmodel is a given
- m_documents.push_back( xModel );
-- INetURLObject aURL( xModel->getURL() );
-- namesToIndices[ aURL.GetLastName() ] = nIndex++;
-+ rtl::OUString sName = xModel->getURL();
-+ if( sName.getLength() )
-+ {
-+ INetURLObject aURL( xModel->getURL() );
-+ namesToIndices[ aURL.GetLastName() ] = nIndex++;
-+ }
-+ else
-+ {
-+ uno::Reference< frame::XTitle > xTitle( xModel, uno::UNO_QUERY_THROW );
-+ sName = xTitle->getTitle();
-+ namesToIndices[ sName ] = nIndex++;
-+ }
- }
- }
-
-diff --git vbahelper/source/vbahelper/vbaeventshelperbase.cxx vbahelper/source/vbahelper/vbaeventshelperbase.cxx
-new file mode 100644
-index 0000000..52aba1f
---- /dev/null
-+++ vbahelper/source/vbahelper/vbaeventshelperbase.cxx
-@@ -0,0 +1,60 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include <vbahelper/vbaeventshelperbase.hxx>
-+
-+using namespace ::com::sun::star;
-+
-+VbaEventsHelperBase::VbaEventsHelperBase( const css::uno::Reference< css::uno::XComponentContext >& xContext ) : m_xContext( xContext ), mbIgnoreEvents( sal_False )
-+{
-+}
-+
-+void VbaEventsHelperBase::insert( const sal_Int32 nId, const rtl::OUString& sEventName )
-+{
-+ m_aEventNameMap.insert( std::make_pair( nId, sEventName ) );
-+}
-+
-+rtl::OUString VbaEventsHelperBase::getEventName( const sal_Int32 nId )
-+{
-+ std::map< sal_Int32, rtl::OUString >::iterator iter = m_aEventNameMap.find( nId );
-+ if( iter != m_aEventNameMap.end() )
-+ return iter->second;
-+ return rtl::OUString();
-+}
-+
-+void SAL_CALL VbaEventsHelperBase::setIgnoreEvents( ::sal_Bool _ignoreevents ) throw (css::uno::RuntimeException)
-+{
-+ mbIgnoreEvents = _ignoreevents;
-+}
-+
-+::sal_Bool SAL_CALL VbaEventsHelperBase::getIgnoreEvents() throw (css::uno::RuntimeException)
-+{
-+ return mbIgnoreEvents;
-+}
-+
-diff --git vbahelper/source/vbahelper/vbahelper.cxx vbahelper/source/vbahelper/vbahelper.cxx
-index 901cc71..1290b25 100644
---- vbahelper/source/vbahelper/vbahelper.cxx
-+++ vbahelper/source/vbahelper/vbahelper.cxx
-@@ -970,6 +970,18 @@ sal_Bool setPropertyValue( uno::Sequence< beans::PropertyValue >& aProp, const r
- return sal_False;
- }
-
-+void setOrAppendPropertyValue( uno::Sequence< beans::PropertyValue >& aProp, const rtl::OUString& aName, const uno::Any& aValue )
-+{
-+ if( setPropertyValue( aProp, aName, aValue ) )
-+ return;
-+
-+ // append the property
-+ sal_Int32 nLength = aProp.getLength();
-+ aProp.realloc( nLength + 1 );
-+ aProp[ nLength ].Name = aName;
-+ aProp[ nLength ].Value = aValue;
-+}
-+
- #define VBA_LEFT "PositionX"
- #define VBA_TOP "PositionY"
- UserFormGeometryHelper::UserFormGeometryHelper( const uno::Reference< uno::XComponentContext >& /*xContext*/, const uno::Reference< awt::XControl >& xControl )
-diff --git vbahelper/source/vbahelper/vbashape.cxx vbahelper/source/vbahelper/vbashape.cxx
-index c35745b..c0c6ba3 100644
---- vbahelper/source/vbahelper/vbashape.cxx
-+++ vbahelper/source/vbahelper/vbashape.cxx
-@@ -38,6 +38,7 @@
- #include <com/sun/star/lang/XServiceInfo.hpp>
- #include <com/sun/star/lang/XMultiServiceFactory.hpp>
- #include <com/sun/star/text/TextContentAnchorType.hpp>
-+#include <com/sun/star/text/RelOrientation.hpp>
- #include <ooo/vba/word/WdRelativeHorizontalPosition.hpp>
- #include <ooo/vba/word/WdRelativeVerticalPosition.hpp>
-
-@@ -222,25 +223,66 @@ ScVbaShape::setWidth( double _width ) throw (uno::RuntimeException)
- double SAL_CALL
- ScVbaShape::getLeft() throw (uno::RuntimeException)
- {
-- return m_pShapeHelper->getLeft();
-+ double left = 0;
-+ try
-+ {
-+ left = m_pShapeHelper->getLeft();
-+ }
-+ catch( uno::Exception& )
-+ {
-+ // fail to get position by using XShape::getPosition()
-+ sal_Int32 nLeft = 0;
-+ m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HoriOrientPosition") ) ) >>= nLeft;
-+ left = Millimeter::getInPoints( nLeft );
-+ }
-+ return left;
- }
-
- void SAL_CALL
- ScVbaShape::setLeft( double _left ) throw (uno::RuntimeException)
- {
-- m_pShapeHelper->setLeft( _left );
-+ try
-+ {
-+ m_pShapeHelper->setLeft( _left );
-+ }
-+ catch( uno::Exception& )
-+ {
-+ sal_Int32 nLeft = 0;
-+ nLeft = Millimeter::getInHundredthsOfOneMillimeter( _left );
-+ m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "HoriOrientPosition" ), uno::makeAny( nLeft ) );
-+ }
- }
-
- double SAL_CALL
- ScVbaShape::getTop() throw (uno::RuntimeException)
- {
-- return m_pShapeHelper->getTop();
-+ double top = 0;
-+ try
-+ {
-+ top = m_pShapeHelper->getTop();
-+ }
-+ catch( uno::Exception& )
-+ {
-+ sal_Int32 nTop = 0;
-+ m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VertOrientPosition") ) ) >>= nTop;
-+ top = Millimeter::getInPoints( nTop );
-+ }
-+ return top;
- }
-
- void SAL_CALL
- ScVbaShape::setTop( double _top ) throw (uno::RuntimeException)
- {
-- return m_pShapeHelper->setTop( _top );
-+ try
-+ {
-+ m_pShapeHelper->setTop( _top );
-+ }
-+ catch( uno::Exception& )
-+ {
-+ sal_Int32 nTop = 0;
-+ nTop = Millimeter::getInHundredthsOfOneMillimeter( _top );
-+ m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "VertOrientPosition" ), uno::makeAny( nTop ) );
-+ }
- }
-
- sal_Bool SAL_CALL
-@@ -507,35 +549,34 @@ sal_Int32 SAL_CALL
- ScVbaShape::getRelativeHorizontalPosition() throw (uno::RuntimeException)
- {
- sal_Int32 nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin;
-- text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH;
-- m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ) ) >>= eType;
-+ sal_Int16 nType = text::RelOrientation::PAGE_LEFT;
-+ m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HoriOrientRelation") ) ) >>= nType;
-
-- switch( eType )
-+ switch( nType )
- {
-- case text::TextContentAnchorType_AT_PARAGRAPH:
-+ case text::RelOrientation::FRAME:
- {
- nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionColumn;
- break;
- }
-- case text::TextContentAnchorType_AT_PAGE:
-+ case text::RelOrientation::PAGE_FRAME:
- {
- nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionPage;
- break;
- }
-- case text::TextContentAnchorType_AT_CHARACTER:
-+ case text::RelOrientation::CHAR:
- {
- nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionCharacter;
- break;
- }
-- case text::TextContentAnchorType_AT_FRAME:
-- case text::TextContentAnchorType_AS_CHARACTER:
-+ case text::RelOrientation::PAGE_PRINT_AREA:
- {
- nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin;
- break;
- }
- default:
- {
-- nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin;
-+ throw uno::RuntimeException( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Shape::RelativeHorizontalPosition: not implemented" ) ), uno::Reference< uno::XInterface >() );
- }
- }
- return nRelativeHorizontalPosition;
-@@ -544,23 +585,27 @@ ScVbaShape::getRelativeHorizontalPosition() throw (uno::RuntimeException)
- void SAL_CALL
- ScVbaShape::setRelativeHorizontalPosition( ::sal_Int32 _relativehorizontalposition ) throw (uno::RuntimeException)
- {
-- text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH;
-+ sal_Int16 nType = text::RelOrientation::PAGE_FRAME;
- switch( _relativehorizontalposition )
- {
- case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionCharacter:
- {
-- eType = text::TextContentAnchorType_AT_CHARACTER;
-+ nType = text::RelOrientation::CHAR;
- break;
- }
- case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionColumn:
-+ {
-+ nType = text::RelOrientation::PAGE_FRAME;
-+ break;
-+ }
- case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin:
- {
-- eType = text::TextContentAnchorType_AT_PARAGRAPH;
-+ nType = text::RelOrientation::PAGE_PRINT_AREA;
- break;
- }
- case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionPage:
- {
-- eType = text::TextContentAnchorType_AT_PAGE;
-+ nType = text::RelOrientation::PAGE_FRAME;
- break;
- }
- default:
-@@ -568,42 +613,41 @@ ScVbaShape::setRelativeHorizontalPosition( ::sal_Int32 _relativehorizontalpositi
- DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
- }
- }
-- m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ), uno::makeAny( eType ) );
-+ m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HoriOrientRelation") ), uno::makeAny( nType ) );
- }
-
- sal_Int32 SAL_CALL
- ScVbaShape::getRelativeVerticalPosition() throw (uno::RuntimeException)
- {
- sal_Int32 nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin;
-- text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH;
-- m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ) ) >>= eType;
-+ sal_Int16 nType = text::RelOrientation::PAGE_FRAME;
-+ m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VertOrientRelation") ) ) >>= nType;
-
-- switch( eType )
-+ switch( nType )
- {
-- case text::TextContentAnchorType_AT_PARAGRAPH:
-+ case text::RelOrientation::FRAME:
- {
- nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionParagraph;
- break;
- }
-- case text::TextContentAnchorType_AT_PAGE:
-+ case text::RelOrientation::PAGE_FRAME:
- {
- nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionPage;
- break;
- }
-- case text::TextContentAnchorType_AT_CHARACTER:
-+ case text::RelOrientation::TEXT_LINE:
- {
- nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionLine;
- break;
- }
-- case text::TextContentAnchorType_AT_FRAME:
-- case text::TextContentAnchorType_AS_CHARACTER:
-+ case text::RelOrientation::PAGE_PRINT_AREA:
- {
- nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin;
- break;
- }
- default:
- {
-- nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin;
-+ throw uno::RuntimeException( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Shape::RelativeVerticalPosition: not implemented" ) ), uno::Reference< uno::XInterface >() );
- }
- }
- return nRelativeVerticalPosition;
-@@ -612,23 +656,27 @@ ScVbaShape::getRelativeVerticalPosition() throw (uno::RuntimeException)
- void SAL_CALL
- ScVbaShape::setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition ) throw (uno::RuntimeException)
- {
-- text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH;
-+ sal_Int16 nType = text::RelOrientation::PAGE_FRAME;
- switch( _relativeverticalposition )
- {
- case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionLine:
- {
-- eType = text::TextContentAnchorType_AT_CHARACTER;
-+ nType = text::RelOrientation::TEXT_LINE;
- break;
- }
- case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionParagraph:
-+ {
-+ nType = text::RelOrientation::FRAME;
-+ break;
-+ }
- case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin:
- {
-- eType = text::TextContentAnchorType_AT_PARAGRAPH;
-+ nType = text::RelOrientation::PAGE_PRINT_AREA;
- break;
- }
- case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionPage:
- {
-- eType = text::TextContentAnchorType_AT_PAGE;
-+ nType = text::RelOrientation::PAGE_FRAME;
- break;
- }
- default:
-@@ -636,7 +684,7 @@ ScVbaShape::setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition )
- DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
- }
- }
-- m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ), uno::makeAny( eType ) );
-+ m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VertOrientRelation") ), uno::makeAny( nType ) );
- }
-
- uno::Any SAL_CALL
-diff --git vbahelper/source/vbahelper/vbashaperange.cxx vbahelper/source/vbahelper/vbashaperange.cxx
-index 0c3535b..b088adf 100644
---- vbahelper/source/vbahelper/vbashaperange.cxx
-+++ vbahelper/source/vbahelper/vbashaperange.cxx
-@@ -128,6 +128,27 @@ ScVbaShapeRange::IncrementTop( double Increment ) throw (uno::RuntimeException)
- }
- }
-
-+rtl::OUString SAL_CALL ScVbaShapeRange::getName() 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 );
-+ return xShape->getName( );
-+ }
-+ throw uno::RuntimeException();
-+}
-+
-+void SAL_CALL ScVbaShapeRange::setName( const rtl::OUString& _name ) 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->setName( _name );
-+ }
-+}
-+
- double SAL_CALL ScVbaShapeRange::getHeight() throw (uno::RuntimeException)
- {
- sal_Int32 nLen = getCount();
-@@ -340,6 +361,16 @@ uno::Any SAL_CALL ScVbaShapeRange::WrapFormat( ) throw (css::uno::RuntimeExcept
- throw uno::RuntimeException();
- }
-
-+void SAL_CALL ScVbaShapeRange::ZOrder( sal_Int32 ZOrderCmd ) 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->ZOrder( ZOrderCmd );
-+ }
-+}
-+
- uno::Type SAL_CALL
- ScVbaShapeRange::getElementType() throw (uno::RuntimeException)
- {
-diff --git vbahelper/source/vbahelper/vbashapes.cxx vbahelper/source/vbahelper/vbashapes.cxx
-index 5302f92..0b09fcc 100644
---- vbahelper/source/vbahelper/vbashapes.cxx
-+++ vbahelper/source/vbahelper/vbashapes.cxx
-@@ -89,7 +89,7 @@ void ScVbaShapes::initBaseCollection()
- 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, const uno::Reference< frame::XModel>& xModel ): ScVbaShapes_BASE( xParent, xContext, xShapes ), m_nNewShapeCount(0), m_xModel( xModel )
-+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, const uno::Reference< frame::XModel>& xModel ): ScVbaShapes_BASE( xParent, xContext, xShapes, sal_True ), m_nNewShapeCount(0), m_xModel( xModel )
- {
- m_xShapes.set( xShapes, uno::UNO_QUERY_THROW );
- m_xDrawPage.set( xShapes, uno::UNO_QUERY_THROW );
diff --git a/patches/vba/vba-word-support-part2.diff b/patches/vba/vba-word-support-part2.diff
deleted file mode 100644
index fdecccf06..000000000
--- a/patches/vba/vba-word-support-part2.diff
+++ /dev/null
@@ -1,23674 +0,0 @@
---- forms/source/component/ListBox.cxx
-+++ forms/source/component/ListBox.cxx
-@@ -1514,6 +1514,8 @@ namespace frm
- void SAL_CALL OListBoxControl::itemStateChanged(const ItemEvent& _rEvent) throw(RuntimeException)
- {
- // forward this to our listeners
-+ Reference< XChild > xChild( getModel(), UNO_QUERY );
-+ if ( xChild.is() && xChild->getParent().is() )
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_aItemListeners.getLength() )
-@@ -1526,6 +1528,8 @@ namespace frm
- m_pItemBroadcaster->addEvent( new ItemEventDescription( _rEvent ), this );
- }
- }
-+ else
-+ m_aItemListeners.notifyEach( &XItemListener::itemStateChanged, _rEvent );
-
- // and do the handling for the ChangeListeners
- ::osl::ClearableMutexGuard aGuard(m_aMutex);
-diff --git oovbaapi/ooo/vba/XApplicationBase.idl oovbaapi/ooo/vba/XApplicationBase.idl
-index bd2fa27..38efadd 100644
---- oovbaapi/ooo/vba/XApplicationBase.idl
-+++ oovbaapi/ooo/vba/XApplicationBase.idl
-@@ -52,8 +52,11 @@ interface XApplicationBase
-
- [attribute] boolean ScreenUpdating;
- [attribute] boolean DisplayStatusBar;
-+ [attribute, readonly] string Version;
-
- any CommandBars( [in] any aIndex );
-+ void Run([in] string MacroName, [in] /*Optional*/ any varg1, [in] /*Optional*/ any varg2, [in] /*Optional*/ any varg3, [in] /*Optional*/ any varg4, [in] /*Optional*/ any varg5, [in] /*Optional*/ any varg6, [in] /*Optional*/ any varg7, [in] /*Optional*/ any varg8, [in] /*Optional*/ any varg9, [in] /*Optional*/ any varg10, [in] /*Optional*/ any varg11, [in] /*Optional*/ any varg12, [in] /*Optional*/ any varg13, [in] /*Optional*/ any varg14, [in] /*Optional*/ any varg15, [in] /*Optional*/ any varg16, [in] /*Optional*/ any varg17, [in] /*Optional*/ any varg18, [in] /*Optional*/ any varg19, [in] /*Optional*/ any varg20, [in] /*Optional*/ any varg21, [in] /*Optional*/ any varg22, [in] /*Optional*/ any varg23, [in] /*Optional*/ any varg24, [in] /*Optional*/ any varg25, [in] /*Optional*/ any varg26, [in] /*Optional*/ any varg27, [in] /*Optional*/ any varg28, [in] /*Optional*/ any varg29, [in] /*Optional*/ any varg30);
-+ float CentimetersToPoints([in] float Centimeters );
- };
-
- }; };
-diff --git oovbaapi/ooo/vba/XDialogBase.idl oovbaapi/ooo/vba/XDialogBase.idl
-new file mode 100644
-index 0000000..550c50f
---- /dev/null
-+++ oovbaapi/ooo/vba/XDialogBase.idl
-@@ -0,0 +1,58 @@
-+/*************************************************************************
-+ *
-+ * 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: XDialog.idl,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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_XDialog_idl__
-+#define __ooo_vba_XDialog_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba {
-+
-+//=============================================================================
-+
-+interface XDialogBase
-+{
-+ interface ::ooo::vba::XHelperInterface;
-+
-+ void Show();
-+};
-+
-+}; };
-+
-+#endif
-+
-diff --git oovbaapi/ooo/vba/XDialogsBase.idl oovbaapi/ooo/vba/XDialogsBase.idl
-new file mode 100644
-index 0000000..14feec4
---- /dev/null
-+++ oovbaapi/ooo/vba/XDialogsBase.idl
-@@ -0,0 +1,60 @@
-+/*************************************************************************
-+ *
-+ * 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: XDialogs.idl,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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_XDialogs_idl__
-+#define __ooo_vba_XDialogs_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+//=============================================================================
-+
-+module ooo { module vba {
-+
-+//interface XDialogs : ::ooo::vba::XCollection
-+interface XDialogsBase
-+{
-+ interface ::ooo::vba::XHelperInterface;
-+
-+ [attribute, readonly] long Count;
-+ any Item( [in] any Index );
-+};
-+
-+}; };
-+
-+#endif
-+
-diff --git oovbaapi/ooo/vba/XDocumentsBase.idl oovbaapi/ooo/vba/XDocumentsBase.idl
-new file mode 100644
-index 0000000..33de551
---- /dev/null
-+++ oovbaapi/ooo/vba/XDocumentsBase.idl
-@@ -0,0 +1,55 @@
-+/*************************************************************************
-+ *
-+ * 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: XDocumentsBase.idl,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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_XDocumentsBase_idl__
-+#define __ooo_vba_XDocumentsBase_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba {
-+
-+//=============================================================================
-+
-+interface XDocumentsBase
-+{
-+ interface ::ooo::vba::XCollection;
-+};
-+
-+}; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/XFontBase.idl oovbaapi/ooo/vba/XFontBase.idl
-new file mode 100644
-index 0000000..c2fe1c5
---- /dev/null
-+++ oovbaapi/ooo/vba/XFontBase.idl
-@@ -0,0 +1,71 @@
-+/*************************************************************************
-+ *
-+ * 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: XFont.idl,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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_XFont_idl__
-+#define __ooo_vba_XFont_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+#ifndef __com_sun_star_lang_IndexOutOfBoundsException_idl__
-+#include <com/sun/star/lang/IndexOutOfBoundsException.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+//=============================================================================
-+
-+module ooo { module vba {
-+
-+interface XFontBase
-+{
-+ interface ::ooo::vba::XHelperInterface;
-+
-+ [attribute] any Size;
-+ [attribute] any ColorIndex;
-+ [attribute] any Color;
-+ [attribute] any Bold;
-+ [attribute] any Underline;
-+ [attribute] any Strikethrough;
-+ [attribute] any Shadow;
-+ [attribute] any Italic;
-+ [attribute] any Subscript;
-+ [attribute] any Superscript;
-+ [attribute] any Name;
-+};
-+
-+//=============================================================================
-+
-+}; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/XPageSetupBase.idl oovbaapi/ooo/vba/XPageSetupBase.idl
-new file mode 100644
-index 0000000..c79f831
---- /dev/null
-+++ oovbaapi/ooo/vba/XPageSetupBase.idl
-@@ -0,0 +1,67 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_XPageSetupBase_idl__
-+#define __ooo_vba_XPageSetupBase_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+//=============================================================================
-+
-+module ooo { module vba {
-+
-+//=============================================================================
-+
-+
-+interface XPageSetupBase
-+{
-+
-+ interface ::ooo::vba::XHelperInterface;
-+
-+ //Attributes
-+ [attribute] double TopMargin;
-+ [attribute] double BottomMargin;
-+ [attribute] double RightMargin;
-+ [attribute] double LeftMargin;
-+ [attribute] long Orientation;
-+};
-+
-+//=============================================================================
-+
-+}; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/excel/TextFrame.idl oovbaapi/ooo/vba/excel/TextFrame.idl
-new file mode 100644
-index 0000000..f6fb5cb
---- /dev/null
-+++ oovbaapi/ooo/vba/excel/TextFrame.idl
-@@ -0,0 +1,53 @@
-+/*************************************************************************
-+ *
-+ * 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 __ooo_vba_excel_TextFrame_idl__
-+#define __ooo_vba_excel_TextFrame_idl__
-+
-+#ifndef __ooo_vba_excel_XTextFrame_idl__
-+#include <ooo/vba/excel/XTextFrame.idl>
-+#endif
-+
-+#include <com/sun/star/uno/XComponentContext.idl>
-+
-+module ooo { module vba { module excel {
-+service TextFrame : XTextFrame
-+{
-+ //createTextFrame( [in] ::ooo::vba::XHelperInterface Parent, [in] ::com::sun::star::frame::XModel xModel );
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/excel/XApplication.idl oovbaapi/ooo/vba/excel/XApplication.idl
-index 35c4852..2d903de 100644
---- oovbaapi/ooo/vba/excel/XApplication.idl
-+++ oovbaapi/ooo/vba/excel/XApplication.idl
-@@ -75,7 +75,6 @@ interface XApplication : com::sun::star::uno::XInterface
- [attribute] any CutCopyMode;
- [attribute] any StatusBar;
- [attribute] long Cursor;
-- [attribute, readonly] string Version;
-
- void setDefaultFilePath([in] string DefaultFilePath) raises(com::sun::star::script::BasicErrorException);
-
-diff --git oovbaapi/ooo/vba/excel/XDialog.idl oovbaapi/ooo/vba/excel/XDialog.idl
-index da45681..c9900f4 100644
---- oovbaapi/ooo/vba/excel/XDialog.idl
-+++ oovbaapi/ooo/vba/excel/XDialog.idl
-@@ -45,13 +45,8 @@ module ooo { module vba { module excel {
-
- //=============================================================================
-
--interface XApplication;
--
--interface XDialog
-+interface XDialog : com::sun::star::uno::XInterface
- {
-- interface ::ooo::vba::XHelperInterface;
--
-- void Show();
- };
-
- }; }; };
-diff --git oovbaapi/ooo/vba/excel/XDialogs.idl oovbaapi/ooo/vba/excel/XDialogs.idl
-index 0610c44..4632e38 100644
---- oovbaapi/ooo/vba/excel/XDialogs.idl
-+++ oovbaapi/ooo/vba/excel/XDialogs.idl
-@@ -33,9 +33,6 @@
- #ifndef __com_sun_star_uno_XInterface_idl__
- #include <com/sun/star/uno/XInterface.idl>
- #endif
--#ifndef __ooo_vba_XCollection_idl__
--#include <ooo/vba/XCollection.idl>
--#endif
-
- #ifndef __ooo_vba_XHelperInterface_idl__
- #include <ooo/vba/XHelperInterface.idl>
-@@ -44,15 +41,9 @@
- //=============================================================================
-
- module ooo { module vba { module excel {
--interface XApplication;
--//=============================================================================
-
--//interface XDialogs : ::ooo::vba::XCollection
--interface XDialogs
-+interface XDialogs : com::sun::star::uno::XInterface
- {
-- interface ::ooo::vba::XHelperInterface;
--
-- [attribute, readonly] long Count;
-
- any Item( [in] any Index );
- };
-diff --git oovbaapi/ooo/vba/excel/XFont.idl oovbaapi/ooo/vba/excel/XFont.idl
-index c03d84a..40396b8 100644
---- oovbaapi/ooo/vba/excel/XFont.idl
-+++ oovbaapi/ooo/vba/excel/XFont.idl
-@@ -47,22 +47,9 @@ module ooo { module vba { module excel {
-
- interface XFont
- {
-- interface ::ooo::vba::XHelperInterface;
--
-- [attribute] any Size;
- [attribute] any StandardFontSize;
- [attribute] any StandardFont;
- [attribute] any FontStyle;
-- [attribute] any ColorIndex;
-- [attribute] any Color;
-- [attribute] any Bold;
-- [attribute] any Underline;
-- [attribute] any Strikethrough;
-- [attribute] any Shadow;
-- [attribute] any Italic;
-- [attribute] any Subscript;
-- [attribute] any Superscript;
-- [attribute] any Name;
- [attribute] any OutlineFont;
- };
-
-diff --git oovbaapi/ooo/vba/excel/XPageSetup.idl oovbaapi/ooo/vba/excel/XPageSetup.idl
-index cd15e79..ca210c4 100644
---- oovbaapi/ooo/vba/excel/XPageSetup.idl
-+++ oovbaapi/ooo/vba/excel/XPageSetup.idl
-@@ -45,20 +45,15 @@ module ooo { module vba { module excel {
- //=============================================================================
-
-
--interface XPageSetup
-+interface XPageSetup : com::sun::star::uno::XInterface
- {
-
-- interface ::ooo::vba::XHelperInterface;
-+// interface ::ooo::vba::XHelperInterface;
-
- //Attributes
- [attribute] string PrintArea;
-- [attribute] double TopMargin;
-- [attribute] double BottomMargin;
-- [attribute] double RightMargin;
-- [attribute] double LeftMargin;
- [attribute] double HeaderMargin;
- [attribute] double FooterMargin;
-- [attribute] long Orientation;
- [attribute] any FitToPagesTall;
- [attribute] any FitToPagesWide;
- [attribute] any Zoom;
-diff --git oovbaapi/ooo/vba/excel/XTextFrame.idl oovbaapi/ooo/vba/excel/XTextFrame.idl
-index 534b256..4962be5 100644
---- oovbaapi/ooo/vba/excel/XTextFrame.idl
-+++ oovbaapi/ooo/vba/excel/XTextFrame.idl
-@@ -34,21 +34,9 @@
- #include <ooo/vba/XHelperInterface.idl>
- #endif
-
--#ifndef __ooo_vba_excel_XCharacters_idl__
--#include <ooo/vba/excel/XCharacters.idl>
--#endif
--
- module ooo { module vba { module excel {
--interface XTextFrame : ooo::vba::XHelperInterface
-+interface XTextFrame : com::sun::star::uno::XInterface
- {
-- [attribute] boolean AutoSize;
-- [attribute] float MarginBottom;
-- [attribute] float MarginTop;
-- [attribute] float MarginLeft;
-- [attribute] float MarginRight;
-- XCharacters Characters();
-- /*I don't find it in msdn
-- Range TextRange();*/
- };
- }; }; };
- #endif
-diff --git oovbaapi/ooo/vba/excel/XWorkbooks.idl oovbaapi/ooo/vba/excel/XWorkbooks.idl
-index 5521257..77a3020 100644
---- oovbaapi/ooo/vba/excel/XWorkbooks.idl
-+++ oovbaapi/ooo/vba/excel/XWorkbooks.idl
-@@ -45,9 +45,8 @@ module ooo { module vba { module excel {
-
- //=============================================================================
-
--interface XWorkbooks
-+interface XWorkbooks : com::sun::star::uno::XInterface
- {
-- interface ::ooo::vba::XCollection;
- any Add();
- any Open([in] string Filename, [in] any UpdateLinks, [in] any ReadOnly, [in] any Format, [in] any Password, [in] any WriteResPassword, [in] any IgnoreReadOnlyRecommended, [in] any Origin, [in] any Delimiter, [in] any Editable, [in] any Notify, [in] any Converter, [in] any AddToMru);
-
-diff --git oovbaapi/ooo/vba/excel/makefile.mk oovbaapi/ooo/vba/excel/makefile.mk
-index 8ef4294..232f83c 100644
---- oovbaapi/ooo/vba/excel/makefile.mk
-+++ oovbaapi/ooo/vba/excel/makefile.mk
-@@ -102,6 +102,7 @@ IDLFILES= XGlobals.idl\
- XHPageBreaks.idl \
- XVPageBreak.idl \
- XVPageBreaks.idl \
-+ TextFrame.idl \
-
-
- # ------------------------------------------------------------------
-diff --git oovbaapi/ooo/vba/makefile.mk oovbaapi/ooo/vba/makefile.mk
-index 2dcc035..f246ce5 100644
---- oovbaapi/ooo/vba/makefile.mk
-+++ oovbaapi/ooo/vba/makefile.mk
-@@ -58,9 +58,14 @@ IDLFILES=\
- XApplicationBase.idl\
- XWindowBase.idl\
- XDocumentBase.idl\
-+ XDocumentsBase.idl\
- XGlobalsBase.idl\
- XDocumentProperty.idl\
- XDocumentProperties.idl\
-+ XFontBase.idl\
-+ XDialogsBase.idl\
-+ XDialogBase.idl\
-+ XPageSetupBase.idl \
-
- # ------------------------------------------------------------------
-
-diff --git oovbaapi/ooo/vba/msforms/XControl.idl oovbaapi/ooo/vba/msforms/XControl.idl
-index 086b646..6e08891 100644
---- oovbaapi/ooo/vba/msforms/XControl.idl
-+++ oovbaapi/ooo/vba/msforms/XControl.idl
-@@ -61,6 +61,7 @@ interface XControl
- [attribute] double Left;
- [attribute] double Top;
- [attribute] string Name;
-+ [attribute] string ControlTipText;
- };
-
- //=============================================================================
-diff --git oovbaapi/ooo/vba/msforms/XShape.idl oovbaapi/ooo/vba/msforms/XShape.idl
-index a1ac36d..90047e6 100644
---- oovbaapi/ooo/vba/msforms/XShape.idl
-+++ oovbaapi/ooo/vba/msforms/XShape.idl
-@@ -34,10 +34,6 @@
- #include <ooo/vba/XHelperInterface.idl>
- #endif
-
--#ifndef __ooo_vba_excel_XTextFrame_idl__
--#include <ooo/vba/excel/XTextFrame.idl>
--#endif
--
- #ifndef __ooo_vba_msforms_XLineFormat_idl__
- #include <ooo/vba/msforms/XLineFormat.idl>
- #endif
-@@ -66,14 +62,13 @@ interface XShape : ooo::vba::XHelperInterface
- [attribute, readonly] XLineFormat Line;
- [attribute, readonly] XFillFormat Fill;
- [attribute, readonly] XPictureFormat PictureFormat;
-+ [attribute] boolean LockAspectRatio;
-+ [attribute] boolean LockAnchor;
-+ [attribute] long RelativeHorizontalPosition;
-+ [attribute] long RelativeVerticalPosition;
-
-- /*
-- using in word
-- [attribute] RelativeHorizontalPosition
-- [attribute] RelativeVerticalPosition
-- [attribute] XWrapFormat WrapFormat;
-- */
-- ooo::vba::excel::XTextFrame TextFrame();
-+ any TextFrame();
-+ any WrapFormat();
- void Delete();
- void ZOrder( [in] long ZOrderCmd );
- void IncrementRotation( [in] double Increment );
-diff --git oovbaapi/ooo/vba/msforms/XShapeRange.idl oovbaapi/ooo/vba/msforms/XShapeRange.idl
-index 1b39485..0ae1883 100644
---- oovbaapi/ooo/vba/msforms/XShapeRange.idl
-+++ oovbaapi/ooo/vba/msforms/XShapeRange.idl
-@@ -44,9 +44,25 @@
-
- module ooo { module vba { module msforms {
-
-+interface XLineFormat;
-+interface XFillFormat;
- interface XShapeRange
- {
- interface ooo::vba::XCollection;
-+
-+ [attribute] double Height;
-+ [attribute] double Width;
-+ [attribute] double Left;
-+ [attribute] double Top;
-+ [attribute, readonly] XLineFormat Line;
-+ [attribute, readonly] XFillFormat Fill;
-+ [attribute] boolean LockAspectRatio;
-+ [attribute] boolean LockAnchor;
-+ [attribute] long RelativeHorizontalPosition;
-+ [attribute] long RelativeVerticalPosition;
-+
-+ any TextFrame();
-+ any WrapFormat();
- void Select();
- XShape Group();
- void IncrementRotation( [in] double Increment );
-diff --git oovbaapi/ooo/vba/msforms/XShapes.idl oovbaapi/ooo/vba/msforms/XShapes.idl
-index 3ba31ab..7d7e26d 100644
---- oovbaapi/ooo/vba/msforms/XShapes.idl
-+++ oovbaapi/ooo/vba/msforms/XShapes.idl
-@@ -51,6 +51,7 @@ interface XShapes
- */
- any AddLine( [in] long StartX, [in] long StartY, [in] long endX, [in] long endY );
- any AddShape([in] long ShapeType, [in] long StartX, [in] long StartY, [in] long endX, [in] long endY );
-+ any AddTextbox([in] long Orientation, [in] long Left, [in] long Top, [in] long Width, [in] long Height );
- };
- }; }; };
-
-diff --git oovbaapi/ooo/vba/msforms/XTextFrame.idl oovbaapi/ooo/vba/msforms/XTextFrame.idl
-new file mode 100644
-index 0000000..b702ecf
---- /dev/null
-+++ oovbaapi/ooo/vba/msforms/XTextFrame.idl
-@@ -0,0 +1,50 @@
-+/*************************************************************************
-+ *
-+ * 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: XTextFrame.idl,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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_msforms_XTextFrame_idl__
-+#define __ooo_vba_msforms_XTextFrame_idl__
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module msforms {
-+interface XTextFrame : ooo::vba::XHelperInterface
-+{
-+ [attribute] boolean AutoSize;
-+ [attribute] float MarginBottom;
-+ [attribute] float MarginTop;
-+ [attribute] float MarginLeft;
-+ [attribute] float MarginRight;
-+ any Characters();
-+ /*I don't find it in msdn
-+ Range TextRange();*/
-+};
-+}; }; };
-+#endif
-diff --git oovbaapi/ooo/vba/msforms/makefile.mk oovbaapi/ooo/vba/msforms/makefile.mk
-index cd2aa3b..6610d33 100644
---- oovbaapi/ooo/vba/msforms/makefile.mk
-+++ oovbaapi/ooo/vba/msforms/makefile.mk
-@@ -66,6 +66,7 @@ IDLFILES=\
- XSpinButton.idl \
- XImage.idl \
- XControls.idl \
-+ XTextFrame.idl \
-
- # ------------------------------------------------------------------
-
-diff --git oovbaapi/ooo/vba/word/XAddin.idl oovbaapi/ooo/vba/word/XAddin.idl
-new file mode 100644
-index 0000000..9854e27
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XAddin.idl
-@@ -0,0 +1,61 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XAddin_idl__
-+#define __ooo_vba_word_XAddin_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+#ifndef __com_sun_star_container_XNamed_idl__
-+#include <com/sun/star/container/XNamed.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XAddin
-+{
-+ interface ooo::vba::XHelperInterface;
-+ interface ::com::sun::star::container::XNamed;
-+
-+ [attribute, readonly] string Path;
-+ [attribute, readonly] boolean Autoload;
-+ [attribute] boolean Installed;
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XAddins.idl oovbaapi/ooo/vba/word/XAddins.idl
-new file mode 100644
-index 0000000..d4b4d1a
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XAddins.idl
-@@ -0,0 +1,55 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XAddins_idl__
-+#define __ooo_vba_word_XAddins_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XAddins
-+{
-+ interface ::ooo::vba::XCollection;
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XApplication.idl oovbaapi/ooo/vba/word/XApplication.idl
-index ae1835b..b3623e4 100644
---- oovbaapi/ooo/vba/word/XApplication.idl
-+++ oovbaapi/ooo/vba/word/XApplication.idl
-@@ -53,7 +53,14 @@ interface XApplication : com::sun::star::uno::XInterface
- [attribute, readonly] ooo::vba::word::XSystem System;
- [attribute, readonly] ooo::vba::word::XOptions Options;
- [attribute, readonly] ooo::vba::word::XSelection Selection;
-+ [attribute] boolean DisplayAutoCompleteTips;
-+ [attribute] long EnableCancelKey;
-+
- any CommandBars( [in] any aIndex );
-+ any Documents( [in] any aIndex );
-+ any Addins( [in] any aIndex );
-+ any Dialogs( [in] any aIndex );
-+ float CentimetersToPoints([in] float Centimeters );
- };
-
- }; }; };
-diff --git oovbaapi/ooo/vba/word/XAutoTextEntries.idl oovbaapi/ooo/vba/word/XAutoTextEntries.idl
-new file mode 100644
-index 0000000..b4bc1e5
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XAutoTextEntries.idl
-@@ -0,0 +1,55 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XAutoTextEntries_idl__
-+#define __ooo_vba_word_XAutoTextEntries_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XAutoTextEntries
-+{
-+ interface ::ooo::vba::XCollection;
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XAutoTextEntry.idl oovbaapi/ooo/vba/word/XAutoTextEntry.idl
-new file mode 100644
-index 0000000..37ce701
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XAutoTextEntry.idl
-@@ -0,0 +1,59 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XAutoTextEntry_idl__
-+#define __ooo_vba_word_XAutoTextEntry_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+#ifndef __com_sun_star_container_XNamed_idl__
-+#include <com/sun/star/container/XNamed.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XRange;
-+interface XAutoTextEntry
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ XRange Insert([in] XRange Where, [in] /*Optional*/ any RichText);
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XBorder.idl oovbaapi/ooo/vba/word/XBorder.idl
-new file mode 100644
-index 0000000..8944bdd
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XBorder.idl
-@@ -0,0 +1,59 @@
-+/*************************************************************************
-+ *
-+ * 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: XBorder.idl,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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XBorder_idl__
-+#define __ooo_vba_word_XBorder_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+
-+//=============================================================================
-+interface XBorder
-+{
-+ interface ::ooo::vba::XHelperInterface;
-+
-+ [attribute] any LineStyle;
-+};
-+
-+//=============================================================================
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XBorders.idl oovbaapi/ooo/vba/word/XBorders.idl
-new file mode 100644
-index 0000000..5956fc3
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XBorders.idl
-@@ -0,0 +1,59 @@
-+/*************************************************************************
-+ *
-+ * 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: XBorders.idl,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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XBorders_idl__
-+#define __ooo_vba_word_XBorders_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+interface XBorders
-+{
-+ interface ooo::vba::XCollection;
-+
-+ [attribute] boolean Shadow;
-+};
-+
-+//=============================================================================
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XDialog.idl oovbaapi/ooo/vba/word/XDialog.idl
-new file mode 100644
-index 0000000..9c31fa7
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XDialog.idl
-@@ -0,0 +1,55 @@
-+/*************************************************************************
-+ *
-+ * 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: XDialog.idl,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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XDialog_idl__
-+#define __ooo_vba_word_XDialog_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XDialog : com::sun::star::uno::XInterface
-+{
-+};
-+
-+}; }; };
-+
-+#endif
-+
-diff --git oovbaapi/ooo/vba/word/XDialogs.idl oovbaapi/ooo/vba/word/XDialogs.idl
-new file mode 100644
-index 0000000..b68848d
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XDialogs.idl
-@@ -0,0 +1,54 @@
-+/*************************************************************************
-+ *
-+ * 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: XDialogs.idl,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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XDialogs_idl__
-+#define __ooo_vba_word_XDialogs_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+interface XDialogs : com::sun::star::uno::XInterface
-+{
-+
-+ any Item( [in] any Index );
-+};
-+
-+}; }; };
-+
-+#endif
-+
-diff --git oovbaapi/ooo/vba/word/XDocument.idl oovbaapi/ooo/vba/word/XDocument.idl
-index 2502846..a7ceb18 100644
---- oovbaapi/ooo/vba/word/XDocument.idl
-+++ oovbaapi/ooo/vba/word/XDocument.idl
-@@ -42,9 +42,13 @@
- #include <ooo/vba/word/XRange.idl>
- #endif
-
-+#ifndef __com_sun_star_script_XInvocation_idl__
-+#include <com/sun/star/script/XInvocation.idl>
-+#endif
-+
- module ooo { module vba { module word {
-
--interface XDocument : com::sun::star::uno::XInterface
-+interface XDocument : com::sun::star::script::XInvocation
- {
- [attribute, readonly] XRange Content;
- [attribute] any AttachedTemplate;
-@@ -54,6 +58,14 @@ interface XDocument : com::sun::star::uno::XInterface
- any CustomDocumentProperties( [in] any index );
- any Bookmarks( [in] any aIndex );
- any Variables( [in] any aIndex );
-+ any Paragraphs( [in] any aIndex );
-+ any Styles( [in] any aIndex );
-+ any Tables( [in] any aIndex );
-+ any Fields( [in] any aIndex );
-+ any Shapes([in] any Index);
-+ any Sections([in] any Index);
-+ void Activate();
-+ any PageSetup();
- };
-
- }; }; };
-diff --git oovbaapi/ooo/vba/word/XDocuments.idl oovbaapi/ooo/vba/word/XDocuments.idl
-new file mode 100644
-index 0000000..c45b9ae
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XDocuments.idl
-@@ -0,0 +1,58 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XDocuments_idl__
-+#define __ooo_vba_word_XDocuments_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XDocuments : com::sun::star::uno::XInterface
-+{
-+ any Add([in] any Template, [in] any NewTemplate, [in] any DocumentType, [in] any Visible);
-+ any Open([in] string Filename, [in] any ConfirmConversions, [in] any ReadOnly, [in] any AddToRecentFiles, [in] any PasswordDocument, [in] any PasswordTemplate, [in] any Revert, [in] any WritePasswordDocument, [in] any WritePasswordTemplate, [in] any Format, [in] any Encoding, [in] any Visible, [in] any OpenAndRepair, [in] any DocumentDirection, [in] any NoEncodingDialog, [in] any XMLTransform);
-+
-+ void Close([in] any SaveChanges,[in] any OriginalFormat,[in] any RouteDocument);
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XField.idl oovbaapi/ooo/vba/word/XField.idl
-new file mode 100644
-index 0000000..19d3d3b
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XField.idl
-@@ -0,0 +1,52 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: XField.idl,v $
-+ *
-+ * $Revision: 1.1 $
-+ *
-+ * last change: $Author: jsc $ $Date: 2007/02/09 08:35:01 $
-+ *
-+ * 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 __ooo_vba_word_XField_idl__
-+#define __ooo_vba_word_XField_idl__
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+module ooo { module vba { module word {
-+
-+interface XField
-+{
-+ interface ::ooo::vba::XHelperInterface;
-+};
-+
-+}; }; };
-+
-+#endif
-+
-diff --git oovbaapi/ooo/vba/word/XFields.idl oovbaapi/ooo/vba/word/XFields.idl
-new file mode 100644
-index 0000000..78266ac
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XFields.idl
-@@ -0,0 +1,62 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: XFields.idl,v $
-+ *
-+ * $Revision: 1.1 $
-+ *
-+ * last change: $Author: jsc $ $Date: 2007/02/09 08:45:13 $
-+ *
-+ * 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 __ooo_vba_word__XFields_idl__
-+#define __ooo_vba_word__XFields_idl__
-+
-+#ifndef __ooo_vba_HelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XRange;
-+interface XField;
-+interface XFields
-+{
-+ interface ooo::vba::XCollection;
-+
-+ XField Add([in] XRange Range, [in] any Type, [in] any Text,[in] any PreserveFormatting);
-+ long Update();
-+};
-+
-+}; }; };
-+
-+#endif
-+
-diff --git oovbaapi/ooo/vba/word/XFind.idl oovbaapi/ooo/vba/word/XFind.idl
-new file mode 100644
-index 0000000..e42ac6f
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XFind.idl
-@@ -0,0 +1,87 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XFind_idl__
-+#define __ooo_vba_word_XFind_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XFind
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ [attribute] string Text;
-+ [attribute] any Replacement;
-+ [attribute] boolean Forward;
-+ [attribute] long Wrap;
-+ [attribute] boolean Format;
-+ [attribute] boolean MatchCase;
-+ [attribute] boolean MatchWholeWord;
-+ [attribute] boolean MatchWildcards;
-+ [attribute] boolean MatchSoundsLike;
-+ [attribute] boolean MatchAllWordForms;
-+ [attribute] any Style;
-+
-+ boolean Execute([in] /* string */ any FindText,
-+ [in] /* boolean */ any MatchCase,
-+ [in] /* boolean */ any MatchWholeWord,
-+ [in] /* boolean */ any MatchWildcards,
-+ [in] /* boolean */ any MatchSoundsLike,
-+ [in] /* boolean */ any MatchAllWordForms,
-+ [in] /* boolean */ any Forward,
-+ [in] /* long */ any Wrap,
-+ [in] /* boolean */ any Format,
-+ [in] /* string */ any ReplaceWith,
-+ [in] /* boolean */ any Replace,
-+ [in] /* boolean */ any MatchKashida,
-+ [in] /* boolean */ any MatchDiacritics,
-+ [in] /* boolean */ any MatchAlefHamza,
-+ [in] /* boolean */ any MatchControl,
-+ [in] /* boolean */ any MatchPrefix,
-+ [in] /* boolean */ any MatchSuffix,
-+ [in] /* boolean */ any MatchPhrase,
-+ [in] /* boolean */ any IgnoreSpace,
-+ [in] /* boolean */ any IgnorePunct );
-+ void ClearFormatting();
-+
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XFont.idl oovbaapi/ooo/vba/word/XFont.idl
-new file mode 100644
-index 0000000..53fc1bb
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XFont.idl
-@@ -0,0 +1,58 @@
-+/*************************************************************************
-+ *
-+ * 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: XFont.idl,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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XFont_idl__
-+#define __ooo_vba_word_XFont_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+#ifndef __com_sun_star_lang_IndexOutOfBoundsException_idl__
-+#include <com/sun/star/lang/IndexOutOfBoundsException.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+interface XFont : com::sun::star::uno::XInterface
-+{
-+};
-+
-+//=============================================================================
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XGlobals.idl oovbaapi/ooo/vba/word/XGlobals.idl
-index 3305e93..519499c 100644
---- oovbaapi/ooo/vba/word/XGlobals.idl
-+++ oovbaapi/ooo/vba/word/XGlobals.idl
-@@ -49,6 +49,10 @@ interface XGlobals : com::sun::star::uno::XInterface
- [attribute, readonly] ooo::vba::word::XOptions Options;
- [attribute, readonly] ooo::vba::word::XSelection Selection;
- any CommandBars( [in] any aIndex );
-+ any Documents( [in] any aIndex );
-+ any Addins( [in] any aIndex );
-+ any Dialogs( [in] any aIndex );
-+ float CentimetersToPoints([in] float Centimeters );
- };
-
- }; }; };
-diff --git oovbaapi/ooo/vba/word/XHeaderFooter.idl oovbaapi/ooo/vba/word/XHeaderFooter.idl
-new file mode 100644
-index 0000000..7dd1a39
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XHeaderFooter.idl
-@@ -0,0 +1,59 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XHeaderFooter_idl__
-+#define __ooo_vba_word_XHeaderFooter_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XRange;
-+interface XHeaderFooter
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ [attribute, readonly] boolean IsHeader;
-+ [attribute] boolean LinkToPrevious;
-+ [attribute, readonly] XRange Range;
-+ //[attribute, readonly] XShapers Shapes ;
-+ any Shapes([in] any Index);
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XOptions.idl oovbaapi/ooo/vba/word/XOptions.idl
-index 75b1064..13bb65e 100644
---- oovbaapi/ooo/vba/word/XOptions.idl
-+++ oovbaapi/ooo/vba/word/XOptions.idl
-@@ -44,6 +44,20 @@ interface XOptions
- {
- interface ooo::vba::XHelperInterface;
-
-+ [attribute] long DefaultBorderLineStyle;
-+ [attribute] long DefaultBorderLineWidth;
-+ [attribute] long DefaultBorderColorIndex;
-+ [attribute] boolean ReplaceSelection;
-+ [attribute] boolean MapPaperSize;
-+ [attribute] boolean AutoFormatAsYouTypeApplyHeadings;
-+ [attribute] boolean AutoFormatAsYouTypeApplyBulletedLists;
-+ [attribute] boolean AutoFormatAsYouTypeApplyNumberedLists;
-+ [attribute] boolean AutoFormatAsYouTypeFormatListItemBeginning;
-+ [attribute] boolean AutoFormatAsYouTypeDefineStyles;
-+ [attribute] boolean AutoFormatApplyHeadings;
-+ [attribute] boolean AutoFormatApplyLists;
-+ [attribute] boolean AutoFormatApplyBulletedLists;
-+
- any DefaultFilePath( [in] long Path );
- };
-
-diff --git oovbaapi/ooo/vba/word/XPageSetup.idl oovbaapi/ooo/vba/word/XPageSetup.idl
-new file mode 100644
-index 0000000..ca8e944
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XPageSetup.idl
-@@ -0,0 +1,63 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XPageSetup_idl__
-+#define __ooo_vba_word_XPageSetup_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+
-+interface XPageSetup : com::sun::star::uno::XInterface
-+{
-+ [attribute] double Gutter;
-+ [attribute] double HeaderDistance;
-+ [attribute] double FooterDistance;
-+ [attribute] boolean DifferentFirstPageHeaderFooter;
-+ [attribute] long SectionStart;
-+};
-+
-+//=============================================================================
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XParagraph.idl oovbaapi/ooo/vba/word/XParagraph.idl
-new file mode 100644
-index 0000000..79ad7ae
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XParagraph.idl
-@@ -0,0 +1,55 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XParagraph_idl__
-+#define __ooo_vba_word_XParagraph_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XRange;
-+interface XParagraph
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ [attribute, readonly] XRange Range;
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XParagraphFormat.idl oovbaapi/ooo/vba/word/XParagraphFormat.idl
-new file mode 100644
-index 0000000..df6d584
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XParagraphFormat.idl
-@@ -0,0 +1,70 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XParagraphFormat_idl__
-+#define __ooo_vba_word_XParagraphFormat_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+
-+module ooo { module vba { module word {
-+
-+interface XParagraphFormat
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ [attribute] long Alignment;
-+ [attribute] float FirstLineIndent;
-+ [attribute] any KeepTogether;
-+ [attribute] any KeepWithNext;
-+ [attribute] any Hyphenation;
-+ [attribute] float LineSpacing;
-+ [attribute] long LineSpacingRule;
-+ [attribute] any NoLineNumber;
-+ [attribute] long OutlineLevel;
-+ [attribute] any PageBreakBefore;
-+ [attribute] float SpaceBefore;
-+ [attribute] float SpaceAfter;
-+ [attribute] float LeftIndent;
-+ [attribute] float RightIndent;
-+ [attribute] any TabStops;
-+ [attribute] any WidowControl;
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XParagraphs.idl oovbaapi/ooo/vba/word/XParagraphs.idl
-new file mode 100644
-index 0000000..d392528
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XParagraphs.idl
-@@ -0,0 +1,55 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XParagraphs_idl__
-+#define __ooo_vba_word_XParagraphs_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XParagraphs
-+{
-+ interface ::ooo::vba::XCollection;
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XRange.idl oovbaapi/ooo/vba/word/XRange.idl
-index 4ce9b79..47e688e 100644
---- oovbaapi/ooo/vba/word/XRange.idl
-+++ oovbaapi/ooo/vba/word/XRange.idl
-@@ -34,6 +34,10 @@
- #include <com/sun/star/uno/XInterface.idl>
- #endif
-
-+#ifndef __com_sun_star_text_XTextRange_idl__
-+#include <com/sun/star/text/XTextRange.idl>
-+#endif
-+
- #ifndef __ooo_vba_XHelperInterface_idl__
- #include <ooo/vba/XHelperInterface.idl>
- #endif
-@@ -41,13 +45,30 @@
-
- module ooo { module vba { module word {
-
-+interface XParagraphFormat;
-+interface XStyle;
-+interface XFont;
- interface XRange
- {
- interface ooo::vba::XHelperInterface;
-
- [attribute] string Text;
-+ [attribute] XParagraphFormat ParagraphFormat;
-+ [attribute] XStyle Style;
-+ [attribute,readonly] ::com::sun::star::text::XTextRange XTextRange;
-+ // Of course Font is NOT readonly, #FIXME #TODO
-+ // readonly though will force an error attempting to write
-+ [attribute, readonly] XFont Font;
-+ [attribute] long LanguageID;
-+ [attribute] long Start;
-+ [attribute] long End;
-
- void InsertBreak( [in] any Type );
-+ void Select();
-+ void InsertParagraph();
-+ void InsertParagraphBefore();
-+ void InsertParagraphAfter();
-+ any PageSetup();
- };
-
- }; }; };
-diff --git oovbaapi/ooo/vba/word/XReplacement.idl oovbaapi/ooo/vba/word/XReplacement.idl
-new file mode 100644
-index 0000000..daae501
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XReplacement.idl
-@@ -0,0 +1,54 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XReplacement_idl__
-+#define __ooo_vba_word_XReplacement_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XReplacement
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ [attribute] string Text;
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XSection.idl oovbaapi/ooo/vba/word/XSection.idl
-new file mode 100644
-index 0000000..c79a24b
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XSection.idl
-@@ -0,0 +1,58 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XSection_idl__
-+#define __ooo_vba_word_XSection_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XSection
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ [attribute] boolean ProtectedForForms;
-+
-+ any Headers();
-+ any Footers();
-+ any PageSetup();
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XSections.idl oovbaapi/ooo/vba/word/XSections.idl
-new file mode 100644
-index 0000000..a941285
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XSections.idl
-@@ -0,0 +1,57 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XSections_idl__
-+#define __ooo_vba_word_XSections_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XSections
-+{
-+ interface ::ooo::vba::XCollection;
-+
-+ any PageSetup();
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XSelection.idl oovbaapi/ooo/vba/word/XSelection.idl
-index 2142fb4..44026da 100644
---- oovbaapi/ooo/vba/word/XSelection.idl
-+++ oovbaapi/ooo/vba/word/XSelection.idl
-@@ -41,11 +41,45 @@
-
- module ooo { module vba { module word {
-
-+interface XRange;
-+interface XParagraphFormat;
-+interface XFind;
-+interface XFont;
-+interface XStyle;
-+interface XHeaderFooter;
- interface XSelection
- {
- interface ooo::vba::XHelperInterface;
-
- [attribute] string Text;
-+ [attribute, readonly] XRange Range;
-+ [attribute] XParagraphFormat ParagraphFormat;
-+ [attribute, readonly] XFind Find;
-+ [attribute] XStyle Style;
-+ [attribute, readonly] XFont Font;
-+ [attribute, readonly] XHeaderFooter HeaderFooter;
-+ [attribute] long LanguageID;
-+ [attribute] long Start;
-+ [attribute] long End;
-+
-+ any Tables( [in] any aIndex );
-+ any Fields( [in] any aIndex );
-+ void TypeText( [in] string Text );
-+ void HomeKey( [in] any Unit, [in] any Extend );
-+ void EndKey( [in] any Unit, [in] any Extend );
-+ void Delete( [in] any Unit, [in] any Count );
-+ void MoveRight( [in] any Unit, [in] any Count, [in] any Extend );
-+ void MoveLeft( [in] any Unit, [in] any Count, [in] any Extend );
-+ void MoveDown( [in] any Unit, [in] any Count, [in] any Extend );
-+ void TypeParagraph();
-+ void InsertParagraph();
-+ void InsertParagraphBefore();
-+ void InsertParagraphAfter();
-+ void TypeBackspace();
-+ XRange GoTo( [in] any What, [in] any Which, [in] any Count, [in] any Name );
-+ any Information( [in] long Type );
-+ void InsertBreak( [in] any Type );
-+ any ShapeRange();
- };
-
- }; }; };
-diff --git oovbaapi/ooo/vba/word/XStyle.idl oovbaapi/ooo/vba/word/XStyle.idl
-new file mode 100644
-index 0000000..af19517
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XStyle.idl
-@@ -0,0 +1,58 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XStyle_idl__
-+#define __ooo_vba_word_XStyle_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XFont;
-+interface XStyle
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ [attribute] string Name;
-+ [attribute] long LanguageID;
-+ [attribute, readonly] long Type;
-+ [attribute, readonly] XFont Font;
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
-diff --git oovbaapi/ooo/vba/word/XStyles.idl oovbaapi/ooo/vba/word/XStyles.idl
-new file mode 100644
-index 0000000..dd6f2b4
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XStyles.idl
-@@ -0,0 +1,55 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XStyles_idl__
-+#define __ooo_vba_word_XStyles_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XStyles
-+{
-+ interface ::ooo::vba::XCollection;
-+};
-+
-+}; }; };
-+
-+#endif
-diff --git oovbaapi/ooo/vba/word/XTable.idl oovbaapi/ooo/vba/word/XTable.idl
-new file mode 100644
-index 0000000..f677da6
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XTable.idl
-@@ -0,0 +1,86 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: XTable.idl,v $
-+ *
-+ * $Revision: 1.1 $
-+ *
-+ * last change: $Author: jsc $ $Date: 2007/02/09 08:35:01 $
-+ *
-+ * 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 __ooo_vba_word_XTable_idl__
-+#define __ooo_vba_word_XTable_idl__
-+
-+#ifndef __com_sun_star_script_BasicErrorException_idl__
-+#include <com/sun/star/script/BasicErrorException.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+module ooo { module vba { module word {
-+
-+interface XRange;
-+
-+interface XTable
-+{
-+ interface ::ooo::vba::XHelperInterface;
-+ [attribute, readonly ] string Name; // for debug only
-+
-+ XRange Range() raises (com::sun::star::script::BasicErrorException);
-+
-+ /**
-+ select the table
-+ */
-+ void Select()
-+ raises (com::sun::star::script::BasicErrorException);
-+
-+ /**
-+ delete the table
-+ */
-+ void Delete()
-+ raises (com::sun::star::script::BasicErrorException);
-+
-+ /**
-+ convert the table to text
-+ @param Separator the separator used for the text where cell separation was
-+ @return XRange a range containing the text
-+ @throw BasicErrorException when the conversion cannot be done
-+ */
-+/*
-+ XRange ConvertToText([in] any Separator, [in] any NestedTables)
-+ raises(com::sun::star::script::BasicErrorException);
-+*/
-+ any Borders( [in] any aIndex );
-+
-+};
-+
-+}; }; };
-+
-+#endif
-+
-diff --git oovbaapi/ooo/vba/word/XTables.idl oovbaapi/ooo/vba/word/XTables.idl
-new file mode 100644
-index 0000000..f09f27f
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XTables.idl
-@@ -0,0 +1,79 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: XTables.idl,v $
-+ *
-+ * $Revision: 1.1 $
-+ *
-+ * last change: $Author: jsc $ $Date: 2007/02/09 08:45:13 $
-+ *
-+ * 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 __ooo_vba_word__XTables_idl__
-+#define __ooo_vba_word__XTables_idl__
-+
-+#ifndef __ooo_vba_HelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+#ifndef __ooo_vba_word_XTable_idl__
-+#include <ooo/vba/word/XTable.idl>
-+#endif
-+
-+#ifndef __com_sun_star_script_BasicErrorException_idl__
-+#include <com/sun/star/script/BasicErrorException.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XRange;
-+
-+interface XTables
-+{
-+ interface ooo::vba::XCollection;
-+ /** Creates a new Table, optionally with a name.
-+ <p>Creates a new table at the current cursor position. </p>
-+ @param range
-+ @returns
-+ reference to the new table.
-+ */
-+ XTable Add([in] XRange Range, [in] any NumRows, [in] any NumColumns,
-+ /*optional*/ [in] any DefaultTableBehavior,
-+ /*optional*/ [in] any AutoFitBehavior)
-+ raises(com::sun::star::script::BasicErrorException);
-+
-+
-+};
-+
-+}; }; };
-+
-+#endif
-+
-diff --git oovbaapi/ooo/vba/word/XTemplate.idl oovbaapi/ooo/vba/word/XTemplate.idl
-index 1913118..a2bd1d7 100644
---- oovbaapi/ooo/vba/word/XTemplate.idl
-+++ oovbaapi/ooo/vba/word/XTemplate.idl
-@@ -45,6 +45,8 @@ interface XTemplate
- interface ooo::vba::XHelperInterface;
-
- [attribute, readonly] string Name;
-+
-+ any AutoTextEntries( [in] any aIndex );
- };
-
- }; }; };
-diff --git oovbaapi/ooo/vba/word/XWrapFormat.idl oovbaapi/ooo/vba/word/XWrapFormat.idl
-new file mode 100644
-index 0000000..386feb3
---- /dev/null
-+++ oovbaapi/ooo/vba/word/XWrapFormat.idl
-@@ -0,0 +1,48 @@
-+/*************************************************************************
-+ *
-+ * 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: XWrapFormat.idl,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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XWrapFormat_idl__
-+#define __ooo_vba_word_XWrapFormat_idl__
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+interface XWrapFormat : ooo::vba::XHelperInterface
-+{
-+ [attribute] long Type;
-+ [attribute] long Side;
-+ [attribute] float DistanceTop;
-+ [attribute] float DistanceBottom;
-+ [attribute] float DistanceLeft;
-+ [attribute] float DistanceRight;
-+};
-+}; }; };
-+#endif
-diff --git oovbaapi/ooo/vba/word/makefile.mk oovbaapi/ooo/vba/word/makefile.mk
-index c638476..8126587 100644
---- oovbaapi/ooo/vba/word/makefile.mk
-+++ oovbaapi/ooo/vba/word/makefile.mk
-@@ -56,7 +56,33 @@ IDLFILES= XGlobals.idl\
- XPanes.idl \
- XOptions.idl \
- XSelection.idl \
-- XTemplate.idl \
-+ XTemplate.idl \
-+ XParagraphFormat.idl \
-+ XAutoTextEntries.idl \
-+ XAutoTextEntry.idl \
-+ XParagraphs.idl \
-+ XParagraph.idl \
-+ XFind.idl \
-+ XReplacement.idl \
-+ XStyle.idl \
-+ XStyles.idl \
-+ XFont.idl \
-+ XTable.idl \
-+ XTables.idl \
-+ XField.idl \
-+ XFields.idl \
-+ XBorder.idl \
-+ XBorders.idl \
-+ XDocuments.idl \
-+ XHeaderFooter.idl \
-+ XAddins.idl \
-+ XAddin.idl \
-+ XDialogs.idl \
-+ XDialog.idl \
-+ XWrapFormat.idl \
-+ XPageSetup.idl \
-+ XSection.idl \
-+ XSections.idl \
-
- # ------------------------------------------------------------------
-
-diff --git sc/source/ui/vba/excelvbahelper.cxx sc/source/ui/vba/excelvbahelper.cxx
-index ba1bdc8..795ec5a 100644
---- sc/source/ui/vba/excelvbahelper.cxx
-+++ sc/source/ui/vba/excelvbahelper.cxx
-@@ -170,7 +170,7 @@ void implnPasteSpecial(USHORT nFlags,USHORT nFunction,sal_Bool bSkipEmpty, sal_B
- }
-
- ScDocShell*
--getDocShell( css::uno::Reference< css::frame::XModel>& xModel )
-+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() );
-@@ -182,7 +182,7 @@ getDocShell( css::uno::Reference< css::frame::XModel>& xModel )
- }
-
- ScTabViewShell*
--getBestViewShell( css::uno::Reference< css::frame::XModel>& xModel )
-+getBestViewShell( const css::uno::Reference< css::frame::XModel>& xModel )
- {
- ScDocShell* pDocShell = getDocShell( xModel );
- if ( pDocShell )
-diff --git sc/source/ui/vba/excelvbahelper.hxx sc/source/ui/vba/excelvbahelper.hxx
-index 7c156df..3a3b7f8 100644
---- sc/source/ui/vba/excelvbahelper.hxx
-+++ sc/source/ui/vba/excelvbahelper.hxx
-@@ -45,8 +45,8 @@ namespace ooo
- void implnPaste();
- void implnCut();
- void implnPasteSpecial(sal_uInt16 nFlags,sal_uInt16 nFunction,sal_Bool bSkipEmpty, sal_Bool bTranspose);
-- ScTabViewShell* getBestViewShell( css::uno::Reference< css::frame::XModel>& xModel ) ;
-- ScDocShell* getDocShell( css::uno::Reference< css::frame::XModel>& xModel ) ;
-+ ScTabViewShell* getBestViewShell( const css::uno::Reference< css::frame::XModel>& xModel ) ;
-+ ScDocShell* getDocShell( const css::uno::Reference< css::frame::XModel>& xModel ) ;
- ScTabViewShell* getCurrentBestViewShell();
- SfxViewFrame* getCurrentViewFrame();
- class ScVbaCellRangeAccess
-diff --git sc/source/ui/vba/makefile.mk sc/source/ui/vba/makefile.mk
-index 1f861e6..9350a3b 100644
---- sc/source/ui/vba/makefile.mk
-+++ sc/source/ui/vba/makefile.mk
-@@ -86,13 +86,6 @@ SLOFILES= \
- $(SLO)$/vbaoleobjects.obj \
- $(SLO)$/vbatextboxshape.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 \
-diff --git sc/source/ui/vba/service.cxx sc/source/ui/vba/service.cxx
-index 06629e7..37b6fb3 100644
---- sc/source/ui/vba/service.cxx
-+++ sc/source/ui/vba/service.cxx
-@@ -73,6 +73,10 @@ namespace vbaeventshelper
- {
- extern sdecl::ServiceDecl const serviceDecl;
- }
-+namespace textframe
-+{
-+extern sdecl::ServiceDecl const serviceDecl;
-+}
-
- extern "C"
- {
-@@ -113,7 +117,7 @@ extern "C"
- #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, vbaeventshelper::serviceDecl );
-+ range::serviceDecl, workbook::serviceDecl, worksheet::serviceDecl, globals::serviceDecl, window::serviceDecl, hyperlink::serviceDecl, application::serviceDecl ) && component_writeInfoHelper( pServiceManager, pRegistryKey, vbaeventshelper::serviceDecl, textframe::serviceDecl );
- #endif
-
- }
-@@ -126,7 +130,7 @@ extern "C"
- void* pRet = component_getFactoryHelper(
- 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, vbaeventshelper::serviceDecl );
-+ pRet = component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey, vbaeventshelper::serviceDecl, textframe::serviceDecl );
- OSL_TRACE("Ret is 0x%x", pRet);
- return pRet;
- }
-diff --git sc/source/ui/vba/vbaapplication.cxx sc/source/ui/vba/vbaapplication.cxx
-index c26a61d..9088dc9 100644
---- sc/source/ui/vba/vbaapplication.cxx
-+++ sc/source/ui/vba/vbaapplication.cxx
-@@ -57,7 +57,7 @@
- #include "tabvwsh.hxx"
- #include "gridwin.hxx"
- #include "vbanames.hxx"
--#include "vbashape.hxx"
-+#include <vbahelper/vbashape.hxx>
- #include "vbatextboxshape.hxx"
- #include "vbaassistant.hxx"
- #include "sc.hrc"
-@@ -88,6 +88,8 @@
- #include "unonames.hxx"
- #include "docsh.hxx"
- #include <vbahelper/helperdecl.hxx>
-+#include "excelvbahelper.hxx"
-+
- #include <basic/sbmeth.hxx>
- #include <basic/sbmod.hxx>
- #include <basic/sbstar.hxx>
-@@ -114,8 +116,6 @@ using ::rtl::OUString;
- #define FILE_PATH_SEPERATOR "\\"
- #endif
-
--#define EXCELVERSION "11.0"
--
- uno::Any sbxToUnoValue( SbxVariable* pVar );
-
- class ActiveWorkbook : public ScVbaWorkbook
-@@ -137,7 +137,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)
-@@ -307,12 +310,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)
- {
-diff --git sc/source/ui/vba/vbaapplication.hxx sc/source/ui/vba/vbaapplication.hxx
-index 9435282..67b6ba9 100644
---- sc/source/ui/vba/vbaapplication.hxx
-+++ sc/source/ui/vba/vbaapplication.hxx
-@@ -51,6 +51,8 @@ public:
- ScVbaApplication( const css::uno::Reference< css::uno::XComponentContext >& m_xContext );
- virtual ~ScVbaApplication();
-
-+ 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);
- virtual void SAL_CALL setDefaultFilePath( const ::rtl::OUString& DefaultFilePath ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-@@ -80,7 +82,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);
-diff --git sc/source/ui/vba/vbacolorformat.cxx sc/source/ui/vba/vbacolorformat.cxx
-deleted file mode 100644
-index d2ce12b..0000000
---- 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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--#include <com/sun/star/beans/XPropertySet.hpp>
--#include <ooo/vba/msforms/XLineFormat.hpp>
--#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 sc/source/ui/vba/vbacolorformat.hxx sc/source/ui/vba/vbacolorformat.hxx
-deleted file mode 100644
-index a45d5d8..0000000
---- 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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--#ifndef SC_VBA_XCOLORFORMAT_HXX
--#define SC_VBA_XCOLORFORMAT_HXX
--
--#include <com/sun/star/drawing/XShape.hpp>
--#include <ooo/vba/msforms/XColorFormat.hpp>
--#include <ooo/vba/msforms/XFillFormat.hpp>
--#include <vbahelper/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<rtl::OUString> 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 sc/source/ui/vba/vbadialog.cxx sc/source/ui/vba/vbadialog.cxx
-index abfa6d3..4adfc4c 100644
---- sc/source/ui/vba/vbadialog.cxx
-+++ sc/source/ui/vba/vbadialog.cxx
-@@ -27,40 +27,11 @@
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
--#include <comphelper/processfactory.hxx>
--
--#include <com/sun/star/lang/XMultiComponentFactory.hpp>
--#include <com/sun/star/frame/XModel.hpp>
--#include <ooo/vba/excel/XApplication.hpp>
--
--#include <tools/string.hxx>
--
--#include "excelvbahelper.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;
-- // #FIXME - should this really use the current document?
-- 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" ) ),
-@@ -103,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;
- }
-
-@@ -114,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 sc/source/ui/vba/vbadialog.hxx sc/source/ui/vba/vbadialog.hxx
-index 583969e..8625166 100644
---- sc/source/ui/vba/vbadialog.hxx
-+++ sc/source/ui/vba/vbadialog.hxx
-@@ -31,26 +31,20 @@
- #define SC_VBA_DIALOG_HXX
-
- #include <cppuhelper/implbase1.hxx>
--
--#include <com/sun/star/uno/XComponentContext.hpp>
--#include <ooo/vba/excel/XApplication.hpp>
- #include <ooo/vba/excel/XDialog.hpp>
--
- #include <vbahelper/vbahelperinterface.hxx>
--#include "vbadialog.hxx"
-+#include <vbahelper/vbadialogbase.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, sal_Int32 nIndex ):ScVbaDialog_BASE( xParent, xContext, 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<rtl::OUString> getServiceNames();
-diff --git sc/source/ui/vba/vbadialogs.cxx sc/source/ui/vba/vbadialogs.cxx
-index c76a0b5..c0c8bf7 100644
---- sc/source/ui/vba/vbadialogs.cxx
-+++ sc/source/ui/vba/vbadialogs.cxx
-@@ -27,18 +27,8 @@
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
--#include <comphelper/processfactory.hxx>
--
--#include <com/sun/star/lang/XMultiComponentFactory.hpp>
--#include <com/sun/star/frame/XModel.hpp>
--#include <ooo/vba/excel/XApplication.hpp>
- #include <ooo/vba/excel/XDialog.hpp>
--
--#include <tools/string.hxx>
--
--#include "excelvbahelper.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 >( Application(),uno::UNO_QUERY_THROW ), nIndex, mxContext ) );
-+ uno::Reference< excel::XDialog > aDialog( new ScVbaDialog( uno::Reference< XHelperInterface >( Application(),uno::UNO_QUERY_THROW ), mxContext, 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 sc/source/ui/vba/vbadialogs.hxx sc/source/ui/vba/vbadialogs.hxx
-index a0b2b24..ab53253 100644
---- sc/source/ui/vba/vbadialogs.hxx
-+++ sc/source/ui/vba/vbadialogs.hxx
-@@ -30,16 +30,14 @@
- #ifndef SC_VBA_DIALOGS_HXX
- #define SC_VBA_DIALOGS_HXX
-
--#include <cppuhelper/implbase1.hxx>
--
- #include <com/sun/star/uno/XComponentContext.hpp>
- #include <ooo/vba/excel/XDialogs.hpp>
- #include <ooo/vba/XCollection.hpp>
- #include <vbahelper/vbahelperinterface.hxx>
-+#include <vbahelper/vbadialogsbase.hxx>
-+#include <cppuhelper/implbase1.hxx>
-
--class ScModelObj;
--
--typedef InheritedHelperInterfaceImpl1< ov::excel::XDialogs > ScVbaDialogs_BASE;
-+typedef cppu::ImplInheritanceHelper1< VbaDialogsBase, ov::excel::XDialogs > ScVbaDialogs_BASE;
-
- class ScVbaDialogs : public ScVbaDialogs_BASE
- {
-@@ -48,7 +46,6 @@ public:
- 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 sc/source/ui/vba/vbaeventshelper.cxx sc/source/ui/vba/vbaeventshelper.cxx
-index 794cb84..3948ac6 100644
---- sc/source/ui/vba/vbaeventshelper.cxx
-+++ sc/source/ui/vba/vbaeventshelper.cxx
-@@ -63,16 +63,13 @@
- #include <cellsuno.hxx>
- #include <convuno.hxx>
- #include <map>
-+#include <svx/msvbahelper.hxx>
-
- using namespace std;
- using namespace com::sun::star;
- using namespace ooo::vba;
- using namespace com::sun::star::document::VbaEventId;
-
--const static rtl::OUString sUrlPart0 = rtl::OUString::createFromAscii( "vnd.sun.star.script:");
--const static rtl::OUString sUrlPart1 = rtl::OUString::createFromAscii( "vnd.sun.star.script:Standard.");
--const static rtl::OUString sUrlPart2 = rtl::OUString::createFromAscii( "?language=Basic&location=document");
--
- typedef ::cppu::WeakImplHelper1< util::XChangesListener > WorksheetChangeListener_BASE;
-
- class WorksheetChangeListener : public WorksheetChangeListener_BASE
-@@ -488,37 +485,6 @@ ScVbaEventsHelper::getEventName( const sal_Int32 nId )
- return sEventName;
- }
-
--// Treat the args as possible inouts ( convertion at bottom of method )
--sal_Bool ScVbaEventsHelper::executeMacro( SfxObjectShell* pShell, const String& sMacroName, uno::Sequence< uno::Any >& aArgs, uno::Any& aRet )
--{
-- // until ObjectModules ( and persisting of codenames ) is supported, if this is a
-- // document saved from XL then we won't be able to determine the codename for the Workbook
-- // Module, so... we have no choice but to search all modules for the moment, thus the macro
-- // passed in should be the fully specified name.
-- rtl::OUString sUrl = sUrlPart0.concat( sMacroName ).concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".") ) ).concat( sUrlPart2 ) ;
-- uno::Sequence< sal_Int16 > aOutArgsIndex;
-- uno::Sequence< uno::Any > aOutArgs;
-- ErrCode nErr = pShell->CallXScript( sUrl, aArgs, aRet,
-- aOutArgsIndex, aOutArgs, sal_False );
--
-- // Script Executed?
-- if ( nErr != ERRCODE_NONE )
-- return sal_False;
--
-- sal_Int32 nLen = aOutArgs.getLength();
-- // convert any out params to seem like they were inouts
-- if ( nLen )
-- {
-- for ( sal_Int32 index=0; index < nLen; ++index )
-- {
-- sal_Int32 nOutIndex = aOutArgsIndex[ index ];
-- aArgs[ nOutIndex ] = aOutArgs[ index ];
-- }
--
-- }
-- return sal_True;
--}
--
- uno::Any ScVbaEventsHelper::createWorkSheet( SfxObjectShell* pShell, SCTAB nTab )
- {
- uno::Any aRet;
-@@ -664,7 +630,7 @@ ScVbaEventsHelper::getMacroPath( const sal_Int32 nEventId, const SCTAB nTab )
- case VBAEVENT_WORKSHEET_SELECTIONCHANGE :
- {
- rtl::OUString aSheetModuleName = getSheetModuleName( nTab );
-- sMacroPath = docMacroExists( pShell, aSheetModuleName, sMacroName );
-+ sMacroPath = findVBAMacro( pShell, aSheetModuleName, sMacroName );
- break;
- }
- // Workbook
-@@ -698,7 +664,7 @@ ScVbaEventsHelper::getMacroPath( const sal_Int32 nEventId, const SCTAB nTab )
- sWorkbookModuleName = aExtDocSettings.maGlobCodeName;
- }
-
-- sMacroPath = docMacroExists( pShell, sWorkbookModuleName, sMacroName );
-+ sMacroPath = findVBAMacro( pShell, sWorkbookModuleName, sMacroName );
- break;
- }
- default:
-diff --git sc/source/ui/vba/vbaeventshelper.hxx sc/source/ui/vba/vbaeventshelper.hxx
-index e812aa0..d165695 100644
---- sc/source/ui/vba/vbaeventshelper.hxx
-+++ sc/source/ui/vba/vbaeventshelper.hxx
-@@ -63,7 +63,6 @@ private:
- css::uno::Any createRange( const css::uno::Any& aRange );
- css::uno::Any createHyperlink( const css::uno::Any& rCell );
- css::uno::Any createWindow( SfxObjectShell* pShell );
-- sal_Bool executeMacro( SfxObjectShell* pShell, const String& sMacroName, css::uno::Sequence< css::uno::Any >& aArgs, css::uno::Any& aRet );
- SCTAB getTabFromArgs( const css::uno::Sequence< css::uno::Any > aArgs, const sal_Int32 nPos = 0 );
- rtl::OUString getEventName( const sal_Int32 nEventId );
- rtl::OUString getMacroPath( const sal_Int32 nEventId, const SCTAB nTab = INVALID_TAB );
-diff --git sc/source/ui/vba/vbafillformat.cxx sc/source/ui/vba/vbafillformat.cxx
-deleted file mode 100644
-index ed7fcd2..0000000
---- 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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--#include <com/sun/star/beans/XPropertySet.hpp>
--#include <com/sun/star/awt/Gradient.hpp>
--#include <com/sun/star/awt/GradientStyle.hpp>
--#include <ooo/vba/office/MsoGradientStyle.hpp>
--#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<double>( 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 sc/source/ui/vba/vbafillformat.hxx sc/source/ui/vba/vbafillformat.hxx
-deleted file mode 100644
-index 047af92..0000000
---- 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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--#ifndef SC_VBA_XFILLFORMAT_HXX
--#define SC_VBA_XFILLFORMAT_HXX
--
--#include <com/sun/star/drawing/XShape.hpp>
--#include <com/sun/star/drawing/FillStyle.hpp>
--#include <ooo/vba/msforms/XFillFormat.hpp>
--#include <vbahelper/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<rtl::OUString> 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 sc/source/ui/vba/vbafont.cxx sc/source/ui/vba/vbafont.cxx
-index 41d09e9..49ebf63 100644
---- sc/source/ui/vba/vbafont.cxx
-+++ sc/source/ui/vba/vbafont.cxx
-@@ -46,30 +46,7 @@
- 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 )
- {
- }
-
-@@ -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,13 +238,12 @@ 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 );
- }
-
-
-@@ -284,26 +254,7 @@ ScVbaFont::getColorIndex() throw ( uno::RuntimeException )
- 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; count<nElems; ++count )
-- {
-- sal_Int32 nPaletteColor = 0;
-- xIndex->getByIndex( count ) >>= nPaletteColor;
-- if ( nPaletteColor == nColor )
-- {
-- nIndex = count + 1; // 1 based
-- break;
-- }
-- }
-- return uno::makeAny( nIndex );
-+ return ScVbaFont_BASE::getColorIndex();
- }
-
- //////////////////////////////////////////////////////////////////////////////////////////
-@@ -396,28 +347,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 +417,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 +432,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 +442,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 +451,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 sc/source/ui/vba/vbafont.hxx sc/source/ui/vba/vbafont.hxx
-index efca63c..16f70ea 100644
---- sc/source/ui/vba/vbafont.hxx
-+++ sc/source/ui/vba/vbafont.hxx
-@@ -32,19 +32,19 @@
-
- #include <cppuhelper/implbase1.hxx>
-
--#include <ooo/vba/excel/XFont.hpp>
- #include <com/sun/star/beans/XPropertySet.hpp>
-+#include <ooo/vba/excel/XFont.hpp>
- #include <vbahelper/vbahelperinterface.hxx>
-+#include <vbahelper/vbafontbase.hxx>
- #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
---- 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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--#include <ooo/vba/office/MsoArrowheadStyle.hpp>
--#include <ooo/vba/office/MsoArrowheadLength.hpp>
--#include <ooo/vba/office/MsoArrowheadWidth.hpp>
--#include <ooo/vba/office/MsoLineDashStyle.hpp>
--#include <com/sun/star/drawing/LineStyle.hpp>
--#include <com/sun/star/drawing/LineDash.hpp>
--#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<sal_Int32>( 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<double>( nTransparency );
-- return fTransparency / 100;
--}
--
--void SAL_CALL
--ScVbaLineFormat::setTransparency( double _transparency ) throw (uno::RuntimeException)
--{
-- sal_Int16 nTransparency = static_cast<sal_Int16>( _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 sc/source/ui/vba/vbalineformat.hxx sc/source/ui/vba/vbalineformat.hxx
-deleted file mode 100644
-index a6287e4..0000000
---- 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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--#ifndef SC_VBA_XLINEFORMAT_HXX
--#define SC_VBA_XLINEFORMAT_HXX
--
--#include <com/sun/star/drawing/XShape.hpp>
--#include <com/sun/star/beans/XPropertySet.hpp>
--#include <ooo/vba/msforms/XLineFormat.hpp>
--#include <vbahelper/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<rtl::OUString> 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 sc/source/ui/vba/vbaoleobject.cxx sc/source/ui/vba/vbaoleobject.cxx
-index cbd1669..3819656 100644
---- sc/source/ui/vba/vbaoleobject.cxx
-+++ sc/source/ui/vba/vbaoleobject.cxx
-@@ -33,6 +33,7 @@
- #include <com/sun/star/view/XControlAccess.hpp>
- #include <com/sun/star/container/XChild.hpp>
- #include <com/sun/star/drawing/XShape.hpp>
-+#include <ooo/vba/XControlProvider.hpp>
-
- #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<lang::XMultiComponentFactory > 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 sc/source/ui/vba/vbaoleobject.hxx sc/source/ui/vba/vbaoleobject.hxx
-index 297fcbf..10133aa 100644
---- sc/source/ui/vba/vbaoleobject.hxx
-+++ sc/source/ui/vba/vbaoleobject.hxx
-@@ -32,8 +32,8 @@
-
- #include <cppuhelper/implbase1.hxx>
- #include <com/sun/star/drawing/XControlShape.hpp>
--#include <com/sun/star/awt/XWindowPeer.hpp>
- #include <ooo/vba/excel/XOLEObject.hpp>
-+#include <ooo/vba/msforms/XControl.hpp>
-
- #include <vbahelper/vbahelperinterface.hxx>
-
-@@ -41,11 +41,11 @@ typedef InheritedHelperInterfaceImpl1< ov::excel::XOLEObject > OLEObjectImpl_BAS
-
- 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<rtl::OUString> 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 sc/source/ui/vba/vbapagesetup.cxx sc/source/ui/vba/vbapagesetup.cxx
-index a859e74..6ce04c5 100644
---- sc/source/ui/vba/vbapagesetup.cxx
-+++ sc/source/ui/vba/vbapagesetup.cxx
-@@ -53,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;
-@@ -66,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)
-@@ -122,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 sc/source/ui/vba/vbapagesetup.hxx sc/source/ui/vba/vbapagesetup.hxx
-index 0026197..59608cf 100644
---- sc/source/ui/vba/vbapagesetup.hxx
-+++ sc/source/ui/vba/vbapagesetup.hxx
-@@ -36,38 +36,27 @@
- #include <com/sun/star/sheet/XSpreadsheet.hpp>
- #include <com/sun/star/beans/XPropertySet.hpp>
- #include <vbahelper/vbahelperinterface.hxx>
-+#include <vbahelper/vbapagesetupbase.hxx>
-
--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);
-+ virtual double SAL_CALL getHeaderMargin() 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 sc/source/ui/vba/vbapalette.cxx sc/source/ui/vba/vbapalette.cxx
-index 8f32414..d5764e5 100644
---- sc/source/ui/vba/vbapalette.cxx
-+++ 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 sc/source/ui/vba/vbapalette.hxx sc/source/ui/vba/vbapalette.hxx
-index af41d2f..dc740ce 100644
---- sc/source/ui/vba/vbapalette.hxx
-+++ sc/source/ui/vba/vbapalette.hxx
-@@ -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 sc/source/ui/vba/vbapictureformat.cxx sc/source/ui/vba/vbapictureformat.cxx
-deleted file mode 100644
-index 2663682..0000000
---- 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
-- * <http://www.openoffice.org/license.html>
-- * 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 sc/source/ui/vba/vbapictureformat.hxx sc/source/ui/vba/vbapictureformat.hxx
-deleted file mode 100644
-index a549b88..0000000
---- 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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--#ifndef SC_VBA_PICTUREFORMAT_HXX
--#define SC_VBA_PICTUREFORMAT_HXX
--
--#include <com/sun/star/drawing/XShape.hpp>
--#include <com/sun/star/beans/XPropertySet.hpp>
--#include <ooo/vba/msforms/XPictureFormat.hpp>
--#include <vbahelper/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<rtl::OUString> 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 sc/source/ui/vba/vbashape.cxx sc/source/ui/vba/vbashape.cxx
-deleted file mode 100644
-index ec13479..0000000
---- sc/source/ui/vba/vbashape.cxx
-+++ /dev/null
-@@ -1,472 +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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--#include<ooo/vba/office/MsoZOrderCmd.hpp>
--#include<ooo/vba/office/MsoScaleFrom.hpp>
--#include<com/sun/star/container/XNamed.hpp>
--#include<com/sun/star/drawing/ConnectorType.hpp>
--#include <com/sun/star/lang/XEventListener.hpp>
--#include<com/sun/star/drawing/XDrawPagesSupplier.hpp>
--#include<com/sun/star/drawing/XDrawPages.hpp>
--
--#include <vos/mutex.hxx>
--#include <vcl/svapp.hxx>
--#include <svx/unopage.hxx>
--#include <svx/unoshape.hxx>
--
--#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 );
-- m_pShapeHelper.reset( new ShapeHelper( m_xShape ) );
-- 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 m_pShapeHelper->getHeight();
--}
--
--void SAL_CALL
--ScVbaShape::setHeight( double _height ) throw (uno::RuntimeException)
--{
-- m_pShapeHelper->setHeight( _height );
--}
--
--double SAL_CALL
--ScVbaShape::getWidth() throw (uno::RuntimeException)
--{
-- return m_pShapeHelper->getWidth();
--}
--
--void SAL_CALL
--ScVbaShape::setWidth( double _width ) throw (uno::RuntimeException)
--{
-- m_pShapeHelper->setWidth( _width );
--}
--
--double SAL_CALL
--ScVbaShape::getLeft() throw (uno::RuntimeException)
--{
-- return m_pShapeHelper->getLeft();
--}
--
--void SAL_CALL
--ScVbaShape::setLeft( double _left ) throw (uno::RuntimeException)
--{
-- m_pShapeHelper->setLeft( _left );
--}
--
--double SAL_CALL
--ScVbaShape::getTop() throw (uno::RuntimeException)
--{
-- return m_pShapeHelper->getTop();
--}
--
--void SAL_CALL
--ScVbaShape::setTop( double _top ) throw (uno::RuntimeException)
--{
-- return m_pShapeHelper->setTop( _top );
--}
--
--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 )
--{
-- // #FIXME don't use getCurrentDocument
-- 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 sc/source/ui/vba/vbashape.hxx sc/source/ui/vba/vbashape.hxx
-deleted file mode 100644
-index eb48b93..0000000
---- 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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--#ifndef SC_VBA_SHAPE_HXX
--#define SC_VBA_SHAPE_HXX
--
--#include <ooo/vba/office/MsoShapeType.hpp>
--#include <com/sun/star/drawing/XShape.hpp>
--#include <com/sun/star/drawing/XShapes.hpp>
--#include <com/sun/star/lang/XEventListener.hpp>
--#include <com/sun/star/beans/XPropertySet.hpp>
--#include <ooo/vba/msforms/XShape.hpp>
--#include <ooo/vba/msforms/XLineFormat.hpp>
--#include <cppuhelper/implbase2.hxx>
--
--#include <vbahelper/vbahelperinterface.hxx>
--
--typedef ::cppu::WeakImplHelper2< ov::msforms::XShape, css::lang::XEventListener > ListeningShape;
--
--typedef InheritedHelperInterfaceImpl< ListeningShape > ScVbaShape_BASE;
--
--class ScVbaShape : public ScVbaShape_BASE
--{
--private:
--protected:
-- std::auto_ptr< ov::ShapeHelper > m_pShapeHelper;
-- 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<rtl::OUString> 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 sc/source/ui/vba/vbashaperange.cxx sc/source/ui/vba/vbashaperange.cxx
-deleted file mode 100644
-index 5890e43..0000000
---- sc/source/ui/vba/vbashaperange.cxx
-+++ /dev/null
-@@ -1,172 +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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--#include <com/sun/star/drawing/XShapeGrouper.hpp>
--#include <com/sun/star/drawing/XDrawPage.hpp>
--
--#include "excelvbahelper.hxx"
--#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<container::XIndexAccess > 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)
--{
-- // #FIXME don't use getCurrentDocument
-- 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 sc/source/ui/vba/vbashaperange.hxx sc/source/ui/vba/vbashaperange.hxx
-deleted file mode 100644
-index 540f33d..0000000
---- 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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--#ifndef SC_VBA_SHAPERANGE_HXX
--#define SC_VBA_SHAPERANGE_HXX
--
--#include <com/sun/star/drawing/XShapes.hpp>
--#include <ooo/vba/msforms/XShapeRange.hpp>
--
--#include <vbahelper/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<rtl::OUString> 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 sc/source/ui/vba/vbashapes.cxx sc/source/ui/vba/vbashapes.cxx
-deleted file mode 100644
-index c1013ba..0000000
---- sc/source/ui/vba/vbashapes.cxx
-+++ /dev/null
-@@ -1,396 +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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--#include <com/sun/star/container/XNamed.hpp>
--#include <com/sun/star/view/XSelectionSupplier.hpp>
--#include <com/sun/star/text/WrapTextMode.hpp>
--#include <ooo/vba/msforms/XShapeRange.hpp>
--#include <ooo/vba/office/MsoAutoShapeType.hpp>
--
--#include "excelvbahelper.hxx"
--#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<msforms::XShapes > m_xParent;
-- uno::Reference<container::XIndexAccess > 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<nLen; ++index )
-- mShapes.push_back( uno::Reference< drawing::XShape >( 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)
--{
-- // #FIXME don't use getCurrentDocument
-- 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 sc/source/ui/vba/vbashapes.hxx sc/source/ui/vba/vbashapes.hxx
-deleted file mode 100644
-index c29f56b..0000000
---- 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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--#ifndef SC_VBA_SHAPES_HXX
--#define SC_VBA_SHAPES_HXX
--
--#include <com/sun/star/drawing/XShapes.hpp>
--#include <com/sun/star/drawing/XDrawPage.hpp>
--#include <com/sun/star/container/XIndexAccess.hpp>
--#include <ooo/vba/msforms/XShapes.hpp>
--
--#include <vbahelper/vbahelperinterface.hxx>
--
--#include <vbahelper/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<rtl::OUString> 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 sc/source/ui/vba/vbatextboxshape.hxx sc/source/ui/vba/vbatextboxshape.hxx
-index c923329..993d045 100644
---- sc/source/ui/vba/vbatextboxshape.hxx
-+++ sc/source/ui/vba/vbatextboxshape.hxx
-@@ -37,7 +37,7 @@
- #include <cppuhelper/implbase1.hxx>
- #include <com/sun/star/text/XTextRange.hpp>
- #include <ooo/vba/msforms/XTextBoxShape.hpp>
--#include "vbashape.hxx"
-+#include <vbahelper/vbashape.hxx>
- #include "excelvbahelper.hxx"
- #include "vbacharacters.hxx"
-
-diff --git sc/source/ui/vba/vbatextframe.cxx sc/source/ui/vba/vbatextframe.cxx
-index fa3980d..1a0f588 100644
---- sc/source/ui/vba/vbatextframe.cxx
-+++ sc/source/ui/vba/vbatextframe.cxx
-@@ -27,6 +27,7 @@
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-+#include <vbahelper/helperdecl.hxx>
- #include <com/sun/star/drawing/TextFitToSizeType.hpp>
- #include <com/sun/star/text/XText.hpp>
- #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_<ScVbaTextFrame, sdecl::with_args<true> > serviceImpl;
-+extern sdecl::ServiceDecl const serviceDecl(
-+ serviceImpl,
-+ "ScVbaTextFrame",
-+ "ooo.vba.excel.TextFrame" );
-+}
-diff --git sc/source/ui/vba/vbatextframe.hxx sc/source/ui/vba/vbatextframe.hxx
-index 4787ddc..71e36bf 100644
---- sc/source/ui/vba/vbatextframe.hxx
-+++ sc/source/ui/vba/vbatextframe.hxx
-@@ -29,45 +29,23 @@
- ************************************************************************/
- #ifndef SC_VBA_TEXTFRAME_HXX
- #define SC_VBA_TEXTFRAME_HXX
--#include <com/sun/star/drawing/XShape.hpp>
--#include <com/sun/star/beans/XPropertySet.hpp>
--#include <ooo/vba/excel/XCharacters.hpp>
- #include <ooo/vba/excel/XTextFrame.hpp>
--
- #include <vbahelper/vbahelperinterface.hxx>
--#include "vbapalette.hxx"
-+#include <vbahelper/vbatextframe.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:
-- virtual rtl::OUString& getServiceImplName();
-- virtual css::uno::Sequence<rtl::OUString> 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);
-+ ScVbaTextFrame( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext > const& xContext ) throw ( css::lang::IllegalArgumentException );
- 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);
-+ virtual css::uno::Any SAL_CALL Characters( ) throw (css::uno::RuntimeException);
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-
- };
-
-diff --git sc/source/ui/vba/vbaworkbooks.cxx sc/source/ui/vba/vbaworkbooks.cxx
-index acb9cfc..2f8325f 100644
---- sc/source/ui/vba/vbaworkbooks.cxx
-+++ sc/source/ui/vba/vbaworkbooks.cxx
-@@ -65,14 +65,6 @@ 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, const uno::Any& aApplication )
- {
-@@ -85,53 +77,6 @@ getWorkbook( uno::Reference< uno::XComponentContext >& xContext, const uno::Refe
- 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;
-@@ -146,100 +91,7 @@ public:
-
- };
-
--// #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
-@@ -255,13 +107,14 @@ 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) ), Application() );
-+ 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 );
-+ uno::Reference< sheet::XSpreadsheetDocument > xDoc( aSource, uno::UNO_QUERY_THROW );
- return getWorkbook( mxContext, xDoc, Application() );
- }
-
-@@ -269,18 +122,7 @@ ScVbaWorkbooks::createCollectionObject( const css::uno::Any& aSource )
- 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 <sheet::XSpreadsheetDocument> xSpreadDoc( xComponent, uno::UNO_QUERY_THROW );
-+ uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( VbaDocumentsBase::Add() , uno::UNO_QUERY_THROW );
-
- if( xSpreadDoc.is() )
- return getWorkbook( mxContext, xSpreadDoc, Application() );
-@@ -290,11 +132,7 @@ ScVbaWorkbooks::Add() throw (uno::RuntimeException)
- 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
-@@ -338,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;
-
-@@ -422,23 +251,7 @@ 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 <sheet::XSpreadsheetDocument> xSpreadDoc( xComponent, uno::UNO_QUERY_THROW );
-+ uno::Reference <sheet::XSpreadsheetDocument> 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() )
-diff --git sc/source/ui/vba/vbaworkbooks.hxx sc/source/ui/vba/vbaworkbooks.hxx
-index b66d294..182a5da 100644
---- sc/source/ui/vba/vbaworkbooks.hxx
-+++ sc/source/ui/vba/vbaworkbooks.hxx
-@@ -34,12 +34,13 @@
- #include <vbahelper/vbacollectionimpl.hxx>
- #include <ooo/vba/excel/XWorkbooks.hpp>
- #include <com/sun/star/container/XEnumerationAccess.hpp>
-+#include <vbahelper/vbadocumentsbase.hxx>
- #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
- {
-diff --git sc/source/ui/vba/vbaworksheet.cxx sc/source/ui/vba/vbaworksheet.cxx
-index 310f81e..ddd5111 100644
---- sc/source/ui/vba/vbaworksheet.cxx
-+++ sc/source/ui/vba/vbaworksheet.cxx
-@@ -86,7 +86,7 @@
- #include "vbapivottables.hxx"
- #include "vbaoleobject.hxx"
- #include "vbaoleobjects.hxx"
--#include "vbashapes.hxx"
-+#include <vbahelper/vbashapes.hxx>
- #include "vbapagesetup.hxx"
- #include "vbapagebreaks.hxx"
-
-diff --git sc/util/makefile.mk sc/util/makefile.mk
-index b3e30f1..442814d 100644
---- sc/util/makefile.mk
-+++ sc/util/makefile.mk
-@@ -373,6 +373,7 @@ SHL9STDLIBS= \
- $(ISCLIB) \
- $(VCLLIB) \
- $(TKLIB) \
-+ $(SVXMSFILTERLIB) \
- $(FORLIB)
-
- SHL9DEPN=$(SHL1TARGETN) $(SHL8TARGETN)
-diff --git scripting/source/dlgprov/dlgevtatt.cxx scripting/source/dlgprov/dlgevtatt.cxx
-index 93409b3..958e854 100644
---- scripting/source/dlgprov/dlgevtatt.cxx
-+++ scripting/source/dlgprov/dlgevtatt.cxx
-@@ -112,13 +112,14 @@ namespace dlgprov
- {
- protected:
- rtl::OUString msDialogCodeName;
-+ rtl::OUString msDialogLibName;
- Reference< script::XScriptListener > mxListener;
- virtual void firing_impl( const script::ScriptEvent& aScriptEvent, uno::Any* pRet );
- public:
-- DialogVBAScriptListenerImpl( const Reference< XComponentContext >& rxContext, const Reference< awt::XControl >& rxControl, const Reference< frame::XModel >& xModel );
-+ DialogVBAScriptListenerImpl( const Reference< XComponentContext >& rxContext, const Reference< awt::XControl >& rxControl, const Reference< frame::XModel >& xModel, const rtl::OUString& sDialogLibName );
- };
-
-- DialogVBAScriptListenerImpl::DialogVBAScriptListenerImpl( const Reference< XComponentContext >& rxContext, const Reference< awt::XControl >& rxControl, const Reference< frame::XModel >& xModel ) : DialogScriptListenerImpl( rxContext )
-+ DialogVBAScriptListenerImpl::DialogVBAScriptListenerImpl( const Reference< XComponentContext >& rxContext, const Reference< awt::XControl >& rxControl, const Reference< frame::XModel >& xModel, const rtl::OUString& sDialogLibName ) : DialogScriptListenerImpl( rxContext ), msDialogLibName( sDialogLibName )
- {
- Reference< XMultiComponentFactory > xSMgr( m_xContext->getServiceManager() );
- Sequence< Any > args(1);
-@@ -146,7 +147,7 @@ namespace dlgprov
- if ( aScriptEvent.ScriptType.equals( rtl::OUString::createFromAscii("VBAInterop") ) && mxListener.is() )
- {
- ScriptEvent aScriptEventCopy( aScriptEvent );
-- aScriptEventCopy.ScriptCode = msDialogCodeName;
-+ aScriptEventCopy.ScriptCode = msDialogLibName.concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "." ) ) ).concat( msDialogCodeName );
- try
- {
- mxListener->firing( aScriptEventCopy );
-@@ -162,7 +163,7 @@ namespace dlgprov
- // DialogEventsAttacherImpl
- // =============================================================================
-
-- DialogEventsAttacherImpl::DialogEventsAttacherImpl( const Reference< XComponentContext >& rxContext, const Reference< frame::XModel >& rxModel, const Reference< awt::XControl >& rxControl, const Reference< XInterface >& rxHandler, const Reference< beans::XIntrospectionAccess >& rxIntrospect, bool bProviderMode, const Reference< script::XScriptListener >& rxRTLListener )
-+ DialogEventsAttacherImpl::DialogEventsAttacherImpl( const Reference< XComponentContext >& rxContext, const Reference< frame::XModel >& rxModel, const Reference< awt::XControl >& rxControl, const Reference< XInterface >& rxHandler, const Reference< beans::XIntrospectionAccess >& rxIntrospect, bool bProviderMode, const Reference< script::XScriptListener >& rxRTLListener, const rtl::OUString& sDialogLibName )
- :m_xContext( rxContext )
- {
- // key listeners by protocol when ScriptType = 'Script'
-@@ -175,7 +176,7 @@ namespace dlgprov
- listernersForTypes[ rtl::OUString::createFromAscii("vnd.sun.star.UNO") ] = new DialogUnoScriptListenerImpl( rxContext, rxModel, rxControl, rxHandler, rxIntrospect, bProviderMode );
- listernersForTypes[ rtl::OUString::createFromAscii("vnd.sun.star.script") ] = new DialogSFScriptListenerImpl( rxContext, rxModel );
- #ifdef FAKE_VBA_EVENT_SUPPORT
-- listernersForTypes[ rtl::OUString::createFromAscii("VBAInterop") ] = new DialogVBAScriptListenerImpl( rxContext, rxControl, rxModel );
-+ listernersForTypes[ rtl::OUString::createFromAscii("VBAInterop") ] = new DialogVBAScriptListenerImpl( rxContext, rxControl, rxModel, sDialogLibName );
- #endif
- }
-
-diff --git scripting/source/dlgprov/dlgevtatt.hxx scripting/source/dlgprov/dlgevtatt.hxx
-index ca1c7a3..d06489d 100644
---- scripting/source/dlgprov/dlgevtatt.hxx
-+++ scripting/source/dlgprov/dlgevtatt.hxx
-@@ -84,7 +84,7 @@ namespace dlgprov
- const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xHandler,
- const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XIntrospectionAccess >& xIntrospect,
- bool bProviderMode,
-- const ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptListener >& xRTLListener );
-+ const ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptListener >& xRTLListener ,const rtl::OUString& sDialogLibName );
- virtual ~DialogEventsAttacherImpl();
-
- // XScriptEventsAttacher
-diff --git scripting/source/dlgprov/dlgprov.cxx scripting/source/dlgprov/dlgprov.cxx
-index a1ae5b7..2754bc1 100644
---- scripting/source/dlgprov/dlgprov.cxx
-+++ scripting/source/dlgprov/dlgprov.cxx
-@@ -418,6 +418,7 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
-
- if ( xISP.is() )
- xInput = xISP->createInputStream();
-+ msDialogLibName = sLibName;
- }
-
- // import dialog model
-@@ -535,7 +536,7 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
- const Reference< XControl >& rxControl,
- const Reference< XInterface >& rxHandler,
- const Reference< XIntrospectionAccess >& rxIntrospectionAccess,
-- bool bDialogProviderMode )
-+ bool bDialogProviderMode, const rtl::OUString& sDialogLibName )
- {
- if ( rxControl.is() )
- {
-@@ -559,7 +560,7 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
-
- Reference< XScriptEventsAttacher > xScriptEventsAttacher = new DialogEventsAttacherImpl
- ( m_xContext, m_xModel, rxControl, rxHandler, rxIntrospectionAccess,
-- bDialogProviderMode, ( m_BasicInfo.get() ? m_BasicInfo->mxBasicRTLListener : NULL ) );
-+ bDialogProviderMode, ( m_BasicInfo.get() ? m_BasicInfo->mxBasicRTLListener : NULL ), msDialogLibName );
-
- Any aHelper;
- xScriptEventsAttacher->attachEvents( aObjects, Reference< XScriptListener >(), aHelper );
-@@ -742,7 +743,7 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
- {
- //xDialog = Reference< XDialog >( xCtrl, UNO_QUERY );
- Reference< XIntrospectionAccess > xIntrospectionAccess = inspectHandler( xHandler );
-- attachControlEvents( xCtrl, xHandler, xIntrospectionAccess, bDialogProviderMode );
-+ attachControlEvents( xCtrl, xHandler, xIntrospectionAccess, bDialogProviderMode, msDialogLibName );
- }
- }
-
-diff --git scripting/source/dlgprov/dlgprov.hxx scripting/source/dlgprov/dlgprov.hxx
-index 559c686..b4c8181 100644
---- scripting/source/dlgprov/dlgprov.hxx
-+++ scripting/source/dlgprov/dlgprov.hxx
-@@ -84,9 +84,9 @@ namespace dlgprov
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xModel;
-
--
-+ rtl::OUString msDialogLibName;
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > createDialogModel( const ::rtl::OUString& sURL );
--
-+
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > createDialogControl(
- const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxDialogModel,
- const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& xParent );
-@@ -94,7 +94,7 @@ namespace dlgprov
- void attachControlEvents( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& rxControlContainer,
- const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxHandler,
- const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XIntrospectionAccess >& rxIntrospectionAccess,
-- bool bDialogProviderMode );
-+ bool bDialogProviderMode, const rtl::OUString& );
- ::com::sun::star::uno::Reference< ::com::sun::star::beans::XIntrospectionAccess > inspectHandler(
- const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxHandler );
- // helper methods
-diff --git scripting/source/vbaevents/eventhelper.cxx scripting/source/vbaevents/eventhelper.cxx
-index 5433c7e..84dc900 100644
---- scripting/source/vbaevents/eventhelper.cxx
-+++ scripting/source/vbaevents/eventhelper.cxx
-@@ -52,6 +52,14 @@
- #include <set>
- #include <list>
- #include <hash_map>
-+#define ASYNC 0
-+
-+// primitive support for asynchronous handling of
-+// events from controls ( all event will be processed asynchronously
-+// in the application thread )
-+#if ASYNC
-+#include <vcl/svapp.hxx>
-+#endif
-
- using namespace ::com::sun::star;
- using namespace ::com::sun::star::script;
-@@ -251,6 +259,12 @@ EventInfoHash& getEventTransInfo()
- info.toVBA = NULL;
- actionInfos.push_back( info );
- eventTransInfo[ rtl::OUString::createFromAscii("actionPerformed") ] = actionInfos;
-+ // itemStateChanged ooo event
-+ std::list< TranslateInfo > stateChangedInfos;
-+ info.sVBAName = rtl::OUString::createFromAscii("_Change");
-+ info.toVBA = NULL;
-+ stateChangedInfos.push_back( info );
-+ eventTransInfo[ rtl::OUString::createFromAscii("itemStateChanged") ] = stateChangedInfos;
- // changed ooo event
- std::list< TranslateInfo > changeInfos;
- info.sVBAName = rtl::OUString::createFromAscii("_Change");
-@@ -621,6 +635,9 @@ protected:
- virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
-
- private:
-+#if ASYNC
-+ DECL_LINK( OnAsyncScriptEvent, ScriptEvent* );
-+#endif
- void setShellFromModel();
- void firing_Impl( const ScriptEvent& evt, Any *pSyncRet=NULL ) throw( RuntimeException );
-
-@@ -666,9 +683,39 @@ EventListener::disposing(const lang::EventObject&) throw( RuntimeException )
- void SAL_CALL
- EventListener::firing(const ScriptEvent& evt) throw(RuntimeException)
- {
-+#if ASYNC
-+ // needs some logic to check if the event handler is oneway or not
-+ // if not oneway then firing_Impl otherwise... as below
-+ acquire();
-+ Application::PostUserEvent( LINK( this, EventListener, OnAsyncScriptEvent ), new ScriptEvent( evt ) );
-+#else
- firing_Impl( evt );
-+#endif
- }
-
-+#if ASYNC
-+IMPL_LINK( EventListener, OnAsyncScriptEvent, ScriptEvent*, _pEvent )
-+{
-+ if ( !_pEvent )
-+ return 1L;
-+
-+ {
-+ // #FIXME if we enable ASYNC we probably need something like
-+ // below
-+ //::osl::ClearableMutexGuard aGuard( m_aMutex );
-+
-+ //if ( !impl_isDisposed_nothrow() )
-+ // impl_doFireScriptEvent_nothrow( aGuard, *_pEvent, NULL );
-+ firing_Impl( *_pEvent, NULL );
-+ }
-+
-+ delete _pEvent;
-+ // we acquired ourself immediately before posting the event
-+ release();
-+ return 0L;
-+ }
-+#endif
-+
- Any SAL_CALL
- EventListener::approveFiring(const ScriptEvent& evt) throw(reflection::InvocationTargetException, RuntimeException)
- {
-@@ -735,6 +782,7 @@ EventListener::firing_Impl(const ScriptEvent& evt, Any* /*pRet*/ ) throw(Runtime
- return;
- lang::EventObject aEvent;
- evt.Arguments[ 0 ] >>= aEvent;
-+ OSL_TRACE("evt.MethodName is %s", rtl::OUStringToOString( evt.MethodName, RTL_TEXTENCODING_UTF8 ).getStr() );
- OSL_TRACE("Argument[0] is %s", rtl::OUStringToOString( comphelper::anyToString( evt.Arguments[0] ), RTL_TEXTENCODING_UTF8 ).getStr() );
- OSL_TRACE("Getting Control");
- uno::Reference< awt::XControl > xControl( aEvent.Source, uno::UNO_QUERY_THROW );
-@@ -771,23 +819,34 @@ EventListener::firing_Impl(const ScriptEvent& evt, Any* /*pRet*/ ) throw(Runtime
-
- StarBASIC* pBasic = mpShell->GetBasic();
- BasicManager* pBasicManager = mpShell->GetBasicManager();
-- //'Project' is a better default but I want to force failures
-- //rtl::OUString sMacroLoc = rtl::OUString::createFromAscii("Project");
-- rtl::OUString sProject = rtl::OUString::createFromAscii("Standard");
--
-- if ( pBasicManager->GetName().Len() > 0 )
-- sProject = pBasicManager->GetName();
--
-+ rtl::OUString sProject;
-+ rtl::OUString sScriptCode( evt.ScriptCode );
-+ // dialogs pass their own library, presence of Dot determines that
-+ if ( sScriptCode.indexOf( '.' ) == -1 )
-+ {
-+ //'Project' is a better default but I want to force failures
-+ //rtl::OUString sMacroLoc = rtl::OUString::createFromAscii("Project");
-+ sProject = rtl::OUString::createFromAscii("Standard");
-+
-+ if ( pBasicManager->GetName().Len() > 0 )
-+ sProject = pBasicManager->GetName();
-+ }
-+ else
-+ {
-+ sal_Int32 nIndex = sScriptCode.indexOf( '.' );
-+ sProject = sScriptCode.copy( 0, nIndex );
-+ sScriptCode = sScriptCode.copy( nIndex + 1 );
-+ }
- rtl::OUString sMacroLoc = sProject;
- sMacroLoc = sMacroLoc.concat( rtl::OUString::createFromAscii(".") );
-- sMacroLoc = sMacroLoc.concat( evt.ScriptCode ).concat( rtl::OUString::createFromAscii(".") );
-+ sMacroLoc = sMacroLoc.concat( sScriptCode ).concat( rtl::OUString::createFromAscii(".") );
-
- OSL_TRACE("sMacroLoc is %s", rtl::OUStringToOString( sMacroLoc, RTL_TEXTENCODING_UTF8 ).getStr() );
-
- // find library
- pBasic = pBasicManager->GetLib( sProject );
-
-- SbModule* pModule = pBasic->FindModule( evt.ScriptCode );
-+ SbModule* pModule = pBasic ? pBasic->FindModule( sScriptCode ) : NULL;
-
- for ( ; pModule && txInfo != txInfo_end; ++txInfo )
- {
-diff --git svx/inc/svx/msvbahelper.hxx svx/inc/svx/msvbahelper.hxx
-new file mode 100644
-index 0000000..8be6901
---- /dev/null
-+++ svx/inc/svx/msvbahelper.hxx
-@@ -0,0 +1,43 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef _MSVBAHELPER_HXX
-+#define _MSVBAHELPER_HXX
-+
-+#include <sfx2/objsh.hxx>
-+#include "svx/svxdllapi.h"
-+
-+namespace ooo { namespace vba
-+{
-+ SVX_DLLPUBLIC String makeMacroURL( const String& sMacroName );
-+ SVX_DLLPUBLIC String findVBAMacro( SfxObjectShell* pShell, const String& sMod, const String& sMacro );
-+ SVX_DLLPUBLIC sal_Bool executeMacro( SfxObjectShell* pShell, const String& sMacroName, com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArgs, com::sun::star::uno::Any& aRet );
-+} }
-+
-+#endif
-diff --git svx/prj/d.lst svx/prj/d.lst
-index 119a6ea..37c75fb 100644
---- svx/prj/d.lst
-+++ svx/prj/d.lst
-@@ -657,5 +657,6 @@ mkdir: %_DEST%\inc%_EXT%\svx\sdr\table
- ..\inc\svx\helperhittest3d.hxx %_DEST%\inc%_EXT%\svx\helperhittest3d.hxx
- ..\inc\svx\optimprove.hxx %_DEST%\inc%_EXT%\svx\optimprove.hxx
- ..\inc\svx\mstoolbar.hxx %_DEST%\inc%_EXT%\svx\mstoolbar.hxx
-+..\inc\svx\msvbahelper.hxx %_DEST%\inc%_EXT%\svx\msvbahelper.hxx
-
- ..\%__SRC%\bin\*-layout.zip %_DEST%\pck%_EXT%\*.*
---- svx/source/msfilter/makefile.mk
-+++ svx/source/msfilter/makefile.mk
-@@ -58,6 +58,7 @@ LIB1OBJFILES= \
- $(SLO)$/mscodec.obj \
- $(SLO)$/msfiltertracer.obj\
- $(SLO)$/mstoolbar.obj\
-+ $(SLO)$/msvbahelper.obj\
-
- EXCEPTIONSFILES= \
- $(SLO)$/eschesdo.obj \
-@@ -76,6 +77,7 @@ EXCEPTIONSFILES= \
- $(SLO)$/svxmsbas.obj \
- $(SLO)$/msfiltertracer.obj\
- $(SLO)$/mstoolbar.obj\
-+ $(SLO)$/msvbahelper.obj\
-
- .INCLUDE : target.mk
-
-diff --git svx/source/msfilter/msocximex.cxx svx/source/msfilter/msocximex.cxx
-index 53e8f82..44a200e 100644
---- svx/source/msfilter/msocximex.cxx
-+++ svx/source/msfilter/msocximex.cxx
-@@ -1749,18 +1749,18 @@ sal_Bool OCX_OptionButton::Import(com::sun::star::uno::Reference<
- rtl::OUString sParentName = msParentName;
- sGroupName = sParentName.concat( C2U( ":" ) ).concat( sGroupName );
- }
-- if ( sGroupName.getLength() > 0 )
-- {
-+ if ( sGroupName.getLength() == 0 )
-+ sGroupName = rtl::OUString::createFromAscii("DefaultGroup");
- OSL_TRACE("RadioButton %s has groupname %s",
- rtl::OUStringToOString( sName, RTL_TEXTENCODING_UTF8 ).getStr(), rtl::OUStringToOString( sGroupName, RTL_TEXTENCODING_UTF8 ).getStr() );
- try
- {
-+ aTmp <<= sGroupName;
- rPropSet->setPropertyValue( WW8_ASCII2STR("GroupName"), aTmp);
- }
- catch( uno::Exception& )
- {
- }
-- }
-
- if (pCaption)
- {
-@@ -1772,11 +1772,6 @@ sal_Bool OCX_OptionButton::Import(com::sun::star::uno::Reference<
- aTmp <<= ::com::sun::star::style::VerticalAlignment_MIDDLE;
- rPropSet->setPropertyValue( WW8_ASCII2STR("VerticalAlign"), aTmp );
-
-- if ( pGroupName )
-- {
-- aTmp <<= lclCreateOUString( pGroupName, nGroupNameLen );
-- rPropSet->setPropertyValue( WW8_ASCII2STR("GroupName"), aTmp);
-- }
- uno::Reference< frame::XModel > xModel ( pDocSh ? pDocSh->GetModel() : NULL );
- lcl_ApplyListSourceAndBindableStuff( xModel, rPropSet, msCtrlSource, msRowSource );
- if ( sImageUrl.getLength() )
-@@ -3791,7 +3786,8 @@ OCX_MultiPage::OCX_MultiPage( SotStorageRef& parent,
- nScrollWidth(0), nScrollHeight(0), nIconLen(0), pIcon(0), nPictureLen(0),
- pPicture(0)
- {
-- msDialogType = C2U("NotSupported");
-+ //msDialogType = C2U("NotSupported");
-+ msDialogType = C2U("com.sun.star.awt.UnoMultiPageModel");
- mnForeColor = 0x80000012L,
- mnBackColor = 0x8000000FL;
- bSetInDialog = true;// UserForm control only
-@@ -3855,7 +3851,6 @@ sal_Bool OCX_MultiPage::Read(SvStorageStream *pS)
- sal_Bool OCX_MultiPage::Import(com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet> &rPropSet)
- {
-- // Calls import on contained controls
- OCX_ContainerControl::Import( rPropSet );
- return sal_True;
- }
-@@ -3876,6 +3871,43 @@ sal_Bool OCX_MultiPage::Import(com::sun::star::uno::Reference<
-
- if ( xPropSet.is() )
- {
-+ uno::Reference<lang::XMultiServiceFactory>
-+ xFactory(rDialog, uno::UNO_QUERY);
-+ OSL_TRACE("** MultiPage creating control %s", rtl::OUStringToOString( msDialogType, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ uno::Reference<uno::XInterface> xCreate = xFactory->createInstance(msDialogType);
-+ if (!xCreate.is())
-+ return sal_False;
-+
-+ uno::Reference<awt::XControlModel> xModel(xCreate, uno::UNO_QUERY);
-+ if (!xModel.is())
-+ return sal_False;
-+
-+ try
-+ {
-+ // we should just call MultiPage::Import( XPropertySet )
-+ OSL_TRACE("********* MULTIPAGE cName %s", rtl::OUStringToOString( sName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ uno::Any aTmp(&sName,getCppuType((OUString *)0));
-+ uno::Reference<beans::XPropertySet> xPrps(xModel, uno::UNO_QUERY);
-+ xPrps->setPropertyValue( WW8_ASCII2STR("Name"), aTmp );
-+ aTmp = uno::makeAny( mnCurrentPageStep );
-+ xPrps->setPropertyValue( WW8_ASCII2STR("ProgressValueMax"), aTmp );
-+ // default current page to 0 ( #FIXME, we need to read this value )
-+ aTmp = uno::makeAny( sal_Int32(0) );
-+ xPrps->setPropertyValue( WW8_ASCII2STR("ProgressValue"), aTmp );
-+ OSL_TRACE("********* MULTIPAGE vomitted out properties");
-+
-+ // Calls import on contained controls
-+ rDialog->insertByName(sName, uno::makeAny(xModel));
-+ OSL_TRACE("*** inserted ***");
-+ }
-+ catch( uno::Exception& )
-+ {
-+ DBG_ERRORFILE(
-+ ByteString( "OCX_Control::Import - cannot insert control \"" ).
-+ Append( ByteString( sName, RTL_TEXTENCODING_UTF8 ) ).
-+ Append( '"' ).GetBuffer() );
-+ }
-+
- // Calls import on contained pages
- return OCX_ContainerControl::Import( xPropSet );
- }
-diff --git svx/source/msfilter/msvbahelper.cxx svx/source/msfilter/msvbahelper.cxx
-new file mode 100644
-index 0000000..5875cf7
---- /dev/null
-+++ svx/source/msfilter/msvbahelper.cxx
-@@ -0,0 +1,134 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#include <svx/msvbahelper.hxx>
-+#include <basic/sbx.hxx>
-+#include <basic/sbstar.hxx>
-+#include <basic/basmgr.hxx>
-+#include <basic/sbmod.hxx>
-+#include <basic/sbmeth.hxx>
-+
-+using namespace ::com::sun::star;
-+
-+const static rtl::OUString sUrlPart0 = rtl::OUString::createFromAscii( "vnd.sun.star.script:");
-+const static rtl::OUString sUrlPart1 = rtl::OUString::createFromAscii( "?language=Basic&location=document");
-+
-+namespace ooo { namespace vba {
-+
-+String makeMacroURL( const String& sMacroName )
-+{
-+ return sUrlPart0.concat( sMacroName ).concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".") ) ).concat( sUrlPart1 ) ;
-+}
-+
-+String findVBAMacro( SfxObjectShell* pShell, const String& sMod, const String& sMacro )
-+{
-+ String sFullName;
-+ // would use the script provider to see if the macro exists but
-+ // called at this stage tdoc content handler stuff is not set up
-+ // so it fails
-+
-+ String sLibrary( RTL_CONSTASCII_USTRINGPARAM("Standard"));
-+ BasicManager* pBasicMgr = pShell-> GetBasicManager();
-+ if ( pBasicMgr )
-+ {
-+ if ( pBasicMgr->GetName().Len() )
-+ sLibrary = pBasicMgr->GetName();
-+ StarBASIC* pBasic = pBasicMgr->GetLib( sLibrary );
-+ if ( !pBasic )
-+ {
-+ USHORT nId = pBasicMgr->GetLibId( sLibrary );
-+ pBasicMgr->LoadLib( nId );
-+ pBasic = pBasicMgr->GetLib( sLibrary );
-+ }
-+ if ( pBasic )
-+ {
-+ if ( sMod.Len() ) // we wish to find the macro is a specific module
-+ {
-+ SbModule* pModule = pBasic->FindModule( sMod );
-+ if ( pModule )
-+ {
-+ SbxArray* pMethods = pModule->GetMethods();
-+ if ( pMethods )
-+ {
-+ SbMethod* pMethod = static_cast< SbMethod* >( pMethods->Find( sMacro, SbxCLASS_METHOD ) );
-+ if ( pMethod )
-+ {
-+ sFullName = sMacro;
-+ sFullName.Insert( '.', 0 ).Insert( sMod, 0 ).Insert( '.', 0 ).Insert( sLibrary, 0 );
-+ }
-+ }
-+ }
-+ }
-+ else if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pBasic->Find( sMacro, SbxCLASS_METHOD ) ) )
-+ {
-+ if( SbModule* pModule = pMethod->GetModule() )
-+ {
-+ sFullName = sMacro;
-+ sFullName.Insert( '.', 0 ).Insert( pModule->GetName(), 0).Insert( '.', 0 ).Insert( sLibrary, 0 );
-+ }
-+ }
-+
-+ }
-+ }
-+ return sFullName;
-+}
-+
-+// Treat the args as possible inouts ( convertion at bottom of method )
-+sal_Bool executeMacro( SfxObjectShell* pShell, const String& sMacroName, uno::Sequence< uno::Any >& aArgs, uno::Any& aRet )
-+{
-+ // until ObjectModules ( and persisting of codenames ) is supported, if this is a
-+ // document saved from XL then we won't be able to determine the codename for the Workbook
-+ // Module, so... we have no choice but to search all modules for the moment, thus the macro
-+ // passed in should be the fully specified name.
-+ rtl::OUString sUrl = makeMacroURL( sMacroName );
-+ uno::Sequence< sal_Int16 > aOutArgsIndex;
-+ uno::Sequence< uno::Any > aOutArgs;
-+ ErrCode nErr = pShell->CallXScript( sUrl, aArgs, aRet,
-+ aOutArgsIndex, aOutArgs, sal_False );
-+
-+ // Script Executed?
-+ if ( nErr != ERRCODE_NONE )
-+ return sal_False;
-+
-+ sal_Int32 nLen = aOutArgs.getLength();
-+ // convert any out params to seem like they were inouts
-+ if ( nLen )
-+ {
-+ for ( sal_Int32 index=0; index < nLen; ++index )
-+ {
-+ sal_Int32 nOutIndex = aOutArgsIndex[ index ];
-+ aArgs[ nOutIndex ] = aOutArgs[ index ];
-+ }
-+
-+ }
-+ return sal_True;
-+}
-+
-+} } // vba // ooo
-diff --git svx/source/msfilter/msvbasic.cxx svx/source/msfilter/msvbasic.cxx
-index 60667ed..cfe547a 100644
---- svx/source/msfilter/msvbasic.cxx
-+++ svx/source/msfilter/msvbasic.cxx
-@@ -954,7 +954,7 @@ int VBA_Impl::ReadVBAProject(const SvStorageRef &rxVBAStorage)
- STREAM_STD_READ | STREAM_NOCREATE );
- // disable read and import of Dir stream bits, e.g. project references and
- // project name for 3.1 ( a bit unstable yet )
--#if 0
-+#if 1
- // decompress the stream
- std::auto_ptr< SvMemoryStream > xCmpDir;
- xCmpDir.reset( MSLZSS::decompressAsStream( xDir, 0 ) );
---- sw/inc/unocoll.hxx
-+++ sw/inc/unocoll.hxx
-@@ -40,6 +40,7 @@
- #include <cppuhelper/implbase4.hxx> // helper for implementations
- #include <IMark.hxx>
- #include <unobaseclass.hxx>
-+#include "swdllapi.h"
- /***************************************************
- ***************************************************
- *
-@@ -283,7 +284,7 @@ cppu::WeakImplHelper3
- ::com::sun::star::lang::XServiceInfo
- >
- SwCollectionBaseClass;
--class SwXTextTables : public SwCollectionBaseClass,
-+class SW_DLLPUBLIC SwXTextTables : public SwCollectionBaseClass,
- public SwUnoCollection
- {
- protected:
---- sw/inc/unotbl.hxx
-+++ sw/inc/unotbl.hxx
-@@ -214,14 +214,13 @@ typedef cppu::WeakImplHelper3<
- ::com::sun::star::lang::XServiceInfo,
- ::com::sun::star::beans::XPropertySet
- > SwXTextTableCursor_Base;
--class SwXTextTableCursor : public SwXTextTableCursor_Base
-+class SW_DLLPUBLIC SwXTextTableCursor : public SwXTextTableCursor_Base
- ,public SwClient
- ,public OTextCursorHelper
- {
- SwDepend aCrsrDepend;
- const SfxItemPropertySet* m_pPropSet;
-
-- SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
- // SwUnoCrsr* GetCrsr() const { return (SwUnoCrsr*)aCrsrDepend.GetRegisteredIn(); }
-
- protected:
-@@ -271,6 +270,7 @@ public:
-
- const SwUnoCrsr* GetCrsr() const;
- SwUnoCrsr* GetCrsr();
-+ SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
- };
-
- /*-----------------11.12.97 09:38-------------------
-diff --git sw/source/filter/ww8/ww8par.cxx sw/source/filter/ww8/ww8par.cxx
-index 65da983..90efd7b 100644
---- sw/source/filter/ww8/ww8par.cxx
-+++ sw/source/filter/ww8/ww8par.cxx
-@@ -154,15 +154,14 @@ using namespace sw::util;
- using namespace sw::types;
- using namespace nsHdFtFlags;
-
--#include <vbahelper/vbahelper.hxx>
- #include <com/sun/star/document/XEventsSupplier.hpp>
- #include <com/sun/star/container/XNameReplace.hpp>
- #include <com/sun/star/frame/XModel.hpp>
--const static String sModule( RTL_CONSTASCII_USTRINGPARAM("ThisDocument"));
-+#include <svx/msvbahelper.hxx>
-+#include <svtools/pathoptions.hxx>
-+#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
-
--const static rtl::OUString sUrlPart0 = rtl::OUString::createFromAscii( "vnd.sun.star.script:");
--const static rtl::OUString sUrlPart1 = rtl::OUString::createFromAscii( "vnd.sun.star.script:Standard.");
--const static rtl::OUString sUrlPart2 = rtl::OUString::createFromAscii( "?language=Basic&location=document");
-+const static String sModule( RTL_CONSTASCII_USTRINGPARAM("ThisDocument"));
-
- struct DocEventNameTable
- {
-@@ -194,7 +193,7 @@ bool registerDocEvent( SfxObjectShell* pShell )
- rtl::OUString sEvt = rtl::OUString::createFromAscii( pTable->sEventName );
- rtl::OUString sMacroName = rtl::OUString::createFromAscii( pTable->sMacroName );
- // fail to search the macro if the module is not specified.
-- String sFullPath = ooo::vba::docMacroExists( pShell, sModule, sMacroName );
-+ String sFullPath = ooo::vba::findVBAMacro( pShell, sModule, sMacroName );
- if( sFullPath.Len() == 0 )
- continue;
-
-@@ -204,7 +203,7 @@ bool registerDocEvent( SfxObjectShell* pShell )
- aOpenEvt[ 0 ].Name = sEvtType;
- aOpenEvt[ 0 ].Value = uno::makeAny(sScript);
- aOpenEvt[ 1 ].Name = sScript;
-- rtl::OUString sUrl = sUrlPart0.concat( sFullPath ).concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".") ) ).concat( sUrlPart2 );
-+ rtl::OUString sUrl = ooo::vba::makeMacroURL( sFullPath );
- aOpenEvt[ 1 ].Value = uno::makeAny(sUrl);
- sal_Int32 nPos = aEvents.getLength();
-
-@@ -3866,16 +3865,16 @@ bool WW8Customizations::Import( SwDocShell* pShell )
-
- bool SwWW8ImplReader::ReadGlobalTemplateSettings()
- {
-+ SvtPathOptions aPathOpt;
-+ String aAddinPath = aPathOpt.GetAddinPath();
- uno::Sequence< rtl::OUString > sGlobalTemplates;
-- rtl::OUString sNode = rtl::OUString::createFromAscii( "org.openoffice.Office.Writer/GlobalTemplateList" );
-- try
-- {
-- css::uno::Reference< css::container::XNameAccess > xCfg( ::comphelper::ConfigurationHelper::openConfig( ::comphelper::getProcessServiceFactory(), sNode, ::comphelper::ConfigurationHelper::E_STANDARD), uno::UNO_QUERY_THROW);
-- xCfg->getByName( rtl::OUString::createFromAscii("Paths") ) >>= sGlobalTemplates;
-- }
-- catch( uno::Exception& )
-- {
-- }
-+
-+ // first get the autoload addins in the directory STARTUP
-+ uno::Reference< ucb::XSimpleFileAccess > xSFA( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ), uno::UNO_QUERY_THROW );
-+
-+ if( xSFA->isFolder( aAddinPath ) )
-+ sGlobalTemplates = xSFA->getFolderContents( aAddinPath, sal_False );
-+
- sal_Int32 nEntries = sGlobalTemplates.getLength();
- bool bRes = true;
- const SvtFilterOptions* pVBAFlags = SvtFilterOptions::Get();
-@@ -3894,8 +3893,9 @@ bool SwWW8ImplReader::ReadGlobalTemplateSettings()
- aURL = sGlobalTemplates[ i ];
- else
- osl::FileBase::getFileURLFromSystemPath( sGlobalTemplates[ i ], aURL );
-- if ( sCreatedFrom.getLength() && sCreatedFrom.equals( aURL ) )
-+ if ( !aURL.endsWithIgnoreAsciiCaseAsciiL( ".dot", 4 ) || ( sCreatedFrom.getLength() && sCreatedFrom.equals( aURL ) ) )
- continue; // don't try and read the same document as ourselves
-+
- SotStorageRef rRoot = new SotStorage( aURL, STREAM_STD_READWRITE, STORAGE_TRANSACTED );
- // Read Macro Projects
- SvxImportMSVBasic aVBasic(*mpDocShell, *rRoot,
-@@ -4182,7 +4182,7 @@ ULONG SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
- maTracer.EnterEnvironment(sw::log::eMacros);
- // dissable below for 3.1 at the moment, 'cause it's kinda immature
- // similarly the project reference in svx/source/msvba
--#if 0
-+#if 1
- // Read Global templates
- ReadGlobalTemplateSettings();
- #endif
-@@ -4199,7 +4199,7 @@ ULONG SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
- int nRet = aVBasic.Import( s1, s2, ! pVBAFlags->IsLoadWordBasicCode() );
- // dissable below for 3.1 at the moment, 'cause it's kinda immature
- // similarly the project reference in svx/source/msvba
--#if 0
-+#if 1
- WW8Customizations aCustomisations( pTableStream, *pWwFib );
- aCustomisations.Import( mpDocShell );
- #endif
-diff --git sw/source/ui/vba/makefile.mk sw/source/ui/vba/makefile.mk
-index 42a9bbc..f51ef26 100644
---- sw/source/ui/vba/makefile.mk
-+++ sw/source/ui/vba/makefile.mk
-@@ -69,7 +69,32 @@ SLOFILES= \
- $(SLO)$/vbapanes.obj \
- $(SLO)$/vbaoptions.obj \
- $(SLO)$/vbaselection.obj \
-- $(SLO)$/vbatemplate.obj \
-+ $(SLO)$/vbatemplate.obj \
-+ $(SLO)$/vbaparagraphformat.obj \
-+ $(SLO)$/vbaautotextentry.obj \
-+ $(SLO)$/vbaparagraph.obj \
-+ $(SLO)$/vbafind.obj \
-+ $(SLO)$/vbareplacement.obj \
-+ $(SLO)$/vbastyle.obj \
-+ $(SLO)$/vbastyles.obj \
-+ $(SLO)$/vbafont.obj \
-+ $(SLO)$/vbapalette.obj \
-+ $(SLO)$/vbainformationhelper.obj \
-+ $(SLO)$/vbatable.obj \
-+ $(SLO)$/vbatables.obj \
-+ $(SLO)$/vbafield.obj \
-+ $(SLO)$/vbaborders.obj \
-+ $(SLO)$/vbadocuments.obj \
-+ $(SLO)$/vbaheaderfooter.obj \
-+ $(SLO)$/vbaheaderfooterhelper.obj \
-+ $(SLO)$/vbaaddin.obj \
-+ $(SLO)$/vbaaddins.obj \
-+ $(SLO)$/vbadialogs.obj \
-+ $(SLO)$/vbadialog.obj \
-+ $(SLO)$/vbawrapformat.obj \
-+ $(SLO)$/vbapagesetup.obj \
-+ $(SLO)$/vbasection.obj \
-+ $(SLO)$/vbasections.obj \
-
- # --- Targets ------------------------------------------------------
-
-diff --git sw/source/ui/vba/service.cxx sw/source/ui/vba/service.cxx
-index 009f440..0ed9492 100644
---- sw/source/ui/vba/service.cxx
-+++ sw/source/ui/vba/service.cxx
-@@ -50,6 +50,11 @@ namespace document
- extern sdecl::ServiceDecl const serviceDecl;
- }
-
-+namespace wrapformat
-+{
-+extern sdecl::ServiceDecl const serviceDecl;
-+}
-+
- extern "C"
- {
- void SAL_CALL component_getImplementationEnvironment(
-@@ -66,7 +71,7 @@ extern "C"
-
- // Component registration
- return component_writeInfoHelper( pServiceManager, pRegistryKey,
-- globals::serviceDecl, document::serviceDecl );
-+ globals::serviceDecl, document::serviceDecl, wrapformat::serviceDecl );
- }
-
- void * SAL_CALL component_getFactory(
-@@ -75,7 +80,7 @@ extern "C"
- {
- OSL_TRACE("In component_getFactory for %s", pImplName );
- void* pRet = component_getFactoryHelper(
-- pImplName, pServiceManager, pRegistryKey, globals::serviceDecl, document::serviceDecl );
-+ pImplName, pServiceManager, pRegistryKey, globals::serviceDecl, document::serviceDecl, wrapformat::serviceDecl );
- OSL_TRACE("Ret is 0x%x", pRet);
- return pRet;
- }
-diff --git sw/source/ui/vba/vbaaddin.cxx sw/source/ui/vba/vbaaddin.cxx
-new file mode 100644
-index 0000000..559643f
---- /dev/null
-+++ sw/source/ui/vba/vbaaddin.cxx
-@@ -0,0 +1,107 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbaaddin.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include <tools/urlobj.hxx>
-+#include <osl/file.hxx>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaAddin::SwVbaAddin( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const rtl::OUString& rFileURL, sal_Bool bAutoload ) throw ( uno::RuntimeException ) :
-+ SwVbaAddin_BASE( rParent, rContext ), msFileURL( rFileURL ), mbAutoload( bAutoload ), mbInstalled( bAutoload )
-+{
-+}
-+
-+SwVbaAddin::~SwVbaAddin()
-+{
-+}
-+
-+::rtl::OUString SAL_CALL SwVbaAddin::getName() throw (uno::RuntimeException)
-+{
-+ rtl::OUString sName;
-+ INetURLObject aURL( msFileURL );
-+ ::osl::File::getSystemPathFromFileURL( aURL.GetLastName(), sName );
-+ return sName;
-+}
-+
-+void SAL_CALL
-+SwVbaAddin::setName( const rtl::OUString& ) throw ( css::uno::RuntimeException )
-+{
-+ throw uno::RuntimeException( rtl::OUString(
-+ RTL_CONSTASCII_USTRINGPARAM(" Fail to set name")), uno::Reference< uno::XInterface >() );
-+}
-+
-+::rtl::OUString SAL_CALL SwVbaAddin::getPath() throw (uno::RuntimeException)
-+{
-+ INetURLObject aURL( msFileURL );
-+ aURL.CutLastName();
-+ return aURL.GetURLPath();
-+}
-+
-+::sal_Bool SAL_CALL SwVbaAddin::getAutoload() throw (uno::RuntimeException)
-+{
-+ return mbAutoload;
-+}
-+
-+::sal_Bool SAL_CALL SwVbaAddin::getInstalled() throw (uno::RuntimeException)
-+{
-+ return mbInstalled;
-+}
-+
-+void SAL_CALL SwVbaAddin::setInstalled( ::sal_Bool _installed ) throw (uno::RuntimeException)
-+{
-+ if( _installed != mbInstalled )
-+ {
-+ mbInstalled = _installed;
-+ // TODO: should call AutoExec and AutoExit etc.
-+ }
-+}
-+
-+rtl::OUString&
-+SwVbaAddin::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaAddin") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaAddin::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Addin" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbaaddin.hxx sw/source/ui/vba/vbaaddin.hxx
-new file mode 100644
-index 0000000..8ddb120
---- /dev/null
-+++ sw/source/ui/vba/vbaaddin.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:
-+ * $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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_ADDIN_HXX
-+#define SW_VBA_ADDIN_HXX
-+
-+#include <ooo/vba/word/XAddin.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XAddin > SwVbaAddin_BASE;
-+
-+class SwVbaAddin : public SwVbaAddin_BASE
-+{
-+private:
-+ rtl::OUString msFileURL;
-+ sal_Bool mbAutoload;
-+ sal_Bool mbInstalled;
-+
-+public:
-+ SwVbaAddin( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const rtl::OUString& rFileURL, sal_Bool bAutoload ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaAddin();
-+
-+ // 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 ::rtl::OUString SAL_CALL getPath() throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getAutoload() throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getInstalled() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setInstalled( ::sal_Bool _installed ) throw (css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_ADDIN_HXX */
-diff --git sw/source/ui/vba/vbaaddins.cxx sw/source/ui/vba/vbaaddins.cxx
-new file mode 100644
-index 0000000..17dbed8
---- /dev/null
-+++ sw/source/ui/vba/vbaaddins.cxx
-@@ -0,0 +1,110 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbaaddins.hxx"
-+#include "vbaaddin.hxx"
-+#include <cppuhelper/implbase3.hxx>
-+#include <svtools/pathoptions.hxx>
-+#include <com/sun/star/lang/XMultiComponentFactory.hpp>
-+#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+uno::Reference< container::XIndexAccess > lcl_getAddinCollection( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext )
-+{
-+ XNamedObjectCollectionHelper< word::XAddin >::XNamedVec maAddins;
-+
-+ // first get the autoload addins in the directory STARTUP
-+ uno::Reference< lang::XMultiComponentFactory > xMCF( xContext->getServiceManager(), uno::UNO_QUERY_THROW );
-+ uno::Reference< ucb::XSimpleFileAccess > xSFA( xMCF->createInstanceWithContext( rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ), xContext), uno::UNO_QUERY_THROW );
-+ SvtPathOptions aPathOpt;
-+ // FIXME: temporary the STARTUP path is located in $OO/basic3.1/program/addin
-+ String aAddinPath = aPathOpt.GetAddinPath();
-+ OSL_TRACE("lcl_getAddinCollection: %s", rtl::OUStringToOString( aAddinPath, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ if( xSFA->isFolder( aAddinPath ) )
-+ {
-+ uno::Sequence< rtl::OUString > sEntries = xSFA->getFolderContents( aAddinPath, sal_False );
-+ sal_Int32 nEntry = sEntries.getLength();
-+ for( sal_Int32 index = 0; index < nEntry; ++index )
-+ {
-+ rtl::OUString sUrl = sEntries[ index ];
-+ if( !xSFA->isFolder( sUrl ) && sUrl.endsWithIgnoreAsciiCaseAsciiL( ".dot", 4 ) )
-+ {
-+ maAddins.push_back( uno::Reference< word::XAddin >( new SwVbaAddin( xParent, xContext, sUrl, sal_True ) ) );
-+ }
-+ }
-+ }
-+
-+ // TODO: second get the customize addins in the org.openoffice.Office.Writer/GlobalTemplateList
-+
-+ uno::Reference< container::XIndexAccess > xAddinsAccess( new XNamedObjectCollectionHelper< word::XAddin >( maAddins ) );
-+ return xAddinsAccess;
-+}
-+
-+SwVbaAddins::SwVbaAddins( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext ) throw (uno::RuntimeException): SwVbaAddins_BASE( xParent, xContext, lcl_getAddinCollection( xParent,xContext ) )
-+{
-+}
-+// XEnumerationAccess
-+uno::Type
-+SwVbaAddins::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XAddin::static_type(0);
-+}
-+uno::Reference< container::XEnumeration >
-+SwVbaAddins::createEnumeration() throw (uno::RuntimeException)
-+{
-+ uno::Reference< container::XEnumerationAccess > xEnumerationAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
-+ return xEnumerationAccess->createEnumeration();
-+}
-+
-+uno::Any
-+SwVbaAddins::createCollectionObject( const css::uno::Any& aSource )
-+{
-+ return aSource;
-+}
-+
-+rtl::OUString&
-+SwVbaAddins::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaAddins") );
-+ return sImplName;
-+}
-+
-+css::uno::Sequence<rtl::OUString>
-+SwVbaAddins::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Addins") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbaaddins.hxx sw/source/ui/vba/vbaaddins.hxx
-new file mode 100644
-index 0000000..6efa97e
---- /dev/null
-+++ sw/source/ui/vba/vbaaddins.hxx
-@@ -0,0 +1,55 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_ADDINS_HXX
-+#define SW_VBA_ADDINS_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XAddins.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+
-+typedef CollTestImplHelper< ooo::vba::word::XAddins > SwVbaAddins_BASE;
-+
-+class SwVbaAddins : public SwVbaAddins_BASE
-+{
-+public:
-+ SwVbaAddins( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext ) throw (css::uno::RuntimeException);
-+ virtual ~SwVbaAddins() {}
-+
-+ // 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);
-+
-+ // SwVbaAddins_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* SW_VBA_ADDINS_HXX */
-diff --git sw/source/ui/vba/vbaapplication.cxx sw/source/ui/vba/vbaapplication.cxx
-index 0d580e3..4117688 100644
---- sw/source/ui/vba/vbaapplication.cxx
-+++ sw/source/ui/vba/vbaapplication.cxx
-@@ -36,6 +36,13 @@
- #include "vbasystem.hxx"
- #include "vbaoptions.hxx"
- #include "vbaselection.hxx"
-+#include "vbadocuments.hxx"
-+#include "vbaaddins.hxx"
-+#include "vbadialogs.hxx"
-+#include <ooo/vba/word/WdEnableCancelKey.hpp>
-+#include <svx/acorrcfg.hxx>
-+#include "wordvbahelper.hxx"
-+#include <docsh.hxx>
-
- using namespace ::ooo;
- using namespace ::ooo::vba;
-@@ -71,6 +78,11 @@ SwVbaApplication::~SwVbaApplication()
- {
- }
-
-+SfxObjectShell* SwVbaApplication::GetDocShell( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
-+{
-+ return static_cast< SfxObjectShell* >( word::getDocShell( xModel ) );
-+}
-+
- rtl::OUString SAL_CALL
- SwVbaApplication::getName() throw (uno::RuntimeException)
- {
-@@ -115,6 +127,59 @@ SwVbaApplication::getSelection() throw (uno::RuntimeException)
- return new SwVbaSelection( this, mxContext, getCurrentDocument() );
- }
-
-+uno::Any SAL_CALL
-+SwVbaApplication::Documents( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< XCollection > xCol( new SwVbaDocuments( this, mxContext ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaApplication::Addins( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ static uno::Reference< XCollection > xCol( new SwVbaAddins( this, mxContext ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaApplication::Dialogs( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< word::XDialogs > xCol( new SwVbaDialogs( this, mxContext ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index );
-+ return uno::makeAny( xCol );
-+}
-+
-+sal_Bool SAL_CALL SwVbaApplication::getDisplayAutoCompleteTips() throw (css::uno::RuntimeException)
-+{
-+ return SvxAutoCorrCfg::Get()->IsAutoTextTip();
-+}
-+
-+void SAL_CALL SwVbaApplication::setDisplayAutoCompleteTips( sal_Bool _displayAutoCompleteTips ) throw (css::uno::RuntimeException)
-+{
-+ SvxAutoCorrCfg::Get()->SetAutoTextTip( _displayAutoCompleteTips );
-+}
-+
-+sal_Int32 SAL_CALL SwVbaApplication::getEnableCancelKey() throw (css::uno::RuntimeException)
-+{
-+ // the default value is wdCancelInterrupt in Word
-+ return word::WdEnableCancelKey::wdCancelInterrupt;
-+}
-+
-+void SAL_CALL SwVbaApplication::setEnableCancelKey( sal_Int32/* _enableCancelKey */) throw (css::uno::RuntimeException)
-+{
-+ // seems not supported in Writer
-+}
-+
-+float SAL_CALL SwVbaApplication::CentimetersToPoints( float _Centimeters ) throw (uno::RuntimeException)
-+{
-+ return VbaApplicationBase::CentimetersToPoints( _Centimeters );
-+}
-+
- rtl::OUString&
- SwVbaApplication::getServiceImplName()
- {
-diff --git sw/source/ui/vba/vbaapplication.hxx sw/source/ui/vba/vbaapplication.hxx
-index fbb7221..e896e02 100644
---- sw/source/ui/vba/vbaapplication.hxx
-+++ sw/source/ui/vba/vbaapplication.hxx
-@@ -36,6 +36,7 @@
- #include <ooo/vba/word/XSystem.hpp>
- #include <ooo/vba/word/XOptions.hpp>
- #include <ooo/vba/word/XSelection.hpp>
-+#include <ooo/vba/word/XAddins.hpp>
- #include <vbahelper/vbahelperinterface.hxx>
- #include <vbahelper/vbaapplicationbase.hxx>
- #include <cppuhelper/implbase1.hxx>
-@@ -49,6 +50,8 @@ public:
- SwVbaApplication( css::uno::Reference< css::uno::XComponentContext >& m_xContext );
- virtual ~SwVbaApplication();
-
-+ virtual SfxObjectShell* GetDocShell( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
-+
- // XApplication
- virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< ooo::vba::word::XSystem > SAL_CALL getSystem() throw (css::uno::RuntimeException);
-@@ -57,6 +60,14 @@ public:
- virtual css::uno::Reference< ooo::vba::word::XOptions > SAL_CALL getOptions() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< ooo::vba::word::XSelection > SAL_CALL getSelection() 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 Documents( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Addins( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Dialogs( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual sal_Bool SAL_CALL getDisplayAutoCompleteTips() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setDisplayAutoCompleteTips( sal_Bool _displayAutoCompleteTips ) throw (css::uno::RuntimeException);
-+ virtual sal_Int32 SAL_CALL getEnableCancelKey() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setEnableCancelKey( sal_Int32 _enableCancelKey ) throw (css::uno::RuntimeException);
-+ virtual float SAL_CALL CentimetersToPoints( float _Centimeters ) throw (css::uno::RuntimeException);
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-diff --git sw/source/ui/vba/vbaautotextentry.cxx sw/source/ui/vba/vbaautotextentry.cxx
-new file mode 100644
-index 0000000..2cab994
---- /dev/null
-+++ sw/source/ui/vba/vbaautotextentry.cxx
-@@ -0,0 +1,129 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbaautotextentry.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include "vbarange.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaAutoTextEntry::SwVbaAutoTextEntry( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XAutoTextEntry >& xEntry ) throw ( uno::RuntimeException ) :
-+ SwVbaAutoTextEntry_BASE( rParent, rContext ), mxEntry( xEntry )
-+{
-+}
-+
-+SwVbaAutoTextEntry::~SwVbaAutoTextEntry()
-+{
-+}
-+
-+uno::Reference< word::XRange > SAL_CALL SwVbaAutoTextEntry::Insert( const uno::Reference< word::XRange >& _where, const uno::Any& _richtext ) throw ( uno::RuntimeException )
-+{
-+ SwVbaRange* pWhere = dynamic_cast<SwVbaRange*>( _where.get() );
-+ if( pWhere )
-+ {
-+ uno::Reference< text::XTextRange > xTextRange = pWhere->getXTextRange();
-+ xTextRange->setString( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("x") ) ); // set marker
-+ uno::Reference< text::XTextRange > xEndMarker = xTextRange->getEnd();
-+ xEndMarker->setString( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("x") ) ); // set marker
-+ uno::Reference< text::XText > xText = pWhere->getXText();
-+ mxEntry->applyTo( xEndMarker->getStart() );
-+ uno::Reference< text::XTextCursor > xTC = xText->createTextCursorByRange( xTextRange->getStart() );
-+ xTC->goRight( 1, sal_True );
-+ xTC->setString( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("") ) ); // remove marker
-+ xEndMarker->setString( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("") ) ); // remove marker
-+ xTC->gotoRange( xEndMarker, sal_True );
-+ pWhere->setXTextCursor( xTC );
-+ }
-+ return uno::Reference< word::XRange >( pWhere );
-+}
-+
-+rtl::OUString&
-+SwVbaAutoTextEntry::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaAutoTextEntry") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaAutoTextEntry::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.AutoTextEntry" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-+
-+SwVbaAutoTextEntries::SwVbaAutoTextEntries( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess ) throw (uno::RuntimeException) : SwVbaAutoTextEntries_BASE( xParent, xContext, xIndexAccess ), mxAutoTextEntryAccess( xIndexAccess )
-+{
-+}
-+
-+// XEnumerationAccess
-+uno::Type
-+SwVbaAutoTextEntries::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XAutoTextEntry::static_type(0);
-+}
-+uno::Reference< container::XEnumeration >
-+SwVbaAutoTextEntries::createEnumeration() throw (uno::RuntimeException)
-+{
-+ uno::Reference< container::XEnumerationAccess > xEnumerationAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
-+ return xEnumerationAccess->createEnumeration();
-+}
-+
-+uno::Any
-+SwVbaAutoTextEntries::createCollectionObject( const css::uno::Any& aSource )
-+{
-+ uno::Reference< text::XAutoTextEntry > xEntry( aSource, uno::UNO_QUERY_THROW );
-+ return uno::makeAny( uno::Reference< word::XAutoTextEntry >( new SwVbaAutoTextEntry( this, mxContext, xEntry ) ) );
-+}
-+
-+rtl::OUString&
-+SwVbaAutoTextEntries::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaAutoTextEntries") );
-+ return sImplName;
-+}
-+
-+css::uno::Sequence<rtl::OUString>
-+SwVbaAutoTextEntries::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.AutoTextEntries") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbaautotextentry.hxx sw/source/ui/vba/vbaautotextentry.hxx
-new file mode 100644
-index 0000000..01d12b9
---- /dev/null
-+++ sw/source/ui/vba/vbaautotextentry.hxx
-@@ -0,0 +1,83 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_AUTOTEXTENTRY_HXX
-+#define SW_VBA_AUTOTEXTENTRY_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XAutoTextEntries.hpp>
-+#include <ooo/vba/word/XAutoTextEntry.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <ooo/vba/word/XRange.hpp>
-+#include <com/sun/star/text/XAutoTextEntry.hpp>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XAutoTextEntry > SwVbaAutoTextEntry_BASE;
-+
-+class SwVbaAutoTextEntry : public SwVbaAutoTextEntry_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XAutoTextEntry > mxEntry;
-+
-+public:
-+ SwVbaAutoTextEntry( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XAutoTextEntry >& xEntry ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaAutoTextEntry();
-+
-+ // XAutoTextEntry
-+ virtual css::uno::Reference< ooo::vba::word::XRange > SAL_CALL Insert( const css::uno::Reference< ooo::vba::word::XRange >& _where, const css::uno::Any& _richtext ) throw ( css::uno::RuntimeException );
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+
-+/* class SwVbaAutoTextEntries */
-+typedef CollTestImplHelper< ooo::vba::word::XAutoTextEntries > SwVbaAutoTextEntries_BASE;
-+
-+class SwVbaAutoTextEntries : public SwVbaAutoTextEntries_BASE
-+{
-+private:
-+ css::uno::Reference< css::container::XIndexAccess > mxAutoTextEntryAccess;
-+
-+public:
-+ SwVbaAutoTextEntries( 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);
-+ virtual ~SwVbaAutoTextEntries() {}
-+
-+ // 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);
-+
-+ // SwVbaAutoTextEntries_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* SW_VBA_AUTOTEXTENTRY_HXX */
-diff --git sw/source/ui/vba/vbabookmark.cxx sw/source/ui/vba/vbabookmark.cxx
-index e05476e..0c7bacf 100644
---- sw/source/ui/vba/vbabookmark.cxx
-+++ sw/source/ui/vba/vbabookmark.cxx
-@@ -87,7 +87,8 @@ uno::Any SAL_CALL SwVbaBookmark::Range() throw ( uno::RuntimeException )
- {
- uno::Reference< text::XTextContent > xTextContent( mxBookmark, uno::UNO_QUERY_THROW );
- uno::Reference< text::XTextDocument > xTextDocument( mxModel, uno::UNO_QUERY_THROW );
-- return uno::makeAny( uno::Reference< word::XRange>( new SwVbaRange( this, mxContext, xTextDocument, xTextContent->getAnchor()->getStart(), xTextContent->getAnchor()->getEnd() ) ) );
-+ uno::Reference< text::XTextRange > xTextRange( xTextContent->getAnchor(), uno::UNO_QUERY_THROW );
-+ return uno::makeAny( uno::Reference< word::XRange>( new SwVbaRange( this, mxContext, xTextDocument, xTextRange->getStart(), xTextRange->getEnd(), xTextRange->getText() ) ) );
- }
-
- rtl::OUString&
-diff --git sw/source/ui/vba/vbabookmarks.cxx sw/source/ui/vba/vbabookmarks.cxx
-index 3ff2bf3..e7d73cf 100644
---- sw/source/ui/vba/vbabookmarks.cxx
-+++ sw/source/ui/vba/vbabookmarks.cxx
-@@ -35,6 +35,8 @@
- #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
- #include <ooo/vba/word/WdBookmarkSortBy.hpp>
- #include "vbarange.hxx"
-+#include "wordvbahelper.hxx"
-+#include <cppuhelper/implbase2.hxx>
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-@@ -55,15 +57,73 @@ public:
-
- };
-
--SwVbaBookmarks::SwVbaBookmarks( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext, const uno::Reference< container::XIndexAccess >& xBookmarks, const uno::Reference< frame::XModel >& xModel ): SwVbaBookmarks_BASE( xParent, xContext, xBookmarks ), mxModel( xModel )
-+// Bookmarks use case-insensitive name lookup in MS Word.
-+typedef ::cppu::WeakImplHelper2< container::XNameAccess, container::XIndexAccess > BookmarkCollectionHelper_BASE;
-+class BookmarkCollectionHelper : public BookmarkCollectionHelper_BASE
-+{
-+private:
-+ uno::Reference< container::XNameAccess > mxNameAccess;
-+ uno::Reference< container::XIndexAccess > mxIndexAccess;
-+ uno::Any cachePos;
-+public:
-+ BookmarkCollectionHelper( const uno::Reference< container::XIndexAccess >& xIndexAccess ) throw (uno::RuntimeException) : mxIndexAccess( xIndexAccess )
-+ {
-+ mxNameAccess.set( mxIndexAccess, uno::UNO_QUERY_THROW );
-+ }
-+ // XElementAccess
-+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) { return mxIndexAccess->getElementType(); }
-+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) { return mxIndexAccess->hasElements(); }
-+ // 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 cachePos;
-+ }
-+ virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException)
-+ {
-+ return mxNameAccess->getElementNames();
-+ }
-+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
-+ {
-+ if( mxNameAccess->hasByName( aName ) )
-+ {
-+ cachePos = mxNameAccess->getByName( aName );
-+ return sal_True;
-+ }
-+ else
-+ {
-+ for( sal_Int32 nIndex = 0; nIndex < mxIndexAccess->getCount(); nIndex++ )
-+ {
-+ uno::Reference< container::XNamed > xNamed( mxIndexAccess->getByIndex( nIndex ), uno::UNO_QUERY_THROW );
-+ rtl::OUString aBookmarkName = xNamed->getName();
-+ if( aName.equalsIgnoreAsciiCase( aBookmarkName ) )
-+ {
-+ cachePos <<= xNamed;
-+ return sal_True;
-+ }
-+ }
-+ }
-+ return sal_False;
-+ }
-+ // XIndexAccess
-+ virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
-+ {
-+ return mxIndexAccess->getCount();
-+ }
-+ virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
-+ {
-+ return mxIndexAccess->getByIndex( Index );
-+ }
-+};
-+
-+SwVbaBookmarks::SwVbaBookmarks( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext, const uno::Reference< container::XIndexAccess >& xBookmarks, const uno::Reference< frame::XModel >& xModel ): SwVbaBookmarks_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new BookmarkCollectionHelper( xBookmarks ) ) ), mxModel( xModel )
- {
- mxBookmarksSupplier.set( mxModel, uno::UNO_QUERY_THROW );
- uno::Reference< text::XTextDocument > xDocument( mxModel, uno::UNO_QUERY_THROW );
-- mxText = xDocument->getText();
--
-- // FIXME: fail to rename the bookmark
-- // word doesn't distinguish cases, so set all bookmarknames to Lowercase
-- //renameAllBookmarksToLowercase();
-+ // use view cursor to insert bookmark, or it will fail if insert bookmark in table
-+ // mxText = xDocument->getText();
-+ mxText = word::getXTextViewCursor( mxModel )->getText();
- }
- // XEnumerationAccess
- uno::Type
-@@ -88,7 +148,7 @@ SwVbaBookmarks::createCollectionObject( const css::uno::Any& aSource )
-
- void SwVbaBookmarks::removeBookmarkByName( const rtl::OUString& rName ) throw (uno::RuntimeException)
- {
-- uno::Reference< text::XTextContent > xBookmark( mxBookmarksSupplier->getBookmarks()->getByName( rName ), uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextContent > xBookmark( m_xNameAccess->getByName( rName ), uno::UNO_QUERY_THROW );
- mxText->removeTextContent( xBookmark );
- }
-
-@@ -101,19 +161,6 @@ void SwVbaBookmarks::addBookmarkByName( const rtl::OUString& rName, const uno::R
- mxText->insertTextContent( rTextRange, xBookmark, sal_False );
- }
-
--void SwVbaBookmarks::renameAllBookmarksToLowercase() throw (uno::RuntimeException)
--{
-- uno::Reference< container::XIndexAccess > xBookmarks( mxBookmarksSupplier->getBookmarks(),uno::UNO_QUERY_THROW );
-- for( sal_Int32 nIndex = 0; nIndex < xBookmarks->getCount(); nIndex++ )
-- {
-- uno::Reference< container::XNamed > xNamed( xBookmarks->getByIndex( nIndex ), uno::UNO_QUERY_THROW );
-- rtl::OUString aName = xNamed->getName();
-- rtl::OUString aNameLowerCase = aName.toAsciiLowerCase();
-- if( !aName.equals( aNameLowerCase ) );
-- xNamed->setName( aNameLowerCase );
-- }
--}
--
- uno::Any SAL_CALL
- SwVbaBookmarks::Add( const rtl::OUString& rName, const uno::Any& rRange ) throw (uno::RuntimeException)
- {
-@@ -128,13 +175,13 @@ SwVbaBookmarks::Add( const rtl::OUString& rName, const uno::Any& rRange ) throw
- else
- {
- // FIXME: insert the bookmark into current view cursor
-- uno::Reference< text::XTextViewCursorSupplier > xViewCursorSupplier( mxModel->getCurrentController(), uno::UNO_QUERY_THROW );
-- xTextRange.set( xViewCursorSupplier->getViewCursor(), uno::UNO_QUERY_THROW );
-+ xTextRange.set( word::getXTextViewCursor( mxModel ), uno::UNO_QUERY_THROW );
- }
-
- // remove the exist bookmark
-- rtl::OUString aName = rName.toAsciiLowerCase();
-- if( mxBookmarksSupplier->getBookmarks()->hasByName( aName ) )
-+ // rtl::OUString aName = rName.toAsciiLowerCase();
-+ rtl::OUString aName = rName;
-+ if( m_xNameAccess->hasByName( aName ) )
- removeBookmarkByName( aName );
-
- addBookmarkByName( aName, xTextRange );
-@@ -169,7 +216,7 @@ SwVbaBookmarks::setShowHidden( sal_Bool /*_hidden*/ ) throw (css::uno::RuntimeEx
- sal_Bool SAL_CALL
- SwVbaBookmarks::Exists( const rtl::OUString& rName ) throw (css::uno::RuntimeException)
- {
-- sal_Bool bExist = mxBookmarksSupplier->getBookmarks()->hasByName( rName.toAsciiLowerCase() );
-+ sal_Bool bExist = m_xNameAccess->hasByName( rName );
- return bExist;
- }
-
-diff --git sw/source/ui/vba/vbabookmarks.hxx sw/source/ui/vba/vbabookmarks.hxx
-index 7fe5ffe..6047788 100644
---- sw/source/ui/vba/vbabookmarks.hxx
-+++ sw/source/ui/vba/vbabookmarks.hxx
-@@ -51,7 +51,6 @@ private:
- private:
- void removeBookmarkByName( const rtl::OUString& rName ) throw (css::uno::RuntimeException);
- void addBookmarkByName( const rtl::OUString& rName, const css::uno::Reference< css::text::XTextRange >& rTextRange ) throw (css::uno::RuntimeException);
-- void renameAllBookmarksToLowercase() throw (css::uno::RuntimeException);
-
- public:
- SwVbaBookmarks( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::container::XIndexAccess >& xBookmarks, const css::uno::Reference< css::frame::XModel >& xModel );
-diff --git sw/source/ui/vba/vbaborders.cxx sw/source/ui/vba/vbaborders.cxx
-new file mode 100644
-index 0000000..44ed6eb
---- /dev/null
-+++ sw/source/ui/vba/vbaborders.cxx
-@@ -0,0 +1,381 @@
-+/*************************************************************************
-+ *
-+ * 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: vbaborders.cxx,v $
-+ * $Revision: 1.6 $
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbaborders.hxx"
-+#include <ooo/vba/word/XBorder.hpp>
-+#include <ooo/vba/word/WdBorderType.hpp>
-+#include <ooo/vba/word/WdLineStyle.hpp>
-+#include <cppuhelper/implbase3.hxx>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <com/sun/star/table/TableBorder.hpp>
-+#include <com/sun/star/table/ShadowFormat.hpp>
-+#include <com/sun/star/table/ShadowLocation.hpp>
-+#include "vbapalette.hxx"
-+
-+using namespace ::com::sun::star;
-+using namespace ::ooo::vba;
-+
-+
-+typedef ::cppu::WeakImplHelper1<container::XIndexAccess > RangeBorders_Base;
-+typedef InheritedHelperInterfaceImpl1<word::XBorder > SwVbaBorder_Base;
-+
-+// #TODO sort these indexes to match the order in which Word iterates over the
-+// borders, the enumeration will match the order in this list
-+static const sal_Int16 supportedIndexTable[] = { word::WdBorderType::wdBorderBottom, word::WdBorderType::wdBorderDiagonalDown, word::WdBorderType::wdBorderDiagonalUp, word::WdBorderType::wdBorderHorizontal, word::WdBorderType::wdBorderLeft, word::WdBorderType::wdBorderRight, word::WdBorderType::wdBorderTop, word::WdBorderType::wdBorderVertical };
-+
-+const static rtl::OUString sTableBorder( RTL_CONSTASCII_USTRINGPARAM("TableBorder") );
-+
-+// Equiv widths in in 1/100 mm
-+const static sal_Int32 OOLineThin = 35;
-+const static sal_Int32 OOLineMedium = 88;
-+const static sal_Int32 OOLineThick = 141;
-+const static sal_Int32 OOLineHairline = 2;
-+
-+class SwVbaBorder : public SwVbaBorder_Base
-+{
-+private:
-+ uno::Reference< beans::XPropertySet > m_xProps;
-+ sal_Int32 m_LineType;
-+ VbaPalette m_Palette;
-+ bool setBorderLine( table::BorderLine& rBorderLine )
-+ {
-+ table::TableBorder aTableBorder;
-+ m_xProps->getPropertyValue( sTableBorder ) >>= aTableBorder;
-+
-+ switch ( m_LineType )
-+ {
-+ case word::WdBorderType::wdBorderLeft:
-+ aTableBorder.IsLeftLineValid = sal_True;
-+ aTableBorder.LeftLine= rBorderLine;
-+ break;
-+ case word::WdBorderType::wdBorderTop:
-+ aTableBorder.IsTopLineValid = sal_True;
-+ aTableBorder.TopLine = rBorderLine;
-+ break;
-+
-+ case word::WdBorderType::wdBorderBottom:
-+ aTableBorder.IsBottomLineValid = sal_True;
-+ aTableBorder.BottomLine = rBorderLine;
-+ break;
-+ case word::WdBorderType::wdBorderRight:
-+ aTableBorder.IsRightLineValid = sal_True;
-+ aTableBorder.RightLine = rBorderLine;
-+ break;
-+ case word::WdBorderType::wdBorderVertical:
-+ aTableBorder.IsVerticalLineValid = sal_True;
-+ aTableBorder.VerticalLine = rBorderLine;
-+ break;
-+ case word::WdBorderType::wdBorderHorizontal:
-+ aTableBorder.IsHorizontalLineValid = sal_True;
-+ aTableBorder.HorizontalLine = rBorderLine;
-+ break;
-+ case word::WdBorderType::wdBorderDiagonalDown:
-+ case word::WdBorderType::wdBorderDiagonalUp:
-+ // #TODO have to ignore at the momement, would be
-+ // nice to investigate what we can do here
-+ break;
-+ default:
-+ return false;
-+ }
-+ m_xProps->setPropertyValue( sTableBorder, uno::makeAny(aTableBorder) );
-+ return true;
-+ }
-+
-+ bool getBorderLine( table::BorderLine& rBorderLine )
-+ {
-+ table::TableBorder aTableBorder;
-+ m_xProps->getPropertyValue( sTableBorder ) >>= aTableBorder;
-+ switch ( m_LineType )
-+ {
-+ case word::WdBorderType::wdBorderLeft:
-+ if ( aTableBorder.IsLeftLineValid )
-+ rBorderLine = aTableBorder.LeftLine;
-+ break;
-+ case word::WdBorderType::wdBorderTop:
-+ if ( aTableBorder.IsTopLineValid )
-+ rBorderLine = aTableBorder.TopLine;
-+ break;
-+ case word::WdBorderType::wdBorderBottom:
-+ if ( aTableBorder.IsBottomLineValid )
-+ rBorderLine = aTableBorder.BottomLine;
-+ break;
-+ case word::WdBorderType::wdBorderRight:
-+ if ( aTableBorder.IsRightLineValid )
-+ rBorderLine = aTableBorder.RightLine;
-+ break;
-+ case word::WdBorderType::wdBorderVertical:
-+ if ( aTableBorder.IsVerticalLineValid )
-+ rBorderLine = aTableBorder.VerticalLine;
-+ break;
-+ case word::WdBorderType::wdBorderHorizontal:
-+ if ( aTableBorder.IsHorizontalLineValid )
-+ rBorderLine = aTableBorder.HorizontalLine;
-+ break;
-+
-+ case word::WdBorderType::wdBorderDiagonalDown:
-+ case word::WdBorderType::wdBorderDiagonalUp:
-+ // #TODO have to ignore at the momement, would be
-+ // nice to investigate what we can do here
-+ break;
-+ default:
-+ return false;
-+ }
-+ return true;
-+ }
-+ SwVbaBorder(); // no impl
-+protected:
-+ virtual rtl::OUString& getServiceImplName()
-+ {
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaBorder") );
-+ return sImplName;
-+ }
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames()
-+ {
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Border" ) );
-+ }
-+ return aServiceNames;
-+ }
-+public:
-+ SwVbaBorder( const uno::Reference< beans::XPropertySet > & xProps, const uno::Reference< uno::XComponentContext >& xContext, sal_Int32 lineType, VbaPalette& rPalette) : SwVbaBorder_Base( uno::Reference< XHelperInterface >( xProps, uno::UNO_QUERY ), xContext ), m_xProps( xProps ), m_LineType( lineType ), m_Palette( rPalette ) {}
-+
-+ uno::Any SAL_CALL getLineStyle() throw (uno::RuntimeException)
-+ {
-+ sal_Int32 nLineStyle = word::WdLineStyle::wdLineStyleNone;
-+ table::BorderLine aBorderLine;
-+ if ( getBorderLine( aBorderLine ) )
-+ {
-+ if( aBorderLine.InnerLineWidth !=0 && aBorderLine.OuterLineWidth !=0 )
-+ {
-+ nLineStyle = word::WdLineStyle::wdLineStyleDouble;
-+ }
-+ else if( aBorderLine.InnerLineWidth !=0 || aBorderLine.OuterLineWidth !=0 )
-+ {
-+ nLineStyle = word::WdLineStyle::wdLineStyleSingle;
-+ }
-+ else
-+ {
-+ nLineStyle = word::WdLineStyle::wdLineStyleNone;
-+ }
-+ }
-+ return uno::makeAny( nLineStyle );
-+ }
-+ void SAL_CALL setLineStyle( const uno::Any& _linestyle ) throw (uno::RuntimeException)
-+ {
-+ // Urk no choice but to silently ignore we don't support this attribute
-+ // #TODO would be nice to support the word line styles
-+ sal_Int32 nLineStyle = 0;
-+ _linestyle >>= nLineStyle;
-+ table::BorderLine aBorderLine;
-+ if ( getBorderLine( aBorderLine ) )
-+ {
-+ switch ( nLineStyle )
-+ {
-+ case word::WdLineStyle::wdLineStyleNone:
-+ {
-+ aBorderLine.InnerLineWidth = 0;
-+ aBorderLine.OuterLineWidth = 0;
-+ break;
-+ }
-+ case word::WdLineStyle::wdLineStyleDashDot:
-+ case word::WdLineStyle::wdLineStyleDashDotDot:
-+ case word::WdLineStyle::wdLineStyleDashDotStroked:
-+ case word::WdLineStyle::wdLineStyleDashLargeGap:
-+ case word::WdLineStyle::wdLineStyleDashSmallGap:
-+ case word::WdLineStyle::wdLineStyleDot:
-+ case word::WdLineStyle::wdLineStyleDouble:
-+ case word::WdLineStyle::wdLineStyleDoubleWavy:
-+ case word::WdLineStyle::wdLineStyleEmboss3D:
-+ case word::WdLineStyle::wdLineStyleEngrave3D:
-+ case word::WdLineStyle::wdLineStyleInset:
-+ case word::WdLineStyle::wdLineStyleOutset:
-+ case word::WdLineStyle::wdLineStyleSingle:
-+ case word::WdLineStyle::wdLineStyleSingleWavy:
-+ case word::WdLineStyle::wdLineStyleThickThinLargeGap:
-+ case word::WdLineStyle::wdLineStyleThickThinMedGap:
-+ case word::WdLineStyle::wdLineStyleThickThinSmallGap:
-+ case word::WdLineStyle::wdLineStyleThinThickLargeGap:
-+ case word::WdLineStyle::wdLineStyleThinThickMedGap:
-+ case word::WdLineStyle::wdLineStyleThinThickSmallGap:
-+ case word::WdLineStyle::wdLineStyleThinThickThinLargeGap:
-+ case word::WdLineStyle::wdLineStyleThinThickThinMedGap:
-+ case word::WdLineStyle::wdLineStyleThinThickThinSmallGap:
-+ case word::WdLineStyle::wdLineStyleTriple:
-+ {
-+ aBorderLine.InnerLineWidth = 0;
-+ aBorderLine.OuterLineWidth = OOLineHairline;
-+ break;
-+ }
-+ default:
-+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Bad param" ) ), uno::Reference< uno::XInterface >() );
-+ }
-+ setBorderLine( aBorderLine );
-+ }
-+ else
-+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Method failed" ) ), uno::Reference< uno::XInterface >() );
-+ }
-+};
-+
-+class RangeBorders : public RangeBorders_Base
-+{
-+private:
-+ uno::Reference< table::XCellRange > m_xRange;
-+ uno::Reference< uno::XComponentContext > m_xContext;
-+ VbaPalette m_Palette;
-+ sal_Int32 getTableIndex( sal_Int32 nConst )
-+ {
-+ // hokay return position of the index in the table
-+ sal_Int32 nIndexes = getCount();
-+ sal_Int32 realIndex = 0;
-+ const sal_Int16* pTableEntry = supportedIndexTable;
-+ for ( ; realIndex < nIndexes; ++realIndex, ++pTableEntry )
-+ {
-+ if ( *pTableEntry == nConst )
-+ return realIndex;
-+ }
-+ return getCount(); // error condition
-+ }
-+public:
-+ RangeBorders( const uno::Reference< table::XCellRange >& xRange, const uno::Reference< uno::XComponentContext > & xContext, VbaPalette& rPalette ) : m_xRange( xRange ), m_xContext( xContext ), m_Palette( rPalette )
-+ {
-+ }
-+ // XIndexAccess
-+ virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
-+ {
-+ return sizeof( supportedIndexTable ) / sizeof( supportedIndexTable[0] );
-+ }
-+ virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+
-+ sal_Int32 nIndex = getTableIndex( Index );
-+ if ( nIndex >= 0 && nIndex < getCount() )
-+ {
-+ uno::Reference< beans::XPropertySet > xProps( m_xRange, uno::UNO_QUERY_THROW );
-+ return uno::makeAny( uno::Reference< word::XBorder >( new SwVbaBorder( xProps, m_xContext, supportedIndexTable[ nIndex ], m_Palette )) );
-+ }
-+ throw lang::IndexOutOfBoundsException();
-+ }
-+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
-+ {
-+ return word::XBorder::static_type(0);
-+ }
-+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
-+ {
-+ return sal_True;
-+ }
-+};
-+
-+uno::Reference< container::XIndexAccess >
-+rangeToBorderIndexAccess( const uno::Reference< table::XCellRange >& xRange, const uno::Reference< uno::XComponentContext > & xContext, VbaPalette& rPalette )
-+{
-+ return new RangeBorders( xRange, xContext, rPalette );
-+}
-+
-+class RangeBorderEnumWrapper : public EnumerationHelper_BASE
-+{
-+ uno::Reference<container::XIndexAccess > m_xIndexAccess;
-+ sal_Int32 nIndex;
-+public:
-+ RangeBorderEnumWrapper( const uno::Reference< container::XIndexAccess >& xIndexAccess ) : 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)
-+ {
-+ if ( nIndex < m_xIndexAccess->getCount() )
-+ return m_xIndexAccess->getByIndex( nIndex++ );
-+ throw container::NoSuchElementException();
-+ }
-+};
-+
-+// for Table borders
-+SwVbaBorders::SwVbaBorders( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< table::XCellRange >& xRange, VbaPalette& rPalette ): SwVbaBorders_BASE( xParent, xContext, rangeToBorderIndexAccess( xRange ,xContext, rPalette ) )
-+{
-+ m_xProps.set( xRange, uno::UNO_QUERY_THROW );
-+}
-+
-+uno::Reference< container::XEnumeration >
-+SwVbaBorders::createEnumeration() throw (uno::RuntimeException)
-+{
-+ return new RangeBorderEnumWrapper( m_xIndexAccess );
-+}
-+
-+uno::Any
-+SwVbaBorders::createCollectionObject( const css::uno::Any& aSource )
-+{
-+ return aSource; // its already a Border object
-+}
-+
-+uno::Type
-+SwVbaBorders::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XBorders::static_type(0);
-+}
-+
-+uno::Any
-+SwVbaBorders::getItemByIntIndex( const sal_Int32 nIndex ) throw (uno::RuntimeException)
-+{
-+ return createCollectionObject( m_xIndexAccess->getByIndex( nIndex ) );
-+}
-+
-+sal_Bool SAL_CALL SwVbaBorders::getShadow() throw (uno::RuntimeException)
-+{
-+ table::ShadowFormat aShadowFormat;
-+ m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ShadowFormat") ) ) >>= aShadowFormat;
-+ return ( aShadowFormat.Location != table::ShadowLocation_NONE );
-+}
-+
-+void SAL_CALL SwVbaBorders::setShadow( sal_Bool _shadow ) throw (uno::RuntimeException)
-+{
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+}
-+
-+rtl::OUString&
-+SwVbaBorders::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaBorders") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaBorders::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Borders" ) );
-+ }
-+ return aServiceNames;
-+}
-diff --git sw/source/ui/vba/vbaborders.hxx sw/source/ui/vba/vbaborders.hxx
-new file mode 100644
-index 0000000..b0cf517
---- /dev/null
-+++ sw/source/ui/vba/vbaborders.hxx
-@@ -0,0 +1,66 @@
-+/*************************************************************************
-+ *
-+ * 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: vbaborders.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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_BORDERS_HXX
-+#define SW_VBA_BORDERS_HXX
-+
-+#include <cppuhelper/implbase1.hxx>
-+#include <ooo/vba/word/XBorders.hpp>
-+#include <com/sun/star/uno/XComponentContext.hpp>
-+#include <com/sun/star/table/XCellRange.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <vbahelper/vbacollectionimpl.hxx>
-+
-+typedef CollTestImplHelper< ov::word::XBorders > SwVbaBorders_BASE;
-+class VbaPalette;
-+class SwVbaBorders : public SwVbaBorders_BASE
-+{
-+ // XEnumerationAccess
-+ virtual css::uno::Any getItemByIntIndex( const sal_Int32 nIndex ) throw (css::uno::RuntimeException);
-+ css::uno::Reference< css::beans::XPropertySet > m_xProps;
-+public:
-+ SwVbaBorders( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::table::XCellRange >& xRange, VbaPalette& rPalette );
-+ virtual ~SwVbaBorders() {}
-+
-+ // 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);
-+
-+ // SwVbaCollectionBaseImpl
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+
-+ virtual sal_Bool SAL_CALL getShadow() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setShadow( sal_Bool _shadow ) throw (css::uno::RuntimeException);
-+
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif //SW_VBA_BORDERS_HXX
-+
-diff --git sw/source/ui/vba/vbadialog.cxx sw/source/ui/vba/vbadialog.cxx
-new file mode 100644
-index 0000000..df35a1a
---- /dev/null
-+++ sw/source/ui/vba/vbadialog.cxx
-@@ -0,0 +1,81 @@
-+/*************************************************************************
-+ *
-+ * 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: vbadialog.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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbadialog.hxx"
-+#include <ooo/vba/word/WdWordDialog.hpp>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+struct WordDialogTable
-+{
-+ sal_Int32 wdDialog;
-+ const sal_Char* ooDialog;
-+};
-+
-+static const WordDialogTable aWordDialogTable[] =
-+{
-+ { word::WdWordDialog::wdDialogFileNew, ".uno:NewDoc" },
-+ { word::WdWordDialog::wdDialogFileOpen, ".uno:Open" },
-+ { word::WdWordDialog::wdDialogFilePrint, ".uno:Print" },
-+ { word::WdWordDialog::wdDialogFileSaveAs, ".uno:SaveAs" },
-+ { 0, 0 }
-+};
-+
-+rtl::OUString
-+SwVbaDialog::mapIndexToName( sal_Int32 nIndex )
-+{
-+ for( const WordDialogTable* pTable = aWordDialogTable; pTable->wdDialog != NULL; pTable++ )
-+ {
-+ if( nIndex == pTable->wdDialog )
-+ {
-+ return rtl::OUString::createFromAscii( pTable->ooDialog );
-+ }
-+ }
-+ return rtl::OUString();
-+}
-+
-+rtl::OUString&
-+SwVbaDialog::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaDialog") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaDialog::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Dialog" ) );
-+ }
-+ return aServiceNames;
-+}
-diff --git sw/source/ui/vba/vbadialog.hxx sw/source/ui/vba/vbadialog.hxx
-new file mode 100644
-index 0000000..9090f15
---- /dev/null
-+++ sw/source/ui/vba/vbadialog.hxx
-@@ -0,0 +1,53 @@
-+/*************************************************************************
-+ *
-+ * 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: vbadialog.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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_DIALOG_HXX
-+#define SW_VBA_DIALOG_HXX
-+
-+#include <cppuhelper/implbase1.hxx>
-+#include <ooo/vba/word/XDialog.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <vbahelper/vbadialogbase.hxx>
-+
-+typedef cppu::ImplInheritanceHelper1< VbaDialogBase, ov::word::XDialog > SwVbaDialog_BASE;
-+
-+class SwVbaDialog : public SwVbaDialog_BASE
-+{
-+public:
-+ SwVbaDialog( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, sal_Int32 nIndex ):SwVbaDialog_BASE( xParent, xContext, nIndex ) {}
-+ virtual ~SwVbaDialog() {}
-+
-+ // Methods
-+ virtual rtl::OUString mapIndexToName( sal_Int32 nIndex );
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* SW_VBA_DIALOG_HXX */
-diff --git sw/source/ui/vba/vbadialogs.cxx sw/source/ui/vba/vbadialogs.cxx
-new file mode 100644
-index 0000000..26dd7f1
---- /dev/null
-+++ sw/source/ui/vba/vbadialogs.cxx
-@@ -0,0 +1,64 @@
-+/*************************************************************************
-+ *
-+ * 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: vbadialogs.cxx,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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include <ooo/vba/word/XDialog.hpp>
-+#include "vbadialogs.hxx"
-+#include "vbadialog.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+uno::Any
-+SwVbaDialogs::Item( const uno::Any &aItem ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nIndex = 0;
-+ aItem >>= nIndex;
-+ uno::Reference< word::XDialog > aDialog( new SwVbaDialog( uno::Reference< XHelperInterface >( Application(),uno::UNO_QUERY_THROW ), mxContext, nIndex ) );
-+ return uno::Any( aDialog );
-+}
-+
-+rtl::OUString&
-+SwVbaDialogs::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaDialogs") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaDialogs::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Dialogs" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbadialogs.hxx sw/source/ui/vba/vbadialogs.hxx
-new file mode 100644
-index 0000000..ef36067
---- /dev/null
-+++ sw/source/ui/vba/vbadialogs.hxx
-@@ -0,0 +1,56 @@
-+/*************************************************************************
-+ *
-+ * 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: vbadialogs.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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_DIALOGS_HXX
-+#define SW_VBA_DIALOGS_HXX
-+
-+#include <com/sun/star/uno/XComponentContext.hpp>
-+#include <ooo/vba/word/XDialogs.hpp>
-+#include <ooo/vba/XCollection.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <vbahelper/vbadialogsbase.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+
-+typedef cppu::ImplInheritanceHelper1< VbaDialogsBase, ov::word::XDialogs > SwVbaDialogs_BASE;
-+
-+class SwVbaDialogs : public SwVbaDialogs_BASE
-+{
-+public:
-+ SwVbaDialogs( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext ): SwVbaDialogs_BASE( xParent, xContext ) {}
-+ virtual ~SwVbaDialogs() {}
-+
-+ // XCollection
-+ virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index ) throw (css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* SW_VBA_DIALOGS_HXX */
-diff --git sw/source/ui/vba/vbadocument.cxx sw/source/ui/vba/vbadocument.cxx
-index bb03373..906a617 100644
---- sw/source/ui/vba/vbadocument.cxx
-+++ sw/source/ui/vba/vbadocument.cxx
-@@ -37,10 +37,23 @@
- #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
- #include <com/sun/star/document/XDocumentInfoSupplier.hpp>
- #include <com/sun/star/document/XDocumentProperties.hpp>
-+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
-+#include <com/sun/star/drawing/XControlShape.hpp>
-+#include <com/sun/star/drawing/XControlShape.hpp>
-+#include <com/sun/star/form/XFormsSupplier.hpp>
-+#include <ooo/vba/XControlProvider.hpp>
-+
- #include <vbahelper/helperdecl.hxx>
- #include <wordvbahelper.hxx>
- #include <docsh.hxx>
- #include "vbatemplate.hxx"
-+#include "vbaparagraph.hxx"
-+#include "vbastyles.hxx"
-+#include "vbatables.hxx"
-+#include "vbafield.hxx"
-+#include "vbapagesetup.hxx"
-+#include "vbasections.hxx"
-+#include <vbahelper/vbashapes.hxx>
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-@@ -159,6 +172,61 @@ SwVbaDocument::Variables( const uno::Any& rIndex ) throw ( uno::RuntimeException
- return uno::Any( xVariables->Item( rIndex, uno::Any() ) );
- }
-
-+uno::Any SAL_CALL
-+SwVbaDocument::Paragraphs( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< XCollection > xCol( new SwVbaParagraphs( mxParent, mxContext, mxTextDocument ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaDocument::Styles( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< XCollection > xCol( new SwVbaStyles( mxParent, mxContext, getModel() ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaDocument::Fields( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< XCollection > xCol( new SwVbaFields( mxParent, mxContext, getModel() ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaDocument::Shapes( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( getModel(), uno::UNO_QUERY_THROW );
-+ //uno::Reference< drawing::XShapes > xShapes( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xIndexAccess( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
-+ uno::Reference< XCollection > xCol( new ScVbaShapes( this, mxContext, xIndexAccess ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaDocument::Sections( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< XCollection > xCol( new SwVbaSections( mxParent, mxContext, getModel() ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaDocument::PageSetup( ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< beans::XPropertySet > xPageProps( word::getCurrentPageStyle( mxModel ), uno::UNO_QUERY_THROW );
-+ return uno::makeAny( uno::Reference< word::XPageSetup >( new SwVbaPageSetup( this, mxContext, mxModel, xPageProps ) ) );
-+}
-+
- rtl::OUString&
- SwVbaDocument::getServiceImplName()
- {
-@@ -185,6 +253,112 @@ SwVbaDocument::setAttachedTemplate( const css::uno::Any& _attachedtemplate ) thr
- throw uno::RuntimeException();
- }
-
-+uno::Any SAL_CALL
-+SwVbaDocument::Tables( const css::uno::Any& aIndex ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW );
-+ uno::Reference< XCollection > xColl( new SwVbaTables( mxParent, mxContext, xModel ) );
-+
-+ if ( aIndex.hasValue() )
-+ return xColl->Item( aIndex, uno::Any() );
-+ return uno::makeAny( xColl );
-+}
-+
-+void SAL_CALL SwVbaDocument::Activate() throw (uno::RuntimeException)
-+{
-+ VbaDocumentBase::Activate();
-+}
-+
-+uno::Any
-+SwVbaDocument::getControlShape( const ::rtl::OUString& sName )
-+{
-+ uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxTextDocument, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xIndexAccess( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
-+
-+ sal_Int32 nCount = xIndexAccess->getCount();
-+ for( int index = 0; index < nCount; index++ )
-+ {
-+ uno::Any aUnoObj = xIndexAccess->getByIndex( index );
-+ // It seems there are some drawing objects that can not query into Control shapes?
-+ uno::Reference< drawing::XControlShape > xControlShape( aUnoObj, uno::UNO_QUERY );
-+ if( xControlShape.is() )
-+ {
-+ uno::Reference< container::XNamed > xNamed( xControlShape->getControl(), uno::UNO_QUERY_THROW );
-+ if( sName.equals( xNamed->getName() ))
-+ {
-+ return aUnoObj;
-+ }
-+ }
-+ }
-+ return uno::Any();
-+}
-+
-+uno::Reference< beans::XIntrospectionAccess > SAL_CALL
-+SwVbaDocument::getIntrospection( ) throw (uno::RuntimeException)
-+{
-+ return uno::Reference< beans::XIntrospectionAccess >();
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaDocument::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)
-+{
-+ OSL_TRACE("** SwVbaDocument::invoke( %s ), will barf",
-+ rtl::OUStringToOString( aFunctionName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+
-+ throw uno::RuntimeException(); // unsupported operation
-+}
-+
-+void SAL_CALL
-+SwVbaDocument::setValue( const ::rtl::OUString& /*aPropertyName*/, const uno::Any& /*aValue*/ ) throw (beans::UnknownPropertyException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException)
-+{
-+ throw uno::RuntimeException(); // unsupported operation
-+}
-+uno::Any SAL_CALL
-+SwVbaDocument::getValue( const ::rtl::OUString& aPropertyName ) throw (beans::UnknownPropertyException, uno::RuntimeException)
-+{
-+ uno::Reference< drawing::XControlShape > xControlShape( getControlShape( aPropertyName ), uno::UNO_QUERY_THROW );
-+
-+ uno::Reference<lang::XMultiComponentFactory > 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 );
-+}
-+
-+::sal_Bool SAL_CALL
-+SwVbaDocument::hasMethod( const ::rtl::OUString& /*aName*/ ) throw (uno::RuntimeException)
-+{
-+ return sal_False;
-+}
-+
-+::sal_Bool SAL_CALL
-+SwVbaDocument::hasProperty( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< container::XNameAccess > xFormControls( getFormControls() );
-+ if ( xFormControls.is() )
-+ return xFormControls->hasByName( aName );
-+ return sal_False;
-+}
-+
-+uno::Reference< container::XNameAccess >
-+SwVbaDocument::getFormControls()
-+{
-+ uno::Reference< container::XNameAccess > xFormControls;
-+ try
-+ {
-+ uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxTextDocument, uno::UNO_QUERY_THROW );
-+ uno::Reference< form::XFormsSupplier > xFormSupplier( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xIndexAccess( xFormSupplier->getForms(), uno::UNO_QUERY_THROW );
-+ // get the www-standard container ( maybe we should access the
-+ // 'www-standard' by name rather than index, this seems an
-+ // implementation detail
-+ xFormControls.set( xIndexAccess->getByIndex(0), uno::UNO_QUERY_THROW );
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+ return xFormControls;
-+}
-+
- uno::Sequence< rtl::OUString >
- SwVbaDocument::getServiceNames()
- {
-diff --git sw/source/ui/vba/vbadocument.hxx sw/source/ui/vba/vbadocument.hxx
-index a82503b..651b06c 100644
---- sw/source/ui/vba/vbadocument.hxx
-+++ sw/source/ui/vba/vbadocument.hxx
-@@ -43,6 +43,9 @@ private:
- css::uno::Reference< css::text::XTextDocument > mxTextDocument;
-
- void Initialize();
-+ css::uno::Any getControlShape( const rtl::OUString& sName );
-+ css::uno::Reference< css::container::XNameAccess > getFormControls();
-+
- public:
- SwVbaDocument( const css::uno::Reference< ooo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& m_xContext, css::uno::Reference< css::frame::XModel > xModel );
- SwVbaDocument( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext );
-@@ -57,7 +60,21 @@ public:
- virtual css::uno::Any SAL_CALL Variables( const css::uno::Any& rIndex ) throw ( css::uno::RuntimeException );
- virtual css::uno::Any SAL_CALL getAttachedTemplate() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setAttachedTemplate( const css::uno::Any& _attachedtemplate ) throw (css::uno::RuntimeException);
--
-+ virtual css::uno::Any SAL_CALL Paragraphs( const css::uno::Any& rIndex ) throw ( css::uno::RuntimeException );
-+ virtual css::uno::Any SAL_CALL Styles( const css::uno::Any& rIndex ) throw ( css::uno::RuntimeException );
-+ virtual css::uno::Any SAL_CALL Tables( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Fields( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Shapes( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Sections( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL Activate() throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL PageSetup() throw (css::uno::RuntimeException);
-+ // XInvocation
-+ 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);
-
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
-diff --git sw/source/ui/vba/vbadocumentproperties.cxx sw/source/ui/vba/vbadocumentproperties.cxx
-index 74470f9..f07b978 100644
---- sw/source/ui/vba/vbadocumentproperties.cxx
-+++ sw/source/ui/vba/vbadocumentproperties.cxx
-@@ -250,38 +250,7 @@ public:
- {
- boost::shared_ptr< PropertGetSetHelper > aStandardHelper( new BuiltinPropertyGetSetHelper( xModel ) );
- boost::shared_ptr< PropertGetSetHelper > aUsingStatsHelper( new StatisticPropertyGetSetHelper( xModel ) );
--/*
-- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTitle ] = DocPropInfo::createDocPropInfo( "Title", "Title", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper );
-- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertySubject ] = DocPropInfo::createDocPropInfo( "Subject", "Subject", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper );
-- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyAuthor ] = DocPropInfo::createDocPropInfo( "Author", "Author", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper );
-- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyKeywords ] = DocPropInfo::createDocPropInfo( "Keywords", "Keywords", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper );
-- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyComments ] = DocPropInfo::createDocPropInfo( "Comments", "Description", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper );
-- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTemplate ] = DocPropInfo::createDocPropInfo( "Template", "Template", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper );
-- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyLastAuthor ] = DocPropInfo::createDocPropInfo( "Last author", "", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper ); // doesn't seem to exist - throw or return nothing ?
-- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyRevision ] = DocPropInfo::createDocPropInfo( "Revision number", "", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper ); // doesn't seem to exist - throw or return nothing ?
-- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyAppName ] = DocPropInfo::createDocPropInfo( "Application name", "Generator", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper ); // doesn't seem to exist - throw or return nothing ?
-- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTimeLastPrinted ] = DocPropInfo::createDocPropInfo( "Last print date", "PrintDate", office::MsoDocProperties::msoPropertyTypeDate, aStandardHelper ); // doesn't seem to exist - throw or return nothing ?
-- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTimeCreated ] = DocPropInfo::createDocPropInfo( "Creation date", "CreationDate", office::MsoDocProperties::msoPropertyTypeDate, aStandardHelper ); // doesn't seem to exist - throw or return nothing ?
-- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTimeLastSaved ] = DocPropInfo::createDocPropInfo( "Last save time", "ModifyDate", office::MsoDocProperties::msoPropertyTypeDate, aStandardHelper ); // doesn't seem to exist - throw or return nothing ?
-- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyVBATotalEdit ] = DocPropInfo::createDocPropInfo( "Total editing time", "EditingDuration", office::MsoDocProperties::msoPropertyTypeNumber, aStandardHelper ); // Not sure if this is correct
-- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyPages ] = DocPropInfo::createDocPropInfo( "Number of pages", "PageCount", office::MsoDocProperties::msoPropertyTypeNumber, aUsingStatsHelper ); // special handling required
-- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyWords ] = DocPropInfo::createDocPropInfo( "Number of words", "WordCount", office::MsoDocProperties::msoPropertyTypeNumber, aUsingStatsHelper ); // special handling required
-- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyCharacters ] = DocPropInfo::createDocPropInfo( "Number of characters", "CharacterCount", office::MsoDocProperties::msoPropertyTypeNumber, aUsingStatsHelper ); // special handling required
-- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertySecurity ] = DocPropInfo::createDocPropInfo( "Security", "", office::MsoDocProperties::msoPropertyTypeNumber, aStandardHelper ); // doesn't seem to exist
-- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyCategory ] = DocPropInfo::createDocPropInfo( "Category", "", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper ); // doesn't seem to exist
-- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyFormat ] = DocPropInfo::createDocPropInfo( "Format", "", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper ); // doesn't seem to exist
-- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyManager ] = DocPropInfo::createDocPropInfo( "Manager", "", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper ); // doesn't seem to exist
-- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyCompany ] = DocPropInfo::createDocPropInfo( "Company", "", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper ); // doesn't seem to exist
-- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyBytes ] = DocPropInfo::createDocPropInfo( "Number of bytes", "", office::MsoDocProperties::msoPropertyTypeNumber, aStandardHelper ); // doesn't seem to exist - size on disk exists ( for an already saved document ) perhaps it will do ( or we need something else )
-- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyLines ] = DocPropInfo::createDocPropInfo( "Number of lines", "LineCount", office::MsoDocProperties::msoPropertyTypeNumber, aUsingStatsHelper ); // special handling
-- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyParas ] = DocPropInfo::createDocPropInfo( "Number of paragraphs", "", office::MsoDocProperties::msoPropertyTypeNumber, aUsingStatsHelper ); // special handling
-- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertySlides ] = DocPropInfo::createDocPropInfo( "Number of slides", "" , office::MsoDocProperties::msoPropertyTypeNumber, aStandardHelper ); // doesn't seem to exist
-- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyNotes ] = DocPropInfo::createDocPropInfo( "Number of notes", "", office::MsoDocProperties::msoPropertyTypeNumber, aStandardHelper ); // doesn't seem to exist
-- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyHiddenSlides ] = DocPropInfo::createDocPropInfo("Number of hidden Slides", "", office::MsoDocProperties::msoPropertyTypeNumber, aStandardHelper ); // doesn't seem to exist
-- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyMMClips ] = DocPropInfo::createDocPropInfo( "Number of multimedia clips", "", office::MsoDocProperties::msoPropertyTypeNumber, aStandardHelper ); // doesn't seem to exist
-- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyHyperlinkBase ] = DocPropInfo::createDocPropInfo( "Hyperlink base", "AutoloadURL", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper );
-- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyCharsWSpaces ] = DocPropInfo::createDocPropInfo( "Number of characters (with spaces)", "", office::MsoDocProperties::msoPropertyTypeNumber, aStandardHelper ); // doesn't seem to be supported
--*/
-+
- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTitle ] = DocPropInfo::createDocPropInfo( "Title", "Title", aStandardHelper );
- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertySubject ] = DocPropInfo::createDocPropInfo( "Subject", "Subject", aStandardHelper );
- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyAuthor ] = DocPropInfo::createDocPropInfo( "Author", "Author", aStandardHelper );
-@@ -393,7 +362,7 @@ SwVbaCustomDocumentProperty::setLinkSource( const rtl::OUString& /*rsLinkContent
- }
-
- void SAL_CALL
--SwVbaCustomDocumentProperty::setName( const ::rtl::OUString& Name ) throw (script::BasicErrorException, uno::RuntimeException)
-+SwVbaCustomDocumentProperty::setName( const ::rtl::OUString& /*Name*/ ) throw (script::BasicErrorException, uno::RuntimeException)
- {
- // setName on existing property ?
- // #FIXME
-@@ -401,7 +370,7 @@ SwVbaCustomDocumentProperty::setName( const ::rtl::OUString& Name ) throw (scrip
- }
-
- void SAL_CALL
--SwVbaCustomDocumentProperty::setType( ::sal_Int8 Type ) throw (script::BasicErrorException, uno::RuntimeException)
-+SwVbaCustomDocumentProperty::setType( ::sal_Int8 /*Type*/ ) throw (script::BasicErrorException, uno::RuntimeException)
- {
- // setType, do we need to do a conversion?
- // #FIXME the underlying value needs to be changed to the new type
-@@ -620,7 +589,7 @@ SwVbaBuiltinDocumentProperties::SwVbaBuiltinDocumentProperties( const uno::Refer
- }
-
- uno::Reference< XDocumentProperty > SAL_CALL
--SwVbaBuiltinDocumentProperties::Add( const ::rtl::OUString& /*Name*/, ::sal_Bool /*LinkToContent*/, ::sal_Int8 /*Type*/, const uno::Any& value, const uno::Any& /*LinkSource*/ ) throw (script::BasicErrorException, uno::RuntimeException)
-+SwVbaBuiltinDocumentProperties::Add( const ::rtl::OUString& /*Name*/, ::sal_Bool /*LinkToContent*/, ::sal_Int8 /*Type*/, const uno::Any& /*value*/, const uno::Any& /*LinkSource*/ ) throw (script::BasicErrorException, uno::RuntimeException)
- {
- throw uno::RuntimeException(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("not supported for Builtin properties") ), uno::Reference< uno::XInterface >() );
-@@ -752,7 +721,7 @@ public:
- return new DocPropEnumeration( simpleDocPropSnapShot );
- }
-
-- void addProp( const ::rtl::OUString& Name, ::sal_Int8 Type, const uno::Any& Value )
-+ void addProp( const ::rtl::OUString& Name, ::sal_Int8 /*Type*/, const uno::Any& Value )
- {
- sal_Int16 attributes = 128;
- uno::Reference< beans::XPropertyContainer > xContainer( mxUserDefinedProp, uno::UNO_QUERY_THROW );
-diff --git sw/source/ui/vba/vbadocuments.cxx sw/source/ui/vba/vbadocuments.cxx
-new file mode 100644
-index 0000000..c8934b4
---- /dev/null
-+++ sw/source/ui/vba/vbadocuments.cxx
-@@ -0,0 +1,181 @@
-+/*************************************************************************
-+ *
-+ * 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: vbadocuments.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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include <comphelper/processfactory.hxx>
-+
-+#include <cppuhelper/implbase1.hxx>
-+#include <cppuhelper/implbase3.hxx>
-+
-+#include <com/sun/star/frame/XDesktop.hpp>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include <com/sun/star/container/XEnumerationAccess.hpp>
-+#include <com/sun/star/frame/XComponentLoader.hpp>
-+#include <com/sun/star/lang/XComponent.hpp>
-+#include <com/sun/star/frame/XModel.hpp>
-+#include <com/sun/star/frame/XFrame.hpp>
-+#include <com/sun/star/frame/FrameSearchFlag.hpp>
-+#include <com/sun/star/util/XModifiable.hpp>
-+#include <com/sun/star/frame/XStorable.hpp>
-+#include <com/sun/star/lang/DisposedException.hpp>
-+#include <com/sun/star/beans/PropertyVetoException.hpp>
-+#include <com/sun/star/util/XCloseable.hpp>
-+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
-+#include <com/sun/star/document/XTypeDetection.hpp>
-+#include <com/sun/star/uri/XUriReference.hpp>
-+#include <com/sun/star/uri/XUriReferenceFactory.hpp>
-+
-+#include <sfx2/objsh.hxx>
-+#include <tools/urlobj.hxx>
-+
-+#include "vbaglobals.hxx"
-+#include "vbadocument.hxx"
-+#include "vbadocuments.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+
-+#include <hash_map>
-+#include <osl/file.hxx>
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+static uno::Any
-+getDocument( uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< text::XTextDocument > &xDoc, const uno::Any& aApplication )
-+{
-+ // FIXME: fine as long as SwVbaDocument is stateless ...
-+ uno::Reference< frame::XModel > xModel( xDoc, uno::UNO_QUERY );
-+ if( !xModel.is() )
-+ return uno::Any();
-+
-+ SwVbaDocument *pWb = new SwVbaDocument( uno::Reference< XHelperInterface >( aApplication, uno::UNO_QUERY_THROW ), xContext, xModel );
-+ return uno::Any( uno::Reference< word::XDocument > (pWb) );
-+}
-+
-+class DocumentEnumImpl : public EnumerationHelperImpl
-+{
-+ uno::Any m_aApplication;
-+public:
-+ DocumentEnumImpl( 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< text::XTextDocument > xDoc( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
-+ return getDocument( m_xContext, xDoc, m_aApplication );
-+ }
-+};
-+
-+SwVbaDocuments::SwVbaDocuments( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext ) : SwVbaDocuments_BASE( xParent, xContext, VbaDocumentsBase::WORD_DOCUMENT )
-+{
-+}
-+// XEnumerationAccess
-+uno::Type
-+SwVbaDocuments::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XDocument::static_type(0);
-+}
-+uno::Reference< container::XEnumeration >
-+SwVbaDocuments::createEnumeration() throw (uno::RuntimeException)
-+{
-+ // #FIXME its possible the DocumentEnumImpl here doens't reflect
-+ // 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
-+ uno::Reference< container::XEnumerationAccess > xEnumerationAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
-+ return new DocumentEnumImpl( mxContext, xEnumerationAccess->createEnumeration(), Application() );
-+}
-+
-+uno::Any
-+SwVbaDocuments::createCollectionObject( const uno::Any& aSource )
-+{
-+ uno::Reference< text::XTextDocument > xDoc( aSource, uno::UNO_QUERY_THROW );
-+ return getDocument( mxContext, xDoc, Application() );
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaDocuments::Add( const uno::Any& Template, const uno::Any& NewTemplate, const uno::Any& DocumentType, const uno::Any& Visible ) throw (uno::RuntimeException)
-+{
-+ rtl::OUString sFileName;
-+ if( Template.hasValue() && ( Template >>= sFileName ) )
-+ {
-+ return Open( sFileName, uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any());
-+ }
-+ uno::Reference <text::XTextDocument> xTextDoc( VbaDocumentsBase::Add() , uno::UNO_QUERY_THROW );
-+
-+ if( xTextDoc.is() )
-+ return getDocument( mxContext, xTextDoc, Application() );
-+ return uno::Any();
-+}
-+
-+// #TODO# #FIXME# can any of the unused params below be used?
-+void SAL_CALL
-+SwVbaDocuments::Close( const uno::Any& SaveChanges, const uno::Any& OriginalFormat, const uno::Any& RouteDocument ) throw (uno::RuntimeException)
-+{
-+ VbaDocumentsBase::Close();
-+}
-+
-+// #TODO# #FIXME# can any of the unused params below be used?
-+uno::Any SAL_CALL
-+SwVbaDocuments::Open( const ::rtl::OUString& Filename, const uno::Any& ConfirmConversions, const uno::Any& ReadOnly, const uno::Any& AddToRecentFiles, const uno::Any& PasswordDocument, const uno::Any& PasswordTemplate, const uno::Any& Revert, const uno::Any& WritePasswordDocument, const uno::Any& WritePasswordTemplate, const uno::Any& Format, const uno::Any& Encoding, const uno::Any& Visible, const uno::Any& OpenAndRepair, const uno::Any& DocumentDirection, const uno::Any& NoEncodingDialog, const uno::Any& XMLTransform ) 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;
-+ aObj.SetURL( Filename );
-+ bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
-+ if ( bIsURL )
-+ aURL = Filename;
-+ else
-+ osl::FileBase::getFileURLFromSystemPath( Filename, aURL );
-+
-+ uno::Sequence< beans::PropertyValue > sProps(0);
-+
-+ uno::Reference <text::XTextDocument> xSpreadDoc( VbaDocumentsBase::Open( Filename, ReadOnly, sProps ), uno::UNO_QUERY_THROW );
-+ uno::Any aRet = getDocument( mxContext, xSpreadDoc, Application() );
-+ uno::Reference< word::XDocument > xDocument( aRet, uno::UNO_QUERY );
-+ if ( xDocument.is() )
-+ xDocument->Activate();
-+ return aRet;
-+}
-+
-+rtl::OUString&
-+SwVbaDocuments::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaDocuments") );
-+ return sImplName;
-+}
-+
-+uno::Sequence<rtl::OUString>
-+SwVbaDocuments::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Documents") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbadocuments.hxx sw/source/ui/vba/vbadocuments.hxx
-new file mode 100644
-index 0000000..e27a3c6
---- /dev/null
-+++ sw/source/ui/vba/vbadocuments.hxx
-@@ -0,0 +1,65 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_DOCUMENTS_HXX
-+#define SW_VBA_DOCUMENTS_HXX
-+
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XDocuments.hpp>
-+#include <com/sun/star/container/XEnumerationAccess.hpp>
-+#include <vbahelper/vbadocumentsbase.hxx>
-+#include "wordvbahelper.hxx"
-+
-+
-+typedef cppu::ImplInheritanceHelper1< VbaDocumentsBase, ov::word::XDocuments > SwVbaDocuments_BASE;
-+
-+class SwVbaDocuments : public SwVbaDocuments_BASE
-+{
-+public:
-+ SwVbaDocuments( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext );
-+ virtual ~SwVbaDocuments() {}
-+
-+ // 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);
-+
-+ // SwVbaDocuments_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+
-+ // Methods
-+ virtual css::uno::Any SAL_CALL Add( const css::uno::Any& Template, const css::uno::Any& NewTemplate, const css::uno::Any& DocumentType, const css::uno::Any& Visible ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Open( const ::rtl::OUString& Filename, const css::uno::Any& ConfirmConversions, const css::uno::Any& ReadOnly, const css::uno::Any& AddToRecentFiles, const css::uno::Any& PasswordDocument, const css::uno::Any& PasswordTemplate, const css::uno::Any& Revert, const css::uno::Any& WritePasswordDocument, const css::uno::Any& WritePasswordTemplate, const css::uno::Any& Format, const css::uno::Any& Encoding, const css::uno::Any& Visible, const css::uno::Any& OpenAndRepair, const css::uno::Any& DocumentDirection, const css::uno::Any& NoEncodingDialog, const css::uno::Any& XMLTransform ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL Close( const css::uno::Any& SaveChanges, const css::uno::Any& OriginalFormat, const css::uno::Any& RouteDocument ) throw (css::uno::RuntimeException);
-+
-+};
-+
-+#endif /* SW_VBA_DOCUMENTS_HXX */
-diff --git sw/source/ui/vba/vbafield.cxx sw/source/ui/vba/vbafield.cxx
-new file mode 100644
-index 0000000..6effe4d
---- /dev/null
-+++ sw/source/ui/vba/vbafield.cxx
-@@ -0,0 +1,481 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbafield.hxx"
-+#include "vbarange.hxx"
-+#include <com/sun/star/frame/XModel.hpp>
-+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
-+#include <com/sun/star/view/XSelectionSupplier.hpp>
-+#include <com/sun/star/text/XTextFieldsSupplier.hpp>
-+#include <ooo/vba/word/WdFieldType.hpp>
-+#include <com/sun/star/text/FilenameDisplayFormat.hpp>
-+#include <com/sun/star/util/XRefreshable.hpp>
-+#include <swtypes.hxx>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+// *** SwVbaField ***********************************************
-+
-+SwVbaField::SwVbaField( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rDocument, const uno::Reference< css::text::XTextField >& xTextField) throw ( uno::RuntimeException ) : SwVbaField_BASE( rParent, rContext ), mxTextDocument( rDocument )
-+{
-+ mxTextField.set( xTextField, uno::UNO_QUERY_THROW );
-+}
-+
-+// XHelperInterface
-+rtl::OUString&
-+SwVbaField::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaField") );
-+ return sImplName;
-+}
-+
-+uno::Sequence<rtl::OUString>
-+SwVbaField::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Field" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-+// *** _ReadFieldParams ***********************************************
-+// the codes are copied from ww8par5.cxx
-+class _ReadFieldParams
-+{
-+private:
-+ String aData;
-+ xub_StrLen nLen, nFnd, nNext, nSavPtr;
-+ String aFieldName;
-+public:
-+ _ReadFieldParams( const String& rData );
-+ ~_ReadFieldParams();
-+
-+ xub_StrLen GoToTokenParam();
-+ long SkipToNextToken();
-+ xub_StrLen GetTokenSttPtr() const { return nFnd; }
-+
-+ xub_StrLen FindNextStringPiece( xub_StrLen _nStart = STRING_NOTFOUND );
-+ bool GetTokenSttFromTo(xub_StrLen* _pFrom, xub_StrLen* _pTo,
-+ xub_StrLen _nMax);
-+
-+ String GetResult() const;
-+ String GetFieldName()const { return aFieldName; }
-+};
-+
-+
-+_ReadFieldParams::_ReadFieldParams( const String& _rData )
-+ : aData( _rData ), nLen( _rData.Len() ), nNext( 0 )
-+{
-+ /*
-+ erstmal nach einer oeffnenden Klammer oder einer Leerstelle oder einem
-+ Anfuehrungszeichen oder einem Backslash suchen, damit der Feldbefehl
-+ (also INCLUDEPICTURE bzw EINFUeGENGRAFIK bzw ...) ueberlesen wird
-+ */
-+ while( (nLen > nNext) && (aData.GetChar( nNext ) == ' ') )
-+ ++nNext;
-+
-+ sal_Unicode c;
-+ while( nLen > nNext
-+ && (c = aData.GetChar( nNext )) != ' '
-+ && c != '"'
-+ && c != '\\'
-+ && c != 132
-+ && c != 0x201c )
-+ ++nNext;
-+
-+ nFnd = nNext;
-+ nSavPtr = nNext;
-+ aFieldName = aData.Copy( 0, nFnd );
-+// cLastChar = aData.GetChar( nSavPtr );
-+}
-+
-+
-+_ReadFieldParams::~_ReadFieldParams()
-+{
-+// aData.SetChar( nSavPtr, cLastChar );
-+}
-+
-+
-+String _ReadFieldParams::GetResult() const
-+{
-+ return (STRING_NOTFOUND == nFnd)
-+ ? aEmptyStr
-+ : aData.Copy( nFnd, (nSavPtr - nFnd) );
-+}
-+
-+
-+xub_StrLen _ReadFieldParams::GoToTokenParam()
-+{
-+ xub_StrLen nOld = nNext;
-+ if( -2 == SkipToNextToken() )
-+ return GetTokenSttPtr();
-+ nNext = nOld;
-+ return STRING_NOTFOUND;
-+}
-+
-+// ret: -2: NOT a '\' parameter but normal Text
-+long _ReadFieldParams::SkipToNextToken()
-+{
-+ long nRet = -1; // Ende
-+ if (
-+ (STRING_NOTFOUND != nNext) && (nLen > nNext) &&
-+ STRING_NOTFOUND != (nFnd = FindNextStringPiece(nNext))
-+ )
-+ {
-+ nSavPtr = nNext;
-+
-+ if ('\\' == aData.GetChar(nFnd) && '\\' != aData.GetChar(nFnd + 1))
-+ {
-+ nRet = aData.GetChar(++nFnd);
-+ nNext = ++nFnd; // und dahinter setzen
-+ }
-+ else
-+ {
-+ nRet = -2;
-+ if (
-+ (STRING_NOTFOUND != nSavPtr ) &&
-+ (
-+ ('"' == aData.GetChar(nSavPtr - 1)) ||
-+ (0x201d == aData.GetChar(nSavPtr - 1))
-+ )
-+ )
-+ {
-+ --nSavPtr;
-+ }
-+ }
-+ }
-+ return nRet;
-+}
-+
-+// FindNextPara sucht naechsten Backslash-Parameter oder naechste Zeichenkette
-+// bis zum Blank oder naechsten "\" oder zum schliessenden Anfuehrungszeichen
-+// oder zum String-Ende von pStr.
-+//
-+// Ausgabe ppNext (falls ppNext != 0) Suchbeginn fuer naechsten Parameter bzw. 0
-+//
-+// Returnwert: 0 falls String-Ende erreicht,
-+// ansonsten Anfang des Paramters bzw. der Zeichenkette
-+//
-+xub_StrLen _ReadFieldParams::FindNextStringPiece(const xub_StrLen nStart)
-+{
-+ xub_StrLen n = ( STRING_NOTFOUND == nStart ) ? nFnd : nStart; // Anfang
-+ xub_StrLen n2; // Ende
-+
-+ nNext = STRING_NOTFOUND; // Default fuer nicht gefunden
-+
-+ while( (nLen > n) && (aData.GetChar( n ) == ' ') )
-+ ++n;
-+
-+ if( nLen == n )
-+ return STRING_NOTFOUND; // String End reached!
-+
-+ if( (aData.GetChar( n ) == '"') // Anfuehrungszeichen vor Para?
-+ || (aData.GetChar( n ) == 0x201c)
-+ || (aData.GetChar( n ) == 132) )
-+ {
-+ n++; // Anfuehrungszeichen ueberlesen
-+ n2 = n; // ab hier nach Ende suchen
-+ while( (nLen > n2)
-+ && (aData.GetChar( n2 ) != '"')
-+ && (aData.GetChar( n2 ) != 0x201d)
-+ && (aData.GetChar( n2 ) != 147) )
-+ n2++; // Ende d. Paras suchen
-+ }
-+ else // keine Anfuehrungszeichen
-+ {
-+ n2 = n; // ab hier nach Ende suchen
-+ while( (nLen > n2) && (aData.GetChar( n2 ) != ' ') ) // Ende d. Paras suchen
-+ {
-+ if( aData.GetChar( n2 ) == '\\' )
-+ {
-+ if( aData.GetChar( n2+1 ) == '\\' )
-+ n2 += 2; // Doppel-Backslash -> OK
-+ else
-+ {
-+ if( n2 > n )
-+ n2--;
-+ break; // einfach-Backslash -> Ende
-+ }
-+ }
-+ else
-+ n2++; // kein Backslash -> OK
-+ }
-+ }
-+ if( nLen > n2 )
-+ {
-+ if(aData.GetChar( n2 ) != ' ') n2++;
-+ nNext = n2;
-+ }
-+ return n;
-+}
-+
-+
-+
-+// read parameters "1-3" or 1-3 with both values between 1 and nMax
-+bool _ReadFieldParams::GetTokenSttFromTo(USHORT* pFrom, USHORT* pTo, USHORT nMax)
-+{
-+ USHORT nStart = 0;
-+ USHORT nEnd = 0;
-+ xub_StrLen n = GoToTokenParam();
-+ if( STRING_NOTFOUND != n )
-+ {
-+
-+ String sParams( GetResult() );
-+
-+ xub_StrLen nIndex = 0;
-+ String sStart( sParams.GetToken(0, '-', nIndex) );
-+ if( STRING_NOTFOUND != nIndex )
-+ {
-+ nStart = static_cast<USHORT>(sStart.ToInt32());
-+ nEnd = static_cast<USHORT>(sParams.Copy(nIndex).ToInt32());
-+ }
-+ }
-+ if( pFrom ) *pFrom = nStart;
-+ if( pTo ) *pTo = nEnd;
-+
-+ return nStart && nEnd && (nMax >= nStart) && (nMax >= nEnd);
-+}
-+
-+// *** SwVbaFields ***********************************************
-+
-+uno::Any lcl_createField( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel, const uno::Any& aSource )
-+{
-+ uno::Reference< text::XTextField > xTextField( aSource, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextDocument > xTextDocument( xModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< word::XField > xField( new SwVbaField( xParent, xContext, xTextDocument, xTextField ) );
-+ return uno::makeAny( xField );
-+}
-+
-+typedef ::cppu::WeakImplHelper1< css::container::XEnumeration > FieldEnumeration_BASE;
-+typedef ::cppu::WeakImplHelper2< container::XIndexAccess, container::XEnumerationAccess > FieldCollectionHelper_BASE;
-+
-+class FieldEnumeration : public FieldEnumeration_BASE
-+{
-+ uno::Reference< XHelperInterface > mxParent;
-+ uno::Reference< uno::XComponentContext > mxContext;
-+ uno::Reference< frame::XModel > mxModel;
-+ uno::Reference< container::XEnumeration > mxEnumeration;
-+public:
-+ FieldEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< container::XEnumeration >& xEnumeration ) : mxParent( xParent ), mxContext( xContext ), mxModel( xModel ), mxEnumeration( xEnumeration )
-+ {
-+ }
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return mxEnumeration->hasMoreElements();
-+ }
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( !hasMoreElements() )
-+ throw container::NoSuchElementException();
-+ return lcl_createField( mxParent, mxContext, mxModel, mxEnumeration->nextElement() );
-+ }
-+};
-+
-+class FieldCollectionHelper : public FieldCollectionHelper_BASE
-+{
-+ uno::Reference< XHelperInterface > mxParent;
-+ uno::Reference< uno::XComponentContext > mxContext;
-+ uno::Reference< frame::XModel > mxModel;
-+ uno::Reference< container::XEnumerationAccess > mxEnumerationAccess;
-+public:
-+ FieldCollectionHelper( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) throw (css::uno::RuntimeException) : mxParent( xParent ), mxContext( xContext ), mxModel( xModel )
-+ {
-+ uno::Reference< text::XTextFieldsSupplier > xSupp( xModel, uno::UNO_QUERY_THROW );
-+ mxEnumerationAccess.set( xSupp->getTextFields(), uno::UNO_QUERY_THROW );
-+ }
-+ // XElementAccess
-+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) { return mxEnumerationAccess->getElementType(); }
-+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) { return mxEnumerationAccess->hasElements(); }
-+ // XIndexAccess
-+ virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
-+ {
-+ uno::Reference< container::XEnumeration > xEnumeration = mxEnumerationAccess->createEnumeration();
-+ sal_Int32 nCount = 0;
-+ while( xEnumeration->hasMoreElements() )
-+ {
-+ ++nCount;
-+ xEnumeration->nextElement();
-+ }
-+ return nCount;
-+ }
-+ virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
-+ {
-+ if( Index < 0 || Index >= getCount() )
-+ throw lang::IndexOutOfBoundsException();
-+
-+ uno::Reference< container::XEnumeration > xEnumeration = mxEnumerationAccess->createEnumeration();
-+ sal_Int32 nCount = 0;
-+ while( xEnumeration->hasMoreElements() )
-+ {
-+ if( nCount == Index )
-+ {
-+ return xEnumeration->nextElement();
-+ }
-+ ++nCount;
-+ }
-+ throw lang::IndexOutOfBoundsException();
-+ }
-+ // XEnumerationAccess
-+ virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
-+ {
-+ uno::Reference< container::XEnumeration > xEnumeration = mxEnumerationAccess->createEnumeration();
-+ return uno::Reference< container::XEnumeration >( new FieldEnumeration( mxParent, mxContext, mxModel, xEnumeration ) );
-+ }
-+};
-+
-+SwVbaFields::SwVbaFields( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel ) : SwVbaFields_BASE( xParent, xContext , uno::Reference< container::XIndexAccess >( new FieldCollectionHelper( xParent, xContext, xModel ) ) ), mxModel( xModel )
-+{
-+ mxMSF.set( mxModel, uno::UNO_QUERY_THROW );
-+}
-+
-+uno::Reference< word::XField > SAL_CALL
-+SwVbaFields::Add( const css::uno::Reference< ::ooo::vba::word::XRange >& Range, const css::uno::Any& Type, const css::uno::Any& Text, const css::uno::Any& /*PreserveFormatting*/ ) throw (css::uno::RuntimeException)
-+{
-+ sal_Int32 nType = word::WdFieldType::wdFieldEmpty;
-+ Type >>= nType;
-+ rtl::OUString sText;
-+ Text >>= sText;
-+
-+ String sFieldName;
-+ if( ( nType == word::WdFieldType::wdFieldEmpty ) && ( sText.getLength() > 0 ) )
-+ {
-+ _ReadFieldParams aReadParam(sText);
-+ sFieldName = aReadParam.GetFieldName();
-+ }
-+
-+ uno::Reference< text::XTextContent > xTextField;
-+ if( nType == word::WdFieldType::wdFieldFileName || sFieldName.EqualsIgnoreCaseAscii("FILENAME") )
-+ {
-+ xTextField.set( Create_Field_FileName( sText ), uno::UNO_QUERY_THROW );
-+ }
-+ else
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+
-+ SwVbaRange* pVbaRange = dynamic_cast< SwVbaRange* >( Range.get() );
-+ uno::Reference< text::XTextRange > xTextRange = pVbaRange->getXTextRange();
-+ uno::Reference< text::XText > xText = xTextRange->getText();
-+ xText->insertTextContent( xTextRange, xTextField, true );
-+ return uno::Reference< word::XField >( new SwVbaField( mxParent, mxContext, uno::Reference< text::XTextDocument >( mxModel, uno::UNO_QUERY_THROW ), uno::Reference< text::XTextField >( xTextField, uno::UNO_QUERY_THROW ) ) );
-+}
-+
-+uno::Reference< text::XTextField > SwVbaFields::Create_Field_FileName( const rtl::OUString _text ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< text::XTextField > xTextField( mxMSF->createInstance( rtl::OUString::createFromAscii("com.sun.star.text.TextField.FileName") ), uno::UNO_QUERY_THROW );
-+ sal_Int16 nFileFormat = text::FilenameDisplayFormat::NAME_AND_EXT;
-+ if( _text.getLength() > 0 )
-+ {
-+ long nRet;
-+ _ReadFieldParams aReadParam( _text );
-+ while (-1 != (nRet = aReadParam.SkipToNextToken()))
-+ {
-+ switch (nRet)
-+ {
-+ case 'p':
-+ nFileFormat = text::FilenameDisplayFormat::FULL;
-+ break;
-+ case '*':
-+ //Skip over MERGEFORMAT
-+ aReadParam.SkipToNextToken();
-+ break;
-+ default:
-+ DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
-+ break;
-+ }
-+ }
-+ }
-+
-+ uno::Reference< beans::XPropertySet > xProps( xTextField, uno::UNO_QUERY_THROW );
-+ xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FileFormat") ), uno::makeAny( nFileFormat ) );
-+
-+ return xTextField;
-+}
-+
-+uno::Reference< container::XEnumeration > SAL_CALL
-+SwVbaFields::createEnumeration() throw (uno::RuntimeException)
-+{
-+ uno::Reference< container::XEnumerationAccess > xEnumerationAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
-+ return xEnumerationAccess->createEnumeration();
-+}
-+
-+// ScVbaCollectionBaseImpl
-+uno::Any
-+SwVbaFields::createCollectionObject( const uno::Any& aSource )
-+{
-+ return lcl_createField( mxParent, mxContext, mxModel, aSource );
-+}
-+
-+sal_Int32 SAL_CALL SwVbaFields::Update() throw (uno::RuntimeException)
-+{
-+ sal_Int32 nUpdate = 1;
-+ try
-+ {
-+ uno::Reference< text::XTextFieldsSupplier > xSupp( mxModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< util::XRefreshable > xRef( xSupp->getTextFields(), uno::UNO_QUERY_THROW );
-+ xRef->refresh();
-+ nUpdate = 0;
-+ }catch( uno::Exception )
-+ {
-+ nUpdate = 1;
-+ }
-+ return nUpdate;
-+}
-+
-+// XHelperInterface
-+rtl::OUString&
-+SwVbaFields::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaFields") );
-+ return sImplName;
-+}
-+
-+// XEnumerationAccess
-+uno::Type SAL_CALL
-+SwVbaFields::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XField::static_type(0);
-+}
-+
-+uno::Sequence<rtl::OUString>
-+SwVbaFields::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Fields" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbafield.hxx sw/source/ui/vba/vbafield.hxx
-new file mode 100644
-index 0000000..20d0499
---- /dev/null
-+++ sw/source/ui/vba/vbafield.hxx
-@@ -0,0 +1,80 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_FIELD_HXX
-+#define SW_VBA_FIELD_HXX
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include <com/sun/star/text/XTextField.hpp>
-+#include <ooo/vba/word/XField.hpp>
-+#include <ooo/vba/word/XFields.hpp>
-+#include <vbahelper/vbacollectionimpl.hxx>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XField > SwVbaField_BASE;
-+
-+class SwVbaField : public SwVbaField_BASE
-+{
-+ css::uno::Reference< css::text::XTextDocument > mxTextDocument;
-+ css::uno::Reference< css::text::XTextField > mxTextField;
-+public:
-+ SwVbaField( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rDocument, const css::uno::Reference< css::text::XTextField >& xTextField) throw ( css::uno::RuntimeException);;
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+// *** SwVbaFields ***********************************************
-+
-+typedef CollTestImplHelper< ov::word::XFields > SwVbaFields_BASE;
-+
-+class SwVbaFields : public SwVbaFields_BASE
-+{
-+ css::uno::Reference< css::frame::XModel > mxModel;
-+ css::uno::Reference< css::lang::XMultiServiceFactory > mxMSF;
-+private:
-+ css::uno::Reference< css::text::XTextField > Create_Field_FileName( const rtl::OUString _text ) throw (css::uno::RuntimeException);
-+
-+public:
-+ SwVbaFields( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel );
-+ // XFields
-+ virtual css::uno::Reference< ::ooo::vba::word::XField > SAL_CALL Add( const css::uno::Reference< ::ooo::vba::word::XRange >& Range, const css::uno::Any& Type, const css::uno::Any& Text, const css::uno::Any& PreserveFormatting ) throw (css::uno::RuntimeException);
-+ virtual sal_Int32 SAL_CALL Update() 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 );
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif
-diff --git sw/source/ui/vba/vbafind.cxx sw/source/ui/vba/vbafind.cxx
-new file mode 100644
-index 0000000..22d9a1f
---- /dev/null
-+++ sw/source/ui/vba/vbafind.cxx
-@@ -0,0 +1,431 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbafind.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include "vbareplacement.hxx"
-+#include <ooo/vba/word/WdFindWrap.hpp>
-+#include <ooo/vba/word/WdReplace.hpp>
-+#include <com/sun/star/text/XTextRangeCompare.hpp>
-+#include "wordvbahelper.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaFind::SwVbaFind( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XTextRange >& xTextRange ) throw ( uno::RuntimeException ) :
-+ SwVbaFind_BASE( rParent, rContext ), mxModel( xModel ), mxTextRange( xTextRange ), mbReplace( sal_False ), mnReplaceType( word::WdReplace::wdReplaceOne ), mnWrap( word::WdFindWrap::wdFindStop )
-+{
-+ mxReplaceable.set( mxModel, uno::UNO_QUERY_THROW );
-+ mxPropertyReplace.set( mxReplaceable->createReplaceDescriptor(), uno::UNO_QUERY_THROW );
-+ mxTVC = word::getXTextViewCursor( mxModel );
-+ mxSelSupp.set( mxModel->getCurrentController(), uno::UNO_QUERY_THROW );
-+}
-+
-+SwVbaFind::~SwVbaFind()
-+{
-+}
-+
-+sal_Bool SwVbaFind::InRange( const uno::Reference< text::XTextRange >& xCurrentRange ) throw ( uno::RuntimeException )
-+{
-+ uno::Reference< text::XTextRangeCompare > xTRC( mxTextRange->getText(), uno::UNO_QUERY_THROW );
-+ if( xTRC->compareRegionStarts( mxTextRange, xCurrentRange ) >= 0 && xTRC->compareRegionEnds( mxTextRange, xCurrentRange ) <= 0 )
-+ return sal_True;
-+ return sal_False;
-+}
-+
-+sal_Bool SwVbaFind::InEqualRange( const uno::Reference< text::XTextRange >& xCurrentRange ) throw ( uno::RuntimeException )
-+{
-+ uno::Reference< text::XTextRangeCompare > xTRC( mxTextRange->getText(), uno::UNO_QUERY_THROW );
-+ if( xTRC->compareRegionStarts( mxTextRange, xCurrentRange ) == 0 && xTRC->compareRegionEnds( mxTextRange, xCurrentRange ) == 0 )
-+ return sal_True;
-+ return sal_False;
-+}
-+
-+void SwVbaFind::SetReplaceWith( const rtl::OUString& rText ) throw (uno::RuntimeException)
-+{
-+ mxPropertyReplace->setReplaceString( rText );
-+ mbReplace = sal_True;
-+}
-+
-+rtl::OUString SwVbaFind::GetReplaceWith() throw (uno::RuntimeException)
-+{
-+ return mxPropertyReplace->getReplaceString();
-+}
-+void SwVbaFind::SetReplace( sal_Int32 type )
-+{
-+ mnReplaceType = type;
-+ mbReplace = sal_True;
-+}
-+
-+rtl::OUString SwVbaFind::ReplaceWildcards( const rtl::OUString& rText ) throw ( uno::RuntimeException )
-+{
-+ // TODO:
-+ return rtl::OUString();
-+}
-+
-+uno::Reference< text::XTextRange > SwVbaFind::FindOneElement() throw ( uno::RuntimeException )
-+{
-+ uno::Reference< text::XTextRange > xFoundOne;
-+ if( mxTVC->getString().getLength() > 0 )
-+ {
-+ if( getForward() )
-+ {
-+ xFoundOne.set( mxReplaceable->findNext( mxTextRange->getStart(), uno::Reference< util::XSearchDescriptor >( mxPropertyReplace, uno::UNO_QUERY_THROW ) ), uno::UNO_QUERY );
-+ }
-+ else
-+ {
-+ xFoundOne.set( mxReplaceable->findNext( mxTextRange->getEnd(), uno::Reference< util::XSearchDescriptor >( mxPropertyReplace, uno::UNO_QUERY_THROW ) ), uno::UNO_QUERY );
-+ }
-+
-+ if( xFoundOne.is() && InEqualRange( xFoundOne ) )
-+ {
-+ xFoundOne.set( mxReplaceable->findNext( xFoundOne, uno::Reference< util::XSearchDescriptor >( mxPropertyReplace, uno::UNO_QUERY_THROW ) ), uno::UNO_QUERY );
-+ }
-+ else if( xFoundOne.is() && !InRange( xFoundOne ) )
-+ {
-+ xFoundOne = uno::Reference< text::XTextRange >();
-+ }
-+ }
-+ else
-+ {
-+ xFoundOne.set( mxReplaceable->findNext( mxTextRange, uno::Reference< util::XSearchDescriptor >( mxPropertyReplace, uno::UNO_QUERY_THROW ) ), uno::UNO_QUERY );
-+ }
-+
-+ if( !xFoundOne.is() && ( getWrap() == word::WdFindWrap::wdFindContinue || getWrap() == word::WdFindWrap::wdFindAsk ) )
-+ {
-+ if( getForward() )
-+ {
-+ mxTVC->gotoStart(sal_False);
-+ xFoundOne.set( mxReplaceable->findNext( mxTextRange->getStart(), uno::Reference< util::XSearchDescriptor >( mxPropertyReplace, uno::UNO_QUERY_THROW ) ), uno::UNO_QUERY );
-+ }
-+ else
-+ {
-+ mxTVC->gotoEnd( sal_False );
-+ xFoundOne.set( mxReplaceable->findNext( mxTextRange->getEnd(), uno::Reference< util::XSearchDescriptor >( mxPropertyReplace, uno::UNO_QUERY_THROW ) ), uno::UNO_QUERY );
-+
-+ }
-+ }
-+ return xFoundOne;
-+}
-+
-+sal_Bool SwVbaFind::SearchReplace() throw (uno::RuntimeException)
-+{
-+ sal_Bool result = sal_False;
-+
-+ // TODO: map wildcards in area to OOo wildcards
-+
-+ if( mbReplace )
-+ {
-+ switch( mnReplaceType )
-+ {
-+ case word::WdReplace::wdReplaceNone:
-+ {
-+ result = sal_True;
-+ break;
-+ }
-+ case word::WdReplace::wdReplaceOne:
-+ {
-+ uno::Reference< text::XTextRange > xFindOne = FindOneElement();
-+ if( xFindOne.is() )
-+ {
-+ xFindOne->setString( GetReplaceWith() );
-+ result = mxSelSupp->select( uno::makeAny( xFindOne ) );
-+ }
-+ break;
-+ }
-+ case word::WdReplace::wdReplaceAll:
-+ {
-+ uno::Reference< container::XIndexAccess > xIndexAccess = mxReplaceable->findAll( uno::Reference< util::XSearchDescriptor >( mxPropertyReplace, uno::UNO_QUERY_THROW ) );
-+ if( xIndexAccess->getCount() > 0 )
-+ {
-+ for( sal_Int32 i = 0; i < xIndexAccess->getCount(); i++ )
-+ {
-+ uno::Reference< text::XTextRange > xTextRange( xIndexAccess->getByIndex( i ), uno::UNO_QUERY_THROW );
-+ if( mnWrap == word::WdFindWrap::wdFindContinue || mnWrap == word::WdFindWrap::wdFindAsk || InRange( xTextRange ) )
-+ {
-+ xTextRange->setString( GetReplaceWith() );
-+ result = sal_True;
-+ }
-+ }
-+ }
-+ break;
-+ }
-+ defalut:
-+ {
-+ result = sal_False;
-+ }
-+ }
-+ }
-+ else
-+ {
-+ uno::Reference< text::XTextRange > xFindOne = FindOneElement();
-+ if( xFindOne.is() )
-+ result = mxSelSupp->select( uno::makeAny( xFindOne ) );
-+ }
-+
-+ return result;
-+}
-+
-+::rtl::OUString SAL_CALL SwVbaFind::getText() throw (uno::RuntimeException)
-+{
-+ return mxPropertyReplace->getSearchString();
-+}
-+
-+void SAL_CALL SwVbaFind::setText( const ::rtl::OUString& _text ) throw (uno::RuntimeException)
-+{
-+ mxPropertyReplace->setSearchString( _text );
-+}
-+
-+uno::Any SAL_CALL SwVbaFind::getReplacement() throw (uno::RuntimeException)
-+{
-+ return uno::makeAny( uno::Reference< word::XReplacement >( new SwVbaReplacement( this, mxContext, mxPropertyReplace ) ) );
-+}
-+
-+void SAL_CALL SwVbaFind::setReplacement( const uno::Any& /*_replacement */ ) throw (uno::RuntimeException)
-+{
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+}
-+
-+::sal_Bool SAL_CALL SwVbaFind::getForward() throw (uno::RuntimeException)
-+{
-+ sal_Bool bBackward = sal_False;
-+ mxPropertyReplace->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchBackwards") ) ) >>= bBackward;
-+ return !bBackward;
-+}
-+
-+void SAL_CALL SwVbaFind::setForward( ::sal_Bool _forward ) throw (uno::RuntimeException)
-+{
-+ sal_Bool bBackward = !_forward;
-+ mxPropertyReplace->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchBackwards") ), uno::makeAny( bBackward ) );
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaFind::getWrap() throw (uno::RuntimeException)
-+{
-+ // seems not supported in Writer
-+ return mnWrap;
-+}
-+
-+void SAL_CALL SwVbaFind::setWrap( ::sal_Int32 _wrap ) throw (uno::RuntimeException)
-+{
-+ // seems not supported in Writer
-+ mnWrap = _wrap;
-+}
-+
-+::sal_Bool SAL_CALL SwVbaFind::getFormat() throw (uno::RuntimeException)
-+{
-+ return mxPropertyReplace->getValueSearch();
-+}
-+
-+void SAL_CALL SwVbaFind::setFormat( ::sal_Bool _format ) throw (uno::RuntimeException)
-+{
-+ mxPropertyReplace->setValueSearch( _format );
-+}
-+
-+::sal_Bool SAL_CALL SwVbaFind::getMatchCase() throw (uno::RuntimeException)
-+{
-+ sal_Bool value = sal_False;
-+ mxPropertyReplace->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchCaseSensitive") ) ) >>= value;
-+ return value;
-+}
-+
-+void SAL_CALL SwVbaFind::setMatchCase( ::sal_Bool _matchcase ) throw (uno::RuntimeException)
-+{
-+ mxPropertyReplace->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchCaseSensitive") ), uno::makeAny( _matchcase ) );
-+}
-+
-+::sal_Bool SAL_CALL SwVbaFind::getMatchWholeWord() throw (uno::RuntimeException)
-+{
-+ sal_Bool value = sal_False;
-+ mxPropertyReplace->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchWords") ) ) >>= value;
-+ return value;
-+}
-+
-+void SAL_CALL SwVbaFind::setMatchWholeWord( ::sal_Bool _matchwholeword ) throw (uno::RuntimeException)
-+{
-+ mxPropertyReplace->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchWords") ), uno::makeAny( _matchwholeword ) );
-+}
-+
-+::sal_Bool SAL_CALL SwVbaFind::getMatchWildcards() throw (uno::RuntimeException)
-+{
-+ sal_Bool value = sal_False;
-+ mxPropertyReplace->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchRegularExpression") ) ) >>= value;
-+ return value;
-+}
-+
-+void SAL_CALL SwVbaFind::setMatchWildcards( ::sal_Bool _matchwildcards ) throw (uno::RuntimeException)
-+{
-+ mxPropertyReplace->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchRegularExpression") ), uno::makeAny( _matchwildcards ) );
-+}
-+
-+::sal_Bool SAL_CALL SwVbaFind::getMatchSoundsLike() throw (uno::RuntimeException)
-+{
-+ sal_Bool value = sal_False;
-+ mxPropertyReplace->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchSimilarity") ) ) >>= value;
-+ return value;
-+}
-+
-+void SAL_CALL SwVbaFind::setMatchSoundsLike( ::sal_Bool _matchsoundslike ) throw (uno::RuntimeException)
-+{
-+ // seems not accurate
-+ mxPropertyReplace->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchSimilarity") ), uno::makeAny( _matchsoundslike ) );
-+}
-+
-+::sal_Bool SAL_CALL SwVbaFind::getMatchAllWordForms() throw (uno::RuntimeException)
-+{
-+ sal_Bool value = sal_False;
-+ mxPropertyReplace->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchSimilarity") ) ) >>= value;
-+ if( value )
-+ mxPropertyReplace->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchSimilarityRelax") ) ) >>= value;
-+ return value;
-+}
-+
-+void SAL_CALL SwVbaFind::setMatchAllWordForms( ::sal_Bool _matchallwordforms ) throw (uno::RuntimeException)
-+{
-+ // seems not accurate
-+ mxPropertyReplace->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchSimilarity") ), uno::makeAny( _matchallwordforms ) );
-+ mxPropertyReplace->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchSimilarityRelax") ), uno::makeAny( _matchallwordforms ) );
-+}
-+
-+uno::Any SAL_CALL SwVbaFind::getStyle() throw (uno::RuntimeException)
-+{
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+}
-+
-+void SAL_CALL SwVbaFind::setStyle( const uno::Any& /*_style */ ) throw (uno::RuntimeException)
-+{
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+}
-+
-+sal_Bool SAL_CALL
-+SwVbaFind::Execute( const uno::Any& FindText, const uno::Any& MatchCase, const uno::Any& MatchWholeWord, const uno::Any& MatchWildcards, const uno::Any& MatchSoundsLike, const uno::Any& MatchAllWordForms, const uno::Any& Forward, const uno::Any& Wrap, const uno::Any& Format, const uno::Any& ReplaceWith, const uno::Any& Replace, const uno::Any& /*MatchKashida*/, const uno::Any& /*MatchDiacritics*/, const uno::Any& /*MatchAlefHamza*/, const uno::Any& /*MatchControl*/, const uno::Any& /*MatchPrefix*/, const uno::Any& /*MatchSuffix*/, const uno::Any& /*MatchPhrase*/, const uno::Any& /*IgnoreSpace*/, const uno::Any& /*IgnorePunct*/ ) throw (uno::RuntimeException)
-+{
-+ sal_Bool result = sal_False;
-+ if( FindText.hasValue() )
-+ {
-+ rtl::OUString sText;
-+ FindText >>= sText;
-+ setText( sText );
-+ }
-+
-+ sal_Bool bValue = sal_False;
-+ if( MatchCase.hasValue() )
-+ {
-+ MatchCase >>= bValue;
-+ setMatchCase( bValue );
-+ }
-+
-+ if( MatchWholeWord.hasValue() )
-+ {
-+ MatchWholeWord >>= bValue;
-+ setMatchWholeWord( bValue );
-+ }
-+
-+ if( MatchWildcards.hasValue() )
-+ {
-+ MatchWildcards >>= bValue;
-+ setMatchWildcards( bValue );
-+ }
-+
-+ if( MatchSoundsLike.hasValue() )
-+ {
-+ MatchSoundsLike >>= bValue;
-+ setMatchSoundsLike( bValue );
-+ }
-+
-+ if( MatchAllWordForms.hasValue() )
-+ {
-+ MatchAllWordForms >>= bValue;
-+ setMatchAllWordForms( bValue );
-+ }
-+
-+ if( Forward.hasValue() )
-+ {
-+ Forward >>= bValue;
-+ setForward( bValue );
-+ }
-+
-+ if( Wrap.hasValue() )
-+ {
-+ sal_Int32 nWrapType = 0;
-+ Wrap >>= nWrapType;
-+ setWrap( nWrapType );
-+ }
-+
-+ if( Format.hasValue() )
-+ {
-+ Format >>= bValue;
-+ setFormat( bValue );
-+ }
-+
-+ if( ReplaceWith.hasValue() )
-+ {
-+ rtl::OUString sValue;
-+ ReplaceWith >>= sValue;
-+ SetReplaceWith( sValue );
-+ }
-+
-+ if( Replace.hasValue() )
-+ {
-+ sal_Int32 nValue;
-+ Replace >>= nValue;
-+ SetReplace( nValue );
-+ }
-+
-+ result = SearchReplace();
-+
-+ return result;
-+}
-+
-+void SAL_CALL
-+SwVbaFind::ClearFormatting( ) throw (uno::RuntimeException)
-+{
-+ uno::Sequence< beans::PropertyValue > aSearchAttribs;
-+ mxPropertyReplace->setSearchAttributes( aSearchAttribs );
-+}
-+
-+rtl::OUString&
-+SwVbaFind::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaFind") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaFind::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Find" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbafind.hxx sw/source/ui/vba/vbafind.hxx
-new file mode 100644
-index 0000000..76988ca
---- /dev/null
-+++ sw/source/ui/vba/vbafind.hxx
-@@ -0,0 +1,104 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_FIND_HXX
-+#define SW_VBA_FIND_HXX
-+
-+#include <ooo/vba/word/XFind.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/text/XTextRange.hpp>
-+#include <com/sun/star/util/XReplaceable.hpp>
-+#include <com/sun/star/util/XPropertyReplace.hpp>
-+#include <com/sun/star/text/XTextViewCursor.hpp>
-+#include <com/sun/star/text/XTextCursor.hpp>
-+#include <com/sun/star/view/XSelectionSupplier.hpp>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XFind > SwVbaFind_BASE;
-+
-+class SwVbaFind : public SwVbaFind_BASE
-+{
-+private:
-+ css::uno::Reference< css::frame::XModel > mxModel;
-+ css::uno::Reference< css::text::XTextRange > mxTextRange;
-+ css::uno::Reference< css::util::XReplaceable > mxReplaceable;
-+ css::uno::Reference< css::util::XPropertyReplace> mxPropertyReplace;
-+ css::uno::Reference< css::text::XTextViewCursor> mxTVC;
-+ css::uno::Reference< css::view::XSelectionSupplier> mxSelSupp;
-+ sal_Bool mbReplace;
-+ sal_Int32 mnReplaceType;
-+ sal_Int32 mnWrap;
-+
-+private:
-+ sal_Bool InRange( const css::uno::Reference< css::text::XTextRange >& xCurrentRange ) throw ( css::uno::RuntimeException );
-+ sal_Bool InEqualRange( const css::uno::Reference< css::text::XTextRange >& xCurrentRange ) throw ( css::uno::RuntimeException );
-+ void SetReplace( sal_Int32 type );
-+ void SetReplaceWith( const rtl::OUString& rText ) throw ( css::uno::RuntimeException );
-+ rtl::OUString GetReplaceWith() throw ( css::uno::RuntimeException );
-+ rtl::OUString ReplaceWildcards( const rtl::OUString& rText ) throw ( css::uno::RuntimeException );
-+ css::uno::Reference< css::text::XTextRange > FindOneElement() throw ( css::uno::RuntimeException );
-+ sal_Bool SearchReplace() throw ( css::uno::RuntimeException );
-+
-+public:
-+ SwVbaFind( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XTextRange >& xTextRange ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaFind();
-+
-+ // Attributes
-+ virtual ::rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setText( const ::rtl::OUString& _text ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL getReplacement() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setReplacement( const css::uno::Any& _replacement ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getForward() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setForward( ::sal_Bool _forward ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getWrap() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setWrap( ::sal_Int32 _wrap ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getFormat() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setFormat( ::sal_Bool _format ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getMatchCase() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setMatchCase( ::sal_Bool _matchcase ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getMatchWholeWord() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setMatchWholeWord( ::sal_Bool _matchwholeword ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getMatchWildcards() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setMatchWildcards( ::sal_Bool _matchwildcards ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getMatchSoundsLike() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setMatchSoundsLike( ::sal_Bool _matchsoundslike ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getMatchAllWordForms() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setMatchAllWordForms( ::sal_Bool _matchallwordforms ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL getStyle() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setStyle( const css::uno::Any& _style ) throw (css::uno::RuntimeException);
-+
-+ // Methods
-+ virtual ::sal_Bool SAL_CALL Execute( const css::uno::Any& FindText, const css::uno::Any& MatchCase, const css::uno::Any& MatchWholeWord, const css::uno::Any& MatchWildcards, const css::uno::Any& MatchSoundsLike, const css::uno::Any& MatchAllWordForms, const css::uno::Any& Forward, const css::uno::Any& Wrap, const css::uno::Any& Format, const css::uno::Any& ReplaceWith, const css::uno::Any& Replace, const css::uno::Any& MatchKashida, const css::uno::Any& MatchDiacritics, const css::uno::Any& MatchAlefHamza, const css::uno::Any& MatchControl, const css::uno::Any& MatchPrefix, const css::uno::Any& MatchSuffix, const css::uno::Any& MatchPhrase, const css::uno::Any& IgnoreSpace, const css::uno::Any& IgnorePunct ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL ClearFormatting( ) throw (css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_FIND_HXX */
-diff --git sw/source/ui/vba/vbafont.cxx sw/source/ui/vba/vbafont.cxx
-new file mode 100644
-index 0000000..58fe73e
---- /dev/null
-+++ sw/source/ui/vba/vbafont.cxx
-@@ -0,0 +1,216 @@
-+#include "vbafont.hxx"
-+#include <com/sun/star/awt/FontUnderline.hpp>
-+#include <ooo/vba/word/WdUnderline.hpp>
-+#include <hash_map>
-+#include <ooo/vba/word/WdColorIndex.hpp>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+const uno::Any aLongAnyTrue( sal_Int16(-1) );
-+const uno::Any aLongAnyFalse( sal_Int16( 0 ) );
-+
-+struct MapPair
-+{
-+ sal_Int32 nMSOConst;
-+ sal_Int32 nOOOConst;
-+};
-+
-+static MapPair UnderLineTable[] = {
-+ { word::WdUnderline::wdUnderlineNone, com::sun::star::awt::FontUnderline::NONE },
-+ { word::WdUnderline::wdUnderlineSingle, com::sun::star::awt::FontUnderline::SINGLE },
-+ { word::WdUnderline::wdUnderlineWords, com::sun::star::awt::FontUnderline::SINGLE },
-+ { word::WdUnderline::wdUnderlineDouble, com::sun::star::awt::FontUnderline::DOUBLE },
-+ { word::WdUnderline::wdUnderlineDotted, com::sun::star::awt::FontUnderline::DOTTED },
-+ { word::WdUnderline::wdUnderlineThick, com::sun::star::awt::FontUnderline::BOLDDASH },
-+ { word::WdUnderline::wdUnderlineDash, com::sun::star::awt::FontUnderline::DASH },
-+ { word::WdUnderline::wdUnderlineDotDash, com::sun::star::awt::FontUnderline::DASHDOT },
-+ { word::WdUnderline::wdUnderlineDotDotDash, com::sun::star::awt::FontUnderline::DASHDOTDOT },
-+ { word::WdUnderline::wdUnderlineWavy, com::sun::star::awt::FontUnderline::WAVE },
-+ { word::WdUnderline::wdUnderlineDottedHeavy, com::sun::star::awt::FontUnderline::BOLDDOTTED },
-+ { word::WdUnderline::wdUnderlineDashHeavy, com::sun::star::awt::FontUnderline::BOLDDASH },
-+ { word::WdUnderline::wdUnderlineDotDashHeavy, com::sun::star::awt::FontUnderline::BOLDDASHDOT },
-+ { word::WdUnderline::wdUnderlineDotDotDashHeavy, com::sun::star::awt::FontUnderline::BOLDDASHDOTDOT },
-+ { word::WdUnderline::wdUnderlineWavyHeavy, com::sun::star::awt::FontUnderline::BOLDWAVE },
-+ { word::WdUnderline::wdUnderlineDashLong, com::sun::star::awt::FontUnderline::LONGDASH },
-+ { word::WdUnderline::wdUnderlineWavyDouble, com::sun::star::awt::FontUnderline::DOUBLEWAVE },
-+ { word::WdUnderline::wdUnderlineDashLongHeavy, com::sun::star::awt::FontUnderline::BOLDLONGDASH },
-+};
-+
-+typedef std::hash_map< sal_Int32, sal_Int32 > ConstToConst;
-+class UnderLineMapper
-+{
-+ ConstToConst MSO2OOO;
-+ ConstToConst OOO2MSO;
-+private:
-+ UnderLineMapper()
-+ {
-+ sal_Int32 nLen = sizeof( UnderLineTable )/ sizeof( UnderLineTable[0] );
-+
-+ for ( sal_Int32 index=0; index<nLen; ++index )
-+ {
-+ MSO2OOO[ UnderLineTable[ index ].nMSOConst ] = UnderLineTable[ index ].nOOOConst;
-+ OOO2MSO[ UnderLineTable[ index ].nOOOConst ] = UnderLineTable[ index ].nMSOConst;
-+ }
-+ }
-+public:
-+ static rtl::OUString propName()
-+ {
-+ static rtl::OUString sPropName( RTL_CONSTASCII_USTRINGPARAM("CharUnderline") );
-+ return sPropName;
-+ }
-+
-+ static UnderLineMapper& instance()
-+ {
-+ static UnderLineMapper theMapper;
-+ return theMapper;
-+ }
-+
-+ sal_Int32 getOOOFromMSO( sal_Int32 nMSOConst ) throw( lang::IllegalArgumentException )
-+ {
-+ ConstToConst::iterator it = MSO2OOO.find( nMSOConst );
-+ if ( it == MSO2OOO.end() )
-+ throw lang::IllegalArgumentException();
-+ return it->second;
-+ }
-+ sal_Int32 getMSOFromOOO( sal_Int32 nOOOConst ) throw( lang::IllegalArgumentException )
-+ {
-+ ConstToConst::iterator it = OOO2MSO.find( nOOOConst );
-+ if ( it == OOO2MSO.end() )
-+ throw lang::IllegalArgumentException();
-+ return it->second;
-+ }
-+};
-+
-+SwVbaFont::SwVbaFont( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xPalette, uno::Reference< css::beans::XPropertySet > xPropertySet ) throw ( css::uno::RuntimeException ) : SwVbaFont_BASE( xParent, xContext, xPalette, xPropertySet )
-+{
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaFont::getUnderline() throw (uno::RuntimeException)
-+{
-+ sal_Int32 nOOVal = 0;
-+ mxFont->getPropertyValue( UnderLineMapper::propName() ) >>= nOOVal;
-+ return uno::makeAny( UnderLineMapper::instance().getMSOFromOOO( nOOVal ) );
-+}
-+
-+void SAL_CALL
-+SwVbaFont::setUnderline( const uno::Any& _underline ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nMSOVal = 0;
-+
-+ if ( _underline >>= nMSOVal )
-+ {
-+ sal_Int32 nOOVal = UnderLineMapper::instance().getOOOFromMSO( nMSOVal );
-+ mxFont->setPropertyValue( UnderLineMapper::propName(), uno::makeAny( nOOVal ) );
-+ }
-+}
-+
-+rtl::OUString&
-+SwVbaFont::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaFont") );
-+ return sImplName;
-+}
-+
-+void SAL_CALL
-+SwVbaFont::setColorIndex( const uno::Any& _colorindex ) throw( uno::RuntimeException )
-+{
-+ sal_Int32 nIndex = 0;
-+ _colorindex >>= nIndex;
-+ return setColor( OORGBToXLRGB(mxPalette->getByIndex( nIndex )) );
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaFont::getColorIndex() throw ( uno::RuntimeException )
-+{
-+ sal_Int32 nColor = 0;
-+
-+ XLRGBToOORGB( getColor() ) >>= nColor;
-+ sal_Int32 nElems = mxPalette->getCount();
-+ sal_Int32 nIndex = 0;
-+ for ( sal_Int32 count=0; count<nElems; ++count )
-+ {
-+ sal_Int32 nPaletteColor = 0;
-+ mxPalette->getByIndex( count ) >>= nPaletteColor;
-+ if ( nPaletteColor == nColor )
-+ {
-+ nIndex = count;
-+ break;
-+ }
-+ }
-+ return uno::makeAny( nIndex );
-+}
-+uno::Any SAL_CALL
-+SwVbaFont::getSubscript() throw ( uno::RuntimeException )
-+{
-+ sal_Bool bRes = sal_False;
-+ SwVbaFont_BASE::getSubscript() >>= bRes;
-+ if ( bRes )
-+ return aLongAnyTrue;
-+ return aLongAnyFalse;
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaFont::getSuperscript() throw ( uno::RuntimeException )
-+{
-+ sal_Bool bRes = sal_False;
-+ SwVbaFont_BASE::getSuperscript() >>= bRes;
-+ if ( bRes )
-+ return aLongAnyTrue;
-+ return aLongAnyFalse;
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaFont::getBold() throw (uno::RuntimeException)
-+{
-+ sal_Bool bRes = sal_False;
-+ SwVbaFont_BASE::getBold() >>= bRes;
-+ if ( bRes )
-+ return aLongAnyTrue;
-+ return aLongAnyFalse;
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaFont::getItalic() throw (uno::RuntimeException)
-+{
-+ sal_Bool bRes = sal_False;
-+ SwVbaFont_BASE::getItalic() >>= bRes;
-+ if ( bRes )
-+ return aLongAnyTrue;
-+ return aLongAnyFalse;
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaFont::getStrikethrough() throw (css::uno::RuntimeException)
-+{
-+ sal_Bool bRes = sal_False;
-+ SwVbaFont_BASE::getStrikethrough() >>= bRes;
-+ if ( bRes )
-+ return aLongAnyTrue;
-+ return aLongAnyFalse;
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaFont::getShadow() throw (uno::RuntimeException)
-+{
-+ sal_Bool bRes = sal_False;
-+ SwVbaFont_BASE::getShadow() >>= bRes;
-+ if ( bRes )
-+ return aLongAnyTrue;
-+ return aLongAnyFalse;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaFont::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Font" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-+
-diff --git sw/source/ui/vba/vbafont.hxx sw/source/ui/vba/vbafont.hxx
-new file mode 100644
-index 0000000..85262ac
---- /dev/null
-+++ sw/source/ui/vba/vbafont.hxx
-@@ -0,0 +1,31 @@
-+#ifndef VBA_FONT_HXX
-+#define VBA_FONT_HXX
-+
-+#include <vbahelper/vbafontbase.hxx>
-+#include <ooo/vba/word/XFont.hpp>
-+
-+typedef cppu::ImplInheritanceHelper1< VbaFontBase, ov::word::XFont > SwVbaFont_BASE;
-+
-+class SwVbaFont : public SwVbaFont_BASE
-+{
-+public:
-+ SwVbaFont( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xPalette, css::uno::Reference< css::beans::XPropertySet > xPropertySet ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaFont(){}
-+
-+ // Attributes
-+ virtual void SAL_CALL setColorIndex( const css::uno::Any& _colorindex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL getColorIndex() 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 getSubscript() throw ( css::uno::RuntimeException );
-+ virtual css::uno::Any SAL_CALL getSuperscript() throw ( css::uno::RuntimeException );
-+
-+ virtual css::uno::Any SAL_CALL getBold() throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL getItalic() throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL getStrikethrough() throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL getShadow() throw (css::uno::RuntimeException);
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif
-diff --git sw/source/ui/vba/vbaglobals.cxx sw/source/ui/vba/vbaglobals.cxx
-index 38818fa..acf6b06 100644
---- sw/source/ui/vba/vbaglobals.cxx
-+++ sw/source/ui/vba/vbaglobals.cxx
-@@ -105,12 +105,35 @@ SwVbaGlobals::CommandBars( const uno::Any& aIndex ) throw (uno::RuntimeException
- return getApplication()->CommandBars( aIndex );
- }
-
-+uno::Any SAL_CALL
-+SwVbaGlobals::Documents( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ return getApplication()->Documents( index );
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaGlobals::Addins( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ return getApplication()->Addins( index );
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaGlobals::Dialogs( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ return getApplication()->Dialogs( index );
-+}
-+
- uno::Reference<word::XSelection > SAL_CALL
- SwVbaGlobals::getSelection() throw (uno::RuntimeException)
- {
- return getApplication()->getSelection();
- }
-
-+float SAL_CALL SwVbaGlobals::CentimetersToPoints( float _Centimeters ) throw (uno::RuntimeException)
-+{
-+ return getApplication()->CentimetersToPoints( _Centimeters );
-+}
-+
- rtl::OUString&
- SwVbaGlobals::getServiceImplName()
- {
-diff --git sw/source/ui/vba/vbaglobals.hxx sw/source/ui/vba/vbaglobals.hxx
-index 5c216b1..267b1ed 100644
---- sw/source/ui/vba/vbaglobals.hxx
-+++ sw/source/ui/vba/vbaglobals.hxx
-@@ -38,7 +38,6 @@
- #include <ooo/vba/word/XSystem.hpp>
- #include <ooo/vba/word/XOptions.hpp>
- #include <ooo/vba/word/XSelection.hpp>
--
- #include <cppuhelper/implbase1.hxx>
- #include <vbahelper/vbahelper.hxx>
- #include <vbahelper/vbaglobalbase.hxx>
-@@ -70,6 +69,10 @@ public:
- virtual css::uno::Reference< ooo::vba::word::XOptions > SAL_CALL getOptions() throw (css::uno::RuntimeException);
- virtual css::uno::Reference< ooo::vba::word::XSelection > SAL_CALL getSelection() 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 Documents( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Addins( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Dialogs( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual float SAL_CALL CentimetersToPoints( float _Centimeters ) throw (css::uno::RuntimeException);
- // XMultiServiceFactory
- virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames( ) throw (css::uno::RuntimeException);
-
-diff --git sw/source/ui/vba/vbaheaderfooter.cxx sw/source/ui/vba/vbaheaderfooter.cxx
-new file mode 100644
-index 0000000..c1eb4ec
---- /dev/null
-+++ sw/source/ui/vba/vbaheaderfooter.cxx
-@@ -0,0 +1,114 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbaheaderfooter.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include <ooo/vba/word/WdHeaderFooterIndex.hpp>
-+#include <com/sun/star/text/XText.hpp>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
-+#include "vbarange.hxx"
-+#include <vbahelper/vbashapes.hxx>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaHeaderFooter::SwVbaHeaderFooter( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< beans::XPropertySet >& rProps, sal_Bool isHeader, sal_Int32 index ) throw ( uno::RuntimeException ) : SwVbaHeaderFooter_BASE( rParent, rContext ), mxModel( xModel ), mxPageStyleProps( rProps ), mbHeader( isHeader ), mnIndex( index )
-+{
-+}
-+
-+sal_Bool SAL_CALL SwVbaHeaderFooter::getIsHeader() throw (uno::RuntimeException)
-+{
-+ return mbHeader;
-+}
-+
-+sal_Bool SAL_CALL SwVbaHeaderFooter::getLinkToPrevious() throw (uno::RuntimeException)
-+{
-+ // seems always false
-+ return sal_False;
-+}
-+
-+void SAL_CALL SwVbaHeaderFooter::setLinkToPrevious( ::sal_Bool _linktoprevious ) throw (uno::RuntimeException)
-+{
-+ // not support in Writer
-+}
-+
-+uno::Reference< word::XRange > SAL_CALL SwVbaHeaderFooter::getRange() throw (uno::RuntimeException)
-+{
-+ rtl::OUString sPropsNameText;
-+ if( mbHeader )
-+ {
-+ sPropsNameText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderText") );
-+ }
-+ else
-+ {
-+ sPropsNameText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterText") );
-+ }
-+ if( mnIndex = word::WdHeaderFooterIndex::wdHeaderFooterEvenPages )
-+ {
-+ sPropsNameText.concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Left") ) );
-+ }
-+
-+ uno::Reference< text::XText > xText( mxPageStyleProps->getPropertyValue( sPropsNameText ), uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextDocument > xDocument( mxModel, uno::UNO_QUERY_THROW );
-+ return uno::Reference< word::XRange >( new SwVbaRange( this, mxContext, xDocument, xText->getStart(), xText->getEnd(), xText ) );
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaHeaderFooter::Shapes( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxModel, uno::UNO_QUERY_THROW );
-+ //uno::Reference< drawing::XShapes > xShapes( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xIndexAccess( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
-+ uno::Reference< XCollection > xCol( new ScVbaShapes( this, mxContext, xIndexAccess ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+rtl::OUString&
-+SwVbaHeaderFooter::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaHeaderFooter") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaHeaderFooter::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Pane" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbaheaderfooter.hxx sw/source/ui/vba/vbaheaderfooter.hxx
-new file mode 100644
-index 0000000..4715994
---- /dev/null
-+++ sw/source/ui/vba/vbaheaderfooter.hxx
-@@ -0,0 +1,63 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_HEADERFOOTER_HXX
-+#define SW_VBA_HEADERFOOTER_HXX
-+
-+#include <ooo/vba/word/XHeaderFooter.hpp>
-+#include <ooo/vba/word/XRange.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XHeaderFooter > SwVbaHeaderFooter_BASE;
-+
-+class SwVbaHeaderFooter : public SwVbaHeaderFooter_BASE
-+{
-+private:
-+ css::uno::Reference< css::frame::XModel > mxModel;
-+ css::uno::Reference< css::beans::XPropertySet > mxPageStyleProps;
-+ sal_Bool mbHeader;
-+ sal_Int32 mnIndex;
-+
-+public:
-+ SwVbaHeaderFooter( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::beans::XPropertySet >& xProps, sal_Bool isHeader, sal_Int32 index ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaHeaderFooter(){}
-+
-+ // Attributes
-+ virtual ::sal_Bool SAL_CALL getIsHeader() throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getLinkToPrevious() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setLinkToPrevious( ::sal_Bool _linktoprevious ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Reference< ::ooo::vba::word::XRange > SAL_CALL getRange() throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Shapes( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_HEADERFOOTER_HXX */
-diff --git sw/source/ui/vba/vbaheaderfooterhelper.cxx sw/source/ui/vba/vbaheaderfooterhelper.cxx
-new file mode 100644
-index 0000000..4069b85
---- /dev/null
-+++ sw/source/ui/vba/vbaheaderfooterhelper.cxx
-@@ -0,0 +1,178 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbaheaderfooterhelper.hxx"
-+#include "wordvbahelper.hxx"
-+#include <comphelper/processfactory.hxx>
-+#include <com/sun/star/frame/XController.hpp>
-+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
-+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
-+#include <com/sun/star/container/XNameAccess.hpp>
-+
-+using namespace ::com::sun::star;
-+using namespace ::ooo::vba;
-+
-+#define FIRST_PAGE 1;
-+
-+// Class HeaderFooterHelper
-+
-+sal_Bool HeaderFooterHelper::isHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW );
-+
-+ sal_Bool isOn = sal_False;
-+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn"))) >>= isOn;
-+ if( !isOn )
-+ return sal_False;
-+
-+ sal_Bool isShared = sal_False;
-+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsShared"))) >>= isShared;
-+
-+ rtl::OUString aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderText") );
-+ if( !isShared )
-+ {
-+ if( 0 == xPageCursor->getPage() % 2 )
-+ {
-+ aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderTextLeft") );
-+ }
-+ else
-+ {
-+ aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderTextRight") );
-+ }
-+ }
-+
-+ uno::Reference< text::XText > xText( xStyleProps->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW );
-+ //FIXME: can not compare in this way?
-+ return ( xText == xCurrentText );
-+}
-+
-+sal_Bool HeaderFooterHelper::isFirstPageHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
-+{
-+ if( isHeader( xModel, xCurrentText ) )
-+ {
-+ uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
-+ // FIXME: getPage allways returns 1
-+ sal_Int32 nPage = xPageCursor->getPage();
-+ return nPage == FIRST_PAGE;
-+ }
-+ return sal_False;
-+}
-+
-+sal_Bool HeaderFooterHelper::isEvenPagesHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
-+{
-+ if( isHeader( xModel, xCurrentText ) )
-+ {
-+ uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW );
-+ sal_Bool isShared = sal_False;
-+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsShared"))) >>= isShared;
-+ if( !isShared )
-+ {
-+ uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
-+ return ( 0 == xPageCursor->getPage() % 2 );
-+ }
-+ }
-+ return sal_False;
-+}
-+
-+sal_Bool HeaderFooterHelper::isFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW );
-+
-+ sal_Bool isOn = sal_False;
-+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn"))) >>= isOn;
-+ if( !isOn )
-+ return sal_False;
-+
-+ sal_Bool isShared = sal_False;
-+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsShared"))) >>= isShared;
-+
-+ rtl::OUString aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterText") );
-+ if( !isShared )
-+ {
-+ if( 0 == xPageCursor->getPage() % 2 )
-+ {
-+ aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterTextLeft") );
-+ }
-+ else
-+ {
-+ aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterTextRight") );
-+ }
-+ }
-+
-+ uno::Reference< text::XText > xText( xStyleProps->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW );
-+
-+ return ( xText == xCurrentText );
-+}
-+
-+sal_Bool HeaderFooterHelper::isFirstPageFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
-+{
-+ if( isFooter( xModel, xCurrentText ) )
-+ {
-+ uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
-+ sal_Int32 nPage = xPageCursor->getPage();
-+ return nPage == FIRST_PAGE;
-+ }
-+ return sal_False;
-+}
-+
-+sal_Bool HeaderFooterHelper::isEvenPagesFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
-+{
-+ if( isFooter( xModel, xCurrentText ) )
-+ {
-+ uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW );
-+ sal_Bool isShared = sal_False;
-+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsShared"))) >>= isShared;
-+ if( !isShared )
-+ {
-+ uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
-+ return ( 0 == xPageCursor->getPage() % 2 );
-+ }
-+ }
-+ return sal_False;
-+}
-+
-+sal_Bool HeaderFooterHelper::isPrimaryHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
-+{
-+ if( isHeader( xModel, xCurrentText ) )
-+ {
-+ return( !( isFirstPageHeader( xModel, xCurrentText ) && isEvenPagesHeader( xModel, xCurrentText ) ) );
-+ }
-+ return sal_False;
-+}
-+
-+sal_Bool HeaderFooterHelper::isPrimaryFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
-+{
-+ if( isHeader( xModel, xCurrentText ) )
-+ {
-+ return( !( isFirstPageFooter( xModel, xCurrentText ) && isEvenPagesFooter( xModel, xCurrentText ) ) );
-+ }
-+ return sal_False;
-+}
-diff --git sw/source/ui/vba/vbaheaderfooterhelper.hxx sw/source/ui/vba/vbaheaderfooterhelper.hxx
-new file mode 100644
-index 0000000..2dffc59
---- /dev/null
-+++ sw/source/ui/vba/vbaheaderfooterhelper.hxx
-@@ -0,0 +1,52 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_WORD_VBA_HEADERFOOTERHELPER_HXX
-+#define SW_WORD_VBA_HEADERFOOTERHELPER_HXX
-+
-+#include <vbahelper/vbahelper.hxx>
-+#include <com/sun/star/text/XText.hpp>
-+#include <com/sun/star/text/XTextViewCursor.hpp>
-+#include <com/sun/star/text/XPageCursor.hpp>
-+#include <com/sun/star/style/XStyle.hpp>
-+
-+class HeaderFooterHelper
-+{
-+public:
-+ static sal_Bool isHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-+ static sal_Bool isFirstPageHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-+ static sal_Bool isEvenPagesHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-+ static sal_Bool isFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-+ static sal_Bool isFirstPageFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-+ static sal_Bool isEvenPagesFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-+ static sal_Bool isPrimaryHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-+ static sal_Bool isPrimaryFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-+};
-+
-+#endif
-diff --git sw/source/ui/vba/vbainformationhelper.cxx sw/source/ui/vba/vbainformationhelper.cxx
-new file mode 100644
-index 0000000..e062ed0
---- /dev/null
-+++ sw/source/ui/vba/vbainformationhelper.cxx
-@@ -0,0 +1,71 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbainformationhelper.hxx"
-+#include <com/sun/star/text/XPageCursor.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include "wordvbahelper.hxx"
-+#include <docsh.hxx>
-+#include <doc.hxx>
-+#include <vbahelper/vbahelper.hxx>
-+#include <swtypes.hxx>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+static const sal_Int32 DEFAULT_PAGE_DISTANCE = 500;
-+
-+sal_Int32 SwVbaInformationHelper::handleWdActiveEndPageNumber( const css::uno::Reference< css::text::XTextViewCursor >& xTVCursor ) throw( css::uno::RuntimeException )
-+{
-+ uno::Reference< text::XPageCursor > xPageCursor( xTVCursor, uno::UNO_QUERY_THROW );
-+ return xPageCursor->getPage();
-+}
-+
-+sal_Int32 SwVbaInformationHelper::handleWdNumberOfPagesInDocument( const css::uno::Reference< css::frame::XModel >& xModel ) throw( css::uno::RuntimeException )
-+{
-+ return word::getPageCount( xModel );
-+}
-+
-+double SwVbaInformationHelper::handleWdVerticalPositionRelativeToPage( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XTextViewCursor >& xTVCursor ) throw( css::uno::RuntimeException )
-+{
-+ xTVCursor->collapseToStart();
-+ uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW );
-+ sal_Int32 nTopMargin = 0;
-+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin") ) ) >>= nTopMargin;
-+ sal_Int32 nCurrentPos = xTVCursor->getPosition().Y;
-+
-+ sal_Int32 nCurrentPage = handleWdActiveEndPageNumber( xTVCursor );
-+ sal_Int32 nPageHeight = word::getDocShell( xModel )->GetDoc()->GetPageSize( nCurrentPage, sal_False ).Height();
-+ // FIXME: handle multipul page style
-+ // it is very strange that the curros position is incorrect when open Word file.
-+ // e.g. if current cursor in the top left of the text body of the first page without header,
-+ // the top value of current position should be 0, but is 201 when open a Word file.
-+ nCurrentPos = nCurrentPos + nTopMargin - ( DEFAULT_PAGE_DISTANCE + TWIP_TO_MM100( nPageHeight ) ) * ( nCurrentPage - 1 );
-+ return Millimeter::getInPoints( nCurrentPos );
-+}
-diff --git sw/source/ui/vba/vbainformationhelper.hxx sw/source/ui/vba/vbainformationhelper.hxx
-new file mode 100644
-index 0000000..96241bb
---- /dev/null
-+++ sw/source/ui/vba/vbainformationhelper.hxx
-@@ -0,0 +1,46 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_INFORMATIONHELPER_HXX
-+#define SW_VBA_INFORMATIONHELPER_HXX
-+
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/text/XTextViewCursor.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+
-+class SwVbaInformationHelper
-+{
-+public:
-+ static sal_Int32 handleWdActiveEndPageNumber( const css::uno::Reference< css::text::XTextViewCursor >& xTVCursor ) throw( css::uno::RuntimeException );
-+ static sal_Int32 handleWdNumberOfPagesInDocument( const css::uno::Reference< css::frame::XModel >& xModel ) throw( css::uno::RuntimeException );
-+ static double handleWdVerticalPositionRelativeToPage( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XTextViewCursor >& xTVCursor ) throw( css::uno::RuntimeException );
-+ //static double verticalPositionRelativeToPageBoundary( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XTextViewCursor >& xTVCursor, const css::uno::Reference< css::beans::XPropertySet >& xStyleProps ) throw( css::uno::RuntimeException );
-+
-+};
-+#endif /* SW_VBA_INFORMATIONHELPER_HXX */
-diff --git sw/source/ui/vba/vbaoptions.cxx sw/source/ui/vba/vbaoptions.cxx
-index 9066a76..eac6da7 100644
---- sw/source/ui/vba/vbaoptions.cxx
-+++ sw/source/ui/vba/vbaoptions.cxx
-@@ -30,6 +30,9 @@
- #include "vbaoptions.hxx"
- #include <vbahelper/vbahelper.hxx>
- #include <ooo/vba/word/WdDefaultFilePath.hpp>
-+#include <ooo/vba/word/WdLineStyle.hpp>
-+#include <ooo/vba/word/WdLineWidth.hpp>
-+#include <ooo/vba/word/WdColorIndex.hpp>
- #include <com/sun/star/util/XStringSubstitution.hpp>
- #include <com/sun/star/beans/XPropertySet.hpp>
- #include <osl/file.hxx>
-@@ -67,6 +70,11 @@ SwVbaOptions::DefaultFilePath( sal_Int32 _path ) throw ( uno::RuntimeException )
- msDefaultFilePath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Template") );
- break;
- }
-+ case word::WdDefaultFilePath::wdStartupPath:
-+ {
-+ msDefaultFilePath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Addin") );
-+ break;
-+ }
- case word::WdDefaultFilePath::wdUserOptionsPath:
- {
- msDefaultFilePath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UserConfig") );
-@@ -128,6 +136,137 @@ uno::Any SwVbaOptions::getValueEvent()
- return uno::makeAny( sPath );
- }
-
-+sal_Int32 SAL_CALL SwVbaOptions::getDefaultBorderLineStyle() throw (uno::RuntimeException)
-+{
-+ return word::WdLineStyle::wdLineStyleSingle;
-+}
-+
-+void SAL_CALL SwVbaOptions::setDefaultBorderLineStyle( ::sal_Int32 _defaultborderlinestyle ) throw (uno::RuntimeException)
-+{
-+ // not support in Writer
-+}
-+
-+sal_Int32 SAL_CALL SwVbaOptions::getDefaultBorderLineWidth() throw (uno::RuntimeException)
-+{
-+ return word::WdLineWidth::wdLineWidth050pt;
-+}
-+
-+void SAL_CALL SwVbaOptions::setDefaultBorderLineWidth( ::sal_Int32 _defaultborderlinewidth ) throw (uno::RuntimeException)
-+{
-+ // not support in Writer
-+}
-+
-+sal_Int32 SAL_CALL SwVbaOptions::getDefaultBorderColorIndex() throw (uno::RuntimeException)
-+{
-+ return word::WdColorIndex::wdAuto;
-+}
-+
-+void SAL_CALL SwVbaOptions::setDefaultBorderColorIndex( ::sal_Int32 _defaultbordercolorindex ) throw (uno::RuntimeException)
-+{
-+ // not support in Writer
-+}
-+
-+::sal_Bool SAL_CALL SwVbaOptions::getReplaceSelection() throw (uno::RuntimeException)
-+{
-+ return sal_True;
-+}
-+
-+void SAL_CALL SwVbaOptions::setReplaceSelection( ::sal_Bool _replaceselection ) throw (uno::RuntimeException)
-+{
-+ // not support in Writer
-+}
-+
-+::sal_Bool SAL_CALL SwVbaOptions::getMapPaperSize() throw (uno::RuntimeException)
-+{
-+ return sal_False;
-+}
-+
-+void SAL_CALL SwVbaOptions::setMapPaperSize( ::sal_Bool _mappapersize ) throw (uno::RuntimeException)
-+{
-+ // not support in Writer
-+}
-+
-+::sal_Bool SAL_CALL SwVbaOptions::getAutoFormatAsYouTypeApplyHeadings() throw (uno::RuntimeException)
-+{
-+ return sal_False;
-+}
-+
-+void SAL_CALL SwVbaOptions::setAutoFormatAsYouTypeApplyHeadings( ::sal_Bool _autoformatasyoutypeapplyheadings ) throw (uno::RuntimeException)
-+{
-+ // not support in Writer
-+}
-+
-+::sal_Bool SAL_CALL SwVbaOptions::getAutoFormatAsYouTypeApplyBulletedLists() throw (uno::RuntimeException)
-+{
-+ return sal_False;
-+}
-+
-+void SAL_CALL SwVbaOptions::setAutoFormatAsYouTypeApplyBulletedLists( ::sal_Bool _autoformatasyoutypeapplybulletedlists ) throw (uno::RuntimeException)
-+{
-+ // not support in Writer
-+}
-+
-+::sal_Bool SAL_CALL SwVbaOptions::getAutoFormatAsYouTypeApplyNumberedLists() throw (uno::RuntimeException)
-+{
-+ return sal_False;
-+}
-+
-+void SAL_CALL SwVbaOptions::setAutoFormatAsYouTypeApplyNumberedLists( ::sal_Bool _autoformatasyoutypeapplynumberedlists ) throw (uno::RuntimeException)
-+{
-+ // not support in Writer
-+}
-+
-+::sal_Bool SAL_CALL SwVbaOptions::getAutoFormatAsYouTypeFormatListItemBeginning() throw (uno::RuntimeException)
-+{
-+ return sal_False;
-+}
-+
-+void SAL_CALL SwVbaOptions::setAutoFormatAsYouTypeFormatListItemBeginning( ::sal_Bool _autoformatasyoutypeformatlistitembeginning ) throw (uno::RuntimeException)
-+{
-+ // not support in Writer
-+}
-+
-+::sal_Bool SAL_CALL SwVbaOptions::getAutoFormatAsYouTypeDefineStyles() throw (uno::RuntimeException)
-+{
-+ return sal_False;
-+}
-+
-+void SAL_CALL SwVbaOptions::setAutoFormatAsYouTypeDefineStyles( ::sal_Bool _autoformatasyoutypedefinestyles ) throw (uno::RuntimeException)
-+{
-+ // not support in Writer
-+}
-+
-+::sal_Bool SAL_CALL SwVbaOptions::getAutoFormatApplyHeadings() throw (uno::RuntimeException)
-+{
-+ return sal_False;
-+}
-+
-+void SAL_CALL SwVbaOptions::setAutoFormatApplyHeadings( ::sal_Bool _autoformatapplyheadings ) throw (uno::RuntimeException)
-+{
-+ // not support in Writer
-+}
-+
-+::sal_Bool SAL_CALL SwVbaOptions::getAutoFormatApplyLists() throw (uno::RuntimeException)
-+{
-+ return sal_False;
-+}
-+
-+void SAL_CALL SwVbaOptions::setAutoFormatApplyLists( ::sal_Bool _autoformatapplylists ) throw (uno::RuntimeException)
-+{
-+ // not support in Writer
-+}
-+
-+::sal_Bool SAL_CALL SwVbaOptions::getAutoFormatApplyBulletedLists() throw (uno::RuntimeException)
-+{
-+ return sal_False;
-+}
-+
-+void SAL_CALL SwVbaOptions::setAutoFormatApplyBulletedLists( ::sal_Bool _autoformatapplybulletedlists ) throw (uno::RuntimeException)
-+{
-+ // not support in Writer
-+}
-+
-+
- rtl::OUString&
- SwVbaOptions::getServiceImplName()
- {
-diff --git sw/source/ui/vba/vbaoptions.hxx sw/source/ui/vba/vbaoptions.hxx
-index a03b581..6ef6e44 100644
---- sw/source/ui/vba/vbaoptions.hxx
-+++ sw/source/ui/vba/vbaoptions.hxx
-@@ -48,7 +48,35 @@ public:
- SwVbaOptions( css::uno::Reference< css::uno::XComponentContext >& m_xContext ) throw ( css::uno::RuntimeException );
- virtual ~SwVbaOptions();
-
-- // XOptions
-+ // Attributes
-+ virtual ::sal_Int32 SAL_CALL getDefaultBorderLineStyle() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setDefaultBorderLineStyle( ::sal_Int32 _defaultborderlinestyle ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getDefaultBorderLineWidth() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setDefaultBorderLineWidth( ::sal_Int32 _defaultborderlinewidth ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getDefaultBorderColorIndex() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setDefaultBorderColorIndex( ::sal_Int32 _defaultbordercolorindex ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getReplaceSelection() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setReplaceSelection( ::sal_Bool _replaceselection ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getMapPaperSize() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setMapPaperSize( ::sal_Bool _mappapersize ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getAutoFormatAsYouTypeApplyHeadings() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setAutoFormatAsYouTypeApplyHeadings( ::sal_Bool _autoformatasyoutypeapplyheadings ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getAutoFormatAsYouTypeApplyBulletedLists() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setAutoFormatAsYouTypeApplyBulletedLists( ::sal_Bool _autoformatasyoutypeapplybulletedlists ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getAutoFormatAsYouTypeApplyNumberedLists() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setAutoFormatAsYouTypeApplyNumberedLists( ::sal_Bool _autoformatasyoutypeapplynumberedlists ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getAutoFormatAsYouTypeFormatListItemBeginning() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setAutoFormatAsYouTypeFormatListItemBeginning( ::sal_Bool _autoformatasyoutypeformatlistitembeginning ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getAutoFormatAsYouTypeDefineStyles() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setAutoFormatAsYouTypeDefineStyles( ::sal_Bool _autoformatasyoutypedefinestyles ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getAutoFormatApplyHeadings() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setAutoFormatApplyHeadings( ::sal_Bool _autoformatapplyheadings ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getAutoFormatApplyLists() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setAutoFormatApplyLists( ::sal_Bool _autoformatapplylists ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getAutoFormatApplyBulletedLists() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setAutoFormatApplyBulletedLists( ::sal_Bool _autoformatapplybulletedlists ) throw (css::uno::RuntimeException);
-+
-+ // Methods
- virtual css::uno::Any SAL_CALL DefaultFilePath( sal_Int32 _path ) throw ( css::uno::RuntimeException );
-
- //PropListener
-diff --git sw/source/ui/vba/vbapagesetup.cxx sw/source/ui/vba/vbapagesetup.cxx
-new file mode 100644
-index 0000000..96760e8
---- /dev/null
-+++ sw/source/ui/vba/vbapagesetup.cxx
-@@ -0,0 +1,275 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbapagesetup.hxx"
-+#include <com/sun/star/text/XText.hpp>
-+#include <com/sun/star/text/XPageCursor.hpp>
-+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
-+#include <com/sun/star/container/XNameAccess.hpp>
-+#include <ooo/vba/word/WdSectionStart.hpp>
-+#include <ooo/vba/word/WdOrientation.hpp>
-+#include "wordvbahelper.hxx"
-+
-+using namespace ::com::sun::star;
-+using namespace ::ooo::vba;
-+
-+SwVbaPageSetup::SwVbaPageSetup(const uno::Reference< XHelperInterface >& xParent,
-+ const uno::Reference< uno::XComponentContext >& xContext,
-+ const uno::Reference< frame::XModel >& xModel,
-+ const uno::Reference< beans::XPropertySet >& xProps ) throw (uno::RuntimeException):
-+ SwVbaPageSetup_BASE( xParent, xContext )
-+{
-+ mxModel.set( xModel, uno::UNO_QUERY_THROW );
-+ mxPageProps.set( xProps, uno::UNO_QUERY_THROW );
-+ mnOrientPortrait = word::WdOrientation::wdOrientPortrait;
-+ mnOrientLandscape = word::WdOrientation::wdOrientLandscape;
-+}
-+
-+double SAL_CALL SwVbaPageSetup::getGutter() throw (uno::RuntimeException)
-+{
-+ // not support in Writer
-+ return 0;
-+}
-+
-+void SAL_CALL SwVbaPageSetup::setGutter( double _gutter ) throw (uno::RuntimeException)
-+{
-+ // default add gutter into left margin
-+ if( _gutter != 0 )
-+ {
-+ double margin = VbaPageSetupBase::getLeftMargin() + _gutter;
-+ VbaPageSetupBase::setLeftMargin( margin );
-+ }
-+}
-+
-+double SAL_CALL SwVbaPageSetup::getHeaderDistance() throw (uno::RuntimeException)
-+{
-+ sal_Bool isHeaderOn = sal_False;
-+ mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn"))) >>= isHeaderOn;
-+ if( !isHeaderOn )
-+ mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn")), uno::makeAny( sal_True ) );
-+ return VbaPageSetupBase::getHeaderMargin();
-+}
-+
-+ /**
-+ * changes the value of TopMargin to the value of new MS-Word-HeaderDistance. Subtracts the difference
-+ * between old TopMargin and the new headerDistance from the value of HeaderSpacing (which defines the
-+ * space between the header and the body of the text). calculates the new HeaderHeight (= height of the
-+ * header + headerBodyDistance).
-+ *
-+ * @param: headerDistance is the value that is set in MS Word for the distance from the top of the page
-+ * to the header
-+ */
-+void SAL_CALL SwVbaPageSetup::setHeaderDistance( double _headerdistance ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 newHeaderDistance = Millimeter::getInHundredthsOfOneMillimeter( _headerdistance );
-+ sal_Bool isHeaderOn = sal_False;
-+ sal_Int32 aktTopMargin = 0;
-+ sal_Int32 aktSpacing = 0;
-+ sal_Int32 aktHeaderHeight = 0;
-+
-+ mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn"))) >>= isHeaderOn;
-+ if( !isHeaderOn )
-+ mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn")), uno::makeAny( sal_True ) );
-+
-+ mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin"))) >>= aktTopMargin;
-+ mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderBodyDistance"))) >>= aktSpacing;
-+ mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderHeight"))) >>= aktHeaderHeight;
-+
-+ sal_Int32 newSpacing = aktSpacing - ( newHeaderDistance - aktTopMargin );
-+ sal_Int32 height = aktHeaderHeight - aktSpacing;
-+ sal_Int32 newHeaderHeight = newSpacing + height;
-+
-+ mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin")), uno::makeAny( newHeaderDistance ) );
-+ mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderBodyDistance")), uno::makeAny( newSpacing ) );
-+ mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderHeight")), uno::makeAny( newHeaderHeight ) );
-+}
-+
-+double SAL_CALL SwVbaPageSetup::getFooterDistance() throw (uno::RuntimeException)
-+{
-+ sal_Bool isFooterOn = sal_False;
-+ mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn"))) >>= isFooterOn;
-+ if( !isFooterOn )
-+ mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn")), uno::makeAny( sal_True ) );
-+ return VbaPageSetupBase::getFooterMargin();
-+}
-+
-+void SAL_CALL SwVbaPageSetup::setFooterDistance( double _footerdistance ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 newFooterDistance = Millimeter::getInHundredthsOfOneMillimeter( _footerdistance );
-+ sal_Bool isFooterOn = sal_False;
-+ sal_Int32 aktBottomMargin = 0;
-+ sal_Int32 aktSpacing = 0;
-+ sal_Int32 aktFooterHeight = 0;
-+
-+ mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn"))) >>= isFooterOn;
-+ if( !isFooterOn )
-+ mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn")), uno::makeAny( sal_True ) );
-+
-+ mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin"))) >>= aktBottomMargin;
-+ mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterBodyDistance"))) >>= aktSpacing;
-+ mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterHeight"))) >>= aktFooterHeight;
-+
-+ sal_Int32 newSpacing = aktSpacing - ( newFooterDistance - aktBottomMargin );
-+ sal_Int32 height = aktFooterHeight - aktSpacing;
-+ sal_Int32 newFooterHeight = newSpacing + height;
-+
-+ mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin")), uno::makeAny( newFooterDistance ) );
-+ mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterBodyDistance")), uno::makeAny( newSpacing ) );
-+ mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterHeight")), uno::makeAny( newFooterHeight ) );
-+}
-+
-+sal_Bool SAL_CALL SwVbaPageSetup::getDifferentFirstPageHeaderFooter() throw (uno::RuntimeException)
-+{
-+ rtl::OUString pageStyle = getStyleOfFirstPage();
-+ if( pageStyle.equalsAscii( "First Page" ) )
-+ return sal_True;
-+
-+ return sal_False;
-+}
-+
-+void SAL_CALL SwVbaPageSetup::setDifferentFirstPageHeaderFooter( sal_Bool status ) throw (uno::RuntimeException)
-+{
-+ if( status == getDifferentFirstPageHeaderFooter() )
-+ return;
-+
-+ rtl::OUString newStyle;
-+ if( status )
-+ newStyle = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("First Page") );
-+ else
-+ newStyle = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Standard") );
-+
-+ uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( mxModel ), uno::UNO_QUERY_THROW );
-+ sal_Int32 nTopMargin = 0;
-+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin"))) >>= nTopMargin;
-+ sal_Int32 nBottomMargin = 0;
-+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin"))) >>= nBottomMargin;
-+ sal_Int32 nLeftMargin = 0;
-+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftMargin"))) >>= nLeftMargin;
-+ sal_Int32 nRightMargin = 0;
-+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightMargin"))) >>= nRightMargin;
-+ sal_Int32 nHeaderHeight = 0;
-+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderHeight"))) >>= nHeaderHeight;
-+ sal_Int32 nFooterHeight = 0;
-+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterHeight"))) >>= nFooterHeight;
-+
-+ sal_Bool isHeaderOn = sal_False;
-+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn"))) >>= isHeaderOn;
-+ if( isHeaderOn )
-+ {
-+ nTopMargin += nHeaderHeight;
-+ nBottomMargin += nFooterHeight;
-+ xStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn")), uno::makeAny( sal_False ) );
-+ xStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn")), uno::makeAny( sal_False ) );
-+ }
-+ uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( mxModel ), uno::UNO_QUERY_THROW );
-+ if( xPageCursor->getPage() != 1 )
-+ {
-+ xPageCursor->jumpToFirstPage();
-+ }
-+
-+ uno::Reference< beans::XPropertySet > xCursorProps( xPageCursor, uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xTableProps( xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ), uno::UNO_QUERY );
-+ if( xTableProps.is() )
-+ {
-+ xTableProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageDescName") ), uno::makeAny( newStyle ) );
-+ }
-+ else
-+ {
-+ xCursorProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageDescName") ), uno::makeAny( newStyle ) );
-+ }
-+
-+ uno::Reference< beans::XPropertySet > xFirstPageProps( word::getCurrentPageStyle( mxModel ), uno::UNO_QUERY_THROW );
-+ xFirstPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin") ), uno::makeAny( nTopMargin ) );
-+ xFirstPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin") ), uno::makeAny( nBottomMargin ) );
-+ xFirstPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftMargin") ), uno::makeAny( nLeftMargin ) );
-+ xFirstPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightMargin") ), uno::makeAny( nRightMargin ) );
-+}
-+
-+rtl::OUString SwVbaPageSetup::getStyleOfFirstPage() throw (uno::RuntimeException)
-+{
-+ rtl::OUString styleFirstPage;
-+ uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( mxModel ), uno::UNO_QUERY_THROW );
-+ if( xPageCursor->getPage() != 1 )
-+ {
-+ xPageCursor->jumpToFirstPage();
-+ }
-+
-+ uno::Reference< beans::XPropertySet > xCursorProps( xPageCursor, uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xTableProps( xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ), uno::UNO_QUERY );
-+ if( xTableProps.is() )
-+ {
-+ xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageDescName") ) ) >>= styleFirstPage;
-+ }
-+ else
-+ {
-+ xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageDescName") ) ) >>= styleFirstPage;
-+ }
-+ return styleFirstPage;
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaPageSetup::getSectionStart() throw (uno::RuntimeException)
-+{
-+ // FIXME:
-+ sal_Int32 wdSectionStart = word::WdSectionStart::wdSectionNewPage;
-+ uno::Reference< container::XNamed > xNamed( mxPageProps, uno::UNO_QUERY_THROW );
-+ rtl::OUString sStyleName = xNamed->getName();
-+ //mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ) ) >>= sStyleName;
-+ if( sStyleName.equalsAscii("Left Page") )
-+ wdSectionStart = word::WdSectionStart::wdSectionEvenPage;
-+ else if( sStyleName.equalsAscii("Right Page") )
-+ wdSectionStart = word::WdSectionStart::wdSectionOddPage;
-+ else
-+ wdSectionStart = word::WdSectionStart::wdSectionNewPage;
-+ return wdSectionStart;
-+}
-+
-+void SAL_CALL SwVbaPageSetup::setSectionStart( ::sal_Int32 _sectionstart ) throw (uno::RuntimeException)
-+{
-+ // fail to find corresponding feature in Writer
-+ // #FIXME:
-+}
-+
-+rtl::OUString&
-+SwVbaPageSetup::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaPageSetup") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaPageSetup::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.PageSetup" ) );
-+ }
-+ return aServiceNames;
-+}
-diff --git sw/source/ui/vba/vbapagesetup.hxx sw/source/ui/vba/vbapagesetup.hxx
-new file mode 100644
-index 0000000..db621ba
---- /dev/null
-+++ sw/source/ui/vba/vbapagesetup.hxx
-@@ -0,0 +1,70 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_PAGESETUP_HXX
-+#define SW_VBA_PAGESETUP_HXX
-+
-+#include <cppuhelper/implbase1.hxx>
-+#include <ooo/vba/word/XPageSetup.hpp>
-+#include <com/sun/star/uno/XComponentContext.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <vbahelper/vbapagesetupbase.hxx>
-+
-+typedef cppu::ImplInheritanceHelper1< VbaPageSetupBase, ooo::vba::word::XPageSetup > SwVbaPageSetup_BASE;
-+
-+class SwVbaPageSetup : public SwVbaPageSetup_BASE
-+{
-+private:
-+ rtl::OUString getStyleOfFirstPage() throw (css::uno::RuntimeException);
-+
-+public:
-+ SwVbaPageSetup( const css::uno::Reference< ooo::vba::XHelperInterface >& xParent,
-+ const css::uno::Reference< css::uno::XComponentContext >& xContext,
-+ const css::uno::Reference< css::frame::XModel >& xModel,
-+ const css::uno::Reference< css::beans::XPropertySet >& xProps ) throw (css::uno::RuntimeException);
-+ virtual ~SwVbaPageSetup(){}
-+
-+ // Attributes
-+ virtual double SAL_CALL getGutter() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setGutter( double _gutter ) throw (css::uno::RuntimeException);
-+ virtual double SAL_CALL getHeaderDistance() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setHeaderDistance( double _headerdistance ) throw (css::uno::RuntimeException);
-+ virtual double SAL_CALL getFooterDistance() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setFooterDistance( double _footerdistance ) throw (css::uno::RuntimeException);
-+ virtual sal_Bool SAL_CALL getDifferentFirstPageHeaderFooter() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setDifferentFirstPageHeaderFooter( sal_Bool status ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getSectionStart() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setSectionStart( ::sal_Int32 _sectionstart ) throw (css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif
-diff --git sw/source/ui/vba/vbapalette.cxx sw/source/ui/vba/vbapalette.cxx
-new file mode 100644
-index 0000000..9c7427d
---- /dev/null
-+++ sw/source/ui/vba/vbapalette.cxx
-@@ -0,0 +1,75 @@
-+#include "vbapalette.hxx"
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <ooo/vba/word/WdColor.hpp>
-+#include <ooo/vba/word/WdColorIndex.hpp>
-+
-+using namespace ::ooo::vba;
-+using namespace ::ooo::vba::word;
-+using namespace ::com::sun::star;
-+
-+static const sal_Int32 ColorTable[] =
-+{
-+WdColor::wdColorAutomatic, // 0
-+WdColor::wdColorBlack, // 1
-+WdColor::wdColorBlue, // 2
-+WdColor::wdColorTurquoise, // 3
-+WdColor::wdColorBrightGreen, // 4
-+WdColor::wdColorPink, // 5
-+WdColor::wdColorRed, // 6
-+WdColor::wdColorYellow, // 7
-+WdColor::wdColorWhite, // 8
-+WdColor::wdColorDarkBlue, // 9
-+WdColor::wdColorTeal, // 10
-+WdColor::wdColorGreen, // 11
-+WdColor::wdColorViolet, // 12
-+WdColor::wdColorDarkRed, // 13
-+WdColor::wdColorDarkYellow, // 14
-+WdColor::wdColorGray50, // 15
-+WdColor::wdColorGray25, // 16
-+};
-+
-+typedef ::cppu::WeakImplHelper1< container::XIndexAccess > XIndexAccess_BASE;
-+
-+class DefaultPalette : public XIndexAccess_BASE
-+{
-+public:
-+ DefaultPalette(){}
-+
-+ // Methods XIndexAccess
-+ virtual ::sal_Int32 SAL_CALL getCount() throw (uno::RuntimeException)
-+ {
-+ return sizeof(ColorTable) / sizeof(ColorTable[0]);
-+ }
-+
-+ virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( Index < 0 || Index >= getCount() )
-+ throw lang::IndexOutOfBoundsException();
-+ return uno::makeAny( sal_Int32( ColorTable[ Index ] ) );
-+ }
-+
-+ // Methods XElementAcess
-+ virtual uno::Type SAL_CALL getElementType() throw (uno::RuntimeException)
-+ {
-+ return ::getCppuType( (sal_Int32*)0 );
-+ }
-+ virtual ::sal_Bool SAL_CALL hasElements() throw (uno::RuntimeException)
-+ {
-+ return sal_True;
-+ }
-+
-+};
-+
-+VbaPalette::VbaPalette()
-+{
-+ mxPalette = new DefaultPalette();
-+}
-+
-+uno::Reference< container::XIndexAccess >
-+VbaPalette::getPalette() const
-+{
-+
-+ return mxPalette;
-+}
-+
-diff --git sw/source/ui/vba/vbapalette.hxx sw/source/ui/vba/vbapalette.hxx
-new file mode 100644
-index 0000000..130e405
---- /dev/null
-+++ sw/source/ui/vba/vbapalette.hxx
-@@ -0,0 +1,15 @@
-+#ifndef VBAPALETTE_HXX
-+#define VBAPALETTE_HXX
-+#include <vbahelper/vbahelper.hxx>
-+
-+class VbaPalette
-+{
-+ css::uno::Reference< css::container::XIndexAccess > mxPalette;
-+public:
-+ VbaPalette();
-+ // 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() const;
-+};
-+
-+#endif
-diff --git sw/source/ui/vba/vbaparagraph.cxx sw/source/ui/vba/vbaparagraph.cxx
-new file mode 100644
-index 0000000..107ff33
---- /dev/null
-+++ sw/source/ui/vba/vbaparagraph.cxx
-@@ -0,0 +1,177 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbaparagraph.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include "vbarange.hxx"
-+#include <com/sun/star/lang/XServiceInfo.hpp>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaParagraph::SwVbaParagraph( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& xDocument, const uno::Reference< text::XTextRange >& xTextRange ) throw ( uno::RuntimeException ) :
-+ SwVbaParagraph_BASE( rParent, rContext ), mxTextDocument( xDocument ), mxTextRange( xTextRange )
-+{
-+}
-+
-+SwVbaParagraph::~SwVbaParagraph()
-+{
-+}
-+
-+uno::Reference< word::XRange > SAL_CALL
-+SwVbaParagraph::getRange( ) throw ( uno::RuntimeException )
-+{
-+ return uno::Reference< word::XRange >( new SwVbaRange( this, mxContext, mxTextDocument, mxTextRange->getStart(), mxTextRange->getEnd(), mxTextRange->getText(), sal_True ) );
-+}
-+
-+rtl::OUString&
-+SwVbaParagraph::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaParagraph") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaParagraph::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Paragraph" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-+
-+//typedef ::cppu::WeakImplHelper1< container::XEnumeration > ParagraphEnumeration_BASE;
-+typedef ::cppu::WeakImplHelper2< container::XIndexAccess, container::XEnumerationAccess > ParagraphCollectionHelper_BASE;
-+
-+class ParagraphCollectionHelper : public ParagraphCollectionHelper_BASE
-+{
-+private:
-+ uno::Reference< text::XTextDocument > mxTextDocument;
-+
-+ uno::Reference< container::XEnumeration > getEnumeration() throw (uno::RuntimeException)
-+ {
-+ uno::Reference< container::XEnumerationAccess > xParEnumAccess( mxTextDocument->getText(), uno::UNO_QUERY_THROW );
-+ return xParEnumAccess->createEnumeration();
-+ }
-+
-+public:
-+ ParagraphCollectionHelper( const uno::Reference< text::XTextDocument >& xDocument ) throw (uno::RuntimeException): mxTextDocument( xDocument )
-+ {
-+ }
-+ // XElementAccess
-+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) { return text::XTextRange::static_type(0); }
-+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) { return sal_True; }
-+ // XIndexAccess
-+ virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
-+ {
-+ sal_Int32 nCount = 0;
-+ uno::Reference< container::XEnumeration > xParEnum = getEnumeration();
-+ while( xParEnum->hasMoreElements() )
-+ {
-+ uno::Reference< lang::XServiceInfo > xServiceInfo( xParEnum->nextElement(), uno::UNO_QUERY_THROW );
-+ if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.Paragraph") ) ) )
-+ {
-+ nCount++;
-+ }
-+ }
-+ return nCount;
-+ }
-+ virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
-+ {
-+ if( Index < getCount() )
-+ {
-+ sal_Int32 nCount = 0;
-+ uno::Reference< container::XEnumeration > xParEnum = getEnumeration();
-+ while( xParEnum->hasMoreElements() )
-+ {
-+ uno::Reference< lang::XServiceInfo > xServiceInfo( xParEnum->nextElement(), uno::UNO_QUERY_THROW );
-+ if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.Paragraph") ) ) )
-+ {
-+ if( Index == nCount )
-+ return uno::makeAny( xServiceInfo );
-+ nCount++;
-+ }
-+ }
-+ }
-+ throw lang::IndexOutOfBoundsException();
-+ }
-+ // XEnumerationAccess
-+ virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
-+ {
-+ return getEnumeration();
-+ }
-+};
-+
-+SwVbaParagraphs::SwVbaParagraphs( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext, const uno::Reference< text::XTextDocument >& xDocument ) throw (uno::RuntimeException) : SwVbaParagraphs_BASE( xParent, xContext, new ParagraphCollectionHelper( xDocument ) ), mxTextDocument( xDocument )
-+{
-+}
-+
-+// XEnumerationAccess
-+uno::Type
-+SwVbaParagraphs::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XParagraph::static_type(0);
-+}
-+uno::Reference< container::XEnumeration >
-+SwVbaParagraphs::createEnumeration() throw (uno::RuntimeException)
-+{
-+ uno::Reference< container::XEnumerationAccess > xEnumerationAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
-+ return xEnumerationAccess->createEnumeration();
-+}
-+
-+uno::Any
-+SwVbaParagraphs::createCollectionObject( const css::uno::Any& aSource )
-+{
-+ uno::Reference< text::XTextRange > xTextRange( aSource, uno::UNO_QUERY_THROW );
-+ return uno::makeAny( uno::Reference< word::XParagraph >( new SwVbaParagraph( this, mxContext, mxTextDocument, xTextRange ) ) );
-+}
-+
-+rtl::OUString&
-+SwVbaParagraphs::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaParagraphs") );
-+ return sImplName;
-+}
-+
-+css::uno::Sequence<rtl::OUString>
-+SwVbaParagraphs::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Paragraphs") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbaparagraph.hxx sw/source/ui/vba/vbaparagraph.hxx
-new file mode 100644
-index 0000000..979116d
---- /dev/null
-+++ sw/source/ui/vba/vbaparagraph.hxx
-@@ -0,0 +1,84 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_PARAGRAPH_HXX
-+#define SW_VBA_PARAGRAPH_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XParagraphs.hpp>
-+#include <ooo/vba/word/XParagraph.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/text/XTextRange.hpp>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XParagraph > SwVbaParagraph_BASE;
-+
-+class SwVbaParagraph : public SwVbaParagraph_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XTextDocument > mxTextDocument;
-+ css::uno::Reference< css::text::XTextRange > mxTextRange;
-+
-+public:
-+ SwVbaParagraph( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& xDocument, const css::uno::Reference< css::text::XTextRange >& xTextRange ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaParagraph();
-+
-+ // XParagraph
-+ virtual css::uno::Reference< ooo::vba::word::XRange > SAL_CALL getRange() throw ( css::uno::RuntimeException );
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+
-+/* class SwVbaParagraphs */
-+typedef CollTestImplHelper< ooo::vba::word::XParagraphs > SwVbaParagraphs_BASE;
-+
-+class SwVbaParagraphs : public SwVbaParagraphs_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XTextDocument > mxTextDocument;
-+public:
-+ SwVbaParagraphs( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::text::XTextDocument >& xDocument ) throw (css::uno::RuntimeException);
-+ virtual ~SwVbaParagraphs() {}
-+
-+ // 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);
-+
-+ // SwVbaParagraphs_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* SW_VBA_PARAGRAPH_HXX */
-diff --git sw/source/ui/vba/vbaparagraphformat.cxx sw/source/ui/vba/vbaparagraphformat.cxx
-new file mode 100644
-index 0000000..7726d48
---- /dev/null
-+++ sw/source/ui/vba/vbaparagraphformat.cxx
-@@ -0,0 +1,576 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbaparagraphformat.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include "wordvbahelper.hxx"
-+#include <com/sun/star/style/LineSpacingMode.hpp>
-+#include <ooo/vba/word/WdLineSpacing.hpp>
-+#include <ooo/vba/word/WdParagraphAlignment.hpp>
-+#include <ooo/vba/word/WdOutlineLevel.hpp>
-+#include <com/sun/star/style/ParagraphAdjust.hpp>
-+#include <com/sun/star/style/BreakType.hpp>
-+
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+static const sal_Int16 CHARACTER_INDENT_FACTOR = 12;
-+static const sal_Int16 PERCENT100 = 100;
-+static const sal_Int16 PERCENT150 = 150;
-+static const sal_Int16 PERCENT200 = 200;
-+
-+SwVbaParagraphFormat::SwVbaParagraphFormat( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& rTextDocument, const uno::Reference< beans::XPropertySet >& rParaProps ) : SwVbaParagraphFormat_BASE( rParent, rContext ), mxTextDocument( rTextDocument ), mxParaProps( rParaProps )
-+{
-+}
-+
-+SwVbaParagraphFormat::~SwVbaParagraphFormat()
-+{
-+}
-+
-+sal_Int32 SAL_CALL SwVbaParagraphFormat::getAlignment() throw (uno::RuntimeException)
-+{
-+ style::ParagraphAdjust aParaAdjust = style::ParagraphAdjust_LEFT;
-+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaAdjust") ) ) >>= aParaAdjust;
-+ return getMSWordAlignment( aParaAdjust );
-+}
-+
-+void SAL_CALL SwVbaParagraphFormat::setAlignment( sal_Int32 _alignment ) throw (uno::RuntimeException)
-+{
-+ style::ParagraphAdjust aParaAdjust = ( style::ParagraphAdjust ) getOOoAlignment( _alignment );
-+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaAdjust") ), uno::makeAny( aParaAdjust ) );
-+}
-+
-+float SAL_CALL SwVbaParagraphFormat::getFirstLineIndent() throw (uno::RuntimeException)
-+{
-+ sal_Int32 indent = 0;
-+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaFirstLineIndent") ) ) >>= indent;
-+ return (float)( Millimeter::getInPoints( indent ) );
-+}
-+
-+void SAL_CALL SwVbaParagraphFormat::setFirstLineIndent( float _firstlineindent ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 indent = Millimeter::getInHundredthsOfOneMillimeter( _firstlineindent );
-+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaFirstLineIndent") ), uno::makeAny( indent ) );
-+}
-+
-+uno::Any SAL_CALL SwVbaParagraphFormat::getKeepTogether() throw (uno::RuntimeException)
-+{
-+ sal_Bool bKeep = sal_False;
-+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaKeepTogether") ) ) >>= bKeep;
-+ return uno::makeAny ( bKeep );
-+}
-+
-+void SAL_CALL SwVbaParagraphFormat::setKeepTogether( const uno::Any& _keeptogether ) throw (uno::RuntimeException)
-+{
-+ sal_Bool bKeep = sal_False;
-+ if( _keeptogether >>= bKeep )
-+ {
-+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaKeepTogether") ), uno::makeAny( bKeep ) );
-+ }
-+ else
-+ {
-+ DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() );
-+ }
-+}
-+
-+uno::Any SAL_CALL SwVbaParagraphFormat::getKeepWithNext() throw (uno::RuntimeException)
-+{
-+ sal_Bool bKeep = sal_False;
-+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaSplit") ) ) >>= bKeep;
-+ return uno::makeAny ( bKeep );
-+}
-+
-+void SAL_CALL SwVbaParagraphFormat::setKeepWithNext( const uno::Any& _keepwithnext ) throw (uno::RuntimeException)
-+{
-+ sal_Bool bKeep = sal_False;
-+ if( _keepwithnext >>= bKeep )
-+ {
-+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaSplit") ), uno::makeAny( bKeep ) );
-+ }
-+ else
-+ {
-+ DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() );
-+ }
-+}
-+
-+uno::Any SAL_CALL SwVbaParagraphFormat::getHyphenation() throw (uno::RuntimeException)
-+{
-+ sal_Bool bHypn = sal_False;
-+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaIsHyphenation") ) ) >>= bHypn;
-+ return uno::makeAny ( bHypn );
-+}
-+
-+void SAL_CALL SwVbaParagraphFormat::setHyphenation( const uno::Any& _hyphenation ) throw (uno::RuntimeException)
-+{
-+ sal_Bool bHypn = sal_False;
-+ if( _hyphenation >>= bHypn )
-+ {
-+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaIsHyphenation") ), uno::makeAny( bHypn ) );
-+ }
-+ else
-+ {
-+ DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() );
-+ }
-+}
-+
-+float SAL_CALL SwVbaParagraphFormat::getLineSpacing() throw (uno::RuntimeException)
-+{
-+ style::LineSpacing aLineSpacing;
-+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLineSpacing") ) ) >>= aLineSpacing;
-+ return getMSWordLineSpacing( aLineSpacing );
-+}
-+
-+void SAL_CALL SwVbaParagraphFormat::setLineSpacing( float _linespacing ) throw (uno::RuntimeException)
-+{
-+ style::LineSpacing aLineSpacing;
-+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLineSpacing") ) ) >>= aLineSpacing;
-+ aLineSpacing = getOOoLineSpacing( _linespacing, aLineSpacing.Mode );
-+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLineSpacing") ), uno::makeAny( aLineSpacing ) );
-+}
-+
-+sal_Int32 SAL_CALL SwVbaParagraphFormat::getLineSpacingRule() throw (uno::RuntimeException)
-+{
-+ style::LineSpacing aLineSpacing;
-+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLineSpacing") ) ) >>= aLineSpacing;
-+ return getMSWordLineSpacingRule( aLineSpacing );
-+}
-+
-+void SAL_CALL SwVbaParagraphFormat::setLineSpacingRule( sal_Int32 _linespacingrule ) throw (uno::RuntimeException)
-+{
-+ style::LineSpacing aLineSpacing = getOOoLineSpacingFromRule( _linespacingrule );
-+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLineSpacing") ), uno::makeAny( aLineSpacing ) );
-+}
-+
-+uno::Any SAL_CALL SwVbaParagraphFormat::getNoLineNumber() throw (uno::RuntimeException)
-+{
-+ sal_Bool noLineNum = sal_False;
-+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLineNumberCount") ) ) >>= noLineNum;
-+ return uno::makeAny ( noLineNum );
-+}
-+
-+void SAL_CALL SwVbaParagraphFormat::setNoLineNumber( const uno::Any& _nolinenumber ) throw (uno::RuntimeException)
-+{
-+ sal_Bool noLineNum = sal_False;
-+ if( _nolinenumber >>= noLineNum )
-+ {
-+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLineNumberCount") ), uno::makeAny( noLineNum ) );
-+ }
-+ else
-+ {
-+ DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() );
-+ }
-+}
-+
-+sal_Int32 SAL_CALL SwVbaParagraphFormat::getOutlineLevel() throw (uno::RuntimeException)
-+{
-+ sal_Int32 nLevel = word::WdOutlineLevel::wdOutlineLevelBodyText;
-+ rtl::OUString aHeading;
-+ const rtl::OUString HEADING = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Heading") );
-+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaStyleName") ) ) >>= aHeading;
-+ if( aHeading.indexOf( HEADING ) == 0 )
-+ {
-+ // get the sub string after "Heading"
-+ nLevel = aHeading.copy( HEADING.getLength() ).toInt32();
-+ }
-+ return nLevel;
-+}
-+
-+void SAL_CALL SwVbaParagraphFormat::setOutlineLevel( sal_Int32 _outlinelevel ) throw (uno::RuntimeException)
-+{
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+}
-+
-+uno::Any SAL_CALL SwVbaParagraphFormat::getPageBreakBefore() throw (uno::RuntimeException)
-+{
-+ style::BreakType aBreakType;
-+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BreakType") ) ) >>= aBreakType;
-+ sal_Bool bBreakBefore = ( aBreakType == style::BreakType_PAGE_BEFORE || aBreakType == style::BreakType_PAGE_BOTH );
-+ return uno::makeAny( bBreakBefore );
-+}
-+
-+void SAL_CALL SwVbaParagraphFormat::setPageBreakBefore( const uno::Any& _breakbefore ) throw (uno::RuntimeException)
-+{
-+ sal_Bool bBreakBefore = sal_False;
-+ if( _breakbefore >>= bBreakBefore )
-+ {
-+ style::BreakType aBreakType;
-+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BreakType") ) ) >>= aBreakType;
-+ if( bBreakBefore )
-+ {
-+ if( aBreakType == style::BreakType_NONE )
-+ aBreakType = style::BreakType_PAGE_BEFORE;
-+ else if ( aBreakType == style::BreakType_PAGE_AFTER )
-+ aBreakType = style::BreakType_PAGE_BOTH;
-+ }
-+ else
-+ {
-+ if( aBreakType == style::BreakType_PAGE_BOTH )
-+ aBreakType = style::BreakType_PAGE_AFTER;
-+ else if ( aBreakType == style::BreakType_PAGE_BEFORE )
-+ aBreakType = style::BreakType_PAGE_AFTER;
-+ }
-+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BreakType") ), uno::makeAny( aBreakType ) );
-+ }
-+ else
-+ {
-+ DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() );
-+ }
-+}
-+
-+float SAL_CALL SwVbaParagraphFormat::getSpaceBefore() throw (uno::RuntimeException)
-+{
-+ sal_Int32 nSpace;
-+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaTopMargin") ) ) >>= nSpace;
-+ return (float)( Millimeter::getInPoints( nSpace ) );
-+}
-+
-+void SAL_CALL SwVbaParagraphFormat::setSpaceBefore( float _space ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nSpace = Millimeter::getInHundredthsOfOneMillimeter( _space );
-+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaTopMargin") ), uno::makeAny( nSpace ) );
-+}
-+
-+float SAL_CALL SwVbaParagraphFormat::getSpaceAfter() throw (uno::RuntimeException)
-+{
-+ sal_Int32 nSpace = 0;
-+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaBottomMargin") ) ) >>= nSpace;
-+ return (float)( Millimeter::getInPoints( nSpace ) );
-+}
-+
-+void SAL_CALL SwVbaParagraphFormat::setSpaceAfter( float _space ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nSpace = Millimeter::getInHundredthsOfOneMillimeter( _space );
-+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaBottomMargin") ), uno::makeAny( nSpace ) );
-+}
-+
-+float SAL_CALL SwVbaParagraphFormat::getLeftIndent() throw (uno::RuntimeException)
-+{
-+ sal_Int32 nIndent = 0;
-+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLeftMargin") ) ) >>= nIndent;
-+ return (float)( Millimeter::getInPoints( nIndent ) );
-+}
-+
-+void SAL_CALL SwVbaParagraphFormat::setLeftIndent( float _leftindent ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nIndent = Millimeter::getInHundredthsOfOneMillimeter( _leftindent );
-+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLeftMargin") ), uno::makeAny( nIndent ) );
-+}
-+
-+float SAL_CALL SwVbaParagraphFormat::getRightIndent() throw (uno::RuntimeException)
-+{
-+ sal_Int32 nIndent = 0;
-+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaRightMargin") ) ) >>= nIndent;
-+ return (float)( Millimeter::getInPoints( nIndent ) );
-+}
-+
-+void SAL_CALL SwVbaParagraphFormat::setRightIndent( float _rightindent ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nIndent = Millimeter::getInHundredthsOfOneMillimeter( _rightindent );
-+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaRightMargin") ), uno::makeAny( nIndent ) );
-+}
-+
-+uno::Any SAL_CALL SwVbaParagraphFormat::getTabStops() throw (uno::RuntimeException)
-+{
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+}
-+
-+void SAL_CALL SwVbaParagraphFormat::setTabStops( const uno::Any& _tabstops ) throw (uno::RuntimeException)
-+{
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+}
-+
-+uno::Any SAL_CALL SwVbaParagraphFormat::getWidowControl() throw (uno::RuntimeException)
-+{
-+ sal_Bool bWidow = sal_False;
-+ sal_Int8 nWidow = 0;
-+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaWidows") ) ) >>= nWidow;
-+ sal_Int8 nOrphan = 0;
-+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaOrphans") ) ) >>= nOrphan;
-+ // if the amount of single lines on one page > 1 and the same of start and end of the paragraph,
-+ // true is retured.
-+ bWidow = ( nWidow > 1 && nOrphan == nWidow );
-+ return uno::makeAny( bWidow );
-+}
-+
-+void SAL_CALL SwVbaParagraphFormat::setWidowControl( const uno::Any& _widowcontrol ) throw (uno::RuntimeException)
-+{
-+ // if we get true, the part of the paragraph on one page has to be
-+ // at least two lines
-+ sal_Bool bWidow = sal_False;
-+ if( _widowcontrol >>= bWidow )
-+ {
-+ sal_Int8 nControl = bWidow? 2:1;
-+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaWidows") ), uno::makeAny( nControl ) );
-+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaOrphans") ), uno::makeAny( nControl ) );
-+ }
-+ else
-+ {
-+ DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() );
-+ }
-+}
-+
-+style::LineSpacing SwVbaParagraphFormat::getOOoLineSpacing( float _lineSpace, sal_Int16 mode )
-+{
-+ style::LineSpacing aLineSpacing;
-+ if( mode != style::LineSpacingMode::MINIMUM && mode != style::LineSpacingMode::FIX )
-+ {
-+ // special behaviour of word: if the space is set to these values, the rule and
-+ // the height are changed accordingly
-+ if( _lineSpace == CHARACTER_INDENT_FACTOR )
-+ {
-+ aLineSpacing.Mode = style::LineSpacingMode::PROP;
-+ aLineSpacing.Height = PERCENT100;
-+ }
-+ else if( _lineSpace == ( sal_Int16 )( CHARACTER_INDENT_FACTOR * 1.5 ) )
-+ {
-+ aLineSpacing.Mode = style::LineSpacingMode::PROP;
-+ aLineSpacing.Height = PERCENT150;
-+ }
-+ else if( _lineSpace == ( sal_Int16 )( ( CHARACTER_INDENT_FACTOR ) * 2 ) )
-+ {
-+ aLineSpacing.Mode = style::LineSpacingMode::PROP;
-+ aLineSpacing.Height = PERCENT200;
-+ }
-+ else
-+ {
-+ aLineSpacing.Mode = style::LineSpacingMode::FIX;
-+ aLineSpacing.Height = ( sal_Int16 )( Millimeter::getInHundredthsOfOneMillimeter( _lineSpace ) );
-+ }
-+ }
-+ else
-+ {
-+ aLineSpacing.Mode = mode;
-+ aLineSpacing.Height = ( sal_Int16 )( Millimeter::getInHundredthsOfOneMillimeter( _lineSpace ) );
-+ }
-+ return aLineSpacing;
-+}
-+
-+style::LineSpacing SwVbaParagraphFormat::getOOoLineSpacingFromRule( sal_Int32 _linespacingrule )
-+{
-+ style::LineSpacing aLineSpacing;
-+ switch( _linespacingrule )
-+ {
-+ case word::WdLineSpacing::wdLineSpace1pt5:
-+ {
-+ aLineSpacing.Mode = style::LineSpacingMode::PROP;
-+ aLineSpacing.Height = PERCENT150;
-+ break;
-+ }
-+ case word::WdLineSpacing::wdLineSpaceAtLeast:
-+ {
-+ aLineSpacing.Mode = style::LineSpacingMode::MINIMUM;
-+ aLineSpacing.Height = getCharHeight();
-+ break;
-+ }
-+ case word::WdLineSpacing::wdLineSpaceDouble:
-+ {
-+ aLineSpacing.Mode = style::LineSpacingMode::PROP;
-+ aLineSpacing.Height = getCharHeight();
-+ break;
-+ }
-+ case word::WdLineSpacing::wdLineSpaceExactly:
-+ case word::WdLineSpacing::wdLineSpaceMultiple:
-+ {
-+ aLineSpacing.Mode = style::LineSpacingMode::FIX;
-+ aLineSpacing.Height = getCharHeight();
-+ break;
-+ }
-+ case word::WdLineSpacing::wdLineSpaceSingle:
-+ {
-+ aLineSpacing.Mode = style::LineSpacingMode::PROP;
-+ aLineSpacing.Height = PERCENT100;
-+ break;
-+ }
-+ default:
-+ {
-+ DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() );
-+ break;
-+ }
-+ }
-+ return aLineSpacing;
-+}
-+
-+float SwVbaParagraphFormat::getMSWordLineSpacing( style::LineSpacing& rLineSpacing )
-+{
-+ float wdLineSpacing = 0;
-+ if( rLineSpacing.Mode != style::LineSpacingMode::PROP )
-+ {
-+ wdLineSpacing = (float)( Millimeter::getInPoints( rLineSpacing.Height ) );
-+ }
-+ else
-+ {
-+ wdLineSpacing = (float)( CHARACTER_INDENT_FACTOR * rLineSpacing.Height ) / PERCENT100;
-+ }
-+ return wdLineSpacing;
-+}
-+
-+sal_Int32 SwVbaParagraphFormat::getMSWordLineSpacingRule( style::LineSpacing& rLineSpacing )
-+{
-+ sal_Int32 wdLineSpacing = word::WdLineSpacing::wdLineSpaceSingle;
-+ switch( rLineSpacing.Mode )
-+ {
-+ case style::LineSpacingMode::PROP:
-+ {
-+ switch( rLineSpacing.Height )
-+ {
-+ case PERCENT100:
-+ {
-+ wdLineSpacing = word::WdLineSpacing::wdLineSpaceSingle;
-+ break;
-+ }
-+ case PERCENT150:
-+ {
-+ wdLineSpacing = word::WdLineSpacing::wdLineSpace1pt5;
-+ break;
-+ }
-+ case PERCENT200:
-+ {
-+ wdLineSpacing = word::WdLineSpacing::wdLineSpaceDouble;
-+ break;
-+ }
-+ default:
-+ {
-+ wdLineSpacing = word::WdLineSpacing::wdLineSpaceMultiple;
-+ }
-+ }
-+ break;
-+ }
-+ case style::LineSpacingMode::MINIMUM:
-+ {
-+ wdLineSpacing = word::WdLineSpacing::wdLineSpaceAtLeast;
-+ break;
-+ }
-+ case style::LineSpacingMode::FIX:
-+ case style::LineSpacingMode::LEADING:
-+ {
-+ wdLineSpacing = word::WdLineSpacing::wdLineSpaceExactly;
-+ break;
-+ }
-+ default:
-+ {
-+ DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() );
-+ }
-+ }
-+ return wdLineSpacing;
-+}
-+
-+sal_Int16 SwVbaParagraphFormat::getCharHeight() throw (uno::RuntimeException)
-+{
-+ float fCharHeight;
-+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CharHeight") ) ) >>= fCharHeight;
-+ return (sal_Int16)( Millimeter::getInHundredthsOfOneMillimeter( fCharHeight ) );
-+}
-+
-+sal_Int32 SwVbaParagraphFormat::getOOoAlignment( sal_Int32 _alignment )
-+{
-+ sal_Int32 nParaAjust = style::ParagraphAdjust_LEFT;
-+ switch( _alignment )
-+ {
-+ case word::WdParagraphAlignment::wdAlignParagraphCenter:
-+ {
-+ nParaAjust = style::ParagraphAdjust_CENTER;
-+ break;
-+ }
-+ case word::WdParagraphAlignment::wdAlignParagraphJustify:
-+ {
-+ nParaAjust = style::ParagraphAdjust_BLOCK;
-+ break;
-+ }
-+ case word::WdParagraphAlignment::wdAlignParagraphLeft:
-+ {
-+ nParaAjust = style::ParagraphAdjust_LEFT;
-+ break;
-+ }
-+ case word::WdParagraphAlignment::wdAlignParagraphRight:
-+ {
-+ nParaAjust = style::ParagraphAdjust_RIGHT;
-+ break;
-+ }
-+ default:
-+ {
-+ DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() );
-+ }
-+ }
-+ return nParaAjust;
-+}
-+
-+sal_Int32 SwVbaParagraphFormat::getMSWordAlignment( sal_Int32 _alignment )
-+{
-+ sal_Int32 wdAlignment = word::WdParagraphAlignment::wdAlignParagraphLeft;
-+ switch( _alignment )
-+ {
-+ case style::ParagraphAdjust_CENTER:
-+ {
-+ wdAlignment = word::WdParagraphAlignment::wdAlignParagraphCenter;
-+ break;
-+ }
-+ case style::ParagraphAdjust_LEFT:
-+ {
-+ wdAlignment = word::WdParagraphAlignment::wdAlignParagraphLeft;
-+ break;
-+ }
-+ case style::ParagraphAdjust_BLOCK:
-+ {
-+ wdAlignment = word::WdParagraphAlignment::wdAlignParagraphJustify;
-+ break;
-+ }
-+ case style::ParagraphAdjust_RIGHT:
-+ {
-+ wdAlignment = word::WdParagraphAlignment::wdAlignParagraphRight;
-+ break;
-+ }
-+ default:
-+ {
-+ DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() );
-+ }
-+ }
-+ return wdAlignment;
-+}
-+
-+rtl::OUString&
-+SwVbaParagraphFormat::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaParagraphFormat") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaParagraphFormat::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ParagraphFormat" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbaparagraphformat.hxx sw/source/ui/vba/vbaparagraphformat.hxx
-new file mode 100644
-index 0000000..d4d9795
---- /dev/null
-+++ sw/source/ui/vba/vbaparagraphformat.hxx
-@@ -0,0 +1,98 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_PARAGRAPHFORMAT_HXX
-+#define SW_VBA_PARAGRAPHFORMAT_HXX
-+
-+#include <ooo/vba/word/XParagraphFormat.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include <com/sun/star/style/LineSpacing.hpp>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XParagraphFormat > SwVbaParagraphFormat_BASE;
-+
-+class SwVbaParagraphFormat : public SwVbaParagraphFormat_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XTextDocument > mxTextDocument;
-+ css::uno::Reference< css::beans::XPropertySet > mxParaProps;
-+
-+private:
-+ css::style::LineSpacing getOOoLineSpacing( float _lineSpace, sal_Int16 mode );
-+ css::style::LineSpacing getOOoLineSpacingFromRule( sal_Int32 _linespacingrule );
-+ float getMSWordLineSpacing( css::style::LineSpacing& rLineSpacing );
-+ sal_Int32 getMSWordLineSpacingRule( css::style::LineSpacing& rLineSpacing );
-+ sal_Int16 getCharHeight() throw (css::uno::RuntimeException);
-+ sal_Int32 getOOoAlignment( sal_Int32 _alignment );
-+ sal_Int32 getMSWordAlignment( sal_Int32 _alignment );
-+
-+public:
-+ SwVbaParagraphFormat( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rTextDocument, const css::uno::Reference< css::beans::XPropertySet >& rParaProps );
-+ virtual ~SwVbaParagraphFormat();
-+
-+ // Attributes
-+ virtual ::sal_Int32 SAL_CALL getAlignment() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setAlignment( ::sal_Int32 _alignment ) throw (css::uno::RuntimeException);
-+ virtual float SAL_CALL getFirstLineIndent() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setFirstLineIndent( float _firstlineindent ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL getKeepTogether() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setKeepTogether( const css::uno::Any& _keeptogether ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL getKeepWithNext() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setKeepWithNext( const css::uno::Any& _keepwithnext ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL getHyphenation() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setHyphenation( const css::uno::Any& _hyphenation ) throw (css::uno::RuntimeException);
-+ virtual float SAL_CALL getLineSpacing() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setLineSpacing( float _linespacing ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getLineSpacingRule() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setLineSpacingRule( ::sal_Int32 _linespacingrule ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL getNoLineNumber() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setNoLineNumber( const css::uno::Any& _nolinenumber ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getOutlineLevel() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setOutlineLevel( ::sal_Int32 _outlinelevel ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL getPageBreakBefore() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setPageBreakBefore( const css::uno::Any& _pagebreakbefore ) throw (css::uno::RuntimeException);
-+ virtual float SAL_CALL getSpaceBefore() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setSpaceBefore( float _spacebefore ) throw (css::uno::RuntimeException);
-+ virtual float SAL_CALL getSpaceAfter() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setSpaceAfter( float _spaceafter ) throw (css::uno::RuntimeException);
-+ virtual float SAL_CALL getLeftIndent() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setLeftIndent( float _leftindent ) throw (css::uno::RuntimeException);
-+ virtual float SAL_CALL getRightIndent() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setRightIndent( float _rightindent ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL getTabStops() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setTabStops( const css::uno::Any& _tabstops ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL getWidowControl() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setWidowControl( const css::uno::Any& _widowcontrol ) throw (css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_PARAGRAPHFORMAT_HXX */
-diff --git sw/source/ui/vba/vbarange.cxx sw/source/ui/vba/vbarange.cxx
-index 39c93b9..283162a 100644
---- sw/source/ui/vba/vbarange.cxx
-+++ sw/source/ui/vba/vbarange.cxx
-@@ -31,65 +31,76 @@
- #include <vbahelper/vbahelper.hxx>
- #include <tools/diagnose_ex.h>
- #include "vbarangehelper.hxx"
--#include <com/sun/star/text/XTextDocument.hpp>
- #include <ooo/vba/word/WdBreakType.hpp>
- #include <com/sun/star/style/BreakType.hpp>
-+#include <com/sun/star/text/ControlCharacter.hpp>
-+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
-+#include "wordvbahelper.hxx"
-+#include "vbaparagraphformat.hxx"
-+#include "vbastyle.hxx"
-+#include "vbafont.hxx"
-+#include "vbapalette.hxx"
-+#include "vbapagesetup.hxx"
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-
--typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XRange > SwVbaBaseRange_BASE;
--
--class SwVbaBaseRange : public SwVbaBaseRange_BASE
-+SwVbaRange::SwVbaRange( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& rTextDocument, const uno::Reference< text::XTextRange >& rStart, sal_Bool _bMaySpanEndOfDocument ) throw (uno::RuntimeException) : SwVbaRange_BASE( rParent, rContext ), mxTextDocument( rTextDocument ), mbMaySpanEndOfDocument( _bMaySpanEndOfDocument )
- {
--protected:
-- uno::Reference< text::XTextDocument > mxTextDocument;
-- uno::Reference< text::XTextCursor > mxTextCursor;
-- uno::Reference< text::XText > mxText;
-- sal_Bool mbMaySpanEndOfDocument;
--
-- SwVbaBaseRange( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext );
-- virtual ~SwVbaBaseRange();
--
--public:
-- uno::Reference< text::XTextRange > getXTextRange() throw (uno::RuntimeException);
--
-- // XRange
-- virtual rtl::OUString SAL_CALL getText() throw (uno::RuntimeException);
-- virtual void SAL_CALL setText( const rtl::OUString& rText ) throw (uno::RuntimeException);
--
-- // Methods
-- virtual void SAL_CALL InsertBreak( const uno::Any& _breakType ) throw (uno::RuntimeException);
-+ uno::Reference< text::XTextRange > xEnd;
-+ initialize( rStart, xEnd );
-+}
-
-- // XHelperInterface
-- virtual rtl::OUString& getServiceImplName();
-- virtual uno::Sequence<rtl::OUString> getServiceNames();
--};
-+SwVbaRange::SwVbaRange( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& rTextDocument, const uno::Reference< text::XTextRange >& rStart, const uno::Reference< text::XTextRange >& rEnd, sal_Bool _bMaySpanEndOfDocument ) throw (uno::RuntimeException) : SwVbaRange_BASE( rParent, rContext ), mxTextDocument( rTextDocument ), mbMaySpanEndOfDocument( _bMaySpanEndOfDocument )
-+{
-+ initialize( rStart, rEnd );
-+}
-
-+SwVbaRange::SwVbaRange( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& rTextDocument, const uno::Reference< text::XTextRange >& rStart, const uno::Reference< text::XTextRange >& rEnd, const uno::Reference< text::XText >& rText, sal_Bool _bMaySpanEndOfDocument ) throw (uno::RuntimeException) : SwVbaRange_BASE( rParent, rContext ),mxTextDocument( rTextDocument ), mbMaySpanEndOfDocument( _bMaySpanEndOfDocument ), mxText( rText )
-+{
-+ initialize( rStart, rEnd );
-+}
-
--SwVbaBaseRange::SwVbaBaseRange( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext )
-- : SwVbaBaseRange_BASE( rParent, rContext )
-+SwVbaRange::~SwVbaRange()
- {
- }
-
--SwVbaBaseRange::~SwVbaBaseRange()
-+void SwVbaRange::initialize( const uno::Reference< text::XTextRange >& rStart, const uno::Reference< text::XTextRange >& rEnd ) throw (uno::RuntimeException)
- {
-+ if( !mxText.is() )
-+ {
-+ mxText = mxTextDocument->getText();
-+ }
-+
-+ mxTextCursor = SwVbaRangeHelper::initCursor( rStart, mxText );
-+ mxTextCursor->collapseToStart();
-+
-+ if( rEnd.is() )
-+ mxTextCursor->gotoRange( rEnd, sal_True );
-+ else
-+ mxTextCursor->gotoEnd( sal_True );
- }
-
--uno::Reference< text::XTextRange >
--SwVbaBaseRange::getXTextRange() throw (uno::RuntimeException)
-+uno::Reference< text::XTextRange > SAL_CALL
-+SwVbaRange::getXTextRange() throw (uno::RuntimeException)
- {
- uno::Reference< text::XTextRange > xTextRange( mxTextCursor, uno::UNO_QUERY_THROW );
- return xTextRange;
- }
-
-+void SwVbaRange::setXTextRange( const uno::Reference< text::XTextRange >& xRange ) throw (uno::RuntimeException)
-+{
-+ mxTextCursor->gotoRange( xRange->getStart(), sal_False );
-+ mxTextCursor->gotoRange( xRange->getEnd(), sal_True );
-+}
-+
- /**
- * The complexity in this method is because we need to workaround
- * an issue that the last paragraph in a document does not have a trailing CRLF.
- * @return
- */
- rtl::OUString SAL_CALL
--SwVbaBaseRange::getText() throw ( uno::RuntimeException )
-+SwVbaRange::getText() throw ( uno::RuntimeException )
- {
- rtl::OUString aText = mxTextCursor->getString();
- sal_Int32 nLen = aText.getLength();
-@@ -118,7 +129,7 @@ SwVbaBaseRange::getText() throw ( uno::RuntimeException )
- }
-
- void SAL_CALL
--SwVbaBaseRange::setText( const rtl::OUString& rText ) throw ( uno::RuntimeException )
-+SwVbaRange::setText( const rtl::OUString& rText ) throw ( uno::RuntimeException )
- {
- if( rText.indexOf( '\n' ) != -1 )
- {
-@@ -134,7 +145,7 @@ SwVbaBaseRange::setText( const rtl::OUString& rText ) throw ( uno::RuntimeExcept
- }
-
- // FIXME: test is not pass
--void SAL_CALL SwVbaBaseRange::InsertBreak( const uno::Any& _breakType ) throw (uno::RuntimeException)
-+void SAL_CALL SwVbaRange::InsertBreak( const uno::Any& _breakType ) throw (uno::RuntimeException)
- {
- // default type is wdPageBreak;
- sal_Int32 nBreakType = word::WdBreakType::wdPageBreak;
-@@ -145,7 +156,7 @@ void SAL_CALL SwVbaBaseRange::InsertBreak( const uno::Any& _breakType ) throw (u
- switch( nBreakType )
- {
- case word::WdBreakType::wdPageBreak:
-- eBreakType = style::BreakType_PAGE_AFTER;
-+ eBreakType = style::BreakType_PAGE_BEFORE;
- break;
- case word::WdBreakType::wdColumnBreak:
- eBreakType = style::BreakType_COLUMN_AFTER;
-@@ -177,110 +188,145 @@ void SAL_CALL SwVbaBaseRange::InsertBreak( const uno::Any& _breakType ) throw (u
- }
- }
-
--rtl::OUString&
--SwVbaBaseRange::getServiceImplName()
-+void SAL_CALL
-+SwVbaRange::Select() throw ( uno::RuntimeException )
- {
-- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaBaseRange") );
-- return sImplName;
-+ uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextViewCursor > xTextViewCursor = word::getXTextViewCursor( xModel );
-+ xTextViewCursor->gotoRange( mxTextCursor->getStart(), sal_False );
-+ xTextViewCursor->gotoRange( mxTextCursor->getEnd(), sal_True );
- }
-
--uno::Sequence< rtl::OUString >
--SwVbaBaseRange::getServiceNames()
-+void SAL_CALL
-+SwVbaRange::InsertParagraph() throw ( uno::RuntimeException )
- {
-- static uno::Sequence< rtl::OUString > aServiceNames;
-- if ( aServiceNames.getLength() == 0 )
-- {
-- aServiceNames.realloc( 1 );
-- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.BaseRange" ) );
-- }
-- return aServiceNames;
-+ mxTextCursor->setString( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("") ) );
-+ InsertParagraphBefore();
- }
-
-+void SAL_CALL
-+SwVbaRange::InsertParagraphBefore() throw ( uno::RuntimeException )
-+{
-+ uno::Reference< text::XTextRange > xTextRange = mxTextCursor->getStart();
-+ mxText->insertControlCharacter( xTextRange, text::ControlCharacter::PARAGRAPH_BREAK, sal_True );
-+ mxTextCursor->gotoRange( xTextRange, sal_True );
-+}
-
--/*
--* class SwVbaDocRange
--*/
--class SwVbaDocRange : public SwVbaBaseRange
-+void SAL_CALL
-+SwVbaRange::InsertParagraphAfter() throw ( uno::RuntimeException )
- {
--public:
-- SwVbaDocRange( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext,
-- const uno::Reference< text::XTextDocument >& rDocument, const uno::Reference< text::XTextRange >& rStart,
-- const uno::Reference< text::XTextRange >& rEnd, const uno::Reference< text::XText >& rText, sal_Bool _bMaySpanEndOfDocument = sal_False )
-- throw ( uno::RuntimeException );
-- virtual ~SwVbaDocRange();
--};
--
--SwVbaDocRange::SwVbaDocRange( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext,
-- const uno::Reference< text::XTextDocument >& rDocument, const uno::Reference< text::XTextRange >& rStart,
-- const uno::Reference< text::XTextRange >& rEnd, const uno::Reference< text::XText >& rText, sal_Bool _bMaySpanEndOfDocument ) throw ( uno::RuntimeException ) : SwVbaBaseRange( rParent, rContext )
-+ uno::Reference< text::XTextRange > xTextRange = mxTextCursor->getEnd();
-+ mxText->insertControlCharacter( xTextRange, text::ControlCharacter::PARAGRAPH_BREAK, sal_True );
-+}
-+
-+uno::Reference< word::XParagraphFormat > SAL_CALL
-+SwVbaRange::getParagraphFormat() throw ( uno::RuntimeException )
- {
-- mxTextDocument = rDocument;
-- mbMaySpanEndOfDocument = _bMaySpanEndOfDocument;
-+ uno::Reference< beans::XPropertySet > xParaProps( mxTextCursor, uno::UNO_QUERY_THROW );
-+ return uno::Reference< word::XParagraphFormat >( new SwVbaParagraphFormat( this, mxContext, mxTextDocument, xParaProps ) );
-+}
-
-- if( rText.is() )
-- mxText = rText;
-- else
-- mxText = mxTextDocument->getText();
--
-- mxTextCursor = SwVbaRangeHelper::initCursor( rStart, mxText );
-- mxTextCursor->collapseToStart();
-+void SAL_CALL
-+SwVbaRange::setParagraphFormat( const uno::Reference< word::XParagraphFormat >& /*rParagraphFormat*/ ) throw ( uno::RuntimeException )
-+{
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+}
-
-- if( rEnd.is() )
-- mxTextCursor->gotoRange( rEnd, sal_True );
-- else
-- mxTextCursor->gotoEnd( sal_True );
-+uno::Reference< word::XStyle > SAL_CALL
-+SwVbaRange::getStyle() throw ( uno::RuntimeException )
-+{
-+ rtl::OUString aStyleName;
-+ rtl::OUString aStyleType;
-+ uno::Reference< beans::XPropertySet > xProp( mxTextCursor, uno::UNO_QUERY_THROW );
-+ if( ( xProp->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CharStyleName") ) ) >>= aStyleName ) && aStyleName.getLength() )
-+ {
-+ aStyleType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CharacterStyles") );
-+ }
-+ else if( ( xProp->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaStyleName") ) ) >>= aStyleName ) && aStyleName.getLength() )
-+ {
-+ aStyleType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParagraphStyles") );
-+ }
-+ if( aStyleType.getLength() == 0 )
-+ {
-+ DebugHelper::exception( SbERR_INTERNAL_ERROR, rtl::OUString() );
-+ }
-+ uno::Reference< style::XStyleFamiliesSupplier > xStyleSupplier( mxTextDocument, uno::UNO_QUERY_THROW);
-+ uno::Reference< container::XNameAccess > xStylesAccess( xStyleSupplier->getStyleFamilies()->getByName( aStyleType ), uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xStyleProps( xStylesAccess->getByName( aStyleName ), uno::UNO_QUERY_THROW );
-+ return uno::Reference< word::XStyle >( new SwVbaStyle( this, mxContext, xStyleProps ) );
- }
-
--SwVbaDocRange::~SwVbaDocRange()
-+void SAL_CALL
-+SwVbaRange::setStyle( const uno::Reference< word::XStyle >& rStyle ) throw ( uno::RuntimeException )
- {
-+ uno::Reference< beans::XPropertySet > xParaProps( mxTextCursor, uno::UNO_QUERY_THROW );
-+ SwVbaStyle::setStyle( xParaProps, rStyle );
- }
-
--/*
--* class SwVbaRange
--*/
--SwVbaRange::SwVbaRange( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext,
-- const uno::Reference< text::XTextDocument >& rTextDocument, const uno::Reference< text::XTextRange >& rStart, const uno::Reference< text::XTextRange >& rEnd, sal_Bool _bMaySpanEndOfDocument ) : SwVbaRange_BASE( rParent, rContext )
-+uno::Reference< word::XFont > SAL_CALL
-+SwVbaRange::getFont() throw ( uno::RuntimeException )
- {
-- uno::Reference< text::XText > xText;
-- mxActualRange = uno::Reference< word::XRange > ( new SwVbaDocRange( rParent, rContext, rTextDocument, rStart, rEnd, xText, _bMaySpanEndOfDocument ) );
-+ VbaPalette aColors;
-+ return new SwVbaFont( mxParent, mxContext, aColors.getPalette(), uno::Reference< beans::XPropertySet >( getXTextRange(), uno::UNO_QUERY_THROW ) );
- }
-
--SwVbaRange::~SwVbaRange()
-+::sal_Int32 SAL_CALL SwVbaRange::getLanguageID() throw (uno::RuntimeException)
- {
-+ uno::Reference< beans::XPropertySet > xParaProps( mxTextCursor, uno::UNO_QUERY_THROW );
-+ return SwVbaStyle::getLanguageID( xParaProps );
- }
-
--uno::Reference< text::XTextRange >
--SwVbaRange::getXTextRange() throw (uno::RuntimeException)
-+void SAL_CALL SwVbaRange::setLanguageID( ::sal_Int32 _languageid ) throw (uno::RuntimeException)
- {
-- uno::Reference< text::XTextRange > xTextRange;
-- SwVbaBaseRange* pBaseRange = dynamic_cast< SwVbaBaseRange* >( mxActualRange.get() );
-- if( pBaseRange )
-- xTextRange = pBaseRange->getXTextRange();
-- return xTextRange;
-+ uno::Reference< beans::XPropertySet > xParaProps( mxTextCursor, uno::UNO_QUERY_THROW );
-+ SwVbaStyle::setLanguageID( xParaProps, _languageid );
- }
-
--rtl::OUString SAL_CALL
--SwVbaRange::getText() throw ( uno::RuntimeException )
-+uno::Any SAL_CALL
-+SwVbaRange::PageSetup( ) throw (uno::RuntimeException)
- {
-- rtl::OUString aText;
-- if( mxActualRange.is() )
-- return mxActualRange->getText();
-- return aText;
-+ uno::Reference< beans::XPropertySet > xParaProps( mxTextCursor, uno::UNO_QUERY_THROW );
-+ uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW );
-+ rtl::OUString aPageStyleName;
-+ xParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyleName"))) >>= aPageStyleName;
-+ uno::Reference< style::XStyleFamiliesSupplier > xSytleFamSupp( xModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XNameAccess > xSytleFamNames( xSytleFamSupp->getStyleFamilies(), uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XNameAccess > xPageStyles( xSytleFamNames->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyles") ) ), uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xPageProps( xPageStyles->getByName( aPageStyleName ), uno::UNO_QUERY_THROW );
-+ return uno::makeAny( uno::Reference< word::XPageSetup >( new SwVbaPageSetup( this, mxContext, xModel, xPageProps ) ) );
- }
-
--void SAL_CALL
--SwVbaRange::setText( const rtl::OUString& rText ) throw ( uno::RuntimeException )
-+::sal_Int32 SAL_CALL SwVbaRange::getStart() throw (uno::RuntimeException)
- {
-- if( mxActualRange.is() )
-- mxActualRange->setText( rText );
-+ uno::Reference< text::XText > xText = mxTextDocument->getText();
-+ return SwVbaRangeHelper::getPosition( xText, mxTextCursor->getStart() );
- }
-
--void SAL_CALL SwVbaRange::InsertBreak( const uno::Any& _breakType ) throw (uno::RuntimeException)
-+void SAL_CALL SwVbaRange::setStart( ::sal_Int32 _start ) throw (uno::RuntimeException)
- {
-- if( mxActualRange.is() )
-- mxActualRange->InsertBreak( _breakType );
-+ uno::Reference< text::XText > xText = mxTextDocument->getText();
-+ uno::Reference< text::XTextRange > xStart = SwVbaRangeHelper::getRangeByPosition( xText, _start );
-+ uno::Reference< text::XTextRange > xEnd = mxTextCursor->getEnd();
-+
-+ mxTextCursor->gotoRange( xStart, sal_False );
-+ mxTextCursor->gotoRange( xEnd, sal_True );
- }
--
-+
-+::sal_Int32 SAL_CALL SwVbaRange::getEnd() throw (uno::RuntimeException)
-+{
-+ uno::Reference< text::XText > xText = mxTextDocument->getText();
-+ return SwVbaRangeHelper::getPosition( xText, mxTextCursor->getEnd() );
-+}
-+
-+void SAL_CALL SwVbaRange::setEnd( ::sal_Int32 _end ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< text::XText > xText = mxTextDocument->getText();
-+ uno::Reference< text::XTextRange > xEnd = SwVbaRangeHelper::getRangeByPosition( xText, _end );
-+
-+ mxTextCursor->collapseToStart();
-+ mxTextCursor->gotoRange( xEnd, sal_True );
-+}
-+
- rtl::OUString&
- SwVbaRange::getServiceImplName()
- {
-diff --git sw/source/ui/vba/vbarange.hxx sw/source/ui/vba/vbarange.hxx
-index f126527..abce5b7 100644
---- sw/source/ui/vba/vbarange.hxx
-+++ sw/source/ui/vba/vbarange.hxx
-@@ -31,32 +31,60 @@
- #define SW_VBA_RANGE_HXX
-
- #include <ooo/vba/word/XRange.hpp>
-+#include <ooo/vba/word/XParagraphFormat.hpp>
-+#include <ooo/vba/word/XFont.hpp>
- #include <vbahelper/vbahelperinterface.hxx>
- #include <cppuhelper/implbase1.hxx>
- #include <com/sun/star/text/XTextRange.hpp>
- #include <com/sun/star/text/XTextDocument.hpp>
-+#include <ooo/vba/word/XStyle.hpp>
-
- typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XRange > SwVbaRange_BASE;
-
- class SwVbaRange : public SwVbaRange_BASE
- {
- private:
-- css::uno::Reference< ooo::vba::word::XRange > mxActualRange;
-+ css::uno::Reference< css::text::XTextDocument > mxTextDocument;
-+ css::uno::Reference< css::text::XTextCursor > mxTextCursor;
-+ css::uno::Reference< css::text::XText > mxText;
-+ sal_Bool mbMaySpanEndOfDocument;
-
-+private:
-+ void initialize( const css::uno::Reference< css::text::XTextRange >& rStart, const css::uno::Reference< css::text::XTextRange >& rEnd ) throw (css::uno::RuntimeException);
- public:
-- SwVbaRange( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext,
-- const css::uno::Reference< css::text::XTextDocument >& rTextDocument, const css::uno::Reference< css::text::XTextRange >& rStart, const css::uno::Reference< css::text::XTextRange >& rEnd, sal_Bool _bMaySpanEndOfDocument = sal_False );
-+ SwVbaRange( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rTextDocument, const css::uno::Reference< css::text::XTextRange >& rStart, sal_Bool _bMaySpanEndOfDocument = sal_False ) throw (css::uno::RuntimeException);
-+ SwVbaRange( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rTextDocument, const css::uno::Reference< css::text::XTextRange >& rStart, const css::uno::Reference< css::text::XTextRange >& rEnd, sal_Bool _bMaySpanEndOfDocument = sal_False ) throw (css::uno::RuntimeException);
-+ SwVbaRange( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rTextDocument, const css::uno::Reference< css::text::XTextRange >& rStart, const css::uno::Reference< css::text::XTextRange >& rEnd, const css::uno::Reference< css::text::XText >& rText, sal_Bool _bMaySpanEndOfDocument = sal_False ) throw (css::uno::RuntimeException);
- virtual ~SwVbaRange();
-+ css::uno::Reference< css::text::XTextDocument > getDocument() { return mxTextDocument; }
-
-- css::uno::Reference< css::text::XTextRange > getXTextRange() throw (css::uno::RuntimeException);
-+ virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getXTextRange() throw (css::uno::RuntimeException);
-+ void setXTextRange( const css::uno::Reference< css::text::XTextRange >& xRange ) throw (css::uno::RuntimeException);
-+ css::uno::Reference< css::text::XText > getXText() { return mxText; }
-+ void setXTextCursor( const css::uno::Reference< css::text::XTextCursor >& xTextCursor ) { mxTextCursor = xTextCursor; }
-
- // Attribute
- virtual rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setText( const rtl::OUString& rText ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Reference< ooo::vba::word::XParagraphFormat > SAL_CALL getParagraphFormat() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setParagraphFormat( const css::uno::Reference< ooo::vba::word::XParagraphFormat >& rParagraphFormat ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Reference< ooo::vba::word::XStyle > SAL_CALL getStyle() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setStyle( const css::uno::Reference< ooo::vba::word::XStyle >& _xStyle ) throw (css::uno::RuntimeException);
-
-- // Methods
-- virtual void SAL_CALL InsertBreak( const css::uno::Any& _breakType ) throw (css::uno::RuntimeException);
--
-+ virtual css::uno::Reference< ooo::vba::word::XFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
-+ // Methods
-+ virtual void SAL_CALL InsertBreak( const css::uno::Any& _breakType ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL Select() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL InsertParagraph() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL InsertParagraphBefore() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL InsertParagraphAfter() throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getLanguageID() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setLanguageID( ::sal_Int32 _languageid ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL PageSetup() throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getStart() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setStart( ::sal_Int32 _start ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getEnd() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setEnd( ::sal_Int32 _end ) throw (css::uno::RuntimeException);
-
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
-diff --git sw/source/ui/vba/vbarangehelper.cxx sw/source/ui/vba/vbarangehelper.cxx
-index 61ced2c..5df01b8 100644
---- sw/source/ui/vba/vbarangehelper.cxx
-+++ sw/source/ui/vba/vbarangehelper.cxx
-@@ -29,6 +29,7 @@
- ************************************************************************/
- #include "vbarangehelper.hxx"
- #include <com/sun/star/text/ControlCharacter.hpp>
-+#include <com/sun/star/text/XTextRangeCompare.hpp>
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-@@ -141,3 +142,33 @@ uno::Reference< text::XTextCursor > SwVbaRangeHelper::initCursor( const uno::Ref
- }
- return xTextCursor;
- }
-+
-+sal_Int32 SwVbaRangeHelper::getPosition( const uno::Reference< text::XText >& rText, const uno::Reference< text::XTextRange >& rTextRange ) throw ( uno::RuntimeException )
-+{
-+ sal_Int32 nPosition = -1;
-+ if( rText.is() && rTextRange.is() )
-+ {
-+ nPosition = 0;
-+ uno::Reference< text::XTextCursor > xCursor = rText->createTextCursor();
-+ xCursor->collapseToStart();
-+ uno::Reference< text::XTextRangeCompare > xCompare( rText, uno::UNO_QUERY_THROW );
-+ // compareValue is 0 if the ranges are equal
-+ sal_Int32 nCompareValue = xCompare->compareRegionStarts( xCursor->getStart(), rTextRange );
-+ sal_Bool canGo = sal_True;
-+
-+ while( nCompareValue !=0 && canGo )
-+ {
-+ canGo = xCursor->goRight( 1, sal_False );
-+ nCompareValue = xCompare->compareRegionStarts( xCursor->getStart(), rTextRange );
-+ nPosition++;
-+ }
-+
-+ // check fails: no correct position found
-+ if( !canGo && nCompareValue != 0 )
-+ {
-+ nPosition = -1;
-+ }
-+ }
-+
-+ return nPosition;
-+}
-diff --git sw/source/ui/vba/vbarangehelper.hxx sw/source/ui/vba/vbarangehelper.hxx
-index 3e5a281..5e47899 100644
---- sw/source/ui/vba/vbarangehelper.hxx
-+++ sw/source/ui/vba/vbarangehelper.hxx
-@@ -40,6 +40,7 @@ public:
- static css::uno::Reference< css::text::XTextRange > getRangeByPosition( const css::uno::Reference< css::text::XText >& rText, sal_Int32 _position )throw ( css::uno::RuntimeException );
- static void insertString( css::uno::Reference< css::text::XTextRange >& rTextRange, css::uno::Reference< css::text::XText >& rText, const rtl::OUString& rStr, sal_Bool _bAbsorb ) throw ( css::uno::RuntimeException );
- static css::uno::Reference< css::text::XTextCursor > initCursor( const css::uno::Reference< css::text::XTextRange >& rTextRange, const css::uno::Reference< css::text::XText >& rText ) throw ( css::uno::RuntimeException );
-+ static sal_Int32 getPosition( const css::uno::Reference< css::text::XText >& rText, const css::uno::Reference< css::text::XTextRange >& rTextRange ) throw ( css::uno::RuntimeException );
-
- };
- #endif /* SW_VBA_RANGEHELPER_HXX */
-diff --git sw/source/ui/vba/vbareplacement.cxx sw/source/ui/vba/vbareplacement.cxx
-new file mode 100644
-index 0000000..abf85f3
---- /dev/null
-+++ sw/source/ui/vba/vbareplacement.cxx
-@@ -0,0 +1,74 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbareplacement.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaReplacement::SwVbaReplacement( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< util::XPropertyReplace >& xPropertyReplace ) throw ( uno::RuntimeException ) :
-+ SwVbaReplacement_BASE( rParent, rContext ), mxPropertyReplace( xPropertyReplace )
-+{
-+}
-+
-+SwVbaReplacement::~SwVbaReplacement()
-+{
-+}
-+
-+::rtl::OUString SAL_CALL SwVbaReplacement::getText() throw (uno::RuntimeException)
-+{
-+ return mxPropertyReplace->getReplaceString();
-+}
-+
-+void SAL_CALL SwVbaReplacement::setText( const ::rtl::OUString& _text ) throw (uno::RuntimeException)
-+{
-+ mxPropertyReplace->setReplaceString( _text );
-+}
-+
-+rtl::OUString&
-+SwVbaReplacement::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaReplacement") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaReplacement::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Replacement" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbareplacement.hxx sw/source/ui/vba/vbareplacement.hxx
-new file mode 100644
-index 0000000..d590a1d
---- /dev/null
-+++ sw/source/ui/vba/vbareplacement.hxx
-@@ -0,0 +1,57 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_REPLACEMENT_HXX
-+#define SW_VBA_REPLACEMENT_HXX
-+
-+#include <ooo/vba/word/XReplacement.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/util/XPropertyReplace.hpp>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XReplacement > SwVbaReplacement_BASE;
-+
-+class SwVbaReplacement : public SwVbaReplacement_BASE
-+{
-+private:
-+ css::uno::Reference< css::util::XPropertyReplace> mxPropertyReplace;
-+
-+public:
-+ SwVbaReplacement( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::util::XPropertyReplace >& xPropertyReplace ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaReplacement();
-+
-+ // Attributes
-+ virtual ::rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setText( const ::rtl::OUString& _text ) throw (css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_REPLACEMENT_HXX */
-diff --git sw/source/ui/vba/vbasection.cxx sw/source/ui/vba/vbasection.cxx
-new file mode 100644
-index 0000000..306ed26
---- /dev/null
-+++ sw/source/ui/vba/vbasection.cxx
-@@ -0,0 +1,90 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbasection.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include "vbapagesetup.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaSection::SwVbaSection( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< beans::XPropertySet >& xProps ) throw ( uno::RuntimeException ) :
-+ SwVbaSection_BASE( rParent, rContext ), mxModel( xModel ), mxPageProps( xProps )
-+{
-+}
-+
-+SwVbaSection::~SwVbaSection()
-+{
-+}
-+
-+::sal_Bool SAL_CALL SwVbaSection::getProtectedForForms() throw (uno::RuntimeException)
-+{
-+ return sal_False;
-+}
-+
-+void SAL_CALL SwVbaSection::setProtectedForForms( ::sal_Bool _protectedforforms ) throw (uno::RuntimeException)
-+{
-+}
-+
-+uno::Any SAL_CALL SwVbaSection::Headers( ) throw (uno::RuntimeException)
-+{
-+ return uno::Any();
-+}
-+
-+uno::Any SAL_CALL SwVbaSection::Footers( ) throw (uno::RuntimeException)
-+{
-+ return uno::Any();
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaSection::PageSetup( ) throw (uno::RuntimeException)
-+{
-+ return uno::makeAny( uno::Reference< word::XPageSetup >( new SwVbaPageSetup( this, mxContext, mxModel, mxPageProps ) ) );
-+}
-+
-+rtl::OUString&
-+SwVbaSection::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaSection") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaSection::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Section" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbasection.hxx sw/source/ui/vba/vbasection.hxx
-new file mode 100644
-index 0000000..92a65f3
---- /dev/null
-+++ sw/source/ui/vba/vbasection.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:
-+ * $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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_SECTION_HXX
-+#define SW_VBA_SECTION_HXX
-+
-+#include <ooo/vba/word/XSection.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XSection > SwVbaSection_BASE;
-+
-+class SwVbaSection : public SwVbaSection_BASE
-+{
-+private:
-+ css::uno::Reference< css::frame::XModel > mxModel;
-+ css::uno::Reference< css::beans::XPropertySet > mxPageProps;
-+
-+public:
-+ SwVbaSection( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::beans::XPropertySet >& xProps ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaSection();
-+
-+ // Attributes
-+ virtual ::sal_Bool SAL_CALL getProtectedForForms() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setProtectedForForms( ::sal_Bool _protectedforforms ) throw (css::uno::RuntimeException);
-+
-+ // Methods
-+ virtual css::uno::Any SAL_CALL Headers( ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Footers( ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL PageSetup( ) throw (css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_SECTION_HXX */
-diff --git sw/source/ui/vba/vbasections.cxx sw/source/ui/vba/vbasections.cxx
-new file mode 100644
-index 0000000..8fca880
---- /dev/null
-+++ sw/source/ui/vba/vbasections.cxx
-@@ -0,0 +1,190 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbasections.hxx"
-+#include "vbasection.hxx"
-+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
-+#include <com/sun/star/style/XStyle.hpp>
-+#include <docsh.hxx>
-+#include <doc.hxx>
-+#include "wordvbahelper.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+typedef ::cppu::WeakImplHelper1< container::XEnumeration > SectionEnumeration_BASE;
-+typedef ::cppu::WeakImplHelper2< container::XIndexAccess, container::XEnumerationAccess > SectionCollectionHelper_Base;
-+typedef std::vector< uno::Reference< beans::XPropertySet > > XSectionVec;
-+
-+class SectionEnumeration : public SectionEnumeration_BASE
-+{
-+ XSectionVec mxSections;
-+ XSectionVec::iterator mIt;
-+
-+public:
-+ SectionEnumeration( const XSectionVec& rVec ) : mxSections( rVec ), mIt( mxSections.begin() ) {}
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( mIt != mxSections.end() );
-+ }
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( hasMoreElements() )
-+ return uno::makeAny( *mIt++ );
-+ throw container::NoSuchElementException();
-+ }
-+};
-+
-+// here I regard pagestyle as section
-+class SectionCollectionHelper : public SectionCollectionHelper_Base
-+{
-+private:
-+ uno::Reference< XHelperInterface > mxParent;
-+ uno::Reference< uno::XComponentContext > mxContext;
-+ uno::Reference< frame::XModel > mxModel;
-+ XSectionVec mxSections;
-+
-+public:
-+ SectionCollectionHelper( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException) : mxParent( xParent ), mxContext( xContext ), mxModel( xModel )
-+ {
-+ uno::Reference< style::XStyleFamiliesSupplier > xSytleFamSupp( mxModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XNameAccess > xSytleFamNames( xSytleFamSupp->getStyleFamilies(), uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xPageStyles( xSytleFamNames->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyles") ) ), uno::UNO_QUERY_THROW );
-+ sal_Int32 nCount = xPageStyles->getCount();
-+ for( sal_Int32 index = 0; index < nCount; ++index )
-+ {
-+ uno::Reference< style::XStyle > xStyle( xPageStyles->getByIndex( index ), uno::UNO_QUERY_THROW );
-+ // only the pagestyles in using are considered
-+ if( xStyle->isInUse( ) )
-+ {
-+ uno::Reference< beans::XPropertySet > xPageProps( xStyle, uno::UNO_QUERY_THROW );
-+ mxSections.push_back( xPageProps );
-+ }
-+ }
-+ }
-+
-+ ~SectionCollectionHelper(){}
-+
-+ // XIndexAccess
-+ virtual sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
-+ {
-+ return mxSections.size();
-+ }
-+ virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( Index < 0 || Index >= getCount() )
-+ throw css::lang::IndexOutOfBoundsException();
-+
-+ uno::Reference< beans::XPropertySet > xPageProps( mxSections[ Index ], uno::UNO_QUERY_THROW );
-+ return uno::makeAny( uno::Reference< word::XSection >( new SwVbaSection( mxParent, mxContext, mxModel, xPageProps ) ) );
-+ }
-+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
-+ {
-+ return word::XSection::static_type(0);
-+ }
-+ virtual sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
-+ {
-+ return sal_True;
-+ }
-+ // XEnumerationAccess
-+ virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
-+ {
-+ return new SectionEnumeration( mxSections );
-+ }
-+};
-+
-+class SectionsEnumWrapper : public EnumerationHelperImpl
-+{
-+ uno::Reference< frame::XModel > mxModel;
-+ uno::WeakReference< XHelperInterface > mxParent;
-+public:
-+ SectionsEnumWrapper( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration, const uno::Reference< frame::XModel >& xModel ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xContext, xEnumeration ), mxModel( xModel ), mxParent( xParent ) {}
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ uno::Reference< beans::XPropertySet > xPageProps( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
-+ return uno::makeAny( uno::Reference< word::XSection > ( new SwVbaSection( mxParent, m_xContext, mxModel, xPageProps ) ) );
-+ }
-+};
-+
-+SwVbaSections::SwVbaSections( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel ): SwVbaSections_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new SectionCollectionHelper( xParent, xContext, xModel ) ) ), mxModel( xModel )
-+{
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaSections::PageSetup( ) throw (uno::RuntimeException)
-+{
-+ if( m_xIndexAccess->getCount() )
-+ {
-+ // check if the first section is our want
-+ uno::Reference< word::XSection > xSection( m_xIndexAccess->getByIndex( 0 ), uno::UNO_QUERY_THROW );
-+ return xSection->PageSetup();
-+ }
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("There is no section") ), uno::Reference< uno::XInterface >() );
-+}
-+
-+// XEnumerationAccess
-+uno::Type SAL_CALL
-+SwVbaSections::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XSection::static_type(0);
-+}
-+
-+uno::Reference< container::XEnumeration > SAL_CALL
-+SwVbaSections::createEnumeration() throw (uno::RuntimeException)
-+{
-+ uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
-+ return new SectionsEnumWrapper( this, mxContext, xEnumAccess->createEnumeration(), mxModel );
-+}
-+
-+uno::Any
-+SwVbaSections::createCollectionObject( const css::uno::Any& aSource )
-+{
-+ return aSource;
-+}
-+
-+rtl::OUString&
-+SwVbaSections::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaSections") );
-+ return sImplName;
-+}
-+
-+css::uno::Sequence<rtl::OUString>
-+SwVbaSections::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Sections") );
-+ }
-+ return sNames;
-+}
-diff --git sw/source/ui/vba/vbasections.hxx sw/source/ui/vba/vbasections.hxx
-new file mode 100644
-index 0000000..1ff9e9e
---- /dev/null
-+++ sw/source/ui/vba/vbasections.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:
-+ * $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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_SECTIONS_HXX
-+#define SW_VBA_SECTIONS_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XSections.hpp>
-+#include <com/sun/star/container/XEnumerationAccess.hpp>
-+#include <com/sun/star/container/XIndexAccess.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+
-+typedef CollTestImplHelper< ooo::vba::word::XSections > SwVbaSections_BASE;
-+
-+class SwVbaSections : public SwVbaSections_BASE
-+{
-+private:
-+ css::uno::Reference< css::frame::XModel > mxModel;
-+
-+public:
-+ SwVbaSections( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel );
-+ virtual ~SwVbaSections() {}
-+
-+ // 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 SAL_CALL PageSetup( ) throw (css::uno::RuntimeException);
-+
-+ // SwVbaSections_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* SW_VBA_SECTIONS_HXX */
-diff --git sw/source/ui/vba/vbaselection.cxx sw/source/ui/vba/vbaselection.cxx
-index ceb7bb1..b85c2d7 100644
---- sw/source/ui/vba/vbaselection.cxx
-+++ sw/source/ui/vba/vbaselection.cxx
-@@ -30,28 +30,635 @@
- #include "vbaselection.hxx"
- #include <vbahelper/vbahelper.hxx>
- #include <tools/diagnose_ex.h>
-+#include "vbarange.hxx"
-+#include "vbafind.hxx"
-+#include "wordvbahelper.hxx"
-+#include <com/sun/star/text/XTextRange.hpp>
-+#include <com/sun/star/text/XTextTable.hpp>
-+#include <com/sun/star/text/XTextTableCursor.hpp>
-+#include <com/sun/star/text/ControlCharacter.hpp>
-+#include <com/sun/star/table/XCell.hpp>
-+#include <ooo/vba/word/WdUnits.hpp>
-+#include <ooo/vba/word/WdMovementType.hpp>
-+#include <ooo/vba/word/WdGoToItem.hpp>
-+#include <ooo/vba/word/WdGoToDirection.hpp>
-+#include <ooo/vba/word/XBookmark.hpp>
-+#include <ooo/vba/word/XApplication.hpp>
-+#include <com/sun/star/text/XPageCursor.hpp>
-+#include "unotbl.hxx"
-+#include "unocoll.hxx"
-+#include "vbatable.hxx"
-+#include <com/sun/star/view/XSelectionSupplier.hpp>
-+#include <com/sun/star/view/XViewCursor.hpp>
-+#include <ooo/vba/word/WdInformation.hpp>
-+#include <ooo/vba/word/WdHeaderFooterIndex.hpp>
-+#include "vbainformationhelper.hxx"
-+#include "vbafield.hxx"
-+#include "vbaheaderfooter.hxx"
-+#include "vbaheaderfooterhelper.hxx"
-+#include <vbahelper/vbashaperange.hxx>
-+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
-+#include <com/sun/star/drawing/XDrawPage.hpp>
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-
--SwVbaSelection::SwVbaSelection( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& rModel ) throw ( css::uno::RuntimeException ) : SwVbaSelection_BASE( rParent, rContext ), mxModel( rModel )
-+SwVbaSelection::SwVbaSelection( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< frame::XModel >& rModel ) throw ( uno::RuntimeException ) : SwVbaSelection_BASE( rParent, rContext ), mxModel( rModel )
- {
-+ mxTextViewCursor = word::getXTextViewCursor( mxModel );
- }
-
- SwVbaSelection::~SwVbaSelection()
- {
- }
-
-+uno::Reference< text::XTextRange > SwVbaSelection::GetSelectedRange() throw ( uno::RuntimeException )
-+{
-+ uno::Reference< text::XTextRange > xTextRange;
-+ uno::Reference< lang::XServiceInfo > xServiceInfo( mxModel->getCurrentSelection(), uno::UNO_QUERY_THROW );
-+ if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextRanges") ) ) )
-+ {
-+ uno::Reference< container::XIndexAccess > xTextRanges( xServiceInfo, uno::UNO_QUERY_THROW );
-+ if( xTextRanges->getCount() > 0 )
-+ {
-+ // if there are multipul selection, just return the last selected Range.
-+ xTextRange.set( xTextRanges->getByIndex( xTextRanges->getCount()-1 ), uno::UNO_QUERY_THROW );
-+ }
-+ }
-+ else
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+ return xTextRange;
-+}
-+
-+uno::Reference< word::XRange > SAL_CALL
-+SwVbaSelection::getRange() throw ( uno::RuntimeException )
-+{
-+ uno::Reference< text::XTextRange > xTextRange = GetSelectedRange();
-+ uno::Reference< text::XTextDocument > xDocument( mxModel, uno::UNO_QUERY_THROW );
-+ return uno::Reference< word::XRange >( new SwVbaRange( this, mxContext, xDocument, xTextRange->getStart(), xTextRange->getEnd(), mxTextViewCursor->getText() ) );
-+}
-+
- rtl::OUString SAL_CALL
- SwVbaSelection::getText() throw ( uno::RuntimeException )
- {
-- rtl::OUString aText;
-- return aText;
-+ return getRange()->getText();
- }
-
- void SAL_CALL
- SwVbaSelection::setText( const rtl::OUString& rText ) throw ( uno::RuntimeException )
- {
-+ getRange()->setText( rText );
-+}
-+
-+void SAL_CALL
-+SwVbaSelection::TypeText( const rtl::OUString& rText ) throw ( uno::RuntimeException )
-+{
-+ // FIXME: handle the property Options.ReplaceSelection, the default value is TRUE
-+ setText( rText );
-+}
-+
-+void SAL_CALL
-+SwVbaSelection::HomeKey( const uno::Any& _unit, const uno::Any& _extend ) throw ( uno::RuntimeException )
-+{
-+ sal_Int32 nUnit = word::WdUnits::wdLine;
-+ sal_Int32 nExtend = word::WdMovementType::wdMove;
-+ _unit >>= nUnit;
-+ _extend >>= nExtend;
-+
-+ switch( nUnit )
-+ {
-+ case word::WdUnits::wdStory:
-+ {
-+ // go to the begin of the document
-+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToStartOfDoc"));
-+ dispatchRequests( mxModel,url );
-+ // If something is selected, it needs to go twice
-+ dispatchRequests( mxModel,url );
-+ break;
-+ }
-+ case word::WdUnits::wdLine:
-+ {
-+ // go to the begin of the Line
-+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToStartOfLine"));
-+ dispatchRequests( mxModel,url );
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ break;
-+ }
-+ }
-+}
-+
-+void SAL_CALL
-+SwVbaSelection::EndKey( const uno::Any& _unit, const uno::Any& _extend ) throw ( uno::RuntimeException )
-+{
-+ sal_Int32 nUnit = word::WdUnits::wdLine;
-+ sal_Int32 nExtend = word::WdMovementType::wdMove;
-+ _unit >>= nUnit;
-+ _extend >>= nExtend;
-+
-+ switch( nUnit )
-+ {
-+ case word::WdUnits::wdStory:
-+ {
-+ // go to the end of the document
-+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToEndOfDoc"));
-+ dispatchRequests( mxModel,url );
-+ // If something is selected, it needs to go twice
-+ dispatchRequests( mxModel,url );
-+ break;
-+ }
-+ case word::WdUnits::wdLine:
-+ {
-+ // go to the end of the Line
-+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToEndOfLine"));
-+ dispatchRequests( mxModel,url );
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ break;
-+ }
-+ }
-+}
-+
-+void SAL_CALL
-+SwVbaSelection::Delete( const uno::Any& _unit, const uno::Any& _count ) throw ( uno::RuntimeException )
-+{
-+ // FIXME: handle the arguments: _unit and _count
-+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Delete"));
-+ dispatchRequests( mxModel,url );
-+}
-+
-+void SwVbaSelection::NextCell( sal_Int32 nCount, E_DIRECTION eDirection ) throw ( uno::RuntimeException )
-+{
-+ uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextTable > xTextTable;
-+ uno::Reference< table::XCell > xCell;
-+ xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ) >>= xTextTable;
-+ xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Cell") ) ) >>= xCell;
-+ if( !xTextTable.is() || !xCell.is() )
-+ {
-+ DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
-+ return;
-+ }
-+ uno::Reference< beans::XPropertySet > xCellProps( xCell, uno::UNO_QUERY_THROW );
-+ rtl::OUString aCellName;
-+ xCellProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CellName") ) ) >>= aCellName;
-+ uno::Reference< text::XTextTableCursor > xTextTableCursor = xTextTable->createCursorByCellName( aCellName );
-+ // move the table cursor
-+ switch( eDirection )
-+ {
-+ case MOVE_LEFT:
-+ {
-+ xTextTableCursor->goLeft( nCount, sal_False );
-+ break;
-+ }
-+ case MOVE_RIGHT:
-+ {
-+ xTextTableCursor->goRight( nCount, sal_False );
-+ break;
-+ }
-+ case MOVE_UP:
-+ {
-+ xTextTableCursor->goUp( nCount, sal_False );
-+ break;
-+ }
-+ case MOVE_DOWN:
-+ {
-+ xTextTableCursor->goDown( nCount, sal_False );
-+ break;
-+ }
-+ default:
-+ {
-+ DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
-+ return;
-+ }
-+ }
-+ // move the view cursor
-+ xCell = xTextTable->getCellByName( xTextTableCursor->getRangeName() );
-+ mxTextViewCursor->gotoRange( uno::Reference< text::XTextRange >( xCell, uno::UNO_QUERY_THROW ), sal_False );
-+}
-+
-+void SAL_CALL
-+SwVbaSelection::MoveRight( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend ) throw ( uno::RuntimeException )
-+{
-+ sal_Int32 nUnit = word::WdUnits::wdCharacter;
-+ sal_Int32 nCount = 1;
-+ sal_Int32 nExtend = word::WdMovementType::wdMove;
-+
-+ if( _unit.hasValue() )
-+ _unit >>= nUnit;
-+ if( _count.hasValue() )
-+ _count >>= nCount;
-+ if( _extend.hasValue() )
-+ _extend >>= nExtend;
-+
-+ if( nCount == 0 )
-+ return;
-+
-+ if( nCount < 0 )
-+ {
-+ // TODO: call MoveLeft;
-+ MoveLeft( _unit, uno::makeAny( -nCount ), _extend );
-+ return;
-+ }
-+
-+ switch( nUnit )
-+ {
-+ case word::WdUnits::wdCell:
-+ {
-+ if( nExtend == word::WdMovementType::wdExtend )
-+ {
-+ DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
-+ return;
-+ }
-+ NextCell( nCount, MOVE_RIGHT );
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ break;
-+ }
-+ }
-+
-+}
-+
-+void SAL_CALL
-+SwVbaSelection::MoveLeft( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend ) throw ( uno::RuntimeException )
-+{
-+ sal_Int32 nUnit = word::WdUnits::wdCharacter;
-+ sal_Int32 nCount = 1;
-+ sal_Int32 nExtend = word::WdMovementType::wdMove;
-+
-+ if( _unit.hasValue() )
-+ _unit >>= nUnit;
-+ if( _count.hasValue() )
-+ _count >>= nCount;
-+ if( _extend.hasValue() )
-+ _extend >>= nExtend;
-+
-+ if( nCount == 0 )
-+ return;
-+
-+ if( nCount < 0 )
-+ {
-+ MoveRight( _unit, uno::makeAny( -nCount ), _extend );
-+ return;
-+ }
-+
-+ switch( nUnit )
-+ {
-+ case word::WdUnits::wdCell:
-+ {
-+ if( nExtend == word::WdMovementType::wdExtend )
-+ {
-+ DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
-+ return;
-+ }
-+ NextCell( nCount, MOVE_LEFT );
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ break;
-+ }
-+ }
-+
-+}
-+
-+void SAL_CALL
-+SwVbaSelection::MoveDown( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend ) throw ( uno::RuntimeException )
-+{
-+ sal_Int32 nUnit = word::WdUnits::wdCharacter;
-+ sal_Int32 nCount = 1;
-+ sal_Int32 nExtend = word::WdMovementType::wdMove;
-+
-+ if( _unit.hasValue() )
-+ _unit >>= nUnit;
-+ if( _count.hasValue() )
-+ _count >>= nCount;
-+ if( _extend.hasValue() )
-+ _extend >>= nExtend;
-+
-+ if( nCount == 0 )
-+ return;
-+
-+ if( nCount < 0 )
-+ {
-+ // TODO: call MoveLeft;
-+ //MoveUp( _unit, uno::makeAny( -nCount ), _extend );
-+ return;
-+ }
-+
-+ switch( nUnit )
-+ {
-+ case word::WdUnits::wdLine:
-+ {
-+ uno::Reference< view::XViewCursor > xViewCursor( mxTextViewCursor, uno::UNO_QUERY_THROW );
-+ sal_Bool bExpand = ( nExtend == word::WdMovementType::wdMove ) ? sal_False : sal_True;
-+ xViewCursor->goDown( nCount, bExpand );
-+ break;
-+ }
-+ default:
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ break;
-+ }
-+ }
-+
-+}
-+
-+void SAL_CALL
-+SwVbaSelection::TypeParagraph() throw ( uno::RuntimeException )
-+{
-+ // #FIXME: if the selection is an entire paragraph, it's replaced
-+ // by the new paragraph
-+ sal_Bool isCollapsed = mxTextViewCursor->isCollapsed();
-+ InsertParagraph();
-+ if( isCollapsed )
-+ mxTextViewCursor->collapseToStart();
-+}
-+
-+void SAL_CALL
-+SwVbaSelection::InsertParagraph() throw ( uno::RuntimeException )
-+{
-+ // #FIME: the selection should include the new paragraph.
-+ getRange()->InsertParagraph();
-+}
-+
-+void SAL_CALL
-+SwVbaSelection::InsertParagraphBefore() throw ( uno::RuntimeException )
-+{
-+ getRange()->InsertParagraphBefore();
-+}
-+
-+void SAL_CALL
-+SwVbaSelection::InsertParagraphAfter() throw ( uno::RuntimeException )
-+{
-+ getRange()->InsertParagraphAfter();
-+}
-+
-+uno::Reference< word::XParagraphFormat > SAL_CALL
-+SwVbaSelection::getParagraphFormat() throw ( uno::RuntimeException )
-+{
-+ return getRange()->getParagraphFormat();
-+}
-+
-+void SAL_CALL
-+SwVbaSelection::setParagraphFormat( const uno::Reference< word::XParagraphFormat >& rParagraphFormat ) throw ( uno::RuntimeException )
-+{
-+ return getRange()->setParagraphFormat( rParagraphFormat );
-+}
-+
-+uno::Reference< word::XFind > SAL_CALL
-+SwVbaSelection::getFind() throw ( uno::RuntimeException )
-+{
-+ uno::Reference< text::XTextRange > xTextRange = GetSelectedRange();
-+ return uno::Reference< word::XFind >( new SwVbaFind( this, mxContext, mxModel, xTextRange ) );
-+}
-+
-+uno::Reference< word::XStyle > SAL_CALL
-+SwVbaSelection::getStyle() throw ( uno::RuntimeException )
-+{
-+ return getRange()->getStyle();
-+}
-+
-+void SAL_CALL
-+SwVbaSelection::setStyle( const uno::Reference< word::XStyle >& rStyle ) throw ( uno::RuntimeException )
-+{
-+ return getRange()->setStyle( rStyle );
-+}
-+
-+uno::Reference< word::XFont > SAL_CALL
-+SwVbaSelection::getFont() throw ( uno::RuntimeException )
-+{
-+ return getRange()->getFont();
-+}
-+
-+void SAL_CALL
-+SwVbaSelection::TypeBackspace() throw ( uno::RuntimeException )
-+{
-+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:SwBackspace"));
-+ dispatchRequests( mxModel,url );
-+}
-+
-+uno::Reference< word::XRange > SAL_CALL SwVbaSelection::GoTo( const uno::Any& _what, const uno::Any& _which, const uno::Any& _count, const uno::Any& _name ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nWhat;
-+ if( ( _what >>= nWhat ) != sal_True )
-+ DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
-+ switch( nWhat )
-+ {
-+ case word::WdGoToItem::wdGoToBookmark:
-+ {
-+ rtl::OUString sName;
-+ uno::Reference< word::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW );
-+ uno::Reference< word::XBookmark > xBookmark( xApplication->getActiveDocument()->Bookmarks(_name), uno::UNO_QUERY_THROW );
-+ xBookmark->Select();
-+ //return uno::Reference< word::XRange >( xBookmark->Range(), uno::UNO_QUERY_THROW );
-+ break;
-+ }
-+ case word::WdGoToItem::wdGoToPage:
-+ {
-+ uno::Reference< text::XPageCursor > xPageCursor( mxTextViewCursor, uno::UNO_QUERY_THROW );
-+ sal_Int32 nCurrPage = xPageCursor->getPage();
-+ sal_Int32 nLastPage = word::getPageCount( mxModel );
-+ sal_Int32 nCount = 0;
-+ if( _count.hasValue() )
-+ _count >>= nCount;
-+ sal_Int32 nWhich = 0;
-+ if( _which.hasValue() )
-+ _which >>= nWhich;
-+ sal_Int32 nPage = 0;
-+ switch( nWhich )
-+ {
-+ case word::WdGoToDirection::wdGoToLast:
-+ {
-+ nPage = nLastPage;
-+ break;
-+ }
-+ case word::WdGoToDirection::wdGoToNext:
-+ {
-+ nPage = nCurrPage + 1;
-+ break;
-+ }
-+ case word::WdGoToDirection::wdGoToPrevious:
-+ {
-+ nPage = nCurrPage - 1;
-+ break;
-+ }
-+ default:
-+ {
-+ nPage = nCount;
-+ }
-+ }
-+ if( nPage <= 0 )
-+ nPage = 1;
-+ if( nPage > nLastPage )
-+ nPage = nLastPage;
-+ xPageCursor->jumpToPage( ( sal_Int16 )( nPage ) );
-+ break;
-+ }
-+ case word::WdGoToItem::wdGoToSection:
-+ {
-+ // TODO: implement Section object
-+ }
-+ default:
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+ return getRange();
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaSelection::getLanguageID() throw (uno::RuntimeException)
-+{
-+ return getRange()->getLanguageID();
-+}
-+
-+void SAL_CALL SwVbaSelection::setLanguageID( ::sal_Int32 _languageid ) throw (uno::RuntimeException)
-+{
-+ getRange()->setLanguageID( _languageid );
-+}
-+
-+uno::Any SAL_CALL SwVbaSelection::Information( sal_Int32 _type ) throw (uno::RuntimeException)
-+{
-+ uno::Any result;
-+ //uno::Reference< view::XSelectionSupplier > xSel( mxModel->getCurrentController(), uno::UNO_QUERY_THROW );
-+ //uno::Any aSelectedObject = xSel->getSelection();
-+ switch( _type )
-+ {
-+ case word::WdInformation::wdActiveEndPageNumber:
-+ {
-+ result = uno::makeAny( SwVbaInformationHelper::handleWdActiveEndPageNumber( mxTextViewCursor ) );
-+ break;
-+ }
-+ case word::WdInformation::wdNumberOfPagesInDocument:
-+ {
-+ result = uno::makeAny( SwVbaInformationHelper::handleWdNumberOfPagesInDocument( mxModel ) );
-+ break;
-+ }
-+ case word::WdInformation::wdVerticalPositionRelativeToPage:
-+ {
-+ result = uno::makeAny( SwVbaInformationHelper::handleWdVerticalPositionRelativeToPage( mxModel, mxTextViewCursor ) );
-+ break;
-+ }
-+ default:
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+ // This method fails to restore the previouse selection
-+ //xSel->select( aSelectedObject );
-+ return result;
-+}
-+
-+void SAL_CALL SwVbaSelection::InsertBreak( const uno::Any& _breakType ) throw (uno::RuntimeException)
-+{
-+ getRange()->InsertBreak( _breakType );
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaSelection::Tables( const uno::Any& aIndex ) throw (uno::RuntimeException)
-+{
-+ // Hacky implementation due to missing api ( and lack of knowledge )
-+ // we can only support a selection that is a single table
-+ if ( !aIndex.hasValue() ) // currently we can't support multiple tables in a selection
-+ throw uno::RuntimeException();
-+ // if the current selection is a XTextTableCursor and the index is 1 then we can service this request, otherwise we just have to throw
-+ uno::Reference< text::XTextTableCursor > xTextTableCursor( mxModel->getCurrentSelection(), uno::UNO_QUERY );
-+
-+ if ( !xTextTableCursor.is() )
-+ throw uno::RuntimeException();
-+
-+ sal_Int32 nIndex = 0;
-+ aIndex >>= nIndex;
-+
-+ uno::Any aRet;
-+
-+ if ( nIndex != 1 )
-+ throw uno::RuntimeException();
-+ SwXTextTableCursor* pTTCursor = dynamic_cast< SwXTextTableCursor* >( xTextTableCursor.get() );
-+ if ( pTTCursor )
-+ {
-+ SwFrmFmt* pFmt = pTTCursor->GetFrmFmt();
-+ rtl::OUString sTableName;
-+ if ( pFmt )
-+ {
-+ uno::Reference< text::XTextTable > xTbl = SwXTextTables::GetObject(*pFmt);
-+ uno::Reference< css::text::XTextDocument > xTextDoc( mxModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< word::XTable > xVBATbl = new SwVbaTable( mxParent, mxContext, xTextDoc, xTbl );
-+ aRet <<= xVBATbl;
-+ }
-+ }
-+ return aRet;
-+
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaSelection::Fields( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< XCollection > xCol( new SwVbaFields( mxParent, mxContext, mxModel ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+uno::Reference< word::XHeaderFooter > SAL_CALL
-+SwVbaSelection::getHeaderFooter() throw ( uno::RuntimeException )
-+{
-+ uno::Reference< text::XText > xCurrentText = word::getXTextViewCursor( mxModel )->getText();
-+ if( HeaderFooterHelper::isHeader( mxModel, xCurrentText ) || HeaderFooterHelper::isFooter( mxModel, xCurrentText ) )
-+ {
-+ uno::Reference< beans::XPropertySet > xPageStyleProps( word::getCurrentPageStyle( mxModel ), uno::UNO_QUERY_THROW );
-+ sal_Int32 nIndex = word::WdHeaderFooterIndex::wdHeaderFooterPrimary;
-+ sal_Bool isHeader = HeaderFooterHelper::isHeader( mxModel, xCurrentText );
-+ if( HeaderFooterHelper::isEvenPagesHeader( mxModel, xCurrentText ) || HeaderFooterHelper::isEvenPagesFooter( mxModel, xCurrentText ) )
-+ nIndex = word::WdHeaderFooterIndex::wdHeaderFooterEvenPages;
-+ else if( HeaderFooterHelper::isFirstPageHeader( mxModel, xCurrentText ) || HeaderFooterHelper::isFirstPageFooter( mxModel, xCurrentText ) )
-+ nIndex = word::WdHeaderFooterIndex::wdHeaderFooterFirstPage;
-+
-+ return uno::Reference< word::XHeaderFooter >( new SwVbaHeaderFooter( this, mxContext, mxModel, xPageStyleProps, isHeader, nIndex ) );
-+
-+ }
-+ return uno::Reference< word::XHeaderFooter >();
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaSelection::ShapeRange( ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< drawing::XShapes > xShapes( mxModel->getCurrentSelection(), uno::UNO_QUERY );
-+
-+ if ( !xShapes.is() )
-+ throw uno::RuntimeException();
-+
-+ uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< drawing::XDrawPage > xDrawPage = xDrawPageSupplier->getDrawPage();
-+ uno::Reference< container::XIndexAccess > xShapesAccess( xShapes, uno::UNO_QUERY_THROW );
-+ return uno::makeAny( uno::Reference< msforms::XShapeRange >( new ScVbaShapeRange( this, mxContext, xShapesAccess, xDrawPage ) ) );
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaSelection::getStart() throw (uno::RuntimeException)
-+{
-+ return getRange()->getStart();
-+}
-+
-+void SAL_CALL SwVbaSelection::setStart( ::sal_Int32 _start ) throw (uno::RuntimeException)
-+{
-+ getRange()->setStart( _start );
-+}
-+::sal_Int32 SAL_CALL SwVbaSelection::getEnd() throw (uno::RuntimeException)
-+{
-+ return getRange()->getEnd();
-+}
-+
-+void SAL_CALL SwVbaSelection::setEnd( ::sal_Int32 _end ) throw (uno::RuntimeException)
-+{
-+ getRange()->setEnd( _end );
- }
-
- rtl::OUString&
-diff --git sw/source/ui/vba/vbaselection.hxx sw/source/ui/vba/vbaselection.hxx
-index 4d48068..83994f6 100644
---- sw/source/ui/vba/vbaselection.hxx
-+++ sw/source/ui/vba/vbaselection.hxx
-@@ -31,7 +31,14 @@
- #define SW_VBA_SELECTION_HXX
-
- #include <ooo/vba/word/XSelection.hpp>
-+#include <ooo/vba/word/XRange.hpp>
- #include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/text/XTextViewCursor.hpp>
-+#include <ooo/vba/word/XParagraphFormat.hpp>
-+#include <ooo/vba/word/XFind.hpp>
-+#include <ooo/vba/word/XStyle.hpp>
-+#include <ooo/vba/word/XFont.hpp>
-+#include <ooo/vba/word/XHeaderFooter.hpp>
-
- typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XSelection > SwVbaSelection_BASE;
-
-@@ -39,6 +46,20 @@ class SwVbaSelection : public SwVbaSelection_BASE
- {
- private:
- css::uno::Reference< css::frame::XModel > mxModel;
-+ css::uno::Reference< css::text::XTextViewCursor > mxTextViewCursor;
-+ css::uno::Reference< ooo::vba::word::XRange > mxRange;
-+
-+ enum E_DIRECTION
-+ {
-+ MOVE_LEFT = 1,
-+ MOVE_RIGHT,
-+ MOVE_UP,
-+ MOVE_DOWN
-+ };
-+
-+private:
-+ void NextCell( sal_Int32 nCount, E_DIRECTION eDirection ) throw ( css::uno::RuntimeException );
-+ css::uno::Reference< css::text::XTextRange > GetSelectedRange() throw ( css::uno::RuntimeException );
-
- public:
- SwVbaSelection( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& rModel ) throw ( css::uno::RuntimeException );
-@@ -47,7 +68,38 @@ public:
- // Attribute
- virtual rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setText( const rtl::OUString& rText ) throw (css::uno::RuntimeException);
--
-+ virtual css::uno::Reference< ooo::vba::word::XRange > SAL_CALL getRange() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL HomeKey( const css::uno::Any& _unit, const css::uno::Any& _extend ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL EndKey( const css::uno::Any& _unit, const css::uno::Any& _extend ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL TypeText( const rtl::OUString& rText ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL Delete( const css::uno::Any& _unit, const css::uno::Any& _count ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL MoveRight( const css::uno::Any& _unit, const css::uno::Any& _count, const css::uno::Any& _extend ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL MoveLeft( const css::uno::Any& _unit, const css::uno::Any& _count, const css::uno::Any& _extend ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL MoveDown( const css::uno::Any& _unit, const css::uno::Any& _count, const css::uno::Any& _extend ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL TypeParagraph() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL InsertParagraph() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL InsertParagraphBefore() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL InsertParagraphAfter() throw (css::uno::RuntimeException);
-+ virtual css::uno::Reference< ooo::vba::word::XParagraphFormat > SAL_CALL getParagraphFormat() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setParagraphFormat( const css::uno::Reference< ooo::vba::word::XParagraphFormat >& rParagraphFormat ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Reference< ooo::vba::word::XFind > SAL_CALL getFind() throw (css::uno::RuntimeException);
-+ virtual css::uno::Reference< ooo::vba::word::XStyle > SAL_CALL getStyle() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setStyle( const css::uno::Reference< ooo::vba::word::XStyle >& _xStyle ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Reference< ooo::vba::word::XFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL TypeBackspace() throw (css::uno::RuntimeException);
-+ virtual css::uno::Reference< ooo::vba::word::XRange > SAL_CALL GoTo( const css::uno::Any& _what, const css::uno::Any& _which, const css::uno::Any& _count, const css::uno::Any& _name ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getLanguageID( ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setLanguageID( ::sal_Int32 _languageid ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Information( sal_Int32 _type ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL InsertBreak( const css::uno::Any& _breakType ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Tables( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Fields( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Reference< ooo::vba::word::XHeaderFooter > SAL_CALL getHeaderFooter() throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL ShapeRange( ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getStart() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setStart( ::sal_Int32 _start ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getEnd() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setEnd( ::sal_Int32 _end ) throw (css::uno::RuntimeException);
-
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
-diff --git sw/source/ui/vba/vbastyle.cxx sw/source/ui/vba/vbastyle.cxx
-new file mode 100644
-index 0000000..f75c16b
---- /dev/null
-+++ sw/source/ui/vba/vbastyle.cxx
-@@ -0,0 +1,152 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#include "vbastyle.hxx"
-+#include <ooo/vba/word/WdStyleType.hpp>
-+#include <com/sun/star/lang/Locale.hpp>
-+#include <i18npool/mslangid.hxx>
-+#include "vbafont.hxx"
-+#include "vbapalette.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+
-+SwVbaStyle::SwVbaStyle( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< beans::XPropertySet >& _xPropertySet ) throw ( script::BasicErrorException, uno::RuntimeException ) : SwVbaStyle_BASE( xParent, xContext ) , mxStyleProps( _xPropertySet )
-+{
-+ mxStyle.set( _xPropertySet, uno::UNO_QUERY_THROW );
-+}
-+
-+void SAL_CALL
-+SwVbaStyle::setName( const ::rtl::OUString& Name ) throw (uno::RuntimeException)
-+{
-+ mxStyle->setName(Name);
-+}
-+
-+::rtl::OUString SAL_CALL
-+SwVbaStyle::getName() throw (uno::RuntimeException)
-+{
-+ return mxStyle->getName();
-+}
-+
-+sal_Int32 SwVbaStyle::getLanguageID( const uno::Reference< beans::XPropertySet >& xTCProps ) throw (uno::RuntimeException)
-+{
-+ lang::Locale aLocale;
-+ xTCProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CharLocale") ) ) >>= aLocale;
-+ return MsLangId::convertLocaleToLanguage( aLocale );
-+}
-+
-+void SwVbaStyle::setLanguageID( const uno::Reference< beans::XPropertySet >& xTCProps, sal_Int32 _languageid ) throw (uno::RuntimeException)
-+{
-+ lang::Locale aLocale = MsLangId::convertLanguageToLocale( _languageid );
-+ xTCProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CharLocale") ), uno::makeAny( aLocale ) ) ;
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaStyle::getLanguageID() throw (uno::RuntimeException)
-+{
-+ return getLanguageID( mxStyleProps );
-+}
-+
-+void SAL_CALL SwVbaStyle::setLanguageID( ::sal_Int32 _languageid ) throw (uno::RuntimeException)
-+{
-+ setLanguageID( mxStyleProps, _languageid );
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaStyle::getType() throw (uno::RuntimeException)
-+{
-+ sal_Int32 nType = word::WdStyleType::wdStyleTypeParagraph;
-+ uno::Reference< lang::XServiceInfo > xServiceInfo( mxStyle, uno::UNO_QUERY_THROW );
-+ if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.ParagraphStyle") ) ) )
-+ nType = word::WdStyleType::wdStyleTypeParagraph;
-+ else if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.CharacterStyle") ) ) )
-+ nType = word::WdStyleType::wdStyleTypeCharacter;
-+ else // if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.NumberingStyle") ) ) )
-+ nType = word::WdStyleType::wdStyleTypeList;
-+ return nType;
-+}
-+
-+uno::Reference< word::XFont > SAL_CALL
-+SwVbaStyle::getFont() throw ( uno::RuntimeException )
-+{
-+ VbaPalette aColors;
-+ return new SwVbaFont( mxParent, mxContext, aColors.getPalette(), mxStyleProps );
-+}
-+
-+void SwVbaStyle::setStyle( const uno::Reference< beans::XPropertySet >& xTCProps, const uno::Reference< ooo::vba::word::XStyle >& xStyle )throw (uno::RuntimeException)
-+{
-+ rtl::OUString aStyleType = getOOoStyleTypeFromMSWord( xStyle->getType() );
-+ xTCProps->setPropertyValue( aStyleType, uno::makeAny( xStyle->getName() ) );
-+}
-+
-+rtl::OUString SwVbaStyle::getOOoStyleTypeFromMSWord( sal_Int32 _wdStyleType )
-+{
-+ rtl::OUString aStyleType;
-+ switch( _wdStyleType )
-+ {
-+ case word::WdStyleType::wdStyleTypeParagraph:
-+ case word::WdStyleType::wdStyleTypeTable:
-+ {
-+ aStyleType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaStyleName") );
-+ break;
-+ }
-+ case word::WdStyleType::wdStyleTypeCharacter:
-+ {
-+ aStyleType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CharStyleName") );
-+ break;
-+ }
-+ case word::WdStyleType::wdStyleTypeList:
-+ {
-+ aStyleType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingStyleName") );
-+ break;
-+ }
-+ default:
-+ DebugHelper::exception( SbERR_INTERNAL_ERROR, rtl::OUString() );
-+ }
-+ return aStyleType;
-+}
-+
-+rtl::OUString&
-+SwVbaStyle::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaStyle") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaStyle::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.XStyle" ) );
-+ }
-+ return aServiceNames;
-+}
-diff --git sw/source/ui/vba/vbastyle.hxx sw/source/ui/vba/vbastyle.hxx
-new file mode 100644
-index 0000000..9a7f349
---- /dev/null
-+++ sw/source/ui/vba/vbastyle.hxx
-@@ -0,0 +1,70 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_STYLE_HXX
-+#define SW_VBA_STYLE_HXX
-+#include <ooo/vba/word/XStyle.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <com/sun/star/frame/XModel.hpp>
-+#include <com/sun/star/container/XNameContainer.hpp>
-+#include <com/sun/star/style/XStyle.hpp>
-+#include <ooo/vba/word/XFont.hpp>
-+
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XStyle > SwVbaStyle_BASE;
-+
-+class SwVbaStyle : public SwVbaStyle_BASE
-+{
-+private:
-+ css::uno::Reference< css::beans::XPropertySet > mxStyleProps;
-+ css::uno::Reference< css::style::XStyle > mxStyle;
-+public:
-+ SwVbaStyle( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::beans::XPropertySet >& _xPropertySet ) throw ( css::script::BasicErrorException, css::uno::RuntimeException );
-+ virtual ~SwVbaStyle(){}
-+
-+ static void setStyle( const css::uno::Reference< css::beans::XPropertySet >& xTCProps, const css::uno::Reference< ooo::vba::word::XStyle >& xStyle ) throw (css::uno::RuntimeException);
-+ static rtl::OUString getOOoStyleTypeFromMSWord( sal_Int32 _wdStyleType );
-+ static sal_Int32 getLanguageID( const css::uno::Reference< css::beans::XPropertySet >& xTCProps ) throw (css::uno::RuntimeException);
-+ static void setLanguageID( const css::uno::Reference< css::beans::XPropertySet >& xTCProps, sal_Int32 _languageid ) 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 ::sal_Int32 SAL_CALL getLanguageID( ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setLanguageID( ::sal_Int32 _languageid ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException);
-+ virtual css::uno::Reference< ooo::vba::word::XFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif //SW_VBA_AXIS_HXX
-diff --git sw/source/ui/vba/vbastyles.cxx sw/source/ui/vba/vbastyles.cxx
-new file mode 100644
-index 0000000..c178fe1
---- /dev/null
-+++ sw/source/ui/vba/vbastyles.cxx
-@@ -0,0 +1,380 @@
-+/*************************************************************************
-+ *
-+ * 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: vbastyles.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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbastyles.hxx"
-+#include "vbastyle.hxx"
-+#include <cppuhelper/implbase3.hxx>
-+#include <com/sun/star/container/XEnumerationAccess.hpp>
-+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
-+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
-+#include <com/sun/star/style/XStyle.hpp>
-+#include <ooo/vba/word/WdBuiltinStyle.hpp>
-+#include <ooo/vba/word/WdStyleType.hpp>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+struct BuiltinStyleTable
-+{
-+ sal_Int32 wdBuiltinStyle;
-+ const sal_Char* pOOoStyleName;
-+ sal_Int32 wdStyleType;
-+};
-+
-+const BuiltinStyleTable aBuiltinStyleTable[] =
-+{
-+ { word::WdBuiltinStyle::wdStyleBlockQuotation, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleBodyText, "Text body", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleBodyText2, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleBodyText3, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleBodyTextFirstIndent, "First line indent", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleBodyTextFirstIndent2, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleBodyTextIndent, "Text body indent", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleBodyTextIndent2, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleBodyTextIndent3, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleCaption, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleClosing, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleCommentReference, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleCommentText, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleDate, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleDefaultParagraphFont, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleEmphasis, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleEndnoteReference, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleEndnoteText, "Endnote", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleEnvelopeAddress, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleEnvelopeReturn, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleFooter, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleFootnoteReference, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleFootnoteText, "Footnote", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleHeader, "Header", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleHeading1, "Heading 1", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleHeading2, "Heading 2", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleHeading3, "Heading 3", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleHeading4, "Heading 4", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleHeading5, "Heading 5", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleHeading6, "Heading 6", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleHeading7, "Heading 7", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleHeading8, "Heading 8", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleHeading9, "Heading 9", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleHtmlAcronym, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleHtmlAddress, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleHtmlCite, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleHtmlCode, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleHtmlDfn, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleHtmlKbd, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleHtmlNormal, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleHtmlPre, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleHtmlSamp, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleHtmlTt, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleHtmlVar, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleHyperlink, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleHyperlinkFollowed, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleIndex1, "Index 1", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleIndex2, "Index 2", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleIndex3, "Index 3", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleIndex4, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleIndex5, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleIndex6, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleIndex7, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleIndex8, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleIndex9, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleIndexHeading, "Index Heading", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleLineNumber, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleList, "List", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleList2, "List 2", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleList3, "List 3", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleList4, "List 4", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleList5, "List 5", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleListBullet, "List 1", word::WdStyleType::wdStyleTypeList },
-+ { word::WdBuiltinStyle::wdStyleListBullet2, "List 2", word::WdStyleType::wdStyleTypeList },
-+ { word::WdBuiltinStyle::wdStyleListBullet3, "List 3", word::WdStyleType::wdStyleTypeList },
-+ { word::WdBuiltinStyle::wdStyleListBullet4, "List 4", word::WdStyleType::wdStyleTypeList },
-+ { word::WdBuiltinStyle::wdStyleListBullet5, "List 5", word::WdStyleType::wdStyleTypeList },
-+ { word::WdBuiltinStyle::wdStyleListContinue, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleListContinue2, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleListContinue3, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleListContinue4, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleListContinue5, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleListNumber, "Numbering 1", word::WdStyleType::wdStyleTypeList },
-+ { word::WdBuiltinStyle::wdStyleListNumber2, "Numbering 2", word::WdStyleType::wdStyleTypeList },
-+ { word::WdBuiltinStyle::wdStyleListNumber3, "Numbering 3", word::WdStyleType::wdStyleTypeList },
-+ { word::WdBuiltinStyle::wdStyleListNumber4, "Numbering 4", word::WdStyleType::wdStyleTypeList },
-+ { word::WdBuiltinStyle::wdStyleListNumber5, "Numbering 5", word::WdStyleType::wdStyleTypeList },
-+ { word::WdBuiltinStyle::wdStyleMacroText, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleMessageHeader, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleNavPane, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleNormal, "Default", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleNormalIndent, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleNormalTable, "Table", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleNoteHeading, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStylePageNumber, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStylePlainText, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleSalutation, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleSignature, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleStrong, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleSubtitle, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleTableOfAuthorities, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleTableOfFigures, "", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleTitle, "Title", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleTOAHeading, "Contents Heading", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleTOC1, "Contents 1", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleTOC2, "Contents 2", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleTOC3, "Contents 3", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleTOC4, "Contents 4", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleTOC5, "Contents 5", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleTOC6, "Contents 6", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleTOC7, "Contents 7", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleTOC8, "Contents 8", word::WdStyleType::wdStyleTypeParagraph },
-+ { word::WdBuiltinStyle::wdStyleTOC9, "Contents 9", word::WdStyleType::wdStyleTypeParagraph },
-+ { 0, 0, 0 }
-+};
-+
-+
-+static uno::Sequence< rtl::OUString > getStyleTypes()
-+{
-+ uno::Sequence< rtl::OUString > aRet(3);
-+ rtl::OUString* pArray = aRet.getArray();
-+ pArray[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParagraphStyles") );
-+ pArray[1] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CharacterStyles") );
-+ pArray[2] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingStyles") );
-+ return aRet;
-+}
-+
-+typedef ::cppu::WeakImplHelper1< container::XEnumeration > StyleEnumeration_BASE;
-+typedef ::cppu::WeakImplHelper3< container::XNameAccess, container::XIndexAccess, container::XEnumerationAccess > StyleCollectionHelper_BASE;
-+/*
-+class StylesEnumeration : public StyleEnumeration_BASE
-+{
-+public:
-+ StylesEnumeration( const SheetMap& sMap ) : mSheetMap( sMap ), mIt( mSheetMap.begin() ) {}
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( mIt != mSheetMap.end() );
-+ }
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( !hasMoreElements() )
-+ throw container::NoSuchElementException();
-+ uno::Reference< sheet::XSpreadsheet > xSheet( *mIt++ );
-+ return uno::makeAny( xSheet ) ;
-+ }
-+};
-+*/
-+class StyleCollectionHelper : public StyleCollectionHelper_BASE
-+{
-+private:
-+ uno::Reference< frame::XModel > mxModel;
-+ uno::Reference< container::XNameAccess > mxStyleFamilies;
-+ uno::Reference< container::XNameContainer > mxCurrentStyleFamily;
-+ uno::Any cachePos;
-+public:
-+ StyleCollectionHelper( const uno::Reference< frame::XModel >& _xModel ) : mxModel( _xModel )
-+ {
-+ uno::Reference< style::XStyleFamiliesSupplier > xStyleSupplier( _xModel, uno::UNO_QUERY_THROW);
-+ mxStyleFamilies = xStyleSupplier->getStyleFamilies();
-+ }
-+ uno::Reference< container::XNameContainer > getCurrentStyleFamily(){ return mxCurrentStyleFamily; }
-+ // XElementAccess
-+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) { return style::XStyle::static_type(0); }
-+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) { return getCount() > 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 cachePos;
-+ }
-+ virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException)
-+ {
-+ uno::Sequence< rtl::OUString > sNames( getCount() );
-+ rtl::OUString* pString = sNames.getArray();
-+ uno::Sequence< rtl::OUString > aStyleTypes = getStyleTypes();
-+ sal_Int32 nCount = 0;
-+ for( sal_Int32 i = 0; i < aStyleTypes.getLength(); i++ )
-+ {
-+ uno::Reference< container::XNameAccess > xNameAccess( mxStyleFamilies->getByName( aStyleTypes[i] ), uno::UNO_QUERY_THROW );
-+ uno::Sequence< rtl::OUString > sElementNames = xNameAccess->getElementNames();
-+ for( sal_Int32 j = 0; j < sElementNames.getLength(); j++ )
-+ {
-+ pString[nCount++] = sElementNames[j];
-+ }
-+ }
-+ return sNames;
-+ }
-+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
-+ {
-+ uno::Sequence< rtl::OUString > aStyleTypes = getStyleTypes();
-+ for( sal_Int32 i = 0; i < aStyleTypes.getLength(); i++ )
-+ {
-+ uno::Reference< container::XNameAccess > xNameAccess( mxStyleFamilies->getByName( aStyleTypes[i] ), uno::UNO_QUERY_THROW );
-+ if( xNameAccess->hasByName( aName ) )
-+ {
-+ cachePos = xNameAccess->getByName( aName );
-+ mxCurrentStyleFamily.set( xNameAccess, uno::UNO_QUERY_THROW );
-+ return sal_True;
-+ }
-+ }
-+ return sal_False;
-+ }
-+
-+ // XIndexAccess
-+ virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
-+ {
-+ uno::Sequence< rtl::OUString > aStyleTypes = getStyleTypes();
-+ sal_Int32 nCount = 0;
-+ for( sal_Int32 i = 0; i < aStyleTypes.getLength(); i++ )
-+ {
-+ uno::Reference< container::XIndexAccess > xIndexAccess( mxStyleFamilies->getByName( aStyleTypes[i] ), uno::UNO_QUERY_THROW );
-+ nCount += xIndexAccess->getCount();
-+ }
-+ return nCount;
-+ }
-+ virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
-+ {
-+ if ( Index < 0 || Index >= getCount() )
-+ throw lang::IndexOutOfBoundsException();
-+
-+ // FIXME: need to make a alphabetically sorted list of style names
-+ uno::Sequence< rtl::OUString > aStyleTypes = getStyleTypes();
-+ for( sal_Int32 i = 0; i < aStyleTypes.getLength(); i++ )
-+ {
-+ uno::Reference< container::XIndexAccess > xIndexAccess( mxStyleFamilies->getByName( aStyleTypes[i] ), uno::UNO_QUERY_THROW );
-+ sal_Int32 nCount = xIndexAccess->getCount();
-+ if( Index >= nCount )
-+ Index -= nCount;
-+ else
-+ {
-+ mxCurrentStyleFamily.set( xIndexAccess, uno::UNO_QUERY_THROW );
-+ return xIndexAccess->getByIndex( Index );
-+ }
-+ }
-+ throw lang::IndexOutOfBoundsException();
-+ }
-+ // XEnumerationAccess
-+ virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
-+ {
-+ // FIXME:
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+};
-+
-+SwVbaStyles::SwVbaStyles( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< css::uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel ) throw ( script::BasicErrorException ) : SwVbaStyles_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new StyleCollectionHelper( xModel ) ) ), mxModel( xModel )
-+{
-+ mxMSF.set( mxModel, uno::UNO_QUERY_THROW );
-+}
-+
-+uno::Any
-+SwVbaStyles::createCollectionObject(const uno::Any& aObject)
-+{
-+ uno::Reference< beans::XPropertySet > xStyleProp( aObject, uno::UNO_QUERY_THROW );
-+ return uno::makeAny( uno::Reference< word::XStyle >( new SwVbaStyle( this, mxContext, xStyleProp ) ) );
-+}
-+
-+uno::Type SAL_CALL
-+SwVbaStyles::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XStyle::static_type(0);
-+}
-+
-+uno::Reference< container::XEnumeration > SAL_CALL
-+SwVbaStyles::createEnumeration() throw (uno::RuntimeException)
-+{
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaStyles::Item( const uno::Any& Index1, const uno::Any& Index2 ) throw (uno::RuntimeException)
-+{
-+ //handle WdBuiltinStyle
-+ sal_Int32 nIndex = 0;
-+ if( ( Index1 >>= nIndex ) && ( nIndex < 0 ) )
-+ {
-+ for( const BuiltinStyleTable* pTable = aBuiltinStyleTable; pTable->wdBuiltinStyle != NULL; pTable++ )
-+ {
-+ if( nIndex == pTable->wdBuiltinStyle )
-+ {
-+ rtl::OUString aStyleName = rtl::OUString::createFromAscii( pTable->pOOoStyleName );
-+ if( aStyleName.getLength() > 0 )
-+ {
-+ rtl::OUString aStyleType = SwVbaStyle::getOOoStyleTypeFromMSWord( pTable->wdStyleType );
-+ switch( pTable->wdStyleType )
-+ {
-+ case word::WdStyleType::wdStyleTypeParagraph:
-+ case word::WdStyleType::wdStyleTypeTable:
-+ {
-+ aStyleType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParagraphStyles") );
-+ break;
-+ }
-+ case word::WdStyleType::wdStyleTypeCharacter:
-+ {
-+ aStyleType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CharacterStyles") );
-+ break;
-+ }
-+ case word::WdStyleType::wdStyleTypeList:
-+ {
-+ aStyleType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingStyles") );
-+ break;
-+ }
-+ default:
-+ DebugHelper::exception( SbERR_INTERNAL_ERROR, rtl::OUString() );
-+ }
-+ uno::Reference< style::XStyleFamiliesSupplier > xStyleSupplier( mxModel, uno::UNO_QUERY_THROW);
-+ uno::Reference< container::XNameAccess > xStylesAccess( xStyleSupplier->getStyleFamilies()->getByName( aStyleType ), uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xStyleProps( xStylesAccess->getByName( aStyleName ), uno::UNO_QUERY_THROW );
-+ return uno::makeAny( uno::Reference< word::XStyle >( new SwVbaStyle( this, mxContext, xStyleProps ) ) );
-+ }
-+ else
-+ {
-+ OSL_TRACE("SwVbaStyles::Item: the builtin style type is not implemented");
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ }
-+ }
-+ }
-+ }
-+ return SwVbaStyles_BASE::Item( Index1, Index2 );
-+}
-+
-+rtl::OUString&
-+SwVbaStyles::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaStyles") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaStyles::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.XStyles" ) );
-+ }
-+ return aServiceNames;
-+}
-diff --git sw/source/ui/vba/vbastyles.hxx sw/source/ui/vba/vbastyles.hxx
-new file mode 100644
-index 0000000..50f20d2
---- /dev/null
-+++ sw/source/ui/vba/vbastyles.hxx
-@@ -0,0 +1,54 @@
-+/*************************************************************************
-+ *
-+ * 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: vbastyles.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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_STYLES_HXX
-+#define SW_VBA_STYLES_HXX
-+
-+#include <ooo/vba/word/XStyles.hpp>
-+#include <vbahelper/vbacollectionimpl.hxx>
-+
-+typedef CollTestImplHelper< ooo::vba::word::XStyles > SwVbaStyles_BASE;
-+class SwVbaStyles: public SwVbaStyles_BASE
-+{
-+ css::uno::Reference< css::frame::XModel > mxModel;
-+ css::uno::Reference< css::lang::XMultiServiceFactory > mxMSF;
-+public:
-+ SwVbaStyles( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel ) throw ( css::script::BasicErrorException );
-+
-+ virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index1, const css::uno::Any& Index2 ) 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&);
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif
-diff --git sw/source/ui/vba/vbasystem.cxx sw/source/ui/vba/vbasystem.cxx
-index 29ea2e5..0b233a4 100644
---- sw/source/ui/vba/vbasystem.cxx
-+++ sw/source/ui/vba/vbasystem.cxx
-@@ -61,7 +61,7 @@ uno::Any PrivateProfileStringListener::getValueEvent()
- // get the private profile string
- Config aCfg( maFileName );
- aCfg.SetGroup( maGroupName );
-- rtl::OUString sValue = rtl::OUString( String( aCfg.ReadKey( maKey ), RTL_TEXTENCODING_UTF8 ) );
-+ rtl::OUString sValue = String( aCfg.ReadKey( maKey ), RTL_TEXTENCODING_DONTKNOW );
-
- return uno::makeAny( sValue );
- }
-@@ -74,7 +74,7 @@ void PrivateProfileStringListener::setValueEvent( const css::uno::Any& value )
-
- rtl::OUString aValue;
- value >>= aValue;
-- aCfg.WriteKey( maKey, ByteString( aValue.getStr(), RTL_TEXTENCODING_UTF8 ) );
-+ aCfg.WriteKey( maKey, ByteString( aValue.getStr(), RTL_TEXTENCODING_DONTKNOW ) );
- }
-
- SwVbaSystem::SwVbaSystem( uno::Reference<uno::XComponentContext >& xContext ): SwVbaSystem_BASE( uno::Reference< XHelperInterface >(), xContext )
-@@ -168,8 +168,8 @@ SwVbaSystem::PrivateProfileString( const rtl::OUString& rFilename, const rtl::OU
- else
- osl::FileBase::getFileURLFromSystemPath( rFilename, sFileUrl);
-
-- ByteString aGroupName = ByteString( rSection.getStr(), RTL_TEXTENCODING_UTF8);
-- ByteString aKey = ByteString( rKey.getStr(), RTL_TEXTENCODING_UTF8);
-+ ByteString aGroupName = ByteString( rSection.getStr(), RTL_TEXTENCODING_DONTKNOW);
-+ ByteString aKey = ByteString( rKey.getStr(), RTL_TEXTENCODING_DONTKNOW);
- maPrivateProfileStringListener.Initialize( sFileUrl, aGroupName, aKey );
-
- return uno::makeAny( uno::Reference< XPropValue > ( new ScVbaPropValue( &maPrivateProfileStringListener ) ) );
-diff --git sw/source/ui/vba/vbatable.cxx sw/source/ui/vba/vbatable.cxx
-new file mode 100644
-index 0000000..3a4ead5
---- /dev/null
-+++ sw/source/ui/vba/vbatable.cxx
-@@ -0,0 +1,97 @@
-+#include "vbatable.hxx"
-+#include "vbarange.hxx"
-+#include <com/sun/star/frame/XModel.hpp>
-+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
-+#include <com/sun/star/view/XSelectionSupplier.hpp>
-+#include <com/sun/star/text/XTextTable.hpp>
-+#include <com/sun/star/text/XTextTablesSupplier.hpp>
-+#include <com/sun/star/table/XTableRows.hpp>
-+#include <com/sun/star/container/XNamed.hpp>
-+#include "vbaborders.hxx"
-+#include "vbapalette.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaTable::SwVbaTable( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rDocument, const uno::Reference< css::text::XTextTable >& xTextTable) throw ( uno::RuntimeException ) : SwVbaTable_BASE( rParent, rContext ), mxTextDocument( rDocument )
-+{
-+ mxTextTable.set( xTextTable, uno::UNO_QUERY_THROW );
-+}
-+
-+uno::Reference< word::XRange > SAL_CALL
-+SwVbaTable::Range( ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ return new SwVbaRange( mxParent, mxContext, mxTextDocument, mxTextTable->getAnchor() );
-+}
-+
-+void SAL_CALL
-+SwVbaTable::Select( ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW );
-+ uno::Reference< frame::XController > xController = xModel->getCurrentController();
-+
-+ uno::Reference< text::XTextViewCursorSupplier > xViewCursorSupplier( xController, uno::UNO_QUERY_THROW );
-+ uno::Reference< view::XSelectionSupplier > xSelectionSupplier( xController, uno::UNO_QUERY_THROW );
-+
-+ // set the view cursor to the start of the table.
-+ xSelectionSupplier->select( uno::makeAny( mxTextTable ) );
-+
-+ // go to the end of the table and span the view
-+ uno::Reference< text::XTextViewCursor > xCursor = xViewCursorSupplier->getViewCursor();
-+ xCursor->gotoEnd(sal_True);
-+
-+}
-+
-+void SAL_CALL
-+SwVbaTable::Delete( ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ uno::Reference< table::XTableRows > xRows( mxTextTable->getRows() );
-+ xRows->removeByIndex( 0, xRows->getCount() );
-+}
-+
-+uno::Reference< word::XRange > SAL_CALL
-+SwVbaTable::ConvertToText( const uno::Any& Separator, const uno::Any& NestedTables ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ // #FIXME the helper api uses the dreaded dispatch mechanism, holding off
-+ // implementation while I look for alternative solution
-+ throw uno::RuntimeException();
-+}
-+
-+rtl::OUString SAL_CALL
-+SwVbaTable::getName() throw (uno::RuntimeException)
-+{
-+ uno::Reference< container::XNamed > xNamed( mxTextTable, uno::UNO_QUERY_THROW );
-+ return xNamed->getName();
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaTable::Borders( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< table::XCellRange > aCellRange( mxTextTable, uno::UNO_QUERY_THROW );
-+ VbaPalette aPalette;
-+ uno::Reference< XCollection > xCol( new SwVbaBorders( this, mxContext, aCellRange, aPalette ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+// XHelperInterface
-+rtl::OUString&
-+SwVbaTable::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaTable") );
-+ return sImplName;
-+}
-+
-+uno::Sequence<rtl::OUString>
-+SwVbaTable::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Table" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbatable.hxx sw/source/ui/vba/vbatable.hxx
-new file mode 100644
-index 0000000..3376007
---- /dev/null
-+++ sw/source/ui/vba/vbatable.hxx
-@@ -0,0 +1,28 @@
-+#ifndef SW_VBA_TABLE_HXX
-+#define SW_VBA_TABLE_HXX
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include <com/sun/star/text/XTextTable.hpp>
-+#include <ooo/vba/word/XRange.hpp>
-+#include <ooo/vba/word/XTable.hpp>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XTable > SwVbaTable_BASE;
-+
-+class SwVbaTable : public SwVbaTable_BASE
-+{
-+ css::uno::Reference< css::text::XTextDocument > mxTextDocument;
-+ css::uno::Reference< css::text::XTextTable > mxTextTable;
-+public:
-+ SwVbaTable( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rDocument, const css::uno::Reference< css::text::XTextTable >& xTextTable) throw ( css::uno::RuntimeException);;
-+ css::uno::Reference< css::text::XTextDocument > getDocument() { return mxTextDocument; };
-+ virtual css::uno::Reference< ::ooo::vba::word::XRange > SAL_CALL Range( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);;
-+ virtual void SAL_CALL Select( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-+ virtual void SAL_CALL Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-+ virtual css::uno::Reference< ::ooo::vba::word::XRange > SAL_CALL ConvertToText( const css::uno::Any& Separator, const css::uno::Any& NestedTables ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-+ virtual rtl::OUString SAL_CALL getName( ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Borders( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif
-diff --git sw/source/ui/vba/vbatables.cxx sw/source/ui/vba/vbatables.cxx
-new file mode 100644
-index 0000000..d6ea709
---- /dev/null
-+++ sw/source/ui/vba/vbatables.cxx
-@@ -0,0 +1,131 @@
-+#include "vbatables.hxx"
-+#include "vbatable.hxx"
-+#include "vbarange.hxx"
-+#include <com/sun/star/text/XTextTable.hpp>
-+#include <com/sun/star/text/XTextTablesSupplier.hpp>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include <comphelper/componentcontext.hxx>
-+
-+using namespace ::ooo::vba;
-+using namespace css;
-+
-+uno::Reference< container::XIndexAccess > lcl_getTables( const uno::Reference< frame::XModel >& xDoc )
-+{
-+ uno::Reference< container::XIndexAccess > xTables;
-+ uno::Reference< text::XTextTablesSupplier > xSupp( xDoc, uno::UNO_QUERY );
-+ if ( xSupp.is() )
-+ xTables.set( xSupp->getTextTables(), uno::UNO_QUERY_THROW );
-+ return xTables;
-+}
-+
-+uno::Any lcl_createTable( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xDocument, const uno::Any& aSource )
-+{
-+ uno::Reference< text::XTextTable > xTextTable( aSource, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextDocument > xTextDocument( xDocument, uno::UNO_QUERY_THROW );
-+ uno::Reference< word::XTable > xTable( new SwVbaTable( xParent, xContext, xTextDocument, xTextTable ) );
-+ return uno::makeAny( xTable );
-+}
-+
-+typedef ::cppu::WeakImplHelper1< css::container::XEnumeration > EnumBase;
-+
-+class TableEnumerationImpl : public EnumBase
-+{
-+ uno::Reference< XHelperInterface > mxParent;
-+ uno::Reference< uno::XComponentContext > mxContext;
-+ uno::Reference< frame::XModel > mxDocument;
-+ uno::Reference< container::XIndexAccess > mxIndexAccess;
-+ sal_Int32 mnCurIndex;
-+public:
-+ TableEnumerationImpl( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xDocument, const uno::Reference< container::XIndexAccess >& xIndexAccess ) : mxParent( xParent ), mxContext( xContext ), mxDocument( xDocument ), mxIndexAccess( xIndexAccess ), mnCurIndex(0)
-+ {
-+ }
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return ( mnCurIndex < mxIndexAccess->getCount() );
-+ }
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( !hasMoreElements() )
-+ throw container::NoSuchElementException();
-+ return lcl_createTable( mxParent, mxContext, mxDocument, mxIndexAccess->getByIndex( mnCurIndex++ ) );
-+ }
-+
-+};
-+
-+SwVbaTables::SwVbaTables( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xDocument ) : SwVbaTables_BASE( xParent, xContext , lcl_getTables( xDocument ) ), mxDocument( xDocument )
-+{
-+}
-+
-+
-+uno::Reference< word::XTable > SAL_CALL
-+SwVbaTables::Add( const uno::Reference< word::XRange >& Range, const uno::Any& NumRows, const uno::Any& NumColumns, const uno::Any& DefaultTableBehavior, const uno::Any& AutoFitBehavior ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ sal_Int32 nCols = 0;
-+ sal_Int32 nRows = 0;
-+ SwVbaRange* pVbaRange = dynamic_cast< SwVbaRange* >( Range.get() );
-+ // Preconditions
-+ if ( !( pVbaRange && ( NumRows >>= nRows ) && ( NumColumns >>= nCols ) ) )
-+ throw uno::RuntimeException(); // #FIXME better exception??
-+ if ( nCols <= 0 || nRows <= 0 )
-+ throw uno::RuntimeException(); // #FIXME better exception??
-+
-+ uno::Reference< frame::XModel > xModel( pVbaRange->getDocument(), uno::UNO_QUERY_THROW );
-+ uno::Reference< lang::XMultiServiceFactory > xMsf( xModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextRange > xTextRange = pVbaRange->getXTextRange();
-+
-+ uno::Reference< text::XTextTable > xTable;
-+ xTable.set( xMsf->createInstance( rtl::OUString::createFromAscii("com.sun.star.text.TextTable") ), uno::UNO_QUERY_THROW );
-+/*
-+ comphelper::ComponentContext aCtx( xMsf );
-+ if ( !aCtx.createComponent( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextTable") ), xTable ) );
-+ throw uno::RuntimeException(); // #FIXME better exception??
-+*/
-+ xTable->initialize( nRows, nCols );
-+ uno::Reference< text::XText > xText = xTextRange->getText();
-+ uno::Reference< text::XTextContent > xContext( xTable, uno::UNO_QUERY_THROW );
-+
-+ xText->insertTextContent( xTextRange, xContext, true );
-+ uno::Reference< word::XTable > xVBATable( new SwVbaTable( mxParent, mxContext, pVbaRange->getDocument(), xTable ) );
-+ return xVBATable;
-+}
-+
-+uno::Reference< container::XEnumeration > SAL_CALL
-+SwVbaTables::createEnumeration() throw (uno::RuntimeException)
-+{
-+ return new TableEnumerationImpl( mxParent, mxContext, mxDocument, m_xIndexAccess );
-+}
-+
-+// ScVbaCollectionBaseImpl
-+uno::Any
-+SwVbaTables::createCollectionObject( const uno::Any& aSource )
-+{
-+ return lcl_createTable( mxParent, mxContext, mxDocument, aSource );
-+}
-+
-+// XHelperInterface
-+rtl::OUString&
-+SwVbaTables::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaTables") );
-+ return sImplName;
-+}
-+
-+// XEnumerationAccess
-+uno::Type SAL_CALL
-+SwVbaTables::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XTable::static_type(0);
-+}
-+
-+uno::Sequence<rtl::OUString>
-+SwVbaTables::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Tables" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git sw/source/ui/vba/vbatables.hxx sw/source/ui/vba/vbatables.hxx
-new file mode 100644
-index 0000000..79df2f9
---- /dev/null
-+++ sw/source/ui/vba/vbatables.hxx
-@@ -0,0 +1,28 @@
-+#ifndef SW_VBA_TABLES_HXX
-+#define SW_VBA_TABLES_HXX
-+
-+#include <ooo/vba/word/XTables.hpp>
-+#include <vbahelper/vbacollectionimpl.hxx>
-+
-+
-+typedef CollTestImplHelper< ov::word::XTables > SwVbaTables_BASE;
-+
-+class SwVbaTables : public SwVbaTables_BASE
-+{
-+ css::uno::Reference< css::frame::XModel > mxDocument;
-+public:
-+ SwVbaTables( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xDocument );
-+ // XTables
-+ virtual css::uno::Reference< ov::word::XTable > SAL_CALL Add( const css::uno::Reference< ::ooo::vba::word::XRange >& Range, const css::uno::Any& NumRows, const css::uno::Any& NumColumns, const css::uno::Any& DefaultTableBehavior, const css::uno::Any& AutoFitBehavior ) 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);
-+ // ScVbaCollectionBaseImpl
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif
-diff --git sw/source/ui/vba/vbatemplate.cxx sw/source/ui/vba/vbatemplate.cxx
-index 11c1a59..9413428 100644
---- sw/source/ui/vba/vbatemplate.cxx
-+++ sw/source/ui/vba/vbatemplate.cxx
-@@ -30,6 +30,9 @@
- #include "vbatemplate.hxx"
- #include <vbahelper/vbahelper.hxx>
- #include "wordvbahelper.hxx"
-+#include "vbaautotextentry.hxx"
-+#include <comphelper/processfactory.hxx>
-+#include <com/sun/star/text/XAutoTextContainer.hpp>
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-@@ -49,6 +52,38 @@ SwVbaTemplate::getName() throw ( css::uno::RuntimeException )
- {
- return msName;
- }
-+
-+uno::Any SAL_CALL
-+SwVbaTemplate::AutoTextEntries( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< lang::XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory();
-+ uno::Reference< text::XAutoTextContainer > xAutoTextContainer( xMgr->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.AutoTextContainer") ) ), uno::UNO_QUERY_THROW );
-+
-+ // the default template is "Normal.dot" in Word.
-+ rtl::OUString sGroup( RTL_CONSTASCII_USTRINGPARAM("Normal") );
-+ if( sal_Int32 nIndex = msName.lastIndexOf( sal_Unicode('.') ) > 0 )
-+ {
-+ sGroup = msName.copy( 0, msName.lastIndexOf( sal_Unicode('.') ) );
-+ // OSL_TRACE("SwVbaTemplate::AutoTextEntries: %s", rtl::OUStringToOString( sGroup, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ }
-+
-+ uno::Reference< container::XIndexAccess > xGroup;
-+ if( xAutoTextContainer->hasByName( sGroup ) )
-+ {
-+ xGroup.set( xAutoTextContainer->getByName( sGroup ), uno::UNO_QUERY_THROW );
-+ }
-+ else
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Auto Text Entry doesn't exist") ), uno::Reference< uno::XInterface >() );
-+ //xGroup.set( xAutoTextContainer->insertNewByName( sGroup ), uno::UNO_QUERY_THROW );
-+ }
-+
-+ uno::Reference< XCollection > xCol( new SwVbaAutoTextEntries( this, mxContext, xGroup ) );
-+ if( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
- rtl::OUString&
- SwVbaTemplate::getServiceImplName()
- {
-diff --git sw/source/ui/vba/vbatemplate.hxx sw/source/ui/vba/vbatemplate.hxx
-index 63a2f26..df8848b 100644
---- sw/source/ui/vba/vbatemplate.hxx
-+++ sw/source/ui/vba/vbatemplate.hxx
-@@ -47,6 +47,7 @@ public:
-
- // XTemplate
- virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL AutoTextEntries( const css::uno::Any& index ) throw (css::uno::RuntimeException);
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-diff --git sw/source/ui/vba/vbaview.cxx sw/source/ui/vba/vbaview.cxx
-index b9b52f4..bc7b9b4 100644
---- sw/source/ui/vba/vbaview.cxx
-+++ sw/source/ui/vba/vbaview.cxx
-@@ -34,10 +34,14 @@
- #include <com/sun/star/view/XViewSettingsSupplier.hpp>
- #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
- #include <com/sun/star/text/XText.hpp>
-+#include <com/sun/star/text/XTextTable.hpp>
-+#include <com/sun/star/table/XCellRange.hpp>
- #include <com/sun/star/text/XTextDocument.hpp>
- #include <com/sun/star/text/XFootnotesSupplier.hpp>
- #include <com/sun/star/text/XEndnotesSupplier.hpp>
- #include <com/sun/star/container/XIndexAccess.hpp>
-+#include <com/sun/star/container/XEnumerationAccess.hpp>
-+#include <com/sun/star/container/XEnumeration.hpp>
- #include <com/sun/star/frame/XController.hpp>
- #include <com/sun/star/lang/XServiceInfo.hpp>
- #include <ooo/vba/word/WdSpecialPane.hpp>
-@@ -45,12 +49,13 @@
- #include <ooo/vba/word/WdSeekView.hpp>
-
- #include "wordvbahelper.hxx"
-+#include "vbaheaderfooterhelper.hxx"
- #include <view.hxx>
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-
--const sal_Int32 DEFAULT_BODY_DISTANCE = 500;
-+static const sal_Int32 DEFAULT_BODY_DISTANCE = 500;
-
- SwVbaView::SwVbaView( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext,
- const uno::Reference< frame::XModel >& rModel ) throw ( uno::RuntimeException ) :
-@@ -72,7 +77,16 @@ SwVbaView::~SwVbaView()
- ::sal_Int32 SAL_CALL
- SwVbaView::getSeekView() throw (css::uno::RuntimeException)
- {
-+ // FIXME: if the view cursor is in table, field, section and frame
-+ // handle if the cursor is in table
- uno::Reference< text::XText > xCurrentText = mxViewCursor->getText();
-+ uno::Reference< beans::XPropertySet > xCursorProps( mxViewCursor, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextContent > xTextContent;
-+ while( xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ) >>= xTextContent )
-+ {
-+ xCurrentText = xTextContent->getAnchor()->getText();
-+ xCursorProps.set( xCurrentText->createTextCursor(), uno::UNO_QUERY_THROW );
-+ }
- uno::Reference< lang::XServiceInfo > xServiceInfo( xCurrentText, uno::UNO_QUERY_THROW );
- rtl::OUString aImplName = xServiceInfo->getImplementationName();
- if( aImplName.equalsAscii("SwXBodyText") )
-@@ -81,20 +95,20 @@ SwVbaView::getSeekView() throw (css::uno::RuntimeException)
- }
- else if( aImplName.equalsAscii("SwXHeadFootText") )
- {
-- if( word::HeaderFooterHelper::isHeader( mxModel, xCurrentText ) )
-+ if( HeaderFooterHelper::isHeader( mxModel, xCurrentText ) )
- {
-- if( word::HeaderFooterHelper::isFirstPageHeader( mxModel, xCurrentText ) )
-+ if( HeaderFooterHelper::isFirstPageHeader( mxModel, xCurrentText ) )
- return word::WdSeekView::wdSeekFirstPageHeader;
-- else if( word::HeaderFooterHelper::isEvenPagesHeader( mxModel, xCurrentText ) )
-+ else if( HeaderFooterHelper::isEvenPagesHeader( mxModel, xCurrentText ) )
- return word::WdSeekView::wdSeekEvenPagesHeader;
- else
- return word::WdSeekView::wdSeekPrimaryHeader;
- }
- else
- {
-- if( word::HeaderFooterHelper::isFirstPageFooter( mxModel, xCurrentText ) )
-+ if( HeaderFooterHelper::isFirstPageFooter( mxModel, xCurrentText ) )
- return word::WdSeekView::wdSeekFirstPageFooter;
-- else if( word::HeaderFooterHelper::isEvenPagesFooter( mxModel, xCurrentText ) )
-+ else if( HeaderFooterHelper::isEvenPagesFooter( mxModel, xCurrentText ) )
- return word::WdSeekView::wdSeekEvenPagesFooter;
- else
- return word::WdSeekView::wdSeekPrimaryFooter;
-@@ -114,8 +128,12 @@ SwVbaView::getSeekView() throw (css::uno::RuntimeException)
- void SAL_CALL
- SwVbaView::setSeekView( ::sal_Int32 _seekview ) throw (css::uno::RuntimeException)
- {
-- if( _seekview == getSeekView() )
-- return;
-+ // FIXME: save the current cursor position, if the cursor is in the main
-+ // document, so we can jump back to this position, if the macro sets
-+ // the ViewMode back to wdSeekMainDocument
-+
-+ // if( _seekview == getSeekView() )
-+ // return;
-
- switch( _seekview )
- {
-@@ -166,7 +184,7 @@ SwVbaView::setSeekView( ::sal_Int32 _seekview ) throw (css::uno::RuntimeExceptio
- {
- uno::Reference< text::XTextDocument > xTextDocument( mxModel, uno::UNO_QUERY_THROW );
- uno::Reference< text::XText > xText = xTextDocument->getText();
-- mxViewCursor->gotoRange( xText->getStart(), sal_False );
-+ mxViewCursor->gotoRange( getFirstObjectPosition( xText ), sal_False );
- break;
- }
- }
-@@ -214,6 +232,7 @@ SwVbaView::setType( ::sal_Int32 _type ) throw (css::uno::RuntimeException)
- switch( _type )
- {
- case word::WdViewType::wdPrintView:
-+ case word::WdViewType::wdNormalView:
- {
- mxViewSettings->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ShowOnlineLayout")), uno::makeAny( sal_False ) );
- break;
-@@ -360,7 +379,29 @@ uno::Reference< text::XTextRange > SwVbaView::getHFTextRange( sal_Int32 nType )
- {
- DebugHelper::exception( SbERR_INTERNAL_ERROR, rtl::OUString() );
- }
-- return xText->getStart();
-+ uno::Reference< text::XTextRange > xTextRange = getFirstObjectPosition( xText );
-+ return xTextRange;
-+}
-+
-+uno::Reference< text::XTextRange > SwVbaView::getFirstObjectPosition( const uno::Reference< text::XText >& xText ) throw (uno::RuntimeException)
-+{
-+ // if the first object is table, get the position of first cell
-+ uno::Reference< text::XTextRange > xTextRange;
-+ uno::Reference< container::XEnumerationAccess > xParaAccess( xText, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XEnumeration> xParaEnum = xParaAccess->createEnumeration();
-+ if( xParaEnum->hasMoreElements() )
-+ {
-+ uno::Reference< lang::XServiceInfo > xServiceInfo( xParaEnum->nextElement(), uno::UNO_QUERY_THROW );
-+ if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextTable") ) ) )
-+ {
-+ uno::Reference< table::XCellRange > xCellRange( xServiceInfo, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XText> xFirstCellText( xCellRange->getCellByPosition(0, 0), uno::UNO_QUERY_THROW );
-+ xTextRange = xFirstCellText->getStart();
-+ }
-+ }
-+ if( !xTextRange.is() )
-+ xTextRange = xText->getStart();
-+ return xTextRange;
- }
-
- rtl::OUString&
-diff --git sw/source/ui/vba/vbaview.hxx sw/source/ui/vba/vbaview.hxx
-index 4aa07a3..47675a5 100644
---- sw/source/ui/vba/vbaview.hxx
-+++ sw/source/ui/vba/vbaview.hxx
-@@ -34,6 +34,7 @@
- #include <vbahelper/vbahelperinterface.hxx>
- #include <com/sun/star/text/XTextViewCursor.hpp>
- #include <com/sun/star/text/XTextRange.hpp>
-+#include <com/sun/star/text/XText.hpp>
- #include <com/sun/star/beans/XPropertySet.hpp>
-
- typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XView > SwVbaView_BASE;
-@@ -46,6 +47,7 @@ private:
- css::uno::Reference< css::beans::XPropertySet > mxViewSettings;
-
- css::uno::Reference< css::text::XTextRange > getHFTextRange( sal_Int32 nType ) throw (css::uno::RuntimeException);
-+ css::uno::Reference< css::text::XTextRange > getFirstObjectPosition( const css::uno::Reference< css::text::XText >& xText ) throw (css::uno::RuntimeException);
-
- public:
- SwVbaView( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext,
-diff --git sw/source/ui/vba/vbawrapformat.cxx sw/source/ui/vba/vbawrapformat.cxx
-new file mode 100644
-index 0000000..a169e95
---- /dev/null
-+++ sw/source/ui/vba/vbawrapformat.cxx
-@@ -0,0 +1,260 @@
-+/*************************************************************************
-+ *
-+ * 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: vbawrapformat.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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbawrapformat.hxx"
-+#include <ooo/vba/word/WdWrapSideType.hpp>
-+#include <ooo/vba/word/WdWrapType.hpp>
-+#include <com/sun/star/text/WrapTextMode.hpp>
-+#include <vbahelper/vbahelper.hxx>
-+#include <vbahelper/helperdecl.hxx>
-+
-+using namespace ooo::vba;
-+using namespace com::sun::star;
-+
-+SwVbaWrapFormat::SwVbaWrapFormat( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape > xShape ) : SwVbaWrapFormat_BASE( xParent, xContext ), m_xShape( xShape ), mnWrapFormatType( 0 ), mnSide( word::WdWrapSideType::wdWrapBoth )
-+{
-+ m_xPropertySet.set( xShape, uno::UNO_QUERY_THROW );
-+}
-+
-+SwVbaWrapFormat::SwVbaWrapFormat( uno::Sequence< uno::Any > const& aArgs, uno::Reference< uno::XComponentContext >const& xContext ) : SwVbaWrapFormat_BASE( getXSomethingFromArgs< XHelperInterface >( aArgs, 0 ), xContext ), m_xShape( getXSomethingFromArgs< drawing::XShape >( aArgs, 1, false ) ), mnWrapFormatType( 0 ), mnSide( word::WdWrapSideType::wdWrapBoth )
-+{
-+ m_xPropertySet.set( m_xShape, uno::UNO_QUERY_THROW );
-+}
-+
-+void SwVbaWrapFormat::makeWrap() throw (uno::RuntimeException)
-+{
-+ text::WrapTextMode eTextMode = text::WrapTextMode_NONE;
-+ if( mnSide == word::WdWrapSideType::wdWrapLeft )
-+ {
-+ eTextMode = text::WrapTextMode_LEFT;
-+ }
-+ else if( mnSide == word::WdWrapSideType::wdWrapRight )
-+ {
-+ eTextMode = text::WrapTextMode_RIGHT;
-+ }
-+ else if( mnSide == word::WdWrapSideType::wdWrapBoth ||
-+ mnSide == word::WdWrapSideType::wdWrapLargest )
-+ {
-+ switch( mnWrapFormatType )
-+ {
-+ case word::WdWrapType::wdWrapNone:
-+ case word::WdWrapType::wdWrapThrough:
-+ {
-+ eTextMode = text::WrapTextMode_THROUGHT;
-+ break;
-+ }
-+ case word::WdWrapType::wdWrapInline:
-+ case word::WdWrapType::wdWrapTopBottom:
-+ {
-+ eTextMode = text::WrapTextMode_NONE;
-+ break;
-+ }
-+ case word::WdWrapType::wdWrapSquare:
-+ {
-+ eTextMode = text::WrapTextMode_PARALLEL;
-+ m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SurroundContour") ), uno::makeAny( sal_False ) );
-+ break;
-+ }
-+ case word::WdWrapType::wdWrapTight:
-+ {
-+ eTextMode = text::WrapTextMode_PARALLEL;
-+ m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SurroundContour") ), uno::makeAny( sal_True ) );
-+ break;
-+ }
-+ default:
-+ {
-+ DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
-+ }
-+ }
-+ }
-+ m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextWrap") ), uno::makeAny( eTextMode ) );
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaWrapFormat::getType() throw (uno::RuntimeException)
-+{
-+ sal_Int32 nType = word::WdWrapType::wdWrapSquare;
-+ text::WrapTextMode eTextMode;
-+ m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextWrap") )) >>= eTextMode;
-+ switch( eTextMode )
-+ {
-+ case text::WrapTextMode_NONE:
-+ {
-+ nType = word::WdWrapType::wdWrapTopBottom;
-+ break;
-+ }
-+ case text::WrapTextMode_THROUGHT:
-+ {
-+ nType = word::WdWrapType::wdWrapNone;
-+ break;
-+ }
-+ case text::WrapTextMode_PARALLEL:
-+ {
-+ sal_Bool bContour = sal_False;
-+ m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SurroundContour") )) >>= bContour;
-+ if( bContour )
-+ nType = word::WdWrapType::wdWrapTight;
-+ else
-+ nType = word::WdWrapType::wdWrapSquare;
-+ break;
-+ }
-+ case text::WrapTextMode_DYNAMIC:
-+ case text::WrapTextMode_LEFT:
-+ case text::WrapTextMode_RIGHT:
-+ {
-+ nType = word::WdWrapType::wdWrapThrough;
-+ break;
-+ }
-+ default:
-+ {
-+ nType = word::WdWrapType::wdWrapSquare;
-+ }
-+ }
-+ return nType;
-+}
-+
-+void SAL_CALL SwVbaWrapFormat::setType( ::sal_Int32 _type ) throw (uno::RuntimeException)
-+{
-+ mnWrapFormatType = _type;
-+ makeWrap();
-+}
-+
-+::sal_Int32 SAL_CALL SwVbaWrapFormat::getSide() throw (uno::RuntimeException)
-+{
-+ sal_Int32 nSide = word::WdWrapSideType::wdWrapBoth;
-+ text::WrapTextMode eTextMode;
-+ m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextWrap") )) >>= eTextMode;
-+ switch( eTextMode )
-+ {
-+ case text::WrapTextMode_LEFT:
-+ {
-+ nSide = word::WdWrapSideType::wdWrapLeft;
-+ break;
-+ }
-+ case text::WrapTextMode_RIGHT:
-+ {
-+ nSide = word::WdWrapSideType::wdWrapRight;
-+ break;
-+ }
-+ default:
-+ {
-+ nSide = word::WdWrapSideType::wdWrapBoth;
-+ }
-+ }
-+ return nSide;
-+}
-+
-+void SAL_CALL SwVbaWrapFormat::setSide( ::sal_Int32 _side ) throw (uno::RuntimeException)
-+{
-+ mnSide = _side;
-+ makeWrap();
-+}
-+
-+float SwVbaWrapFormat::getDistance( const rtl::OUString& sName ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nDistance = 0;
-+ m_xPropertySet->getPropertyValue( sName ) >>= nDistance;
-+ return static_cast< float >( Millimeter::getInPoints( nDistance ) );
-+}
-+
-+void SwVbaWrapFormat::setDistance( const rtl::OUString& sName, float _distance ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nDistance = Millimeter::getInHundredthsOfOneMillimeter( _distance );
-+ m_xPropertySet->setPropertyValue( sName, uno::makeAny( nDistance ) );
-+}
-+
-+float SAL_CALL SwVbaWrapFormat::getDistanceTop() throw (uno::RuntimeException)
-+{
-+ return getDistance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin") ) );
-+}
-+
-+void SAL_CALL SwVbaWrapFormat::setDistanceTop( float _distancetop ) throw (uno::RuntimeException)
-+{
-+ setDistance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin") ), _distancetop );
-+}
-+
-+float SAL_CALL SwVbaWrapFormat::getDistanceBottom() throw (uno::RuntimeException)
-+{
-+ return getDistance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin") ) );
-+}
-+
-+void SAL_CALL SwVbaWrapFormat::setDistanceBottom( float _distancebottom ) throw (uno::RuntimeException)
-+{
-+ setDistance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin") ), _distancebottom );
-+}
-+
-+float SAL_CALL SwVbaWrapFormat::getDistanceLeft() throw (uno::RuntimeException)
-+{
-+ return getDistance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftMargin") ) );
-+}
-+
-+void SAL_CALL SwVbaWrapFormat::setDistanceLeft( float _distanceleft ) throw (uno::RuntimeException)
-+{
-+ setDistance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftMargin") ), _distanceleft );
-+}
-+
-+float SAL_CALL SwVbaWrapFormat::getDistanceRight() throw (uno::RuntimeException)
-+{
-+ return getDistance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightMargin") ) );
-+}
-+
-+void SAL_CALL SwVbaWrapFormat::setDistanceRight( float _distanceright ) throw (uno::RuntimeException)
-+{
-+ setDistance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightMargin") ), _distanceright );
-+}
-+
-+rtl::OUString&
-+SwVbaWrapFormat::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaWrapFormat") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaWrapFormat::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.WrapFormat" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-+namespace wrapformat
-+{
-+namespace sdecl = comphelper::service_decl;
-+sdecl::vba_service_class_<SwVbaWrapFormat, sdecl::with_args<true> > serviceImpl;
-+extern sdecl::ServiceDecl const serviceDecl(
-+ serviceImpl,
-+ "SwVbaWrapFormat",
-+ "ooo.vba.word.WrapFormat" );
-+}
-+
-+
-diff --git sw/source/ui/vba/vbawrapformat.hxx sw/source/ui/vba/vbawrapformat.hxx
-new file mode 100644
-index 0000000..6ef75ba
---- /dev/null
-+++ sw/source/ui/vba/vbawrapformat.hxx
-@@ -0,0 +1,73 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_XWRAPFORMAT_HXX
-+#define SW_VBA_XWRAPFORMAT_HXX
-+
-+#include <com/sun/star/drawing/XShape.hpp>
-+#include <ooo/vba/word/XWrapFormat.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XWrapFormat > SwVbaWrapFormat_BASE;
-+
-+class SwVbaWrapFormat : public SwVbaWrapFormat_BASE
-+{
-+private:
-+ css::uno::Reference< css::drawing::XShape > m_xShape;
-+ css::uno::Reference< css::beans::XPropertySet > m_xPropertySet;
-+ sal_Int32 mnWrapFormatType;
-+ sal_Int32 mnSide;
-+
-+private:
-+ void makeWrap() throw (css::uno::RuntimeException);
-+ float getDistance( const rtl::OUString& sName ) throw (css::uno::RuntimeException);
-+ void setDistance( const rtl::OUString& sName, float _distance ) throw (css::uno::RuntimeException);
-+
-+public:
-+ SwVbaWrapFormat( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape > xShape );
-+ SwVbaWrapFormat( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext );
-+
-+ virtual ::sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setType( ::sal_Int32 _type ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getSide() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setSide( ::sal_Int32 _side ) throw (css::uno::RuntimeException);
-+ virtual float SAL_CALL getDistanceTop() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setDistanceTop( float _distancetop ) throw (css::uno::RuntimeException);
-+ virtual float SAL_CALL getDistanceBottom() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setDistanceBottom( float _distancebottom ) throw (css::uno::RuntimeException);
-+ virtual float SAL_CALL getDistanceLeft() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setDistanceLeft( float _distanceleft ) throw (css::uno::RuntimeException);
-+ virtual float SAL_CALL getDistanceRight() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setDistanceRight( float _distanceright ) throw (css::uno::RuntimeException);
-+
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif//SW_VBA_XWRAPFORMAT_HXX
-diff --git sw/source/ui/vba/wordvbahelper.cxx sw/source/ui/vba/wordvbahelper.cxx
-index 00f40fd..409b8bd 100644
---- sw/source/ui/vba/wordvbahelper.cxx
-+++ sw/source/ui/vba/wordvbahelper.cxx
-@@ -36,6 +36,7 @@
- #include <com/sun/star/container/XNameAccess.hpp>
- #include <com/sun/star/lang/XUnoTunnel.hpp>
- #include <unotxdoc.hxx>
-+#include <doc.hxx>
-
- using namespace ::com::sun::star;
- using namespace ::ooo::vba;
-@@ -83,123 +84,10 @@ uno::Reference< style::XStyle > getCurrentPageStyle( const uno::Reference< frame
- return xStyle;
- }
-
--// Class HeaderFooterHelper
--
--sal_Bool HeaderFooterHelper::isHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
--{
-- uno::Reference< text::XPageCursor > xPageCursor( getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
-- uno::Reference< beans::XPropertySet > xStyleProps( getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW );
--
-- sal_Bool isOn = sal_False;
-- xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn"))) >>= isOn;
-- if( !isOn )
-- return sal_False;
--
-- sal_Bool isShared = sal_False;
-- xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsShared"))) >>= isShared;
--
-- rtl::OUString aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderText") );
-- if( !isShared )
-- {
-- if( 0 == xPageCursor->getPage() % 2 )
-- {
-- aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderTextLeft") );
-- }
-- else
-- {
-- aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderTextRight") );
-- }
-- }
--
-- uno::Reference< text::XText > xText( xStyleProps->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW );
-- //FIXME: can not compare in this way?
-- return ( xText == xCurrentText );
--}
--
--sal_Bool HeaderFooterHelper::isFirstPageHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
--{
-- if( isHeader( xModel, xCurrentText ) )
-- {
-- uno::Reference< text::XPageCursor > xPageCursor( getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
-- // FIXME: getPage allways returns 1
-- sal_Int32 nPage = xPageCursor->getPage();
-- return nPage == FIRST_PAGE;
-- }
-- return sal_False;
--}
--
--sal_Bool HeaderFooterHelper::isEvenPagesHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
--{
-- if( isHeader( xModel, xCurrentText ) )
-- {
-- uno::Reference< beans::XPropertySet > xStyleProps( getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW );
-- sal_Bool isShared = sal_False;
-- xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsShared"))) >>= isShared;
-- if( !isShared )
-- {
-- uno::Reference< text::XPageCursor > xPageCursor( getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
-- return ( 0 == xPageCursor->getPage() % 2 );
-- }
-- }
-- return sal_False;
--}
--
--sal_Bool HeaderFooterHelper::isFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
-+sal_Int32 getPageCount( const uno::Reference< frame::XModel>& xModel ) throw (uno::RuntimeException)
- {
-- uno::Reference< text::XPageCursor > xPageCursor( getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
-- uno::Reference< beans::XPropertySet > xStyleProps( getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW );
--
-- sal_Bool isOn = sal_False;
-- xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn"))) >>= isOn;
-- if( !isOn )
-- return sal_False;
--
-- sal_Bool isShared = sal_False;
-- xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsShared"))) >>= isShared;
--
-- rtl::OUString aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterText") );
-- if( !isShared )
-- {
-- if( 0 == xPageCursor->getPage() % 2 )
-- {
-- aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterTextLeft") );
-- }
-- else
-- {
-- aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterTextRight") );
-- }
-- }
--
-- uno::Reference< text::XText > xText( xStyleProps->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW );
--
-- return ( xText == xCurrentText );
--}
--
--sal_Bool HeaderFooterHelper::isFirstPageFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
--{
-- if( isFooter( xModel, xCurrentText ) )
-- {
-- uno::Reference< text::XPageCursor > xPageCursor( getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
-- sal_Int32 nPage = xPageCursor->getPage();
-- return nPage == FIRST_PAGE;
-- }
-- return sal_False;
--}
--
--sal_Bool HeaderFooterHelper::isEvenPagesFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
--{
-- if( isFooter( xModel, xCurrentText ) )
-- {
-- uno::Reference< beans::XPropertySet > xStyleProps( getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW );
-- sal_Bool isShared = sal_False;
-- xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsShared"))) >>= isShared;
-- if( !isShared )
-- {
-- uno::Reference< text::XPageCursor > xPageCursor( getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
-- return ( 0 == xPageCursor->getPage() % 2 );
-- }
-- }
-- return sal_False;
-+ SwDocShell* pDocShell = getDocShell( xModel );
-+ return pDocShell ? pDocShell->GetDoc()->GetPageCount() : 0;
- }
-
- } // word
-diff --git sw/source/ui/vba/wordvbahelper.hxx sw/source/ui/vba/wordvbahelper.hxx
-index aecae44..98afd00 100644
---- sw/source/ui/vba/wordvbahelper.hxx
-+++ sw/source/ui/vba/wordvbahelper.hxx
-@@ -49,17 +49,7 @@ namespace ooo
- SwView* getView( const css::uno::Reference< css::frame::XModel>& xModel );
- css::uno::Reference< css::text::XTextViewCursor > getXTextViewCursor( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
- css::uno::Reference< css::style::XStyle > getCurrentPageStyle( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
--
--class HeaderFooterHelper
--{
--public:
-- static sal_Bool isHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-- static sal_Bool isFirstPageHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-- static sal_Bool isEvenPagesHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-- static sal_Bool isFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-- static sal_Bool isFirstPageFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-- static sal_Bool isEvenPagesFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
--};
-+ sal_Int32 getPageCount( const css::uno::Reference< css::frame::XModel>& xModel ) throw (css::uno::RuntimeException);
-
- }; // word
- }; // vba
-diff --git sw/util/makefile.mk sw/util/makefile.mk
-index d12cd60..1181815 100644
---- sw/util/makefile.mk
-+++ sw/util/makefile.mk
-@@ -349,7 +349,6 @@ SHL4STDLIBS= \
- $(CPPUHELPERLIB) \
- $(SALLIB) \
- $(ICUUCLIB) \
-- $(VBAHELPERLIB) \
- $(BASICLIB) \
- $(I18NUTILLIB)
-
-@@ -368,6 +367,7 @@ SHL5STDLIBS= \
- $(CPPULIB) \
- $(COMPHELPERLIB) \
- $(SVLIB) \
-+ $(UNOTOOLSLIB) \
- $(TOOLSLIB) \
- $(SALLIB)\
- $(VBAHELPERLIB) \
-@@ -376,8 +376,11 @@ SHL5STDLIBS= \
- $(SVXLIB) \
- $(SVTOOLLIB) \
- $(SVLLIB) \
-- $(VCLLIB) \
-- $(TKLIB) \
-+ $(VCLLIB) \
-+ $(TKLIB) \
-+ $(I18NISOLANGLIB) \
-+ $(SVXCORELIB) \
-+ $(SVXMSFILTERLIB) \
-
- SHL5DEPN=$(SHL1TARGETN)
- SHL5LIBS=$(SLB)$/$(TARGET_VBA).lib
-diff --git toolkit/inc/toolkit/controls/unocontrols.hxx toolkit/inc/toolkit/controls/unocontrols.hxx
-index b22e5b4..a5eb2e6 100644
---- toolkit/inc/toolkit/controls/unocontrols.hxx
-+++ toolkit/inc/toolkit/controls/unocontrols.hxx
-@@ -669,6 +669,44 @@ public:
-
- };
-
-+class UnoMultiPageModel : public UnoControlModel
-+{
-+protected:
-+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
-+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
-+
-+public:
-+ UnoMultiPageModel();
-+ UnoMultiPageModel( const UnoMultiPageModel& rModel ) : UnoControlModel( rModel ) {;}
-+
-+ UnoControlModel* Clone() const { return new UnoMultiPageModel( *this ); }
-+
-+ // ::com::sun::star::io::XPersistObject
-+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
-+
-+ // ::com::sun::star::beans::XMultiPropertySet
-+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
-+
-+ // ::com::sun::star::lang::XServiceInfo
-+ DECLIMPL_SERVICEINFO_DERIVED( UnoMultiPageModel, UnoControlModel, szServiceName_UnoMultiPageModel )
-+
-+};
-+// ----------------------------------------------------
-+// class UnoGroupBoxControl
-+// ----------------------------------------------------
-+class UnoMultiPageControl : public UnoControlBase
-+{
-+public:
-+ UnoMultiPageControl();
-+ ::rtl::OUString GetComponentServiceName();
-+
-+ sal_Bool SAL_CALL isTransparent( ) throw(::com::sun::star::uno::RuntimeException);
-+
-+ // ::com::sun::star::lang::XServiceInfo
-+ DECLIMPL_SERVICEINFO_DERIVED( UnoMultiPageControl, UnoControlBase, szServiceName_UnoMultiPageControl )
-+
-+};
-+
- // ----------------------------------------------------
- // class UnoFixedTextControl
- // ----------------------------------------------------
-diff --git toolkit/inc/toolkit/helper/servicenames.hxx toolkit/inc/toolkit/helper/servicenames.hxx
-index 78a507a..a0dec29 100644
---- toolkit/inc/toolkit/helper/servicenames.hxx
-+++ toolkit/inc/toolkit/helper/servicenames.hxx
-@@ -40,6 +40,8 @@ extern const sal_Char __FAR_DATA szServiceName_PopupMenu[], szServiceName2_Popup
- extern const sal_Char __FAR_DATA szServiceName_MenuBar[], szServiceName2_MenuBar[];
- extern const sal_Char __FAR_DATA szServiceName_Pointer[], szServiceName2_Pointer[];
- extern const sal_Char __FAR_DATA szServiceName_UnoControlContainer[], szServiceName2_UnoControlContainer[];
-+extern const sal_Char __FAR_DATA szServiceName_UnoMultiPageControl[], szServiceName2_UnoMultiPageControl[];
-+extern const sal_Char __FAR_DATA szServiceName_UnoMultiPageModel[], szServiceName2_UnoMultiPageModel[];
- extern const sal_Char __FAR_DATA szServiceName_UnoControlContainerModel[], szServiceName2_UnoControlContainerModel[];
- extern const sal_Char __FAR_DATA szServiceName_TabController[], szServiceName2_TabController[];
- extern const sal_Char __FAR_DATA szServiceName_TabControllerModel[], szServiceName2_TabControllerModel[];
-diff --git toolkit/source/awt/vclxwindows.cxx toolkit/source/awt/vclxwindows.cxx
-index 1b23f37..bc673cf 100644
---- toolkit/source/awt/vclxwindows.cxx
-+++ toolkit/source/awt/vclxwindows.cxx
-@@ -1179,6 +1179,16 @@ void VCLXRadioButton::setProperty( const ::rtl::OUString& PropertyName, const ::
- pButton->Check( b );
- else
- pButton->SetState( b );
-+ // If VBA - need to be able to test
-+ // simulate click event
-+ if ( maActionListeners.getLength() )
-+ {
-+ ::com::sun::star::awt::ActionEvent aEvent;
-+ aEvent.Source = (::cppu::OWeakObject*)this;
-+ aEvent.ActionCommand = maActionCommand;
-+ maActionListeners.actionPerformed( aEvent );
-+ }
-+
- }
- }
- break;
-@@ -1937,8 +1947,11 @@ void VCLXListBox::setProperty( const ::rtl::OUString& PropertyName, const ::com:
- ::com::sun::star::uno::Sequence< ::rtl::OUString> aItems;
- if ( Value >>= aItems )
- {
-+ sal_Int16 nElem = pListBox->GetEntryCount();
- pListBox->Clear();
- addItems( aItems, 0 );
-+ if ( aItems.getLength() == 0 && nElem && maItemListeners.getLength() )
-+ ImplCallItemListeners();
- }
- }
- break;
-@@ -1951,7 +1964,11 @@ void VCLXListBox::setProperty( const ::rtl::OUString& PropertyName, const ::com:
- pListBox->SelectEntryPos( --n, sal_False );
-
- if ( aItems.getLength() )
-+ {
- selectItemsPos( aItems, sal_True );
-+ if ( maItemListeners.getLength() )
-+ ImplCallItemListeners();
-+ }
- else
- pListBox->SetNoSelection();
-
-diff --git toolkit/source/controls/unocontrols.cxx toolkit/source/controls/unocontrols.cxx
-index 2cfa89f..b8ca5f1 100644
---- toolkit/source/controls/unocontrols.cxx
-+++ toolkit/source/controls/unocontrols.cxx
-@@ -1852,6 +1852,77 @@ sal_Bool UnoGroupBoxControl::isTransparent() throw(uno::RuntimeException)
- return sal_True;
- }
-
-+// MultiPage
-+
-+UnoMultiPageModel::UnoMultiPageModel()
-+{
-+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
-+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
-+ ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
-+ ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
-+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
-+ ImplRegisterProperty( BASEPROPERTY_LABEL );
-+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
-+ ImplRegisterProperty( BASEPROPERTY_PROGRESSVALUE );
-+ ImplRegisterProperty( BASEPROPERTY_PROGRESSVALUE_MAX );
-+}
-+
-+::rtl::OUString UnoMultiPageModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
-+{
-+ return ::rtl::OUString::createFromAscii( szServiceName_UnoMultiPageModel );
-+}
-+
-+uno::Any UnoMultiPageModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-+{
-+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
-+ {
-+ uno::Any aAny;
-+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlGroupBox );
-+ //aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoMultiPageControl );
-+ return aAny;
-+ }
-+ return UnoControlModel::ImplGetDefaultValue( nPropId );
-+}
-+
-+::cppu::IPropertyArrayHelper& UnoMultiPageModel::getInfoHelper()
-+{
-+ static UnoPropertyArrayHelper* pHelper = NULL;
-+ if ( !pHelper )
-+ {
-+ uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
-+ pHelper = new UnoPropertyArrayHelper( aIDs );
-+ }
-+ return *pHelper;
-+}
-+
-+// beans::XMultiPropertySet
-+uno::Reference< beans::XPropertySetInfo > UnoMultiPageModel::getPropertySetInfo( ) throw(uno::RuntimeException)
-+{
-+ static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
-+ return xInfo;
-+}
-+
-+// ----------------------------------------------------
-+// class MultiPageControl
-+// ----------------------------------------------------
-+UnoMultiPageControl::UnoMultiPageControl()
-+{
-+ maComponentInfos.nWidth = 100;
-+ maComponentInfos.nHeight = 100;
-+}
-+
-+::rtl::OUString UnoMultiPageControl::GetComponentServiceName()
-+{
-+ return ::rtl::OUString::createFromAscii( "multipage" );
-+}
-+
-+sal_Bool UnoMultiPageControl::isTransparent() throw(uno::RuntimeException)
-+{
-+ return sal_True;
-+}
-+
-+
-+
- // ----------------------------------------------------
- // class UnoControlListBoxModel
- // ----------------------------------------------------
-diff --git toolkit/source/helper/registerservices.cxx toolkit/source/helper/registerservices.cxx
-index 6bbc5eb..cb48a95 100644
---- toolkit/source/helper/registerservices.cxx
-+++ toolkit/source/helper/registerservices.cxx
-@@ -168,6 +168,7 @@ IMPL_CREATEINSTANCE( UnoControlTimeFieldModel )
- IMPL_CREATEINSTANCE( UnoControlProgressBarModel )
- IMPL_CREATEINSTANCE( UnoControlScrollBarModel )
- IMPL_CREATEINSTANCE( UnoSpinButtonModel )
-+IMPL_CREATEINSTANCE( UnoMultiPageModel )
- IMPL_CREATEINSTANCE( UnoControlFixedLineModel )
- IMPL_CREATEINSTANCE( UnoCurrencyFieldControl )
- IMPL_CREATEINSTANCE( UnoDateFieldControl )
-@@ -187,6 +188,7 @@ IMPL_CREATEINSTANCE( UnoTimeFieldControl )
- IMPL_CREATEINSTANCE( UnoProgressBarControl )
- IMPL_CREATEINSTANCE( UnoScrollBarControl )
- IMPL_CREATEINSTANCE( UnoSpinButtonControl )
-+IMPL_CREATEINSTANCE( UnoMultiPageControl )
- IMPL_CREATEINSTANCE( UnoFixedLineControl )
- IMPL_CREATEINSTANCE( VCLXMenuBar )
- IMPL_CREATEINSTANCE( VCLXPointer )
-@@ -273,6 +275,8 @@ TOOLKIT_DLLPUBLIC sal_Bool SAL_CALL component_writeInfo( void* _pServiceManager,
- registerServices( xRegistryKey, "UnoControlScrollBarModel", szServiceName_UnoControlScrollBarModel, szServiceName2_UnoControlScrollBarModel );
- registerServices( xRegistryKey, "UnoSpinButtonModel", szServiceName_UnoSpinButtonModel );
- registerServices( xRegistryKey, "UnoSpinButtonControl", szServiceName_UnoSpinButtonControl );
-+ registerServices( xRegistryKey, "UnoMultiPageModel", szServiceName_UnoMultiPageModel );
-+ registerServices( xRegistryKey, "UnoMultiPageControl", szServiceName_UnoMultiPageControl );
- registerServices( xRegistryKey, "UnoFixedLineControl", szServiceName_UnoControlFixedLine, szServiceName2_UnoControlFixedLine );
- registerServices( xRegistryKey, "UnoControlFixedLineModel", szServiceName_UnoControlFixedLineModel, szServiceName2_UnoControlFixedLineModel );
- registerServices( xRegistryKey, "VCLXPrinterServer", szServiceName_PrinterServer, szServiceName2_PrinterServer );
-@@ -358,6 +362,8 @@ TOOLKIT_DLLPUBLIC void* SAL_CALL component_getFactory( const sal_Char* sImplemen
- CHECKANDCREATEFACTORY( VCLXPrinterServer, szServiceName_PrinterServer, szServiceName2_PrinterServer )
- CHECKANDCREATEFACTORY( UnoRoadmapControl, szServiceName_UnoControlRoadmap, szServiceName2_UnoControlRoadmap )
- CHECKANDCREATEFACTORY( UnoControlRoadmapModel, szServiceName_UnoControlRoadmapModel, szServiceName2_UnoControlRoadmapModel )
-+ CHECKANDCREATEFACTORY( UnoMultiPageModel, szServiceName_UnoMultiPageModel, NULL )
-+ CHECKANDCREATEFACTORY( UnoMultiPageControl, szServiceName_UnoMultiPageControl, NULL )
- CHECKANDCREATEFACTORY( UnoSpinButtonModel, szServiceName_UnoSpinButtonModel, NULL )
- CHECKANDCREATEFACTORY( UnoSpinButtonControl, szServiceName_UnoSpinButtonControl, NULL )
- CHECKANDCREATEFACTORY( TreeControl, szServiceName_TreeControl, NULL )
-diff --git toolkit/source/helper/servicenames.cxx toolkit/source/helper/servicenames.cxx
-index 3b27e91..e03808d 100644
---- toolkit/source/helper/servicenames.cxx
-+++ toolkit/source/helper/servicenames.cxx
-@@ -40,6 +40,8 @@ const sal_Char __FAR_DATA szServiceName_PopupMenu[] = "stardiv.vcl.PopupMenu", s
- const sal_Char __FAR_DATA szServiceName_MenuBar[] = "stardiv.vcl.MenuBar", szServiceName2_MenuBar[] = "com.sun.star.awt.MenuBar";
- const sal_Char __FAR_DATA szServiceName_Pointer[] = "stardiv.vcl.Pointer", szServiceName2_Pointer[] = "com.sun.star.awt.Pointer";
- const sal_Char __FAR_DATA szServiceName_UnoControlContainer[] = "stardiv.vcl.control.ControlContainer", szServiceName2_UnoControlContainer[] = "com.sun.star.awt.UnoControlContainer";
-+
-+
- const sal_Char __FAR_DATA szServiceName_UnoControlContainerModel[] = "stardiv.vcl.controlmodel.ControlContainer", szServiceName2_UnoControlContainerModel[] = "com.sun.star.awt.UnoControlContainerModel";
- const sal_Char __FAR_DATA szServiceName_TabController[] = "stardiv.vcl.control.TabController", szServiceName2_TabController[] = "com.sun.star.awt.TabController";
- const sal_Char __FAR_DATA szServiceName_TabControllerModel[] = "stardiv.vcl.controlmodel.TabController", szServiceName2_TabControllerModel[] = "com.sun.star.awt.TabControllerModel";
-@@ -92,6 +94,8 @@ const sal_Char __FAR_DATA szServiceName_UnoControlRoadmap[] = "stardiv.vcl.contr
- const sal_Char __FAR_DATA szServiceName_UnoControlRoadmapModel[] = "stardiv.vcl.controlmodel.Roadmap", szServiceName2_UnoControlRoadmapModel[] = "com.sun.star.awt.UnoControlRoadmapModel";
- const sal_Char __FAR_DATA szServiceName_UnoSpinButtonControl[] = "com.sun.star.awt.UnoControlSpinButton";
- const sal_Char __FAR_DATA szServiceName_UnoSpinButtonModel[] = "com.sun.star.awt.UnoControlSpinButtonModel";
-+const sal_Char __FAR_DATA szServiceName_UnoMultiPageControl[] = "com.sun.star.awt.UnoControlMultiPage";
-+const sal_Char __FAR_DATA szServiceName_UnoMultiPageModel[] = "com.sun.star.awt.UnoMultiPageModel";
- const sal_Char __FAR_DATA szServiceName_TreeControl[] = "com.sun.star.awt.tree.TreeControl";
- const sal_Char __FAR_DATA szServiceName_TreeControlModel[] = "com.sun.star.awt.tree.TreeControlModel";
- const sal_Char __FAR_DATA szServiceName_MutableTreeDataModel[] = "com.sun.star.awt.tree.MutableTreeDataModel";
-diff --git vbahelper/inc/vbahelper/vbaapplicationbase.hxx vbahelper/inc/vbahelper/vbaapplicationbase.hxx
-index aff57d0..a4d550b 100644
---- vbahelper/inc/vbahelper/vbaapplicationbase.hxx
-+++ vbahelper/inc/vbahelper/vbaapplicationbase.hxx
-@@ -33,14 +33,16 @@
- #include <ooo/vba/XHelperInterface.hpp>
- #include <ooo/vba/XApplicationBase.hpp>
- #include <vbahelper/vbahelperinterface.hxx>
-+#include <sfx2/objsh.hxx>
-
- typedef InheritedHelperInterfaceImpl1< ov::XApplicationBase > ApplicationBase_BASE;
-
--class VbaApplicationBase : public ApplicationBase_BASE
-+class VBAHELPER_DLLPUBLIC VbaApplicationBase : public ApplicationBase_BASE
- {
- protected:
- VbaApplicationBase( const css::uno::Reference< css::uno::XComponentContext >& xContext );
- virtual ~VbaApplicationBase();
-+ virtual SfxObjectShell* GetDocShell( const css::uno::Reference< css::frame::XModel >& /*xModel*/ ) throw (css::uno::RuntimeException) { return NULL; }
-
- public:
- // XHelperInterface ( parent is itself )
-@@ -51,6 +53,9 @@ public:
- virtual sal_Bool SAL_CALL getDisplayStatusBar() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setDisplayStatusBar(sal_Bool bDisplayStatusBar) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL CommandBars( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual ::rtl::OUString SAL_CALL getVersion() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL Run( const ::rtl::OUString& MacroName, const css::uno::Any& varg1, const css::uno::Any& varg2, const css::uno::Any& varg3, const css::uno::Any& varg4, const css::uno::Any& varg5, const css::uno::Any& varg6, const css::uno::Any& varg7, const css::uno::Any& varg8, const css::uno::Any& varg9, const css::uno::Any& varg10, const css::uno::Any& varg11, const css::uno::Any& varg12, const css::uno::Any& varg13, const css::uno::Any& varg14, const css::uno::Any& varg15, const css::uno::Any& varg16, const css::uno::Any& varg17, const css::uno::Any& varg18, const css::uno::Any& varg19, const css::uno::Any& varg20, const css::uno::Any& varg21, const css::uno::Any& varg22, const css::uno::Any& varg23, const css::uno::Any& varg24, const css::uno::Any& varg25, const css::uno::Any& varg26, const css::uno::Any& varg27, const css::uno::Any& varg28, const css::uno::Any& varg29, const css::uno::Any& varg30 ) throw (css::uno::RuntimeException);
-+ virtual float SAL_CALL CentimetersToPoints( float _Centimeters ) throw (css::uno::RuntimeException);
-
- // XHelperInterface
- virtual rtl::OUString& getServiceImplName();
-diff --git vbahelper/inc/vbahelper/vbacollectionimpl.hxx vbahelper/inc/vbahelper/vbacollectionimpl.hxx
-index fec7b92..bc60cf1 100644
---- vbahelper/inc/vbahelper/vbacollectionimpl.hxx
-+++ vbahelper/inc/vbahelper/vbacollectionimpl.hxx
-@@ -49,7 +49,7 @@
-
- typedef ::cppu::WeakImplHelper1< css::container::XEnumeration > EnumerationHelper_BASE;
-
--class EnumerationHelperImpl : public EnumerationHelper_BASE
-+class VBAHELPER_DLLPUBLIC EnumerationHelperImpl : public EnumerationHelper_BASE
- {
- protected:
- css::uno::Reference< css::uno::XComponentContext > m_xContext;
-@@ -68,7 +68,7 @@ public:
- typedef ::cppu::WeakImplHelper3< css::container::XNameAccess, css::container::XIndexAccess, css::container::XEnumerationAccess > XNamedCollectionHelper_BASE;
-
- template< typename Ifc1 >
--class XNamedObjectCollectionHelper : public XNamedCollectionHelper_BASE
-+class VBAHELPER_DLLPUBLIC XNamedObjectCollectionHelper : public XNamedCollectionHelper_BASE
- {
- public:
- typedef std::vector< css::uno::Reference< Ifc1 > > XNamedVec;
-@@ -237,7 +237,7 @@ typedef ::cppu::WeakImplHelper1<ov::XCollection> 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
-+class VBAHELPER_DLLPUBLIC 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){}
-@@ -245,7 +245,7 @@ public:
- };
-
- template <typename Ifc> // where Ifc must implement XCollectionTest
--class CollTestImplHelper : public ScVbaCollectionBase< ::cppu::WeakImplHelper1< Ifc > >
-+class VBAHELPER_DLLPUBLIC CollTestImplHelper : public ScVbaCollectionBase< ::cppu::WeakImplHelper1< Ifc > >
- {
- typedef ScVbaCollectionBase< ::cppu::WeakImplHelper1< Ifc > > ImplBase1;
-
-diff --git vbahelper/inc/vbahelper/vbadialogbase.hxx vbahelper/inc/vbahelper/vbadialogbase.hxx
-new file mode 100644
-index 0000000..4b3e2a2
---- /dev/null
-+++ vbahelper/inc/vbahelper/vbadialogbase.hxx
-@@ -0,0 +1,52 @@
-+/*************************************************************************
-+ *
-+ * 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: vbadialog.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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef VBA_DIALOG_BASE_HXX
-+#define VBA_DIALOG_BASE_HXX
-+
-+#include <cppuhelper/implbase1.hxx>
-+#include <ooo/vba/XDialogBase.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+
-+typedef InheritedHelperInterfaceImpl1< ov::XDialogBase > VbaDialogBase_BASE;
-+
-+class VBAHELPER_DLLPUBLIC VbaDialogBase : public VbaDialogBase_BASE
-+{
-+protected:
-+ sal_Int32 mnIndex;
-+public:
-+ VbaDialogBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, sal_Int32 nIndex ):VbaDialogBase_BASE( xParent, xContext ), mnIndex( nIndex ) {}
-+ virtual ~VbaDialogBase() {}
-+
-+ // Methods
-+ virtual void SAL_CALL Show() throw (css::uno::RuntimeException);
-+ virtual rtl::OUString mapIndexToName( sal_Int32 nIndex ) = 0;
-+};
-+
-+#endif /* VBA_DIALOG_BASE_HXX */
-diff --git vbahelper/inc/vbahelper/vbadialogsbase.hxx vbahelper/inc/vbahelper/vbadialogsbase.hxx
-new file mode 100644
-index 0000000..e8b1b2e
---- /dev/null
-+++ vbahelper/inc/vbahelper/vbadialogsbase.hxx
-@@ -0,0 +1,51 @@
-+/*************************************************************************
-+ *
-+ * 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: vbadialogs.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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef VBA_DIALOGS_BASE_HXX
-+#define VBA_DIALOGS_BASE_HXX
-+
-+#include <cppuhelper/implbase1.hxx>
-+#include <ooo/vba/XHelperInterface.hpp>
-+#include <ooo/vba/XDialogsBase.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+
-+typedef InheritedHelperInterfaceImpl1< ov::XDialogsBase > VbaDialogsBase_BASE;
-+
-+class VBAHELPER_DLLPUBLIC VbaDialogsBase : public VbaDialogsBase_BASE
-+{
-+public:
-+ VbaDialogsBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext ): VbaDialogsBase_BASE( xParent, xContext ) {}
-+ virtual ~VbaDialogsBase() {}
-+
-+ // 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);
-+};
-+
-+#endif /* VBA_DIALOGS_BASE_HXX */
-diff --git vbahelper/inc/vbahelper/vbadocumentbase.hxx vbahelper/inc/vbahelper/vbadocumentbase.hxx
-index 985cd25..9576510 100644
---- vbahelper/inc/vbahelper/vbadocumentbase.hxx
-+++ vbahelper/inc/vbahelper/vbadocumentbase.hxx
-@@ -36,7 +36,7 @@
-
- typedef InheritedHelperInterfaceImpl1< ooo::vba::XDocumentBase > VbaDocumentBase_BASE;
-
--class VbaDocumentBase : public VbaDocumentBase_BASE
-+class VBAHELPER_DLLPUBLIC VbaDocumentBase : public VbaDocumentBase_BASE
- {
- protected:
- css::uno::Reference< css::frame::XModel > mxModel;
-diff --git vbahelper/inc/vbahelper/vbadocumentsbase.hxx vbahelper/inc/vbahelper/vbadocumentsbase.hxx
-new file mode 100644
-index 0000000..cc8c1b3
---- /dev/null
-+++ vbahelper/inc/vbahelper/vbadocumentsbase.hxx
-@@ -0,0 +1,69 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef VBA_WORKBOOKS_HXX
-+#define VBA_WORKBOOKS_HXX
-+
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/XDocumentsBase.hpp>
-+#include <com/sun/star/container/XEnumerationAccess.hpp>
-+
-+typedef CollTestImplHelper< ooo::vba::XDocumentsBase > VbaDocumentsBase_BASE;
-+
-+class VBAHELPER_DLLPUBLIC VbaDocumentsBase : public VbaDocumentsBase_BASE
-+{
-+public:
-+ enum DOCUMENT_TYPE
-+ {
-+ WORD_DOCUMENT = 1,
-+ EXCEL_DOCUMENT
-+ };
-+
-+private:
-+ DOCUMENT_TYPE meDocType;
-+
-+public:
-+ VbaDocumentsBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, DOCUMENT_TYPE eDocType ) throw (css::uno::RuntimeException);
-+ virtual ~VbaDocumentsBase() {}
-+
-+ // XEnumerationAccess
-+ virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException) = 0;
-+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException) = 0;
-+
-+ // VbaDocumentsBase_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ) = 0;
-+
-+ // XDocumentsBase
-+ virtual css::uno::Any SAL_CALL Add() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL Close( ) throw (css::uno::RuntimeException);
-+ 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 vbahelper/inc/vbahelper/vbafontbase.hxx vbahelper/inc/vbahelper/vbafontbase.hxx
-new file mode 100644
-index 0000000..be30554
---- /dev/null
-+++ vbahelper/inc/vbahelper/vbafontbase.hxx
-@@ -0,0 +1,99 @@
-+/*************************************************************************
-+ *
-+ * 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: vbafont.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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef VBAHELPER_FONTBASE_HXX
-+#define VBAHELPER_FONTBASE_HXX
-+
-+#include <cppuhelper/implbase1.hxx>
-+
-+#include <ooo/vba/XFontBase.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+
-+// 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;
-+
-+typedef InheritedHelperInterfaceImpl1< ov::XFontBase > VbaFontBase_BASE;
-+
-+class VBAHELPER_DLLPUBLIC VbaFontBase : public VbaFontBase_BASE
-+{
-+protected:
-+ css::uno::Reference< css::beans::XPropertySet > mxFont;
-+ css::uno::Reference< css::container::XIndexAccess > mxPalette;
-+public:
-+ VbaFontBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xPalette, css::uno::Reference< css::beans::XPropertySet > xPropertySet ) throw ( css::uno::RuntimeException );
-+ virtual ~VbaFontBase();// {}
-+
-+ // 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 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) = 0;
-+ virtual void SAL_CALL setUnderline( const css::uno::Any& _underline ) throw (css::uno::RuntimeException) = 0;
-+ 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) ;
-+};
-+
-+#endif
-+
-diff --git vbahelper/inc/vbahelper/vbaglobalbase.hxx vbahelper/inc/vbahelper/vbaglobalbase.hxx
-index 43c8286..f9c0d25 100644
---- vbahelper/inc/vbahelper/vbaglobalbase.hxx
-+++ vbahelper/inc/vbahelper/vbaglobalbase.hxx
-@@ -34,7 +34,7 @@
- #include <ooo/vba/XGlobalsBase.hpp>
-
- typedef InheritedHelperInterfaceImpl1< ov::XGlobalsBase > Globals_BASE;
--class VbaGlobalsBase : public Globals_BASE
-+class VBAHELPER_DLLPUBLIC VbaGlobalsBase : public Globals_BASE
-
- {
- protected:
-diff --git vbahelper/inc/vbahelper/vbahelper.hxx vbahelper/inc/vbahelper/vbahelper.hxx
-index a333cf0..1849437 100644
---- vbahelper/inc/vbahelper/vbahelper.hxx
-+++ vbahelper/inc/vbahelper/vbahelper.hxx
-@@ -92,7 +92,6 @@ namespace ooo
- VBAHELPER_DLLPUBLIC double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical);
- VBAHELPER_DLLPUBLIC sal_Int32 getPointerStyle();
- VBAHELPER_DLLPUBLIC void setCursorHelper( const Pointer& rPointer, sal_Bool bOverWrite );
-- VBAHELPER_DLLPUBLIC String docMacroExists( SfxObjectShell* pShell, const String& sMod, const String& sMacro );
-
- class VBAHELPER_DLLPUBLIC Millimeter
- {
-diff --git vbahelper/inc/vbahelper/vbahelperinterface.hxx vbahelper/inc/vbahelper/vbahelperinterface.hxx
-index 389a825..3d82aaa 100644
---- vbahelper/inc/vbahelper/vbahelperinterface.hxx
-+++ vbahelper/inc/vbahelper/vbahelperinterface.hxx
-@@ -64,7 +64,7 @@
- const ::rtl::OUString sHelperServiceName( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.HelperServiceBase" ) );
-
- template< typename Ifc1 >
--class InheritedHelperInterfaceImpl : public Ifc1
-+class VBAHELPER_DLLPUBLIC InheritedHelperInterfaceImpl : public Ifc1
- {
- protected:
- css::uno::WeakReference< ov::XHelperInterface > mxParent;
-@@ -110,7 +110,7 @@ public:
- };
-
- template< typename Ifc1 >
--class InheritedHelperInterfaceImpl1 : public InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper1< Ifc1 > >
-+class VBAHELPER_DLLPUBLIC InheritedHelperInterfaceImpl1 : public InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper1< Ifc1 > >
-
- {
- typedef InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper1< Ifc1 > > Base;
-diff --git vbahelper/inc/vbahelper/vbapagesetupbase.hxx vbahelper/inc/vbahelper/vbapagesetupbase.hxx
-new file mode 100644
-index 0000000..4c8a4bc
---- /dev/null
-+++ vbahelper/inc/vbahelper/vbapagesetupbase.hxx
-@@ -0,0 +1,70 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef VBA_PAGESETUPBASE_HXX
-+#define VBA_PAGESETUPBASE_HXX
-+
-+#include <cppuhelper/implbase1.hxx>
-+#include <ooo/vba/XPageSetupBase.hpp>
-+#include <com/sun/star/uno/XComponentContext.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::XPageSetupBase > VbaPageSetupBase_BASE;
-+
-+class VBAHELPER_DLLPUBLIC VbaPageSetupBase : public VbaPageSetupBase_BASE
-+{
-+protected:
-+ css::uno::Reference< css::frame::XModel > mxModel;
-+ css::uno::Reference< css::beans::XPropertySet > mxPageProps;
-+ sal_Int32 mnOrientLandscape;
-+ sal_Int32 mnOrientPortrait;
-+
-+ VbaPageSetupBase( const css::uno::Reference< ov::XHelperInterface >& xParent,
-+ const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException);
-+public:
-+ virtual ~VbaPageSetupBase(){}
-+
-+ // Attribute
-+ 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);
-+};
-+#endif
-diff --git vbahelper/inc/vbahelper/vbapropvalue.hxx vbahelper/inc/vbahelper/vbapropvalue.hxx
-index c782f5b..d56d799 100644
---- vbahelper/inc/vbahelper/vbapropvalue.hxx
-+++ vbahelper/inc/vbahelper/vbapropvalue.hxx
-@@ -36,7 +36,7 @@
-
- typedef ::cppu::WeakImplHelper1< ov::XPropValue > PropValueImpl_BASE;
-
--class PropListener
-+class VBAHELPER_DLLPUBLIC PropListener
- {
- public:
- virtual void setValueEvent( const css::uno::Any& value ) = 0;
-@@ -44,7 +44,7 @@ public:
- };
-
-
--class ScVbaPropValue : public PropValueImpl_BASE
-+class VBAHELPER_DLLPUBLIC ScVbaPropValue : public PropValueImpl_BASE
- {
- PropListener* m_pListener;
- public:
-diff --git vbahelper/inc/vbahelper/vbashape.hxx vbahelper/inc/vbahelper/vbashape.hxx
-new file mode 100644
-index 0000000..7893905
---- /dev/null
-+++ vbahelper/inc/vbahelper/vbashape.hxx
-@@ -0,0 +1,117 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SC_VBA_SHAPE_HXX
-+#define SC_VBA_SHAPE_HXX
-+
-+#include <ooo/vba/office/MsoShapeType.hpp>
-+#include <com/sun/star/drawing/XShape.hpp>
-+#include <com/sun/star/drawing/XShapes.hpp>
-+#include <com/sun/star/lang/XEventListener.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <ooo/vba/msforms/XShape.hpp>
-+#include <ooo/vba/msforms/XLineFormat.hpp>
-+#include <cppuhelper/implbase2.hxx>
-+
-+#include <vbahelper/vbahelperinterface.hxx>
-+
-+typedef ::cppu::WeakImplHelper2< ov::msforms::XShape, css::lang::XEventListener > ListeningShape;
-+
-+typedef InheritedHelperInterfaceImpl< ListeningShape > ScVbaShape_BASE;
-+
-+class VBAHELPER_DLLPUBLIC ScVbaShape : public ScVbaShape_BASE
-+{
-+private:
-+protected:
-+ std::auto_ptr< ov::ShapeHelper > m_pShapeHelper;
-+ 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<rtl::OUString> 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);
-+ virtual ::sal_Bool SAL_CALL getLockAspectRatio() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setLockAspectRatio( ::sal_Bool _lockaspectratio ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getLockAnchor() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setLockAnchor( ::sal_Bool _lockanchor ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getRelativeHorizontalPosition() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setRelativeHorizontalPosition( ::sal_Int32 _relativehorizontalposition ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getRelativeVerticalPosition() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition ) throw (css::uno::RuntimeException);
-+
-+ // Methods
-+ virtual css::uno::Any SAL_CALL SAL_CALL TextFrame( ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL SAL_CALL WrapFormat( ) 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 vbahelper/inc/vbahelper/vbashaperange.hxx vbahelper/inc/vbahelper/vbashaperange.hxx
-new file mode 100644
-index 0000000..af39456
---- /dev/null
-+++ vbahelper/inc/vbahelper/vbashaperange.hxx
-@@ -0,0 +1,88 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SC_VBA_SHAPERANGE_HXX
-+#define SC_VBA_SHAPERANGE_HXX
-+
-+#include <com/sun/star/drawing/XShapes.hpp>
-+#include <ooo/vba/msforms/XShapeRange.hpp>
-+#include <com/sun/star/drawing/XDrawPage.hpp>
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/msforms/XLineFormat.hpp>
-+#include <ooo/vba/msforms/XFillFormat.hpp>
-+
-+typedef CollTestImplHelper< ov::msforms::XShapeRange > ScVbaShapeRange_BASE;
-+
-+class VBAHELPER_DLLPUBLIC 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<rtl::OUString> 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);
-+ 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 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 ::sal_Bool SAL_CALL getLockAspectRatio() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setLockAspectRatio( ::sal_Bool _lockaspectratio ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getLockAnchor() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setLockAnchor( ::sal_Bool _lockanchor ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getRelativeHorizontalPosition() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setRelativeHorizontalPosition( ::sal_Int32 _relativehorizontalposition ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getRelativeVerticalPosition() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL SAL_CALL TextFrame( ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL SAL_CALL WrapFormat( ) 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 vbahelper/inc/vbahelper/vbashapes.hxx vbahelper/inc/vbahelper/vbashapes.hxx
-new file mode 100644
-index 0000000..597f97b
---- /dev/null
-+++ vbahelper/inc/vbahelper/vbashapes.hxx
-@@ -0,0 +1,83 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SC_VBA_SHAPES_HXX
-+#define SC_VBA_SHAPES_HXX
-+
-+#include <com/sun/star/drawing/XShapes.hpp>
-+#include <com/sun/star/drawing/XDrawPage.hpp>
-+#include <com/sun/star/container/XIndexAccess.hpp>
-+#include <ooo/vba/msforms/XShapes.hpp>
-+
-+#include <vbahelper/vbahelperinterface.hxx>
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+
-+typedef CollTestImplHelper< ov::msforms::XShapes > ScVbaShapes_BASE;
-+
-+class VBAHELPER_DLLPUBLIC 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<rtl::OUString> 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);
-+ css::uno::Any AddTextboxInWriter( sal_Int32 _nOrientation, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) throw (css::uno::RuntimeException);
-+ rtl::OUString createName( rtl::OUString sName );
-+ css::uno::Any AddShape( const rtl::OUString& sService, const rtl::OUString& sName, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) throw (css::uno::RuntimeException);
-+ //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::Any SAL_CALL AddTextbox( sal_Int32 _nOrientation, 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 ) throw (css::uno::RuntimeException);
-+ 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 vbahelper/inc/vbahelper/vbatextframe.hxx vbahelper/inc/vbahelper/vbatextframe.hxx
-new file mode 100644
-index 0000000..0b7d9ec
---- /dev/null
-+++ vbahelper/inc/vbahelper/vbatextframe.hxx
-@@ -0,0 +1,70 @@
-+/*************************************************************************
-+ *
-+ * 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: vbatextframe.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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef VBA_TEXTFRAME_HXX
-+#define VBA_TEXTFRAME_HXX
-+#include <ooo/vba/msforms/XTextFrame.hpp>
-+#include <com/sun/star/drawing/XShape.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+
-+typedef InheritedHelperInterfaceImpl1< ov::msforms::XTextFrame > VbaTextFrame_BASE;
-+
-+class VBAHELPER_DLLPUBLIC VbaTextFrame : public VbaTextFrame_BASE
-+{
-+protected:
-+ 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<rtl::OUString> getServiceNames();
-+ virtual void setAsMSObehavior();
-+ sal_Int32 getMargin( rtl::OUString sMarginType );
-+ void setMargin( rtl::OUString sMarginType, float fMargin );
-+public:
-+ VbaTextFrame( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext , css::uno::Reference< css::drawing::XShape > xShape);
-+ virtual ~VbaTextFrame() {}
-+ // 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::Any SAL_CALL Characters( ) throw (css::uno::RuntimeException);
-+
-+};
-+
-+#endif//SC_VBA_TEXTFRAME_HXX
-diff --git vbahelper/inc/vbahelper/vbawindowbase.hxx vbahelper/inc/vbahelper/vbawindowbase.hxx
-index ad35a98..508f9d2 100644
---- vbahelper/inc/vbahelper/vbawindowbase.hxx
-+++ vbahelper/inc/vbahelper/vbawindowbase.hxx
-@@ -38,7 +38,7 @@
-
- typedef InheritedHelperInterfaceImpl1<ov::XWindowBase > WindowBaseImpl_BASE;
-
--class VbaWindowBase : public WindowBaseImpl_BASE
-+class VBAHELPER_DLLPUBLIC VbaWindowBase : public WindowBaseImpl_BASE
- {
- protected:
- css::uno::Reference< css::frame::XModel > m_xModel;
-diff --git vbahelper/prj/d.lst vbahelper/prj/d.lst
-index e06c9d1..d7b61d1 100644
---- vbahelper/prj/d.lst
-+++ vbahelper/prj/d.lst
-@@ -1,6 +1,6 @@
- ..\%__SRC%\lib\lib*.so %_DEST%\lib%_EXT%
- ..\%__SRC%\lib\lib*.dylib %_DEST%\lib%_EXT%
--..\%__SRC%\slb\vbahelper.lib %_DEST%\lib%_EXT%\vbahelper.lib
-+..\%__SRC%\lib\ivbahelper.lib %_DEST%\lib%_EXT%\vbahelper.lib
- ..\%__SRC%\lib\vbahelp*.* %_DEST%\lib%_EXT%\vba*.*
- ..\%__SRC%\bin\vbahelper*.* %_DEST%\bin%_EXT%\vbahelper*.*
- ..\%__SRC%\bin\msforms*.* %_DEST%\bin%_EXT%\msforms*.*
-@@ -11,8 +11,17 @@ mkdir: %_DEST%\inc%_EXT%\basic
- ..\inc\vbahelper\helperdecl.hxx %_DEST%\inc%_EXT%\vbahelper\helperdecl.hxx
- ..\inc\vbahelper\vbahelperinterface.hxx %_DEST%\inc%_EXT%\vbahelper\vbahelperinterface.hxx
- ..\inc\vbahelper\vbaapplicationbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbaapplicationbase.hxx
-+..\inc\vbahelper\vbafontbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbafontbase.hxx
- ..\inc\vbahelper\vbadllapi.h %_DEST%\inc%_EXT%\vbahelper\vbadllapi.h
- ..\inc\vbahelper\vbawindowbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbawindowbase.hxx
- ..\inc\vbahelper\vbadocumentbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbadocumentbase.hxx
-+..\inc\vbahelper\vbadocumentsbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbadocumentsbase.hxx
- ..\inc\vbahelper\vbapropvalue.hxx %_DEST%\inc%_EXT%\vbahelper\vbapropvalue.hxx
- ..\inc\vbahelper\vbaglobalbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbaglobalbase.hxx
-+..\inc\vbahelper\vbadialogbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbadialogbase.hxx
-+..\inc\vbahelper\vbadialogsbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbadialogsbase.hxx
-+..\inc\vbahelper\vbashape.hxx %_DEST%\inc%_EXT%\vbahelper\vbashape.hxx
-+..\inc\vbahelper\vbashapes.hxx %_DEST%\inc%_EXT%\vbahelper\vbashapes.hxx
-+..\inc\vbahelper\vbatextframe.hxx %_DEST%\inc%_EXT%\vbahelper\vbatextframe.hxx
-+..\inc\vbahelper\vbashaperange.hxx %_DEST%\inc%_EXT%\vbahelper\vbashaperange.hxx
-+..\inc\vbahelper\vbapagesetupbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbapagesetupbase.hxx
-diff --git vbahelper/source/msforms/vbacontrol.cxx vbahelper/source/msforms/vbacontrol.cxx
-index 100c2b3..3503631 100644
---- vbahelper/source/msforms/vbacontrol.cxx
-+++ vbahelper/source/msforms/vbacontrol.cxx
-@@ -361,6 +361,22 @@ ScVbaControl::setName( const rtl::OUString& _name ) throw (uno::RuntimeException
- m_xProps->setPropertyValue
- (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ), uno::makeAny( _name ) );
- }
-+
-+rtl::OUString SAL_CALL
-+ScVbaControl::getControlTipText() throw (css::uno::RuntimeException)
-+{
-+ rtl::OUString sName;
-+ m_xProps->getPropertyValue
-+ (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HelpText" ) ) ) >>= sName;
-+ return sName;
-+}
-+
-+void SAL_CALL
-+ScVbaControl::setControlTipText( const rtl::OUString& rsToolTip ) throw (css::uno::RuntimeException)
-+{
-+ m_xProps->setPropertyValue
-+ (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HelpText" ) ), uno::makeAny( rsToolTip ) );
-+}
- //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 )
-diff --git vbahelper/source/msforms/vbacontrol.hxx vbahelper/source/msforms/vbacontrol.hxx
-index e7593e8..3c9a128 100644
---- vbahelper/source/msforms/vbacontrol.hxx
-+++ vbahelper/source/msforms/vbacontrol.hxx
-@@ -86,6 +86,8 @@ public:
- 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);
-+ virtual rtl::OUString SAL_CALL getControlTipText() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setControlTipText( const rtl::OUString& ) 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
-diff --git vbahelper/source/msforms/vbalistbox.cxx vbahelper/source/msforms/vbalistbox.cxx
-index 39eb251..47f9847 100644
---- vbahelper/source/msforms/vbalistbox.cxx
-+++ vbahelper/source/msforms/vbalistbox.cxx
-@@ -53,7 +53,8 @@ ScVbaListBox::setListIndex( const uno::Any& _value ) throw (uno::RuntimeExceptio
- {
- sal_Int32 nIndex = 0;
- _value >>= nIndex;
-- Selected( nIndex );
-+ uno::Reference< XPropValue > xPropVal( Selected( nIndex ), uno::UNO_QUERY_THROW );
-+ xPropVal->setValue( uno::makeAny( sal_True ) );
- }
-
- uno::Any SAL_CALL
-@@ -224,7 +225,8 @@ ScVbaListBox::setValueEvent( const uno::Any& value )
- nList.realloc( 1 );
- nList[0] = nIndex;
- }
-- m_xProps->setPropertyValue( sSourceName, uno::makeAny( nList ) );
-+ //m_xProps->setPropertyValue( sSourceName, uno::makeAny( nList ) );
-+ m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nList ) );
- }
- }
-
-diff --git vbahelper/source/msforms/vbatextbox.hxx vbahelper/source/msforms/vbatextbox.hxx
-index 3abe491..4e26f6f 100644
---- vbahelper/source/msforms/vbatextbox.hxx
-+++ vbahelper/source/msforms/vbatextbox.hxx
-@@ -29,12 +29,12 @@
- ************************************************************************/
- #ifndef SC_VBA_TEXTBOX_HXX
- #define SC_VBA_TEXTBOX_HXX
--#include <cppuhelper/implbase1.hxx>
-+#include <cppuhelper/implbase2.hxx>
- #include <ooo/vba/msforms/XTextBox.hpp>
- #include "vbacontrol.hxx"
- #include <vbahelper/vbahelper.hxx>
-
--typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XTextBox > TextBoxImpl_BASE;
-+typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XTextBox, css::script::XDefaultProperty > TextBoxImpl_BASE;
-
- class ScVbaTextBox : public TextBoxImpl_BASE
- {
-@@ -50,6 +50,8 @@ public:
- 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);
-+ // XDefaultProperty
-+ rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
- //XHelperInterface
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-diff --git vbahelper/source/msforms/vbauserform.cxx vbahelper/source/msforms/vbauserform.cxx
-index 775b539..fef36db 100644
---- vbahelper/source/msforms/vbauserform.cxx
-+++ vbahelper/source/msforms/vbauserform.cxx
-@@ -72,6 +72,7 @@ ScVbaUserForm::Show( ) throw (uno::RuntimeException)
- {
- OSL_TRACE("ScVbaUserForm::Show( )");
- short aRet = 0;
-+ mbDispose = true;
- if ( m_xDialog.is() )
- aRet = m_xDialog->execute();
- OSL_TRACE("ScVbaUserForm::Show() execute returned %d", aRet);
-diff --git vbahelper/source/vbahelper/makefile.mk vbahelper/source/vbahelper/makefile.mk
-index 8f5862a..61155e6 100644
---- vbahelper/source/vbahelper/makefile.mk
-+++ vbahelper/source/vbahelper/makefile.mk
-@@ -31,7 +31,7 @@
-
- PRJ=..$/../
- PRJNAME=vbahelper
--TARGET=vbahelper
-+TARGET=vbahelperbits
-
- ENABLE_EXCEPTIONS := TRUE
-
-@@ -49,7 +49,20 @@ SLOFILES=\
- $(SLO)$/vbaapplicationbase.obj \
- $(SLO)$/vbawindowbase.obj \
- $(SLO)$/vbadocumentbase.obj \
-+ $(SLO)$/vbadocumentsbase.obj \
- $(SLO)$/vbaglobalbase.obj \
-+ $(SLO)$/vbafontbase.obj \
-+ $(SLO)$/vbadialogbase.obj \
-+ $(SLO)$/vbadialogsbase.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)$/vbapagesetupbase.obj \
-
- # --- Targets -------------------------------------------------------
-
-diff --git vbahelper/source/vbahelper/vbaapplicationbase.cxx vbahelper/source/vbahelper/vbaapplicationbase.cxx
-index b6a8dee..a424b35 100644
---- vbahelper/source/vbahelper/vbaapplicationbase.cxx
-+++ vbahelper/source/vbahelper/vbaapplicationbase.cxx
-@@ -35,13 +35,21 @@
- #include "vbahelper/vbaapplicationbase.hxx"
- #include <com/sun/star/container/XIndexAccess.hpp>
- #include <com/sun/star/frame/XLayoutManager.hpp>
-+#include <com/sun/star/frame/XDesktop.hpp>
-+#include <com/sun/star/container/XEnumerationAccess.hpp>
-+#include <com/sun/star/document/XDocumentInfoSupplier.hpp>
-+#include <com/sun/star/document/XDocumentProperties.hpp>
-+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
-
- #include "vbacommandbars.hxx"
-+#include <svx/msvbahelper.hxx>
-
- using namespace com::sun::star;
- using namespace ooo::vba;
-
--VbaApplicationBase::VbaApplicationBase( const uno::Reference< css::uno::XComponentContext >& xContext )
-+#define OFFICEVERSION "11.0"
-+
-+VbaApplicationBase::VbaApplicationBase( const uno::Reference< uno::XComponentContext >& xContext )
- : ApplicationBase_BASE( uno::Reference< XHelperInterface >(), xContext )
- {
- }
-@@ -118,6 +126,251 @@ VbaApplicationBase::CommandBars( const uno::Any& aIndex ) throw (uno::RuntimeExc
- return uno::makeAny( xCommandBars );
- }
-
-+::rtl::OUString SAL_CALL
-+VbaApplicationBase::getVersion() throw (uno::RuntimeException)
-+{
-+ return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(OFFICEVERSION));
-+}
-+
-+void SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, const uno::Any& varg1, const uno::Any& varg2, const uno::Any& varg3, const uno::Any& varg4, const uno::Any& varg5, const uno::Any& varg6, const uno::Any& varg7, const uno::Any& varg8, const uno::Any& varg9, const uno::Any& varg10, const uno::Any& varg11, const uno::Any& varg12, const uno::Any& varg13, const uno::Any& varg14, const uno::Any& varg15, const uno::Any& varg16, const uno::Any& varg17, const uno::Any& varg18, const uno::Any& varg19, const uno::Any& varg20, const uno::Any& varg21, const uno::Any& varg22, const uno::Any& varg23, const uno::Any& varg24, const uno::Any& varg25, const uno::Any& varg26, const uno::Any& varg27, const uno::Any& varg28, const uno::Any& varg29, const uno::Any& varg30 ) throw (uno::RuntimeException)
-+{
-+ // parse the macro name
-+ sal_Int32 nDocSepIndex = MacroName.indexOfAsciiL( "!", 1 );
-+ String sMacroUrl = MacroName;
-+ uno::Reference< frame::XModel > xModel;
-+ if( nDocSepIndex > 0 )
-+ {
-+ rtl::OUString sTemplate = MacroName.copy( 0, nDocSepIndex );
-+ OSL_TRACE("VbaApplicationBase::Run, template name: %s", rtl::OUStringToOString( sTemplate, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ sMacroUrl = MacroName.copy( nDocSepIndex + 1 );
-+ OSL_TRACE("VbaApplicationBase::Run, macro name: %s", rtl::OUStringToOString( sMacroUrl, RTL_TEXTENCODING_UTF8 ).getStr() );
-+
-+ // get the template model
-+ 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< container::XEnumeration > mxComponents = xDesktop->getComponents()->createEnumeration();
-+ sal_Int32 nCount = 0;
-+ while( mxComponents->hasMoreElements() )
-+ {
-+ uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( mxComponents->nextElement(), uno::UNO_QUERY );
-+ if( xDocInfoSupp.is() )
-+ {
-+ uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW );
-+ uno::Reference< document::XDocumentProperties > xDocProps( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW );
-+ rtl::OUString sCurrName = xDocProps->getTemplateName();
-+ OSL_TRACE("VbaApplicationBase::Run, current template %d name: %s", ++nCount, rtl::OUStringToOString( sCurrName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ // FIXME: should be check the full path of the template
-+ if( sTemplate.lastIndexOf( sCurrName ) >= 0 )
-+ {
-+ xModel.set( xDocInfoSupp, uno::UNO_QUERY_THROW );
-+ break;
-+ }
-+ }
-+ }
-+ }
-+ else
-+ {
-+ xModel = getCurrentDocument();
-+ }
-+
-+ if( !xModel.is() )
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Fail to find the template in Application.Run") ), uno::Reference< uno::XInterface >() );
-+ }
-+
-+ String sMacro;
-+ String sModule;
-+ sal_Int32 nTokens = sMacroUrl.GetTokenCount( '.' );
-+ xub_StrLen nToken = 0;
-+ xub_StrLen nIndex = 0;
-+ // only support ThisModule.ThisMacro
-+ if( nTokens == 2 )
-+ {
-+ sModule = sMacroUrl.GetToken( nToken, '.', nIndex );
-+ sMacro = sMacroUrl.GetToken( nToken, '.', nIndex );
-+ }
-+ else
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("The macro doesn't exist") ), uno::Reference< uno::XInterface >() );
-+ }
-+
-+ SfxObjectShell* pShell = GetDocShell( xModel );
-+ if( pShell )
-+ {
-+ sMacroUrl = findVBAMacro( pShell, sModule, sMacro );
-+ if( sMacroUrl.Len() )
-+ {
-+ // handle the arguments
-+ uno::Sequence< uno::Any > aArgs;
-+ if( varg1.hasValue() )
-+ {
-+ aArgs.realloc( aArgs.getLength() + 1 );
-+ aArgs[ aArgs.getLength() ] = varg1;
-+ }
-+ if( varg2.hasValue() )
-+ {
-+ aArgs.realloc( aArgs.getLength() + 1 );
-+ aArgs[ aArgs.getLength() ] = varg2;
-+ }
-+ if( varg3.hasValue() )
-+ {
-+ aArgs.realloc( aArgs.getLength() + 1 );
-+ aArgs[ aArgs.getLength() ] = varg3;
-+ }
-+ if( varg4.hasValue() )
-+ {
-+ aArgs.realloc( aArgs.getLength() + 1 );
-+ aArgs[ aArgs.getLength() ] = varg4;
-+ }
-+ if( varg5.hasValue() )
-+ {
-+ aArgs.realloc( aArgs.getLength() + 1 );
-+ aArgs[ aArgs.getLength() ] = varg5;
-+ }
-+ if( varg6.hasValue() )
-+ {
-+ aArgs.realloc( aArgs.getLength() + 1 );
-+ aArgs[ aArgs.getLength() ] = varg6;
-+ }
-+ if( varg7.hasValue() )
-+ {
-+ aArgs.realloc( aArgs.getLength() + 1 );
-+ aArgs[ aArgs.getLength() ] = varg7;
-+ }
-+ if( varg8.hasValue() )
-+ {
-+ aArgs.realloc( aArgs.getLength() + 1 );
-+ aArgs[ aArgs.getLength() ] = varg8;
-+ }
-+ if( varg9.hasValue() )
-+ {
-+ aArgs.realloc( aArgs.getLength() + 1 );
-+ aArgs[ aArgs.getLength() ] = varg9;
-+ }
-+ if( varg10.hasValue() )
-+ {
-+ aArgs.realloc( aArgs.getLength() + 1 );
-+ aArgs[ aArgs.getLength() ] = varg10;
-+ }
-+ if( varg11.hasValue() )
-+ {
-+ aArgs.realloc( aArgs.getLength() + 1 );
-+ aArgs[ aArgs.getLength() ] = varg11;
-+ }
-+ if( varg12.hasValue() )
-+ {
-+ aArgs.realloc( aArgs.getLength() + 1 );
-+ aArgs[ aArgs.getLength() ] = varg12;
-+ }
-+ if( varg13.hasValue() )
-+ {
-+ aArgs.realloc( aArgs.getLength() + 1 );
-+ aArgs[ aArgs.getLength() ] = varg13;
-+ }
-+ if( varg14.hasValue() )
-+ {
-+ aArgs.realloc( aArgs.getLength() + 1 );
-+ aArgs[ aArgs.getLength() ] = varg14;
-+ }
-+ if( varg15.hasValue() )
-+ {
-+ aArgs.realloc( aArgs.getLength() + 1 );
-+ aArgs[ aArgs.getLength() ] = varg15;
-+ }
-+ if( varg16.hasValue() )
-+ {
-+ aArgs.realloc( aArgs.getLength() + 1 );
-+ aArgs[ aArgs.getLength() ] = varg16;
-+ }
-+ if( varg17.hasValue() )
-+ {
-+ aArgs.realloc( aArgs.getLength() + 1 );
-+ aArgs[ aArgs.getLength() ] = varg17;
-+ }
-+ if( varg18.hasValue() )
-+ {
-+ aArgs.realloc( aArgs.getLength() + 1 );
-+ aArgs[ aArgs.getLength() ] = varg18;
-+ }
-+ if( varg19.hasValue() )
-+ {
-+ aArgs.realloc( aArgs.getLength() + 1 );
-+ aArgs[ aArgs.getLength() ] = varg19;
-+ }
-+ if( varg20.hasValue() )
-+ {
-+ aArgs.realloc( aArgs.getLength() + 1 );
-+ aArgs[ aArgs.getLength() ] = varg20;
-+ }
-+ if( varg21.hasValue() )
-+ {
-+ aArgs.realloc( aArgs.getLength() + 1 );
-+ aArgs[ aArgs.getLength() ] = varg21;
-+ }
-+ if( varg22.hasValue() )
-+ {
-+ aArgs.realloc( aArgs.getLength() + 1 );
-+ aArgs[ aArgs.getLength() ] = varg22;
-+ }
-+ if( varg23.hasValue() )
-+ {
-+ aArgs.realloc( aArgs.getLength() + 1 );
-+ aArgs[ aArgs.getLength() ] = varg23;
-+ }
-+ if( varg24.hasValue() )
-+ {
-+ aArgs.realloc( aArgs.getLength() + 1 );
-+ aArgs[ aArgs.getLength() ] = varg24;
-+ }
-+ if( varg25.hasValue() )
-+ {
-+ aArgs.realloc( aArgs.getLength() + 1 );
-+ aArgs[ aArgs.getLength() ] = varg25;
-+ }
-+ if( varg26.hasValue() )
-+ {
-+ aArgs.realloc( aArgs.getLength() + 1 );
-+ aArgs[ aArgs.getLength() ] = varg26;
-+ }
-+ if( varg27.hasValue() )
-+ {
-+ aArgs.realloc( aArgs.getLength() + 1 );
-+ aArgs[ aArgs.getLength() ] = varg27;
-+ }
-+ if( varg28.hasValue() )
-+ {
-+ aArgs.realloc( aArgs.getLength() + 1 );
-+ aArgs[ aArgs.getLength() ] = varg28;
-+ }
-+ if( varg29.hasValue() )
-+ {
-+ aArgs.realloc( aArgs.getLength() + 1 );
-+ aArgs[ aArgs.getLength() ] = varg29;
-+ }
-+ if( varg30.hasValue() )
-+ {
-+ aArgs.realloc( aArgs.getLength() + 1 );
-+ aArgs[ aArgs.getLength() ] = varg30;
-+ }
-+ uno::Any aRet;
-+ executeMacro( pShell, sMacroUrl, aArgs, aRet );
-+ }
-+ else
-+ {
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("The macro doesn't exist") ), uno::Reference< uno::XInterface >() );
-+ }
-+ }
-+}
-+
-+float SAL_CALL VbaApplicationBase::CentimetersToPoints( float _Centimeters ) throw (uno::RuntimeException)
-+{
-+ // i cm = 28.35 points
-+ static const float rate = 28.35;
-+ return ( _Centimeters * rate );
-+}
-+
- rtl::OUString&
- VbaApplicationBase::getServiceImplName()
- {
-diff --git vbahelper/source/vbahelper/vbacolorformat.cxx vbahelper/source/vbahelper/vbacolorformat.cxx
-new file mode 100644
-index 0000000..d2ce12b
---- /dev/null
-+++ vbahelper/source/vbahelper/vbacolorformat.cxx
-@@ -0,0 +1,190 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <ooo/vba/msforms/XLineFormat.hpp>
-+#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 vbahelper/source/vbahelper/vbacolorformat.hxx vbahelper/source/vbahelper/vbacolorformat.hxx
-new file mode 100644
-index 0000000..a45d5d8
---- /dev/null
-+++ vbahelper/source/vbahelper/vbacolorformat.hxx
-@@ -0,0 +1,128 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SC_VBA_XCOLORFORMAT_HXX
-+#define SC_VBA_XCOLORFORMAT_HXX
-+
-+#include <com/sun/star/drawing/XShape.hpp>
-+#include <ooo/vba/msforms/XColorFormat.hpp>
-+#include <ooo/vba/msforms/XFillFormat.hpp>
-+#include <vbahelper/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<rtl::OUString> 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 vbahelper/source/vbahelper/vbadialogbase.cxx vbahelper/source/vbahelper/vbadialogbase.cxx
-new file mode 100644
-index 0000000..205442e
---- /dev/null
-+++ vbahelper/source/vbahelper/vbadialogbase.cxx
-@@ -0,0 +1,52 @@
-+/*************************************************************************
-+ *
-+ * 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: vbadialog.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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include <vbahelper/vbadialogbase.hxx>
-+#include <vbahelper/vbahelper.hxx>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+// fails silently
-+void
-+VbaDialogBase::Show() throw(uno::RuntimeException)
-+{
-+ rtl::OUString aURL;
-+ uno::Reference< frame::XModel > xModel = getCurrentDocument();
-+ if ( xModel.is() )
-+ {
-+ aURL = mapIndexToName( mnIndex );
-+ if( aURL.getLength() == 0 )
-+ throw uno::RuntimeException(
-+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " Unable to open the specified dialog " ) ),
-+ uno::Reference< XInterface > () );
-+ dispatchRequests( xModel, aURL );
-+ }
-+}
-+
-diff --git vbahelper/source/vbahelper/vbadialogsbase.cxx vbahelper/source/vbahelper/vbadialogsbase.cxx
-new file mode 100644
-index 0000000..f3679d6
---- /dev/null
-+++ vbahelper/source/vbahelper/vbadialogsbase.cxx
-@@ -0,0 +1,47 @@
-+/*************************************************************************
-+ *
-+ * 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: vbadialogs.cxx,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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include <vbahelper/vbadialogsbase.hxx>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+::sal_Int32
-+VbaDialogsBase::getCount() throw (uno::RuntimeException)
-+{
-+ //#TODO #FIXEME
-+ return 0;
-+}
-+
-+uno::Any
-+VbaDialogsBase::Item( const uno::Any& /* &aItem */) throw (uno::RuntimeException)
-+{
-+ return uno::Any();
-+}
-+
-diff --git vbahelper/source/vbahelper/vbadocumentsbase.cxx vbahelper/source/vbahelper/vbadocumentsbase.cxx
-new file mode 100644
-index 0000000..813e084
---- /dev/null
-+++ vbahelper/source/vbahelper/vbadocumentsbase.cxx
-@@ -0,0 +1,295 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include <vbahelper/vbadocumentsbase.hxx>
-+#include <comphelper/processfactory.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <cppuhelper/implbase3.hxx>
-+#include <com/sun/star/frame/XDesktop.hpp>
-+#include <com/sun/star/container/XEnumerationAccess.hpp>
-+#include <com/sun/star/frame/XComponentLoader.hpp>
-+#include <com/sun/star/lang/XComponent.hpp>
-+#include <com/sun/star/frame/XModel.hpp>
-+#include <com/sun/star/frame/XFrame.hpp>
-+#include <com/sun/star/frame/FrameSearchFlag.hpp>
-+#include <com/sun/star/util/XModifiable.hpp>
-+#include <com/sun/star/frame/XStorable.hpp>
-+#include <com/sun/star/lang/DisposedException.hpp>
-+#include <com/sun/star/beans/PropertyVetoException.hpp>
-+#include <com/sun/star/util/XCloseable.hpp>
-+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
-+#include <com/sun/star/document/XTypeDetection.hpp>
-+#include <com/sun/star/uri/XUriReference.hpp>
-+#include <com/sun/star/uri/XUriReferenceFactory.hpp>
-+#include <com/sun/star/lang/XServiceInfo.hpp>
-+#include <sfx2/objsh.hxx>
-+#include <tools/urlobj.hxx>
-+#include <vbahelper/vbahelper.hxx>
-+#include <hash_map>
-+#include <osl/file.hxx>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+static const rtl::OUString sSpreadsheetDocument( rtl::OUString::createFromAscii( "com.sun.star.sheet.SpreadsheetDocument" ) );
-+static const rtl::OUString sTextDocument( rtl::OUString::createFromAscii( "com.sun.star.text.TextDocument" ) );
-+
-+typedef std::hash_map< rtl::OUString,
-+sal_Int32, ::rtl::OUStringHash,
-+::std::equal_to< ::rtl::OUString > > NameIndexHash;
-+
-+typedef std::vector < uno::Reference< frame::XModel > > Documents;
-+
-+typedef ::cppu::WeakImplHelper1< container::XEnumeration > DocumentsEnumImpl_BASE;
-+
-+// #FIXME clearly this is a candidate for some sort of helper base class as
-+// this is a copy of SelectedSheetsEnum ( vbawindow.cxx )
-+
-+class DocumentsEnumImpl : public DocumentsEnumImpl_BASE
-+{
-+ uno::Reference< uno::XComponentContext > m_xContext;
-+ Documents m_documents;
-+ Documents::const_iterator m_it;
-+
-+public:
-+ DocumentsEnumImpl( const uno::Reference< uno::XComponentContext >& xContext, const Documents& docs ) throw ( uno::RuntimeException ) : m_xContext( xContext ), m_documents( docs )
-+ {
-+ m_it = m_documents.begin();
-+ }
-+ DocumentsEnumImpl( 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< frame::XModel > xNext( mxComponents->nextElement(), uno::UNO_QUERY );
-+ if ( xNext.is() )
-+ m_documents.push_back( xNext );
-+ }
-+ m_it = m_documents.begin();
-+ }
-+ // XEnumeration
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return m_it != m_documents.end();
-+ }
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( !hasMoreElements() )
-+ {
-+ throw container::NoSuchElementException();
-+ }
-+ return makeAny( *(m_it++) );
-+ }
-+};
-+
-+// #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
-+ > DocumentsAccessImpl_BASE;
-+
-+class DocumentsAccessImpl : public DocumentsAccessImpl_BASE
-+{
-+ uno::Reference< uno::XComponentContext > m_xContext;
-+ Documents m_documents;
-+ NameIndexHash namesToIndices;
-+ VbaDocumentsBase::DOCUMENT_TYPE meDocType;
-+public:
-+ DocumentsAccessImpl( const uno::Reference< uno::XComponentContext >& xContext, VbaDocumentsBase::DOCUMENT_TYPE eDocType ) throw (uno::RuntimeException) :m_xContext( xContext ), meDocType( eDocType )
-+ {
-+ uno::Reference< container::XEnumeration > xEnum = new DocumentsEnumImpl( m_xContext );
-+ sal_Int32 nIndex=0;
-+ while( xEnum->hasMoreElements() )
-+ {
-+ uno::Reference< lang::XServiceInfo > xServiceInfo( xEnum->nextElement(), uno::UNO_QUERY );
-+ if ( xServiceInfo.is()
-+ && ( ( xServiceInfo->supportsService( sSpreadsheetDocument ) && meDocType == VbaDocumentsBase::EXCEL_DOCUMENT )
-+ || ( xServiceInfo->supportsService( sTextDocument ) && meDocType == VbaDocumentsBase::WORD_DOCUMENT ) ) )
-+ {
-+ uno::Reference< frame::XModel > xModel( xServiceInfo, uno::UNO_QUERY_THROW ); // that the spreadsheetdocument is a xmodel is a given
-+ m_documents.push_back( xModel );
-+ INetURLObject aURL( xModel->getURL() );
-+ namesToIndices[ aURL.GetLastName() ] = nIndex++;
-+ }
-+ }
-+
-+ }
-+
-+ //XEnumerationAccess
-+ virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
-+ {
-+ return new DocumentsEnumImpl( m_xContext, m_documents );
-+ }
-+ // XIndexAccess
-+ virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
-+ {
-+ return m_documents.size();
-+ }
-+ virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw ( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( Index < 0
-+ || static_cast< Documents::size_type >(Index) >= m_documents.size() )
-+ throw lang::IndexOutOfBoundsException();
-+ return makeAny( m_documents[ Index ] ); // returns xspreadsheetdoc
-+ }
-+
-+ //XElementAccess
-+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
-+ {
-+ return frame::XModel::static_type(0);
-+ }
-+
-+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
-+ {
-+ return (m_documents.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_documents[ 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());
-+ }
-+
-+};
-+
-+VbaDocumentsBase::VbaDocumentsBase( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< css::uno::XComponentContext >& xContext, DOCUMENT_TYPE eDocType ) throw (uno::RuntimeException) : VbaDocumentsBase_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new DocumentsAccessImpl( xContext, eDocType ) ) ), meDocType( eDocType )
-+{
-+}
-+
-+uno::Any SAL_CALL
-+VbaDocumentsBase::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 );
-+ rtl::OUString sURL;
-+ if( meDocType == WORD_DOCUMENT )
-+ sURL = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("private:factory/swriter") );
-+ else if( meDocType == EXCEL_DOCUMENT )
-+ sURL = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("private:factory/scalc") );
-+ else
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+ uno::Reference< lang::XComponent > xComponent = xLoader->loadComponentFromURL(
-+ sURL ,
-+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("_blank") ), 0,
-+ uno::Sequence< beans::PropertyValue >(0) );
-+ return uno::makeAny( xComponent );
-+}
-+
-+void
-+VbaDocumentsBase::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);
-+}
-+
-+// #TODO# #FIXME# can any of the unused params below be used?
-+uno::Any
-+VbaDocumentsBase::Open( const rtl::OUString& rFileName, const uno::Any& ReadOnly, const uno::Sequence< beans::PropertyValue >& rProps ) 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;
-+ 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( rProps );
-+ sal_Int32 nIndex = 0;
-+
-+ 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);
-+ return uno::makeAny( xComponent );
-+}
-+
-diff --git vbahelper/source/vbahelper/vbafillformat.cxx vbahelper/source/vbahelper/vbafillformat.cxx
-new file mode 100644
-index 0000000..ed7fcd2
---- /dev/null
-+++ vbahelper/source/vbahelper/vbafillformat.cxx
-@@ -0,0 +1,202 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <com/sun/star/awt/Gradient.hpp>
-+#include <com/sun/star/awt/GradientStyle.hpp>
-+#include <ooo/vba/office/MsoGradientStyle.hpp>
-+#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<double>( 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 vbahelper/source/vbahelper/vbafillformat.hxx vbahelper/source/vbahelper/vbafillformat.hxx
-new file mode 100644
-index 0000000..047af92
---- /dev/null
-+++ vbahelper/source/vbahelper/vbafillformat.hxx
-@@ -0,0 +1,74 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SC_VBA_XFILLFORMAT_HXX
-+#define SC_VBA_XFILLFORMAT_HXX
-+
-+#include <com/sun/star/drawing/XShape.hpp>
-+#include <com/sun/star/drawing/FillStyle.hpp>
-+#include <ooo/vba/msforms/XFillFormat.hpp>
-+#include <vbahelper/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<rtl::OUString> 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 vbahelper/source/vbahelper/vbafontbase.cxx vbahelper/source/vbahelper/vbafontbase.cxx
-new file mode 100644
-index 0000000..26da500
---- /dev/null
-+++ vbahelper/source/vbahelper/vbafontbase.cxx
-@@ -0,0 +1,309 @@
-+/*************************************************************************
-+ *
-+ * 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: vbafont.cxx,v $
-+ * $Revision: 1.7 $
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include <com/sun/star/beans/XProperty.hpp>
-+#include <com/sun/star/awt/FontWeight.hpp>
-+#include <com/sun/star/awt/FontUnderline.hpp>
-+#include <com/sun/star/awt/FontStrikeout.hpp>
-+#include <com/sun/star/awt/FontSlant.hpp>
-+#include <com/sun/star/text/XSimpleText.hpp>
-+#include <vbahelper/vbafontbase.hxx>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+VbaFontBase::VbaFontBase( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< css::container::XIndexAccess >& xPalette, uno::Reference< beans::XPropertySet > xPropertySet ) throw ( uno::RuntimeException ) : VbaFontBase_BASE( xParent, xContext ), mxFont( xPropertySet, css::uno::UNO_QUERY_THROW ), mxPalette( xPalette )
-+{
-+}
-+
-+VbaFontBase::~VbaFontBase()
-+{
-+}
-+
-+
-+void SAL_CALL
-+VbaFontBase::setSuperscript( const uno::Any& aValue ) throw ( uno::RuntimeException )
-+{
-+ sal_Bool bValue = sal_False;
-+ aValue >>= bValue;
-+ sal_Int16 nValue = NORMAL;
-+ sal_Int8 nValue2 = NORMALHEIGHT;
-+
-+ if( bValue )
-+ {
-+ nValue = SUPERSCRIPT;
-+ nValue2 = SUPERSCRIPTHEIGHT;
-+ }
-+ mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ), ( uno::Any )nValue );
-+ mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapementHeight" ) ), ( uno::Any )nValue2 );
-+}
-+
-+uno::Any SAL_CALL
-+VbaFontBase::getSuperscript() throw ( uno::RuntimeException )
-+{
-+ short nValue = 0;
-+ mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ) ) >>= nValue;
-+ return uno::makeAny( ( nValue == SUPERSCRIPT ) );
-+}
-+
-+void SAL_CALL
-+VbaFontBase::setSubscript( const uno::Any& aValue ) throw ( uno::RuntimeException )
-+{
-+ sal_Bool bValue = sal_False;
-+ aValue >>= bValue;
-+ sal_Int16 nValue = NORMAL;
-+ sal_Int8 nValue2 = NORMALHEIGHT;
-+
-+ if( bValue )
-+ {
-+ nValue= SUBSCRIPT;
-+ nValue2 = SUBSCRIPTHEIGHT;
-+ }
-+
-+ mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapementHeight" ) ), ( uno::Any )nValue2 );
-+ mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ), ( uno::Any )nValue );
-+
-+}
-+
-+uno::Any SAL_CALL
-+VbaFontBase::getSubscript() throw ( uno::RuntimeException )
-+{
-+ short nValue = NORMAL;
-+ mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ) ) >>= nValue;
-+ return uno::makeAny( ( nValue == SUBSCRIPT ) );
-+}
-+
-+void SAL_CALL
-+VbaFontBase::setSize( const uno::Any& aValue ) throw( uno::RuntimeException )
-+{
-+ mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharHeight" ) ), aValue );
-+}
-+
-+uno::Any SAL_CALL
-+VbaFontBase::getSize() throw ( uno::RuntimeException )
-+{
-+ return mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharHeight" ) ) );
-+}
-+
-+void SAL_CALL
-+VbaFontBase::setColorIndex( const uno::Any& _colorindex ) throw( uno::RuntimeException )
-+{
-+ sal_Int32 nIndex = 0;
-+ _colorindex >>= nIndex;
-+
-+ --nIndex; // OOo indices are zero bases
-+
-+ // 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(mxPalette->getByIndex( nIndex )) );
-+}
-+
-+
-+uno::Any SAL_CALL
-+VbaFontBase::getColorIndex() throw ( uno::RuntimeException )
-+{
-+ sal_Int32 nColor = 0;
-+
-+ XLRGBToOORGB( getColor() ) >>= nColor;
-+ sal_Int32 nElems = mxPalette->getCount();
-+ sal_Int32 nIndex = -1;
-+ for ( sal_Int32 count=0; count<nElems; ++count )
-+ {
-+ sal_Int32 nPaletteColor = 0;
-+ mxPalette->getByIndex( count ) >>= nPaletteColor;
-+ if ( nPaletteColor == nColor )
-+ {
-+ nIndex = count + 1; // 1 based
-+ break;
-+ }
-+ }
-+ return uno::makeAny( nIndex );
-+}
-+
-+void SAL_CALL
-+VbaFontBase::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
-+VbaFontBase::getBold() throw ( uno::RuntimeException )
-+{
-+ double fValue = 0.0;
-+ mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharWeight" ) ) ) >>= fValue;
-+ return uno::makeAny( fValue == awt::FontWeight::BOLD );
-+}
-+
-+void SAL_CALL
-+VbaFontBase::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
-+VbaFontBase::getStrikethrough() throw ( uno::RuntimeException )
-+{
-+ short nValue = 0;
-+ mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharStrikeout" ) ) ) >>= nValue;
-+ return uno::Any( nValue == awt::FontStrikeout::SINGLE );
-+}
-+
-+void SAL_CALL
-+VbaFontBase::setShadow( const uno::Any& aValue ) throw ( uno::RuntimeException )
-+{
-+ mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharShadowed" ) ), aValue );
-+}
-+
-+uno::Any SAL_CALL
-+VbaFontBase::getShadow() throw (uno::RuntimeException)
-+{
-+ return mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharShadowed" ) ) );
-+}
-+
-+void SAL_CALL
-+VbaFontBase::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 );
-+}
-+
-+uno::Any SAL_CALL
-+VbaFontBase::getItalic() throw ( uno::RuntimeException )
-+{
-+
-+ awt::FontSlant aFS;
-+ mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharPosture" ) ) ) >>= aFS;
-+ return uno::makeAny( aFS == awt::FontSlant_ITALIC );
-+}
-+
-+void SAL_CALL
-+VbaFontBase::setName( const uno::Any& aValue ) throw ( uno::RuntimeException )
-+{
-+ rtl::OUString sString;
-+ aValue >>= sString;
-+ mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharFontName" ) ), aValue);
-+}
-+
-+uno::Any SAL_CALL
-+VbaFontBase::getName() throw ( uno::RuntimeException )
-+{
-+ return mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharFontName" ) ) );
-+}
-+uno::Any
-+VbaFontBase::getColor() throw (uno::RuntimeException)
-+{
-+ uno::Any aAny;
-+ aAny = OORGBToXLRGB( mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharColor" ) ) ) );
-+ return aAny;
-+}
-+
-+void
-+VbaFontBase::setColor( const uno::Any& _color ) throw (uno::RuntimeException)
-+{
-+ mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharColor" ) ) , XLRGBToOORGB(_color));
-+}
-+
-+void SAL_CALL
-+VbaFontBase::setUnderline( const uno::Any& aValue ) throw ( uno::RuntimeException )
-+{
-+/*
-+ // default
-+ sal_Int32 nValue = excel::XlUnderlineStyle::xlUnderlineStyleNone;
-+ aValue >>= nValue;
-+ switch ( nValue )
-+ {
-+// NOTE:: #TODO #FIMXE
-+// xlUnderlineStyleDoubleAccounting & xlUnderlineStyleSingleAccounting
-+// don't seem to be supported in Openoffice.
-+// The import filter converts them to single or double underlines as appropriate
-+// So, here at the moment we are similarly silently converting
-+// xlUnderlineStyleSingleAccounting to xlUnderlineStyleSingle.
-+
-+ case excel::XlUnderlineStyle::xlUnderlineStyleNone:
-+ nValue = awt::FontUnderline::NONE;
-+ break;
-+ case excel::XlUnderlineStyle::xlUnderlineStyleSingle:
-+ case excel::XlUnderlineStyle::xlUnderlineStyleSingleAccounting:
-+ nValue = awt::FontUnderline::SINGLE;
-+ break;
-+ case excel::XlUnderlineStyle::xlUnderlineStyleDouble:
-+ case excel::XlUnderlineStyle::xlUnderlineStyleDoubleAccounting:
-+ nValue = awt::FontUnderline::DOUBLE;
-+ break;
-+ default:
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Unknown value for Underline")), uno::Reference< uno::XInterface >() );
-+ }
-+
-+ mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharUnderline" ) ), ( uno::Any )nValue );
-+*/
-+
-+}
-+
-+uno::Any SAL_CALL
-+VbaFontBase::getUnderline() throw ( uno::RuntimeException )
-+{
-+ sal_Int32 nValue = awt::FontUnderline::NONE;
-+ mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharUnderline" ) ) ) >>= nValue;
-+/*
-+ switch ( nValue )
-+ {
-+ case awt::FontUnderline::DOUBLE:
-+ nValue = excel::XlUnderlineStyle::xlUnderlineStyleDouble;
-+ break;
-+ case awt::FontUnderline::SINGLE:
-+ nValue = excel::XlUnderlineStyle::xlUnderlineStyleSingle;
-+ break;
-+ case awt::FontUnderline::NONE:
-+ nValue = excel::XlUnderlineStyle::xlUnderlineStyleNone;
-+ break;
-+ default:
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Unknown value retrieved for Underline") ), uno::Reference< uno::XInterface >() );
-+
-+ }
-+*/
-+ return uno::makeAny( nValue );
-+}
-+
-+
-diff --git vbahelper/source/vbahelper/vbahelper.cxx vbahelper/source/vbahelper/vbahelper.cxx
-index b95ccf1..57bca7c 100644
---- vbahelper/source/vbahelper/vbahelper.cxx
-+++ vbahelper/source/vbahelper/vbahelper.cxx
-@@ -89,6 +89,7 @@ using namespace ::ooo::vba;
-
- #define POINTTO100THMILLIMETERFACTOR 35.27778
-
-+
- void unoToSbxValue( SbxVariable* pVar, const uno::Any& aValue );
-
- uno::Any sbxToUnoValue( SbxVariable* pVar );
-@@ -468,6 +469,8 @@ getCurrentDocument() throw (uno::RuntimeException)
- sal_Int32
- OORGBToXLRGB( sal_Int32 nCol )
- {
-+ sal_Int32 nAutoBits = nCol;
-+ nAutoBits &= 0xFF000000;
- sal_Int32 nRed = nCol;
- nRed &= 0x00FF0000;
- nRed >>= 16;
-@@ -476,12 +479,15 @@ OORGBToXLRGB( sal_Int32 nCol )
- nGreen >>= 8;
- sal_Int32 nBlue = nCol;
- nBlue &= 0x000000FF;
-- sal_Int32 nRGB = ( (nBlue << 16) | (nGreen << 8) | nRed );
-+ sal_Int32 nRGB = ( nAutoBits | (nBlue << 16) | (nGreen << 8) | nRed );
- return nRGB;
- }
- sal_Int32
- XLRGBToOORGB( sal_Int32 nCol )
- {
-+ sal_Int32 nAutoBits = nCol;
-+ nAutoBits &= 0xFF000000;
-+
- sal_Int32 nBlue = nCol;
- nBlue &= 0x00FF0000;
- nBlue >>= 16;
-@@ -490,7 +496,7 @@ XLRGBToOORGB( sal_Int32 nCol )
- nGreen >>= 8;
- sal_Int32 nRed = nCol;
- nRed &= 0x000000FF;
-- sal_Int32 nRGB = ( (nRed << 16) | (nGreen << 8) | nBlue );
-+ sal_Int32 nRGB = ( nAutoBits | (nRed << 16) | (nGreen << 8) | nBlue );
- return nRGB;
- }
- uno::Any
-@@ -899,59 +905,6 @@ void setCursorHelper( const Pointer& rPointer, sal_Bool bOverWrite )
- }
- }
-
--String docMacroExists( SfxObjectShell* pShell, const String& sMod, const String& sMacro )
--{
-- String sFullName;
-- // would use the script provider to see if the macro exists but
-- // called at this stage tdoc content handler stuff is not set up
-- // so it fails
--
-- String sLibrary( RTL_CONSTASCII_USTRINGPARAM("Standard"));
-- BasicManager* pBasicMgr = pShell-> GetBasicManager();
-- if ( pBasicMgr )
-- {
-- if ( pBasicMgr->GetName().Len() )
-- sLibrary = pBasicMgr->GetName();
-- StarBASIC* pBasic = pBasicMgr->GetLib( sLibrary );
-- if ( !pBasic )
-- {
-- USHORT nId = pBasicMgr->GetLibId( sLibrary );
-- pBasicMgr->LoadLib( nId );
-- pBasic = pBasicMgr->GetLib( sLibrary );
-- }
-- if ( pBasic )
-- {
-- if ( sMod.Len() ) // we wish to find the macro is a specific module
-- {
-- SbModule* pModule = pBasic->FindModule( sMod );
-- if ( pModule )
-- {
-- SbxArray* pMethods = pModule->GetMethods();
-- if ( pMethods )
-- {
-- SbMethod* pMethod = static_cast< SbMethod* >( pMethods->Find( sMacro, SbxCLASS_METHOD ) );
-- if ( pMethod )
-- {
-- sFullName = sMacro;
-- sFullName.Insert( '.', 0 ).Insert( sMod, 0 ).Insert( '.', 0 ).Insert( sLibrary, 0 );
-- }
-- }
-- }
-- }
-- else if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pBasic->Find( sMacro, SbxCLASS_METHOD ) ) )
-- {
-- if( SbModule* pModule = pMethod->GetModule() )
-- {
-- sFullName = sMacro;
-- sFullName.Insert( '.', 0 ).Insert( pModule->GetName(), 0).Insert( '.', 0 ).Insert( sLibrary, 0 );
-- }
-- }
--
-- }
-- }
-- return sFullName;
--}
--
- #define VBA_LEFT "PositionX"
- #define VBA_TOP "PositionY"
- UserFormGeometryHelper::UserFormGeometryHelper( const uno::Reference< uno::XComponentContext >& /*xContext*/, const uno::Reference< awt::XControl >& xControl )
-diff --git vbahelper/source/vbahelper/vbalineformat.cxx vbahelper/source/vbahelper/vbalineformat.cxx
-new file mode 100644
-index 0000000..7c9610f
---- /dev/null
-+++ vbahelper/source/vbahelper/vbalineformat.cxx
-@@ -0,0 +1,458 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include <ooo/vba/office/MsoArrowheadStyle.hpp>
-+#include <ooo/vba/office/MsoArrowheadLength.hpp>
-+#include <ooo/vba/office/MsoArrowheadWidth.hpp>
-+#include <ooo/vba/office/MsoLineDashStyle.hpp>
-+#include <com/sun/star/drawing/LineStyle.hpp>
-+#include <com/sun/star/drawing/LineDash.hpp>
-+#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<sal_Int32>( 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<double>( nTransparency );
-+ return fTransparency / 100;
-+}
-+
-+void SAL_CALL
-+ScVbaLineFormat::setTransparency( double _transparency ) throw (uno::RuntimeException)
-+{
-+ sal_Int16 nTransparency = static_cast<sal_Int16>( _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 vbahelper/source/vbahelper/vbalineformat.hxx vbahelper/source/vbahelper/vbalineformat.hxx
-new file mode 100644
-index 0000000..a6287e4
---- /dev/null
-+++ vbahelper/source/vbahelper/vbalineformat.hxx
-@@ -0,0 +1,85 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SC_VBA_XLINEFORMAT_HXX
-+#define SC_VBA_XLINEFORMAT_HXX
-+
-+#include <com/sun/star/drawing/XShape.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <ooo/vba/msforms/XLineFormat.hpp>
-+#include <vbahelper/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<rtl::OUString> 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 vbahelper/source/vbahelper/vbapagesetupbase.cxx vbahelper/source/vbahelper/vbapagesetupbase.cxx
-new file mode 100644
-index 0000000..569b204
---- /dev/null
-+++ vbahelper/source/vbahelper/vbapagesetupbase.cxx
-@@ -0,0 +1,325 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include <vbahelper/vbapagesetupbase.hxx>
-+
-+using namespace ::com::sun::star;
-+using namespace ::ooo::vba;
-+
-+VbaPageSetupBase::VbaPageSetupBase(const uno::Reference< XHelperInterface >& xParent,
-+ const uno::Reference< uno::XComponentContext >& xContext ) throw (uno::RuntimeException): VbaPageSetupBase_BASE( xParent, xContext )
-+{
-+}
-+
-+double SAL_CALL VbaPageSetupBase::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 = topMargin + headerHeight;
-+ }
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+
-+ return Millimeter::getInPoints( topMargin );
-+}
-+
-+void SAL_CALL VbaPageSetupBase::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 VbaPageSetupBase::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 VbaPageSetupBase::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 VbaPageSetupBase::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 VbaPageSetupBase::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 VbaPageSetupBase::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 VbaPageSetupBase::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 VbaPageSetupBase::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 );;
-+}
-+
-+void SAL_CALL VbaPageSetupBase::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& )
-+ {
-+ }
-+}
-+
-+double SAL_CALL VbaPageSetupBase::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 );;
-+}
-+
-+void SAL_CALL VbaPageSetupBase::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 VbaPageSetupBase::getOrientation() throw (css::uno::RuntimeException)
-+{
-+ sal_Int32 orientation = mnOrientPortrait;
-+ try
-+ {
-+ sal_Bool isLandscape = sal_False;
-+ uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsLandscape")));
-+ aValue >>= isLandscape;
-+
-+ if( isLandscape )
-+ {
-+ orientation = mnOrientLandscape;
-+ }
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+ return orientation;
-+}
-+
-+void SAL_CALL VbaPageSetupBase::setOrientation( sal_Int32 orientation ) throw (css::uno::RuntimeException)
-+{
-+ if( ( orientation != mnOrientPortrait ) &&
-+ ( orientation != mnOrientLandscape ) )
-+ {
-+ 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 != mnOrientLandscape ) ||
-+ ( !isLandscape && orientation != mnOrientPortrait ))
-+ {
-+ 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 = mnOrientLandscape;
-+ }
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+}
-+
-diff --git vbahelper/source/vbahelper/vbapictureformat.cxx vbahelper/source/vbahelper/vbapictureformat.cxx
-new file mode 100644
-index 0000000..2663682
---- /dev/null
-+++ vbahelper/source/vbahelper/vbapictureformat.cxx
-@@ -0,0 +1,147 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * 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 vbahelper/source/vbahelper/vbapictureformat.hxx vbahelper/source/vbahelper/vbapictureformat.hxx
-new file mode 100644
-index 0000000..a549b88
---- /dev/null
-+++ vbahelper/source/vbahelper/vbapictureformat.hxx
-@@ -0,0 +1,64 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SC_VBA_PICTUREFORMAT_HXX
-+#define SC_VBA_PICTUREFORMAT_HXX
-+
-+#include <com/sun/star/drawing/XShape.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <ooo/vba/msforms/XPictureFormat.hpp>
-+#include <vbahelper/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<rtl::OUString> 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 vbahelper/source/vbahelper/vbashape.cxx vbahelper/source/vbahelper/vbashape.cxx
-new file mode 100644
-index 0000000..5a8dbd6
---- /dev/null
-+++ vbahelper/source/vbahelper/vbashape.cxx
-@@ -0,0 +1,679 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include<ooo/vba/office/MsoZOrderCmd.hpp>
-+#include<ooo/vba/office/MsoScaleFrom.hpp>
-+#include<com/sun/star/container/XNamed.hpp>
-+#include<com/sun/star/drawing/ConnectorType.hpp>
-+#include <com/sun/star/lang/XEventListener.hpp>
-+#include<com/sun/star/drawing/XDrawPagesSupplier.hpp>
-+#include<com/sun/star/drawing/XDrawPages.hpp>
-+#include<com/sun/star/view/XSelectionSupplier.hpp>
-+#include <com/sun/star/lang/XServiceInfo.hpp>
-+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-+#include <com/sun/star/text/TextContentAnchorType.hpp>
-+#include <ooo/vba/word/WdRelativeHorizontalPosition.hpp>
-+#include <ooo/vba/word/WdRelativeVerticalPosition.hpp>
-+
-+#include <comphelper/processfactory.hxx>
-+#include <vos/mutex.hxx>
-+#include <vcl/svapp.hxx>
-+#include <svx/unopage.hxx>
-+#include <svx/unoshape.hxx>
-+
-+#include <vbahelper/vbashape.hxx>
-+#include <vbahelper/vbatextframe.hxx>
-+#include "vbalineformat.hxx"
-+#include "vbafillformat.hxx"
-+#include "vbapictureformat.hxx"
-+#include <vbahelper/vbashaperange.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 );
-+ m_pShapeHelper.reset( new ShapeHelper( m_xShape ) );
-+ 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 )
-+{
-+ try
-+ {
-+ 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();
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+}
-+
-+
-+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();
-+ OSL_TRACE("ScVbaShape::getType: %s", rtl::OUStringToOString( sShapeType, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ // 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" ) ) ||
-+ sShapeType.equals( rtl::OUString::createFromAscii( "FrameShape" ) ) )
-+ 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 if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.TextShape" ) ) )
-+ return office::MsoShapeType::msoTextBox;
-+ else
-+ throw uno::RuntimeException( rtl::OUString::createFromAscii( "the shape type do not be supported: " ) + 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 m_pShapeHelper->getHeight();
-+}
-+
-+void SAL_CALL
-+ScVbaShape::setHeight( double _height ) throw (uno::RuntimeException)
-+{
-+ m_pShapeHelper->setHeight( _height );
-+}
-+
-+double SAL_CALL
-+ScVbaShape::getWidth() throw (uno::RuntimeException)
-+{
-+ return m_pShapeHelper->getWidth();
-+}
-+
-+void SAL_CALL
-+ScVbaShape::setWidth( double _width ) throw (uno::RuntimeException)
-+{
-+ m_pShapeHelper->setWidth( _width );
-+}
-+
-+double SAL_CALL
-+ScVbaShape::getLeft() throw (uno::RuntimeException)
-+{
-+ return m_pShapeHelper->getLeft();
-+}
-+
-+void SAL_CALL
-+ScVbaShape::setLeft( double _left ) throw (uno::RuntimeException)
-+{
-+ m_pShapeHelper->setLeft( _left );
-+}
-+
-+double SAL_CALL
-+ScVbaShape::getTop() throw (uno::RuntimeException)
-+{
-+ return m_pShapeHelper->getTop();
-+}
-+
-+void SAL_CALL
-+ScVbaShape::setTop( double _top ) throw (uno::RuntimeException)
-+{
-+ return m_pShapeHelper->setTop( _top );
-+}
-+
-+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::Any SAL_CALL
-+ScVbaShape::TextFrame() throw (uno::RuntimeException)
-+{
-+ uno::Reference< frame::XModel > xModel = getCurrentDocument();
-+ uno::Reference< lang::XServiceInfo > xServiceInfo( xModel, uno::UNO_QUERY_THROW );
-+ if( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.SpreadsheetDocument" ) ) ) )
-+ {
-+ uno::Reference< lang::XMultiServiceFactory > xSF( comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+ uno::Sequence< uno::Any > aArgs(2);
-+ aArgs[0] = uno::makeAny( getParent() );
-+ aArgs[1] <<= m_xShape;
-+ uno::Reference< uno::XInterface > xTextFrame( xSF->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.TextFrame") ) , aArgs ) , uno::UNO_QUERY_THROW );
-+ return uno::makeAny( xTextFrame );
-+ }
-+
-+ return uno::makeAny( uno::Reference< msforms::XTextFrame >( new VbaTextFrame( this, 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 )
-+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 );
-+}
-+
-+sal_Bool SAL_CALL
-+ScVbaShape::getLockAspectRatio() throw (uno::RuntimeException)
-+{
-+ // FIXME:
-+ return sal_False;
-+}
-+
-+void SAL_CALL
-+ScVbaShape::setLockAspectRatio( sal_Bool /*_lockaspectratio*/ ) throw (uno::RuntimeException)
-+{
-+ // FIXME:
-+}
-+
-+sal_Bool SAL_CALL
-+ScVbaShape::getLockAnchor() throw (uno::RuntimeException)
-+{
-+ // FIXME:
-+ return sal_True;
-+}
-+
-+void SAL_CALL
-+ScVbaShape::setLockAnchor( sal_Bool /*_lockanchor*/ ) throw (uno::RuntimeException)
-+{
-+ // FIXME:
-+}
-+
-+sal_Int32 SAL_CALL
-+ScVbaShape::getRelativeHorizontalPosition() throw (uno::RuntimeException)
-+{
-+ sal_Int32 nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin;
-+ text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH;
-+ m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ) ) >>= eType;
-+
-+ switch( eType )
-+ {
-+ case text::TextContentAnchorType_AT_PARAGRAPH:
-+ {
-+ nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionColumn;
-+ break;
-+ }
-+ case text::TextContentAnchorType_AT_PAGE:
-+ {
-+ nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionPage;
-+ break;
-+ }
-+ case text::TextContentAnchorType_AT_CHARACTER:
-+ {
-+ nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionCharacter;
-+ break;
-+ }
-+ case text::TextContentAnchorType_AT_FRAME:
-+ case text::TextContentAnchorType_AS_CHARACTER:
-+ {
-+ nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin;
-+ break;
-+ }
-+ default:
-+ {
-+ nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin;
-+ }
-+ }
-+ return nRelativeHorizontalPosition;
-+}
-+
-+void SAL_CALL
-+ScVbaShape::setRelativeHorizontalPosition( ::sal_Int32 _relativehorizontalposition ) throw (uno::RuntimeException)
-+{
-+ text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH;
-+ switch( _relativehorizontalposition )
-+ {
-+ case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionCharacter:
-+ {
-+ eType = text::TextContentAnchorType_AT_CHARACTER;
-+ break;
-+ }
-+ case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionColumn:
-+ case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin:
-+ {
-+ eType = text::TextContentAnchorType_AT_PARAGRAPH;
-+ break;
-+ }
-+ case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionPage:
-+ {
-+ eType = text::TextContentAnchorType_AT_PAGE;
-+ break;
-+ }
-+ default:
-+ {
-+ DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
-+ }
-+ }
-+ m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ), uno::makeAny( eType ) );
-+}
-+
-+sal_Int32 SAL_CALL
-+ScVbaShape::getRelativeVerticalPosition() throw (uno::RuntimeException)
-+{
-+ sal_Int32 nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin;
-+ text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH;
-+ m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ) ) >>= eType;
-+
-+ switch( eType )
-+ {
-+ case text::TextContentAnchorType_AT_PARAGRAPH:
-+ {
-+ nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionParagraph;
-+ break;
-+ }
-+ case text::TextContentAnchorType_AT_PAGE:
-+ {
-+ nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionPage;
-+ break;
-+ }
-+ case text::TextContentAnchorType_AT_CHARACTER:
-+ {
-+ nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionLine;
-+ break;
-+ }
-+ case text::TextContentAnchorType_AT_FRAME:
-+ case text::TextContentAnchorType_AS_CHARACTER:
-+ {
-+ nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin;
-+ break;
-+ }
-+ default:
-+ {
-+ nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin;
-+ }
-+ }
-+ return nRelativeVerticalPosition;
-+}
-+
-+void SAL_CALL
-+ScVbaShape::setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition ) throw (uno::RuntimeException)
-+{
-+ text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH;
-+ switch( _relativeverticalposition )
-+ {
-+ case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionLine:
-+ {
-+ eType = text::TextContentAnchorType_AT_CHARACTER;
-+ break;
-+ }
-+ case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionParagraph:
-+ case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin:
-+ {
-+ eType = text::TextContentAnchorType_AT_PARAGRAPH;
-+ break;
-+ }
-+ case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionPage:
-+ {
-+ eType = text::TextContentAnchorType_AT_PAGE;
-+ break;
-+ }
-+ default:
-+ {
-+ DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
-+ }
-+ }
-+ m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ), uno::makeAny( eType ) );
-+}
-+
-+uno::Any SAL_CALL
-+ScVbaShape::WrapFormat() throw (uno::RuntimeException)
-+{
-+ uno::Reference< frame::XModel > xModel = getCurrentDocument();
-+ uno::Reference< lang::XServiceInfo > xServiceInfo( xModel, uno::UNO_QUERY_THROW );
-+ if( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument" ) ) ) )
-+ {
-+ uno::Reference< lang::XMultiServiceFactory > xSF( comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+ uno::Sequence< uno::Any > aArgs(2);
-+ aArgs[0] = uno::makeAny( getParent() );
-+ aArgs[1] <<= m_xShape;
-+ uno::Reference< uno::XInterface > xWrapFormat( xSF->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.WrapFormat") ) , aArgs ) , uno::UNO_QUERY_THROW );
-+ return uno::makeAny( xWrapFormat );
-+ }
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+}
-+
-+
-+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 vbahelper/source/vbahelper/vbashaperange.cxx vbahelper/source/vbahelper/vbashaperange.cxx
-new file mode 100644
-index 0000000..ae1a1fb
---- /dev/null
-+++ vbahelper/source/vbahelper/vbashaperange.cxx
-@@ -0,0 +1,383 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include <com/sun/star/drawing/XShapeGrouper.hpp>
-+#include <com/sun/star/drawing/XDrawPage.hpp>
-+#include<com/sun/star/view/XSelectionSupplier.hpp>
-+
-+#include <vbahelper/vbahelper.hxx>
-+#include <vbahelper/vbashaperange.hxx>
-+#include <vbahelper/vbashape.hxx>
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+class VbShapeRangeEnumHelper : public EnumerationHelper_BASE
-+{
-+ uno::Reference< XCollection > m_xParent;
-+ uno::Reference<container::XIndexAccess > 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 );
-+ }
-+}
-+
-+double SAL_CALL ScVbaShapeRange::getHeight() 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 );
-+ return xShape->getHeight( );
-+ }
-+ throw uno::RuntimeException();
-+}
-+
-+void SAL_CALL ScVbaShapeRange::setHeight( double _height ) 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->setHeight( _height );
-+ }
-+}
-+
-+double SAL_CALL ScVbaShapeRange::getWidth() 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 );
-+ return xShape->getWidth( );
-+ }
-+ throw uno::RuntimeException();
-+}
-+
-+void SAL_CALL ScVbaShapeRange::setWidth( double _width ) 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->setWidth( _width );
-+ }
-+}
-+
-+double SAL_CALL ScVbaShapeRange::getLeft() 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 );
-+ return xShape->getLeft();
-+ }
-+ throw uno::RuntimeException();
-+}
-+
-+void SAL_CALL ScVbaShapeRange::setLeft( double _left ) 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->setLeft( _left );
-+ }
-+}
-+
-+double SAL_CALL ScVbaShapeRange::getTop() 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 );
-+ return xShape->getTop();
-+ }
-+ throw uno::RuntimeException();
-+}
-+
-+void SAL_CALL ScVbaShapeRange::setTop( double _top ) 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->setTop( _top );
-+ }
-+}
-+
-+uno::Reference< ov::msforms::XLineFormat > SAL_CALL ScVbaShapeRange::getLine() throw (css::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 );
-+ return xShape->getLine();
-+ }
-+ throw uno::RuntimeException();
-+}
-+
-+uno::Reference< ov::msforms::XFillFormat > SAL_CALL ScVbaShapeRange::getFill() throw (css::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 );
-+ return xShape->getFill();
-+ }
-+ throw uno::RuntimeException();
-+}
-+
-+::sal_Bool SAL_CALL ScVbaShapeRange::getLockAspectRatio() 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 );
-+ return xShape->getLockAspectRatio();
-+ }
-+ throw uno::RuntimeException();
-+}
-+
-+void SAL_CALL ScVbaShapeRange::setLockAspectRatio( ::sal_Bool _lockaspectratio ) 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->setLockAspectRatio( _lockaspectratio );
-+ }
-+}
-+
-+::sal_Bool SAL_CALL ScVbaShapeRange::getLockAnchor() 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 );
-+ return xShape->getLockAnchor();
-+ }
-+ throw uno::RuntimeException();
-+}
-+
-+void SAL_CALL ScVbaShapeRange::setLockAnchor( ::sal_Bool _lockanchor ) 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->setLockAnchor( _lockanchor );
-+ }
-+}
-+
-+::sal_Int32 SAL_CALL ScVbaShapeRange::getRelativeHorizontalPosition() 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 );
-+ return xShape->getRelativeHorizontalPosition();
-+ }
-+ throw uno::RuntimeException();
-+}
-+
-+void SAL_CALL ScVbaShapeRange::setRelativeHorizontalPosition( ::sal_Int32 _relativehorizontalposition ) 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->setRelativeHorizontalPosition( _relativehorizontalposition );
-+ }
-+}
-+
-+::sal_Int32 SAL_CALL ScVbaShapeRange::getRelativeVerticalPosition() 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 );
-+ return xShape->getRelativeVerticalPosition();
-+ }
-+ throw uno::RuntimeException();
-+}
-+
-+void SAL_CALL ScVbaShapeRange::setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition ) 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->setRelativeVerticalPosition( _relativeverticalposition );
-+ }
-+}
-+
-+uno::Any SAL_CALL ScVbaShapeRange::TextFrame( ) throw (css::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 );
-+ return xShape->TextFrame();
-+ }
-+ throw uno::RuntimeException();
-+}
-+
-+uno::Any SAL_CALL ScVbaShapeRange::WrapFormat( ) throw (css::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 );
-+ return xShape->WrapFormat();
-+ }
-+ throw uno::RuntimeException();
-+}
-+
-+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 vbahelper/source/vbahelper/vbashapes.cxx vbahelper/source/vbahelper/vbashapes.cxx
-new file mode 100644
-index 0000000..6515c6e
---- /dev/null
-+++ vbahelper/source/vbahelper/vbashapes.cxx
-@@ -0,0 +1,493 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include <com/sun/star/container/XNamed.hpp>
-+#include <com/sun/star/view/XSelectionSupplier.hpp>
-+#include <com/sun/star/text/WrapTextMode.hpp>
-+#include <ooo/vba/msforms/XShapeRange.hpp>
-+#include <ooo/vba/office/MsoAutoShapeType.hpp>
-+#include <ooo/vba/office/MsoTextOrientation.hpp>
-+#include <com/sun/star/lang/XServiceInfo.hpp>
-+#include <com/sun/star/text/XText.hpp>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include <com/sun/star/text/XTextContent.hpp>
-+#include <com/sun/star/text/TextContentAnchorType.hpp>
-+#include <com/sun/star/text/HoriOrientation.hpp>
-+#include <com/sun/star/text/VertOrientation.hpp>
-+#include <com/sun/star/text/RelOrientation.hpp>
-+#include <com/sun/star/text/SizeType.hpp>
-+#include <com/sun/star/text/WritingMode.hpp>
-+#include <com/sun/star/drawing/LineStyle.hpp>
-+
-+#include <vbahelper/vbahelper.hxx>
-+#include <vbahelper/vbashape.hxx>
-+#include <vbahelper/vbashapes.hxx>
-+#include <vbahelper/vbashaperange.hxx>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+class VbShapeEnumHelper : public EnumerationHelper_BASE
-+{
-+ uno::Reference<msforms::XShapes > m_xParent;
-+ uno::Reference<container::XIndexAccess > 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<nLen; ++index )
-+ mShapes.push_back( uno::Reference< drawing::XShape >( 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 ) throw (uno::RuntimeException)
-+{
-+ 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)
-+{
-+ // #FIXME don't use getCurrentDocument
-+ 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();
-+}
-+
-+uno::Any SAL_CALL
-+ScVbaShapes::AddTextbox( sal_Int32 _nOrientation, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< lang::XServiceInfo > xServiceInfo( getCurrentDocument(), uno::UNO_QUERY_THROW );
-+ if( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument" ) ) ) )
-+ {
-+ return AddTextboxInWriter( _nOrientation, _nLeft, _nTop, _nWidth, _nHeight );
-+ }
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+}
-+
-+uno::Any
-+ScVbaShapes::AddTextboxInWriter( sal_Int32 _nOrientation, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) throw (uno::RuntimeException)
-+{
-+ rtl::OUString sCreateShapeName( rtl::OUString::createFromAscii( "com.sun.star.drawing.TextShape" ) );
-+ sal_Int32 nXPos = Millimeter::getInHundredthsOfOneMillimeter( _nLeft );
-+ sal_Int32 nYPos = Millimeter::getInHundredthsOfOneMillimeter( _nTop );
-+ sal_Int32 nWidth = Millimeter::getInHundredthsOfOneMillimeter( _nWidth );
-+ sal_Int32 nHeight = Millimeter::getInHundredthsOfOneMillimeter( _nHeight );
-+
-+ uno::Reference< drawing::XShape > xShape( createShape( sCreateShapeName ), uno::UNO_QUERY_THROW );
-+ m_xShapes->add( xShape );
-+
-+ setDefaultShapeProperties(xShape);
-+
-+ rtl::OUString sName = createName( rtl::OUString::createFromAscii( "Text Box") );
-+ setShape_NameProperty( xShape, sName );
-+
-+ awt::Size size;
-+ size.Height = nHeight;
-+ size.Width = nWidth;
-+ xShape->setSize(size);
-+
-+ uno::Reference< beans::XPropertySet > xShapeProps( xShape, uno::UNO_QUERY_THROW );
-+ xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "AnchorType" ), uno::makeAny( text::TextContentAnchorType_AT_PAGE ) );
-+ xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "HoriOrientRelation" ), uno::makeAny( text::RelOrientation::PAGE_LEFT ) );
-+ xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "HoriOrient" ), uno::makeAny( text::HoriOrientation::NONE ) );
-+ xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "HoriOrientPosition" ), uno::makeAny( nXPos ) );
-+
-+ xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "VertOrientRelation" ), uno::makeAny( text::RelOrientation::PAGE_FRAME ) );
-+ xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "VertOrient" ), uno::makeAny( text::VertOrientation::NONE ) );
-+ xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "VertOrientPosition" ), uno::makeAny( nYPos ) );
-+
-+ // set to visible
-+ drawing::LineStyle aLineStyle = drawing::LineStyle_SOLID;
-+ xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ), uno::makeAny( aLineStyle ) );
-+ // set to font
-+ sal_Int16 nLayerId = 1;
-+ rtl::OUString sLayerName = rtl::OUString::createFromAscii("Heaven");
-+ xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "LayerID" ), uno::makeAny( nLayerId ) );
-+ xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "LayerName" ), uno::makeAny( sLayerName ) );
-+
-+
-+ ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, ScVbaShape::getType( xShape ) );
-+ return uno::makeAny( uno::Reference< msforms::XShape > ( pScVbaShape ) );
-+}
-+
-+uno::Any
-+ScVbaShapes::AddShape( const rtl::OUString& sService, const rtl::OUString& sName, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nXPos = Millimeter::getInHundredthsOfOneMillimeter( _nLeft );
-+ sal_Int32 nYPos = Millimeter::getInHundredthsOfOneMillimeter( _nTop );
-+ sal_Int32 nWidth = Millimeter::getInHundredthsOfOneMillimeter( _nWidth );
-+ sal_Int32 nHeight = Millimeter::getInHundredthsOfOneMillimeter( _nHeight );
-+
-+ uno::Reference< drawing::XShape > xShape( createShape( sService ), uno::UNO_QUERY_THROW );
-+ m_xShapes->add( xShape );
-+
-+ 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 ) );
-+ return uno::makeAny( uno::Reference< msforms::XShape > ( pScVbaShape ) );
-+}
-+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 vbahelper/source/vbahelper/vbatextframe.cxx vbahelper/source/vbahelper/vbatextframe.cxx
-new file mode 100644
-index 0000000..a461c54
---- /dev/null
-+++ vbahelper/source/vbahelper/vbatextframe.cxx
-@@ -0,0 +1,169 @@
-+/*************************************************************************
-+ *
-+ * 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: vbatextframe.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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include <vbahelper/helperdecl.hxx>
-+#include <com/sun/star/drawing/TextFitToSizeType.hpp>
-+#include <com/sun/star/text/XText.hpp>
-+#include <vbahelper/vbatextframe.hxx>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+VbaTextFrame::VbaTextFrame( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, uno::Reference< drawing::XShape > xShape ) : VbaTextFrame_BASE( xParent, xContext ), m_xShape( xShape )
-+{
-+ m_xPropertySet.set( m_xShape, uno::UNO_QUERY_THROW );
-+}
-+
-+void
-+VbaTextFrame::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 VbaTextFrame::getMargin( rtl::OUString sMarginType )
-+{
-+ sal_Int32 nMargin = 0;
-+ uno::Any aMargin = m_xPropertySet->getPropertyValue( sMarginType );
-+ aMargin >>= nMargin;
-+ return nMargin;
-+}
-+
-+void VbaTextFrame::setMargin( rtl::OUString sMarginType, float fMargin )
-+{
-+ sal_Int32 nMargin = Millimeter::getInHundredthsOfOneMillimeter( fMargin );
-+ m_xPropertySet->setPropertyValue( sMarginType, uno::makeAny( nMargin ) );
-+}
-+
-+// Attributes
-+sal_Bool SAL_CALL
-+VbaTextFrame::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
-+VbaTextFrame::setAutoSize( sal_Bool _autosize ) throw (uno::RuntimeException)
-+{
-+ setAsMSObehavior();
-+ m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "TextAutoGrowHeight" ), uno::makeAny( _autosize ) );
-+}
-+
-+float SAL_CALL
-+VbaTextFrame::getMarginBottom() throw (uno::RuntimeException)
-+{
-+ sal_Int32 nMargin = getMargin( rtl::OUString::createFromAscii( "TextLowerDistance" ) );
-+ float fMargin = (float)Millimeter::getInPoints( nMargin );
-+ return fMargin;
-+}
-+
-+void SAL_CALL
-+VbaTextFrame::setMarginBottom( float _marginbottom ) throw (uno::RuntimeException)
-+{
-+ setMargin( rtl::OUString::createFromAscii( "TextLowerDistance" ), _marginbottom );
-+}
-+
-+float SAL_CALL
-+VbaTextFrame::getMarginTop() throw (uno::RuntimeException)
-+{
-+ sal_Int32 nMargin = getMargin( rtl::OUString::createFromAscii( "TextUpperDistance" ) );
-+ float fMargin = (float)Millimeter::getInPoints( nMargin );
-+ return fMargin;
-+}
-+
-+void SAL_CALL
-+VbaTextFrame::setMarginTop( float _margintop ) throw (uno::RuntimeException)
-+{
-+ setMargin( rtl::OUString::createFromAscii( "TextUpperDistance" ), _margintop );
-+}
-+
-+float SAL_CALL
-+VbaTextFrame::getMarginLeft() throw (uno::RuntimeException)
-+{
-+ sal_Int32 nMargin = getMargin( rtl::OUString::createFromAscii( "TextLeftDistance" ) );
-+ float fMargin = (float)Millimeter::getInPoints( nMargin );
-+ return fMargin;
-+}
-+
-+void SAL_CALL
-+VbaTextFrame::setMarginLeft( float _marginleft ) throw (uno::RuntimeException)
-+{
-+ setMargin( rtl::OUString::createFromAscii( "TextLeftDistance" ), _marginleft );
-+}
-+
-+float SAL_CALL
-+VbaTextFrame::getMarginRight() throw (uno::RuntimeException)
-+{
-+ sal_Int32 nMargin = getMargin( rtl::OUString::createFromAscii( "TextRightDistance" ) );
-+ float fMargin = (float)Millimeter::getInPoints( nMargin );
-+ return fMargin;
-+}
-+
-+void SAL_CALL
-+VbaTextFrame::setMarginRight( float _marginright ) throw (uno::RuntimeException)
-+{
-+ setMargin( rtl::OUString::createFromAscii( "TextRightDistance" ), _marginright );
-+}
-+
-+
-+// Methods
-+uno::Any SAL_CALL
-+VbaTextFrame::Characters() throw (uno::RuntimeException)
-+{
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
-+}
-+
-+rtl::OUString&
-+VbaTextFrame::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("VbaTextFrame") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+VbaTextFrame::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.TextFrame" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-diff --git vbahelper/util/makefile.mk vbahelper/util/makefile.mk
-index 7835a0c..796af0a 100644
---- vbahelper/util/makefile.mk
-+++ vbahelper/util/makefile.mk
-@@ -40,13 +40,12 @@ TARGET=vbahelper
-
-
- TARGET_HELPER=vbahelper
--SHL1TARGET= $(TARGET_HELPER)$(DLLPOSTFIX)
--SHL1IMPLIB= i$(TARGET_HELPER)
-
--SHL1DEF=$(MISC)$/$(SHL1TARGET).def
--DEF1NAME=$(SHL1TARGET)
-+LIB1TARGET= $(SLB)$/$(TARGET).lib
-+LIB1FILES=$(SLB)$/$(TARGET)bits.lib
-+
-+SHL1TARGET= $(TARGET_HELPER)$(DLLPOSTFIX)
-
--LIB1FILES=$(SLB)$/$(TARGET_HELPER).lib
-
- # dynamic libraries
- SHL1STDLIBS= \
-@@ -62,9 +61,17 @@ SHL1STDLIBS= \
- $(VCLLIB) \
- $(SVTOOLLIB) \
- $(TKLIB) \
-+ $(SVXMSFILTERLIB) \
-
--#SHL4DEPN=$(SHL1TARGETN)
--SHL1LIBS=$(LIB1FILES)
-+SHL1DEPN=
-+SHL1IMPLIB= i$(TARGET_HELPER)
-+SHL1USE_EXPORTS=name
-+SHL1LIBS=$(LIB1TARGET)
-+
-+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
-+
-+DEF1NAME=$(SHL1TARGET)
-+DEFLIB1NAME=$(TARGET)
-
- TARGET_MSFORMS=msforms
- SHL2TARGET=$(TARGET_MSFORMS)$(DLLPOSTFIX).uno
-diff --git xmlscript/source/xmldlg_imexp/exp_share.hxx xmlscript/source/xmldlg_imexp/exp_share.hxx
-index 2007522..2685f32 100644
---- xmlscript/source/xmldlg_imexp/exp_share.hxx
-+++ xmlscript/source/xmldlg_imexp/exp_share.hxx
-@@ -174,6 +174,8 @@ public:
- //
- void readDialogModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
-+ void readMultiPageModel( StyleBag * all_styles )
-+ SAL_THROW( (css::uno::Exception) );
- void readButtonModel( StyleBag * all_styles )
- SAL_THROW( (css::uno::Exception) );
- void readEditModel( StyleBag * all_styles )
-diff --git xmlscript/source/xmldlg_imexp/imp_share.hxx xmlscript/source/xmldlg_imexp/imp_share.hxx
-index bf3ea5f..bf83523 100644
---- xmlscript/source/xmldlg_imexp/imp_share.hxx
-+++ xmlscript/source/xmldlg_imexp/imp_share.hxx
-@@ -1028,6 +1028,27 @@ public:
- };
-
- //==============================================================================
-+class MultiPage
-+ : public ControlElement
-+{
-+public:
-+ virtual css::uno::Reference< css::xml::input::XElement >
-+ SAL_CALL startChildElement(
-+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
-+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
-+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-+ virtual void SAL_CALL endElement()
-+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-+
-+ inline MultiPage(
-+ ::rtl::OUString const & rLocalName,
-+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
-+ ElementBase * pParent, DialogImport * pImport )
-+ SAL_THROW( () )
-+ : ControlElement( rLocalName, xAttributes, pParent, pImport )
-+ {}
-+};
-+
- class ProgressBarElement
- : public ControlElement
- {
-diff --git xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
-index 4f87c16..8559984 100644
---- xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
-+++ xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
-@@ -137,6 +137,42 @@ static inline bool readFontProps( ElementDescriptor * element, Style & style )
- }
-
- //__________________________________________________________________________________________________
-+void ElementDescriptor::readMultiPageModel( StyleBag * all_styles )
-+{
-+ // collect styles
-+ Style aStyle( 0x2 | 0x8 | 0x20 );
-+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
-+ aStyle._set |= 0x2;
-+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
-+ aStyle._set |= 0x20;
-+ if (readFontProps( this, aStyle ))
-+ aStyle._set |= 0x8;
-+ if (aStyle._set)
-+ {
-+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
-+ all_styles->getStyleId( aStyle ) );
-+ }
-+
-+ // collect elements
-+ readDefaults();
-+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
-+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) );
-+
-+ OUString aTitle;
-+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ) ) >>= aTitle)
-+ {
-+ ElementDescriptor * title = new ElementDescriptor(
-+ _xProps, _xPropState,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ) );
-+ title->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ),
-+ aTitle );
-+ addSubElement( title );
-+ }
-+
-+ readEvents();
-+}
- void ElementDescriptor::readButtonModel( StyleBag * all_styles )
- SAL_THROW( (Exception) )
- {
-diff --git xmlscript/source/xmldlg_imexp/xmldlg_export.cxx xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
-index b5c223d..223e803 100644
---- xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
-+++ xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
-@@ -1420,6 +1420,14 @@ void SAL_CALL exportDialogModel(
- xElem = static_cast< xml::sax::XAttributeList * >( pElem );
- pElem->readGroupBoxModel( &all_styles );
- }
-+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoMultiPageModel") ) ) )
-+ {
-+ pElem = new ElementDescriptor(
-+ xProps, xPropState,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multipage") ) );
-+ xElem = static_cast< xml::sax::XAttributeList * >( pElem );
-+ pElem->readMultiPageModel( &all_styles );
-+ }
- else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedTextModel") ) ) )
- {
- pElem = new ElementDescriptor(
-diff --git xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
-index 92c1a09..d5a82ab 100644
---- xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
-+++ xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
-@@ -51,6 +51,69 @@ using ::rtl::OUString;
-
- namespace xmlscript
- {
-+Reference< xml::input::XElement > MultiPage::startChildElement(
-+ sal_Int32 nUid, OUString const & rLocalName,
-+ Reference< xml::input::XAttributes > const & xAttributes )
-+ throw (xml::sax::SAXException, RuntimeException)
-+{
-+ // event
-+rtl::OUString _label = rtl::OUString::createFromAscii("foo");
-+ if (_pImport->isEventElement( nUid, rLocalName ))
-+ {
-+ return new EventElement(
-+ nUid, rLocalName, xAttributes, this, _pImport );
-+ }
-+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("title") ))
-+ {
-+ getStringAttr( &_label,
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
-+ xAttributes,
-+ _pImport->XMLNS_DIALOGS_UID );
-+
-+ return new ElementBase(
-+ _pImport->XMLNS_DIALOGS_UID,
-+ rLocalName, xAttributes, this, _pImport );
-+ }
-+ else
-+ {
-+
-+ throw xml::sax::SAXException(
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
-+ Reference< XInterface >(), Any() );
-+ }
-+}
-+//__________________________________________________________________________________________________
-+
-+void MultiPage::endElement()
-+ throw (xml::sax::SAXException, RuntimeException)
-+{
-+ ControlImportContext ctx(
-+ _pImport, getControlId( _xAttributes ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoMultiPageModel") ) );
-+// OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) );
-+ Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
-+
-+ Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
-+ if (xStyle.is())
-+ {
-+ StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
-+ pStyle->importTextColorStyle( xControlModel );
-+ pStyle->importTextLineColorStyle( xControlModel );
-+ pStyle->importFontStyle( xControlModel );
-+ }
-+
-+ ctx.importDefaults( 0, 0, _xAttributes ); // inherited from BulletinBoardElement
-+ ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
-+ _xAttributes );
-+ ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") ),
-+ OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ),
-+ _xAttributes );
-+ ctx.importEvents( _events );
-+ // avoid ring-reference:
-+ // vector< event elements > holding event elements holding this (via _pParent)
-+ _events.clear();
-+}
-
- // #FIXME cut'n'pasted from xmloff/source/core/xmlimp.cxx:1251
- // of course we need to find a common home for this helper
-@@ -2422,6 +2485,10 @@ Reference< xml::input::XElement > BulletinBoardElement::startChildElement(
- {
- return new ProgressBarElement( rLocalName, xAttributes, this, _pImport );
- }
-+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("multipage") ))
-+ {
-+ return new MultiPage( rLocalName, xAttributes, this, _pImport );
-+ }
- // bulletinboard
- else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bulletinboard") ))
- {
diff --git a/patches/vba/vba-word-support.diff b/patches/vba/vba-word-support.diff
deleted file mode 100644
index 804915cce..000000000
--- a/patches/vba/vba-word-support.diff
+++ /dev/null
@@ -1,30509 +0,0 @@
---- basic/inc/basic/basmgr.hxx.old 2009-04-06 16:41:59.000000000 +0000
-+++ basic/inc/basic/basmgr.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -231,6 +231,8 @@ public:
- ::com::sun::star::uno::Any
- SetGlobalUNOConstant( const sal_Char* _pAsciiName, const ::com::sun::star::uno::Any& _rValue );
-
-+ /** retrieves a global constant in the basic library, referring to some UNO object, returns true if a value is found ( value is in aOut ) false otherwise. */
-+ bool GetGlobalUNOConstant( const sal_Char* _pAsciiName, ::com::sun::star::uno::Any& aOut );
- /** determines whether there are password-protected modules whose size exceedes the
- legacy module size
- @param _out_rModuleNames
---- basic/inc/basic/sbstar.hxx
-+++ basic/inc/basic/sbstar.hxx
-@@ -75,6 +75,10 @@ class StarBASIC : public SbxObject
- BOOL bVBAEnabled;
- BasicLibInfo* pLibInfo; // Info block for basic manager
- SbLanguageMode eLanguageMode; // LanguageMode of the basic object
-+
-+ SbxObjectRef pVBAGlobals;
-+ SbxObject* getVBAGlobals( );
-+
- protected:
- BOOL CError( SbError, const String&, xub_StrLen, xub_StrLen, xub_StrLen );
- private:
-@@ -199,6 +203,7 @@ public:
-
- SbxObjectRef getRTL( void ) { return pRtl; }
- BOOL IsDocBasic() { return bDocBasic; }
-+ SbxVariable* VBAFind( const String& rName, SbxClassType t );
- };
-
- #ifndef __SB_SBSTARBASICREF_HXX
---- basic/prj/d.lst.old 2009-04-02 10:49:18.000000000 +0000
-+++ basic/prj/d.lst 2009-04-06 16:42:01.000000000 +0000
-@@ -7,6 +7,8 @@ mkdir: %COMMON_DEST%\res%_EXT%
- ..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib
- ..\%__SRC%\lib\*.a %_DEST%\lib%_EXT%\*.a
- ..\%__SRC%\slb\sb.lib %_DEST%\lib%_EXT%\xsb.lib
-+..\%__SRC%\lib\vbahelp*.* %_DEST%\lib%_EXT%\vba*.*
-+
- ..\%__SRC%\srs\classes.srs %_DEST%\res%_EXT%\basic.srs
- ..\%COMMON_OUTDIR%\srs\classes_srs.hid %COMMON_DEST%\res%_EXT%\basic_srs.hid
- ..\%__SRC%\bin\sb?????.dll %_DEST%\bin%_EXT%\sb?????.dll
-@@ -56,4 +58,8 @@ mkdir: %_DEST%\inc%_EXT%\basic
- ..\inc\basic\sbxmstrm.hxx %_DEST%\inc%_EXT%\basic\sbxmstrm.hxx
-
- ..\inc\basic\basicmanagerrepository.hxx %_DEST%\inc%_EXT%\basic\basicmanagerrepository.hxx
-+..\inc\basic\vbacollectionimpl.hxx %_DEST%\inc%_EXT%\basic\vbacollectionimpl.hxx
-+..\inc\basic\vbahelper.hxx %_DEST%\inc%_EXT%\basic\vbahelper.hxx
-+..\inc\basic\helperdecl.hxx %_DEST%\inc%_EXT%\basic\helperdecl.hxx
-+..\inc\basic\vbahelperinterface.hxx %_DEST%\inc%_EXT%\basic\vbahelperinterface.hxx
- ..\inc\modsizeexceeded.hxx %_DEST%\inc%_EXT%\basic\modsizeexceeded.hxx
---- basic/source/basmgr/basmgr.cxx.old 2009-04-06 16:41:59.000000000 +0000
-+++ basic/source/basmgr/basmgr.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -48,6 +48,7 @@
-
- #include <basic/sbuno.hxx>
- #include <basic/basmgr.hxx>
-+#include <sbunoobj.hxx>
- #include "basrid.hxx"
- #include "sbintern.hxx"
- #include <sb.hrc>
-@@ -1833,6 +1834,23 @@ BasicError* BasicManager::GetNextError()
- DBG_CHKTHIS( BasicManager, 0 );
- return pErrorMgr->GetNextError();
- }
-+bool BasicManager::GetGlobalUNOConstant( const sal_Char* _pAsciiName, ::com::sun::star::uno::Any& aOut )
-+{
-+ bool bRes = false;
-+ StarBASIC* pStandardLib = GetStdLib();
-+ OSL_PRECOND( pStandardLib, "BasicManager::SetGlobalUNOConstant: no lib to insert into!" );
-+ if ( pStandardLib )
-+ {
-+ ::rtl::OUString sVarName( ::rtl::OUString::createFromAscii( _pAsciiName ) );
-+ SbUnoObject* pGlobs = dynamic_cast<SbUnoObject*>( pStandardLib->Find( sVarName, SbxCLASS_DONTCARE ) );
-+ if ( pGlobs )
-+ {
-+ aOut = pGlobs->getUnoAny();
-+ bRes = true;
-+ }
-+ }
-+ return bRes;
-+}
-
- Any BasicManager::SetGlobalUNOConstant( const sal_Char* _pAsciiName, const Any& _rValue )
- {
---- basic/source/classes/sb.cxx
-+++ basic/source/classes/sb.cxx
-@@ -70,7 +70,29 @@ SV_IMPL_VARARR(SbTextPortions,SbTextPort
- TYPEINIT1(StarBASIC,SbxObject)
-
- #define RTLNAME "@SBRTL"
-+// i#i68894#
-
-+const static String aThisComponent( RTL_CONSTASCII_USTRINGPARAM("ThisComponent") );
-+const static String aVBAHook( RTL_CONSTASCII_USTRINGPARAM( "VBAGlobals" ) );
-+
-+SbxObject* StarBASIC::getVBAGlobals( )
-+{
-+ if ( !pVBAGlobals )
-+ pVBAGlobals = (SbUnoObject*)Find( aVBAHook , SbxCLASS_DONTCARE );
-+ return pVBAGlobals;
-+}
-+
-+// i#i68894#
-+SbxVariable* StarBASIC::VBAFind( const String& rName, SbxClassType t )
-+{
-+ if( rName == aThisComponent )
-+ return NULL;
-+ // rename to init globals
-+ if ( getVBAGlobals( ) )
-+ return pVBAGlobals->Find( rName, t );
-+ return NULL;
-+
-+}
- // Create array for conversion SFX <-> VB error code
- struct SFX_VB_ErrorItem
- {
-@@ -609,6 +631,7 @@ StarBASIC::StarBASIC( StarBASIC* p, BOOL
- pRtl = new SbiStdObject( String( RTL_CONSTASCII_USTRINGPARAM(RTLNAME) ), this );
- // Search via StarBasic is always global
- SetFlag( SBX_GBLSEARCH );
-+ pVBAGlobals = NULL;
- }
-
- // #51727 Override SetModified so that the modified state
---- basic/source/classes/sbxmod.cxx.old 2009-04-06 16:42:00.000000000 +0000
-+++ basic/source/classes/sbxmod.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -1781,13 +1781,20 @@ void SbUserFormModule::InitObject()
- try
- {
-
-- if ( m_xModel.is() )
-+ String aHook( RTL_CONSTASCII_USTRINGPARAM( "VBAGlobals" ) );
-+ SbUnoObject* pGlobs = (SbUnoObject*)GetParent()->Find( aHook, SbxCLASS_DONTCARE );
-+ if ( m_xModel.is() && pGlobs )
- {
-+
-+ uno::Reference< lang::XMultiServiceFactory > xVBAFactory( pGlobs->getUnoAny(), uno::UNO_QUERY_THROW );
- uno::Reference< lang::XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
- uno::Sequence< uno::Any > aArgs(1);
- aArgs[ 0 ] <<= m_xModel;
- rtl::OUString sDialogUrl( RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.script:" ) );
-- sDialogUrl = sDialogUrl.concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Standard") ) ).concat( rtl::OUString( '.') ).concat( GetName() ).concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("?location=document") ) );
-+ rtl::OUString sProjectName( RTL_CONSTASCII_USTRINGPARAM("Standard") );
-+ if ( this->GetParent()->GetName().Len() )
-+ sProjectName = this->GetParent()->GetName();
-+ sDialogUrl = sDialogUrl.concat( sProjectName ).concat( rtl::OUString( '.') ).concat( GetName() ).concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("?location=document") ) );
-
- uno::Reference< awt::XDialogProvider > xProvider( xFactory->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.DialogProvider")), aArgs ), uno::UNO_QUERY_THROW );
- m_xDialog = xProvider->createDialog( sDialogUrl );
-@@ -1797,7 +1804,7 @@ void SbUserFormModule::InitObject()
- aArgs[ 0 ] = uno::Any();
- aArgs[ 1 ] <<= m_xDialog;
- aArgs[ 2 ] <<= m_xModel;
-- pDocObject = new SbUnoObject( GetName(), uno::makeAny( xFactory->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.UserForm")), aArgs ) ) );
-+ pDocObject = new SbUnoObject( GetName(), uno::makeAny( xVBAFactory->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.UserForm")), aArgs ) ) );
- uno::Reference< lang::XComponent > xComponent( aArgs[ 1 ], uno::UNO_QUERY_THROW );
- // remove old listener if it exists
- FormObjEventListenerImpl* pFormListener = dynamic_cast< FormObjEventListenerImpl* >( m_DialogListener.get() );
---- basic/source/inc/runtime.hxx.old 2009-04-06 16:42:00.000000000 +0000
-+++ basic/source/inc/runtime.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -206,7 +206,6 @@ class SbiInstance
- BOOL bCompatibility; // Flag: TRUE = VBA runtime compatibility mode
-
- ComponentVector_t ComponentVector;
--
- public:
- SbiRuntime* pRun; // Call-Stack
- SbiInstance* pNext; // Instanzen-Chain
---- basic/source/runtime/methods.cxx.old 2009-04-06 16:42:00.000000000 +0000
-+++ basic/source/runtime/methods.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -844,6 +844,15 @@ RTLFUNC(SendKeys) // JSM
- StarBASIC::Error(SbERR_NOT_IMPLEMENTED);
- }
-
-+// Stub, basic already yields by default
-+RTLFUNC(DoEvents)
-+{
-+ (void)pBasic;
-+ (void)bWrite;
-+
-+ rPar.Get(0)->PutInteger( 0 );
-+}
-+
- RTLFUNC(Exp)
- {
- (void)pBasic;
---- basic/source/runtime/rtlproto.hxx.old 2009-04-06 16:42:00.000000000 +0000
-+++ basic/source/runtime/rtlproto.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -167,6 +167,7 @@ extern RTLFUNC(Kill); // JSM
- extern RTLFUNC(MkDir); // JSM
- extern RTLFUNC(RmDir); // JSM
- extern RTLFUNC(SendKeys); // JSM
-+extern RTLFUNC(DoEvents);
- extern RTLFUNC(DimArray);
- extern RTLFUNC(Dir);
- extern RTLFUNC(Exp);
---- basic/source/runtime/stdobj.cxx.old 2009-04-06 16:42:00.000000000 +0000
-+++ basic/source/runtime/stdobj.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -478,6 +478,7 @@ static Methods aMethods[] = {
- { "SendKeys", SbxNULL, 2 | _FUNCTION, RTLNAME(SendKeys),0 },
- { "String", SbxSTRING, 0,NULL,0 },
- { "Wait", SbxBOOL, _OPT, NULL,0 },
-+{ "DoEvents", SbxINTEGER, 0 | _FUNCTION, RTLNAME(DoEvents),0 },
- { "SetAttr", SbxNULL, 2 | _FUNCTION, RTLNAME(SetAttr),0 },
- { "File" , SbxSTRING, 0,NULL,0 },
- { "Attributes", SbxINTEGER, 0,NULL,0 },
---- basic/source/runtime/step2.cxx.old 2009-04-02 10:49:15.000000000 +0000
-+++ basic/source/runtime/step2.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -56,57 +56,6 @@ using com::sun::star::uno::Reference;
-
- SbxVariable* getVBAConstant( const String& rName );
-
--const static String aThisComponent( RTL_CONSTASCII_USTRINGPARAM("ThisComponent") );
--const static String aVBAHook( RTL_CONSTASCII_USTRINGPARAM( "VBAGlobals" ) );
--// i#i68894#
--SbxArray* getVBAGlobals( )
--{
-- static SbxArrayRef pArray;
-- static bool isInitialised = false;
-- if ( isInitialised )
-- return pArray;
-- Reference < XComponentContext > xCtx;
-- Reference < XPropertySet > xProps(
-- ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
-- xCtx.set( xProps->getPropertyValue( rtl::OUString(
-- RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))),
-- UNO_QUERY_THROW );
-- SbUnoObject dGlobs( String( RTL_CONSTASCII_USTRINGPARAM("ExcelGlobals") ), xCtx->getValueByName( ::rtl::OUString::createFromAscii( "/singletons/ooo.vba.theGlobals") ) );
--
-- SbxVariable *vba = dGlobs.Find( String( RTL_CONSTASCII_USTRINGPARAM("getGlobals") ) , SbxCLASS_DONTCARE );
--
-- if ( vba )
-- {
-- pArray = static_cast<SbxArray *>(vba->GetObject());
-- isInitialised = true;
-- return pArray;
-- }
-- return NULL;
--}
--
--// i#i68894#
--SbxVariable* VBAFind( const String& rName, SbxClassType t )
--{
-- if( rName == aThisComponent )
-- return NULL;
--
-- SbxArray *pVBAGlobals = getVBAGlobals( );
-- for (USHORT i = 0; pVBAGlobals && i < pVBAGlobals->Count(); i++)
-- {
-- SbxVariable *pElem = pVBAGlobals->Get( i );
-- if (!pElem || !pElem->IsObject())
-- continue;
-- SbxObject *pVba = static_cast<SbxObject *>(pElem->GetObject());
-- SbxVariable *pVbaVar = pVba ? pVba->Find( rName, t ) : NULL;
-- if( pVbaVar )
-- {
-- return pVbaVar;
-- }
-- }
-- return NULL;
--
--}
--
- // Suchen eines Elements
- // Die Bits im String-ID:
- // 0x8000 - Argv ist belegt
-@@ -191,7 +140,7 @@ SbxVariable* SbiRuntime::FindElement
- if ( bVBAEnabled )
- {
- // Try Find in VBA symbols space
-- pElem = VBAFind( aName, SbxCLASS_DONTCARE );
-+ pElem = rBasic.VBAFind( aName, SbxCLASS_DONTCARE );
- if ( pElem )
- bSetName = false; // don't overwrite uno name
- else
---- forms/source/misc/InterfaceContainer.cxx.old 2009-04-06 16:41:59.000000000 +0000
-+++ forms/source/misc/InterfaceContainer.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -132,9 +132,8 @@ OInterfaceContainer::fakeVbaEventsHack(
- // we'll ignore, we'll get called back here anyway )
- Reference< XChild > xChild( xForm->getParent(), UNO_QUERY_THROW );
- Reference< XModel > xDocOwner( xChild->getParent(), UNO_QUERY );
-- Reference< XCodeNameQuery > xNameQuery( xDocOwner, UNO_QUERY );
- OSL_TRACE(" Is DOC ????? %s", xDocOwner.is() ? "true" : "false" );
-- if ( xDocOwner.is() && xNameQuery.is() )
-+ if ( xDocOwner.is() )
- {
- bool hasVBABindings = lcl_hasVbaEvents( m_xEventAttacher->getScriptEvents( _nIndex ) );
- if ( hasVBABindings )
-@@ -143,12 +142,14 @@ OInterfaceContainer::fakeVbaEventsHack(
- return;
- }
- Reference< XMultiServiceFactory > xFac( comphelper::getProcessServiceFactory(), UNO_QUERY );
-- if ( xFac.is() )
-+ Reference< XMultiServiceFactory > xDocFac( xDocOwner, UNO_QUERY );
-+ if ( xFac.is() && xDocFac.is() )
- {
- try
- {
- Reference< ooo::vba::XVBAToOOEventDescGen > xDescSupplier( xFac->createInstance( rtl::OUString::createFromAscii( "ooo.vba.VBAToOOEventDesc" ) ), UNO_QUERY_THROW );
- Reference< XInterface > xIf( getByIndex( _nIndex ) , UNO_QUERY_THROW );
-+ Reference< XCodeNameQuery > xNameQuery( xDocFac->createInstance( rtl::OUString::createFromAscii( "ooo.vba.VBACodeNameProvider" ) ), UNO_QUERY_THROW );
- rtl::OUString sCodeName;
- sCodeName = xNameQuery->getCodeNameForObject( xIf );
- Reference< XPropertySet > xProps( xIf, UNO_QUERY );
---- offapi/com/sun/star/document/XCompatWriterDocProperties.idl.old 1970-01-01 00:00:00.000000000 +0000
-+++ offapi/com/sun/star/document/XCompatWriterDocProperties.idl 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,49 @@
-+/*************************************************************************
-+ *
-+ * 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: XDocumentProperties.idl,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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __com_sun_star_document_XCompatWriterDocProperties_idl__
-+#define __com_sun_star_document_XCompatWriterDocProperties_idl__
-+
-+#ifndef __com_sun_star_document_XDocumentProperties_idl__
-+#include <com/sun/star/document/XDocumentProperties.idl>
-+#endif
-+//=============================================================================
-+
-+module com { module sun { module star { module document {
-+interface XCompatWriterDocProperties
-+{
-+// interface ::com::sun::star::document::XDocumentProperties;
-+ [attribute] string Manager;
-+ [attribute] string Category;
-+ [attribute] string Company;
-+
-+
-+}; }; }; };
-+};
-+#endif
---- offapi/com/sun/star/document/makefile.mk.old 2009-04-06 16:42:00.000000000 +0000
-+++ offapi/com/sun/star/document/makefile.mk 2009-04-06 16:42:01.000000000 +0000
-@@ -118,6 +118,7 @@ IDLFILES=\
- XDocumentLanguages.idl \
- XCodeNameQuery.idl \
- XDocumentEventCompatibleHelper.idl \
-+ XCompatWriterDocProperties.idl \
- VbaEventId.idl \
- XVbaEventsHelper.idl \
- VbaEventsHelper.idl \
---- oovbaapi/ooo/vba/ControlProvider.idl.old 1970-01-01 00:00:00.000000000 +0000
-+++ oovbaapi/ooo/vba/ControlProvider.idl 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,54 @@
-+/*************************************************************************
-+ *
-+ * 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: XGlobals.idl,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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_ControlProvider_idl__
-+#define __ooo_vba_ControlProvider_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __com_sun_star_frame_XModel_idl__
-+#include <com/sun/star/frame/XModel.idl>
-+#endif
-+
-+
-+module ooo { module vba {
-+
-+interface XControlProvider;
-+
-+service ControlProvider
-+{
-+ interface ::ooo::vba::XControlProvider;
-+};
-+
-+}; };
-+
-+#endif
-+
---- oovbaapi/ooo/vba/Globals.idl.old 2009-04-02 10:36:29.000000000 +0000
-+++ oovbaapi/ooo/vba/Globals.idl 1970-01-01 00:00:00.000000000 +0000
-@@ -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: Globals.idl,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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--
--#ifndef __ooo_vba_Globals_idl__
--#define __ooo_vba_Globals_idl__
--
--#ifndef __ooo_vba_XGlobals_idl__
--#include <ooo/vba/XGlobals.idl>
--#endif
--
--#include <com/sun/star/uno/XComponentContext.idl>
--#include <com/sun/star/table/XCellRange.idl>
--
--module ooo { module vba {
--service Globals : XGlobals
--{
--};
--
--}; };
--
--#endif
---- oovbaapi/ooo/vba/XApplicationBase.idl.old 1970-01-01 00:00:00.000000000 +0000
-+++ oovbaapi/ooo/vba/XApplicationBase.idl 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,61 @@
-+/*************************************************************************
-+ *
-+ * 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 __ooo_vba_XApplicationBase_idl__
-+#define __ooo_vba_XApplicationBase_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba {
-+//=============================================================================
-+
-+interface XApplicationBase
-+{
-+ interface ::ooo::vba::XHelperInterface;
-+
-+ [attribute] boolean ScreenUpdating;
-+ [attribute] boolean DisplayStatusBar;
-+
-+ any CommandBars( [in] any aIndex );
-+};
-+
-+}; };
-+
-+#endif
---- oovbaapi/ooo/vba/XControlProvider.idl.old 1970-01-01 00:00:00.000000000 +0000
-+++ oovbaapi/ooo/vba/XControlProvider.idl 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,64 @@
-+/*************************************************************************
-+ *
-+ * 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: XGlobals.idl,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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_XControlProvider_idl__
-+#define __ooo_vba_XControlProvider_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __com_sun_star_frame_XModel_idl__
-+#include <com/sun/star/frame/XModel.idl>
-+#endif
-+
-+#ifndef __com_sun_star_awt_XControl_idl__
-+#include <com/sun/star/awt/XControl.idl>
-+#endif
-+
-+#ifndef __com_sun_star_drawing_XControlShape_idl__
-+#include <com/sun/star/drawing/XControlShape.idl>
-+#endif
-+#ifndef __ooo_vba_msforms_XControl_idl__
-+#include <ooo/vba/msforms/XControl.idl>
-+#endif
-+
-+module ooo { module vba {
-+
-+interface XControlProvider
-+{
-+ ::ooo::vba::msforms::XControl createControl( [in] ::com::sun::star::drawing::XControlShape xControl, [in] ::com::sun::star::frame::XModel xDocOwner );
-+ ::ooo::vba::msforms::XControl createUserformControl( [in] ::com::sun::star::awt::XControl xControl, [in] ::com::sun::star::awt::XControl xDialog, [in] ::com::sun::star::frame::XModel xDocOwner );
-+
-+};
-+
-+}; };
-+
-+#endif
-+
---- oovbaapi/ooo/vba/XDocumentBase.idl.old 1970-01-01 00:00:00.000000000 +0000
-+++ oovbaapi/ooo/vba/XDocumentBase.idl 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,67 @@
-+/*************************************************************************
-+ *
-+ * 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 __ooo_vba_XDocumentBase_idl__
-+#define __ooo_vba_XDocumentBase_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba {
-+//=============================================================================
-+
-+interface XDocumentBase
-+{
-+ interface ::ooo::vba::XHelperInterface;
-+
-+ [attribute, readonly] string Name;
-+ [attribute, readonly] string Path;
-+ [attribute, readonly] string FullName;
-+ [attribute] boolean Saved;
-+
-+ void Close([in] any SaveChanges, [in] any FileName, [in] any RouteWorkBook);
-+ void Save();
-+ void Activate();
-+ void Protect( [in] any Password );
-+ void Unprotect( [in] any Password );
-+};
-+
-+}; };
-+
-+#endif
---- oovbaapi/ooo/vba/XDocumentProperties.idl.old 1970-01-01 00:00:00.000000000 +0000
-+++ oovbaapi/ooo/vba/XDocumentProperties.idl 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,71 @@
-+/*************************************************************************
-+ *
-+ * 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: XDocument.idl,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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef __ooo_vba_XDocumentProperties_idl__
-+#define __ooo_vba_XDocumentProperties_idl__
-+
-+#ifndef __com_sun_star_script_BasicErrorException_idl__
-+#include <com/sun/star/script/BasicErrorException.idl>
-+#endif
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+module ooo { module vba {
-+interface XDocumentProperty;
-+interface XDocumentProperties
-+{
-+ interface XCollection;
-+ /** Creates a new custom document property.
-+ * You can only add a new document property to the custom DocumentProperties collection. Depending on value of
-+ * boolean LinkSource, either (False) Value or (True) LinkSource must be provided.
-+ * @param Name (Required String. The name of the property.
-+ * @param LinkToContent Specifies whether the property is linked to the contents of the container document. If this argument is True, the LinkSource argument is required; if it's False, the value argument is required.
-+ * @param Type The data type of the property. Can be one of the following MsoDocProperties constants:
-+ * msoPropertyTypeBoolean, msoPropertyTypeDate, msoPropertyTypeFloat, msoPropertyTypeNumber, or msoPropertyTypeString.
-+ * @param Value The value of the property, if it's not linked to the contents of the container document.
-+ * The value is converted to match the data type specified by the type argument, if it can't be converted, an error occurs.
-+ * If LinkToContent is True, the Value argument is ignored and the new document property is assigned a default value
-+ * until the linked property values are updated by the container application (usually when the document is saved).
-+ * @param LinkSource Ignored if LinkToContent is False. The source of the linked property. The container application determines
-+ * what types of source linking you can use.
-+ */
-+ XDocumentProperty Add([in] string Name, [in] boolean LinkToContent, [in] /* MsoDocProperties */ byte Type, [in] any Value,
-+ [in] /*optional*/ any LinkSource)
-+ raises (com::sun::star::script::BasicErrorException);
-+};
-+
-+}; };
-+
-+#endif
-+
---- oovbaapi/ooo/vba/XDocumentProperty.idl.old 1970-01-01 00:00:00.000000000 +0000
-+++ oovbaapi/ooo/vba/XDocumentProperty.idl 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,106 @@
-+/*************************************************************************
-+ *
-+ * 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: XDocument.idl,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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef __ooo_vba_XDocumentProperty_idl__
-+#define __ooo_vba_XDocumentProperty_idl__
-+
-+#ifndef __com_sun_star_script_BasicErrorException_idl__
-+#include <com/sun/star/script/BasicErrorException.idl>
-+#endif
-+#ifndef __com_sun_star_script_XDefaultProperty_idl__
-+#include <com/sun/star/script/XDefaultProperty.idl>
-+#endif
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba {
-+
-+/**
-+ * Specific built-in document property. Use CustomDocumentProperties(index),
-+ * where index is the name or index number of the custom document property,
-+ * to return a DocumentProperty object that represents a specific custom document property.
-+ */
-+interface XDocumentProperty
-+{
-+
-+ interface com::sun::star::script::XDefaultProperty;
-+ interface ooo::vba::XHelperInterface;
-+
-+ void Delete()
-+ raises (com::sun::star::script::BasicErrorException);
-+
-+ /** Required String. The name of the property.
-+ */
-+ string getName()
-+ raises (com::sun::star::script::BasicErrorException);
-+
-+ void setName([in] string Name)
-+ raises (com::sun::star::script::BasicErrorException);
-+
-+ /** The data type of the property.
-+ * Can be one of the following MsoDocProperties constants:
-+ * msoPropertyTypeBoolean, msoPropertyTypeDate, msoPropertyTypeFloat,
-+ * msoPropertyTypeNumber, or msoPropertyTypeString.
-+ */
-+ byte getType()
-+ raises (com::sun::star::script::BasicErrorException);
-+
-+ void setType([in] byte Type)
-+ raises (com::sun::star::script::BasicErrorException);
-+
-+ /** If true, then LinkSource has a valid value. */
-+ boolean getLinkToContent()
-+ raises (com::sun::star::script::BasicErrorException);
-+
-+ void setLinkToContent([in] boolean LinkToContent)
-+ raises (com::sun::star::script::BasicErrorException);
-+
-+ /** If LinkToContent is false, then this contains the value of the property
-+ * The data type of the value will match the Type property.
-+ */
-+ any getValue()
-+ raises (com::sun::star::script::BasicErrorException);
-+
-+ void setValue([in] any Value)
-+ raises (com::sun::star::script::BasicErrorException);
-+
-+ /** If LinkToContent is false, then this contains the value of the property */
-+ string getLinkSource()
-+ raises (com::sun::star::script::BasicErrorException);
-+
-+ void setLinkSource([in] string LinkSource)
-+ raises (com::sun::star::script::BasicErrorException);
-+};
-+
-+}; };
-+
-+#endif
-+
---- oovbaapi/ooo/vba/XGlobals.idl.old 2009-04-02 10:36:29.000000000 +0000
-+++ oovbaapi/ooo/vba/XGlobals.idl 1970-01-01 00:00:00.000000000 +0000
-@@ -1,67 +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: XGlobals.idl,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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--#ifndef __ooo_vba_XGlobals_idl__
--#define __ooo_vba_XGlobals_idl__
--
--#ifndef __com_sun_star_uno_XInterface_idl__
--#include <com/sun/star/uno/XInterface.idl>
--#endif
--#ifndef __ooo_vba_excel_XApplication_idl__
--#include <ooo/vba/excel/XApplication.idl>
--#endif
--#ifndef __ooo_vba_excel_XWorkbook_idl__
--#include <ooo/vba/excel/XWorkbook.idl>
--#endif
--#ifndef __ooo_vba_excel_XWorksheet_idl__
--#include <ooo/vba/excel/XWorksheet.idl>
--#endif
--
--module ooo { module vba {
--
--interface XGlobals: com::sun::star::uno::XInterface
--{
-- // FIXME, need better way to expose globals
-- sequence< any > getGlobals();
--
-- [attribute, readonly] ooo::vba::excel::XApplication Application;
-- [attribute, readonly] ooo::vba::excel::XWorkbook ActiveWorkbook;
-- [attribute, readonly] ooo::vba::excel::XWorksheet ActiveSheet;
-- any WorkSheets( [in] any aIndex );
-- any WorkBooks( [in] any aIndex );
-- any Sheets( [in] any aIndex );
-- any Range( [in] any Cell1, [in] any Cell2 );
-- any Names( [in] any Index );
--};
--
--}; };
--
--#endif
--
--
---- oovbaapi/ooo/vba/XGlobalsBase.idl.old 1970-01-01 00:00:00.000000000 +0000
-+++ oovbaapi/ooo/vba/XGlobalsBase.idl 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,53 @@
-+/*************************************************************************
-+ *
-+ * 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: XGlobals.idl,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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_XGlobalsBase_idl__
-+#define __ooo_vba_XGlobalsBase_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+#ifndef __com_sun_star_lang_XMultiServiceFactory
-+#include <com/sun/star/lang/XMultiServiceFactory.idl>
-+#endif
-+module ooo { module vba {
-+interface XGlobalsBase
-+{
-+ interface ::ooo::vba::XHelperInterface;
-+ interface ::com::sun::star::lang::XMultiServiceFactory;
-+};
-+
-+}; };
-+
-+#endif
-+
-+
---- oovbaapi/ooo/vba/XWindowBase.idl.old 1970-01-01 00:00:00.000000000 +0000
-+++ oovbaapi/ooo/vba/XWindowBase.idl 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,62 @@
-+/*************************************************************************
-+ *
-+ * 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 __ooo_vba_XHelperWindow_idl__
-+#define __ooo_vba_XHelperWindow_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba {
-+//=============================================================================
-+
-+interface XWindowBase
-+{
-+ interface ::ooo::vba::XHelperInterface;
-+
-+ [attribute] long Height;
-+ [attribute] long Left;
-+ [attribute] long Top;
-+ [attribute] boolean Visible;
-+ [attribute] long Width;
-+};
-+
-+}; };
-+
-+#endif
---- oovbaapi/ooo/vba/excel/Globals.idl.old 1970-01-01 00:00:00.000000000 +0000
-+++ oovbaapi/ooo/vba/excel/Globals.idl 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,48 @@
-+/*************************************************************************
-+ *
-+ * 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: Globals.idl,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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef __ooo_vba_excel_Globals_idl__
-+#define __ooo_vba_excel_Globals_idl__
-+
-+#ifndef __ooo_vba_excel_XGlobals_idl__
-+#include <ooo/vba/excel/XGlobals.idl>
-+#endif
-+
-+#include <com/sun/star/uno/XComponentContext.idl>
-+#include <com/sun/star/table/XCellRange.idl>
-+
-+module ooo { module vba { module excel {
-+service Globals : XGlobals
-+{
-+};
-+
-+}; }; };
-+
-+#endif
---- oovbaapi/ooo/vba/excel/XApplication.idl.old 2009-04-06 16:41:59.000000000 +0000
-+++ oovbaapi/ooo/vba/excel/XApplication.idl 2009-04-06 16:42:01.000000000 +0000
-@@ -42,10 +42,6 @@
- #include <ooo/vba/XAssistant.idl>
- #endif
-
--#ifndef __ooo_vba_XCommandBars_idl__
--#include <ooo/vba/XCommandBars.idl>
--#endif
--
- module ooo { module vba { module excel {
-
- interface XRange;
-@@ -56,10 +52,10 @@ interface XWorksheetFunction;
- interface XWindow;
- interface XWorksheet;
-
--interface XApplication
-+interface XApplication : com::sun::star::uno::XInterface
- {
-
-- interface ::ooo::vba::XHelperInterface;
-+// interface ::ooo::vba::XHelperInterface;
-
- [attribute, readonly] any Selection;
- [attribute, readonly] XWorkbook ActiveWorkbook;
-@@ -74,8 +70,6 @@ interface XApplication
- // to determine this
- [attribute, readonly] XWorkbook ThisWorkbook;
- [attribute, readonly] string Name;
-- [attribute] boolean ScreenUpdating;
-- [attribute] boolean DisplayStatusBar;
- [attribute] boolean DisplayAlerts;
- [attribute] boolean DisplayFormulaBar;
- [attribute] any CutCopyMode;
-@@ -90,7 +84,7 @@ interface XApplication
- string LibraryPath() raises(com::sun::star::script::BasicErrorException);
- string TemplatesPath() raises(com::sun::star::script::BasicErrorException);
- string PathSeparator() raises(com::sun::star::script::BasicErrorException);
-- any CommandBars( [in] any aIndex );
-+ //any CommandBars( [in] any aIndex );
- any Workbooks( [in] any aIndex );
- any Worksheets( [in] any aIndex );
- any Windows( [in] any aIndex );
-@@ -109,7 +103,6 @@ interface XApplication
- XRange Union([in] XRange Arg1, [in] XRange Arg2, [in] /*Optional*/ any Arg3, [in] /*Optional*/ any Arg4, [in] /*Optional*/ any Arg5, [in] /*Optional*/ any Arg6, [in] /*Optional*/ any Arg7, [in] /*Optional*/ any Arg8, [in] /*Optional*/ any Arg9, [in] /*Optional*/ any Arg10, [in] /*Optional*/ any Arg11, [in] /*Optional*/ any Arg12, [in] /*Optional*/ any Arg13, [in] /*Optional*/ any Arg14, [in] /*Optional*/ any Arg15, [in] /*Optional*/ any Arg16, [in] /*Optional*/ any Arg17, [in] /*Optional*/ any Arg18, [in] /*Optional*/ any Arg19, [in] /*Optional*/ any Arg20, [in] /*Optional*/ any Arg21, [in] /*Optional*/ any Arg22, [in] /*Optional*/ any Arg23, [in] /*Optional*/ any Arg24, [in] /*Optional*/ any Arg25, [in] /*Optional*/ any Arg26, [in] /*Optional*/ any Arg27, [in] /*Optional*/ any Arg28, [in] /*Optional*/ any Arg29, [in] /*Optional*/ any Arg30)
- raises(com::sun::star::script::BasicErrorException);
- void Volatile([in] any Volatile);
-- void DoEvents();
- any Caller( [in] any aIndex );
- };
-
---- oovbaapi/ooo/vba/excel/XGlobals.idl.old 1970-01-01 00:00:00.000000000 +0000
-+++ oovbaapi/ooo/vba/excel/XGlobals.idl 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,86 @@
-+/*************************************************************************
-+ *
-+ * 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: XGlobals.idl,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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_excel_XGlobals_idl__
-+#define __ooo_vba_excel_XGlobals_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+#ifndef __com_sun_star_script_BasicErrorException_idl__
-+#include <com/sun/star/script/BasicErrorException.idl>
-+#endif
-+#ifndef __ooo_vba_excel_XWorkbook_idl__
-+#include <ooo/vba/excel/XWorkbook.idl>
-+#endif
-+#ifndef __ooo_vba_excel_XWorksheet_idl__
-+#include <ooo/vba/excel/XWorksheet.idl>
-+#endif
-+#ifndef __ooo_vba_XAssistant_idl__
-+#include <ooo/vba/XAssistant.idl>
-+#endif
-+
-+module ooo { module vba { module excel {
-+interface XRange;
-+interface XWindow;
-+interface XGlobals: com::sun::star::uno::XInterface
-+{
-+ [attribute, readonly] ooo::vba::excel::XWorkbook ActiveWorkbook;
-+ [attribute, readonly] ooo::vba::excel::XWorksheet ActiveSheet;
-+ [attribute, readonly] ooo::vba::excel::XWindow ActiveWindow;
-+ [attribute, readonly] ooo::vba::excel::XRange ActiveCell;
-+ [attribute, readonly] ooo::vba::XAssistant Assistant;
-+ [attribute, readonly] any Selection;
-+ [attribute, readonly] XWorkbook ThisWorkbook;
-+
-+ void Calculate() raises(com::sun::star::script::BasicErrorException);
-+ XRange Cells([in] any RowIndex, [in] any ColumnIndex);
-+ XRange Columns([in] any aIndex);
-+ any CommandBars( [in] any aIndex );
-+ any Evaluate( [in] string Name );
-+XRange Intersect([in] XRange Arg1, [in] XRange Arg2, [in] /*Optional*/ any Arg3, [in] /*Optional*/ any Arg4, [in] /*Optional*/ any Arg5, [in] /*Optional*/ any Arg6, [in] /*Optional*/ any Arg7, [in] /*Optional*/ any Arg8, [in] /*Optional*/ any Arg9, [in] /*Optional*/ any Arg10, [in] /*Optional*/ any Arg11, [in] /*Optional*/ any Arg12, [in] /*Optional*/ any Arg13, [in] /*Optional*/ any Arg14, [in] /*Optional*/ any Arg15, [in] /*Optional*/ any Arg16, [in] /*Optional*/ any Arg17, [in] /*Optional*/ any Arg18, [in] /*Optional*/ any Arg19, [in] /*Optional*/ any Arg20, [in] /*Optional*/ any Arg21, [in] /*Optional*/ any Arg22, [in] /*Optional*/ any Arg23, [in] /*Optional*/ any Arg24, [in] /*Optional*/ any Arg25, [in] /*Optional*/ any Arg26, [in] /*Optional*/ any Arg27, [in] /*Optional*/ any Arg28, [in] /*Optional*/ any Arg29, [in] /*Optional*/ any Arg30)
-+ raises(com::sun::star::script::BasicErrorException);
-+ any WorkSheets( [in] any aIndex );
-+ any WorkBooks( [in] any aIndex );
-+ any WorksheetFunction();
-+ any Windows( [in] any aIndex );
-+ any Sheets( [in] any aIndex );
-+ any Range( [in] any Cell1, [in] any Cell2 );
-+ XRange Rows([in] any aIndex);
-+ any Names( [in] any Index );
-+ XRange Union([in] XRange Arg1, [in] XRange Arg2, [in] /*Optional*/ any Arg3, [in] /*Optional*/ any Arg4, [in] /*Optional*/ any Arg5, [in] /*Optional*/ any Arg6, [in] /*Optional*/ any Arg7, [in] /*Optional*/ any Arg8, [in] /*Optional*/ any Arg9, [in] /*Optional*/ any Arg10, [in] /*Optional*/ any Arg11, [in] /*Optional*/ any Arg12, [in] /*Optional*/ any Arg13, [in] /*Optional*/ any Arg14, [in] /*Optional*/ any Arg15, [in] /*Optional*/ any Arg16, [in] /*Optional*/ any Arg17, [in] /*Optional*/ any Arg18, [in] /*Optional*/ any Arg19, [in] /*Optional*/ any Arg20, [in] /*Optional*/ any Arg21, [in] /*Optional*/ any Arg22, [in] /*Optional*/ any Arg23, [in] /*Optional*/ any Arg24, [in] /*Optional*/ any Arg25, [in] /*Optional*/ any Arg26, [in] /*Optional*/ any Arg27, [in] /*Optional*/ any Arg28, [in] /*Optional*/ any Arg29, [in] /*Optional*/ any Arg30)
-+ raises(com::sun::star::script::BasicErrorException);
-+
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
---- oovbaapi/ooo/vba/excel/XWindow.idl.old 2009-04-02 10:36:29.000000000 +0000
-+++ oovbaapi/ooo/vba/excel/XWindow.idl 2009-04-06 16:42:01.000000000 +0000
-@@ -46,10 +46,8 @@ module ooo { module vba { module excel
- interface XRange;
- interface XWorksheet;
- interface XPane;
--interface XWindow
-+interface XWindow : com::sun::star::uno::XInterface
- {
-- interface ::ooo::vba::XHelperInterface;
--
- [attribute] any Caption;
- [attribute] boolean DisplayGridlines;
- [attribute] boolean DisplayHeadings;
-@@ -58,8 +56,6 @@ interface XWindow
- [attribute] boolean DisplayVerticalScrollBar;
- [attribute] boolean DisplayWorkbookTabs;
- [attribute] boolean FreezePanes;
-- [attribute] long Height;
-- [attribute] long Left;
- [attribute] boolean Split;
- [attribute] long SplitColumn;
- [attribute] double SplitHorizontal;
-@@ -67,10 +63,7 @@ interface XWindow
- [attribute] double SplitVertical;
- [attribute] any ScrollColumn;
- [attribute] any ScrollRow;
-- [attribute] long Top;
- [attribute] any View;
-- [attribute] boolean Visible;
-- [attribute] long Width;
- [attribute] any WindowState;
- [attribute] any Zoom;
- any SelectedSheets( [in] any aIndex );
---- oovbaapi/ooo/vba/excel/XWorkbook.idl.old 2009-04-02 10:36:29.000000000 +0000
-+++ oovbaapi/ooo/vba/excel/XWorkbook.idl 2009-04-06 16:42:01.000000000 +0000
-@@ -48,31 +48,19 @@ interface XWorksheet;
- interface XWorksheets;
- interface XStyles;
-
--interface XWorkbook
-+interface XWorkbook : com::sun::star::uno::XInterface
- {
-- interface ::ooo::vba::XHelperInterface;
--
-- [attribute, readonly] string Name;
-- [attribute, readonly] string Path;
-- [attribute, readonly] string FullName;
- [attribute, readonly] boolean ProtectStructure;
- [attribute, readonly] XWorksheet ActiveSheet;
-- [attribute] boolean Saved;
- [attribute, readonly] string CodeName;
-
- any Worksheets([in] any sheet);
- any Styles([in] any Index );
- any Sheets([in] any sheet);
- any Windows([in] any index );
-- void Close([in] any SaveChanges, [in] any FileName, [in] any RouteWorkBook);
-- void Protect( [in] any Password );
-- void Unprotect( [in] any Password );
-- void Save();
-- void Activate();
- void ResetColors() raises (com::sun::star::script::BasicErrorException);
--
-+ void Activate();
- any Names( [in] any Index );
--
- any Colors([in] any Index) raises (com::sun::star::script::BasicErrorException);
- long FileFormat() raises (com::sun::star::script::BasicErrorException);
- void SaveCopyAs( [in] string Filename );
---- oovbaapi/ooo/vba/excel/makefile.mk.old 2009-04-06 16:41:59.000000000 +0000
-+++ oovbaapi/ooo/vba/excel/makefile.mk 2009-04-06 16:42:01.000000000 +0000
-@@ -41,7 +41,9 @@ PACKAGE=ooo$/vba$/Excel
- # ------------------------------------------------------------------------
-
-
--IDLFILES= XApplication.idl\
-+IDLFILES= XGlobals.idl\
-+ Globals.idl\
-+ XApplication.idl\
- XComment.idl\
- XComments.idl\
- XRange.idl\
---- oovbaapi/ooo/vba/makefile.mk.old 2009-04-06 16:42:00.000000000 +0000
-+++ oovbaapi/ooo/vba/makefile.mk 2009-04-06 16:42:01.000000000 +0000
-@@ -42,7 +42,6 @@ PACKAGE=ooo$/vba
-
- IDLFILES=\
- XErrObject.idl \
-- XGlobals.idl \
- XCollection.idl\
- XVBAToOOEventDescGen.idl\
- XPropValue.idl\
-@@ -54,7 +53,14 @@ IDLFILES=\
- XCommandBars.idl\
- XCommandBarPopup.idl\
- XCommandBarButton.idl\
-- Globals.idl\
-+ XControlProvider.idl\
-+ ControlProvider.idl\
-+ XApplicationBase.idl\
-+ XWindowBase.idl\
-+ XDocumentBase.idl\
-+ XGlobalsBase.idl\
-+ XDocumentProperty.idl\
-+ XDocumentProperties.idl\
-
- # ------------------------------------------------------------------
-
---- oovbaapi/ooo/vba/word/XApplication.idl.old 1970-01-01 00:00:00.000000000 +0000
-+++ oovbaapi/ooo/vba/word/XApplication.idl 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,63 @@
-+/*************************************************************************
-+ *
-+ * 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: XApplication.idl,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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XApplication_idl__
-+#define __ooo_vba_word_XApplication_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XDocument;
-+interface XWindow;
-+interface XSystem;
-+interface XOptions;
-+interface XSelection;
-+interface XApplication : com::sun::star::uno::XInterface
-+{
-+ [attribute, readonly] XDocument ActiveDocument;
-+ [attribute, readonly] XWindow ActiveWindow;
-+ [attribute, readonly] string Name;
-+ [attribute, readonly] ooo::vba::word::XSystem System;
-+ [attribute, readonly] ooo::vba::word::XOptions Options;
-+ [attribute, readonly] ooo::vba::word::XSelection Selection;
-+ any CommandBars( [in] any aIndex );
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
---- oovbaapi/ooo/vba/word/XBookmark.idl.old 1970-01-01 00:00:00.000000000 +0000
-+++ oovbaapi/ooo/vba/word/XBookmark.idl 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,61 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XBookmark_idl__
-+#define __ooo_vba_word_XBookmark_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+#ifndef __com_sun_star_container_XNamed_idl__
-+#include <com/sun/star/container/XNamed.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XBookmark
-+{
-+ interface ooo::vba::XHelperInterface;
-+ interface ::com::sun::star::container::XNamed;
-+
-+ void Delete();
-+ void Select();
-+ any Range();
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
---- oovbaapi/ooo/vba/word/XBookmarks.idl.old 1970-01-01 00:00:00.000000000 +0000
-+++ oovbaapi/ooo/vba/word/XBookmarks.idl 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,61 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XBookmarks_idl__
-+#define __ooo_vba_word_XBookmarks_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XBookmarks
-+{
-+ interface ::ooo::vba::XCollection;
-+
-+ [attribute] long DefaultSorting;
-+ [attribute] boolean ShowHidden;
-+
-+ any Add( [in] string Name, [in] any Range );
-+ boolean Exists( [in] string Name );
-+};
-+
-+}; }; };
-+
-+#endif
---- oovbaapi/ooo/vba/word/XDocument.idl.old 1970-01-01 00:00:00.000000000 +0000
-+++ oovbaapi/ooo/vba/word/XDocument.idl 2009-04-06 16:42:01.000000000 +0000
-@@ -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: XDocument.idl,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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XDocument_idl__
-+#define __ooo_vba_word_XDocument_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_word_XRange_idl__
-+#include <ooo/vba/word/XRange.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XDocument : com::sun::star::uno::XInterface
-+{
-+ [attribute, readonly] XRange Content;
-+
-+ XRange Range( [in] any Start, [in] any End );
-+ any BuiltInDocumentProperties( [in] any index );
-+ any CustomDocumentProperties( [in] any index );
-+ any Bookmarks( [in] any aIndex );
-+ any Variables( [in] any aIndex );
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
---- oovbaapi/ooo/vba/word/XGlobals.idl.old 1970-01-01 00:00:00.000000000 +0000
-+++ oovbaapi/ooo/vba/word/XGlobals.idl 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,58 @@
-+/*************************************************************************
-+ *
-+ * 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: XGlobals.idl,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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XGlobals_idl__
-+#define __ooo_vba_word_XGlobals_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+interface XDocument;
-+interface XWindow;
-+interface XSystem;
-+interface XOptions;
-+interface XSelection;
-+interface XGlobals : com::sun::star::uno::XInterface
-+{
-+ [attribute, readonly] XDocument ActiveDocument;
-+ [attribute, readonly] XWindow ActiveWindow;
-+ [attribute, readonly] string Name;
-+ [attribute, readonly] ooo::vba::word::XSystem System;
-+ [attribute, readonly] ooo::vba::word::XOptions Options;
-+ [attribute, readonly] ooo::vba::word::XSelection Selection;
-+ any CommandBars( [in] any aIndex );
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
---- oovbaapi/ooo/vba/word/XOptions.idl.old 1970-01-01 00:00:00.000000000 +0000
-+++ oovbaapi/ooo/vba/word/XOptions.idl 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,54 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XOptions_idl__
-+#define __ooo_vba_word_XOptions_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XOptions
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ any DefaultFilePath( [in] long Path );
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
---- oovbaapi/ooo/vba/word/XPane.idl.old 1970-01-01 00:00:00.000000000 +0000
-+++ oovbaapi/ooo/vba/word/XPane.idl 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,55 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XPane_idl__
-+#define __ooo_vba_word_XPane_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XPane
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ any View();
-+ void Close();
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
---- oovbaapi/ooo/vba/word/XPanes.idl.old 1970-01-01 00:00:00.000000000 +0000
-+++ oovbaapi/ooo/vba/word/XPanes.idl 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,55 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XPanes_idl__
-+#define __ooo_vba_word_XPanes_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XPanes
-+{
-+ interface ::ooo::vba::XCollection;
-+};
-+
-+}; }; };
-+
-+#endif
---- oovbaapi/ooo/vba/word/XRange.idl.old 1970-01-01 00:00:00.000000000 +0000
-+++ oovbaapi/ooo/vba/word/XRange.idl 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,57 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XRange_idl__
-+#define __ooo_vba_word_XRange_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+
-+module ooo { module vba { module word {
-+
-+interface XRange
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ [attribute] string Text;
-+
-+ void InsertBreak( [in] any Type );
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
---- oovbaapi/ooo/vba/word/XSelection.idl.old 1970-01-01 00:00:00.000000000 +0000
-+++ oovbaapi/ooo/vba/word/XSelection.idl 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,55 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XSelection_idl__
-+#define __ooo_vba_word_XSelection_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+
-+module ooo { module vba { module word {
-+
-+interface XSelection
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ [attribute] string Text;
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
---- oovbaapi/ooo/vba/word/XSystem.idl.old 1970-01-01 00:00:00.000000000 +0000
-+++ oovbaapi/ooo/vba/word/XSystem.idl 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,56 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XSystem_idl__
-+#define __ooo_vba_word_XSystem_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+
-+module ooo { module vba { module word {
-+
-+interface XSystem
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ [attribute] long Cursor;
-+ any PrivateProfileString( [in] string Filename, [in] string Section, [in] string Key );
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
---- oovbaapi/ooo/vba/word/XVariable.idl.old 1970-01-01 00:00:00.000000000 +0000
-+++ oovbaapi/ooo/vba/word/XVariable.idl 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,60 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XVariable_idl__
-+#define __ooo_vba_word_XVariable_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+#ifndef __com_sun_star_container_XNamed_idl__
-+#include <com/sun/star/container/XNamed.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XVariable
-+{
-+ interface ooo::vba::XHelperInterface;
-+ interface ::com::sun::star::container::XNamed;
-+
-+ [attribute] any Value;
-+ [attribute, readonly] long Index;
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
---- oovbaapi/ooo/vba/word/XVariables.idl.old 1970-01-01 00:00:00.000000000 +0000
-+++ oovbaapi/ooo/vba/word/XVariables.idl 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,57 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XVariables_idl__
-+#define __ooo_vba_word_XVariables_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XCollection_idl__
-+#include <ooo/vba/XCollection.idl>
-+#endif
-+
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+
-+interface XVariables
-+{
-+ interface ::ooo::vba::XCollection;
-+
-+ any Add( [in] string Name, [in] any Value );
-+};
-+
-+}; }; };
-+
-+#endif
---- oovbaapi/ooo/vba/word/XView.idl.old 1970-01-01 00:00:00.000000000 +0000
-+++ oovbaapi/ooo/vba/word/XView.idl 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,57 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XView_idl__
-+#define __ooo_vba_word_XView_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+module ooo { module vba { module word {
-+
-+interface XView
-+{
-+ interface ooo::vba::XHelperInterface;
-+
-+ [attribute] long SeekView;
-+ [attribute] long SplitSpecial;
-+ [attribute] boolean TableGridLines;
-+ [attribute] long Type;
-+};
-+
-+}; }; };
-+
-+#endif
-+
-+
---- oovbaapi/ooo/vba/word/XWindow.idl.old 1970-01-01 00:00:00.000000000 +0000
-+++ oovbaapi/ooo/vba/word/XWindow.idl 2009-04-06 16:42:01.000000000 +0000
-@@ -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: XWindow.idl,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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __ooo_vba_word_XWindow_idl__
-+#define __ooo_vba_word_XWindow_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+#ifndef __ooo_vba_XHelperInterface_idl__
-+#include <ooo/vba/XHelperInterface.idl>
-+#endif
-+
-+//=============================================================================
-+
-+module ooo { module vba { module word {
-+
-+//=============================================================================
-+//interface XPane;
-+interface XWindow : com::sun::star::uno::XInterface
-+{
-+ [attribute] any View;
-+ void Activate();
-+ void Close([in] any SaveChanges, [in] any RouteDocument);
-+ any Panes( [in] any aIndex ); // this is a fake api for it seems not support in Write
-+ any ActivePane(); // this is a fake api for it seems not support in Write
-+};
-+
-+//=============================================================================
-+
-+}; }; };
-+
-+#endif
-+
-+
---- oovbaapi/ooo/vba/word/makefile.mk.old 1970-01-01 00:00:00.000000000 +0000
-+++ oovbaapi/ooo/vba/word/makefile.mk 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,63 @@
-+#*************************************************************************
-+#
-+# 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: makefile.mk,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
-+# <http://www.openoffice.org/license.html>
-+# for a copy of the LGPLv3 License.
-+#
-+#*************************************************************************
-+PRJ=..$/..$/..
-+
-+PRJNAME=oovapi
-+
-+TARGET=word
-+PACKAGE=ooo$/vba$/Word
-+
-+# --- Settings -----------------------------------------------------
-+.INCLUDE : $(PRJ)$/util$/makefile.pmk
-+
-+# ------------------------------------------------------------------------
-+
-+
-+IDLFILES= XGlobals.idl\
-+ XApplication.idl \
-+ XDocument.idl \
-+ XWindow.idl \
-+ XSystem.idl \
-+ XRange.idl \
-+ XBookmark.idl \
-+ XBookmarks.idl \
-+ XVariable.idl \
-+ XVariables.idl \
-+ XView.idl \
-+ XPane.idl \
-+ XPanes.idl \
-+ XOptions.idl \
-+ XSelection.idl \
-+
-+# ------------------------------------------------------------------
-+
-+.INCLUDE : target.mk
-+
---- oovbaapi/prj/build.lst.old 2009-04-02 10:36:28.000000000 +0000
-+++ oovbaapi/prj/build.lst 2009-04-06 16:42:01.000000000 +0000
-@@ -4,5 +4,6 @@ ovba oovbaapi\genconstidl
- ovba oovbaapi\ooo\vba\constants nmake - all ovba_constants ovba_genconstidl NULL
- ovba oovbaapi\ooo\vba nmake - all ovba_vba NULL
- ovba oovbaapi\ooo\vba\excel nmake - all ovba_excel NULL
-+ovba oovbaapi\ooo\vba\word nmake - all ovba_word NULL
- ovba oovbaapi\ooo\vba\msforms nmake - all ovba_msforms NULL
--ovba oovbaapi\util nmake - all ovba_util ovba_vba ovba_excel ovba_msforms ovba_constants ovba_genconstidl NULL
-+ovba oovbaapi\util nmake - all ovba_util ovba_vba ovba_excel ovba_word ovba_msforms ovba_constants ovba_genconstidl NULL
---- oovbaapi/util/makefile.mk.old 2009-04-06 16:41:59.000000000 +0000
-+++ oovbaapi/util/makefile.mk 2009-04-06 16:42:01.000000000 +0000
-@@ -44,6 +44,7 @@ TARGET=oovbaapi_db
- UNOIDLDBFILES= \
- $(UCR)$/vba.db \
- $(UCR)$/excel.db \
-+ $(UCR)$/word.db \
- $(UCR)$/msforms.db \
- $(UCR)$/constants.db
-
---- sc/inc/docuno.hxx.old 2009-04-06 16:42:00.000000000 +0000
-+++ sc/inc/docuno.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -77,8 +77,6 @@ class SvxFmDrawPage;
- class SvxDrawPage;
- class ScRangeList;
-
--#include <com/sun/star/document/XCodeNameQuery.hpp>
--
- class SC_DLLPUBLIC ScModelObj : public SfxBaseModel,
- public com::sun::star::sheet::XSpreadsheetDocument,
- public com::sun::star::document::XActionLockable,
-@@ -92,7 +90,6 @@ class SC_DLLPUBLIC ScModelObj : public S
- public com::sun::star::view::XRenderable,
- public com::sun::star::document::XLinkTargetSupplier,
- public com::sun::star::beans::XPropertySet,
-- public com::sun::star::document::XCodeNameQuery,
- public com::sun::star::document::XDocumentEventCompatibleHelper,
- public SvxFmMSFactory, // derived from XMultiServiceFactory
- public com::sun::star::lang::XServiceInfo,
-@@ -320,8 +317,6 @@ public:
- virtual void SAL_CALL removeChangesListener( const ::com::sun::star::uno::Reference<
- ::com::sun::star::util::XChangesListener >& aListener )
- throw (::com::sun::star::uno::RuntimeException);
-- virtual rtl::OUString SAL_CALL getCodeNameForObject( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& aObj )
-- throw(::com::sun::star::uno::RuntimeException);
- // XVbaEventHelper
- virtual sal_Bool SAL_CALL processCompatibleEvent( sal_Int16 nEventId ) throw (::com::sun::star::uno::RuntimeException);
- };
---- sc/inc/servuno.hxx.old 2009-04-06 16:41:59.000000000 +0000
-+++ sc/inc/servuno.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -94,7 +94,8 @@ class ScDocShell;
- #define SC_SERVICE_FORMULAPARS 38
- #define SC_SERVICE_OPCODEMAPPER 39
- #define SC_SERVICE_VBAOBJECTPROVIDER 40
--#define SC_SERVICE_COUNT 41
-+#define SC_SERVICE_VBACODENAMEPROVIDER 41
-+#define SC_SERVICE_COUNT 42
- #define SC_SERVICE_INVALID USHRT_MAX
-
-
---- sc/prj/build.lst
-+++ sc/prj/build.lst
-@@ -1,4 +1,4 @@
--sc sc : l10n oovbaapi svx stoc uui BOOST:boost formula oox NULL
-+sc sc : l10n vbahelper oovbaapi svx stoc uui 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
---- sc/source/core/tool/interpr4.cxx.old 2009-04-06 16:41:58.000000000 +0000
-+++ sc/source/core/tool/interpr4.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -77,7 +77,8 @@
- #include <map>
- #include <algorithm>
- #include <functional>
- #include <memory>
-+#include <vbahelper/vbahelper.hxx>
-
- using namespace com::sun::star;
- using namespace formula;
-@@ -2513,18 +2514,11 @@ lcl_setVBARange( ScRange& aRange, ScDocu
- try
- {
- uno::Reference< uno::XInterface > xVBARange;
-- uno::Reference< lang::XMultiComponentFactory > xSMgr( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-- uno::Reference< beans::XPropertySet > xProps( xSMgr, uno::UNO_QUERY_THROW );
-- uno::Reference< uno::XComponentContext > xCtx( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
- uno::Reference<table::XCellRange> xCellRange = ScCellRangeObj::CreateRangeFromDoc( pDok, aRange );
-- // hmm probably better not to have to include the vba generated headers
-- // here, but... if they ever become always available certainly the
-- // line below is more coder friendly
-- //xRange = ooo::vba::excel::Range::createRangeFromXCellRange( xCtx , uno::Reference< ooo::vba::XHelperInterface >(), xCellRange );
- uno::Sequence< uno::Any > aArgs(2);
- aArgs[0] = uno::Any( uno::Reference< uno::XInterface >() ); // dummy parent
- aArgs[1] = uno::Any( xCellRange );
-- xVBARange = xSMgr->createInstanceWithArgumentsAndContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Range") ), aArgs, xCtx );
-+ xVBARange = ov::createVBAUnoAPIServiceWithArgs( pDok->GetDocumentShell(), "ooo.vba.excel.Range", aArgs );
- if ( xVBARange.is() )
- {
- String sDummy(RTL_CONSTASCII_USTRINGPARAM("A-Range") );
---- sc/source/filter/excel/excimp8.cxx.old 2009-04-06 16:41:59.000000000 +0000
-+++ sc/source/filter/excel/excimp8.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -103,8 +103,11 @@
- #include <com/sun/star/document/XDocumentProperties.hpp>
- #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
- #include <com/sun/star/script/ModuleInfo.hpp>
-+#include <basic/basmgr.hxx>
-+#include <cppuhelper/component_context.hxx>
-
--
-+#include <com/sun/star/container/XNameContainer.hpp>
-+
- using namespace com::sun::star;
-
-
-@@ -255,16 +258,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;
-@@ -280,8 +273,11 @@ void ImportExcel8::ReadBasic( void )
- bool bLoadStrg = pFilterOpt->IsLoadExcelBasicStorage();
- if( bLoadCode || bLoadStrg )
- {
-+ uno::Any aGlobs;
-+ aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstance( ::rtl::OUString::createFromAscii( "ooo.vba.excel.Globals") );
-+ pShell->GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
- SvxImportMSVBasic aBasicImport( *pShell, *xRootStrg, bLoadCode, bLoadStrg );
-- bool bAsComment = !bLoadExecutable || !lcl_hasVBAEnabled();
-+ bool bAsComment = !bLoadExecutable || !aGlobs.hasValue();
- aBasicImport.Import( EXC_STORAGE_VBA_PROJECT, EXC_STORAGE_VBA, bAsComment );
- GetObjectManager().SetOleNameOverrideInfo( aBasicImport.ControlNameForObjectId() );
- }
---- sc/source/filter/excel/xlescher.cxx.old 2009-04-06 16:41:59.000000000 +0000
-+++ sc/source/filter/excel/xlescher.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -44,6 +44,7 @@
- #include <basic/sbstar.hxx>
- #include <basic/sbmod.hxx>
- #include <basic/sbmeth.hxx>
-+#include <basic/basmgr.hxx>
-
- using ::rtl::OUString;
- using ::com::sun::star::uno::Reference;
-@@ -305,6 +306,7 @@ Reference< XControlModel > XclControlHel
- }
-
- #define EXC_MACRONAME_PRE "vnd.sun.star.script:Standard."
-+#define EXC_MACRO_SCHEME "vnd.sun.star.script:"
- #define EXC_MACRONAME_SUF "?language=Basic&location=document"
-
- OUString XclControlHelper::GetScMacroName( const String& rXclMacroName, SfxObjectShell* pDocShell )
-@@ -312,9 +314,14 @@ OUString XclControlHelper::GetScMacroNam
- String sTmp( rXclMacroName );
- if( rXclMacroName.Len() > 0 )
- {
-+ String sProjectName( RTL_CONSTASCII_USTRINGPARAM("Standard") );
-+
-+ if ( pDocShell && pDocShell->GetBasicManager()->GetName().Len() > 0 )
-+ sProjectName = pDocShell->GetBasicManager()->GetName();
-+
- if ( ( sTmp.Search( '.' ) == STRING_NOTFOUND) && pDocShell )
- {
-- if( StarBASIC* pBasic = pDocShell->GetBasic() )
-+ if( StarBASIC* pBasic = pDocShell->GetBasicManager()->GetLib( sProjectName ) )
- {
- if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pBasic->Find( sTmp, SbxCLASS_METHOD ) ) )
- {
-@@ -325,7 +332,9 @@ OUString XclControlHelper::GetScMacroNam
- }
- }
- }
-- return CREATE_OUSTRING( EXC_MACRONAME_PRE ) + sTmp + CREATE_OUSTRING( EXC_MACRONAME_SUF );
-+ sProjectName.Append( '.' );
-+ sTmp.Insert( sProjectName, 0 );
-+ return CREATE_OUSTRING( EXC_MACRO_SCHEME ) + sTmp + CREATE_OUSTRING( EXC_MACRONAME_SUF );
- }
- return OUString();
- }
---- sc/source/ui/docshell/docsh.cxx.old 2009-04-06 16:42:00.000000000 +0000
-+++ sc/source/ui/docshell/docsh.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -131,7 +131,8 @@
- #include "cellsuno.hxx"
- #include <com/sun/star/document/XVbaEventsHelper.hpp>
- #include <com/sun/star/document/VbaEventId.hpp>
--
-+#include <basic/sbstar.hxx>
-+#include <basic/basmgr.hxx>
- using namespace com::sun::star;
- using namespace com::sun::star::document::VbaEventId;
-
-@@ -284,6 +285,7 @@ void ScDocShell::BeforeXMLLoading()
- if ( xEvt.is() )
- xEvt->setIgnoreEvents( sal_True );
-
-+// if VBA enabled then we need to
- // prevent unnecessary broadcasts and updates
- DBG_ASSERT(pModificator == NULL, "The Modificator should not exist");
- pModificator = new ScDocShellModificator( *this );
-@@ -367,7 +369,14 @@ void ScDocShell::AfterXMLLoading(sal_Boo
- }
- else
- aDocument.SetInsertingFromOtherDoc( FALSE );
--
-+ // add vba globals ( if they are availabl )
-+ SfxObjectShell* pShell = aDocument.GetDocumentShell();
-+ if ( pShell )
-+ {
-+ uno::Any aGlobs;
-+ aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.excel.Globals" ) ) );
-+ pShell->GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
-+ }
- // suppress VBA events when loading the xml
- uno::Reference< document::XVbaEventsHelper > xEvt( aDocument.GetVbaEventsHelper() );
- if ( xEvt.is() )
---- sc/source/ui/unoobj/docuno.cxx
-+++ sc/source/ui/unoobj/docuno.cxx
-@@ -107,7 +107,6 @@ using namespace com::sun::star::document
- // alles ohne Which-ID, Map nur fuer PropertySetInfo
-
- //! umbenennen, sind nicht mehr nur Options
--#include <com/sun/star/script/ScriptEventDescriptor.hpp>
- const SfxItemPropertyMapEntry* lcl_GetDocOptPropertyMap()
- {
- static SfxItemPropertyMapEntry aDocOptPropertyMap_Impl[] =
-@@ -315,7 +314,6 @@ uno::Any SAL_CALL ScModelObj::queryInter
- SC_QUERYINTERFACE( view::XRenderable )
- SC_QUERYINTERFACE( document::XLinkTargetSupplier )
- SC_QUERYINTERFACE( beans::XPropertySet )
-- SC_QUERYINTERFACE( document::XCodeNameQuery )
- SC_QUERYINTERFACE( document::XDocumentEventCompatibleHelper)
- SC_QUERYINTERFACE( lang::XMultiServiceFactory )
- SC_QUERYINTERFACE( lang::XServiceInfo )
-@@ -1723,49 +1721,7 @@ uno::Sequence<rtl::OUString> SAL_CALL Sc
-
- return concatServiceNames( aMyServices, aDrawServices );
- }
--// XCodeNameQuery
--rtl::OUString SAL_CALL
--ScModelObj::getCodeNameForObject( const uno::Reference< uno::XInterface >& xIf ) throw( uno::RuntimeException )
--{
-- rtl::OUString sCodeName;
-- if ( pDocShell )
-- {
-- OSL_TRACE( "*** In ScModelObj::getCodeNameForObject");
-- // need to find the page ( and index ) for this control
-- uno::Reference< drawing::XDrawPagesSupplier > xSupplier( pDocShell->GetModel(), uno::UNO_QUERY_THROW );
-- uno::Reference< container::XIndexAccess > xIndex( xSupplier->getDrawPages(), uno::UNO_QUERY_THROW );
-- sal_Int32 nLen = xIndex->getCount();
-- bool bMatched = false;
-- uno::Sequence< script::ScriptEventDescriptor > aFakeEvents;
-- for ( sal_Int32 index = 0; index < nLen; ++index )
-- {
-- try
-- {
-- uno::Reference< form::XFormsSupplier > xFormSupplier( xIndex->getByIndex( index ), uno::UNO_QUERY_THROW );
-- uno::Reference< container::XIndexAccess > xFormIndex( xFormSupplier->getForms(), uno::UNO_QUERY_THROW );
-- // get the www-standard container
-- uno::Reference< container::XIndexAccess > xFormControls( xFormIndex->getByIndex(0), uno::UNO_QUERY_THROW );
-- sal_Int32 nCntrls = xFormControls->getCount();
-- for( sal_Int32 cIndex = 0; cIndex < nCntrls; ++cIndex )
-- {
-- uno::Reference< uno::XInterface > xControl( xFormControls->getByIndex( cIndex ), uno::UNO_QUERY_THROW );
-- bMatched = ( xControl == xIf );
-- if ( bMatched )
-- {
-- String sName;
-- pDocShell->GetDocument()->GetCodeName( index, sName );
-- sCodeName = sName;
-- }
-- }
-- }
-- catch( uno::Exception& ) {}
-- if ( bMatched )
-- break;
-- }
-- }
-- // Probably should throw here ( if !bMatched )
-- return sCodeName;
--}
-+
- // XVbaEventHelper
- // For Vba Event
- sal_Bool SAL_CALL
---- sc/source/ui/unoobj/servuno.cxx.old 2009-04-06 16:41:59.000000000 +0000
-+++ sc/source/ui/unoobj/servuno.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -63,31 +63,31 @@
- #include <svx/xmlgrhlp.hxx>
-
- #include <comphelper/processfactory.hxx>
--
-+#include <com/sun/star/document/XCodeNameQuery.hpp>
-+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
-+#include <com/sun/star/form/XFormsSupplier.hpp>
-+#include <com/sun/star/script/ScriptEventDescriptor.hpp>
-+#include <comphelper/componentcontext.hxx>
-+#include <cppuhelper/component_context.hxx>
-+#include <vbahelper/vbahelper.hxx>
- using namespace ::com::sun::star;
-
- class ScVbaObjectForCodeNameProvider : public ::cppu::WeakImplHelper1< container::XNameAccess >
- {
- uno::Any maWorkbook;
- uno::Any maCachedObject;
-- uno::Reference<lang::XMultiServiceFactory> mxSF;
- ScDocShell* mpDocShell;
- public:
- ScVbaObjectForCodeNameProvider( ScDocShell* pDocShell ) : mpDocShell( pDocShell )
- {
-- mxSF.set(comphelper::getProcessServiceFactory());
-- uno::Reference<beans::XPropertySet> xProps(mxSF, uno::UNO_QUERY);
-- if( xProps.is() )
-- {
-- ScDocument* pDoc = mpDocShell->GetDocument();
-- if ( !pDoc )
-- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("")), uno::Reference< uno::XInterface >() );
--
-- uno::Sequence< uno::Any > aArgs(2);
-- aArgs[0] = uno::Any( uno::Reference< uno::XInterface >() );
-- aArgs[1] = uno::Any( mpDocShell->GetModel() );
-- maWorkbook <<= mxSF->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Workbook") ), aArgs );
-- }
-+ ScDocument* pDoc = mpDocShell->GetDocument();
-+ if ( !pDoc )
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("")), uno::Reference< uno::XInterface >() );
-+
-+ uno::Sequence< uno::Any > aArgs(2);
-+ aArgs[0] = uno::Any( uno::Reference< uno::XInterface >() );
-+ aArgs[1] = uno::Any( mpDocShell->GetModel() );
-+ maWorkbook <<= ov::createVBAUnoAPIServiceWithArgs( mpDocShell, "ooo.vba.excel.Workbook", aArgs );
- }
-
- virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException )
-@@ -120,7 +120,7 @@ public:
- aArgs[0] = maWorkbook;
- aArgs[1] = uno::Any( xModel );
- aArgs[2] = uno::Any( rtl::OUString( sSheetName ) );
-- maCachedObject <<= mxSF->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Worksheet") ), aArgs );
-+ maCachedObject <<= ov::createVBAUnoAPIServiceWithArgs( mpDocShell, "ooo.vba.excel.Worksheet", aArgs );
- break;
- }
- }
-@@ -160,6 +160,56 @@ public:
-
- };
-
-+class ScVbaCodeNameProvider : public ::cppu::WeakImplHelper1< document::XCodeNameQuery >
-+{
-+ScDocShell* mpDocShell;
-+public:
-+ ScVbaCodeNameProvider( ScDocShell* pDocShell ) : mpDocShell( pDocShell ) {}
-+ // XCodeNameQuery
-+ rtl::OUString SAL_CALL getCodeNameForObject( const uno::Reference< uno::XInterface >& xIf ) throw( uno::RuntimeException )
-+ {
-+ rtl::OUString sCodeName;
-+ if ( mpDocShell )
-+ {
-+ OSL_TRACE( "*** In ScVbaCodeNameProvider::getCodeNameForObject");
-+ // need to find the page ( and index ) for this control
-+ uno::Reference< drawing::XDrawPagesSupplier > xSupplier( mpDocShell->GetModel(), uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xIndex( xSupplier->getDrawPages(), uno::UNO_QUERY_THROW );
-+ sal_Int32 nLen = xIndex->getCount();
-+ bool bMatched = false;
-+ uno::Sequence< script::ScriptEventDescriptor > aFakeEvents;
-+ for ( sal_Int32 index = 0; index < nLen; ++index )
-+ {
-+ try
-+ {
-+ uno::Reference< form::XFormsSupplier > xFormSupplier( xIndex->getByIndex( index ), uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xFormIndex( xFormSupplier->getForms(), uno::UNO_QUERY_THROW );
-+ // get the www-standard container
-+ uno::Reference< container::XIndexAccess > xFormControls( xFormIndex->getByIndex(0), uno::UNO_QUERY_THROW );
-+ sal_Int32 nCntrls = xFormControls->getCount();
-+ for( sal_Int32 cIndex = 0; cIndex < nCntrls; ++cIndex )
-+ {
-+ uno::Reference< uno::XInterface > xControl( xFormControls->getByIndex( cIndex ), uno::UNO_QUERY_THROW );
-+ bMatched = ( xControl == xIf );
-+ if ( bMatched )
-+ {
-+ String sName;
-+ mpDocShell->GetDocument()->GetCodeName( index, sName );
-+ sCodeName = sName;
-+ }
-+ }
-+ }
-+ catch( uno::Exception& ) {}
-+ if ( bMatched )
-+ break;
-+ }
-+ }
-+ // Probably should throw here ( if !bMatched )
-+ return sCodeName;
-+ }
-+
-+};
-+
- //------------------------------------------------------------------------
-
- static const sal_Char* __FAR_DATA aProvNames[SC_SERVICE_COUNT] =
-@@ -210,6 +260,7 @@ static const sal_Char* __FAR_DATA aProvN
- SC_SERVICENAME_FORMULAPARS, // SC_SERVICE_FORMULAPARS
- SC_SERVICENAME_OPCODEMAPPER, // SC_SERVICE_OPCODEMAPPER
- "ooo.vba.VBAObjectModuleObjectProvider",// SC_SERVICE_VBAOBJECTPROVIDER
-+"ooo.vba.VBACodeNameProvider",// SC_SERVICE_VBACODENAMEPROVIDER
- };
-
- //
-@@ -263,6 +314,7 @@ static const sal_Char* __FAR_DATA aOldNa
- "", // SC_SERVICE_FORMULAPARS
- "", // SC_SERVICE_OPCODEMAPPER
- "", // SC_SERVICE_VBAOBJECTPROVIDER
-+ "", // SC_SERVICE_VBACODENAMEPROVIDER
- };
-
-
-@@ -464,6 +516,9 @@ uno::Reference<uno::XInterface> ScServic
- case SC_SERVICE_VBAOBJECTPROVIDER:
- xRet.set(static_cast<container::XNameAccess*>(new ScVbaObjectForCodeNameProvider( pDocShell )));
- break;
-+ case SC_SERVICE_VBACODENAMEPROVIDER:
-+ xRet.set(static_cast<document::XCodeNameQuery*>(new ScVbaCodeNameProvider( pDocShell )));
-+ break;
- }
- return xRet;
- }
---- sc/source/ui/vba/excelvbahelper.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sc/source/ui/vba/excelvbahelper.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,218 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include <docuno.hxx>
-+#include "excelvbahelper.hxx"
-+#include "tabvwsh.hxx"
-+#include "transobj.hxx"
-+#include "scmod.hxx"
-+#include "cellsuno.hxx"
-+#include <comphelper/processfactory.hxx>
-+
-+using namespace ::com::sun::star;
-+using namespace ::ooo::vba;
-+
-+namespace ooo
-+{
-+namespace vba
-+{
-+namespace excel
-+{
-+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<uno::XComponentContext > xContext( xTmpProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
-+ static uno::Reference<lang::XMultiComponentFactory > 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()
-+{
-+ PasteCellsWarningReseter resetWarningBox;
-+ ScTabViewShell* pViewShell = getCurrentBestViewShell();
-+ if ( pViewShell )
-+ {
-+ pViewShell->PasteFromSystem();
-+ pViewShell->CellContentChanged();
-+ }
-+}
-+
-+
-+void
-+implnCopy()
-+{
-+ ScTabViewShell* pViewShell = getCurrentBestViewShell();
-+ if ( pViewShell )
-+ pViewShell->CopyToClip(NULL,false,false,true);
-+}
-+
-+void
-+implnCut()
-+{
-+ ScTabViewShell* pViewShell = getCurrentBestViewShell();
-+ if ( pViewShell )
-+ pViewShell->CutToClip( NULL, TRUE );
-+}
-+
-+void implnPasteSpecial(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 = ScTabViewShell::GetActiveViewShell();
-+ if ( !pTabViewShell )
-+ // none active, try next best
-+ pTabViewShell = getCurrentBestViewShell();
-+ 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( 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( css::uno::Reference< css::frame::XModel>& xModel )
-+{
-+ ScDocShell* pDocShell = getDocShell( xModel );
-+ if ( pDocShell )
-+ return pDocShell->GetBestViewShell();
-+ return NULL;
-+}
-+
-+ScTabViewShell*
-+getCurrentBestViewShell()
-+{
-+ uno::Reference< frame::XModel > xModel = getCurrentDocument();
-+ return getBestViewShell( xModel );
-+}
-+
-+SfxViewFrame*
-+getCurrentViewFrame()
-+{
-+ ScTabViewShell* pViewShell = getCurrentBestViewShell();
-+ if ( pViewShell )
-+ return pViewShell->GetViewFrame();
-+ return NULL;
-+}
-+
-+SfxItemSet*
-+ScVbaCellRangeAccess::GetDataSet( ScCellRangeObj* pRangeObj )
-+{
-+ SfxItemSet* pDataSet = pRangeObj ? pRangeObj->GetCurrentDataSet( true ) : NULL ;
-+ return pDataSet;
-+
-+}
-+} //excel
-+} //vba
-+} //ooo
---- sc/source/ui/vba/excelvbahelper.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sc/source/ui/vba/excelvbahelper.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,60 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SC_EXCEL_VBA_HELPER_HXX
-+#define SC_EXCEL_VBA_HELPER_HXX
-+
-+#include<vbahelper/vbahelper.hxx>
-+#include <docsh.hxx>
-+
-+class ScCellRangeObj;
-+
-+namespace ooo
-+{
-+ namespace vba
-+ {
-+ namespace excel
-+ {
-+ void implnCopy();
-+ void implnPaste();
-+ void implnCut();
-+ void implnPasteSpecial(sal_uInt16 nFlags,sal_uInt16 nFunction,sal_Bool bSkipEmpty, sal_Bool bTranspose);
-+ ScTabViewShell* getBestViewShell( css::uno::Reference< css::frame::XModel>& xModel ) ;
-+ ScDocShell* getDocShell( css::uno::Reference< css::frame::XModel>& xModel ) ;
-+ ScTabViewShell* getCurrentBestViewShell();
-+ SfxViewFrame* getCurrentViewFrame();
-+ class ScVbaCellRangeAccess
-+ {
-+ public:
-+ static SfxItemSet* GetDataSet( ScCellRangeObj* pRangeObj );
-+ };
-+};
-+};
-+};
-+#endif
---- sc/source/ui/vba/makefile.mk.old 2009-04-06 16:42:00.000000000 +0000
-+++ sc/source/ui/vba/makefile.mk 2009-04-06 16:42:01.000000000 +0000
-@@ -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,20 +81,10 @@ 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 \
-@@ -116,24 +106,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 \
- $(SLO)$/vbaeventshelper.obj
-
---- sc/source/ui/vba/service.cxx.old 2009-04-06 16:42:00.000000000 +0000
-+++ sc/source/ui/vba/service.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -61,11 +61,11 @@ 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;
- }
-@@ -87,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 ) && component_writeInfoHelper( pServiceManager, pRegistryKey, vbaeventshelper::serviceDecl ) )
-+ range::serviceDecl, workbook::serviceDecl, worksheet::serviceDecl, globals::serviceDecl, window::serviceDecl, hyperlink::serviceDecl, application::serviceDecl ) && component_writeInfoHelper( pServiceManager, pRegistryKey, vbaeventshelper::serviceDecl ) )
- {
- // Singleton registration
- try
-@@ -110,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, vbaeventshelper::serviceDecl );
-+#endif
-+
- }
-
- SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
-@@ -118,7 +124,7 @@ 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, vbaeventshelper::serviceDecl );
- OSL_TRACE("Ret is 0x%x", pRet);
---- sc/source/ui/vba/vbaapplication.cxx.old 2009-04-06 16:41:59.000000000 +0000
-+++ sc/source/ui/vba/vbaapplication.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -60,7 +60,6 @@
- #include "vbashape.hxx"
- #include "vbatextboxshape.hxx"
- #include "vbaassistant.hxx"
--#include "vbacommandbars.hxx"
- #include "sc.hrc"
-
- #include <osl/file.hxx>
-@@ -87,6 +86,7 @@
- #include "miscuno.hxx"
- #include "unonames.hxx"
- #include "docsh.hxx"
-+#include <vbahelper/helperdecl.hxx>
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
-@@ -123,7 +123,7 @@ public:
- ActiveWorkbook( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext) : ScVbaWorkbook( xParent, xContext ){}
- };
-
--ScVbaApplication::ScVbaApplication( uno::Reference<uno::XComponentContext >& xContext ): ScVbaApplication_BASE( uno::Reference< XHelperInterface >(), xContext ), m_xCalculation( excel::XlCalculation::xlCalculationAutomatic )
-+ScVbaApplication::ScVbaApplication( const uno::Reference<uno::XComponentContext >& xContext ): ScVbaApplication_BASE( xContext ), m_xCalculation( excel::XlCalculation::xlCalculationAutomatic )
- {
- }
-
-@@ -151,15 +151,6 @@ ScVbaApplication::getAssistant() throw (
- }
-
- 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() ** ");
-@@ -227,7 +218,7 @@ ScVbaApplication::getActiveCell() throw
- {
- 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();
- if ( !pViewShell )
- throw uno::RuntimeException( rtl::OUString::createFromAscii("No ViewShell available"), uno::Reference< uno::XInterface >() );
- ScViewData* pTabView = pViewShell->GetViewData();
-@@ -240,65 +231,6 @@ ScVbaApplication::getActiveCell() throw
- 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)
- {
-@@ -347,7 +279,7 @@ ScVbaApplication::Evaluate( const ::rtl:
- 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 ) );
- if( !aIndex.hasValue() )
- return uno::Any( xDialogs );
- return uno::Any( xDialogs->Item( aIndex ) );
-@@ -460,7 +392,7 @@ ScVbaApplication::setCalculation( ::sal_
- 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() ) );
-@@ -571,11 +503,11 @@ ScVbaApplication::GoTo( const uno::Any&
- xModel->getCurrentController(), uno::UNO_QUERY_THROW );
- uno::Reference< sheet::XSpreadsheet > xDoc = xSpreadsheet->getActiveSheet();
-
-- ScTabViewShell* pShell = getCurrentBestViewShell();
-+ ScTabViewShell* pShell = excel::getCurrentBestViewShell();
- 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 )
- {
-@@ -613,7 +545,7 @@ ScVbaApplication::GoTo( const uno::Any&
- if( Reference >>= xRange )
- {
- uno::Reference< excel::XRange > xVbaRange( Reference, uno::UNO_QUERY );
-- ScTabViewShell* pShell = getCurrentBestViewShell();
-+ ScTabViewShell* pShell = excel::getCurrentBestViewShell();
- ScGridWindow* gridWindow = (ScGridWindow*)pShell->GetWindow();
- if ( xVbaRange.is() )
- {
-@@ -643,38 +575,10 @@ ScVbaApplication::GoTo( const uno::Any&
- 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();
-
- switch( nPointerStyle )
- {
-@@ -696,82 +600,34 @@ ScVbaApplication::setCursor( sal_Int32 _
- {
- try
- {
-- ::std::vector< uno::Reference< frame::XController > > aControllers;
--
-- const uno::Reference< frame::XModel2 > xModel2( SfxObjectShell::GetCurrentComponent(), uno::UNO_QUERY );
-- if ( xModel2.is() )
-- {
-- const uno::Reference< container::XEnumeration > xEnumControllers( xModel2->getControllers(), uno::UNO_SET_THROW );
-- while ( xEnumControllers->hasMoreElements() )
-- {
-- const uno::Reference< frame::XController > xController( xEnumControllers->nextElement(), uno::UNO_QUERY_THROW );
-- aControllers.push_back( xController );
-- }
-- }
-- else
-+ switch( _cursor )
- {
-- const uno::Reference< frame::XModel > xModel( SfxObjectShell::GetCurrentComponent(), uno::UNO_QUERY );
-- if ( xModel.is() )
-+ case excel::XlMousePointer::xlNorthwestArrow:
- {
-- const uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_SET_THROW );
-- aControllers.push_back( xController );
-+ const Pointer& rPointer( POINTER_ARROW );
-+ setCursorHelper( rPointer, sal_False );
-+ break;
- }
-- else
-+ case excel::XlMousePointer::xlWait:
-+ case excel::XlMousePointer::xlIBeam:
- {
-- const uno::Reference< frame::XController > xController( SfxObjectShell::GetCurrentComponent(), uno::UNO_QUERY_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( rPointer, sal_True );
-+ break;
- }
-- }
--
-- 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::xlDefault:
- {
-- 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( 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& )
- {
-@@ -1145,7 +1001,7 @@ ScVbaApplication::Intersect( const uno::
- }
-
- 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() ) );
-@@ -1234,7 +1090,7 @@ ScVbaApplication::Union( const uno::Refe
- 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
-@@ -1269,16 +1125,11 @@ ScVbaApplication::Volatile( const uno::A
- */
- }
-
--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();
- if ( pViewShell )
- {
- SfxBoolItem sfxFormBar( FID_TOGGLEINPUTLINE);
-@@ -1296,7 +1147,7 @@ ScVbaApplication::getDisplayFormulaBar()
- void SAL_CALL
- ScVbaApplication::setDisplayFormulaBar( ::sal_Bool _displayformulabar ) throw ( css::uno::RuntimeException )
- {
-- ScTabViewShell* pViewShell = getCurrentBestViewShell();
-+ ScTabViewShell* pViewShell = excel::getCurrentBestViewShell();
- if ( pViewShell && ( _displayformulabar != getDisplayFormulaBar() ) )
- {
- SfxBoolItem sfxFormBar( FID_TOGGLEINPUTLINE, _displayformulabar);
-@@ -1343,3 +1194,13 @@ ScVbaApplication::getServiceNames()
- }
- return aServiceNames;
- }
-+
-+namespace application
-+{
-+namespace sdecl = comphelper::service_decl;
-+sdecl::vba_service_class_<ScVbaApplication, sdecl::with_args<false> > serviceImpl;
-+extern sdecl::ServiceDecl const serviceDecl(
-+ serviceImpl,
-+ "ScVbaApplication",
-+ "ooo.vba.excel.Application" );
-+}
---- sc/source/ui/vba/vbaapplication.hxx.old 2009-04-06 16:41:59.000000000 +0000
-+++ sc/source/ui/vba/vbaapplication.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -35,9 +35,12 @@
- #include <ooo/vba/excel/XApplication.hpp>
- #include <com/sun/star/uno/XComponentContext.hpp>
-
--#include "vbahelperinterface.hxx"
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <vbahelper/vbaapplicationbase.hxx>
-+#include <cppuhelper/implbase1.hxx>
-
--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
- {
-@@ -45,12 +48,9 @@ private:
- sal_Int32 m_xCalculation;
- rtl::OUString getOfficePath( const rtl::OUString& sPath ) 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; }
--
- // XApplication
- virtual ::rtl::OUString SAL_CALL PathSeparator( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
- virtual void SAL_CALL setDefaultFilePath( const ::rtl::OUString& DefaultFilePath ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-@@ -68,15 +68,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);
-@@ -102,7 +97,6 @@ public:
- 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);
- 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();
---- sc/source/ui/vba/vbaassistant.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbaassistant.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -40,8 +40,8 @@
-
- #include <sfx2/sfxhelp.hxx>
-
--#include "vbahelper.hxx"
--#include "vbahelperinterface.hxx"
-+#include "excelvbahelper.hxx"
-+#include <vbahelper/vbahelperinterface.hxx>
-
- typedef ::cppu::WeakImplHelper1< ov::XAssistant > Assistant;
- typedef InheritedHelperInterfaceImpl< Assistant > ScVbaAssistantImpl_BASE;
---- sc/source/ui/vba/vbaaxes.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbaaxes.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -32,7 +32,7 @@
- #include <ooo/vba/excel/XAxes.hpp>
- #include <ooo/vba/excel/XAxis.hpp>
- #include <ooo/vba/excel/XChart.hpp>
--#include "vbacollectionimpl.hxx"
-+#include <vbahelper/vbacollectionimpl.hxx>
-
- typedef CollTestImplHelper< ov::excel::XAxes > ScVbaAxes_BASE;
- class ScVbaAxes : public ScVbaAxes_BASE
---- sc/source/ui/vba/vbaaxis.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbaaxis.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -32,8 +32,8 @@
- #include <com/sun/star/beans/XPropertySet.hpp>
- #include <ooo/vba/excel/XAxis.hpp>
- #include <ooo/vba/excel/XChart.hpp>
--#include "vbahelperinterface.hxx"
--
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <memory>
- typedef InheritedHelperInterfaceImpl1< ov::excel::XAxis > ScVbaAxis_BASE;
- class ScVbaChart;
- class ScVbaAxis : public ScVbaAxis_BASE
---- sc/source/ui/vba/vbaborders.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbaborders.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -38,7 +38,7 @@
- #include <com/sun/star/beans/XPropertySet.hpp>
-
-
--#include "vbacollectionimpl.hxx"
-+#include <vbahelper/vbacollectionimpl.hxx>
-
- typedef CollTestImplHelper< ov::excel::XBorders > ScVbaBorders_BASE;
- class ScVbaPalette;
---- sc/source/ui/vba/vbabutton.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbabutton.cxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--#include "vbabutton.hxx"
--#include <vector>
--
--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;
--}
---- sc/source/ui/vba/vbabutton.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbabutton.hxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--#ifndef SC_VBA_BUTTON_HXX
--#define SC_VBA_BUTTON_HXX
--#include <cppuhelper/implbase1.hxx>
--#include <ooo/vba/msforms/XButton.hpp>
--
--#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<rtl::OUString> getServiceNames();
--};
--#endif //SC_VBA_BUTTON_HXX
---- sc/source/ui/vba/vbacharacters.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbacharacters.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -36,7 +36,7 @@
- #include <com/sun/star/uno/XComponentContext.hpp>
- #include <com/sun/star/text/XSimpleText.hpp>
-
--#include "vbahelperinterface.hxx"
-+#include <vbahelper/vbahelperinterface.hxx>
- #include "vbapalette.hxx"
- typedef InheritedHelperInterfaceImpl1< ov::excel::XCharacters > ScVbaCharacters_BASE;
-
---- sc/source/ui/vba/vbachart.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbachart.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -41,7 +41,7 @@
- #include <ooo/vba/excel/XChart.hpp>
- #include <ooo/vba/excel/XDataLabels.hpp>
- #include <ooo/vba/excel/XSeries.hpp>
--#include "vbahelperinterface.hxx"
-+#include <vbahelper/vbahelperinterface.hxx>
-
- typedef InheritedHelperInterfaceImpl1<ov::excel::XChart > ChartImpl_BASE;
-
---- sc/source/ui/vba/vbachartobject.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbachartobject.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -36,7 +36,7 @@
- #include <com/sun/star/container/XNamed.hpp>
- #include <com/sun/star/document/XEmbeddedObjectSupplier.hpp>
- #include <ooo/vba/excel/XChartObject.hpp>
--#include "vbahelperinterface.hxx"
-+#include <vbahelper/vbahelperinterface.hxx>
- #include <memory>
-
- typedef InheritedHelperInterfaceImpl1<ov::excel::XChartObject > ChartObjectImpl_BASE;
---- sc/source/ui/vba/vbachartobjects.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbachartobjects.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -36,8 +36,8 @@
- #include <com/sun/star/table/XTableCharts.hpp>
- #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
- #include <com/sun/star/container/XEnumerationAccess.hpp>
--#include"vbacollectionimpl.hxx"
--#include "vbahelper.hxx"
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include "excelvbahelper.hxx"
- #include <hash_map>
-
- typedef CollTestImplHelper< ov::excel::XChartObjects > ChartObjects_BASE;
---- sc/source/ui/vba/vbacharts.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbacharts.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -31,8 +31,8 @@
- #define SC_VBA_CHARTS_HXX
- #include <ooo/vba/excel/XCharts.hpp>
- #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
--#include"vbacollectionimpl.hxx"
--#include "vbahelper.hxx"
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include "excelvbahelper.hxx"
- #include <hash_map>
-
- typedef CollTestImplHelper< ov::excel::XCharts > Charts_BASE;
---- sc/source/ui/vba/vbacheckbox.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbacheckbox.cxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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 <vector>
--
--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;
--}
---- sc/source/ui/vba/vbacheckbox.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbacheckbox.hxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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 <cppuhelper/implbase2.hxx>
--#include <ooo/vba/msforms/XRadioButton.hpp>
--
--#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<rtl::OUString> getServiceNames();
--};
--#endif //SC_VBA_CHECKBOX_HXX
---- sc/source/ui/vba/vbacollectionimpl.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbacollectionimpl.cxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--#include <vbacollectionimpl.hxx>
--#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 );
--}
--
--
---- sc/source/ui/vba/vbacollectionimpl.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbacollectionimpl.hxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--#ifndef SC_VBA_COLLECTION_IMPL_HXX
--#define SC_VBA_COLLECTION_IMPL_HXX
--
--#include <ooo/vba/XCollection.hpp>
--//#include <ooo/vba/XCollectionTest.hpp>
--#include <com/sun/star/container/XEnumerationAccess.hpp>
--#include <com/sun/star/uno/XComponentContext.hpp>
--#include <com/sun/star/script/XDefaultMethod.hpp>
--#include <com/sun/star/container/XIndexAccess.hpp>
--#include <com/sun/star/container/XNameAccess.hpp>
--#include <com/sun/star/container/XNamed.hpp>
--
--#include <cppuhelper/implbase3.hxx>
--#include <cppuhelper/implbase2.hxx>
--#include <cppuhelper/implbase1.hxx>
--
--#include "vbahelper.hxx"
--#include "vbahelperinterface.hxx"
--#include "vbaglobals.hxx"
--
--#include <vector>
--
--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<ov::XCollection> 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 <typename Ifc> // 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
---- sc/source/ui/vba/vbacolorformat.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbacolorformat.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -33,7 +33,7 @@
- #include <com/sun/star/drawing/XShape.hpp>
- #include <ooo/vba/msforms/XColorFormat.hpp>
- #include <ooo/vba/msforms/XFillFormat.hpp>
--#include "vbahelperinterface.hxx"
-+#include <vbahelper/vbahelperinterface.hxx>
- #include "vbafillformat.hxx"
-
- typedef InheritedHelperInterfaceImpl1< ov::msforms::XColorFormat > ScVbaColorFormat_BASE;
---- sc/source/ui/vba/vbacombobox.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbacombobox.cxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--#include "vbacombobox.hxx"
--#include <vector>
--
--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;
--}
---- sc/source/ui/vba/vbacombobox.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbacombobox.hxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--#ifndef SC_VBA_COMBOBOX_HXX
--#define SC_VBA_COMBOBOX_HXX
--#include <cppuhelper/implbase2.hxx>
--#include <com/sun/star/uno/XComponentContext.hpp>
--#include <com/sun/star/beans/XPropertySet.hpp>
--#include <com/sun/star/script/XDefaultProperty.hpp>
--#include <ooo/vba/msforms/XComboBox.hpp>
--#include <comphelper/proparrhlp.hxx>
--#include <comphelper/propertycontainer.hxx>
--#include <com/sun/star/beans/PropertyAttribute.hpp>
--
--#include "vbacontrol.hxx"
--#include "vbalistcontrolhelper.hxx"
--#include "vbahelper.hxx"
--
--typedef cppu::ImplInheritanceHelper2<ScVbaControl, ov::msforms::XComboBox, css::script::XDefaultProperty > 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<rtl::OUString> getServiceNames();
--};
--
--#endif //
---- sc/source/ui/vba/vbacommandbar.cxx.old 2009-04-06 16:42:00.000000000 +0000
-+++ sc/source/ui/vba/vbacommandbar.cxx 1970-01-01 00:00:00.000000000 +0000
-@@ -1,347 +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 <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
--#include <com/sun/star/frame/XFrame.hpp>
--#include <com/sun/star/frame/XDesktop.hpp>
--#include <com/sun/star/frame/XLayoutManager.hpp>
--#include <com/sun/star/beans/XPropertySet.hpp>
--#include <ooo/vba/office/MsoBarType.hpp>
--
--#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 = m_pScVbaCommandBars->GetModuleName();
--}
--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 );
--}
--
--sal_Int32 SAL_CALL
--ScVbaCommandBar::Type() throw (script::BasicErrorException, uno::RuntimeException)
--{
-- // #FIXME support msoBarTypePopup
-- sal_Int32 nType = office::MsoBarType::msoBarTypePopup;
-- nType = m_bIsMenu? office::MsoBarType::msoBarTypeNormal : office::MsoBarType::msoBarTypeMenuBar;
-- return nType;
--}
--
--uno::Any SAL_CALL
--ScVbaCommandBar::FindControl( const uno::Any& /*aType*/, const uno::Any& /*aId*/, const uno::Any& /*aTag*/, const uno::Any& /*aVisible*/, const uno::Any& /*aRecursive*/ ) throw (script::BasicErrorException, uno::RuntimeException)
--{
-- // alwayse fail to find control
-- return uno::makeAny( uno::Reference< XCommandBarControl > () );
--}
--
--rtl::OUString&
--ScVbaCommandBar::getServiceImplName()
--{
-- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBar") );
-- return sImplName;
--}
--uno::Sequence<rtl::OUString>
--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;
--}
---- sc/source/ui/vba/vbacommandbar.hxx.old 2009-04-06 16:42:00.000000000 +0000
-+++ sc/source/ui/vba/vbacommandbar.hxx 1970-01-01 00:00:00.000000000 +0000
-@@ -1,107 +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 <ooo/vba/XCommandBar.hpp>
--#include <com/sun/star/ui/XUIConfigurationManager.hpp>
--#include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
--#include <com/sun/star/container/XIndexContainer.hpp>
--#include <com/sun/star/beans/PropertyValues.hpp>
--
--#include "vbahelperinterface.hxx"
--#include "vbacommandbars.hxx"
--
--#include <map>
--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);
-- virtual sal_Int32 SAL_CALL Type( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-- virtual css::uno::Any SAL_CALL FindControl( const css::uno::Any& aType, const css::uno::Any& aId, const css::uno::Any& aTag, const css::uno::Any& aVisible, const css::uno::Any& aRecursive ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
--
-- // XHelperInterface
-- virtual rtl::OUString& getServiceImplName();
-- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
--};
--#endif//SC_VBA_COMMANDBAR_HXX
---- sc/source/ui/vba/vbacommandbarcontrol.cxx.old 2009-04-06 16:42:00.000000000 +0000
-+++ sc/source/ui/vba/vbacommandbarcontrol.cxx 1970-01-01 00:00:00.000000000 +0000
-@@ -1,443 +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"
--#include <basic/sbstar.hxx>
--#include <basic/sbmod.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, sal_Int32 nPosition, sal_Int32 nType ) throw (uno::RuntimeException) : CommandBarControl_BASE( xParent, xContext ), m_sName( sName ), m_nPosition( nPosition ), m_nType( nType )
--{
-- // 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 );
-- }
-- }
-- 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, sal_Int32 nPosition, sal_Bool bTemporary, sal_Int32 nType) throw (uno::RuntimeException) : CommandBarControl_BASE( xParent, xContext ), m_nPosition( nPosition ), m_bTemporary( bTemporary ), m_nType( nType )
--{
-- m_xParentHardRef.set( xParent, uno::UNO_QUERY_THROW );
-- initObjects();
-- if( sName.getLength() > 0 )
-- {
-- m_sName = sName;
-- }
-- 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" );
--}
--
--void
--ScVbaCommandBarControl::createNewMenuBarControl()
--{
-- uno::Reference< lang::XSingleComponentFactory > xMenuMSF( m_xBarSettings, uno::UNO_QUERY_THROW );
--
-- uno::Sequence< beans::PropertyValue > aPropertys;
-- if( m_nType == office::MsoControlType::msoControlPopup )
-- aPropertys = uno::Sequence< beans::PropertyValue >( 4 );
-- else
-- aPropertys = uno::Sequence< beans::PropertyValue >( 3 );
--
-- 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 <<= sal_Int32(0);
--
-- if( m_nType == office::MsoControlType::msoControlPopup )
-- {
-- aPropertys[3].Name = rtl::OUString::createFromAscii("ItemDescriptorContainer");
-- aPropertys[3].Value <<= xMenuMSF->createInstanceWithContext( mxContext );
-- }
--
-- 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
-- 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( aPropertys ) );
-- }
-- 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 <<= sal_Int32(0);
-- 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() )
-- {
-- // convert the comand url into something like vnd.sun.star.script:Standard.testMacro.Macro1?language=Basic&location=document
-- rtl::OUString aCommandURL;
-- rtl::OUString sUrlPart = rtl::OUString::createFromAscii( "vnd.sun.star.script:Standard.");
-- SbModule* pModule = StarBASIC::GetActiveModule();
-- if( pModule && ( _onaction.indexOf( sUrlPart ) == -1 ) )
-- {
-- rtl::OUString sUrlPart1 = rtl::OUString::createFromAscii( "?language=Basic&location=document");
-- aCommandURL = sUrlPart.concat( pModule->GetName() ).concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".") ) ).concat( _onaction ).concat( sUrlPart1 );
-- }
-- else
-- {
-- aCommandURL = _onaction;
-- }
-- OSL_TRACE(" ScVbaCommandBarControl::setOnAction: %s", rtl::OUStringToOString( aCommandURL, RTL_TEXTENCODING_UTF8 ).getStr() );
--
-- beans::PropertyValues aPropertyValues;
-- m_xCurrentSettings->getByIndex( m_nPosition ) >>= aPropertyValues;
-- beans::PropertyValues aNewPropertyValues;
-- aNewPropertyValues = lcl_repalcePropertyValue( aPropertyValues, rtl::OUString::createFromAscii("CommandURL"), uno::makeAny( aCommandURL ) );
-- 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<rtl::OUString>
--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;
--}
--
--//////////// ScVbaCommandBarPopup //////////////////////////////
--ScVbaCommandBarPopup::ScVbaCommandBarPopup( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition ) throw (uno::RuntimeException) : CommandBarPopup_BASE( xParent, xContext, sName, nPosition, office::MsoControlType::msoControlPopup )
--{
--}
--
--ScVbaCommandBarPopup::ScVbaCommandBarPopup( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition, sal_Bool bTemporary ) throw (uno::RuntimeException) : CommandBarPopup_BASE( xParent, xContext, sName, nPosition, bTemporary, office::MsoControlType::msoControlPopup)
--{
--}
--
--rtl::OUString&
--ScVbaCommandBarPopup::getServiceImplName()
--{
-- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBarPopup") );
-- return sImplName;
--}
--uno::Sequence<rtl::OUString>
--ScVbaCommandBarPopup::getServiceNames()
--{
-- static uno::Sequence< rtl::OUString > aServiceNames;
-- if ( aServiceNames.getLength() == 0 )
-- {
-- aServiceNames.realloc( 1 );
-- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.CommandBarPopup" ) );
-- }
-- return aServiceNames;
--}
--
--//////////// ScVbaCommandBarButton //////////////////////////////
--ScVbaCommandBarButton::ScVbaCommandBarButton( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition ) throw (uno::RuntimeException) : CommandBarButton_BASE( xParent, xContext, sName, nPosition, office::MsoControlType::msoControlButton )
--{
--}
--
--ScVbaCommandBarButton::ScVbaCommandBarButton( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition, sal_Bool bTemporary ) throw (uno::RuntimeException) : CommandBarButton_BASE( xParent, xContext, sName, nPosition, bTemporary, office::MsoControlType::msoControlButton)
--{
--}
--
--rtl::OUString&
--ScVbaCommandBarButton::getServiceImplName()
--{
-- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBarButton") );
-- return sImplName;
--}
--uno::Sequence<rtl::OUString>
--ScVbaCommandBarButton::getServiceNames()
--{
-- static uno::Sequence< rtl::OUString > aServiceNames;
-- if ( aServiceNames.getLength() == 0 )
-- {
-- aServiceNames.realloc( 1 );
-- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.CommandBarButton" ) );
-- }
-- return aServiceNames;
--}
---- sc/source/ui/vba/vbacommandbarcontrol.hxx.old 2009-04-06 16:42:00.000000000 +0000
-+++ sc/source/ui/vba/vbacommandbarcontrol.hxx 1970-01-01 00:00:00.000000000 +0000
-@@ -1,120 +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 <ooo/vba/XCommandBarControl.hpp>
--#include <ooo/vba/XCommandBarPopup.hpp>
--#include <ooo/vba/XCommandBarButton.hpp>
--#include <ooo/vba/office/MsoControlType.hpp>
--
--#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, sal_Int32 nPosition = 0, sal_Int32 nType = ov::office::MsoControlType::msoControlButton ) throw (css::uno::RuntimeException);
-- ScVbaCommandBarControl( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition, sal_Bool bTemporary, sal_Int32 nType = ov::office::MsoControlType::msoControlButton ) 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; };
-- 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<rtl::OUString> getServiceNames();
--};
--
--typedef cppu::ImplInheritanceHelper1< ScVbaCommandBarControl, ov::XCommandBarPopup > CommandBarPopup_BASE;
--class ScVbaCommandBarPopup : public CommandBarPopup_BASE
--{
--public:
-- ScVbaCommandBarPopup( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition = 0 ) throw (css::uno::RuntimeException);
-- ScVbaCommandBarPopup( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition, sal_Bool bTemporary ) throw (css::uno::RuntimeException);
-- // XHelperInterface
-- virtual rtl::OUString& getServiceImplName();
-- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
--};
--
--typedef cppu::ImplInheritanceHelper1< ScVbaCommandBarControl, ov::XCommandBarButton > CommandBarButton_BASE;
--class ScVbaCommandBarButton : public CommandBarButton_BASE
--{
--public:
-- ScVbaCommandBarButton( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition = 0 ) throw (css::uno::RuntimeException);
-- ScVbaCommandBarButton( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition, sal_Bool bTemporary ) throw (css::uno::RuntimeException);
-- // XHelperInterface
-- virtual rtl::OUString& getServiceImplName();
-- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
--};
--
--#endif//SC_VBA_COMMANDBARCONTROL_HXX
---- sc/source/ui/vba/vbacommandbarcontrols.cxx.old 2009-04-06 16:42:00.000000000 +0000
-+++ sc/source/ui/vba/vbacommandbarcontrols.cxx 1970-01-01 00:00:00.000000000 +0000
-@@ -1,348 +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;
--
--uno::Any lcl_getPropertyValue( beans::PropertyValues aPropertyValues, rtl::OUString sPropertyName );
--
--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 )
-- {
-- m_xUICfgManager.set( m_pCommandBarControl->GetUICfgManager(), uno::UNO_QUERY_THROW );
-- m_xUICfgPers.set( m_pCommandBarControl->GetUICfgPers(), uno::UNO_QUERY_THROW );
-- beans::PropertyValues aPropertyValues;
-- m_pCommandBarControl->GetCurrentSettings()->getByIndex( m_pCommandBarControl->GetPosition() ) >>= aPropertyValues;
-- m_pCommandBarControl->SetPropertyValues( aPropertyValues );
-- m_xBarSettings.set( m_pCommandBarControl->GetCurrentSettings(), uno::UNO_QUERY_THROW );
--
-- uno::Any aValue = lcl_getPropertyValue( m_pCommandBarControl->GetPropertyValues(), rtl::OUString::createFromAscii("ItemDescriptorContainer") );
-- if( aValue.hasValue() )
-- {
-- m_xCurrentSettings = m_pCommandBarControl->GetCurrentSettings();
-- m_bHasElements = sal_True;
-- }
-- else
-- {
-- m_bHasElements = sal_False;
-- }
-- m_bIsMenu = m_pCommandBarControl->IsMenu();
-- }
-- 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 )
-- {
-- uno::Reference< container::XIndexContainer > xCurrentSettings;
-- beans::PropertyValues aPropertyValues;
-- if( m_pCommandBarControl )
-- {
-- m_pCommandBarControl->GetCurrentSettings()->getByIndex( m_pCommandBarControl->GetPosition() ) >>= aPropertyValues;
-- xCurrentSettings.set( lcl_getPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( "ItemDescriptorContainer" ) ), uno::UNO_QUERY );
-- if( !xCurrentSettings.is() )
-- {
-- xCurrentSettings.set( m_xUICfgManager->getSettings( GetParentToolBarName(), sal_True ), uno::UNO_QUERY );
-- }
-- }
--
-- sal_Int32 nPosition = -1;
-- for( sal_Int32 i = 0; i < xCurrentSettings->getCount(); i++ )
-- {
-- xCurrentSettings->getByIndex( i ) >>= aPropertyValues;
-- // Label always empty in OOo
-- rtl::OUString sLabel;
-- lcl_getPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( "Label" ) ) >>= sLabel;
-- if( sLabel.equalsIgnoreAsciiCase( sName ) )
-- {
-- nPosition = i;
-- break;
-- }
-- // using CammandURL to find
-- rtl::OUString sCommandURL;
-- lcl_getPropertyValue( aPropertyValues, 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 ) )
-- {
-- nPosition = i;
-- break;
-- }
-- }
--
-- if( nPosition != -1 )
-- {
-- uno::Reference< container::XIndexContainer > xSubMenu;
-- lcl_getPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( "ItemDescriptorContainer" ) ) >>= xSubMenu;
-- ScVbaCommandBarControl* pNewCommandBarControl = NULL;
-- if( xSubMenu.is() )
-- pNewCommandBarControl = new ScVbaCommandBarPopup( this, mxContext, sName, nPosition );
-- else
-- pNewCommandBarControl = new ScVbaCommandBarButton( this, mxContext, sName, nPosition );
--
-- return uno::makeAny( uno::Reference< XCommandBarControl > ( pNewCommandBarControl ) );
-- }
-- else
-- throw uno::RuntimeException( rtl::OUString::createFromAscii("The CommandBarControl do not exist"), uno::Reference< uno::XInterface >() );
--
-- }
-- 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() )
-- Before >>= nPosition;
-- else
-- {
-- // if Before is ignore, the new control should be placed at the end of the commandbars;
-- if( m_pCommandBar )
-- nPosition = getCount();
-- else if ( m_pCommandBarControl )
-- {
-- css::uno::Reference< css::container::XIndexContainer > xCurrentSettings;
-- xCurrentSettings.set( lcl_getPropertyValue( m_pCommandBarControl->GetPropertyValues(), rtl::OUString::createFromAscii("ItemDescriptorContainer") ), uno::UNO_QUERY );
-- if( xCurrentSettings.is() )
-- {
-- nPosition = xCurrentSettings->getCount();
-- }
-- }
-- }
-- if( Temporary.hasValue() )
-- if( Temporary >>= bTemporary )
-- {
-- // evalute the temporary of the new Control
-- }
--
-- ScVbaCommandBarControl* pNewCommandBarControl = NULL;
-- if( nType == office::MsoControlType::msoControlButton )
-- {
-- pNewCommandBarControl = new ScVbaCommandBarButton( this, mxContext, sCaption, nPosition, bTemporary );
-- }
-- else if ( nType == office::MsoControlType::msoControlPopup )
-- {
-- pNewCommandBarControl = new ScVbaCommandBarPopup( this, mxContext, sCaption, nPosition, bTemporary );
-- }
-- else
-- {
-- pNewCommandBarControl = new ScVbaCommandBarControl( this, mxContext, sCaption, nPosition, bTemporary );
-- }
--
-- return uno::Reference< XCommandBarControl >( pNewCommandBarControl );
--}
--
--// XHelperInterface
--rtl::OUString&
--ScVbaCommandBarControls::getServiceImplName()
--{
-- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBarControls") );
-- return sImplName;
--}
--uno::Sequence<rtl::OUString>
--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;
--}
--
---- sc/source/ui/vba/vbacommandbarcontrols.hxx.old 2009-04-06 16:42:00.000000000 +0000
-+++ sc/source/ui/vba/vbacommandbarcontrols.hxx 1970-01-01 00:00:00.000000000 +0000
-@@ -1,91 +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 <ooo/vba/XCommandBarControls.hpp>
--
--#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;
-- css::uno::Reference< css::container::XIndexContainer > m_xCurrentSettings;
--
--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<rtl::OUString> getServiceNames();
--};
--
--#endif//SC_VBA_COMMANDBARCONTROLS_HXX
---- sc/source/ui/vba/vbacommandbars.cxx.old 2009-04-06 16:42:00.000000000 +0000
-+++ sc/source/ui/vba/vbacommandbars.cxx 1970-01-01 00:00:00.000000000 +0000
-@@ -1,261 +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 <com/sun/star/lang/XServiceInfo.hpp>
--#include <com/sun/star/frame/XDesktop.hpp>
--#include <com/sun/star/container/XNameAccess.hpp>
--
--#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 );
-- }
--
-- // hardcode if "aIndex = 1" that would return "main menu".
-- sal_Int16 nIndex = 0;
-- aIndex >>= nIndex;
-- if( nIndex == 1 )
-- {
-- uno::Any aSource;
-- if( m_sModuleName.equalsIgnoreAsciiCase( sSpreadsheetDocumentUrl ) )
-- aSource <<= rtl::OUString::createFromAscii( "Worksheet Menu Bar" );
-- else if( m_sModuleName.equalsIgnoreAsciiCase( sTextDocumentUrl ) )
-- aSource <<= rtl::OUString::createFromAscii( "Menu Bar" );
-- if( aSource.hasValue() )
-- return createCollectionObject( aSource );
-- }
-- 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<rtl::OUString>
--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;
--}
--
---- sc/source/ui/vba/vbacommandbars.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbacommandbars.hxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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 <ooo/vba/XCommandBar.hpp>
--#include <ooo/vba/XCommandBars.hpp>
--#include <com/sun/star/container/XNameAccess.hpp>
--
--#include <cppuhelper/implbase1.hxx>
--
--#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<rtl::OUString> getServiceNames();
--};
--
--#endif//SC_VBA_COMMANDBARS_HXX
---- sc/source/ui/vba/vbacomment.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbacomment.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -39,7 +39,7 @@
- #include <com/sun/star/table/XCellRange.hpp>
- #include <com/sun/star/uno/XComponentContext.hpp>
-
--#include "vbahelperinterface.hxx"
-+#include <vbahelper/vbahelperinterface.hxx>
-
- typedef InheritedHelperInterfaceImpl1< ov::excel::XComment > ScVbaComment_BASE;
-
---- sc/source/ui/vba/vbacomments.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbacomments.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -34,8 +34,8 @@
-
- #include <ooo/vba/excel/XComments.hpp>
-
--#include "vbahelper.hxx"
--#include "vbacollectionimpl.hxx"
-+#include "excelvbahelper.hxx"
-+#include <vbahelper/vbacollectionimpl.hxx>
- #include "vbacomment.hxx"
-
- typedef CollTestImplHelper< ov::excel::XComments > ScVbaComments_BASE;
---- sc/source/ui/vba/vbacondition.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbacondition.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -31,7 +31,7 @@
- #define SC_VBA_CONDITION_HXX
- #include <com/sun/star/sheet/XSheetCondition.hpp>
- #include <com/sun/star/sheet/XCellRangeAddressable.hpp>
--#include "vbahelperinterface.hxx"
-+#include <vbahelper/vbahelperinterface.hxx>
- #include <com/sun/star/sheet/ConditionOperator.hpp>
-
- template< typename Ifc1 >
---- sc/source/ui/vba/vbacontrol.cxx
-+++ 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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--#include <com/sun/star/form/FormComponentType.hpp>
--#include <com/sun/star/awt/XControlModel.hpp>
--#include <com/sun/star/awt/XControl.hpp>
--#include <com/sun/star/awt/XWindow2.hpp>
--#include <com/sun/star/lang/XEventListener.hpp>
--#include <com/sun/star/drawing/XShape.hpp>
--#include <com/sun/star/frame/XModel.hpp>
--#include <com/sun/star/view/XControlAccess.hpp>
--#include <com/sun/star/container/XChild.hpp>
--#include <com/sun/star/form/binding/XBindableValue.hpp>
--#include <com/sun/star/form/binding/XListEntrySink.hpp>
--#include <com/sun/star/table/CellAddress.hpp>
--#include <com/sun/star/table/CellRangeAddress.hpp>
--#ifdef VBA_OOBUILD_HACK
--#include <svtools/bindablecontrolhelper.hxx>
--#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;
--}
--
--
---- sc/source/ui/vba/vbacontrol.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbacontrol.hxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--#ifndef SC_VBA_CONTROL_HXX
--#define SC_VBA_CONTROL_HXX
--
--#include <cppuhelper/implbase1.hxx>
--#include <com/sun/star/beans/XPropertySet.hpp>
--#include <com/sun/star/uno/XComponentContext.hpp>
--#include <com/sun/star/script/XDefaultProperty.hpp>
--#include <com/sun/star/drawing/XControlShape.hpp>
--#include <com/sun/star/awt/XControl.hpp>
--#include <com/sun/star/awt/XWindowPeer.hpp>
--#include <ooo/vba/msforms/XControl.hpp>
--
--#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<rtl::OUString> 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
---- sc/source/ui/vba/vbacontrols.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbacontrols.cxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--
--#include "vbacontrols.hxx"
--#include "vbacontrol.hxx"
--#include <cppuhelper/implbase2.hxx>
--#include <com/sun/star/awt/XControlContainer.hpp>
--#include <hash_map>
--
--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<XHelperInterface > m_xParent;
-- uno::Reference<uno::XComponentContext > m_xContext;
-- uno::Reference<container::XIndexAccess > m_xIndexAccess;
-- uno::Reference<awt::XControl > 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<container::XIndexAccess >
--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;
--}
---- sc/source/ui/vba/vbacontrols.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbacontrols.hxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--#ifndef SC_VBA_CONTROLS_HXX
--#define SC_VBA_CONTROLS_HXX
--
--#include <cppuhelper/implbase1.hxx>
--#include <ooo/vba/msforms/XControls.hpp>
--#include <com/sun/star/awt/XControl.hpp>
--
--#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<rtl::OUString> 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
--
---- sc/source/ui/vba/vbadialog.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbadialog.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -35,7 +35,7 @@
-
- #include <tools/string.hxx>
-
--#include "vbahelper.hxx"
-+#include "excelvbahelper.hxx"
- #include "vbadialog.hxx"
- #include "vbaglobals.hxx"
-
---- sc/source/ui/vba/vbadialog.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbadialog.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -33,11 +33,10 @@
- #include <cppuhelper/implbase1.hxx>
-
- #include <com/sun/star/uno/XComponentContext.hpp>
--#include <ooo/vba/XGlobals.hpp>
- #include <ooo/vba/excel/XApplication.hpp>
- #include <ooo/vba/excel/XDialog.hpp>
-
--#include "vbahelperinterface.hxx"
-+#include <vbahelper/vbahelperinterface.hxx>
- #include "vbadialog.hxx"
-
- typedef InheritedHelperInterfaceImpl1< ov::excel::XDialog > ScVbaDialog_BASE;
---- sc/source/ui/vba/vbadialogs.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbadialogs.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -36,7 +36,7 @@
-
- #include <tools/string.hxx>
-
--#include "vbahelper.hxx"
-+#include "excelvbahelper.hxx"
- #include "vbadialogs.hxx"
- #include "vbaglobals.hxx"
- #include "vbadialog.hxx"
-@@ -62,7 +62,7 @@ ScVbaDialogs::Item( const uno::Any &aIte
- {
- 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 ), nIndex, mxContext ) );
- return uno::Any( aDialog );
- }
- rtl::OUString&
---- sc/source/ui/vba/vbadialogs.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbadialogs.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -35,7 +35,7 @@
- #include <com/sun/star/uno/XComponentContext.hpp>
- #include <ooo/vba/excel/XDialogs.hpp>
- #include <ooo/vba/XCollection.hpp>
--#include "vbahelperinterface.hxx"
-+#include <vbahelper/vbahelperinterface.hxx>
-
- class ScModelObj;
-
---- sc/source/ui/vba/vbaeventshelper.cxx.old 2009-04-06 16:42:00.000000000 +0000
-+++ sc/source/ui/vba/vbaeventshelper.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -33,12 +33,8 @@
- *
- ************************************************************************/
- #include "vbaeventshelper.hxx"
--#include "helperdecl.hxx"
-+#include <vbahelper/helperdecl.hxx>
- #include <sfx2/objsh.hxx>
--#include <basic/basmgr.hxx>
--#include <basic/sbmod.hxx>
--#include <basic/sbmeth.hxx>
--#include <basic/sbx.hxx>
- #include "scextopt.hxx"
- #include <sfx2/evntconf.hxx>
- #include <sfx2/event.hxx>
-@@ -69,8 +65,6 @@ using namespace com::sun::star;
- using namespace ooo::vba;
- using namespace com::sun::star::document::VbaEventId;
-
--const static String sLibrary( RTL_CONSTASCII_USTRINGPARAM("Standard"));
--
- const static rtl::OUString sUrlPart0 = rtl::OUString::createFromAscii( "vnd.sun.star.script:");
- const static rtl::OUString sUrlPart1 = rtl::OUString::createFromAscii( "vnd.sun.star.script:Standard.");
- const static rtl::OUString sUrlPart2 = rtl::OUString::createFromAscii( "?language=Basic&location=document");
-@@ -400,7 +394,7 @@ ScVbaEventsHelper::ScVbaEventsHelper( un
- : m_xContext( xContext ), mpVbaEventsListener( NULL ), mbOpened( sal_False ), mbIgnoreEvents( sal_False )
- {
- uno::Reference< frame::XModel > xModel ( getXSomethingFromArgs< frame::XModel >( aArgs, 0 ), uno::UNO_QUERY );
-- ScDocShell* pDocShell = getDocShell( xModel );
-+ ScDocShell* pDocShell = excel::getDocShell( xModel );
- pDoc = pDocShell->GetDocument();
- }
-
-@@ -452,55 +446,6 @@ sal_Bool ScVbaEventsHelper::executeMacro
- }
- return sal_True;
- }
--String ScVbaEventsHelper::workbookMacroExists( SfxObjectShell* pShell, const String& sMod, const String& sMacro )
--{
-- String sFullName;
-- // would use the script provider to see if the macro exists but
-- // called at this stage tdoc content handler stuff is not set up
-- // so it fails
--
-- BasicManager* pBasicMgr = pShell-> GetBasicManager();
-- if ( pBasicMgr )
-- {
-- StarBASIC* pBasic = pBasicMgr->GetLib( sLibrary );
-- if ( !pBasic )
-- {
-- USHORT nId = pBasicMgr->GetLibId( sLibrary );
-- pBasicMgr->LoadLib( nId );
-- pBasic = pBasicMgr->GetLib( sLibrary );
-- }
-- if ( pBasic )
-- {
-- if ( sMod.Len() ) // we wish to find the macro is a specific module
-- {
-- SbModule* pModule = pBasic->FindModule( sMod );
-- if ( pModule )
-- {
-- SbxArray* pMethods = pModule->GetMethods();
-- if ( pMethods )
-- {
-- SbMethod* pMethod = static_cast< SbMethod* >( pMethods->Find( sMacro, SbxCLASS_METHOD ) );
-- if ( pMethod )
-- {
-- sFullName = sMacro;
-- sFullName.Insert( '.', 0 ).Insert( sMod, 0 ).Insert( '.', 0 ).Insert( sLibrary, 0 );
-- }
-- }
-- }
-- }
-- else if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pBasic->Find( sMacro, SbxCLASS_METHOD ) ) )
-- {
-- if( SbModule* pModule = pMethod->GetModule() )
-- {
-- sFullName = sMacro;
-- sFullName.Insert( '.', 0 ).Insert( pModule->GetName(), 0).Insert( '.', 0 ).Insert( sLibrary, 0 );
-- }
-- }
--
-- }
-- }
-- return sFullName;
--}
-
- uno::Any ScVbaEventsHelper::createWorkSheet( SfxObjectShell* pShell, SCTAB nTab )
- {
-@@ -517,7 +462,7 @@ uno::Any ScVbaEventsHelper::createWorkSh
- uno::Sequence< uno::Any > aArgs(2);
- aArgs[0] = uno::Any( uno::Reference< uno::XInterface >() );
- aArgs[1] = uno::Any( pShell->GetModel() );
-- uno::Reference< uno::XInterface > xWorkbook( xSMgr->createInstanceWithArgumentsAndContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Workbook") ), aArgs, xCtx ), uno::UNO_QUERY );
-+ uno::Reference< uno::XInterface > xWorkbook( ov::createVBAUnoAPIServiceWithArgs( pShell, "ooo.vba.excel.Workbook", aArgs ), uno::UNO_QUERY );
-
- // create WorkSheet
- String sSheetName;
-@@ -526,7 +471,7 @@ uno::Any ScVbaEventsHelper::createWorkSh
- aArgs[ 0 ] <<= xWorkbook;
- aArgs[ 1 ] <<= pShell->GetModel();
- aArgs[ 2 ] = uno::makeAny( rtl::OUString( sSheetName ) );
-- aRet <<= xSMgr->createInstanceWithArgumentsAndContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Worksheet") ), aArgs, xCtx );
-+ aRet <<= ov::createVBAUnoAPIServiceWithArgs( pShell, "ooo.vba.excel.Worksheet", aArgs );
- }
- catch( uno::Exception& e )
- {
-@@ -560,7 +505,7 @@ uno::Any ScVbaEventsHelper::createRange(
- {
- throw uno::RuntimeException(); //
- }
-- aRet <<= xSMgr->createInstanceWithArgumentsAndContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Range") ), aArgs, xCtx );
-+ aRet <<= ov::createVBAUnoAPIServiceWithArgs( pDoc->GetDocumentShell(), "ooo.vba.excel.Range", aArgs );
- }
- }
- catch( uno::Exception& e )
-@@ -584,7 +529,7 @@ uno::Any ScVbaEventsHelper::createHyperl
- aArgs[0] = uno::Any( uno::Reference< uno::XInterface >() ); // dummy parent
- aArgs[1] <<= rCell;
-
-- aRet <<= xSMgr->createInstanceWithArgumentsAndContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Hyperlink") ), aArgs, xCtx );
-+ aRet <<= ov::createVBAUnoAPIServiceWithArgs( pDoc->GetDocumentShell(), "ooo.vba.excel.Hyperlink", aArgs );
- }
- else
- {
-@@ -647,7 +592,7 @@ ScVbaEventsHelper::getMacroPath( const s
- case VBAEVENT_WORKSHEET_SELECTIONCHANGE :
- {
- rtl::OUString aSheetModuleName = getSheetModuleName( nTab );
-- sMacroPath = workbookMacroExists( pShell, aSheetModuleName, sMacroName );
-+ sMacroPath = docMacroExists( pShell, aSheetModuleName, sMacroName );
- break;
- }
- // Workbook
-@@ -681,7 +626,7 @@ ScVbaEventsHelper::getMacroPath( const s
- sWorkbookModuleName = aExtDocSettings.maGlobCodeName;
- }
-
-- sMacroPath = workbookMacroExists( pShell, sWorkbookModuleName, sMacroName );
-+ sMacroPath = docMacroExists( pShell, sWorkbookModuleName, sMacroName );
- break;
- }
- default:
---- sc/source/ui/vba/vbaeventshelper.hxx.old 2009-04-06 16:42:00.000000000 +0000
-+++ sc/source/ui/vba/vbaeventshelper.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -40,7 +40,7 @@
- #include <cppuhelper/implbase1.hxx>
- #include <com/sun/star/document/VbaEventId.hpp>
- #include <com/sun/star/document/XVbaEventsHelper.hpp>
--#include "vbahelper.hxx"
-+#include "excelvbahelper.hxx"
-
- #define INVALID_TAB -1
-
-@@ -57,7 +57,6 @@ private:
- sal_Bool mbIgnoreEvents;
-
- String getSheetModuleName( SCTAB nTab );
-- String workbookMacroExists( SfxObjectShell* pShell, const String& sMod, const String& sMacro );
- css::uno::Any createWorkSheet( SfxObjectShell* pShell, SCTAB nTab );
- css::uno::Any createRange( const css::uno::Any& aRange );
- css::uno::Any createHyperlink( const css::uno::Any& rCell );
---- sc/source/ui/vba/vbafillformat.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbafillformat.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -33,7 +33,7 @@
- #include <com/sun/star/drawing/XShape.hpp>
- #include <com/sun/star/drawing/FillStyle.hpp>
- #include <ooo/vba/msforms/XFillFormat.hpp>
--#include "vbahelperinterface.hxx"
-+#include <vbahelper/vbahelperinterface.hxx>
-
- typedef InheritedHelperInterfaceImpl1< ov::msforms::XFillFormat > ScVbaFillFormat_BASE;
-
---- sc/source/ui/vba/vbafont.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbafont.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -34,7 +34,7 @@
-
- #include <ooo/vba/excel/XFont.hpp>
- #include <com/sun/star/beans/XPropertySet.hpp>
--#include "vbahelperinterface.hxx"
-+#include <vbahelper/vbahelperinterface.hxx>
- #include "vbapalette.hxx"
-
- class ScTableSheetsObj;
---- sc/source/ui/vba/vbaformat.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbaformat.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -33,6 +33,7 @@
- #include <ooo/vba/excel/XlHAlign.hpp>
- #include <ooo/vba/excel/XlOrientation.hpp>
- #include <ooo/vba/excel/Constants.hpp>
-+#include <ooo/vba/excel/XRange.hpp>
- #include <com/sun/star/table/CellVertJustify.hpp>
- #include <com/sun/star/table/CellHoriJustify.hpp>
- #include <com/sun/star/table/CellOrientation.hpp>
-@@ -341,7 +342,7 @@ template< typename Ifc1 >
- uno::Any SAL_CALL
- ScVbaFormat<Ifc1>::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<Ifc1>::Font( ) throw (script::BasicErrorException, uno::RuntimeException)
- {
-- ScVbaPalette aPalette( getDocShell( mxModel ) );
-+ ScVbaPalette aPalette( excel::getDocShell( mxModel ) );
- return new ScVbaFont( thisHelperIface(), ScVbaFormat_BASE::mxContext, aPalette, mxPropertySet );
- }
-
---- sc/source/ui/vba/vbaformat.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbaformat.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -39,7 +39,7 @@
- #include <com/sun/star/lang/XMultiServiceFactory.hpp>
- #include <com/sun/star/lang/Locale.hpp>
- #include <com/sun/star/beans/XPropertyState.hpp>
--#include "vbahelperinterface.hxx"
-+#include <vbahelper/vbahelperinterface.hxx>
-
- template< typename Ifc1 >
- class ScVbaFormat : public InheritedHelperInterfaceImpl1< Ifc1 >
---- sc/source/ui/vba/vbaformatconditions.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbaformatconditions.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -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( R
- 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 );
---- sc/source/ui/vba/vbaformatconditions.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbaformatconditions.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -35,7 +35,7 @@
- #include <com/sun/star/beans/XPropertySet.hpp>
- #include <com/sun/star/table/CellAddress.hpp>
- #include <com/sun/star/sheet/XSheetConditionalEntries.hpp>
--#include "vbacollectionimpl.hxx"
-+#include <vbahelper/vbacollectionimpl.hxx>
-
- typedef CollTestImplHelper< ov::excel::XFormatConditions > ScVbaFormatConditions_BASE;
- class ScVbaFormatConditions: public ScVbaFormatConditions_BASE
---- sc/source/ui/vba/vbaframe.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbaframe.cxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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 <vector>
--
--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;
--}
---- sc/source/ui/vba/vbaframe.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbaframe.hxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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 <cppuhelper/implbase1.hxx>
--#include <ooo/vba/msforms/XLabel.hpp>
--
--#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<rtl::OUString> getServiceNames();
--};
--#endif //SC_VBA_LABEL_HXX
---- sc/source/ui/vba/vbaglobals.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbaglobals.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -27,13 +27,14 @@
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
--#include "helperdecl.hxx"
-+#include <vbahelper/helperdecl.hxx>
- #include "vbaglobals.hxx"
-
- #include <comphelper/unwrapargs.hxx>
-
- #include <com/sun/star/lang/XMultiComponentFactory.hpp>
- #include <com/sun/star/beans/XPropertySet.hpp>
-+#include <cppuhelper/component_context.hxx>
-
- #include "vbaapplication.hxx"
- #include "vbaworksheet.hxx"
-@@ -49,11 +50,10 @@ 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 )
- {
- OSL_TRACE("ScVbaGlobals::ScVbaGlobals()");
-- mxApplication = uno::Reference< excel::XApplication > ( new ScVbaApplication( m_xContext) );
-+ init( rxContext, uno::Any( getApplication() ) );
- }
-
- ScVbaGlobals::~ScVbaGlobals()
-@@ -61,23 +61,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 +68,15 @@ uno::Reference<excel::XApplication >
- ScVbaGlobals::getApplication() throw (uno::RuntimeException)
- {
- // OSL_TRACE("In ScVbaGlobals::getApplication");
-- return mxApplication;
-+ static uno::Reference< excel::XApplication > ExcelApplication( new ScVbaApplication( mxContext) );
-+ return ExcelApplication;
- }
-
- 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 +87,28 @@ ScVbaGlobals::getActiveWorkbook() throw
- }
-
-
-+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 +116,6 @@ ScVbaGlobals::Sheets( const uno::Any& aI
- 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 +128,140 @@ ScVbaGlobals::Names( const css::uno::Any
- 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_<ScVbaGlobals, sdecl::with_args<false> > serviceImpl;
-+sdecl::vba_service_class_<ScVbaGlobals, sdecl::with_args<false> > serviceImpl;
- extern sdecl::ServiceDecl const serviceDecl(
- serviceImpl,
- "ScVbaGlobals",
-- "ooo.vba.Globals" );
-+ "ooo.vba.excel.Globals" );
- }
-
---- sc/source/ui/vba/vbaglobals.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbaglobals.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -33,43 +33,62 @@
- #include <com/sun/star/lang/XServiceInfo.hpp>
- #include <com/sun/star/lang/XInitialization.hpp>
- #include <com/sun/star/uno/XComponentContext.hpp>
--#include <ooo/vba/XGlobals.hpp>
-+#include <ooo/vba/excel/XGlobals.hpp>
-+#include <ooo/vba/excel/XApplication.hpp>
-
- #include <cppuhelper/implbase1.hxx>
--#include "vbahelper.hxx"
-+#include "excelvbahelper.hxx"
-
-+#include <vbahelper/vbaglobalbase.hxx>
- // =============================================================================
- // 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;
-+ virtual css::uno::Reference<
-+ ov::excel::XApplication > SAL_CALL getApplication()
-+ throw (css::uno::RuntimeException);
- 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
-- virtual css::uno::Reference<
-- ov::excel::XApplication > SAL_CALL getApplication()
-- throw (css::uno::RuntimeException);
- 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<rtl::OUString> getServiceNames();
- };
- #endif //
---- sc/source/ui/vba/vbahelper.cxx
-+++ sc/source/ui/vba/vbahelper.cxx
-@@ -1,828 +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.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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--#include <cppuhelper/bootstrap.hxx>
--#include <com/sun/star/util/XURLTransformer.hpp>
--#include <com/sun/star/frame/XDispatchProvider.hpp>
--#include <com/sun/star/frame/XModel.hpp>
--#include <com/sun/star/frame/XFrame.hpp>
--#include <com/sun/star/frame/XDesktop.hpp>
--#include <com/sun/star/frame/XController.hpp>
--#include <com/sun/star/uno/XComponentContext.hpp>
--#include <com/sun/star/lang/XMultiComponentFactory.hpp>
--#include <com/sun/star/beans/XPropertySet.hpp>
--#include <com/sun/star/beans/XIntrospection.hpp>
--
--#include <comphelper/processfactory.hxx>
--
--#include <sfx2/objsh.hxx>
--#include <sfx2/viewfrm.hxx>
--#include <sfx2/dispatch.hxx>
--#include <sfx2/app.hxx>
--#include <svtools/stritem.hxx>
--
--#include <docuno.hxx>
--
--#include <basic/sbx.hxx>
--#include <basic/sbstar.hxx>
--#include <rtl/math.hxx>
--
--#include <math.h>
--#include "vbahelper.hxx"
--#include "tabvwsh.hxx"
--#include "transobj.hxx"
--#include "scmod.hxx"
--#include "vbashape.hxx"
--#include "unonames.hxx"
--#include "cellsuno.hxx"
--using namespace ::com::sun::star;
--using namespace ::ooo::vba;
--
--#define POINTTO100THMILLIMETERFACTOR 35.27778
--void unoToSbxValue( SbxVariable* pVar, const uno::Any& aValue );
--
--uno::Any sbxToUnoValue( SbxVariable* pVar );
--
--
--namespace ooo
--{
--namespace vba
--{
--
--const double Millimeter::factor = 35.27778;
--
--uno::Reference< beans::XIntrospectionAccess >
--getIntrospectionAccess( const uno::Any& aObject ) throw (uno::RuntimeException)
--{
-- static uno::Reference< beans::XIntrospection > xIntrospection;
-- if( !xIntrospection.is() )
-- {
-- uno::Reference< lang::XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-- xIntrospection.set( xFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.beans.Introspection") ), uno::UNO_QUERY_THROW );
-- }
-- return xIntrospection->inspect( aObject );
--}
--
--uno::Reference< script::XTypeConverter >
--getTypeConverter( const uno::Reference< uno::XComponentContext >& xContext ) throw (uno::RuntimeException)
--{
-- static uno::Reference< script::XTypeConverter > xTypeConv( xContext->getServiceManager()->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter") ), xContext ), uno::UNO_QUERY_THROW );
-- return xTypeConv;
--}
--// helper method to determine if the view ( calc ) is in print-preview mode
--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"));
--const uno::Any&
--aNULL()
--{
-- static uno::Any aNULLL = uno::makeAny( uno::Reference< uno::XInterface >() );
-- return aNULLL;
--}
--
--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<uno::XComponentContext > xContext( xTmpProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
-- static uno::Reference<lang::XMultiComponentFactory > 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
--dispatchRequests (uno::Reference< frame::XModel>& xModel,rtl::OUString & aUrl, uno::Sequence< beans::PropertyValue >& sProps )
--{
--
-- util::URL url ;
-- url.Complete = aUrl;
-- rtl::OUString emptyString = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "" ));
-- uno::Reference<frame::XController> xController = xModel->getCurrentController();
-- uno::Reference<frame::XFrame> xFrame = xController->getFrame();
-- uno::Reference<frame::XDispatchProvider> xDispatchProvider (xFrame,uno::UNO_QUERY_THROW);
-- try
-- {
-- uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-- uno::Reference<uno::XComponentContext > xContext( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
-- if ( !xContext.is() )
-- {
-- return ;
-- }
--
-- uno::Reference<lang::XMultiComponentFactory > xServiceManager(
-- xContext->getServiceManager() );
-- if ( !xServiceManager.is() )
-- {
-- return ;
-- }
-- uno::Reference<util::XURLTransformer> xParser( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ) )
-- ,xContext), uno::UNO_QUERY_THROW );
-- if (!xParser.is())
-- return;
-- xParser->parseStrict (url);
-- }
-- catch ( uno::Exception & /*e*/ )
-- {
-- return ;
-- }
--
-- uno::Reference<frame::XDispatch> xDispatcher = xDispatchProvider->queryDispatch(url,emptyString,0);
--
-- uno::Sequence<beans::PropertyValue> dispatchProps(1);
--
-- sal_Int32 nProps = sProps.getLength();
-- beans::PropertyValue* pDest = dispatchProps.getArray();
-- if ( nProps )
-- {
-- dispatchProps.realloc( nProps + 1 );
-- // need to reaccquire pDest after realloc
-- pDest = dispatchProps.getArray();
-- beans::PropertyValue* pSrc = sProps.getArray();
-- for ( sal_Int32 index=0; index<nProps; ++index, ++pSrc, ++pDest )
-- *pDest = *pSrc;
-- }
--
-- (*pDest).Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Silent" ));
-- (*pDest).Value <<= (sal_Bool)sal_True;
--
-- if (xDispatcher.is())
-- xDispatcher->dispatch( url, dispatchProps );
--}
--
--void
--dispatchRequests (uno::Reference< frame::XModel>& xModel,rtl::OUString & aUrl)
--{
-- uno::Sequence<beans::PropertyValue> dispatchProps;
-- dispatchRequests( xModel, aUrl, dispatchProps );
--}
--
--
--void dispatchExecute(css::uno::Reference< css::frame::XModel>& xModel, USHORT nSlot, SfxCallMode nCall)
--{
-- ScTabViewShell* pViewShell = getBestViewShell( xModel );
-- SfxViewFrame* pViewFrame = NULL;
-- if ( pViewShell )
-- pViewFrame = pViewShell->GetViewFrame();
-- if ( pViewFrame )
-- {
-- SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
-- if( pDispatcher )
-- {
-- pDispatcher->Execute( nSlot , nCall );
-- }
-- }
--}
--
--void
--implnPaste()
--{
-- PasteCellsWarningReseter resetWarningBox;
-- ScTabViewShell* pViewShell = getCurrentBestViewShell();
-- if ( pViewShell )
-- {
-- pViewShell->PasteFromSystem();
-- pViewShell->CellContentChanged();
-- }
--}
--
--
--void
--implnCopy()
--{
-- ScTabViewShell* pViewShell = getCurrentBestViewShell();
-- if ( pViewShell )
-- pViewShell->CopyToClip(NULL,false,false,true);
--}
--
--void
--implnCut()
--{
-- ScTabViewShell* pViewShell = getCurrentBestViewShell();
-- if ( pViewShell )
-- pViewShell->CutToClip( NULL, TRUE );
--}
--
--void implnPasteSpecial(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 = ScTabViewShell::GetActiveViewShell();
-- if ( !pTabViewShell )
-- // none active, try next best
-- pTabViewShell = getCurrentBestViewShell();
-- 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();
-- }
-- }
-- }
--
--}
--
-- uno::Reference< frame::XModel >
--getCurrentDocument() throw (uno::RuntimeException)
--{
-- uno::Reference< frame::XModel > xModel;
-- SbxObject* pBasic = dynamic_cast< SbxObject* > ( SFX_APP()->GetBasic() );
-- SbxObject* basicChosen = pBasic ;
-- if ( basicChosen == NULL)
-- {
-- OSL_TRACE("getModelFromBasic() StarBASIC* is NULL" );
-- return xModel;
-- }
-- SbxObject* p = pBasic;
-- SbxObject* pParent = p->GetParent();
-- SbxObject* pParentParent = pParent ? pParent->GetParent() : NULL;
--
-- if( pParentParent )
-- {
-- basicChosen = pParentParent;
-- }
-- else if( pParent )
-- {
-- basicChosen = pParent;
-- }
--
--
-- uno::Any aModel;
-- SbxVariable *pCompVar = basicChosen->Find( UniString(RTL_CONSTASCII_USTRINGPARAM("ThisComponent")), SbxCLASS_OBJECT );
--
-- if ( pCompVar )
-- {
-- aModel = sbxToUnoValue( pCompVar );
-- if ( sal_False == ( aModel >>= xModel ) ||
-- !xModel.is() )
-- {
-- // trying last gasp try the current component
-- uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-- // test if vba service is present
-- uno::Reference< uno::XComponentContext > xCtx( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
-- uno::Reference<lang::XMultiComponentFactory > xSMgr( xCtx->getServiceManager(), uno::UNO_QUERY_THROW );
-- uno::Reference< frame::XDesktop > xDesktop (xSMgr->createInstanceWithContext(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"), xCtx), uno::UNO_QUERY_THROW );
-- xModel.set( xDesktop->getCurrentComponent(), uno::UNO_QUERY );
-- if ( !xModel.is() )
-- {
-- throw uno::RuntimeException(
-- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can't extract model from basic ( its obviously not set yet ) therefore don't know the currently selected document") ), uno::Reference< uno::XInterface >() );
-- }
-- return xModel;
-- }
-- else
-- {
-- OSL_TRACE("Have model ThisComponent points to url %s",
-- ::rtl::OUStringToOString( xModel->getURL(),
-- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-- }
-- }
-- else
-- {
-- OSL_TRACE("Failed to get ThisComponent");
-- throw uno::RuntimeException(
-- rtl::OUString(
-- RTL_CONSTASCII_USTRINGPARAM(
-- "Can't determine the currently selected document") ),
-- uno::Reference< uno::XInterface >() );
-- }
-- return xModel;
--}
--
--ScDocShell*
--getDocShell( 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( css::uno::Reference< css::frame::XModel>& xModel )
--{
-- ScDocShell* pDocShell = getDocShell( xModel );
-- if ( pDocShell )
-- return pDocShell->GetBestViewShell();
-- return NULL;
--}
--
--ScTabViewShell*
--getCurrentBestViewShell()
--{
-- uno::Reference< frame::XModel > xModel = getCurrentDocument();
-- return getBestViewShell( xModel );
--}
--
--SfxViewFrame*
--getCurrentViewFrame()
--{
-- ScTabViewShell* pViewShell = getCurrentBestViewShell();
-- if ( pViewShell )
-- return pViewShell->GetViewFrame();
-- return NULL;
--}
--
--sal_Int32
--OORGBToXLRGB( sal_Int32 nCol )
--{
-- sal_Int32 nRed = nCol;
-- nRed &= 0x00FF0000;
-- nRed >>= 16;
-- sal_Int32 nGreen = nCol;
-- nGreen &= 0x0000FF00;
-- nGreen >>= 8;
-- sal_Int32 nBlue = nCol;
-- nBlue &= 0x000000FF;
-- sal_Int32 nRGB = ( (nBlue << 16) | (nGreen << 8) | nRed );
-- return nRGB;
--}
--sal_Int32
--XLRGBToOORGB( sal_Int32 nCol )
--{
-- sal_Int32 nBlue = nCol;
-- nBlue &= 0x00FF0000;
-- nBlue >>= 16;
-- sal_Int32 nGreen = nCol;
-- nGreen &= 0x0000FF00;
-- nGreen >>= 8;
-- sal_Int32 nRed = nCol;
-- nRed &= 0x000000FF;
-- sal_Int32 nRGB = ( (nRed << 16) | (nGreen << 8) | nBlue );
-- return nRGB;
--}
--uno::Any
--OORGBToXLRGB( const uno::Any& aCol )
--{
-- sal_Int32 nCol=0;
-- aCol >>= nCol;
-- nCol = OORGBToXLRGB( nCol );
-- return uno::makeAny( nCol );
--}
--uno::Any
--XLRGBToOORGB( const uno::Any& aCol )
--{
-- sal_Int32 nCol=0;
-- aCol >>= nCol;
-- nCol = XLRGBToOORGB( nCol );
-- return uno::makeAny( nCol );
--}
--
--void PrintOutHelper( const uno::Any& From, const uno::Any& To, const uno::Any& Copies, const uno::Any& Preview, const uno::Any& /*ActivePrinter*/, const uno::Any& /*PrintToFile*/, const uno::Any& Collate, const uno::Any& PrToFileName, css::uno::Reference< frame::XModel >& xModel, sal_Bool bUseSelection )
--{
-- sal_Int32 nTo = 0;
-- sal_Int32 nFrom = 0;
-- sal_Int16 nCopies = 1;
-- sal_Bool bPreview = sal_False;
-- sal_Bool bCollate = sal_False;
-- sal_Bool bSelection = bUseSelection;
-- From >>= nFrom;
-- To >>= nTo;
-- Copies >>= nCopies;
-- Preview >>= bPreview;
-- if ( nCopies > 1 ) // Collate only useful when more that 1 copy
-- Collate >>= bCollate;
--
-- rtl::OUString sRange( RTL_CONSTASCII_USTRINGPARAM( "-" ) );
-- rtl::OUString sFileName;
--
-- if (( nFrom || nTo ) )
-- {
-- if ( nFrom )
-- sRange = ( ::rtl::OUString::valueOf( nFrom ) + sRange );
-- if ( nTo )
-- sRange += ::rtl::OUString::valueOf( nTo );
-- }
--
-- if ( PrToFileName.getValue() )
-- {
-- PrToFileName >>= sFileName;
-- }
-- ScTabViewShell* pViewShell = getBestViewShell( xModel );
-- SfxViewFrame* pViewFrame = NULL;
-- if ( pViewShell )
-- pViewFrame = pViewShell->GetViewFrame();
-- if ( pViewFrame )
-- {
-- SfxAllItemSet aArgs( SFX_APP()->GetPool() );
--
-- SfxBoolItem sfxCollate( SID_PRINT_COLLATE, bCollate );
-- aArgs.Put( sfxCollate, sfxCollate.Which() );
-- SfxInt16Item sfxCopies( SID_PRINT_COPIES, nCopies );
-- aArgs.Put( sfxCopies, sfxCopies.Which() );
-- if ( sFileName.getLength() )
-- {
-- SfxStringItem sfxFileName( SID_FILE_NAME, sFileName);
-- aArgs.Put( sfxFileName, sfxFileName.Which() );
--
-- }
-- if ( sRange.getLength() )
-- {
-- SfxStringItem sfxRange( SID_PRINT_PAGES, sRange );
-- aArgs.Put( sfxRange, sfxRange.Which() );
-- }
-- SfxBoolItem sfxSelection( SID_SELECTION, bSelection );
-- aArgs.Put( sfxSelection, sfxSelection.Which() );
-- SfxBoolItem sfxAsync( SID_ASYNCHRON, sal_False );
-- aArgs.Put( sfxAsync, sfxAsync.Which() );
-- SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
--
-- if ( pDispatcher )
-- {
-- if ( bPreview )
-- {
-- if ( !pViewFrame->GetFrame()->IsInPlace() )
-- {
-- SC_MOD()->InputEnterHandler();
-- pViewFrame->GetDispatcher()->Execute( SID_VIEWSHELL1, SFX_CALLMODE_SYNCHRON );
-- while ( isInPrintPreview( pViewFrame ) )
-- Application::Yield();
-- }
-- }
-- else
-- pDispatcher->Execute( (USHORT)SID_PRINTDOC, (SfxCallMode)SFX_CALLMODE_SYNCHRON, aArgs );
-- }
--
-- }
--
-- // #FIXME #TODO
-- // 1 ActivePrinter ( how/can we switch a printer via API? )
-- // 2 PrintToFile ( ms behaviour if this option is specified but no
-- // filename supplied 'PrToFileName' then the user will be prompted )
-- // 3 Need to check behaviour of Selected sheets with range ( e.g. From & To
-- // values ) in oOO these options are mutually exclusive
-- // 4 There is a pop up to do with transparent objects in the print source
-- // should be able to disable that via configuration for the duration
-- // of this method
--}
--
-- void PrintPreviewHelper( const css::uno::Any& /*EnableChanges*/, css::uno::Reference< css::frame::XModel >& xModel )
--{
-- dispatchExecute( xModel, SID_VIEWSHELL1 );
--}
--
--rtl::OUString getAnyAsString( const uno::Any& pvargItem ) throw ( uno::RuntimeException )
--{
-- uno::Type aType = pvargItem.getValueType();
-- uno::TypeClass eTypeClass = aType.getTypeClass();
-- rtl::OUString sString;
-- switch ( eTypeClass )
-- {
-- case uno::TypeClass_BOOLEAN:
-- {
-- sal_Bool bBool = sal_False;
-- pvargItem >>= bBool;
-- sString = rtl::OUString::valueOf( bBool );
-- break;
-- }
-- case uno::TypeClass_STRING:
-- pvargItem >>= sString;
-- break;
-- case uno::TypeClass_FLOAT:
-- {
-- float aFloat = 0;
-- pvargItem >>= aFloat;
-- sString = rtl::OUString::valueOf( aFloat );
-- break;
-- }
-- case uno::TypeClass_DOUBLE:
-- {
-- double aDouble = 0;
-- pvargItem >>= aDouble;
-- sString = rtl::OUString::valueOf( aDouble );
-- break;
-- }
-- case uno::TypeClass_SHORT:
-- case uno::TypeClass_LONG:
-- case uno::TypeClass_BYTE:
-- {
-- sal_Int32 aNum = 0;
-- pvargItem >>= aNum;
-- sString = rtl::OUString::valueOf( aNum );
-- break;
-- }
--
-- case uno::TypeClass_HYPER:
-- {
-- sal_Int64 aHyper = 0;
-- pvargItem >>= aHyper;
-- sString = rtl::OUString::valueOf( aHyper );
-- break;
-- }
-- default:
-- throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid type, can't convert" ), uno::Reference< uno::XInterface >() );
-- }
-- return sString;
--}
--
--
--rtl::OUString
--ContainerUtilities::getUniqueName( const uno::Sequence< ::rtl::OUString >& _slist, const rtl::OUString& _sElementName, const ::rtl::OUString& _sSuffixSeparator)
--{
-- return getUniqueName(_slist, _sElementName, _sSuffixSeparator, sal_Int32(2));
--}
--
--rtl::OUString
--ContainerUtilities::getUniqueName( const uno::Sequence< rtl::OUString >& _slist, const rtl::OUString _sElementName, const rtl::OUString& _sSuffixSeparator, sal_Int32 _nStartSuffix)
--{
-- sal_Int32 a = _nStartSuffix;
-- rtl::OUString scompname = _sElementName;
-- bool bElementexists = true;
-- sal_Int32 nLen = _slist.getLength();
-- if ( nLen == 0 )
-- return _sElementName;
--
-- while (bElementexists == true)
-- {
-- for (sal_Int32 i = 0; i < nLen; i++)
-- {
-- if (FieldInList(_slist, scompname) == -1)
-- {
-- return scompname;
-- }
-- }
-- scompname = _sElementName + _sSuffixSeparator + rtl::OUString::valueOf( a++ );
-- }
-- return rtl::OUString();
--}
--
--sal_Int32
--ContainerUtilities::FieldInList( const uno::Sequence< rtl::OUString >& SearchList, const rtl::OUString& SearchString )
--{
-- sal_Int32 FieldLen = SearchList.getLength();
-- sal_Int32 retvalue = -1;
-- for (sal_Int32 i = 0; i < FieldLen; i++)
-- {
-- // I wonder why comparing lexicographically is done
-- // when its a match is whats interesting?
-- //if (SearchList[i].compareTo(SearchString) == 0)
-- if ( SearchList[i].equals( SearchString ) )
-- {
-- retvalue = i;
-- break;
-- }
-- }
-- return retvalue;
--
--}
--bool NeedEsc(sal_Unicode cCode)
--{
-- String sEsc(RTL_CONSTASCII_USTRINGPARAM(".^$+\\|{}()"));
-- return (STRING_NOTFOUND != sEsc.Search(cCode));
--}
--
--rtl::OUString VBAToRegexp(const rtl::OUString &rIn, bool bForLike )
--{
-- rtl::OUStringBuffer sResult;
-- const sal_Unicode *start = rIn.getStr();
-- const sal_Unicode *end = start + rIn.getLength();
--
-- int seenright = 0;
-- if ( bForLike )
-- sResult.append(static_cast<sal_Unicode>('^'));
--
-- while (start < end)
-- {
-- switch (*start)
-- {
-- case '?':
-- sResult.append(static_cast<sal_Unicode>('.'));
-- start++;
-- break;
-- case '*':
-- sResult.append(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".*")));
-- start++;
-- break;
-- case '#':
-- sResult.append(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("[0-9]")));
-- start++;
-- break;
-- case '~':
-- sResult.append(static_cast<sal_Unicode>('\\'));
-- sResult.append(*(++start));
-- start++;
-- break;
-- // dump the ~ and escape the next characture
-- case ']':
-- sResult.append(static_cast<sal_Unicode>('\\'));
-- sResult.append(*start++);
-- break;
-- case '[':
-- sResult.append(*start++);
-- seenright = 0;
-- while (start < end && !seenright)
-- {
-- switch (*start)
-- {
-- case '[':
-- case '?':
-- case '*':
-- sResult.append(static_cast<sal_Unicode>('\\'));
-- sResult.append(*start);
-- break;
-- case ']':
-- sResult.append(*start);
-- seenright = 1;
-- break;
-- case '!':
-- sResult.append(static_cast<sal_Unicode>('^'));
-- break;
-- default:
-- if (NeedEsc(*start))
-- sResult.append(static_cast<sal_Unicode>('\\'));
-- sResult.append(*start);
-- break;
-- }
-- start++;
-- }
-- break;
-- default:
-- if (NeedEsc(*start))
-- sResult.append(static_cast<sal_Unicode>('\\'));
-- sResult.append(*start++);
-- }
-- }
--
-- if ( bForLike )
-- sResult.append(static_cast<sal_Unicode>('$'));
--
-- return sResult.makeStringAndClear( );
--}
--
--double getPixelTo100thMillimeterConversionFactor( css::uno::Reference< css::awt::XDevice >& xDevice, sal_Bool bVertical)
--{
-- double fConvertFactor = 1.0;
-- if( bVertical )
-- {
-- fConvertFactor = xDevice->getInfo().PixelPerMeterY/100000;
-- }
-- else
-- {
-- fConvertFactor = xDevice->getInfo().PixelPerMeterX/100000;
-- }
-- return fConvertFactor;
--}
--
--double PointsToPixels( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical)
--{
-- double fConvertFactor = getPixelTo100thMillimeterConversionFactor( xDevice, bVertical );
-- return fPoints * POINTTO100THMILLIMETERFACTOR * fConvertFactor;
--}
--double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double fPixels, sal_Bool bVertical)
--{
-- double fConvertFactor = getPixelTo100thMillimeterConversionFactor( xDevice, bVertical );
-- return (fPixels/fConvertFactor)/POINTTO100THMILLIMETERFACTOR;
--}
--
--ConcreteXShapeGeometryAttributes::ConcreteXShapeGeometryAttributes( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape )
--{
-- m_xShape = new ScVbaShape( xContext, xShape );
--}
--
--#define VBA_LEFT "PositionX"
--#define VBA_TOP "PositionY"
--UserFormGeometryHelper::UserFormGeometryHelper( const uno::Reference< uno::XComponentContext >& /*xContext*/, const uno::Reference< awt::XControl >& xControl )
--{
-- mxModel.set( xControl->getModel(), uno::UNO_QUERY_THROW );
--}
-- double UserFormGeometryHelper::getLeft()
-- {
-- sal_Int32 nLeft = 0;
-- mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_LEFT ) ) ) >>= nLeft;
-- return Millimeter::getInPoints( nLeft );
-- }
-- void UserFormGeometryHelper::setLeft( double nLeft )
-- {
-- mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_LEFT ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nLeft ) ) );
-- }
-- double UserFormGeometryHelper::getTop()
-- {
-- sal_Int32 nTop = 0;
-- mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_TOP ) ) ) >>= nTop;
-- return Millimeter::getInPoints( nTop );
-- }
-- void UserFormGeometryHelper::setTop( double nTop )
-- {
-- mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_TOP ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nTop ) ) );
-- }
-- double UserFormGeometryHelper::getHeight()
-- {
-- sal_Int32 nHeight = 0;
-- mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CELLHGT ) ) ) >>= nHeight;
-- return Millimeter::getInPoints( nHeight );
-- }
-- void UserFormGeometryHelper::setHeight( double nHeight )
-- {
-- mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CELLHGT ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nHeight ) ) );
-- }
-- double UserFormGeometryHelper::getWidth()
-- {
-- sal_Int32 nWidth = 0;
-- mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CELLWID ) ) ) >>= nWidth;
-- return Millimeter::getInPoints( nWidth );
-- }
-- void UserFormGeometryHelper::setWidth( double nWidth)
-- {
-- mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CELLWID ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nWidth ) ) );
-- }
--
--SfxItemSet*
--ScVbaCellRangeAccess::GetDataSet( ScCellRangeObj* pRangeObj )
--{
-- SfxItemSet* pDataSet = pRangeObj ? pRangeObj->GetCurrentDataSet( true ) : NULL ;
-- return pDataSet;
--
--}
--
--} // openoffice
--} //org
---- sc/source/ui/vba/vbahelper.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbahelper.hxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--#ifndef SC_VBA_HELPER_HXX
--#define SC_VBA_HELPER_HXX
--
--#include <com/sun/star/drawing/XShape.hpp>
--#include <com/sun/star/beans/XIntrospectionAccess.hpp>
--#include <com/sun/star/script/BasicErrorException.hpp>
--#include <com/sun/star/script/XTypeConverter.hpp>
--#include <com/sun/star/lang/IllegalArgumentException.hpp>
--#include <com/sun/star/awt/XControl.hpp>
--#include <com/sun/star/awt/XDevice.hpp>
--#include <basic/sberrors.hxx>
--#include <cppuhelper/implbase1.hxx>
--#include <com/sun/star/frame/XModel.hpp>
--#include <docsh.hxx>
--#include <sfx2/dispatch.hxx>
--#include <ooo/vba/msforms/XShape.hpp>
--#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<sal_Int32>(points * factor);
-- return mm;
-- }
--
-- static double getInPoints(int _hmm)
-- {
-- double points = double( static_cast<double>(_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
---- sc/source/ui/vba/vbahelperinterface.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbahelperinterface.hxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--#ifndef SC_VBA_HELPERINTERFACE_HXX
--#define SC_VBA_HELPERINTERFACE_HXX
--
--#include <cppuhelper/implbase1.hxx>
--#include <ooo/vba/XHelperInterface.hpp>
--#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<rtl::OUString> 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
---- sc/source/ui/vba/vbahyperlink.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbahyperlink.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -32,7 +32,7 @@
- * MA 02111-1307 USA
- *
- ************************************************************************/
--#include "helperdecl.hxx"
-+#include <vbahelper/helperdecl.hxx>
- #include "vbahyperlink.hxx"
- #include <com/sun/star/container/XIndexAccess.hpp>
- #include <com/sun/star/text/XTextFieldsSupplier.hpp>
---- sc/source/ui/vba/vbahyperlink.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbahyperlink.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -40,7 +40,7 @@
- #include <com/sun/star/beans/XPropertySet.hpp>
- #include <ooo/vba/excel/XRange.hpp>
-
--#include "vbahelperinterface.hxx"
-+#include <vbahelper/vbahelperinterface.hxx>
-
- typedef InheritedHelperInterfaceImpl1< ov::excel::XHyperlink > HyperlinkImpl_BASE;
-
---- sc/source/ui/vba/vbaimage.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbaimage.cxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--#include "vbaimage.hxx"
--#include <vector>
--
--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;
--}
---- sc/source/ui/vba/vbaimage.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbaimage.hxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--#ifndef SC_VBA_IMAGE_HXX
--#define SC_VBA_IMAGE_HXX
--#include <cppuhelper/implbase1.hxx>
--#include <ooo/vba/msforms/XImage.hpp>
--
--#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<rtl::OUString> getServiceNames();
--};
--#endif //SC_VBA_IMAGE_HXX
---- sc/source/ui/vba/vbainterior.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbainterior.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -34,9 +34,10 @@
- #include <com/sun/star/uno/XComponentContext.hpp>
- #include <com/sun/star/beans/XPropertySet.hpp>
- #include <com/sun/star/container/XIndexAccess.hpp>
-+#include <com/sun/star/container/XNameContainer.hpp>
-
- #include <com/sun/star/script/XInvocation.hpp>
--#include "vbahelperinterface.hxx"
-+#include <vbahelper/vbahelperinterface.hxx>
-
- class ScDocument;
-
---- sc/source/ui/vba/vbalabel.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbalabel.cxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--#include "vbalabel.hxx"
--#include <vector>
--
--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;
--}
---- sc/source/ui/vba/vbalabel.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbalabel.hxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--#ifndef SC_VBA_LABEL_HXX
--#define SC_VBA_LABEL_HXX
--#include <cppuhelper/implbase1.hxx>
--#include <ooo/vba/msforms/XLabel.hpp>
--
--#include "vbacontrol.hxx"
--#include "vbahelper.hxx"
--#include <cppuhelper/implbase2.hxx>
--
--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<rtl::OUString> getServiceNames();
-- // XDefaultProperty
-- rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
--};
--#endif //SC_VBA_LABEL_HXX
---- sc/source/ui/vba/vbalineformat.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbalineformat.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -33,7 +33,7 @@
- #include <com/sun/star/drawing/XShape.hpp>
- #include <com/sun/star/beans/XPropertySet.hpp>
- #include <ooo/vba/msforms/XLineFormat.hpp>
--#include "vbahelperinterface.hxx"
-+#include <vbahelper/vbahelperinterface.hxx>
-
- typedef InheritedHelperInterfaceImpl1< ov::msforms::XLineFormat > ScVbaLineFormat_BASE;
-
---- sc/source/ui/vba/vbalistbox.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbalistbox.cxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--#include <com/sun/star/form/validation/XValidatableFormComponent.hpp>
--
--#include "vbalistbox.hxx"
--#include "vbapropvalue.hxx"
--#include <vector>
--#include <comphelper/anytostring.hxx>
--#include <com/sun/star/script/ArrayWrapper.hpp>
--
--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<sal_Int16>( 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<sal_Int16>( 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;
--}
---- sc/source/ui/vba/vbalistbox.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbalistbox.hxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--#ifndef SC_VBA_LISTBOX_HXX
--#define SC_VBA_LISTBOX_HXX
--#include <cppuhelper/implbase2.hxx>
--#include <com/sun/star/uno/XComponentContext.hpp>
--#include <com/sun/star/script/XDefaultProperty.hpp>
--#include <ooo/vba/msforms/XListBox.hpp>
--#include <com/sun/star/beans/PropertyAttribute.hpp>
--
--#include "vbacontrol.hxx"
--#include "vbapropvalue.hxx"
--#include "vbalistcontrolhelper.hxx"
--#include "vbahelper.hxx"
--
--typedef cppu::ImplInheritanceHelper2<ScVbaControl, ov::msforms::XListBox, css::script::XDefaultProperty > 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<rtl::OUString> getServiceNames();
--
-- //PropListener
-- virtual void setValueEvent( const css::uno::Any& value );
-- virtual css::uno::Any getValueEvent();
--
--
--};
--
--#endif //
---- sc/source/ui/vba/vbalistcontrolhelper.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbalistcontrolhelper.cxx 1970-01-01 00:00:00.000000000 +0000
-@@ -1,145 +0,0 @@
--#include <vbalistcontrolhelper.hxx>
--
--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;
--}
---- sc/source/ui/vba/vbalistcontrolhelper.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbalistcontrolhelper.hxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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
---- sc/source/ui/vba/vbamultipage.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbamultipage.cxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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 <ooo/vba/XCollection.hpp>
--#include "vbapages.hxx"
--#include <vector>
--
--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;
--}
---- sc/source/ui/vba/vbamultipage.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbamultipage.hxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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 <cppuhelper/implbase1.hxx>
--#include <ooo/vba/msforms/XMultiPage.hpp>
--#include <com/sun/star/container/XIndexAccess.hpp>
--
--#include "vbacontrol.hxx"
--#include "vbahelper.hxx"
--//#include <cppuhelper/implbase2.hxx>
--#include <cppuhelper/implbase1.hxx>
--
--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<rtl::OUString> getServiceNames();
-- // XDefaultProperty
-- rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
--};
--#endif //SC_VBA_LABEL_HXX
---- sc/source/ui/vba/vbaname.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbaname.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -27,7 +27,7 @@
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
--#include "helperdecl.hxx"
-+#include <vbahelper/helperdecl.hxx>
-
- #include <com/sun/star/table/XCellRange.hpp>
- #include <com/sun/star/sheet/XCellRangeAddressable.hpp>
-@@ -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 :
- 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;
- }
-
---- sc/source/ui/vba/vbaname.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbaname.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -34,7 +34,9 @@
- #include <com/sun/star/sheet/XNamedRange.hpp>
- #include <com/sun/star/sheet/XNamedRanges.hpp>
-
--#include "vbahelperinterface.hxx"
-+#include <vbahelper/vbahelperinterface.hxx>
-+
-+class ScDocument;
-
- typedef InheritedHelperInterfaceImpl1< ov::excel::XName > NameImpl_BASE;
-
---- sc/source/ui/vba/vbanames.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbanames.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -27,7 +27,7 @@
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
--#include "helperdecl.hxx"
-+#include <vbahelper/helperdecl.hxx>
-
- #include <com/sun/star/table/XCellRange.hpp>
- #include <com/sun/star/sheet/XCellRangeAddressable.hpp>
-@@ -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();
---- sc/source/ui/vba/vbanames.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbanames.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -34,7 +34,10 @@
- #include <ooo/vba/XCollection.hpp>
- #include <com/sun/star/container/XEnumerationAccess.hpp>
- #include <com/sun/star/sheet/XNamedRanges.hpp>
--#include "vbacollectionimpl.hxx"
-+#include <vbahelper/vbacollectionimpl.hxx>
-+
-+class ScDocument;
-+class ScDocShell;
-
- typedef CollTestImplHelper< ov::excel::XNames > ScVbaNames_BASE;
-
---- sc/source/ui/vba/vbaoleobject.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbaoleobject.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -35,7 +35,7 @@
- #include <com/sun/star/awt/XWindowPeer.hpp>
- #include <ooo/vba/excel/XOLEObject.hpp>
-
--#include "vbahelperinterface.hxx"
-+#include <vbahelper/vbahelperinterface.hxx>
-
- typedef InheritedHelperInterfaceImpl1< ov::excel::XOLEObject > OLEObjectImpl_BASE;
-
---- sc/source/ui/vba/vbaoleobjects.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbaoleobjects.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -33,8 +33,8 @@
- #include <cppuhelper/implbase1.hxx>
- #include <ooo/vba/excel/XOLEObjects.hpp>
-
--#include "vbacollectionimpl.hxx"
--#include "vbahelper.hxx"
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include "excelvbahelper.hxx"
-
- typedef CollTestImplHelper< ov::excel::XOLEObjects > OLEObjectsImpl_BASE;
-
---- sc/source/ui/vba/vbaoutline.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbaoutline.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -34,7 +34,7 @@
- #include <cppuhelper/implbase1.hxx>
- #include <ooo/vba/excel/XOutline.hpp>
- #include <com/sun/star/uno/XComponentContext.hpp>
--#include "vbahelperinterface.hxx"
-+#include <vbahelper/vbahelperinterface.hxx>
-
- typedef InheritedHelperInterfaceImpl1< ov::excel::XOutline > ScVbaOutline_BASE;
-
---- sc/source/ui/vba/vbapagebreak.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbapagebreak.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -38,7 +38,7 @@
- #include <com/sun/star/script/BasicErrorException.hpp>
- #include <com/sun/star/sheet/TablePageBreakData.hpp>
- #include <com/sun/star/beans/XPropertySet.hpp>
--#include "vbahelperinterface.hxx"
-+#include <vbahelper/vbahelperinterface.hxx>
-
- template< typename Ifc1 >
- class ScVbaPageBreak : public InheritedHelperInterfaceImpl1< Ifc1 >
---- sc/source/ui/vba/vbapagebreaks.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbapagebreaks.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -41,8 +41,8 @@
- #include <com/sun/star/beans/XPropertySet.hpp>
- #include <com/sun/star/container/XIndexAccess.hpp>
- #include <com/sun/star/table/XColumnRowRange.hpp>
--#include "vbahelperinterface.hxx"
--#include "vbacollectionimpl.hxx"
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <vbahelper/vbacollectionimpl.hxx>
-
- typedef CollTestImplHelper< ov::excel::XHPageBreaks > ScVbaHPageBreaks_BASE;
-
---- sc/source/ui/vba/vbapages.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbapages.cxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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;
--}
---- sc/source/ui/vba/vbapages.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbapages.hxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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 <ooo/vba/office/MsoShapeType.hpp>
--#include <com/sun/star/lang/XEventListener.hpp>
--#include <com/sun/star/beans/XPropertySet.hpp>
--#include <ooo/vba/msforms/XPages.hpp>
--#include <cppuhelper/implbase2.hxx>
--#include <cppuhelper/implbase1.hxx>
--
--#include "vbacollectionimpl.hxx"
--typedef CollTestImplHelper<
--ov::msforms::XPages > ScVbaPages_BASE;
--
--class ScVbaPages : public ScVbaPages_BASE
--{
--protected:
-- virtual rtl::OUString& getServiceImplName();
-- virtual css::uno::Sequence<rtl::OUString> 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
---- sc/source/ui/vba/vbapagesetup.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbapagesetup.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -31,6 +31,7 @@
- #include "cellsuno.hxx"
- #include "convuno.hxx"
- #include "rangelst.hxx"
-+#include "excelvbahelper.hxx"
- #include <com/sun/star/sheet/XPrintAreas.hpp>
- #include <com/sun/star/sheet/XHeaderFooterContent.hpp>
- #include <com/sun/star/text/XText.hpp>
-@@ -85,7 +86,7 @@ rtl::OUString SAL_CALL ScVbaPageSetup::g
- 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 +107,7 @@ void SAL_CALL ScVbaPageSetup::setPrintAr
- {
- 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;
---- sc/source/ui/vba/vbapagesetup.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbapagesetup.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -35,7 +35,7 @@
- #include <com/sun/star/uno/XComponentContext.hpp>
- #include <com/sun/star/sheet/XSpreadsheet.hpp>
- #include <com/sun/star/beans/XPropertySet.hpp>
--#include "vbahelperinterface.hxx"
-+#include <vbahelper/vbahelperinterface.hxx>
-
- typedef InheritedHelperInterfaceImpl1< ov::excel::XPageSetup > ScVbaPageSetup_BASE;
-
---- sc/source/ui/vba/vbapalette.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbapalette.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -30,7 +30,7 @@
- #ifndef SC_VBAPALETTE_HXX
- #define SC_VBAPALETTE_HXX
-
--#include "vbahelper.hxx"
-+#include "excelvbahelper.hxx"
- #include <document.hxx>
- #include <com/sun/star/container/XIndexAccess.hpp>
-
---- sc/source/ui/vba/vbapane.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbapane.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -34,7 +34,7 @@
- #include<com/sun/star/sheet/XViewPane.hpp>
- #include<ooo/vba/excel/XPane.hpp>
-
--#include"vbahelper.hxx"
-+#include"excelvbahelper.hxx"
-
- typedef cppu::WeakImplHelper1< ov::excel::XPane > PaneImpl_Base;
-
---- sc/source/ui/vba/vbapictureformat.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbapictureformat.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -33,7 +33,7 @@
- #include <com/sun/star/drawing/XShape.hpp>
- #include <com/sun/star/beans/XPropertySet.hpp>
- #include <ooo/vba/msforms/XPictureFormat.hpp>
--#include "vbahelperinterface.hxx"
-+#include <vbahelper/vbahelperinterface.hxx>
-
- typedef InheritedHelperInterfaceImpl1< ov::msforms::XPictureFormat > ScVbaPictureFormat_BASE;
-
---- sc/source/ui/vba/vbapivotcache.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbapivotcache.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -34,7 +34,7 @@
- #include <com/sun/star/sheet/XDataPilotTable.hpp>
-
- #include <ooo/vba/excel/XPivotCache.hpp>
--#include "vbahelperinterface.hxx"
-+#include <vbahelper/vbahelperinterface.hxx>
-
- typedef InheritedHelperInterfaceImpl1<ov::excel::XPivotCache > PivotCacheImpl_BASE;
-
---- sc/source/ui/vba/vbapivottable.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbapivottable.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -33,8 +33,8 @@
- #include <com/sun/star/uno/XComponentContext.hpp>
- #include <com/sun/star/sheet/XDataPilotTable.hpp>
- #include <ooo/vba/excel/XPivotTable.hpp>
--#include "vbahelper.hxx"
--#include "vbahelperinterface.hxx"
-+#include "excelvbahelper.hxx"
-+#include <vbahelper/vbahelperinterface.hxx>
-
- typedef InheritedHelperInterfaceImpl1< ov::excel::XPivotTable > PivotTableImpl_BASE;
-
---- sc/source/ui/vba/vbapivottables.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbapivottables.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -36,9 +36,9 @@
- #include <com/sun/star/container/XEnumerationAccess.hpp>
- #include <com/sun/star/uno/XComponentContext.hpp>
-
--#include "vbahelper.hxx"
--#include "vbahelperinterface.hxx"
--#include "vbacollectionimpl.hxx"
-+#include "excelvbahelper.hxx"
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <vbahelper/vbacollectionimpl.hxx>
-
-
- typedef CollTestImplHelper< ov::excel::XPivotTables > ScVbaPivotTables_BASE;
---- sc/source/ui/vba/vbaprogressbar.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbaprogressbar.cxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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 <vector>
--
--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;
--}
---- sc/source/ui/vba/vbaprogressbar.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbaprogressbar.hxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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 <cppuhelper/implbase1.hxx>
--#include <ooo/vba/msforms/XProgressBar.hpp>
--
--#include "vbacontrol.hxx"
--#include "vbahelper.hxx"
--#include <cppuhelper/implbase2.hxx>
--
--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<rtl::OUString> getServiceNames();
-- // XDefaultProperty
-- rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
--};
--#endif //SC_VBA_LABEL_HXX
---- sc/source/ui/vba/vbapropvalue.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbapropvalue.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -32,7 +32,7 @@
- #include <ooo/vba/XPropValue.hpp>
- #include <cppuhelper/implbase1.hxx>
-
--#include "vbahelper.hxx"
-+#include "excelvbahelper.hxx"
-
- typedef ::cppu::WeakImplHelper1< ov::XPropValue > PropValueImpl_BASE;
-
---- sc/source/ui/vba/vbaradiobutton.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbaradiobutton.cxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--#include "vbaradiobutton.hxx"
--#include <vector>
--
--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;
--}
---- sc/source/ui/vba/vbaradiobutton.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbaradiobutton.hxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--#ifndef SC_VBA_RADIOBUTTON_HXX
--#define SC_VBA_RADIOBUTTON_HXX
--#include <ooo/vba/msforms/XRadioButton.hpp>
--#include "vbacontrol.hxx"
--#include "vbahelper.hxx"
--#include <cppuhelper/implbase2.hxx>
--
--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<rtl::OUString> getServiceNames();
-- // XDefaultProperty
-- rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
--
--};
--#endif //SC_VBA_RADIOBUTTON_HXX
---- sc/source/ui/vba/vbarange.cxx.old 2009-04-06 16:42:00.000000000 +0000
-+++ sc/source/ui/vba/vbarange.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -27,7 +27,7 @@
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
--#include "helperdecl.hxx"
-+#include <vbahelper/helperdecl.hxx>
-
- #include <comphelper/unwrapargs.hxx>
- #include <comphelper/processfactory.hxx>
-@@ -146,7 +146,6 @@
- #include "rangelst.hxx"
- #include "convuno.hxx"
- #include "compiler.hxx"
--#include "formula/grammar.hxx"
- #include "attrib.hxx"
- #include "undodat.hxx"
- #include "dbdocfun.hxx"
-@@ -159,7 +158,7 @@
- #include "vbaglobals.hxx"
- #include "vbastyle.hxx"
- #include <vector>
--#include <vbacollectionimpl.hxx>
-+#include <vbahelper/vbacollectionimpl.hxx>
- // begin test includes
- #include <com/sun/star/sheet/FunctionArgument.hpp>
- // end test includes
-@@ -253,7 +252,7 @@ ScCellRangeObj* ScVbaRange::getCellRang
- 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;
-@@ -470,7 +469,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
-@@ -1999,7 +1998,7 @@ bool cellInRange( const table::CellRange
-
- void setCursor( const SCCOL& nCol, const SCROW& nRow, bool bInSel = true )
- {
-- ScTabViewShell* pShell = getCurrentBestViewShell();
-+ ScTabViewShell* pShell = excel::getCurrentBestViewShell();
- if ( pShell )
- {
- if ( bInSel )
-@@ -2210,7 +2209,7 @@ ScVbaRange::Copy(const ::uno::Any& Desti
- else
- {
- Select();
-- implnCopy();
-+ excel::implnCopy();
- }
- }
-
-@@ -2234,7 +2233,7 @@ ScVbaRange::Cut(const ::uno::Any& Destin
- }
- {
- Select();
-- implnCut();
-+ excel::implnCut();
- }
- }
-
-@@ -2564,7 +2563,7 @@ ScVbaRange::PasteSpecial( const uno::Any
-
- USHORT nFlags = getPasteFlags(nPaste);
- USHORT nFormulaBits = getPasteFormulaBits(nOperation);
-- implnPasteSpecial(nFlags,nFormulaBits,bSkipBlanks,bTranspose);
-+ excel::implnPasteSpecial(nFlags,nFormulaBits,bSkipBlanks,bTranspose);
- // restore selection
- xSelection->select( uno::makeAny( xSel ) );
- }
-@@ -3233,13 +3232,13 @@ ScVbaRange::End( ::sal_Int32 Direction )
-
- // 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();
-+ SfxViewFrame* pViewFrame = excel::getCurrentViewFrame();
- if ( pViewFrame )
- {
- SfxAllItemSet aArgs( SFX_APP()->GetPool() );
-@@ -3275,18 +3274,17 @@ ScVbaRange::End( ::sal_Int32 Direction )
- }
-
- // 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
-
-@@ -3749,7 +3747,7 @@ ScVbaRange::setPageBreak( const uno::Any
- 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 )
-@@ -4711,7 +4709,7 @@ ScVbaRange::PrintOut( const uno::Any& Fr
- {
- 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 );
- }
- }
- }
-@@ -5362,7 +5360,8 @@ sal_Bool SAL_CALL
- ScVbaRange::hasError() throw (uno::RuntimeException)
- {
- double dResult = sal_False;
-- uno::Reference< script::XInvocation > xInvoc( ScVbaGlobals::getGlobalsImpl( mxContext )->getApplication()->WorksheetFunction(), uno::UNO_QUERY_THROW );
-+ uno::Reference< excel::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW );
-+ uno::Reference< script::XInvocation > xInvoc( xApplication->WorksheetFunction(), uno::UNO_QUERY_THROW );
-
- static rtl::OUString FunctionName( RTL_CONSTASCII_USTRINGPARAM("IsError" ) );
- uno::Sequence< uno::Any > Params(1);
---- sc/source/ui/vba/vbarange.hxx.old 2009-04-06 16:42:00.000000000 +0000
-+++ sc/source/ui/vba/vbarange.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -53,12 +53,15 @@
- #include <com/sun/star/sheet/XSpreadsheet.hpp>
- #include <com/sun/star/sheet/XSheetCellRangeContainer.hpp>
-
--//#include "vbahelperinterface.hxx"
-+//#include <vbahelper/vbahelperinterface.hxx>
- #include "vbaformat.hxx"
-+#include <formula/grammar.hxx>
-
- class ScTableSheetsObj;
- class ScCellRangesBase;
- class ScCellRangeObj;
-+class ScDocShell;
-+class ScDocument;
-
- //typedef InheritedHelperInterfaceImpl1< ov::excel::XRange > ScVbaRange_BASE;
- typedef ScVbaFormat< ov::excel::XRange > ScVbaRange_BASE;
---- sc/source/ui/vba/vbascrollbar.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbascrollbar.cxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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 <vector>
--
--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;
--}
---- sc/source/ui/vba/vbascrollbar.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbascrollbar.hxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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 <cppuhelper/implbase1.hxx>
--#include <ooo/vba/msforms/XScrollBar.hpp>
--
--#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<rtl::OUString> getServiceNames();
--};
--#endif //SC_VBA_LABEL_HXX
---- sc/source/ui/vba/vbaseriescollection.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbaseriescollection.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -31,9 +31,9 @@
- #define SC_VBA_SERIESCOLLECTION_HXX
-
- #include <ooo/vba/excel/XSeriesCollection.hpp>
--#include "vbahelperinterface.hxx"
--#include "vbacollectionimpl.hxx"
--#include "vbahelper.hxx"
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include "excelvbahelper.hxx"
-
-
- typedef CollTestImplHelper< ov::excel::XSeriesCollection > SeriesCollection_BASE;
---- sc/source/ui/vba/vbashape.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbashape.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -39,7 +39,7 @@
- #include <ooo/vba/msforms/XLineFormat.hpp>
- #include <cppuhelper/implbase2.hxx>
-
--#include "vbahelperinterface.hxx"
-+#include <vbahelper/vbahelperinterface.hxx>
-
- typedef ::cppu::WeakImplHelper2< ov::msforms::XShape, css::lang::XEventListener > ListeningShape;
-
---- sc/source/ui/vba/vbashaperange.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbashaperange.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -30,6 +30,7 @@
- #include <com/sun/star/drawing/XShapeGrouper.hpp>
- #include <com/sun/star/drawing/XDrawPage.hpp>
-
-+#include "excelvbahelper.hxx"
- #include "vbashaperange.hxx"
- #include "vbashape.hxx"
-
---- sc/source/ui/vba/vbashaperange.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbashaperange.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -33,7 +33,7 @@
- #include <com/sun/star/drawing/XShapes.hpp>
- #include <ooo/vba/msforms/XShapeRange.hpp>
-
--#include "vbacollectionimpl.hxx"
-+#include <vbahelper/vbacollectionimpl.hxx>
-
- typedef CollTestImplHelper< ov::msforms::XShapeRange > ScVbaShapeRange_BASE;
-
---- sc/source/ui/vba/vbashapes.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbashapes.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -33,6 +33,7 @@
- #include <ooo/vba/msforms/XShapeRange.hpp>
- #include <ooo/vba/office/MsoAutoShapeType.hpp>
-
-+#include "excelvbahelper.hxx"
- #include "vbashapes.hxx"
- #include "vbashape.hxx"
- #include "vbashaperange.hxx"
---- sc/source/ui/vba/vbashapes.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbashapes.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -35,9 +35,9 @@
- #include <com/sun/star/container/XIndexAccess.hpp>
- #include <ooo/vba/msforms/XShapes.hpp>
-
--#include "vbahelperinterface.hxx"
-+#include <vbahelper/vbahelperinterface.hxx>
-
--#include "vbacollectionimpl.hxx"
-+#include <vbahelper/vbacollectionimpl.hxx>
-
- typedef CollTestImplHelper< ov::msforms::XShapes > ScVbaShapes_BASE;
-
---- sc/source/ui/vba/vbaspinbutton.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbaspinbutton.cxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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 <vector>
--
--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;
--}
---- sc/source/ui/vba/vbaspinbutton.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbaspinbutton.hxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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 <cppuhelper/implbase1.hxx>
--#include <ooo/vba/msforms/XSpinButton.hpp>
--
--#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<rtl::OUString> getServiceNames();
--};
--#endif //SC_VBA_SPINBUTTON_HXX
---- sc/source/ui/vba/vbastyles.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbastyles.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -29,6 +29,7 @@
- ************************************************************************/
- #include "vbastyles.hxx"
- #include "vbastyle.hxx"
-+#include <ooo/vba/excel/XRange.hpp>
-
- using namespace ::ooo::vba;
- using namespace ::com::sun::star;
---- sc/source/ui/vba/vbastyles.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbastyles.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -31,7 +31,7 @@
- #define SC_VBA_STYLES_HXX
- #include <ooo/vba/excel/XStyles.hpp>
- #include <com/sun/star/container/XNameContainer.hpp>
--#include "vbacollectionimpl.hxx"
-+#include <vbahelper/vbacollectionimpl.hxx>
-
- typedef CollTestImplHelper< ov::excel::XStyles > ScVbaStyles_BASE;
- class ScVbaStyles: public ScVbaStyles_BASE
---- sc/source/ui/vba/vbatextbox.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbatextbox.cxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--#include <com/sun/star/text/XTextRange.hpp>
--
--#include "vbatextbox.hxx"
--#include <vector>
--
--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;
--}
---- sc/source/ui/vba/vbatextbox.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbatextbox.hxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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
-- * <http://www.openoffice.org/license.html>
-- * for a copy of the LGPLv3 License.
-- *
-- ************************************************************************/
--#ifndef SC_VBA_TEXTBOX_HXX
--#define SC_VBA_TEXTBOX_HXX
--#include <cppuhelper/implbase1.hxx>
--#include <ooo/vba/msforms/XTextBox.hpp>
--#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<rtl::OUString> getServiceNames();
--};
--#endif //SC_VBA_TEXTBOX_HXX
---- sc/source/ui/vba/vbatextboxshape.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbatextboxshape.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -62,7 +62,7 @@ ScVbaTextBoxShape::setText( const rtl::O
- 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 )
---- sc/source/ui/vba/vbatextboxshape.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbatextboxshape.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -38,7 +38,7 @@
- #include <com/sun/star/text/XTextRange.hpp>
- #include <ooo/vba/msforms/XTextBoxShape.hpp>
- #include "vbashape.hxx"
--#include "vbahelper.hxx"
-+#include "excelvbahelper.hxx"
- #include "vbacharacters.hxx"
-
- typedef cppu::ImplInheritanceHelper1< ScVbaShape, ov::msforms::XTextBoxShape > TextBoxShapeImpl_BASE;
---- sc/source/ui/vba/vbatextframe.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbatextframe.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -34,7 +34,7 @@
- #include <ooo/vba/excel/XCharacters.hpp>
- #include <ooo/vba/excel/XTextFrame.hpp>
-
--#include "vbahelperinterface.hxx"
-+#include <vbahelper/vbahelperinterface.hxx>
- #include "vbapalette.hxx"
-
- typedef InheritedHelperInterfaceImpl1< ov::excel::XTextFrame > ScVbaTextFrame_BASE;
---- sc/source/ui/vba/vbatitle.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbatitle.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -30,14 +30,15 @@
- #ifndef SC_VBA_TITLE_HXX
- #define SC_VBA_TITLE_HXX
-
--#include "vbahelperinterface.hxx"
--#include "vbahelper.hxx"
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include "excelvbahelper.hxx"
- #include "vbainterior.hxx"
- #include "vbafont.hxx"
- #include "vbapalette.hxx"
- #include <com/sun/star/drawing/XShape.hpp>
- #include <com/sun/star/beans/XPropertySet.hpp>
- #include <ooo/vba/excel/XTitle.hpp>
-+#include <ooo/vba/excel/XCharacters.hpp>
- #include <basic/sberrors.hxx>
- #include <memory>
-
---- sc/source/ui/vba/vbatogglebutton.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbatogglebutton.cxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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 <vector>
--
--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;
--}
--
---- sc/source/ui/vba/vbatogglebutton.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbatogglebutton.hxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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 <cppuhelper/implbase2.hxx>
--#include <ooo/vba/msforms/XToggleButton.hpp>
--
--#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<rtl::OUString> getServiceNames();
-- // XDefaultProperty
-- rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
--};
--#endif //SC_VBA_TOGGLEBUTTON_HXX
---- sc/source/ui/vba/vbauserform.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbauserform.cxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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 <com/sun/star/awt/XControl.hpp>
--#include <com/sun/star/awt/XControlContainer.hpp>
--#include <com/sun/star/beans/PropertyConcept.hpp>
--#include <basic/sbx.hxx>
--#include <basic/sbstar.hxx>
--#include <basic/sbmeth.hxx>
--#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_<ScVbaUserForm, sdecl::with_args<true> > serviceImpl;
--extern sdecl::ServiceDecl const serviceDecl(
-- serviceImpl,
-- "ScVbaUserForm",
-- "ooo.vba.excel.UserForm" );
--}
--
---- sc/source/ui/vba/vbauserform.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbauserform.hxx 1970-01-01 00:00:00.000000000 +0000
-@@ -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 <cppuhelper/implbase1.hxx>
--#include <ooo/vba/msforms/XUserForm.hpp>
--#include <com/sun/star/awt/XDialog.hpp>
--#include <com/sun/star/frame/XModel.hpp>
--
--#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<rtl::OUString> getServiceNames();
--};
--#endif
---- sc/source/ui/vba/vbavalidation.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbavalidation.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -33,7 +33,7 @@
- #include <com/sun/star/uno/XComponentContext.hpp>
- #include <ooo/vba/excel/XValidation.hpp>
- #include <com/sun/star/table/XCellRange.hpp>
--#include "vbahelperinterface.hxx"
-+#include <vbahelper/vbahelperinterface.hxx>
-
- typedef InheritedHelperInterfaceImpl1<ov::excel::XValidation > ValidationImpl_BASE;
-
---- sc/source/ui/vba/vbawindow.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbawindow.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -27,10 +27,11 @@
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
--#include "helperdecl.hxx"
-+#include <vbahelper/helperdecl.hxx>
- #include "vbawindow.hxx"
- #include "vbaworksheets.hxx"
- #include "vbaworksheet.hxx"
-+#include "vbaglobals.hxx"
- #include "vbapane.hxx"
- #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
- #include <com/sun/star/sheet/XSpreadsheet.hpp>
-@@ -118,7 +119,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 +203,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 +306,7 @@ ScVbaWindow::getCaption() throw (uno::Ru
- 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 +342,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 +355,7 @@ ScVbaWindow::getScrollRow() throw (uno::
- 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 +370,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 +383,7 @@ ScVbaWindow::getScrollColumn() throw (un
- 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 +398,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 +420,7 @@ ScVbaWindow::setWindowState( const uno::
- {
- 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 +443,7 @@ ScVbaWindow::setWindowState( const uno::
- 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 +451,7 @@ ScVbaWindow::Activate() throw (css::uno:
- 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 +464,15 @@ ScVbaWindow::ActivePane() throw (script:
- 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
-@@ -759,7 +758,8 @@ ScVbaWindow::setZoom( const uno::Any& _z
- 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 +787,9 @@ ScVbaWindow::setView( const uno::Any& _v
- 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 +812,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&
---- sc/source/ui/vba/vbawindow.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbawindow.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -39,15 +39,16 @@
- #include <ooo/vba/excel/XPane.hpp>
- #include <com/sun/star/awt/XDevice.hpp>
-
--#include "vbahelperinterface.hxx"
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <vbahelper/vbawindowbase.hxx>
- #include "vbaworkbook.hxx"
-
--typedef InheritedHelperInterfaceImpl1<ov::excel::XWindow > WindowImpl_BASE;
-+//typedef InheritedHelperInterfaceImpl1<ov::excel::XWindow > 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);
---- sc/source/ui/vba/vbawindows.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbawindows.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -37,6 +37,7 @@
-
- #include <tools/urlobj.hxx>
- #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::R
- {
- }
-
-+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 (un
- 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)
---- sc/source/ui/vba/vbawindows.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbawindows.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -35,8 +35,8 @@
-
- #include <com/sun/star/uno/XComponentContext.hpp>
-
--#include "vbahelper.hxx"
--#include "vbacollectionimpl.hxx"
-+#include "excelvbahelper.hxx"
-+#include <vbahelper/vbacollectionimpl.hxx>
-
-
- typedef CollTestImplHelper< ov::excel::XWindows > ScVbaWindows_BASE;
-@@ -45,6 +45,7 @@ class ScVbaWindows : public ScVbaWindows
- {
- 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<rtl::OUString> getServiceNames();
---- sc/source/ui/vba/vbaworkbook.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbaworkbook.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -27,7 +27,7 @@
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
--#include "helperdecl.hxx"
-+#include <vbahelper/helperdecl.hxx>
- #include <tools/urlobj.hxx>
- #include <comphelper/unwrapargs.hxx>
-
-@@ -46,7 +46,7 @@
- #include "vbaworkbook.hxx"
- #include "vbawindows.hxx"
- #include "vbastyles.hxx"
--#include "vbahelper.hxx"
-+#include "excelvbahelper.hxx"
- #include "vbapalette.hxx"
- #include <osl/file.hxx>
- #include <stdio.h>
-@@ -192,7 +192,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,54 +203,18 @@ ScVbaWorkbook::ScVbaWorkbook( const css
- 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)
- {
-@@ -281,91 +245,19 @@ ScVbaWorkbook::Worksheets( const uno::An
- 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)
--{
-- 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)
-+void SAL_CALL
-+ScVbaWorkbook::Activate() 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() );
-+ VbaDocumentBase::Activate();
- }
-
--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() );
-- }
--}
--
- ::sal_Bool
- ScVbaWorkbook::getProtectStructure() throw (uno::RuntimeException)
- {
-@@ -373,28 +265,6 @@ ScVbaWorkbook::getProtectStructure() thr
- return xProt->isProtected();
- }
-
--void
--ScVbaWorkbook::setSaved( sal_Bool bSave ) throw (uno::RuntimeException)
--{
-- uno::Reference< util::XModifiable > xModifiable( getModel(), uno::UNO_QUERY_THROW );
-- xModifiable->setModified( bSave );
--}
--
--sal_Bool
--ScVbaWorkbook::getSaved() 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);
--}
--
- void
- ScVbaWorkbook::SaveCopyAs( const rtl::OUString& sFileName ) throw ( uno::RuntimeException)
- {
-@@ -407,13 +277,6 @@ ScVbaWorkbook::SaveCopyAs( const rtl::OU
- 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 +328,7 @@ ScVbaWorkbook::getCodeName() throw (css:
- {
- #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 +342,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;
---- sc/source/ui/vba/vbaworkbook.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbaworkbook.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -32,21 +32,20 @@
-
- #include <com/sun/star/frame/XModel.hpp>
- #include <ooo/vba/excel/XWorkbook.hpp>
--#include "vbahelperinterface.hxx"
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <vbahelper/vbadocumentbase.hxx>
-
- 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,25 +54,14 @@ 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);
-
- // 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);
-+ 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);
-
---- sc/source/ui/vba/vbaworkbooks.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbaworkbooks.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -56,7 +56,7 @@
- #include "vbaglobals.hxx"
- #include "vbaworkbook.hxx"
- #include "vbaworkbooks.hxx"
--#include "vbahelper.hxx"
-+#include <vbahelper/vbahelper.hxx>
-
- #include <hash_map>
- #include <osl/file.hxx>
-@@ -74,14 +74,14 @@ typedef std::vector < uno::Reference< sh
- 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) );
- }
-
-@@ -134,13 +134,14 @@ public:
-
- 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 );
- }
-
- };
-@@ -254,14 +255,14 @@ ScVbaWorkbooks::createEnumeration() thro
- // 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) ) );
-+ return new WorkBookEnumImpl( mxContext, uno::Reference< container::XEnumeration >( new SpreadSheetDocEnumImpl(mxContext) ), Application() );
- }
-
- uno::Any
- ScVbaWorkbooks::createCollectionObject( const css::uno::Any& aSource )
- {
- uno::Reference< sheet::XSpreadsheetDocument > xDoc( aSource, uno::UNO_QUERY );
-- return getWorkbook( mxContext, xDoc );
-+ return getWorkbook( mxContext, xDoc, Application() );
- }
-
-
-@@ -282,7 +283,7 @@ ScVbaWorkbooks::Add() throw (uno::Runtim
- uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( xComponent, uno::UNO_QUERY_THROW );
-
- if( xSpreadDoc.is() )
-- return getWorkbook( mxContext, xSpreadDoc );
-+ return getWorkbook( mxContext, xSpreadDoc, Application() );
- return uno::Any();
- }
-
-@@ -438,7 +439,7 @@ ScVbaWorkbooks::Open( const rtl::OUStrin
- frame::FrameSearchFlag::CREATE,
- sProps);
- uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( xComponent, uno::UNO_QUERY_THROW );
-- uno::Any aRet = getWorkbook( mxContext, xSpreadDoc );
-+ uno::Any aRet = getWorkbook( mxContext, xSpreadDoc, Application() );
- uno::Reference< excel::XWorkbook > xWBook( aRet, uno::UNO_QUERY );
- if ( xWBook.is() )
- xWBook->Activate();
---- sc/source/ui/vba/vbaworkbooks.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbaworkbooks.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -31,11 +31,10 @@
- #define SC_VBA_WORKBOOKS_HXX
-
-
--#include "vbacollectionimpl.hxx"
--#include <ooo/vba/XGlobals.hpp>
-+#include <vbahelper/vbacollectionimpl.hxx>
- #include <ooo/vba/excel/XWorkbooks.hpp>
- #include <com/sun/star/container/XEnumerationAccess.hpp>
--#include "vbahelper.hxx"
-+#include "excelvbahelper.hxx"
-
-
- class ScModelObj;
-@@ -45,7 +44,6 @@ typedef CollTestImplHelper< ov::excel::X
- 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 );
---- sc/source/ui/vba/vbaworksheet.cxx.old 2009-04-06 16:42:00.000000000 +0000
-+++ sc/source/ui/vba/vbaworksheet.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -27,7 +27,7 @@
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
--#include "helperdecl.hxx"
-+#include <vbahelper/helperdecl.hxx>
- #include <cppuhelper/queryinterface.hxx>
-
- #include <com/sun/star/beans/XPropertySet.hpp>
-@@ -59,6 +59,7 @@
- #include <com/sun/star/form/FormComponentType.hpp>
- #include <com/sun/star/form/XFormsSupplier.hpp>
- #include <ooo/vba/excel/XlEnableSelection.hpp>
-+#include <ooo/vba/XControlProvider.hpp>
-
- #include <comphelper/processfactory.hxx>
-
-@@ -83,7 +84,6 @@
- #include "vbaworksheet.hxx"
- #include "vbachartobjects.hxx"
- #include "vbapivottables.hxx"
--#include "vbacombobox.hxx"
- #include "vbaoleobject.hxx"
- #include "vbaoleobjects.hxx"
- #include "vbashapes.hxx"
-@@ -268,7 +268,7 @@ ScVbaWorksheet::getEnableSelection() thr
- if ( bSheetExists )
- {
- uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );
-- ScDocument* pDoc = getDocShell( xModel )->GetDocument();
-+ ScDocument* pDoc = excel::getDocShell( xModel )->GetDocument();
- ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
- sal_Bool bLockedCells = sal_False;
- sal_Bool bUnlockedCells = sal_False;
-@@ -308,7 +308,7 @@ ScVbaWorksheet::setEnableSelection( sal_
- if ( bSheetExists )
- {
- uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );
-- ScDocument* pDoc = getDocShell( xModel )->GetDocument();
-+ ScDocument* pDoc = excel::getDocShell( xModel )->GetDocument();
- ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
- // default is xlNoSelection
- sal_Bool bLockedCells = sal_False;
-@@ -431,11 +431,11 @@ ScVbaWorksheet::Move( const uno::Any& Be
- uno::Reference<excel::XRange> xRange = new ScVbaRange( this, mxContext, xRange1);
- if (xRange.is())
- xRange->Select();
-- implnCopy();
-+ excel::implnCopy();
- uno::Reference<frame::XModel> xModel = openNewDoc(aCurrSheetName);
- if (xModel.is())
- {
-- implnPaste();
-+ excel::implnPaste();
- Delete();
- }
- return ;
-@@ -469,11 +469,11 @@ ScVbaWorksheet::Copy( const uno::Any& Be
- uno::Reference<excel::XRange> xRange = new ScVbaRange( this, mxContext, xRange1);
- if (xRange.is())
- xRange->Select();
-- implnCopy();
-+ excel::implnCopy();
- uno::Reference<frame::XModel> xModel = openNewDoc(aCurrSheetName);
- if (xModel.is())
- {
-- implnPaste();
-+ excel::implnPaste();
- }
- return;
- }
-@@ -502,7 +502,7 @@ ScVbaWorksheet::Paste( const uno::Any& D
- uno::Reference<excel::XRange> xRange( Destination, uno::UNO_QUERY );
- if ( xRange.is() )
- xRange->Select();
-- implnPaste();
-+ excel::implnPaste();
- }
-
- void
-@@ -713,7 +713,7 @@ ScVbaWorksheet::ShowDataForm( ) throw (u
- {
- #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
-@@ -762,9 +762,11 @@ 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() ) );
-- return uno::makeAny( xControl );
-+
-+ uno::Reference<lang::XMultiComponentFactory > 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 );
- }
-
- ::sal_Bool SAL_CALL
-@@ -947,10 +949,9 @@ ScVbaWorksheet::PrintOut( const uno::Any
- 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;
---- sc/source/ui/vba/vbaworksheet.hxx.old 2009-04-06 16:42:00.000000000 +0000
-+++ sc/source/ui/vba/vbaworksheet.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -47,7 +47,8 @@
- #include <ooo/vba/excel/XChartObjects.hpp>
- #include <com/sun/star/container/XNamed.hpp>
-
--#include "vbahelperinterface.hxx"
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include "address.hxx"
-
- typedef InheritedHelperInterfaceImpl1< ov::excel::XWorksheet > WorksheetImpl_BASE;
-
---- sc/source/ui/vba/vbaworksheets.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbaworksheets.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -217,8 +217,8 @@ ScVbaWorksheets::Add( const uno::Any& Be
- }
- 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() );
-@@ -295,7 +295,7 @@ ScVbaWorksheets::PrintOut( const uno::An
- 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 +336,7 @@ ScVbaWorksheets::setVisible( const uno::
- 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 >() );
-
---- sc/source/ui/vba/vbaworksheets.hxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbaworksheets.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -36,9 +36,8 @@
- #include <com/sun/star/sheet/XSpreadsheets.hpp>
- #include <com/sun/star/container/XEnumerationAccess.hpp>
- #include <com/sun/star/uno/XComponentContext.hpp>
--#include <ooo/vba/XGlobals.hpp>
-
--#include "vbacollectionimpl.hxx"
-+#include <vbahelper/vbacollectionimpl.hxx>
-
- class ScModelObj;
-
---- sc/util/makefile.mk.old 2009-04-06 16:41:56.000000000 +0000
-+++ sc/util/makefile.mk 2009-04-06 16:42:01.000000000 +0000
-@@ -78,6 +78,7 @@ SHL1IMPLIB= sci
-
- # dynamic libraries
- SHL1STDLIBS= \
-+ $(VBAHELPERLIB) \
- $(BASICLIB) \
- $(SFXLIB) \
- $(SVTOOLLIB) \
-@@ -299,6 +300,7 @@ SHL9RPATH=OOO
- .ENDIF
-
- SHL9STDLIBS= \
-+ $(VBAHELPERLIB) \
- $(CPPUHELPERLIB) \
- $(VCLLIB) \
- $(CPPULIB) \
---- scp2/source/ooo/file_library_ooo.scp.old 2009-04-06 16:41:58.000000000 +0000
-+++ scp2/source/ooo/file_library_ooo.scp 2009-04-06 16:42:01.000000000 +0000
-@@ -406,7 +406,42 @@ File gid_File_Lib_Vbaobj
- #endif
- End
-
-+File gid_File_Lib_Vbaswobj
-+ TXT_FILE_BODY;
-+ Styles = (PACKED,UNO_COMPONENT);
-+ RegistryID = gid_Starregistry_Services_Rdb;
-+ Dir = gid_Dir_Program;
-+ #ifdef UNX
-+ Name = STRING(CONCAT4(libvbaswobj,DLLPOSTFIX,.uno,UNXSUFFIX));
-+ #else
-+ Name = STRING(CONCAT4(vbaswobj,DLLPOSTFIX,.uno,.dll));
-+ #endif
-+End
-+
-+File gid_File_Lib_Vbamsforms
-+ TXT_FILE_BODY;
-+ Styles = (PACKED,UNO_COMPONENT);
-+ RegistryID = gid_Starregistry_Services_Rdb;
-+ Dir = gid_Dir_Program;
-+ #ifdef UNX
-+ Name = STRING(CONCAT4(libmsforms,DLLPOSTFIX,.uno,UNXSUFFIX));
-+ #else
-+ Name = STRING(CONCAT4(msforms,DLLPOSTFIX,.uno,.dll));
-+ #endif
-+End
-+
- #endif // VBA_EXTENSION
-+File gid_File_Lib_Vbahelper
-+ TXT_FILE_BODY;
-+ Styles = (PACKED);
-+ RegistryID = gid_Starregistry_Services_Rdb;
-+ Dir = SCP2_OOO_BIN_DIR;
-+ #ifdef UNX
-+ Name = STRING(CONCAT3(libvbahelper,DLLPOSTFIX,UNXSUFFIX));
-+ #else
-+ Name = STRING(CONCAT3(vbahelper,DLLPOSTFIX,.dll));
-+ #endif
-+End
- #endif // ENABLE_VBA
-
-
---- scripting/source/vbaevents/eventhelper.cxx.old 2009-04-06 16:42:00.000000000 +0000
-+++ scripting/source/vbaevents/eventhelper.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -768,10 +768,27 @@ EventListener::firing_Impl(const ScriptE
- std::list< TranslateInfo >::const_iterator txInfo =
- eventInfo_it->second.begin();
- std::list< TranslateInfo >::const_iterator txInfo_end = eventInfo_it->second.end();
-- rtl::OUString sMacroLoc = rtl::OUString::createFromAscii("Standard.").concat( evt.ScriptCode ).concat( rtl::OUString::createFromAscii(".") );
-
- StarBASIC* pBasic = mpShell->GetBasic();
-+ BasicManager* pBasicManager = mpShell->GetBasicManager();
-+ //'Project' is a better default but I want to force failures
-+ //rtl::OUString sMacroLoc = rtl::OUString::createFromAscii("Project");
-+ rtl::OUString sProject = rtl::OUString::createFromAscii("Standard");
-+
-+ if ( pBasicManager->GetName().Len() > 0 )
-+ sProject = pBasicManager->GetName();
-+
-+ rtl::OUString sMacroLoc = sProject;
-+ sMacroLoc = sMacroLoc.concat( rtl::OUString::createFromAscii(".") );
-+ sMacroLoc = sMacroLoc.concat( evt.ScriptCode ).concat( rtl::OUString::createFromAscii(".") );
-+
-+ OSL_TRACE("sMacroLoc is %s", rtl::OUStringToOString( sMacroLoc, RTL_TEXTENCODING_UTF8 ).getStr() );
-+
-+ // find library
-+ pBasic = pBasicManager->GetLib( sProject );
-+
- SbModule* pModule = pBasic->FindModule( evt.ScriptCode );
-+
- for ( ; pModule && txInfo != txInfo_end; ++txInfo )
- {
- // see if we have a match for the handlerextension
---- sfx2/inc/sfx2/sfx.hrc.old 2009-04-02 10:44:03.000000000 +0000
-+++ sfx2/inc/sfx2/sfx.hrc 2009-04-06 16:42:01.000000000 +0000
-@@ -402,8 +402,10 @@
- #define MID_DOCINFO_ENCRYPTED 0x2c
- #define MID_DOCINFO_STATISTIC 0x33
- #define MID_DOCINFO_CHARLOCALE 0x34
--
--#define MID_LAST_USED_PROPID MID_DOCINFO_CHARLOCALE
-+#define MID_CATEGORY 0x35
-+#define MID_COMPANY 0x36
-+#define MID_MANAGER 0x37
-+#define MID_LAST_USED_PROPID MID_MANAGER
-
- // Config-Ids -----------------------------------------------------------
-
---- sfx2/inc/sfx2/sfxbasemodel.hxx.old 2009-04-02 10:44:03.000000000 +0000
-+++ sfx2/inc/sfx2/sfxbasemodel.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -1379,6 +1379,7 @@ protected:
- /* returns true if the document signatures are valid, otherwise false */
- sal_Bool hasValidSignatures() const;
-
-+ void setDocumentProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentProperties >& );
- //________________________________________________________________________________________________________
- // private methods
- //________________________________________________________________________________________________________
---- sfx2/source/appl/appuno.cxx.old 2009-04-02 10:44:02.000000000 +0000
-+++ sfx2/source/appl/appuno.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -2283,6 +2283,16 @@ SFX2_DLLPUBLIC sal_Bool SAL_CALL compone
- xNewKey = xKey->createKey( aTempStr );
- xNewKey->createKey( ::rtl::OUString::createFromAscii("com.sun.star.document.DocumentProperties") );
-
-+
-+ // writer compatable document properties
-+ aImpl = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/"));
-+ aImpl += comp_CompatWriterDocProps::_getImplementationName();
-+
-+ aTempStr = aImpl;
-+ aTempStr += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES"));
-+ xNewKey = xKey->createKey( aTempStr );
-+ xNewKey->createKey( ::rtl::OUString::createFromAscii("com.sun.star.writer.DocumentProperties") );
-+
- return sal_True;
- }
-
-@@ -2340,6 +2350,16 @@ SFX2_DLLPUBLIC void* SAL_CALL component_
- ::comp_SfxDocumentMetaData::_getImplementationName(),
- ::comp_SfxDocumentMetaData::_getSupportedServiceNames());
- }
-+ if ( ::comp_CompatWriterDocProps::_getImplementationName().equals(
-+ ::rtl::OUString::createFromAscii( pImplementationName ) ) )
-+ {
-+ xFactory = ::cppu::createSingleComponentFactory(
-+ ::comp_CompatWriterDocProps::_create,
-+ ::comp_CompatWriterDocProps::_getImplementationName(),
-+ ::comp_CompatWriterDocProps::_getSupportedServiceNames());
-+ }
-+
-+ // Factory is valid - service was found.
-
- // Factory is valid - service was found.
- if ( xFactory.is() )
---- sfx2/source/doc/SfxDocumentMetaData.cxx.old 2009-04-02 10:43:58.000000000 +0000
-+++ sfx2/source/doc/SfxDocumentMetaData.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -89,6 +89,10 @@
- #include <cstring>
- #include <limits>
-
-+
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/document/XCompatWriterDocProperties.hpp>
-+
- /**
- * This file contains the implementation of the service
- * com.sun.star.document.DocumentProperties.
-@@ -298,12 +302,12 @@ public:
- const css::uno::Sequence< css::beans::StringPair >& i_rNamespaces)
- throw (css::uno::RuntimeException, css::xml::sax::SAXException);
-
--private:
-+protected:
- SfxDocumentMetaData(SfxDocumentMetaData &); // not defined
- SfxDocumentMetaData& operator =(SfxDocumentMetaData &); // not defined
-
- virtual ~SfxDocumentMetaData() {}
--
-+ virtual SfxDocumentMetaData* createMe( css::uno::Reference< css::uno::XComponentContext > const & context ) { return new SfxDocumentMetaData( context ); };
- const css::uno::Reference< css::uno::XComponentContext > m_xContext;
-
- /// for notification
-@@ -377,6 +381,54 @@ private:
- // throw (css::uno::RuntimeException);
- };
-
-+typedef ::cppu::ImplInheritanceHelper1< SfxDocumentMetaData, css::document::XCompatWriterDocProperties > CompatWriterDocPropsImpl_BASE;
-+
-+class CompatWriterDocPropsImpl : public CompatWriterDocPropsImpl_BASE
-+{
-+ rtl::OUString msManager;
-+ rtl::OUString msCategory;
-+ rtl::OUString msCompany;
-+protected:
-+ virtual SfxDocumentMetaData* createMe( css::uno::Reference< css::uno::XComponentContext > const & context ) { return new CompatWriterDocPropsImpl( context ); };
-+public:
-+ CompatWriterDocPropsImpl( css::uno::Reference< css::uno::XComponentContext > const & context) : CompatWriterDocPropsImpl_BASE( context ) {}
-+// XCompatWriterDocPropsImpl
-+ virtual ::rtl::OUString SAL_CALL getManager() throw (::com::sun::star::uno::RuntimeException) { return msManager; }
-+ virtual void SAL_CALL setManager( const ::rtl::OUString& _manager ) throw (::com::sun::star::uno::RuntimeException) { msManager = _manager; }
-+ virtual ::rtl::OUString SAL_CALL getCategory() throw (::com::sun::star::uno::RuntimeException){ return msCategory; }
-+ virtual void SAL_CALL setCategory( const ::rtl::OUString& _category ) throw (::com::sun::star::uno::RuntimeException){ msCategory = _category; }
-+ virtual ::rtl::OUString SAL_CALL getCompany() throw (::com::sun::star::uno::RuntimeException){ return msCompany; }
-+ virtual void SAL_CALL setCompany( const ::rtl::OUString& _company ) throw (::com::sun::star::uno::RuntimeException){ msCompany = _company; }
-+
-+// XServiceInfo
-+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException)
-+ {
-+ return comp_CompatWriterDocProps::_getImplementationName();
-+ }
-+
-+ virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException)
-+ {
-+ css::uno::Sequence< rtl::OUString > sServiceNames= getSupportedServiceNames();
-+ sal_Int32 nLen = sServiceNames.getLength();
-+ rtl::OUString* pIt = sServiceNames.getArray();
-+ rtl::OUString* pEnd = ( pIt + nLen );
-+ sal_Bool bRes = sal_False;
-+ for ( ; pIt != pEnd; ++pIt )
-+ {
-+ if ( pIt->equals( ServiceName ) )
-+ {
-+ bRes = sal_True;
-+ break;
-+ }
-+ }
-+ return bRes;
-+ }
-+
-+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException)
-+ {
-+ return comp_CompatWriterDocProps::_getSupportedServiceNames();
-+ }
-+};
- ////////////////////////////////////////////////////////////////////////////
-
- bool operator== (const css::util::DateTime &i_rLeft,
-@@ -2149,7 +2201,7 @@ SfxDocumentMetaData::createClone()
- ::osl::MutexGuard g(m_aMutex);
- checkInit();
-
-- SfxDocumentMetaData *pNew = new SfxDocumentMetaData(m_xContext);
-+ SfxDocumentMetaData *pNew = createMe(m_xContext);
-
- // NB: do not copy the modification listeners, only DOM
- css::uno::Reference<css::xml::dom::XDocument> xDoc = createDOM();
-@@ -2266,6 +2318,32 @@ void SAL_CALL SfxDocumentMetaData::seria
-
-
- // component helper namespace
-+namespace comp_CompatWriterDocProps {
-+
-+ ::rtl::OUString SAL_CALL _getImplementationName() {
-+ return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
-+ "CompatWriterDocPropsImpl"));
-+}
-+
-+ css::uno::Sequence< ::rtl::OUString > SAL_CALL _getSupportedServiceNames()
-+ {
-+ static css::uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.writer.DocumentProperties" ) );
-+ }
-+ return aServiceNames;
-+ }
-+ css::uno::Reference< css::uno::XInterface > SAL_CALL _create(
-+ const css::uno::Reference< css::uno::XComponentContext > & context)
-+ SAL_THROW((css::uno::Exception))
-+ {
-+ return static_cast< ::cppu::OWeakObject * >
-+ (new CompatWriterDocPropsImpl(context));
-+ }
-+
-+}
- namespace comp_SfxDocumentMetaData {
-
- ::rtl::OUString SAL_CALL _getImplementationName() {
---- sfx2/source/doc/docinf.cxx.old 2009-04-02 10:43:58.000000000 +0000
-+++ sfx2/source/doc/docinf.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -37,6 +37,7 @@
- #include <com/sun/star/beans/XPropertySet.hpp>
- #include <com/sun/star/beans/XPropertyContainer.hpp>
- #include <com/sun/star/document/XDocumentProperties.hpp>
-+#include <com/sun/star/document/XCompatWriterDocProperties.hpp>
- #include <com/sun/star/uno/Exception.hpp>
-
- #include <rtl/ustring.hxx>
-@@ -46,7 +47,6 @@
- #include <vcl/gdimtf.hxx>
-
- #include "oleprops.hxx"
--
- // ============================================================================
-
- // stream names
-@@ -174,6 +174,28 @@ sal_uInt32 SFX2_DLLPUBLIC LoadOlePropert
- }
- }
- }
-+
-+ uno::Reference< document::XCompatWriterDocProperties > xWriterProps( i_xDocProps, uno::UNO_QUERY );
-+ if ( xWriterProps.is() )
-+ {
-+ SfxOleSectionRef xBuiltin = aDocSet.GetSection( SECTION_BUILTIN );
-+ if ( xBuiltin.get() )
-+ {
-+ try
-+ {
-+ String aStrValue;
-+ if ( xBuiltin->GetStringValue( aStrValue, PROPID_MANAGER ) )
-+ xWriterProps->setManager( aStrValue );
-+ if ( xBuiltin->GetStringValue( aStrValue, PROPID_CATEGORY ) )
-+ xWriterProps->setCategory( aStrValue );
-+ if ( xBuiltin->GetStringValue( aStrValue, PROPID_COMPANY ) )
-+ xWriterProps->setCompany( aStrValue );
-+ }
-+ catch ( uno::Exception& )
-+ {
-+ }
-+ }
-+ }
-
- // return code
- return (nGlobError != ERRCODE_NONE) ? nGlobError : nDocError;
---- sfx2/source/doc/objuno.cxx.old 2009-04-02 10:43:58.000000000 +0000
-+++ sfx2/source/doc/objuno.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -48,6 +48,7 @@
- #include <com/sun/star/lang/Locale.hpp>
- #include <com/sun/star/util/XModifiable.hpp>
- #include <com/sun/star/document/XDocumentProperties.hpp>
-+#include <com/sun/star/document/XCompatWriterDocProperties.hpp>
-
- #include <unotools/configmgr.hxx>
- #include <tools/inetdef.hxx>
-@@ -105,6 +106,9 @@ SfxItemPropertyMap aDocInfoPropertyMap_I
- { "AutoloadEnabled" , 15, MID_DOCINFO_AUTOLOADENABLED, &::getBooleanCppuType(), PROPERTY_UNBOUND, 0 },
- { "AutoloadSecs" , 12, MID_DOCINFO_AUTOLOADSECS, &::getCppuType((const sal_Int32*)0), PROPERTY_UNBOUND, 0 },
- { "AutoloadURL" , 11, MID_DOCINFO_AUTOLOADURL, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
-+ { "Category" , 8 , MID_CATEGORY, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
-+ { "Company" , 7 , MID_COMPANY, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
-+ { "Manager" , 7 , MID_MANAGER, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
- { "CreationDate" , 12, WID_DATE_CREATED, &::getCppuType((const ::com::sun::star::util::DateTime*)0),PROPERTY_MAYBEVOID, 0 },
- { "DefaultTarget" , 13, MID_DOCINFO_DEFAULTTARGET, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
- { "Description" , 11, MID_DOCINFO_DESCRIPTION, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
-@@ -824,6 +828,22 @@ void SAL_CALL SfxDocumentInfoObject::se
- _pImp->m_xDocProps->setDefaultTarget(sTemp);
- break;
- // case WID_CONTENT_TYPE : // this is readonly!
-+ case MID_CATEGORY:
-+ case MID_MANAGER:
-+ case MID_COMPANY:
-+ {
-+ uno::Reference< document::XCompatWriterDocProperties > xWriterProps( _pImp->m_xDocProps, uno::UNO_QUERY );
-+ if ( xWriterProps.is() )
-+ {
-+ if ( nHandle == MID_CATEGORY )
-+ xWriterProps->setCategory( sTemp );
-+ else if ( nHandle == MID_MANAGER )
-+ xWriterProps->setManager( sTemp );
-+ else
-+ xWriterProps->setCompany( sTemp );
-+ break;
-+ }
-+ }
- default:
- break;
- }
-@@ -1041,6 +1061,23 @@ void SAL_CALL SfxDocumentInfoObject::se
- case MID_DOCINFO_CHARLOCALE:
- aValue <<= _pImp->m_xDocProps->getLanguage();
- break;
-+ case MID_CATEGORY:
-+ case MID_MANAGER:
-+ case MID_COMPANY:
-+ {
-+ uno::Reference< document::XCompatWriterDocProperties > xWriterProps( _pImp->m_xDocProps, uno::UNO_QUERY );
-+ if ( xWriterProps.is() )
-+ {
-+ if ( nHandle == MID_CATEGORY )
-+ aValue <<= xWriterProps->getCategory();
-+ else if ( nHandle == MID_MANAGER )
-+ aValue <<= xWriterProps->getManager();
-+ else
-+ aValue <<= xWriterProps->getCompany();
-+ break;
-+ }
-+ }
-+
- default:
- aValue <<= ::rtl::OUString();
- break;
---- sfx2/source/doc/oleprops.hxx.old 2009-04-02 10:43:58.000000000 +0000
-+++ sfx2/source/doc/oleprops.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -83,6 +83,10 @@ const sal_Int32 PROPID_CREATED
- const sal_Int32 PROPID_LASTSAVED = 13;
- const sal_Int32 PROPID_THUMBNAIL = 17;
-
-+// some Builtin properties
-+const sal_Int32 PROPID_CATEGORY = 0x2;
-+const sal_Int32 PROPID_COMPANY = 0xf;
-+const sal_Int32 PROPID_MANAGER = 0xe;
- // predefined codepages
- const sal_uInt16 CODEPAGE_UNKNOWN = 0;
- const sal_uInt16 CODEPAGE_UNICODE = 1200;
---- sfx2/source/doc/sfxbasemodel.cxx.old 2009-04-02 10:43:58.000000000 +0000
-+++ sfx2/source/doc/sfxbasemodel.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -784,7 +784,15 @@ uno::Reference< document::XDocumentInfo
-
- return m_pData->m_xDocumentInfo;
- }
--
-+void
-+SfxBaseModel::setDocumentProperties( const uno::Reference< document::XDocumentProperties >& rxNewDocProps )
-+{
-+ // object already disposed?
-+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
-+ if ( impl_isDisposed() )
-+ throw lang::DisposedException();
-+ m_pData->m_xDocumentProperties.set(rxNewDocProps, uno::UNO_QUERY_THROW);
-+}
- // document::XDocumentPropertiesSupplier:
- uno::Reference< document::XDocumentProperties > SAL_CALL
- SfxBaseModel::getDocumentProperties()
---- sfx2/source/inc/SfxDocumentMetaData.hxx.old 2009-04-02 10:43:59.000000000 +0000
-+++ sfx2/source/inc/SfxDocumentMetaData.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -48,5 +48,16 @@ css::uno::Reference< css::uno::XInterfac
-
- } // closing component helper namespace
-
-+namespace comp_CompatWriterDocProps {
-+
-+namespace css = ::com::sun::star;
-+
-+// component and service helper functions:
-+::rtl::OUString SAL_CALL _getImplementationName();
-+css::uno::Sequence< ::rtl::OUString > SAL_CALL _getSupportedServiceNames();
-+css::uno::Reference< css::uno::XInterface > SAL_CALL _create(
-+ css::uno::Reference< css::uno::XComponentContext > const & context );
-+
-+}
- #endif
-
---- solenv/inc/libs.mk.old 2009-04-02 10:53:10.000000000 +0000
-+++ solenv/inc/libs.mk 2009-04-06 16:42:01.000000000 +0000
-@@ -192,6 +192,7 @@ SAXLIB=-lsax$(DLLPOSTFIX)
- MAILLIB=-lmail
- DOCMGRLIB=-ldmg$(DLLPOSTFIX)
- BASICLIB=-lsb$(DLLPOSTFIX)
-+VBAHELPERLIB=-lvbahelper$(DLLPOSTFIX)
- DBTOOLSLIB=-ldbtools$(DLLPOSTFIX)
- HM2LIBSH=-lhmwrpdll
- HM2LIBST=-lhmwrap
-@@ -433,6 +434,7 @@ SAXLIB=isax.lib
- MAILLIB=mail.lib
- DOCMGRLIB=docmgr.lib
- BASICLIB=basic.lib
-+VBAHELPERLIB=vbahelper.lib
- TKTLIB=tkt.lib
- SJLIB=sj.lib
- SVXLIB=isvx.lib
---- svx/inc/svx/mstoolbar.hxx.old 2009-04-06 16:42:00.000000000 +0000
-+++ svx/inc/svx/mstoolbar.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -27,6 +27,7 @@ public:
- virtual rtl::OUString MSOTCIDToOOCommand( sal_Int16 msoTCID ) = 0;
- };
-
-+class SfxObjectShell;
-
- class SVX_DLLPUBLIC CustomToolBarImportHelper
- {
-@@ -39,16 +40,16 @@ class SVX_DLLPUBLIC CustomToolBarImportH
- std::auto_ptr< MSOCommandConvertor > pMSOCmdConvertor;
- css::uno::Reference< css::ui::XUIConfigurationManagerSupplier > m_xCfgSupp;
- css::uno::Reference< css::ui::XUIConfigurationManager > m_xAppCfgMgr;
--
-+ SfxObjectShell& mrDocSh;
- public:
-- CustomToolBarImportHelper( const css::uno::Reference< css::frame::XModel >& rxModel, const css::uno::Reference< css::ui::XUIConfigurationManager >& rxAppCfgMgr );
-+ CustomToolBarImportHelper( SfxObjectShell& rDocSh, const css::uno::Reference< css::ui::XUIConfigurationManager >& rxAppCfgMgr );
-
- void setMSOCommandMap( MSOCommandConvertor* pCnvtr ) { pMSOCmdConvertor.reset( pCnvtr ); }
- css::uno::Reference< css::ui::XUIConfigurationManager > getCfgManager();
- css::uno::Reference< css::ui::XUIConfigurationManager > getAppCfgManager();
-
-
-- static css::uno::Any createCommandFromMacro( const rtl::OUString& sCmd );
-+ css::uno::Any createCommandFromMacro( const rtl::OUString& sCmd );
-
- void addIcon( const css::uno::Reference< css::graphic::XGraphic >& xImage, const rtl::OUString& sString );
- void applyIcons();
-@@ -131,7 +132,7 @@ public:
- ~TBCGeneralInfo() {}
- bool Read(SvStream *pS);
- void Print( FILE* );
-- bool ImportToolBarControlData( std::vector< css::beans::PropertyValue >& );
-+ bool ImportToolBarControlData( CustomToolBarImportHelper&, std::vector< css::beans::PropertyValue >& );
- };
-
- class SVX_DLLPUBLIC TBCBitMap : public TBBase
---- svx/inc/svxmsbas.hxx.old 2009-04-06 16:42:00.000000000 +0000
-+++ svx/inc/svxmsbas.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -59,6 +59,8 @@ typedef std::hash_map< sal_Int32, String
-
- typedef std::map< String, ObjIdToName > ControlAttributeInfo;
-
-+class VBA_Impl;
-+
- class SVX_DLLPUBLIC SvxImportMSVBasic
- {
- ControlAttributeInfo m_ModuleNameToObjIdHash;
-@@ -102,6 +104,9 @@ private:
- const String &rSubStorageName, BOOL bVBAMode );
- SVX_DLLPRIVATE BOOL CopyStorage_Impl( const String& rStorageName,
- const String &rSubStorageName);
-+ rtl::OUString msProjectName;
-+ SVX_DLLPRIVATE BOOL ImportCode_Impl( VBA_Impl&, BOOL, BOOL );
-+ SVX_DLLPRIVATE bool ImportForms_Impl( VBA_Impl&, const String&, const String&, BOOL);
- };
-
- #endif
---- svx/source/msfilter/mstoolbar.cxx.old 2009-04-06 16:42:00.000000000 +0000
-+++ svx/source/msfilter/mstoolbar.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -8,6 +8,8 @@
- #include <vcl/graph.hxx>
- #include <vcl/bitmapex.hxx>
- #include <map>
-+#include <sfx2/objsh.hxx>
-+#include <basic/basmgr.hxx>
-
- int TBBase::nIndent = 0;
-
-@@ -36,9 +38,9 @@ void CustomToolBarImportHelper::addIcon(
- iconcommands.push_back( item );
- }
-
--CustomToolBarImportHelper::CustomToolBarImportHelper( const uno::Reference< frame::XModel >& rxModel, const css::uno::Reference< css::ui::XUIConfigurationManager>& rxAppCfgMgr )
-+CustomToolBarImportHelper::CustomToolBarImportHelper( SfxObjectShell& rDocShell, const css::uno::Reference< css::ui::XUIConfigurationManager>& rxAppCfgMgr ) : mrDocSh( rDocShell )
- {
-- m_xCfgSupp.set( rxModel, uno::UNO_QUERY_THROW );
-+ m_xCfgSupp.set( mrDocSh.GetModel(), uno::UNO_QUERY_THROW );
- m_xAppCfgMgr.set( rxAppCfgMgr, uno::UNO_QUERY_THROW );
- }
-
-@@ -58,10 +60,18 @@ uno::Any
- CustomToolBarImportHelper::createCommandFromMacro( const rtl::OUString& sCmd )
- {
- //"vnd.sun.star.script:Standard.Module1.Main?language=Basic&location=document"
-- static rtl::OUString part1 = rtl::OUString::createFromAscii( "vnd.sun.star.script:Standard.");
-+ static rtl::OUString scheme = rtl::OUString::createFromAscii( "vnd.sun.star.script:");
- static rtl::OUString part2 = rtl::OUString::createFromAscii("?language=Basic&location=document");
-+ rtl::OUString sProject( RTL_CONSTASCII_USTRINGPARAM("Standard") );
-+ if ( mrDocSh.GetBasicManager()->GetName().Len() )
-+ sProject = mrDocSh.GetBasicManager()->GetName();
-+ sProject += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".") );
-+
-+ // #TODO #FIXME a script can also be loosly defined ( e.g. with no module
-+ // spec )
-+
- // create script url
-- rtl::OUString scriptURL = part1 + sCmd + part2;
-+ rtl::OUString scriptURL = scheme + sProject + sCmd + part2;
- return uno::makeAny( scriptURL );
- }
-
-@@ -197,7 +207,7 @@ bool TBCData::Read(SvStream *pS)
-
- bool TBCData::ImportToolBarControl( const css::uno::Reference< css::container::XIndexContainer >& /*toolbarcontainer*/, CustomToolBarImportHelper& helper, std::vector< css::beans::PropertyValue >& props )
- {
-- controlGeneralInfo.ImportToolBarControlData( props );
-+ controlGeneralInfo.ImportToolBarControlData( helper, props );
- beans::PropertyValue aProp;
- aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Visible") ) ;
- aProp.Value = uno::makeAny( rHeader.isVisible() ); // where is the visible attribute stored
-@@ -356,7 +366,7 @@ TBCGeneralInfo::Print( FILE* fp )
- }
-
- bool
--TBCGeneralInfo::ImportToolBarControlData( std::vector< beans::PropertyValue >& sControlData )
-+TBCGeneralInfo::ImportToolBarControlData( CustomToolBarImportHelper& helper, std::vector< beans::PropertyValue >& sControlData )
- {
- if ( ( bFlags & 0x5 ) )
- {
-@@ -366,7 +376,7 @@ TBCGeneralInfo::ImportToolBarControlData
- if ( extraInfo.getOnAction().getLength() )
- {
- aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CommandURL") );
-- aProp.Value = CustomToolBarImportHelper::createCommandFromMacro( extraInfo.getOnAction() );
-+ aProp.Value = helper.createCommandFromMacro( extraInfo.getOnAction() );
- sControlData.push_back( aProp );
- }
-
-@@ -379,7 +389,7 @@ TBCGeneralInfo::ImportToolBarControlData
- sControlData.push_back( aProp );
-
- aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HelpURL") );
-- aProp.Value = uno::makeAny( CustomToolBarImportHelper::createCommandFromMacro( tooltip.getString() ) );
-+ aProp.Value = uno::makeAny( helper.createCommandFromMacro( tooltip.getString() ) );
- sControlData.push_back( aProp );
-
- // #TODO find out what is the property for tooltip?
---- svx/source/msfilter/msvbasic.cxx.old 2009-04-06 16:41:59.000000000 +0000
-+++ svx/source/msfilter/msvbasic.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -40,9 +40,929 @@
- #include <osl/endian.h>
- #include <rtl/tencinfo.h> //rtl_getTextEncodingFromWindowsCodePage
- #include "msvbasic.hxx"
-+#include <fstream>
-+#include <memory>
-+#include <rtl/ustrbuf.hxx>
-
- using namespace ::com::sun::star::script;
-
-+// #FIXME this routine is stolen from msocximex ( needs to be somewhere central )
-+
-+const sal_uInt32 SVX_MSOCX_SIZEMASK = 0x7FFFFFFF; /// Mask for character buffer size.
-+const sal_uInt32 SVX_MSOCX_COMPRESSED = 0x80000000;
-+
-+inline bool lclIsCompressed( sal_uInt32 nLenFld )
-+{
-+ return (nLenFld & SVX_MSOCX_COMPRESSED) != 0;
-+}
-+
-+
-+/** Extracts and returns the memory size of the character buffer.
-+ @return Character buffer size (may differ from resulting string length!).
-+ */
-+inline sal_uInt32 lclGetBufferSize( sal_uInt32 nLenFld )
-+{
-+ return nLenFld & SVX_MSOCX_SIZEMASK;
-+}
-+/** Creates an OUString from a character array created with lclReadCharArray().
-+
-+ The passed parameters must match, that means the length field must be the
-+ same used to create the passed character array.
-+
-+ @param pcCharArr
-+ The character array returned by lclReadCharArray(). May be compressed
-+ or uncompressed, next parameter nLenFld will specify this.
-+
-+ @param nLenFld
-+ MUST be the same string length field that has been passed to
-+ lclReadCharArray() to create the character array in previous parameter
-+ pcCharArr.
-+
-+ @return
-+ An OUString containing the decoded string data. Will be empty if
-+ pcCharArr is 0.
-+ */
-+rtl::OUString lclCreateOUString( const char* pcCharArr, sal_uInt32 nLenFld )
-+{
-+ rtl::OUStringBuffer aBuffer;
-+ sal_uInt32 nBufSize = lclGetBufferSize( nLenFld );
-+ if( lclIsCompressed( nLenFld ) )
-+ {
-+ // buffer contains compressed Unicode, not encoded bytestring
-+ sal_Int32 nStrLen = static_cast< sal_Int32 >( nBufSize );
-+ aBuffer.setLength( nStrLen );
-+ const char* pcCurrChar = pcCharArr;
-+ for( sal_Int32 nChar = 0; nChar < nStrLen; ++nChar, ++pcCurrChar )
-+ /* *pcCurrChar may contain negative values and therefore MUST be
-+ casted to unsigned char, before assigned to a sal_Unicode. */
-+ aBuffer.setCharAt( nChar, static_cast< unsigned char >( *pcCurrChar ) );
-+ }
-+ else
-+ {
-+ // buffer contains Little-Endian Unicode
-+ sal_Int32 nStrLen = static_cast< sal_Int32 >( nBufSize ) / 2;
-+ aBuffer.setLength( nStrLen );
-+ const char* pcCurrChar = pcCharArr;
-+ for( sal_Int32 nChar = 0; nChar < nStrLen; ++nChar )
-+ {
-+ /* *pcCurrChar may contain negative values and therefore MUST be
-+ casted to unsigned char, before assigned to a sal_Unicode. */
-+ sal_Unicode cChar = static_cast< unsigned char >( *pcCurrChar++ );
-+ cChar |= (static_cast< unsigned char >( *pcCurrChar++ ) << 8);
-+ aBuffer.setCharAt( nChar, cChar );
-+ }
-+ }
-+ return aBuffer.makeStringAndClear();
-+}
-+
-+
-+namespace MSLZSS {
-+
-+static unsigned int getShift( sal_uInt32 nPos )
-+{
-+ if (nPos <= 0x80) {
-+ if (nPos <= 0x20)
-+ return (nPos <= 0x10) ? 12 : 11;
-+ else
-+ return (nPos <= 0x40) ? 10 : 9;
-+ } else {
-+ if (nPos <= 0x200)
-+ return (nPos <= 0x100) ? 8 : 7;
-+ else if (nPos <= 0x800)
-+ return (nPos <= 0x400) ? 6 : 5;
-+ else
-+ return 4;
-+ }
-+}
-+
-+SvMemoryStream *decompressAsStream( SvStream *pStream, sal_uInt32 nOffset, sal_uInt32 *pCompressedLength = NULL, sal_uInt32 *pLength = NULL )
-+{
-+ SvMemoryStream *pResult;
-+ const sal_Int32 nWINDOWLEN = 4096;
-+ pResult = new SvMemoryStream();
-+
-+ sal_uInt8 nLeadbyte;
-+ unsigned int nPos = 0;
-+ int nLen, nDistance, nShift, nClean=1;
-+ sal_uInt8 aHistory[ nWINDOWLEN ];
-+
-+ pStream->Seek( nOffset + 3 );
-+
-+ while( pStream->Read( &nLeadbyte, 1 ) )
-+ {
-+ for(int nMask=0x01; nMask < 0x100; nMask = nMask<<1)
-+ {
-+ // we see if the leadbyte has flagged this location as a dataunit
-+ // which is actually a token which must be looked up in the history
-+ if( nLeadbyte & nMask )
-+ {
-+ sal_uInt16 nToken;
-+
-+ *pStream >> nToken;
-+
-+ if (nClean == 0)
-+ nClean=1;
-+
-+ //For some reason the division of the token into the length
-+ //field of the data to be inserted, and the distance back into
-+ //the history differs depending on how full the history is
-+ nShift = getShift( nPos % nWINDOWLEN );
-+
-+ nLen = (nToken & ((1<<nShift) - 1)) + 3;
-+ nDistance = nToken >> nShift;
-+
-+ //read the len of data from the history, wrapping around the
-+ //nWINDOWLEN boundary if necessary data read from the history
-+ //is also copied into the recent part of the history as well.
-+ for (int i = 0; i < nLen; i++)
-+ {
-+ unsigned char c;
-+ c = aHistory[(nPos-nDistance-1) % nWINDOWLEN];
-+ aHistory[nPos % nWINDOWLEN] = c;
-+ nPos++;
-+ }
-+ }
-+ else
-+ {
-+ // special boundary case code, not guarantueed to be correct
-+ // seems to work though, there is something wrong with the
-+ // compression scheme (or maybe a feature) where when the data
-+ // ends on a nWINDOWLEN boundary and the excess bytes in the 8
-+ // dataunit list are discarded, and not interpreted as tokens
-+ // or normal data.
-+ if ((nPos != 0) && ((nPos % nWINDOWLEN) == 0) && (nClean))
-+ {
-+ pStream->SeekRel(2);
-+ nClean=0;
-+ pResult->Write( aHistory, nWINDOWLEN );
-+ break;
-+ }
-+ //This is the normal case for when the data unit is not a
-+ //token to be looked up, but instead some normal data which
-+ //can be output, and placed in the history.
-+ if (pStream->Read(&aHistory[nPos % nWINDOWLEN],1))
-+ nPos++;
-+
-+ if (nClean == 0)
-+ nClean=1;
-+ }
-+ }
-+ }
-+ if (nPos % nWINDOWLEN)
-+ pResult->Write( aHistory, nPos % nWINDOWLEN );
-+ pResult->Flush();
-+
-+ if( pCompressedLength )
-+ *pCompressedLength = nPos;
-+
-+ if( pLength )
-+ *pLength = pResult->Tell();
-+
-+ pResult->Seek( 0 );
-+
-+ return pResult;
-+}
-+
-+} //MSZSS
-+
-+// also _VBA_PROJECT_VDPI can be used to create a usable
-+// ( and much smaller ) "_VBA_PROJECT" stream
-+
-+// _VBA_PROJECT Stream Version Dependant Project Information
-+// _VBA_PROJECT Stream Version Dependant Project Information
-+
-+class _VBA_PROJECT_VDPI
-+{
-+public:
-+sal_Int16 Reserved1;
-+sal_Int16 Version;
-+sal_Int8 Reserved2;
-+sal_Int16 Reserved3;
-+sal_uInt8* PerformanceCache;
-+sal_Int32 PerformanceCacheSize;
-+_VBA_PROJECT_VDPI(): Reserved1( 0x61CC), Version( 0xFFFF ), Reserved2(0x0), Reserved3(0x0), PerformanceCache(0), PerformanceCacheSize(0) {}
-+~_VBA_PROJECT_VDPI()
-+{
-+ if ( PerformanceCache )
-+ delete [] PerformanceCache;
-+ PerformanceCache = 0;
-+ PerformanceCacheSize = 0;
-+}
-+void read(){}
-+void write( SvStream* pStream )
-+{
-+ *pStream << Reserved1 << Version << Reserved2 << Reserved3;
-+ for( sal_Int32 i = 0; PerformanceCache && i < PerformanceCacheSize; ++i )
-+ {
-+ *pStream >> PerformanceCache[ i ];
-+ }
-+}
-+};
-+
-+class ProjectSysKindRecord
-+{
-+public:
-+sal_Int16 Id;
-+sal_Int32 Size;
-+sal_Int32 SysKind;
-+ProjectSysKindRecord(): Id(0x1), Size(0x4), SysKind( 0x1 ) {}
-+void read( SvStream* pStream )
-+{
-+ *pStream >> Id >> Size >> SysKind;
-+}
-+};
-+
-+class ProjectLcidRecord
-+{
-+public:
-+sal_Int16 Id;
-+sal_Int32 Size;
-+sal_Int32 Lcid;
-+
-+ProjectLcidRecord() : Id( 0x2 ), Size( 0x4 ), Lcid( 0x409 ) {}
-+void read( SvStream* pStream )
-+{
-+ OSL_TRACE("ProjectLcidRecord [0x%x]", pStream->Tell() );
-+ *pStream >> Id >> Size >> Lcid;
-+}
-+};
-+
-+class ProjectLcidInvokeRecord
-+{
-+sal_Int16 Id;
-+sal_Int32 Size;
-+sal_Int32 LcidInvoke;
-+public:
-+ProjectLcidInvokeRecord() : Id( 0x14 ), Size( 0x4 ), LcidInvoke( 0x409 ) {}
-+void read( SvStream* pStream )
-+{
-+ OSL_TRACE("ProjectLcidInvokeRecord [0x%x]", pStream->Tell() );
-+ *pStream >> Id >> Size >> LcidInvoke;
-+}
-+};
-+
-+class ProjectCodePageRecord
-+{
-+sal_Int16 Id;
-+sal_Int32 Size;
-+sal_Int16 CodePage;
-+public:
-+// #FIXME get a better default for the CodePage
-+ProjectCodePageRecord() : Id( 0x03 ), Size( 0x2 ), CodePage( 0x0 ) {}
-+void read( SvStream* pStream )
-+{
-+ OSL_TRACE("ProjectCodePageRecord [0x%x]", pStream->Tell() );
-+ *pStream >> Id >> Size >> CodePage;
-+}
-+};
-+class ProjectNameRecord
-+{
-+public:
-+sal_Int16 Id;
-+sal_Int32 SizeOfProjectName;
-+sal_uInt8* ProjectName;
-+rtl::OUString msProjectName;
-+ProjectNameRecord() : Id( 0x04 ), SizeOfProjectName( 0x0 ), ProjectName(0) {}
-+~ProjectNameRecord()
-+{
-+ delete [] ProjectName;
-+ ProjectName = 0;
-+}
-+void read( SvStream* pStream )
-+{
-+ OSL_TRACE("ProjectNameRecord [0x%x]", pStream->Tell() );
-+ *pStream >> Id >> SizeOfProjectName;
-+ if ( ProjectName )
-+ delete [] ProjectName;
-+
-+ if ( SizeOfProjectName )
-+ {
-+ ProjectName = new sal_uInt8[ SizeOfProjectName ];
-+ OSL_TRACE("ProjectNameRecord about to read name from [0x%x], size %d", pStream->Tell(), SizeOfProjectName );
-+ pStream->Read( ProjectName, SizeOfProjectName );
-+ msProjectName = lclCreateOUString( reinterpret_cast< const char* >( ProjectName ), ( SVX_MSOCX_COMPRESSED | SizeOfProjectName ) );
-+ }
-+}
-+};
-+
-+class ProjectDocStringRecord
-+{
-+public:
-+sal_Int16 Id;
-+sal_Int32 SizeOfDocString;
-+sal_uInt8* DocString;
-+sal_Int16 Reserved;
-+sal_Int32 SizeOfDocStringUnicode;
-+sal_uInt8* DocStringUnicode;
-+
-+ProjectDocStringRecord() : Id( 0x5 ), SizeOfDocString( 0x0 ), DocString( 0 ), Reserved( 0x0 ), SizeOfDocStringUnicode( 0 ), DocStringUnicode( 0 ) {}
-+
-+~ProjectDocStringRecord()
-+{
-+ delete [] DocString;
-+ delete [] DocStringUnicode;
-+ DocString = 0;
-+ DocStringUnicode = 0;
-+}
-+void read( SvStream* pStream )
-+{
-+ OSL_TRACE("ProjectDocStringRecord [0x%x]", pStream->Tell() );
-+ *pStream >> Id >> SizeOfDocString;
-+
-+ if ( DocString )
-+ delete [] DocString;
-+
-+ DocString = new sal_uInt8[ SizeOfDocString ];
-+ pStream->Read( DocString, SizeOfDocString );
-+
-+ if ( SizeOfDocStringUnicode )
-+ delete [] DocStringUnicode;
-+
-+ *pStream >> Reserved >> SizeOfDocStringUnicode;
-+
-+ if ( DocStringUnicode )
-+ delete [] DocStringUnicode;
-+
-+ DocStringUnicode = new sal_uInt8[ SizeOfDocStringUnicode ];
-+
-+ pStream->Read( DocStringUnicode, SizeOfDocStringUnicode );
-+}
-+
-+};
-+
-+class ProjectHelpFilePath
-+{
-+public:
-+sal_Int16 Id;
-+sal_Int32 SizeOfHelpFile1;
-+sal_uInt8* HelpFile1;
-+sal_Int16 Reserved;
-+sal_Int32 SizeOfHelpFile2;
-+sal_uInt8* HelpFile2;
-+
-+ProjectHelpFilePath() : Id( 0x06 ), SizeOfHelpFile1(0), HelpFile1(0), Reserved(0x0), SizeOfHelpFile2(0), HelpFile2(0) {}
-+~ProjectHelpFilePath()
-+{
-+ if ( HelpFile1 )
-+ delete [] HelpFile1;
-+ if ( HelpFile2 )
-+ delete [] HelpFile2;
-+ HelpFile1 = 0;
-+ HelpFile2 = 0;
-+}
-+void read( SvStream* pStream )
-+{
-+ OSL_TRACE("ProjectHelpFilePath [0x%x]", pStream->Tell() );
-+ *pStream >> Id >> SizeOfHelpFile1;
-+
-+ if ( HelpFile1 )
-+ delete HelpFile1;
-+
-+ HelpFile1 = new sal_uInt8[ SizeOfHelpFile1 ];
-+ pStream->Read( HelpFile1, SizeOfHelpFile1 );
-+
-+ *pStream >> Reserved >> SizeOfHelpFile2;
-+
-+ if ( HelpFile2 )
-+ delete HelpFile2;
-+
-+ HelpFile2 = new sal_uInt8[ SizeOfHelpFile2 ];
-+ pStream->Read( HelpFile2, SizeOfHelpFile2 );
-+
-+}
-+};
-+
-+class ProjectHelpContextRecord
-+{
-+public:
-+sal_Int16 Id;
-+sal_Int32 Size;
-+sal_Int32 HelpContext;
-+
-+ProjectHelpContextRecord() : Id( 0x7 ), Size( 0x4 ), HelpContext( 0 ) {}
-+void read( SvStream* pStream )
-+{
-+
-+ OSL_TRACE("ProjectHelpContextRecord [0x%x]", pStream->Tell() );
-+ *pStream >> Id >> Size >> HelpContext;
-+}
-+
-+};
-+
-+class ProjectLibFlagsRecord
-+{
-+sal_Int16 Id;
-+sal_Int32 Size;
-+sal_Int32 ProjectLibFlags;
-+
-+public:
-+ProjectLibFlagsRecord() : Id( 0x8 ), Size( 0x4 ), ProjectLibFlags( 0x0 ) {}
-+void read( SvStream* pStream )
-+{
-+ OSL_TRACE("ProjectLibFlagsRecord [0x%x]", pStream->Tell() );
-+ *pStream >> Id >> Size >> ProjectLibFlags;
-+}
-+};
-+
-+class ProjectVersionRecord
-+{
-+public:
-+sal_Int16 Id;
-+sal_Int32 Reserved;
-+sal_Int32 VersionMajor;
-+sal_Int16 VersionMinor;
-+ProjectVersionRecord() : Id( 0x9 ), Reserved( 0x4 ), VersionMajor( 0x1 ), VersionMinor( 0 ) {}
-+void read( SvStream* pStream )
-+{
-+ OSL_TRACE("ProjectVersionRecord [0x%x]", pStream->Tell() );
-+ *pStream >> Id >> Reserved >> VersionMajor >> VersionMinor;
-+}
-+};
-+
-+class ProjectConstantsRecord
-+{
-+sal_Int16 Id;
-+sal_Int32 SizeOfConstants;
-+sal_uInt8* Constants;
-+sal_Int16 Reserved;
-+sal_Int32 SizeOfConstantsUnicode;
-+sal_uInt8* ConstantsUnicode;
-+public:
-+ProjectConstantsRecord() : Id( 0xC ), SizeOfConstants( 0 ), Constants( 0 ), Reserved( 0x3C ), SizeOfConstantsUnicode( 0 ), ConstantsUnicode(0) {}
-+
-+~ProjectConstantsRecord()
-+{
-+ delete [] Constants;
-+ Constants = 0;
-+ delete [] ConstantsUnicode;
-+ ConstantsUnicode = 0;
-+}
-+
-+void read( SvStream* pStream )
-+{
-+ OSL_TRACE("ProjectConstantsRecord [0x%x]", pStream->Tell() );
-+ *pStream >> Id >> SizeOfConstants;
-+ if ( Constants )
-+ delete [] Constants;
-+ Constants = new sal_uInt8[ SizeOfConstants ];
-+
-+ pStream->Read( Constants, SizeOfConstants );
-+
-+ *pStream >> Reserved;
-+
-+ if ( ConstantsUnicode )
-+ delete [] ConstantsUnicode;
-+
-+ *pStream >> SizeOfConstantsUnicode;
-+
-+ ConstantsUnicode = new sal_uInt8[ SizeOfConstantsUnicode ];
-+ pStream->Read( ConstantsUnicode, SizeOfConstantsUnicode );
-+}
-+
-+};
-+
-+class ReferenceNameRecord
-+{
-+public:
-+sal_Int16 Id;
-+sal_Int32 SizeOfName;
-+sal_uInt8* Name;
-+sal_Int16 Reserved;
-+sal_Int32 SizeOfNameUnicode;
-+sal_uInt8* NameUnicode;
-+
-+ReferenceNameRecord() : Id( 0x16 ), SizeOfName( 0 ), Name( 0 ), Reserved( 0x3E ), SizeOfNameUnicode( 0 ), NameUnicode( 0 ) {}
-+~ReferenceNameRecord()
-+{
-+ delete [] Name;
-+ Name = 0;
-+ delete [] NameUnicode;
-+ NameUnicode = 0;
-+}
-+
-+void read( SvStream* pStream )
-+{
-+ OSL_TRACE("NameRecord [0x%x]", pStream->Tell() );
-+ *pStream >> Id >> SizeOfName;
-+
-+ if ( Name )
-+ delete [] Name;
-+
-+ Name = new sal_uInt8[ SizeOfName ];
-+
-+ pStream->Read( Name, SizeOfName );
-+
-+ *pStream >> Reserved >> SizeOfNameUnicode;
-+
-+ if ( NameUnicode )
-+ delete [] Name;
-+
-+ NameUnicode = new sal_uInt8[ SizeOfNameUnicode ];
-+ pStream->Read( NameUnicode, SizeOfNameUnicode );
-+}
-+
-+};
-+
-+// Baseclass for ReferenceControlRecord, ReferenceRegisteredRecord, ReferenceProjectRecord
-+class DirDumper;
-+
-+class BaseReferenceRecord
-+{
-+public:
-+virtual ~BaseReferenceRecord(){}
-+virtual bool read( SvStream* pStream ) = 0;
-+virtual void import( VBA_Impl& ){}
-+};
-+
-+
-+class ReferenceProjectRecord : public BaseReferenceRecord
-+{
-+public:
-+ sal_uInt16 Id;
-+ sal_uInt32 Size;
-+ sal_uInt32 SizeOfLibidAbsolute;
-+ sal_uInt8* pLibidAbsolute;
-+ sal_uInt32 SizeOfLibidRelative;
-+ sal_uInt8* pLibidRelative;
-+ sal_uInt32 MajorVersion;
-+ sal_uInt16 MinorVersion;
-+ rtl::OUString msAbsoluteLibid;
-+ rtl::OUString msRelativeLibid;
-+
-+ virtual bool read( SvStream* pStream );
-+ virtual void import( VBA_Impl& rDir );
-+ ReferenceProjectRecord();
-+ ~ReferenceProjectRecord();
-+};
-+
-+ReferenceProjectRecord::ReferenceProjectRecord() : Id( 0x000E ), Size( 0 ), SizeOfLibidAbsolute( 0 ), pLibidAbsolute( NULL ), SizeOfLibidRelative( 0 ), pLibidRelative( 0 ), MajorVersion( 0 ), MinorVersion( 0 )
-+{
-+}
-+
-+ReferenceProjectRecord::~ReferenceProjectRecord()
-+{
-+ if ( pLibidAbsolute )
-+ delete[] pLibidAbsolute;
-+ if ( pLibidRelative )
-+ delete[] pLibidRelative;
-+}
-+
-+bool ReferenceProjectRecord::read( SvStream* pStream )
-+{
-+ OSL_TRACE("ReferenceProjectRecord [0x%x]", pStream->Tell() );
-+ *pStream >> Id >> Size >> SizeOfLibidAbsolute;
-+
-+ if ( SizeOfLibidAbsolute )
-+ {
-+ pLibidAbsolute = new sal_uInt8[ SizeOfLibidAbsolute ];
-+ OSL_TRACE("ReferenceProjectRecord about to read LibidAbsolute at [0x%x]", pStream->Tell() );
-+ pStream->Read( pLibidAbsolute, SizeOfLibidAbsolute );
-+ }
-+
-+ *pStream >> SizeOfLibidRelative;
-+
-+ if ( SizeOfLibidRelative )
-+ {
-+ pLibidRelative = new sal_uInt8[ SizeOfLibidRelative ];
-+ OSL_TRACE("ReferenceProjectRecord about to read LibidRelative at [0x%x]", pStream->Tell() );
-+ pStream->Read( pLibidRelative, SizeOfLibidRelative );
-+ }
-+
-+ *pStream >> MajorVersion >> MinorVersion;
-+
-+ // array size is ORed with SVX_MSOCX_COMPRESSED to force processing of ascii bytes ( and not
-+ // 16 bit unicode )
-+ // the offset of 3 is needed to skip the ProjectReference "*\" and project kind ( 0x4[1-4] ) info.
-+
-+ msAbsoluteLibid = lclCreateOUString( reinterpret_cast< const char* >( pLibidAbsolute + 3 ), ( SVX_MSOCX_COMPRESSED | (SizeOfLibidAbsolute - 3 )));
-+ msRelativeLibid = lclCreateOUString( reinterpret_cast< const char* >( pLibidRelative + 3 ), ( SVX_MSOCX_COMPRESSED | ( SizeOfLibidRelative -3 )));
-+
-+ OSL_TRACE("ReferenceProjectRecord - absolute path %s", rtl::OUStringToOString( msAbsoluteLibid, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ OSL_TRACE("ReferenceProjectRecord - relative path %s", rtl::OUStringToOString( msRelativeLibid, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ return true;
-+}
-+
-+void ReferenceProjectRecord::import( VBA_Impl& rDir )
-+{
-+ rDir.AddProjectReference( msAbsoluteLibid );
-+}
-+
-+class ReferenceRegisteredRecord : public BaseReferenceRecord
-+{
-+public:
-+ sal_uInt16 Id;
-+ sal_uInt32 Size;
-+ sal_uInt32 SizeOfLibid;
-+ sal_uInt8* pLibid;
-+ sal_Int32 Reserved1;
-+ sal_Int16 Reserved2;
-+
-+ ReferenceRegisteredRecord();
-+ ~ReferenceRegisteredRecord();
-+ bool read( SvStream* pStream );
-+};
-+
-+ReferenceRegisteredRecord::ReferenceRegisteredRecord() : Id( 0x000D ), Size( 0 ), SizeOfLibid( 0 ), pLibid( NULL ), Reserved1( 0 ), Reserved2( 0 )
-+{
-+}
-+
-+ReferenceRegisteredRecord::~ReferenceRegisteredRecord()
-+{
-+ if ( pLibid )
-+ {
-+ delete[] pLibid;
-+ }
-+}
-+
-+bool
-+ReferenceRegisteredRecord::read( SvStream* pStream )
-+{
-+ OSL_TRACE("ReferenceRegisteredRecord [0x%x]", pStream->Tell() );
-+ *pStream >> Id >> Size >> SizeOfLibid;
-+ if ( SizeOfLibid )
-+ {
-+ pLibid = new sal_uInt8[ SizeOfLibid ];
-+ OSL_TRACE("ReferenceRegisteredRecord about to read Libid [0x%x]", pStream->Tell() );
-+ pStream->Read( pLibid, SizeOfLibid );
-+ }
-+ *pStream >> Reserved1 >> Reserved2;
-+ return true;
-+}
-+
-+class ReferenceOriginalRecord
-+{
-+public:
-+ sal_uInt16 Id;
-+ sal_uInt32 SizeOfLibOriginal;
-+ sal_uInt8* pLibidOriginal;
-+
-+
-+ReferenceOriginalRecord() : Id( 0x033 ), SizeOfLibOriginal( 0 ), pLibidOriginal( NULL )
-+{
-+}
-+
-+~ReferenceOriginalRecord()
-+{
-+ if ( pLibidOriginal )
-+ delete[] pLibidOriginal;
-+}
-+
-+void read( SvStream* pStream )
-+{
-+ *pStream >> Id >> SizeOfLibOriginal;
-+ if ( SizeOfLibOriginal )
-+ {
-+ pLibidOriginal = new sal_uInt8[ SizeOfLibOriginal ];
-+ pStream->Read( pLibidOriginal, SizeOfLibOriginal );
-+ }
-+}
-+
-+};
-+
-+class ReferenceControlRecord : public BaseReferenceRecord
-+{
-+public:
-+ReferenceOriginalRecord OriginalRecord;
-+sal_Int16 Id;
-+sal_uInt32 SizeTwiddled;
-+sal_uInt32 SizeOfLibidTwiddled;
-+sal_uInt8* LibidTwiddled;
-+sal_uInt32 Reserved1;
-+sal_uInt16 Reserved2;
-+ReferenceNameRecord* NameRecordExtended;// Optional
-+sal_uInt16 Reserved3;
-+sal_uInt32 SizeExtended;
-+sal_uInt32 SizeOfLibidExtended;
-+sal_uInt8* LibidExtended;
-+sal_uInt32 Reserved4;
-+sal_uInt16 Reserved5;
-+sal_uInt8 OriginalTypeLib[ 16 ];
-+sal_uInt32 Cookie;
-+
-+ReferenceControlRecord() : Id( 0x2F ), SizeTwiddled( 0 ), SizeOfLibidTwiddled( 0 ), LibidTwiddled( 0 ), Reserved1( 0 ), Reserved2( 0 ), NameRecordExtended( 0 ), Reserved3( 0x30 ), SizeExtended( 0 ), SizeOfLibidExtended( 0 ), LibidExtended( 0 ), Reserved4( 0 ), Reserved5( 0 ), Cookie( 0 )
-+{
-+ for( int i = 0; i < 16; ++i )
-+ OriginalTypeLib[ i ] = 0;
-+}
-+
-+~ReferenceControlRecord()
-+{
-+ delete LibidTwiddled;
-+ delete NameRecordExtended;
-+ delete [] LibidExtended;
-+ LibidTwiddled = 0;
-+ NameRecordExtended = 0;
-+ LibidExtended = 0;
-+}
-+
-+bool read( SvStream* pStream )
-+{
-+ OSL_TRACE("ReferenceControlRecord [0x%x]", pStream->Tell() );
-+ OriginalRecord.read( pStream );
-+ *pStream >> Id >> SizeTwiddled >> SizeOfLibidTwiddled;
-+
-+ if ( SizeOfLibidTwiddled )
-+ {
-+ LibidTwiddled = new sal_uInt8[ SizeOfLibidTwiddled ];
-+ pStream->Read( LibidTwiddled, SizeOfLibidTwiddled );
-+ }
-+
-+ *pStream >> Reserved1 >> Reserved2;
-+
-+ long nPos = pStream->Tell();
-+ // peek at the id for optional NameRecord
-+ sal_Int16 nTmpId;
-+ *pStream >> nTmpId;
-+ if ( nTmpId == 0x30 )
-+ {
-+ Reserved3 = 0x30;
-+ }
-+ else
-+ {
-+ pStream->Seek( nPos );
-+ NameRecordExtended = new ReferenceNameRecord();
-+ NameRecordExtended->read( pStream );
-+ *pStream >> Reserved3;
-+ }
-+ *pStream >> SizeExtended >> SizeOfLibidExtended;
-+
-+ if ( SizeExtended )
-+ {
-+ LibidExtended = new sal_uInt8[ SizeOfLibidExtended ];
-+ pStream->Read( LibidExtended, SizeOfLibidExtended );
-+ }
-+
-+ *pStream >> Reserved4;
-+ *pStream >> Reserved5;
-+
-+ pStream->Read( OriginalTypeLib, sizeof( OriginalTypeLib ) );
-+ *pStream >> Cookie;
-+ return true;
-+}
-+
-+};
-+
-+class ReferenceRecord : public BaseReferenceRecord
-+{
-+public:
-+// NameRecord is Optional
-+ReferenceNameRecord* NameRecord;
-+BaseReferenceRecord* aReferenceRecord;
-+ReferenceRecord(): NameRecord(0), aReferenceRecord(0) {}
-+~ReferenceRecord()
-+{
-+ if ( NameRecord )
-+ delete NameRecord;
-+ if ( aReferenceRecord )
-+ delete aReferenceRecord;
-+}
-+
-+// false return would mean failed to read Record e.g. end of array encountered
-+// Note: this read routine will make sure the stream is pointing to where it was the
-+// method was called )
-+
-+bool read( SvStream* pStream )
-+{
-+ OSL_TRACE("ReferenceRecord [0x%x]", pStream->Tell() );
-+ bool bRead = true;
-+ long nStart = pStream->Tell();
-+ long nPos = nStart;
-+ // Peek at the ID
-+ sal_Int16 Id;
-+ *pStream >> Id;
-+ pStream->Seek( nPos ); // place back before Id
-+ if ( Id == 0x16 ) // Optional NameRecord
-+ {
-+ NameRecord = new ReferenceNameRecord();
-+ NameRecord->read( pStream );
-+ }
-+ else if ( Id == 0x0f )
-+ {
-+ pStream->Seek( nStart );
-+ bRead = false;
-+ return bRead; // start of module, terminate read
-+ }
-+
-+ nPos = pStream->Tell(); // mark position, peek at next Id
-+ *pStream >> Id;
-+ pStream->Seek( nPos ); // place back before Id
-+
-+ switch( Id )
-+ {
-+ case 0x0D:
-+ aReferenceRecord = new ReferenceRegisteredRecord();
-+ break;
-+ case 0x0E:
-+ aReferenceRecord = new ReferenceProjectRecord();
-+ break;
-+ case 0x2F:
-+ case 0x33:
-+ aReferenceRecord = new ReferenceControlRecord();
-+ break;
-+ default:
-+ bRead = false;
-+ OSL_TRACE("Big fat error, unknown ID 0x%x", Id);
-+ break;
-+ }
-+ if ( bRead )
-+ aReferenceRecord->read( pStream );
-+ return bRead;
-+}
-+
-+void import( VBA_Impl& rVBA )
-+{
-+ if ( aReferenceRecord )
-+ aReferenceRecord->import( rVBA );
-+}
-+
-+};
-+
-+class DirDumper
-+{
-+public:
-+ProjectSysKindRecord mSysKindRec;
-+ProjectLcidRecord mLcidRec;
-+ProjectLcidInvokeRecord mLcidInvokeRec;
-+ProjectCodePageRecord mCodePageRec;
-+ProjectNameRecord mProjectNameRec;
-+ProjectDocStringRecord mDocStringRec;
-+ProjectHelpFilePath mHelpFileRec;
-+ProjectHelpContextRecord mHelpContextRec;
-+ProjectLibFlagsRecord mLibFlagsRec;
-+ProjectVersionRecord mVersionRec;
-+ProjectConstantsRecord mConstantsRecord;
-+std::vector< ReferenceRecord* > ReferenceArray;
-+
-+DirDumper() {}
-+~DirDumper()
-+{
-+ for ( std::vector< ReferenceRecord* >::iterator it = ReferenceArray.begin(); it != ReferenceArray.end(); ++it )
-+ delete *it;
-+
-+}
-+
-+void read( SvStream* pStream )
-+{
-+ sal_Int32 nPos = pStream->Tell();
-+ std::ofstream aDump("dir.dump");
-+ while ( !pStream->IsEof() )
-+ {
-+ sal_Int8 aByte;
-+ *pStream >> aByte;
-+ aDump << aByte;
-+ }
-+ aDump.flush();
-+ pStream->Seek( nPos );
-+ readProjectInformation( pStream );
-+ readProjectReferenceInformation( pStream );
-+}
-+
-+void readProjectReferenceInformation( SvStream* pStream )
-+{
-+ bool bKeepReading = true;
-+ while( bKeepReading )
-+ {
-+ ReferenceRecord* pRef = new ReferenceRecord();
-+ bKeepReading = pRef->read( pStream );
-+ if ( bKeepReading )
-+ ReferenceArray.push_back( pRef );
-+ }
-+}
-+
-+void readProjectInformation( SvStream* pStream )
-+{
-+ mSysKindRec.read( pStream );
-+ mLcidRec.read( pStream );
-+ mLcidInvokeRec.read( pStream );
-+ mCodePageRec.read( pStream );
-+ mProjectNameRec.read( pStream );
-+ mDocStringRec.read( pStream );
-+ mHelpFileRec.read( pStream );
-+ mHelpContextRec.read( pStream );
-+ mLibFlagsRec.read( pStream );
-+ mVersionRec.read( pStream );
-+ sal_Int32 nPos = pStream->Tell();
-+ sal_uInt16 nTmp;
-+ *pStream >> nTmp;
-+ if ( nTmp == 0x0C )
-+ {
-+ pStream->Seek( nPos );
-+ mConstantsRecord.read( pStream );
-+ }
-+ OSL_TRACE("After Information pos is 0x%x", pStream->Tell() );
-+}
-+
-+void import( VBA_Impl& rVBA )
-+{
-+ // get project references
-+ for ( std::vector< ReferenceRecord* >::iterator it = ReferenceArray.begin(); it != ReferenceArray.end(); ++it )
-+ (*it)->import( rVBA );
-+ rVBA.SetProjectName( mProjectNameRec.msProjectName );
-+
-+}
-+};
-+
-+
- /*
- A few urls which may in the future be of some use
- http://www.virusbtn.com/vb2000/Programme/papers/bontchev.pdf
-@@ -155,7 +1075,17 @@ int VBA_Impl::ReadVBAProject(const SvSto
- xVBAProject = rxVBAStorage->OpenSotStream(
- String( RTL_CONSTASCII_USTRINGPARAM( "_VBA_PROJECT" ) ),
- STREAM_STD_READ | STREAM_NOCREATE );
--
-+ // read Dir stream
-+ SvStorageStreamRef xDir = rxVBAStorage->OpenSotStream(
-+ String( RTL_CONSTASCII_USTRINGPARAM( "dir" ) ),
-+ STREAM_STD_READ | STREAM_NOCREATE );
-+ // decompress the stream
-+ std::auto_ptr< SvMemoryStream > xCmpDir;
-+ xCmpDir.reset( MSLZSS::decompressAsStream( xDir, 0 ) );
-+ // try to parse the dir stream
-+ DirDumper dDump;
-+ dDump.read( xCmpDir.get() );
-+ dDump.import( *this );
- if( !xVBAProject.Is() || SVSTREAM_OK != xVBAProject->GetError() )
- {
- DBG_WARNING("Not able to find vba project, cannot find macros");
-@@ -455,6 +1385,7 @@ bool VBA_Impl::Open( const String &rTopl
- if( !xMacros.Is() || SVSTREAM_OK != xMacros->GetError() )
- {
- DBG_WARNING("No Macros Storage");
-+ OSL_TRACE("No Macros Storage");
- }
- else
- {
-@@ -464,6 +1395,7 @@ bool VBA_Impl::Open( const String &rTopl
- if( !xVBA.Is() || SVSTREAM_OK != xVBA->GetError() )
- {
- DBG_WARNING("No Visual Basic in Storage");
-+ OSL_TRACE("No Visual Basic in Storage");
- }
- else
- {
-@@ -478,6 +1410,7 @@ bool VBA_Impl::Open( const String &rTopl
- * ( value ) is either a Class Module, Form Module or a plain VB Module. */
- SvStorageStreamRef xProject = xMacros->OpenSotStream(
- String( RTL_CONSTASCII_USTRINGPARAM( "PROJECT" ) ) );
-+
- SvStorageStream* pStp = xProject;
- UniString tmp;
- static const String sThisDoc( RTL_CONSTASCII_USTRINGPARAM( "ThisDocument" ) );
---- svx/source/msfilter/msvbasic.hxx.old 2009-04-06 16:41:59.000000000 +0000
-+++ svx/source/msfilter/msvbasic.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -97,9 +97,14 @@ public:
- //
- // #117718# member map of module names to types of module
- ModType GetModuleType( const UniString& rModuleName );
--
-- std::vector<String> maReferences;
-+ rtl::OUString& ProjectName() { return msProjectName; }
-+ void SetProjectName( const rtl::OUString& rPName ) { msProjectName = rPName; }
-+ const std::vector<rtl::OUString>& ProjectReferences() { return maPrjReferences; }
-+ void AddProjectReference( const rtl::OUString& rProject ) { maPrjReferences.push_back( rProject); }
-+ SvStorage* GetStorage() { return xStor; }
- private:
-+ std::vector<rtl::OUString> maReferences;
-+ std::vector<rtl::OUString> maPrjReferences;
- struct VBAOffset_Impl
- {
- String sName;
-@@ -125,6 +130,7 @@ private:
- int ReadVBAProject(const SvStorageRef &rxVBAStorage);
- int DecompressVBA(int index, SvStorageStreamRef &rxVBAStream);
- sal_uInt8 ReadPString(SvStorageStreamRef &xVBAProject, bool bIsUnicode);
-+ rtl::OUString msProjectName;
- };
-
- #endif
---- svx/source/msfilter/svxmsbas.cxx.old 2009-04-06 16:42:00.000000000 +0000
-+++ svx/source/msfilter/svxmsbas.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -83,6 +83,7 @@ int SvxImportMSVBasic::Import( const Str
- const String &rSubStorageName,
- BOOL bAsComment, BOOL bStripped )
- {
-+ msProjectName = rtl::OUString();
- int nRet = 0;
- if( bImport && ImportCode_Impl( rStorageName, rSubStorageName,
- bAsComment, bStripped ))
-@@ -100,7 +101,42 @@ int SvxImportMSVBasic::Import( const Str
- bool SvxImportMSVBasic::ImportForms_Impl(const String& rStorageName,
- const String& rSubStorageName, BOOL bVBAMode )
- {
-- SvStorageRef xVBAStg(xRoot->OpenSotStorage(rStorageName,
-+ BOOL bRet = FALSE;
-+ // #FIXME VBA_Impl ( or some other new class ) should handle both userforms
-+ // and code
-+ VBA_Impl aVBA( *xRoot, TRUE );
-+ // This call is a waste we read the source ( again ) only to get the refereneces
-+ // *AGAIN*, we really need to rewrite all of this
-+ aVBA.Open( rStorageName, rSubStorageName );
-+
-+ bRet = ImportForms_Impl( aVBA, rStorageName, rSubStorageName, bVBAMode );
-+ std::vector<rtl::OUString> sProjectRefs = aVBA.ProjectReferences();
-+
-+ for ( std::vector<rtl::OUString>::iterator it = sProjectRefs.begin(); it != sProjectRefs.end(); ++it )
-+ {
-+ rtl::OUString sFileName = *it;
-+#ifndef WIN
-+#ifdef DEBUG
-+ // hacky test code to read referenced projects on linux
-+ sal_Int32 nPos = (*it).lastIndexOf('\\');
-+ sFileName = (*it).copy( nPos + 1 );
-+ sFileName = rtl::OUString::createFromAscii("~/Documents/") + sFileName;
-+#endif
-+#endif
-+ SotStorageRef rRoot = new SotStorage( sFileName, STREAM_STD_READWRITE, STORAGE_TRANSACTED );
-+ VBA_Impl refVBA( *rRoot, TRUE );
-+ refVBA.Open( rStorageName, rSubStorageName );
-+ // The return from ImportForms doesn't indicate and error ( it could )
-+ // but also it just means no userforms were imported
-+ if ( ImportForms_Impl( refVBA, rStorageName, rSubStorageName, bVBAMode ) )
-+ bRet = true; // mark that at least on userform was imported
-+ }
-+ return bRet;
-+}
-+
-+bool SvxImportMSVBasic::ImportForms_Impl( VBA_Impl& rVBA, const String& rStorageName, const String& rSubStorageName, BOOL bVBAMode )
-+{
-+ SvStorageRef xVBAStg(rVBA.GetStorage()->OpenSotStorage(rStorageName,
- STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYALL));
- if (!xVBAStg.Is() || xVBAStg->GetError())
- return false;
-@@ -133,6 +169,10 @@ bool SvxImportMSVBasic::ImportForms_Impl
- DBG_ASSERT( xLibContainer.is(), "No BasicContainer!" );
-
- String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
-+
-+ if (rVBA.ProjectName().getLength() )
-+ aLibName = rVBA.ProjectName();
-+ OSL_TRACE( "userformage lib name %s", rtl::OUStringToOString( aLibName, RTL_TEXTENCODING_UTF8 ).getStr() );
- Reference<XNameContainer> xLib;
- if (xLibContainer.is())
- {
-@@ -260,17 +300,55 @@ BOOL SvxImportMSVBasic::ImportCode_Impl(
- {
- BOOL bRet = FALSE;
- VBA_Impl aVBA( *xRoot, bAsComment );
-+
- if( aVBA.Open(rStorageName,rSubStorageName) )
- {
-+ msProjectName = aVBA.ProjectName();
-+
-+ if ( msProjectName.getLength() )
-+ rDocSh.GetBasicManager()->SetName( msProjectName ); // set name of Project
-+
-+ bRet = ImportCode_Impl( aVBA, bAsComment, bStripped );
-+ std::vector<rtl::OUString> sProjectRefs = aVBA.ProjectReferences();
-+
-+ for ( std::vector<rtl::OUString>::iterator it = sProjectRefs.begin(); it != sProjectRefs.end(); ++it )
-+ {
-+ rtl::OUString sFileName = *it;
-+#ifndef WIN
-+#ifdef DEBUG
-+ // hacky test code to read referenced projects on linux
-+ sal_Int32 nPos = (*it).lastIndexOf('\\');
-+ sFileName = (*it).copy( nPos + 1 );
-+ sFileName = rtl::OUString::createFromAscii("~/Documents/") + sFileName;
-+#endif
-+#endif
-+ OSL_TRACE("referenced project %s ", rtl::OUStringToOString( sFileName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ SotStorageRef rRoot = new SotStorage( sFileName, STREAM_STD_READWRITE, STORAGE_TRANSACTED );
-+ VBA_Impl refVBA( *rRoot, bAsComment );
-+ if( refVBA.Open(rStorageName,rSubStorageName) && ImportCode_Impl( refVBA, bAsComment, bStripped ) )
-+ bRet = TRUE; // mark that some code was imported
-+ }
-+ }
-+ return bRet;
-+}
-+
-+BOOL SvxImportMSVBasic::ImportCode_Impl( VBA_Impl& aVBA, BOOL bAsComment, BOOL bStripped )
-+{
-+ BOOL bRet = FALSE;
- SFX_APP()->EnterBasicCall();
- Reference<XLibraryContainer> xLibContainer = rDocSh.GetBasicContainer();
- DBG_ASSERT( xLibContainer.is(), "No BasicContainer!" );
-
- UINT16 nStreamCount = aVBA.GetNoStreams();
- Reference<XNameContainer> xLib;
-+
-+ String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
-+
- if( xLibContainer.is() && nStreamCount )
- {
-- String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
-+ if ( aVBA.ProjectName().getLength() )
-+ aLibName = aVBA.ProjectName();
-+
- if( !xLibContainer->hasByName( aLibName ) )
- xLibContainer->createLibrary( aLibName );
-
-@@ -282,7 +360,7 @@ BOOL SvxImportMSVBasic::ImportCode_Impl(
- Reference< container::XNameAccess > xVBAObjectForCodeName;
- if ( !bAsComment )
- {
-- rDocSh.GetBasic()->SetVBAEnabled( true );
-+ rDocSh.GetBasicManager()->GetLib( aLibName )->SetVBAEnabled( true );
- Reference< XMultiServiceFactory> xSF(rDocSh.GetModel(), UNO_QUERY);
- if ( xSF.is() )
- {
-@@ -483,7 +561,6 @@ BOOL SvxImportMSVBasic::ImportCode_Impl(
- }
- if( bRet )
- SFX_APP()->LeaveBasicCall();
-- }
- return bRet;
- }
-
---- sw/inc/unocoll.hxx.old 2009-04-02 10:50:57.000000000 +0000
-+++ sw/inc/unocoll.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -194,8 +194,10 @@ class SwUnoCollection
- #define SW_SERVICE_CHART2_DATA_PROVIDER 106
- #define SW_SERVICE_TYPE_FIELDMARK 107
- #define SW_SERVICE_TYPE_FORMFIELDMARK 108
-+#define SW_SERVICE_VBAOBJECTPROVIDER 109
-+#define SW_SERVICE_VBACODENAMEPROVIDER 110
-
--#define SW_SERVICE_LAST SW_SERVICE_TYPE_FORMFIELDMARK
-+#define SW_SERVICE_LAST SW_SERVICE_VBACODENAMEPROVIDER
-
- #define SW_SERVICE_INVALID USHRT_MAX
-
---- sw/prj/build.lst
-+++ sw/prj/build.lst
-@@ -1,4 +1,4 @@
--sw sw : l10n connectivity OOo:writerperfect OOo:lotuswordpro svx stoc uui writerfilter NULL
-+sw sw : l10n connectivity OOo:writerperfect OOo:lotuswordpro svx stoc uui writerfilter vbahelper NULL
- sw sw usr1 - all sw_mkout NULL
- sw sw\inc nmake - all sw_inc NULL
- sw sw\uiconfig\layout nmake - all sw_layout NULL
-@@ -33,6 +33,7 @@ sw sw\source\ui\smartmenu
- sw sw\source\ui\table nmake - all sw_table sw_inc NULL
- sw sw\source\ui\uiview nmake - all sw_uivw sw_sdi sw_inc NULL
- sw sw\source\ui\uno nmake - all sw_uiuno sw_sdi sw_inc NULL
-+sw sw\source\ui\vba nmake - all sw_vba sw_inc NULL
- sw sw\source\ui\utlui nmake - all sw_utlui sw_inc NULL
- sw sw\source\ui\web nmake - all sw_web sw_uinc sw_sdi sw_inc NULL
- sw sw\source\ui\wrtsh nmake - all sw_wrtsh sw_inc NULL
-@@ -69,7 +70,7 @@ sw sw\source\filter\writer
- sw sw\source\filter\ww1 nmake - all sw_ww1 sw_inc NULL
- sw sw\source\filter\ww8 nmake - all sw_ww8 sw_inc NULL
- sw sw\source\filter\xml nmake - all sw_xml sw_inc NULL
--sw sw\source\ui nmake - all sw_ui sw_app sw_cctrl sw_chrdl sw_conf sw_dbui sw_dchdl sw_dcvw sw_dlg sw_envlp sw_fldui sw_fmtui sw_frmdl sw_globd sw_index sw_ling sw_misc sw_rbbar sw_shell sw_table sw_uiuno sw_uivw sw_utlui sw_web sw_wrtsh sw_smartmenu NULL
-+sw sw\source\ui nmake - all sw_ui sw_app sw_cctrl sw_chrdl sw_conf sw_dbui sw_dchdl sw_dcvw sw_dlg sw_envlp sw_fldui sw_fmtui sw_frmdl sw_globd sw_index sw_ling sw_misc sw_rbbar sw_shell sw_table sw_uiuno sw_uivw sw_utlui sw_web sw_wrtsh sw_smartmenu sw_vba NULL
- sw sw\source\core nmake - all sw_core sw_attr sw_bast sw_crsr sw_dcnd sw_doc sw_draw sw_edit sw_excpt sw_fld sw_frmed sw_grph sw_layo sw_ole sw_para sw_sw3io sw_swg sw_text sw_tox sw_txtnd sw_uco sw_undo sw_view sw_acc sw_objpos sw_NumberTree sw_tablecore NULL
- sw sw\source\filter nmake - all sw_flt sw_ascii sw_bsflt sw_html sw_rtf sw_wrtr sw_ww1 sw_ww8 sw_xml NULL
- sw sw\util nmake - all sw_util sw_core sw_flt sw_sdi sw_ui NULL
---- sw/prj/d.lst.old 2009-04-02 10:50:58.000000000 +0000
-+++ sw/prj/d.lst 2009-04-06 16:42:01.000000000 +0000
-@@ -63,6 +63,7 @@ mkdir: %_DEST%\xml%_EXT%\uiconfig\module
- ..\%__SRC%\bin\swd?????.dll %_DEST%\bin%_EXT%\swd?????.dll
- ..\%__SRC%\bin\swui?????.dll %_DEST%\bin%_EXT%\swui?????.dll
- ..\%__SRC%\bin\msword?????.dll %_DEST%\bin%_EXT%\msword?????.dll
-+..\%__SRC%\bin\vbaswobj*.dll %_DEST%\bin%_EXT%\vbaswobj*.dll
- ..\%__SRC%\bin\sw*.res %_DEST%\bin%_EXT%\sw*.res
- ..\%__SRC%\lib\lib*.* %_DEST%\lib%_EXT%\lib*.*
-
---- sw/source/core/unocore/unocoll.cxx
-+++ sw/source/core/unocore/unocoll.cxx
-@@ -73,7 +73,14 @@
- #include <iterator>
-
- #include "docsh.hxx"
--
-+#include <com/sun/star/document/XCodeNameQuery.hpp>
-+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
-+#include <com/sun/star/form/XFormsSupplier.hpp>
-+#include <com/sun/star/script/ModuleInfo.hpp>
-+#include <com/sun/star/script/ModuleType.hpp>
-+#include <com/sun/star/script/ScriptEventDescriptor.hpp>
-+#include <vbahelper/vbahelper.hxx>
-+#include <basic/basmgr.hxx>
- using ::rtl::OUString;
- using namespace ::com::sun::star;
- using namespace ::com::sun::star::document;
-@@ -82,6 +89,119 @@ using namespace ::com::sun::star::text;
- using namespace ::com::sun::star::container;
- using namespace ::com::sun::star::lang;
-
-+class SwVbaCodeNameProvider : public ::cppu::WeakImplHelper1< document::XCodeNameQuery >
-+{
-+ SwDocShell* mpDocShell;
-+ rtl::OUString msThisDocumentCodeName;
-+public:
-+ SwVbaCodeNameProvider( SwDocShell* pDocShell ) : mpDocShell( pDocShell ) {}
-+ // XCodeNameQuery
-+ rtl::OUString SAL_CALL getCodeNameForObject( const uno::Reference< uno::XInterface >& xIf ) throw( uno::RuntimeException )
-+ {
-+ // Initialise the code name
-+ if ( msThisDocumentCodeName.getLength() == 0 )
-+ {
-+ try
-+ {
-+ uno::Reference< beans::XPropertySet > xProps( mpDocShell->GetModel(), uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XNameAccess > xLibContainer( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BasicLibraries") ) ), uno::UNO_QUERY_THROW );
-+ rtl::OUString sProjectName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Standard") ) );
-+ if ( mpDocShell->GetBasicManager()->GetName().Len() )
-+ sProjectName = mpDocShell->GetBasicManager()->GetName();
-+
-+ uno::Reference< container::XNameAccess > xStandard( xLibContainer->getByName( sProjectName ), uno::UNO_QUERY_THROW );
-+ uno::Sequence< rtl::OUString > sModuleNames = xStandard->getElementNames();
-+ for ( sal_Int32 i=0; i < sModuleNames.getLength(); ++i )
-+ {
-+ script::ModuleInfo mInfo;
-+ if ( xStandard->getByName( sModuleNames[ i ] ) >>= mInfo )
-+ {
-+ if ( mInfo.ModuleType == script::ModuleType::Document )
-+ {
-+ msThisDocumentCodeName = sModuleNames[ i ];
-+ break;
-+ }
-+ }
-+ }
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+ }
-+ rtl::OUString sCodeName;
-+ if ( mpDocShell )
-+ {
-+ OSL_TRACE( "*** In ScVbaCodeNameProvider::getCodeNameForObject");
-+ // need to find the page ( and index ) for this control
-+ uno::Reference< drawing::XDrawPageSupplier > xSupplier( mpDocShell->GetModel(), uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xIndex( xSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
-+ sal_Int32 nLen = xIndex->getCount();
-+ bool bMatched = false;
-+ uno::Sequence< script::ScriptEventDescriptor > aFakeEvents;
-+ try
-+ {
-+ uno::Reference< form::XFormsSupplier > xFormSupplier( xIndex, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xFormIndex( xFormSupplier->getForms(), uno::UNO_QUERY_THROW );
-+ // get the www-standard container
-+ uno::Reference< container::XIndexAccess > xFormControls( xFormIndex->getByIndex(0), uno::UNO_QUERY_THROW );
-+ sal_Int32 nCntrls = xFormControls->getCount();
-+ for( sal_Int32 cIndex = 0; cIndex < nCntrls; ++cIndex )
-+ {
-+ uno::Reference< uno::XInterface > xControl( xFormControls->getByIndex( cIndex ), uno::UNO_QUERY_THROW );
-+ bMatched = ( xControl == xIf );
-+ if ( bMatched )
-+ {
-+ sCodeName = msThisDocumentCodeName;
-+ break;
-+ }
-+ }
-+ }
-+ catch( uno::Exception& ) {}
-+ }
-+ // Probably should throw here ( if !bMatched )
-+ return sCodeName;
-+ }
-+};
-+
-+class SwVbaObjectForCodeNameProvider : public ::cppu::WeakImplHelper1< container::XNameAccess >
-+{
-+ SwDocShell* mpDocShell;
-+public:
-+ SwVbaObjectForCodeNameProvider( SwDocShell* pDocShell ) : mpDocShell( pDocShell )
-+ {
-+ // #FIXME #TODO is the code name for ThisDocument read anywhere?
-+ }
-+
-+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException )
-+ {
-+ // #FIXME #TODO we really need to be checking against the codename for
-+ // ThisDocument
-+ if ( aName.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ThisDocument" ) ) ) )
-+ return sal_True;
-+ return sal_False;
-+ }
-+ ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
-+ {
-+ if ( !hasByName( aName ) )
-+ throw container::NoSuchElementException();
-+ uno::Sequence< uno::Any > aArgs( 2 );
-+ aArgs[0] = uno::Any( uno::Reference< uno::XInterface >() );
-+ aArgs[1] = uno::Any( mpDocShell->GetModel() );
-+ uno::Reference< uno::XInterface > xDocObj = ov::createVBAUnoAPIServiceWithArgs( mpDocShell, "ooo.vba.word.Document" , aArgs );
-+ OSL_TRACE("Creating Object ( ooo.vba.word.Document ) 0x%x", xDocObj.get() );
-+ return uno::makeAny( xDocObj );
-+ }
-+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (::com::sun::star::uno::RuntimeException)
-+ {
-+ uno::Sequence< rtl::OUString > aNames;
-+ return aNames;
-+ }
-+ // XElemenAccess
-+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException){ return uno::Type(); }
-+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException ) { return sal_True; }
-+
-+};
-+
- /******************************************************************************
- *
- ******************************************************************************/
-@@ -203,6 +323,8 @@ const ProvNamesId_Type __FAR_DATA aProvN
- { "com.sun.star.chart2.data.DataProvider", SW_SERVICE_CHART2_DATA_PROVIDER },
- { "com.sun.star.text.Fieldmark", SW_SERVICE_TYPE_FIELDMARK },
- { "com.sun.star.text.FormFieldmark", SW_SERVICE_TYPE_FORMFIELDMARK },
-+ { "ooo.vba.VBAObjectModuleObjectProvider", SW_SERVICE_VBAOBJECTPROVIDER },
-+ { "ooo.vba.VBACodeNameProvider", SW_SERVICE_VBACODENAMEPROVIDER },
-
- // case-correct versions of the service names (see #i67811)
- { CSS_TEXT_TEXTFIELD_DATE_TIME, SW_SERVICE_FIELDTYPE_DATETIME },
-@@ -383,6 +505,18 @@ uno::Reference< uno::XInterface > SwXS
- xRet = (cppu::OWeakObject*)pFieldmark;
- }
- break;
-+ case SW_SERVICE_VBAOBJECTPROVIDER :
-+ {
-+ SwVbaObjectForCodeNameProvider* pObjProv = new SwVbaObjectForCodeNameProvider( pDoc->GetDocShell() );
-+ xRet = (cppu::OWeakObject*)pObjProv;
-+ }
-+ break;
-+ case SW_SERVICE_VBACODENAMEPROVIDER :
-+ {
-+ SwVbaCodeNameProvider* pObjProv = new SwVbaCodeNameProvider( pDoc->GetDocShell() );
-+ xRet = (cppu::OWeakObject*)pObjProv;
-+ }
-+ break;
- case SW_SERVICE_TYPE_FOOTNOTE :
- xRet = (cppu::OWeakObject*)new SwXFootnote(sal_False);
- break;
---- sw/source/filter/ww8/ww8par.cxx.old 2009-04-06 16:42:00.000000000 +0000
-+++ sw/source/filter/ww8/ww8par.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -132,6 +132,9 @@
- #include <svtools/itemiter.hxx> //SfxItemIter
-
- #include <stdio.h>
-+#include <comphelper/processfactory.hxx>
-+#include <basic/basmgr.hxx>
-+
- #include "ww8toolbar.hxx"
- #ifdef DEBUG
- #include <iostream>
-@@ -146,6 +149,76 @@ using namespace sw::util;
- using namespace sw::types;
- using namespace nsHdFtFlags;
-
-+#include <vbahelper/vbahelper.hxx>
-+#include <com/sun/star/document/XEventsSupplier.hpp>
-+#include <com/sun/star/container/XNameReplace.hpp>
-+#include <com/sun/star/frame/XModel.hpp>
-+const static String sModule( RTL_CONSTASCII_USTRINGPARAM("ThisDocument"));
-+
-+const static rtl::OUString sUrlPart0 = rtl::OUString::createFromAscii( "vnd.sun.star.script:");
-+const static rtl::OUString sUrlPart1 = rtl::OUString::createFromAscii( "vnd.sun.star.script:Standard.");
-+const static rtl::OUString sUrlPart2 = rtl::OUString::createFromAscii( "?language=Basic&location=document");
-+
-+struct DocEventNameTable
-+{
-+ const sal_Char* sEventName;
-+ const sal_Char* sMacroName;
-+};
-+
-+const DocEventNameTable aEventNameTable[] =
-+{
-+ {"OnNew", "Document_New"},
-+ {"OnLoad", "Document_Open"},
-+ {"OnPrepareUnload", "Document_Close"},
-+ {NULL, NULL}
-+};
-+
-+bool registerDocEvent( SfxObjectShell* pShell )
-+{
-+ bool result = false;
-+ const static rtl::OUString sEvtType( RTL_CONSTASCII_USTRINGPARAM("EventType") );
-+ const static rtl::OUString sScript( RTL_CONSTASCII_USTRINGPARAM("Script") );
-+ uno::Reference< document::XEventsSupplier > xEvtSupplier( pShell->GetModel(), uno::UNO_QUERY );
-+ if( !xEvtSupplier.is() )
-+ return result;
-+ uno::Reference< container::XNameReplace > xEvts( xEvtSupplier->getEvents(), uno::UNO_QUERY );
-+ if ( xEvts.is() )
-+ {
-+ for( const DocEventNameTable* pTable = aEventNameTable; pTable->sEventName != NULL; pTable++ )
-+ {
-+ rtl::OUString sEvt = rtl::OUString::createFromAscii( pTable->sEventName );
-+ rtl::OUString sMacroName = rtl::OUString::createFromAscii( pTable->sMacroName );
-+ // fail to search the macro if the module is not specified.
-+ String sFullPath = ooo::vba::docMacroExists( pShell, sModule, sMacroName );
-+ if( sFullPath.Len() == 0 )
-+ continue;
-+
-+ uno::Sequence< beans::PropertyValue > aEvents;
-+ xEvts->getByName( sEvt ) >>= aEvents;
-+ uno::Sequence< beans::PropertyValue > aOpenEvt( 2 );
-+ aOpenEvt[ 0 ].Name = sEvtType;
-+ aOpenEvt[ 0 ].Value = uno::makeAny(sScript);
-+ aOpenEvt[ 1 ].Name = sScript;
-+ rtl::OUString sUrl = sUrlPart0.concat( sFullPath ).concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".") ) ).concat( sUrlPart2 );
-+ aOpenEvt[ 1 ].Value = uno::makeAny(sUrl);
-+ sal_Int32 nPos = aEvents.getLength();
-+
-+ sal_Int32 nNewSize = aEvents.getLength() + aOpenEvt.getLength();
-+ if ( nNewSize > aEvents.getLength() )
-+ aEvents.realloc( nNewSize );
-+
-+ for ( sal_Int32 nIndex = nPos, nCpyIndex = 0; nIndex<nNewSize; nIndex++, nCpyIndex++ )
-+ aEvents[ nIndex ] = aOpenEvt[ nCpyIndex ];
-+
-+ uno::Any aParam = uno::makeAny( aEvents );
-+
-+ xEvts->replaceByName( sEvt, aParam );
-+ result = true;
-+ }
-+ }
-+ return result;
-+}
-+
-
- SwMSDffManager::SwMSDffManager( SwWW8ImplReader& rRdr )
- : SvxMSDffManager(*rRdr.pTableStream, rRdr.GetBaseURL(), rRdr.pWwFib->fcDggInfo,
-@@ -3904,7 +3977,52 @@ ULONG SwWW8ImplReader::CoreLoad(WW8Gloss
- }
- else //ordinary case
- {
-+ if (mbNewDoc && pStg && !pGloss) /*meaningless for a glossary, cmc*/
-+ {
-+ const SvtFilterOptions* pVBAFlags = SvtFilterOptions::Get();
-+ maTracer.EnterEnvironment(sw::log::eMacros);
-+ // Create and insert Excel vba Globals
-+ uno::Any aGlobs;
-+ aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstance( ::rtl::OUString::createFromAscii( "ooo.vba.word.Globals") );
-+ mpDocShell->GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
-+
-+ SvxImportMSVBasic aVBasic(*mpDocShell, *pStg,
-+ pVBAFlags->IsLoadWordBasicCode(),
-+ pVBAFlags->IsLoadWordBasicStorage() );
-+ String s1(CREATE_CONST_ASC("Macros"));
-+ String s2(CREATE_CONST_ASC("VBA"));
-+ int nRet = aVBasic.Import( s1, s2, ! pVBAFlags->IsLoadWordBasicCode() );
-+ // Read custom toolbars
-+ if ( pWwFib->lcbCmds )
-+ {
-+ // there is a tgc255 structure
-+ long nCur = pTableStream->Tell();
-+ Tcg aTCG;
-+ pTableStream->Seek( pWwFib->fcCmds ); // point at tgc record
-+ if (!aTCG.Read( pTableStream ) )
-+ OSL_TRACE("** Read of Customization data failed!!!! ");
-+ pTableStream->Seek( nCur ); // return to previous position, is that necessary?
-+#if DEBUG
-+ aTCG.Print( stderr );
-+#endif
-+ aTCG.ImportCustomToolBar( *mpDocShell );
-+ }
-+ if( 2 & nRet )
-+ {
-+ maTracer.Log(sw::log::eContainsVisualBasic);
-+ rDoc.SetContainsMSVBasic(true);
-+ }
-+
-+ StoreMacroCmds();
-+
-+ // Hackly to register the document event.
-+ // should be find a better solution to share the codes with Excel Workbook event.
-+ registerDocEvent( mpDocShell );
-+
-+ maTracer.LeaveEnvironment(sw::log::eMacros);
-+ }
- ReadText(0, pWwFib->ccpText, MAN_MAINTEXT);
-+
- }
-
- ::SetProgressState(nProgress, mpDocShell); // Update
-@@ -3978,41 +4096,6 @@ ULONG SwWW8ImplReader::CoreLoad(WW8Gloss
- eMode |= nsRedlineMode_t::REDLINE_ON;
- if( pWDop->fRMView )
- eMode |= nsRedlineMode_t::REDLINE_SHOW_DELETE;
-- if (pStg && !pGloss) /*meaningless for a glossary, cmc*/
-- {
-- // Read custom toolbars
-- if ( pWwFib->lcbCmds )
-- {
-- // there is a tgc255 structure
-- long nCur = pTableStream->Tell();
-- Tcg aTCG;
-- pTableStream->Seek( pWwFib->fcCmds ); // point at tgc record
-- if (!aTCG.Read( pTableStream ) )
-- OSL_TRACE("** Read of Customization data failed!!!! ");
-- pTableStream->Seek( nCur ); // return to previous position, is that necessary?
--#if DEBUG
-- aTCG.Print( stderr );
--#endif
-- aTCG.ImportCustomToolBar( mpDocShell->GetModel() );
-- }
-- const SvtFilterOptions* pVBAFlags = SvtFilterOptions::Get();
-- maTracer.EnterEnvironment(sw::log::eMacros);
-- SvxImportMSVBasic aVBasic(*mpDocShell, *pStg,
-- pVBAFlags->IsLoadWordBasicCode(),
-- pVBAFlags->IsLoadWordBasicStorage() );
-- String s1(CREATE_CONST_ASC("Macros"));
-- String s2(CREATE_CONST_ASC("VBA"));
-- int nRet = aVBasic.Import( s1, s2 );
-- if( 2 & nRet )
-- {
-- maTracer.Log(sw::log::eContainsVisualBasic);
-- rDoc.SetContainsMSVBasic(true);
-- }
--
-- StoreMacroCmds();
--
-- maTracer.LeaveEnvironment(sw::log::eMacros);
-- }
- }
-
- maInsertedTables.DelAndMakeTblFrms();
---- sw/source/filter/ww8/ww8toolbar.cxx.old 2009-04-06 16:42:00.000000000 +0000
-+++ sw/source/filter/ww8/ww8toolbar.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -154,14 +154,14 @@ void CTBWrapper::Print( FILE* fp )
- }
- }
-
--bool CTBWrapper::ImportCustomToolBar( const uno::Reference< css::frame::XModel >& rxModel )
-+bool CTBWrapper::ImportCustomToolBar( SfxObjectShell& rDocSh )
- {
-
- for ( std::vector< Customization >::iterator it = rCustomizations.begin(); it != rCustomizations.end(); ++it )
- {
- uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
- uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xAppCfgSupp( xMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.ModuleUIConfigurationManagerSupplier" ) ) ), uno::UNO_QUERY_THROW );
-- CustomToolBarImportHelper helper( rxModel, xAppCfgSupp->getUIConfigurationManager( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument" ) ) ) );
-+ CustomToolBarImportHelper helper( rDocSh, xAppCfgSupp->getUIConfigurationManager( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument" ) ) ) );
- helper.setMSOCommandMap( new MSOWordCommandConvertor() );
- if ( !(*it).ImportCustomToolBar( helper ) )
- return false;
-@@ -538,9 +538,9 @@ void Tcg::Print( FILE* fp )
- tcg->Print( fp );
- }
-
--bool Tcg::ImportCustomToolBar( const uno::Reference< frame::XModel >& rxModel )
-+bool Tcg::ImportCustomToolBar( SfxObjectShell& rDocSh )
- {
-- return tcg->ImportCustomToolBar( rxModel );
-+ return tcg->ImportCustomToolBar( rDocSh );
- }
-
- Tcg255::Tcg255()
-@@ -601,7 +601,7 @@ bool Tcg255::processSubStruct( sal_uInt8
- return true;
- }
-
--bool Tcg255::ImportCustomToolBar( const uno::Reference< css::frame::XModel >& rxModel )
-+bool Tcg255::ImportCustomToolBar( SfxObjectShell& rDocSh )
- {
- // Find the CTBWrapper
- for ( std::vector< Tcg255SubStruct* >::const_iterator it = rgtcgData.begin(); it != rgtcgData.end(); ++it )
-@@ -612,7 +612,7 @@ bool Tcg255::ImportCustomToolBar( const
- CTBWrapper* pCTBWrapper = dynamic_cast< CTBWrapper* > ( *it );
- if ( pCTBWrapper )
- {
-- if ( !pCTBWrapper->ImportCustomToolBar( rxModel ) )
-+ if ( !pCTBWrapper->ImportCustomToolBar( rDocSh ) )
- return false;
- }
- }
---- sw/source/filter/ww8/ww8toolbar.hxx.old 2009-04-06 16:42:00.000000000 +0000
-+++ sw/source/filter/ww8/ww8toolbar.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -117,6 +117,8 @@ public:
- void Print( FILE* );
- };
-
-+class SfxObjectShell;
-+
- class CTBWrapper : public Tcg255SubStruct
- {
- // reserved1 is the ch field of Tcg255SubStruct
-@@ -139,7 +141,7 @@ public:
- CTBWrapper( bool bReadId = true );
- ~CTBWrapper();
- bool Read(SvStream *pS);
-- bool ImportCustomToolBar( const css::uno::Reference< css::frame::XModel >& rxModel );
-+ bool ImportCustomToolBar( SfxObjectShell& rDocSh );
- void Print( FILE* );
- };
-
-@@ -320,7 +322,7 @@ public:
- ~Tcg255();
- bool Read(SvStream *pS);
- void Print( FILE* );
-- bool ImportCustomToolBar( const css::uno::Reference< css::frame::XModel >& rxModel );
-+ bool ImportCustomToolBar( SfxObjectShell& rDocSh );
- };
-
- class Tcg: public TBBase
-@@ -333,7 +335,7 @@ public:
- Tcg();
- ~Tcg(){}
- bool Read(SvStream *pS);
-- bool ImportCustomToolBar( const css::uno::Reference< css::frame::XModel >& rxModel );
-+ bool ImportCustomToolBar( SfxObjectShell& rDocSh );
- void Print( FILE* );
- };
-
---- sw/source/ui/uno/unotxdoc.cxx.old 2009-04-02 10:50:38.000000000 +0000
-+++ sw/source/ui/uno/unotxdoc.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -170,6 +170,7 @@ using ::osl::FileBase;
- #define SW_CREATE_MARKER_TABLE 0x06
- #define SW_CREATE_DRAW_DEFAULTS 0x07
-
-+#include <comphelper/processfactory.hxx>
-
- /******************************************************************************
- *
-@@ -362,6 +363,9 @@ SwXTextDocument::SwXTextDocument(SwDocSh
- pxXRedlines(0),
- m_pHiddenViewFrame(0)
- {
-+ uno::Reference< document::XDocumentProperties > xWriterProps( ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.writer.DocumentProperties") ), uno::UNO_QUERY_THROW);
-+
-+ SfxBaseModel::setDocumentProperties( xWriterProps );
- }
- /*-- 18.12.98 11:53:00---------------------------------------------------
-
-@@ -2883,6 +2887,7 @@ uno::Sequence< lang::Locale > SAL_CALL S
- {
- ::vos::OGuard aGuard(Application::GetSolarMutex());
-
-+
- // possible canonical values for nScriptTypes
- // any bit wise combination is allowed
- const sal_Int16 nLatin = 0x001;
---- sw/source/ui/vba/makefile.mk.old 1970-01-01 00:00:00.000000000 +0000
-+++ sw/source/ui/vba/makefile.mk 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,85 @@
-+#*************************************************************************
-+#
-+# 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: makefile.mk,v $
-+#
-+# $Revision: 1.6 $
-+#
-+# 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
-+# <http://www.openoffice.org/license.html>
-+# for a copy of the LGPLv3 License.
-+#
-+#*************************************************************************
-+
-+PRJ=..$/..$/..
-+
-+PRJNAME=sw
-+TARGET=vbaswobj
-+ENABLE_EXCEPTIONS=TRUE
-+
-+# --- Settings -----------------------------------------------------
-+
-+.INCLUDE : settings.mk
-+DLLPRE =
-+
-+.IF "$(ENABLE_VBA)"!="YES"
-+dummy:
-+ @echo "not building vba..."
-+.ENDIF
-+
-+INCPRE=$(INCCOM)$/$(TARGET)
-+CDEFS+=-DVBA_OOBUILD_HACK
-+# ------------------------------------------------------------------
-+
-+SLOFILES= \
-+ $(SLO)$/vbaglobals.obj \
-+ $(SLO)$/vbaapplication.obj \
-+ $(SLO)$/vbadocument.obj \
-+ $(SLO)$/vbawindow.obj \
-+ $(SLO)$/vbasystem.obj \
-+ $(SLO)$/vbarangehelper.obj \
-+ $(SLO)$/vbarange.obj \
-+ $(SLO)$/vbabookmark.obj \
-+ $(SLO)$/vbabookmarks.obj \
-+ $(SLO)$/vbavariable.obj \
-+ $(SLO)$/vbavariables.obj \
-+ $(SLO)$/vbaview.obj \
-+ $(SLO)$/wordvbahelper.obj \
-+ $(SLO)$/service.obj \
-+ $(SLO)$/vbadocumentproperties.obj \
-+ $(SLO)$/vbapane.obj \
-+ $(SLO)$/vbapanes.obj \
-+ $(SLO)$/vbaoptions.obj \
-+ $(SLO)$/vbaselection.obj \
-+
-+# --- Targets ------------------------------------------------------
-+
-+.INCLUDE : target.mk
-+
-+ALLTAR : \
-+ $(MISC)$/$(TARGET).don \
-+
-+$(SLOFILES) : $(MISC)$/$(TARGET).don
-+
-+$(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb
-+ +$(CPPUMAKER) -O$(INCCOM)$/$(TARGET) -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@
-+ echo $@
-+
---- sw/source/ui/vba/service.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sw/source/ui/vba/service.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,82 @@
-+/*************************************************************************
-+ *
-+ * 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: service.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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "cppuhelper/implementationentry.hxx"
-+#include "com/sun/star/lang/XMultiServiceFactory.hpp"
-+#include "com/sun/star/registry/XRegistryKey.hpp"
-+#include "comphelper/servicedecl.hxx"
-+
-+// =============================================================================
-+// component exports
-+// =============================================================================
-+using namespace ::com::sun::star;
-+using namespace ::com::sun::star::uno;
-+
-+namespace sdecl = comphelper::service_decl;
-+
-+namespace globals
-+{
-+extern sdecl::ServiceDecl const serviceDecl;
-+}
-+
-+namespace document
-+{
-+extern sdecl::ServiceDecl const serviceDecl;
-+}
-+
-+extern "C"
-+{
-+ void SAL_CALL component_getImplementationEnvironment(
-+ const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ )
-+ {
-+ OSL_TRACE("In component_getImplementationEnv");
-+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
-+ }
-+
-+ sal_Bool SAL_CALL component_writeInfo(
-+ lang::XMultiServiceFactory * pServiceManager, registry::XRegistryKey * pRegistryKey )
-+ {
-+ OSL_TRACE("In component_writeInfo");
-+
-+ // Component registration
-+ return component_writeInfoHelper( pServiceManager, pRegistryKey,
-+ globals::serviceDecl, document::serviceDecl );
-+ }
-+
-+ void * SAL_CALL component_getFactory(
-+ const sal_Char * pImplName, lang::XMultiServiceFactory * pServiceManager,
-+ registry::XRegistryKey * pRegistryKey )
-+ {
-+ OSL_TRACE("In component_getFactory for %s", pImplName );
-+ void* pRet = component_getFactoryHelper(
-+ pImplName, pServiceManager, pRegistryKey, globals::serviceDecl, document::serviceDecl );
-+ OSL_TRACE("Ret is 0x%x", pRet);
-+ return pRet;
-+ }
-+}
---- sw/source/ui/vba/vbaapplication.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sw/source/ui/vba/vbaapplication.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,135 @@
-+/*************************************************************************
-+ *
-+ * 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: vbaapplication.cxx,v $
-+ * $Revision: 1.7 $
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include <stdio.h>
-+#include "vbaapplication.hxx"
-+#include "vbadocument.hxx"
-+#include <osl/file.hxx>
-+#include <vbahelper/vbahelper.hxx>
-+#include "vbawindow.hxx"
-+#include "vbasystem.hxx"
-+#include "vbaoptions.hxx"
-+#include "vbaselection.hxx"
-+
-+using namespace ::ooo;
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+using ::com::sun::star::uno::Reference;
-+using ::com::sun::star::uno::UNO_QUERY_THROW;
-+using ::com::sun::star::uno::UNO_QUERY;
-+using ::rtl::OUString;
-+
-+// Enable our own join detection for Intersection and Union
-+// should be more efficient than using ScRangeList::Join ( because
-+// we already are testing the same things )
-+
-+#define OWN_JOIN 1
-+
-+// #TODO is this defined somewhere else?
-+#if ( defined UNX ) || ( defined OS2 ) //unix
-+#define FILE_PATH_SEPERATOR "/"
-+#else // windows
-+#define FILE_PATH_SEPERATOR "\\"
-+#endif
-+
-+#define EXCELVERSION "11.0"
-+
-+uno::Any sbxToUnoValue( SbxVariable* pVar );
-+
-+SwVbaApplication::SwVbaApplication( uno::Reference<uno::XComponentContext >& xContext ): SwVbaApplication_BASE( xContext )
-+{
-+}
-+
-+SwVbaApplication::~SwVbaApplication()
-+{
-+}
-+
-+rtl::OUString SAL_CALL
-+SwVbaApplication::getName() throw (uno::RuntimeException)
-+{
-+ static rtl::OUString appName( RTL_CONSTASCII_USTRINGPARAM("Microsoft Word" ) );
-+ return appName;
-+}
-+
-+uno::Reference< word::XDocument > SAL_CALL
-+SwVbaApplication::getActiveDocument() throw (uno::RuntimeException)
-+{
-+ return new SwVbaDocument( this, mxContext, getCurrentDocument() );
-+}
-+
-+uno::Reference< word::XWindow > SAL_CALL
-+SwVbaApplication::getActiveWindow() throw (uno::RuntimeException)
-+{
-+ // #FIXME sofar can't determine Parent
-+ return new SwVbaWindow( uno::Reference< XHelperInterface >(), mxContext, getCurrentDocument() );
-+}
-+
-+uno::Reference<word::XSystem > SAL_CALL
-+SwVbaApplication::getSystem() throw (uno::RuntimeException)
-+{
-+ return uno::Reference< word::XSystem >( new SwVbaSystem( mxContext ) );
-+}
-+
-+uno::Reference<word::XOptions > SAL_CALL
-+SwVbaApplication::getOptions() throw (uno::RuntimeException)
-+{
-+ return uno::Reference< word::XOptions >( new SwVbaOptions( mxContext ) );
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaApplication::CommandBars( const uno::Any& aIndex ) throw (uno::RuntimeException)
-+{
-+ return VbaApplicationBase::CommandBars( aIndex );
-+}
-+
-+uno::Reference< word::XSelection > SAL_CALL
-+SwVbaApplication::getSelection() throw (uno::RuntimeException)
-+{
-+ return new SwVbaSelection( this, mxContext, getCurrentDocument() );
-+}
-+
-+rtl::OUString&
-+SwVbaApplication::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaApplication") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaApplication::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Application" ) );
-+ }
-+ return aServiceNames;
-+}
---- sw/source/ui/vba/vbaapplication.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sw/source/ui/vba/vbaapplication.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,64 @@
-+/*************************************************************************
-+ *
-+ * 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: vbaapplication.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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_APPLICATION_HXX
-+#define SW_VBA_APPLICATION_HXX
-+
-+#include <ooo/vba/word/XApplication.hpp>
-+#include <ooo/vba/word/XDocument.hpp>
-+#include <ooo/vba/word/XWindow.hpp>
-+#include <ooo/vba/word/XSystem.hpp>
-+#include <ooo/vba/word/XOptions.hpp>
-+#include <ooo/vba/word/XSelection.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <vbahelper/vbaapplicationbase.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+
-+//typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XApplication > SwVbaApplication_BASE;
-+typedef cppu::ImplInheritanceHelper1< VbaApplicationBase, ooo::vba::word::XApplication > SwVbaApplication_BASE;
-+
-+class SwVbaApplication : public SwVbaApplication_BASE
-+{
-+public:
-+ SwVbaApplication( css::uno::Reference< css::uno::XComponentContext >& m_xContext );
-+ virtual ~SwVbaApplication();
-+
-+ // XApplication
-+ virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
-+ virtual css::uno::Reference< ooo::vba::word::XSystem > SAL_CALL getSystem() throw (css::uno::RuntimeException);
-+ virtual css::uno::Reference< ov::word::XDocument > SAL_CALL getActiveDocument() throw (css::uno::RuntimeException);
-+ virtual css::uno::Reference< ov::word::XWindow > SAL_CALL getActiveWindow() throw (css::uno::RuntimeException);
-+ virtual css::uno::Reference< ooo::vba::word::XOptions > SAL_CALL getOptions() throw (css::uno::RuntimeException);
-+ virtual css::uno::Reference< ooo::vba::word::XSelection > SAL_CALL getSelection() throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL CommandBars( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_APPLICATION_HXX */
---- sw/source/ui/vba/vbabookmark.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sw/source/ui/vba/vbabookmark.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,111 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbabookmark.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include <com/sun/star/text/XTextContent.hpp>
-+#include <com/sun/star/text/XTextViewCursor.hpp>
-+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
-+#include "vbarange.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaBookmark::SwVbaBookmark( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext,
-+ const css::uno::Reference< frame::XModel >& rModel, const rtl::OUString& rName ) throw ( css::uno::RuntimeException ) :
-+ SwVbaBookmark_BASE( rParent, rContext ), mxModel( rModel ), maName( rName ), mbValid( sal_True )
-+{
-+ uno::Reference< text::XBookmarksSupplier > xBookmarksSupplier( mxModel, uno::UNO_QUERY_THROW );
-+ mxBookmark.set( xBookmarksSupplier->getBookmarks()->getByName( maName ), uno::UNO_QUERY_THROW );
-+}
-+
-+SwVbaBookmark::~SwVbaBookmark()
-+{
-+}
-+
-+void SwVbaBookmark::checkVality() throw ( uno::RuntimeException )
-+{
-+ if( !mbValid )
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("The bookmark is not valid" ) ), uno::Reference< uno::XInterface >() );
-+}
-+
-+void SAL_CALL SwVbaBookmark::Delete() throw ( uno::RuntimeException )
-+{
-+ checkVality();
-+ uno::Reference< text::XTextDocument > xTextDocument( mxModel, uno::UNO_QUERY_THROW );
-+ xTextDocument->getText()->removeTextContent( mxBookmark );
-+ mbValid = sal_False;
-+}
-+
-+void SAL_CALL SwVbaBookmark::Select() throw ( uno::RuntimeException )
-+{
-+ checkVality();
-+ uno::Reference< text::XTextViewCursorSupplier > xViewCursorSupplier( mxModel->getCurrentController(), uno::UNO_QUERY_THROW );
-+ xViewCursorSupplier->getViewCursor()->gotoRange( mxBookmark->getAnchor(),sal_False );
-+}
-+
-+rtl::OUString SAL_CALL SwVbaBookmark::getName() throw ( uno::RuntimeException )
-+{
-+ return maName;
-+}
-+
-+void SAL_CALL SwVbaBookmark::setName( const rtl::OUString& _name ) throw ( uno::RuntimeException )
-+{
-+ uno::Reference< container::XNamed > xNamed( mxBookmark, uno::UNO_QUERY_THROW );
-+ xNamed->setName( _name );
-+}
-+
-+uno::Any SAL_CALL SwVbaBookmark::Range() throw ( uno::RuntimeException )
-+{
-+ uno::Reference< text::XTextContent > xTextContent( mxBookmark, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextDocument > xTextDocument( mxModel, uno::UNO_QUERY_THROW );
-+ return uno::makeAny( uno::Reference< word::XRange>( new SwVbaRange( this, mxContext, xTextDocument, xTextContent->getAnchor()->getStart(), xTextContent->getAnchor()->getEnd() ) ) );
-+}
-+
-+rtl::OUString&
-+SwVbaBookmark::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaBookmark") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaBookmark::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Bookmark" ) );
-+ }
-+ return aServiceNames;
-+}
-+
---- sw/source/ui/vba/vbabookmark.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sw/source/ui/vba/vbabookmark.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,68 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_BOOKMARK_HXX
-+#define SW_VBA_BOOKMARK_HXX
-+
-+#include <ooo/vba/word/XBookmark.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/text/XBookmarksSupplier.hpp>
-+#include <com/sun/star/text/XTextContent.hpp>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XBookmark > SwVbaBookmark_BASE;
-+
-+class SwVbaBookmark : public SwVbaBookmark_BASE
-+{
-+private:
-+ css::uno::Reference< css::frame::XModel > mxModel;
-+ css::uno::Reference< css::text::XTextContent > mxBookmark;
-+ rtl::OUString maName;
-+ sal_Bool mbValid;
-+
-+private:
-+ void checkVality() throw ( css::uno::RuntimeException );
-+
-+public:
-+ SwVbaBookmark( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext,
-+ const css::uno::Reference< css::frame::XModel >& rModel, const rtl::OUString& rName ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaBookmark();
-+
-+ // Methods
-+ virtual rtl::OUString SAL_CALL getName() throw ( css::uno::RuntimeException );
-+ virtual void SAL_CALL setName( const rtl::OUString& ) throw ( css::uno::RuntimeException );
-+ virtual void SAL_CALL Delete() throw ( css::uno::RuntimeException );
-+ virtual void SAL_CALL Select() throw ( css::uno::RuntimeException );
-+ virtual css::uno::Any SAL_CALL Range() throw ( css::uno::RuntimeException );
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_BOOKMARK_HXX */
---- sw/source/ui/vba/vbabookmarks.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sw/source/ui/vba/vbabookmarks.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,193 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbabookmarks.hxx"
-+#include "vbabookmark.hxx"
-+#include <com/sun/star/container/XNamed.hpp>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include <com/sun/star/text/XTextViewCursor.hpp>
-+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
-+#include <ooo/vba/word/WdBookmarkSortBy.hpp>
-+#include "vbarange.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+class BookmarksEnumeration : public EnumerationHelperImpl
-+{
-+ uno::Reference< frame::XModel > mxModel;
-+ uno::WeakReference< XHelperInterface > mxParent;
-+public:
-+ BookmarksEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration, const uno::Reference< frame::XModel >& xModel ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xContext, xEnumeration ), mxModel( xModel ), mxParent( xParent ) {}
-+
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ uno::Reference< container::XNamed > xNamed( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
-+ rtl::OUString aName = xNamed->getName();
-+ return uno::makeAny( uno::Reference< word::XBookmark > ( new SwVbaBookmark( mxParent, m_xContext, mxModel, aName ) ) );
-+ }
-+
-+};
-+
-+SwVbaBookmarks::SwVbaBookmarks( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext, const uno::Reference< container::XIndexAccess >& xBookmarks, const uno::Reference< frame::XModel >& xModel ): SwVbaBookmarks_BASE( xParent, xContext, xBookmarks ), mxModel( xModel )
-+{
-+ mxBookmarksSupplier.set( mxModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextDocument > xDocument( mxModel, uno::UNO_QUERY_THROW );
-+ mxText = xDocument->getText();
-+
-+ // FIXME: fail to rename the bookmark
-+ // word doesn't distinguish cases, so set all bookmarknames to Lowercase
-+ //renameAllBookmarksToLowercase();
-+}
-+// XEnumerationAccess
-+uno::Type
-+SwVbaBookmarks::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XBookmark::static_type(0);
-+}
-+uno::Reference< container::XEnumeration >
-+SwVbaBookmarks::createEnumeration() throw (uno::RuntimeException)
-+{
-+ uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
-+ return new BookmarksEnumeration( getParent(), mxContext,xEnumAccess->createEnumeration(), mxModel );
-+}
-+
-+uno::Any
-+SwVbaBookmarks::createCollectionObject( const css::uno::Any& aSource )
-+{
-+ uno::Reference< container::XNamed > xNamed( aSource, uno::UNO_QUERY_THROW );
-+ rtl::OUString aName = xNamed->getName();
-+ return uno::makeAny( uno::Reference< word::XBookmark > ( new SwVbaBookmark( getParent(), mxContext, mxModel, aName ) ) );
-+}
-+
-+void SwVbaBookmarks::removeBookmarkByName( const rtl::OUString& rName ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< text::XTextContent > xBookmark( mxBookmarksSupplier->getBookmarks()->getByName( rName ), uno::UNO_QUERY_THROW );
-+ mxText->removeTextContent( xBookmark );
-+}
-+
-+void SwVbaBookmarks::addBookmarkByName( const rtl::OUString& rName, const uno::Reference< text::XTextRange >& rTextRange ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< lang::XMultiServiceFactory > xDocMSF( mxModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextContent > xBookmark( xDocMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.Bookmark")) ), uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XNamed > xNamed( xBookmark, uno::UNO_QUERY_THROW );
-+ xNamed->setName( rName );
-+ mxText->insertTextContent( rTextRange, xBookmark, sal_False );
-+}
-+
-+void SwVbaBookmarks::renameAllBookmarksToLowercase() throw (uno::RuntimeException)
-+{
-+ uno::Reference< container::XIndexAccess > xBookmarks( mxBookmarksSupplier->getBookmarks(),uno::UNO_QUERY_THROW );
-+ for( sal_Int32 nIndex = 0; nIndex < xBookmarks->getCount(); nIndex++ )
-+ {
-+ uno::Reference< container::XNamed > xNamed( xBookmarks->getByIndex( nIndex ), uno::UNO_QUERY_THROW );
-+ rtl::OUString aName = xNamed->getName();
-+ rtl::OUString aNameLowerCase = aName.toAsciiLowerCase();
-+ if( !aName.equals( aNameLowerCase ) );
-+ xNamed->setName( aNameLowerCase );
-+ }
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaBookmarks::Add( const rtl::OUString& rName, const uno::Any& rRange ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< text::XTextRange > xTextRange;
-+ uno::Reference< word::XRange > xRange;
-+ if( rRange >>= xRange )
-+ {
-+ SwVbaRange* pRange = dynamic_cast< SwVbaRange* >( xRange.get() );
-+ if( pRange )
-+ xTextRange = pRange->getXTextRange();
-+ }
-+ else
-+ {
-+ // FIXME: insert the bookmark into current view cursor
-+ uno::Reference< text::XTextViewCursorSupplier > xViewCursorSupplier( mxModel->getCurrentController(), uno::UNO_QUERY_THROW );
-+ xTextRange.set( xViewCursorSupplier->getViewCursor(), uno::UNO_QUERY_THROW );
-+ }
-+
-+ // remove the exist bookmark
-+ rtl::OUString aName = rName.toAsciiLowerCase();
-+ if( mxBookmarksSupplier->getBookmarks()->hasByName( aName ) )
-+ removeBookmarkByName( aName );
-+
-+ addBookmarkByName( aName, xTextRange );
-+
-+ return uno::makeAny( uno::Reference< word::XBookmark >( new SwVbaBookmark( getParent(), mxContext, mxModel, aName ) ) );
-+}
-+
-+sal_Int32 SAL_CALL
-+SwVbaBookmarks::getDefaultSorting() throw (css::uno::RuntimeException)
-+{
-+ return word::WdBookmarkSortBy::wdSortByName;
-+}
-+
-+void SAL_CALL
-+SwVbaBookmarks::setDefaultSorting( sal_Int32/* _type*/ ) throw (css::uno::RuntimeException)
-+{
-+ // not support in Writer
-+}
-+
-+sal_Bool SAL_CALL
-+SwVbaBookmarks::getShowHidden() throw (css::uno::RuntimeException)
-+{
-+ return sal_True;
-+}
-+
-+void SAL_CALL
-+SwVbaBookmarks::setShowHidden( sal_Bool /*_hidden*/ ) throw (css::uno::RuntimeException)
-+{
-+ // not support in Writer
-+}
-+
-+sal_Bool SAL_CALL
-+SwVbaBookmarks::Exists( const rtl::OUString& rName ) throw (css::uno::RuntimeException)
-+{
-+ sal_Bool bExist = mxBookmarksSupplier->getBookmarks()->hasByName( rName.toAsciiLowerCase() );
-+ return bExist;
-+}
-+
-+rtl::OUString&
-+SwVbaBookmarks::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaBookmarks") );
-+ return sImplName;
-+}
-+
-+css::uno::Sequence<rtl::OUString>
-+SwVbaBookmarks::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Bookmarks") );
-+ }
-+ return sNames;
-+}
---- sw/source/ui/vba/vbabookmarks.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sw/source/ui/vba/vbabookmarks.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,79 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_BOOKMARKS_HXX
-+#define SW_VBA_BOOKMARKS_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XBookmarks.hpp>
-+#include <com/sun/star/container/XEnumerationAccess.hpp>
-+#include <com/sun/star/container/XIndexAccess.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/text/XBookmarksSupplier.hpp>
-+#include <com/sun/star/text/XTextRange.hpp>
-+#include <com/sun/star/text/XText.hpp>
-+
-+typedef CollTestImplHelper< ooo::vba::word::XBookmarks > SwVbaBookmarks_BASE;
-+
-+class SwVbaBookmarks : public SwVbaBookmarks_BASE
-+{
-+private:
-+ css::uno::Reference< css::frame::XModel > mxModel;
-+ css::uno::Reference< css::text::XBookmarksSupplier > mxBookmarksSupplier;
-+ css::uno::Reference< css::text::XText > mxText;
-+
-+private:
-+ void removeBookmarkByName( const rtl::OUString& rName ) throw (css::uno::RuntimeException);
-+ void addBookmarkByName( const rtl::OUString& rName, const css::uno::Reference< css::text::XTextRange >& rTextRange ) throw (css::uno::RuntimeException);
-+ void renameAllBookmarksToLowercase() throw (css::uno::RuntimeException);
-+
-+public:
-+ SwVbaBookmarks( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::container::XIndexAccess >& xBookmarks, const css::uno::Reference< css::frame::XModel >& xModel );
-+ virtual ~SwVbaBookmarks() {}
-+
-+ // 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);
-+
-+ // SwVbaBookmarks_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+
-+ // XBookmarks
-+ virtual sal_Int32 SAL_CALL getDefaultSorting() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setDefaultSorting( sal_Int32 _type ) throw (css::uno::RuntimeException);
-+ virtual sal_Bool SAL_CALL getShowHidden() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setShowHidden( sal_Bool _hidden ) throw (css::uno::RuntimeException);
-+
-+ virtual css::uno::Any SAL_CALL Add( const rtl::OUString& rName, const css::uno::Any& rRange ) throw (css::uno::RuntimeException);
-+ virtual sal_Bool SAL_CALL Exists( const rtl::OUString& rName ) throw (css::uno::RuntimeException);
-+};
-+
-+#endif /* SW_VBA_BOOKMARKS_HXX */
---- sw/source/ui/vba/vbadocument.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sw/source/ui/vba/vbadocument.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,186 @@
-+/*************************************************************************
-+ *
-+ * 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: vbadocument.cxx,v $
-+ * $Revision: 1.7 $
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbadocument.hxx"
-+#include "vbarange.hxx"
-+#include "vbarangehelper.hxx"
-+#include "vbadocumentproperties.hxx"
-+#include "vbabookmarks.hxx"
-+#include "vbavariables.hxx"
-+#include <com/sun/star/text/XBookmarksSupplier.hpp>
-+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
-+#include <com/sun/star/document/XDocumentProperties.hpp>
-+#include <vbahelper/helperdecl.hxx>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaDocument::SwVbaDocument( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, uno::Reference< frame::XModel > xModel ): SwVbaDocument_BASE( xParent, xContext, xModel )
-+{
-+ Initialize();
-+}
-+SwVbaDocument::SwVbaDocument( uno::Sequence< uno::Any > const& aArgs, uno::Reference< uno::XComponentContext >const& xContext ) : SwVbaDocument_BASE( aArgs, xContext )
-+{
-+ Initialize();
-+}
-+
-+SwVbaDocument::~SwVbaDocument()
-+{
-+}
-+
-+void SwVbaDocument::Initialize()
-+{
-+ mxTextDocument.set( getModel(), uno::UNO_QUERY_THROW );
-+}
-+
-+uno::Reference< word::XRange > SAL_CALL
-+SwVbaDocument::getContent() throw ( uno::RuntimeException )
-+{
-+ uno::Reference< text::XTextRange > xStart = mxTextDocument->getText()->getStart();
-+ uno::Reference< text::XTextRange > xEnd;
-+ return uno::Reference< word::XRange >( new SwVbaRange( this, mxContext, mxTextDocument, xStart, xEnd, sal_True ) );
-+}
-+
-+uno::Reference< word::XRange > SAL_CALL
-+SwVbaDocument::Range( const uno::Any& rStart, const uno::Any& rEnd ) throw ( uno::RuntimeException )
-+{
-+ if( !rStart.hasValue() && !rEnd.hasValue() )
-+ return getContent();
-+
-+ sal_Int32 nStart = 0;
-+ sal_Int32 nEnd = 0;
-+ rStart >>= nStart;
-+ rEnd >>= nEnd;
-+ nStart--;
-+ nEnd--;
-+
-+ uno::Reference< text::XTextRange > xStart;
-+ uno::Reference< text::XTextRange > xEnd;
-+ if( nStart != -1 || nEnd != -1 )
-+ {
-+ if( nStart == -1 )
-+ xStart = mxTextDocument->getText()->getStart();
-+ else
-+ xStart = SwVbaRangeHelper::getRangeByPosition( mxTextDocument->getText(), nStart );
-+
-+ if( nEnd == -1 )
-+ xEnd = mxTextDocument->getText()->getEnd();
-+ else
-+ xEnd = SwVbaRangeHelper::getRangeByPosition( mxTextDocument->getText(), nEnd );
-+ }
-+
-+ if( !xStart.is() && !xEnd.is() )
-+ {
-+ try
-+ {
-+ // FIXME
-+ xStart = mxTextDocument->getText()->getStart();
-+ xEnd = mxTextDocument->getText()->getEnd();
-+ }
-+ catch( uno::Exception )
-+ {
-+ DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
-+ }
-+ }
-+ return uno::Reference< word::XRange >( new SwVbaRange( this, mxContext, mxTextDocument, xStart, xEnd ) );
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaDocument::BuiltInDocumentProperties( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< XCollection > xCol( new SwVbaBuiltinDocumentProperties( mxParent, mxContext, getModel() ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaDocument::CustomDocumentProperties( const uno::Any& index ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< XCollection > xCol( new SwVbaCustomDocumentProperties( mxParent, mxContext, getModel() ) );
-+ if ( index.hasValue() )
-+ return xCol->Item( index, uno::Any() );
-+ return uno::makeAny( xCol );
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaDocument::Bookmarks( const uno::Any& rIndex ) throw ( uno::RuntimeException )
-+{
-+ uno::Reference< text::XBookmarksSupplier > xBookmarksSupplier( getModel(),uno::UNO_QUERY_THROW );
-+ uno::Reference<container::XIndexAccess > xBookmarks( xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY_THROW );
-+ uno::Reference< XCollection > xBookmarksVba( new SwVbaBookmarks( this, mxContext, xBookmarks, getModel() ) );
-+ if ( rIndex.getValueTypeClass() == uno::TypeClass_VOID )
-+ return uno::makeAny( xBookmarksVba );
-+
-+ return uno::Any( xBookmarksVba->Item( rIndex, uno::Any() ) );
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaDocument::Variables( const uno::Any& rIndex ) throw ( uno::RuntimeException )
-+{
-+ uno::Reference< document::XDocumentPropertiesSupplier > xDocumentPropertiesSupplier( getModel(),uno::UNO_QUERY_THROW );
-+ uno::Reference< document::XDocumentProperties > xDocumentProperties = xDocumentPropertiesSupplier->getDocumentProperties();
-+ uno::Reference< beans::XPropertyAccess > xUserDefined( xDocumentProperties->getUserDefinedProperties(), uno::UNO_QUERY_THROW );
-+
-+ uno::Reference< XCollection > xVariables( new SwVbaVariables( this, mxContext, xUserDefined ) );
-+ if ( rIndex.getValueTypeClass() == uno::TypeClass_VOID )
-+ return uno::makeAny( xVariables );
-+
-+ return uno::Any( xVariables->Item( rIndex, uno::Any() ) );
-+}
-+
-+rtl::OUString&
-+SwVbaDocument::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaDocument") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaDocument::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Document" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-+namespace document
-+{
-+namespace sdecl = comphelper::service_decl;
-+sdecl::vba_service_class_<SwVbaDocument, sdecl::with_args<true> > serviceImpl;
-+extern sdecl::ServiceDecl const serviceDecl(
-+ serviceImpl,
-+ "SwVbaDocument",
-+ "ooo.vba.word.Document" );
-+}
-+
---- sw/source/ui/vba/vbadocument.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sw/source/ui/vba/vbadocument.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,63 @@
-+/*************************************************************************
-+ *
-+ * 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: vbadocument.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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_DOCUMENT_HXX
-+#define SW_VBA_DOCUMENT_HXX
-+
-+#include <ooo/vba/word/XDocument.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <vbahelper/vbadocumentbase.hxx>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+
-+typedef cppu::ImplInheritanceHelper1< VbaDocumentBase, ooo::vba::word::XDocument > SwVbaDocument_BASE;
-+
-+class SwVbaDocument : public SwVbaDocument_BASE
-+{
-+private:
-+ css::uno::Reference< css::text::XTextDocument > mxTextDocument;
-+
-+ void Initialize();
-+public:
-+ SwVbaDocument( const css::uno::Reference< ooo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& m_xContext, css::uno::Reference< css::frame::XModel > xModel );
-+ SwVbaDocument( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext );
-+ virtual ~SwVbaDocument();
-+
-+ // XDocument
-+ virtual css::uno::Reference< ooo::vba::word::XRange > SAL_CALL getContent() throw ( css::uno::RuntimeException );
-+ virtual css::uno::Reference< ooo::vba::word::XRange > SAL_CALL Range( const css::uno::Any& rStart, const css::uno::Any& rEnd ) throw ( css::uno::RuntimeException );
-+ virtual css::uno::Any SAL_CALL BuiltInDocumentProperties( const css::uno::Any& index ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL CustomDocumentProperties( const css::uno::Any& index ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Bookmarks( const css::uno::Any& rIndex ) throw ( css::uno::RuntimeException );
-+ virtual css::uno::Any SAL_CALL Variables( const css::uno::Any& rIndex ) throw ( css::uno::RuntimeException );
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_DOCUMENT_HXX */
---- sw/source/ui/vba/vbadocumentproperties.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sw/source/ui/vba/vbadocumentproperties.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,798 @@
-+/*************************************************************************
-+ *
-+ * 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: vbadocument.cxx,v $
-+ * $Revision: 1.7 $
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbadocumentproperties.hxx"
-+#include <cppuhelper/implbase1.hxx>
-+#include <cppuhelper/implbase3.hxx>
-+#include <com/sun/star/document/XDocumentInfoSupplier.hpp>
-+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
-+#include <com/sun/star/beans/NamedValue.hpp>
-+#include <com/sun/star/beans/XPropertyContainer.hpp>
-+#include <ooo/vba/word/WdBuiltInProperty.hpp>
-+#include <ooo/vba/office/MsoDocProperties.hpp>
-+#include <memory>
-+#include <boost/shared_ptr.hpp>
-+#include "wordvbahelper.hxx"
-+#include "fesh.hxx"
-+#include "docsh.hxx"
-+using namespace ::ooo::vba;
-+using namespace css;
-+
-+sal_Int8 lcl_toMSOPropType( const uno::Type& aType ) throw ( lang::IllegalArgumentException )
-+{
-+ sal_Int16 msoType = office::MsoDocProperties::msoPropertyTypeString;
-+
-+ switch ( aType.getTypeClass() )
-+ {
-+ case uno::TypeClass_BOOLEAN:
-+ msoType = office::MsoDocProperties::msoPropertyTypeBoolean;
-+ break;
-+ case uno::TypeClass_FLOAT:
-+ msoType = office::MsoDocProperties::msoPropertyTypeFloat;
-+ break;
-+ case uno::TypeClass_STRUCT: // Assume date
-+ msoType = office::MsoDocProperties::msoPropertyTypeDate;
-+ break;
-+ case uno::TypeClass_BYTE:
-+ case uno::TypeClass_SHORT:
-+ case uno::TypeClass_LONG:
-+ case uno::TypeClass_HYPER:
-+ msoType = office::MsoDocProperties::msoPropertyTypeNumber;
-+ break;
-+ default:
-+ throw lang::IllegalArgumentException();
-+ }
-+ return msoType;
-+}
-+
-+class PropertGetSetHelper
-+{
-+protected:
-+ uno::Reference< frame::XModel > m_xModel;
-+ uno::Reference< beans::XPropertySet > mxProps;
-+public:
-+ PropertGetSetHelper( const uno::Reference< frame::XModel >& xModel ):m_xModel( xModel )
-+ {
-+ uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( m_xModel, uno::UNO_QUERY_THROW );
-+ mxProps.set( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW );
-+ }
-+ virtual ~PropertGetSetHelper() {}
-+ virtual uno::Any getPropertyValue( const rtl::OUString& rPropName ) = 0;
-+ virtual void setPropertyValue( const rtl::OUString& rPropName, const uno::Any& aValue ) = 0;
-+ virtual uno::Reference< beans::XPropertySet > getUnoProperties() { return mxProps; }
-+
-+};
-+
-+class BuiltinPropertyGetSetHelper : public PropertGetSetHelper
-+{
-+public:
-+ BuiltinPropertyGetSetHelper( const uno::Reference< frame::XModel >& xModel ) :PropertGetSetHelper( xModel )
-+ {
-+ }
-+ virtual uno::Any getPropertyValue( const rtl::OUString& rPropName )
-+ {
-+ if ( rPropName.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("EditingDuration" ) ) ) )
-+ {
-+ sal_Int32 nSecs = 0;
-+ mxProps->getPropertyValue( rPropName ) >>= nSecs;
-+ return uno::makeAny( nSecs/60 ); // minutes
-+ }
-+ return mxProps->getPropertyValue( rPropName );
-+ }
-+ virtual void setPropertyValue( const rtl::OUString& rPropName, const uno::Any& aValue )
-+ {
-+ mxProps->setPropertyValue( rPropName, aValue );
-+ }
-+};
-+
-+class CustomPropertyGetSetHelper : public BuiltinPropertyGetSetHelper
-+{
-+public:
-+ CustomPropertyGetSetHelper( const uno::Reference< frame::XModel >& xModel ) :BuiltinPropertyGetSetHelper( xModel )
-+ {
-+ uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( mxProps, uno::UNO_QUERY_THROW );
-+ uno::Reference< document::XDocumentProperties > xDocProp( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW );
-+ mxProps.set( xDocProp->getUserDefinedProperties(), uno::UNO_QUERY_THROW );
-+ }
-+};
-+class StatisticPropertyGetSetHelper : public PropertGetSetHelper
-+{
-+ SwDocShell* mpDocShell;
-+ uno::Reference< beans::XPropertySet > mxModelProps;
-+public:
-+ StatisticPropertyGetSetHelper( const uno::Reference< frame::XModel >& xModel ) :PropertGetSetHelper( xModel ) , mpDocShell( NULL )
-+ {
-+ mxModelProps.set( m_xModel, uno::UNO_QUERY_THROW );
-+ mpDocShell = word::getDocShell( xModel );
-+ }
-+ virtual uno::Any getPropertyValue( const rtl::OUString& rPropName )
-+ {
-+ uno::Sequence< beans::NamedValue > stats;
-+ try
-+ {
-+ // Characters, ParagraphCount & WordCount are available from
-+ // the model ( and addtionally these also update the statics object )
-+ //return mxProps->getPropertyValue( rPropName );
-+ return mxModelProps->getPropertyValue( rPropName );
-+ }
-+ catch( uno::Exception& )
-+ {
-+ OSL_TRACE("Got exception");
-+ }
-+ uno::Any aReturn;
-+ if ( rPropName.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount")) ) ) // special processing needed
-+ {
-+ if ( mpDocShell )
-+ {
-+ SwFEShell* pFEShell = mpDocShell->GetFEShell();
-+ if(pFEShell)
-+ {
-+ aReturn <<= pFEShell->GetLineCount(FALSE);
-+ }
-+ }
-+ }
-+ else
-+ {
-+ mxModelProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParagraphCount") ) ) >>= stats;
-+ mxProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DocumentStatistic") ) ) >>= stats;
-+
-+ sal_Int32 nLen = stats.getLength();
-+ bool bFound = false;
-+ for ( sal_Int32 index = 0; index < nLen && !bFound ; ++index )
-+ {
-+ if ( rPropName.equals( stats[ index ].Name ) )
-+ {
-+ aReturn = stats[ index ].Value;
-+ bFound = true;
-+ }
-+ }
-+ if ( !bFound )
-+ throw uno::RuntimeException(); // bad Property
-+ }
-+ return aReturn;
-+ }
-+
-+ virtual void setPropertyValue( const rtl::OUString& rPropName, const uno::Any& aValue )
-+ {
-+
-+ uno::Sequence< beans::NamedValue > stats;
-+ mxProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DocumentStatistic") ) ) >>= stats;
-+
-+ sal_Int32 nLen = stats.getLength();
-+ for ( sal_Int32 index = 0; index < nLen; ++index )
-+ {
-+ if ( rPropName.equals( stats[ index ].Name ) )
-+ {
-+ stats[ index ].Value = aValue;
-+ mxProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DocumentStatistic") ), uno::makeAny( stats ) );
-+ break;
-+ }
-+ }
-+ }
-+};
-+
-+class DocPropInfo
-+{
-+public:
-+ rtl::OUString msMSODesc;
-+ rtl::OUString msOOOPropName;
-+ boost::shared_ptr< PropertGetSetHelper > mpPropGetSetHelper;
-+
-+ static DocPropInfo createDocPropInfo( const rtl::OUString& sDesc, const rtl::OUString& sPropName, boost::shared_ptr< PropertGetSetHelper >& rHelper )
-+ {
-+ return createDocPropInfo( rtl::OUStringToOString( sDesc, RTL_TEXTENCODING_UTF8 ).getStr(), rtl::OUStringToOString( sPropName, RTL_TEXTENCODING_UTF8 ).getStr(), rHelper );
-+ }
-+
-+ static DocPropInfo createDocPropInfo( const sal_Char* sDesc, const sal_Char* sPropName, boost::shared_ptr< PropertGetSetHelper >& rHelper )
-+ {
-+ DocPropInfo aItem;
-+ aItem.msMSODesc = rtl::OUString::createFromAscii( sDesc );
-+ aItem.msOOOPropName = rtl::OUString::createFromAscii( sPropName );
-+ aItem.mpPropGetSetHelper = rHelper;
-+ return aItem;
-+ }
-+ uno::Any getValue()
-+ {
-+ if ( mpPropGetSetHelper.get() )
-+ return mpPropGetSetHelper->getPropertyValue( msOOOPropName );
-+ return uno::Any();
-+ }
-+ void setValue( const uno::Any& rValue )
-+ {
-+ if ( mpPropGetSetHelper.get() )
-+ mpPropGetSetHelper->setPropertyValue( msOOOPropName, rValue );
-+ }
-+ uno::Reference< beans::XPropertySet > getUnoProperties()
-+ {
-+
-+ uno::Reference< beans::XPropertySet > xProps;
-+ if ( mpPropGetSetHelper.get() )
-+ return mpPropGetSetHelper->getUnoProperties();
-+ return xProps;
-+ }
-+};
-+
-+
-+typedef std::hash_map< sal_Int32, DocPropInfo > MSOIndexToOODocPropInfo;
-+
-+class BuiltInIndexHelper
-+{
-+ MSOIndexToOODocPropInfo m_docPropInfoMap;
-+ BuiltInIndexHelper();
-+public:
-+ BuiltInIndexHelper( const uno::Reference< frame::XModel >& xModel )
-+ {
-+ boost::shared_ptr< PropertGetSetHelper > aStandardHelper( new BuiltinPropertyGetSetHelper( xModel ) );
-+ boost::shared_ptr< PropertGetSetHelper > aUsingStatsHelper( new StatisticPropertyGetSetHelper( xModel ) );
-+/*
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTitle ] = DocPropInfo::createDocPropInfo( "Title", "Title", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper );
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertySubject ] = DocPropInfo::createDocPropInfo( "Subject", "Subject", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper );
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyAuthor ] = DocPropInfo::createDocPropInfo( "Author", "Author", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper );
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyKeywords ] = DocPropInfo::createDocPropInfo( "Keywords", "Keywords", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper );
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyComments ] = DocPropInfo::createDocPropInfo( "Comments", "Description", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper );
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTemplate ] = DocPropInfo::createDocPropInfo( "Template", "Template", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper );
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyLastAuthor ] = DocPropInfo::createDocPropInfo( "Last author", "", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper ); // doesn't seem to exist - throw or return nothing ?
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyRevision ] = DocPropInfo::createDocPropInfo( "Revision number", "", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper ); // doesn't seem to exist - throw or return nothing ?
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyAppName ] = DocPropInfo::createDocPropInfo( "Application name", "Generator", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper ); // doesn't seem to exist - throw or return nothing ?
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTimeLastPrinted ] = DocPropInfo::createDocPropInfo( "Last print date", "PrintDate", office::MsoDocProperties::msoPropertyTypeDate, aStandardHelper ); // doesn't seem to exist - throw or return nothing ?
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTimeCreated ] = DocPropInfo::createDocPropInfo( "Creation date", "CreationDate", office::MsoDocProperties::msoPropertyTypeDate, aStandardHelper ); // doesn't seem to exist - throw or return nothing ?
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTimeLastSaved ] = DocPropInfo::createDocPropInfo( "Last save time", "ModifyDate", office::MsoDocProperties::msoPropertyTypeDate, aStandardHelper ); // doesn't seem to exist - throw or return nothing ?
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyVBATotalEdit ] = DocPropInfo::createDocPropInfo( "Total editing time", "EditingDuration", office::MsoDocProperties::msoPropertyTypeNumber, aStandardHelper ); // Not sure if this is correct
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyPages ] = DocPropInfo::createDocPropInfo( "Number of pages", "PageCount", office::MsoDocProperties::msoPropertyTypeNumber, aUsingStatsHelper ); // special handling required
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyWords ] = DocPropInfo::createDocPropInfo( "Number of words", "WordCount", office::MsoDocProperties::msoPropertyTypeNumber, aUsingStatsHelper ); // special handling required
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyCharacters ] = DocPropInfo::createDocPropInfo( "Number of characters", "CharacterCount", office::MsoDocProperties::msoPropertyTypeNumber, aUsingStatsHelper ); // special handling required
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertySecurity ] = DocPropInfo::createDocPropInfo( "Security", "", office::MsoDocProperties::msoPropertyTypeNumber, aStandardHelper ); // doesn't seem to exist
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyCategory ] = DocPropInfo::createDocPropInfo( "Category", "", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper ); // doesn't seem to exist
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyFormat ] = DocPropInfo::createDocPropInfo( "Format", "", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper ); // doesn't seem to exist
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyManager ] = DocPropInfo::createDocPropInfo( "Manager", "", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper ); // doesn't seem to exist
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyCompany ] = DocPropInfo::createDocPropInfo( "Company", "", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper ); // doesn't seem to exist
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyBytes ] = DocPropInfo::createDocPropInfo( "Number of bytes", "", office::MsoDocProperties::msoPropertyTypeNumber, aStandardHelper ); // doesn't seem to exist - size on disk exists ( for an already saved document ) perhaps it will do ( or we need something else )
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyLines ] = DocPropInfo::createDocPropInfo( "Number of lines", "LineCount", office::MsoDocProperties::msoPropertyTypeNumber, aUsingStatsHelper ); // special handling
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyParas ] = DocPropInfo::createDocPropInfo( "Number of paragraphs", "", office::MsoDocProperties::msoPropertyTypeNumber, aUsingStatsHelper ); // special handling
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertySlides ] = DocPropInfo::createDocPropInfo( "Number of slides", "" , office::MsoDocProperties::msoPropertyTypeNumber, aStandardHelper ); // doesn't seem to exist
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyNotes ] = DocPropInfo::createDocPropInfo( "Number of notes", "", office::MsoDocProperties::msoPropertyTypeNumber, aStandardHelper ); // doesn't seem to exist
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyHiddenSlides ] = DocPropInfo::createDocPropInfo("Number of hidden Slides", "", office::MsoDocProperties::msoPropertyTypeNumber, aStandardHelper ); // doesn't seem to exist
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyMMClips ] = DocPropInfo::createDocPropInfo( "Number of multimedia clips", "", office::MsoDocProperties::msoPropertyTypeNumber, aStandardHelper ); // doesn't seem to exist
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyHyperlinkBase ] = DocPropInfo::createDocPropInfo( "Hyperlink base", "AutoloadURL", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper );
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyCharsWSpaces ] = DocPropInfo::createDocPropInfo( "Number of characters (with spaces)", "", office::MsoDocProperties::msoPropertyTypeNumber, aStandardHelper ); // doesn't seem to be supported
-+*/
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTitle ] = DocPropInfo::createDocPropInfo( "Title", "Title", aStandardHelper );
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertySubject ] = DocPropInfo::createDocPropInfo( "Subject", "Subject", aStandardHelper );
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyAuthor ] = DocPropInfo::createDocPropInfo( "Author", "Author", aStandardHelper );
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyKeywords ] = DocPropInfo::createDocPropInfo( "Keywords", "Keywords", aStandardHelper );
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyComments ] = DocPropInfo::createDocPropInfo( "Comments", "Description", aStandardHelper );
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTemplate ] = DocPropInfo::createDocPropInfo( "Template", "Template", aStandardHelper );
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyLastAuthor ] = DocPropInfo::createDocPropInfo( "Last author", "ModifiedBy", aStandardHelper ); // doesn't seem to exist - throw or return nothing ?
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyRevision ] = DocPropInfo::createDocPropInfo( "Revision number", "EditingCycles", aStandardHelper ); // doesn't seem to exist - throw or return nothing ?
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyAppName ] = DocPropInfo::createDocPropInfo( "Application name", "Generator", aStandardHelper ); // doesn't seem to exist - throw or return nothing ?
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTimeLastPrinted ] = DocPropInfo::createDocPropInfo( "Last print date", "PrintDate", aStandardHelper ); // doesn't seem to exist - throw or return nothing ?
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTimeCreated ] = DocPropInfo::createDocPropInfo( "Creation date", "CreationDate", aStandardHelper );
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTimeLastSaved ] = DocPropInfo::createDocPropInfo( "Last save time", "ModifyDate", aStandardHelper );
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyVBATotalEdit ] = DocPropInfo::createDocPropInfo( "Total editing time", "EditingDuration", aStandardHelper ); // Not sure if this is correct
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyPages ] = DocPropInfo::createDocPropInfo( "Number of pages", "PageCount", aUsingStatsHelper ); // special handling required ?
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyWords ] = DocPropInfo::createDocPropInfo( "Number of words", "WordCount", aUsingStatsHelper ); // special handling require ?
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyCharacters ] = DocPropInfo::createDocPropInfo( "Number of characters", "CharacterCount", aUsingStatsHelper ); // special handling required ?
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertySecurity ] = DocPropInfo::createDocPropInfo( "Security", "", aStandardHelper ); // doesn't seem to exist
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyCategory ] = DocPropInfo::createDocPropInfo( "Category", "Category", aStandardHelper ); // hacked in
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyFormat ] = DocPropInfo::createDocPropInfo( "Format", "", aStandardHelper ); // doesn't seem to exist
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyManager ] = DocPropInfo::createDocPropInfo( "Manager", "Manager", aStandardHelper ); // hacked in
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyCompany ] = DocPropInfo::createDocPropInfo( "Company", "Company", aStandardHelper ); // hacked in
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyBytes ] = DocPropInfo::createDocPropInfo( "Number of bytes", "", aStandardHelper ); // doesn't seem to exist - size on disk exists ( for an already saved document ) perhaps it will do ( or we need something else )
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyLines ] = DocPropInfo::createDocPropInfo( "Number of lines", "LineCount", aUsingStatsHelper ); // special handling
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyParas ] = DocPropInfo::createDocPropInfo( "Number of paragraphs", "ParagraphCount", aUsingStatsHelper ); // special handling
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertySlides ] = DocPropInfo::createDocPropInfo( "Number of slides", "" , aStandardHelper ); // doesn't seem to exist
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyNotes ] = DocPropInfo::createDocPropInfo( "Number of notes", "", aStandardHelper ); // doesn't seem to exist
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyHiddenSlides ] = DocPropInfo::createDocPropInfo("Number of hidden Slides", "", aStandardHelper ); // doesn't seem to exist
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyMMClips ] = DocPropInfo::createDocPropInfo( "Number of multimedia clips", "", aStandardHelper ); // doesn't seem to exist
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyHyperlinkBase ] = DocPropInfo::createDocPropInfo( "Hyperlink base", "AutoloadURL", aStandardHelper );
-+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyCharsWSpaces ] = DocPropInfo::createDocPropInfo( "Number of characters (with spaces)", "", aStandardHelper ); // doesn't seem to be supported
-+ }
-+
-+ MSOIndexToOODocPropInfo& getDocPropInfoMap() { return m_docPropInfoMap; }
-+};
-+
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::XDocumentProperty > SwVbaDocumentProperty_BASE;
-+
-+class SwVbaBuiltInDocumentProperty : public SwVbaDocumentProperty_BASE
-+{
-+protected:
-+ DocPropInfo mPropInfo;
-+public:
-+ SwVbaBuiltInDocumentProperty( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const DocPropInfo& rInfo );
-+ // XDocumentProperty
-+ virtual void SAL_CALL Delete( ) throw (script::BasicErrorException, uno::RuntimeException);
-+ virtual ::rtl::OUString SAL_CALL getName( ) throw (script::BasicErrorException, uno::RuntimeException);
-+ virtual void SAL_CALL setName( const ::rtl::OUString& Name ) throw (script::BasicErrorException, uno::RuntimeException);
-+ virtual ::sal_Int8 SAL_CALL getType( ) throw (script::BasicErrorException, uno::RuntimeException);
-+ virtual void SAL_CALL setType( ::sal_Int8 Type ) throw (script::BasicErrorException, uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getLinkToContent( ) throw (script::BasicErrorException, uno::RuntimeException);
-+ virtual void SAL_CALL setLinkToContent( ::sal_Bool LinkToContent ) throw (script::BasicErrorException, uno::RuntimeException);
-+ virtual uno::Any SAL_CALL getValue( ) throw (script::BasicErrorException, uno::RuntimeException);
-+ virtual void SAL_CALL setValue( const uno::Any& Value ) throw (script::BasicErrorException, uno::RuntimeException);
-+ virtual rtl::OUString SAL_CALL getLinkSource( ) throw (script::BasicErrorException, uno::RuntimeException);
-+ virtual void SAL_CALL setLinkSource( const rtl::OUString& LinkSource ) throw (script::BasicErrorException, uno::RuntimeException);
-+ //XDefaultProperty
-+ virtual ::rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (uno::RuntimeException) { return rtl::OUString::createFromAscii("Value"); }
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+class SwVbaCustomDocumentProperty : public SwVbaBuiltInDocumentProperty
-+{
-+public:
-+
-+ SwVbaCustomDocumentProperty( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const DocPropInfo& rInfo );
-+
-+ virtual ::sal_Bool SAL_CALL getLinkToContent( ) throw (script::BasicErrorException, uno::RuntimeException);
-+ virtual void SAL_CALL setLinkToContent( ::sal_Bool LinkToContent ) throw (script::BasicErrorException, uno::RuntimeException);
-+
-+ virtual rtl::OUString SAL_CALL getLinkSource( ) throw (script::BasicErrorException, uno::RuntimeException);
-+ virtual void SAL_CALL setLinkSource( const rtl::OUString& LinkSource ) throw (script::BasicErrorException, uno::RuntimeException);
-+ virtual void SAL_CALL Delete( ) throw (script::BasicErrorException, uno::RuntimeException);
-+ virtual void SAL_CALL setName( const ::rtl::OUString& Name ) throw (script::BasicErrorException, uno::RuntimeException);
-+ virtual void SAL_CALL setType( ::sal_Int8 Type ) throw (script::BasicErrorException, uno::RuntimeException);
-+
-+};
-+
-+
-+SwVbaCustomDocumentProperty::SwVbaCustomDocumentProperty( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const DocPropInfo& rInfo ) : SwVbaBuiltInDocumentProperty( xParent, xContext, rInfo )
-+{
-+}
-+
-+sal_Bool
-+SwVbaCustomDocumentProperty::getLinkToContent( ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ // #FIXME we need to store the link content somewhere
-+ return sal_False;
-+}
-+
-+void
-+SwVbaCustomDocumentProperty::setLinkToContent( sal_Bool /*bLinkContent*/ ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+}
-+
-+rtl::OUString
-+SwVbaCustomDocumentProperty::getLinkSource( ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ // #FIXME we need to store the link content somewhere
-+ return rtl::OUString();;
-+}
-+
-+void
-+SwVbaCustomDocumentProperty::setLinkSource( const rtl::OUString& /*rsLinkContent*/ ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ // #FIXME we need to store the link source somewhere
-+}
-+
-+void SAL_CALL
-+SwVbaCustomDocumentProperty::setName( const ::rtl::OUString& Name ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ // setName on existing property ?
-+ // #FIXME
-+ // do we need to delete existing property and create a new one?
-+}
-+
-+void SAL_CALL
-+SwVbaCustomDocumentProperty::setType( ::sal_Int8 Type ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ // setType, do we need to do a conversion?
-+ // #FIXME the underlying value needs to be changed to the new type
-+}
-+
-+void SAL_CALL
-+SwVbaCustomDocumentProperty::Delete( ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ uno::Reference< beans::XPropertyContainer > xContainer( mPropInfo.getUnoProperties(), uno::UNO_QUERY_THROW );
-+ xContainer->removeProperty( getName() );
-+}
-+
-+SwVbaBuiltInDocumentProperty::SwVbaBuiltInDocumentProperty( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const DocPropInfo& rInfo ) : SwVbaDocumentProperty_BASE( xParent, xContext ), mPropInfo( rInfo )
-+{
-+}
-+
-+void SAL_CALL
-+SwVbaBuiltInDocumentProperty::Delete( ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ // not valid for Builtin
-+ throw uno::RuntimeException();
-+}
-+
-+::rtl::OUString SAL_CALL
-+SwVbaBuiltInDocumentProperty::getName( ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ return mPropInfo.msMSODesc;
-+}
-+
-+void SAL_CALL
-+SwVbaBuiltInDocumentProperty::setName( const rtl::OUString& ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ // not valid for Builtin
-+ throw uno::RuntimeException();
-+}
-+
-+::sal_Int8 SAL_CALL
-+SwVbaBuiltInDocumentProperty::getType( ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ return lcl_toMSOPropType( getValue().getValueType() );
-+}
-+
-+void SAL_CALL
-+SwVbaBuiltInDocumentProperty::setType( ::sal_Int8 /*Type*/ ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ // not valid for Builtin
-+ throw uno::RuntimeException();
-+}
-+
-+::sal_Bool SAL_CALL
-+SwVbaBuiltInDocumentProperty::getLinkToContent( ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ return sal_False; // built-in always false
-+}
-+
-+void SAL_CALL
-+SwVbaBuiltInDocumentProperty::setLinkToContent( ::sal_Bool /*LinkToContent*/ ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ // not valid for Builtin
-+ throw uno::RuntimeException();
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaBuiltInDocumentProperty::getValue( ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ uno::Any aRet = mPropInfo.getValue();
-+ if ( !aRet.hasValue() )
-+ throw uno::RuntimeException();
-+ return aRet;
-+}
-+
-+void SAL_CALL
-+SwVbaBuiltInDocumentProperty::setValue( const uno::Any& Value ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ mPropInfo.setValue( Value );
-+}
-+
-+rtl::OUString SAL_CALL
-+SwVbaBuiltInDocumentProperty::getLinkSource( ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ // not valid for Builtin
-+ throw uno::RuntimeException();
-+}
-+
-+void SAL_CALL
-+SwVbaBuiltInDocumentProperty::setLinkSource( const rtl::OUString& /*LinkSource*/ ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ // not valid for Builtin
-+ throw uno::RuntimeException();
-+}
-+
-+rtl::OUString&
-+SwVbaBuiltInDocumentProperty::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaBuiltinDocumentProperty") );
-+ return sImplName;
-+}
-+
-+uno::Sequence<rtl::OUString>
-+SwVbaBuiltInDocumentProperty::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.DocumentProperty" ) );
-+ }
-+ return aServiceNames;
-+}
-+typedef ::cppu::WeakImplHelper3< com::sun::star::container::XIndexAccess
-+ ,com::sun::star::container::XNameAccess
-+ ,com::sun::star::container::XEnumerationAccess
-+ > PropertiesImpl_BASE;
-+
-+typedef std::hash_map< sal_Int32, uno::Reference< XDocumentProperty > > DocProps;
-+
-+typedef ::cppu::WeakImplHelper1< com::sun::star::container::XEnumeration > DocPropEnumeration_BASE;
-+class DocPropEnumeration : public DocPropEnumeration_BASE
-+{
-+ DocProps mDocProps;
-+ DocProps::iterator mIt;
-+public:
-+
-+ DocPropEnumeration( const DocProps& rProps ) : mDocProps( rProps ), mIt( mDocProps.begin() ) {}
-+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
-+ {
-+ return mIt != mDocProps.end();
-+ }
-+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( !hasMoreElements() )
-+ throw container::NoSuchElementException();
-+ return uno::makeAny( mIt++->second );
-+ }
-+};
-+
-+typedef std::hash_map< rtl::OUString, uno::Reference< XDocumentProperty >, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > DocPropsByName;
-+
-+class BuiltInPropertiesImpl : public PropertiesImpl_BASE
-+{
-+protected:
-+
-+ uno::Reference< XHelperInterface > m_xParent;
-+ uno::Reference< uno::XComponentContext > m_xContext;
-+ uno::Reference< frame::XModel > m_xModel;
-+ uno::Reference< document::XDocumentInfo > m_xOOOBuiltIns;
-+
-+ DocProps mDocProps;
-+ DocPropsByName mNamedDocProps;
-+
-+ public:
-+ BuiltInPropertiesImpl( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) : m_xParent( xParent ), m_xContext( xContext ), m_xModel( xModel )
-+ {
-+ BuiltInIndexHelper builtIns( m_xModel );
-+ for ( sal_Int32 index = word::WdBuiltInProperty::wdPropertyTitle; index <= word::WdBuiltInProperty::wdPropertyCharsWSpaces; ++index )
-+ {
-+ mDocProps[ index ] = new SwVbaBuiltInDocumentProperty( xParent, xContext, builtIns.getDocPropInfoMap()[ index ] );
-+ mNamedDocProps[ mDocProps[ index ]->getName() ] = mDocProps[ index ];
-+ }
-+ }
-+// XIndexAccess
-+ virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
-+ {
-+ return mDocProps.size();
-+ }
-+ virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException )
-+ {
-+ // correct the correct by the base class for 1 based indices
-+ DocProps::iterator it = mDocProps.find( ++Index );
-+ if ( it == mDocProps.end() )
-+ throw lang::IndexOutOfBoundsException();
-+ return uno::makeAny( it->second );
-+ }
-+ virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( !hasByName( aName ) )
-+ throw container::NoSuchElementException();
-+ DocPropsByName::iterator it = mNamedDocProps.find( aName );
-+ return uno::Any( it->second );
-+
-+ }
-+ virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException)
-+ {
-+ uno::Sequence< rtl::OUString > aNames( getCount() );
-+ rtl::OUString* pName = aNames.getArray();
-+ DocPropsByName::iterator it_end = mNamedDocProps.end();
-+ for( DocPropsByName::iterator it = mNamedDocProps.begin(); it != it_end; ++it, ++pName )
-+ *pName = it->first;
-+ return aNames;
-+ }
-+
-+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
-+ {
-+ DocPropsByName::iterator it = mNamedDocProps.find( aName );
-+ if ( it == mNamedDocProps.end() )
-+ return sal_False;
-+ return sal_True;
-+ }
-+// XElementAccess
-+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
-+ {
-+ return XDocumentProperty::static_type(0);
-+ }
-+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
-+ {
-+ return mDocProps.size() > 0;
-+ }
-+ virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
-+ {
-+ return new DocPropEnumeration( mDocProps );
-+ }
-+};
-+
-+SwVbaBuiltinDocumentProperties::SwVbaBuiltinDocumentProperties( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) : SwVbaDocumentproperties_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new BuiltInPropertiesImpl( xParent, xContext, xModel ) ) ), m_xModel( xModel )
-+{
-+}
-+
-+uno::Reference< XDocumentProperty > SAL_CALL
-+SwVbaBuiltinDocumentProperties::Add( const ::rtl::OUString& /*Name*/, ::sal_Bool /*LinkToContent*/, ::sal_Int8 /*Type*/, const uno::Any& value, const uno::Any& /*LinkSource*/ ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ throw uno::RuntimeException(
-+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("not supported for Builtin properties") ), uno::Reference< uno::XInterface >() );
-+}
-+
-+// XEnumerationAccess
-+uno::Type SAL_CALL
-+SwVbaBuiltinDocumentProperties::getElementType() throw (uno::RuntimeException)
-+{
-+ return XDocumentProperty::static_type(0);
-+}
-+
-+uno::Reference< container::XEnumeration > SAL_CALL
-+SwVbaBuiltinDocumentProperties::createEnumeration() throw (uno::RuntimeException)
-+{
-+ uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
-+ return xEnumAccess->createEnumeration();
-+}
-+
-+// ScVbaCollectionBaseImpl
-+uno::Any
-+SwVbaBuiltinDocumentProperties::createCollectionObject( const uno::Any& aSource )
-+{
-+ // pass through
-+ return aSource;
-+}
-+
-+// XHelperInterface
-+rtl::OUString&
-+SwVbaBuiltinDocumentProperties::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaBuiltinDocumentProperties") );
-+ return sImplName;
-+}
-+
-+uno::Sequence<rtl::OUString>
-+SwVbaBuiltinDocumentProperties::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.DocumentProperties" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-+class CustomPropertiesImpl : public PropertiesImpl_BASE
-+{
-+ uno::Reference< XHelperInterface > m_xParent;
-+ uno::Reference< uno::XComponentContext > m_xContext;
-+ uno::Reference< frame::XModel > m_xModel;
-+ uno::Reference< beans::XPropertySet > mxUserDefinedProp;
-+ boost::shared_ptr< PropertGetSetHelper > mpPropGetSetHelper;
-+public:
-+ CustomPropertiesImpl( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) : m_xParent( xParent ), m_xContext( xContext ), m_xModel( xModel )
-+ {
-+ // suck in the document( custom ) properties
-+ uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( m_xModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW );
-+ uno::Reference< document::XDocumentProperties > xDocProp( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW );
-+ mxUserDefinedProp.set( xDocProp->getUserDefinedProperties(), uno::UNO_QUERY_THROW );
-+ mpPropGetSetHelper.reset( new CustomPropertyGetSetHelper( m_xModel ) );
-+ };
-+ // XIndexAccess
-+ virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
-+ {
-+ return mxUserDefinedProp->getPropertySetInfo()->getProperties().getLength();
-+ }
-+
-+ virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException )
-+ {
-+ uno::Sequence< beans::Property > aProps = mxUserDefinedProp->getPropertySetInfo()->getProperties();
-+ if ( Index >= aProps.getLength() )
-+ throw lang::IndexOutOfBoundsException();
-+ // How to determine type e.g Date? ( com.sun.star.util.DateTime )
-+ DocPropInfo aPropInfo = DocPropInfo::createDocPropInfo( aProps[ Index ].Name, aProps[ Index ].Name, mpPropGetSetHelper );
-+ return uno::makeAny( uno::Reference< XDocumentProperty >( new SwVbaCustomDocumentProperty( m_xParent, m_xContext, aPropInfo ) ) );
-+ }
-+
-+ virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if ( !hasByName( aName ) )
-+ throw container::NoSuchElementException();
-+
-+ DocPropInfo aPropInfo = DocPropInfo::createDocPropInfo( aName, aName, mpPropGetSetHelper );
-+ return uno::makeAny( uno::Reference< XDocumentProperty >( new SwVbaCustomDocumentProperty( m_xParent, m_xContext, aPropInfo ) ) );
-+ }
-+
-+ virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException)
-+ {
-+ uno::Sequence< beans::Property > aProps = mxUserDefinedProp->getPropertySetInfo()->getProperties();
-+ uno::Sequence< rtl::OUString > aNames( aProps.getLength() );
-+ rtl::OUString* pString = aNames.getArray();
-+ rtl::OUString* pEnd = ( pString + aNames.getLength() );
-+ beans::Property* pProp = aProps.getArray();
-+ for ( ; pString != pEnd; ++pString, ++pProp )
-+ *pString = pProp->Name;
-+ return aNames;
-+ }
-+
-+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
-+ {
-+ OSL_TRACE("hasByName(%s) returns %d", rtl::OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr(), mxUserDefinedProp->getPropertySetInfo()->hasPropertyByName( aName ) );
-+ return mxUserDefinedProp->getPropertySetInfo()->hasPropertyByName( aName );
-+ }
-+
-+ // XElementAccess
-+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
-+ {
-+ return XDocumentProperty::static_type(0);
-+ }
-+
-+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
-+ {
-+ return getCount() > 0;
-+ }
-+
-+ virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
-+ {
-+ // create a map of properties ( the key doesn't matter )
-+ OSL_TRACE("Creating an enumeration");
-+ sal_Int32 key = 0;
-+ sal_Int32 nElem = getCount();
-+ DocProps simpleDocPropSnapShot;
-+ for ( ; key < nElem; ++key )
-+ simpleDocPropSnapShot[ key ].set( getByIndex( key ), uno::UNO_QUERY_THROW );
-+ OSL_TRACE("After creating the enumeration");
-+ return new DocPropEnumeration( simpleDocPropSnapShot );
-+ }
-+
-+ void addProp( const ::rtl::OUString& Name, ::sal_Int8 Type, const uno::Any& Value )
-+ {
-+ sal_Int16 attributes = 128;
-+ uno::Reference< beans::XPropertyContainer > xContainer( mxUserDefinedProp, uno::UNO_QUERY_THROW );
-+ // TODO fixme, perform the necessary Type Value conversions
-+ xContainer->addProperty( Name, attributes, Value );
-+ }
-+
-+};
-+
-+
-+SwVbaCustomDocumentProperties::SwVbaCustomDocumentProperties( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) : SwVbaBuiltinDocumentProperties( xParent, xContext, xModel )
-+{
-+ // replace the m_xIndexAccess implementation ( we need a virtual init )
-+ m_xIndexAccess.set( new CustomPropertiesImpl( xParent, xContext, xModel ) );
-+ m_xNameAccess.set( m_xIndexAccess, uno::UNO_QUERY_THROW );
-+}
-+
-+uno::Reference< XDocumentProperty > SAL_CALL
-+SwVbaCustomDocumentProperties::Add( const ::rtl::OUString& Name, ::sal_Bool LinkToContent, ::sal_Int8 Type, const uno::Any& Value, const uno::Any& LinkSource ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ CustomPropertiesImpl* pCustomProps = dynamic_cast< CustomPropertiesImpl* > ( m_xIndexAccess.get() );
-+ uno::Reference< XDocumentProperty > xDocProp;
-+ if ( pCustomProps )
-+ {
-+ rtl::OUString sLinkSource;
-+ pCustomProps->addProp( Name, Type, Value );
-+
-+ xDocProp.set( m_xNameAccess->getByName( Name ), uno::UNO_QUERY_THROW );
-+ xDocProp->setLinkToContent( LinkToContent );
-+
-+ if ( LinkSource >>= sLinkSource )
-+ xDocProp->setLinkSource( sLinkSource );
-+ }
-+ return xDocProp;
-+}
-+
-+// XHelperInterface
-+rtl::OUString&
-+SwVbaCustomDocumentProperties::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaCustomDocumentProperties") );
-+ return sImplName;
-+}
---- sw/source/ui/vba/vbadocumentproperties.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sw/source/ui/vba/vbadocumentproperties.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,70 @@
-+/*************************************************************************
-+ *
-+ * 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: vbadocument.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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_DOCUMENTPROPERTIES_HXX
-+#define SW_VBA_DOCUMENTPROPERTIES_HXX
-+
-+#include <ooo/vba/XDocumentProperties.hpp>
-+#include <com/sun/star/frame/XModel.hpp>
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <hash_map>
-+
-+typedef CollTestImplHelper< ov::XDocumentProperties > SwVbaDocumentproperties_BASE;
-+
-+class SwVbaBuiltinDocumentProperties : public SwVbaDocumentproperties_BASE
-+{
-+protected:
-+ css::uno::Reference< css::frame::XModel > m_xModel;
-+public:
-+ SwVbaBuiltinDocumentProperties( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xDocument );
-+
-+ // XDocumentProperties
-+ virtual css::uno::Reference< ::ooo::vba::XDocumentProperty > SAL_CALL Add( const ::rtl::OUString& Name, ::sal_Bool LinkToContent, ::sal_Int8 Type, const css::uno::Any& Value, const css::uno::Any& LinkSource ) 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);
-+ // ScVbaCollectionBaseImpl
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+class SwVbaCustomDocumentProperties : public SwVbaBuiltinDocumentProperties
-+{
-+public:
-+ SwVbaCustomDocumentProperties( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xDocument );
-+// XDocumentProperties
-+ virtual css::uno::Reference< ::ooo::vba::XDocumentProperty > SAL_CALL Add( const ::rtl::OUString& Name, ::sal_Bool LinkToContent, ::sal_Int8 Type, const css::uno::Any& Value, const css::uno::Any& LinkSource ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+};
-+
-+#endif /* SW_VBA_DOCUMENTPROPERTY_HXX */
---- sw/source/ui/vba/vbaglobals.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sw/source/ui/vba/vbaglobals.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,164 @@
-+/*************************************************************************
-+ *
-+ * 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: vbaglobals.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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include <vbahelper/helperdecl.hxx>
-+#include "vbaglobals.hxx"
-+
-+#include <comphelper/unwrapargs.hxx>
-+
-+#include <com/sun/star/lang/XMultiComponentFactory.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <com/sun/star/container/XNameContainer.hpp>
-+#include <cppuhelper/bootstrap.hxx>
-+#include "vbaapplication.hxx"
-+using namespace ::com::sun::star;
-+using namespace ::com::sun::star::uno;
-+using namespace ::ooo::vba;
-+
-+
-+
-+// =============================================================================
-+// SwVbaGlobals
-+// =============================================================================
-+
-+SwVbaGlobals::SwVbaGlobals( css::uno::Reference< css::uno::XComponentContext >const& rxContext ) : SwVbaGlobals_BASE( uno::Reference< XHelperInterface >(), rxContext )
-+{
-+ OSL_TRACE("SwVbaGlobals::SwVbaGlobals()");
-+ init( rxContext, uno::makeAny( getApplication() ) );
-+}
-+
-+SwVbaGlobals::~SwVbaGlobals()
-+{
-+ OSL_TRACE("SwVbaGlobals::~SwVbaGlobals");
-+}
-+
-+// =============================================================================
-+// XGlobals
-+// =============================================================================
-+uno::Reference<word::XApplication >
-+SwVbaGlobals::getApplication() throw (uno::RuntimeException)
-+{
-+ OSL_TRACE("In SwVbaGlobals::getApplication");
-+ static uno::Reference< word::XApplication > WordApplication( new SwVbaApplication( mxContext) );
-+ return WordApplication;
-+}
-+
-+uno::Reference<word::XSystem > SAL_CALL
-+SwVbaGlobals::getSystem() throw (uno::RuntimeException)
-+{
-+ return getApplication()->getSystem();
-+}
-+
-+uno::Reference< word::XDocument > SAL_CALL
-+SwVbaGlobals::getActiveDocument() throw (uno::RuntimeException)
-+{
-+ return getApplication()->getActiveDocument();
-+}
-+
-+uno::Reference< word::XWindow > SAL_CALL
-+SwVbaGlobals::getActiveWindow() throw (uno::RuntimeException)
-+{
-+ return getApplication()->getActiveWindow();
-+}
-+
-+rtl::OUString SAL_CALL
-+SwVbaGlobals::getName() throw (uno::RuntimeException)
-+{
-+ return getApplication()->getName();
-+}
-+
-+uno::Reference<word::XOptions > SAL_CALL
-+SwVbaGlobals::getOptions() throw (uno::RuntimeException)
-+{
-+ return getApplication()->getOptions();
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaGlobals::CommandBars( const uno::Any& aIndex ) throw (uno::RuntimeException)
-+{
-+ return getApplication()->CommandBars( aIndex );
-+}
-+
-+uno::Reference<word::XSelection > SAL_CALL
-+SwVbaGlobals::getSelection() throw (uno::RuntimeException)
-+{
-+ return getApplication()->getSelection();
-+}
-+
-+rtl::OUString&
-+SwVbaGlobals::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaGlobals") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaGlobals::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Globals" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaGlobals::getAvailableServiceNames( ) throw (uno::RuntimeException)
-+{
-+ static bool bInit = false;
-+ static uno::Sequence< rtl::OUString > serviceNames( SwVbaGlobals_BASE::getAvailableServiceNames() );
-+ if ( !bInit )
-+ {
-+ rtl::OUString names[] = {
-+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "ooo.vba.word.Document" ) ),
-+// #FIXME #TODO make Application a proper service
-+// ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "ooo.vba.word.Application" ) ),
-+ };
-+ sal_Int32 nWordServices = ( sizeof( names )/ sizeof( names[0] ) );
-+ sal_Int32 startIndex = serviceNames.getLength();
-+ serviceNames.realloc( serviceNames.getLength() + nWordServices );
-+ for ( sal_Int32 index = 0; index < nWordServices; ++index )
-+ serviceNames[ startIndex + index ] = names[ index ];
-+ bInit = true;
-+ }
-+ return serviceNames;
-+}
-+
-+namespace globals
-+{
-+namespace sdecl = comphelper::service_decl;
-+sdecl::vba_service_class_<SwVbaGlobals, sdecl::with_args<false> > serviceImpl;
-+extern sdecl::ServiceDecl const serviceDecl(
-+ serviceImpl,
-+ "SwVbaGlobals",
-+ "ooo.vba.word.Globals" );
-+}
-+
---- sw/source/ui/vba/vbaglobals.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sw/source/ui/vba/vbaglobals.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,80 @@
-+/*************************************************************************
-+ *
-+ * 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: vbaglobals.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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_GLOBALS_HXX
-+#define SW_VBA_GLOBALS_HXX
-+
-+#include <com/sun/star/lang/XServiceInfo.hpp>
-+#include <com/sun/star/lang/XInitialization.hpp>
-+#include <com/sun/star/uno/XComponentContext.hpp>
-+#include <ooo/vba/word/XGlobals.hpp>
-+#include <ooo/vba/word/XApplication.hpp>
-+#include <ooo/vba/word/XSystem.hpp>
-+#include <ooo/vba/word/XOptions.hpp>
-+#include <ooo/vba/word/XSelection.hpp>
-+
-+#include <cppuhelper/implbase1.hxx>
-+#include <vbahelper/vbahelper.hxx>
-+#include <vbahelper/vbaglobalbase.hxx>
-+
-+// =============================================================================
-+// class SwVbaGlobals
-+// =============================================================================
-+
-+
-+typedef ::cppu::ImplInheritanceHelper1< VbaGlobalsBase, ov::word::XGlobals > SwVbaGlobals_BASE;
-+
-+class SwVbaGlobals : public SwVbaGlobals_BASE
-+{
-+private:
-+ css::uno::Reference< ooo::vba::word::XApplication > mxApplication;
-+
-+ virtual css::uno::Reference< ooo::vba::word::XApplication > getApplication() throw (css::uno::RuntimeException);
-+
-+public:
-+
-+ SwVbaGlobals( css::uno::Reference< css::uno::XComponentContext >const& rxContext );
-+ virtual ~SwVbaGlobals();
-+
-+ // XGlobals
-+ virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
-+ virtual css::uno::Reference< ooo::vba::word::XSystem > SAL_CALL getSystem() throw (css::uno::RuntimeException);
-+ virtual css::uno::Reference< ov::word::XDocument > SAL_CALL getActiveDocument() throw (css::uno::RuntimeException);
-+ virtual css::uno::Reference< ov::word::XWindow > SAL_CALL getActiveWindow() throw (css::uno::RuntimeException);
-+ virtual css::uno::Reference< ooo::vba::word::XOptions > SAL_CALL getOptions() throw (css::uno::RuntimeException);
-+ virtual css::uno::Reference< ooo::vba::word::XSelection > SAL_CALL getSelection() throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL CommandBars( const css::uno::Any& aIndex ) throw (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<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_GLOBALS_HXX */
---- sw/source/ui/vba/vbaoptions.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sw/source/ui/vba/vbaoptions.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,148 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microoptionss, 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbaoptions.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <ooo/vba/word/WdDefaultFilePath.hpp>
-+#include <com/sun/star/util/XStringSubstitution.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <osl/file.hxx>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaOptions::SwVbaOptions( uno::Reference<uno::XComponentContext >& xContext ) throw ( uno::RuntimeException ) : SwVbaOptions_BASE( uno::Reference< XHelperInterface >(), xContext )
-+{
-+ mxFactory.set( comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+}
-+
-+SwVbaOptions::~SwVbaOptions()
-+{
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaOptions::DefaultFilePath( sal_Int32 _path ) throw ( uno::RuntimeException )
-+{
-+ switch( _path )
-+ {
-+ case word::WdDefaultFilePath::wdDocumentsPath:
-+ {
-+ msDefaultFilePath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Work") );
-+ break;
-+ }
-+ case word::WdDefaultFilePath::wdPicturesPath:
-+ {
-+ msDefaultFilePath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Gallery") );
-+ break;
-+ }
-+ case word::WdDefaultFilePath::wdUserTemplatesPath:
-+ case word::WdDefaultFilePath::wdWorkgroupTemplatesPath:
-+ {
-+ msDefaultFilePath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Template") );
-+ break;
-+ }
-+ case word::WdDefaultFilePath::wdUserOptionsPath:
-+ {
-+ msDefaultFilePath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UserConfig") );
-+ break;
-+ }
-+ case word::WdDefaultFilePath::wdToolsPath:
-+ case word::WdDefaultFilePath::wdProgramPath:
-+ {
-+ msDefaultFilePath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Module") );
-+ break;
-+ }
-+ case word::WdDefaultFilePath::wdTempFilePath:
-+ {
-+ msDefaultFilePath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Temp") );
-+ break;
-+ }
-+ default:
-+ {
-+ DebugHelper::exception( SbERR_NOT_IMPLEMENTED, rtl::OUString() );
-+ break;
-+ }
-+ }
-+ return uno::makeAny( uno::Reference< XPropValue > ( new ScVbaPropValue( this ) ) );
-+}
-+
-+void SwVbaOptions::setValueEvent( const uno::Any& value )
-+{
-+ rtl::OUString sNewPath;
-+ value >>= sNewPath;
-+ rtl::OUString sNewPathUrl;
-+ ::osl::File::getFileURLFromSystemPath( sNewPath, sNewPathUrl );
-+ uno::Reference< beans::XPropertySet > xPathSettings( mxFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.util.PathSettings") ), uno::UNO_QUERY_THROW );
-+ rtl::OUString sOldPathUrl;
-+ xPathSettings->getPropertyValue( msDefaultFilePath ) >>= sOldPathUrl;
-+ // path could be a multipath, Microsoft doesn't support this feature in Word currently
-+ // only the last path is from interest.
-+ sal_Int32 nIndex = sOldPathUrl.lastIndexOf( sal_Unicode(';') );
-+ if( nIndex != -1 )
-+ {
-+ sNewPathUrl = sOldPathUrl.copy( 0, nIndex + 1 ).concat( sNewPathUrl );
-+ }
-+ xPathSettings->setPropertyValue( msDefaultFilePath, uno::makeAny( sNewPathUrl ) );
-+}
-+
-+uno::Any SwVbaOptions::getValueEvent()
-+{
-+ uno::Reference< beans::XPropertySet > xPathSettings( mxFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.util.PathSettings") ), uno::UNO_QUERY_THROW );
-+ rtl::OUString sPathUrl;
-+ xPathSettings->getPropertyValue( msDefaultFilePath ) >>= sPathUrl;
-+ // path could be a multipath, Microsoft doesn't support this feature in Word currently
-+ // only the last path is from interest.
-+ sal_Int32 nIndex = sPathUrl.lastIndexOf( sal_Unicode(';') );
-+ if( nIndex != -1 )
-+ {
-+ sPathUrl = sPathUrl.copy( nIndex + 1 );
-+ }
-+ rtl::OUString sPath;
-+ ::osl::File::getSystemPathFromFileURL( sPathUrl, sPath );
-+ return uno::makeAny( sPath );
-+}
-+
-+rtl::OUString&
-+SwVbaOptions::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaOptions") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaOptions::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Options" ) );
-+ }
-+ return aServiceNames;
-+}
---- sw/source/ui/vba/vbaoptions.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sw/source/ui/vba/vbaoptions.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -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: vbasystem.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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_OPTIONS_HXX
-+#define SW_VBA_OPTIONS_HXX
-+
-+#include <ooo/vba/word/XOptions.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <vbahelper/vbapropvalue.hxx>
-+#include <comphelper/processfactory.hxx>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XOptions > SwVbaOptions_BASE;
-+
-+class SwVbaOptions : public SwVbaOptions_BASE,
-+ public PropListener
-+{
-+private:
-+ rtl::OUString msDefaultFilePath;
-+ css::uno::Reference< css::lang::XMultiServiceFactory > mxFactory;
-+public:
-+ SwVbaOptions( css::uno::Reference< css::uno::XComponentContext >& m_xContext ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaOptions();
-+
-+ // XOptions
-+ virtual css::uno::Any SAL_CALL DefaultFilePath( sal_Int32 _path ) throw ( css::uno::RuntimeException );
-+
-+ //PropListener
-+ virtual void setValueEvent( const css::uno::Any& value );
-+ virtual css::uno::Any getValueEvent();
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_OPTIONS_HXX */
---- sw/source/ui/vba/vbapane.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sw/source/ui/vba/vbapane.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,79 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbapane.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include "vbaview.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaPane::SwVbaPane( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext,
-+ const uno::Reference< frame::XModel >& xModel ) throw ( uno::RuntimeException ) :
-+ SwVbaPane_BASE( rParent, rContext ), mxModel( xModel )
-+{
-+}
-+
-+SwVbaPane::~SwVbaPane()
-+{
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaPane::View() throw ( css::uno::RuntimeException )
-+{
-+ return uno::makeAny( uno::Reference< word::XView >( new SwVbaView( this, mxContext, mxModel ) ) );
-+}
-+
-+void SAL_CALL
-+SwVbaPane::Close( ) throw ( css::uno::RuntimeException )
-+{
-+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CloseWin"));
-+ dispatchRequests( mxModel,url );
-+}
-+
-+rtl::OUString&
-+SwVbaPane::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaPane") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaPane::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Pane" ) );
-+ }
-+ return aServiceNames;
-+}
-+
---- sw/source/ui/vba/vbapane.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sw/source/ui/vba/vbapane.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,57 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_PANE_HXX
-+#define SW_VBA_PANE_HXX
-+
-+#include <ooo/vba/word/XPane.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XPane > SwVbaPane_BASE;
-+
-+class SwVbaPane : public SwVbaPane_BASE
-+{
-+private:
-+ css::uno::Reference< css::frame::XModel > mxModel;
-+
-+public:
-+ SwVbaPane( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext,
-+ const css::uno::Reference< css::frame::XModel >& xModel ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaPane();
-+
-+ // Methods
-+ virtual css::uno::Any SAL_CALL View( ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL Close( ) throw (css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_PANE_HXX */
---- sw/source/ui/vba/vbapanes.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sw/source/ui/vba/vbapanes.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,127 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbapanes.hxx"
-+#include "vbapane.hxx"
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+// I assume there is only one pane in Writer
-+typedef ::cppu::WeakImplHelper1<container::XIndexAccess > PanesIndexAccess_Base;
-+class PanesIndexAccess : public PanesIndexAccess_Base
-+{
-+private:
-+ uno::Reference< XHelperInterface > mxParent;
-+ uno::Reference< uno::XComponentContext > mxContext;
-+ uno::Reference< frame::XModel > mxModel;
-+
-+public:
-+ PanesIndexAccess( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) : mxParent( xParent ), mxContext( xContext ), mxModel( xModel ) {}
-+ ~PanesIndexAccess(){}
-+
-+ // XIndexAccess
-+ virtual sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
-+ {
-+ return 1;
-+ }
-+ virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
-+ {
-+ if( Index != 1 )
-+ throw container::NoSuchElementException();
-+ return uno::makeAny( uno::Reference< word::XPane >( new SwVbaPane( mxParent, mxContext, mxModel ) ) );
-+ }
-+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
-+ {
-+ return word::XPane::static_type(0);
-+ }
-+ virtual sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
-+ {
-+ return sal_True;
-+ }
-+};
-+
-+class PanesEnumWrapper : public EnumerationHelper_BASE
-+{
-+ uno::Reference<container::XIndexAccess > m_xIndexAccess;
-+ sal_Int32 nIndex;
-+public:
-+ PanesEnumWrapper( const uno::Reference< container::XIndexAccess >& xIndexAccess ) : 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)
-+ {
-+ if ( nIndex < m_xIndexAccess->getCount() )
-+ return m_xIndexAccess->getByIndex( nIndex++ );
-+ throw container::NoSuchElementException();
-+ }
-+};
-+
-+SwVbaPanes::SwVbaPanes( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel ): SwVbaPanes_BASE( xParent, xContext, new PanesIndexAccess( xParent, xContext, xModel ) ), mxModel( xModel )
-+{
-+}
-+// XEnumerationAccess
-+uno::Type
-+SwVbaPanes::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XPane::static_type(0);
-+}
-+uno::Reference< container::XEnumeration >
-+SwVbaPanes::createEnumeration() throw (uno::RuntimeException)
-+{
-+ return new PanesEnumWrapper( m_xIndexAccess );
-+}
-+
-+uno::Any
-+SwVbaPanes::createCollectionObject( const css::uno::Any& aSource )
-+{
-+ return aSource;
-+}
-+
-+rtl::OUString&
-+SwVbaPanes::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaPanes") );
-+ return sImplName;
-+}
-+
-+css::uno::Sequence<rtl::OUString>
-+SwVbaPanes::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Panes") );
-+ }
-+ return sNames;
-+}
---- sw/source/ui/vba/vbapanes.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sw/source/ui/vba/vbapanes.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,60 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_PANES_HXX
-+#define SW_VBA_PANES_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XPanes.hpp>
-+#include <com/sun/star/container/XEnumerationAccess.hpp>
-+#include <com/sun/star/container/XIndexAccess.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+
-+typedef CollTestImplHelper< ooo::vba::word::XPanes > SwVbaPanes_BASE;
-+
-+class SwVbaPanes : public SwVbaPanes_BASE
-+{
-+private:
-+ css::uno::Reference< css::frame::XModel > mxModel;
-+
-+public:
-+ SwVbaPanes( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel );
-+ virtual ~SwVbaPanes() {}
-+
-+ // 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);
-+
-+ // SwVbaPanes_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* SW_VBA_PANES_HXX */
---- sw/source/ui/vba/vbarange.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sw/source/ui/vba/vbarange.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,302 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbarange.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include "vbarangehelper.hxx"
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include <ooo/vba/word/WdBreakType.hpp>
-+#include <com/sun/star/style/BreakType.hpp>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XRange > SwVbaBaseRange_BASE;
-+
-+class SwVbaBaseRange : public SwVbaBaseRange_BASE
-+{
-+protected:
-+ uno::Reference< text::XTextDocument > mxTextDocument;
-+ uno::Reference< text::XTextCursor > mxTextCursor;
-+ uno::Reference< text::XText > mxText;
-+ sal_Bool mbMaySpanEndOfDocument;
-+
-+ SwVbaBaseRange( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext );
-+ virtual ~SwVbaBaseRange();
-+
-+public:
-+ uno::Reference< text::XTextRange > getXTextRange() throw (uno::RuntimeException);
-+
-+ // XRange
-+ virtual rtl::OUString SAL_CALL getText() throw (uno::RuntimeException);
-+ virtual void SAL_CALL setText( const rtl::OUString& rText ) throw (uno::RuntimeException);
-+
-+ // Methods
-+ virtual void SAL_CALL InsertBreak( const uno::Any& _breakType ) throw (uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+
-+SwVbaBaseRange::SwVbaBaseRange( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext )
-+ : SwVbaBaseRange_BASE( rParent, rContext )
-+{
-+}
-+
-+SwVbaBaseRange::~SwVbaBaseRange()
-+{
-+}
-+
-+uno::Reference< text::XTextRange >
-+SwVbaBaseRange::getXTextRange() throw (uno::RuntimeException)
-+{
-+ uno::Reference< text::XTextRange > xTextRange( mxTextCursor, uno::UNO_QUERY_THROW );
-+ return xTextRange;
-+}
-+
-+/**
-+* The complexity in this method is because we need to workaround
-+* an issue that the last paragraph in a document does not have a trailing CRLF.
-+* @return
-+*/
-+rtl::OUString SAL_CALL
-+SwVbaBaseRange::getText() throw ( uno::RuntimeException )
-+{
-+ rtl::OUString aText = mxTextCursor->getString();
-+ sal_Int32 nLen = aText.getLength();
-+
-+ // FIXME: should add a line separator if the range includes the last paragraph
-+ if( nLen == 0 )
-+ {
-+ if( mxTextCursor->isCollapsed() )
-+ {
-+ mxTextCursor->goRight( 1, sal_True );
-+ aText = mxTextCursor->getString();
-+ mxTextCursor->collapseToStart();
-+ }
-+ else
-+ {
-+ uno::Reference< text::XTextRange > xStart = mxTextCursor->getStart();
-+ uno::Reference< text::XTextRange > xEnd = mxTextCursor->getEnd();
-+ mxTextCursor->collapseToEnd();
-+ mxTextCursor->goRight( 1, sal_True );
-+ mxTextCursor->gotoRange( xStart, sal_False );
-+ mxTextCursor->gotoRange( xEnd, sal_True );
-+ }
-+ }
-+
-+ return aText;
-+}
-+
-+void SAL_CALL
-+SwVbaBaseRange::setText( const rtl::OUString& rText ) throw ( uno::RuntimeException )
-+{
-+ if( rText.indexOf( '\n' ) != -1 )
-+ {
-+ mxTextCursor->setString( rtl::OUString() );
-+ // process CR in strings
-+ uno::Reference< text::XTextRange > xRange( mxTextCursor, uno::UNO_QUERY_THROW );
-+ SwVbaRangeHelper::insertString( xRange, mxText, rText, sal_True );
-+ }
-+ else
-+ {
-+ mxTextCursor->setString( rText );
-+ }
-+}
-+
-+// FIXME: test is not pass
-+void SAL_CALL SwVbaBaseRange::InsertBreak( const uno::Any& _breakType ) throw (uno::RuntimeException)
-+{
-+ // default type is wdPageBreak;
-+ sal_Int32 nBreakType = word::WdBreakType::wdPageBreak;
-+ if( _breakType.hasValue() )
-+ _breakType >>= nBreakType;
-+
-+ style::BreakType eBreakType = style::BreakType_NONE;
-+ switch( nBreakType )
-+ {
-+ case word::WdBreakType::wdPageBreak:
-+ eBreakType = style::BreakType_PAGE_AFTER;
-+ break;
-+ case word::WdBreakType::wdColumnBreak:
-+ eBreakType = style::BreakType_COLUMN_AFTER;
-+ break;
-+ case word::WdBreakType::wdLineBreak:
-+ case word::WdBreakType::wdLineBreakClearLeft:
-+ case word::WdBreakType::wdLineBreakClearRight:
-+ case word::WdBreakType::wdSectionBreakContinuous:
-+ case word::WdBreakType::wdSectionBreakEvenPage:
-+ case word::WdBreakType::wdSectionBreakNextPage:
-+ case word::WdBreakType::wdSectionBreakOddPage:
-+ case word::WdBreakType::wdTextWrappingBreak:
-+ DebugHelper::exception( SbERR_NOT_IMPLEMENTED, rtl::OUString() );
-+ break;
-+ default:
-+ DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() );
-+ }
-+
-+ if( eBreakType != style::BreakType_NONE )
-+ {
-+ if( !mxTextCursor->isCollapsed() )
-+ {
-+ mxTextCursor->setString( rtl::OUString() );
-+ mxTextCursor->collapseToStart();
-+ }
-+
-+ uno::Reference< beans::XPropertySet > xProp( mxTextCursor, uno::UNO_QUERY_THROW );
-+ xProp->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BreakType") ), uno::makeAny( eBreakType ) );
-+ }
-+}
-+
-+rtl::OUString&
-+SwVbaBaseRange::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaBaseRange") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaBaseRange::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.BaseRange" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-+
-+/*
-+* class SwVbaDocRange
-+*/
-+class SwVbaDocRange : public SwVbaBaseRange
-+{
-+public:
-+ SwVbaDocRange( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext,
-+ const uno::Reference< text::XTextDocument >& rDocument, const uno::Reference< text::XTextRange >& rStart,
-+ const uno::Reference< text::XTextRange >& rEnd, const uno::Reference< text::XText >& rText, sal_Bool _bMaySpanEndOfDocument = sal_False )
-+ throw ( uno::RuntimeException );
-+ virtual ~SwVbaDocRange();
-+};
-+
-+SwVbaDocRange::SwVbaDocRange( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext,
-+ const uno::Reference< text::XTextDocument >& rDocument, const uno::Reference< text::XTextRange >& rStart,
-+ const uno::Reference< text::XTextRange >& rEnd, const uno::Reference< text::XText >& rText, sal_Bool _bMaySpanEndOfDocument ) throw ( uno::RuntimeException ) : SwVbaBaseRange( rParent, rContext )
-+{
-+ mxTextDocument = rDocument;
-+ mbMaySpanEndOfDocument = _bMaySpanEndOfDocument;
-+
-+ if( rText.is() )
-+ mxText = rText;
-+ else
-+ mxText = mxTextDocument->getText();
-+
-+ mxTextCursor = SwVbaRangeHelper::initCursor( rStart, mxText );
-+ mxTextCursor->collapseToStart();
-+
-+ if( rEnd.is() )
-+ mxTextCursor->gotoRange( rEnd, sal_True );
-+ else
-+ mxTextCursor->gotoEnd( sal_True );
-+}
-+
-+SwVbaDocRange::~SwVbaDocRange()
-+{
-+}
-+
-+/*
-+* class SwVbaRange
-+*/
-+SwVbaRange::SwVbaRange( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext,
-+ const uno::Reference< text::XTextDocument >& rTextDocument, const uno::Reference< text::XTextRange >& rStart, const uno::Reference< text::XTextRange >& rEnd, sal_Bool _bMaySpanEndOfDocument ) : SwVbaRange_BASE( rParent, rContext )
-+{
-+ uno::Reference< text::XText > xText;
-+ mxActualRange = uno::Reference< word::XRange > ( new SwVbaDocRange( rParent, rContext, rTextDocument, rStart, rEnd, xText, _bMaySpanEndOfDocument ) );
-+}
-+
-+SwVbaRange::~SwVbaRange()
-+{
-+}
-+
-+uno::Reference< text::XTextRange >
-+SwVbaRange::getXTextRange() throw (uno::RuntimeException)
-+{
-+ uno::Reference< text::XTextRange > xTextRange;
-+ SwVbaBaseRange* pBaseRange = dynamic_cast< SwVbaBaseRange* >( mxActualRange.get() );
-+ if( pBaseRange )
-+ xTextRange = pBaseRange->getXTextRange();
-+ return xTextRange;
-+}
-+
-+rtl::OUString SAL_CALL
-+SwVbaRange::getText() throw ( uno::RuntimeException )
-+{
-+ rtl::OUString aText;
-+ if( mxActualRange.is() )
-+ return mxActualRange->getText();
-+ return aText;
-+}
-+
-+void SAL_CALL
-+SwVbaRange::setText( const rtl::OUString& rText ) throw ( uno::RuntimeException )
-+{
-+ if( mxActualRange.is() )
-+ mxActualRange->setText( rText );
-+}
-+
-+void SAL_CALL SwVbaRange::InsertBreak( const uno::Any& _breakType ) throw (uno::RuntimeException)
-+{
-+ if( mxActualRange.is() )
-+ mxActualRange->InsertBreak( _breakType );
-+}
-+
-+rtl::OUString&
-+SwVbaRange::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaRange") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaRange::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Range" ) );
-+ }
-+ return aServiceNames;
-+}
-+
---- sw/source/ui/vba/vbarange.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sw/source/ui/vba/vbarange.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,65 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_RANGE_HXX
-+#define SW_VBA_RANGE_HXX
-+
-+#include <ooo/vba/word/XRange.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/text/XTextRange.hpp>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XRange > SwVbaRange_BASE;
-+
-+class SwVbaRange : public SwVbaRange_BASE
-+{
-+private:
-+ css::uno::Reference< ooo::vba::word::XRange > mxActualRange;
-+
-+public:
-+ SwVbaRange( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext,
-+ const css::uno::Reference< css::text::XTextDocument >& rTextDocument, const css::uno::Reference< css::text::XTextRange >& rStart, const css::uno::Reference< css::text::XTextRange >& rEnd, sal_Bool _bMaySpanEndOfDocument = sal_False );
-+ virtual ~SwVbaRange();
-+
-+ css::uno::Reference< css::text::XTextRange > getXTextRange() throw (css::uno::RuntimeException);
-+
-+ // Attribute
-+ virtual rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setText( const rtl::OUString& rText ) throw (css::uno::RuntimeException);
-+
-+ // Methods
-+ virtual void SAL_CALL InsertBreak( const css::uno::Any& _breakType ) throw (css::uno::RuntimeException);
-+
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_RANGE_HXX */
---- sw/source/ui/vba/vbarangehelper.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sw/source/ui/vba/vbarangehelper.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,143 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbarangehelper.hxx"
-+#include <com/sun/star/text/ControlCharacter.hpp>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+/**
-+ * get a range in a xText by creating
-+ * a cursor that iterates over the text. If the iterating cursor is
-+ * equal to the desired position, the range equivalent is returned.
-+ * Some special cases are tables that are inside of the text, because the
-+ * position has to be adjusted.
-+ * @param xText a text where a range position is searched
-+ * @param position a position inside o the text
-+ * @return a range for the postion; null is returned if no range can be
-+ * constructed.
-+ */
-+uno::Reference< text::XTextRange > SwVbaRangeHelper::getRangeByPosition( const uno::Reference< text::XText >& rText, sal_Int32 _position ) throw ( uno::RuntimeException )
-+{
-+ uno::Reference< text::XTextRange > xRange;
-+ if( rText.is() )
-+ {
-+ sal_Int32 nPos = 0;
-+ uno::Reference< text::XTextCursor > xCursor = rText->createTextCursor();
-+ xCursor->collapseToStart();
-+ sal_Bool bCanGo = sal_True;
-+ while( !xRange.is() && bCanGo )
-+ {
-+ if( _position == nPos )
-+ {
-+ xRange = xCursor->getStart();
-+ }
-+ else
-+ {
-+ bCanGo = xCursor->goRight( 1, sal_False );
-+ nPos++;
-+ }
-+ }
-+ }
-+ return xRange;
-+}
-+
-+
-+void SwVbaRangeHelper::insertString( uno::Reference< text::XTextRange >& rTextRange, uno::Reference< text::XText >& rText, const rtl::OUString& rStr, sal_Bool _bAbsorb ) throw ( uno::RuntimeException )
-+{
-+ sal_Int32 nlastIndex = 0;
-+ sal_Int32 nIndex = 0;
-+ uno::Reference< text::XTextRange > xRange = rTextRange;
-+
-+ while(( nIndex = rStr.indexOf('\n', nlastIndex)) >= 0 )
-+ {
-+ xRange = xRange->getEnd();
-+ if( nlastIndex < ( nIndex - 1 ) )
-+ {
-+ rText->insertString( xRange, rStr.copy( nlastIndex, ( nIndex - 1 - nlastIndex ) ), _bAbsorb );
-+ xRange = xRange->getEnd();
-+ }
-+
-+ rText->insertControlCharacter( xRange, text::ControlCharacter::PARAGRAPH_BREAK, _bAbsorb );
-+ nlastIndex = nIndex + 1;
-+ }
-+
-+ if( nlastIndex < rStr.getLength() )
-+ {
-+ xRange = xRange->getEnd();
-+
-+ rtl::OUString aWatt = rStr.copy( nlastIndex );
-+ rText->insertString( xRange, aWatt, _bAbsorb );
-+ }
-+}
-+
-+uno::Reference< text::XTextCursor > SwVbaRangeHelper::initCursor( const uno::Reference< text::XTextRange >& rTextRange, const uno::Reference< text::XText >& rText ) throw ( uno::RuntimeException )
-+{
-+ uno::Reference< text::XTextCursor > xTextCursor;
-+ sal_Bool bGotTextCursor = sal_False;
-+
-+ try
-+ {
-+ xTextCursor = rText->createTextCursorByRange( rTextRange );
-+ bGotTextCursor = sal_True;
-+ }
-+ catch (uno::Exception& e)
-+ {
-+ DebugHelper::exception(e);
-+ }
-+
-+ if( !bGotTextCursor )
-+ {
-+ try
-+ {
-+ uno::Reference< text::XText > xText = rTextRange->getText();
-+ xTextCursor = xText->createTextCursor();
-+ bGotTextCursor = sal_True;
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ DebugHelper::exception(e);
-+ }
-+ }
-+
-+ if( !bGotTextCursor )
-+ {
-+ try
-+ {
-+ xTextCursor = rText->createTextCursor();
-+ bGotTextCursor = sal_True;
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ DebugHelper::exception(e);
-+ }
-+ }
-+ return xTextCursor;
-+}
---- sw/source/ui/vba/vbarangehelper.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sw/source/ui/vba/vbarangehelper.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,45 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_RANGEHELPER_HXX
-+#define SW_VBA_RANGEHELPER_HXX
-+
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/text/XTextViewCursor.hpp>
-+#include <com/sun/star/text/XText.hpp>
-+
-+class SwVbaRangeHelper
-+{
-+public:
-+ static css::uno::Reference< css::text::XTextRange > getRangeByPosition( const css::uno::Reference< css::text::XText >& rText, sal_Int32 _position )throw ( css::uno::RuntimeException );
-+ static void insertString( css::uno::Reference< css::text::XTextRange >& rTextRange, css::uno::Reference< css::text::XText >& rText, const rtl::OUString& rStr, sal_Bool _bAbsorb ) throw ( css::uno::RuntimeException );
-+ static css::uno::Reference< css::text::XTextCursor > initCursor( const css::uno::Reference< css::text::XTextRange >& rTextRange, const css::uno::Reference< css::text::XText >& rText ) throw ( css::uno::RuntimeException );
-+
-+};
-+#endif /* SW_VBA_RANGEHELPER_HXX */
---- sw/source/ui/vba/vbaselection.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sw/source/ui/vba/vbaselection.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,75 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbaselection.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaSelection::SwVbaSelection( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& rModel ) throw ( css::uno::RuntimeException ) : SwVbaSelection_BASE( rParent, rContext ), mxModel( rModel )
-+{
-+}
-+
-+SwVbaSelection::~SwVbaSelection()
-+{
-+}
-+
-+rtl::OUString SAL_CALL
-+SwVbaSelection::getText() throw ( uno::RuntimeException )
-+{
-+ rtl::OUString aText;
-+ return aText;
-+}
-+
-+void SAL_CALL
-+SwVbaSelection::setText( const rtl::OUString& rText ) throw ( uno::RuntimeException )
-+{
-+}
-+
-+rtl::OUString&
-+SwVbaSelection::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaSelection") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaSelection::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Selection" ) );
-+ }
-+ return aServiceNames;
-+}
-+
---- sw/source/ui/vba/vbaselection.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sw/source/ui/vba/vbaselection.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,56 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_SELECTION_HXX
-+#define SW_VBA_SELECTION_HXX
-+
-+#include <ooo/vba/word/XSelection.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XSelection > SwVbaSelection_BASE;
-+
-+class SwVbaSelection : public SwVbaSelection_BASE
-+{
-+private:
-+ css::uno::Reference< css::frame::XModel > mxModel;
-+
-+public:
-+ SwVbaSelection( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& rModel ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaSelection();
-+
-+ // Attribute
-+ virtual rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setText( const rtl::OUString& rText ) throw (css::uno::RuntimeException);
-+
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_SELECTION_HXX */
---- sw/source/ui/vba/vbasystem.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sw/source/ui/vba/vbasystem.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,195 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbasystem.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <ooo/vba/word/WdCursorType.hpp>
-+#include <tools/diagnose_ex.h>
-+#include <tools/config.hxx>
-+#include <tools/string.hxx>
-+#include <osl/file.hxx>
-+#include <tools/urlobj.hxx>
-+#include <tools/string.hxx>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+PrivateProfileStringListener::PrivateProfileStringListener( const rtl::OUString& rFileName, const ByteString& rGroupName, const ByteString& rKey )
-+ :maFileName( rFileName ), maGroupName( rGroupName ), maKey( rKey )
-+{
-+}
-+
-+PrivateProfileStringListener::~PrivateProfileStringListener()
-+{
-+}
-+
-+void PrivateProfileStringListener::Initialize( const rtl::OUString& rFileName, const ByteString& rGroupName, const ByteString& rKey )
-+{
-+ maFileName = rFileName;
-+ maGroupName = rGroupName;
-+ maKey = rKey;
-+}
-+
-+uno::Any PrivateProfileStringListener::getValueEvent()
-+{
-+ // get the private profile string
-+ Config aCfg( maFileName );
-+ aCfg.SetGroup( maGroupName );
-+ rtl::OUString sValue = rtl::OUString( String( aCfg.ReadKey( maKey ), RTL_TEXTENCODING_UTF8 ) );
-+
-+ return uno::makeAny( sValue );
-+}
-+
-+void PrivateProfileStringListener::setValueEvent( const css::uno::Any& value )
-+{
-+ // set the private profile string
-+ Config aCfg( maFileName );
-+ aCfg.SetGroup( maGroupName );
-+
-+ rtl::OUString aValue;
-+ value >>= aValue;
-+ aCfg.WriteKey( maKey, ByteString( aValue.getStr(), RTL_TEXTENCODING_UTF8 ) );
-+}
-+
-+SwVbaSystem::SwVbaSystem( uno::Reference<uno::XComponentContext >& xContext ): SwVbaSystem_BASE( uno::Reference< XHelperInterface >(), xContext )
-+{
-+}
-+
-+SwVbaSystem::~SwVbaSystem()
-+{
-+}
-+
-+sal_Int32 SAL_CALL
-+SwVbaSystem::getCursor() throw (uno::RuntimeException)
-+{
-+ sal_Int32 nPointerStyle = getPointerStyle();
-+
-+ switch( nPointerStyle )
-+ {
-+ case POINTER_ARROW:
-+ return word::WdCursorType::wdCursorNorthwestArrow;
-+ case POINTER_NULL:
-+ return word::WdCursorType::wdCursorNormal;
-+ case POINTER_WAIT:
-+ return word::WdCursorType::wdCursorWait;
-+ case POINTER_TEXT:
-+ return word::WdCursorType::wdCursorIBeam;
-+ default:
-+ return word::WdCursorType::wdCursorNormal;
-+ }
-+}
-+
-+void SAL_CALL
-+SwVbaSystem::setCursor( sal_Int32 _cursor ) throw (uno::RuntimeException)
-+{
-+ try
-+ {
-+ switch( _cursor )
-+ {
-+ case word::WdCursorType::wdCursorNorthwestArrow:
-+ {
-+ const Pointer& rPointer( POINTER_ARROW );
-+ setCursorHelper( rPointer, sal_False );
-+ break;
-+ }
-+ case word::WdCursorType::wdCursorWait:
-+ {
-+ const Pointer& rPointer( static_cast< PointerStyle >( POINTER_WAIT ) );
-+ //It will set the edit window, toobar and statusbar's mouse pointer.
-+ setCursorHelper( rPointer, sal_True );
-+ break;
-+ }
-+ case word::WdCursorType::wdCursorIBeam:
-+ {
-+ const Pointer& rPointer( static_cast< PointerStyle >( POINTER_TEXT ) );
-+ //It will set the edit window, toobar and statusbar's mouse pointer.
-+ setCursorHelper( rPointer, sal_True );
-+ break;
-+ }
-+ case word::WdCursorType::wdCursorNormal:
-+ {
-+ const Pointer& rPointer( POINTER_NULL );
-+ setCursorHelper( 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& )
-+ {
-+ DBG_UNHANDLED_EXCEPTION();
-+ }
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaSystem::PrivateProfileString( const rtl::OUString& rFilename, const rtl::OUString& rSection, const rtl::OUString& rKey ) throw ( uno::RuntimeException )
-+{
-+ if( rFilename.getLength() == 0 )
-+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Failed to access document from shell" ) ), uno::Reference< uno::XInterface >() );
-+
-+ // FIXME: need to detect whether it is a relative file path
-+ // we need to detect if this is a URL, if not then assume its a file path
-+ rtl::OUString sFileUrl;
-+ INetURLObject aObj;
-+ aObj.SetURL( rFilename );
-+ bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
-+ if ( bIsURL )
-+ sFileUrl = rFilename;
-+ else
-+ osl::FileBase::getFileURLFromSystemPath( rFilename, sFileUrl);
-+
-+ ByteString aGroupName = ByteString( rSection.getStr(), RTL_TEXTENCODING_UTF8);
-+ ByteString aKey = ByteString( rKey.getStr(), RTL_TEXTENCODING_UTF8);
-+ maPrivateProfileStringListener.Initialize( sFileUrl, aGroupName, aKey );
-+
-+ return uno::makeAny( uno::Reference< XPropValue > ( new ScVbaPropValue( &maPrivateProfileStringListener ) ) );
-+}
-+
-+rtl::OUString&
-+SwVbaSystem::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaSystem") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaSystem::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.System" ) );
-+ }
-+ return aServiceNames;
-+}
---- sw/source/ui/vba/vbasystem.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sw/source/ui/vba/vbasystem.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,75 @@
-+/*************************************************************************
-+ *
-+ * 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: vbasystem.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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_SYSTEM_HXX
-+#define SW_VBA_SYSTEM_HXX
-+
-+#include <ooo/vba/word/XSystem.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <vbahelper/vbapropvalue.hxx>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XSystem > SwVbaSystem_BASE;
-+
-+class PrivateProfileStringListener : public PropListener
-+{
-+private:
-+ rtl::OUString maFileName;
-+ ByteString maGroupName;
-+ ByteString maKey;
-+public:
-+ PrivateProfileStringListener(){};
-+ PrivateProfileStringListener( const rtl::OUString& rFileName, const ByteString& rGroupName, const ByteString& rKey );
-+ virtual ~PrivateProfileStringListener();
-+ void Initialize( const rtl::OUString& rFileName, const ByteString& rGroupName, const ByteString& rKey );
-+
-+ //PropListener
-+ virtual void setValueEvent( const css::uno::Any& value );
-+ virtual css::uno::Any getValueEvent();
-+};
-+
-+class SwVbaSystem : public SwVbaSystem_BASE
-+{
-+private:
-+ PrivateProfileStringListener maPrivateProfileStringListener;
-+
-+public:
-+ SwVbaSystem( css::uno::Reference< css::uno::XComponentContext >& m_xContext );
-+ virtual ~SwVbaSystem();
-+
-+ // XSystem
-+ virtual sal_Int32 SAL_CALL getCursor() throw ( css::uno::RuntimeException );
-+ virtual void SAL_CALL setCursor( sal_Int32 _cursor ) throw ( css::uno::RuntimeException );
-+ virtual css::uno::Any SAL_CALL PrivateProfileString( const rtl::OUString& rFilename, const rtl::OUString& rSection, const rtl::OUString& rKey ) throw ( css::uno::RuntimeException );
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_SYSTEM_HXX */
---- sw/source/ui/vba/vbavariable.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sw/source/ui/vba/vbavariable.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,108 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbavariable.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <com/sun/star/beans/PropertyValue.hpp>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+SwVbaVariable::SwVbaVariable( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext,
-+ const uno::Reference< beans::XPropertyAccess >& rUserDefined, const rtl::OUString& rName ) throw ( uno::RuntimeException ) :
-+ SwVbaVariable_BASE( rParent, rContext ), mxUserDefined( rUserDefined ), maName( rName )
-+{
-+}
-+
-+SwVbaVariable::~SwVbaVariable()
-+{
-+}
-+
-+rtl::OUString SAL_CALL
-+SwVbaVariable::getName() throw ( css::uno::RuntimeException )
-+{
-+ return maName;
-+}
-+
-+void SAL_CALL
-+SwVbaVariable::setName( const rtl::OUString& ) throw ( css::uno::RuntimeException )
-+{
-+ throw uno::RuntimeException( rtl::OUString(
-+ RTL_CONSTASCII_USTRINGPARAM(" Fail to set name")), uno::Reference< uno::XInterface >() );
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaVariable::getValue() throw ( css::uno::RuntimeException )
-+{
-+ uno::Reference< beans::XPropertySet > xProp( mxUserDefined, uno::UNO_QUERY_THROW );
-+ return xProp->getPropertyValue( maName );
-+}
-+
-+void SAL_CALL
-+SwVbaVariable::setValue( const uno::Any& rValue ) throw ( css::uno::RuntimeException )
-+{
-+ // FIXME: fail to set the value if the new type of vaue is differenct from the original one.
-+ uno::Reference< beans::XPropertySet > xProp( mxUserDefined, uno::UNO_QUERY_THROW );
-+ xProp->setPropertyValue( maName, rValue );
-+}
-+
-+sal_Int32 SAL_CALL
-+SwVbaVariable::getIndex() throw ( css::uno::RuntimeException )
-+{
-+ const uno::Sequence< beans::PropertyValue > props = mxUserDefined->getPropertyValues();
-+ for (sal_Int32 i = 0; i < props.getLength(); ++i)
-+ {
-+ if( maName.equals( props[i].Name ) )
-+ return i+1;
-+ }
-+
-+ return 0;
-+}
-+
-+rtl::OUString&
-+SwVbaVariable::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaVariable") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaVariable::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Variable" ) );
-+ }
-+ return aServiceNames;
-+}
-+
---- sw/source/ui/vba/vbavariable.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sw/source/ui/vba/vbavariable.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -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:
-+ * $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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_VARIABLE_HXX
-+#define SW_VBA_VARIABLE_HXX
-+
-+#include <ooo/vba/word/XVariable.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/beans/XPropertyAccess.hpp>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XVariable > SwVbaVariable_BASE;
-+
-+class SwVbaVariable : public SwVbaVariable_BASE
-+{
-+private:
-+ css::uno::Reference< css::beans::XPropertyAccess > mxUserDefined;
-+ rtl::OUString maName;
-+
-+public:
-+ SwVbaVariable( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext,
-+ const css::uno::Reference< css::beans::XPropertyAccess >& rUserDefined, const rtl::OUString& rName ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaVariable();
-+
-+ // XVariable
-+ virtual rtl::OUString SAL_CALL getName() throw ( css::uno::RuntimeException );
-+ virtual void SAL_CALL setName( const rtl::OUString& ) throw ( css::uno::RuntimeException );
-+ virtual css::uno::Any SAL_CALL getValue() throw ( css::uno::RuntimeException );
-+ virtual void SAL_CALL setValue( const css::uno::Any& rValue ) throw ( css::uno::RuntimeException );
-+ virtual sal_Int32 SAL_CALL getIndex() throw ( css::uno::RuntimeException );
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_VARIABLE_HXX */
---- sw/source/ui/vba/vbavariables.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sw/source/ui/vba/vbavariables.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,105 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbavariables.hxx"
-+#include "vbavariable.hxx"
-+#include <com/sun/star/beans/XPropertyContainer.hpp>
-+#include <com/sun/star/beans/PropertyAttribute.hpp>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+uno::Reference< container::XIndexAccess > createVariablesAccess( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< beans::XPropertyAccess >& xUserDefined ) throw ( uno::RuntimeException )
-+{
-+ // FIXME: the performance is poor?
-+ XNamedObjectCollectionHelper< word::XVariable >::XNamedVec mVariables;
-+ const uno::Sequence< beans::PropertyValue > props = xUserDefined->getPropertyValues();
-+ sal_Int32 nCount = props.getLength();
-+ mVariables.reserve( nCount );
-+ for( sal_Int32 i=0; i < nCount; i++ )
-+ mVariables.push_back( uno::Reference< word::XVariable > ( new SwVbaVariable( xParent, xContext, xUserDefined, props[i].Name ) ) );
-+
-+ uno::Reference< container::XIndexAccess > xVariables( new XNamedObjectCollectionHelper< word::XVariable >( mVariables ) );
-+ return xVariables;
-+}
-+
-+SwVbaVariables::SwVbaVariables( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext, const uno::Reference< beans::XPropertyAccess >& rUserDefined ): SwVbaVariables_BASE( xParent, xContext, createVariablesAccess( xParent, xContext, rUserDefined ) ), mxUserDefined( rUserDefined )
-+{
-+}
-+// XEnumerationAccess
-+uno::Type
-+SwVbaVariables::getElementType() throw (uno::RuntimeException)
-+{
-+ return word::XVariable::static_type(0);
-+}
-+uno::Reference< container::XEnumeration >
-+SwVbaVariables::createEnumeration() throw (uno::RuntimeException)
-+{
-+ uno::Reference< container::XEnumerationAccess > xEnumerationAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
-+ return xEnumerationAccess->createEnumeration();
-+}
-+
-+uno::Any
-+SwVbaVariables::createCollectionObject( const css::uno::Any& aSource )
-+{
-+ return aSource;
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaVariables::Add( const rtl::OUString& rName, const uno::Any& rValue ) throw (uno::RuntimeException)
-+{
-+ uno::Any aValue;
-+ if( rValue.hasValue() )
-+ aValue = rValue;
-+ else
-+ aValue <<= rtl::OUString();
-+ uno::Reference< beans::XPropertyContainer > xPropertyContainer( mxUserDefined, uno::UNO_QUERY_THROW );
-+ xPropertyContainer->addProperty( rName, beans::PropertyAttribute::MAYBEVOID | beans::PropertyAttribute::REMOVEABLE, aValue );
-+
-+ return uno::makeAny( uno::Reference< word::XVariable >( new SwVbaVariable( getParent(), mxContext, mxUserDefined, rName ) ) );
-+}
-+
-+rtl::OUString&
-+SwVbaVariables::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaVariables") );
-+ return sImplName;
-+}
-+
-+css::uno::Sequence<rtl::OUString>
-+SwVbaVariables::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > sNames;
-+ if ( sNames.getLength() == 0 )
-+ {
-+ sNames.realloc( 1 );
-+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Variables") );
-+ }
-+ return sNames;
-+}
---- sw/source/ui/vba/vbavariables.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sw/source/ui/vba/vbavariables.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,64 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_VARIABLES_HXX
-+#define SW_VBA_VARIABLES_HXX
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <ooo/vba/word/XVariables.hpp>
-+#include <com/sun/star/container/XEnumerationAccess.hpp>
-+#include <com/sun/star/container/XIndexAccess.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/beans/XPropertyAccess.hpp>
-+
-+typedef CollTestImplHelper< ooo::vba::word::XVariables > SwVbaVariables_BASE;
-+
-+class SwVbaVariables : public SwVbaVariables_BASE
-+{
-+private:
-+ css::uno::Reference< css::beans::XPropertyAccess > mxUserDefined;
-+
-+public:
-+ SwVbaVariables( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::beans::XPropertyAccess >& rUserDefined );
-+ virtual ~SwVbaVariables() {}
-+
-+ // 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);
-+
-+ // SwVbaVariables_BASE
-+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+
-+ // XVariables
-+ virtual css::uno::Any SAL_CALL Add( const rtl::OUString& rName, const css::uno::Any& rValue ) throw (css::uno::RuntimeException);
-+};
-+
-+#endif /* SW_VBA_VARIABLES_HXX */
---- sw/source/ui/vba/vbaview.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sw/source/ui/vba/vbaview.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,384 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbaview.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <tools/diagnose_ex.h>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <com/sun/star/view/XViewSettingsSupplier.hpp>
-+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
-+#include <com/sun/star/text/XText.hpp>
-+#include <com/sun/star/text/XTextDocument.hpp>
-+#include <com/sun/star/text/XFootnotesSupplier.hpp>
-+#include <com/sun/star/text/XEndnotesSupplier.hpp>
-+#include <com/sun/star/container/XIndexAccess.hpp>
-+#include <com/sun/star/frame/XController.hpp>
-+#include <com/sun/star/lang/XServiceInfo.hpp>
-+#include <ooo/vba/word/WdSpecialPane.hpp>
-+#include <ooo/vba/word/WdViewType.hpp>
-+#include <ooo/vba/word/WdSeekView.hpp>
-+
-+#include "wordvbahelper.hxx"
-+#include <view.hxx>
-+
-+using namespace ::ooo::vba;
-+using namespace ::com::sun::star;
-+
-+const sal_Int32 DEFAULT_BODY_DISTANCE = 500;
-+
-+SwVbaView::SwVbaView( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext,
-+ const uno::Reference< frame::XModel >& rModel ) throw ( uno::RuntimeException ) :
-+ SwVbaView_BASE( rParent, rContext ), mxModel( rModel )
-+{
-+ uno::Reference< frame::XController > xController = mxModel->getCurrentController();
-+
-+ uno::Reference< text::XTextViewCursorSupplier > xTextViewCursorSupp( xController, uno::UNO_QUERY_THROW );
-+ mxViewCursor = xTextViewCursorSupp->getViewCursor();
-+
-+ uno::Reference< view::XViewSettingsSupplier > xViewSettingSupp( xController, uno::UNO_QUERY_THROW );
-+ mxViewSettings.set( xViewSettingSupp->getViewSettings(), uno::UNO_QUERY_THROW );
-+}
-+
-+SwVbaView::~SwVbaView()
-+{
-+}
-+
-+::sal_Int32 SAL_CALL
-+SwVbaView::getSeekView() throw (css::uno::RuntimeException)
-+{
-+ uno::Reference< text::XText > xCurrentText = mxViewCursor->getText();
-+ uno::Reference< lang::XServiceInfo > xServiceInfo( xCurrentText, uno::UNO_QUERY_THROW );
-+ rtl::OUString aImplName = xServiceInfo->getImplementationName();
-+ if( aImplName.equalsAscii("SwXBodyText") )
-+ {
-+ return word::WdSeekView::wdSeekMainDocument;
-+ }
-+ else if( aImplName.equalsAscii("SwXHeadFootText") )
-+ {
-+ if( word::HeaderFooterHelper::isHeader( mxModel, xCurrentText ) )
-+ {
-+ if( word::HeaderFooterHelper::isFirstPageHeader( mxModel, xCurrentText ) )
-+ return word::WdSeekView::wdSeekFirstPageHeader;
-+ else if( word::HeaderFooterHelper::isEvenPagesHeader( mxModel, xCurrentText ) )
-+ return word::WdSeekView::wdSeekEvenPagesHeader;
-+ else
-+ return word::WdSeekView::wdSeekPrimaryHeader;
-+ }
-+ else
-+ {
-+ if( word::HeaderFooterHelper::isFirstPageFooter( mxModel, xCurrentText ) )
-+ return word::WdSeekView::wdSeekFirstPageFooter;
-+ else if( word::HeaderFooterHelper::isEvenPagesFooter( mxModel, xCurrentText ) )
-+ return word::WdSeekView::wdSeekEvenPagesFooter;
-+ else
-+ return word::WdSeekView::wdSeekPrimaryFooter;
-+ }
-+ }
-+ else if( aImplName.equalsAscii("SwXFootnote") )
-+ {
-+ if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.Endnote") ) ) )
-+ return word::WdSeekView::wdSeekEndnotes;
-+ else
-+ return word::WdSeekView::wdSeekFootnotes;
-+ }
-+
-+ return word::WdSeekView::wdSeekMainDocument;
-+}
-+
-+void SAL_CALL
-+SwVbaView::setSeekView( ::sal_Int32 _seekview ) throw (css::uno::RuntimeException)
-+{
-+ if( _seekview == getSeekView() )
-+ return;
-+
-+ switch( _seekview )
-+ {
-+ case word::WdSeekView::wdSeekFirstPageFooter:
-+ case word::WdSeekView::wdSeekFirstPageHeader:
-+ case word::WdSeekView::wdSeekCurrentPageFooter:
-+ case word::WdSeekView::wdSeekCurrentPageHeader:
-+ case word::WdSeekView::wdSeekPrimaryFooter:
-+ case word::WdSeekView::wdSeekPrimaryHeader:
-+ case word::WdSeekView::wdSeekEvenPagesFooter:
-+ case word::WdSeekView::wdSeekEvenPagesHeader:
-+ {
-+ // need to test
-+ mxViewCursor->gotoRange( getHFTextRange( _seekview ), sal_False );
-+ break;
-+ }
-+ case word::WdSeekView::wdSeekFootnotes:
-+ {
-+ uno::Reference< text::XFootnotesSupplier > xFootnotesSupp( mxModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xFootnotes( xFootnotesSupp->getFootnotes(), uno::UNO_QUERY_THROW );
-+ if( xFootnotes->getCount() > 0 )
-+ {
-+ uno::Reference< text::XText > xText( xFootnotes->getByIndex(0), uno::UNO_QUERY_THROW );
-+ mxViewCursor->gotoRange( xText->getStart(), sal_False );
-+ }
-+ else
-+ {
-+ DebugHelper::exception( SbERR_NO_ACTIVE_OBJECT, rtl::OUString() );
-+ }
-+ break;
-+ }
-+ case word::WdSeekView::wdSeekEndnotes:
-+ {
-+ uno::Reference< text::XEndnotesSupplier > xEndnotesSupp( mxModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xEndnotes( xEndnotesSupp->getEndnotes(), uno::UNO_QUERY_THROW );
-+ if( xEndnotes->getCount() > 0 )
-+ {
-+ uno::Reference< text::XText > xText( xEndnotes->getByIndex(0), uno::UNO_QUERY_THROW );
-+ mxViewCursor->gotoRange( xText->getStart(), sal_False );
-+ }
-+ else
-+ {
-+ DebugHelper::exception( SbERR_NO_ACTIVE_OBJECT, rtl::OUString() );
-+ }
-+ break;
-+ }
-+ case word::WdSeekView::wdSeekMainDocument:
-+ {
-+ uno::Reference< text::XTextDocument > xTextDocument( mxModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XText > xText = xTextDocument->getText();
-+ mxViewCursor->gotoRange( xText->getStart(), sal_False );
-+ break;
-+ }
-+ }
-+}
-+
-+::sal_Int32 SAL_CALL
-+SwVbaView::getSplitSpecial() throw (css::uno::RuntimeException)
-+{
-+ return word::WdSpecialPane::wdPaneNone;
-+}
-+
-+void SAL_CALL
-+SwVbaView::setSplitSpecial( ::sal_Int32/* _splitspecial */) throw (css::uno::RuntimeException)
-+{
-+ // not support in Writer
-+}
-+
-+::sal_Bool SAL_CALL
-+SwVbaView::getTableGridLines() throw (css::uno::RuntimeException)
-+{
-+ sal_Bool bShowTableGridLine = sal_False;
-+ mxViewSettings->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ShowTableBoundaries"))) >>= bShowTableGridLine;
-+ return bShowTableGridLine;
-+}
-+
-+void SAL_CALL
-+SwVbaView::setTableGridLines( ::sal_Bool _tablegridlines ) throw (css::uno::RuntimeException)
-+{
-+ mxViewSettings->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ShowTableBoundaries")), uno::makeAny( _tablegridlines ) );
-+}
-+
-+::sal_Int32 SAL_CALL
-+SwVbaView::getType() throw (css::uno::RuntimeException)
-+{
-+ // FIXME: handle wdPrintPreview type
-+ sal_Bool bOnlineLayout = sal_False;
-+ mxViewSettings->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ShowOnlineLayout"))) >>= bOnlineLayout;
-+ return bOnlineLayout ? word::WdViewType::wdWebView : word::WdViewType::wdPrintView;
-+}
-+
-+void SAL_CALL
-+SwVbaView::setType( ::sal_Int32 _type ) throw (css::uno::RuntimeException)
-+{
-+ // FIXME: handle wdPrintPreview type
-+ switch( _type )
-+ {
-+ case word::WdViewType::wdPrintView:
-+ {
-+ mxViewSettings->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ShowOnlineLayout")), uno::makeAny( sal_False ) );
-+ break;
-+ }
-+ case word::WdViewType::wdWebView:
-+ {
-+ mxViewSettings->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ShowOnlineLayout")), uno::makeAny( sal_True ) );
-+ break;
-+ }
-+ case word::WdViewType::wdPrintPreview:
-+ {
-+ PrintPreviewHelper( uno::Any(),word::getView( mxModel ) );
-+ break;
-+ }
-+ default:
-+ DebugHelper::exception( SbERR_NOT_IMPLEMENTED, rtl::OUString() );
-+
-+ }
-+}
-+
-+uno::Reference< text::XTextRange > SwVbaView::getHFTextRange( sal_Int32 nType ) throw (uno::RuntimeException)
-+{
-+ mxModel->lockControllers();
-+
-+ rtl::OUString aPropIsOn;
-+ rtl::OUString aPropIsShared;
-+ rtl::OUString aPropBodyDistance;
-+ rtl::OUString aPropText;
-+
-+ switch( nType )
-+ {
-+ case word::WdSeekView::wdSeekCurrentPageFooter:
-+ case word::WdSeekView::wdSeekFirstPageFooter:
-+ case word::WdSeekView::wdSeekPrimaryFooter:
-+ case word::WdSeekView::wdSeekEvenPagesFooter:
-+ {
-+ aPropIsOn = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn") );
-+ aPropIsShared = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsShared") );
-+ aPropBodyDistance = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterBodyDistance") );
-+ aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterText") );
-+ break;
-+ }
-+ case word::WdSeekView::wdSeekCurrentPageHeader:
-+ case word::WdSeekView::wdSeekFirstPageHeader:
-+ case word::WdSeekView::wdSeekPrimaryHeader:
-+ case word::WdSeekView::wdSeekEvenPagesHeader:
-+ {
-+ aPropIsOn = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn") );
-+ aPropIsShared = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsShared") );
-+ aPropBodyDistance = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderBodyDistance") );
-+ aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderText") );
-+ break;
-+ }
-+ }
-+
-+ uno::Reference< text::XPageCursor > xPageCursor( mxViewCursor, uno::UNO_QUERY_THROW );
-+
-+ if( nType == word::WdSeekView::wdSeekFirstPageFooter
-+ || nType == word::WdSeekView::wdSeekFirstPageHeader )
-+ {
-+ xPageCursor->jumpToFirstPage();
-+ }
-+
-+ uno::Reference< style::XStyle > xStyle;
-+ uno::Reference< text::XText > xText;
-+ switch( nType )
-+ {
-+ case word::WdSeekView::wdSeekPrimaryFooter:
-+ case word::WdSeekView::wdSeekPrimaryHeader:
-+ case word::WdSeekView::wdSeekEvenPagesFooter:
-+ case word::WdSeekView::wdSeekEvenPagesHeader:
-+ {
-+ // The primary header is the first header of the section.
-+ // If the header is not shared between odd and even pages
-+ // the odd page's header is the primary header. If the
-+ // first page's header is different from the rest of the
-+ // document, it is NOT the primary header ( the next primary
-+ // header would be on page 3 )
-+ // The even pages' header is only available if the header is
-+ // not shared and the current style is applied to a page with
-+ // an even page number
-+ uno::Reference< beans::XPropertySet > xCursorProps( mxViewCursor, uno::UNO_QUERY_THROW );
-+ rtl::OUString aPageStyleName;
-+ xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyleName"))) >>= aPageStyleName;
-+ if( aPageStyleName.equalsAscii("First Page") )
-+ {
-+ // go to the beginning of where the next style is used
-+ sal_Bool hasNextPage = sal_False;
-+ xStyle = word::getCurrentPageStyle( mxModel );
-+ do
-+ {
-+ hasNextPage = xPageCursor->jumpToNextPage();
-+ }
-+ while( hasNextPage && ( xStyle == word::getCurrentPageStyle( mxModel ) ) );
-+
-+ if( !hasNextPage )
-+ DebugHelper::exception( SbERR_BAD_ACTION, rtl::OUString() );
-+ }
-+ break;
-+ }
-+ default:
-+ {
-+ break;
-+ }
-+ }
-+
-+ xStyle = word::getCurrentPageStyle( mxModel );
-+ uno::Reference< beans::XPropertySet > xPageProps( xStyle, uno::UNO_QUERY_THROW );
-+ sal_Bool isOn = sal_False;
-+ xPageProps->getPropertyValue( aPropIsOn ) >>= isOn;
-+ sal_Bool isShared = sal_False;
-+ xPageProps->getPropertyValue( aPropIsShared ) >>= isShared;
-+ if( !isOn )
-+ {
-+ xPageProps->setPropertyValue( aPropIsOn, uno::makeAny( sal_True ) );
-+ xPageProps->setPropertyValue( aPropBodyDistance, uno::makeAny( DEFAULT_BODY_DISTANCE ) );
-+ }
-+ if( !isShared )
-+ {
-+ rtl::OUString aTempPropText = aPropText;
-+ if( nType == word::WdSeekView::wdSeekEvenPagesFooter
-+ || nType == word::WdSeekView::wdSeekEvenPagesHeader )
-+ {
-+ aTempPropText += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Left") );
-+ }
-+ else
-+ {
-+ aTempPropText += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Right") );
-+ }
-+ xText.set( xPageProps->getPropertyValue( aTempPropText), uno::UNO_QUERY_THROW );
-+ }
-+ else
-+ {
-+ if( nType == word::WdSeekView::wdSeekEvenPagesFooter
-+ || nType == word::WdSeekView::wdSeekEvenPagesHeader )
-+ {
-+ DebugHelper::exception( SbERR_BAD_ACTION, rtl::OUString() );
-+ }
-+ xText.set( xPageProps->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW );
-+ }
-+
-+ mxModel->unlockControllers();
-+ if( !xText.is() )
-+ {
-+ DebugHelper::exception( SbERR_INTERNAL_ERROR, rtl::OUString() );
-+ }
-+ return xText->getStart();
-+}
-+
-+rtl::OUString&
-+SwVbaView::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaView") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaView::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.View" ) );
-+ }
-+ return aServiceNames;
-+}
-+
---- sw/source/ui/vba/vbaview.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sw/source/ui/vba/vbaview.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,69 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_VIEW_HXX
-+#define SW_VBA_VIEW_HXX
-+
-+#include <ooo/vba/word/XView.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <com/sun/star/text/XTextViewCursor.hpp>
-+#include <com/sun/star/text/XTextRange.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XView > SwVbaView_BASE;
-+
-+class SwVbaView : public SwVbaView_BASE
-+{
-+private:
-+ css::uno::Reference< css::frame::XModel > mxModel;
-+ css::uno::Reference< css::text::XTextViewCursor > mxViewCursor;
-+ css::uno::Reference< css::beans::XPropertySet > mxViewSettings;
-+
-+ css::uno::Reference< css::text::XTextRange > getHFTextRange( sal_Int32 nType ) throw (css::uno::RuntimeException);
-+
-+public:
-+ SwVbaView( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext,
-+ const css::uno::Reference< css::frame::XModel >& rModel ) throw ( css::uno::RuntimeException );
-+ virtual ~SwVbaView();
-+
-+ // XView
-+ virtual ::sal_Int32 SAL_CALL getSeekView() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setSeekView( ::sal_Int32 _seekview ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getSplitSpecial() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setSplitSpecial( ::sal_Int32 _splitspecial ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getTableGridLines() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setTableGridLines( ::sal_Bool _tablegridlines ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setType( ::sal_Int32 _type ) throw (css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif /* SW_VBA_VIEW_HXX */
---- sw/source/ui/vba/vbawindow.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sw/source/ui/vba/vbawindow.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,116 @@
-+/*************************************************************************
-+ *
-+ * 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: vbawindow.cxx,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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include <vbahelper/helperdecl.hxx>
-+#include "vbawindow.hxx"
-+#include "vbaglobals.hxx"
-+#include "vbadocument.hxx"
-+#include "vbaview.hxx"
-+#include "vbapanes.hxx"
-+#include "vbapane.hxx"
-+
-+using namespace ::com::sun::star;
-+using namespace ::ooo::vba;
-+
-+SwVbaWindow::SwVbaWindow( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) : WindowImpl_BASE( xParent, xContext, xModel )
-+{
-+}
-+
-+SwVbaWindow::SwVbaWindow( uno::Sequence< uno::Any > const & args, uno::Reference< uno::XComponentContext > const & xContext )
-+ : WindowImpl_BASE( args, xContext )
-+{
-+}
-+
-+void
-+SwVbaWindow::Activate() throw (css::uno::RuntimeException)
-+{
-+ SwVbaDocument document( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel );
-+
-+ document.Activate();
-+}
-+
-+void
-+SwVbaWindow::Close( const uno::Any& SaveChanges, const uno::Any& RouteDocument ) throw (uno::RuntimeException)
-+{
-+ // FIXME: it is incorrect when there are more than 1 windows
-+ SwVbaDocument document( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel );
-+ uno::Any FileName;
-+ document.Close(SaveChanges, FileName, RouteDocument );
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaWindow::getView() throw (uno::RuntimeException)
-+{
-+ return uno::makeAny( uno::Reference< word::XView >( new SwVbaView( this, mxContext, m_xModel ) ) );
-+}
-+
-+void SAL_CALL SwVbaWindow::setView( const uno::Any& _view ) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nType = 0;
-+ if( _view >>= nType )
-+ {
-+ SwVbaView view( this, mxContext, m_xModel );
-+ view.setType( nType );
-+ }
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaWindow::Panes( const uno::Any& aIndex ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< XCollection > xPanes( new SwVbaPanes( this, mxContext, m_xModel ) );
-+ if( aIndex.getValueTypeClass() == uno::TypeClass_VOID )
-+ return uno::makeAny( xPanes );
-+
-+ return uno::Any( xPanes->Item( aIndex, uno::Any() ) );
-+}
-+
-+uno::Any SAL_CALL
-+SwVbaWindow::ActivePane() throw (uno::RuntimeException)
-+{
-+ return uno::makeAny( uno::Reference< word::XPane >( new SwVbaPane( this, mxContext, m_xModel ) ) );
-+}
-+
-+rtl::OUString&
-+SwVbaWindow::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaWindow") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+SwVbaWindow::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Window" ) );
-+ }
-+ return aServiceNames;
-+}
---- sw/source/ui/vba/vbawindow.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sw/source/ui/vba/vbawindow.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,61 @@
-+/*************************************************************************
-+ *
-+ * 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: vbawindow.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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_VBA_WINDOW_HXX
-+#define SW_VBA_WINDOW_HXX
-+#include <cppuhelper/implbase1.hxx>
-+#include <ooo/vba/word/XWindow.hpp>
-+#include <com/sun/star/uno/XComponentContext.hpp>
-+
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <vbahelper/vbawindowbase.hxx>
-+
-+typedef cppu::ImplInheritanceHelper1< VbaWindowBase, ov::word::XWindow > WindowImpl_BASE;
-+
-+class SwVbaWindow : public WindowImpl_BASE
-+{
-+public:
-+ SwVbaWindow( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::frame::XModel >& xModel );
-+ SwVbaWindow( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext > const& xContext );
-+
-+
-+ // Attributes
-+ 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);
-+ // Methods
-+ virtual void SAL_CALL Activate( ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL Close( const css::uno::Any& SaveChanges, const css::uno::Any& RouteDocument ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL Panes( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL ActivePane() throw (css::uno::RuntimeException);
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif //SW_VBA_WINDOW_HXX
---- sw/source/ui/vba/wordvbahelper.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sw/source/ui/vba/wordvbahelper.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,207 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include <docsh.hxx>
-+#include "wordvbahelper.hxx"
-+#include <comphelper/processfactory.hxx>
-+#include <com/sun/star/frame/XController.hpp>
-+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
-+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
-+#include <com/sun/star/container/XNameAccess.hpp>
-+#include <com/sun/star/lang/XUnoTunnel.hpp>
-+#include <unotxdoc.hxx>
-+
-+using namespace ::com::sun::star;
-+using namespace ::ooo::vba;
-+
-+#define FIRST_PAGE 1;
-+
-+namespace ooo
-+{
-+namespace vba
-+{
-+namespace word
-+{
-+
-+SwDocShell* getDocShell( const uno::Reference< frame::XModel>& xModel )
-+{
-+ uno::Reference< lang::XUnoTunnel > xTunnel( xModel, uno::UNO_QUERY_THROW );
-+ SwXTextDocument* pXDoc = reinterpret_cast< SwXTextDocument * >( sal::static_int_cast< sal_IntPtr >(xTunnel->getSomething(SwXTextDocument::getUnoTunnelId())));
-+ return pXDoc ? pXDoc->GetDocShell() : 0;
-+}
-+
-+SwView* getView( const uno::Reference< frame::XModel>& xModel )
-+{
-+ SwDocShell* pDocShell = getDocShell( xModel );
-+ return pDocShell? pDocShell->GetView() : 0;
-+}
-+
-+uno::Reference< text::XTextViewCursor > getXTextViewCursor( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< frame::XController > xController = xModel->getCurrentController();
-+ uno::Reference< text::XTextViewCursorSupplier > xTextViewCursorSupp( xController, uno::UNO_QUERY_THROW );
-+ uno::Reference< text::XTextViewCursor > xTextViewCursor = xTextViewCursorSupp->getViewCursor();
-+ return xTextViewCursor;
-+}
-+
-+uno::Reference< style::XStyle > getCurrentPageStyle( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< beans::XPropertySet > xCursorProps( getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
-+ rtl::OUString aPageStyleName;
-+ xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyleName"))) >>= aPageStyleName;
-+ uno::Reference< style::XStyleFamiliesSupplier > xSytleFamSupp( xModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XNameAccess > xSytleFamNames( xSytleFamSupp->getStyleFamilies(), uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XNameAccess > xPageStyles( xSytleFamNames->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyles") ) ), uno::UNO_QUERY_THROW );
-+ uno::Reference< style::XStyle > xStyle( xPageStyles->getByName( aPageStyleName ), uno::UNO_QUERY_THROW );
-+
-+ return xStyle;
-+}
-+
-+// Class HeaderFooterHelper
-+
-+sal_Bool HeaderFooterHelper::isHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< text::XPageCursor > xPageCursor( getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xStyleProps( getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW );
-+
-+ sal_Bool isOn = sal_False;
-+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn"))) >>= isOn;
-+ if( !isOn )
-+ return sal_False;
-+
-+ sal_Bool isShared = sal_False;
-+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsShared"))) >>= isShared;
-+
-+ rtl::OUString aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderText") );
-+ if( !isShared )
-+ {
-+ if( 0 == xPageCursor->getPage() % 2 )
-+ {
-+ aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderTextLeft") );
-+ }
-+ else
-+ {
-+ aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderTextRight") );
-+ }
-+ }
-+
-+ uno::Reference< text::XText > xText( xStyleProps->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW );
-+ //FIXME: can not compare in this way?
-+ return ( xText == xCurrentText );
-+}
-+
-+sal_Bool HeaderFooterHelper::isFirstPageHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
-+{
-+ if( isHeader( xModel, xCurrentText ) )
-+ {
-+ uno::Reference< text::XPageCursor > xPageCursor( getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
-+ // FIXME: getPage allways returns 1
-+ sal_Int32 nPage = xPageCursor->getPage();
-+ return nPage == FIRST_PAGE;
-+ }
-+ return sal_False;
-+}
-+
-+sal_Bool HeaderFooterHelper::isEvenPagesHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
-+{
-+ if( isHeader( xModel, xCurrentText ) )
-+ {
-+ uno::Reference< beans::XPropertySet > xStyleProps( getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW );
-+ sal_Bool isShared = sal_False;
-+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsShared"))) >>= isShared;
-+ if( !isShared )
-+ {
-+ uno::Reference< text::XPageCursor > xPageCursor( getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
-+ return ( 0 == xPageCursor->getPage() % 2 );
-+ }
-+ }
-+ return sal_False;
-+}
-+
-+sal_Bool HeaderFooterHelper::isFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< text::XPageCursor > xPageCursor( getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xStyleProps( getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW );
-+
-+ sal_Bool isOn = sal_False;
-+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn"))) >>= isOn;
-+ if( !isOn )
-+ return sal_False;
-+
-+ sal_Bool isShared = sal_False;
-+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsShared"))) >>= isShared;
-+
-+ rtl::OUString aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterText") );
-+ if( !isShared )
-+ {
-+ if( 0 == xPageCursor->getPage() % 2 )
-+ {
-+ aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterTextLeft") );
-+ }
-+ else
-+ {
-+ aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterTextRight") );
-+ }
-+ }
-+
-+ uno::Reference< text::XText > xText( xStyleProps->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW );
-+
-+ return ( xText == xCurrentText );
-+}
-+
-+sal_Bool HeaderFooterHelper::isFirstPageFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
-+{
-+ if( isFooter( xModel, xCurrentText ) )
-+ {
-+ uno::Reference< text::XPageCursor > xPageCursor( getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
-+ sal_Int32 nPage = xPageCursor->getPage();
-+ return nPage == FIRST_PAGE;
-+ }
-+ return sal_False;
-+}
-+
-+sal_Bool HeaderFooterHelper::isEvenPagesFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
-+{
-+ if( isFooter( xModel, xCurrentText ) )
-+ {
-+ uno::Reference< beans::XPropertySet > xStyleProps( getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW );
-+ sal_Bool isShared = sal_False;
-+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsShared"))) >>= isShared;
-+ if( !isShared )
-+ {
-+ uno::Reference< text::XPageCursor > xPageCursor( getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
-+ return ( 0 == xPageCursor->getPage() % 2 );
-+ }
-+ }
-+ return sal_False;
-+}
-+
-+} // word
-+} //
-+} //
---- sw/source/ui/vba/wordvbahelper.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sw/source/ui/vba/wordvbahelper.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,67 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SW_WORD_VBA_HELPER_HXX
-+#define SW_WORD_VBA_HELPER_HXX
-+
-+#include <vbahelper/vbahelper.hxx>
-+#include <com/sun/star/text/XText.hpp>
-+#include <com/sun/star/text/XTextViewCursor.hpp>
-+#include <com/sun/star/text/XPageCursor.hpp>
-+#include <com/sun/star/style/XStyle.hpp>
-+
-+class SwDocShell;
-+class SwView;
-+namespace ooo
-+{
-+ namespace vba
-+ {
-+ namespace word
-+ {
-+ //css::uno::Reference< css::frame::XModel > getCurrentDocument() throw (css::uno::RuntimeException);
-+ SwDocShell* getDocShell( const css::uno::Reference< css::frame::XModel>& xModel );
-+ SwView* getView( const css::uno::Reference< css::frame::XModel>& xModel );
-+ css::uno::Reference< css::text::XTextViewCursor > getXTextViewCursor( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
-+ css::uno::Reference< css::style::XStyle > getCurrentPageStyle( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
-+
-+class HeaderFooterHelper
-+{
-+public:
-+ static sal_Bool isHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-+ static sal_Bool isFirstPageHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-+ static sal_Bool isEvenPagesHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-+ static sal_Bool isFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-+ static sal_Bool isFirstPageFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-+ static sal_Bool isEvenPagesFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
-+};
-+
-+}; // word
-+}; // vba
-+}; // ooo
-+#endif
---- sw/util/makefile.mk.old 2009-04-06 16:41:40.000000000 +0000
-+++ sw/util/makefile.mk 2009-04-06 16:42:01.000000000 +0000
-@@ -131,6 +131,7 @@ SHL1STDLIBS+= \
- $(SALHELPERLIB) \
- $(ICUUCLIB) \
- $(I18NUTILLIB) \
-+ $(VBAHELPERLIB) \
- $(AVMEDIALIB)
-
- .IF "$(GUI)"=="WNT"
-@@ -343,6 +344,41 @@ SHL4STDLIBS= \
- $(CPPUHELPERLIB) \
- $(SALLIB) \
- $(ICUUCLIB) \
-+ $(VBAHELPERLIB) \
-+ $(BASICLIB) \
- $(I18NUTILLIB)
-
-+#target vba
-+TARGET_VBA=vbaswobj
-+SHL5TARGET=$(TARGET_VBA)$(DLLPOSTFIX).uno
-+SHL5IMPLIB= i$(TARGET_VBA)
-+
-+SHL5VERSIONMAP=$(TARGET_VBA).map
-+SHL5DEF=$(MISC)$/$(SHL5TARGET).def
-+DEF5NAME=$(SHL5TARGET)
-+SHL5STDLIBS= \
-+ $(ISWLIB) \
-+ $(CPPUHELPERLIB) \
-+ $(VCLLIB) \
-+ $(CPPULIB) \
-+ $(COMPHELPERLIB) \
-+ $(SVLIB) \
-+ $(TOOLSLIB) \
-+ $(SALLIB)\
-+ $(VBAHELPERLIB) \
-+ $(BASICLIB) \
-+ $(SFXLIB) \
-+ $(SVXLIB) \
-+ $(SVTOOLLIB) \
-+ $(SVLLIB) \
-+ $(VCLLIB) \
-+ $(TKLIB) \
-+
-+.IF "$(GUI)"=="WNT"
-+SHL5STDLIBS+= $(ADVAPI32LIB)
-+.ENDIF # WNT
-+
-+SHL5DEPN=$(SHL1TARGETN)
-+SHL5LIBS=$(SLB)$/$(TARGET_VBA).lib
-+
- .INCLUDE : target.mk
---- sw/util/vbaswobj.map.old 1970-01-01 00:00:00.000000000 +0000
-+++ sw/util/vbaswobj.map 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,9 @@
-+OOO_1.1 {
-+ global:
-+ component_getImplementationEnvironment;
-+ component_getFactory;
-+ component_writeInfo;
-+
-+ local:
-+ *;
-+};
---- vbahelper/inc/vbahelper/helperdecl.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/inc/vbahelper/helperdecl.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,58 @@
-+/*************************************************************************
-+ *
-+ * 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: helperdecl.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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef OOVBAAPI_SERV_DECL
-+#define OOVBAAPI_SERV_DECL
-+#include <comphelper/servicedecl.hxx>
-+#include <ooo/vba/XHelperInterface.hpp>
-+
-+namespace comphelper {
-+namespace service_decl {
-+template <typename ImplT_, typename WithArgsT = with_args<false> >
-+struct vba_service_class_ : public serviceimpl_base< detail::OwnServiceImpl<ImplT_>, WithArgsT >
-+{
-+ typedef serviceimpl_base< detail::OwnServiceImpl<ImplT_>, WithArgsT > baseT;
-+ /** Default ctor. Implementation class without args, expecting
-+ component context as single argument.
-+ */
-+ vba_service_class_() : baseT() {}
-+ template <typename PostProcessFuncT>
-+ /** 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<uno::XInterface>
-+ */
-+ explicit vba_service_class_( PostProcessFuncT const& postProcessFunc ) : baseT( postProcessFunc ) {}
-+};
-+
-+} // namespace service_decl
-+} // namespace comphelper
-+#endif
---- vbahelper/inc/vbahelper/vbaapplicationbase.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/inc/vbahelper/vbaapplicationbase.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,59 @@
-+/*************************************************************************
-+ *
-+ * 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: vbaapplicationbase.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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef VBA_APPLICATION_BASE_HXX
-+#define VBA_APPLICATION_BASE_HXX
-+
-+#include <ooo/vba/XHelperInterface.hpp>
-+#include <ooo/vba/XApplicationBase.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+
-+typedef InheritedHelperInterfaceImpl1< ov::XApplicationBase > ApplicationBase_BASE;
-+
-+class VbaApplicationBase : public ApplicationBase_BASE
-+{
-+protected:
-+ VbaApplicationBase( const css::uno::Reference< css::uno::XComponentContext >& xContext );
-+ virtual ~VbaApplicationBase();
-+
-+public:
-+ // XHelperInterface ( parent is itself )
-+ virtual css::uno::Reference< ov::XHelperInterface > SAL_CALL getParent( ) throw (css::script::BasicErrorException, css::uno::RuntimeException) { return this; }
-+
-+ 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 css::uno::Any SAL_CALL CommandBars( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif
---- vbahelper/inc/vbahelper/vbacollectionimpl.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/inc/vbahelper/vbacollectionimpl.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,257 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef OOVBAAPI_VBA_COLLECTION_IMPL_HXX
-+#define OOVBAAPI_VBA_COLLECTION_IMPL_HXX
-+
-+#include <ooo/vba/XCollection.hpp>
-+#include <com/sun/star/container/XEnumerationAccess.hpp>
-+#include <com/sun/star/uno/XComponentContext.hpp>
-+#include <com/sun/star/script/XDefaultMethod.hpp>
-+#include <com/sun/star/container/XIndexAccess.hpp>
-+#include <com/sun/star/container/XNameAccess.hpp>
-+#include <com/sun/star/container/XNamed.hpp>
-+
-+#include <cppuhelper/implbase3.hxx>
-+#include <cppuhelper/implbase2.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+
-+#include "vbahelper/vbahelper.hxx"
-+#include "vbahelper/vbahelperinterface.hxx"
-+
-+#include <vector>
-+
-+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<ov::XCollection> 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 <typename Ifc> // 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
---- vbahelper/inc/vbahelper/vbadllapi.h.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/inc/vbahelper/vbadllapi.h 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,44 @@
-+/*************************************************************************
-+ *
-+ * 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: svldllapi.h,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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef INCLUDED_VBADLLAPI_H
-+#define INCLUDED_VBADLLAPI_H
-+
-+#include "sal/types.h"
-+
-+#if defined(VBAHELPER_DLLIMPLEMENTATION)
-+#define VBAHELPER_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
-+#else
-+#define VBAHELPER_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
-+#endif
-+#define VBAHELPER_DLLPRIVATE SAL_DLLPRIVATE
-+
-+#endif /* INCLUDED_SVLDLLAPI_H */
-+
---- vbahelper/inc/vbahelper/vbadocumentbase.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/inc/vbahelper/vbadocumentbase.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,73 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef VBA_DOCUMENTBASE_HXX
-+#define VBA_DOCUMENTBASE_HXX
-+
-+#include <com/sun/star/frame/XModel.hpp>
-+#include <ooo/vba/XDocumentBase.hpp>
-+#include <vbahelper/vbahelperinterface.hxx>
-+
-+typedef InheritedHelperInterfaceImpl1< ooo::vba::XDocumentBase > VbaDocumentBase_BASE;
-+
-+class VbaDocumentBase : public VbaDocumentBase_BASE
-+{
-+protected:
-+ css::uno::Reference< css::frame::XModel > mxModel;
-+protected:
-+ virtual css::uno::Reference< css::frame::XModel > getModel() { return mxModel; }
-+ VbaDocumentBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext);
-+public:
-+ VbaDocumentBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext,
-+ css::uno::Reference< css::frame::XModel > xModel );
-+ VbaDocumentBase( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext );
-+ virtual ~VbaDocumentBase() {}
-+
-+ // 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 getSaved() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setSaved( sal_Bool bSave ) throw (css::uno::RuntimeException);
-+
-+ // Methods
-+ 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);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif /* VBA_DOCUMENTBASE_HXX */
---- vbahelper/inc/vbahelper/vbaglobalbase.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/inc/vbahelper/vbaglobalbase.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,53 @@
-+/*************************************************************************
-+ *
-+ * 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: vbaapplicationbase.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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef VBA_GLOBAL_BASE_HXX
-+#define VBA_GLOBAL_BASE_HXX
-+
-+#include "vbahelperinterface.hxx"
-+#include <ooo/vba/XGlobalsBase.hpp>
-+
-+typedef InheritedHelperInterfaceImpl1< ov::XGlobalsBase > Globals_BASE;
-+class VbaGlobalsBase : public Globals_BASE
-+
-+{
-+protected:
-+
-+ bool hasServiceName( const rtl::OUString& serviceName );
-+ void init( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Any& aApplication );
-+
-+public:
-+ VbaGlobalsBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext);
-+ virtual ~VbaGlobalsBase(){};
-+ // XMultiServiceFactory
-+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( const ::rtl::OUString& aServiceSpecifier ) throw (css::uno::Exception, css::uno::RuntimeException);
-+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const css::uno::Sequence< css::uno::Any >& Arguments ) throw (css::uno::Exception, css::uno::RuntimeException);
-+ virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames( ) throw (css::uno::RuntimeException);
-+};
-+#endif
---- vbahelper/inc/vbahelper/vbahelper.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/inc/vbahelper/vbahelper.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,224 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef OOVBAAPI_VBA_HELPER_HXX
-+#define OOVBAAPI_VBA_HELPER_HXX
-+
-+#include <com/sun/star/drawing/XShape.hpp>
-+#include <com/sun/star/beans/XIntrospectionAccess.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <com/sun/star/script/BasicErrorException.hpp>
-+#include <com/sun/star/script/XTypeConverter.hpp>
-+#include <com/sun/star/lang/IllegalArgumentException.hpp>
-+#include <com/sun/star/awt/XControl.hpp>
-+#include <com/sun/star/awt/XDevice.hpp>
-+#include <basic/sberrors.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/frame/XModel.hpp>
-+#include <sfx2/dispatch.hxx>
-+//#include <ooo/vba/msforms/XShape.hpp>
-+#include <vcl/pointr.hxx>
-+#define VBAHELPER_DLLIMPLEMENTATION
-+#include <vbahelper/vbadllapi.h>
-+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;
-+ }
-+ VBAHELPER_DLLPUBLIC css::uno::Reference< css::uno::XInterface > createVBAUnoAPIService( SfxObjectShell* pShell, const sal_Char* _pAsciiName ) throw (css::uno::RuntimeException);
-+ VBAHELPER_DLLPUBLIC css::uno::Reference< css::uno::XInterface > createVBAUnoAPIServiceWithArgs( SfxObjectShell* pShell, const sal_Char* _pAsciiName, const css::uno::Sequence< css::uno::Any >& aArgs ) throw (css::uno::RuntimeException);
-+ VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getCurrentDocument() throw (css::uno::RuntimeException);
-+ VBAHELPER_DLLPUBLIC css::uno::Reference< css::beans::XIntrospectionAccess > getIntrospectionAccess( const css::uno::Any& aObject ) throw (css::uno::RuntimeException);
-+ VBAHELPER_DLLPUBLIC css::uno::Reference< css::script::XTypeConverter > getTypeConverter( const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException);
-+
-+ VBAHELPER_DLLPUBLIC void dispatchRequests (css::uno::Reference< css::frame::XModel>& xModel,rtl::OUString & aUrl) ;
-+ VBAHELPER_DLLPUBLIC void dispatchRequests (css::uno::Reference< css::frame::XModel>& xModel,rtl::OUString & aUrl, css::uno::Sequence< css::beans::PropertyValue >& sProps ) ;
-+ VBAHELPER_DLLPUBLIC void dispatchExecute(SfxViewShell* pView, USHORT nSlot, SfxCallMode nCall = SFX_CALLMODE_SYNCHRON );
-+ VBAHELPER_DLLPUBLIC sal_Int32 OORGBToXLRGB( sal_Int32 );
-+ VBAHELPER_DLLPUBLIC sal_Int32 XLRGBToOORGB( sal_Int32 );
-+ VBAHELPER_DLLPUBLIC css::uno::Any OORGBToXLRGB( const css::uno::Any& );
-+ VBAHELPER_DLLPUBLIC 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
-+ VBAHELPER_DLLPUBLIC const css::uno::Any& aNULL();
-+ VBAHELPER_DLLPUBLIC void PrintOutHelper( SfxViewShell* pViewShell, 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, sal_Bool bSelection );
-+ VBAHELPER_DLLPUBLIC void PrintPreviewHelper( const css::uno::Any& EnableChanges, SfxViewShell* );
-+
-+ VBAHELPER_DLLPUBLIC rtl::OUString getAnyAsString( const css::uno::Any& pvargItem ) throw ( css::uno::RuntimeException );
-+ VBAHELPER_DLLPUBLIC rtl::OUString VBAToRegexp(const rtl::OUString &rIn, bool bForLike = false); // needs to be in an uno service ( already this code is duplicated in basic )
-+ VBAHELPER_DLLPUBLIC double getPixelTo100thMillimeterConversionFactor( css::uno::Reference< css::awt::XDevice >& xDevice, sal_Bool bVertical);
-+ VBAHELPER_DLLPUBLIC double PointsToPixels( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical);
-+ VBAHELPER_DLLPUBLIC double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical);
-+ VBAHELPER_DLLPUBLIC sal_Int32 getPointerStyle();
-+ VBAHELPER_DLLPUBLIC void setCursorHelper( const Pointer& rPointer, sal_Bool bOverWrite );
-+ VBAHELPER_DLLPUBLIC String docMacroExists( SfxObjectShell* pShell, const String& sMod, const String& sMacro );
-+
-+class VBAHELPER_DLLPUBLIC Millimeter
-+{
-+//Factor to translate between points and hundredths of millimeters:
-+private:
-+ static const double factor;
-+
-+ double m_nMillimeter;
-+
-+public:
-+ Millimeter();
-+
-+ Millimeter(double mm);
-+
-+ void set(double mm);
-+ void setInPoints(double points) ;
-+ void setInHundredthsOfOneMillimeter(double hmm);
-+ double get();
-+ double getInHundredthsOfOneMillimeter();
-+ double getInPoints();
-+ static sal_Int32 getInHundredthsOfOneMillimeter(double points);
-+ static double getInPoints(int _hmm);
-+};
-+
-+class VBAHELPER_DLLPUBLIC 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;
-+};
-+
-+namespace msforms {
-+ class XShape;
-+}
-+
-+class VBAHELPER_DLLPUBLIC 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();
-+ 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);
-+};
-+#define VBA_LEFT "PositionX"
-+#define VBA_TOP "PositionY"
-+class VBAHELPER_DLLPUBLIC 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 VBAHELPER_DLLPUBLIC ShapeHelper
-+{
-+protected:
-+ css::uno::Reference< css::drawing::XShape > xShape;
-+public:
-+ ShapeHelper( const css::uno::Reference< css::drawing::XShape >& _xShape) throw (css::script::BasicErrorException );
-+
-+ double getHeight();
-+
-+ void setHeight(double _fheight) throw ( css::script::BasicErrorException );
-+
-+ double getWidth();
-+
-+ void setWidth(double _fWidth) throw ( css::script::BasicErrorException );
-+
-+ double getLeft();
-+
-+ void setLeft(double _fLeft);
-+
-+ double getTop();
-+
-+ void setTop(double _fTop);
-+};
-+
-+class VBAHELPER_DLLPUBLIC 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 VBAHELPER_DLLPUBLIC DebugHelper
-+{
-+public:
-+ static void exception( const rtl::OUString& DetailedMessage, const css::uno::Exception& ex, int err, const rtl::OUString& /*additionalArgument*/ ) throw( css::script::BasicErrorException );
-+
-+ static void exception( int err, const rtl::OUString& additionalArgument ) throw( css::script::BasicErrorException );
-+
-+ static void exception( css::uno::Exception& ex ) throw( css::script::BasicErrorException );
-+};
-+ } // 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
---- vbahelper/inc/vbahelper/vbahelperinterface.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/inc/vbahelper/vbahelperinterface.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,121 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef OOVBAAPI_VBA_HELPERINTERFACE_HXX
-+#define OOVBAAPI_VBA_HELPERINTERFACE_HXX
-+
-+#include <cppuhelper/implbase1.hxx>
-+#include <ooo/vba/XHelperInterface.hpp>
-+#include <vbahelper/vbahelper.hxx>
-+#include <com/sun/star/container/XNameAccess.hpp>
-+
-+// 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<rtl::OUString> 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) {
-+ // The application could certainly be passed around in the context - seems
-+ // to make sense
-+ css::uno::Reference< css::container::XNameAccess > xNameAccess( mxContext, css::uno::UNO_QUERY_THROW );
-+ return xNameAccess->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Application" ) ) );
-+ }
-+
-+
-+ // 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
---- vbahelper/inc/vbahelper/vbapropvalue.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/inc/vbahelper/vbapropvalue.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,60 @@
-+/*************************************************************************
-+ *
-+ * 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: vbapropvalue.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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SC_VBA_PROPVALULE_HXX
-+#define SC_VBA_PROPVALULE_HXX
-+#include <ooo/vba/XPropValue.hpp>
-+#include <cppuhelper/implbase1.hxx>
-+
-+#include <vbahelper/vbahelper.hxx>
-+
-+typedef ::cppu::WeakImplHelper1< ov::XPropValue > PropValueImpl_BASE;
-+
-+class PropListener
-+{
-+public:
-+ virtual void setValueEvent( const css::uno::Any& value ) = 0;
-+ virtual css::uno::Any getValueEvent() = 0;
-+};
-+
-+
-+class ScVbaPropValue : public PropValueImpl_BASE
-+{
-+ PropListener* m_pListener;
-+public:
-+ ScVbaPropValue( PropListener* pListener );
-+
-+ // 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);
-+
-+ rtl::OUString SAL_CALL getDefaultPropertyName() throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
-+
-+};
-+#endif //SC_VBA_PROPVALULE_HXX
---- vbahelper/inc/vbahelper/vbawindowbase.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/inc/vbahelper/vbawindowbase.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,66 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef VBA_WINDOWBASE_HXX
-+#define VBA_WINDOWBASE_HXX
-+#include <cppuhelper/implbase1.hxx>
-+#include <ooo/vba/XWindowBase.hpp>
-+#include <com/sun/star/frame/XModel.hpp>
-+#include <com/sun/star/awt/XDevice.hpp>
-+
-+#include <vbahelper/vbahelperinterface.hxx>
-+
-+typedef InheritedHelperInterfaceImpl1<ov::XWindowBase > WindowBaseImpl_BASE;
-+
-+class VbaWindowBase : public WindowBaseImpl_BASE
-+{
-+protected:
-+ css::uno::Reference< css::frame::XModel > m_xModel;
-+public:
-+ VbaWindowBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::frame::XModel >& xModel );
-+ VbaWindowBase( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext > const& xContext );
-+
-+ // XWindowBase
-+ 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_Int32 SAL_CALL getTop() throw (css::uno::RuntimeException) ;
-+ virtual void SAL_CALL setTop( sal_Int32 _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 getWidth() throw (css::uno::RuntimeException) ;
-+ virtual void SAL_CALL setWidth( sal_Int32 _width ) throw (css::uno::RuntimeException) ;
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif //VBA_WINDOWBASE_HXX
---- vbahelper/prj/build.lst.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/prj/build.lst 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,6 @@
-+vba vbahelper : oovbaapi basic sfx2 svx cppuhelper vcl comphelper svtools tools sal NULL
-+vba vbahelper usr1 - all vba_mkout NULL
-+#vba vbahelper\inc nmake - all vba_inc NULL
-+vba vbahelper\source\vbahelper nmake - all vba_vbahelper NULL
-+vba vbahelper\source\msforms nmake - all vba_msforms NULL
-+vba vbahelper\util nmake - all vba_util vba_vbahelper vba_msforms NULL
---- vbahelper/prj/d.lst.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/prj/d.lst 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,18 @@
-+..\%__SRC%\lib\lib*.so %_DEST%\lib%_EXT%
-+..\%__SRC%\lib\lib*.dylib %_DEST%\lib%_EXT%
-+..\%__SRC%\slb\vbahelper.lib %_DEST%\lib%_EXT%\vbahelper.lib
-+..\%__SRC%\lib\vbahelp*.* %_DEST%\lib%_EXT%\vba*.*
-+..\%__SRC%\bin\vbahelper*.* %_DEST%\bin%_EXT%\vbahelper*.*
-+..\%__SRC%\bin\msforms*.* %_DEST%\bin%_EXT%\msforms*.*
-+
-+mkdir: %_DEST%\inc%_EXT%\basic
-+..\inc\vbahelper\vbacollectionimpl.hxx %_DEST%\inc%_EXT%\vbahelper\vbacollectionimpl.hxx
-+..\inc\vbahelper\vbahelper.hxx %_DEST%\inc%_EXT%\vbahelper\vbahelper.hxx
-+..\inc\vbahelper\helperdecl.hxx %_DEST%\inc%_EXT%\vbahelper\helperdecl.hxx
-+..\inc\vbahelper\vbahelperinterface.hxx %_DEST%\inc%_EXT%\vbahelper\vbahelperinterface.hxx
-+..\inc\vbahelper\vbaapplicationbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbaapplicationbase.hxx
-+..\inc\vbahelper\vbadllapi.h %_DEST%\inc%_EXT%\vbahelper\vbadllapi.h
-+..\inc\vbahelper\vbawindowbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbawindowbase.hxx
-+..\inc\vbahelper\vbadocumentbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbadocumentbase.hxx
-+..\inc\vbahelper\vbapropvalue.hxx %_DEST%\inc%_EXT%\vbahelper\vbapropvalue.hxx
-+..\inc\vbahelper\vbaglobalbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbaglobalbase.hxx
---- vbahelper/source/msforms/makefile.mk.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/msforms/makefile.mk 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,78 @@
-+#*************************************************************************
-+#
-+# 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: makefile.mk,v $
-+#
-+# $Revision: 1.45 $
-+#
-+# 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
-+# <http://www.openoffice.org/license.html>
-+# for a copy of the LGPLv3 License.
-+#
-+#*************************************************************************
-+
-+PRJ=..$/..
-+PRJNAME=vbahelper
-+TARGET=msforms
-+
-+ENABLE_EXCEPTIONS := TRUE
-+
-+# --- Settings -----------------------------------------------------
-+
-+.INCLUDE : settings.mk
-+
-+SLOFILES=\
-+ $(SLO)$/vbacontrol.obj \
-+ $(SLO)$/vbacontrols.obj \
-+ $(SLO)$/vbabutton.obj \
-+ $(SLO)$/vbacombobox.obj \
-+ $(SLO)$/vbalabel.obj \
-+ $(SLO)$/vbatextbox.obj \
-+ $(SLO)$/vbaradiobutton.obj \
-+ $(SLO)$/vbalistbox.obj \
-+ $(SLO)$/vbatogglebutton.obj \
-+ $(SLO)$/vbacheckbox.obj \
-+ $(SLO)$/vbaframe.obj \
-+ $(SLO)$/vbascrollbar.obj \
-+ $(SLO)$/vbaprogressbar.obj \
-+ $(SLO)$/vbamultipage.obj \
-+ $(SLO)$/vbalistcontrolhelper.obj \
-+ $(SLO)$/vbaspinbutton.obj \
-+ $(SLO)$/vbaimage.obj \
-+ $(SLO)$/vbapages.obj \
-+ $(SLO)$/vbauserform.obj \
-+ $(SLO)$/service.obj \
-+
-+# #FIXME vbapropvalue needs to move to vbahelper
-+
-+# --- Targets -------------------------------------------------------
-+
-+.INCLUDE : target.mk
-+
-+ALLTAR : \
-+ $(MISC)$/$(TARGET).don \
-+
-+$(SLOFILES) : $(MISC)$/$(TARGET).don
-+
-+$(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb
-+ +$(CPPUMAKER) -O$(INCCOM)$/$(TARGET) -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@
-+ echo $@
-+
---- vbahelper/source/msforms/service.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/msforms/service.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,83 @@
-+/*************************************************************************
-+ *
-+ * 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: service.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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "cppuhelper/implementationentry.hxx"
-+#include "com/sun/star/lang/XMultiServiceFactory.hpp"
-+#include "com/sun/star/registry/XRegistryKey.hpp"
-+#include "comphelper/servicedecl.hxx"
-+
-+// =============================================================================
-+// component exports
-+// =============================================================================
-+using namespace ::com::sun::star;
-+using namespace ::com::sun::star::uno;
-+
-+namespace sdecl = comphelper::service_decl;
-+
-+// reference service helper(s)
-+namespace controlprovider
-+{
-+extern sdecl::ServiceDecl const serviceDecl;
-+}
-+
-+namespace userform
-+{
-+extern sdecl::ServiceDecl const serviceDecl;
-+}
-+
-+extern "C"
-+{
-+ void SAL_CALL component_getImplementationEnvironment(
-+ const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ )
-+ {
-+ OSL_TRACE("In component_getImplementationEnv");
-+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
-+ }
-+
-+ sal_Bool SAL_CALL component_writeInfo(
-+ lang::XMultiServiceFactory * pServiceManager, registry::XRegistryKey * pRegistryKey )
-+ {
-+ OSL_TRACE("In component_writeInfo");
-+
-+ // Component registration
-+ return component_writeInfoHelper( pServiceManager, pRegistryKey,
-+ controlprovider::serviceDecl, userform::serviceDecl );
-+ }
-+
-+ void * SAL_CALL component_getFactory(
-+ const sal_Char * pImplName, lang::XMultiServiceFactory * pServiceManager,
-+ registry::XRegistryKey * pRegistryKey )
-+ {
-+ OSL_TRACE("In component_getFactory for %s", pImplName );
-+ void* pRet = component_getFactoryHelper(
-+ pImplName, pServiceManager, pRegistryKey, controlprovider::serviceDecl, userform::serviceDecl );
-+ OSL_TRACE("Ret is 0x%x", pRet);
-+ return pRet;
-+ }
-+}
---- vbahelper/source/msforms/vbabutton.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/msforms/vbabutton.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,74 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbabutton.hxx"
-+#include <vector>
-+
-+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;
-+}
---- vbahelper/source/msforms/vbabutton.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/msforms/vbabutton.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,51 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SC_VBA_BUTTON_HXX
-+#define SC_VBA_BUTTON_HXX
-+#include <cppuhelper/implbase1.hxx>
-+#include <ooo/vba/msforms/XButton.hpp>
-+
-+#include "vbacontrol.hxx"
-+#include <vbahelper/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<rtl::OUString> getServiceNames();
-+};
-+#endif //SC_VBA_BUTTON_HXX
---- vbahelper/source/msforms/vbacheckbox.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/msforms/vbacheckbox.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,112 @@
-+/*************************************************************************
-+ *
-+ * 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 <vbahelper/helperdecl.hxx>
-+#include <vector>
-+
-+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;
-+}
-+
---- vbahelper/source/msforms/vbacheckbox.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/msforms/vbacheckbox.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,61 @@
-+/*************************************************************************
-+ *
-+ * 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 <cppuhelper/implbase2.hxx>
-+#include <ooo/vba/msforms/XRadioButton.hpp>
-+
-+#include "vbacontrol.hxx"
-+#include <vbahelper/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<rtl::OUString> getServiceNames();
-+};
-+
-+#endif //SC_VBA_CHECKBOX_HXX
---- vbahelper/source/msforms/vbacombobox.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/msforms/vbacombobox.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,175 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbacombobox.hxx"
-+#include <vector>
-+
-+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;
-+}
---- vbahelper/source/msforms/vbacombobox.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/msforms/vbacombobox.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,80 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SC_VBA_COMBOBOX_HXX
-+#define SC_VBA_COMBOBOX_HXX
-+#include <cppuhelper/implbase2.hxx>
-+#include <com/sun/star/uno/XComponentContext.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <com/sun/star/script/XDefaultProperty.hpp>
-+#include <ooo/vba/msforms/XComboBox.hpp>
-+#include <comphelper/proparrhlp.hxx>
-+#include <comphelper/propertycontainer.hxx>
-+#include <com/sun/star/beans/PropertyAttribute.hpp>
-+
-+#include "vbacontrol.hxx"
-+#include "vbalistcontrolhelper.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+
-+typedef cppu::ImplInheritanceHelper2<ScVbaControl, ov::msforms::XComboBox, css::script::XDefaultProperty > 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<rtl::OUString> getServiceNames();
-+};
-+
-+#endif //
---- vbahelper/source/msforms/vbacontrol.cxx
-+++ vbahelper/source/msforms/vbacontrol.cxx
-@@ -0,0 +1,520 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include <com/sun/star/form/FormComponentType.hpp>
-+#include <com/sun/star/awt/XControlModel.hpp>
-+#include <com/sun/star/awt/XControl.hpp>
-+#include <com/sun/star/awt/XWindow2.hpp>
-+#include <com/sun/star/lang/XEventListener.hpp>
-+#include <com/sun/star/drawing/XShape.hpp>
-+#include <com/sun/star/drawing/XControlShape.hpp>
-+#include <com/sun/star/awt/XControl.hpp>
-+#include <com/sun/star/frame/XModel.hpp>
-+#include <com/sun/star/view/XControlAccess.hpp>
-+#include <com/sun/star/container/XChild.hpp>
-+#include <com/sun/star/form/binding/XBindableValue.hpp>
-+#include <com/sun/star/form/binding/XListEntrySink.hpp>
-+#include <com/sun/star/table/CellAddress.hpp>
-+#include <com/sun/star/table/CellRangeAddress.hpp>
-+#include <ooo/vba/XControlProvider.hpp>
-+#ifdef VBA_OOBUILD_HACK
-+#include <svtools/bindablecontrolhelper.hxx>
-+#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"
-+#include <vbahelper/helperdecl.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)
-+{
-+ uno::Reference< awt::XWindow2 > xWindow2( getWindowPeer(), uno::UNO_QUERY_THROW );
-+ return xWindow2->isVisible();
-+}
-+
-+void SAL_CALL ScVbaControl::setVisible( sal_Bool bVisible ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< awt::XWindow2 > xWindow2( getWindowPeer(), uno::UNO_QUERY_THROW );
-+ xWindow2->setVisible( 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;
-+}
-+
-+
-+
-+typedef cppu::WeakImplHelper1< XControlProvider > ControlProvider_BASE;
-+class ControlProviderImpl : public ControlProvider_BASE
-+{
-+ uno::Reference< uno::XComponentContext > m_xCtx;
-+public:
-+ ControlProviderImpl( const uno::Reference< uno::XComponentContext >& xCtx ) : m_xCtx( xCtx ) {}
-+ virtual uno::Reference< msforms::XControl > SAL_CALL createControl( const uno::Reference< drawing::XControlShape >& xControl, const uno::Reference< frame::XModel >& xDocOwner ) throw (uno::RuntimeException);
-+ virtual uno::Reference< msforms::XControl > SAL_CALL createUserformControl( const uno::Reference< awt::XControl >& xControl, const uno::Reference< awt::XControl >& xDialog, const uno::Reference< frame::XModel >& xDocOwner ) throw (uno::RuntimeException);
-+};
-+
-+uno::Reference< msforms::XControl > SAL_CALL
-+ControlProviderImpl::createControl( const uno::Reference< drawing::XControlShape >& xControlShape, const uno::Reference< frame::XModel >& xDocOwner ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< msforms::XControl > xControlToReturn;
-+ if ( xControlShape.is() )
-+ {
-+ ScVbaControlFactory controlFactory( m_xCtx, xControlShape, xDocOwner );
-+ xControlToReturn.set( controlFactory.createControl( xDocOwner ) );
-+ }
-+ return xControlToReturn;
-+
-+}
-+uno::Reference< msforms::XControl > SAL_CALL
-+ControlProviderImpl::createUserformControl( const uno::Reference< awt::XControl >& xControl, const uno::Reference< awt::XControl >& xDialog, const uno::Reference< frame::XModel >& xDocOwner ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< msforms::XControl > xControlToReturn;
-+ if ( xControl.is() && xDialog.is() )
-+ {
-+
-+ ScVbaControlFactory controlFactory( m_xCtx, xControl, xDocOwner );
-+ xControlToReturn.set( controlFactory.createControl( xDialog->getModel() ) );
-+ ScVbaControl* pControl = dynamic_cast< ScVbaControl* >( xControlToReturn.get() );
-+ pControl->setGeometryHelper( new UserFormGeometryHelper( m_xCtx, xControl ) );
-+ }
-+ return xControlToReturn;
-+}
-+
-+namespace controlprovider
-+{
-+namespace sdecl = comphelper::service_decl;
-+sdecl::class_<ControlProviderImpl, sdecl::with_args<false> > serviceImpl;
-+extern sdecl::ServiceDecl const serviceDecl(
-+ serviceImpl,
-+ "ControlProviderImpl",
-+ "ooo.vba.ControlProvider" );
-+}
-+
-+
---- vbahelper/source/msforms/vbacontrol.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/msforms/vbacontrol.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,112 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SC_VBA_CONTROL_HXX
-+#define SC_VBA_CONTROL_HXX
-+
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <com/sun/star/uno/XComponentContext.hpp>
-+#include <com/sun/star/script/XDefaultProperty.hpp>
-+#include <com/sun/star/drawing/XControlShape.hpp>
-+#include <com/sun/star/awt/XControl.hpp>
-+#include <com/sun/star/awt/XWindowPeer.hpp>
-+#include <ooo/vba/msforms/XControl.hpp>
-+
-+#include <vbahelper/vbahelper.hxx>
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <memory>
-+
-+//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<rtl::OUString> 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
---- vbahelper/source/msforms/vbacontrols.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/msforms/vbacontrols.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,232 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#include "vbacontrols.hxx"
-+#include <cppuhelper/implbase2.hxx>
-+#include <com/sun/star/awt/XControlContainer.hpp>
-+#include <ooo/vba//XControlProvider.hpp>
-+#include <hash_map>
-+
-+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<XHelperInterface > m_xParent;
-+ uno::Reference<uno::XComponentContext > m_xContext;
-+ uno::Reference<container::XIndexAccess > m_xIndexAccess;
-+ uno::Reference<awt::XControl > 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< awt::XControl > xControl;
-+ m_xIndexAccess->getByIndex( nIndex++ ) >>= xControl;
-+
-+ uno::Reference<lang::XMultiComponentFactory > xServiceManager( m_xContext->getServiceManager(), uno::UNO_QUERY_THROW );
-+ uno::Reference< XControlProvider > xControlProvider( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.ControlProvider" ) ), m_xContext ), uno::UNO_QUERY_THROW );
-+
-+ uno::Reference< msforms::XControl > xVBAControl( xControlProvider->createUserformControl( xControl, m_xDlg, xModel ) );
-+ return uno::makeAny( xVBAControl );
-+ }
-+ throw container::NoSuchElementException();
-+ }
-+
-+};
-+
-+
-+uno::Reference<container::XIndexAccess >
-+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;
-+ uno::Reference<lang::XMultiComponentFactory > 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 > xVBAControl( xControlProvider->createUserformControl( xControl, mxDialog, xModel ) );
-+
-+ 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;
-+}
---- vbahelper/source/msforms/vbacontrols.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/msforms/vbacontrols.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -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$
-+ * $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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SC_VBA_CONTROLS_HXX
-+#define SC_VBA_CONTROLS_HXX
-+
-+#include <cppuhelper/implbase1.hxx>
-+#include <ooo/vba/msforms/XControls.hpp>
-+#include <com/sun/star/awt/XControl.hpp>
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+#include <vbahelper/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<rtl::OUString> 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
-+
---- vbahelper/source/msforms/vbaframe.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/msforms/vbaframe.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,93 @@
-+/*************************************************************************
-+ *
-+ * 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 <vector>
-+
-+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;
-+}
---- vbahelper/source/msforms/vbaframe.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/msforms/vbaframe.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,58 @@
-+/*************************************************************************
-+ *
-+ * 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 <cppuhelper/implbase1.hxx>
-+#include <ooo/vba/msforms/XLabel.hpp>
-+
-+#include "vbacontrol.hxx"
-+#include <vbahelper/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<rtl::OUString> getServiceNames();
-+};
-+#endif //SC_VBA_LABEL_HXX
---- vbahelper/source/msforms/vbaimage.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/msforms/vbaimage.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,59 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbaimage.hxx"
-+#include <vector>
-+
-+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;
-+}
---- vbahelper/source/msforms/vbaimage.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/msforms/vbaimage.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,48 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SC_VBA_IMAGE_HXX
-+#define SC_VBA_IMAGE_HXX
-+#include <cppuhelper/implbase1.hxx>
-+#include <ooo/vba/msforms/XImage.hpp>
-+
-+#include "vbacontrol.hxx"
-+#include <vbahelper/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<rtl::OUString> getServiceNames();
-+};
-+#endif //SC_VBA_IMAGE_HXX
---- vbahelper/source/msforms/vbalabel.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/msforms/vbalabel.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,88 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbalabel.hxx"
-+#include <vector>
-+
-+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;
-+}
---- vbahelper/source/msforms/vbalabel.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/msforms/vbalabel.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,56 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SC_VBA_LABEL_HXX
-+#define SC_VBA_LABEL_HXX
-+#include <cppuhelper/implbase1.hxx>
-+#include <ooo/vba/msforms/XLabel.hpp>
-+
-+#include "vbacontrol.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <cppuhelper/implbase2.hxx>
-+
-+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<rtl::OUString> getServiceNames();
-+ // XDefaultProperty
-+ rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
-+};
-+#endif //SC_VBA_LABEL_HXX
---- vbahelper/source/msforms/vbalistbox.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/msforms/vbalistbox.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,288 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include <com/sun/star/form/validation/XValidatableFormComponent.hpp>
-+
-+#include "vbalistbox.hxx"
-+#include <vector>
-+#include <comphelper/anytostring.hxx>
-+#include <com/sun/star/script/ArrayWrapper.hpp>
-+
-+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<sal_Int16>( 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<sal_Int16>( 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;
-+}
---- vbahelper/source/msforms/vbalistbox.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/msforms/vbalistbox.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,90 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SC_VBA_LISTBOX_HXX
-+#define SC_VBA_LISTBOX_HXX
-+#include <cppuhelper/implbase2.hxx>
-+#include <com/sun/star/uno/XComponentContext.hpp>
-+#include <com/sun/star/script/XDefaultProperty.hpp>
-+#include <ooo/vba/msforms/XListBox.hpp>
-+#include <com/sun/star/beans/PropertyAttribute.hpp>
-+
-+#include "vbacontrol.hxx"
-+#include <vbahelper/vbapropvalue.hxx>
-+#include "vbalistcontrolhelper.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+
-+typedef cppu::ImplInheritanceHelper2<ScVbaControl, ov::msforms::XListBox, css::script::XDefaultProperty > 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<rtl::OUString> getServiceNames();
-+
-+ //PropListener
-+ virtual void setValueEvent( const css::uno::Any& value );
-+ virtual css::uno::Any getValueEvent();
-+
-+
-+};
-+
-+#endif //
---- vbahelper/source/msforms/vbalistcontrolhelper.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/msforms/vbalistcontrolhelper.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,146 @@
-+#include <vbalistcontrolhelper.hxx>
-+#include <vector>
-+
-+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;
-+}
---- vbahelper/source/msforms/vbalistcontrolhelper.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/msforms/vbalistcontrolhelper.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,20 @@
-+#ifndef SC_VBA_LISTCONTROLHELPER
-+#define SC_VBA_LISTCONTROLHELPER
-+
-+#include <vbahelper/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
---- vbahelper/source/msforms/vbamultipage.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/msforms/vbamultipage.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,132 @@
-+/*************************************************************************
-+ *
-+ * 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 <ooo/vba/XCollection.hpp>
-+#include "vbapages.hxx"
-+#include <vector>
-+
-+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;
-+}
---- vbahelper/source/msforms/vbamultipage.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/msforms/vbamultipage.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,65 @@
-+/*************************************************************************
-+ *
-+ * 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 <cppuhelper/implbase1.hxx>
-+#include <ooo/vba/msforms/XMultiPage.hpp>
-+#include <com/sun/star/container/XIndexAccess.hpp>
-+
-+#include "vbacontrol.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+//#include <cppuhelper/implbase2.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+
-+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<rtl::OUString> getServiceNames();
-+ // XDefaultProperty
-+ rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
-+};
-+#endif //SC_VBA_LABEL_HXX
---- vbahelper/source/msforms/vbapages.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/msforms/vbapages.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,80 @@
-+/*************************************************************************
-+ *
-+ * 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;
-+
-+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;
-+}
---- vbahelper/source/msforms/vbapages.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/msforms/vbapages.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,64 @@
-+/*************************************************************************
-+ *
-+ * 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 <ooo/vba/office/MsoShapeType.hpp>
-+#include <com/sun/star/lang/XEventListener.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <ooo/vba/msforms/XPages.hpp>
-+#include <cppuhelper/implbase2.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+
-+#include <vbahelper/vbacollectionimpl.hxx>
-+typedef CollTestImplHelper<
-+ov::msforms::XPages > ScVbaPages_BASE;
-+
-+class ScVbaPages : public ScVbaPages_BASE
-+{
-+protected:
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> 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
---- vbahelper/source/msforms/vbaprogressbar.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/msforms/vbaprogressbar.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,78 @@
-+/*************************************************************************
-+ *
-+ * 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 <vector>
-+
-+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;
-+}
---- vbahelper/source/msforms/vbaprogressbar.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/msforms/vbaprogressbar.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,59 @@
-+/*************************************************************************
-+ *
-+ * 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 <cppuhelper/implbase1.hxx>
-+#include <ooo/vba/msforms/XProgressBar.hpp>
-+
-+#include "vbacontrol.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <cppuhelper/implbase2.hxx>
-+
-+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<rtl::OUString> getServiceNames();
-+ // XDefaultProperty
-+ rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
-+};
-+#endif //SC_VBA_LABEL_HXX
---- vbahelper/source/msforms/vbaradiobutton.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/msforms/vbaradiobutton.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,107 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbaradiobutton.hxx"
-+#include <vector>
-+
-+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;
-+}
---- vbahelper/source/msforms/vbaradiobutton.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/msforms/vbaradiobutton.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,55 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SC_VBA_RADIOBUTTON_HXX
-+#define SC_VBA_RADIOBUTTON_HXX
-+#include <ooo/vba/msforms/XRadioButton.hpp>
-+#include "vbacontrol.hxx"
-+#include <vbahelper/vbahelper.hxx>
-+#include <cppuhelper/implbase2.hxx>
-+
-+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<rtl::OUString> getServiceNames();
-+ // XDefaultProperty
-+ rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
-+
-+};
-+#endif //SC_VBA_RADIOBUTTON_HXX
---- vbahelper/source/msforms/vbascrollbar.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/msforms/vbascrollbar.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,139 @@
-+/*************************************************************************
-+ *
-+ * 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 <vector>
-+
-+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;
-+}
---- vbahelper/source/msforms/vbascrollbar.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/msforms/vbascrollbar.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,66 @@
-+/*************************************************************************
-+ *
-+ * 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 <cppuhelper/implbase1.hxx>
-+#include <ooo/vba/msforms/XScrollBar.hpp>
-+
-+#include "vbacontrol.hxx"
-+#include <vbahelper/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<rtl::OUString> getServiceNames();
-+};
-+#endif //SC_VBA_LABEL_HXX
---- vbahelper/source/msforms/vbaspinbutton.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/msforms/vbaspinbutton.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,109 @@
-+/*************************************************************************
-+ *
-+ * 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 <vector>
-+
-+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;
-+}
---- vbahelper/source/msforms/vbaspinbutton.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/msforms/vbaspinbutton.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,61 @@
-+/*************************************************************************
-+ *
-+ * 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 <cppuhelper/implbase1.hxx>
-+#include <ooo/vba/msforms/XSpinButton.hpp>
-+
-+#include "vbacontrol.hxx"
-+#include <vbahelper/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<rtl::OUString> getServiceNames();
-+};
-+#endif //SC_VBA_SPINBUTTON_HXX
---- vbahelper/source/msforms/vbatextbox.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/msforms/vbatextbox.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,137 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include <com/sun/star/text/XTextRange.hpp>
-+
-+#include "vbatextbox.hxx"
-+#include <vector>
-+
-+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;
-+}
---- vbahelper/source/msforms/vbatextbox.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/msforms/vbatextbox.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,57 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef SC_VBA_TEXTBOX_HXX
-+#define SC_VBA_TEXTBOX_HXX
-+#include <cppuhelper/implbase1.hxx>
-+#include <ooo/vba/msforms/XTextBox.hpp>
-+#include "vbacontrol.hxx"
-+#include <vbahelper/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<rtl::OUString> getServiceNames();
-+};
-+#endif //SC_VBA_TEXTBOX_HXX
---- vbahelper/source/msforms/vbatogglebutton.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/msforms/vbatogglebutton.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,108 @@
-+/*************************************************************************
-+ *
-+ * 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 <vector>
-+
-+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;
-+}
-+
---- vbahelper/source/msforms/vbatogglebutton.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/msforms/vbatogglebutton.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,63 @@
-+/*************************************************************************
-+ *
-+ * 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 <cppuhelper/implbase2.hxx>
-+#include <ooo/vba/msforms/XToggleButton.hpp>
-+
-+#include "vbacontrol.hxx"
-+#include <vbahelper/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<rtl::OUString> getServiceNames();
-+ // XDefaultProperty
-+ rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
-+};
-+#endif //SC_VBA_TOGGLEBUTTON_HXX
---- vbahelper/source/msforms/vbauserform.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/msforms/vbauserform.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,226 @@
-+/*************************************************************************
-+ *
-+ * 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 <vbahelper/helperdecl.hxx>
-+#include "vbauserform.hxx"
-+#include <com/sun/star/awt/XControl.hpp>
-+#include <com/sun/star/awt/XControlContainer.hpp>
-+#include <com/sun/star/beans/PropertyConcept.hpp>
-+#include <basic/sbx.hxx>
-+#include <basic/sbstar.hxx>
-+#include <basic/sbmeth.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) ), mbDispose( true )
-+{
-+ m_xDialog.set( m_xControl, uno::UNO_QUERY_THROW );
-+ uno::Reference< awt::XControl > xControl( m_xDialog, uno::UNO_QUERY_THROW );
-+ 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_<ScVbaUserForm, sdecl::with_args<true> > serviceImpl;
-+extern sdecl::ServiceDecl const serviceDecl(
-+ serviceImpl,
-+ "ScVbaUserForm",
-+ "ooo.vba.msforms.UserForm" );
-+}
-+
---- vbahelper/source/msforms/vbauserform.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/msforms/vbauserform.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,77 @@
-+/*************************************************************************
-+ *
-+ * 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 <cppuhelper/implbase1.hxx>
-+#include <ooo/vba/msforms/XUserForm.hpp>
-+#include <com/sun/star/awt/XDialog.hpp>
-+#include <com/sun/star/frame/XModel.hpp>
-+
-+#include <vbahelper/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;
-+ 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<rtl::OUString> getServiceNames();
-+};
-+#endif
---- vbahelper/source/vbahelper/makefile.mk.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/vbahelper/makefile.mk 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,66 @@
-+#*************************************************************************
-+#
-+# 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: makefile.mk,v $
-+#
-+# $Revision: 1.45 $
-+#
-+# 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
-+# <http://www.openoffice.org/license.html>
-+# for a copy of the LGPLv3 License.
-+#
-+#*************************************************************************
-+
-+PRJ=..$/../
-+PRJNAME=vbahelper
-+TARGET=vbahelper
-+
-+ENABLE_EXCEPTIONS := TRUE
-+
-+# --- Settings -----------------------------------------------------
-+
-+.INCLUDE : settings.mk
-+
-+SLOFILES=\
-+ $(SLO)$/vbahelper.obj \
-+ $(SLO)$/vbapropvalue.obj \
-+ $(SLO)$/vbacommandbars.obj \
-+ $(SLO)$/vbacommandbar.obj \
-+ $(SLO)$/vbacommandbarcontrols.obj \
-+ $(SLO)$/vbacommandbarcontrol.obj \
-+ $(SLO)$/vbaapplicationbase.obj \
-+ $(SLO)$/vbawindowbase.obj \
-+ $(SLO)$/vbadocumentbase.obj \
-+ $(SLO)$/vbaglobalbase.obj \
-+
-+# --- Targets -------------------------------------------------------
-+
-+.INCLUDE : target.mk
-+
-+ALLTAR : \
-+ $(MISC)$/$(TARGET).don \
-+
-+$(SLOFILES) : $(MISC)$/$(TARGET).don
-+
-+$(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb
-+ +$(CPPUMAKER) -O$(INCCOM)$/$(TARGET) -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@
-+ echo $@
-+
---- vbahelper/source/vbahelper/vbaapplicationbase.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/vbahelper/vbaapplicationbase.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,139 @@
-+/*************************************************************************
-+ *
-+ * 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 "vbahelper/vbaapplicationbase.hxx"
-+#include <com/sun/star/container/XIndexAccess.hpp>
-+#include <com/sun/star/frame/XLayoutManager.hpp>
-+
-+#include "vbacommandbars.hxx"
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+
-+VbaApplicationBase::VbaApplicationBase( const uno::Reference< css::uno::XComponentContext >& xContext )
-+ : ApplicationBase_BASE( uno::Reference< XHelperInterface >(), xContext )
-+{
-+}
-+
-+VbaApplicationBase::~VbaApplicationBase()
-+{
-+}
-+
-+sal_Bool SAL_CALL
-+VbaApplicationBase::getScreenUpdating() throw (uno::RuntimeException)
-+{
-+ uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
-+ return !xModel->hasControllersLocked();
-+}
-+
-+void SAL_CALL
-+VbaApplicationBase::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 SAL_CALL
-+VbaApplicationBase::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 SAL_CALL
-+VbaApplicationBase::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
-+VbaApplicationBase::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 );
-+}
-+
-+rtl::OUString&
-+VbaApplicationBase::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("VbaApplicationBase") );
-+ return sImplName;
-+}
-+uno::Sequence<rtl::OUString>
-+VbaApplicationBase::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.VbaApplicationBase" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-+
---- vbahelper/source/vbahelper/vbacommandbar.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/vbahelper/vbacommandbar.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,346 @@
-+/*************************************************************************
-+ *
-+ * 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 <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
-+#include <com/sun/star/frame/XFrame.hpp>
-+#include <com/sun/star/frame/XDesktop.hpp>
-+#include <com/sun/star/frame/XLayoutManager.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <com/sun/star/container/XNameContainer.hpp>
-+#include <ooo/vba/office/MsoBarType.hpp>
-+
-+#include "vbacommandbar.hxx"
-+#include "vbacommandbarcontrols.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 = m_pScVbaCommandBars->GetModuleName();
-+}
-+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 );
-+}
-+
-+sal_Int32 SAL_CALL
-+ScVbaCommandBar::Type() throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ // #FIXME support msoBarTypePopup
-+ sal_Int32 nType = office::MsoBarType::msoBarTypePopup;
-+ nType = m_bIsMenu? office::MsoBarType::msoBarTypeNormal : office::MsoBarType::msoBarTypeMenuBar;
-+ return nType;
-+}
-+
-+uno::Any SAL_CALL
-+ScVbaCommandBar::FindControl( const uno::Any& /*aType*/, const uno::Any& /*aId*/, const uno::Any& /*aTag*/, const uno::Any& /*aVisible*/, const uno::Any& /*aRecursive*/ ) throw (script::BasicErrorException, uno::RuntimeException)
-+{
-+ // alwayse fail to find control
-+ return uno::makeAny( uno::Reference< XCommandBarControl > () );
-+}
-+
-+rtl::OUString&
-+ScVbaCommandBar::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBar") );
-+ return sImplName;
-+}
-+uno::Sequence<rtl::OUString>
-+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;
-+}
---- vbahelper/source/vbahelper/vbacommandbar.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/vbahelper/vbacommandbar.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,107 @@
-+/*************************************************************************
-+ *
-+ * 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 <ooo/vba/XCommandBar.hpp>
-+#include <com/sun/star/ui/XUIConfigurationManager.hpp>
-+#include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
-+#include <com/sun/star/container/XIndexContainer.hpp>
-+#include <com/sun/star/beans/PropertyValues.hpp>
-+
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include "vbacommandbars.hxx"
-+
-+#include <map>
-+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);
-+ virtual sal_Int32 SAL_CALL Type( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-+ virtual css::uno::Any SAL_CALL FindControl( const css::uno::Any& aType, const css::uno::Any& aId, const css::uno::Any& aTag, const css::uno::Any& aVisible, const css::uno::Any& aRecursive ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-+
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+#endif//SC_VBA_COMMANDBAR_HXX
---- vbahelper/source/vbahelper/vbacommandbarcontrol.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/vbahelper/vbacommandbarcontrol.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,453 @@
-+/*************************************************************************
-+ *
-+ * 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"
-+#include <basic/sbstar.hxx>
-+#include <basic/sbmod.hxx>
-+#include <basic/sbmeth.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, sal_Int32 nPosition, sal_Int32 nType ) throw (uno::RuntimeException) : CommandBarControl_BASE( xParent, xContext ), m_sName( sName ), m_nPosition( nPosition ), m_nType( nType )
-+{
-+ // 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 );
-+ }
-+ }
-+ 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, sal_Int32 nPosition, sal_Bool bTemporary, sal_Int32 nType) throw (uno::RuntimeException) : CommandBarControl_BASE( xParent, xContext ), m_nPosition( nPosition ), m_bTemporary( bTemporary ), m_nType( nType )
-+{
-+ m_xParentHardRef.set( xParent, uno::UNO_QUERY_THROW );
-+ initObjects();
-+ if( sName.getLength() > 0 )
-+ {
-+ m_sName = sName;
-+ }
-+ 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" );
-+}
-+
-+void
-+ScVbaCommandBarControl::createNewMenuBarControl()
-+{
-+ uno::Reference< lang::XSingleComponentFactory > xMenuMSF( m_xBarSettings, uno::UNO_QUERY_THROW );
-+
-+ uno::Sequence< beans::PropertyValue > aPropertys;
-+ if( m_nType == office::MsoControlType::msoControlPopup )
-+ aPropertys = uno::Sequence< beans::PropertyValue >( 4 );
-+ else
-+ aPropertys = uno::Sequence< beans::PropertyValue >( 3 );
-+
-+ 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 <<= sal_Int32(0);
-+
-+ if( m_nType == office::MsoControlType::msoControlPopup )
-+ {
-+ aPropertys[3].Name = rtl::OUString::createFromAscii("ItemDescriptorContainer");
-+ aPropertys[3].Value <<= xMenuMSF->createInstanceWithContext( mxContext );
-+ }
-+
-+ 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
-+ 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( aPropertys ) );
-+ }
-+ 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 <<= sal_Int32(0);
-+ 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() )
-+ {
-+ // convert the comand url into something like vnd.sun.star.script:Standard.testMacro.Macro1?language=Basic&location=document
-+ rtl::OUString aCommandURL;
-+ rtl::OUString sScheme = rtl::OUString::createFromAscii( "vnd.sun.star.script:");
-+ SbModule* pModule = StarBASIC::GetActiveModule();
-+ if( pModule )
-+ {
-+ String sTmp = _onaction;
-+ if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pModule->Find( sTmp, SbxCLASS_METHOD ) ) )
-+ {
-+ if( pMethod )
-+ {
-+ sTmp.Insert( '.', 0 ).Insert( pModule->GetName(), 0 ).Insert( '.', 0 ).Insert( pModule->GetParent()->GetName(), 0 );
-+ }
-+ }
-+
-+ rtl::OUString sUrlPart2 = rtl::OUString::createFromAscii( "?language=Basic&location=document");
-+ aCommandURL = sScheme.concat( sTmp ).concat( sUrlPart2 );
-+ OSL_TRACE("**** METHOD IS %s", rtl::OUStringToOString( aCommandURL, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ }
-+ else
-+ {
-+ aCommandURL = _onaction;
-+ }
-+ OSL_TRACE(" ScVbaCommandBarControl::setOnAction: %s", rtl::OUStringToOString( aCommandURL, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ beans::PropertyValues aPropertyValues;
-+ m_xCurrentSettings->getByIndex( m_nPosition ) >>= aPropertyValues;
-+ beans::PropertyValues aNewPropertyValues;
-+ aNewPropertyValues = lcl_repalcePropertyValue( aPropertyValues, rtl::OUString::createFromAscii("CommandURL"), uno::makeAny( aCommandURL ) );
-+ 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<rtl::OUString>
-+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;
-+}
-+
-+//////////// ScVbaCommandBarPopup //////////////////////////////
-+ScVbaCommandBarPopup::ScVbaCommandBarPopup( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition ) throw (uno::RuntimeException) : CommandBarPopup_BASE( xParent, xContext, sName, nPosition, office::MsoControlType::msoControlPopup )
-+{
-+}
-+
-+ScVbaCommandBarPopup::ScVbaCommandBarPopup( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition, sal_Bool bTemporary ) throw (uno::RuntimeException) : CommandBarPopup_BASE( xParent, xContext, sName, nPosition, bTemporary, office::MsoControlType::msoControlPopup)
-+{
-+}
-+
-+rtl::OUString&
-+ScVbaCommandBarPopup::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBarPopup") );
-+ return sImplName;
-+}
-+uno::Sequence<rtl::OUString>
-+ScVbaCommandBarPopup::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.CommandBarPopup" ) );
-+ }
-+ return aServiceNames;
-+}
-+
-+//////////// ScVbaCommandBarButton //////////////////////////////
-+ScVbaCommandBarButton::ScVbaCommandBarButton( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition ) throw (uno::RuntimeException) : CommandBarButton_BASE( xParent, xContext, sName, nPosition, office::MsoControlType::msoControlButton )
-+{
-+}
-+
-+ScVbaCommandBarButton::ScVbaCommandBarButton( const uno::Reference< XHelperInterface > xParent, const uno::Reference< uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition, sal_Bool bTemporary ) throw (uno::RuntimeException) : CommandBarButton_BASE( xParent, xContext, sName, nPosition, bTemporary, office::MsoControlType::msoControlButton)
-+{
-+}
-+
-+rtl::OUString&
-+ScVbaCommandBarButton::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBarButton") );
-+ return sImplName;
-+}
-+uno::Sequence<rtl::OUString>
-+ScVbaCommandBarButton::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.CommandBarButton" ) );
-+ }
-+ return aServiceNames;
-+}
---- vbahelper/source/vbahelper/vbacommandbarcontrol.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/vbahelper/vbacommandbarcontrol.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,120 @@
-+/*************************************************************************
-+ *
-+ * 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 <ooo/vba/XCommandBarControl.hpp>
-+#include <ooo/vba/XCommandBarPopup.hpp>
-+#include <ooo/vba/XCommandBarButton.hpp>
-+#include <ooo/vba/office/MsoControlType.hpp>
-+
-+#include <vbahelper/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, sal_Int32 nPosition = 0, sal_Int32 nType = ov::office::MsoControlType::msoControlButton ) throw (css::uno::RuntimeException);
-+ ScVbaCommandBarControl( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition, sal_Bool bTemporary, sal_Int32 nType = ov::office::MsoControlType::msoControlButton ) 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; };
-+ 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<rtl::OUString> getServiceNames();
-+};
-+
-+typedef cppu::ImplInheritanceHelper1< ScVbaCommandBarControl, ov::XCommandBarPopup > CommandBarPopup_BASE;
-+class ScVbaCommandBarPopup : public CommandBarPopup_BASE
-+{
-+public:
-+ ScVbaCommandBarPopup( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition = 0 ) throw (css::uno::RuntimeException);
-+ ScVbaCommandBarPopup( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition, sal_Bool bTemporary ) throw (css::uno::RuntimeException);
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+typedef cppu::ImplInheritanceHelper1< ScVbaCommandBarControl, ov::XCommandBarButton > CommandBarButton_BASE;
-+class ScVbaCommandBarButton : public CommandBarButton_BASE
-+{
-+public:
-+ ScVbaCommandBarButton( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition = 0 ) throw (css::uno::RuntimeException);
-+ ScVbaCommandBarButton( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, rtl::OUString sName, sal_Int32 nPosition, sal_Bool bTemporary ) throw (css::uno::RuntimeException);
-+ // XHelperInterface
-+ virtual rtl::OUString& getServiceImplName();
-+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-+};
-+
-+#endif//SC_VBA_COMMANDBARCONTROL_HXX
---- vbahelper/source/vbahelper/vbacommandbarcontrols.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/vbahelper/vbacommandbarcontrols.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,348 @@
-+/*************************************************************************
-+ *
-+ * 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;
-+
-+uno::Any lcl_getPropertyValue( beans::PropertyValues aPropertyValues, rtl::OUString sPropertyName );
-+
-+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 )
-+ {
-+ m_xUICfgManager.set( m_pCommandBarControl->GetUICfgManager(), uno::UNO_QUERY_THROW );
-+ m_xUICfgPers.set( m_pCommandBarControl->GetUICfgPers(), uno::UNO_QUERY_THROW );
-+ beans::PropertyValues aPropertyValues;
-+ m_pCommandBarControl->GetCurrentSettings()->getByIndex( m_pCommandBarControl->GetPosition() ) >>= aPropertyValues;
-+ m_pCommandBarControl->SetPropertyValues( aPropertyValues );
-+ m_xBarSettings.set( m_pCommandBarControl->GetCurrentSettings(), uno::UNO_QUERY_THROW );
-+
-+ uno::Any aValue = lcl_getPropertyValue( m_pCommandBarControl->GetPropertyValues(), rtl::OUString::createFromAscii("ItemDescriptorContainer") );
-+ if( aValue.hasValue() )
-+ {
-+ m_xCurrentSettings = m_pCommandBarControl->GetCurrentSettings();
-+ m_bHasElements = sal_True;
-+ }
-+ else
-+ {
-+ m_bHasElements = sal_False;
-+ }
-+ m_bIsMenu = m_pCommandBarControl->IsMenu();
-+ }
-+ 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 )
-+ {
-+ uno::Reference< container::XIndexContainer > xCurrentSettings;
-+ beans::PropertyValues aPropertyValues;
-+ if( m_pCommandBarControl )
-+ {
-+ m_pCommandBarControl->GetCurrentSettings()->getByIndex( m_pCommandBarControl->GetPosition() ) >>= aPropertyValues;
-+ xCurrentSettings.set( lcl_getPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( "ItemDescriptorContainer" ) ), uno::UNO_QUERY );
-+ if( !xCurrentSettings.is() )
-+ {
-+ xCurrentSettings.set( m_xUICfgManager->getSettings( GetParentToolBarName(), sal_True ), uno::UNO_QUERY );
-+ }
-+ }
-+
-+ sal_Int32 nPosition = -1;
-+ for( sal_Int32 i = 0; i < xCurrentSettings->getCount(); i++ )
-+ {
-+ xCurrentSettings->getByIndex( i ) >>= aPropertyValues;
-+ // Label always empty in OOo
-+ rtl::OUString sLabel;
-+ lcl_getPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( "Label" ) ) >>= sLabel;
-+ if( sLabel.equalsIgnoreAsciiCase( sName ) )
-+ {
-+ nPosition = i;
-+ break;
-+ }
-+ // using CammandURL to find
-+ rtl::OUString sCommandURL;
-+ lcl_getPropertyValue( aPropertyValues, 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 ) )
-+ {
-+ nPosition = i;
-+ break;
-+ }
-+ }
-+
-+ if( nPosition != -1 )
-+ {
-+ uno::Reference< container::XIndexContainer > xSubMenu;
-+ lcl_getPropertyValue( aPropertyValues, rtl::OUString::createFromAscii( "ItemDescriptorContainer" ) ) >>= xSubMenu;
-+ ScVbaCommandBarControl* pNewCommandBarControl = NULL;
-+ if( xSubMenu.is() )
-+ pNewCommandBarControl = new ScVbaCommandBarPopup( this, mxContext, sName, nPosition );
-+ else
-+ pNewCommandBarControl = new ScVbaCommandBarButton( this, mxContext, sName, nPosition );
-+
-+ return uno::makeAny( uno::Reference< XCommandBarControl > ( pNewCommandBarControl ) );
-+ }
-+ else
-+ throw uno::RuntimeException( rtl::OUString::createFromAscii("The CommandBarControl do not exist"), uno::Reference< uno::XInterface >() );
-+
-+ }
-+ 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() )
-+ Before >>= nPosition;
-+ else
-+ {
-+ // if Before is ignore, the new control should be placed at the end of the commandbars;
-+ if( m_pCommandBar )
-+ nPosition = getCount();
-+ else if ( m_pCommandBarControl )
-+ {
-+ css::uno::Reference< css::container::XIndexContainer > xCurrentSettings;
-+ xCurrentSettings.set( lcl_getPropertyValue( m_pCommandBarControl->GetPropertyValues(), rtl::OUString::createFromAscii("ItemDescriptorContainer") ), uno::UNO_QUERY );
-+ if( xCurrentSettings.is() )
-+ {
-+ nPosition = xCurrentSettings->getCount();
-+ }
-+ }
-+ }
-+ if( Temporary.hasValue() )
-+ if( Temporary >>= bTemporary )
-+ {
-+ // evalute the temporary of the new Control
-+ }
-+
-+ ScVbaCommandBarControl* pNewCommandBarControl = NULL;
-+ if( nType == office::MsoControlType::msoControlButton )
-+ {
-+ pNewCommandBarControl = new ScVbaCommandBarButton( this, mxContext, sCaption, nPosition, bTemporary );
-+ }
-+ else if ( nType == office::MsoControlType::msoControlPopup )
-+ {
-+ pNewCommandBarControl = new ScVbaCommandBarPopup( this, mxContext, sCaption, nPosition, bTemporary );
-+ }
-+ else
-+ {
-+ pNewCommandBarControl = new ScVbaCommandBarControl( this, mxContext, sCaption, nPosition, bTemporary );
-+ }
-+
-+ return uno::Reference< XCommandBarControl >( pNewCommandBarControl );
-+}
-+
-+// XHelperInterface
-+rtl::OUString&
-+ScVbaCommandBarControls::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaCommandBarControls") );
-+ return sImplName;
-+}
-+uno::Sequence<rtl::OUString>
-+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;
-+}
-+
---- vbahelper/source/vbahelper/vbacommandbarcontrols.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/vbahelper/vbacommandbarcontrols.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,91 @@
-+/*************************************************************************
-+ *
-+ * 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 <ooo/vba/XCommandBarControls.hpp>
-+
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include "vbacommandbar.hxx"
-+#include <vbahelper/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;
-+ css::uno::Reference< css::container::XIndexContainer > m_xCurrentSettings;
-+
-+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<rtl::OUString> getServiceNames();
-+};
-+
-+#endif//SC_VBA_COMMANDBARCONTROLS_HXX
---- vbahelper/source/vbahelper/vbacommandbars.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/vbahelper/vbacommandbars.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,261 @@
-+/*************************************************************************
-+ *
-+ * 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 <com/sun/star/lang/XServiceInfo.hpp>
-+#include <com/sun/star/frame/XDesktop.hpp>
-+#include <com/sun/star/container/XNameAccess.hpp>
-+
-+#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 );
-+ }
-+
-+ // hardcode if "aIndex = 1" that would return "main menu".
-+ sal_Int16 nIndex = 0;
-+ aIndex >>= nIndex;
-+ if( nIndex == 1 )
-+ {
-+ uno::Any aSource;
-+ if( m_sModuleName.equalsIgnoreAsciiCase( sSpreadsheetDocumentUrl ) )
-+ aSource <<= rtl::OUString::createFromAscii( "Worksheet Menu Bar" );
-+ else if( m_sModuleName.equalsIgnoreAsciiCase( sTextDocumentUrl ) )
-+ aSource <<= rtl::OUString::createFromAscii( "Menu Bar" );
-+ if( aSource.hasValue() )
-+ return createCollectionObject( aSource );
-+ }
-+ 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<rtl::OUString>
-+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;
-+}
-+
---- vbahelper/source/vbahelper/vbacommandbars.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/vbahelper/vbacommandbars.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,79 @@
-+/*************************************************************************
-+ *
-+ * 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 <ooo/vba/XCommandBar.hpp>
-+#include <ooo/vba/XCommandBars.hpp>
-+#include <com/sun/star/container/XNameAccess.hpp>
-+
-+#include <cppuhelper/implbase1.hxx>
-+
-+#include <vbahelper/vbahelperinterface.hxx>
-+#include <vbahelper/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<rtl::OUString> getServiceNames();
-+};
-+
-+#endif//SC_VBA_COMMANDBARS_HXX
---- vbahelper/source/vbahelper/vbadocumentbase.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/vbahelper/vbadocumentbase.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,223 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include <vbahelper/vbadocumentbase.hxx>
-+#include <vbahelper/helperdecl.hxx>
-+#include <comphelper/unwrapargs.hxx>
-+
-+#include <com/sun/star/util/XModifiable.hpp>
-+#include <com/sun/star/util/XProtectable.hpp>
-+#include <com/sun/star/util/XCloseable.hpp>
-+#include <com/sun/star/frame/XStorable.hpp>
-+#include <com/sun/star/frame/XFrame.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+
-+#include <tools/urlobj.hxx>
-+#include <osl/file.hxx>
-+
-+using namespace ::com::sun::star;
-+using namespace ::ooo::vba;
-+
-+VbaDocumentBase::VbaDocumentBase( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext) :VbaDocumentBase_BASE( xParent, xContext ), mxModel(NULL)
-+{
-+}
-+
-+VbaDocumentBase::VbaDocumentBase( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, uno::Reference< frame::XModel > xModel ) : VbaDocumentBase_BASE( xParent, xContext ), mxModel( xModel )
-+{
-+}
-+
-+VbaDocumentBase::VbaDocumentBase( uno::Sequence< uno::Any> const & args,
-+ uno::Reference< uno::XComponentContext> const & xContext ) : VbaDocumentBase_BASE( getXSomethingFromArgs< XHelperInterface >( args, 0 ), xContext ), mxModel( getXSomethingFromArgs< frame::XModel >( args, 1 ) )
-+{
-+}
-+
-+::rtl::OUString
-+VbaDocumentBase::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
-+VbaDocumentBase::getPath() throw (uno::RuntimeException)
-+{
-+ INetURLObject aURL( getModel()->getURL() );
-+ aURL.CutLastName();
-+ return aURL.GetURLPath();
-+}
-+
-+::rtl::OUString
-+VbaDocumentBase::getFullName() throw (uno::RuntimeException)
-+{
-+ INetURLObject aURL( getModel()->getURL() );
-+ return aURL.GetURLPath();
-+}
-+void
-+VbaDocumentBase::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg,
-+ const uno::Any &rRouteArg ) 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
-+VbaDocumentBase::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
-+VbaDocumentBase::Unprotect( const uno::Any &aPassword ) throw (uno::RuntimeException)
-+{
-+ rtl::OUString rPassword;
-+ uno::Reference< util::XProtectable > xProt( getModel(), uno::UNO_QUERY_THROW );
-+ if( !xProt->isProtected() )
-+ 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() );
-+ }
-+}
-+
-+void
-+VbaDocumentBase::setSaved( sal_Bool bSave ) throw (uno::RuntimeException)
-+{
-+ uno::Reference< util::XModifiable > xModifiable( getModel(), uno::UNO_QUERY_THROW );
-+ xModifiable->setModified( bSave );
-+}
-+
-+sal_Bool
-+VbaDocumentBase::getSaved() throw (uno::RuntimeException)
-+{
-+ uno::Reference< util::XModifiable > xModifiable( getModel(), uno::UNO_QUERY_THROW );
-+ return xModifiable->isModified();
-+}
-+
-+void
-+VbaDocumentBase::Save() throw (uno::RuntimeException)
-+{
-+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".uno:Save"));
-+ uno::Reference< frame::XModel > xModel = getModel();
-+ dispatchRequests(xModel,url);
-+}
-+
-+void
-+VbaDocumentBase::Activate() throw (uno::RuntimeException)
-+{
-+ uno::Reference< frame::XFrame > xFrame( getModel()->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW );
-+ xFrame->activate();
-+}
-+
-+rtl::OUString&
-+VbaDocumentBase::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("VbaDocumentBase") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+VbaDocumentBase::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.VbaDocumentBase" ) );
-+ }
-+ return aServiceNames;
-+}
-+
---- vbahelper/source/vbahelper/vbaglobalbase.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/vbahelper/vbaglobalbase.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,113 @@
-+/*************************************************************************
-+ *
-+ * 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 "vbahelper/vbaglobalbase.hxx"
-+
-+#include <cppuhelper/component_context.hxx>
-+#include <comphelper/processfactory.hxx>
-+#include <com/sun/star/container/XNameContainer.hpp>
-+
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+
-+VbaGlobalsBase::VbaGlobalsBase(
-+const uno::Reference< ov::XHelperInterface >& xParent,
-+const uno::Reference< uno::XComponentContext >& xContext)
-+: Globals_BASE( xParent, xContext )
-+{
-+ // overwrite context with custom one ( that contains the application )
-+ ::cppu::ContextEntry_Init aHandlerContextInfo[] =
-+ {
-+ ::cppu::ContextEntry_Init( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Application" ) ), uno::Any() )
-+ };
-+
-+ mxContext = ::cppu::createComponentContext( aHandlerContextInfo, sizeof( aHandlerContextInfo ) / sizeof( aHandlerContextInfo[0] ), xContext );
-+
-+}
-+
-+void
-+VbaGlobalsBase::init( uno::Reference< uno::XComponentContext >const& rxContext, const uno::Any& aApplication )
-+{
-+ uno::Reference< container::XNameContainer > xNameContainer( mxContext, uno::UNO_QUERY_THROW );
-+ xNameContainer->replaceByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Application") ), aApplication );
-+ uno::Reference< XHelperInterface > xParent( aApplication, uno::UNO_QUERY );
-+ mxParent = xParent;
-+}
-+
-+uno::Reference< uno::XInterface > SAL_CALL
-+VbaGlobalsBase::createInstance( const ::rtl::OUString& aServiceSpecifier ) throw (uno::Exception, uno::RuntimeException)
-+{
-+ uno::Reference< uno::XInterface > xReturn;
-+
-+ if ( hasServiceName( aServiceSpecifier ) )
-+ xReturn = mxContext->getServiceManager()->createInstanceWithContext( aServiceSpecifier, mxContext );
-+ return xReturn;
-+}
-+
-+uno::Reference< uno::XInterface > SAL_CALL
-+VbaGlobalsBase::createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const uno::Sequence< uno::Any >& Arguments ) throw (uno::Exception, uno::RuntimeException)
-+{
-+
-+ uno::Reference< uno::XInterface > xReturn;
-+
-+ if ( hasServiceName( ServiceSpecifier ) )
-+ xReturn = mxContext->getServiceManager()->createInstanceWithArgumentsAndContext( ServiceSpecifier, Arguments, mxContext );
-+ return xReturn;
-+}
-+
-+uno::Sequence< ::rtl::OUString > SAL_CALL
-+VbaGlobalsBase::getAvailableServiceNames( ) throw (uno::RuntimeException)
-+{
-+ static const rtl::OUString names[] = {
-+ // common
-+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "ooo.vba.msforms.UserForm" ) ),
-+ };
-+ static uno::Sequence< rtl::OUString > serviceNames( names, sizeof( names )/ sizeof( names[0] ) );
-+ return serviceNames;
-+}
-+
-+bool
-+VbaGlobalsBase::hasServiceName( const rtl::OUString& serviceName )
-+{
-+ uno::Sequence< rtl::OUString > sServiceNames( getAvailableServiceNames() );
-+ sal_Int32 nLen = sServiceNames.getLength();
-+ for ( sal_Int32 index = 0; index < nLen; ++index )
-+ {
-+ if ( sServiceNames[ index ].equals( serviceName ) )
-+ return true;
-+ }
-+ return false;
-+}
-+
-+
---- vbahelper/source/vbahelper/vbahelper.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/vbahelper/vbahelper.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,1170 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include <cppuhelper/bootstrap.hxx>
-+#include <com/sun/star/util/XURLTransformer.hpp>
-+#include <com/sun/star/frame/XDispatchProvider.hpp>
-+#include <com/sun/star/frame/XModel.hpp>
-+#include <com/sun/star/frame/XFrame.hpp>
-+#include <com/sun/star/frame/XDesktop.hpp>
-+#include <com/sun/star/frame/XController.hpp>
-+#include <com/sun/star/uno/XComponentContext.hpp>
-+#include <com/sun/star/lang/XMultiComponentFactory.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <com/sun/star/beans/XIntrospection.hpp>
-+#include <ooo/vba/msforms/XShape.hpp>
-+
-+#include <comphelper/processfactory.hxx>
-+
-+#include <sfx2/objsh.hxx>
-+#include <sfx2/viewfrm.hxx>
-+#include <sfx2/dispatch.hxx>
-+#include <sfx2/app.hxx>
-+#include <svl/stritem.hxx>
-+#include <svl/eitem.hxx>
-+#include <svl/intitem.hxx>
-+#include <svl/itemset.hxx>
-+//#include <svtools/itempool.hxx>
-+#include <sfx2/docfac.hxx>
-+#include <sfx2/viewfac.hxx>
-+
-+#include <basic/sbx.hxx>
-+#include <basic/sbstar.hxx>
-+#include <basic/basmgr.hxx>
-+#include <basic/sbmod.hxx>
-+#include <basic/sbmeth.hxx>
-+#include <rtl/math.hxx>
-+#include <sfx2/viewsh.hxx>
-+#include <math.h>
-+#include <tools/urlobj.hxx>
-+#include <osl/file.hxx>
-+#include <toolkit/awt/vclxwindow.hxx>
-+#include <toolkit/helper/vclunohelper.hxx>
-+#include <com/sun/star/frame/XModel2.hpp>
-+#include <vcl/window.hxx>
-+#include <vcl/syswin.hxx>
-+#include <tools/diagnose_ex.h>
-+
-+#ifndef OOVBA_DLLIMPLEMENTATION
-+#define OOVBA_DLLIMPLEMENTATION
-+#endif
-+
-+#include <vbahelper/vbahelper.hxx>
-+#include <sfx2/app.hxx>
-+// #FIXME needs service
-+//#include "vbashape.hxx"
-+//#include "unonames.hxx"
-+
-+using namespace ::com::sun::star;
-+using namespace ::ooo::vba;
-+
-+#define NAME_HEIGHT "Height"
-+#define NAME_WIDTH "Width"
-+
-+#define POINTTO100THMILLIMETERFACTOR 35.27778
-+
-+void unoToSbxValue( SbxVariable* pVar, const uno::Any& aValue );
-+
-+uno::Any sbxToUnoValue( SbxVariable* pVar );
-+
-+
-+namespace ooo
-+{
-+namespace vba
-+{
-+
-+uno::Reference< lang::XMultiServiceFactory > getVBAServiceFactory( SfxObjectShell* pShell )
-+{
-+ uno::Any aUnoVar;
-+ if ( !pShell || ! pShell->GetBasicManager()->GetGlobalUNOConstant( "VBAGlobals", aUnoVar ) )
-+ throw lang::IllegalArgumentException();
-+ uno::Reference< lang::XMultiServiceFactory > xVBAFactory( aUnoVar, uno::UNO_QUERY_THROW );
-+ return xVBAFactory;
-+}
-+
-+css::uno::Reference< css::uno::XInterface > createVBAUnoAPIService( SfxObjectShell* pShell, const sal_Char* _pAsciiName ) throw (css::uno::RuntimeException)
-+{
-+ OSL_PRECOND( pShell, "createVBAUnoAPIService: no shell!" );
-+ ::rtl::OUString sVarName( ::rtl::OUString::createFromAscii( _pAsciiName ) );
-+ return getVBAServiceFactory( pShell )->createInstance( sVarName );
-+}
-+
-+css::uno::Reference< css::uno::XInterface > createVBAUnoAPIServiceWithArgs( SfxObjectShell* pShell, const sal_Char* _pAsciiName, const uno::Sequence< uno::Any >& aArgs ) throw ( css::uno::RuntimeException )
-+{
-+ OSL_PRECOND( pShell, "createVBAUnoAPIService: no shell!" );
-+ ::rtl::OUString sVarName( ::rtl::OUString::createFromAscii( _pAsciiName ) );
-+ uno::Reference< uno::XInterface > xIf = getVBAServiceFactory( pShell )->createInstanceWithArguments( sVarName, aArgs );
-+ return xIf;
-+}
-+// helper method to determine if the view ( calc ) is in print-preview mode
-+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;
-+}
-+#if 0
-+namespace excel // all in this namespace probably can be moved to sc
-+{
-+
-+
-+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<uno::XComponentContext > xContext( xTmpProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
-+ static uno::Reference<lang::XMultiComponentFactory > 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()
-+{
-+ PasteCellsWarningReseter resetWarningBox;
-+ ScTabViewShell* pViewShell = getCurrentBestViewShell();
-+ if ( pViewShell )
-+ {
-+ pViewShell->PasteFromSystem();
-+ pViewShell->CellContentChanged();
-+ }
-+}
-+
-+
-+void
-+implnCopy()
-+{
-+ ScTabViewShell* pViewShell = getCurrentBestViewShell();
-+ if ( pViewShell )
-+ pViewShell->CopyToClip(NULL,false,false,true);
-+}
-+
-+void
-+implnCut()
-+{
-+ ScTabViewShell* pViewShell = getCurrentBestViewShell();
-+ if ( pViewShell )
-+ pViewShell->CutToClip( NULL, TRUE );
-+}
-+void implnPasteSpecial(SfxViewShell* pViewShell, USHORT nFlags,USHORT nFunction,sal_Bool bSkipEmpty, sal_Bool bTranspose)
-+{
-+ PasteCellsWarningReseter resetWarningBox;
-+ sal_Bool bAsLink(sal_False), bOtherDoc(sal_False);
-+ InsCellCmd eMoveMode = INS_NONE;
-+
-+ if ( !pTabViewShell )
-+ // none active, try next best
-+ pTabViewShell = getCurrentBestViewShell();
-+ 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( 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( css::uno::Reference< css::frame::XModel>& xModel )
-+{
-+ ScDocShell* pDocShell = getDocShell( xModel );
-+ if ( pDocShell )
-+ return pDocShell->GetBestViewShell();
-+ return NULL;
-+}
-+
-+ScTabViewShell*
-+getCurrentBestViewShell()
-+{
-+ uno::Reference< frame::XModel > xModel = getCurrentDocument();
-+ return getBestViewShell( xModel );
-+}
-+
-+SfxViewFrame*
-+getCurrentViewFrame()
-+{
-+ ScTabViewShell* pViewShell = getCurrentBestViewShell();
-+ if ( pViewShell )
-+ return pViewShell->GetViewFrame();
-+ return NULL;
-+}
-+};
-+
-+#endif
-+const double Millimeter::factor = 35.27778;
-+
-+uno::Reference< beans::XIntrospectionAccess >
-+getIntrospectionAccess( const uno::Any& aObject ) throw (uno::RuntimeException)
-+{
-+ static uno::Reference< beans::XIntrospection > xIntrospection;
-+ if( !xIntrospection.is() )
-+ {
-+ uno::Reference< lang::XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+ xIntrospection.set( xFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.beans.Introspection") ), uno::UNO_QUERY_THROW );
-+ }
-+ return xIntrospection->inspect( aObject );
-+}
-+
-+uno::Reference< script::XTypeConverter >
-+getTypeConverter( const uno::Reference< uno::XComponentContext >& xContext ) throw (uno::RuntimeException)
-+{
-+ static uno::Reference< script::XTypeConverter > xTypeConv( xContext->getServiceManager()->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter") ), xContext ), uno::UNO_QUERY_THROW );
-+ return xTypeConv;
-+}
-+const uno::Any&
-+aNULL()
-+{
-+ static uno::Any aNULLL = uno::makeAny( uno::Reference< uno::XInterface >() );
-+ return aNULLL;
-+}
-+
-+void dispatchExecute(SfxViewShell* pViewShell, USHORT nSlot, SfxCallMode nCall)
-+{
-+ SfxViewFrame* pViewFrame = NULL;
-+ if ( pViewShell )
-+ pViewFrame = pViewShell->GetViewFrame();
-+ if ( pViewFrame )
-+ {
-+ SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
-+ if( pDispatcher )
-+ {
-+ pDispatcher->Execute( nSlot , nCall );
-+ }
-+ }
-+}
-+
-+void
-+dispatchRequests (uno::Reference< frame::XModel>& xModel,rtl::OUString & aUrl, uno::Sequence< beans::PropertyValue >& sProps )
-+{
-+
-+ util::URL url ;
-+ url.Complete = aUrl;
-+ rtl::OUString emptyString = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "" ));
-+ uno::Reference<frame::XController> xController = xModel->getCurrentController();
-+ uno::Reference<frame::XFrame> xFrame = xController->getFrame();
-+ uno::Reference<frame::XDispatchProvider> xDispatchProvider (xFrame,uno::UNO_QUERY_THROW);
-+ try
-+ {
-+ uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+ uno::Reference<uno::XComponentContext > xContext( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
-+ if ( !xContext.is() )
-+ {
-+ return ;
-+ }
-+
-+ uno::Reference<lang::XMultiComponentFactory > xServiceManager(
-+ xContext->getServiceManager() );
-+ if ( !xServiceManager.is() )
-+ {
-+ return ;
-+ }
-+ uno::Reference<util::XURLTransformer> xParser( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ) )
-+ ,xContext), uno::UNO_QUERY_THROW );
-+ if (!xParser.is())
-+ return;
-+ xParser->parseStrict (url);
-+ }
-+ catch ( uno::Exception & /*e*/ )
-+ {
-+ return ;
-+ }
-+
-+ uno::Reference<frame::XDispatch> xDispatcher = xDispatchProvider->queryDispatch(url,emptyString,0);
-+
-+ uno::Sequence<beans::PropertyValue> dispatchProps(1);
-+
-+ sal_Int32 nProps = sProps.getLength();
-+ beans::PropertyValue* pDest = dispatchProps.getArray();
-+ if ( nProps )
-+ {
-+ dispatchProps.realloc( nProps + 1 );
-+ // need to reaccquire pDest after realloc
-+ pDest = dispatchProps.getArray();
-+ beans::PropertyValue* pSrc = sProps.getArray();
-+ for ( sal_Int32 index=0; index<nProps; ++index, ++pSrc, ++pDest )
-+ *pDest = *pSrc;
-+ }
-+
-+ (*pDest).Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Silent" ));
-+ (*pDest).Value <<= (sal_Bool)sal_True;
-+
-+ if (xDispatcher.is())
-+ xDispatcher->dispatch( url, dispatchProps );
-+}
-+
-+void
-+dispatchRequests (uno::Reference< frame::XModel>& xModel,rtl::OUString & aUrl)
-+{
-+ uno::Sequence<beans::PropertyValue> dispatchProps;
-+ dispatchRequests( xModel, aUrl, dispatchProps );
-+}
-+
-+
-+
-+ uno::Reference< frame::XModel >
-+getCurrentDocument() throw (uno::RuntimeException)
-+{
-+ uno::Reference< frame::XModel > xModel;
-+ SbxObject* pBasic = dynamic_cast< SbxObject* > ( SFX_APP()->GetBasic() );
-+ SbxObject* basicChosen = pBasic ;
-+ if ( basicChosen == NULL)
-+ {
-+ OSL_TRACE("getModelFromBasic() StarBASIC* is NULL" );
-+ return xModel;
-+ }
-+ SbxObject* p = pBasic;
-+ SbxObject* pParent = p->GetParent();
-+ SbxObject* pParentParent = pParent ? pParent->GetParent() : NULL;
-+
-+ if( pParentParent )
-+ {
-+ basicChosen = pParentParent;
-+ }
-+ else if( pParent )
-+ {
-+ basicChosen = pParent;
-+ }
-+
-+
-+ uno::Any aModel;
-+ SbxVariable *pCompVar = basicChosen->Find( UniString(RTL_CONSTASCII_USTRINGPARAM("ThisComponent")), SbxCLASS_OBJECT );
-+
-+ if ( pCompVar )
-+ {
-+ aModel = sbxToUnoValue( pCompVar );
-+ if ( sal_False == ( aModel >>= xModel ) ||
-+ !xModel.is() )
-+ {
-+ // trying last gasp try the current component
-+ uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+ // test if vba service is present
-+ uno::Reference< uno::XComponentContext > xCtx( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
-+ uno::Reference<lang::XMultiComponentFactory > xSMgr( xCtx->getServiceManager(), uno::UNO_QUERY_THROW );
-+ uno::Reference< frame::XDesktop > xDesktop (xSMgr->createInstanceWithContext(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"), xCtx), uno::UNO_QUERY_THROW );
-+ xModel.set( xDesktop->getCurrentComponent(), uno::UNO_QUERY );
-+ if ( !xModel.is() )
-+ {
-+ throw uno::RuntimeException(
-+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can't extract model from basic ( its obviously not set yet ) therefore don't know the currently selected document") ), uno::Reference< uno::XInterface >() );
-+ }
-+ return xModel;
-+ }
-+ else
-+ {
-+ OSL_TRACE("Have model ThisComponent points to url %s",
-+ ::rtl::OUStringToOString( xModel->getURL(),
-+ RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-+ }
-+ }
-+ else
-+ {
-+ OSL_TRACE("Failed to get ThisComponent");
-+ throw uno::RuntimeException(
-+ rtl::OUString(
-+ RTL_CONSTASCII_USTRINGPARAM(
-+ "Can't determine the currently selected document") ),
-+ uno::Reference< uno::XInterface >() );
-+ }
-+ return xModel;
-+}
-+
-+sal_Int32
-+OORGBToXLRGB( sal_Int32 nCol )
-+{
-+ sal_Int32 nRed = nCol;
-+ nRed &= 0x00FF0000;
-+ nRed >>= 16;
-+ sal_Int32 nGreen = nCol;
-+ nGreen &= 0x0000FF00;
-+ nGreen >>= 8;
-+ sal_Int32 nBlue = nCol;
-+ nBlue &= 0x000000FF;
-+ sal_Int32 nRGB = ( (nBlue << 16) | (nGreen << 8) | nRed );
-+ return nRGB;
-+}
-+sal_Int32
-+XLRGBToOORGB( sal_Int32 nCol )
-+{
-+ sal_Int32 nBlue = nCol;
-+ nBlue &= 0x00FF0000;
-+ nBlue >>= 16;
-+ sal_Int32 nGreen = nCol;
-+ nGreen &= 0x0000FF00;
-+ nGreen >>= 8;
-+ sal_Int32 nRed = nCol;
-+ nRed &= 0x000000FF;
-+ sal_Int32 nRGB = ( (nRed << 16) | (nGreen << 8) | nBlue );
-+ return nRGB;
-+}
-+uno::Any
-+OORGBToXLRGB( const uno::Any& aCol )
-+{
-+ sal_Int32 nCol;
-+ aCol >>= nCol;
-+ nCol = OORGBToXLRGB( nCol );
-+ return uno::makeAny( nCol );
-+}
-+uno::Any
-+XLRGBToOORGB( const uno::Any& aCol )
-+{
-+ sal_Int32 nCol;
-+ aCol >>= nCol;
-+ nCol = XLRGBToOORGB( nCol );
-+ return uno::makeAny( nCol );
-+}
-+
-+void PrintOutHelper( SfxViewShell* pViewShell, const uno::Any& From, const uno::Any& To, const uno::Any& Copies, const uno::Any& Preview, const uno::Any& /*ActivePrinter*/, const uno::Any& /*PrintToFile*/, const uno::Any& Collate, const uno::Any& PrToFileName, sal_Bool bUseSelection )
-+{
-+ sal_Int32 nTo = 0;
-+ sal_Int32 nFrom = 0;
-+ sal_Int16 nCopies = 1;
-+ sal_Bool bPreview = sal_False;
-+ sal_Bool bCollate = sal_False;
-+ sal_Bool bSelection = bUseSelection;
-+ From >>= nFrom;
-+ To >>= nTo;
-+ Copies >>= nCopies;
-+ Preview >>= bPreview;
-+ if ( nCopies > 1 ) // Collate only useful when more that 1 copy
-+ Collate >>= bCollate;
-+
-+ rtl::OUString sRange( RTL_CONSTASCII_USTRINGPARAM( "-" ) );
-+ rtl::OUString sFileName;
-+
-+ if (( nFrom || nTo ) )
-+ {
-+ if ( nFrom )
-+ sRange = ( ::rtl::OUString::valueOf( nFrom ) + sRange );
-+ if ( nTo )
-+ sRange += ::rtl::OUString::valueOf( nTo );
-+ }
-+
-+ if ( PrToFileName.getValue() )
-+ {
-+ PrToFileName >>= sFileName;
-+ }
-+ SfxViewFrame* pViewFrame = NULL;
-+ if ( pViewShell )
-+ pViewFrame = pViewShell->GetViewFrame();
-+ if ( pViewFrame )
-+ {
-+ SfxAllItemSet aArgs( SFX_APP()->GetPool() );
-+
-+ SfxBoolItem sfxCollate( SID_PRINT_COLLATE, bCollate );
-+ aArgs.Put( sfxCollate, sfxCollate.Which() );
-+ SfxInt16Item sfxCopies( SID_PRINT_COPIES, nCopies );
-+ aArgs.Put( sfxCopies, sfxCopies.Which() );
-+ if ( sFileName.getLength() )
-+ {
-+ SfxStringItem sfxFileName( SID_FILE_NAME, sFileName);
-+ aArgs.Put( sfxFileName, sfxFileName.Which() );
-+
-+ }
-+ if ( sRange.getLength() )
-+ {
-+ SfxStringItem sfxRange( SID_PRINT_PAGES, sRange );
-+ aArgs.Put( sfxRange, sfxRange.Which() );
-+ }
-+ SfxBoolItem sfxSelection( SID_SELECTION, bSelection );
-+ aArgs.Put( sfxSelection, sfxSelection.Which() );
-+ SfxBoolItem sfxAsync( SID_ASYNCHRON, sal_False );
-+ aArgs.Put( sfxAsync, sfxAsync.Which() );
-+ SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
-+
-+ if ( pDispatcher )
-+ {
-+ if ( bPreview )
-+ {
-+ if ( !pViewFrame->GetFrame()->IsInPlace() )
-+ {
-+ // #TODO is this necessary ( calc specific )
-+// SC_MOD()->InputEnterHandler();
-+ pViewFrame->GetDispatcher()->Execute( SID_VIEWSHELL1, SFX_CALLMODE_SYNCHRON );
-+ while ( isInPrintPreview( pViewFrame ) )
-+ Application::Yield();
-+ }
-+ }
-+ else
-+ pDispatcher->Execute( (USHORT)SID_PRINTDOC, (SfxCallMode)SFX_CALLMODE_SYNCHRON, aArgs );
-+ }
-+
-+ }
-+
-+ // #FIXME #TODO
-+ // 1 ActivePrinter ( how/can we switch a printer via API? )
-+ // 2 PrintToFile ( ms behaviour if this option is specified but no
-+ // filename supplied 'PrToFileName' then the user will be prompted )
-+ // 3 Need to check behaviour of Selected sheets with range ( e.g. From & To
-+ // values ) in oOO these options are mutually exclusive
-+ // 4 There is a pop up to do with transparent objects in the print source
-+ // should be able to disable that via configuration for the duration
-+ // of this method
-+}
-+
-+ void PrintPreviewHelper( const css::uno::Any& /*EnableChanges*/, SfxViewShell* pViewShell )
-+{
-+ dispatchExecute( pViewShell, SID_VIEWSHELL1 );
-+}
-+
-+rtl::OUString getAnyAsString( const uno::Any& pvargItem ) throw ( uno::RuntimeException )
-+{
-+ uno::Type aType = pvargItem.getValueType();
-+ uno::TypeClass eTypeClass = aType.getTypeClass();
-+ rtl::OUString sString;
-+ switch ( eTypeClass )
-+ {
-+ case uno::TypeClass_BOOLEAN:
-+ {
-+ sal_Bool bBool = sal_False;
-+ pvargItem >>= bBool;
-+ sString = rtl::OUString::valueOf( bBool );
-+ break;
-+ }
-+ case uno::TypeClass_STRING:
-+ pvargItem >>= sString;
-+ break;
-+ case uno::TypeClass_FLOAT:
-+ {
-+ float aFloat = 0;
-+ pvargItem >>= aFloat;
-+ sString = rtl::OUString::valueOf( aFloat );
-+ break;
-+ }
-+ case uno::TypeClass_DOUBLE:
-+ {
-+ double aDouble = 0;
-+ pvargItem >>= aDouble;
-+ sString = rtl::OUString::valueOf( aDouble );
-+ break;
-+ }
-+ case uno::TypeClass_SHORT:
-+ case uno::TypeClass_LONG:
-+ case uno::TypeClass_BYTE:
-+ {
-+ sal_Int32 aNum = 0;
-+ pvargItem >>= aNum;
-+ sString = rtl::OUString::valueOf( aNum );
-+ break;
-+ }
-+
-+ case uno::TypeClass_HYPER:
-+ {
-+ sal_Int64 aHyper = 0;
-+ pvargItem >>= aHyper;
-+ sString = rtl::OUString::valueOf( aHyper );
-+ break;
-+ }
-+ default:
-+ throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid type, can't convert" ), uno::Reference< uno::XInterface >() );
-+ }
-+ return sString;
-+}
-+
-+
-+rtl::OUString
-+ContainerUtilities::getUniqueName( const uno::Sequence< ::rtl::OUString >& _slist, const rtl::OUString& _sElementName, const ::rtl::OUString& _sSuffixSeparator)
-+{
-+ return getUniqueName(_slist, _sElementName, _sSuffixSeparator, sal_Int32(2));
-+}
-+
-+rtl::OUString
-+ContainerUtilities::getUniqueName( const uno::Sequence< rtl::OUString >& _slist, const rtl::OUString _sElementName, const rtl::OUString& _sSuffixSeparator, sal_Int32 _nStartSuffix)
-+{
-+ sal_Int32 a = _nStartSuffix;
-+ rtl::OUString scompname = _sElementName;
-+ bool bElementexists = true;
-+ sal_Int32 nLen = _slist.getLength();
-+ if ( nLen == 0 )
-+ return _sElementName;
-+
-+ while (bElementexists == true)
-+ {
-+ for (sal_Int32 i = 0; i < nLen; i++)
-+ {
-+ if (FieldInList(_slist, scompname) == -1)
-+ {
-+ return scompname;
-+ }
-+ }
-+ scompname = _sElementName + _sSuffixSeparator + rtl::OUString::valueOf( a++ );
-+ }
-+ return rtl::OUString();
-+}
-+
-+sal_Int32
-+ContainerUtilities::FieldInList( const uno::Sequence< rtl::OUString >& SearchList, const rtl::OUString& SearchString )
-+{
-+ sal_Int32 FieldLen = SearchList.getLength();
-+ sal_Int32 retvalue = -1;
-+ for (sal_Int32 i = 0; i < FieldLen; i++)
-+ {
-+ // I wonder why comparing lexicographically is done
-+ // when its a match is whats interesting?
-+ //if (SearchList[i].compareTo(SearchString) == 0)
-+ if ( SearchList[i].equals( SearchString ) )
-+ {
-+ retvalue = i;
-+ break;
-+ }
-+ }
-+ return retvalue;
-+
-+}
-+bool NeedEsc(sal_Unicode cCode)
-+{
-+ String sEsc(RTL_CONSTASCII_USTRINGPARAM(".^$+\\|{}()"));
-+ return (STRING_NOTFOUND != sEsc.Search(cCode));
-+}
-+
-+rtl::OUString VBAToRegexp(const rtl::OUString &rIn, bool bForLike )
-+{
-+ rtl::OUStringBuffer sResult;
-+ const sal_Unicode *start = rIn.getStr();
-+ const sal_Unicode *end = start + rIn.getLength();
-+
-+ int seenright = 0;
-+ if ( bForLike )
-+ sResult.append(static_cast<sal_Unicode>('^'));
-+
-+ while (start < end)
-+ {
-+ switch (*start)
-+ {
-+ case '?':
-+ sResult.append(static_cast<sal_Unicode>('.'));
-+ start++;
-+ break;
-+ case '*':
-+ sResult.append(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".*")));
-+ start++;
-+ break;
-+ case '#':
-+ sResult.append(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("[0-9]")));
-+ start++;
-+ break;
-+ case '~':
-+ sResult.append(static_cast<sal_Unicode>('\\'));
-+ sResult.append(*(++start));
-+ start++;
-+ break;
-+ // dump the ~ and escape the next characture
-+ case ']':
-+ sResult.append(static_cast<sal_Unicode>('\\'));
-+ sResult.append(*start++);
-+ break;
-+ case '[':
-+ sResult.append(*start++);
-+ seenright = 0;
-+ while (start < end && !seenright)
-+ {
-+ switch (*start)
-+ {
-+ case '[':
-+ case '?':
-+ case '*':
-+ sResult.append(static_cast<sal_Unicode>('\\'));
-+ sResult.append(*start);
-+ break;
-+ case ']':
-+ sResult.append(*start);
-+ seenright = 1;
-+ break;
-+ case '!':
-+ sResult.append(static_cast<sal_Unicode>('^'));
-+ break;
-+ default:
-+ if (NeedEsc(*start))
-+ sResult.append(static_cast<sal_Unicode>('\\'));
-+ sResult.append(*start);
-+ break;
-+ }
-+ start++;
-+ }
-+ break;
-+ default:
-+ if (NeedEsc(*start))
-+ sResult.append(static_cast<sal_Unicode>('\\'));
-+ sResult.append(*start++);
-+ }
-+ }
-+
-+ if ( bForLike )
-+ sResult.append(static_cast<sal_Unicode>('$'));
-+
-+ return sResult.makeStringAndClear( );
-+}
-+
-+double getPixelTo100thMillimeterConversionFactor( css::uno::Reference< css::awt::XDevice >& xDevice, sal_Bool bVertical)
-+{
-+ double fConvertFactor = 1.0;
-+ if( bVertical )
-+ {
-+ fConvertFactor = xDevice->getInfo().PixelPerMeterY/100000;
-+ }
-+ else
-+ {
-+ fConvertFactor = xDevice->getInfo().PixelPerMeterX/100000;
-+ }
-+ return fConvertFactor;
-+}
-+
-+double PointsToPixels( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical)
-+{
-+ double fConvertFactor = getPixelTo100thMillimeterConversionFactor( xDevice, bVertical );
-+ return fPoints * POINTTO100THMILLIMETERFACTOR * fConvertFactor;
-+}
-+double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double fPixels, sal_Bool bVertical)
-+{
-+ double fConvertFactor = getPixelTo100thMillimeterConversionFactor( xDevice, bVertical );
-+ return (fPixels/fConvertFactor)/POINTTO100THMILLIMETERFACTOR;
-+}
-+
-+ConcreteXShapeGeometryAttributes::ConcreteXShapeGeometryAttributes( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape )
-+{
-+// #FIXME needs to be an instantiable service
-+// m_xShape = new ScVbaShape( xContext, xShape );
-+}
-+
-+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 getPointerStyle()
-+{
-+ 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();
-+ }
-+ return nPointerStyle;
-+}
-+
-+void setCursorHelper( const Pointer& rPointer, sal_Bool bOverWrite )
-+{
-+ ::std::vector< uno::Reference< frame::XController > > aControllers;
-+
-+ const uno::Reference< frame::XModel2 > xModel2( SfxObjectShell::GetCurrentComponent(), uno::UNO_QUERY );
-+ if ( xModel2.is() )
-+ {
-+ const uno::Reference< container::XEnumeration > xEnumControllers( xModel2->getControllers(), uno::UNO_SET_THROW );
-+ while ( xEnumControllers->hasMoreElements() )
-+ {
-+ const uno::Reference< frame::XController > xController( xEnumControllers->nextElement(), uno::UNO_QUERY_THROW );
-+ aControllers.push_back( xController );
-+ }
-+ }
-+ else
-+ {
-+ const uno::Reference< frame::XModel > xModel( SfxObjectShell::GetCurrentComponent(), uno::UNO_QUERY );
-+ if ( xModel.is() )
-+ {
-+ const uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_SET_THROW );
-+ aControllers.push_back( xController );
-+ }
-+ else
-+ {
-+ 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;
-+
-+ pWindow->GetSystemWindow()->SetPointer( rPointer );
-+ pWindow->GetSystemWindow()->EnableChildPointerOverwrite( bOverWrite );
-+ }
-+}
-+
-+String docMacroExists( SfxObjectShell* pShell, const String& sMod, const String& sMacro )
-+{
-+ String sFullName;
-+ // would use the script provider to see if the macro exists but
-+ // called at this stage tdoc content handler stuff is not set up
-+ // so it fails
-+
-+ String sLibrary( RTL_CONSTASCII_USTRINGPARAM("Standard"));
-+ BasicManager* pBasicMgr = pShell-> GetBasicManager();
-+ if ( pBasicMgr )
-+ {
-+ if ( pBasicMgr->GetName().Len() )
-+ sLibrary = pBasicMgr->GetName();
-+ StarBASIC* pBasic = pBasicMgr->GetLib( sLibrary );
-+ if ( !pBasic )
-+ {
-+ USHORT nId = pBasicMgr->GetLibId( sLibrary );
-+ pBasicMgr->LoadLib( nId );
-+ pBasic = pBasicMgr->GetLib( sLibrary );
-+ }
-+ if ( pBasic )
-+ {
-+ if ( sMod.Len() ) // we wish to find the macro is a specific module
-+ {
-+ SbModule* pModule = pBasic->FindModule( sMod );
-+ if ( pModule )
-+ {
-+ SbxArray* pMethods = pModule->GetMethods();
-+ if ( pMethods )
-+ {
-+ SbMethod* pMethod = static_cast< SbMethod* >( pMethods->Find( sMacro, SbxCLASS_METHOD ) );
-+ if ( pMethod )
-+ {
-+ sFullName = sMacro;
-+ sFullName.Insert( '.', 0 ).Insert( sMod, 0 ).Insert( '.', 0 ).Insert( sLibrary, 0 );
-+ }
-+ }
-+ }
-+ }
-+ else if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pBasic->Find( sMacro, SbxCLASS_METHOD ) ) )
-+ {
-+ if( SbModule* pModule = pMethod->GetModule() )
-+ {
-+ sFullName = sMacro;
-+ sFullName.Insert( '.', 0 ).Insert( pModule->GetName(), 0).Insert( '.', 0 ).Insert( sLibrary, 0 );
-+ }
-+ }
-+
-+ }
-+ }
-+ return sFullName;
-+}
-+
-+#define VBA_LEFT "PositionX"
-+#define VBA_TOP "PositionY"
-+UserFormGeometryHelper::UserFormGeometryHelper( const uno::Reference< uno::XComponentContext >& /*xContext*/, const uno::Reference< awt::XControl >& xControl )
-+{
-+ mxModel.set( xControl->getModel(), uno::UNO_QUERY_THROW );
-+}
-+ double UserFormGeometryHelper::getLeft()
-+ {
-+ sal_Int32 nLeft = 0;
-+ mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_LEFT ) ) ) >>= nLeft;
-+ return Millimeter::getInPoints( nLeft );
-+ }
-+ void UserFormGeometryHelper::setLeft( double nLeft )
-+ {
-+ mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_LEFT ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nLeft ) ) );
-+ }
-+ double UserFormGeometryHelper::getTop()
-+ {
-+ sal_Int32 nTop = 0;
-+ mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_TOP ) ) ) >>= nTop;
-+ return Millimeter::getInPoints( nTop );
-+ }
-+ void UserFormGeometryHelper::setTop( double nTop )
-+ {
-+ mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VBA_TOP ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nTop ) ) );
-+ }
-+ double UserFormGeometryHelper::getHeight()
-+ {
-+ sal_Int32 nHeight = 0;
-+ mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( NAME_HEIGHT ) ) ) >>= nHeight;
-+ return Millimeter::getInPoints( nHeight );
-+ }
-+ void UserFormGeometryHelper::setHeight( double nHeight )
-+ {
-+ mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( NAME_HEIGHT ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nHeight ) ) );
-+ }
-+ double UserFormGeometryHelper::getWidth()
-+ {
-+ sal_Int32 nWidth = 0;
-+ mxModel->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( NAME_WIDTH ) ) ) >>= nWidth;
-+ return Millimeter::getInPoints( nWidth );
-+ }
-+ void UserFormGeometryHelper::setWidth( double nWidth)
-+ {
-+ mxModel->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( NAME_WIDTH ) ), uno::makeAny( Millimeter::getInHundredthsOfOneMillimeter( nWidth ) ) );
-+ }
-+
-+ double ConcreteXShapeGeometryAttributes::getLeft()
-+ {
-+ return m_xShape->getLeft();
-+ }
-+ void ConcreteXShapeGeometryAttributes::setLeft( double nLeft )
-+ {
-+ m_xShape->setLeft( nLeft );
-+ }
-+ double ConcreteXShapeGeometryAttributes::getTop()
-+ {
-+ return m_xShape->getTop();
-+ }
-+ void ConcreteXShapeGeometryAttributes::setTop( double nTop )
-+ {
-+ m_xShape->setTop( nTop );
-+ }
-+
-+ double ConcreteXShapeGeometryAttributes::getHeight()
-+ {
-+ return m_xShape->getHeight();
-+ }
-+ void ConcreteXShapeGeometryAttributes::setHeight( double nHeight )
-+ {
-+ m_xShape->setHeight( nHeight );
-+ }
-+ double ConcreteXShapeGeometryAttributes::getWidth()
-+ {
-+ return m_xShape->getWidth();
-+ }
-+ void ConcreteXShapeGeometryAttributes::setWidth( double nWidth)
-+ {
-+ m_xShape->setHeight( nWidth );
-+ }
-+
-+
-+ ShapeHelper::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 ShapeHelper::getHeight()
-+ {
-+ return Millimeter::getInPoints(xShape->getSize().Height);
-+ }
-+
-+
-+ void ShapeHelper::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 ShapeHelper::getWidth()
-+ {
-+ return Millimeter::getInPoints(xShape->getSize().Width);
-+ }
-+
-+ void ShapeHelper::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 ShapeHelper::getLeft()
-+ {
-+ return Millimeter::getInPoints(xShape->getPosition().X);
-+ }
-+
-+
-+ void ShapeHelper::setLeft(double _fLeft)
-+ {
-+ css::awt::Point aPoint = xShape->getPosition();
-+ aPoint.X = Millimeter::getInHundredthsOfOneMillimeter(_fLeft);
-+ xShape->setPosition(aPoint);
-+ }
-+
-+
-+ double ShapeHelper::getTop()
-+ {
-+ return Millimeter::getInPoints(xShape->getPosition().Y);
-+ }
-+
-+
-+ void ShapeHelper::setTop(double _fTop)
-+ {
-+ css::awt::Point aPoint = xShape->getPosition();
-+ aPoint.Y = Millimeter::getInHundredthsOfOneMillimeter(_fTop);
-+ xShape->setPosition(aPoint);
-+ }
-+
-+ void DebugHelper::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() );
-+ }
-+
-+ void DebugHelper::exception( int err, const rtl::OUString& additionalArgument ) throw( css::script::BasicErrorException )
-+ {
-+ exception( rtl::OUString(), css::uno::Exception(), err, additionalArgument );
-+ }
-+ void DebugHelper::exception( css::uno::Exception& ex ) throw( css::script::BasicErrorException )
-+ {
-+ exception( rtl::OUString(), ex, SbERR_INTERNAL_ERROR, rtl::OUString() );
-+ }
-+
-+ Millimeter::Millimeter():m_nMillimeter(0) {}
-+
-+ Millimeter::Millimeter(double mm):m_nMillimeter(mm) {}
-+
-+ void Millimeter::set(double mm) { m_nMillimeter = mm; }
-+ void Millimeter::setInPoints(double points)
-+ {
-+ m_nMillimeter = points * 0.352777778;
-+ // 25.4mm / 72
-+ }
-+
-+ void Millimeter::setInHundredthsOfOneMillimeter(double hmm)
-+ {
-+ m_nMillimeter = hmm / 100;
-+ }
-+
-+ double Millimeter::get()
-+ {
-+ return m_nMillimeter;
-+ }
-+ double Millimeter::getInHundredthsOfOneMillimeter()
-+ {
-+ return m_nMillimeter * 100;
-+ }
-+ double Millimeter::getInPoints()
-+ {
-+ return m_nMillimeter * 2.834645669; // 72 / 25.4mm
-+ }
-+
-+ sal_Int32 Millimeter::getInHundredthsOfOneMillimeter(double points)
-+ {
-+ sal_Int32 mm = static_cast<sal_Int32>(points * factor);
-+ return mm;
-+ }
-+
-+ double Millimeter::getInPoints(int _hmm)
-+ {
-+ double points = double( static_cast<double>(_hmm) / factor);
-+ return points;
-+ }
-+
-+
-+} // openoffice
-+} //org
---- vbahelper/source/vbahelper/vbapropvalue.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/vbahelper/vbapropvalue.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,48 @@
-+/*************************************************************************
-+ *
-+ * 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: vbapropvalue.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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include "vbahelper/vbapropvalue.hxx"
-+
-+using namespace com::sun::star;
-+
-+ScVbaPropValue::ScVbaPropValue( PropListener* pListener ) : m_pListener( pListener )
-+{
-+}
-+
-+css::uno::Any SAL_CALL
-+ScVbaPropValue::getValue() throw (css::uno::RuntimeException)
-+{
-+ return m_pListener->getValueEvent();
-+}
-+
-+void SAL_CALL
-+ScVbaPropValue::setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException)
-+{
-+ m_pListener->setValueEvent( _value );
-+}
---- vbahelper/source/vbahelper/vbawindowbase.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/source/vbahelper/vbawindowbase.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,180 @@
-+/*************************************************************************
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#include <vbahelper/helperdecl.hxx>
-+#include <vbahelper/vbawindowbase.hxx>
-+#include <com/sun/star/awt/XWindow.hpp>
-+#include <com/sun/star/awt/XWindow2.hpp>
-+#include <com/sun/star/awt/PosSize.hpp>
-+
-+using namespace ::com::sun::star;
-+using namespace ::ooo::vba;
-+
-+VbaWindowBase::VbaWindowBase( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) : WindowBaseImpl_BASE( xParent, xContext ), m_xModel( xModel )
-+{
-+}
-+
-+VbaWindowBase::VbaWindowBase( uno::Sequence< uno::Any > const & args, uno::Reference< uno::XComponentContext > const & xContext )
-+ : WindowBaseImpl_BASE( getXSomethingFromArgs< XHelperInterface >( args, 0 ), xContext ),
-+ m_xModel( getXSomethingFromArgs< frame::XModel >( args, 1 ) )
-+{
-+}
-+
-+sal_Bool SAL_CALL
-+VbaWindowBase::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
-+VbaWindowBase::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
-+VbaWindowBase::getHeight() throw (uno::RuntimeException)
-+{
-+ css::awt::Rectangle aRect = getPosSize(m_xModel);
-+ return aRect.Height;
-+}
-+
-+void SAL_CALL
-+VbaWindowBase::setHeight( sal_Int32 _height ) throw (uno::RuntimeException)
-+{
-+ setPosSize(m_xModel, _height, css::awt::PosSize::HEIGHT);
-+}
-+
-+sal_Int32 SAL_CALL
-+VbaWindowBase::getLeft() throw (uno::RuntimeException)
-+{
-+ css::awt::Rectangle aRect = getPosSize(m_xModel);
-+ return aRect.X;
-+}
-+
-+void SAL_CALL
-+VbaWindowBase::setLeft( sal_Int32 _left ) throw (uno::RuntimeException)
-+{
-+ setPosSize(m_xModel, _left, css::awt::PosSize::X);
-+}
-+sal_Int32 SAL_CALL
-+VbaWindowBase::getTop() throw (uno::RuntimeException)
-+{
-+ css::awt::Rectangle aRect = getPosSize(m_xModel);
-+ return aRect.Y;
-+}
-+
-+void SAL_CALL
-+VbaWindowBase::setTop( sal_Int32 _top ) throw (uno::RuntimeException)
-+{
-+ setPosSize(m_xModel, _top, css::awt::PosSize::Y);
-+}
-+sal_Int32 SAL_CALL
-+VbaWindowBase::getWidth() throw (uno::RuntimeException)
-+{
-+ css::awt::Rectangle aRect = getPosSize(m_xModel);
-+ return aRect.Width;
-+}
-+
-+void SAL_CALL
-+VbaWindowBase::setWidth( sal_Int32 _width ) throw (uno::RuntimeException)
-+{
-+ setPosSize(m_xModel, _width, css::awt::PosSize::WIDTH);
-+}
-+
-+rtl::OUString&
-+VbaWindowBase::getServiceImplName()
-+{
-+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("VbaWindowBase") );
-+ return sImplName;
-+}
-+
-+uno::Sequence< rtl::OUString >
-+VbaWindowBase::getServiceNames()
-+{
-+ static uno::Sequence< rtl::OUString > aServiceNames;
-+ if ( aServiceNames.getLength() == 0 )
-+ {
-+ aServiceNames.realloc( 1 );
-+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.VbaWindowBase" ) );
-+ }
-+ return aServiceNames;
-+}
---- vbahelper/util/makefile.mk.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/util/makefile.mk 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,97 @@
-+#*************************************************************************
-+#
-+# 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: makefile.mk,v $
-+#
-+# $Revision: 1.24 $
-+#
-+# 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
-+# <http://www.openoffice.org/license.html>
-+# for a copy of the LGPLv3 License.
-+#
-+#*************************************************************************
-+
-+PRJ=..
-+
-+PRJNAME=vbahelper
-+TARGET=vbahelper
-+
-+# --- Settings ---------------------------------------------------
-+
-+.INCLUDE : settings.mk
-+
-+
-+TARGET_HELPER=vbahelper
-+SHL1TARGET= $(TARGET_HELPER)$(DLLPOSTFIX)
-+SHL1IMPLIB= i$(TARGET_HELPER)
-+
-+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
-+DEF1NAME=$(SHL1TARGET)
-+
-+LIB1FILES=$(SLB)$/$(TARGET_HELPER).lib
-+
-+# dynamic libraries
-+SHL1STDLIBS= \
-+ $(CPPULIB) \
-+ $(COMPHELPERLIB) \
-+ $(CPPUHELPERLIB) \
-+ $(BASICLIB) \
-+ $(TOOLSLIB) \
-+ $(SALLIB)\
-+ $(SFXLIB) \
-+ $(SVTOOLLIB) \
-+ $(SVLLIB) \
-+ $(VCLLIB) \
-+ $(SVTOOLLIB) \
-+ $(TKLIB) \
-+
-+#SHL4DEPN=$(SHL1TARGETN)
-+SHL1LIBS=$(LIB1FILES)
-+
-+TARGET_MSFORMS=msforms
-+SHL2TARGET=$(TARGET_MSFORMS)$(DLLPOSTFIX).uno
-+SHL2IMPLIB= i$(TARGET_MSFORMS)
-+
-+SHL2VERSIONMAP=$(TARGET_MSFORMS).map
-+SHL2DEF=$(MISC)$/$(SHL2TARGET).def
-+DEF2NAME=$(SHL2TARGET)
-+SHL2STDLIBS= \
-+ $(CPPUHELPERLIB) \
-+ $(CPPULIB) \
-+ $(COMPHELPERLIB) \
-+ $(SVLIB) \
-+ $(TOOLSLIB) \
-+ $(SALLIB)\
-+ $(VBAHELPERLIB) \
-+ $(SFXLIB) \
-+ $(SVXLIB) \
-+ $(SVTOOLLIB) \
-+ $(SVLLIB) \
-+ $(VCLLIB) \
-+ $(TKLIB) \
-+ $(BASICLIB) \
-+
-+SHL2DEPN=$(SHL1TARGETN)
-+SHL2LIBS=$(SLB)$/$(TARGET_MSFORMS).lib
-+
-+# --- Targets -----------------------------------------------------------
-+
-+.INCLUDE : target.mk
---- vbahelper/util/msforms.map.old 1970-01-01 00:00:00.000000000 +0000
-+++ vbahelper/util/msforms.map 2009-04-06 16:42:01.000000000 +0000
-@@ -0,0 +1,9 @@
-+OOO_1.1 {
-+ global:
-+ component_getImplementationEnvironment;
-+ component_getFactory;
-+ component_writeInfo;
-+
-+ local:
-+ *;
-+};
---- basic/source/uno/namecont.cxx.old 2009-04-06 16:41:59.000000000 +0000
-+++ basic/source/uno/namecont.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -2730,6 +2730,10 @@ OUString SfxLibraryContainer::expand_url
- {
- // get the standard library
- String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
-+
-+ if ( pBasMgr->GetName().Len() )
-+ aLibName = pBasMgr->GetName();
-+
- StarBASIC* pBasic = pBasMgr->GetLib( aLibName );
- if( pBasic )
- bVBACompat = pBasic->isVBAEnabled();
---- sc/inc/cellsuno.hxx.old 2009-04-02 10:45:43.000000000 +0000
-+++ sc/inc/cellsuno.hxx 2009-04-06 16:42:01.000000000 +0000
-@@ -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 : pu
- {
- friend class ScTabViewObj; // fuer select()
- friend class ScTableSheetObj; // fuer createCursorByRange()
-- friend class ooo::vba::ScVbaCellRangeAccess;
-+ friend class ooo::vba::excel::ScVbaCellRangeAccess;
-
- private:
- SfxItemPropertySet aPropSet;
---- sc/source/ui/vba/vbafont.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbafont.cxx 2009-04-06 16:42:01.000000000 +0000
-@@ -76,7 +76,7 @@ ScVbaFont::ScVbaFont( const uno::Referen
- SfxItemSet*
- ScVbaFont::GetDataSet()
- {
-- SfxItemSet* pDataSet = ScVbaCellRangeAccess::GetDataSet( mpRangeObj );
-+ SfxItemSet* pDataSet = excel::ScVbaCellRangeAccess::GetDataSet( mpRangeObj );
- return pDataSet;
- }
-
diff --git a/patches/vba/vba-workbook-auto-open-event.diff b/patches/vba/vba-workbook-auto-open-event.diff
deleted file mode 100644
index 1f826e840..000000000
--- a/patches/vba/vba-workbook-auto-open-event.diff
+++ /dev/null
@@ -1,67 +0,0 @@
-diff --git sc/source/ui/vba/vbaeventshelper.cxx sc/source/ui/vba/vbaeventshelper.cxx
-index eba8a1f..78b3ede 100644
---- sc/source/ui/vba/vbaeventshelper.cxx
-+++ sc/source/ui/vba/vbaeventshelper.cxx
-@@ -384,7 +384,7 @@ protected:
- static ImplVbaEventNameInfo* pImplVbaEventNameInfo;
- ImplVbaEventNameInfo() { InitImplVbaEventNameInfo(); }
- private:
-- void insert( const sal_Int32 nId, const rtl::OUString sEventName )
-+ void insert( const sal_Int32 nId, const rtl::OUString& sEventName )
- {
- m_aEventNameMap.insert( make_pair( nId, sEventName ) );
- }
-@@ -450,6 +450,7 @@ void ImplVbaEventNameInfo::InitImplVbaEventNameInfo()
- INSERT_WORKBOOK_EVENT_INFO( DEACTIVATE, "Deactivate" );
- INSERT_WORKBOOK_EVENT_INFO( OPEN, "Open" );
- // AUTOOPEN doesn't be used. TODO, this should be "auto_open"
-+ insert( VBAEVENT_WORKBOOK_AUTOOPEN, CREATEOUSTRING("Auto_Open") );
- INSERT_WORKBOOK_EVENT_INFO( BEFORECLOSE, "BeforeClose" );
- INSERT_WORKBOOK_EVENT_INFO( BEFOREPRINT, "BeforePrint" );
- INSERT_WORKBOOK_EVENT_INFO( BEFORESAVE, "BeforeSave" );
-@@ -638,7 +639,6 @@ ScVbaEventsHelper::getMacroPath( const sal_Int32 nEventId, const SCTAB nTab )
- case VBAEVENT_WORKBOOK_ACTIVATE :
- case VBAEVENT_WORKBOOK_DEACTIVATE :
- case VBAEVENT_WORKBOOK_OPEN :
-- case VBAEVENT_WORKBOOK_AUTOOPEN :
- case VBAEVENT_WORKBOOK_BEFORECLOSE :
- case VBAEVENT_WORKBOOK_BEFOREPRINT :
- case VBAEVENT_WORKBOOK_BEFORESAVE :
-@@ -669,6 +669,11 @@ ScVbaEventsHelper::getMacroPath( const sal_Int32 nEventId, const SCTAB nTab )
- sMacroResolvedInfo = resolveVBAMacro( pShell, sMacroName );
- break;
- }
-+ case VBAEVENT_WORKBOOK_AUTOOPEN :
-+ {
-+ sMacroResolvedInfo = resolveVBAMacro( pShell, sMacroName );
-+ break;
-+ }
- default:
- break;
- }
-@@ -698,6 +703,7 @@ sal_Bool ScVbaEventsHelper::processVbaEvent( const sal_Int32 nEventId, const uno
- case VBAEVENT_WORKBOOK_ACTIVATE:
- case VBAEVENT_WORKBOOK_DEACTIVATE:
- case VBAEVENT_WORKBOOK_OPEN:
-+ case VBAEVENT_WORKBOOK_AUTOOPEN:
- {
- // no arguments
- break;
-@@ -992,6 +998,7 @@ ScVbaEventsHelper::ProcessCompatibleVbaEvent( sal_Int32 nEventId, const uno::Seq
- if( !mbOpened )
- {
- processVbaEvent( nEventId, aArgs );
-+ processVbaEvent( VBAEVENT_WORKBOOK_AUTOOPEN, aArgs );
- mbOpened = sal_True;
- ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_ACTIVATE, aArgs );
- }
-@@ -1004,9 +1011,6 @@ ScVbaEventsHelper::ProcessCompatibleVbaEvent( sal_Int32 nEventId, const uno::Seq
- }
- break;
- }
-- case VBAEVENT_WORKBOOK_AUTOOPEN:
-- // TODO
-- break;
- case VBAEVENT_WORKBOOK_BEFORECLOSE:
- {
- sal_Bool bCancel = processVbaEvent( nEventId, aArgs );
diff --git a/patches/vba/vba-workbook-precisionasdisplayed.diff b/patches/vba/vba-workbook-precisionasdisplayed.diff
deleted file mode 100644
index 20bded152..000000000
--- a/patches/vba/vba-workbook-precisionasdisplayed.diff
+++ /dev/null
@@ -1,60 +0,0 @@
-diff --git oovbaapi/ooo/vba/excel/XWorkbook.idl oovbaapi/ooo/vba/excel/XWorkbook.idl
-index 66a6380..d72940c 100644
---- oovbaapi/ooo/vba/excel/XWorkbook.idl
-+++ oovbaapi/ooo/vba/excel/XWorkbook.idl
-@@ -53,6 +53,7 @@ interface XWorkbook : com::sun::star::uno::XInterface
- [attribute, readonly] boolean ProtectStructure;
- [attribute, readonly] XWorksheet ActiveSheet;
- [attribute, readonly] string CodeName;
-+ [attribute] boolean PrecisionAsDisplayed;
-
- any Worksheets([in] any sheet);
- any Styles([in] any Index );
-diff --git sc/source/ui/vba/vbaworkbook.cxx sc/source/ui/vba/vbaworkbook.cxx
-index 5b6e277..7438065 100644
---- sc/source/ui/vba/vbaworkbook.cxx
-+++ sc/source/ui/vba/vbaworkbook.cxx
-@@ -52,6 +52,7 @@
- #include <stdio.h>
- #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
-@@ -270,6 +271,22 @@ ScVbaWorkbook::getProtectStructure() throw (uno::RuntimeException)
- return xProt->isProtected();
- }
-
-+::sal_Bool SAL_CALL ScVbaWorkbook::getPrecisionAsDisplayed() throw (uno::RuntimeException)
-+{
-+ uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );
-+ ScDocument* pDoc = excel::getDocShell( xModel )->GetDocument();
-+ return pDoc->GetDocOptions().IsCalcAsShown();
-+}
-+
-+void SAL_CALL ScVbaWorkbook::setPrecisionAsDisplayed( sal_Bool _precisionAsDisplayed ) throw (uno::RuntimeException)
-+{
-+ 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
- ScVbaWorkbook::SaveCopyAs( const rtl::OUString& sFileName ) throw ( uno::RuntimeException)
- {
-diff --git sc/source/ui/vba/vbaworkbook.hxx sc/source/ui/vba/vbaworkbook.hxx
-index 1ce5de5..05a0d52 100644
---- sc/source/ui/vba/vbaworkbook.hxx
-+++ sc/source/ui/vba/vbaworkbook.hxx
-@@ -56,6 +56,8 @@ public:
- // Attributes
- 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 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);
diff --git a/patches/vba/vba-workbook-worksheet-events.diff b/patches/vba/vba-workbook-worksheet-events.diff
deleted file mode 100644
index bf0eb4f94..000000000
--- a/patches/vba/vba-workbook-worksheet-events.diff
+++ /dev/null
@@ -1,2227 +0,0 @@
---- offapi/com/sun/star/document/VbaEventId.idl.old 1970-01-01 00:00:00.000000000 +0000
-+++ offapi/com/sun/star/document/VbaEventId.idl 2009-04-06 16:42:00.000000000 +0000
-@@ -0,0 +1,82 @@
-+/*************************************************************************
-+ *
-+ * 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 __org_openoffice_vba_VbaEventId_idl__
-+#define __org_openoffice_vba_VbaEventId_idl__
-+
-+//=============================================================================
-+
-+module com { module sun { module star { module document {
-+//=============================================================================
-+
-+/* VBA compatibility event id */
-+constants VbaEventId
-+{
-+ // Worksheet
-+ const long VBAEVENT_WORKSHEET_ACTIVATE = 1;
-+ const long VBAEVENT_WORKSHEET_BEFOREDOUBLECLICK = 2;
-+ const long VBAEVENT_WORKSHEET_BEFORERIGHTCLICK = 3;
-+ const long VBAEVENT_WORKSHEET_CALCULATE = 4;
-+ const long VBAEVENT_WORKSHEET_CHANGE = 5;
-+ const long VBAEVENT_WORKSHEET_DEACTIVATE = 6;
-+ const long VBAEVENT_WORKSHEET_FOLLOWHYPERLINK = 7;
-+ const long VBAEVENT_WORKSHEET_PIVOTTABLEUPDATE = 8;
-+ const long VBAEVENT_WORKSHEET_SELECTIONCHANGE = 9;
-+ // Workbook
-+ const long VBAEVENT_WORKBOOK_ACTIVATE = 20;
-+ const long VBAEVENT_WORKBOOK_DEACTIVATE = 21;
-+ const long VBAEVENT_WORKBOOK_OPEN = 22;
-+ const long VBAEVENT_WORKBOOK_AUTOOPEN = 23;
-+ const long VBAEVENT_WORKBOOK_BEFORECLOSE = 24;
-+ const long VBAEVENT_WORKBOOK_BEFOREPRINT = 25;
-+ const long VBAEVENT_WORKBOOK_BEFORESAVE = 26;
-+ const long VBAEVENT_WORKBOOK_NEWSHEET = 27;
-+ const long VBAEVENT_WORKBOOK_WINDOWACTIVATE = 28;
-+ const long VBAEVENT_WORKBOOK_WINDOWDEACTIVATE = 29;
-+ const long VBAEVENT_WORKBOOK_WINDOWRESIZE = 30;
-+ // Workbook_sheet
-+ const long VBAEVENT_WORKBOOK_SHEET_ACTIVATE = 51;
-+ const long VBAEVENT_WORKBOOK_SHEET_BEFOREDOUBLECLICK = 52;
-+ const long VBAEVENT_WORKBOOK_SHEET_BEFORERIGHTCLICK = 53;
-+ const long VBAEVENT_WORKBOOK_SHEET_CALCULATE = 54;
-+ const long VBAEVENT_WORKBOOK_SHEET_CHANGE = 55;
-+ const long VBAEVENT_WORKBOOK_SHEET_DEACTIVATE = 56;
-+ const long VBAEVENT_WORKBOOK_SHEET_FOLLOWHYPERLINK = 57;
-+ const long VBAEVENT_WORKBOOK_SHEET_PIVOTTABLEUPDATE = 58;
-+ const long VBAEVENT_WORKBOOK_SHEET_SELECTIONCHANGE = 59;
-+};
-+
-+}; }; }; };
-+
-+#endif
---- offapi/com/sun/star/document/XVbaEventsHelper.idl.old 1970-01-01 00:00:00.000000000 +0000
-+++ offapi/com/sun/star/document/XVbaEventsHelper.idl 2009-04-06 16:42:00.000000000 +0000
-@@ -0,0 +1,60 @@
-+/*************************************************************************
-+ *
-+ * 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 __org_openoffice_vba_XVbaEventsHelper_idl__
-+#define __org_openoffice_vba_XVbaEventsHelper_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+//=============================================================================
-+
-+module com { module sun { module star { module document {
-+//=============================================================================
-+
-+interface XVbaEventsHelper
-+{
-+ /**
-+ Execute VBA compatible event.
-+ VbaEvent: Compatible VBA event id.
-+ aArgs: the array of input arguments.
-+ return: True if execute successfully, or False.
-+ **/
-+ boolean ProcessCompatibleVbaEvent( [in] long nEventId, [in] sequence< any > aArgs );
-+ [attribute ] boolean IgnoreEvents;
-+};
-+
-+}; }; }; };
-+
-+#endif
---- offapi/com/sun/star/document/VbaEventsHelper.idl.old 1970-01-01 00:00:00.000000000 +0000
-+++ offapi/com/sun/star/document/VbaEventsHelper.idl 2009-04-06 16:42:00.000000000 +0000
-@@ -0,0 +1,55 @@
-+/*************************************************************************
-+ *
-+ * 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 __org_openoffice_vba_VbaEventsHelper_idl__
-+#define __org_openoffice_vba_VbaEventsHelper_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+#include <com/sun/star/frame/XModel.idl>
-+#include <com/sun/star/document/XVbaEventsHelper.idl>
-+//=============================================================================
-+
-+module com { module sun { module star { module document {
-+//=============================================================================
-+
-+service VbaEventsHelper : XVbaEventsHelper
-+{
-+ createVbaEventsHelper( [in] ::com::sun::star::frame::XModel xModel );
-+};
-+
-+}; }; }; };
-+
-+#endif
---- offapi/com/sun/star/document/XDocumentEventCompatibleHelper.idl.old 1970-01-01 00:00:00.000000000 +0000
-+++ offapi/com/sun/star/document/XDocumentEventCompatibleHelper.idl 2009-04-06 16:42:00.000000000 +0000
-@@ -0,0 +1,53 @@
-+/*************************************************************************
-+ *
-+ * 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: XVbaEventHelper.idl,v $
-+ * $Revision: 1.0 $
-+ *
-+ * 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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef __com_sun_star_document_XDocumentEventCompatibleHelper_idl__
-+#define __com_sun_star_document_XDocumentEventCompatibleHelper_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+//=============================================================================
-+
-+module com { module sun { module star { module document {
-+
-+//=============================================================================
-+interface XDocumentEventCompatibleHelper
-+{
-+ /* Execute some compatible VBA event related to document, such as document save, document print.
-+ nEventId: event id.
-+ */
-+ boolean processCompatibleEvent( [in] short nEventId );
-+};
-+
-+//=============================================================================
-+
-+}; }; }; };
-+
-+#endif
---- offapi/com/sun/star/document/makefile.mk.old 2009-04-06 16:41:59.000000000 +0000
-+++ offapi/com/sun/star/document/makefile.mk 2009-04-06 16:42:00.000000000 +0000
-@@ -117,6 +117,10 @@ IDLFILES=\
- DocumentRevisionListPersistence.idl \
- XDocumentLanguages.idl \
- XCodeNameQuery.idl \
-+ XDocumentEventCompatibleHelper.idl \
-+ VbaEventId.idl \
-+ XVbaEventsHelper.idl \
-+ VbaEventsHelper.idl \
-
-
- # ------------------------------------------------------------------
---- sc/source/ui/vba/vbaeventshelper.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sc/source/ui/vba/vbaeventshelper.hxx 2009-04-06 16:42:00.000000000 +0000
-@@ -0,0 +1,83 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: vbaeventshelper.hxx,v $
-+ *
-+ * $Revision: 1.0 $
-+ *
-+ * last change: $Author: vg $ $Date: 2007/12/07 10:42:26 $
-+ *
-+ * 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_VBAEVENTS_HXX
-+#define SC_VBAEVENTS_HXX
-+
-+#include "document.hxx"
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/document/VbaEventId.hpp>
-+#include <com/sun/star/document/XVbaEventsHelper.hpp>
-+#include "vbahelper.hxx"
-+
-+#define INVALID_TAB -1
-+
-+typedef ::cppu::WeakImplHelper1< com::sun::star::document::XVbaEventsHelper > VBAWorkbookEvent_BASE;
-+
-+class VbaEventsListener;
-+class ScVbaEventsHelper : public VBAWorkbookEvent_BASE
-+{
-+private:
-+ ScDocument* pDoc;
-+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
-+ VbaEventsListener* mpVbaEventsListener;
-+ sal_Bool mbOpened;
-+ sal_Bool mbIgnoreEvents;
-+
-+ String getSheetModuleName( SCTAB nTab );
-+ String workbookMacroExists( SfxObjectShell* pShell, const String& sMod, const String& sMacro );
-+ css::uno::Any createWorkSheet( SfxObjectShell* pShell, SCTAB nTab );
-+ css::uno::Any createRange( const css::uno::Any& aRange );
-+ css::uno::Any createHyperlink( const css::uno::Any& rCell );
-+ css::uno::Any createWindow( SfxObjectShell* pShell );
-+ sal_Bool executeMacro( SfxObjectShell* pShell, const String& sMacroName, css::uno::Sequence< css::uno::Any >& aArgs, css::uno::Any& aRet );
-+ SCTAB getTabFromArgs( const css::uno::Sequence< css::uno::Any > aArgs, const sal_Int32 nPos = 0 );
-+ rtl::OUString getEventName( const sal_Int32 nEventId );
-+ rtl::OUString getMacroPath( const sal_Int32 nEventId, const SCTAB nTab = INVALID_TAB );
-+ sal_Bool processVbaEvent( const sal_Int32 nEventId, const css::uno::Sequence< css::uno::Any >& rArgs, const SCTAB nTab = INVALID_TAB );
-+
-+public:
-+ ScVbaEventsHelper( ScDocument* pDocument ):pDoc( pDocument ), mpVbaEventsListener( NULL ), mbOpened( sal_False ){};
-+ ScVbaEventsHelper( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext > const& xContext );
-+ ~ScVbaEventsHelper();
-+ ScDocument* getDocument() { return pDoc; };
-+ // XVBAWorkbookEventHelper
-+ virtual sal_Bool SAL_CALL ProcessCompatibleVbaEvent( sal_Int32 nEventId, const css::uno::Sequence< css::uno::Any >& aArgs ) throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setIgnoreEvents( ::sal_Bool _ignoreevents ) throw (css::uno::RuntimeException);
-+ virtual ::sal_Bool SAL_CALL getIgnoreEvents() throw (css::uno::RuntimeException);
-+};
-+
-+#endif
-+
---- sc/source/ui/vba/vbaeventshelper.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ sc/source/ui/vba/vbaeventshelper.cxx 2009-04-06 16:42:00.000000000 +0000
-@@ -0,0 +1,1066 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: vbaeventshelper.cxx,v $
-+ *
-+ * $Revision: 1.0 $
-+ *
-+ * last change: $Author: vg $ $Date: 2007/12/07 10:42:26 $
-+ *
-+ * 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 "vbaeventshelper.hxx"
-+#include "helperdecl.hxx"
-+#include <sfx2/objsh.hxx>
-+#include <basic/basmgr.hxx>
-+#include <basic/sbmod.hxx>
-+#include <basic/sbmeth.hxx>
-+#include <basic/sbx.hxx>
-+#include "scextopt.hxx"
-+#include <sfx2/evntconf.hxx>
-+#include <sfx2/event.hxx>
-+#include <sfx2/sfx.hrc>
-+#include <toolkit/unohlp.hxx>
-+#include <comphelper/processfactory.hxx>
-+#include <cppuhelper/implbase1.hxx>
-+#include <com/sun/star/sheet/XSheetCellRangeContainer.hpp>
-+#include <com/sun/star/document/XEventsSupplier.hpp>
-+#include <com/sun/star/sheet/XCellRangeReferrer.hpp>
-+#include <com/sun/star/table/XCell.hpp>
-+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
-+#include <com/sun/star/sheet/XSpreadsheet.hpp>
-+#include <com/sun/star/container/XNamed.hpp>
-+#include <com/sun/star/awt/XWindowListener.hpp>
-+#include <com/sun/star/awt/WindowEvent.hpp>
-+#include <com/sun/star/lang/EventObject.hpp>
-+#include <com/sun/star/util/XCloseListener.hpp>
-+#include <com/sun/star/util/XCloseBroadcaster.hpp>
-+#include <com/sun/star/frame/XControllerBorder.hpp>
-+#include <com/sun/star/frame/XBorderResizeListener.hpp>
-+#include "cellsuno.hxx"
-+
-+#include <map>
-+
-+using namespace std;
-+using namespace com::sun::star;
-+using namespace ooo::vba;
-+using namespace com::sun::star::document::VbaEventId;
-+
-+const static String sLibrary( RTL_CONSTASCII_USTRINGPARAM("Standard"));
-+
-+const static rtl::OUString sUrlPart0 = rtl::OUString::createFromAscii( "vnd.sun.star.script:");
-+const static rtl::OUString sUrlPart1 = rtl::OUString::createFromAscii( "vnd.sun.star.script:Standard.");
-+const static rtl::OUString sUrlPart2 = rtl::OUString::createFromAscii( "?language=Basic&location=document");
-+
-+
-+typedef ::cppu::WeakImplHelper3< awt::XWindowListener, util::XCloseListener, frame::XBorderResizeListener > WindowListener_BASE;
-+
-+// This class is to process Workbook window related event
-+class VbaEventsListener : public WindowListener_BASE
-+{
-+ ScVbaEventsHelper* pVbaEventsHelper;
-+ uno::Reference< frame::XModel > m_xModel;
-+ sal_Bool m_bPrepare;
-+ sal_Bool m_bWindowResized;
-+ sal_Bool m_bBorderChanged;
-+protected :
-+ uno::Reference< awt::XWindow > GetContainerWindow();
-+ uno::Reference< frame::XFrame > GetFrame();
-+ sal_Bool IsMouseReleased();
-+ DECL_LINK( fireResizeMacro, Timer* );
-+ void processWindowResizeMacro();
-+public :
-+ VbaEventsListener( ScVbaEventsHelper* pHelper );
-+ void startEventsLinstener();
-+ void stopEventsLinstener();
-+ // XWindowListener
-+ virtual void SAL_CALL windowResized( const awt::WindowEvent& aEvent ) throw ( uno::RuntimeException );
-+ virtual void SAL_CALL windowMoved( const awt::WindowEvent& aEvent ) throw ( uno::RuntimeException );
-+ virtual void SAL_CALL windowShown( const lang::EventObject& aEvent ) throw ( uno::RuntimeException );
-+ virtual void SAL_CALL windowHidden( const lang::EventObject& aEvent ) throw ( uno::RuntimeException );
-+ virtual void SAL_CALL disposing( const lang::EventObject& aEvent ) throw ( uno::RuntimeException );
-+ // XCloseListener
-+ virtual void SAL_CALL queryClosing( const lang::EventObject& Source, ::sal_Bool GetsOwnership ) throw (util::CloseVetoException, uno::RuntimeException);
-+ virtual void SAL_CALL notifyClosing( const lang::EventObject& Source ) throw (uno::RuntimeException);
-+ // XBorderResizeListener
-+ virtual void SAL_CALL borderWidthsChanged( const uno::Reference< uno::XInterface >& aObject, const frame::BorderWidths& aNewSize ) throw (uno::RuntimeException);
-+};
-+VbaEventsListener::VbaEventsListener( ScVbaEventsHelper* pHelper ) : pVbaEventsHelper( pHelper )
-+{
-+ m_xModel.set( pVbaEventsHelper->getDocument()->GetDocumentShell()->GetModel(), uno::UNO_QUERY );
-+ m_bPrepare = sal_False;
-+ m_bWindowResized = sal_False;
-+ m_bBorderChanged = sal_False;
-+}
-+uno::Reference< frame::XFrame >
-+VbaEventsListener::GetFrame()
-+{
-+ try
-+ {
-+ if( pVbaEventsHelper )
-+ {
-+ if( m_xModel.is() )
-+ {
-+ uno::Reference< frame::XController > xController( m_xModel->getCurrentController(), uno::UNO_QUERY );
-+ if( xController.is() )
-+ {
-+ uno::Reference< frame::XFrame > xFrame( xController->getFrame(), uno::UNO_QUERY );
-+ if( xFrame.is() )
-+ {
-+ return xFrame;
-+ }
-+ }
-+ }
-+ }
-+ }
-+ catch( uno::Exception& /*e*/ )
-+ {
-+ }
-+ return uno::Reference< frame::XFrame >();
-+}
-+uno::Reference< awt::XWindow >
-+VbaEventsListener::GetContainerWindow()
-+{
-+ try
-+ {
-+ uno::Reference< frame::XFrame > xFrame( GetFrame(), uno::UNO_QUERY );
-+ if( xFrame.is() )
-+ {
-+ uno::Reference< awt::XWindow > xWindow( xFrame->getContainerWindow(), uno::UNO_QUERY );
-+ if( xWindow.is() )
-+ return xWindow;
-+ }
-+ }
-+ catch( uno::Exception& /*e*/ )
-+ {
-+ }
-+ return uno::Reference< awt::XWindow >();
-+}
-+sal_Bool
-+VbaEventsListener::IsMouseReleased()
-+{
-+ Window* pWindow = (VCLUnoHelper::GetWindow( GetContainerWindow() ) );
-+ if( pWindow )
-+ {
-+ Window::PointerState aPointerState = pWindow->GetPointerState();
-+ if( !aPointerState.mnState & ( MOUSE_LEFT | MOUSE_MIDDLE | MOUSE_RIGHT ) )
-+ return sal_True;
-+ }
-+ return sal_False;
-+}
-+void
-+VbaEventsListener::startEventsLinstener()
-+{
-+ if( m_xModel.is() )
-+ {
-+ // add window listener
-+ uno::Reference< awt::XWindow > xWindow( GetContainerWindow(), uno::UNO_QUERY );
-+ if( xWindow.is() )
-+ xWindow->addWindowListener( this );
-+ // add close listener
-+ //uno::Reference< util::XCloseBroadcaster > xCloseBroadcaster( GetFrame(), uno::UNO_QUERY );
-+ uno::Reference< util::XCloseBroadcaster > xCloseBroadcaster( m_xModel, uno::UNO_QUERY );
-+ if( xCloseBroadcaster.is() )
-+ {
-+ xCloseBroadcaster->addCloseListener( this );
-+ }
-+ // add Border resize listener
-+ uno::Reference< frame::XController > xController( m_xModel->getCurrentController(), uno::UNO_QUERY );
-+ if( xController.is() )
-+ {
-+ uno::Reference< frame::XControllerBorder > xControllerBorder( xController, uno::UNO_QUERY );
-+ if( xControllerBorder.is() )
-+ {
-+ xControllerBorder->addBorderResizeListener( this );
-+ }
-+ }
-+ }
-+}
-+void
-+VbaEventsListener::stopEventsLinstener()
-+{
-+ if( m_xModel.is() )
-+ {
-+ uno::Reference< awt::XWindow > xWindow( GetContainerWindow(), uno::UNO_QUERY );
-+ if( xWindow.is() )
-+ {
-+ xWindow->removeWindowListener( this );
-+ }
-+ //uno::Reference< util::XCloseBroadcaster > xCloseBroadcaster( GetFrame(), uno::UNO_QUERY );
-+ uno::Reference< util::XCloseBroadcaster > xCloseBroadcaster( m_xModel, uno::UNO_QUERY );
-+ if( xCloseBroadcaster.is() )
-+ {
-+ xCloseBroadcaster->removeCloseListener( this );
-+ }
-+ uno::Reference< frame::XController > xController( m_xModel->getCurrentController(), uno::UNO_QUERY );
-+ if( xController.is() )
-+ {
-+ uno::Reference< frame::XControllerBorder > xControllerBorder( xController, uno::UNO_QUERY );
-+ if( xControllerBorder.is() )
-+ {
-+ xControllerBorder->removeBorderResizeListener( this );
-+ }
-+ }
-+ pVbaEventsHelper = NULL;
-+ }
-+}
-+void
-+VbaEventsListener::processWindowResizeMacro()
-+{
-+ if( pVbaEventsHelper )
-+ pVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_WINDOWRESIZE, uno::Sequence< uno::Any >() );
-+}
-+IMPL_LINK( VbaEventsListener, fireResizeMacro, Timer*, pTimer )
-+{
-+ if( pVbaEventsHelper && m_bPrepare && pTimer )
-+ {
-+ if( IsMouseReleased() )
-+ {
-+ pTimer->Stop();
-+ delete pTimer;
-+ pTimer = 0;
-+ m_bPrepare = sal_False;
-+ processWindowResizeMacro();
-+ }
-+ }
-+ return 0;
-+}
-+void SAL_CALL
-+VbaEventsListener::windowResized( const awt::WindowEvent& /*aEvent*/ ) throw ( uno::RuntimeException )
-+{
-+ // Workbook_window_resize event
-+ OSL_TRACE("VbaEventsListener::windowResized");
-+ m_bWindowResized = sal_True;
-+ Window* pWindow = (VCLUnoHelper::GetWindow( GetContainerWindow() ) );
-+ if( pWindow && !m_bPrepare && m_bBorderChanged )
-+ {
-+ m_bPrepare = sal_True;
-+ m_bBorderChanged = m_bWindowResized = sal_False;
-+ AutoTimer* pTimer = new AutoTimer();
-+ pTimer->SetTimeoutHdl( LINK( this, VbaEventsListener, fireResizeMacro ) );
-+ pTimer->Start();
-+ }
-+}
-+void SAL_CALL
-+VbaEventsListener::windowMoved( const awt::WindowEvent& /*aEvent*/ ) throw ( uno::RuntimeException )
-+{
-+ // not interest this time
-+}
-+void SAL_CALL
-+VbaEventsListener::windowShown( const lang::EventObject& /*aEvent*/ ) throw ( uno::RuntimeException )
-+{
-+ // not interest this time
-+}
-+void SAL_CALL
-+VbaEventsListener::windowHidden( const lang::EventObject& /*aEvent*/ ) throw ( uno::RuntimeException )
-+{
-+ // not interest this time
-+}
-+void SAL_CALL
-+VbaEventsListener::disposing( const lang::EventObject& /*aEvent*/ ) throw ( uno::RuntimeException )
-+{
-+ pVbaEventsHelper = NULL;
-+}
-+void SAL_CALL
-+VbaEventsListener::queryClosing( const lang::EventObject& Source, ::sal_Bool GetsOwnership ) throw (util::CloseVetoException, uno::RuntimeException)
-+{
-+ // it can cancel the close, but need to throw a CloseVetoException, and it will be transmit to caller.
-+}
-+void SAL_CALL
-+VbaEventsListener::notifyClosing( const lang::EventObject& Source ) throw (uno::RuntimeException)
-+{
-+ OSL_TRACE("VbaEventsListener::notifyClosing");
-+ stopEventsLinstener();
-+}
-+void SAL_CALL
-+VbaEventsListener::borderWidthsChanged( const uno::Reference< uno::XInterface >& aObject, const frame::BorderWidths& aNewSize ) throw (uno::RuntimeException)
-+{
-+ // work with WindowResized event to guard Window Resize event.
-+ OSL_TRACE("VbaEventsListener::borderWidthsChanged");
-+ m_bBorderChanged = sal_True;
-+ Window* pWindow = (VCLUnoHelper::GetWindow( GetContainerWindow() ) );
-+ if( pWindow && !m_bPrepare && m_bWindowResized )
-+ {
-+ m_bPrepare = sal_True;
-+ m_bWindowResized = m_bBorderChanged = sal_False;
-+ AutoTimer* pTimer = new AutoTimer();
-+ pTimer->SetTimeoutHdl( LINK( this, VbaEventsListener, fireResizeMacro ) );
-+ pTimer->Start();
-+ }
-+}
-+
-+class ImplVbaEventNameInfo
-+{
-+private:
-+ map< sal_Int32, rtl::OUString > m_aEventNameMap;
-+
-+protected:
-+ static ImplVbaEventNameInfo* pImplVbaEventNameInfo;
-+ ImplVbaEventNameInfo() { InitImplVbaEventNameInfo(); }
-+private:
-+ void insert( const sal_Int32 nId, const rtl::OUString sEventName )
-+ {
-+ m_aEventNameMap.insert( make_pair( nId, sEventName ) );
-+ }
-+ void InitImplVbaEventNameInfo();
-+public:
-+ virtual ~ImplVbaEventNameInfo();
-+ rtl::OUString getEventName( const sal_Int32 nId )
-+ {
-+ map< sal_Int32, rtl::OUString >::iterator iter = m_aEventNameMap.find( nId );
-+ if( iter != m_aEventNameMap.end() )
-+ return iter->second;
-+ return rtl::OUString();
-+ }
-+ static ImplVbaEventNameInfo* GetImplVbaEventNameInfo();
-+};
-+ImplVbaEventNameInfo* ImplVbaEventNameInfo::pImplVbaEventNameInfo = NULL;
-+
-+ImplVbaEventNameInfo::~ImplVbaEventNameInfo()
-+{
-+ if( pImplVbaEventNameInfo )
-+ {
-+ delete pImplVbaEventNameInfo;
-+ pImplVbaEventNameInfo = NULL;
-+ }
-+}
-+
-+ImplVbaEventNameInfo*
-+ImplVbaEventNameInfo::GetImplVbaEventNameInfo()
-+{
-+ if( !pImplVbaEventNameInfo )
-+ {
-+ pImplVbaEventNameInfo = new ImplVbaEventNameInfo;
-+ }
-+ return pImplVbaEventNameInfo;
-+}
-+
-+#define CREATEOUSTRING(asciistr) rtl::OUString::createFromAscii(asciistr)
-+
-+#define INSERT_EVENT_INFO( Object, Event, ObjectName, EventName ) \
-+ insert( VBAEVENT_##Object##_##Event, ObjectName + CREATEOUSTRING( EventName ) )
-+
-+#define INSERT_WORKSHEET_EVENT_INFO( Event, EventName ) \
-+ INSERT_EVENT_INFO( WORKSHEET, Event,CREATEOUSTRING("Worksheet_"), EventName ); \
-+ INSERT_EVENT_INFO( WORKBOOK_SHEET, Event, CREATEOUSTRING("Workbook_Sheet"), EventName )
-+
-+#define INSERT_WORKBOOK_EVENT_INFO( Event, EventName ) \
-+ INSERT_EVENT_INFO( WORKBOOK, Event, CREATEOUSTRING("Workbook_"), EventName )
-+
-+void ImplVbaEventNameInfo::InitImplVbaEventNameInfo()
-+{
-+ INSERT_WORKSHEET_EVENT_INFO( ACTIVATE, "Activate");
-+ INSERT_WORKSHEET_EVENT_INFO( BEFOREDOUBLECLICK, "BeforeDoubleClick" );
-+ INSERT_WORKSHEET_EVENT_INFO( BEFORERIGHTCLICK, "BeforeRightClick" );
-+ INSERT_WORKSHEET_EVENT_INFO( CALCULATE, "Calculate" );
-+ INSERT_WORKSHEET_EVENT_INFO( CHANGE, "Change" );
-+ INSERT_WORKSHEET_EVENT_INFO( DEACTIVATE, "Deactivate" );
-+ INSERT_WORKSHEET_EVENT_INFO( FOLLOWHYPERLINK, "FollowHyperlink" );
-+ INSERT_WORKSHEET_EVENT_INFO( PIVOTTABLEUPDATE, "PivotTableUpdate" );
-+ INSERT_WORKSHEET_EVENT_INFO( SELECTIONCHANGE, "SelectionChange" );
-+
-+ // Workbook
-+ INSERT_WORKBOOK_EVENT_INFO( ACTIVATE, "Activate" );
-+ INSERT_WORKBOOK_EVENT_INFO( DEACTIVATE, "Deactivate" );
-+ INSERT_WORKBOOK_EVENT_INFO( OPEN, "Open" );
-+ // AUTOOPEN doesn't be used. TODO, this should be "auto_open"
-+ INSERT_WORKBOOK_EVENT_INFO( BEFORECLOSE, "BeforeClose" );
-+ INSERT_WORKBOOK_EVENT_INFO( BEFOREPRINT, "BeforePrint" );
-+ INSERT_WORKBOOK_EVENT_INFO( BEFORESAVE, "BeforeSave" );
-+ INSERT_WORKBOOK_EVENT_INFO( NEWSHEET, "NewSheet" );
-+ INSERT_WORKBOOK_EVENT_INFO( WINDOWACTIVATE, "WindowActivate" );
-+ INSERT_WORKBOOK_EVENT_INFO( WINDOWDEACTIVATE, "WindowDeactivate" );
-+ INSERT_WORKBOOK_EVENT_INFO( WINDOWRESIZE, "WindowResize" );
-+}
-+
-+ScVbaEventsHelper::ScVbaEventsHelper( uno::Sequence< css::uno::Any > const& aArgs, uno::Reference< uno::XComponentContext > const& xContext )
-+ : m_xContext( xContext ), mpVbaEventsListener( NULL ), mbOpened( sal_False ), mbIgnoreEvents( sal_False )
-+{
-+ uno::Reference< frame::XModel > xModel ( getXSomethingFromArgs< frame::XModel >( aArgs, 0 ), uno::UNO_QUERY );
-+ ScDocShell* pDocShell = getDocShell( xModel );
-+ pDoc = pDocShell->GetDocument();
-+}
-+
-+ScVbaEventsHelper::~ScVbaEventsHelper()
-+{
-+ if( mpVbaEventsListener )
-+ {
-+ mpVbaEventsListener = NULL;
-+ }
-+}
-+
-+rtl::OUString
-+ScVbaEventsHelper::getEventName( const sal_Int32 nId )
-+{
-+ rtl::OUString sEventName;
-+ ImplVbaEventNameInfo* pEventInfo = ImplVbaEventNameInfo::GetImplVbaEventNameInfo();
-+ if( pEventInfo )
-+ sEventName = pEventInfo->getEventName( nId );
-+ return sEventName;
-+}
-+
-+// Treat the args as possible inouts ( convertion at bottom of method )
-+sal_Bool ScVbaEventsHelper::executeMacro( SfxObjectShell* pShell, const String& sMacroName, uno::Sequence< uno::Any >& aArgs, uno::Any& aRet )
-+{
-+ // until ObjectModules ( and persisting of codenames ) is supported, if this is a
-+ // document saved from XL then we won't be able to determine the codename for the Workbook
-+ // Module, so... we have no choice but to search all modules for the moment, thus the macro
-+ // passed in should be the fully specified name.
-+ rtl::OUString sUrl = sUrlPart0.concat( sMacroName ).concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".") ) ).concat( sUrlPart2 ) ;
-+ uno::Sequence< sal_Int16 > aOutArgsIndex;
-+ uno::Sequence< uno::Any > aOutArgs;
-+ ErrCode nErr = pShell->CallXScript( sUrl, aArgs, aRet,
-+ aOutArgsIndex, aOutArgs, sal_False );
-+
-+ // Script Executed?
-+ if ( nErr != ERRCODE_NONE )
-+ return sal_False;
-+
-+ sal_Int32 nLen = aOutArgs.getLength();
-+ // convert any out params to seem like they were inouts
-+ if ( nLen )
-+ {
-+ for ( sal_Int32 index=0; index < nLen; ++index )
-+ {
-+ sal_Int32 nOutIndex = aOutArgsIndex[ index ];
-+ aArgs[ nOutIndex ] = aOutArgs[ index ];
-+ }
-+
-+ }
-+ return sal_True;
-+}
-+String ScVbaEventsHelper::workbookMacroExists( SfxObjectShell* pShell, const String& sMod, const String& sMacro )
-+{
-+ String sFullName;
-+ // would use the script provider to see if the macro exists but
-+ // called at this stage tdoc content handler stuff is not set up
-+ // so it fails
-+
-+ BasicManager* pBasicMgr = pShell-> GetBasicManager();
-+ if ( pBasicMgr )
-+ {
-+ StarBASIC* pBasic = pBasicMgr->GetLib( sLibrary );
-+ if ( !pBasic )
-+ {
-+ USHORT nId = pBasicMgr->GetLibId( sLibrary );
-+ pBasicMgr->LoadLib( nId );
-+ pBasic = pBasicMgr->GetLib( sLibrary );
-+ }
-+ if ( pBasic )
-+ {
-+ if ( sMod.Len() ) // we wish to find the macro is a specific module
-+ {
-+ SbModule* pModule = pBasic->FindModule( sMod );
-+ if ( pModule )
-+ {
-+ SbxArray* pMethods = pModule->GetMethods();
-+ if ( pMethods )
-+ {
-+ SbMethod* pMethod = static_cast< SbMethod* >( pMethods->Find( sMacro, SbxCLASS_METHOD ) );
-+ if ( pMethod )
-+ {
-+ sFullName = sMacro;
-+ sFullName.Insert( '.', 0 ).Insert( sMod, 0 ).Insert( '.', 0 ).Insert( sLibrary, 0 );
-+ }
-+ }
-+ }
-+ }
-+ else if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pBasic->Find( sMacro, SbxCLASS_METHOD ) ) )
-+ {
-+ if( SbModule* pModule = pMethod->GetModule() )
-+ {
-+ sFullName = sMacro;
-+ sFullName.Insert( '.', 0 ).Insert( pModule->GetName(), 0).Insert( '.', 0 ).Insert( sLibrary, 0 );
-+ }
-+ }
-+
-+ }
-+ }
-+ return sFullName;
-+}
-+
-+uno::Any ScVbaEventsHelper::createWorkSheet( SfxObjectShell* pShell, SCTAB nTab )
-+{
-+ uno::Any aRet;
-+ try
-+ {
-+ uno::Reference< lang::XMultiComponentFactory > xSMgr( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xProps( xSMgr, uno::UNO_QUERY_THROW );
-+ uno::Reference<uno::XComponentContext > xCtx( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
-+ // Eventually we will be able to pull the Workbook/Worksheet objects
-+ // directly from basic and register them as listeners
-+
-+ // create Workbook
-+ uno::Sequence< uno::Any > aArgs(2);
-+ aArgs[0] = uno::Any( uno::Reference< uno::XInterface >() );
-+ aArgs[1] = uno::Any( pShell->GetModel() );
-+ uno::Reference< uno::XInterface > xWorkbook( xSMgr->createInstanceWithArgumentsAndContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Workbook") ), aArgs, xCtx ), uno::UNO_QUERY );
-+
-+ // create WorkSheet
-+ String sSheetName;
-+ pDoc->GetName( nTab, sSheetName );
-+ aArgs = uno::Sequence< uno::Any >(3);
-+ aArgs[ 0 ] <<= xWorkbook;
-+ aArgs[ 1 ] <<= pShell->GetModel();
-+ aArgs[ 2 ] = uno::makeAny( rtl::OUString( sSheetName ) );
-+ aRet <<= xSMgr->createInstanceWithArgumentsAndContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Worksheet") ), aArgs, xCtx );
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ }
-+ return aRet;
-+}
-+
-+uno::Any ScVbaEventsHelper::createRange( const uno::Any& aRange )
-+{
-+ uno::Any aRet;
-+ try
-+ {
-+ uno::Reference< sheet::XSheetCellRangeContainer > xRanges( aRange, uno::UNO_QUERY );
-+ uno::Reference< table::XCellRange > xRange( aRange, uno::UNO_QUERY );
-+ uno::Reference< lang::XMultiComponentFactory > xSMgr( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xProps( xSMgr, uno::UNO_QUERY_THROW );
-+ if ( xRanges.is() || xRange.is() )
-+ {
-+ uno::Reference<uno::XComponentContext > xCtx( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
-+ uno::Sequence< uno::Any > aArgs(2);
-+ aArgs[0] = uno::Any( uno::Reference< uno::XInterface >() ); // dummy parent
-+ if ( xRanges.is() )
-+ {
-+ aArgs[1] <<= xRanges;
-+ }
-+ else if ( xRange.is() )
-+ {
-+ aArgs[1] <<= xRange;
-+ }
-+ else
-+ {
-+ throw uno::RuntimeException(); //
-+ }
-+ aRet <<= xSMgr->createInstanceWithArgumentsAndContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Range") ), aArgs, xCtx );
-+ }
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ }
-+ return aRet;
-+}
-+
-+uno::Any ScVbaEventsHelper::createHyperlink( const uno::Any& rCell )
-+{
-+ uno::Any aRet;
-+ try
-+ {
-+ uno::Reference< lang::XMultiComponentFactory > xSMgr( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xProps( xSMgr, uno::UNO_QUERY_THROW );
-+ uno::Reference< table::XCell > xCell( rCell, uno::UNO_QUERY );
-+ if( xCell.is() )
-+ {
-+ uno::Reference<uno::XComponentContext > xCtx( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), uno::UNO_QUERY_THROW );
-+ uno::Sequence< uno::Any > aArgs(2);
-+ aArgs[0] = uno::Any( uno::Reference< uno::XInterface >() ); // dummy parent
-+ aArgs[1] <<= rCell;
-+
-+ aRet <<= xSMgr->createInstanceWithArgumentsAndContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Hyperlink") ), aArgs, xCtx );
-+ }
-+ else
-+ {
-+ throw uno::RuntimeException(); //
-+ }
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ }
-+ return aRet;
-+}
-+
-+uno::Any ScVbaEventsHelper::createWindow( SfxObjectShell* pShell )
-+{
-+ try
-+ {
-+ uno::Reference< lang::XMultiServiceFactory > xSF( comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
-+ uno::Reference< frame::XModel > xModel( pShell->GetModel(), uno::UNO_QUERY );
-+ uno::Sequence< uno::Any > aWindowArgs(2);
-+ aWindowArgs[0] = uno::Any( uno::Reference< uno::XInterface > () );
-+ aWindowArgs[1] = uno::Any( xModel );
-+ uno::Reference< uno::XInterface > xWindow( xSF->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Window" ) ), aWindowArgs ), uno::UNO_QUERY );
-+ if( xWindow.is() )
-+ return uno::makeAny( xWindow );
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ }
-+ return uno::Any();
-+}
-+
-+String ScVbaEventsHelper::getSheetModuleName( SCTAB nTab )
-+{
-+ ScExtDocOptions* pExtOptions = pDoc->GetExtDocOptions();
-+ String aCodeName;
-+ pDoc->GetName( nTab, aCodeName);
-+ // Use code name if that exists
-+ if ( pExtOptions )
-+ aCodeName = pExtOptions->GetCodeName( nTab );
-+ return aCodeName;
-+}
-+
-+rtl::OUString
-+ScVbaEventsHelper::getMacroPath( const sal_Int32 nEventId, const SCTAB nTab )
-+{
-+ SfxObjectShell* pShell = pDoc->GetDocumentShell();
-+ rtl::OUString sMacroPath;
-+ rtl::OUString sMacroName = getEventName( nEventId );
-+ switch( nEventId )
-+ {
-+ // Worksheet
-+ case VBAEVENT_WORKSHEET_ACTIVATE :
-+ case VBAEVENT_WORKSHEET_BEFOREDOUBLECLICK :
-+ case VBAEVENT_WORKSHEET_BEFORERIGHTCLICK :
-+ case VBAEVENT_WORKSHEET_CALCULATE :
-+ case VBAEVENT_WORKSHEET_CHANGE :
-+ case VBAEVENT_WORKSHEET_DEACTIVATE :
-+ case VBAEVENT_WORKSHEET_FOLLOWHYPERLINK :
-+ case VBAEVENT_WORKSHEET_PIVOTTABLEUPDATE :
-+ case VBAEVENT_WORKSHEET_SELECTIONCHANGE :
-+ {
-+ rtl::OUString aSheetModuleName = getSheetModuleName( nTab );
-+ sMacroPath = workbookMacroExists( pShell, aSheetModuleName, sMacroName );
-+ break;
-+ }
-+ // Workbook
-+ case VBAEVENT_WORKBOOK_ACTIVATE :
-+ case VBAEVENT_WORKBOOK_DEACTIVATE :
-+ case VBAEVENT_WORKBOOK_OPEN :
-+ case VBAEVENT_WORKBOOK_AUTOOPEN :
-+ case VBAEVENT_WORKBOOK_BEFORECLOSE :
-+ case VBAEVENT_WORKBOOK_BEFOREPRINT :
-+ case VBAEVENT_WORKBOOK_BEFORESAVE :
-+ case VBAEVENT_WORKBOOK_NEWSHEET :
-+ case VBAEVENT_WORKBOOK_WINDOWACTIVATE :
-+ case VBAEVENT_WORKBOOK_WINDOWDEACTIVATE :
-+ case VBAEVENT_WORKBOOK_WINDOWRESIZE :
-+ // Workbook_sheet
-+ case VBAEVENT_WORKBOOK_SHEET_ACTIVATE :
-+ case VBAEVENT_WORKBOOK_SHEET_BEFOREDOUBLECLICK :
-+ case VBAEVENT_WORKBOOK_SHEET_BEFORERIGHTCLICK :
-+ case VBAEVENT_WORKBOOK_SHEET_CALCULATE :
-+ case VBAEVENT_WORKBOOK_SHEET_CHANGE :
-+ case VBAEVENT_WORKBOOK_SHEET_DEACTIVATE :
-+ case VBAEVENT_WORKBOOK_SHEET_FOLLOWHYPERLINK :
-+ case VBAEVENT_WORKBOOK_SHEET_PIVOTTABLEUPDATE :
-+ case VBAEVENT_WORKBOOK_SHEET_SELECTIONCHANGE :
-+ {
-+ ScExtDocOptions* pExtOptions = pDoc->GetExtDocOptions();
-+ String sWorkbookModuleName = pDoc->GetCodeName();
-+ if( pExtOptions )
-+ {
-+ ScExtDocSettings aExtDocSettings = pExtOptions->GetDocSettings();
-+ sWorkbookModuleName = aExtDocSettings.maGlobCodeName;
-+ }
-+
-+ sMacroPath = workbookMacroExists( pShell, sWorkbookModuleName, sMacroName );
-+ break;
-+ }
-+ default:
-+ break;
-+ }
-+ return sMacroPath;
-+}
-+
-+sal_Bool ScVbaEventsHelper::processVbaEvent( const sal_Int32 nEventId, const uno::Sequence< uno::Any >& rArgs, const SCTAB nTab )
-+{
-+ SfxObjectShell* pShell = pDoc->GetDocumentShell();
-+
-+ sal_Bool result = sal_False;
-+ sal_Bool bCancel = sal_False;
-+ uno::Sequence< uno::Any > aArgs;
-+ uno::Any aRet;
-+
-+ // For most cases, there is no corresponsible event macro in the document.
-+ // It is better fo check if the event macro exists before process the arguments to improve performance.
-+ rtl::OUString sMacroPath = getMacroPath( nEventId, nTab );
-+ if( sMacroPath.getLength() )
-+ {
-+ switch( nEventId )
-+ {
-+ case VBAEVENT_WORKSHEET_ACTIVATE:
-+ case VBAEVENT_WORKSHEET_CALCULATE:
-+ case VBAEVENT_WORKSHEET_DEACTIVATE:
-+ case VBAEVENT_WORKBOOK_ACTIVATE:
-+ case VBAEVENT_WORKBOOK_DEACTIVATE:
-+ case VBAEVENT_WORKBOOK_OPEN:
-+ {
-+ // no arguments
-+ break;
-+ }
-+ case VBAEVENT_WORKBOOK_SHEET_DEACTIVATE:
-+ case VBAEVENT_WORKBOOK_SHEET_CALCULATE:
-+ case VBAEVENT_WORKBOOK_SHEET_ACTIVATE:
-+ case VBAEVENT_WORKBOOK_NEWSHEET:
-+ {
-+ aArgs = uno::Sequence< uno::Any >(1);
-+ aArgs[0] = createWorkSheet( pShell, nTab );
-+ break;
-+ }
-+ case VBAEVENT_WORKSHEET_CHANGE:
-+ case VBAEVENT_WORKSHEET_SELECTIONCHANGE:
-+ {
-+ // one argument: range
-+ uno::Any aRange = createRange( rArgs[0] );
-+ aArgs = uno::Sequence< uno::Any >(1);
-+ aArgs[0] = aRange;
-+ break;
-+ }
-+ case VBAEVENT_WORKBOOK_SHEET_CHANGE:
-+ case VBAEVENT_WORKBOOK_SHEET_SELECTIONCHANGE:
-+ {
-+ uno::Any aRange = createRange( rArgs[0] );
-+ aArgs = uno::Sequence< uno::Any >(2);
-+ aArgs[0] = createWorkSheet( pShell, nTab );
-+ aArgs[1] = aRange;
-+ break;
-+ }
-+ case VBAEVENT_WORKSHEET_BEFOREDOUBLECLICK:
-+ case VBAEVENT_WORKSHEET_BEFORERIGHTCLICK:
-+ {
-+ // two aruments: range and cancel
-+ uno::Any aRange = createRange( rArgs[0] );
-+ aArgs = uno::Sequence< uno::Any >(2);
-+ aArgs[0] = aRange;
-+ aArgs[1] <<= bCancel;
-+ // TODO: process "cancel" action
-+ break;
-+ }
-+ case VBAEVENT_WORKBOOK_SHEET_BEFOREDOUBLECLICK:
-+ case VBAEVENT_WORKBOOK_SHEET_BEFORERIGHTCLICK:
-+ {
-+ uno::Any aRange = createRange( rArgs[0] );
-+ aArgs = uno::Sequence< uno::Any >(3);
-+ aArgs[0] = createWorkSheet( pShell, nTab );
-+ aArgs[1] = aRange;
-+ aArgs[2] <<= bCancel;
-+ // TODO: process "cancel" action
-+ break;
-+ }
-+ case VBAEVENT_WORKSHEET_FOLLOWHYPERLINK:
-+ {
-+ // one argument: hyperlink
-+ uno::Any aHyperlink = createHyperlink( rArgs[0] );
-+ aArgs = uno::Sequence< uno::Any >(1);
-+ aArgs[0] = aHyperlink;
-+ break;
-+ }
-+ case VBAEVENT_WORKBOOK_SHEET_FOLLOWHYPERLINK:
-+ {
-+ uno::Any aHyperlink = createHyperlink( rArgs[0] );
-+ aArgs = uno::Sequence< uno::Any >(2);
-+ aArgs[0] = createWorkSheet( pShell, nTab );
-+ aArgs[1] = aHyperlink;
-+ break;
-+ }
-+ case VBAEVENT_WORKSHEET_PIVOTTABLEUPDATE:
-+ case VBAEVENT_WORKBOOK_SHEET_PIVOTTABLEUPDATE:
-+ {
-+ // one argument: pivottable
-+ // TODO: not support yet
-+ return result;
-+ }
-+ case VBAEVENT_WORKBOOK_BEFORECLOSE:
-+ case VBAEVENT_WORKBOOK_BEFOREPRINT:
-+ {
-+ // process Cancel argument
-+ aArgs = uno::Sequence< uno::Any >(1);
-+ aArgs[0] <<= bCancel;
-+ executeMacro( pShell, sMacroPath, aArgs, aRet );
-+ aArgs[0] >>= bCancel;
-+ return bCancel;
-+ }
-+ case VBAEVENT_WORKBOOK_BEFORESAVE:
-+ {
-+ // two arguments: SaveAs and Cancel
-+ aArgs = uno::Sequence< uno::Any >(2);
-+ aArgs[0] = rArgs[0];
-+ aArgs[1] <<= bCancel;
-+ executeMacro( pShell, sMacroPath, aArgs, aRet );
-+ aArgs[1] >>= bCancel;
-+ return bCancel;
-+ }
-+ case VBAEVENT_WORKBOOK_WINDOWACTIVATE:
-+ case VBAEVENT_WORKBOOK_WINDOWDEACTIVATE:
-+ case VBAEVENT_WORKBOOK_WINDOWRESIZE:
-+ {
-+ // one argument: windows
-+ aArgs = uno::Sequence< uno::Any >(1);
-+ aArgs[0] = createWindow( pShell );
-+ break;
-+ }
-+ default:
-+ return result;
-+ }
-+
-+ // excute the macro
-+ result = executeMacro( pShell, sMacroPath, aArgs, aRet );
-+ }
-+
-+ return result;
-+}
-+
-+SCTAB ScVbaEventsHelper::getTabFromArgs( const uno::Sequence< uno::Any > aArgs, const sal_Int32 nPos )
-+{
-+ SCTAB nTab = -1;
-+ uno::Reference< sheet::XCellRangeAddressable > xCellRangeAddressable( getXSomethingFromArgs< sheet::XCellRangeAddressable >( aArgs, nPos ), uno::UNO_QUERY );
-+ if( xCellRangeAddressable.is() )
-+ {
-+ table::CellRangeAddress aAddress = xCellRangeAddressable->getRangeAddress();
-+ nTab = aAddress.Sheet;
-+ }
-+ return nTab;
-+}
-+
-+sal_Bool SAL_CALL
-+ScVbaEventsHelper::ProcessCompatibleVbaEvent( sal_Int32 nEventId, const uno::Sequence< uno::Any >& aArgs ) throw (uno::RuntimeException)
-+{
-+ SfxObjectShell* pShell = pDoc->GetDocumentShell();
-+ if( !pShell || mbIgnoreEvents)
-+ return sal_False;
-+
-+ // In order to better support "withevents" in the future,
-+ // it is better to process a event at a time
-+ SCTAB nTab = INVALID_TAB;
-+ switch( nEventId )
-+ {
-+ // Worksheet
-+ case VBAEVENT_WORKSHEET_ACTIVATE:
-+ {
-+ aArgs[0] >>= nTab;
-+ if( nTab != INVALID_TAB )
-+ {
-+ // process the event
-+ processVbaEvent( nEventId, aArgs, nTab );
-+ // recursive process related workbook sheet event.
-+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_SHEET_ACTIVATE, aArgs );
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKSHEET_BEFOREDOUBLECLICK:
-+ {
-+ nTab = getTabFromArgs( aArgs );
-+ if( nTab != INVALID_TAB )
-+ {
-+ processVbaEvent( nEventId, aArgs, nTab );
-+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_SHEET_BEFOREDOUBLECLICK, aArgs );
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKSHEET_BEFORERIGHTCLICK:
-+ {
-+ nTab = getTabFromArgs( aArgs );
-+ if( nTab != INVALID_TAB )
-+ {
-+ processVbaEvent( nEventId, aArgs, nTab );
-+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_SHEET_BEFORERIGHTCLICK, aArgs );
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKSHEET_CALCULATE:
-+ {
-+ aArgs[0] >>= nTab;
-+ if( nTab != INVALID_TAB )
-+ {
-+ processVbaEvent( nEventId, aArgs, nTab );
-+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_SHEET_CALCULATE, aArgs );
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKSHEET_CHANGE:
-+ {
-+ nTab = getTabFromArgs( aArgs );
-+ if( nTab != INVALID_TAB )
-+ {
-+ processVbaEvent( nEventId, aArgs, nTab );
-+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_SHEET_CHANGE, aArgs );
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKSHEET_DEACTIVATE:
-+ {
-+ aArgs[0] >>= nTab;
-+ if( nTab != INVALID_TAB )
-+ {
-+ processVbaEvent( nEventId, aArgs, nTab );
-+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_SHEET_DEACTIVATE, aArgs );
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKSHEET_FOLLOWHYPERLINK:
-+ {
-+ nTab = getTabFromArgs( aArgs );
-+ if( nTab != INVALID_TAB )
-+ {
-+ processVbaEvent( nEventId, aArgs, nTab );
-+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_SHEET_FOLLOWHYPERLINK, aArgs );
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKSHEET_PIVOTTABLEUPDATE:
-+ // TODO
-+ break;
-+ case VBAEVENT_WORKSHEET_SELECTIONCHANGE:
-+ {
-+ nTab = getTabFromArgs( aArgs );
-+ if( nTab != INVALID_TAB )
-+ {
-+ processVbaEvent( nEventId, aArgs, nTab );
-+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_SHEET_SELECTIONCHANGE, aArgs );
-+ }
-+ break;
-+ }
-+ // Workbook_sheet
-+ case VBAEVENT_WORKBOOK_SHEET_ACTIVATE:
-+ case VBAEVENT_WORKBOOK_SHEET_CALCULATE:
-+ case VBAEVENT_WORKBOOK_SHEET_DEACTIVATE:
-+ {
-+ aArgs[0] >>= nTab;
-+ if( nTab != INVALID_TAB )
-+ {
-+ processVbaEvent( nEventId, aArgs, nTab );
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKBOOK_SHEET_BEFOREDOUBLECLICK:
-+ case VBAEVENT_WORKBOOK_SHEET_BEFORERIGHTCLICK:
-+ case VBAEVENT_WORKBOOK_SHEET_CHANGE:
-+ case VBAEVENT_WORKBOOK_SHEET_FOLLOWHYPERLINK:
-+ case VBAEVENT_WORKBOOK_SHEET_SELECTIONCHANGE:
-+ {
-+ nTab = getTabFromArgs( aArgs );
-+ if( nTab != INVALID_TAB )
-+ {
-+ processVbaEvent( nEventId, aArgs, nTab );
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKBOOK_SHEET_PIVOTTABLEUPDATE:
-+ // TODO
-+ break;
-+ // Workbook
-+ case VBAEVENT_WORKBOOK_ACTIVATE:
-+ {
-+ // if workbook open event do not be fired. fired it before
-+ // workbook activate event to compatible with MSO.
-+ if( mbOpened )
-+ {
-+ // process workbook activate event
-+ processVbaEvent( nEventId, aArgs );
-+ // process workbook window activate event at the same time
-+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_WINDOWACTIVATE, aArgs );
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKBOOK_DEACTIVATE:
-+ {
-+ processVbaEvent( nEventId, aArgs );
-+ // same as workbook window deactivate
-+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_WINDOWDEACTIVATE, aArgs );
-+ break;
-+ }
-+ case VBAEVENT_WORKBOOK_OPEN:
-+ {
-+ // process workbook open macro
-+ // does auto open work here?
-+ if( !mbOpened )
-+ {
-+ processVbaEvent( nEventId, aArgs );
-+ mbOpened = sal_True;
-+ ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_ACTIVATE, aArgs );
-+ }
-+ // register the window listener.
-+ if( !mpVbaEventsListener )
-+ {
-+ mpVbaEventsListener = new VbaEventsListener( this );
-+ mpVbaEventsListener->startEventsLinstener();
-+ }
-+ break;
-+ }
-+ case VBAEVENT_WORKBOOK_AUTOOPEN:
-+ // TODO
-+ break;
-+ case VBAEVENT_WORKBOOK_BEFORECLOSE:
-+ {
-+ sal_Bool bCancel = processVbaEvent( nEventId, aArgs );
-+ if( mpVbaEventsListener && !bCancel )
-+ {
-+ mpVbaEventsListener->stopEventsLinstener();
-+ mpVbaEventsListener = NULL;
-+ }
-+ return bCancel;
-+ }
-+ case VBAEVENT_WORKBOOK_BEFOREPRINT:
-+ case VBAEVENT_WORKBOOK_BEFORESAVE:
-+ case VBAEVENT_WORKBOOK_WINDOWACTIVATE:
-+ case VBAEVENT_WORKBOOK_WINDOWDEACTIVATE:
-+ case VBAEVENT_WORKBOOK_WINDOWRESIZE:
-+ {
-+ return processVbaEvent( nEventId, aArgs );
-+ }
-+ case VBAEVENT_WORKBOOK_NEWSHEET:
-+ {
-+ aArgs[0] >>= nTab;
-+ if( nTab != INVALID_TAB )
-+ {
-+ processVbaEvent( nEventId, aArgs, nTab );
-+ }
-+ break;
-+ }
-+ default:
-+ OSL_TRACE( "Invalid Event" );
-+ }
-+
-+ return sal_True;
-+}
-+
-+::sal_Bool SAL_CALL
-+ScVbaEventsHelper::getIgnoreEvents() throw (uno::RuntimeException)
-+{
-+ return mbIgnoreEvents;
-+}
-+
-+void SAL_CALL
-+ScVbaEventsHelper::setIgnoreEvents( ::sal_Bool _ignoreevents ) throw (uno::RuntimeException)
-+{
-+ mbIgnoreEvents = _ignoreevents;
-+}
-+
-+
-+namespace vbaeventshelper
-+{
-+namespace sdecl = comphelper::service_decl;
-+sdecl::class_<ScVbaEventsHelper, sdecl::with_args<true> > serviceImpl;
-+extern sdecl::ServiceDecl const serviceDecl(
-+ serviceImpl,
-+ "ScVbaEventsHelper",
-+ "com.sun.star.document.VbaEventsHelper" );
-+}
---- sc/inc/document.hxx.old 2009-04-06 16:41:59.000000000 +0000
-+++ sc/inc/document.hxx 2009-04-06 16:42:00.000000000 +0000
-@@ -157,6 +157,9 @@ namespace com { namespace sun { namespac
- }
- } } }
-
-+namespace com { namespace sun { namespace star { namespace document {
-+ class XVbaEventsHelper;
-+} } } }
- #include <svtools/zforlist.hxx>
- /*
- #ifdef _ZFORLIST_DECLARE_TABLE
-@@ -319,6 +322,8 @@ private:
-
- Timer aTrackTimer;
-
-+ com::sun::star::uno::Reference< com::sun::star::document::XVbaEventsHelper > mxVbaEventsHelper;
-+
- public:
- ScTabOpList aTableOpList; // list of ScInterpreterTableOpParams currently in use
- ScInterpreterTableOpParams aLastTableOpParams; // remember last params
-@@ -1707,6 +1712,8 @@ public:
- void GetSortParam( ScSortParam& rParam, SCTAB nTab );
- void SetSortParam( ScSortParam& rParam, SCTAB nTab );
-
-+ com::sun::star::uno::Reference< com::sun::star::document::XVbaEventsHelper > GetVbaEventsHelper();
-+
- /** Should only be GRAM_PODF or GRAM_ODFF. */
- void SetStorageGrammar( formula::FormulaGrammar::Grammar eGrammar );
- formula::FormulaGrammar::Grammar GetStorageGrammar() const
---- sc/source/core/data/documen2.cxx
-+++ sc/source/core/data/documen2.cxx
-@@ -96,6 +96,7 @@
- #include "externalrefmgr.hxx"
- #include "tabprotection.hxx"
- #include "formulaparserpool.hxx"
- #include "clipparam.hxx"
-+#include <com/sun/star/document/XVbaEventsHelper.hpp>
-
- // pImpl because including lookupcache.hxx in document.hxx isn't wanted, and
-@@ -1267,6 +1268,29 @@ void ScDocument::RemoveLookupCache( ScLo
- }
- }
-
-+using namespace com::sun::star;
-+uno::Reference< document::XVbaEventsHelper >
-+ScDocument::GetVbaEventsHelper()
-+{
-+ if( !mxVbaEventsHelper.is() )
-+ {
-+ try
-+ {
-+ uno::Reference< lang::XMultiServiceFactory > xSF( comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
-+ uno::Reference< frame::XModel > xModel( pShell ? pShell->GetModel() : NULL, uno::UNO_QUERY );
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] = uno::Any( xModel );
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper( xSF->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.VbaEventsHelper" ) ), aArgs ), uno::UNO_QUERY );
-+ // helper will always be created successfully.
-+ mxVbaEventsHelper.set( xVbaEventsHelper, uno::UNO_QUERY );
-+ }
-+ catch( uno::Exception& e )
-+ {
-+ }
-+ }
-+ return mxVbaEventsHelper;
-+}
-+
- void ScDocument::ClearLookupCaches()
- {
- if( pLookupCacheMapImpl )
---- sc/source/ui/docshell/docsh.cxx.old 2009-04-06 16:41:50.000000000 +0000
-+++ sc/source/ui/docshell/docsh.cxx 2009-04-06 16:42:00.000000000 +0000
-@@ -127,6 +127,13 @@
- #include <rtl/logfile.hxx>
-
- #include <comphelper/processfactory.hxx>
-+#include "uiitems.hxx"
-+#include "cellsuno.hxx"
-+#include <com/sun/star/document/XVbaEventsHelper.hpp>
-+#include <com/sun/star/document/VbaEventId.hpp>
-+
-+using namespace com::sun::star;
-+using namespace com::sun::star::document::VbaEventId;
-
- using namespace com::sun::star;
-
-@@ -272,7 +279,11 @@ sal_uInt16 ScDocShell::GetHiddenInformat
- void ScDocShell::BeforeXMLLoading()
- {
- aDocument.DisableIdle( TRUE );
--
-+ // suppress VBA events when loading the xml
-+ uno::Reference< document::XVbaEventsHelper > xEvt( aDocument.GetVbaEventsHelper() );
-+ if ( xEvt.is() )
-+ xEvt->setIgnoreEvents( sal_True );
-+
- // prevent unnecessary broadcasts and updates
- DBG_ASSERT(pModificator == NULL, "The Modificator should not exist");
- pModificator = new ScDocShellModificator( *this );
-@@ -357,6 +368,10 @@ void ScDocShell::AfterXMLLoading(sal_Boo
- else
- aDocument.SetInsertingFromOtherDoc( FALSE );
-
-+ // suppress VBA events when loading the xml
-+ uno::Reference< document::XVbaEventsHelper > xEvt( aDocument.GetVbaEventsHelper() );
-+ if ( xEvt.is() )
-+ xEvt->setIgnoreEvents( sal_False );
- aDocument.SetImportingXML( FALSE );
- aDocument.EnableUndo( TRUE );
- bIsEmpty = FALSE;
-@@ -498,9 +513,71 @@ BOOL __EXPORT ScDocShell::Load( SfxMediu
- return bRet;
- }
-
-+void lcl_processCompatibleSfxHint( uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper, const SfxHint& rHint )
-+{
-+ if (rHint.ISA(ScTablesHint) )
-+ {
-+ USHORT nId = ((ScTablesHint&)rHint).GetId();
-+ SCTAB nTab = ((ScTablesHint&)rHint).GetTab1();
-+ if( nId == SC_TAB_INSERTED )
-+ {
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] <<= nTab;
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_NEWSHEET, aArgs );
-+ }
-+ }
-+ else if ( rHint.ISA( SfxEventHint ) )
-+ {
-+ ULONG nEventId = ((SfxEventHint&)rHint).GetEventId();
-+ switch ( nEventId )
-+ {
-+ case SFX_EVENT_ACTIVATEDOC:
-+ {
-+ uno::Sequence< uno::Any > aArgs;
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_ACTIVATE, aArgs );
-+ }
-+ break;
-+ case SFX_EVENT_DEACTIVATEDOC:
-+ {
-+ uno::Sequence< uno::Any > aArgs;
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_DEACTIVATE, aArgs );
-+ }
-+ break;
-+ /*case SFX_EVENT_CLOSEDOC :
-+ {
-+ uno::Sequence< uno::Any > aArgs;
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_CLOSE, aArgs );
-+ }
-+ break;
-+ case SFX_EVENT_CLOSEVIEW :
-+ {
-+ uno::Sequence< uno::Any > aArgs;
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_WINDOWCOLSE, aArgs );
-+ }
-+ break;
-+ */
-+ case SFX_EVENT_OPENDOC:
-+ {
-+ // some later than workbook activate.
-+ uno::Sequence< uno::Any > aArgs;
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_OPEN, aArgs );
-+ }
-+ break;
-+ default:
-+ {
-+ }
-+ break;
-+ }
-+ }
-+}
-
- void __EXPORT ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
- {
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper ( aDocument.GetVbaEventsHelper(), uno::UNO_QUERY );
-+ if ( xVbaEventsHelper.is() )
-+ {
-+ lcl_processCompatibleSfxHint( xVbaEventsHelper, rHint );
-+ }
- if (rHint.ISA(SfxSimpleHint)) // ohne Parameter
- {
- ULONG nSlot = ((const SfxSimpleHint&)rHint).GetId();
-@@ -2144,6 +2221,16 @@ USHORT __EXPORT ScDocShell::PrepareClose
-
- DoEnterHandler();
-
-+ // start handler for possible veto from DocBefore_Close
-+ uno::Sequence< uno::Any > aArgs;
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper ( aDocument.GetVbaEventsHelper(), uno::UNO_QUERY );
-+ if ( !IsInPrepareClose() && xVbaEventsHelper.is() )
-+ {
-+ if ( xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_BEFORECLOSE, aArgs ) )
-+ return sal_False;
-+ }
-+ // end handler code
-+
- USHORT nRet = SfxObjectShell::PrepareClose( bUI, bForBrowsing );
- if (nRet == TRUE) // TRUE = schliessen
- aDocument.DisableIdle(TRUE); // nicht mehr drin rumpfuschen !!!
---- sc/source/ui/inc/docsh.hxx.old 2009-04-06 16:41:53.000000000 +0000
-+++ sc/source/ui/inc/docsh.hxx 2009-04-06 16:42:00.000000000 +0000
-@@ -47,6 +47,7 @@
- #include "refreshtimer.hxx"
-
- #include <hash_map>
-+#include <cppuhelper/implbase1.hxx>
-
- class ScEditEngineDefaulter;
- class FontList;
---- sc/source/ui/unoobj/viewuno.cxx
-+++ sc/source/ui/unoobj/viewuno.cxx
-@@ -71,9 +71,13 @@
- #include "gridwin.hxx"
- #include <com/sun/star/view/DocumentZoomType.hpp>
- #include "AccessibilityHints.hxx"
-+#include <com/sun/star/awt/MouseButton.hpp>
-+#include <com/sun/star/document/XVbaEventsHelper.hpp>
-+#include <com/sun/star/document/VbaEventId.hpp>
- #include <svx/sdrhittesthelper.hxx>
-
- using namespace com::sun::star;
-+using namespace com::sun::star::document::VbaEventId;
-
- //------------------------------------------------------------------------
-
-@@ -458,6 +462,78 @@ void SAL_CALL ScViewPaneObj::release() t
- OWeakObject::release();
- }
-
-+// To process sheet compatibile event
-+typedef ::cppu::WeakImplHelper2< awt::XEnhancedMouseClickHandler, view::XSelectionChangeListener > TabViewEventListener_BASE;
-+class ScTabViewEventListener: public TabViewEventListener_BASE
-+{
-+private:
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper;
-+ ScTabViewObj* pViewObj;
-+
-+public:
-+ ScTabViewEventListener( ScTabViewObj* pObj, uno::Reference< document::XVbaEventsHelper >& rVbaEventsHelper);
-+ ~ScTabViewEventListener();
-+ // XEnhancedMouseClickHandler
-+ virtual sal_Bool SAL_CALL mousePressed( const awt::EnhancedMouseEvent& e ) throw (uno::RuntimeException);
-+ virtual sal_Bool SAL_CALL mouseReleased( const awt::EnhancedMouseEvent& e ) throw (uno::RuntimeException);
-+
-+ // XSelectionChangeListener
-+ virtual void SAL_CALL selectionChanged( const lang::EventObject& aEvent ) throw ( uno::RuntimeException );
-+ // XEventListener
-+ virtual void SAL_CALL disposing( const lang::EventObject& aEvent ) throw ( uno::RuntimeException );
-+};
-+
-+ScTabViewEventListener::ScTabViewEventListener(ScTabViewObj* pObj, uno::Reference< document::XVbaEventsHelper >& rVbaEventsHelper):
-+ pViewObj( pObj ),xVbaEventsHelper( rVbaEventsHelper )
-+{
-+}
-+
-+ScTabViewEventListener::~ScTabViewEventListener()
-+{
-+}
-+
-+void SAL_CALL ScTabViewEventListener::disposing( const lang::EventObject& /*aEvent*/ ) throw ( uno::RuntimeException )
-+{
-+}
-+
-+sal_Bool SAL_CALL ScTabViewEventListener::mousePressed( const awt::EnhancedMouseEvent& e ) throw (uno::RuntimeException)
-+{
-+ sal_Bool result = sal_False;
-+ // process BeforeDoubleClick and BeforeRightClick events
-+ if( e.ClickCount == 2 || e.Buttons == ::com::sun::star::awt::MouseButton::RIGHT )
-+ {
-+ // ensure the target is a cell
-+ uno::Reference< table::XCell > xCell( e.Target, uno::UNO_QUERY );
-+ if( xCell.is() && xVbaEventsHelper.is() && pViewObj)
-+ {
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] = pViewObj->getSelection();
-+ sal_Int32 nEventId = VBAEVENT_WORKSHEET_BEFORERIGHTCLICK;
-+ if( e.ClickCount == 2 )
-+ nEventId = VBAEVENT_WORKSHEET_BEFOREDOUBLECLICK;
-+
-+ result = xVbaEventsHelper->ProcessCompatibleVbaEvent( nEventId, aArgs );
-+ // TODO: process Cancel argument
-+ }
-+ }
-+ return result;
-+}
-+
-+sal_Bool SAL_CALL ScTabViewEventListener::mouseReleased( const awt::EnhancedMouseEvent&/*e*/) throw (uno::RuntimeException)
-+{
-+ return sal_False;
-+}
-+
-+void SAL_CALL ScTabViewEventListener::selectionChanged( const lang::EventObject& /*aEvent*/ ) throw ( uno::RuntimeException )
-+{
-+ if ( xVbaEventsHelper.is() && pViewObj)
-+ {
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] = pViewObj->getSelection();
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKSHEET_SELECTIONCHANGE, aArgs );
-+ }
-+}
-+
- //------------------------------------------------------------------------
-
- // Default-ctor wird fuer SMART_REFLECTION_IMPLEMENTATION gebraucht
-@@ -482,7 +558,19 @@ ScTabViewObj::ScTabViewObj( ScTabViewShe
- bDrawSelModeSet(sal_False),
- bFilteredRangeSelection(sal_True)
- {
-- //! Listening oder so
-+ if( pViewSh )
-+ {
-+ ScViewData* pViewData = pViewSh->GetViewData();
-+ if( pViewData )
-+ {
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper (pViewData->GetDocument()->GetVbaEventsHelper(), uno::UNO_QUERY );
-+ ScTabViewEventListener* pEventListener = new ScTabViewEventListener( this, xVbaEventsHelper );
-+ uno::Reference< awt::XEnhancedMouseClickHandler > aMouseClickHandler( *pEventListener, uno::UNO_QUERY );
-+ addEnhancedMouseClickHandler( aMouseClickHandler );
-+ uno::Reference< view::XSelectionChangeListener > aSelectionChangeListener( *pEventListener, uno::UNO_QUERY );
-+ addSelectionChangeListener( aSelectionChangeListener );
-+ }
-+ }
- }
-
- ScTabViewObj::~ScTabViewObj()
---- sc/source/ui/unoobj/docuno.cxx.old 2009-04-06 16:41:59.000000000 +0000
-+++ sc/source/ui/unoobj/docuno.cxx 2009-04-06 16:42:00.000000000 +0000
-@@ -97,7 +97,10 @@
- #include <svx/unoshape.hxx>
- #endif
-
-+#include <com/sun/star/document/XVbaEventsHelper.hpp>
-+#include <com/sun/star/document/VbaEventId.hpp>
- using namespace com::sun::star;
-+using namespace com::sun::star::document::VbaEventId;
-
- //------------------------------------------------------------------------
-
-@@ -313,6 +316,7 @@ uno::Any SAL_CALL ScModelObj::queryInter
- SC_QUERYINTERFACE( document::XLinkTargetSupplier )
- SC_QUERYINTERFACE( beans::XPropertySet )
- SC_QUERYINTERFACE( document::XCodeNameQuery )
-+ SC_QUERYINTERFACE( document::XDocumentEventCompatibleHelper)
- SC_QUERYINTERFACE( lang::XMultiServiceFactory )
- SC_QUERYINTERFACE( lang::XServiceInfo )
- SC_QUERYINTERFACE( util::XChangesNotifier )
-@@ -1762,6 +1766,39 @@ ScModelObj::getCodeNameForObject( const
- // Probably should throw here ( if !bMatched )
- return sCodeName;
- }
-+// XVbaEventHelper
-+// For Vba Event
-+sal_Bool SAL_CALL
-+ScModelObj::processCompatibleEvent( sal_Int16 nSlotId ) throw( ::com::sun::star::uno::RuntimeException )
-+{
-+ USHORT nId = (USHORT)nSlotId;
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper( GetDocument()->GetVbaEventsHelper(), uno::UNO_QUERY );
-+ if( xVbaEventsHelper.is() )
-+ {
-+ switch( nId )
-+ {
-+ case SID_SAVEDOC:
-+ {
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] <<= sal_False;
-+ return xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_BEFORESAVE, aArgs );
-+ }
-+ case SID_SAVEASDOC:
-+ {
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] <<= sal_True;
-+ return xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_BEFORESAVE, aArgs );
-+ }
-+ case SID_PRINTDOC:
-+ case SID_PRINTDOCDIRECT:
-+ {
-+ uno::Sequence< uno::Any > aArgs;
-+ return xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKBOOK_BEFOREPRINT, aArgs );
-+ }
-+ }
-+ }
-+ return sal_False;
-+}
- // XServiceInfo
-
- rtl::OUString SAL_CALL ScModelObj::getImplementationName() throw(uno::RuntimeException)
---- sc/inc/docuno.hxx.old 2009-04-06 16:41:59.000000000 +0000
-+++ sc/inc/docuno.hxx 2009-04-06 16:42:00.000000000 +0000
-@@ -56,6 +56,7 @@
- #include <com/sun/star/beans/XPropertySet.hpp>
- #include <com/sun/star/sheet/XCellRangesAccess.hpp>
- #include <com/sun/star/util/XChangesNotifier.hpp>
-+#include <com/sun/star/document/XDocumentEventCompatibleHelper.hpp>
- #include <cppuhelper/implbase2.hxx>
- #include <cppuhelper/implbase3.hxx>
- #include <cppuhelper/implbase4.hxx>
-@@ -92,6 +93,7 @@ class SC_DLLPUBLIC ScModelObj : public S
- public com::sun::star::document::XLinkTargetSupplier,
- public com::sun::star::beans::XPropertySet,
- public com::sun::star::document::XCodeNameQuery,
-+ public com::sun::star::document::XDocumentEventCompatibleHelper,
- public SvxFmMSFactory, // derived from XMultiServiceFactory
- public com::sun::star::lang::XServiceInfo,
- public ::com::sun::star::util::XChangesNotifier
-@@ -320,6 +322,8 @@ public:
- throw (::com::sun::star::uno::RuntimeException);
- virtual rtl::OUString SAL_CALL getCodeNameForObject( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& aObj )
- throw(::com::sun::star::uno::RuntimeException);
-+ // XVbaEventHelper
-+ virtual sal_Bool SAL_CALL processCompatibleEvent( sal_Int16 nEventId ) throw (::com::sun::star::uno::RuntimeException);
- };
-
-
---- sc/source/ui/view/gridwin.cxx.old 2009-04-06 16:41:50.000000000 +0000
-+++ sc/source/ui/view/gridwin.cxx 2009-04-06 16:42:00.000000000 +0000
-@@ -130,7 +130,13 @@
- #include <svx/sdr/overlay/overlaymanager.hxx>
- #include <vcl/svapp.hxx>
-
-+#include "cellsuno.hxx"
-+
-+#include <com/sun/star/document/XVbaEventsHelper.hpp>
-+#include <com/sun/star/document/VbaEventId.hpp>
-+
- using namespace com::sun::star;
-+using namespace com::sun::star::document::VbaEventId;
- using ::com::sun::star::uno::Sequence;
- using ::com::sun::star::uno::Any;
-
-@@ -356,6 +362,32 @@ void lcl_UnLockComment( ScDrawView* pVie
- }
- }
-
-+sal_Bool lcl_GetHyperlinkCell(ScDocument* pDoc, SCCOL& rPosX, SCROW& rPosY, SCTAB nTab, ScBaseCell*& rpCell )
-+{
-+ BOOL bFound = FALSE;
-+ do
-+ {
-+ pDoc->GetCell( rPosX, rPosY, nTab, rpCell );
-+ if ( !rpCell || rpCell->GetCellType() == CELLTYPE_NOTE )
-+ {
-+ if ( rPosX <= 0 )
-+ return FALSE; // alles leer bis links
-+ else
-+ --rPosX; // weitersuchen
-+ }
-+ else if ( rpCell->GetCellType() == CELLTYPE_EDIT)
-+ bFound = TRUE;
-+ else if (rpCell->GetCellType() == CELLTYPE_FORMULA &&
-+ static_cast<ScFormulaCell*>(rpCell)->IsHyperLinkCell())
-+ bFound = TRUE;
-+ else
-+ return FALSE; // andere Zelle
-+ }
-+ while ( !bFound );
-+
-+ return bFound;
-+}
-+
- // ---------------------------------------------------------------------------
- // WB_DIALOGCONTROL noetig fuer UNO-Controls
- ScGridWindow::ScGridWindow( Window* pParent, ScViewData* pData, ScSplitPos eWhichPos )
-@@ -1403,6 +1435,7 @@ void ScGridWindow::HandleMouseButtonDown
- SCCOL nOldColFBox = bWasFilterBox ? pFilterBox->GetCol() : 0;
- SCROW nOldRowFBox = bWasFilterBox ? pFilterBox->GetRow() : 0;
- #endif
-+#include "cellsuno.hxx"
-
- ClickExtern(); // loescht FilterBox, wenn vorhanden
-
-@@ -2085,6 +2118,26 @@ void __EXPORT ScGridWindow::MouseButtonU
- {
- nMouseStatus = SC_GM_NONE; // keinen Doppelklick anfangen
- ScGlobal::OpenURL( aUrl, aTarget );
-+
-+ // fire worksheet_followhyperlink event
-+ Point aPos = rMEvt.GetPosPixel();
-+ SCsCOL nPosX;
-+ SCsROW nPosY;
-+ SCTAB nTab = pViewData->GetTabNo();
-+ pViewData->GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY );
-+ ScBaseCell* pCell = NULL;
-+
-+ BOOL bFound = lcl_GetHyperlinkCell( pDoc, nPosX, nPosY, nTab, pCell );
-+ if( bFound )
-+ {
-+ ScAddress aCellPos( nPosX, nPosY, nTab );
-+ ScCellObj* pObj = new ScCellObj( pViewData->GetDocShell(), aCellPos );
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] = uno::makeAny(uno::Reference<uno::XInterface>(static_cast<cppu::OWeakObject*>(pObj)));
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper ( pViewData->GetDocument()->GetVbaEventsHelper(), uno::UNO_QUERY );
-+ if( xVbaEventsHelper.is() )
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKSHEET_FOLLOWHYPERLINK, aArgs );
-+ }
- return;
- }
- }
-@@ -2412,7 +2465,7 @@ long ScGridWindow::PreNotify( NotifyEven
- lcl_InitMouseEvent( aEvent, *rNEvt.GetMouseEvent() );
- if ( rNEvt.GetWindow() )
- aEvent.Source = rNEvt.GetWindow()->GetComponentInterface();
-- if ( nType == EVENT_MOUSEBUTTONDOWN)
-+ if ( nType == EVENT_MOUSEBUTTONDOWN )
- pImp->MousePressed( aEvent );
- else
- pImp->MouseReleased( aEvent );
-@@ -4827,26 +4880,9 @@ BOOL ScGridWindow::GetEditUrlOrError( BO
- ScDocument* pDoc = pDocSh->GetDocument();
- ScBaseCell* pCell = NULL;
-
-- BOOL bFound = FALSE;
-- do
-- {
-- pDoc->GetCell( nPosX, nPosY, nTab, pCell );
-- if ( !pCell || pCell->GetCellType() == CELLTYPE_NOTE )
-- {
-- if ( nPosX <= 0 )
-- return FALSE; // alles leer bis links
-- else
-- --nPosX; // weitersuchen
-- }
-- else if ( pCell->GetCellType() == CELLTYPE_EDIT)
-- bFound = TRUE;
-- else if (pCell->GetCellType() == CELLTYPE_FORMULA &&
-- static_cast<ScFormulaCell*>(pCell)->IsHyperLinkCell())
-- bFound = TRUE;
-- else
-- return FALSE; // andere Zelle
-- }
-- while ( !bFound );
-+ BOOL bFound = lcl_GetHyperlinkCell( pDoc, nPosX, nPosY, nTab, pCell );
-+ if( !bFound )
-+ return FALSE;
-
- ScHideTextCursor aHideCursor( pViewData, eWhich ); // before GetEditArea (MapMode is changed)
-
---- sc/source/ui/view/tabview3.cxx.old 2009-04-06 16:41:50.000000000 +0000
-+++ sc/source/ui/view/tabview3.cxx 2009-04-06 16:42:00.000000000 +0000
-@@ -82,6 +82,10 @@
- #include "tabprotection.hxx"
-
- #include <com/sun/star/chart2/data/HighlightedRange.hpp>
-+#include <com/sun/star/document/XVbaEventsHelper.hpp>
-+#include <com/sun/star/document/VbaEventId.hpp>
-+
-+using namespace com::sun::star::document::VbaEventId;
-
- namespace
- {
-@@ -1600,6 +1604,17 @@ void ScTabView::SetTabNo( SCTAB nTab, BO
- // nicht InputEnterHandler wegen Referenzeingabe !
-
- ScDocument* pDoc = aViewData.GetDocument();
-+ if( !bNew )
-+ {
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper ( pDoc->GetVbaEventsHelper(), uno::UNO_QUERY );
-+ if( xVbaEventsHelper.is() )
-+ {
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] <<= aViewData.GetTabNo();
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKSHEET_DEACTIVATE, aArgs );
-+ }
-+ }
-+
- pDoc->MakeTable( nTab );
-
- SCTAB nTabCount = pDoc->GetTableCount();
-@@ -1698,8 +1713,20 @@ void ScTabView::SetTabNo( SCTAB nTab, BO
- if ( pGridWin[i]->IsVisible() )
- pGridWin[i]->UpdateEditViewPos();
- }
--
-+
- TabChanged(); // DrawView
-+
-+ if( !bNew )
-+ {
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper ( pDoc->GetVbaEventsHelper(), uno::UNO_QUERY );
-+ if( xVbaEventsHelper.is() )
-+ {
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] <<= aViewData.GetTabNo();
-+ xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKSHEET_ACTIVATE, aArgs );
-+ }
-+ }
-+
- aViewData.GetViewShell()->WindowChanged(); // falls das aktive Fenster anders ist
- if ( !bUnoRefDialog )
- aViewData.GetViewShell()->DisconnectAllClients(); // important for floating frames
---- sc/source/ui/vba/makefile.mk.old 2009-04-06 16:41:59.000000000 +0000
-+++ sc/source/ui/vba/makefile.mk 2009-04-06 16:42:00.000000000 +0000
-@@ -134,7 +134,8 @@ SLOFILES= \
- $(SLO)$/vbapagebreaks.obj \
- $(SLO)$/vbaspinbutton.obj \
- $(SLO)$/vbaimage.obj \
-- $(SLO)$/service.obj
-+ $(SLO)$/service.obj \
-+ $(SLO)$/vbaeventshelper.obj
-
- # --- Targets ------------------------------------------------------
-
---- sc/source/ui/vba/service.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/service.cxx 2009-04-06 16:42:00.000000000 +0000
-@@ -69,6 +69,10 @@ namespace hyperlink
- {
- extern sdecl::ServiceDecl const serviceDecl;
- }
-+namespace vbaeventshelper
-+{
-+extern sdecl::ServiceDecl const serviceDecl;
-+}
-
- extern "C"
- {
-@@ -86,7 +90,7 @@ extern "C"
-
- // 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, userform::serviceDecl, window::serviceDecl, hyperlink::serviceDecl ) && component_writeInfoHelper( pServiceManager, pRegistryKey, vbaeventshelper::serviceDecl ) )
- {
- // Singleton registration
- try
-@@ -115,6 +119,8 @@ 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 );
-+ if( !pRet )
-+ pRet = component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey, vbaeventshelper::serviceDecl );
- OSL_TRACE("Ret is 0x%x", pRet);
- return pRet;
- }
---- sfx2/inc/sfx2/objsh.hxx.old 2009-04-06 16:41:53.000000000 +0000
-+++ sfx2/inc/sfx2/objsh.hxx 2009-04-06 16:42:00.000000000 +0000
-@@ -308,6 +308,7 @@ public:
- void SetNoName();
- sal_Bool IsInModalMode() const;
- sal_Bool HasModalViews() const;
-+ sal_Bool IsInPrepareClose() const;
- sal_Bool IsHelpDocument() const;
-
- sal_Bool IsDocShared() const;
-@@ -408,7 +409,8 @@ public:
- const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aParams,
- ::com::sun::star::uno::Any& aRet,
- ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
-- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam
-+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam,
-+ bool bRaiseError = true
- );
-
- static ErrCode CallXScript(
-@@ -417,7 +419,8 @@ public:
- const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aParams,
- ::com::sun::star::uno::Any& aRet,
- ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
-- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam
-+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam,
-+ bool bRaiseError = true
- );
-
- /** adjusts the internal macro mode, according to the current security settings
---- sfx2/source/doc/objmisc.cxx.old 2009-04-02 10:43:58.000000000 +0000
-+++ sfx2/source/doc/objmisc.cxx 2009-04-06 16:42:00.000000000 +0000
-@@ -1632,7 +1632,7 @@ namespace
- }
-
- ErrCode SfxObjectShell::CallXScript( const Reference< XInterface >& _rxScriptContext, const ::rtl::OUString& _rScriptURL,
-- const Sequence< Any >& aParams, Any& aRet, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam )
-+ const Sequence< Any >& aParams, Any& aRet, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam, bool bRaiseError )
- {
- OSL_TRACE( "in CallXScript" );
- ErrCode nErr = ERRCODE_NONE;
-@@ -1673,7 +1673,7 @@ ErrCode SfxObjectShell::CallXScript( con
- nErr = ERRCODE_BASIC_INTERNAL_ERROR;
- }
-
-- if ( bCaughtException )
-+ if ( bCaughtException && bRaiseError )
- {
- ::std::auto_ptr< VclAbstractDialog > pScriptErrDlg;
- SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
-@@ -1697,9 +1697,9 @@ ErrCode SfxObjectShell::CallXScript( con
- ::com::sun::star::uno::Any& aRet,
- ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >&
-- aOutParam)
-+ aOutParam, bool bRaiseError )
- {
-- return CallXScript( GetModel(), rScriptURL, aParams, aRet, aOutParamIndex, aOutParam );
-+ return CallXScript( GetModel(), rScriptURL, aParams, aRet, aOutParamIndex, aOutParam, bRaiseError );
- }
-
- //-------------------------------------------------------------------------
---- sfx2/source/doc/objserv.cxx.old 2009-04-06 16:41:53.000000000 +0000
-+++ sfx2/source/doc/objserv.cxx 2009-04-06 16:42:00.000000000 +0000
-@@ -103,6 +103,7 @@
- #include <com/sun/star/embed/XTransactedObject.hpp>
- #include <com/sun/star/util/XCloneable.hpp>
- #include <com/sun/star/document/XDocumentProperties.hpp>
-+#include <com/sun/star/document/XDocumentEventCompatibleHelper.hpp>
-
- #include "helpid.hrc"
-
-@@ -507,6 +508,18 @@ void SfxObjectShell::ExecFile_Impl(SfxRe
- case SID_SAVEASDOC:
- case SID_SAVEDOC:
- {
-+ if( nId == SID_SAVEDOC || nId == SID_SAVEASDOC )
-+ {
-+ uno::Reference< document::XDocumentEventCompatibleHelper > xVbaEventHelper( GetModel(), uno::UNO_QUERY );
-+ if( xVbaEventHelper.is() )
-+ {
-+ if( xVbaEventHelper->processCompatibleEvent( nId ) )
-+ {
-+ rReq.SetReturnValue( SfxBoolItem( 0, sal_True ) );
-+ return;
-+ }
-+ }
-+ }
- //!! detaillierte Auswertung eines Fehlercodes
- SfxObjectShellRef xLock( this );
-
---- sfx2/source/view/viewprn.cxx.old 2009-04-02 10:44:00.000000000 +0000
-+++ sfx2/source/view/viewprn.cxx 2009-04-06 16:42:00.000000000 +0000
-@@ -32,6 +32,7 @@
- #include "precompiled_sfx2.hxx"
-
- #include <com/sun/star/document/XDocumentProperties.hpp>
-+#include <com/sun/star/document/XDocumentEventCompatibleHelper.hpp>
- #include <com/sun/star/view/PrintableState.hpp>
- #include <svtools/itempool.hxx>
- #ifndef _MSGBOX_HXX //autogen
-@@ -67,6 +68,8 @@
- #include "view.hrc"
- #include "helpid.hrc"
-
-+using namespace com::sun::star;
-+
- TYPEINIT1(SfxPrintingHint, SfxHint);
-
- // -----------------------------------------------------------------------
-@@ -405,6 +408,22 @@ void SfxViewShell::ExecPrint_Impl( SfxRe
- case SID_SETUPPRINTER:
- case SID_PRINTER_NAME :
- {
-+ if( nId == SID_PRINTDOC )
-+ {
-+ SfxObjectShell* pDoc = GetObjectShell();
-+ if( pDoc )
-+ {
-+ uno::Reference< document::XDocumentEventCompatibleHelper > xVbaEventHelper( pDoc->GetModel(), uno::UNO_QUERY );
-+ if( xVbaEventHelper.is() )
-+ {
-+ if( xVbaEventHelper->processCompatibleEvent( nId ) )
-+ {
-+ rReq.SetReturnValue(SfxBoolItem(0,FALSE));
-+ return;
-+ }
-+ }
-+ }
-+ }
- // quiet mode (AppEvent, API call)
- SFX_REQUEST_ARG(rReq, pSilentItem, SfxBoolItem, SID_SILENT, FALSE);
- bSilent = pSilentItem && pSilentItem->GetValue();
-@@ -717,6 +736,15 @@ void SfxViewShell::ExecPrint_Impl( SfxRe
- if ( SID_PRINTDOCDIRECT == nId )
- {
- SfxObjectShell* pDoc = GetObjectShell();
-+ uno::Reference< document::XDocumentEventCompatibleHelper > xVbaEventHelper( pDoc->GetModel(), uno::UNO_QUERY );
-+ if( xVbaEventHelper.is() )
-+ {
-+ if( xVbaEventHelper->processCompatibleEvent( nId ) )
-+ {
-+ rReq.SetReturnValue(SfxBoolItem(0,FALSE));
-+ return;
-+ }
-+ }
- bool bDetectHidden = ( !bSilent && pDoc );
- if ( bDetectHidden && pDoc->QueryHiddenInformation( WhenPrinting, NULL ) != RET_YES )
- return;
---- sfx2/source/doc/objxtor.cxx.old 2009-04-02 10:43:58.000000000 +0000
-+++ sfx2/source/doc/objxtor.cxx 2009-04-06 16:42:00.000000000 +0000
-@@ -579,6 +579,13 @@ SfxObjectShell* SfxObjectShell::Current(
- return pFrame ? pFrame->GetObjectShell() : 0;
- }
-
-+//-------------------------------------------------------------------------
-+
-+sal_Bool SfxObjectShell::IsInPrepareClose() const
-+{
-+ return pImp->bInPrepareClose;
-+}
-+
- //------------------------------------------------------------------------
-
- struct BoolEnv_Impl
diff --git a/patches/vba/vba-worksheet-calculate-event-fix.diff b/patches/vba/vba-worksheet-calculate-event-fix.diff
deleted file mode 100644
index cc9cb9956..000000000
--- a/patches/vba/vba-worksheet-calculate-event-fix.diff
+++ /dev/null
@@ -1,141 +0,0 @@
---- sc/inc/document.hxx.old 2009-04-06 16:42:00.000000000 +0000
-+++ sc/inc/document.hxx 2009-04-06 16:42:00.000000000 +0000
-@@ -423,6 +423,9 @@ private:
-
- sal_Int16 mnNamedRangesLockCount;
-
-+ // for worksheet calculate event
-+ ::std::vector< SCTAB > maTabs;
-+
- public:
- SC_DLLPUBLIC ULONG GetCellCount() const; // alle Zellen
- ULONG GetWeightedCount() const; // Formeln und Edit staerker gewichtet
-@@ -865,6 +868,10 @@ public:
- BOOL IsForcedFormulaPending() const { return bForcedFormulaPending; }
- // if CalcFormulaTree() is currently running
- BOOL IsCalculatingFormulaTree() { return bCalculatingFormulaTree; }
-+
-+ // for worksheet calculate event
-+ BOOL FireCalculateEvent( SCTAB nTab );
-+ void AddCalculateTable( SCTAB nTab );
-
- USHORT GetErrCode( const ScAddress& ) const;
-
---- sc/source/core/data/documen7.cxx.old 2009-04-02 10:45:01.000000000 +0000
-+++ sc/source/core/data/documen7.cxx 2009-04-06 16:42:00.000000000 +0000
-@@ -59,7 +59,15 @@
-
-
- #include "globstr.hrc"
-+#include <algorithm>
-+#include <vector>
-
-+
-+#include <com/sun/star/document/XVbaEventsHelper.hpp>
-+#include <com/sun/star/document/VbaEventId.hpp>
-+
-+using namespace com::sun::star;
-+using namespace com::sun::star::document::VbaEventId;
- extern const ScFormulaCell* pLastFormulaTreeTop; // cellform.cxx Err527 WorkAround
-
- // STATIC DATA -----------------------------------------------------------
-@@ -520,5 +528,35 @@ void ScDocument::SetAutoCalc( BOOL bNewA
- }
- }
-
-+BOOL ScDocument::FireCalculateEvent( SCTAB nTab )
-+{
-+ BOOL bSuccess = FALSE;
-+ ::std::vector<SCTAB>::iterator iter;
-+ iter = ::std::find( maTabs.begin(), maTabs.end(), nTab );
-+ if( iter != maTabs.end() )
-+ {
-+ // make sure fire worksheet calculate event only once for each sheet
-+ // regardless of how many formula cells are calculated.
-+ maTabs.erase(iter);
-+
-+ uno::Reference< document::XVbaEventsHelper > xVbaEventsHelper ( GetVbaEventsHelper(), uno::UNO_QUERY );
-+ if( xVbaEventsHelper.is() )
-+ {
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] <<= nTab;
-+ bSuccess = xVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKSHEET_CALCULATE, aArgs );
-+ }
-+ }
-+ return bSuccess;
-+}
-
-+void ScDocument::AddCalculateTable( SCTAB nTab )
-+{
-+ ::std::vector<SCTAB>::iterator iter;
-+ iter = ::std::find( maTabs.begin(), maTabs.end(), nTab );
-+ if( iter == maTabs.end() )
-+ {
-+ maTabs.push_back( nTab );
-+ }
-+}
-
---- sc/inc/cell.hxx.old 2009-04-06 16:41:50.000000000 +0000
-+++ sc/inc/cell.hxx 2009-04-06 16:42:00.000000000 +0000
-@@ -418,7 +418,7 @@ public:
- const formula::FormulaGrammar::Grammar = formula::FormulaGrammar::GRAM_DEFAULT ) const;
-
- void SetDirty();
-- inline void SetDirtyVar() { bDirty = TRUE; }
-+ void SetDirtyVar();
- // If setting entire document dirty after load, no broadcasts but still append to FormulaTree.
- void SetDirtyAfterLoad();
- inline void ResetTableOpDirtyVar() { bTableOpDirty = FALSE; }
---- sc/source/core/data/cell.cxx.old 2009-04-06 16:41:50.000000000 +0000
-+++ sc/source/core/data/cell.cxx 2009-04-06 16:42:00.000000000 +0000
-@@ -1486,6 +1486,9 @@ void ScFormulaCell::Interpret()
- }
- } while (bIterationFromRecursion || bResumeIteration);
- }
-+
-+ // Fire worksheet calculate event
-+ pDocument->FireCalculateEvent( aPos.Tab() );
- }
-
- void ScFormulaCell::InterpretTail( ScInterpretTailParameter eTailParam )
-@@ -1769,7 +1772,7 @@ void __EXPORT ScFormulaCell::Notify( Svt
- else
- {
- bForceTrack = !bDirty;
-- bDirty = TRUE;
-+ SetDirtyVar();
- }
- // #35962# Don't remove from FormulaTree to put in FormulaTrack to
- // put in FormulaTree again and again, only if necessary.
-@@ -1792,7 +1795,7 @@ void ScFormulaCell::SetDirty()
- if ( !IsInChangeTrack() )
- {
- if ( pDocument->GetHardRecalcState() )
-- bDirty = TRUE;
-+ SetDirtyVar();
- else
- {
- // Mehrfach-FormulaTracking in Load und in CompileAll
-@@ -1801,7 +1804,7 @@ void ScFormulaCell::SetDirty()
- // setzen, z.B. in CompileTokenArray
- if ( !bDirty || !pDocument->IsInFormulaTree( this ) )
- {
-- bDirty = TRUE;
-+ SetDirtyVar();
- pDocument->AppendToFormulaTrack( this );
- pDocument->TrackFormulas();
- }
-@@ -1809,6 +1812,13 @@ void ScFormulaCell::SetDirty()
- }
- }
-
-+void ScFormulaCell::SetDirtyVar()
-+{
-+ bDirty = TRUE;
-+ // mark the sheet of this cell to be calculated
-+ pDocument->AddCalculateTable( aPos.Tab() );
-+}
-+
- void ScFormulaCell::SetDirtyAfterLoad()
- {
- bDirty = TRUE;
diff --git a/patches/vba/vba-worksheet-change-event-fix.diff b/patches/vba/vba-worksheet-change-event-fix.diff
deleted file mode 100644
index 4bcabe9e2..000000000
--- a/patches/vba/vba-worksheet-change-event-fix.diff
+++ /dev/null
@@ -1,148 +0,0 @@
-diff --git sc/source/ui/vba/vbaeventshelper.cxx sc/source/ui/vba/vbaeventshelper.cxx
-index 8248d48..794cb84 100644
---- sc/source/ui/vba/vbaeventshelper.cxx
-+++ sc/source/ui/vba/vbaeventshelper.cxx
-@@ -56,8 +56,12 @@
- #include <com/sun/star/util/XCloseBroadcaster.hpp>
- #include <com/sun/star/frame/XControllerBorder.hpp>
- #include <com/sun/star/frame/XBorderResizeListener.hpp>
--#include "cellsuno.hxx"
--
-+#include <com/sun/star/util/XChangesListener.hpp>
-+#include <com/sun/star/util/ElementChange.hpp>
-+#include <com/sun/star/util/XChangesNotifier.hpp>
-+#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
-+#include <cellsuno.hxx>
-+#include <convuno.hxx>
- #include <map>
-
- using namespace std;
-@@ -69,6 +73,70 @@ const static rtl::OUString sUrlPart0 = rtl::OUString::createFromAscii( "vnd.sun.
- const static rtl::OUString sUrlPart1 = rtl::OUString::createFromAscii( "vnd.sun.star.script:Standard.");
- const static rtl::OUString sUrlPart2 = rtl::OUString::createFromAscii( "?language=Basic&location=document");
-
-+typedef ::cppu::WeakImplHelper1< util::XChangesListener > WorksheetChangeListener_BASE;
-+
-+class WorksheetChangeListener : public WorksheetChangeListener_BASE
-+{
-+private:
-+ ScVbaEventsHelper* pVbaEventsHelper;
-+public:
-+ WorksheetChangeListener(ScVbaEventsHelper* pHelper ) : pVbaEventsHelper( pHelper ){}
-+ virtual void SAL_CALL changesOccurred(const util::ChangesEvent& aEvent) throw (uno::RuntimeException);
-+ virtual void SAL_CALL disposing(const lang::EventObject& aSource) throw(uno::RuntimeException){}
-+};
-+
-+void WorksheetChangeListener::changesOccurred(const util::ChangesEvent& aEvent) throw (uno::RuntimeException)
-+{
-+ sal_Int32 nCount = aEvent.Changes.getLength();
-+ if( nCount == 0 )
-+ return;
-+
-+ util::ElementChange aChange = aEvent.Changes[ 0 ];
-+ rtl::OUString sOperation;
-+ aChange.Accessor >>= sOperation;
-+ if( !sOperation.equalsIgnoreAsciiCaseAscii("cell-change") )
-+ return;
-+
-+ if( nCount == 1 )
-+ {
-+ uno::Reference< table::XCellRange > xRangeObj;
-+ aChange.ReplacedElement >>= xRangeObj;
-+ if( xRangeObj.is() )
-+ {
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] <<= xRangeObj;
-+ pVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKSHEET_CHANGE, aArgs );
-+ }
-+ return;
-+ }
-+
-+ ScRangeList aRangeList;
-+ for( sal_Int32 nIndex = 0; nIndex < nCount; ++nIndex )
-+ {
-+ aChange = aEvent.Changes[ nIndex ];
-+ aChange.Accessor >>= sOperation;
-+ uno::Reference< table::XCellRange > xRangeObj;
-+ aChange.ReplacedElement >>= xRangeObj;
-+ if( xRangeObj.is() && sOperation.equalsIgnoreAsciiCaseAscii("cell-change") )
-+ {
-+ uno::Reference< sheet::XCellRangeAddressable > xCellRangeAddressable( xRangeObj, uno::UNO_QUERY );
-+ if( xCellRangeAddressable.is() )
-+ {
-+ ScRange aRange;
-+ ScUnoConversion::FillScRange( aRange, xCellRangeAddressable->getRangeAddress() );
-+ aRangeList.Append( aRange );
-+ }
-+ }
-+ }
-+
-+ if( aRangeList.Count() > 0 )
-+ {
-+ uno::Reference< sheet::XSheetCellRangeContainer > xRanges( new ScCellRangesObj( pVbaEventsHelper->getDocumentShell(), aRangeList ) );
-+ uno::Sequence< uno::Any > aArgs(1);
-+ aArgs[0] <<= xRanges;
-+ pVbaEventsHelper->ProcessCompatibleVbaEvent( VBAEVENT_WORKSHEET_CHANGE, aArgs );
-+ }
-+}
-
- typedef ::cppu::WeakImplHelper3< awt::XWindowListener, util::XCloseListener, frame::XBorderResizeListener > WindowListener_BASE;
-
-@@ -394,8 +462,12 @@ ScVbaEventsHelper::ScVbaEventsHelper( uno::Sequence< css::uno::Any > const& aArg
- : m_xContext( xContext ), mpVbaEventsListener( NULL ), mbOpened( sal_False ), mbIgnoreEvents( sal_False )
- {
- uno::Reference< frame::XModel > xModel ( getXSomethingFromArgs< frame::XModel >( aArgs, 0 ), uno::UNO_QUERY );
-- ScDocShell* pDocShell = excel::getDocShell( xModel );
-+ pDocShell = excel::getDocShell( xModel );
- pDoc = pDocShell->GetDocument();
-+ // Add worksheet change listener
-+ uno::Reference< util::XChangesNotifier > xChangesNotifier( xModel, uno::UNO_QUERY );
-+ if( xChangesNotifier.is() )
-+ xChangesNotifier->addChangesListener( uno::Reference< util::XChangesListener >( new WorksheetChangeListener( this ) ) );
- }
-
- ScVbaEventsHelper::~ScVbaEventsHelper()
-@@ -782,6 +854,18 @@ SCTAB ScVbaEventsHelper::getTabFromArgs( const uno::Sequence< uno::Any > aArgs,
- table::CellRangeAddress aAddress = xCellRangeAddressable->getRangeAddress();
- nTab = aAddress.Sheet;
- }
-+ else
-+ {
-+ uno::Reference< sheet::XSheetCellRangeContainer > xRanges( getXSomethingFromArgs< sheet::XSheetCellRangeContainer >( aArgs, nPos ), uno::UNO_QUERY );
-+ if( xRanges.is() )
-+ {
-+ uno::Sequence< table::CellRangeAddress > aRangeAddresses = xRanges->getRangeAddresses();
-+ if( aRangeAddresses.getLength() > 0 )
-+ {
-+ nTab = aRangeAddresses[ 0 ].Sheet;
-+ }
-+ }
-+ }
- return nTab;
- }
-
-diff --git sc/source/ui/vba/vbaeventshelper.hxx sc/source/ui/vba/vbaeventshelper.hxx
-index e8c41d3..e812aa0 100644
---- sc/source/ui/vba/vbaeventshelper.hxx
-+++ sc/source/ui/vba/vbaeventshelper.hxx
-@@ -47,10 +47,12 @@
- typedef ::cppu::WeakImplHelper1< com::sun::star::document::XVbaEventsHelper > VBAWorkbookEvent_BASE;
-
- class VbaEventsListener;
-+class ScDocShell;
- class ScVbaEventsHelper : public VBAWorkbookEvent_BASE
- {
- private:
- ScDocument* pDoc;
-+ ScDocShell* pDocShell;
- css::uno::Reference< css::uno::XComponentContext > m_xContext;
- VbaEventsListener* mpVbaEventsListener;
- sal_Bool mbOpened;
-@@ -72,6 +74,7 @@ public:
- ScVbaEventsHelper( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext > const& xContext );
- ~ScVbaEventsHelper();
- ScDocument* getDocument() { return pDoc; };
-+ ScDocShell* getDocumentShell() { return pDocShell; };
- // XVBAWorkbookEventHelper
- virtual sal_Bool SAL_CALL ProcessCompatibleVbaEvent( sal_Int32 nEventId, const css::uno::Sequence< css::uno::Any >& aArgs ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL setIgnoreEvents( ::sal_Bool _ignoreevents ) throw (css::uno::RuntimeException);
diff --git a/patches/vba/vba-worksheet-copy-otherdoc-api-support.diff b/patches/vba/vba-worksheet-copy-otherdoc-api-support.diff
deleted file mode 100644
index 22c36106a..000000000
--- a/patches/vba/vba-worksheet-copy-otherdoc-api-support.diff
+++ /dev/null
@@ -1,207 +0,0 @@
----
- sc/source/ui/docshell/docsh5.cxx | 41 +++++++++++++++++++++++++++++
- sc/source/ui/inc/docsh.hxx | 4 +++
- sc/source/ui/vba/vbaworksheet.cxx | 35 +++++++++++++++++++++----
- sc/source/ui/view/viewfun2.cxx | 51 ++----------------------------------
- 4 files changed, 77 insertions(+), 54 deletions(-)
-
-diff --git sc/source/ui/docshell/docsh5.cxx sc/source/ui/docshell/docsh5.cxx
-index aa3ca3e..d4d79e4 100644
---- sc/source/ui/docshell/docsh5.cxx
-+++ sc/source/ui/docshell/docsh5.cxx
-@@ -857,6 +857,47 @@ SCTAB ScDocShell::MakeScenario( SCTAB nTab, const String& rName, const String& r
- return nTab;
- }
-
-+ULONG ScDocShell::TransferTab( ScDocShell& rSrcDocShell, SCTAB nSrcPos,
-+ SCTAB nDestPos, BOOL bInsertNew,
-+ BOOL bNotifyAndPaint )
-+{
-+ ScDocument* pSrcDoc = rSrcDocShell.GetDocument();
-+
-+ ULONG nErrVal = aDocument.TransferTab( pSrcDoc, nSrcPos, nDestPos,
-+ bInsertNew ); // no insert
-+
-+ // TransferTab doesn't copy drawing objects with bInsertNew=FALSE
-+ if ( nErrVal > 0 && !bInsertNew)
-+ aDocument.TransferDrawPage( pSrcDoc, nSrcPos, nDestPos );
-+
-+ if(nErrVal>0 && pSrcDoc->IsScenario( nSrcPos ))
-+ {
-+ String aComment;
-+ Color aColor;
-+ USHORT nFlags;
-+
-+ pSrcDoc->GetScenarioData( nSrcPos, aComment,aColor, nFlags);
-+ aDocument.SetScenario(nDestPos,TRUE);
-+ aDocument.SetScenarioData(nDestPos,aComment,aColor,nFlags);
-+ BOOL bActive = pSrcDoc->IsActiveScenario(nSrcPos);
-+ aDocument.SetActiveScenario(nDestPos, bActive );
-+
-+ BOOL bVisible=pSrcDoc->IsVisible(nSrcPos);
-+ aDocument.SetVisible(nDestPos,bVisible );
-+
-+ }
-+
-+ if ( nErrVal > 0 && pSrcDoc->IsTabProtected( nSrcPos ) )
-+ aDocument.SetTabProtection(nDestPos, pSrcDoc->GetTabProtection(nSrcPos));
-+ if ( bNotifyAndPaint )
-+ {
-+ Broadcast( ScTablesHint( SC_TAB_INSERTED, nDestPos ) );
-+ PostPaintExtras();
-+ PostPaintGridAll();
-+ }
-+ return nErrVal;
-+}
-+
- BOOL ScDocShell::MoveTable( SCTAB nSrcTab, SCTAB nDestTab, BOOL bCopy, BOOL bRecord )
- {
- ScDocShellModificator aModificator( *this );
-diff --git sc/source/ui/inc/docsh.hxx sc/source/ui/inc/docsh.hxx
-index beb3e4e..8f62ca0 100644
---- sc/source/ui/inc/docsh.hxx
-+++ sc/source/ui/inc/docsh.hxx
-@@ -297,6 +297,10 @@ public:
- ScMarkData& rMark, BOOL bRecord = TRUE );
- void ModifyScenario( SCTAB nTab, const String& rName, const String& rComment,
- const Color& rColor, USHORT nFlags );
-+ ULONG TransferTab( ScDocShell& rSrcDocShell, SCTAB nSrcPos,
-+ SCTAB nDestPos, BOOL bInsertNew,
-+ BOOL bNotifyAndPaint );
-+
- BOOL MoveTable( SCTAB nSrcTab, SCTAB nDestTab, BOOL bCopy, BOOL bRecord );
-
- void DoRecalc( BOOL bApi );
-diff --git sc/source/ui/vba/vbaworksheet.cxx sc/source/ui/vba/vbaworksheet.cxx
-index 2af3a04..0525850 100644
---- sc/source/ui/vba/vbaworksheet.cxx
-+++ sc/source/ui/vba/vbaworksheet.cxx
-@@ -486,20 +486,43 @@ ScVbaWorksheet::Copy( const uno::Any& Before, const uno::Any& After ) throw (uno
- return;
- }
-
-- uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( getModel(), uno::UNO_QUERY );
-+ ScVbaWorksheet* pDestSheet = static_cast< ScVbaWorksheet* >(xSheet.get());
-+ uno::Reference <sheet::XSpreadsheetDocument> xDestDoc( pDestSheet->getModel(), uno::UNO_QUERY );
-+ uno::Reference <sheet::XSpreadsheetDocument> xSrcDoc( getModel(), uno::UNO_QUERY );
-+
- SCTAB nDest = 0;
-+ SCTAB nSrc = 0;
- aSheetName = xSheet->getName();
-- bool bSheetExists = nameExists (xSpreadDoc, aSheetName, nDest );
-
-- if ( bSheetExists )
-+ bool bSameDoc = ( pDestSheet->getModel() == getModel() );
-+ bool bDestSheetExists = nameExists (xDestDoc, aSheetName, nDest );
-+ bool bSheetExists = nameExists (xSrcDoc, aCurrSheetName, nSrc );
-+
-+ // set sheet name to be newSheet name
-+ aSheetName = aCurrSheetName;
-+ SCTAB nDummy=0;
-+ if ( bSheetExists && bDestSheetExists )
- {
- sal_Bool bAfter = After.hasValue();
- if(bAfter)
- nDest++;
-- uno::Reference<sheet::XSpreadsheets> xSheets = xSpreadDoc->getSheets();
-- getNewSpreadsheetName(aSheetName,aCurrSheetName,xSpreadDoc);
-- xSheets->copyByName(aCurrSheetName,aSheetName,nDest);
-+ uno::Reference<sheet::XSpreadsheets> xSheets = xDestDoc->getSheets();
-+ if ( bSameDoc || nameExists( xDestDoc, aCurrSheetName, nDummy ) )
-+ getNewSpreadsheetName(aSheetName,aCurrSheetName,xDestDoc);
-+ if ( bSameDoc )
-+ xSheets->copyByName(aCurrSheetName,aSheetName,nDest);
-+ else
-+ {
-+ ScDocShell* pDestDocShell = excel::getDocShell( pDestSheet->getModel() );
-+ ScDocShell* pSrcDocShell = excel::getDocShell( getModel() );
-+ if ( pDestDocShell && pSrcDocShell )
-+ pDestDocShell->TransferTab( *pSrcDocShell, static_cast<SCTAB>(nSrc), static_cast<SCTAB>(nDest), TRUE, TRUE );
-+ }
- }
-+ // active the new sheet
-+ uno::Reference< excel::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW );
-+ uno::Reference< excel::XWorksheet > xNewSheet( xApplication->Worksheets( uno::makeAny( aSheetName ) ), uno::UNO_QUERY_THROW );
-+ xNewSheet->Activate();
- }
-
-
-diff --git sc/source/ui/view/viewfun2.cxx sc/source/ui/view/viewfun2.cxx
-index 9f2bc5e..2030372 100644
---- sc/source/ui/view/viewfun2.cxx
-+++ sc/source/ui/view/viewfun2.cxx
-@@ -2474,8 +2474,8 @@ void ScViewFunc::ImportTables( ScDocShell* pSrcShell,
- {
- SCTAB nSrcTab = pSrcTabs[i];
- SCTAB nDestTab1=nTab+i;
-- ULONG nErrVal = pDoc->TransferTab( pSrcDoc, nSrcTab, nDestTab1,
-- FALSE ); // no insert
-+ ULONG nErrVal = pDocSh->TransferTab( *pSrcShell, nSrcTab, nDestTab1,
-+ FALSE, FALSE ); // no insert
-
- switch (nErrVal)
- {
-@@ -2493,25 +2493,6 @@ void ScViewFunc::ImportTables( ScDocShell* pSrcShell,
- break;
- }
-
-- // TransferTab doesn't copy drawing objects with bInsertNew=FALSE
-- if ( !bError )
-- pDoc->TransferDrawPage( pSrcDoc, nSrcTab, nDestTab1 );
--
-- if(!bError &&pSrcDoc->IsScenario(nSrcTab))
-- {
-- String aComment;
-- Color aColor;
-- USHORT nFlags;
--
-- pSrcDoc->GetScenarioData(nSrcTab, aComment,aColor, nFlags);
-- pDoc->SetScenario( nDestTab1,TRUE);
-- pDoc->SetScenarioData( nTab+i,aComment,aColor,nFlags);
-- BOOL bActive = pSrcDoc->IsActiveScenario(nSrcTab );
-- pDoc->SetActiveScenario( nDestTab1, bActive );
-- BOOL bVisible=pSrcDoc->IsVisible(nSrcTab);
-- pDoc->SetVisible(nDestTab1,bVisible );
--
-- }
- }
-
- if (bLink)
-@@ -2695,33 +2676,7 @@ void ScViewFunc::MoveTable( USHORT nDestDocNo, SCTAB nDestTab, BOOL bCopy )
- nDestTab1 = nDestTab;
- for(USHORT i=0;i<TheTabs.Count();i++)
- {
-- nErrVal = pDestDoc->TransferTab( pDoc, TheTabs[i], nDestTab1,
-- FALSE ); // no insert
--
-- // TransferTab doesn't copy drawing objects with bInsertNew=FALSE
-- if ( nErrVal > 0 )
-- pDestDoc->TransferDrawPage( pDoc, TheTabs[i], nDestTab1 );
--
-- if(nErrVal>0 && pDoc->IsScenario(TheTabs[i]))
-- {
-- String aComment;
-- Color aColor;
-- USHORT nFlags;
--
-- pDoc->GetScenarioData(TheTabs[i], aComment,aColor, nFlags);
-- pDestDoc->SetScenario(nDestTab1,TRUE);
-- pDestDoc->SetScenarioData(nDestTab1,aComment,aColor,nFlags);
-- BOOL bActive = pDoc->IsActiveScenario(TheTabs[i]);
-- pDestDoc->SetActiveScenario(nDestTab1, bActive );
--
-- BOOL bVisible=pDoc->IsVisible(TheTabs[i]);
-- pDestDoc->SetVisible(nDestTab1,bVisible );
--
-- }
--
-- if ( nErrVal > 0 && pDoc->IsTabProtected( TheTabs[i] ) )
-- pDestDoc->SetTabProtection(nDestTab1, pDoc->GetTabProtection(TheTabs[i]));
--
-+ nErrVal = pDestShell->TransferTab( *pDocShell, static_cast<SCTAB>(TheTabs[i]), static_cast<SCTAB>(nDestTab1), FALSE, FALSE );
- nDestTab1++;
- }
- }
---
-1.7.0.1
-
diff --git a/patches/vba/vba-worksheet-enableselection.diff b/patches/vba/vba-worksheet-enableselection.diff
deleted file mode 100644
index da541c531..000000000
--- a/patches/vba/vba-worksheet-enableselection.diff
+++ /dev/null
@@ -1,116 +0,0 @@
---- oovbaapi/ooo/vba/excel/XWorksheet.idl.orig 2008-07-29 18:14:09.000000000 +0800
-+++ oovbaapi/ooo/vba/excel/XWorksheet.idl 2008-07-29 18:17:10.000000000 +0800
-@@ -70,6 +70,7 @@ interface XWorksheet
- [attribute, readonly] XWorksheet Previous;
- [attribute, readonly] string CodeName;
- [attribute, readonly] short Index;
-+ [attribute] long EnableSelection;
-
- void Activate();
- void Calculate( );
---- sc/source/ui/vba/vbaworksheet.hxx.orig 2008-07-29 18:14:09.000000000 +0800
-+++ sc/source/ui/vba/vbaworksheet.hxx 2008-07-29 18:17:49.000000000 +0800
-@@ -96,6 +96,8 @@ public:
- 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);
---- sc/source/ui/vba/vbaworksheet.cxx.orig 2008-07-29 18:14:32.000000000 +0800
-+++ sc/source/ui/vba/vbaworksheet.cxx 2008-07-29 18:22:43.000000000 +0800
-@@ -58,6 +58,7 @@
- #include <com/sun/star/drawing/XControlShape.hpp>
- #include <com/sun/star/form/FormComponentType.hpp>
- #include <com/sun/star/form/XFormsSupplier.hpp>
-+#include <ooo/vba/excel/XlEnableSelection.hpp>
-
- #include <comphelper/processfactory.hxx>
-
-@@ -257,6 +258,83 @@ ScVbaWorksheet::getIndex() throw (uno::R
- return getSheetID() + 1;
- }
-
-+sal_Int32
-+ScVbaWorksheet::getEnableSelection() throw (uno::RuntimeException)
-+{
-+ uno::Reference <sheet::XSpreadsheetDocument> 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 = 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 <sheet::XSpreadsheetDocument> 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 = 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)
- {
-
diff --git a/patches/vba/vba-xls-formula-parser.diff b/patches/vba/vba-xls-formula-parser.diff
deleted file mode 100644
index 553a2bb28..000000000
--- a/patches/vba/vba-xls-formula-parser.diff
+++ /dev/null
@@ -1,48 +0,0 @@
-diff --git sc/source/ui/vba/vbarange.cxx sc/source/ui/vba/vbarange.cxx
-index e7f6797..0911361 100644
---- sc/source/ui/vba/vbarange.cxx
-+++ sc/source/ui/vba/vbarange.cxx
-@@ -792,9 +792,10 @@ protected:
- double aDblValue = 0.0;
- if ( aValue >>= sFormula )
- {
-- // convert to CONV_OOO style formula string because XCell::setFormula
-- // always compile it in CONV_OOO style. Perhaps css.sheet.FormulaParser
-- // should be used in future to directly pass formula tokens.
-+ // convert to GRAM_PODF_A1 style grammar because XCell::setFormula
-+ // always compile it in that grammar. Perhaps
-+ // css.sheet.FormulaParser should be used in future to directly
-+ // pass formula tokens when that API stabilizes.
- if ( m_eGrammar != formula::FormulaGrammar::GRAM_PODF_A1 && ( sFormula.trim().indexOf('=') == 0 ) )
- {
- uno::Reference< uno::XInterface > xIf( xCell, uno::UNO_QUERY_THROW );
-@@ -1462,25 +1463,25 @@ void
- ScVbaRange::setFormula(const uno::Any &rFormula ) throw (uno::RuntimeException)
- {
- // #FIXME converting "=$a$1" e.g. CONV_XL_A1 -> CONV_OOO // results in "=$a$1:a1", temporalily disable conversion
-- setFormulaValue( rFormula,formula::FormulaGrammar::GRAM_NATIVE_XL_A1 );;
-+ setFormulaValue( rFormula,formula::FormulaGrammar::GRAM_ENGLISH_XL_A1 );;
- }
-
- uno::Any
- ScVbaRange::getFormulaR1C1() throw (::com::sun::star::uno::RuntimeException)
- {
-- return getFormulaValue( formula::FormulaGrammar::GRAM_NATIVE_XL_R1C1 );
-+ return getFormulaValue( formula::FormulaGrammar::GRAM_ENGLISH_XL_R1C1 );
- }
-
- void
- ScVbaRange::setFormulaR1C1(const uno::Any& rFormula ) throw (uno::RuntimeException)
- {
-- setFormulaValue( rFormula,formula::FormulaGrammar::GRAM_NATIVE_XL_R1C1 );
-+ setFormulaValue( rFormula,formula::FormulaGrammar::GRAM_ENGLISH_XL_R1C1 );
- }
-
- uno::Any
- ScVbaRange::getFormula() throw (::com::sun::star::uno::RuntimeException)
- {
-- return getFormulaValue( formula::FormulaGrammar::GRAM_NATIVE_XL_A1 );
-+ return getFormulaValue( formula::FormulaGrammar::GRAM_ENGLISH_XL_A1 );
- }
-
- sal_Int32
diff --git a/patches/vba/vba-zoom-per-sheet.diff b/patches/vba/vba-zoom-per-sheet.diff
deleted file mode 100644
index 8a2a45a8f..000000000
--- a/patches/vba/vba-zoom-per-sheet.diff
+++ /dev/null
@@ -1,273 +0,0 @@
-diff --git sc/source/ui/inc/tabview.hxx sc/source/ui/inc/tabview.hxx
-index 882c88b..95a5663 100644
---- sc/source/ui/inc/tabview.hxx
-+++ sc/source/ui/inc/tabview.hxx
-@@ -298,7 +298,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();
-diff --git sc/source/ui/inc/viewdata.hxx sc/source/ui/inc/viewdata.hxx
-index 27e6821..8557dc9 100644
---- sc/source/ui/inc/viewdata.hxx
-+++ sc/source/ui/inc/viewdata.hxx
-@@ -239,6 +239,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:
-@@ -332,6 +333,8 @@ public:
- void SetPasteMode ( ScPasteFlags nFlags ) { nPasteFlags = nFlags; }
-
- 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 sc/source/ui/vba/excelvbahelper.cxx sc/source/ui/vba/excelvbahelper.cxx
-index 5f133d9..c98cab0 100644
---- sc/source/ui/vba/excelvbahelper.cxx
-+++ sc/source/ui/vba/excelvbahelper.cxx
-@@ -44,6 +44,13 @@ 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;
-diff --git sc/source/ui/vba/excelvbahelper.hxx sc/source/ui/vba/excelvbahelper.hxx
-index 3a3b7f8..af3e0bb 100644
---- sc/source/ui/vba/excelvbahelper.hxx
-+++ sc/source/ui/vba/excelvbahelper.hxx
-@@ -41,6 +41,8 @@ namespace ooo
- {
- 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();
- void implnPaste();
- void implnCut();
-diff --git sc/source/ui/vba/vbawindow.cxx sc/source/ui/vba/vbawindow.cxx
-index c64e156..ea93022 100644
---- sc/source/ui/vba/vbawindow.cxx
-+++ sc/source/ui/vba/vbawindow.cxx
-@@ -58,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 <sheet::XSpreadsheetDocument>& xSpreadDoc, ::rtl::OUString & name, SCTAB& nTab ) throw ( lang::IllegalArgumentException );
-+
- typedef std::hash_map< rtl::OUString,
- SCTAB, ::rtl::OUStringHash,
- ::std::equal_to< ::rtl::OUString > > NameIndexHash;
-@@ -735,24 +738,18 @@ 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 <sheet::XSpreadsheetDocument> 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
-diff --git sc/source/ui/vba/vbaworksheet.cxx sc/source/ui/vba/vbaworksheet.cxx
-index a416c8c..76c2f21 100644
---- sc/source/ui/vba/vbaworksheet.cxx
-+++ sc/source/ui/vba/vbaworksheet.cxx
-@@ -96,7 +96,7 @@
- #define DOESNOTEXIST -1
- using namespace com::sun::star;
- using namespace ooo::vba;
--static bool
-+bool
- nameExists( uno::Reference <sheet::XSpreadsheetDocument>& xSpreadDoc, ::rtl::OUString & name, SCTAB& nTab ) throw ( lang::IllegalArgumentException )
- {
- if (!xSpreadDoc.is())
-diff --git sc/source/ui/view/viewdata.cxx sc/source/ui/view/viewdata.cxx
-index ea04a47..1b2a7b8 100644
---- sc/source/ui/view/viewdata.cxx
-+++ sc/source/ui/view/viewdata.cxx
-@@ -650,66 +650,103 @@ void ScViewData::SetViewShell( ScTabViewShell* pViewSh )
- pView = NULL;
- }
- }
-+void ScViewData::CreateTabData( std::vector< SCTAB >& rvTabs )
-+{
-+ 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 );
-+}
-
--void ScViewData::SetZoomType( SvxZoomType eNew, BOOL bAll )
-+void ScViewData::SetZoomType( SvxZoomType eNew, std::vector< SCTAB >& tabs )
- {
-- if ( !bAll )
-- CreateSelectedTabData(); // if zoom is set for a table, it must be stored
-+ BOOL bAll = ( tabs.size() == 0 );
-+
-+ if ( !bAll ) // create associated table data
-+ CreateTabData( tabs );
-
-- for ( SCTAB i = 0; i <= MAXTAB; i++ )
-- if ( pTabData[i] && ( bAll || aMarkData.GetTableSelect(i) ) )
-+ 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 )
-+{
-+ std::vector< SCTAB > vTabs; // Empty for all tabs
-+ if ( !bAll ) // get selected tabs
-+ {
-+ SCTAB nTabCount = pDoc->GetTableCount();
-+ for (SCTAB i=0; i<nTabCount; i++)
-+ {
-+ if ( aMarkData.GetTableSelect(i) )
-+ vTabs.push_back( i );
-+ }
-+ }
-+ SetZoomType( eNew, vTabs );
-+}
-+
-+void ScViewData::SetZoom( const Fraction& rNewX, const Fraction& rNewY, std::vector< SCTAB >& tabs )
- {
-- if ( !bAll )
-- CreateSelectedTabData(); // if zoom is set for a table, it must be stored
-+ BOOL bAll = ( tabs.size() == 0 );
-+ if ( !bAll ) // create associated table data
-+ CreateTabData( tabs );
-+ Fraction aFrac20( 1,5 );
-+ Fraction aFrac400( 4,1 );
-
-- Fraction aFrac20( 1,5 );
-- Fraction aFrac400( 4,1 );
-+ Fraction aValidX = rNewX;
-+ if (aValidX<aFrac20)
-+ aValidX = aFrac20;
-+ if (aValidX>aFrac400)
-+ aValidX = aFrac400;
-
-- Fraction aValidX = rNewX;
-- if (aValidX<aFrac20) aValidX = aFrac20;
-- if (aValidX>aFrac400) aValidX = aFrac400;
-+ Fraction aValidY = rNewY;
-+ if (aValidY<aFrac20)
-+ aValidY = aFrac20;
-+ if (aValidY>aFrac400)
-+ aValidY = aFrac400;
-
-- Fraction aValidY = rNewY;
-- if (aValidY<aFrac20) aValidY = aFrac20;
-- if (aValidY>aFrac400) aValidY = aFrac400;
-+ std::vector< SCTAB >::iterator it_end = tabs.end();
-+ std::vector< SCTAB >::iterator it = tabs.begin();
-
-- if ( bPagebreak )
-- {
-- for ( SCTAB i = 0; i <= MAXTAB; i++ )
-- if ( pTabData[i] && ( bAll || aMarkData.GetTableSelect(i) ) )
-+ for ( SCTAB i = ( bAll ? 0 : *it ); ( bAll ? i <= MAXTAB : it != it_end ); ++i , ++it )
-+ {
-+ 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();
-+}
-
-- 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<nTabCount; i++)
-+ {
-+ if ( aMarkData.GetTableSelect(i) )
-+ vTabs.push_back( i );
-+ }
-+ }
-+ SetZoom( rNewX, rNewY, vTabs );
- }
-
- void ScViewData::SetShowGrid( bool bShow )
diff --git a/patches/vba/vbaevents-services-build.diff b/patches/vba/vbaevents-services-build.diff
deleted file mode 100644
index 063f0a99f..000000000
--- a/patches/vba/vbaevents-services-build.diff
+++ /dev/null
@@ -1,19 +0,0 @@
---- scripting/prj/build.lst 2007-02-12 17:34:17.000000000 +0000
-+++ scripting/prj/build.lst 2007-02-11 17:11:40.000000000 +0000
-@@ -1,13 +1,14 @@
--tc scripting : bridges rdbmaker vcl xmlscript basic sfx2 rhino BSH:beanshell javaunohelper NULL
-+tc scripting : oovbaapi bridges rdbmaker vcl xmlscript basic sfx2 rhino BSH:beanshell javaunohelper NULL
- tc scripting usr1 - all tc1_mkout NULL
- tc scripting\inc nmake - all tc1_inc NULL
- tc scripting\source\provider nmake - all tc1_scriptingprovider tc1_inc NULL
- tc scripting\source\basprov nmake - all tc1_scriptingbasprov tc1_inc NULL
-+tc scripting\source\vbaevents nmake - all tc1_scriptingvbaevents tc1_inc NULL
- tc scripting\source\dlgprov nmake - all tc1_scriptingdlgprov tc1_inc NULL
- tc scripting\source\stringresource nmake - all tc1_scriptingstringresource tc1_inc NULL
- tc scripting\source\pyprov nmake - all tc1_scriptingpyprov tc1_inc NULL
- tc scripting\source\protocolhandler nmake - all tc1_scriptingprotocolhandler tc1_scriptingprovider tc1_inc NULL
- tc scripting\java nmake - all tc1_scriptingjava tc1_scriptingprovider tc1_scriptingprotocolhandler NULL
- tc scripting\examples\java nmake - all tc1_scriptingexamplesjava tc1_scriptingjava NULL
- tc scripting\examples nmake - all tc1_scriptingexamples tc1_scriptingexamplesjava tc1_inc NULL
--tc scripting\util nmake - all tc1_scriptingutil tc1_scriptingprovider tc1_scriptingprotocolhandler tc1_scriptingbasprov tc1_scriptingstringresource tc1_scriptingpyprov tc1_scriptingjava tc1_scriptingexamplesjava tc1_scriptingexamples NULL
-+tc scripting\util nmake - all tc1_scriptingutil tc1_scriptingprovider tc1_scriptingprotocolhandler tc1_scriptingbasprov tc1_scriptingstringresource tc1_scriptingvbaevents tc1_scriptingpyprov tc1_scriptingjava tc1_scriptingexamplesjava tc1_scriptingexamples NULL
diff --git a/patches/vba/vbaevents-services-sources.diff b/patches/vba/vbaevents-services-sources.diff
deleted file mode 100644
index 7ee89e721..000000000
--- a/patches/vba/vbaevents-services-sources.diff
+++ /dev/null
@@ -1,2074 +0,0 @@
---- comphelper/inc/comphelper/evtmethodhelper.hxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ comphelper/inc/comphelper/evtmethodhelper.hxx 2009-04-06 16:41:59.000000000 +0000
-@@ -0,0 +1,41 @@
-+/*************************************************************************
-+ *
-+ * 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: evtlistenerhlp.hxx,v $
-+ * $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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+#ifndef COMPHELPER_EVENTMEHODHELPER_HXX
-+#define COMPHELPER_EVENMETHODHELPER_HXX
-+#include <comphelper/sequence.hxx>
-+//........................................................................
-+namespace comphelper
-+{
-+ COMPHELPER_DLLPUBLIC ::com::sun::star::uno::Sequence< ::rtl::OUString> getEventMethodsForType(const ::com::sun::star::uno::Type& type);
-+//........................................................................
-+
-+} // namespace comphelper
-+//........................................................................
-+#endif // COMPHELPER_EVENTMEHODHELPER_HXX
---- comphelper/source/misc/evtmethodhelper.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ comphelper/source/misc/evtmethodhelper.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -0,0 +1,77 @@
-+/*************************************************************************
-+ *
-+ * 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: evtlistenerhlp.cxx,v $
-+ * $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
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_comphelper.hxx"
-+#include "comphelper/evtmethodhelper.hxx"
-+#include "cppuhelper/typeprovider.hxx"
-+
-+using ::com::sun::star::uno::Sequence;
-+using ::com::sun::star::uno::Type;
-+
-+namespace comphelper
-+{
-+
-+ Sequence< ::rtl::OUString> getEventMethodsForType(const Type& type)
-+ {
-+ typelib_InterfaceTypeDescription *pType=0;
-+ type.getDescription( (typelib_TypeDescription**)&pType);
-+
-+ if(!pType)
-+ return Sequence< ::rtl::OUString>();
-+
-+ Sequence< ::rtl::OUString> aNames(pType->nMembers);
-+ ::rtl::OUString* pNames = aNames.getArray();
-+ for(sal_Int32 i=0;i<pType->nMembers;i++,++pNames)
-+ {
-+ // the decription reference
-+ typelib_TypeDescriptionReference* pMemberDescriptionReference = pType->ppMembers[i];
-+ // the description for the reference
-+ typelib_TypeDescription* pMemberDescription = NULL;
-+ typelib_typedescriptionreference_getDescription(&pMemberDescription, pMemberDescriptionReference);
-+ if (pMemberDescription)
-+ {
-+ typelib_InterfaceMemberTypeDescription* pRealMemberDescription =
-+ reinterpret_cast<typelib_InterfaceMemberTypeDescription*>(pMemberDescription);
-+ *pNames = pRealMemberDescription->pMemberName;
-+ }
-+ }
-+ typelib_typedescription_release( (typelib_TypeDescription *)pType );
-+ return aNames;
-+ }
-+
-+}
-+
-+
-+
-+
-+
-+
-+
---- comphelper/source/misc/makefile.mk
-+++ comphelper/source/misc/makefile.mk
-@@ -58,6 +58,7 @@ SLOFILES= \
- $(SLO)$/componentmodule.obj \
- $(SLO)$/configurationhelper.obj \
- $(SLO)$/documentinfo.obj \
-+ $(SLO)$/evtmethodhelper.obj \
- $(SLO)$/documentiologring.obj \
- $(SLO)$/evtlistenerhlp.obj \
- $(SLO)$/facreg.obj \
---- extensions/source/propctrlr/eventhandler.cxx.old 2009-04-02 10:51:17.000000000 +0000
-+++ extensions/source/propctrlr/eventhandler.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -62,6 +62,7 @@
- /** === end UNO includes === **/
-
- #include <comphelper/namedvaluecollection.hxx>
-+#include <comphelper/evtmethodhelper.hxx>
- #include <comphelper/types.hxx>
- #include <cppuhelper/implbase1.hxx>
- #include <rtl/ref.hxx>
-@@ -165,36 +166,6 @@ namespace pcr
- namespace
- {
- //....................................................................
-- Sequence< ::rtl::OUString > lcl_getListenerMethodsForType( const Type& type )
-- {
-- typelib_InterfaceTypeDescription *pType=0;
-- type.getDescription( (typelib_TypeDescription**)&pType);
--
-- if ( !pType )
-- return Sequence< ::rtl::OUString>();
--
-- Sequence< ::rtl::OUString > aNames( pType->nMembers );
-- ::rtl::OUString* pNames = aNames.getArray();
-- for ( sal_Int32 i = 0; i < pType->nMembers; ++i, ++pNames)
-- {
-- // the decription reference
-- typelib_TypeDescriptionReference* pMemberDescriptionReference = pType->ppMembers[i];
-- // the description for the reference
-- typelib_TypeDescription* pMemberDescription = NULL;
-- typelib_typedescriptionreference_getDescription( &pMemberDescription, pMemberDescriptionReference );
-- if ( pMemberDescription )
-- {
-- typelib_InterfaceMemberTypeDescription* pRealMemberDescription =
-- reinterpret_cast<typelib_InterfaceMemberTypeDescription*>(pMemberDescription);
-- *pNames = pRealMemberDescription->pMemberName;
-- }
-- }
--
-- typelib_typedescription_release( (typelib_TypeDescription*)pType );
-- return aNames;
-- }
--
-- //....................................................................
- #define DESCRIBE_EVENT( asciinamespace, asciilistener, asciimethod, id_postfix ) \
- s_aKnownEvents.insert( EventMap::value_type( \
- ::rtl::OUString::createFromAscii( asciimethod ), \
-@@ -762,7 +733,7 @@ namespace pcr
- continue;
-
- // loop through all methods
-- Sequence< ::rtl::OUString > aMethods( lcl_getListenerMethodsForType( *pListeners ) );
-+ Sequence< ::rtl::OUString > aMethods( comphelper::getEventMethodsForType( *pListeners ) );
-
- const ::rtl::OUString* pMethods = aMethods.getConstArray();
- sal_uInt32 methodCount = aMethods.getLength();
---- forms/source/inc/InterfaceContainer.hxx.old 2009-04-02 11:04:10.000000000 +0000
-+++ forms/source/inc/InterfaceContainer.hxx 2009-04-06 16:41:59.000000000 +0000
-@@ -260,6 +260,9 @@ protected:
- void implCheckIndex( const sal_Int32 _nIndex ) SAL_THROW( ( ::com::sun::star::lang::IndexOutOfBoundsException ) );
-
- private:
-+ // hack for Vba Events
-+ void fakeVbaEventsHack( sal_Int32 _nIndex );
-+
- // the runtime event format has changed from version SO5.2 to OOo
- enum EventFormat
- {
---- forms/source/misc/InterfaceContainer.cxx.old 2009-04-02 11:04:11.000000000 +0000
-+++ forms/source/misc/InterfaceContainer.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -60,13 +60,20 @@
- #include <rtl/logfile.hxx>
-
- //.........................................................................
-+#include <com/sun/star/frame/XModel.hpp>
-+#include <com/sun/star/document/XCodeNameQuery.hpp>
-+#include <ooo/vba/XVBAToOOEventDescGen.hpp>
-+#include <comphelper/processfactory.hxx>
-+
- namespace frm
- {
- //.........................................................................
-
-+using namespace ::com::sun::star::frame;
- using namespace ::com::sun::star::lang;
- using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::beans;
-+using namespace ::com::sun::star::document;
- using namespace ::com::sun::star::container;
- using namespace ::com::sun::star::script;
- using namespace ::com::sun::star::io;
-@@ -81,6 +88,88 @@ namespace
- }
- }
-
-+bool
-+lcl_hasVbaEvents( const Sequence< ScriptEventDescriptor >& sEvents )
-+{
-+ const ScriptEventDescriptor* pDesc = sEvents.getConstArray();
-+ const ScriptEventDescriptor* pEnd = ( pDesc + sEvents.getLength() );
-+ for ( ; pDesc != pEnd; ++pDesc )
-+ {
-+ if ( pDesc->ScriptType.equals( rtl::OUString::createFromAscii( "VBAInterop" ) ) )
-+ return true;
-+ }
-+ return false;
-+}
-+
-+Sequence< ScriptEventDescriptor >
-+lcl_stripVbaEvents( const Sequence< ScriptEventDescriptor >& sEvents )
-+{
-+ Sequence< ScriptEventDescriptor > sStripped( sEvents.getLength() );
-+
-+ const ScriptEventDescriptor* pDesc = sEvents.getConstArray();
-+ const ScriptEventDescriptor* pEnd = ( pDesc + sEvents.getLength() );
-+ sal_Int32 nCopied = 0;
-+ for ( ; pDesc != pEnd; ++pDesc )
-+ {
-+ if ( !pDesc->ScriptType.equals( rtl::OUString::createFromAscii( "VBAInterop" ) ) )
-+ {
-+ sStripped[ nCopied++ ] = *pDesc;
-+ }
-+ }
-+ if ( nCopied )
-+ sStripped.realloc( nCopied );
-+ return sStripped;
-+}
-+
-+void
-+OInterfaceContainer::fakeVbaEventsHack( sal_Int32 _nIndex )
-+{
-+ // we are dealing with form controls
-+ try
-+ {
-+ Reference< XFormComponent > xForm( static_cast< XContainer* >(this), UNO_QUERY_THROW );
-+ // grand-parent should be the model, no parent ? if not
-+ // we'll ignore, we'll get called back here anyway )
-+ Reference< XChild > xChild( xForm->getParent(), UNO_QUERY_THROW );
-+ Reference< XModel > xDocOwner( xChild->getParent(), UNO_QUERY );
-+ Reference< XCodeNameQuery > xNameQuery( xDocOwner, UNO_QUERY );
-+ OSL_TRACE(" Is DOC ????? %s", xDocOwner.is() ? "true" : "false" );
-+ if ( xDocOwner.is() && xNameQuery.is() )
-+ {
-+ bool hasVBABindings = lcl_hasVbaEvents( m_xEventAttacher->getScriptEvents( _nIndex ) );
-+ if ( hasVBABindings )
-+ {
-+ OSL_TRACE("Has VBA bindings already, returning ");
-+ return;
-+ }
-+ Reference< XMultiServiceFactory > xFac( comphelper::getProcessServiceFactory(), UNO_QUERY );
-+ if ( xFac.is() )
-+ {
-+ try
-+ {
-+ Reference< ooo::vba::XVBAToOOEventDescGen > xDescSupplier( xFac->createInstance( rtl::OUString::createFromAscii( "ooo.vba.VBAToOOEventDesc" ) ), UNO_QUERY_THROW );
-+ Reference< XInterface > xIf( getByIndex( _nIndex ) , UNO_QUERY_THROW );
-+ rtl::OUString sCodeName;
-+ sCodeName = xNameQuery->getCodeNameForObject( xIf );
-+ Reference< XPropertySet > xProps( xIf, UNO_QUERY );
-+ rtl::OUString sServiceName;
-+ xProps->getPropertyValue( rtl::OUString::createFromAscii("DefaultControl" ) ) >>= sServiceName;
-+
-+ Sequence< ScriptEventDescriptor > vbaEvents = xDescSupplier->getEventDescriptions( xFac->createInstance( sServiceName ), sCodeName );
-+ // register the vba script events
-+ if ( m_xEventAttacher.is() )
-+ m_xEventAttacher->registerScriptEvents( _nIndex, vbaEvents );
-+ }
-+ catch( Exception& e ){ OSL_TRACE("lcl_fakevbaevents - Caught Exception trying to create control eventstuff "); }
-+ }
-+
-+ }
-+ }
-+ catch( Exception& e )
-+ {
-+ }
-+
-+}
- //==================================================================
- //= ElementDescription
- //==================================================================
-@@ -694,6 +783,7 @@ void OInterfaceContainer::approveNewElem
- void OInterfaceContainer::implInsert(sal_Int32 _nIndex, const Reference< XPropertySet >& _rxElement,
- sal_Bool _bEvents, ElementDescription* _pApprovalResult, sal_Bool _bFire ) throw( IllegalArgumentException )
- {
-+ OSL_TRACE("OInterfaceContainer::implInsert( %d)", _nIndex );
- RTL_LOGFILE_CONTEXT( aLogger, "forms::OInterfaceContainer::implInsert" );
-
- ::osl::ClearableMutexGuard aGuard( m_rMutex );
-@@ -743,6 +833,23 @@ void OInterfaceContainer::implInsert(sal
- {
- m_xEventAttacher->insertEntry(_nIndex);
- m_xEventAttacher->attach( _nIndex, pElementMetaData->xInterface, makeAny( _rxElement ) );
-+ // insert fake events?
-+ Reference< XEventAttacherManager > xMgr ( pElementMetaData->xInterface, UNO_QUERY );
-+ if ( xMgr.is() )
-+ {
-+ OInterfaceContainer* pIfcMgr = dynamic_cast< OInterfaceContainer* >( xMgr.get() );
-+ sal_Int32 nLen = pIfcMgr->getCount();
-+ for ( sal_Int32 i = 0; (i < nLen) && pIfcMgr ; ++i )
-+ {
-+ // add fake events to the control at index i
-+ pIfcMgr->fakeVbaEventsHack( i );
-+ }
-+ }
-+ else
-+ {
-+ // add fake events to the control at index i
-+ fakeVbaEventsHack( _nIndex );
-+ }
- }
-
- // notify derived classes
-@@ -1022,20 +1129,29 @@ void SAL_CALL OInterfaceContainer::remov
- //------------------------------------------------------------------------
- void SAL_CALL OInterfaceContainer::registerScriptEvent( sal_Int32 nIndex, const ScriptEventDescriptor& aScriptEvent ) throw(IllegalArgumentException, RuntimeException)
- {
-+ OSL_TRACE("*** registerScriptEvent %d", nIndex);
- if ( m_xEventAttacher.is() )
-+ {
- m_xEventAttacher->registerScriptEvent( nIndex, aScriptEvent );
-+ fakeVbaEventsHack( nIndex ); // add fake vba events
-+ }
- }
-
- //------------------------------------------------------------------------
- void SAL_CALL OInterfaceContainer::registerScriptEvents( sal_Int32 nIndex, const Sequence< ScriptEventDescriptor >& aScriptEvents ) throw(IllegalArgumentException, RuntimeException)
- {
-+ OSL_TRACE("*** registerScriptEvent(s) %d", nIndex);
- if ( m_xEventAttacher.is() )
-+ {
- m_xEventAttacher->registerScriptEvents( nIndex, aScriptEvents );
-+ fakeVbaEventsHack( nIndex ); // add fake vba events
-+ }
- }
-
- //------------------------------------------------------------------------
- void SAL_CALL OInterfaceContainer::revokeScriptEvent( sal_Int32 nIndex, const ::rtl::OUString& aListenerType, const ::rtl::OUString& aEventMethod, const ::rtl::OUString& aRemoveListenerParam ) throw(IllegalArgumentException, RuntimeException)
- {
-+ OSL_TRACE("*** revokeScriptEvent %d listenertype %s, eventMethod %s", nIndex, rtl::OUStringToOString( aListenerType, RTL_TEXTENCODING_UTF8 ).getStr(), rtl::OUStringToOString( aEventMethod, RTL_TEXTENCODING_UTF8 ).getStr());
- if ( m_xEventAttacher.is() )
- m_xEventAttacher->revokeScriptEvent( nIndex, aListenerType, aEventMethod, aRemoveListenerParam );
- }
-@@ -1064,9 +1180,16 @@ void SAL_CALL OInterfaceContainer::remov
- //------------------------------------------------------------------------
- Sequence< ScriptEventDescriptor > SAL_CALL OInterfaceContainer::getScriptEvents( sal_Int32 nIndex ) throw(IllegalArgumentException, RuntimeException)
- {
-+ OSL_TRACE("getScriptEvents");
- Sequence< ScriptEventDescriptor > aReturn;
- if ( m_xEventAttacher.is() )
-+ {
- aReturn = m_xEventAttacher->getScriptEvents( nIndex );
-+ if ( lcl_hasVbaEvents( aReturn ) )
-+ {
-+ aReturn = lcl_stripVbaEvents( aReturn );
-+ }
-+ }
- return aReturn;
- }
-
---- forms/source/misc/makefile.mk.old 2009-04-02 11:04:11.000000000 +0000
-+++ forms/source/misc/makefile.mk 2009-04-06 16:41:59.000000000 +0000
-@@ -45,6 +45,7 @@ ENABLE_EXCEPTIONS=TRUE
- # --- Types -------------------------------------
-
- INCPRE+=$(SOLARINCDIR)$/offuh
-+INCPRE*=$(INCCOM)$/$(TARGET)
-
- # --- Files -------------------------------------
-
-@@ -62,3 +63,12 @@ SLOFILES= $(SLO)$/limitedformats.obj \
-
- .INCLUDE : target.mk
-
-+ALLTAR : \
-+ $(MISC)$/$(TARGET).don \
-+
-+$(SLOFILES) : $(MISC)$/$(TARGET).don
-+
-+$(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb
-+ +$(CPPUMAKER) -O$(INCCOM)$/$(TARGET) -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@
-+ echo $@
-+
---- offapi/com/sun/star/document/XCodeNameQuery.idl.old 1970-01-01 00:00:00.000000000 +0000
-+++ offapi/com/sun/star/document/XCodeNameQuery.idl 2009-04-06 16:41:59.000000000 +0000
-@@ -0,0 +1,56 @@
-+/*************************************************************************
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: XDocumentPropertiesSupplier.idl,v $
-+ *
-+ * $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 __com_sun_star_document_XCodeNameQuery_idl__
-+#define __com_sun_star_document_XCodeNameQuery_idl__
-+
-+#ifndef __com_sun_star_uno_XInterface_idl__
-+#include <com/sun/star/uno/XInterface.idl>
-+#endif
-+
-+//=============================================================================
-+
-+module com { module sun { module star { module document {
-+//=============================================================================
-+interface XCodeNameQuery
-+{
-+ //-------------------------------------------------------------------------
-+ string getCodeNameForObject( [in] com::sun::star::uno::XInterface aObj );
-+};
-+
-+//=============================================================================
-+
-+}; }; }; };
-+
-+#endif
---- offapi/com/sun/star/document/makefile.mk.old 2009-04-02 10:51:33.000000000 +0000
-+++ offapi/com/sun/star/document/makefile.mk 2009-04-06 16:41:59.000000000 +0000
-@@ -115,7 +115,9 @@ IDLFILES=\
- LinkUpdateModes.idl\
- XDocumentRevisionListPersistence.idl\
- DocumentRevisionListPersistence.idl \
-- XDocumentLanguages.idl
-+ XDocumentLanguages.idl \
-+ XCodeNameQuery.idl \
-+
-
- # ------------------------------------------------------------------
-
---- oovbaapi/ooo/vba/XVBAToOOEventDescGen.idl.old 2009-04-02 10:36:29.000000000 +0000
-+++ oovbaapi/ooo/vba/XVBAToOOEventDescGen.idl 2009-04-06 16:41:59.000000000 +0000
-@@ -41,8 +41,8 @@
- module ooo { module vba {
- interface XVBAToOOEventDescGen : com::sun::star::uno::XInterface
- {
-- sequence< com::sun::star::script::ScriptEventDescriptor > getEventDescriptions( [in] com::sun::star::uno::XInterface xControl, [in] string sLibModName, [in] sequence< string > handlerExts );
-- com::sun::star::script::XScriptEventsSupplier getEventSupplier( [in] com::sun::star::uno::XInterface xControl );
-+ sequence< com::sun::star::script::ScriptEventDescriptor > getEventDescriptions( [in] com::sun::star::uno::XInterface xControl, [in] string sCodeName );
-+ com::sun::star::script::XScriptEventsSupplier getEventSupplier( [in] com::sun::star::uno::XInterface xControl, [in] string sCodeName );
- };
-
- }; };
---- sc/inc/document.hxx.old 2009-04-06 16:41:50.000000000 +0000
-+++ sc/inc/document.hxx 2009-04-06 16:41:59.000000000 +0000
-@@ -292,6 +292,7 @@ private:
-
- ::std::auto_ptr<ScExternalRefManager> pExternalRefMgr;
- String aDocName; // opt: Dokumentname
-+ String aDocCodeName; // opt: Dokumentname
- ScRangePairListRef xColNameRanges;
- ScRangePairListRef xRowNameRanges;
-
-@@ -438,6 +439,8 @@ public:
-
- SC_DLLPUBLIC const String& GetName() const { return aDocName; }
- void SetName( const String& r ) { aDocName = r; }
-+ const String& GetCodeName() const { return aDocCodeName; }
-+ void SetCodeName( const String& r ) { aDocCodeName = r; }
-
- void GetDocStat( ScDocStat& rDocStat );
-
-@@ -528,6 +531,8 @@ public:
-
- SC_DLLPUBLIC BOOL HasTable( SCTAB nTab ) const;
- SC_DLLPUBLIC BOOL GetName( SCTAB nTab, String& rName ) const;
-+ SC_DLLPUBLIC BOOL GetCodeName( SCTAB nTab, String& rName ) const;
-+ SC_DLLPUBLIC BOOL SetCodeName( SCTAB nTab, String& rName );
- SC_DLLPUBLIC BOOL GetTable( const String& rName, SCTAB& rTab ) const;
- SC_DLLPUBLIC inline SCTAB GetTableCount() const { return nMaxTableNumber; }
- SvNumberFormatterIndexTable* GetFormatExchangeList() const { return pFormatExchangeList; }
---- sc/inc/docuno.hxx.old 2009-04-02 10:45:43.000000000 +0000
-+++ sc/inc/docuno.hxx 2009-04-06 16:41:59.000000000 +0000
-@@ -76,6 +76,8 @@ class SvxFmDrawPage;
- class SvxDrawPage;
- class ScRangeList;
-
-+#include <com/sun/star/document/XCodeNameQuery.hpp>
-+
- class SC_DLLPUBLIC ScModelObj : public SfxBaseModel,
- public com::sun::star::sheet::XSpreadsheetDocument,
- public com::sun::star::document::XActionLockable,
-@@ -89,6 +91,7 @@ class SC_DLLPUBLIC ScModelObj : public S
- public com::sun::star::view::XRenderable,
- public com::sun::star::document::XLinkTargetSupplier,
- public com::sun::star::beans::XPropertySet,
-+ public com::sun::star::document::XCodeNameQuery,
- public SvxFmMSFactory, // derived from XMultiServiceFactory
- public com::sun::star::lang::XServiceInfo,
- public ::com::sun::star::util::XChangesNotifier
-@@ -315,6 +318,8 @@ public:
- virtual void SAL_CALL removeChangesListener( const ::com::sun::star::uno::Reference<
- ::com::sun::star::util::XChangesListener >& aListener )
- throw (::com::sun::star::uno::RuntimeException);
-+ virtual rtl::OUString SAL_CALL getCodeNameForObject( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& aObj )
-+ throw(::com::sun::star::uno::RuntimeException);
- };
-
-
---- sc/inc/scextopt.hxx.old 2009-04-06 16:41:49.000000000 +0000
-+++ sc/inc/scextopt.hxx 2009-04-06 16:41:59.000000000 +0000
-@@ -124,6 +124,8 @@ public:
- const String& GetCodeName( size_t nIdx ) const;
- /** Appends a codename for a sheet. */
- void AppendCodeName( const String& rCodeName );
-+ void SetCodeName( const String& rCodeName, size_t nIdx );
-+ void DeleteCodeName( size_t nIdx );
-
- private:
- ::std::auto_ptr< ScExtDocOptionsImpl > mxImpl;
---- sc/inc/table.hxx.old 2009-04-06 16:41:50.000000000 +0000
-+++ sc/inc/table.hxx 2009-04-06 16:41:59.000000000 +0000
-@@ -85,6 +85,7 @@ private:
- ScColumn aCol[MAXCOLCOUNT];
-
- String aName;
-+ String aCodeName;
- String aComment;
- BOOL bScenario;
- BOOL bLayoutRTL;
-@@ -215,6 +216,9 @@ public:
- void GetName( String& rName ) const;
- void SetName( const String& rNewName );
-
-+ void GetCodeName( String& rName ) const { rName = aCodeName; }
-+ void SetCodeName( const String& rNewName ) { aCodeName = rNewName; }
-+
- const String& GetUpperName() const;
-
- const String& GetPageStyle() const { return aPageStyle; }
---- sc/source/core/data/document.cxx
-+++ sc/source/core/data/document.cxx
-@@ -154,6 +154,32 @@ BOOL ScDocument::GetName( SCTAB nTab, St
- return FALSE;
- }
-
-+BOOL ScDocument::SetCodeName( SCTAB nTab, String& rName )
-+{
-+ if (VALIDTAB(nTab))
-+ {
-+ if (pTab[nTab])
-+ {
-+ pTab[nTab]->SetCodeName( rName );
-+ return TRUE;
-+ }
-+ }
-+ OSL_TRACE( "**** can't set code name %s", rtl::OUStringToOString( rName, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ return FALSE;
-+}
-+
-+BOOL ScDocument::GetCodeName( SCTAB nTab, String& rName ) const
-+{
-+ if (VALIDTAB(nTab))
-+ if (pTab[nTab])
-+ {
-+ pTab[nTab]->GetCodeName( rName );
-+ return TRUE;
-+ }
-+ rName.Erase();
-+ return FALSE;
-+}
-+
-
- BOOL ScDocument::GetTable( const String& rName, SCTAB& rTab ) const
- {
-@@ -293,6 +319,7 @@ BOOL ScDocument::InsertTab( SCTAB nPos,
- if (nPos == SC_TAB_APPEND || nPos == nTabCount)
- {
- pTab[nTabCount] = new ScTable(this, nTabCount, rName);
-+ pTab[nTabCount]->SetCodeName( rName );
- ++nMaxTableNumber;
- if ( bExternalDocument )
- pTab[nTabCount]->SetVisible( FALSE );
-@@ -325,10 +352,16 @@ BOOL ScDocument::InsertTab( SCTAB nPos,
- for (i = 0; i <= MAXTAB; i++)
- if (pTab[i])
- pTab[i]->UpdateInsertTab(nPos);
-+
- for (i = nTabCount; i > nPos; i--)
-+ {
- pTab[i] = pTab[i - 1];
-+ }
-+
- pTab[nPos] = new ScTable(this, nPos, rName);
-+ pTab[nPos]->SetCodeName( rName );
- ++nMaxTableNumber;
-+
- // UpdateBroadcastAreas must be called between UpdateInsertTab,
- // which ends listening, and StartAllListeners, to not modify
- // areas that are to be inserted by starting listeners.
-@@ -420,7 +453,10 @@ BOOL ScDocument::DeleteTab( SCTAB nTab,
- pRefUndoDoc ? pRefUndoDoc->pTab[i] : 0);
- delete pTab[nTab];
- for (i=nTab + 1; i < nTabCount; i++)
-+ {
- pTab[i - 1] = pTab[i];
-+ }
-+
- pTab[nTabCount - 1] = NULL;
- --nMaxTableNumber;
- for (i = 0; i <= MAXTAB; i++)
---- sc/source/core/data/table1.cxx.old 2009-04-06 16:41:50.000000000 +0000
-+++ sc/source/core/data/table1.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -125,6 +125,7 @@ extern BOOL bIsOlk, bOderSo;
- ScTable::ScTable( ScDocument* pDoc, SCTAB nNewTab, const String& rNewName,
- BOOL bColInfo, BOOL bRowInfo ) :
- aName( rNewName ),
-+ aCodeName( rNewName ),
- bScenario( FALSE ),
- bLayoutRTL( FALSE ),
- bLoadingRTL( FALSE ),
---- sc/source/filter/excel/excimp8.cxx.old 2009-04-06 16:41:59.000000000 +0000
-+++ sc/source/filter/excel/excimp8.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -114,7 +114,7 @@ using namespace com::sun::star;
- script::ModuleInfo lcl_InitModuleInfo( SfxObjectShell& rDocSh, String& sModule );
-
- ImportExcel8::ImportExcel8( XclImpRootData& rImpData, SvStream& rStrm ) :
-- ImportExcel( rImpData, rStrm )
-+ ImportExcel( rImpData, rStrm ), mnTab(0)
- {
- delete pFormConv;
-
-@@ -237,9 +237,15 @@ void ImportExcel8::Codename( BOOL bWorkb
- if( aName.Len() )
- {
- if( bWorkbookGlobals )
-+ {
- GetExtDocOptions().GetDocSettings().maGlobCodeName = aName;
-+ GetDoc().SetCodeName( aName );
-+ }
- else
-+ {
- GetExtDocOptions().AppendCodeName( aName );
-+ GetDoc().SetCodeName( mnTab++, aName );
-+ }
- }
- }
- }
---- sc/source/filter/inc/excimp8.hxx.old 2009-04-06 16:41:49.000000000 +0000
-+++ sc/source/filter/inc/excimp8.hxx 2009-04-06 16:41:59.000000000 +0000
-@@ -52,6 +52,7 @@ class XclImpStream;
-
- class ImportExcel8 : public ImportExcel
- {
-+ SCTAB mnTab;
- protected:
- ExcScenarioList aScenList;
-
---- sc/source/ui/unoobj/docuno.cxx
-+++ sc/source/ui/unoobj/docuno.cxx
-@@ -104,6 +104,7 @@ using namespace com::sun::star;
- // alles ohne Which-ID, Map nur fuer PropertySetInfo
-
- //! umbenennen, sind nicht mehr nur Options
-+#include <com/sun/star/script/ScriptEventDescriptor.hpp>
- const SfxItemPropertyMapEntry* lcl_GetDocOptPropertyMap()
- {
- static SfxItemPropertyMapEntry aDocOptPropertyMap_Impl[] =
-@@ -311,6 +312,7 @@ uno::Any SAL_CALL ScModelObj::queryInter
- SC_QUERYINTERFACE( view::XRenderable )
- SC_QUERYINTERFACE( document::XLinkTargetSupplier )
- SC_QUERYINTERFACE( beans::XPropertySet )
-+ SC_QUERYINTERFACE( document::XCodeNameQuery )
- SC_QUERYINTERFACE( lang::XMultiServiceFactory )
- SC_QUERYINTERFACE( lang::XServiceInfo )
- SC_QUERYINTERFACE( util::XChangesNotifier )
-@@ -1717,7 +1719,49 @@ uno::Sequence<rtl::OUString> SAL_CALL Sc
-
- return concatServiceNames( aMyServices, aDrawServices );
- }
--
-+// XCodeNameQuery
-+rtl::OUString SAL_CALL
-+ScModelObj::getCodeNameForObject( const uno::Reference< uno::XInterface >& xIf ) throw( uno::RuntimeException )
-+{
-+ rtl::OUString sCodeName;
-+ if ( pDocShell )
-+ {
-+ OSL_TRACE( "*** In ScModelObj::getCodeNameForObject");
-+ // need to find the page ( and index ) for this control
-+ uno::Reference< drawing::XDrawPagesSupplier > xSupplier( pDocShell->GetModel(), uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xIndex( xSupplier->getDrawPages(), uno::UNO_QUERY_THROW );
-+ sal_Int32 nLen = xIndex->getCount();
-+ bool bMatched = false;
-+ uno::Sequence< script::ScriptEventDescriptor > aFakeEvents;
-+ for ( sal_Int32 index = 0; index < nLen; ++index )
-+ {
-+ try
-+ {
-+ uno::Reference< form::XFormsSupplier > xFormSupplier( xIndex->getByIndex( index ), uno::UNO_QUERY_THROW );
-+ uno::Reference< container::XIndexAccess > xFormIndex( xFormSupplier->getForms(), uno::UNO_QUERY_THROW );
-+ // get the www-standard container
-+ uno::Reference< container::XIndexAccess > xFormControls( xFormIndex->getByIndex(0), uno::UNO_QUERY_THROW );
-+ sal_Int32 nCntrls = xFormControls->getCount();
-+ for( sal_Int32 cIndex = 0; cIndex < nCntrls; ++cIndex )
-+ {
-+ uno::Reference< uno::XInterface > xControl( xFormControls->getByIndex( cIndex ), uno::UNO_QUERY_THROW );
-+ bMatched = ( xControl == xIf );
-+ if ( bMatched )
-+ {
-+ String sName;
-+ pDocShell->GetDocument()->GetCodeName( index, sName );
-+ sCodeName = sName;
-+ }
-+ }
-+ }
-+ catch( uno::Exception& ) {}
-+ if ( bMatched )
-+ break;
-+ }
-+ }
-+ // Probably should throw here ( if !bMatched )
-+ return sCodeName;
-+}
- // XServiceInfo
-
- rtl::OUString SAL_CALL ScModelObj::getImplementationName() throw(uno::RuntimeException)
---- sc/source/ui/vba/vbaworksheet.cxx.old 2009-04-02 10:45:35.000000000 +0000
-+++ sc/source/ui/vba/vbaworksheet.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -794,7 +794,7 @@ ScVbaWorksheet::getServiceNames()
- rtl::OUString SAL_CALL
- ScVbaWorksheet::getCodeName() throw (css::uno::RuntimeException)
- {
--#ifdef VBA_OOBUILD_HACK
-+#if 0
- uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( getModel(), uno::UNO_QUERY_THROW );
- SCTAB nTab = 0;
- rtl::OUString aSheetName = getName();
-@@ -815,7 +815,7 @@ ScVbaWorksheet::getCodeName() throw (css
- throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
- #endif
- }
--#ifdef VBA_OOBUILD_HACK
-+#if 0
- void SAL_CALL
- ScVbaWorksheet::setCodeName( const rtl::OUString& sCodeName ) throw (css::uno::RuntimeException)
- {
---- scripting/source/dlgprov/dlgevtatt.cxx.old 2009-04-06 16:41:59.000000000 +0000
-+++ scripting/source/dlgprov/dlgevtatt.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -121,18 +121,20 @@ namespace dlgprov
- DialogVBAScriptListenerImpl::DialogVBAScriptListenerImpl( const Reference< XComponentContext >& rxContext, const Reference< awt::XControl >& rxControl, const Reference< frame::XModel >& xModel ) : DialogScriptListenerImpl( rxContext )
- {
- Reference< XMultiComponentFactory > xSMgr( m_xContext->getServiceManager() );
-+ Sequence< Any > args(1);
- if ( xSMgr.is() )
- {
-- Sequence< Any > args(1);
- args[0] <<= xModel;
- mxListener = Reference< XScriptListener >( xSMgr->createInstanceWithArgumentsAndContext( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.EventListener" ) ), args, m_xContext ), UNO_QUERY );
- }
- if ( rxControl.is() )
- {
-- Reference< XPropertySet > xProps( rxControl->getModel(), UNO_QUERY );
- try
- {
-+ Reference< XPropertySet > xProps( rxControl->getModel(), UNO_QUERY_THROW );
- xProps->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Name") ) ) >>= msDialogCodeName;
-+ xProps.set( mxListener, UNO_QUERY_THROW );
-+ xProps->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Model") ), args[ 0 ] );
- }
- catch ( Exception& ) {}
- }
-@@ -193,7 +195,7 @@ namespace dlgprov
- return it->second;
- }
- #ifdef FAKE_VBA_EVENT_SUPPORT
-- Reference< XScriptEventsSupplier > DialogEventsAttacherImpl::getFakeVbaEventsSupplier( const Reference< XControl >& xControl )
-+ Reference< XScriptEventsSupplier > DialogEventsAttacherImpl::getFakeVbaEventsSupplier( const Reference< XControl >& xControl, rtl::OUString& sControlName )
- {
- Reference< XScriptEventsSupplier > xEventsSupplier;
- Reference< XMultiComponentFactory > xSMgr( m_xContext->getServiceManager() );
-@@ -201,7 +203,7 @@ namespace dlgprov
- {
- Reference< ooo::vba::XVBAToOOEventDescGen > xVBAToOOEvtDesc( xSMgr->createInstanceWithContext( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAToOOEventDesc" ) ), m_xContext ), UNO_QUERY );
- if ( xVBAToOOEvtDesc.is() )
-- xEventsSupplier.set( xVBAToOOEvtDesc->getEventSupplier( xControl ), UNO_QUERY );
-+ xEventsSupplier.set( xVBAToOOEvtDesc->getEventSupplier( xControl, sControlName ), UNO_QUERY );
-
- }
- return xEventsSupplier;
-@@ -324,6 +326,20 @@ namespace dlgprov
- // go over all objects
- const Reference< XInterface >* pObjects = Objects.getConstArray();
- sal_Int32 nObjCount = Objects.getLength();
-+#ifdef FAKE_VBA_EVENT_SUPPORT
-+ Reference< awt::XControl > xDlgControl( Objects[ nObjCount - 1 ], uno::UNO_QUERY ); // last object is the dialog
-+ rtl::OUString sDialogCodeName;
-+ if ( xDlgControl.is() )
-+ {
-+ Reference< XPropertySet > xProps( xDlgControl->getModel(), UNO_QUERY );
-+ try
-+ {
-+ xProps->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Name") ) ) >>= sDialogCodeName;
-+ }
-+ catch( Exception& ){}
-+ }
-+#endif
-+
- for ( sal_Int32 i = 0; i < nObjCount; ++i )
- {
- // We know that we have to do with instances of XControl.
-@@ -338,7 +354,7 @@ namespace dlgprov
- Reference< XScriptEventsSupplier > xEventsSupplier( xControlModel, UNO_QUERY );
- attachEventsToControl( xControl, xEventsSupplier, Helper );
- #ifdef FAKE_VBA_EVENT_SUPPORT
-- xEventsSupplier.set( getFakeVbaEventsSupplier( xControl ) );
-+ xEventsSupplier.set( getFakeVbaEventsSupplier( xControl, sDialogCodeName ) );
- attachEventsToControl( xControl, xEventsSupplier, Helper );
- #endif
- }
---- scripting/source/dlgprov/dlgevtatt.hxx.old 2009-04-02 10:36:33.000000000 +0000
-+++ scripting/source/dlgprov/dlgevtatt.hxx 2009-04-06 16:41:59.000000000 +0000
-@@ -46,6 +46,9 @@
- #include <com/sun/star/script/XScriptEventsSupplier.hpp>
-
- #include <hash_map>
-+
-+#define FAKE_VBA_EVENT_SUPPORT 1
-+
- //.........................................................................
- namespace dlgprov
- {
-@@ -71,7 +74,7 @@ namespace dlgprov
- ::com::sun::star::uno::Reference< ::com::sun::star::script::XEventAttacher > m_xEventAttacher;
- ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptListener > getScriptListenerForKey( const rtl::OUString& sScriptName ) throw ( ::com::sun::star::uno::RuntimeException );
- #ifdef FAKE_VBA_EVENT_SUPPORT
-- ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptEventsSupplier > getFakeVbaEventsSupplier( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl );
-+ ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptEventsSupplier > getFakeVbaEventsSupplier( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl, rtl::OUString& sCodeName );
- #endif
- void SAL_CALL attachEventsToControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl, const ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptEventsSupplier >& events, const ::com::sun::star::uno::Any& Helper );
- public:
---- scripting/source/vbaevents/eventhelper.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ scripting/source/vbaevents/eventhelper.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -0,0 +1,919 @@
-+#include <comphelper/processfactory.hxx>
-+#include <comphelper/uno3.hxx>
-+#include <comphelper/proparrhlp.hxx>
-+#include <comphelper/propertycontainer.hxx>
-+
-+#include <ooo/vba/XVBAToOOEventDescGen.hpp>
-+
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <com/sun/star/beans/XIntrospection.hpp>
-+#include <com/sun/star/beans/PropertyAttribute.hpp>
-+
-+#include <com/sun/star/lang/XMultiComponentFactory.hpp>
-+#include <com/sun/star/lang/XServiceName.hpp>
-+#include <com/sun/star/lang/XServiceInfo.hpp>
-+#include <com/sun/star/lang/XInitialization.hpp>
-+
-+#include <com/sun/star/frame/XModel.hpp>
-+
-+#include <com/sun/star/script/XLibraryContainer.hpp>
-+#include <com/sun/star/script/ScriptEventDescriptor.hpp>
-+#include <com/sun/star/script/provider/XScriptProviderSupplier.hpp>
-+
-+#include <com/sun/star/drawing/XControlShape.hpp>
-+
-+#include <com/sun/star/awt/XControl.hpp>
-+#include <com/sun/star/awt/XDialog.hpp>
-+#include <com/sun/star/awt/KeyEvent.hpp>
-+#include <com/sun/star/awt/MouseEvent.hpp>
-+
-+#include <msforms/ReturnInteger.hpp>
-+
-+#include <sfx2/objsh.hxx>
-+#include <basic/sbstar.hxx>
-+#include <basic/basmgr.hxx>
-+#include <basic/sbmeth.hxx>
-+#include <basic/sbmod.hxx>
-+#include <basic/sbx.hxx>
-+
-+
-+
-+
-+// for debug
-+#include <comphelper/anytostring.hxx>
-+
-+
-+#include <com/sun/star/lang/XMultiComponentFactory.hpp>
-+#include <com/sun/star/script/XScriptListener.hpp>
-+#include <cppuhelper/implbase1.hxx>
-+#include <cppuhelper/implbase2.hxx>
-+#include <comphelper/evtmethodhelper.hxx>
-+
-+#include <set>
-+#include <list>
-+#include <hash_map>
-+
-+using namespace ::com::sun::star;
-+using namespace ::com::sun::star::script;
-+using namespace ::com::sun::star::uno;
-+using namespace ::ooo::vba;
-+
-+
-+// Some constants
-+const static rtl::OUString DELIM = rtl::OUString::createFromAscii( "::" );
-+const static sal_Int32 DELIMLEN = DELIM.getLength();
-+
-+#if 0
-+void dumpListeners( const Reference< beans::XIntrospection >& xIntrospection, const Reference<XInterface>& xIfc)
-+{
-+ Reference< beans::XIntrospectionAccess > xIntrospectionAccess;
-+ if ( xIntrospection.is() )
-+ {
-+ xIntrospectionAccess = xIntrospection->inspect(
-+ makeAny( xIfc ) );
-+ Sequence< Type > aControlListeners =
-+ xIntrospectionAccess->getSupportedListeners();
-+ sal_Int32 nLength = aControlListeners.getLength();
-+
-+ for ( sal_Int32 i = 0; i< nLength; ++i )
-+ {
-+ Type& listType = aControlListeners[ i ];
-+ rtl::OUString sFullTypeName = listType.getTypeName();
-+ rtl::OUString sTypeName = listType.getTypeName();
-+ sal_Int32 lastDotIndex = -1;
-+ if ( ( lastDotIndex = sFullTypeName.lastIndexOf( '.' ) ) > -1 )
-+ {
-+ sTypeName = sFullTypeName.copy( lastDotIndex + 1 );
-+ }
-+ Sequence< ::rtl::OUString > sMeths = comphelper::getEventMethodsForType( listType );
-+ sal_Int32 sMethLen = sMeths.getLength();
-+ for ( sal_Int32 j=0 ; j < sMethLen; ++j )
-+ {
-+ OSL_TRACE("**Listener [%d] Type[%s] Method[%s]",j,
-+ rtl::OUStringToOString( sTypeName,
-+ RTL_TEXTENCODING_UTF8 ).getStr(),
-+ rtl::OUStringToOString( sMeths[ j ],
-+ RTL_TEXTENCODING_UTF8 ).getStr() );
-+ }
-+ }
-+
-+ }
-+}
-+
-+void dumpEvent( const ScriptEvent& evt )
-+{
-+ OSL_TRACE("dumpEvent: Source %s",
-+ rtl::OUStringToOString( comphelper::anyToString( makeAny(evt.Source)),
-+ RTL_TEXTENCODING_UTF8 ).getStr() );
-+
-+ OSL_TRACE("dumpEvent: ScriptType %s",
-+ rtl::OUStringToOString( evt.ScriptType,
-+ RTL_TEXTENCODING_UTF8 ).getStr() );
-+
-+ OSL_TRACE("dumpEvent: ScriptCode %s",
-+ rtl::OUStringToOString( evt.ScriptCode,
-+ RTL_TEXTENCODING_UTF8 ).getStr() );
-+
-+ OSL_TRACE("dumpEvent: ListenerType %s",
-+ rtl::OUStringToOString( evt.ListenerType.getTypeName(),
-+ RTL_TEXTENCODING_UTF8 ).getStr() );
-+
-+ OSL_TRACE("dumpEvent: Listener methodname %s",
-+ rtl::OUStringToOString( evt.MethodName,
-+ RTL_TEXTENCODING_UTF8 ).getStr() );
-+
-+ OSL_TRACE("dumpEvent: arguments;");
-+ sal_Int32 nLen = evt.Arguments.getLength();
-+ for ( sal_Int32 index=0; index < nLen; ++index )
-+ {
-+ OSL_TRACE("\t [%d] %s", index,
-+ rtl::OUStringToOString( comphelper::anyToString( evt.Arguments[ index ] ),
-+ RTL_TEXTENCODING_UTF8 ).getStr() );
-+
-+ }
-+}
-+
-+#endif
-+
-+bool isKeyEventOk( awt::KeyEvent& evt, const Sequence< Any >& params )
-+{
-+ if ( !( params.getLength() > 0 ) ||
-+ !( params[ 0 ] >>= evt ) )
-+ return false;
-+ return true;
-+}
-+
-+bool isMouseEventOk( awt::MouseEvent& evt, const Sequence< Any >& params )
-+{
-+ if ( !( params.getLength() > 0 ) ||
-+ !( params[ 0 ] >>= evt ) )
-+ return false;
-+ return true;
-+}
-+
-+Sequence< Any > ooMouseEvtToVBADblClick( const Sequence< Any >& params )
-+{
-+ Sequence< Any > translatedParams;
-+ awt::MouseEvent evt;
-+
-+ if ( !( isMouseEventOk(evt, params)) ||
-+ (evt.ClickCount != 2) )
-+ return Sequence< Any >();
-+ // give back orig params, this will signal that the event is good
-+ return params;
-+}
-+
-+Sequence< Any > ooMouseEvtToVBAMouseEvt( const Sequence< Any >& params )
-+{
-+ Sequence< Any > translatedParams;
-+ awt::MouseEvent evt;
-+
-+ if ( !isMouseEventOk(evt, params) )
-+ return Sequence< Any >();
-+
-+ translatedParams.realloc(4);
-+
-+ // Buttons
-+ translatedParams[ 0 ] <<= evt.Buttons;
-+ // Shift
-+ translatedParams[ 1 ] <<= evt.Modifiers;
-+ // X
-+ translatedParams[ 2 ] <<= evt.X;
-+ // Y
-+ translatedParams[ 3 ] <<= evt.Y;
-+ return translatedParams;
-+}
-+
-+Sequence< Any > ooKeyPressedToVBAKeyPressed( const Sequence< Any >& params )
-+{
-+ Sequence< Any > translatedParams;
-+ awt::KeyEvent evt;
-+
-+ if ( !isKeyEventOk( evt, params ) )
-+ return Sequence< Any >();
-+
-+ translatedParams.realloc(1);
-+
-+ msforms::ReturnInteger keyCode;
-+ keyCode.Value = evt.KeyCode;
-+ translatedParams[0] <<= keyCode;
-+ return translatedParams;
-+}
-+
-+Sequence< Any > ooKeyPressedToVBAKeyUpDown( const Sequence< Any >& params )
-+{
-+ Sequence< Any > translatedParams;
-+ awt::KeyEvent evt;
-+
-+ if ( !isKeyEventOk( evt, params ) )
-+ return Sequence< Any >();
-+
-+ translatedParams.realloc(2);
-+
-+ msforms::ReturnInteger keyCode;
-+ sal_Int8 shift = evt.Modifiers;
-+
-+ // #TODO check whether values from OOO conform to values generated from vba
-+ keyCode.Value = evt.KeyCode;
-+ translatedParams[0] <<= keyCode;
-+ translatedParams[1] <<= shift;
-+ return translatedParams;
-+}
-+
-+typedef Sequence< Any > (*Translator)(const Sequence< Any >&);
-+
-+struct TranslateInfo
-+{
-+ rtl::OUString sVBAName;
-+ Translator toVBA;
-+};
-+
-+
-+typedef std::hash_map< rtl::OUString,
-+std::list< TranslateInfo >,
-+::rtl::OUStringHash,
-+::std::equal_to< ::rtl::OUString > > EventInfoHash;
-+
-+
-+EventInfoHash& getEventTransInfo()
-+{
-+ static bool initialised = false;
-+ static EventInfoHash eventTransInfo;
-+ if ( !initialised )
-+ {
-+ TranslateInfo info;
-+ // actionPerformed ooo event
-+ std::list< TranslateInfo > actionInfos;
-+ info.sVBAName = rtl::OUString::createFromAscii("_Click");
-+ info.toVBA = NULL;
-+ actionInfos.push_back( info );
-+ info.sVBAName = rtl::OUString::createFromAscii("_Change");
-+ info.toVBA = NULL;
-+ actionInfos.push_back( info );
-+ eventTransInfo[ rtl::OUString::createFromAscii("actionPerformed") ] = actionInfos;
-+ // changed ooo event
-+ std::list< TranslateInfo > changeInfos;
-+ info.sVBAName = rtl::OUString::createFromAscii("_Change");
-+ info.toVBA = NULL;
-+ changeInfos.push_back( info );
-+ eventTransInfo[ rtl::OUString::createFromAscii("changed") ] = changeInfos;
-+ // focusGained ooo event
-+ std::list< TranslateInfo > focusGainedInfos;
-+ info.sVBAName = rtl::OUString::createFromAscii("_GotFocus");
-+ info.toVBA = NULL;
-+ focusGainedInfos.push_back( info );
-+ eventTransInfo[ rtl::OUString::createFromAscii("focusGained") ] = focusGainedInfos;
-+ // focusLost ooo event
-+ std::list< TranslateInfo > focusLostInfos;
-+ info.sVBAName = rtl::OUString::createFromAscii("_LostFocus");
-+ info.toVBA = NULL;
-+ focusLostInfos.push_back( info );
-+ eventTransInfo[ rtl::OUString::createFromAscii("focusGained") ] = focusLostInfos;
-+ // adjustmentValueChanged ooo event
-+ std::list< TranslateInfo > adjustInfos;
-+ info.sVBAName = rtl::OUString::createFromAscii("_Scroll");
-+ info.toVBA = NULL;
-+ adjustInfos.push_back( info );
-+ info.sVBAName = rtl::OUString::createFromAscii("_Change");
-+ info.toVBA = NULL;
-+ adjustInfos.push_back( info );
-+ eventTransInfo[ rtl::OUString::createFromAscii("adjustmentValueChanged") ] = adjustInfos;
-+ // textChanged ooo event
-+ std::list< TranslateInfo > txtChangedInfos;
-+ info.sVBAName = rtl::OUString::createFromAscii("_Change");
-+ info.toVBA = NULL;
-+ txtChangedInfos.push_back( info );
-+ eventTransInfo[ rtl::OUString::createFromAscii("textChanged") ] = txtChangedInfos;
-+
-+ // keyReleased ooo event
-+ std::list< TranslateInfo > keyReleasedInfos;
-+ info.sVBAName = rtl::OUString::createFromAscii("_KeyUp");
-+ info.toVBA = ooKeyPressedToVBAKeyUpDown;
-+ keyReleasedInfos.push_back( info );
-+ eventTransInfo[ rtl::OUString::createFromAscii("keyReleased") ] = keyReleasedInfos;
-+ // mouseReleased ooo event
-+ std::list< TranslateInfo > mouseReleasedInfos;
-+ info.sVBAName = rtl::OUString::createFromAscii("_MouseUp");
-+ info.toVBA = ooMouseEvtToVBAMouseEvt;
-+ mouseReleasedInfos.push_back( info );
-+ eventTransInfo[ rtl::OUString::createFromAscii("mouseReleased") ] = mouseReleasedInfos;
-+ // mousePressed ooo event
-+ std::list< TranslateInfo > mousePressedInfos;
-+ info.sVBAName = rtl::OUString::createFromAscii("_MouseDown");
-+ info.toVBA = ooMouseEvtToVBAMouseEvt;
-+ mousePressedInfos.push_back( info );
-+ info.sVBAName = rtl::OUString::createFromAscii("_DblClick");
-+ // emulate double click event
-+ info.toVBA = ooMouseEvtToVBADblClick;
-+ mousePressedInfos.push_back( info );
-+ eventTransInfo[ rtl::OUString::createFromAscii("mousePressed") ] = mousePressedInfos;
-+ // mouseMoved ooo event
-+ std::list< TranslateInfo > mouseMovedInfos;
-+ info.sVBAName = rtl::OUString::createFromAscii("_MouseMove");
-+ info.toVBA = ooMouseEvtToVBAMouseEvt;
-+ mouseMovedInfos.push_back( info );
-+ eventTransInfo[ rtl::OUString::createFromAscii("mouseMoved") ] = mouseMovedInfos;
-+ // keyPressed ooo event
-+ std::list< TranslateInfo > keyPressedInfos;
-+ info.sVBAName = rtl::OUString::createFromAscii("_KeyDown");
-+ info.toVBA = ooKeyPressedToVBAKeyUpDown;
-+ keyPressedInfos.push_back( info );
-+ info.sVBAName = rtl::OUString::createFromAscii("_KeyPress");
-+ info.toVBA = ooKeyPressedToVBAKeyPressed;
-+ keyPressedInfos.push_back( info );
-+ eventTransInfo[ rtl::OUString::createFromAscii("keyPressed") ] = keyPressedInfos;
-+ initialised = true;
-+ }
-+ return eventTransInfo;
-+}
-+
-+// Helper class
-+
-+class ScriptEventHelper
-+{
-+public:
-+ ScriptEventHelper( const Reference< XInterface >& xControl );
-+ Sequence< ScriptEventDescriptor > createEvents( const rtl::OUString& sCodeName );
-+ Sequence< rtl::OUString > getEventListeners();
-+private:
-+ Reference< XComponentContext > m_xCtx;
-+ Reference< XInterface > m_xControl;
-+};
-+
-+bool
-+eventMethodToDescriptor( const ::rtl::OUString& rEventMethod, ScriptEventDescriptor& evtDesc, const ::rtl::OUString& sCodeName )
-+{
-+ // format of ControlListener is TypeName::methodname e.g.
-+ // "com.sun.star.awt.XActionListener::actionPerformed" or
-+ // "XActionListener::actionPerformed
-+
-+ ::rtl::OUString sMethodName;
-+ ::rtl::OUString sTypeName;
-+ sal_Int32 nDelimPos = rEventMethod.indexOf( DELIM );
-+ if ( nDelimPos == -1 )
-+ {
-+ return false;
-+ }
-+ sMethodName = rEventMethod.copy( nDelimPos + DELIMLEN );
-+ sTypeName = rEventMethod.copy( 0, nDelimPos );
-+
-+ EventInfoHash& infos = getEventTransInfo();
-+
-+ // Only create an ScriptEventDescriptor for an event we can translate
-+ // or emulate
-+ if ( sMethodName.getLength()
-+ && sTypeName.getLength()
-+ && ( infos.find( sMethodName ) != infos.end() ) )
-+ {
-+ // just fill in CodeName, when the event fires the other
-+ // info is gathered from the event source to determine what
-+ // event handler we try to call
-+ evtDesc.ScriptCode = sCodeName;
-+ evtDesc.ListenerType = sTypeName;
-+ evtDesc.EventMethod = sMethodName;
-+
-+ // set this it VBAInterop, ensures that it doesn't
-+ // get persisted or shown in property editors
-+ evtDesc.ScriptType = rtl::OUString::createFromAscii(
-+ "VBAInterop" );
-+ return true;
-+ }
-+ return false;
-+
-+}
-+
-+ScriptEventHelper::ScriptEventHelper( const Reference< XInterface >& xControl ) : m_xControl( xControl )
-+{
-+ Reference < beans::XPropertySet > xProps(
-+ ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
-+ m_xCtx.set( xProps->getPropertyValue( rtl::OUString(
-+ RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))),
-+ uno::UNO_QUERY_THROW );
-+}
-+
-+Sequence< rtl::OUString >
-+ScriptEventHelper::getEventListeners()
-+{
-+ Reference< lang::XMultiComponentFactory > xMFac(
-+ m_xCtx->getServiceManager(), UNO_QUERY );
-+ std::list< rtl::OUString > eventMethods;
-+
-+ if ( xMFac.is() )
-+ {
-+ Reference< beans::XIntrospection > xIntrospection(
-+ xMFac->createInstanceWithContext( rtl::OUString(
-+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.beans.Introspection" ) ), m_xCtx ), UNO_QUERY );
-+#if 0
-+ dumpListeners( xIntrospection, m_xControl );
-+ dumpListeners( xIntrospection, m_xControl->getModel() );
-+#endif
-+ Reference< beans::XIntrospectionAccess > xIntrospectionAccess;
-+ if ( xIntrospection.is() )
-+ {
-+ xIntrospectionAccess = xIntrospection->inspect(
-+ makeAny( m_xControl ) );
-+ Sequence< Type > aControlListeners =
-+ xIntrospectionAccess->getSupportedListeners();
-+ sal_Int32 nLength = aControlListeners.getLength();
-+ for ( sal_Int32 i = 0; i< nLength; ++i )
-+ {
-+ Type& listType = aControlListeners[ i ];
-+ rtl::OUString sFullTypeName = listType.getTypeName();
-+ Sequence< ::rtl::OUString > sMeths =
-+ comphelper::getEventMethodsForType( listType );
-+ sal_Int32 sMethLen = sMeths.getLength();
-+ for ( sal_Int32 j=0 ; j < sMethLen; ++j )
-+ {
-+ rtl::OUString sEventMethod = sFullTypeName;
-+ sEventMethod += DELIM;
-+ sEventMethod += sMeths[ j ];
-+ eventMethods.push_back( sEventMethod );
-+ }
-+ }
-+
-+ }
-+ }
-+
-+ Sequence< rtl::OUString > sEventMethodNames( eventMethods.size() );
-+ std::list< rtl::OUString >::const_iterator it = eventMethods.begin();
-+ rtl::OUString* pDest = sEventMethodNames.getArray();
-+
-+ for ( ; it != eventMethods.end(); ++it, ++pDest )
-+ *pDest = *it;
-+
-+ return sEventMethodNames;
-+}
-+
-+Sequence< ScriptEventDescriptor >
-+ScriptEventHelper::createEvents( const rtl::OUString& sCodeName )
-+{
-+ Sequence< rtl::OUString > aControlListeners = getEventListeners();
-+ rtl::OUString* pSrc = aControlListeners.getArray();
-+ sal_Int32 nLength = aControlListeners.getLength();
-+
-+ Sequence< ScriptEventDescriptor > aDest( nLength );
-+ sal_Int32 nEvts = 0;
-+ for ( sal_Int32 i = 0; i< nLength; ++i, ++pSrc )
-+ {
-+ // from getListeners eventName is of form
-+ // "com.sun.star.awt.XActionListener::actionPerformed"
-+ // we need to strip "com.sun.star.awt." from that for form
-+ // controls
-+ ScriptEventDescriptor evtDesc;
-+ if ( eventMethodToDescriptor( *pSrc, evtDesc, sCodeName ) )
-+ {
-+ sal_Int32 dIndex = nEvts;
-+ ++nEvts;
-+ if ( nEvts > aDest.getLength() )
-+ aDest.realloc( nEvts );// should never happen
-+ aDest[ dIndex ] = evtDesc;
-+ }
-+ }
-+ aDest.realloc( nEvts );
-+
-+ return aDest;
-+}
-+
-+
-+typedef ::cppu::WeakImplHelper1< container::XNameContainer > NameContainer_BASE;
-+
-+class ReadOnlyEventsNameContainer : public NameContainer_BASE
-+{
-+public:
-+ ReadOnlyEventsNameContainer( const Sequence< rtl::OUString >& eventMethods, const rtl::OUString& sCodeName );
-+ // XNameContainer
-+
-+ virtual void SAL_CALL insertByName( const ::rtl::OUString&, const Any& ) throw (lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, RuntimeException)
-+ {
-+ throw RuntimeException( rtl::OUString::createFromAscii( "ReadOnly container" ), Reference< XInterface >() );
-+
-+ }
-+ virtual void SAL_CALL removeByName( const ::rtl::OUString& ) throw (::com::sun::star::container::NoSuchElementException, lang::WrappedTargetException, RuntimeException)
-+ {
-+ throw RuntimeException( rtl::OUString::createFromAscii( "ReadOnly container" ), Reference< XInterface >() );
-+ }
-+
-+ // XNameReplace
-+ virtual void SAL_CALL replaceByName( const ::rtl::OUString&, const Any& ) throw (lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, RuntimeException)
-+ {
-+ throw RuntimeException( rtl::OUString::createFromAscii( "ReadOnly container" ), Reference< XInterface >() );
-+
-+ }
-+
-+ // XNameAccess
-+ virtual Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, RuntimeException);
-+ virtual Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (RuntimeException);
-+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (RuntimeException);
-+
-+ // XElementAccess
-+ virtual Type SAL_CALL getElementType( ) throw (RuntimeException)
-+ { return getCppuType(static_cast< const rtl::OUString * >(0) ); }
-+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (RuntimeException)
-+ { return ( ( m_hEvents.size() > 0 ? sal_True : sal_False ) ); }
-+private:
-+
-+typedef std::hash_map< rtl::OUString, Any, ::rtl::OUStringHash,
-+::std::equal_to< ::rtl::OUString > > EventSupplierHash;
-+
-+ EventSupplierHash m_hEvents;
-+};
-+
-+ReadOnlyEventsNameContainer::ReadOnlyEventsNameContainer( const Sequence< rtl::OUString >& eventMethods, const rtl::OUString& sCodeName )
-+{
-+ const rtl::OUString* pSrc = eventMethods.getConstArray();
-+ sal_Int32 nLen = eventMethods.getLength();
-+ for ( sal_Int32 index = 0; index < nLen; ++index, ++pSrc )
-+ {
-+ Any aDesc;
-+ ScriptEventDescriptor evtDesc;
-+ if ( eventMethodToDescriptor( *pSrc, evtDesc, sCodeName ) )
-+ {
-+ aDesc <<= evtDesc;
-+ m_hEvents[ *pSrc ] = aDesc;
-+ }
-+ }
-+}
-+
-+Any SAL_CALL
-+ReadOnlyEventsNameContainer::getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, RuntimeException){
-+ EventSupplierHash::const_iterator it = m_hEvents.find( aName );
-+ if ( it == m_hEvents.end() )
-+ throw container::NoSuchElementException();
-+ return it->second;
-+}
-+
-+Sequence< ::rtl::OUString > SAL_CALL
-+ReadOnlyEventsNameContainer::getElementNames( ) throw (RuntimeException)
-+{
-+ Sequence< ::rtl::OUString > names(m_hEvents.size());
-+ rtl::OUString* pDest = names.getArray();
-+ EventSupplierHash::const_iterator it = m_hEvents.begin();
-+ EventSupplierHash::const_iterator it_end = m_hEvents.end();
-+ for ( sal_Int32 index = 0; it != it_end; ++index, ++pDest, ++it )
-+ *pDest = it->first;
-+ return names;
-+}
-+
-+sal_Bool SAL_CALL
-+ReadOnlyEventsNameContainer::hasByName( const ::rtl::OUString& aName ) throw (RuntimeException)
-+{
-+ EventSupplierHash::const_iterator it = m_hEvents.find( aName );
-+ if ( it == m_hEvents.end() )
-+ return sal_False;
-+ return sal_True;
-+}
-+
-+typedef ::cppu::WeakImplHelper1< XScriptEventsSupplier > EventsSupplier_BASE;
-+
-+class ReadOnlyEventsSupplier : public EventsSupplier_BASE
-+{
-+public:
-+ ReadOnlyEventsSupplier( const Sequence< ::rtl::OUString >& eventMethods, const rtl::OUString& sCodeName )
-+ { m_xNameContainer = new ReadOnlyEventsNameContainer( eventMethods, sCodeName ); }
-+
-+ // XScriptEventSupplier
-+ virtual Reference< container::XNameContainer > SAL_CALL getEvents( ) throw (RuntimeException){ return m_xNameContainer; }
-+private:
-+ Reference< container::XNameContainer > m_xNameContainer;
-+};
-+
-+typedef ::cppu::WeakImplHelper2< XScriptListener, lang::XInitialization > EventListener_BASE;
-+
-+#define EVENTLSTNR_PROPERTY_ID_MODEL 1
-+#define EVENTLSTNR_PROPERTY_MODEL ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Model" ) )
-+
-+class EventListener : public EventListener_BASE
-+ ,public ::comphelper::OMutexAndBroadcastHelper
-+ ,public ::comphelper::OPropertyContainer
-+ ,public ::comphelper::OPropertyArrayUsageHelper< EventListener >
-+
-+{
-+
-+public:
-+ EventListener( const Reference< XComponentContext >& rxContext );
-+ // XEventListener
-+ virtual void SAL_CALL disposing(const lang::EventObject& Source) throw( RuntimeException );
-+
-+ // XScriptListener
-+ virtual void SAL_CALL firing(const ScriptEvent& evt) throw(RuntimeException);
-+ virtual Any SAL_CALL approveFiring(const ScriptEvent& evt) throw(reflection::InvocationTargetException, RuntimeException);
-+ // XPropertySet
-+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException);
-+ // XInitialization
-+ virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException);
-+ // XInterface
-+ DECLARE_XINTERFACE()
-+
-+ // XTypeProvider
-+ DECLARE_XTYPEPROVIDER()
-+ virtual void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
-+ {
-+ OPropertyContainer::setFastPropertyValue( nHandle, rValue );
-+ if ( nHandle == EVENTLSTNR_PROPERTY_ID_MODEL )
-+ setShellFromModel();
-+ }
-+
-+protected:
-+ // OPropertySetHelper
-+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper( );
-+
-+ // OPropertyArrayUsageHelper
-+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
-+
-+private:
-+ void setShellFromModel();
-+ void firing_Impl( const ScriptEvent& evt, Any *pSyncRet=NULL ) throw( RuntimeException );
-+
-+ Reference< XComponentContext > m_xContext;
-+ Reference< frame::XModel > m_xModel;
-+ SfxObjectShell* mpShell;
-+
-+};
-+
-+EventListener::EventListener( const Reference< XComponentContext >& rxContext ) :
-+OPropertyContainer(GetBroadcastHelper()), m_xContext( rxContext ), mpShell( 0 )
-+{
-+ registerProperty( EVENTLSTNR_PROPERTY_MODEL, EVENTLSTNR_PROPERTY_ID_MODEL,
-+ beans::PropertyAttribute::TRANSIENT, &m_xModel, ::getCppuType( &m_xModel ) );
-+
-+}
-+
-+void
-+EventListener::setShellFromModel()
-+{
-+ // reset mpShell
-+ mpShell = 0;
-+ SfxObjectShell* pShell = SfxObjectShell::GetFirst();
-+ while ( m_xModel.is() && pShell )
-+ {
-+ if ( pShell->GetModel() == m_xModel )
-+ {
-+ mpShell = pShell;
-+ break;
-+ }
-+ pShell = SfxObjectShell::GetNext( *pShell );
-+ }
-+}
-+
-+//XEventListener
-+void
-+EventListener::disposing(const lang::EventObject&) throw( RuntimeException )
-+{
-+}
-+
-+//XScriptListener
-+
-+void SAL_CALL
-+EventListener::firing(const ScriptEvent& evt) throw(RuntimeException)
-+{
-+ firing_Impl( evt );
-+}
-+
-+Any SAL_CALL
-+EventListener::approveFiring(const ScriptEvent& evt) throw(reflection::InvocationTargetException, RuntimeException)
-+{
-+ Any ret;
-+ firing_Impl( evt, &ret );
-+ return ret;
-+}
-+
-+// XInitialization
-+void SAL_CALL
-+EventListener::initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException)
-+{
-+ if ( aArguments.getLength() == 1 )
-+ aArguments[0] >>= m_xModel;
-+ OSL_TRACE("EventListener::initialize() args %d m_xModel %d", aArguments.getLength(), m_xModel.is() );
-+}
-+
-+// XInterface
-+
-+IMPLEMENT_FORWARD_XINTERFACE2( EventListener, EventListener_BASE, OPropertyContainer )
-+
-+// XTypeProvider
-+
-+IMPLEMENT_FORWARD_XTYPEPROVIDER2( EventListener, EventListener_BASE, OPropertyContainer )
-+
-+// OPropertySetHelper
-+
-+::cppu::IPropertyArrayHelper&
-+EventListener::getInfoHelper( )
-+{
-+ return *getArrayHelper();
-+}
-+
-+// OPropertyArrayUsageHelper
-+
-+::cppu::IPropertyArrayHelper*
-+EventListener::createArrayHelper( ) const
-+{
-+ Sequence< beans::Property > aProps;
-+ describeProperties( aProps );
-+ return new ::cppu::OPropertyArrayHelper( aProps );
-+}
-+
-+// XPropertySet
-+Reference< beans::XPropertySetInfo >
-+EventListener::getPropertySetInfo( ) throw (RuntimeException)
-+{
-+ Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
-+ return xInfo;
-+}
-+
-+
-+// EventListener
-+
-+void
-+EventListener::firing_Impl(const ScriptEvent& evt, Any* /*pRet*/ ) throw(RuntimeException)
-+{
-+ OSL_TRACE("EventListener::firing_Impl( FAKE VBA_EVENTS )");
-+ static const ::rtl::OUString vbaInterOp =
-+ ::rtl::OUString::createFromAscii("VBAInterop");
-+
-+ // let default handlers deal with non vba stuff
-+ if ( !evt.ScriptType.equals( vbaInterOp ) )
-+ return;
-+ lang::EventObject aEvent;
-+ evt.Arguments[ 0 ] >>= aEvent;
-+ OSL_TRACE("Argument[0] is %s", rtl::OUStringToOString( comphelper::anyToString( evt.Arguments[0] ), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ OSL_TRACE("Getting Control");
-+ uno::Reference< awt::XControl > xControl( aEvent.Source, uno::UNO_QUERY_THROW );
-+ OSL_TRACE("Getting properties");
-+ uno::Reference< beans::XPropertySet > xProps( xControl->getModel(), uno::UNO_QUERY_THROW );
-+
-+ rtl::OUString sName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UserForm") );
-+ OSL_TRACE("Getting Name");
-+
-+ uno::Reference< awt::XDialog > xDlg( aEvent.Source, uno::UNO_QUERY );
-+ if ( !xDlg.is() )
-+ xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ) ) >>= sName;
-+ //dumpEvent( evt );
-+ EventInfoHash& infos = getEventTransInfo();
-+ EventInfoHash::const_iterator eventInfo_it = infos.find( evt.MethodName );
-+ EventInfoHash::const_iterator it_end = infos.end();
-+ if ( eventInfo_it == it_end )
-+ {
-+ OSL_TRACE("Bogus event for %s",
-+ rtl::OUStringToOString( evt.ScriptType, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ return;
-+ }
-+
-+ uno::Reference< script::provider::XScriptProviderSupplier > xSPS( m_xModel, uno::UNO_QUERY );
-+ uno::Reference< script::provider::XScriptProvider > xScriptProvider;
-+ if ( xSPS.is() )
-+ xScriptProvider = xSPS->getScriptProvider();
-+ if ( xScriptProvider.is() && mpShell )
-+ {
-+ std::list< TranslateInfo > matchingMethods;
-+ std::list< TranslateInfo >::const_iterator txInfo =
-+ eventInfo_it->second.begin();
-+ std::list< TranslateInfo >::const_iterator txInfo_end = eventInfo_it->second.end();
-+ rtl::OUString sMacroLoc = rtl::OUString::createFromAscii("Standard.").concat( evt.ScriptCode ).concat( rtl::OUString::createFromAscii(".") );
-+
-+ StarBASIC* pBasic = mpShell->GetBasic();
-+ SbModule* pModule = pBasic->FindModule( evt.ScriptCode );
-+ for ( ; pModule && txInfo != txInfo_end; ++txInfo )
-+ {
-+ // see if we have a match for the handlerextension
-+ // where ScriptCode is methodname_handlerextension
-+ rtl::OUString sTemp = sName.concat( (*txInfo).sVBAName );
-+
-+ OSL_TRACE("*** trying to invoke %s ",
-+ rtl::OUStringToOString( sTemp, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ SbMethod* pMeth = static_cast< SbMethod* >( pModule->Find( sTemp, SbxCLASS_METHOD ) );
-+ if ( pMeth )
-+ {
-+ // !! translate arguments & emulate events where necessary
-+ Sequence< Any > aArguments;
-+ if ( (*txInfo).toVBA )
-+ aArguments = (*txInfo).toVBA( evt.Arguments );
-+ else
-+ aArguments = evt.Arguments;
-+ if ( aArguments.getLength() )
-+ {
-+ // call basic event handlers for event
-+
-+ static rtl::OUString part1 = rtl::OUString::createFromAscii( "vnd.sun.star.script:");
-+ static rtl::OUString part2 = rtl::OUString::createFromAscii("?language=Basic&location=document");
-+
-+ // create script url
-+ rtl::OUString url = part1 + sMacroLoc + sTemp + part2;
-+
-+ OSL_TRACE("script url = %s",
-+ rtl::OUStringToOString( url,
-+ RTL_TEXTENCODING_UTF8 ).getStr() );
-+ Sequence< sal_Int16 > aOutArgsIndex;
-+ Sequence< Any > aOutArgs;
-+ try
-+ {
-+ uno::Reference< script::provider::XScript > xScript = xScriptProvider->getScript( url );
-+ if ( xScript.is() )
-+ xScript->invoke( aArguments, aOutArgsIndex, aOutArgs );
-+ }
-+ catch ( uno::Exception& e )
-+ {
-+ OSL_TRACE("event script raised %s", rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
-+ }
-+ }
-+ }
-+ }
-+ }
-+}
-+
-+typedef ::cppu::WeakImplHelper1< XVBAToOOEventDescGen > VBAToOOEventDescGen_BASE;
-+
-+
-+class VBAToOOEventDescGen : public VBAToOOEventDescGen_BASE
-+{
-+public:
-+ VBAToOOEventDescGen( const Reference< XComponentContext >& rxContext );
-+
-+ // XVBAToOOEventDescGen
-+ virtual Sequence< ScriptEventDescriptor > SAL_CALL getEventDescriptions( const Reference< XInterface >& control, const rtl::OUString& sCodeName ) throw (RuntimeException);
-+ virtual Reference< XScriptEventsSupplier > SAL_CALL getEventSupplier( const Reference< XInterface >& xControl, const rtl::OUString& sCodeName ) throw (::com::sun::star::uno::RuntimeException);
-+private:
-+ Reference< XComponentContext > m_xContext;
-+
-+};
-+
-+VBAToOOEventDescGen::VBAToOOEventDescGen( const Reference< XComponentContext >& rxContext ):m_xContext( rxContext ) {}
-+
-+Sequence< ScriptEventDescriptor > SAL_CALL
-+VBAToOOEventDescGen::getEventDescriptions( const Reference< XInterface >& xControl, const rtl::OUString& sCodeName ) throw (RuntimeException)
-+{
-+ ScriptEventHelper evntHelper( xControl );
-+ return evntHelper.createEvents( sCodeName );
-+}
-+
-+Reference< XScriptEventsSupplier > SAL_CALL
-+VBAToOOEventDescGen::getEventSupplier( const Reference< XInterface >& xControl, const rtl::OUString& sCodeName ) throw (::com::sun::star::uno::RuntimeException)
-+{
-+ ScriptEventHelper evntHelper( xControl );
-+ Reference< XScriptEventsSupplier > xSupplier =
-+ new ReadOnlyEventsSupplier(
-+ evntHelper.getEventListeners(), sCodeName ) ;
-+ return xSupplier;
-+}
-+
-+// Component related
-+
-+namespace evtlstner
-+{
-+ ::rtl::OUString SAL_CALL getImplementationName()
-+ {
-+ static ::rtl::OUString* pImplName = 0;
-+ if ( !pImplName )
-+ {
-+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
-+ if ( !pImplName )
-+ {
-+ static ::rtl::OUString aImplName( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.EventListener" ) );
-+ pImplName = &aImplName;
-+ }
-+ }
-+ return *pImplName;
-+ }
-+
-+ uno::Reference< XInterface > SAL_CALL create(
-+ Reference< XComponentContext > const & xContext )
-+ SAL_THROW( () )
-+ {
-+ return static_cast< lang::XTypeProvider * >( new EventListener( xContext ) );
-+ }
-+
-+ Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
-+ {
-+ const ::rtl::OUString strName( ::evtlstner::getImplementationName() );
-+ return Sequence< ::rtl::OUString >( &strName, 1 );
-+ }
-+}
-+namespace ooevtdescgen
-+{
-+ ::rtl::OUString SAL_CALL getImplementationName()
-+ {
-+ static ::rtl::OUString* pImplName = 0;
-+ if ( !pImplName )
-+ {
-+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
-+ if ( !pImplName )
-+ {
-+ static ::rtl::OUString aImplName( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAToOOEventDesc" ) );
-+ pImplName = &aImplName;
-+ }
-+ }
-+ return *pImplName;
-+ }
-+
-+ uno::Reference< XInterface > SAL_CALL create(
-+ Reference< XComponentContext > const & xContext )
-+ SAL_THROW( () )
-+ {
-+ return static_cast< lang::XTypeProvider * >( new VBAToOOEventDescGen( xContext ) );
-+ }
-+
-+ Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
-+ {
-+ const ::rtl::OUString strName( ::ooevtdescgen::getImplementationName() );
-+ return Sequence< ::rtl::OUString >( &strName, 1 );
-+ }
-+}
---- scripting/source/vbaevents/makefile.mk.old 1970-01-01 00:00:00.000000000 +0000
-+++ scripting/source/vbaevents/makefile.mk 2009-04-06 16:41:59.000000000 +0000
-@@ -0,0 +1,58 @@
-+PRJ=..$/..
-+
-+PRJNAME=vbaevents
-+TARGET=vbaevents
-+.IF "$(ENABLE_VBA)"!="YES"
-+dummy:
-+ @echo "not building vbaevents..."
-+.ENDIF
-+
-+NO_BSYMBOLIC= TRUE
-+ENABLE_EXCEPTIONS=TRUE
-+COMP1TYPELIST=$(TARGET)
-+COMPRDB=$(SOLARBINDIR)$/types.rdb
-+
-+# --- Settings -----------------------------------------------------
-+
-+.INCLUDE : settings.mk
-+DLLPRE =
-+
-+# ------------------------------------------------------------------
-+
-+ALLTAR : \
-+ $(MISC)$/$(TARGET).don \
-+ $(SLOTARGET)
-+
-+$(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb
-+ +$(CPPUMAKER) -O$(OUT)$/inc -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@
-+ echo $@
-+# ------------------------------------------------------------------
-+
-+#.INCLUDE : ..$/cppumaker.mk
-+
-+SLOFILES= \
-+ $(SLO)$/service.obj \
-+ $(SLO)$/eventhelper.obj
-+
-+SHL1TARGET= $(TARGET)$(DLLPOSTFIX).uno
-+SHL1IMPLIB= i$(TARGET)
-+
-+SHL1VERSIONMAP=$(TARGET).map
-+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
-+DEF1NAME=$(SHL1TARGET)
-+
-+SHL1STDLIBS= \
-+ $(CPPUHELPERLIB) \
-+ $(BASICLIB) \
-+ $(COMPHELPERLIB) \
-+ $(SFXLIB) \
-+ $(CPPULIB) \
-+ $(TOOLSLIB) \
-+ $(SALLIB)
-+
-+SHL1DEPN=
-+SHL1LIBS=$(SLB)$/$(TARGET).lib
-+
-+# --- Targets ------------------------------------------------------
-+
-+.INCLUDE : target.mk
---- scripting/source/vbaevents/service.cxx.old 1970-01-01 00:00:00.000000000 +0000
-+++ scripting/source/vbaevents/service.cxx 2009-04-06 16:41:59.000000000 +0000
-@@ -0,0 +1,99 @@
-+#include "cppuhelper/implementationentry.hxx"
-+#include "com/sun/star/lang/XMultiServiceFactory.hpp"
-+#include "com/sun/star/registry/XRegistryKey.hpp"
-+
-+// =============================================================================
-+// component exports
-+// =============================================================================
-+using namespace ::com::sun::star;
-+using namespace ::com::sun::star::uno;
-+
-+namespace evtlstner
-+{
-+ // =============================================================================
-+ // component operations
-+ // =============================================================================
-+
-+ uno::Reference< XInterface > SAL_CALL create(
-+ Reference< XComponentContext > const & xContext )
-+ SAL_THROW( () );
-+
-+ // -----------------------------------------------------------------------------
-+
-+ ::rtl::OUString SAL_CALL getImplementationName();
-+
-+ Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames();
-+
-+ Reference<XInterface> SAL_CALL create(
-+ Sequence<Any> const &, Reference<XComponentContext> const & );
-+} // end evtlstner
-+
-+namespace ooevtdescgen
-+{
-+ // =============================================================================
-+ // component operations
-+ // =============================================================================
-+
-+ uno::Reference< XInterface > SAL_CALL create(
-+ Reference< XComponentContext > const & xContext )
-+ SAL_THROW( () );
-+
-+ // -----------------------------------------------------------------------------
-+
-+ ::rtl::OUString SAL_CALL getImplementationName();
-+
-+ Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames();
-+
-+ Reference<XInterface> SAL_CALL create(
-+ Sequence<Any> const &, Reference<XComponentContext> const & );
-+} // end ooevtdescgen
-+
-+
-+
-+ // =============================================================================
-+
-+ const ::cppu::ImplementationEntry s_component_entries [] =
-+ {
-+ {
-+ ::evtlstner::create, ::evtlstner::getImplementationName,
-+ ::evtlstner::getSupportedServiceNames,
-+ ::cppu::createSingleComponentFactory,
-+ 0, 0
-+ },
-+ {
-+ ::ooevtdescgen::create, ::ooevtdescgen::getImplementationName,
-+ ::ooevtdescgen::getSupportedServiceNames,
-+ ::cppu::createSingleComponentFactory,
-+ 0, 0
-+ },
-+ { 0, 0, 0, 0, 0, 0 }
-+ };
-+
-+extern "C"
-+{
-+ void SAL_CALL component_getImplementationEnvironment(
-+ const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv )
-+ {
-+ OSL_TRACE("In component_getImplementationEnv");
-+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
-+ }
-+
-+ sal_Bool SAL_CALL component_writeInfo(
-+ lang::XMultiServiceFactory * pServiceManager, registry::XRegistryKey * pRegistryKey )
-+ {
-+ OSL_TRACE("In component_writeInfo");
-+ if ( ::cppu::component_writeInfoHelper(
-+ pServiceManager, pRegistryKey, s_component_entries ) )
-+ return sal_True;
-+ return sal_False;
-+ }
-+
-+ void * SAL_CALL component_getFactory(
-+ const sal_Char * pImplName, lang::XMultiServiceFactory * pServiceManager,
-+ registry::XRegistryKey * pRegistryKey )
-+ {
-+ OSL_TRACE("In component_getFactory");
-+ return ::cppu::component_getFactoryHelper(
-+ pImplName, pServiceManager, pRegistryKey, s_component_entries );
-+ }
-+}
---- scripting/source/vbaevents/vbaevents.map.old 1970-01-01 00:00:00.000000000 +0000
-+++ scripting/source/vbaevents/vbaevents.map 2009-04-06 16:41:59.000000000 +0000
-@@ -0,0 +1,9 @@
-+OOO_1.1 {
-+ global:
-+ component_getImplementationEnvironment;
-+ component_getFactory;
-+ component_writeInfo;
-+
-+ local:
-+ *;
-+};
---- scripting/source/vbaevents/vbaevents.xml.old 1970-01-01 00:00:00.000000000 +0000
-+++ scripting/source/vbaevents/vbaevents.xml 2009-04-06 16:41:59.000000000 +0000
-@@ -0,0 +1,26 @@
-+<?xml version="1.0" encoding="UTF-8"?>
-+<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd">
-+<module-description xmlns:xlink="http://www.w3.org/1999/xlink">
-+
-+ <module-name>vbaevents</module-name>
-+
-+ <component-description>
-+ <author>Noel Power </author>
-+ <name>ooo.vba.EventListener</name>
-+ <description>Event listener to handle ooo events and to translate them to calls to basic macros ala Button_Click etc.</description>
-+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
-+ <language>c++</language>
-+ <status value="drafts"/>
-+ <supported-service>ooo.vba.EventListener</supported-service>
-+ <type>com.sun.star.uno.XComponentContext</type>
-+ </component-description>
-+
-+ <project-build-dependency>cppuhelper</project-build-dependency>
-+ <project-build-dependency>cppu</project-build-dependency>
-+ <project-build-dependency>sal</project-build-dependency>
-+
-+ <runtime-module-dependency>cppuhelper3$(COM)</runtime-module-dependency>
-+ <runtime-module-dependency>cppu3</runtime-module-dependency>
-+ <runtime-module-dependency>sal3</runtime-module-dependency>
-+
-+</module-description>
---- svx/source/form/fmtools.cxx
-+++ svx/source/form/fmtools.cxx
-@@ -105,7 +105,7 @@
- #include <comphelper/extract.hxx>
- #include <comphelper/uno3.hxx>
- #include <connectivity/dbexception.hxx>
--#include <comphelper/extract.hxx>
-+#include <comphelper/evtmethodhelper.hxx>
- #include <cppuhelper/typeprovider.hxx>
- #include <algorithm>
- #include <rtl/logfile.hxx>
-@@ -719,37 +720,6 @@ sal_Int16 getControlTypeByObject(const R
- return ::rtl::OUString();
- }
- //------------------------------------------------------------------------------
--Sequence< ::rtl::OUString> getEventMethods(const Type& type)
--{
-- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "fmtools::getEventMethods" );
-- typelib_InterfaceTypeDescription *pType=0;
-- type.getDescription( (typelib_TypeDescription**)&pType);
--
-- if(!pType)
-- return Sequence< ::rtl::OUString>();
--
-- Sequence< ::rtl::OUString> aNames(pType->nMembers);
-- ::rtl::OUString* pNames = aNames.getArray();
-- for(sal_Int32 i=0;i<pType->nMembers;i++,++pNames)
-- {
-- // the decription reference
-- typelib_TypeDescriptionReference* pMemberDescriptionReference = pType->ppMembers[i];
-- // the description for the reference
-- typelib_TypeDescription* pMemberDescription = NULL;
-- typelib_typedescriptionreference_getDescription(&pMemberDescription, pMemberDescriptionReference);
-- if (pMemberDescription)
-- {
-- typelib_InterfaceMemberTypeDescription* pRealMemberDescription =
-- reinterpret_cast<typelib_InterfaceMemberTypeDescription*>(pMemberDescription);
-- *pNames = pRealMemberDescription->pMemberName;
-- }
-- }
-- typelib_typedescription_release( (typelib_TypeDescription *)pType );
-- return aNames;
--}
--
--
--//------------------------------------------------------------------------------
- void TransferEventScripts(const Reference< ::com::sun::star::awt::XControlModel>& xModel, const Reference< ::com::sun::star::awt::XControl>& xControl,
- const Sequence< ::com::sun::star::script::ScriptEventDescriptor>& rTransferIfAvailable)
- {
-@@ -821,7 +792,8 @@ void TransferEventScripts(const Referenc
- continue;
-
- // now check the methods
-- Sequence< ::rtl::OUString> aMethodsNames = getEventMethods(*pCurrentListeners);
-+ Sequence< ::rtl::OUString> aMethodsNames = ::comphelper::getEventMethodsForType(*pCurrentListeners);
-+
- const ::rtl::OUString* pMethodsNames = aMethodsNames.getConstArray();
- for (k=0; k<aMethodsNames.getLength(); ++k, ++pMethodsNames)
- {
diff --git a/patches/vba/vbahelper-link-with-oox.diff b/patches/vba/vbahelper-link-with-oox.diff
deleted file mode 100644
index 878d2db0c..000000000
--- a/patches/vba/vbahelper-link-with-oox.diff
+++ /dev/null
@@ -1,10 +0,0 @@
---- vbahelper/util/makefile.mk 2010-07-16 10:10:55.000000000 +0200
-+++ vbahelper/util/makefile.mk 2010-07-16 10:11:26.000000000 +0200
-@@ -94,6 +94,7 @@
- $(SVTOOLLIB) \
- $(SVLLIB) \
- $(VCLLIB) \
-+ $(OOXLIB) \
- $(TKLIB) \
- $(BASICLIB) \
- $(SVXMSFILTERLIB) \
diff --git a/patches/vba/vbahelper-no-oox.diff b/patches/vba/vbahelper-no-oox.diff
deleted file mode 100644
index 2c3883192..000000000
--- a/patches/vba/vbahelper-no-oox.diff
+++ /dev/null
@@ -1,48 +0,0 @@
-diff --git vbahelper/inc/vbahelper/vbahelper.hxx vbahelper/inc/vbahelper/vbahelper.hxx
-index 4cc1082..ab07aed 100644
---- vbahelper/inc/vbahelper/vbahelper.hxx
-+++ vbahelper/inc/vbahelper/vbahelper.hxx
-@@ -36,6 +36,7 @@
- #include <com/sun/star/awt/XControl.hpp>
- #include <com/sun/star/awt/XDevice.hpp>
- #include <com/sun/star/frame/XDispatchResultListener.hpp>
-+#include <com/sun/star/awt/XUnitConversion.hpp>
- #include <com/sun/star/frame/DispatchResultEvent.hpp>
- #include <com/sun/star/frame/DispatchResultState.hpp>
- #include <com/sun/star/lang/EventObject.hpp>
-@@ -48,7 +49,6 @@
- #include <sfx2/docfilt.hxx>
- #include <sfx2/docfile.hxx>
- #include <vcl/pointr.hxx>
--#include <oox/helper/graphichelper.hxx>
- #include <memory>
- #include "vbaaccesshelper.hxx"
-
-@@ -195,7 +195,6 @@ class VBAHELPER_DLLPUBLIC UserFormGeomet
- {
- css::uno::Reference< css::awt::XUnitConversion > mxControlUnits;
- css::uno::Reference< css::beans::XPropertySet > mxModel;
-- std::auto_ptr< oox::GraphicHelper > mpGraphicHelper;
-
- sal_Int32 ConvertLogicToPixel( sal_Int32 nValue, sal_Bool bIsPoint, sal_Bool bIsX, sal_Int16 nSourceUnit );
- sal_Int32 ConvertPixelToLogic( sal_Int32 nValue, sal_Bool bIsPoint, sal_Bool bIsX, sal_Int16 nTargetUnit );
-diff --git vbahelper/prj/build.lst vbahelper/prj/build.lst
-index ded9ee2..20001db 100644
---- vbahelper/prj/build.lst
-+++ vbahelper/prj/build.lst
-@@ -1,4 +1,4 @@
--vba vbahelper : oovbaapi oox basic sfx2 svx filter cppuhelper vcl comphelper svtools tools sal NULL
-+vba vbahelper : oovbaapi basic sfx2 svx filter cppuhelper vcl comphelper svtools tools sal NULL
- vba vbahelper usr1 - all vba_mkout NULL
- #vba vbahelper\inc nmake - all vba_inc NULL
- vba vbahelper\source\vbahelper nmake - all vba_vbahelper NULL
---- vbahelper/util/makefile.mk.old 2010-08-03 15:12:54.000000000 +0200
-+++ vbahelper/util/makefile.mk 2010-08-03 17:44:26.000000000 +0200
-@@ -61,7 +61,6 @@ SHL1STDLIBS= \
- $(VCLLIB) \
- $(SVTOOLLIB) \
- $(MSFILTERLIB) \
-- $(OOXLIB) \
- $(TKLIB)
-
- SHL1DEPN=
diff --git a/patches/vba/vbasupport-patch-roll-up.diff b/patches/vba/vbasupport-patch-roll-up.diff
deleted file mode 100644
index d5441be6a..000000000
--- a/patches/vba/vbasupport-patch-roll-up.diff
+++ /dev/null
@@ -1,1005 +0,0 @@
-diff --git basic/source/classes/image.cxx basic/source/classes/image.cxx
-index c04cfef..76672b4 100644
---- basic/source/classes/image.cxx
-+++ basic/source/classes/image.cxx
-@@ -433,7 +433,7 @@ void SbiImage::AddString( const String& r )
- memcpy( p, pStrings, nStringSize * sizeof( sal_Unicode ) );
- delete[] pStrings;
- pStrings = p;
-- nStringSize = sal::static_int_cast< UINT16 >(nNewLen);
-+ nStringSize = sal::static_int_cast< UINT32 >(nNewLen);
- }
- else
- bError = TRUE;
-diff --git forms/source/misc/InterfaceContainer.cxx forms/source/misc/InterfaceContainer.cxx
-index d0deb50..c2616fd 100644
---- forms/source/misc/InterfaceContainer.cxx
-+++ forms/source/misc/InterfaceContainer.cxx
-@@ -154,9 +154,16 @@ void OInterfaceContainer::impl_addVbEvents_nolck_nothrow( const sal_Int32 i_nIn
- xProps->getPropertyValue( rtl::OUString::createFromAscii("DefaultControl" ) ) >>= sServiceName;
-
- Reference< ooo::vba::XVBAToOOEventDescGen > xDescSupplier( m_xServiceFactory->createInstance( rtl::OUString::createFromAscii( "ooo.vba.VBAToOOEventDesc" ) ), UNO_QUERY_THROW );
-- Sequence< ScriptEventDescriptor > vbaEvents = xDescSupplier->getEventDescriptions( m_xServiceFactory->createInstance( sServiceName ), sCodeName );
-+ Reference< XInterface > xInterface = m_xServiceFactory->createInstance( sServiceName );
-+ Sequence< ScriptEventDescriptor > vbaEvents = xDescSupplier->getEventDescriptions( xInterface, sCodeName );
- // register the vba script events
- m_xEventAttacher->registerScriptEvents( i_nIndex, vbaEvents );
-+
-+ Reference< XComponent > xComponent( xInterface, UNO_QUERY );
-+ if ( xComponent.is() )
-+ {
-+ xComponent->dispose();
-+ }
- }
- while ( false );
- }
-diff --git oovbaapi/ooo/vba/excel/XName.idl oovbaapi/ooo/vba/excel/XName.idl
-index 6397e7a..dd51d33 100644
---- oovbaapi/ooo/vba/excel/XName.idl
-+++ oovbaapi/ooo/vba/excel/XName.idl
-@@ -50,12 +50,12 @@ interface XName
- [attribute] string Name;
- [attribute] string NameLocal;
- [attribute] boolean Visible;
-- [attribute, readonly] string Value;
-- [attribute, readonly] string RefersTo;
-- [attribute, readonly] string RefersToLocal;
-- [attribute, readonly] string RefersToR1C1;
-- [attribute, readonly] string RefersToR1C1Local;
-- [attribute, readonly] XRange RefersToRange;
-+ [attribute] string Value;
-+ [attribute, readonly] string RefersTo;
-+ [attribute, readonly] string RefersToLocal;
-+ [attribute, readonly] string RefersToR1C1;
-+ [attribute, readonly] string RefersToR1C1Local;
-+ [attribute, readonly] XRange RefersToRange;
-
- void Delete( );
- };
-diff --git oovbaapi/ooo/vba/excel/XRange.idl oovbaapi/ooo/vba/excel/XRange.idl
-index 4ed6fc4..1654749 100644
---- oovbaapi/ooo/vba/excel/XRange.idl
-+++ oovbaapi/ooo/vba/excel/XRange.idl
-@@ -83,6 +83,7 @@ interface XRange
- interface ::ooo::vba::excel::XFormat;
- //interface ::ooo::vba::XHelperInterface;
-
-+ [attribute, readonly] any Name;
- [attribute] any Value;
- [attribute] any Formula;
- [attribute] any FormulaArray;
-diff --git sc/inc/document.hxx sc/inc/document.hxx
-index 7eaf99f..e59bdee 100644
---- sc/inc/document.hxx
-+++ sc/inc/document.hxx
-@@ -593,6 +593,7 @@ public:
- BOOL HasSelectedBlockMatrixFragment( SCCOL nStartCol, SCROW nStartRow,
- SCCOL nEndCol, SCROW nEndRow,
- const ScMarkData& rMark ) const;
-+ BOOL HasSelectedBlockMatrixFragment( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTAB ) const;
-
- BOOL GetMatrixFormulaRange( const ScAddress& rCellPos, ScRange& rMatrix );
-
-@@ -1050,6 +1051,9 @@ public:
- const ScMarkData* pMarks = NULL, bool bAllTabs = false, bool bKeepScenarioFlags = false,
- bool bIncludeObjects = false, bool bCloneNoteCaptions = true);
-
-+ void CopyToClip4VBA(const ScClipParam& rClipParam, ScDocument* pClipDoc, bool bKeepScenarioFlags = false,
-+ bool bIncludeObjects = false, bool bCloneNoteCaptions = true);
-+
- void CopyTabToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
- SCTAB nTab, ScDocument* pClipDoc = NULL);
- void CopyBlockFromClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
-@@ -1875,6 +1879,7 @@ private: // CLOOK-Impl-Methoden
- const ScRange& r, SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
-
- void CopyRangeNamesToClip(ScDocument* pClipDoc, const ScRange& rClipRange, const ScMarkData* pMarks, bool bAllTabs);
-+ void CopyRangeNamesToClip(ScDocument* pClipDoc, const ScRange& rClipRange, SCTAB nTab);
- void CopyRangeNamesFromClip(ScDocument* pClipDoc, ScClipRangeNameData& rRangeNames);
- void UpdateRangeNamesInFormulas(
- ScClipRangeNameData& rRangeNames, const ScRangeList& rDestRanges, const ScMarkData& rMark,
-diff --git sc/source/core/data/document.cxx sc/source/core/data/document.cxx
-index 1d13cbb..790c40b 100644
---- sc/source/core/data/document.cxx
-+++ sc/source/core/data/document.cxx
-@@ -1618,6 +1618,40 @@ void ScDocument::CopyToClip(const ScClipParam& rClipParam,
- pClipDoc->ExtendMerge(aClipRange, true);
- }
-
-+// Copy the content of the Range into clipboard. Adding this method for VBA API: Range.Copy().
-+void ScDocument::CopyToClip4VBA(const ScClipParam& rClipParam, ScDocument* pClipDoc, bool bKeepScenarioFlags, bool bIncludeObjects, bool bCloneNoteCaptions)
-+{
-+ if ( !bIsClip )
-+ {
-+ pClipDoc = pClipDoc ? pClipDoc : SC_MOD()->GetClipDoc();
-+ if ( !pClipDoc )
-+ {
-+ return;
-+ }
-+ ScRange aClipRange = rClipParam.getWholeRange();
-+ SCTAB nTab = aClipRange.aStart.Tab();
-+ pClipDoc->aDocName = aDocName;
-+ pClipDoc->SetClipParam( rClipParam );
-+ pClipDoc->ResetClip( this, nTab );
-+
-+ CopyRangeNamesToClip( pClipDoc, aClipRange, nTab );
-+
-+ if ( pTab[nTab] && pClipDoc->pTab[nTab] )
-+ {
-+ pTab[nTab]->CopyToClip( rClipParam.maRanges, pClipDoc->pTab[nTab], bKeepScenarioFlags, bCloneNoteCaptions );
-+ if ( pDrawLayer && bIncludeObjects )
-+ {
-+ // Also copy drawing objects.
-+ Rectangle aObjRect = GetMMRect( aClipRange.aStart.Col(), aClipRange.aStart.Row(), aClipRange.aEnd.Col(), aClipRange.aEnd.Row(), nTab );
-+ pDrawLayer->CopyToClip( pClipDoc, nTab, aObjRect );
-+ }
-+ }
-+
-+ // Make sure to mark overlapped cells.
-+ pClipDoc->ExtendMerge( aClipRange, true );
-+ }
-+}
-+
- void ScDocument::CopyTabToClip(SCCOL nCol1, SCROW nRow1,
- SCCOL nCol2, SCROW nRow2,
- SCTAB nTab, ScDocument* pClipDoc)
-@@ -1739,6 +1773,31 @@ void ScDocument::CopyRangeNamesToClip(ScDocument* pClipDoc, const ScRange& rClip
- }
- }
-
-+void ScDocument::CopyRangeNamesToClip(ScDocument* pClipDoc, const ScRange& rClipRange, SCTAB nTab)
-+{
-+ // Indexes of named ranges that are used in the copied cells
-+ std::set<USHORT> aUsedNames;
-+ if ( pTab[nTab] && pClipDoc->pTab[nTab] )
-+ {
-+ pTab[nTab]->FindRangeNamesInUse( rClipRange.aStart.Col(), rClipRange.aStart.Row(), rClipRange.aEnd.Col(), rClipRange.aEnd.Row(), aUsedNames );
-+ }
-+
-+ pClipDoc->pRangeName->FreeAll();
-+ for ( USHORT i = 0; i < pRangeName->GetCount(); i++ )
-+ {
-+ USHORT nIndex = ((ScRangeData*)((*pRangeName)[i]))->GetIndex();
-+ bool bInUse = ( aUsedNames.find(nIndex) != aUsedNames.end() );
-+ if ( bInUse )
-+ {
-+ ScRangeData* pData = new ScRangeData(*((*pRangeName)[i]));
-+ if ( !pClipDoc->pRangeName->Insert(pData) )
-+ delete pData;
-+ else
-+ pData->SetIndex(nIndex);
-+ }
-+ }
-+}
-+
- ScDocument::NumFmtMergeHandler::NumFmtMergeHandler(ScDocument* pDoc, ScDocument* pSrcDoc) :
- mpDoc(pDoc)
- {
-@@ -4506,6 +4565,15 @@ BOOL ScDocument::HasSelectedBlockMatrixFragment( SCCOL nStartCol, SCROW nStartRo
- return !bOk;
- }
-
-+BOOL ScDocument::HasSelectedBlockMatrixFragment( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab ) const
-+{
-+ BOOL bOk = TRUE;
-+ if ( pTab[nTab] && pTab[nTab]->HasBlockMatrixFragment( nStartCol, nStartRow, nEndCol, nEndRow ) )
-+ {
-+ bOk = FALSE;
-+ }
-+ return !bOk;
-+}
-
- BOOL ScDocument::GetMatrixFormulaRange( const ScAddress& rCellPos, ScRange& rMatrix )
- {
-diff --git sc/source/ui/inc/viewfunc.hxx sc/source/ui/inc/viewfunc.hxx
-index 4f56a63..2f271c9 100644
---- sc/source/ui/inc/viewfunc.hxx
-+++ sc/source/ui/inc/viewfunc.hxx
-@@ -111,6 +111,8 @@ public:
- SC_DLLPUBLIC void CutToClip( ScDocument* pClipDoc = NULL, BOOL bIncludeObjects = FALSE );
- SC_DLLPUBLIC BOOL CopyToClip( ScDocument* pClipDoc = NULL, BOOL bCut = FALSE, BOOL bApi = FALSE,
- BOOL bIncludeObjects = FALSE, BOOL bStopEdit = TRUE );
-+ SC_DLLPUBLIC BOOL CopyToClip( ScDocument* pClipDoc, const ScRange& rRange, BOOL bCut = FALSE,
-+ BOOL bApi = FALSE, BOOL bIncludeObjects = FALSE, BOOL bStopEdit = TRUE );
- ScTransferObj* CopyToTransferable();
- SC_DLLPUBLIC BOOL PasteFromClip( USHORT nFlags, ScDocument* pClipDoc,
- USHORT nFunction = PASTE_NOFUNC, BOOL bSkipEmpty = FALSE,
-diff --git sc/source/ui/vba/excelvbahelper.cxx sc/source/ui/vba/excelvbahelper.cxx
-index 705941b..23eb681 100644
---- sc/source/ui/vba/excelvbahelper.cxx
-+++ sc/source/ui/vba/excelvbahelper.cxx
-@@ -30,6 +30,9 @@
- #include "transobj.hxx"
- #include "scmod.hxx"
- #include "cellsuno.hxx"
-+#include "compiler.hxx"
-+#include "token.hxx"
-+#include "tokenarray.hxx"
- #include <comphelper/processfactory.hxx>
- #include <com/sun/star/sheet/XSheetCellRange.hpp>
-
-@@ -255,6 +258,15 @@ void implnPasteSpecial( const uno::Reference< frame::XModel>& xModel, USHORT nFl
-
- }
-
-+void implnCopyRange( const uno::Reference< frame::XModel>& xModel, const ScRange& rRange )
-+{
-+ ScTabViewShell* pViewShell = getBestViewShell( xModel );
-+ if ( pViewShell )
-+ {
-+ pViewShell->CopyToClip( NULL, rRange, FALSE, TRUE, TRUE );
-+ }
-+}
-+
- ScDocShell*
- getDocShell( const css::uno::Reference< css::frame::XModel>& xModel )
- {
-@@ -322,6 +334,84 @@ getUnoSheetModuleObj( const uno::Reference< table::XCellRange >& xRange ) throw
- return xParent;
- }
-
-+formula::FormulaGrammar::Grammar GetFormulaGrammar( ScDocument* pDoc, const ScAddress& sAddress, const css::uno::Any& aFormula )
-+{
-+ formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_NATIVE_XL_A1;
-+ if ( pDoc && aFormula.hasValue() && aFormula.getValueTypeClass() == uno::TypeClass_STRING )
-+ {
-+ rtl::OUString sFormula;
-+ aFormula >>= sFormula;
-+
-+ ScCompiler aCompiler( pDoc, sAddress );
-+ aCompiler.SetGrammar( formula::FormulaGrammar::GRAM_NATIVE_XL_R1C1 );
-+ ScTokenArray* pCode = aCompiler.CompileString( sFormula );
-+ if ( pCode )
-+ {
-+ USHORT nLen = pCode->GetLen();
-+ formula::FormulaToken** pTokens = pCode->GetArray();
-+ for ( USHORT nPos = 0; nPos < nLen; nPos++ )
-+ {
-+ const formula::FormulaToken& rToken = *pTokens[nPos];
-+ switch ( rToken.GetType() )
-+ {
-+ case formula::svSingleRef:
-+ case formula::svDoubleRef:
-+ {
-+ return formula::FormulaGrammar::GRAM_NATIVE_XL_R1C1;
-+ }
-+ break;
-+ default: break;
-+ }
-+ }
-+ }
-+ }
-+ return eGrammar;
-+}
-+
-+void CompileExcelFormulaToODF( ScDocument* pDoc, const String& rOldFormula, String& rNewFormula )
-+{
-+ if ( !pDoc )
-+ {
-+ return;
-+ }
-+ ScCompiler aCompiler( pDoc, ScAddress() );
-+ aCompiler.SetGrammar( excel::GetFormulaGrammar( pDoc, ScAddress(), uno::Any( rtl::OUString( rOldFormula ) ) ) );
-+ ScTokenArray* pCode = aCompiler.CompileString( rOldFormula );
-+ aCompiler.SetGrammar( formula::FormulaGrammar::GRAM_PODF_A1 );
-+ aCompiler.CreateStringFromTokenArray( rNewFormula );
-+}
-+
-+void CompileODFFormulaToExcel( ScDocument* pDoc, const String& rOldFormula, String& rNewFormula, const formula::FormulaGrammar::Grammar eGrammar )
-+{
-+ // eGrammar can be formula::FormulaGrammar::GRAM_NATIVE_XL_R1C1 and formula::FormulaGrammar::GRAM_NATIVE_XL_A1
-+ if ( !pDoc )
-+ {
-+ return;
-+ }
-+ ScCompiler aCompiler( pDoc, ScAddress() );
-+ aCompiler.SetGrammar( formula::FormulaGrammar::GRAM_PODF_A1 );
-+ ScTokenArray* pCode = aCompiler.CompileString( rOldFormula );
-+ aCompiler.SetGrammar( eGrammar );
-+ if ( !pCode )
-+ {
-+ return;
-+ }
-+ USHORT nLen = pCode->GetLen();
-+ formula::FormulaToken** pTokens = pCode->GetArray();
-+ for ( USHORT nPos = 0; nPos < nLen && pTokens[nPos]; nPos++ )
-+ {
-+ String rFormula;
-+ formula::FormulaToken* pToken = pTokens[nPos];
-+ aCompiler.CreateStringFromToken( rFormula, pToken, TRUE );
-+ if ( pToken->GetOpCode() == ocSep )
-+ {
-+ // Excel formula separator is ",".
-+ rFormula = String::CreateFromAscii(",");
-+ }
-+ rNewFormula += rFormula;
-+ }
-+}
-+
- uno::Reference< XHelperInterface >
- getUnoSheetModuleObj( const uno::Reference< sheet::XSheetCellRangeContainer >& xRanges ) throw ( uno::RuntimeException )
- {
-diff --git sc/source/ui/vba/excelvbahelper.hxx sc/source/ui/vba/excelvbahelper.hxx
-index ab0474e..d93237f 100644
---- sc/source/ui/vba/excelvbahelper.hxx
-+++ sc/source/ui/vba/excelvbahelper.hxx
-@@ -34,6 +34,7 @@
- #include <com/sun/star/table/XCellRange.hpp>
- #include <com/sun/star/sheet/XSheetCellRangeContainer.hpp>
- #include <ooo/vba/XHelperInterface.hpp>
-+#include <formula/grammar.hxx>
-
- class ScCellRangesBase;
-
-@@ -49,11 +50,15 @@ namespace ooo
- 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);
-+ void implnCopyRange( const css::uno::Reference< css::frame::XModel>& xModel, const ScRange& rRange );
- 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 );
- sal_Bool IsR1C1ReferFormat( ScDocument* pDoc, const ::rtl::OUString& sRangeStr );
-+ formula::FormulaGrammar::Grammar GetFormulaGrammar( ScDocument* pDoc, const ScAddress& sAddress, const css::uno::Any& aFormula );
-+ void CompileExcelFormulaToODF( ScDocument* pDoc, const String& rOldFormula, String& rNewFormula );
-+ void CompileODFFormulaToExcel( ScDocument* pDoc, const String& rOldFormula, String& rNewFormula, const formula::FormulaGrammar::Grammar eGrammar );
- css::uno::Reference< css::sheet::XDatabaseRanges > GetDataBaseRanges( ScDocShell* pShell ) throw ( css::uno::RuntimeException );
-
- css::uno::Reference< css::sheet::XDatabaseRange > GetAutoFiltRange( ScDocShell* pShell, sal_Int16 nSheet, rtl::OUString& sName ) throw ( css::uno::RuntimeException );
-diff --git sc/source/ui/vba/vbaname.cxx sc/source/ui/vba/vbaname.cxx
-index b5238cf..d0c3fd4 100644
---- sc/source/ui/vba/vbaname.cxx
-+++ sc/source/ui/vba/vbaname.cxx
-@@ -107,78 +107,41 @@ ScVbaName::setVisible( sal_Bool /*bVisible*/ ) throw (css::uno::RuntimeException
- ::rtl::OUString
- ScVbaName::getValue() throw (css::uno::RuntimeException)
- {
-- ::rtl::OUString sValue = mxNamedRange->getContent();
-- ::rtl::OUString sSheetName = getWorkSheet()->getName();
-- ::rtl::OUString sSegmentation = ::rtl::OUString::createFromAscii( ";" );
-- ::rtl::OUString sNewSegmentation = ::rtl::OUString::createFromAscii( "," );
-- ::rtl::OUString sResult;
-- sal_Int32 nFrom = 0;
-- sal_Int32 nTo = 0;
-- nTo = sValue.indexOf( sSegmentation, nFrom );
-- while ( nTo != -1 )
-- {
-- ::rtl::OUString sTmpValue = sValue.copy( nFrom, nTo - nFrom );
-- if ( sTmpValue.toChar() == '$' )
-- {
-- ::rtl::OUString sTmp = sTmpValue.copy( 1 );
-- sTmp = sTmp.replaceAt(0, (sSheetName + ::rtl::OUString::createFromAscii(".")).getLength(), sSheetName + ::rtl::OUString::createFromAscii("!"));
-- sResult += sTmp;
-- sResult += sNewSegmentation;
-- }
-- nFrom = nTo + 1;
-- nTo = sValue.indexOf( sSegmentation, nFrom );
-- }
-- ::rtl::OUString sTmpValue = sValue.copy( nFrom );
-- if ( sTmpValue.toChar() == '$' )
-+ return getValue( formula::FormulaGrammar::GRAM_NATIVE_XL_A1 );
-+}
-+
-+::rtl::OUString
-+ScVbaName::getValue(const formula::FormulaGrammar::Grammar eGrammar) throw (css::uno::RuntimeException)
-+{
-+ rtl::OUString sValue = mxNamedRange->getContent();
-+ ScDocShell* pDocShell = excel::getDocShell( mxModel );
-+ ScDocument* pDoc = pDocShell ? pDocShell->GetDocument() : NULL;
-+ String aContent;
-+ excel::CompileODFFormulaToExcel( pDoc, sValue, aContent, eGrammar );
-+ if ( aContent.Len() > 0 )
- {
-- ::rtl::OUString sTmp = sTmpValue.copy(1);
-- sTmp = sTmp.replaceAt(0, (sSheetName + ::rtl::OUString::createFromAscii(".")).getLength(), sSheetName + ::rtl::OUString::createFromAscii("!"));
-- sResult += sTmp;
-- }
-- if (sResult.indexOf('=') != 0)
-+ sValue = aContent;
-+ }
-+ if ( sValue.indexOf('=') != 0 )
- {
-- sResult = ::rtl::OUString::createFromAscii("=") + sResult;
-+ sValue = rtl::OUString::createFromAscii("=") + sValue;
- }
-- return sResult;
-+ return sValue;
- }
-
- void
- ScVbaName::setValue( const ::rtl::OUString & rValue ) throw (css::uno::RuntimeException)
- {
-- ::rtl::OUString sSheetName = getWorkSheet()->getName();
- ::rtl::OUString sValue = rValue;
-- ::rtl::OUString sSegmentation = ::rtl::OUString::createFromAscii( "," );
-- ::rtl::OUString sNewSegmentation = ::rtl::OUString::createFromAscii( ";" );
-- ::rtl::OUString sResult;
-- sal_Int32 nFrom = 0;
-- sal_Int32 nTo = 0;
-- if (sValue.indexOf('=') == 0)
-+ ScDocShell* pDocShell = excel::getDocShell( mxModel );
-+ ScDocument* pDoc = pDocShell ? pDocShell->GetDocument() : NULL;
-+ String aContent;
-+ excel::CompileExcelFormulaToODF( pDoc, sValue, aContent );
-+ if ( aContent.Len() > 0 )
- {
-- ::rtl::OUString sTmp = sValue.copy(1);
-- sValue = sTmp;
-+ sValue = aContent;
- }
-- nTo = sValue.indexOf( sSegmentation, nFrom );
-- while ( nTo != -1 )
-- {
-- ::rtl::OUString sTmpValue = sValue.copy( nFrom, nTo - nFrom );
-- sTmpValue = sTmpValue.replaceAt(0, (sSheetName + ::rtl::OUString::createFromAscii("!")).getLength(), sSheetName + ::rtl::OUString::createFromAscii("."));
-- if (sTmpValue.copy(0, sSheetName.getLength()).equals(sSheetName))
-- {
-- sTmpValue = ::rtl::OUString::createFromAscii("$") + sTmpValue;
-- }
-- sTmpValue += sNewSegmentation;
-- sResult += sTmpValue;
-- nFrom = nTo + 1;
-- nTo = sValue.indexOf( sSegmentation, nFrom );
-- }
-- ::rtl::OUString sTmpValue = sValue.copy( nFrom );
-- sTmpValue = sTmpValue.replaceAt(0, (sSheetName + ::rtl::OUString::createFromAscii("!")).getLength(), sSheetName + ::rtl::OUString::createFromAscii("."));
-- if (sTmpValue.copy(0, sSheetName.getLength()).equals(sSheetName))
-- {
-- sTmpValue = ::rtl::OUString::createFromAscii("$") + sTmpValue;
-- }
-- sResult += sTmpValue;
-- mxNamedRange->setContent(sResult);
-+ mxNamedRange->setContent( sValue );
- }
-
- ::rtl::OUString
-@@ -208,7 +171,7 @@ ScVbaName::setRefersToLocal( const ::rtl::OUString & rRefersTo ) throw (css::uno
- ::rtl::OUString
- ScVbaName::getRefersToR1C1() throw (css::uno::RuntimeException)
- {
-- return getRefersTo();
-+ return getValue( formula::FormulaGrammar::GRAM_NATIVE_XL_R1C1 );
- }
-
- void
-@@ -220,7 +183,7 @@ ScVbaName::setRefersToR1C1( const ::rtl::OUString & rRefersTo ) throw (css::uno:
- ::rtl::OUString
- ScVbaName::getRefersToR1C1Local() throw (css::uno::RuntimeException)
- {
-- return getRefersTo();
-+ return getValue( formula::FormulaGrammar::GRAM_NATIVE_XL_R1C1 );
- }
-
- void
-diff --git sc/source/ui/vba/vbaname.hxx sc/source/ui/vba/vbaname.hxx
-index 1378647..42ee8d1 100644
---- sc/source/ui/vba/vbaname.hxx
-+++ sc/source/ui/vba/vbaname.hxx
-@@ -33,6 +33,8 @@
-
- #include <vbahelper/vbahelperinterface.hxx>
-
-+#include <formula/grammar.hxx>
-+
- class ScDocument;
-
- typedef InheritedHelperInterfaceImpl1< ov::excel::XName > NameImpl_BASE;
-@@ -48,6 +50,8 @@ class ScVbaName : public NameImpl_BASE
- protected:
- virtual css::uno::Reference< css::frame::XModel > getModel() { return mxModel; }
- virtual css::uno::Reference< ov::excel::XWorksheet > getWorkSheet() throw (css::uno::RuntimeException);
-+ // Get value by FormulaGrammar, such as FormulaGrammar::GRAM_NATIVE_XL_R1C1
-+ virtual ::rtl::OUString SAL_CALL getValue(const formula::FormulaGrammar::Grammar eGrammar) throw (css::uno::RuntimeException);
-
- public:
- ScVbaName( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::sheet::XNamedRange >& xName , const css::uno::Reference< css::sheet::XNamedRanges >& xNames , const css::uno::Reference< css::frame::XModel >& xModel );
-diff --git sc/source/ui/vba/vbanames.cxx sc/source/ui/vba/vbanames.cxx
-index 6a32914..02c1728 100644
---- sc/source/ui/vba/vbanames.cxx
-+++ sc/source/ui/vba/vbanames.cxx
-@@ -87,6 +87,33 @@ ScVbaNames::getScDocument()
- return pViewData->GetDocument();
- }
-
-+void GetRangeOrRefersTo( const css::uno::Any& RefersTo, const uno::Reference< uno::XComponentContext >& xContext, css::uno::Reference< excel::XRange >& xRange, rtl::OUString& sRefersTo )
-+{
-+ if ( RefersTo.getValueTypeClass() == uno::TypeClass_STRING )
-+ {
-+ RefersTo >>= sRefersTo;
-+ }
-+ else if ( RefersTo.getValueTypeClass() == uno::TypeClass_INTERFACE )
-+ {
-+ RefersTo >>= xRange;
-+ }
-+ else if ( RefersTo.hasValue() )
-+ {
-+ uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( xContext );
-+ try
-+ {
-+ if ( xConverter.is() )
-+ {
-+ uno::Any aConverted = xConverter->convertTo( RefersTo, getCppuType((rtl::OUString*)0) );
-+ aConverted >>= sRefersTo;
-+ }
-+ }
-+ catch( uno::Exception& )
-+ {
-+ }
-+ }
-+}
-+
- css::uno::Any
- ScVbaNames::Add( const css::uno::Any& Name ,
- const css::uno::Any& RefersTo,
-@@ -100,8 +127,9 @@ ScVbaNames::Add( const css::uno::Any& Name ,
- const css::uno::Any& RefersToR1C1,
- const css::uno::Any& RefersToR1C1Local ) throw (css::uno::RuntimeException)
- {
--
-+ rtl::OUString sSheetName;
- rtl::OUString sName;
-+ rtl::OUString sRefersTo;
- uno::Reference< excel::XRange > xRange;
- if ( Name.hasValue() )
- Name >>= sName;
-@@ -109,6 +137,12 @@ ScVbaNames::Add( const css::uno::Any& Name ,
- NameLocal >>= sName;
- if ( sName.getLength() != 0 )
- {
-+ sal_Int32 nTokenIndex = sName.indexOf('!');
-+ if ( nTokenIndex >= 0 )
-+ {
-+ sSheetName = sName.copy( 0, nTokenIndex );
-+ sName = sName.copy( nTokenIndex + 1 );
-+ }
- if ( !ScRangeData::IsNameValid( sName , getScDocument() ) )
- {
- ::rtl::OUString sResult ;
-@@ -121,19 +155,22 @@ ScVbaNames::Add( const css::uno::Any& Name ,
- sResult = sName.copy( nIndex );
- sName = sResult ;
- if ( !ScRangeData::IsNameValid( sName , getScDocument() ) )
-- throw uno::RuntimeException( rtl::OUString::createFromAscii("This Name is a valid ."), uno::Reference< uno::XInterface >() );
-+ throw uno::RuntimeException( rtl::OUString::createFromAscii("This Name is a invalid ."), uno::Reference< uno::XInterface >() );
- }
- }
- if ( RefersTo.hasValue() || RefersToR1C1.hasValue() || RefersToR1C1Local.hasValue() )
- {
- if ( RefersTo.hasValue() )
-- RefersTo >>= xRange;
-+ GetRangeOrRefersTo( RefersTo, mxContext, xRange, sRefersTo );
- if ( RefersToR1C1.hasValue() )
-- RefersToR1C1 >>= xRange;
-+ GetRangeOrRefersTo( RefersToR1C1, mxContext, xRange, sRefersTo );
- if ( RefersToR1C1Local.hasValue() )
-- RefersToR1C1Local >>= xRange;
-+ GetRangeOrRefersTo( RefersToR1C1Local, mxContext, xRange, sRefersTo );
- }
-
-+ String aContent;
-+ table::CellAddress aPosition;
-+ RangeType nType = RT_NAME;
- if ( xRange.is() )
- {
- ScVbaRange* pRange = dynamic_cast< ScVbaRange* >( xRange.get() );
-@@ -146,19 +183,36 @@ ScVbaNames::Add( const css::uno::Any& Name ,
- ScAddress aPos( static_cast< SCCOL >( aAddr.StartColumn ) , static_cast< SCROW >( aAddr.StartRow ) , static_cast< SCTAB >(aAddr.Sheet ) );
- uno::Any xAny2 ;
- String sRangeAdd = xRange->Address( xAny2, xAny2 , xAny2 , xAny2, xAny2 );
-- String sTmp;
-- sTmp += String::CreateFromAscii("$");
-- sTmp += UniString(xRange->getWorksheet()->getName());
-- sTmp += String::CreateFromAscii(".");
-- sTmp += sRangeAdd;
-- if ( mxNames.is() )
-+ aContent += String::CreateFromAscii("$");
-+ aContent += UniString(xRange->getWorksheet()->getName());
-+ aContent += String::CreateFromAscii(".");
-+ aContent += sRangeAdd;
-+ aPosition = table::CellAddress( aAddr.Sheet , aAddr.StartColumn , aAddr.StartRow );
-+ }
-+ else
-+ {
-+ ScDocShell* pDocShell = excel::getDocShell( mxModel );
-+ ScDocument* pDoc = pDocShell ? pDocShell->GetDocument() : NULL;
-+ excel::CompileExcelFormulaToODF( pDoc, sRefersTo, aContent );
-+ if ( aContent.Len() == 0 )
- {
-- RangeType nType = RT_NAME;
-- table::CellAddress aCellAddr( aAddr.Sheet , aAddr.StartColumn , aAddr.StartRow );
-- if ( mxNames->hasByName( sName ) )
-- mxNames->removeByName(sName);
-- mxNames->addNewByName( sName , rtl::OUString(sTmp) , aCellAddr , (sal_Int32)nType);
-+ aContent = sRefersTo;
- }
-+ }
-+
-+ uno::Reference< sheet::XNamedRange > xNewNamedRange;
-+ if ( mxNames.is() )
-+ {
-+ if ( mxNames->hasByName( sName ) )
-+ {
-+ mxNames->removeByName( sName );
-+ }
-+ mxNames->addNewByName( sName, rtl::OUString( aContent ), aPosition, (sal_Int32) nType );
-+ xNewNamedRange = uno::Reference< sheet::XNamedRange >( mxNames->getByName( sName ), uno::UNO_QUERY );
-+ }
-+ if ( xNewNamedRange.is() )
-+ {
-+ return uno::makeAny( uno::Reference< excel::XName >( new ScVbaName( mxParent, mxContext, xNewNamedRange ,mxNames , mxModel ) ) );
- }
- return css::uno::Any();
- }
-diff --git sc/source/ui/vba/vbaoleobject.cxx sc/source/ui/vba/vbaoleobject.cxx
-index 9ca23d9..4e0ee2e 100644
---- sc/source/ui/vba/vbaoleobject.cxx
-+++ sc/source/ui/vba/vbaoleobject.cxx
-@@ -67,7 +67,7 @@ ScVbaOLEObject::ScVbaOLEObject( const uno::Reference< XHelperInterface >& xParen
- uno::Reference< uno::XInterface > SAL_CALL
- ScVbaOLEObject::getObject() throw (uno::RuntimeException)
- {
-- return uno::Reference< uno::XInterface >( m_xControlShape, uno::UNO_QUERY_THROW );
-+ return uno::Reference< uno::XInterface >( m_xControl, uno::UNO_QUERY_THROW );
- }
-
- sal_Bool SAL_CALL
-diff --git sc/source/ui/vba/vbarange.cxx sc/source/ui/vba/vbarange.cxx
-index fe1a89d..1dfbc79 100755
---- sc/source/ui/vba/vbarange.cxx
-+++ sc/source/ui/vba/vbarange.cxx
-@@ -50,6 +50,7 @@
- #include <com/sun/star/sheet/XSheetCellCursor.hpp>
- #include <com/sun/star/sheet/XArrayFormulaRange.hpp>
- #include <com/sun/star/sheet/XNamedRange.hpp>
-+#include <com/sun/star/sheet/XNamedRanges.hpp>
- #include <com/sun/star/sheet/XPrintAreas.hpp>
- #include <com/sun/star/sheet/XCellRangesQuery.hpp>
- #include <com/sun/star/beans/XPropertySet.hpp>
-@@ -176,6 +177,8 @@
-
- #include "vbaglobals.hxx"
- #include "vbastyle.hxx"
-+#include "vbaname.hxx"
-+#include "vbanames.hxx"
- #include <vector>
- #include <vbahelper/vbacollectionimpl.hxx>
- // begin test includes
-@@ -1472,7 +1475,53 @@ ScVbaRange::visitArray( ArrayVisitor& visitor )
- }
- }
-
-+uno::Any SAL_CALL ScVbaRange::getName() throw (uno::RuntimeException)
-+{
-+ uno::Reference< excel::XName > xName;
-+
-+ ScDocShell* pDocShell = getScDocShell();
-+ uno::Reference< frame::XModel > xModel = pDocShell ? pDocShell->GetModel() : NULL;
-+ if ( !xModel.is() )
-+ {
-+ throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid document" ), uno::Reference< uno::XInterface >() );
-+ }
-+ uno::Reference< beans::XPropertySet > xPropertySet( xModel, uno::UNO_QUERY_THROW );
-+ uno::Reference< sheet::XNamedRanges > xNamedRanges( xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("NamedRanges")) , uno::UNO_QUERY_THROW );
-
-+ uno::Reference< excel::XNames > xNames( new ScVbaNames( uno::Reference< XHelperInterface >(), mxContext , xNamedRanges , xModel ) );
-+ sal_Int32 nCount = xNames->getCount();
-+ ScCellRangesBase* pUnoRangesBase = getCellRangesBase();
-+ if ( pUnoRangesBase && nCount > 0 )
-+ {
-+ ScRangeList aRangeList = pUnoRangesBase->GetRangeList();
-+ for ( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
-+ {
-+ uno::Reference< excel::XName > xTmpName( xNames->Item( uno::makeAny( nIndex + 1 ), uno::Any() ), uno::UNO_QUERY );
-+ if ( xTmpName.is() )
-+ {
-+ try
-+ {
-+ uno::Reference< excel::XRange > xRange = xTmpName->getRefersToRange();
-+ if ( xRange.is() )
-+ {
-+ ScVbaRange* pRange = dynamic_cast< ScVbaRange* >( xRange.get() );
-+ ScCellRangesBase* pCurRangesBase = pRange ? pRange->getCellRangesBase() : NULL;
-+ if ( pCurRangesBase && aRangeList == pCurRangesBase->GetRangeList() )
-+ {
-+ xName = xTmpName;
-+ break;
-+ }
-+ }
-+ }
-+ catch (const uno::Exception&)
-+ {
-+ }
-+ }
-+ }
-+ }
-+
-+ return uno::makeAny( xName );
-+}
-
- uno::Any
- ScVbaRange::getValue( ValueGetter& valueGetter) throw (uno::RuntimeException)
-@@ -2129,24 +2178,42 @@ ScVbaRange::Cells( const uno::Any &nRowIndex, const uno::Any &nColumnIndex ) thr
- // set in the Any, we should convert as appropriate
- // #FIXME - perhaps worth turning this into some sort of
- // convertion routine e.g. bSuccess = getValueFromAny( nRow, nRowIndex, getCppuType((sal_Int32*)0) )
-- if ( nRowIndex.hasValue() && !( nRowIndex >>= nRow ) )
-+ uno::Any aRowIndexAny = nRowIndex;
-+ if ( aRowIndexAny.getValueTypeClass() == uno::TypeClass_INTERFACE )
-+ {
-+ try
-+ {
-+ aRowIndexAny = getDefaultPropByIntrospection( aRowIndexAny );
-+ }
-+ catch( uno::Exception& ) {}
-+ }
-+ if ( aRowIndexAny.hasValue() && !( aRowIndexAny >>= nRow ) )
- {
- uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( mxContext );
- uno::Any aConverted;
- try
- {
-- aConverted = xConverter->convertTo( nRowIndex, getCppuType((sal_Int32*)0) );
-+ aConverted = xConverter->convertTo( aRowIndexAny, getCppuType((sal_Int32*)0) );
- bIsIndex = ( aConverted >>= nRow );
- }
- catch( uno::Exception& ) {} // silence any errors
- }
-- if ( bIsColumnIndex && !( nColumnIndex >>= nColumn ) )
-+ uno::Any aColumnAny = nColumnIndex;
-+ if ( aColumnAny.getValueTypeClass() == uno::TypeClass_INTERFACE )
-+ {
-+ try
-+ {
-+ aColumnAny = getDefaultPropByIntrospection( aColumnAny );
-+ }
-+ catch( uno::Exception& ) {}
-+ }
-+ if ( bIsColumnIndex && !( aColumnAny >>= nColumn ) )
- {
- uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( mxContext );
- uno::Any aConverted;
- try
- {
-- aConverted = xConverter->convertTo( nColumnIndex, getCppuType((sal_Int32*)0) );
-+ aConverted = xConverter->convertTo( aColumnAny, getCppuType((sal_Int32*)0) );
- bIsColumnIndex = ( aConverted >>= nColumn );
- }
- catch( uno::Exception& ) {} // silence any errors
-@@ -2463,9 +2530,11 @@ ScVbaRange::Copy(const ::uno::Any& Destination) throw (uno::RuntimeException)
- }
- else
- {
-+ ScRange aRange;
-+ RangeHelper thisRange( mxRange );
-+ ScUnoConversion::FillScRange( aRange, thisRange.getCellRangeAddressable()->getRangeAddress() );
- uno::Reference< frame::XModel > xModel = excel::GetModelFromRange( mxRange );
-- Select();
-- excel::implnCopy( xModel );
-+ excel::implnCopyRange( xModel, aRange );
- }
- }
-
-diff --git sc/source/ui/vba/vbarange.hxx sc/source/ui/vba/vbarange.hxx
-index 50b18ba..eb6999d 100644
---- sc/source/ui/vba/vbarange.hxx
-+++ sc/source/ui/vba/vbarange.hxx
-@@ -154,7 +154,8 @@ public:
- formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_XL_A1 ) throw ( css::uno::RuntimeException );
- css::table::CellAddress getLeftUpperCellAddress();
-
-- // Attributes
-+ // Attributes
-+ virtual css::uno::Any SAL_CALL getName() throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setValue( const css::uno::Any& aValue ) throw ( css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getFormula() throw (css::uno::RuntimeException);
-diff --git sc/source/ui/view/viewfun3.cxx sc/source/ui/view/viewfun3.cxx
-index 4c353f0..e8aa10e 100644
---- sc/source/ui/view/viewfun3.cxx
-+++ sc/source/ui/view/viewfun3.cxx
-@@ -502,6 +502,76 @@ BOOL ScViewFunc::CopyToClip( ScDocument* pClipDoc, BOOL bCut, BOOL bApi, BOOL bI
- {
- if (!bApi)
- ErrorMessage(STR_NOMULTISELECT);
-+ }
-+
-+ return bDone;
-+}
-+
-+// Copy the content of the Range into clipboard. Adding this method for VBA API: Range.Copy().
-+BOOL ScViewFunc::CopyToClip( ScDocument* pClipDoc, const ScRange& rRange, BOOL bCut, BOOL bApi, BOOL bIncludeObjects, BOOL bStopEdit )
-+{
-+ BOOL bDone = FALSE;
-+ if ( bStopEdit )
-+ UpdateInputLine();
-+
-+ ScRange aRange = rRange;
-+ ScDocument* pDoc = GetViewData()->GetDocument();
-+ if ( pDoc && !pDoc->HasSelectedBlockMatrixFragment( aRange.aStart.Col(), aRange.aStart.Row(), aRange.aEnd.Col(), aRange.aEnd.Row(), aRange.aStart.Tab() ) )
-+ {
-+ BOOL bSysClip = FALSE;
-+ if ( !pClipDoc )
-+ {
-+ // Create one (deleted by ScTransferObj).
-+ pClipDoc = new ScDocument( SCDOCMODE_CLIP );
-+ bSysClip = TRUE;
-+ }
-+ if ( !bCut )
-+ {
-+ ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
-+ if ( pChangeTrack )
-+ pChangeTrack->ResetLastCut();
-+ }
-+
-+ if ( bSysClip && bIncludeObjects )
-+ {
-+ BOOL bAnyOle = pDoc->HasOLEObjectsInArea( aRange );
-+ // Update ScGlobal::pDrawClipDocShellRef.
-+ ScDrawLayer::SetGlobalDrawPersist( ScTransferObj::SetDrawClipDoc( bAnyOle ) );
-+ }
-+
-+ ScClipParam aClipParam( aRange, bCut );
-+ pDoc->CopyToClip4VBA( aClipParam, pClipDoc, false, bIncludeObjects );
-+ if ( bSysClip )
-+ {
-+ ScDrawLayer::SetGlobalDrawPersist(NULL);
-+ ScGlobal::SetClipDocName( pDoc->GetDocumentShell()->GetTitle( SFX_TITLE_FULLNAME ) );
-+ }
-+ pClipDoc->ExtendMerge( aRange, TRUE );
-+
-+ if ( bSysClip )
-+ {
-+ ScDocShell* pDocSh = GetViewData()->GetDocShell();
-+ TransferableObjectDescriptor aObjDesc;
-+ pDocSh->FillTransferableObjectDescriptor( aObjDesc );
-+ aObjDesc.maDisplayName = pDocSh->GetMedium()->GetURLObject().GetURLNoPass();
-+
-+ ScTransferObj* pTransferObj = new ScTransferObj( pClipDoc, aObjDesc );
-+ uno::Reference<datatransfer::XTransferable> xTransferable( pTransferObj );
-+ if ( ScGlobal::pDrawClipDocShellRef )
-+ {
-+ SfxObjectShellRef aPersistRef( &(*ScGlobal::pDrawClipDocShellRef) );
-+ pTransferObj->SetDrawPersist( aPersistRef );
-+ }
-+ pTransferObj->CopyToClipboard( GetActiveWin() );
-+ SC_MOD()->SetClipObject( pTransferObj, NULL );
-+ }
-+
-+ bDone = TRUE;
-+ }
-+ else
-+ {
-+ if ( !bApi )
-+ ErrorMessage(STR_MATRIXFRAGMENTERR);
- }
-
- return bDone;
-diff --git vbahelper/inc/vbahelper/vbahelper.hxx vbahelper/inc/vbahelper/vbahelper.hxx
-index e13e847..4ec41a9 100644
---- vbahelper/inc/vbahelper/vbahelper.hxx
-+++ vbahelper/inc/vbahelper/vbahelper.hxx
-@@ -112,6 +112,7 @@ namespace ooo
- VBAHELPER_DLLPUBLIC sal_Int32 getPointerStyle( const css::uno::Reference< css::frame::XModel >& );
- VBAHELPER_DLLPUBLIC void setCursorHelper( const css::uno::Reference< css::frame::XModel >& xModel, const Pointer& rPointer, sal_Bool bOverWrite );
- VBAHELPER_DLLPUBLIC void setDefaultPropByIntrospection( const css::uno::Any& aObj, const css::uno::Any& aValue ) throw ( css::uno::RuntimeException );
-+ VBAHELPER_DLLPUBLIC css::uno::Any getDefaultPropByIntrospection( const css::uno::Any& aObj ) throw ( css::uno::RuntimeException );
- VBAHELPER_DLLPUBLIC css::uno::Any getPropertyValue( const css::uno::Sequence< css::beans::PropertyValue >& aProp, const rtl::OUString& aName );
- VBAHELPER_DLLPUBLIC sal_Bool setPropertyValue( css::uno::Sequence< css::beans::PropertyValue >& aProp, const rtl::OUString& aName, const css::uno::Any& aValue );
- VBAHELPER_DLLPUBLIC void setOrAppendPropertyValue( css::uno::Sequence< css::beans::PropertyValue >& aProp, const rtl::OUString& aName, const css::uno::Any& aValue );
-diff --git vbahelper/source/msforms/vbauserform.cxx vbahelper/source/msforms/vbauserform.cxx
-index db98591..5e14d80 100644
---- vbahelper/source/msforms/vbauserform.cxx
-+++ vbahelper/source/msforms/vbauserform.cxx
-@@ -27,6 +27,7 @@
- #include <vbahelper/helperdecl.hxx>
- #include "vbauserform.hxx"
- #include <com/sun/star/awt/XControl.hpp>
-+#include <com/sun/star/awt/XWindow2.hpp>
- #include <com/sun/star/beans/PropertyConcept.hpp>
- #include <com/sun/star/container/XNameContainer.hpp>
- #include <basic/sbx.hxx>
-@@ -106,6 +107,24 @@ ScVbaUserForm::Hide( ) throw (uno::RuntimeException)
- m_xDialog->endExecute();
- }
-
-+sal_Bool SAL_CALL ScVbaUserForm::getVisible() throw (uno::RuntimeException)
-+{
-+ uno::Reference< awt::XWindow2 > xWindow2( getWindowPeer(), uno::UNO_QUERY_THROW );
-+ return xWindow2->isVisible();
-+}
-+
-+void SAL_CALL ScVbaUserForm::setVisible( sal_Bool bVisible ) throw (uno::RuntimeException)
-+{
-+ if ( bVisible )
-+ {
-+ Show();
-+ }
-+ else
-+ {
-+ Hide();
-+ }
-+}
-+
- void SAL_CALL
- ScVbaUserForm::RePaint( ) throw (uno::RuntimeException)
- {
-diff --git vbahelper/source/msforms/vbauserform.hxx vbahelper/source/msforms/vbauserform.hxx
-index ccc853e..bd609ad 100644
---- vbahelper/source/msforms/vbauserform.hxx
-+++ vbahelper/source/msforms/vbauserform.hxx
-@@ -50,6 +50,8 @@ public:
- ScVbaUserForm( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext ) throw ( css::lang::IllegalArgumentException );
- virtual ~ScVbaUserForm();
- static css::uno::Reference< css::awt::XControl > nestedSearch( const rtl::OUString& aPropertyName, css::uno::Reference< css::awt::XControlContainer >& xContainer );
-+ virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException);
-+ virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (css::uno::RuntimeException);
- // XUserForm
- virtual void SAL_CALL RePaint( ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Show( ) throw (css::uno::RuntimeException);
-diff --git vbahelper/source/vbahelper/vbadocumentsbase.cxx vbahelper/source/vbahelper/vbadocumentsbase.cxx
-index d3eb535..b7686c2 100644
---- vbahelper/source/vbahelper/vbadocumentsbase.cxx
-+++ vbahelper/source/vbahelper/vbadocumentsbase.cxx
-@@ -50,6 +50,7 @@
- #include <sfx2/objsh.hxx>
- #include <tools/urlobj.hxx>
- #include <vbahelper/vbahelper.hxx>
-+#include <vbahelper/vbadocumentbase.hxx>
- #include <hash_map>
- #include <osl/file.hxx>
-
-@@ -144,18 +145,13 @@ public:
- {
- uno::Reference< frame::XModel > xModel( xServiceInfo, uno::UNO_QUERY_THROW ); // that the spreadsheetdocument is a xmodel is a given
- m_documents.push_back( xModel );
-- rtl::OUString sName = xModel->getURL();
-- if( sName.getLength() )
-- {
-- INetURLObject aURL( xModel->getURL() );
-- namesToIndices[ aURL.GetLastName() ] = nIndex++;
-- }
-- else
-- {
-- uno::Reference< frame::XTitle > xTitle( xModel, uno::UNO_QUERY_THROW );
-- sName = xTitle->getTitle();
-- namesToIndices[ sName ] = nIndex++;
-- }
-+ rtl::OUString sName;
-+ uno::Reference< ::ooo::vba::XDocumentBase > xVbaDocument = new VbaDocumentBase( uno::Reference< XHelperInterface >(), xContext, xModel );
-+ if ( xVbaDocument.is() )
-+ {
-+ sName = xVbaDocument->getName();
-+ }
-+ namesToIndices[ sName ] = nIndex++;
- }
- }
-
-diff --git vbahelper/source/vbahelper/vbahelper.cxx vbahelper/source/vbahelper/vbahelper.cxx
-index 2dc02a0..ed90dc5 100644
---- vbahelper/source/vbahelper/vbahelper.cxx
-+++ vbahelper/source/vbahelper/vbahelper.cxx
-@@ -971,6 +971,23 @@ void setDefaultPropByIntrospection( const uno::Any& aObj, const uno::Any& aValue
- throw uno::RuntimeException();
- }
-
-+uno::Any getDefaultPropByIntrospection( const uno::Any& aObj ) throw ( uno::RuntimeException )
-+{
-+ uno::Any aValue;
-+ uno::Reference< beans::XIntrospectionAccess > xUnoAccess( getIntrospectionAccess( aObj ) );
-+ uno::Reference< script::XDefaultProperty > xDefaultProperty( aObj, uno::UNO_QUERY_THROW );
-+ uno::Reference< beans::XPropertySet > xPropSet;
-+
-+ if ( xUnoAccess.is() )
-+ xPropSet.set( xUnoAccess->queryAdapter( ::getCppuType( (const uno::Reference< beans::XPropertySet > *)0 ) ), uno::UNO_QUERY );
-+
-+ if ( xPropSet.is() )
-+ aValue = xPropSet->getPropertyValue( xDefaultProperty->getDefaultPropertyName() );
-+ else
-+ throw uno::RuntimeException();
-+ return aValue;
-+}
-+
- uno::Any getPropertyValue( const uno::Sequence< beans::PropertyValue >& aProp, const rtl::OUString& aName )
- {
- uno::Any result;