[ooo-build-commit] patches/dev300 patches/vba
Pei Feng Lin
pflin at kemper.freedesktop.org
Fri Jul 10 02:17:52 PDT 2009
patches/dev300/apply | 4 +
patches/vba/vba-buildin-toolbar-fix.diff | 81 ++++++++++++++++++++++++++
patches/vba/vba-workbook-auto-open-event.diff | 67 +++++++++++++++++++++
3 files changed, 152 insertions(+)
New commits:
commit 835cd29b3036ce137d42bf16c91ce8cb68e462fc
Author: Fong Lin <pflin at novell.com>
Date: Fri Jul 10 17:17:11 2009 +0800
support workbook auto_open event and buildin toolbar. n#520228.
* patches/dev300/apply:
* patches/vba/vba-buildin-toolbar-fix.diff:
* patches/vba/vba-workbook-auto-open-event.diff:
diff --git a/patches/dev300/apply b/patches/dev300/apply
index bae8666..d156c3f 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -1866,6 +1866,10 @@ vba-cursor-pos-for-selected-maxrange.diff
writer-uno-numberingrule-bulletid.diff, i#103021, Fong
# fix combox binding data import in userform
vba-combobox-rowsource-fix.diff, Fong
+# support workbook auto_open event
+vba-workbook-auto-open-event.diff, n#520228, Fong
+# support buildin toolbar in CommandBar object
+vba-buildin-toolbar-fix.diff, n#520228, Fong
[VBAUntested]
SectionOwner => noelpwer
# doesn't work
diff --git a/patches/vba/vba-buildin-toolbar-fix.diff b/patches/vba/vba-buildin-toolbar-fix.diff
new file mode 100644
index 0000000..222fb2b
--- /dev/null
+++ b/patches/vba/vba-buildin-toolbar-fix.diff
@@ -0,0 +1,81 @@
+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-workbook-auto-open-event.diff b/patches/vba/vba-workbook-auto-open-event.diff
new file mode 100644
index 0000000..f54130d
--- /dev/null
+++ b/patches/vba/vba-workbook-auto-open-event.diff
@@ -0,0 +1,67 @@
+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 );
More information about the ooo-build-commit
mailing list